Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
SIX OVAL - http://code.google.com/p/six-oval/ Copyright (C) 2010 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number: H22PRO-1124 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package jp.go.aist.six.oval.model.definitions;
 
The Set enables complex objects to be described. It is a recursive element in that each set element can contain additional set elements as children.

Author(s):
Akihito Nakamura, AIST
Version:
$Id: Set.java 3046 2013-02-21 09:33:57Z nakamura5akihito@gmail.com $
See also:
OVAL Language
 
 public class Set
     implements OvalObject
 {
     /* TODO: XSD model
      * <choice>
      *   <sequence>
      *     <element ref="set" 1..2 />
      *   </sequence>
      *   <sequence>
      *     <element name="object_reference" 1..2 />
      *     <element ref="filter" 0..* />
      *   </sequence>
      * </choice>
      */
 
     private final Collection<Set>  set = new ArrayList<Set>( 2 );
     //{1..2}
 
 
     private final Collection<String>  object_reference = new ArrayList<String>( 2 );
     //{1..2}
 
 
     private final Collection<Filter>  filter = new ArrayList<Filter>();
     //{0..*}
 
 
     public static final SetOperatorEnumeration  DEFAULT_SET_OPERATOR =
         .;
 
     private SetOperatorEnumeration  set_operator;
     //{optional, default='UNION'}
 


    
Constructor.
 
     public Set()
     {
     }




    
 
     public void setSet(
                     final Collection<? extends Setfilters
                     )
     {
         if ( != filters) {
             int  size = (filters == null ? 0 : filters.size());
             if (filters != null  &&  size > 2) {
                 throw new IllegalArgumentException(
                                 "invalid number of child 'set' (maxOccurs=2): "
                                 + size );
             }
 
             .clear();
             if (size > 0) {
                 .addAllfilters );
            }
        }
    }
    public boolean addSet(
                    final Set set
                    )
    {
        if (set == null) {
            return false;
        }
        if (this..size() >= 2) {
            throw new IllegalStateException(
                            "no more child 'set' can't be added (maxOccurs=2)");
        }
        return this..addset );
    }
    public Collection<SetgetSet()
    {
        return ;
    }
    public Iterator<SetiterateSet()
    {
        return .iterator();
    }



    
    public void setObjectReference(
                    final Collection<Stringobject_references
                    )
    {
        if ( != object_references) {
            int  size = (object_references == null ? 0 : object_references.size());
            if (object_references != null  &&  size > 2) {
                throw new IllegalArgumentException(
                                "invalid number of child 'object_reference' (maxOccurs=2): "
                                + size );
            }
            .clear();
            if (size > 0) {
                .addAllobject_references );
            }
        }
    }
    public boolean addObjectReference(
                    final String object_reference
                    )
    {
        if (object_reference == null) {
            return false;
        }
        if (this..size() >= 2) {
            throw new IllegalStateException(
                            "no more child 'object_reference' can't be added (maxOccurs=2)");
        }
        return this..addobject_reference );
    }
    {
        return ;
    }
    {
        return .iterator();
    }



    
    public void setFilter(
                    final Collection<? extends FilterfilterSeq
                    )
    {
        if ( != filterSeq) {
            .clear();
            if (filterSeq != null  &&  filterSeq.size() > 0) {
                .addAllfilterSeq );
            }
        }
    }
    public boolean addFilter(
                    final Filter filter
                    )
    {
        if (filter == null) {
            return false;
        }
        return this..addfilter );
    }
    public Collection<FiltergetFilter()
    {
        return ;
    }
    public Iterator<FilteriterateFilter()
    {
        return .iterator();
    }



    
    public void setSetOperator(
                    final SetOperatorEnumeration action
                    )
    {
         = action;
    }
    {
        return ;
    }
    public static SetOperatorEnumeration setOperator(
                    final Set obj
                    )
    {
        SetOperatorEnumeration  set_operator = obj.getSetOperator();
        return (set_operator == null ?  : set_operator);
    }
    //**************************************************************
    //  java.lang.Object
    //**************************************************************
    @Override
    public int hashCode()
    {
        final int  prime = 37;
        int  result = 17;
        result = prime * result + setOperatorthis ).hashCode();
        return result;
    }
    @Override
    public boolean equals(
                    final Object obj
                    )
    {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof Set)) {
            return false;
        }
        Set  other = (Set)obj;
        if (setOperatorthis ) == setOperatorother )) {
            return true;
        }
        return false;
    }
    @Override
    public String toString()
    {
        return "set[set=" + getSet()
             + ", object_reference=" + getObjectReference()
             + ", filter=" + getFilter()
             + ", set_operator=" + getSetOperator()
             + "]";
    }
//Set
New to GrepCode? Check out our FAQ X