Export the size node from data.

@param config The config reference (must not be <code>null</code>).
@return The size node.
@throws LionEngineException If unable to read node.
183447
public static Xml exports(SizeConfig config)
    {
        Check.notNull(config);

        final Xml node = new Xml(NODE_SIZE);
        node.writeInteger(ATT_WIDTH, config.getWidth());
        node.writeInteger(ATT_HEIGHT, config.getHeight());

        return node;
    }
313359
public static Parameters fromConfig(ConfigParams config) {
		Parameters result = new Parameters();

		if (config == null || config.size() == 0)
			return result;

		for (Map.Entry<String, String> entry : config.entrySet()) {
			result.put(entry.getKey(), entry.getValue());
		}

		return result;
	}
1273739
private void parseNamespaceFilterConfig(final Node node, final ConfigSettings config) {
		String name;
		Integer value;
		Node nnode;
		final NodeList list = node.getChildNodes();
		final int length = list.getLength();
		final Set<Integer> namespaces = new HashSet<Integer>();

		for (int i = 0; i < length; i++) {
			nnode = list.item(i);

			name = nnode.getNodeName().toUpperCase();
			if (name.equals(NAMESPACE_TO_KEEP)) {

				value = Integer.parseInt(nnode.getChildNodes().item(0)
						.getNodeValue());
				namespaces.add(value);


			}

		}

		config.setConfigParameter(
				ConfigurationKeys.NAMESPACES_TO_KEEP,
				namespaces);

	}
435152
private static Map<String, Map<String, String[]>> extractConfig(Map<String, Object> config) {
        Map<String, String[]> factories = new HashMap<String, String[]>();
        Map<String, String[]> channels = new HashMap<String, String[]>();
        Map<String, String[]> chains = new HashMap<String, String[]>();
        Map<String, String[]> groups = new HashMap<String, String[]>();
        Map<String, String[]> endpoints = new HashMap<String, String[]>();

        for (Map.Entry<String, Object> entry : config.entrySet()) {
            String key = entry.getKey();
            String name;
            if (key.startsWith(CHANNEL_PREFIX)) {
                name = key.substring(CHANNEL_PREFIX.length()).trim();
                if (0 != name.length()) {
                    channels.put(name, (String[]) entry.getValue());
                }
            } else if (key.startsWith(CHAIN_PREFIX)) {
                name = key.substring(CHAIN_PREFIX.length()).trim();
                if (0 != name.length()) {
                    chains.put(name, (String[]) entry.getValue());
                }
            } else if (key.startsWith(GROUP_PREFIX)) {
                name = key.substring(GROUP_PREFIX.length()).trim();
                if (0 != name.length()) {
                    groups.put(name, (String[]) entry.getValue());
                }
            } else if (key.startsWith(FACTORY_PREFIX)) {
                name = key.substring(FACTORY_PREFIX.length()).trim();
                if (0 != name.length()) {
                    factories.put(name, (String[]) entry.getValue());
                }
            } else if (key.startsWith(ENDPOINT_PREFIX)) {
                name = key.substring(ENDPOINT_PREFIX.length()).trim();
                if (0 != name.length()) {
                    endpoints.put(name, (String[]) entry.getValue());
                }
            }
        }
        Map<String, Map<String, String[]>> rc = new HashMap<String, Map<String, String[]>>();
        rc.put("factories", factories);
        rc.put("channels", channels);
        rc.put("chains", chains);
        rc.put("groups", groups);
        rc.put("endpoints", endpoints);
        return rc;
    }
326055
private static org.rythmengine.RythmEngine createEngine(TemplateConfig config) {
		if (null == config) {
			config = new TemplateConfig();
		}
		
		final Properties props = new Properties();
		final String path = config.getPath();
		if (null != path) {
			props.put("home.template", path);
		}

		final org.rythmengine.RythmEngine engine = new org.rythmengine.RythmEngine(props);
		return engine;
	}
564668
public long getNodeChangedSize(String nodePath)
   {
      long nodeDelta = 0;

      Iterator<ChangesItem> changes = iterator();
      while (changes.hasNext())
      {
         nodeDelta += changes.next().getNodeChangedSize(nodePath);
      }

      return nodeDelta;
   }
