|
@@ -1,45 +1,45 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.aokeyhole.objects; |
3 |
|
- |
|
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
|
- |
public class ASet { |
7 |
|
- |
private Set<String> mAcceptablePOtypes = new HashSet<String>(); |
8 |
|
- |
private PropertyMetaData[] mPMDs; |
9 |
|
- |
private AttributeCreationCallBack mCreationCallBack = null; |
10 |
|
- |
|
11 |
|
- |
public ASet( PropertyMetaData... pPMDs ) { |
12 |
|
- |
mPMDs = (pPMDs != null) ? pPMDs : PropertyMetaData.EMPTY_ARRAY; |
13 |
|
- |
} |
14 |
|
- |
|
15 |
|
- |
public ASet( String pAcceptablePOtype, PropertyMetaData... pPMDs ) { |
16 |
|
- |
this( pPMDs ); |
17 |
|
- |
if ( pAcceptablePOtype != null ) { |
18 |
|
- |
mAcceptablePOtypes.add( pAcceptablePOtype ); |
19 |
|
- |
} |
20 |
|
- |
} |
21 |
|
- |
|
22 |
|
- |
public ASet( Set<String> pAcceptablePOtypes, PropertyMetaData... pPMDs ) { |
23 |
|
- |
this( pPMDs ); |
24 |
|
- |
if ( pAcceptablePOtypes != null ) { |
25 |
|
- |
mAcceptablePOtypes.addAll( pAcceptablePOtypes ); |
26 |
|
- |
} |
27 |
|
- |
} |
28 |
|
- |
|
29 |
|
- |
public PropertyMetaData[] getPMDs() { |
30 |
|
- |
return mPMDs; |
31 |
|
- |
} |
32 |
|
- |
|
33 |
|
- |
public AttributeCreationCallBack getCreationCallBack() { |
34 |
|
- |
return mCreationCallBack; |
35 |
|
- |
} |
36 |
|
- |
|
37 |
|
- |
public ASet set( AttributeCreationCallBack pCreationCallBack ) { |
38 |
|
- |
mCreationCallBack = pCreationCallBack; |
39 |
|
- |
return this; |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
public boolean isAcceptableAsRelatedTo( ObjectMetaData pObjectMetaData ) { |
43 |
|
- |
return mAcceptablePOtypes.isEmpty() || mAcceptablePOtypes.contains( pObjectMetaData.getObjectSet().getType() ); |
44 |
|
- |
} |
45 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.aokeyhole.objects; |
|
3 |
+ |
|
|
4 |
+ |
import java.util.*; |
|
5 |
+ |
|
|
6 |
+ |
public class ASet { |
|
7 |
+ |
private Set<String> mAcceptablePOtypes = new HashSet<String>(); |
|
8 |
+ |
private PropertyMetaData[] mPMDs; |
|
9 |
+ |
private AttributeCreationCallBack mCreationCallBack = null; |
|
10 |
+ |
|
|
11 |
+ |
public ASet( PropertyMetaData... pPMDs ) { |
|
12 |
+ |
mPMDs = (pPMDs != null) ? pPMDs : PropertyMetaData.EMPTY_ARRAY; |
|
13 |
+ |
} |
|
14 |
+ |
|
|
15 |
+ |
public ASet( String pAcceptablePOtype, PropertyMetaData... pPMDs ) { |
|
16 |
+ |
this( pPMDs ); |
|
17 |
+ |
if ( pAcceptablePOtype != null ) { |
|
18 |
+ |
mAcceptablePOtypes.add( pAcceptablePOtype ); |
|
19 |
+ |
} |
|
20 |
+ |
} |
|
21 |
+ |
|
|
22 |
+ |
public ASet( Set<String> pAcceptablePOtypes, PropertyMetaData... pPMDs ) { |
|
23 |
+ |
this( pPMDs ); |
|
24 |
+ |
if ( pAcceptablePOtypes != null ) { |
|
25 |
+ |
mAcceptablePOtypes.addAll( pAcceptablePOtypes ); |
|
26 |
+ |
} |
|
27 |
+ |
} |
|
28 |
+ |
|
|
29 |
+ |
public PropertyMetaData[] getPMDs() { |
|
30 |
+ |
return mPMDs; |
|
31 |
+ |
} |
|
32 |
+ |
|
|
33 |
+ |
public AttributeCreationCallBack getCreationCallBack() { |
|
34 |
+ |
return mCreationCallBack; |
|
35 |
+ |
} |
|
36 |
+ |
|
|
37 |
+ |
public ASet set( AttributeCreationCallBack pCreationCallBack ) { |
|
38 |
+ |
mCreationCallBack = pCreationCallBack; |
|
39 |
+ |
return this; |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
public boolean isAcceptableAsRelatedTo( ObjectMetaData pObjectMetaData ) { |
|
43 |
+ |
return mAcceptablePOtypes.isEmpty() || mAcceptablePOtypes.contains( pObjectMetaData.getObjectSet().getType() ); |
|
44 |
+ |
} |
|
45 |
+ |
} |