return whether a given component is the 'primary' or 'secondary'
        component in its parent orbit
336293
def get_primary_or_secondary(self, component, return_ind=False):
        
        parent = self.get_parent_of(component)
        if parent is None:
            # then this is a single component, not in a binary
            return 'primary'

        children_of_parent = self.get_children_of(parent)

        ind = children_of_parent.index(component)

        if ind > 1:
            return None

        if return_ind:
            return ind + 1

        return ['primary', 'secondary'][ind]
1278207
private int getComponentState(JComponent c) {
        if (rootParent != null) {

            if (isParentSelected()) {
                return SELECTED;
            }
        }

        return SeaGlassLookAndFeel.getComponentState(c);
    }
1142676
def _is_parent(self, roleid1, roleid2):
        """"""

        role2 = copy.deepcopy(self.flatten[roleid2])
        role1 = copy.deepcopy(self.flatten[roleid1])

        if role1 == role2:
            return False

        # Check if role1 is contained by role2
        for b1 in role1['backends_groups']:
            if b1 not in role2['backends_groups']:
                return False
            for group in role1['backends_groups'][b1]:
                if group not in role2['backends_groups'][b1]:
                    return False

        # If role2 is inside role1, roles are equal, throw exception
        for b2 in role2['backends_groups']:
            if b2 not in role1['backends_groups']:
                return True
            for group in role2['backends_groups'][b2]:
                if group not in role1['backends_groups'][b2]:
                    return True
        raise DumplicateRoleContent(roleid1, roleid2)
272742
function (primary, secondary) {
            var primary = primary || {};
            for (var property in secondary)
                if (secondary.hasOwnProperty(property))
                    primary[property] = secondary[property];
            return primary;
        }
136460
function (root, componentType) {
    return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
      return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
    });
  }
388576
function isOpponentsEqual(exOpponents, currentOpponents) {
    var ans = false,
        cOpponents = currentOpponents.sort();

    if (exOpponents.length) {
        exOpponents.forEach(function(i) {
            var array = i.sort();

            ans = (array.length == cOpponents.length) && array.every(function(el, index) {
                return el === cOpponents[index];
            });
        });
    }

    return ans;
}
305760
def mass2_from_mass1_eta(mass1, eta, force_real=True):
    
    return mass_from_knownmass_eta(mass1, eta, known_is_secondary=False,
                                   force_real=force_real)
331279
def primary_xi(mass1, mass2, spin1x, spin1y, spin2x, spin2y):
    
    spinx = primary_spin(mass1, mass2, spin1x, spin2x)
    spiny = primary_spin(mass1, mass2, spin1y, spin2y)
    return chi_perp_from_spinx_spiny(spinx, spiny)
1372024
function(name) {
      if (name) {
        var i = 0;
        var comps = this.jCal[COMPONENT_INDEX];
        var len = comps.length;

        for (; i < len; i++) {
          if (comps[i][NAME_INDEX] === name) {
            var result = this._hydrateComponent(i);
            return result;
          }
        }
      } else {
        if (this.jCal[COMPONENT_INDEX].length) {
          return this._hydrateComponent(0);
        }
      }

      // ensure we return a value (strict mode)
      return null;
    }
37629
function isAncestor(instA, instB) {
  while (instB) {
    if (instA === instB || instA === instB.alternate) {
      return true;
    }
    instB = getParent(instB);
  }
  return false;
}
728026
def component(self, extra_params=None):
        
        if self.get('component_id', None):
            components = self.space.components(id=self['component_id'], extra_params=extra_params)
            if components:
                return components[0]
23807
def is_parent_of(page1, page2):
    

    try:
        return page1.tree_id == page2.tree_id and page1.lft < page2.lft and page1.rght > page2.rght
    except AttributeError:
        return False
535125
def spin_px(self):
        """"""
        return conversions.primary_spin(self.mass1, self.mass2, self.spin1x,
                                        self.spin2x)
1025661
def GetSchema(component):
    
    parent = component
    while not isinstance(parent, XMLSchema):
        parent = parent._parent()
    return parent
1123346
def is_view_child(view, par):
    '''
    
    '''
    if par.base is None:
        # par is the base array.
        return view.base is par
    else:
        # par is a view of another array as well!
        # view can only be a child of par if they share base.
        return view.base is par.base
998906
def get_orbits(self):
        
        #~ l = re.findall(r"[\w']+", self.get_value())
        # now search for indices of orbit and take the next entry from this flat list
        #~ return [l[i+1] for i,s in enumerate(l) if s=='orbit']
        orbits = []
        for star in self.get_stars():
            parent = self.get_parent_of(star)
            if parent not in orbits and parent!='component' and parent is not None:
                orbits.append(parent)
        return orbits
359584
def mass1_from_mass2_eta(mass2, eta, force_real=True):
    
    return mass_from_knownmass_eta(mass2, eta, known_is_secondary=True,
                                   force_real=force_real)