Package org.dmd.dmc.types

Examples of org.dmd.dmc.types.Modifier


   
    @Override
    // org.dmd.dms.util.GenUtility.dumpMVType(GenUtility.java:2363)
    public Modifier add(Object v) throws DmcValueException {
        synchronized(this){
            Modifier rc = typeCheck(v);
            if (value == null)
                value = new ArrayList<Modifier>();
            value.add(rc);
            return(rc);
        }
View Full Code Here


    public Modifier del(Object v){
        synchronized(this){
            if (value == null)
                return(null);
   
            Modifier key = null;
            Modifier rc = null;
            try {
                key = typeCheck(v);
            } catch (DmcValueException e) {
                throw(new IllegalStateException("Incompatible type passed to del():" + getName(),e));
            }
View Full Code Here

                throw(new IllegalStateException("Attribute: " + getAttributeInfo().name + " is not indexed. You can't use setMVnth()."));
           
            if ( (index < 0) || (index >= getAttributeInfo().indexSize))
                throw(new IllegalStateException("Index " + index + " for attribute: " + getAttributeInfo().name + " is out of range: 0 <= index < " + getAttributeInfo().indexSize));
           
            Modifier rc = null;
           
            if (v != null)
                rc = typeCheck(v);
           
            if (value == null){
View Full Code Here

        synchronized(this){
            if (value == null)
                return(false);

            try {
                Modifier val = typeCheck(v);
                return(value.contains(val));
            } catch (DmcValueException e) {
                return(false);
            }
        }
View Full Code Here

        DmcTypeModifierMV newModifier = new DmcTypeModifierMV(MetaDMSAG.__modify);
       
        Iterator<Modifier>  modifiers = getModifyAttribute().getMV();
        if (modifiers != null){
          while(modifiers.hasNext()){
            Modifier mod = modifiers.next();
            DmcAttributeInfo ai = mod.getAttributeInfo();
            if (ai == null)
              throw(new IllegalStateException("Unknown attribute in modify: " + mod.getAttributeName()));
            if (ai.dataType == DataTypeEnum.PERSISTENT)
              newModifier.add(new Modifier(mod));
          }
         
          // If there are any PERSISTENT modifications, we'll returned an alterred clone
          if (newModifier.getMVSize() > 0){
            // There were non-persistent attributes in the modify, clone the event
View Full Code Here

  DmcTypeModifierMV getModifierSlice(DmcSliceInfo slice, DmcTypeModifierMV source){
    DmcTypeModifierMV rc = new DmcTypeModifierMV();
   
    Iterator<Modifier> mods = source.getMV();
    while(mods.hasNext()){
      Modifier mod = mods.next();
      if (slice.contains(mod.getAttributeID())){
        try {
          rc.add(mod);
        } catch (DmcValueException e) {
          throw(new IllegalStateException("Should not throw an exception adding a Modifier to a DmcTypeModifier"));
        }
View Full Code Here

  public boolean thisAttributeModified(DmcAttributeInfo ai){
    if (getEventTypeDMP() == DMPEventTypeEnum.MODIFIED){
      DmcTypeModifierMV mods = getModifyAttribute();
      if (mods != null){
        for(int i=0; i<mods.getMVSize(); i++){
          Modifier mod = mods.getMVnth(i);
          DmcAttributeInfo modai = mod.getAttributeInfo();
          if (modai == null)
            throw(new IllegalStateException("Couldn't get attriute info for: " + mod.getAttributeName()));
          if (modai.id == ai.id)
            return(true);
        }
      }
    }
View Full Code Here

        throw(new IllegalStateException("Malformed DMPEvent. Missing modify attribute for a MODIFIED event."));
     
      Iterator<Modifier>  modifiers = getModifyAttribute().getMV();
      if (modifiers != null){
        while(modifiers.hasNext()){
          Modifier mod = modifiers.next();
          if (mod.getAttribute() == null){
            if (mod.getModifyType() == ModifyTypeEnum.REM){
              AttributeDefinition ad = DmwOmni.instance().getSchema().adef(mod.getAttributeName());
              if (ad == null)
                throw(new IllegalStateException("Malformed DMPEvent. Could not get definition for attribute: " + mod.getAttributeName()));
              else
                if (ad.getDataType() == DataTypeEnum.PERSISTENT){
                  rc = true;
                  break;
                }
            }
            else if (mod.getModifyType() == ModifyTypeEnum.NTH){
              AttributeDefinition ad = DmwOmni.instance().getSchema().adef(mod.getAttributeName());
              if (ad == null)
                throw(new IllegalStateException("Malformed DMPEvent. Could not get definition for attribute: " + mod.getAttributeName()));
              else
                if (ad.getDataType() == DataTypeEnum.PERSISTENT){
                  rc = true;
                  break;
                }
            }
            else
              throw(new IllegalStateException("Malformed DMPEvent. Missing attribute for a Modifier: " + mod.toString()));
          }
          else if (mod.getAttribute().getAttributeInfo().dataType == DataTypeEnum.PERSISTENT){
            rc = true;
            break;
          }
        }
      }
View Full Code Here

    // as a single operation, thus we create a new DmcTypeModifierMV and add the single Modifier
    // to it. We don;t attempt to reuse the same modifier because these may be used in events.
    Iterator<Modifier> it = mods.getMV();
    while(it.hasNext()){
      DmcTypeModifierMV single = new DmcTypeModifierMV();
      Modifier mod = it.next();
      try {
        // Add the Modifier to our temporary
        single.add(mod);
       
        if (cache == null)
          ((DmcObject)mod.getReferringObject()).applyModifier(single);
        else
          cache.applyModification(mod.getReferringObject(), single);
       
      } catch (DmcValueException e) {
        throw(new IllegalStateException("Adding a prebuilt Modifier to a DmcTypeModifierMV shouldn't thrown an exception."));
      } catch (DmcValueExceptionSet e) {
        throw(new IllegalStateException("Removing a back reference shouldn't thrown an exception."));
View Full Code Here

 
  protected void addModsSV(DmcTypeModifierMV mods, DmcAttribute<?> existingValue, DmcAdapterIF adapter){
    try {
      if (existingValue == null){
        if (adapter.hasValue())
          mods.add(new Modifier(ModifyTypeEnum.SET, this.cloneIt()));
      }
      else{
        if (!adapter.hasValue())
          mods.add(new Modifier(ModifyTypeEnum.REM, attrInfo));
        else
          mods.add(new Modifier(ModifyTypeEnum.SET, this.cloneIt()));
      }
    } catch (DmcValueException e) {
      throw(new IllegalStateException("Changes to the Modifier shouldn't throw an exception.", e));
    }
  }
View Full Code Here

TOP

Related Classes of org.dmd.dmc.types.Modifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.