65212
public static SizeConfig imports(Configurer configurer)
    {
        Check.notNull(configurer);

        return imports(configurer.getRoot());
    }
87048
private static Configuration createCfg(TemplateConfig config) {
		if (null == config) {
			config = new TemplateConfig();
		}

		final Configuration cfg = new Configuration(Configuration.VERSION_2_3_28);
		cfg.setLocalizedLookup(false);
		cfg.setDefaultEncoding(config.getCharset().toString());

		switch (config.getResourceMode()) {
		case CLASSPATH:
			cfg.setTemplateLoader(new ClassTemplateLoader(ClassUtil.getClassLoader(), config.getPath()));
			break;
		case FILE:
			try {
				cfg.setTemplateLoader(new FileTemplateLoader(FileUtil.file(config.getPath())));
			} catch (IOException e) {
				throw new IORuntimeException(e);
			}
			break;
		case WEB_ROOT:
			 try {
				 cfg.setTemplateLoader(new FileTemplateLoader(FileUtil.file(FileUtil.getWebRoot(), config.getPath())));
			 } catch (IOException e) {
				 throw new IORuntimeException(e);
			 }
			break;
		case STRING:
			cfg.setTemplateLoader(new SimpleStringTemplateLoader());
			break;
		default:
			break;
		}
		
		return cfg;
	}
807930
static JmxMeasurementConfig from(Config config) {
    String name = config.getString("name");
    Map<String, String> tags = config.getConfigList("tags")
        .stream()
        .collect(Collectors.toMap(c -> c.getString("key"), c -> c.getString("value")));
    String value = config.getString("value");
    boolean counter = config.hasPath("counter") && config.getBoolean("counter");
    return new JmxMeasurementConfig(name, tags, value, counter);
  }
13443
public synchronized static CFMLEngine getInstance(final ServletConfig config) throws ServletException {

	if (singelton != null) {
	    if (factory == null) factory = singelton.getCFMLEngineFactory(); // not sure if this ever is done, but it does not hurt
	    return singelton;
	}

	if (factory == null) factory = new CFMLEngineFactory(config);

	// read init param from config
	factory.readInitParam(config);

	factory.initEngineIfNecessary();
	singelton.addServletConfig(config);

	// add listener for update
	// factory.addListener(singelton);
	return singelton;
    }
1037002
@Override
    public int size() {
        try {
            lockAllSegments();
            int size = 0;
            for (LinkedHashMapSegment<K, V> seg : segments) {
                size += seg.size();
            }
            return size;
        } finally {
            unlockAllSegments();
        }
    }
398549
public static void setConfiguredSize(
      final View parentView,
      final View draweeView,
      final Config config) {
    if (parentView != null) {
      if (config.overrideSize) {
        SizeUtil.updateViewLayoutParams(
            draweeView,
            config.overridenWidth,
            config.overridenHeight);
      } else {
        int size = SizeUtil.calcDesiredSize(
            parentView.getContext(),
            parentView.getWidth(),
            parentView.getHeight());
        SizeUtil.updateViewLayoutParams(draweeView, size, (int) (size / Const.RATIO));
      }
    }
  }
1351799
@Override
	public void applyConfig(final ConfigSettings config)
	{

		Object o = config
				.getConfigParameter(ConfigurationKeys.LIMIT_TASK_SIZE_REVISIONS);
		if (o != null) {
			this.articleTaskLimitField.setText(Long.toString((Long) o));
		}
		else {
			this.articleTaskLimitField.setText("");
		}

		o = config.getConfigParameter(ConfigurationKeys.LIMIT_TASK_SIZE_DIFFS);
		if (o != null) {
			this.diffTaskLimitField.setText(Long.toString((Long) o));
		}
		else {
			this.diffTaskLimitField.setText("");
		}

		o = config
				.getConfigParameter(ConfigurationKeys.LIMIT_SQLSERVER_MAX_ALLOWED_PACKET);
		if (o != null) {
			this.maxAllowedPacketField.setText(Long.toString((Long) o));
		}
		else {
			this.maxAllowedPacketField.setText("");
		}
	}
