Gets the size of the eeprom storage for a given element type
@param item the item to determine eeprom size for
@return the eeprom storage needed.
351611
public static int eepromSizeForItem(MenuItem item) {
        return MenuItemHelper.visitWithResult(item, new AbstractMenuItemVisitor<Integer>() {
            @Override
            public void visit(AnalogMenuItem item) {
                setResult(2);
            }

            @Override
            public void visit(BooleanMenuItem item) {
                setResult(1);
            }

            @Override
            public void visit(EnumMenuItem item) {
                setResult(2);
            }

            @Override
            public void visit(TextMenuItem item) {
                setResult(item.getTextLength());
            }

            @Override
            public void anyItem(MenuItem item) {
                setResult(0);
            }
        }).orElse(0);
    }
652520
private static long getSizeOfPhysicalMemoryForMac() {

		BufferedReader bi = null;

		try {
			Process proc = Runtime.getRuntime().exec("sysctl hw.memsize");

			bi = new BufferedReader(
					new InputStreamReader(proc.getInputStream()));

			String line;

			while ((line = bi.readLine()) != null) {
				if (line.startsWith("hw.memsize")) {
					long memsize = Long.parseLong(line.split(":")[1].trim());
					bi.close();
					proc.destroy();
					return memsize;
				}
			}

		} catch (Exception e) {
			LOG.error(e);
			return -1;
		} finally {
			if (bi != null) {
				try {
					bi.close();
				} catch (IOException ioe) {
				}
			}
		}
		return -1;
	}
409365
public C getCell(T item) {
        C cell = pool.poll();
        if(cell != null) {
            cell.updateItem(item);
        } else {
            cell = cellFactory.apply(item);
        }
        return cell;
    }
683455
public final long getCurrentSize()
    {
        long result = 0;
        result = result + _storedItemManager.getCurrentSize();
        result = result + _unstoredItemManager.getCurrentSize();
        return result;
    }
911354
public synchronized void putLong(long item)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putLong", Long.valueOf(item));

      checkValid();
      getCurrentByteBuffer(4).putLong(item);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putLong");
   }
314570
public static int getPosition(Element e) {

        NodeList<Node> childNodes = e.getParentElement().getChildNodes();
        for (int i = childNodes.getLength(); i >= 0; i--) {
            if (childNodes.getItem(i) == e) {
                return i;
            }
        }
        return -1;
    }
190088
@Override
	public int size() {

		if (allElementsInCache) {
			return orderedCache.size();
		} else {
			int count = 0;
			try (final RocksBytesIterator iterator = orderedBytesIterator()) {
				while (iterator.hasNext()) {
					iterator.next();
					++count;
				}
			}
			return count;
		}
	}
904314
public long getNodeDataSize(String nodeIdentifier) throws RepositoryException
   {
      long dataSize = 0;

      ResultSet result = null;
      try
      {
         result = findNodeDataSize(getInternalId(nodeIdentifier));
         try
         {
            if (result.next())
            {
               dataSize += result.getLong(1);
            }
         }
         finally
         {
            JDBCUtils.freeResources(result, null, null);
         }

         result = findNodePropertiesOnValueStorage(getInternalId(nodeIdentifier));
         try
         {
            while (result.next())
            {
               String storageDesc = result.getString(DBConstants.COLUMN_VSTORAGE_DESC);
               String propertyId = result.getString(DBConstants.COLUMN_VPROPERTY_ID);
               int orderNum = result.getInt(DBConstants.COLUMN_VORDERNUM);

               ValueIOChannel channel = containerConfig.valueStorageProvider.getChannel(storageDesc);

               dataSize += channel.getValueSize(getIdentifier(propertyId), orderNum);
            }
         }
         finally
         {
            JDBCUtils.freeResources(result, null, null);
         }
      }
      catch (IOException e)
      {
         throw new RepositoryException(e);
      }
      catch (SQLException e)
      {
         throw new RepositoryException(e.getMessage(), e);
      }

      return dataSize;
   }
54087
public int submitSingle(T item) {
        if (Objects.isNull(item))
            return 0;
        synchronized (this.dataList) {
            this.dataList.add(item);
            setLastDataTimestamp();
            if (this.dataList.size() >= this.bulkSize)
                flush();
            return 1;
        }
    }
