Removed executable flag from files which don't need it.
[potlatch2.git] / net / systemeD / potlatch2 / mapfeatures / Presence.as
1 package net.systemeD.potlatch2.mapfeatures {
2
3     import net.systemeD.halcyon.connection.*;
4
5
6         public class Presence {
7             private static var ALWAYS:Presence;
8             private static var ON_TAG_MATCH:Presence;
9             private static var WITH_CATEGORY:Presence;
10         
11         public static function getPresence(presence:String):Presence {
12             if ( ALWAYS == null ) {
13                 ALWAYS = new Presence();
14                 ON_TAG_MATCH = new OnTagMatch();
15                 WITH_CATEGORY = new WithCategory();
16             }
17             if ( presence == "always" )
18                 return ALWAYS;
19             if ( presence == "onTagMatch" )
20                 return ON_TAG_MATCH;
21             if ( presence == "withCategory" )
22                 return WITH_CATEGORY;
23             return ON_TAG_MATCH;
24         }
25
26         public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
27             return forCategory == null || forCategory == editor.category;
28         }
29
30     }
31
32 }
33
34     import net.systemeD.halcyon.connection.*;
35     import net.systemeD.potlatch2.mapfeatures.*;
36
37     class OnTagMatch extends Presence {
38         public function OnTagMatch() {}
39         
40         override public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
41             return (forCategory == null || forCategory == editor.category) &&
42                       editor.areTagsMatching(forEntity);
43         }
44     }
45
46     class WithCategory extends Presence {
47         public function WithCategory() {}
48         
49         override public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
50             return forCategory == editor.category &&
51                       editor.areTagsMatching(forEntity);
52         }
53     }
54