View Javadoc

1   // -- FILE ------------------------------------------------------------------
2   // name       : AsnType.java
3   // project    : Panter: LI
4   // created    : lep - 2007.01.03
5   // language   : java
6   // environment: JDK 1.5.0
7   // copyright  : (c) 2006 by Panter llc, Switzerland
8   // license    : this is free software licensed under the GPL. see COPYING
9   // --------------------------------------------------------------------------
10  package ch.panter.li.bi.asn.model;
11  
12  import ch.panter.li.bi.asn.AsnTag;
13  import ch.panter.li.bi.asn.AsnTagClass;
14  import ch.panter.li.bi.util.ReadOnlyNamedItemMap;
15  import ch.panter.li.bi.util.ReadOnlyCollection;
16  import ch.panter.li.bi.util.NamedItem;
17  
18  
19  public interface AsnType extends NamedItem {
20  
21    public AsnModule getModule();
22  
23    public AsnTag getTag();
24  
25    public AsnTag deriveTag( final AsnTagClass tagClass, final int tagNumber );
26  
27    public AsnTag deriveApplicationTag( final int tagNumber );
28  
29    public AsnTag deriveContextTag( final int tagNumber );
30  
31    public AsnTag derivePrivateTag( final int tagNumber );
32  
33    /** Determines whether this instances tag might represent a value for this type.
34     Tests whether the constructed/primitive flag has a value allowed by this type.
35     @param tagToCheck the tag to check
36     @return true if the nature of the given tag is allowed by this type
37     */
38    public boolean isCompatible( final AsnTag tagToCheck );
39  
40    /** Determines the same check as <code>isCompatible</code> but throws in case of
41     an incompatibility.
42     @param tagToCheck the tag to check
43     @throws IllegalArgumentException in case the tag is considered incompatible
44     */
45    public void checkCompatible( final AsnTag tagToCheck ) throws IllegalArgumentException;
46  
47    public boolean isSimple();
48  
49    public boolean isComplex();
50  
51    public boolean isConstructedEncodingAllowed();
52  
53    public boolean isRootType();
54  
55    public AsnType getBaseType();
56  
57    public AsnType getRootType();
58  
59    public boolean isDerivedFrom( final AsnType baseTypeToCheckFor );
60  
61    public boolean isExtensionAllowed();
62  
63    public boolean isUniqueTagsRequired();
64  
65    public boolean hasConstraints(); // this instance
66  
67    public boolean hasAnyConstraints(); // this instance or any base type
68  
69    public ReadOnlyCollection<AsnConstraint> getConstraints();
70    
71    public boolean hasFields();
72  
73    public ReadOnlyNamedItemMap<AsnField> getFields();
74  
75    /** Searches the fields of this instance for one with a tag matching the given tag.
76     @param tag the tag of the field to search for
77     @return the field that matches the given tag or null if no match was found
78     */
79    public AsnField getFieldByTag( final AsnTag tag );
80  
81  } // interface AsnType
82  
83  // -- EOF -------------------------------------------------------------------