experiments/JavaCompilerProblemRegistry.st
changeset 2678 c865275e48a7
child 2731 13f5be2bf83b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/JavaCompilerProblemRegistry.st	Fri Sep 06 02:45:44 2013 +0200
@@ -0,0 +1,156 @@
+"
+ Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
+                         SWING Research Group, Czech Technical University 
+                         in Prague
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the 'Software'), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+"
+"{ Package: 'stx:libjava/experiments' }"
+
+Object subclass:#JavaCompilerProblemRegistry
+	instanceVariableNames:'problems'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Java-Support-Compiling'
+!
+
+JavaCompilerProblemRegistry class instanceVariableNames:'theOneAndOnlyInstance'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+!JavaCompilerProblemRegistry class methodsFor:'documentation'!
+
+copyright
+"
+ Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
+                         SWING Research Group, Czech Technical University 
+                         in Prague
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the 'Software'), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+"
+! !
+
+!JavaCompilerProblemRegistry class methodsFor:'instance creation'!
+
+flush
+    "flushes the cached singleton"
+
+    theOneAndOnlyInstance := nil
+
+    "
+     self flushSingleton
+    "
+
+    "Created: / 06-08-2013 / 10:19:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+instance
+    "returns a singleton"
+
+    theOneAndOnlyInstance isNil ifTrue:[
+        theOneAndOnlyInstance := self basicNew initialize.
+    ].
+    ^ theOneAndOnlyInstance.
+
+    "Created: / 06-08-2013 / 10:19:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+new
+    "returns a singleton"
+
+    ^ self instance.
+
+    "Modified: / 06-08-2013 / 10:20:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaCompilerProblemRegistry class methodsFor:'accessing'!
+
+problemsFor: jclass
+    ^ self instance problemsFor: jclass.
+
+    "Created: / 06-08-2013 / 10:29:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+problemsFor: jclass put: problems
+    ^ self instance problemsFor: jclass put: problems
+
+    "Created: / 06-08-2013 / 10:29:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaCompilerProblemRegistry methodsFor:'accessing'!
+
+problemsFor: jclass
+    ^ problems at: jclass ifAbsent:[nil]
+
+    "Created: / 06-08-2013 / 10:24:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+problemsFor: jclass put: problemsForClass
+    problemsForClass isNil ifTrue:[
+        problems removeKey: jclass ifAbsent:[nil].
+    ] ifFalse:[
+        problems at: jclass put: problemsForClass.
+    ].
+    self changed: #problems with: jclass.
+
+    "Created: / 06-08-2013 / 10:25:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaCompilerProblemRegistry methodsFor:'initialization'!
+
+initialize
+    "Invoked when a new instance is created."
+
+    problems := WeakIdentityDictionary new.
+
+    "Modified: / 06-08-2013 / 10:20:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaCompilerProblemRegistry class methodsFor:'documentation'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libjava/experiments/JavaCompilerProblemRegistry.st,v 1.1 2013-09-06 00:44:04 vrany Exp $'
+! !
+