public void addChildElement(Object obj) { if (_children == null) { _children = new NSMutableArray(); } _children.addObject(obj); }
public NSArray<MInstance> runningInstances_M() { NSMutableArray<MInstance> instances = new NSMutableArray<>(); int numInstances = _instanceArray.count(); for (int i=0; i<numInstances; i++) { MInstance anInstance = (MInstance) _instanceArray.objectAtIndex(i); if (anInstance.isRunning_M()) { instances.addObject(anInstance); } } return instances; }
public NSArray<ERIAttribute> allAttributes() { NSMutableArray<ERIAttribute> result = new NSMutableArray<>(); for (ERIAttributeGroup group : groups()) { result.addObjectsFromArray(attributes()); } return result; }
public static NSArray<String> partialAttributes() { if ( _partialAttributes == null ) { synchronized(ENTITY_NAME) { NSMutableArray<String> partialList = new NSMutableArray<String>(); partialList.addObject( LAST_LOGIN_DATE_KEY ); partialList.addObject( PASSWORD_KEY ); partialList.addObject( USERNAME_KEY ); _partialAttributes = partialList.immutableClone(); } } return _partialAttributes; }
/********** Adding and Removing Instance primitives **********/ public void _addInstancePrimitive(MInstance anInstance) { _instanceArray.addObject(anInstance); if (!_hostArray.containsObject(anInstance._host)) { _hostArray.addObject(anInstance._host); } }
public void flatListForAttribute(DRAttribute att) { //OWDebug.println(1, "att:"+att); if (!att.isGroup()) { //OWDebug.println(1, "att is NOT group"); _flatAttributeList.addObject(att); } else { //OWDebug.println(1, "att IS group"); NSArray subvls = att.flatAttributesWithDepthDictionary(_attributeListDepth, _flatAttributeDepthDict); _flatAttributeList.addObjectsFromArray(subvls); if (att.shouldTotal()) { _flatAttributeList.addObject(att); } } Number dpthKey = Integer.valueOf(_attributeListDepth); //OWDebug.println(1, "dpthKey:"+dpthKey); NSMutableArray lst = (NSMutableArray)_flatAttributeDepthDict.objectForKey(dpthKey); if (lst == null) { lst = new NSMutableArray(); _flatAttributeDepthDict.setObjectForKey(lst, dpthKey); } lst.addObject(att); //OWDebug.println(1, "lst:"+lst); }
public boolean isStopped_M() { int numInstances = _instanceArray.count(); for (int i=0; i<numInstances; i++) { MInstance anInstance = (MInstance) _instanceArray.objectAtIndex(i); if (anInstance.state != MObject.DEAD) { return false; } } return true; } }
public synchronized NSArray orderedComponents(EOEditingContext ec) { NSMutableArray result = new NSMutableArray(); if (_cachedComponentsByGlobalID == null) { _cachedComponents = new NSMutableArray(); _cachedComponentsByGlobalID = new NSMutableDictionary(); addChildrenOfComponentToArray(null, result, ec); int level = 0; for (Enumeration e = result.objectEnumerator(); e.hasMoreElements();) { Component component = (Component) e.nextElement(); String sortOrder = (level < 10 ? "0" : "") + (level); _cachedComponentsByGlobalID.setObjectForKey(sortOrder, component.permanentGlobalID()); _cachedComponents.addObject(component.permanentGlobalID()); level++; } } result.removeAllObjects(); for (Enumeration e = _cachedComponents.objectEnumerator(); e.hasMoreElements();) { EOGlobalID gid = (EOGlobalID) e.nextElement(); Component component = (Component) ec.faultForGlobalID(gid, ec); if(component != null) { result.addObject(component); } else { log.error("No object: " + gid); } } return result; }
public void moveUp(DRAttribute member, boolean up) { int cnt; NSMutableArray arr = _attribute.attributes(); int cur = arr.indexOfObject(member); arr.removeObject(member); cnt = arr.count(); if (up) { int newdex = cur-1; if (newdex < 0) { arr.addObject(member); } else { arr.insertObjectAtIndex(member, newdex); } } else { int newdex = cur+1; if (newdex > cnt) { arr.insertObjectAtIndex(member, 0); } else { arr.insertObjectAtIndex(member, newdex); } } }
if (config != null) { if (!config.active) { for (Enumeration e1 = config.notificationKeys.objectEnumerator(); e1.hasMoreElements();) { String key = (String) e1.nextElement(); Object value = null; NSMutableArray<EOQualifier> qualifiers = new NSMutableArray(rel.joins().count()); NSDictionary pk = source.primaryKeyForGlobalID(sourceGlobalID); for (Iterator iterator = rel.joins().iterator(); iterator.hasNext();) { Object pkValue = pk.objectForKey(join.sourceAttribute().name()); EOKeyValueQualifier qualifier = new EOKeyValueQualifier(join.destinationAttribute().name(), EOQualifier.QualifierOperatorEqual, pkValue); qualifiers.addObject(qualifier); fs.setQualifier(qualifiers.count() == 1 ? qualifiers.lastObject() : new EOAndQualifier(qualifiers)); value = ec.objectsWithFetchSpecification(fs);
public NSArray<ERIAttributeGroup> groups() { NSMutableArray<ERIAttributeGroup> result = new NSMutableArray<>(); ERIAttributeGroup current = this; result.addObject(current); while (current.parent() != null) { result.insertObjectAtIndex(current, 0); current = current.parent(); } return result; }
NSMutableArray<EOAttribute> fetchAttributes = new NSMutableArray<>(); fetchAttributes.addObjectsFromArray(_entity.primaryKeyAttributes()); fetchAttributes.addObject(tagNameAttribute); EOFetchSpecification fetchSpec = new EOFetchSpecification(_entity.name(), tagNameQualifier, null); EOSQLExpression sqlExpression = sqlHelper.sqlExpressionForFetchSpecification(editingContext, fetchSpec, 0, -1, fetchAttributes); NSMutableArray<EOAttribute> groupByAttributes = new NSMutableArray<>(); groupByAttributes.addObjectsFromArray(pkAttrs); sqlHelper.addGroupByClauseToExpression(groupByAttributes, sqlExpression); sqlHelper.addHavingCountClauseToExpression(EOQualifier.QualifierOperatorEqual, tagNames.count(), sqlExpression); NSMutableArray<Object> itemPrimaryKeys = new NSMutableArray<>(); NSArray<NSDictionary> rawRows = ERXEOAccessUtilities.rawRowsForSQLExpression(editingContext, _entity.model(), sqlExpression, pkAttrs); EOAttribute pkAttr = pkAttrs.objectAtIndex(0); for (NSDictionary rawRow : rawRows) { Object pk = rawRow.objectForKey(pkAttr.name()); itemPrimaryKeys.addObject(pk); NSMutableArray<EOAttribute> tagsFetchAttributes = new NSMutableArray<>(); tagsFetchAttributes.addObjectsFromArray(_entity.primaryKeyAttributes()); tagsFetchAttributes.addObject(tagIDAttribute); tagsFetchAttributes.addObject(tagNameAttribute); tagsFetchAttributes.addObject(countAttribute); NSMutableArray<EOAttribute> tagsGroupByAttributes = new NSMutableArray<>(new EOAttribute[] { tagNameAttribute, tagIDAttribute });
protected void _makePrimarySortOrderingWithSelector(NSSelector aSelector) { String aKey = _selectedKey; WODisplayGroup aDisplayGroup = displayGroup(); NSArray<EOSortOrdering> sortOrderings = aDisplayGroup.sortOrderings(); NSMutableArray<EOSortOrdering> aSortOrderingArray; if (sortOrderings!=null) { aSortOrderingArray = new NSMutableArray<>(sortOrderings); } else { aSortOrderingArray = new NSMutableArray<>(); } EOSortOrdering aNewSortOrdering = EOSortOrdering.sortOrderingWithKey(aKey, aSelector); aSortOrderingArray.insertObjectAtIndex(aNewSortOrdering, 0); if (aSortOrderingArray.count() > 3) { // ** limits sorting to 3 levels aSortOrderingArray.removeLastObject(); } aDisplayGroup.setSortOrderings(aSortOrderingArray); }
public void setSelection(Object value) { NSMutableArray selections = (selections() != null) ? selections().mutableClone() : new NSMutableArray(); if (value != null) { selections.addObject(item()); } else { selections.removeObject(item()); } setValueForBinding(selections, Bindings.selections); }
public void addToHList(DRGroup drg) { if (!_hList.containsObject(drg)) { _hList.addObject(drg); } if (_vList.containsObject(drg)) { _vList.removeObject(drg); } if (_zList.containsObject(drg)) { _zList.removeObject(drg); } }
Object highVal = null; NSMutableArray possibleValuesToUse = possibleValuesToUse(); Object maxVal = possibleValuesToUse.lastObject(); Object minVal = possibleValuesToUse.objectAtIndex(0); double v = DRValueConverter.converter().doubleForValue(aval); double maxv = DRValueConverter.converter().doubleForValue(maxVal); lowVal = maxVal; highVal = newWithDelta(maxVal, _periodicDelta); possibleValuesToUse.addObject(highVal); return valDictMaxMin(highVal, lowVal); lowVal = newWithDelta(minVal, -_periodicDelta); highVal = minVal; possibleValuesToUse.insertObjectAtIndex(lowVal, 0); return valDictMaxMin(highVal, lowVal); int pvcount = possibleValuesToUse.count(); lowVal = possibleValuesToUse.objectAtIndex(i); highVal = possibleValuesToUse.objectAtIndex(nextIndex); minv = DRValueConverter.converter().doubleForValue(lowVal); maxv = DRValueConverter.converter().doubleForValue(highVal);
protected NSDictionary serializeObject(EOEnterpriseObject eo) { NSMutableDictionary<String, Object> result = new NSMutableDictionary<>(); result.addEntriesFromDictionary(eo.snapshot()); for (Enumeration e = eo.snapshot().keyEnumerator(); e.hasMoreElements();) { String key = (String) e.nextElement(); Object value = result.objectForKey(key); if (value instanceof ERXConstant.Constant) { ERXConstant.Constant constant = (ERXConstant.Constant) value; result.setObjectForKey(constant.value(), key); } else if (value == NSKeyValueCoding.NullValue) { result.removeObjectForKey(key); } else if (value instanceof ERXGenericRecord) { ERXGenericRecord rec = (ERXGenericRecord) value; result.setObjectForKey(ERXKeyGlobalID.globalIDForGID(rec.permanentGlobalID()).asString(), key); } else if (value instanceof NSArray) { NSArray oldValue = (NSArray) value; NSMutableArray newValue = new NSMutableArray(oldValue.count()); for (Enumeration e1 = newValue.objectEnumerator(); e1.hasMoreElements();) { ERXGenericRecord rec = (ERXGenericRecord) e1.nextElement(); newValue.addObject(ERXKeyGlobalID.globalIDForGID(rec.permanentGlobalID()).asString()); } result.setObjectForKey(newValue, key); } } return result; }
public NSArray moveUpArray(DRAttribute member, boolean up, NSArray arr1) { int cnt; int cur = arr1.indexOfObject(member); NSMutableArray arr = newArraySans(arr1, member); cnt = arr.count(); if (up) { int newdex = cur-1; if (newdex < 0) { arr.addObject(member); } else { arr.insertObjectAtIndex(member, newdex); } } else { int newdex = cur+1; if (newdex > cnt) { arr.insertObjectAtIndex(member, 0); } else { arr.insertObjectAtIndex(member, newdex); } } return arr; }
public void toggleGroupInList(DRAttribute att) { int curDex; DRAttribute newAtt; NSMutableArray arr = new NSMutableArray(attributeList()); curDex = arr.indexOfObject(att); if (att.isGroup()) { newAtt = DRAttribute.withKeyPathFormatLabelTotalUserInfo(att.keyPath(), att.format(), att.label(), att.shouldTotal(), att.userInfo()); } else { newAtt = DRAttributeGroup.withKeyPathFormatLabelTotalListUserInfo(att.keyPath(), att.format(), att.label(), att.shouldTotal(), new NSMutableArray(), att.userInfo()); } arr.insertObjectAtIndex(newAtt, curDex); arr.removeObjectAtIndex(curDex+1); setAttributeList(arr); }
public NSArray currentEventDescriptions() { NSMutableArray<String> descs; NSDictionary<String,String> map; map = EOEvent.eventTypeDescriptions(currentClass); descs = new NSMutableArray<>(); descs.setArray(map.allValues()); descs.removeObject(map.objectForKey(EOEvent.EventGroupName)); try { descs.sortUsingComparator(NSComparator.AscendingStringComparator); } catch (NSComparator.ComparisonException e) { throw NSForwardException._runtimeExceptionForThrowable(e); } descs.insertObjectAtIndex(map.objectForKey(EOEvent.EventGroupName), 0); return descs; }