coreRuntime/src/sc/sync/SyncProperties.java
public void merge(SyncProperties other) {
      ArrayList<Object> myProps = null;
      ArrayList<Object> myStaticProps = null;
      for (Object prop: other.classProps) {
         String propName;
         int propFlags;
         boolean hasDefault = false;
         Object defaultValue = null;
         if (prop instanceof SyncPropOptions) {
            SyncPropOptions opts = (SyncPropOptions) prop;
            propName = opts.propName;
            propFlags = opts.flags;
            if (opts.hasDefault) {
               hasDefault = true;
               defaultValue = opts.defaultValue;
            }
         }
         else {
            propName = (String) prop;
            propFlags = 0;
         }
         if ((propFlags & SyncPropOptions.SYNC_STATIC) != 0) {
            if (staticPropIndex == null) {
               staticPropIndex = new IntCoalescedHashMap(classProps.length);
            }
            if (myStaticProps == null)
               myStaticProps = new ArrayList<Object>();
            if (staticPropIndex.get(propName) == -1) {
               myStaticProps.add(propName);
               staticPropIndex.put(propName, propFlags);
            }
         }
         else if (propIndex.get(propName) == -1) {
            if (myProps == null)
               myProps = new ArrayList<Object>(Arrays.asList(classProps));
            myProps.add(prop);
            propIndex.put(propName, propFlags);
            if (hasDefault) {
               if (defaultValueMap == null)
                  defaultValueMap = new HashMap<String,Object>();
               defaultValueMap.put(propName, defaultValue);
            }
         }
      }
      if (myProps != null) {
         classProps = myProps.toArray(new Object[classProps.length]);
         if (chainedProps != null) // TODO: this is used when building the SyncProperties at compile time which right now does not use chainedProps so we should be ok
            System.err.println("*** Not merging in chainedProperties!");
         allProps = classProps;
      }

      if (myStaticProps != null) {
         if (staticProps == null)
            staticProps = myStaticProps.toArray();
         else {
            ArrayList<Object> mergedStatic = new ArrayList<Object>();
            mergedStatic.addAll(Arrays.asList(staticProps));
            mergedStatic.addAll(myStaticProps);
            staticProps = mergedStatic.toArray();
         }
      }
   }
// Merges the other properties - only replacing properties which do not exist in this sync properties.
Merges the other properties - only replacing properties which do not exist in this sync properties.
Merges the other properties - only replacing properties which do not exist in this sync properties .
public void merge(SyncProperties other) {
      ArrayList<Object> myProps = null;
      ArrayList<Object> myStaticProps = null;
      for (Object prop: other.classProps) {
         String propName;
         int propFlags;
         boolean hasDefault = false;
         Object defaultValue = null;
         if (prop instanceof SyncPropOptions) {
            SyncPropOptions opts = (SyncPropOptions) prop;
            propName = opts.propName;
            propFlags = opts.flags;
            if (opts.hasDefault) {
               hasDefault = true;
               defaultValue = opts.defaultValue;
            }
         }
         else {
            propName = (String) prop;
            propFlags = 0;
         }
         if ((propFlags & SyncPropOptions.SYNC_STATIC) != 0) {
            if (staticPropIndex == null) {
               staticPropIndex = new IntCoalescedHashMap(classProps.length);
            }
            if (myStaticProps == null)
               myStaticProps = new ArrayList<Object>();
            if (staticPropIndex.get(propName) == -1) {
               myStaticProps.add(propName);
               staticPropIndex.put(propName, propFlags);
            }
         }
         else if (propIndex.get(propName) == -1) {
            if (myProps == null)
               myProps = new ArrayList<Object>(Arrays.asList(classProps));
            myProps.add(prop);
            propIndex.put(propName, propFlags);
            if (hasDefault) {
               if (defaultValueMap == null)
                  defaultValueMap = new HashMap<String,Object>();
               defaultValueMap.put(propName, defaultValue);
            }
         }
      }
      if (myProps != null) {
         classProps = myProps.toArray(new Object[classProps.length]);
         if (chainedProps != null) 
            System.err.println("*** Not merging in chainedProperties!");
         allProps = classProps;
      }
      if (myStaticProps != null) {
         if (staticProps == null)
            staticProps = myStaticProps.toArray();
         else {
            ArrayList<Object> mergedStatic = new ArrayList<Object>();
            mergedStatic.addAll(Arrays.asList(staticProps));
            mergedStatic.addAll(myStaticProps);
            staticProps = mergedStatic.toArray();
         }
      }
   }
public void merge ( SyncProperties other ) { ArrayList < Object > myProps = null ; ArrayList < Object > myStaticProps = null ; for ( Object prop : other . classProps ) { String propName ; int propFlags ; boolean hasDefault = false ; Object defaultValue = null ; if ( prop instanceof SyncPropOptions ) { SyncPropOptions opts = ( SyncPropOptions ) prop ; propName = opts . propName ; propFlags = opts . flags ; if ( opts . hasDefault ) { hasDefault = true ; defaultValue = opts . defaultValue ; } } else { propName = ( String ) prop ; propFlags = 0 ; } if ( ( propFlags & SyncPropOptions . SYNC_STATIC ) != 0 ) { if ( staticPropIndex == null ) { staticPropIndex = new IntCoalescedHashMap ( classProps . length ) ; } if ( myStaticProps == null ) myStaticProps = new ArrayList < Object > ( ) ; if ( staticPropIndex . get ( propName ) == - 1 ) { myStaticProps . add ( propName ) ; staticPropIndex . put ( propName , propFlags ) ; } } else if ( propIndex . get ( propName ) == - 1 ) { if ( myProps == null ) myProps = new ArrayList < Object > ( Arrays . asList ( classProps ) ) ; myProps . add ( prop ) ; propIndex . put ( propName , propFlags ) ; if ( hasDefault ) { if ( defaultValueMap == null ) defaultValueMap = new HashMap < String , Object > ( ) ; defaultValueMap . put ( propName , defaultValue ) ; } } } if ( myProps != null ) { classProps = myProps . toArray ( new Object [ classProps . length ] ) ; if ( chainedProps != null ) System . err . println ( "*** Not merging in chainedProperties!" ) ; allProps = classProps ; } if ( myStaticProps != null ) { if ( staticProps == null ) staticProps = myStaticProps . toArray ( ) ; else { ArrayList < Object > mergedStatic = new ArrayList < Object > ( ) ; mergedStatic . addAll ( Arrays . asList ( staticProps ) ) ; mergedStatic . addAll ( myStaticProps ) ; staticProps = mergedStatic . toArray ( ) ; } } }
Merges the other properties - only replacing properties which do not exist in this sync properties.
Merges the other properties - only replacing properties which do not exist in this sync properties .
// TODO: this is used when building the SyncProperties at compile time which right now does not use chainedProps so we should be ok