797422
@SuppressWarnings({ "rawtypes", "unchecked" })
	public Map getMap(NodeConfig nodeConfig) {
		Map map = new HashMap();
		List<AttributeConfig> attributes = nodeConfig.getAttribute();
		map.putAll(getAttribute(attributes));

		List<NodeConfig> childrenNodes = nodeConfig.getChildrenNodes();
		if (childrenNodes != null && childrenNodes.size() > 0) {
			for (NodeConfig childNode : childrenNodes) {
				String name = childNode.getName();
				Object value = childNode.getValue();

				if (childNode.hasChildren()) {
					Map childNodeMap = getMap(childNode);
					map.put(name, addToList(map.get(name), childNodeMap));
				} else {
					if (childNode.hasAttributes()) {
						Map attributeMap = new HashMap();
						attributeMap = getAttribute(childNode.getAttribute());
						if (attributeMap.size() > 0) {
							if (value != null && value instanceof String) {
								attributeMap.put("nodeValue", value);
							}
							value = attributeMap;
						}
					}
				}

				if (value != null) {
					map.put(name, addToList(map.get(name), value));
				}
			}
		}
		if (nodeConfig.getName() != null && nodeConfig.getValue() != null) {
			map.put(nodeConfig.getName(), nodeConfig.getValue());
		}
		return map;
	}
1098186
public static Configuration loadFromString(String config)
    throws IOException, SAXException {
    ConfigurationImpl cfg = new ConfigurationImpl();

    XMLReader parser = XMLReaderFactory.createXMLReader();
    parser.setContentHandler(new ConfigHandler(cfg, null));
    Reader reader = new StringReader(config);
    parser.parse(new InputSource(reader));
    return cfg;
  }
1074870
private static org.thymeleaf.TemplateEngine createEngine(TemplateConfig config) {
		if (null == config) {
			config = new TemplateConfig();
		}
		
		ITemplateResolver resolver = null;
		switch (config.getResourceMode()) {
		case CLASSPATH:
			final ClassLoaderTemplateResolver classLoaderResolver = new ClassLoaderTemplateResolver();
			classLoaderResolver.setCharacterEncoding(config.getCharsetStr());
			classLoaderResolver.setTemplateMode(TemplateMode.HTML);
			classLoaderResolver.setPrefix(StrUtil.addSuffixIfNot(config.getPath(), "/"));
			resolver = classLoaderResolver;
			break;
		case FILE:
			final FileTemplateResolver fileResolver = new FileTemplateResolver();
			fileResolver.setCharacterEncoding(config.getCharsetStr());
			fileResolver.setTemplateMode(TemplateMode.HTML);
			fileResolver.setPrefix(StrUtil.addSuffixIfNot(config.getPath(), "/"));
			resolver = fileResolver;
			break;
		case WEB_ROOT:
			final FileTemplateResolver webRootResolver = new FileTemplateResolver();
			webRootResolver.setCharacterEncoding(config.getCharsetStr());
			webRootResolver.setTemplateMode(TemplateMode.HTML);
			webRootResolver.setPrefix(StrUtil.addSuffixIfNot(FileUtil.getAbsolutePath(FileUtil.file(FileUtil.getWebRoot(), config.getPath())), "/"));
			resolver = webRootResolver;
			break;
		case STRING:
			resolver = new StringTemplateResolver();
			break;
		case COMPOSITE:
			resolver = new DefaultTemplateResolver();
			break;
		default:
			resolver = new DefaultTemplateResolver();
			break;
		}
		
		final org.thymeleaf.TemplateEngine engine = new org.thymeleaf.TemplateEngine();
		engine.setTemplateResolver(resolver);
		return engine;
	}
724574
public function export($dataSetConfig = null)
    {
        $export = [
            'label' => $this->getLabel(),
            'data'  => [],
        ];

        foreach ($this->getData() as $data) {
            $export['data'][] = $data->export();
        }

        if (null !== $dataSetConfig) {
            $export = array_merge($export, $dataSetConfig->export());
        }

        return $export;
    }