856993
async def get_element_size(self, elem_type, elem=None, params=None):
        
        if hasattr(elem_type, 'blob_size'):
            elem = elem_type() if elem is None else elem
            return await elem.blob_size(self)

        if issubclass(elem_type, x.UVarintType):
            raise helpers.ArchiveException('Unknown size for varint')

        elif issubclass(elem_type, x.IntType):
            return elem_type.WIDTH

        elif issubclass(elem_type, x.BlobType):
            if elem is not None:
                return len(elem)
            if not elem_type.FIX_SIZE:
                raise helpers.ArchiveException('Unknown size for blob')
            return elem_type.SIZE

        elif issubclass(elem_type, x.UnicodeType):
            raise helpers.ArchiveException('Unknown size for string')

        elif issubclass(elem_type, x.VariantType):
            raise helpers.ArchiveException('Unknown size for variant')

        elif issubclass(elem_type, x.ContainerType):  # container ~ simple list
            celem_type = x.container_elem_type(elem_type, params)
            if elem is not None:
                return len(elem) * await self.get_element_size(elem_type=celem_type, elem=elem[0] if len(elem) > 0 else None)
            if not elem_type.FIX_SIZE:
                raise helpers.ArchiveException('Unknown size for container')
            return elem_type.SIZE * await self.get_element_size(elem_type=celem_type)

        elif issubclass(elem_type, x.TupleType):  # tuple ~ simple list
            acc = 0
            for t in elem_type.f_specs():
                acc += await self.get_element_size(t)
            return acc

        elif issubclass(elem_type, x.MessageType):
            acc = 0
            for t in elem_type.f_specs():
                acc += await self.get_element_size(t[1], params=t[2:])
            return acc

        else:
            raise TypeError
814285
@SuppressWarnings("resource")
	private static long getSizeOfPhysicalMemoryForLinux() {
		BufferedReader lineReader = null;
		try {
			lineReader = new BufferedReader(new FileReader(LINUX_MEMORY_INFO_PATH));

			String line = null;
			while ((line = lineReader.readLine()) != null) {
				Matcher matcher = LINUX_MEMORY_REGEX.matcher(line);
				if (matcher.matches()) {
					String totalMemory = matcher.group(1);
					return Long.parseLong(totalMemory) * 1024L; // Convert from kilobyte to byte
				}
			}
			
			// expected line did not come
			LOG.error("Cannot determine the size of the physical memory using '/proc/meminfo'. Unexpected format.");
			return -1;
		}
		catch (NumberFormatException e) {
			LOG.error("Cannot determine the size of the physical memory using '/proc/meminfo'. Unexpected format.");
			return -1;
		}
		catch (IOException e) {
			LOG.error("Cannot determine the size of the physical memory using '/proc/meminfo': " + e.getMessage(), e);
			return -1;
		}
		finally {
			// Make sure we always close the file handle
			try {
				if (lineReader != null) {
					lineReader.close();
				}
			} catch (Throwable t) {}
		}
	}
1014393
private static String getFullNameForItem(@Nullable BlueOrganization org, @Nonnull Item item) {
        ItemGroup<?> group = getBaseGroup(org);
        return Functions.getRelativeNameFrom(item, group);
    }
455225
@Override
    public long getItemId(int position) {
        if (shouldInsertItemAtPosition(position)) {
            return getItem(position).getIdentifier();
        } else {
            return mAdapter.getItemId(position - itemInsertedBeforeCount(position));
        }
    }
1308001
def GetByteSize(self):
    
    if not self.element_data_type_definition:
      return None

    if self.elements_data_size:
      return self.elements_data_size

    if not self.number_of_elements:
      return None

    element_byte_size = self.element_data_type_definition.GetByteSize()
    if not element_byte_size:
      return None

    return element_byte_size * self.number_of_elements
23329
static public int sizeOf(WsByteBuffer[] list) {
        if (null == list) {
            return 0;
        }
        int size = 0;
        for (int i = 0; i < list.length; i++) {
            if (null != list[i]) {
                size += list[i].remaining();
            }
        }
        return size;
    }
121374
@Override public int getItemCount() {
    int size = items.size();
    if (hasHeader()) {
      size++;
    }
    if (hasFooter()) {
      size++;
    }
    return size;
  }
341685
@Override
    public ItemProcessor getProcessor(Item item) {
        for (Map.Entry<String, ItemProcessor> mapping : patternToProcessorMappings.entrySet()) {
            if (item.getUrl().matches(mapping.getKey())) {
                return mapping.getValue();
            }
        }

        return null;
    }