ソースを参照

part 1 & 2 done

Kate Moore 6 年 前
コミット
e694d1e7dd
共有4 個のファイルを変更した563 個の追加0 個の削除を含む
  1. 55
    0
      src/main/java/io/zipcoder/ParenChecker.java
  2. 11
    0
      src/main/java/io/zipcoder/WC.java
  3. 467
    0
      src/main/resources/someTextFile.txt
  4. 30
    0
      src/test/java/io/zipcoder/ParenCheckerTest.java

+ 55
- 0
src/main/java/io/zipcoder/ParenChecker.java ファイルの表示

@@ -1,4 +1,59 @@
1 1
 package io.zipcoder;
2 2
 
3
+import java.util.Stack;
4
+
3 5
 public class ParenChecker {
6
+
7
+
8
+
9
+    public static boolean checkParen(String s){
10
+        Stack<Character> stack = new Stack<Character>();
11
+
12
+        for(int i = 0; i< s.length(); i++) {
13
+            char c = s.charAt(i);
14
+            if(c == '(') {
15
+                stack.push(c);
16
+            } else if(c == ')') {
17
+                if(stack.isEmpty() || stack.pop() != '(') {
18
+                    return false;
19
+                }
20
+            }
21
+        }
22
+        return stack.isEmpty();
23
+    }
24
+
25
+    public static boolean checkAll(String s) {
26
+        Stack<Character> stack = new Stack<Character>();
27
+
28
+        for(int i = 0; i < s.length(); i++) {
29
+            char c = s.charAt(i);
30
+            if(c == '(' || c == '{' || c == '[' || c == '<' || c == '"') {
31
+                stack.push(c);
32
+            } else if(c == ')') {
33
+                if(stack.isEmpty() || stack.pop() != '(') {
34
+                    return false;
35
+                } else if(c == '}') {
36
+                    if(stack.isEmpty() || stack.pop() != '{') {
37
+                        return false;
38
+                    } else if(c == ']') {
39
+                        if(stack.isEmpty() || stack.pop() != '[') {
40
+                            return false;
41
+                        } else if(c == '>') {
42
+                            if(stack.isEmpty() || stack.pop() != '<') {
43
+                                return false;
44
+                            } else if(c == '"') {
45
+                                if(stack.isEmpty() || stack.pop() != '"') {
46
+                                    return false;
47
+                                }
48
+                            }
49
+                        }
50
+                    }
51
+                }
52
+            }
53
+        }
54
+
55
+        return stack.isEmpty();
56
+    }
57
+
58
+
4 59
 }

+ 11
- 0
src/main/java/io/zipcoder/WC.java ファイルの表示

@@ -2,15 +2,23 @@ package io.zipcoder;
2 2
 
3 3
 import java.io.FileNotFoundException;
4 4
 import java.io.FileReader;
5
+import java.util.HashMap;
5 6
 import java.util.Iterator;
7
+import java.util.Map;
6 8
 import java.util.Scanner;
7 9
 
8 10
 public class WC {
9 11
     private Iterator<String> si;
10 12
 
13
+    Map<String, Integer> map = new HashMap<String, Integer>();
14
+
15
+
16
+
11 17
     public WC(String fileName) {
12 18
         try {
13 19
             this.si = new Scanner(new FileReader(fileName));
20
+
21
+
14 22
         } catch (FileNotFoundException e) {
15 23
             System.out.println(fileName + " Does Not Exist");
16 24
             System.exit(-1);
@@ -20,4 +28,7 @@ public class WC {
20 28
     public WC(Iterator<String> si) {
21 29
         this.si = si;
22 30
     }
31
+
32
+
33
+
23 34
 }

+ 467
- 0
src/main/resources/someTextFile.txt ファイルの表示

@@ -0,0 +1,467 @@
1
+SEPTEMBER
2
+The barren, sterile emotions which Art gives us, though they have the
3
+advantage of harmlessness over the emotions of Life itself, that tree of
4
+sweet and bitter fruits, bear with them the inherent defects of their
5
+unreality; and whereas there is hardly an emotion of Life which does not
6
+leave us stronger and more vivified, there is hardly an emotion of Art
7
+where one’s senses are stirred, not by actual events of joy or sorrow,
8
+but the imagined scenes thereof, which does not leave us flat and
9
+unbraced in proportion as the emotion excited has been keen. Love and
10
+death, the two great _motifs_ on which the drama of Life is based,
11
+whether they are whispered on the shivering strings, or piped on remote
12
+flutes, or thundered with the blast of trumpets and the clash of
13
+cymbals, leave us, when such actual experience has touched us, the
14
+richer for it, and stronger and more vivified. But such is not the case
15
+in the reflection of experience which Art gives us; vivid it may be--so
16
+vivid, indeed, that reality after it seems shadow-like and unreal--but
17
+its life is temporary. We thrill with ecstasies that are not really
18
+ours; our soul, in its secret place, sickens with sin or withers with
19
+renunciations which are not its own; and when the mimic spectacle is
20
+over, and we wake from the storms or sunshine of a coloured dream to a
21
+gray morning, and have to take up again the dispiriting thread of
22
+uneventful hours, it is with an intolerable sense of flatness that we at
23
+first look out over the undistinguished landscape of life. For a week,
24
+perhaps, or a fortnight, we have agonized with the throes of Titans;
25
+monstrous joys and sorrows have been our portion, and for the monstrous
26
+we take up again the minute. We have been burning with alien fires and
27
+passions not our own: the temptation of Kundry has shaken us; the sorrow
28
+of Wotan, as wide as the world and as bitter as the sea, has for the
29
+time been ours; we have been laid to sleep on a mountain-top, like
30
+Brunehilde, and, like Siegfried, have dreamed in the green shade of
31
+woods until the voice of Nature has become intelligible, and the
32
+twittering of birds articulate through the murmur of the forest. The
33
+quintessence of human emotion, in all its terror and beauty, has shaken
34
+and enthralled us. Then--then the curtain came down, and we go out again
35
+into the real world, which for the time Art has rendered shadow-like,
36
+where a hundred petty duties await us, in no way refreshed or strung up
37
+for their accomplishment, but impatient, irritated, and bored.
38
+
39
+Such, at least, were my own feelings when on a morning I awoke and
40
+remembered (what at first seemed incredible) that there was to be no
41
+opera that day, and that the curtain was down on the stage at Bayreuth
42
+for two years. The little backwater of a town, which on arrival had
43
+seemed so instinct with such sweet repose and tranquillity, was
44
+insupportable: its tranquillity was the stagnation of decay; its repose
45
+a creeping death-trance, with gray nightmare to ride its rest. Instead
46
+of finding that the fiery dreams of the last fortnight had gilded its
47
+streets and woven themselves into its gardens and trellises, it appeared
48
+to me merely the most dismal little sun-baked suburb I had ever seen. A
49
+glorious lamp had burned there, but the lamp was quenched, and instead
50
+of a reflection of its light lingering there, there was only a smell of
51
+oil. But the immediate and vital question was what to do and where to
52
+go. I could not imagine myself finding existence tolerable anywhere, and
53
+least of all, perhaps, could I imagine myself back in England in my own
54
+quiet little house in the country town, since for the time being, at any
55
+rate, all the minute pleasures which had built up that delightful life
56
+and made it so full of happiness were incomprehensible. Not long ago a
57
+quiet morning of work, with glances into the garden to see what new
58
+plant had flowered, a game of golf over the breezy down, the face of a
59
+friend, the hundred details of my life which I have tried to describe in
60
+these pages, were overflowingly sufficient to make me more than content.
61
+But now there was exasperation in the very multitude of them. And all
62
+the time there were, so to speak, images of glorious brightness shut
63
+away in some dark place of my brain. The Valkyries were there and
64
+Parsifal, Hans Sachs, mellow and unembittered, looked on the love of
65
+others and smiled, and Walter sang of spring-time, and everywhere was
66
+melody.
67
+
68
+Here, if you please, is egotism _in excelsis_, for I solemnly told
69
+myself that, instead of going back home like a sober and average person,
70
+I was bound--no less--to go somewhere and to do something by which I
71
+could the more fully apprehend and crystallize these images; and the
72
+grounds on which I put this to myself--that is my only excuse--were
73
+genuine. For I believe that one of the main duties of man to God and to
74
+himself is to realize beauty and understand it, and that one of his main
75
+duties to his neighbour is to produce beauty in some shape or form,
76
+moral, mental, or physical--if, indeed, there is any real difference
77
+between them. The last fortnight had given me new material; that part of
78
+me which is capable in its small way of feeling beauty had been shown
79
+wonderful things. If I went back home to the ordinary routine of daily
80
+life, I felt that I should not only do my part in it exceedingly ill,
81
+but also that the monotony and triviality of it would tarnish and dull
82
+the brightness of my new possessions. In other words, I began--a solemn
83
+prig--to think about my artistic temperament, and make plans for its
84
+well-being. And that confession made--in the hope that _Qui s’accuse
85
+s’excuse_ in some small degree--the mind-narrative can go on its way. My
86
+body--after an effusion of telegrams--sped South to the house of a
87
+friend in Capri, where it arrived two days later.
88
+
89
+       *       *       *       *       *
90
+
91
+Here in this remote island, separated by a few leagues of sea only from
92
+that vividly modern and restless place called Naples, can be recaptured
93
+without effort something of the early days of the world, and from the
94
+steamer one steps out of all the responsibilities and codes which the
95
+stupidity and wickedness of mankind have built up, into paganism and
96
+fairyland. The gray walls compounded of priggishness and puritanism (yet
97
+knitted together with the mortar of good intentions and morality) with
98
+which this civilized century has fortressed itself fall as the walls of
99
+Jericho fell at the blast of the trumpet, and there is left sunlight and
100
+sea and the beauty of the seven days of creation, which was pronounced
101
+by God to be good.
102
+
103
+The red, waxlike flowers of the pomegranate are in full bloom, and as
104
+evening falls they glow like hot coals over the rough stone walls that
105
+bound the path up to Capri, where the green lizards slip in and out. The
106
+smell of the vines is in the air, heavy and warm, and once or twice as I
107
+walked through the dusky trellises my heart hammered in me, for I knew
108
+that but a little more and I should see Dionysus himself, with the
109
+vine-leaves in his hair, and delicate hand holding the cup that brimmed
110
+with purple; and at noonday often have I all but seen in the
111
+briar-decked clefts of rock the great god Pan himself, to the music of
112
+whose fluting the whole world dances. Up and down their steep paths,
113
+with head erect beneath the wine-jars, walk the maidens of Capri, and
114
+something of Aphrodite lives in their wine-painted faces and moulded
115
+bosoms; and young Apollo, bare-footed and splashed to the knee in the
116
+trodden vats, strips the nut-husks off with his gleaming teeth, and
117
+looks at the passer-by with brown soft eye. He has pushed a pomegranate
118
+flower behind his ear, and his shirt is open, so that the smooth brown
119
+breast is seen. What thoughts fill day by day that gay, lazy Italian
120
+brain? He is not religious, although he goes to Mass most regularly,
121
+for from Mass he passes back again to paganism; and he only goes there
122
+because he is a child and is vaguely afraid--or would be if he did not
123
+go to Mass--of what the priests have told him about a remote bogie--for
124
+so God seems to him--who can make him burn in unquenchable fires if he
125
+does not. Nor does he weary his mind with any question of morality or
126
+code of ethics: the sun is warm to him, or, if the sun be hot, the shade
127
+is cool, and the almond fruit is sweet, and the fumes of the fermenting
128
+vats mysteriously exciting, and the maiden with whom he is in treaty to
129
+wed very fair and loving, and her dowry is good. And for the passer-by
130
+he has his bright smile, and the expression of his hope that I have
131
+enjoyed my bathe. No, he has not bathed to-day, for the work of the
132
+vintage is heavy, and he is paid by the hour. Ah, a cigarette? The
133
+signor is too kind. Will not the signor take his pomegranate flower?
134
+Indeed the signor will.
135
+
136
+Day by day this sunny and innocent paganism gets more possession of me,
137
+and day by day the beauty of that which I saw at Bayreuth glows more
138
+brightly. Yesterday, about evening, a sudden summer squall came storming
139
+over from Posillippo, gleaming with lightning and riotous with thunder,
140
+and to me it was Wotan who steered from the north. On Monte Solaro the
141
+Valkyries awaited his coming, and when the whistling winds had passed
142
+away over our heads, while the house shuddered, and the moon again rose
143
+in a velvet sky with stars swarming thick round her, I knew that on the
144
+mountain-top Brunehilde slept within a ring of fire, waiting for the man
145
+who should claim her with his kiss. But the morning again to-day was
146
+very clear and hot, and instead of going up Mount Solaro, as I had
147
+intended, I went, as usual, down to the Bagno, a white pebbly beach with
148
+pockets of sand to lie on. I took with me a basket of figs and a flask
149
+of wine stoppered with vine-leaves, and my friend took a book which we
150
+often read and a straw case of cigarettes. And together we swam through
151
+the chrysoprase of sunlit sea far out to a brown, seaweed-covered rock.
152
+The water was very deep round it, and fathoms down something shone very
153
+brightly with wavering, subaqueous gleam, and, half laughing at myself,
154
+I dived and dived--for I knew it was the Rhinegold that shone
155
+there--until I could dive no more. Yet still I could not get deep
156
+enough. Then, having rested, we swam back, and lay on pockets of hot
157
+sand, and drank from the leaf-stoppered bottle, and ate the purple of
158
+the figs; and my friend read in the book which he had brought, beginning
159
+at the seventh chapter, and to this effect:
160
+
161
+‘Did I seriously believe that that contemplation of God which is the
162
+prime duty laid on us by religion must, or even could, legitimately give
163
+us any touch of sadness of whatever kind, I would throw religion away as
164
+heedlessly as I throw away the end of a smoked-out cigarette, for I have
165
+no use for it. Yet although on every side, and most of all in every
166
+pulpit, I see the lamentable Puritan jowl, and hear the lamentable
167
+Puritan whine, which bids me look with horror on the sin of the world
168
+and with sorrow on its sufferings, I do not for a moment believe that
169
+this impious gabble is the result of religion, but rather of grossest
170
+irreligion, on the part of its exponents. For me, I know that the
171
+contemplation of God is my duty, and if I make it my whole and
172
+absorbing duty I cannot go very far astray. For above all things is God
173
+love, and above all things is He beauty, and the love which engirdles
174
+Him joins without break to the human love which it is our duty always to
175
+give and take, giving with both hands and taking by the armful. So, too,
176
+His beauty joins without break to the beauty of all He has made, and in
177
+the golden hair of women and in the rose-petal, in the smooth swift
178
+limbs of youth and in the faceted diamond, in the curve of a girl’s lips
179
+and in the rose-flushed clouds, in the blue chalice of the sky of
180
+morning, equally and everywhere must we look for and absorb the beauty
181
+which is implanted there.
182
+
183
+‘It is here that Christianity, with its mournful, man-invented morality,
184
+has gone so far astray from its Founder that many Christians turn from
185
+beauty as if beauty was evil, instead of ever seeking it and worshipping
186
+it, find it where they will, until the dross of their gross minds is
187
+burned up in that fine fire. Hence, too, sprang--by “hence,” I mean from
188
+impious Puritanism--such phrases as the “temptations and dangers of
189
+physical beauty,” whereas to the man whose mind is set on God it is by
190
+and through beauty that the uttermost death-stroke is dealt to the
191
+writhing earthworm of carnalism. For the truth is that no beauty of
192
+soul, and no completeness, was ever framed on the mutilation or
193
+starvation of self, and at the Last Day the gray and pallid ascetic will
194
+find that what he thought was virtue, and what he taught as
195
+self-control, was sheer darkness of soul and purblind vision.
196
+
197
+‘It is this that must be cast away. We are people that sit in darkness,
198
+content that our religion should make us sad, and as such we have a
199
+lesson humbly to learn from paganism, and in particular from the
200
+paganism of the Greeks, whose hierarchy of gods were enthroned in
201
+brightness, and the name thereof was Beauty. And that Beauty, the search
202
+of which to them was worship and prayer and praise, they found
203
+everywhere: in the sunlight and the blue dome of heaven; in the crisp,
204
+curly acanthus leaf which they set to twine about the capitals of their
205
+marble-hewn columns and on the necks of the vases of the dead; in the
206
+radiance of jewels and in the tragedies of heroes; and above all in the
207
+beauty of the human form. Disfigured and astray their worship often
208
+went, and it wore strange garbs, but through all its sin and its
209
+misconceptions, its thousand errors and distortions, we can see
210
+gleaming, deep below, the bright shining of its truth. And this, to my
211
+mind, gleams less brightly in the sadder worship of to-day.
212
+
213
+‘For I doubt very much whether anybody is in the least benefited by the
214
+actual sorrow or repentance of anyone, though no doubt such--especially
215
+to sour and brooding natures--is necessary. But the best repentance, if
216
+one has sufficient vitality, will be momentary, a fiery sword-thrust,
217
+which will leave no ache or throb behind. It is better, I dare say, that
218
+a man should suffer the fires of remorse for years rather than that he
219
+should not suffer them at all, but I think that the man who is capable
220
+of throwing his remorse off and starting fresh and unwounded is the more
221
+Godlike creature, for the reason that it is infinitely better to be
222
+happy and smiling than to go frowning through the world. For sin is
223
+seldom born of a happy impulse, stare as you may, unless from a happy
224
+impulse which has been, so to speak, shut up in the dark and has gone
225
+putrid.
226
+
227
+‘And here in this divine place’ (the book I am quoting from was written
228
+at Athens), ‘where beauty is thrown broadcast over all one sees, and
229
+happiness is so easy, it seems to me to follow as a corollary that
230
+things which a Northern and gloomy people consider wrong are less wrong.
231
+For supposing in foggy London every shopkeeper tried to cheat one, one
232
+would say that the middle class was going to the dogs. Quite so--it
233
+would be. But the middle class is not in the least going to the dogs
234
+here. Why not? For a variety of reasons: partly because there is more
235
+sun here and no fog, and because the Parthenon is near at hand. Ah, yes,
236
+indeed it is so: Gaiety covers a multitude of sins, and while they are
237
+covered, Beauty blots them out.
238
+
239
+‘O beautiful God of this beautiful world, let me make somebody laugh
240
+to-day. Amen.’
241
+
242
+At that point I laughed.
243
+
244
+‘So his prayer is heard,’ said my friend. ‘Have you eaten all the figs
245
+while I have been reading?’
246
+
247
+‘Yes; but don’t be unhappy. Remember it is your duty to be happy. You
248
+may have the last cigarette. No--we’ll toss for it.’
249
+
250
+‘I’ll be shot if we do!’ said he.
251
+
252
+‘Well, I’ll cut it in half.’
253
+
254
+‘So that neither of us gets any,’ said he. ‘Give it me;’ and he very
255
+rudely snatched at it. Here ensued a scuffle, and, the bowels of the
256
+cigarette being scattered about the beach, neither of us got any, and
257
+the occasion gave rise to moral reflections. Also immoral ones. Then
258
+peace and plenty descended in the shape of a friend also coming down to
259
+bathe with a supply of fresh tobacco, and the sun was warm again and the
260
+sea blue. Then my friend (whom I must call Toby, because he objects to
261
+his real name being known, saying that I am certain to keep all the
262
+beautiful remarks for myself and give him all the idiocy) held forth:
263
+
264
+‘The man is shallow,’ he said; ‘it is only a gospel of surfaces he
265
+preaches, and you think it profound merely because he loads it with
266
+grave words. I have done for years exactly what he preaches: I have
267
+succeeded in being always happy and usually gay, and I spend my whole
268
+life in looking for what I consider beautiful. Yet what did you call me
269
+last night? A second-hand sensualist, I think.’
270
+
271
+‘Very likely. That is because you are not strenuous. Your pursuit of
272
+beauty must be passionate, and the pursuit must be an act of worship.
273
+Your pursuit of beauty is not an act of worship; it is more like sucking
274
+sweets.’
275
+
276
+Toby laughed loudly and idiotically.
277
+
278
+‘Or eating all the figs,’ said he, and the discussion ended.
279
+
280
+It is close on noon, and only the faintest breeze is stirring. The bay
281
+is silent and waveless, except that at intervals a ripple falls like the
282
+happy sigh of some beautiful basking creature on to the hot, white
283
+pebbles of the beach. There, like a living sapphire, lies the dear sea,
284
+the thing in this world I love best and understand best, though I do not
285
+understand it at all. Never have I seen it so luminous as it is to-day;
286
+you would say that the sunlight of centuries had been lit in its depths.
287
+Gray rocks run out from the precipitous land, fringed with seaweed, and
288
+under the water the seaweed shows purple. A brown-sailed fishing-boat
289
+lies becalmed a mile out, and across the bay Naples sparkles white and
290
+remote, and only the thin line of smoke streaming upwards from Vesuvius
291
+speaks of the fierce and everlasting stir of forces which underlie the
292
+world. In the thickets which come down to the water’s edge of this
293
+tideless sea there is now no sound of life, though an hour ago they were
294
+resonant with the whirring of the cicalas. The lizards have crept out in
295
+the stillness and bask on the white stones, as still as if once more
296
+Orpheus charmed them; and high above me a hawk, with wings motionless,
297
+floats slowly, in seeming sleep, down some breeze in the upper air.
298
+
299
+And what if my nameless author is right? What if--this is the
300
+upshot--happiness is our first duty? It is certainly not true that if
301
+you are good you are happy; but may it not be true that by being happy
302
+you are in some degree good? The Puritan interpretation of Christianity
303
+has had a fair trial, and, indeed, it seems to have made but a poor job
304
+out of it. What is the result of all these sadnesses and renunciations?
305
+Nothing but starved lives and unrealized ideals. Such self-denial is
306
+touching, beautiful in theory, and based, of course, on Christ’s
307
+teaching. But it is based awry if it brings sadness with it, if it sees
308
+in beauty only a lure to lead the soul astray, rather than the signpost
309
+which points by no winding road, but a royal highway, straight to God.
310
+And that road resounds with praise, and the birds of St. Francis sit in
311
+the pleasant boughs of the trees that grow beside it, and the dear saint
312
+smiles at them, and says: ‘Sing, my sisters, and praise the Lord.’ And
313
+at his bidding they fill their throats with bubbling song, and thank God
314
+for their warm feathers and the green habitations He has builded for
315
+them. Then St. Francis, so the legend tells us, sits down at table with
316
+St. Blaise and others, the friends of St. Francis, and feeds his dear
317
+birds, so that they become very strong. That saint is more to my mind
318
+than that foolish fellow Stylites, or the dour St. Bernard, who, being
319
+plagued with the flies on a hot day, excommunicated them, and they all
320
+dropped down dead. For love, joy, and peace are the gifts of the Spirit,
321
+but we are too much given to let the joy take care of itself, to check
322
+it even, as if salvation was clothed in sackcloth.
323
+
324
+Happiness is a home product. We cannot import it into ourselves, nor by
325
+multiplying our pleasures can we come one whit nearer to it. But by
326
+being dull, by being slow to perceive, or having perceived to receive,
327
+we can, and we often do, succeed in closing the doors of our souls to
328
+it. Yet, though it comes not from without, nor is it the sum or product
329
+of any pleasures, our soul must sit with doors and windows open to catch
330
+if it be but one-millionth of the myriad sweet and beautiful things that
331
+stir and shine about us, or else, as in the darkness and stagnation of
332
+some closed house, dust and airlessness overlay us. For there is nothing
333
+in the world, except only that which the sin and folly of man have
334
+wrought, which is not wholesome and innocent. It is our grossness which
335
+makes things gross, our rebellion which makes us say that in beauty
336
+there lurk any seeds or germs that can ripen into or go to form anything
337
+that is not beautiful.
338
+
339
+    ‘O world as God has made it, all is beauty,
340
+     And knowing this is love, and love is duty:
341
+     What further can be sought for or declared?’
342
+
343
+       *       *       *       *       *
344
+
345
+Seraphina and Francesco, with outside help when they want it, are the
346
+domestic staff of Toby’s house. They are engaged to be married, and, in
347
+fact, the marriage is going to come off in three months’ time.
348
+Domestically speaking, this is an ideal arrangement, because if
349
+Seraphina’s work happens on any day to be heavy (she cooks, though I
350
+cannot call her a cook) Francesco delights to help her; while, on the
351
+other hand, if her work is light, she lends her aid in the cleaning and
352
+embellishment of the house, for thus she is with her _promesso_. And in
353
+the evening, as often as not, when their work is finished, they stroll
354
+and sit in the garden as we do, and with a little encouragement join in
355
+our talk, and tell us the strange legends of the saints common to this
356
+countryside, or with bated breath speak of the days of the Emperor
357
+Tiberius, who still is the bogie of the island, so that a mother even
358
+to-day, if a child is troublesome, warns it that Tiberius is coming.
359
+High on the eastward end of Capri stand the ruins of one of his palaces;
360
+the walls are built to the sheer edge of the precipitous rock, and it
361
+was from here that he used to hurl down his victims when he was
362
+satiated with them, flinging them headlong, a glimmer of white limbs
363
+that turned over and over in the air till they splashed on the rocks
364
+three hundred feet below. Round this crag still hovers some poisonous
365
+breath of crime; sudden shrieks are heard of nights, so Francesco says,
366
+and shadows pace in the shadows. Here, too, that dark soul used to walk
367
+up and down in his corridor of mirrors, so that he could see that none
368
+came up behind him with the assassin’s knife; weary of life, he yet
369
+clung to it with a maniac force; longing for death, he fenced himself
370
+from it with a thousand guards. ‘And on us,’ said Francesco, when he
371
+told us of these things, with the poet that lurks in the Italian blood
372
+suddenly inspiring his tongue--‘on us, signor, those same stars look
373
+down that beheld Tiberius. Yet they do not care.’
374
+
375
+In this manner we were sitting in the garden on the evening of the day
376
+which I have been speaking of. There had been some small _festa_ in the
377
+town, and Seraphina, to make herself the more comely in her lover’s
378
+eyes, had put on, when her kitchen work was over, her _festa_ clothes,
379
+even though they would only glimmer for an hour in the dusk, before she
380
+went to bed. Her olive skin, flushed with the warm tints of wind and
381
+sun, was dusky in the moonlight, and her brown eyes, underneath her
382
+thin, straight eyebrows, were big and soft, as if made of velvet. But
383
+all the gaiety of the South was set in her laughing mouth, and her teeth
384
+were a band of ivory in the red of pomegranate. Her arms were bare above
385
+the elbows almost to the shoulder, and beneath the smooth satiny skin,
386
+as she moved them in Southern gesticulation at some story she was
387
+telling us, I could see the swift and supple play of the muscles. Round
388
+us the night was pricked with a thousand remote stars, and the warm,
389
+languid air stirred in the bushes and sighed among the vineyards like a
390
+lingering caress. Now and then a handful of hot air would be tossed over
391
+us from the veranda, where the sun had grilled the flagstones all the
392
+afternoon; now and then a breath of coolness--a handful of air that had
393
+been shaded all day by the thick vine-leaves--stirred from its place and
394
+refreshed us. Below gleamed the lights of Capri, and the murmur of the
395
+town stole softly to us, or a gay stanza would be flung into the air
396
+from some homeward-going peasant as he passed up the cobbled ways. To
397
+the north a great emptiness of gray showed where the Gulf of Naples
398
+basked beneath the moon, and high up on the horizon a thin necklace of
399
+light lying along the edge of the sea showed the town. This hour of warm
400
+night, especially with such a setting, is, to my mind, the most animal
401
+of all. In the moon-dusk a thousand subtle scents and hints float round
402
+one, not consciously perceived, but exciting to the primeval animal
403
+instincts which æons of evolution have not yet eradicated from our
404
+nature; and at such an hour the beast within us, prowling, predatory,
405
+hot on its slinking errands, is more than ever dominant.
406
+
407
+Soon Toby got up, stretching himself.
408
+
409
+‘Mail-day to-morrow,’ he said, ‘and I have two letters to write. Just
410
+get me some paper and envelopes, Francesco; there were none this
411
+morning.’
412
+
413
+Francesco jumped up.
414
+
415
+‘Eh, signor, I forgot,’ he said; ‘there are none in the house. I will
416
+run over to Capri; the shops are still open. Two minutes only;’ and he
417
+vaulted over the wall into the road.
418
+
419
+Toby strolled towards the house.
420
+
421
+‘Are you coming in?’ he said to me over his shoulder.
422
+
423
+‘Yes, in ten minutes,’ I answered, and he disappeared.
424
+
425
+Seraphina rose also, resting her weight for a moment on her arm.
426
+
427
+‘It is good beneath the stars in the evening, is it not?’ she said. ‘I
428
+must go in. Happy dreams, signor!’
429
+
430
+‘No; tell me one more story about Tiberius,’ I said.
431
+
432
+She laughed.
433
+
434
+‘Surely the signor is like a child,’ she said: ‘he is so fond of
435
+stories. Will he not tell me an English story for a change?’
436
+
437
+‘About what?’
438
+
439
+‘About yourself or your friends--about your customs in England. I like
440
+the ways of English folk;’ and she sat down again close to me,
441
+eager-eyed, with smiling mouth.
442
+
443
+Suddenly it seemed to me that the whole spirit of all I saw and felt
444
+was changed. The soft, innocent Southern night was alive with voices. No
445
+longer did a child sit by me, but a woman--dark-eyed like a stag,
446
+intoxicating to the sense. Passion and desire, those headlong twins,
447
+rushed down on me, with arms intertwined and purple-stained mouth,
448
+chanting with a meaning that was new to me, ‘All is beauty, and knowing
449
+this is love; and love----’ There she sat, exquisite, trembling between
450
+girlhood and womanhood, the eternal riddle of life, to solve which men
451
+have gladly died, and lightly dismissed honour, like a stale piece of
452
+unlikely gossip. But----
453
+
454
+‘It is mail-day to-morrow,’ I said, and I heard how unsteady was my
455
+voice; ‘I also have letters to write.’
456
+
457
+She rose at once.
458
+
459
+‘Good-night, signor,’ she said, and turned to go to the house.
460
+
461
+As she got further on her way, I think I would have given all I had for
462
+her to turn back again, so that I might say--well, nothing particular,
463
+but just let her guess, no more, that---- But she did not turn.
464
+
465
+So, then, what of my gospel about beauty? It remains exactly where it
466
+was, true, I believe, in every respect. Only in me, at any rate, there
467
+lurks the beast. To-night he growled and pulled at his chain.

+ 30
- 0
src/test/java/io/zipcoder/ParenCheckerTest.java ファイルの表示

@@ -5,4 +5,34 @@ import org.junit.Test;
5 5
 
6 6
 public class ParenCheckerTest {
7 7
 
8
+    @Test
9
+    public void checkParenTest(){
10
+        String str = "this ( is a test";
11
+
12
+        boolean expected = false;
13
+        boolean actual = ParenChecker.checkParen(str);
14
+
15
+        Assert.assertEquals(expected, actual);
16
+    }
17
+
18
+    @Test
19
+    public void checkAllTest1() {
20
+        String str = "this is a test";
21
+
22
+        boolean expected = true;
23
+        boolean actual = ParenChecker.checkAll(str);
24
+
25
+        Assert.assertEquals(expected, actual);
26
+    }
27
+
28
+    @Test
29
+    public void checkAllTest2() {
30
+        String str = "this < is a test";
31
+
32
+        boolean expected = false;
33
+        boolean actual = ParenChecker.checkAll(str);
34
+
35
+        Assert.assertEquals(expected, actual);
36
+    }
37
+
8 38
 }