text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Statistics of PART in UD_Swedish-LinES</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Swedish-LinES: POS Tags: PART

There are 6 PART lemmas (0%), 6 PART types (0%) and 2052 PART tokens (2%).
Out of 17 observed tags, the rank of PART is: 17 in number of lemmas, 17 in number of types and 12 in number of tokens.

The 10 most frequent PART lemmas: att, inte, så, ej, icke, to

The 10 most frequent PART types:  att, inte, så, ej, icke, to

The 10 most frequent ambiguous lemmas: att (<tt>PART</tt> 1177, <tt>SCONJ</tt> 821), så (<tt>ADV</tt> 306, <tt>SCONJ</tt> 27, <tt>PART</tt> 16, <tt>CCONJ</tt> 15), to (<tt>ADP</tt> 1, <tt>PART</tt> 1)

The 10 most frequent ambiguous types:  att (<tt>PART</tt> 1147, <tt>SCONJ</tt> 820), så (<tt>ADV</tt> 285, <tt>SCONJ</tt> 22, <tt>PART</tt> 16, <tt>CCONJ</tt> 13, <tt>ADJ</tt> 8)

att

<tt>PART</tt> 1147: Konsekvenser av att filtrera beräkningar

<tt>SCONJ</tt> 820: Han gissade att hon var i tjugoårsåldern .

så

<tt>ADV</tt> 285: Blir det bra så ? undrade Auster .

<tt>SCONJ</tt> 22: 1 Först filtreras fältet Sport så att endast golfförsäljningen visas .

<tt>PART</tt> 16: Eftersom checken är i mitt namn så kan jag lösa in den åt er .

<tt>CCONJ</tt> 13: På tal om resurser , ny teknik och talartid så är min tid ute .

<tt>ADJ</tt> 8: i så fall har du mer eller mindre hunnit komma i ordning när hon kommer ner .

Morphology

The form / lemma ratio of PART is 1.000000 (the average of all parts of speech is 1.416904).

The 1st highest number of forms (1) was observed with the lemma "att": att.

The 2nd highest number of forms (1) was observed with the lemma "ej": ej.

The 3rd highest number of forms (1) was observed with the lemma "icke": icke.

PART occurs with 1 features: <tt>Polarity</tt> (11; 1% instances)

PART occurs with 1 feature-value pairs: Polarity=Neg

PART occurs with 2 feature combinations.
The most frequent feature combination is _ (2041 tokens).
Examples: att, inte, så, to

Relations

PART nodes are attached to their parents using 8 different relations: <tt>mark</tt> (1176; 57% instances), <tt>advmod</tt> (847; 41% instances), <tt>discourse</tt> (16; 1% instances), <tt>conj</tt> (6; 0% instances), <tt>fixed</tt> (3; 0% instances), <tt>root</tt> (2; 0% instances), <tt>dislocated</tt> (1; 0% instances), <tt>parataxis</tt> (1; 0% instances)

Parents of PART nodes belong to 12 different parts of speech: <tt>VERB</tt> (1739; 85% instances), <tt>ADJ</tt> (111; 5% instances), <tt>NOUN</tt> (88; 4% instances), <tt>ADV</tt> (59; 3% instances), <tt>PRON</tt> (24; 1% instances), <tt>AUX</tt> (16; 1% instances), <tt>PROPN</tt> (6; 0% instances), <tt>ADP</tt> (2; 0% instances), <tt>NUM</tt> (2; 0% instances),  (2; 0% instances), <tt>SCONJ</tt> (2; 0% instances), <tt>DET</tt> (1; 0% instances)

2027 (99%) PART nodes are leaves.

19 (1%) PART nodes have one child.

5 (0%) PART nodes have two children.

1 (0%) PART nodes have three or more children.

The highest child degree of a PART node is 4.

Children of PART nodes are attached using 8 different relations: <tt>advmod</tt> (9; 27% instances), <tt>punct</tt> (7; 21% instances), <tt>cc</tt> (6; 18% instances), <tt>fixed</tt> (6; 18% instances), <tt>nsubj</tt> (2; 6% instances), <tt>advcl</tt> (1; 3% instances), <tt>discourse</tt> (1; 3% instances), <tt>parataxis</tt> (1; 3% instances)

Children of PART nodes belong to 6 different parts of speech: <tt>ADV</tt> (15; 45% instances), <tt>PUNCT</tt> (7; 21% instances), <tt>CCONJ</tt> (6; 18% instances), <tt>PRON</tt> (2; 6% instances), <tt>VERB</tt> (2; 6% instances), <tt>INTJ</tt> (1; 3% instances)

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
package com.alibaba.jstorm.metric;

import backtype.storm.generated.MetricInfo;
import backtype.storm.generated.TopologyMetric;
import backtype.storm.utils.Utils;
import com.alibaba.jstorm.cache.JStormCache;
import com.alibaba.jstorm.cache.RocksDBCache;
import com.alibaba.jstorm.cache.TimeoutMemCache;
import com.alibaba.jstorm.client.ConfigExtension;
import com.alibaba.jstorm.cluster.StormClusterState;
import com.alibaba.jstorm.cluster.StormConfig;
import com.alibaba.jstorm.utils.OSInfo;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;

/**
 * metrics cache. we maintain the following data in rocks DB cache: 1. all topology ids 2. topology id ==> all metrics meta(map<metric_name, metric_id>) 3.
 * topology id ==> all metrics data
 *
 * @author Cody (weiyue.wy@alibaba-inc.com)
 * @since 2.0.5
 */
@SuppressWarnings("unchecked")
public class JStormMetricCache {
    private static final Logger LOG = LoggerFactory.getLogger(JStormMetricCache.class);

    public static final String TIMEOUT_MEM_CACHE_CLASS = TimeoutMemCache.class.getName();
    public static final String ROCKS_DB_CACHE_CLASS = RocksDBCache.class.getName();

    protected final Object lock = new Object();

    protected JStormCache cache = null;

    protected static final String METRIC_META_PREFIX = "__metric.meta__";
    protected static final String SENT_METRIC_META_PREFIX = "__saved.metric.meta__";
    protected static final String TOPOLOGY_SAMPLE_RATE = "__topology.sample.rate__";

    protected static final String METRIC_DATA_PREFIX = "__metric.data__";
    protected static final String METRIC_DATA_30M_COMPONENT = "__metric.data.comp__";
    protected static final String METRIC_DATA_30M_TASK = "__metric.data.task__";
    protected static final String METRIC_DATA_30M_STREAM = "__metric.data.stream__";
    protected static final String METRIC_DATA_30M_WORKER = "__metric.data.worker__";
    protected static final String METRIC_DATA_30M_NETTY = "__metric.data.netty__";
    protected static final String METRIC_DATA_30M_TOPOLOGY = "__metric.data.topology__";
    protected static final String METRIC_DATA_30M_COMP_STREAM = "__metric.data.comp.stream__";

    protected final StormClusterState zkCluster;

    public String getNimbusCacheClass(Map conf) {
        boolean isLinux = OSInfo.isLinux();
        boolean isMac = OSInfo.isMac();
        boolean isLocal = StormConfig.local_mode(conf);

        if (isLocal) {
            return TIMEOUT_MEM_CACHE_CLASS;
        }

        if (!isLinux && !isMac) {
            return TIMEOUT_MEM_CACHE_CLASS;
        }

        String nimbusCacheClass = ConfigExtension.getNimbusCacheClass(conf);
        if (!StringUtils.isBlank(nimbusCacheClass)) {
            return nimbusCacheClass;
        }

        return ROCKS_DB_CACHE_CLASS;
    }

    public JStormMetricCache(Map conf, StormClusterState zkCluster) {
        String dbCacheClass = getNimbusCacheClass(conf);
        LOG.info("JStorm metrics cache will use {}", dbCacheClass);

        boolean reset = ConfigExtension.getMetricCacheReset(conf);
        try {
            cache = (JStormCache) Utils.newInstance(dbCacheClass);

            String dbDir = StormConfig.metricDbDir(conf);
            conf.put(RocksDBCache.ROCKSDB_ROOT_DIR, dbDir);
            conf.put(RocksDBCache.ROCKSDB_RESET, reset);
            cache.init(conf);
        } catch (Exception e) {
            if (!reset && cache != null) {
                LOG.error("Failed to init rocks db, will reset and try to re-init...");
                conf.put(RocksDBCache.ROCKSDB_RESET, true);
                try {
                    cache.init(conf);
                } catch (Exception ex) {
                    LOG.error("Error", ex);
                }
            } else {
                LOG.error("Failed to create metrics cache!", e);
                throw new RuntimeException(e);
            }
        }

        this.zkCluster = zkCluster;
    }

    public JStormCache getCache() {
        return cache;
    }

    public JStormCache put(String k, Object v) {
        cache.put(k, v);
        return cache;
    }

    /**
     * store 30min metric data. the metric data is stored in a ring.
     */
    public JStormCache putMetricData(String topologyId, TopologyMetric tpMetric) {
        // map<key, [ts, metric_info]>
        Map<String, Object> batchData = new HashMap<>();
        long ts = System.currentTimeMillis();
        int tp = 0, comp = 0, compStream = 0, task = 0, stream = 0, worker = 0, netty = 0;
        if (tpMetric.get_componentMetric().get_metrics_size() > 0) {
            batchData.put(METRIC_DATA_30M_COMPONENT + topologyId, new Object[]{ts, tpMetric.get_componentMetric()});
            comp += tpMetric.get_componentMetric().get_metrics_size();
        }
        if (tpMetric.is_set_compStreamMetric() && tpMetric.get_compStreamMetric().get_metrics_size() > 0) {
            batchData.put(METRIC_DATA_30M_COMP_STREAM + topologyId, new Object[]{ts, tpMetric.get_compStreamMetric()});
            compStream += tpMetric.get_compStreamMetric().get_metrics_size();
        }
        if (tpMetric.get_taskMetric().get_metrics_size() > 0) {
            tryCombineMetricInfo(METRIC_DATA_30M_TASK + topologyId, tpMetric.get_taskMetric(), MetaType.TASK, ts);
            task += tpMetric.get_taskMetric().get_metrics_size();
        }
        if (tpMetric.get_streamMetric().get_metrics_size() > 0) {
            tryCombineMetricInfo(METRIC_DATA_30M_STREAM + topologyId, tpMetric.get_streamMetric(), MetaType.STREAM, ts);
            stream += tpMetric.get_streamMetric().get_metrics_size();
        }
        if (tpMetric.get_workerMetric().get_metrics_size() > 0) {
            tryCombineMetricInfo(METRIC_DATA_30M_WORKER + topologyId, tpMetric.get_workerMetric(), MetaType.WORKER, ts);
            worker += tpMetric.get_workerMetric().get_metrics_size();
        }
        if (tpMetric.get_nettyMetric().get_metrics_size() > 0) {
            tryCombineMetricInfo(METRIC_DATA_30M_NETTY + topologyId, tpMetric.get_nettyMetric(), MetaType.NETTY, ts);
            netty += tpMetric.get_nettyMetric().get_metrics_size();
        }

        // store 30 snapshots of topology metrics
        if (tpMetric.get_topologyMetric().get_metrics_size() > 0) {
            String keyPrefix = METRIC_DATA_30M_TOPOLOGY + topologyId + "-";
            int page = getRingAvailableIndex(keyPrefix);

            batchData.put(keyPrefix + page, new Object[]{ts, tpMetric.get_topologyMetric()});
            tp += tpMetric.get_topologyMetric().get_metrics_size();
        }
        LOG.info("caching metric data for topology:{},tp:{},comp:{},comp_stream:{},task:{},stream:{},worker:{},netty:{},cost:{}",
                topologyId, tp, comp, compStream, task, stream, worker, netty, System.currentTimeMillis() - ts);

        return putBatch(batchData);
    }

    private int getRingAvailableIndex(String keyPrefix) {
        int page = 0;
        // backward check
        long last_ts = 0;
        for (int idx = 1; idx <= 30; idx++) {
            String key = keyPrefix + idx;
            if (cache.get(key) != null) {
                long timestamp = (long) ((Object[]) cache.get(key))[0];
                if (timestamp > last_ts) {
                    last_ts = timestamp;
                    page = idx;
                }
            }
        }
        if (page < 30) {
            page += 1;
        } else {
            page = 1;
        }
        return page;
    }

    private void tryCombineMetricInfo(String key, MetricInfo incoming, MetaType metaType, long ts) {
        Object data = cache.get(key);
        if (data != null) {
            try {
                Object[] parts = (Object[]) data;
                MetricInfo old = (MetricInfo) parts[1];

                LOG.info("combine {} metrics, old:{}, new:{}",
                        metaType, old.get_metrics_size(), incoming.get_metrics_size());
                old.get_metrics().putAll(incoming.get_metrics());
                // remove dead worker
                cache.put(key, new Object[]{ts, old});
            } catch (Exception ignored) {
                cache.remove(key);
                cache.put(key, new Object[]{ts, incoming});
            }
        } else {
            cache.put(key, new Object[]{ts, incoming});
        }
    }

    public List<MetricInfo> getMetricData(String topologyId, MetaType metaType) {
        Map<Long, MetricInfo> retMap = new TreeMap<>();

        String key = null;
        if (metaType == MetaType.COMPONENT) {
            key = METRIC_DATA_30M_COMPONENT + topologyId;
        } else if (metaType == MetaType.TASK) {
            key = METRIC_DATA_30M_TASK + topologyId;
        } else if (metaType == MetaType.STREAM) {
            key = METRIC_DATA_30M_STREAM + topologyId;
        } else if (metaType == MetaType.WORKER) {
            key = METRIC_DATA_30M_WORKER + topologyId;
        } else if (metaType == MetaType.NETTY) {
            key = METRIC_DATA_30M_NETTY + topologyId;
        } else if (metaType == MetaType.COMPONENT_STREAM) {
            key = METRIC_DATA_30M_COMP_STREAM + topologyId;
        } else if (metaType == MetaType.TOPOLOGY) {
            String keyPrefix = METRIC_DATA_30M_TOPOLOGY + topologyId + "-";
            for (int i = 1; i <= 30; i++) {
                Object obj = cache.get(keyPrefix + i);
                if (obj != null) {
                    Object[] objects = (Object[]) obj;
                    retMap.put((Long) objects[0], (MetricInfo) objects[1]);
                }
            }
        }
        if (key != null) {
            Object obj = cache.get(key);
            if (obj != null) {
                Object[] objects = (Object[]) obj;
                retMap.put((Long) objects[0], (MetricInfo) objects[1]);
            }
        }
        List<MetricInfo> ret = Lists.newArrayList(retMap.values());
        int cnt = 0;
        for (MetricInfo metricInfo : ret) {
            cnt += metricInfo.get_metrics_size();
        }
        LOG.info("getMetricData, topology:{}, meta type:{}, metric info size:{}, total metric size:{}",
                topologyId, metaType, ret.size(), cnt);
        return ret;
    }

    public JStormCache putBatch(Map<String, Object> kv) {
        if (kv.size() > 0) {
            cache.putBatch(kv);
        }
        return cache;
    }

    public Object get(String k) {
        return cache.get(k);
    }

    public void remove(String k) {
        cache.remove(k);
    }

    public void removeTopology(String topologyId) {
        removeTopologyMeta(topologyId);
        removeTopologyData(topologyId);
    }

    protected void removeTopologyMeta(String topologyId) {
        cache.remove(METRIC_META_PREFIX + topologyId);
    }

    protected void removeTopologyData(String topologyId) {
        long start = System.currentTimeMillis();
        cache.remove(METRIC_DATA_PREFIX + topologyId);

        Set<String> metricDataKeys = new HashSet<>();
        for (int i = 1; i <= 30; i++) {
            String metricDataKeySuffix = topologyId + "-" + i;
            metricDataKeys.add(METRIC_DATA_30M_TOPOLOGY + metricDataKeySuffix);
        }
        metricDataKeys.add(METRIC_DATA_30M_COMPONENT + topologyId);
        metricDataKeys.add(METRIC_DATA_30M_TASK + topologyId);
        metricDataKeys.add(METRIC_DATA_30M_STREAM + topologyId);
        metricDataKeys.add(METRIC_DATA_30M_WORKER + topologyId);
        metricDataKeys.add(METRIC_DATA_30M_NETTY + topologyId);
        metricDataKeys.add(METRIC_DATA_30M_COMP_STREAM + topologyId);

        cache.removeBatch(metricDataKeys);
        LOG.info("removing metric cache of topology:{}, cost:{}", topologyId, System.currentTimeMillis() - start);
    }

    public void unregisterWorker(String topologyId, String host, int port) {
        String prefix = MetricUtils.workerMetricPrefix(topologyId, host, port);
        synchronized (lock) {
            //remove dead worker meta info in METRIC_META_PREFIX
            Map<String, Long> nodes = (Map<String, Long>) cache.get(METRIC_META_PREFIX + topologyId);
            if (nodes != null) {
                Iterator<String> keyIterator = nodes.keySet().iterator();
                while (keyIterator.hasNext()) {
                    String metricName = keyIterator.next();
                    // remove metric type
                    metricName = metricName.charAt(0) + metricName.substring(2, metricName.length());
                    if (metricName.startsWith(prefix)) {
                        keyIterator.remove();
                    }
                }
                cache.put(METRIC_META_PREFIX + topologyId, nodes);
            }
            //remove dead worker in METRIC_DATA_30M_WORKER
            Object data = cache.get(METRIC_DATA_30M_WORKER + topologyId);
            if (data != null) {
                Object[] parts = (Object[]) data;
                MetricInfo old = (MetricInfo) parts[1];
                Iterator<String> oldKeys = old.get_metrics().keySet().iterator();
                while (oldKeys.hasNext()) {
                    String metricName = oldKeys.next();
                    metricName = metricName.charAt(0) + metricName.substring(2, metricName.length());
                    if (metricName.startsWith(prefix)) {
                        oldKeys.remove();
                        LOG.info("remove dead worker metric : {}", metricName);
                    }
                }
                cache.put(METRIC_DATA_30M_WORKER + topologyId, data);
            }
        }
    }

    public Map<String, Long> getMeta(String topologyId) {
        return (Map<String, Long>) cache.get(METRIC_META_PREFIX + topologyId);
    }

    public void putMeta(String topologyId, Object v) {
        cache.put(METRIC_META_PREFIX + topologyId, v);
    }

    public void putSampleRate(String topologyId, double sampleRate) {
        cache.put(TOPOLOGY_SAMPLE_RATE + topologyId, sampleRate);
    }

    public void removeSampleRate(String topologyId) {
        cache.remove(TOPOLOGY_SAMPLE_RATE + topologyId);
    }

    public double getSampleRate(String topologyId) {
        String rate = (String) cache.get(TOPOLOGY_SAMPLE_RATE + topologyId);
        if (rate == null) {
            return ConfigExtension.DEFAULT_METRIC_SAMPLE_RATE;
        }
        return Double.parseDouble(rate);
    }

    public Map<String, Long> getSentMeta(String topologyId) {
        return (Map<String, Long>) cache.get(SENT_METRIC_META_PREFIX + topologyId);
    }

    public void putSentMeta(String topologyId, Object allMetricMeta) {
        cache.put(SENT_METRIC_META_PREFIX + topologyId, allMetricMeta);
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef _FS_DIRECTOR_H_
#define _FS_DIRECTOR_H_
#include "FsMacros.h"
#include "scheduler/FsSchedulerTarget.h"

NS_FS_BEGIN
class Scene;
class DirectorTouchEventListener;
class DirectorKeypadEventListener;
class DirectorInputTextEventListener;

class FsArray;
class Vector2;
class Render;
class TouchEvent;

class Director :public SchedulerTarget
{
	public:
		static Director* create();

	public:
		/* inherit FsObject */
		virtual const char* className();

		/* inherit SchedulerTarget */
		virtual void update(int priority,float dt);

	public:
		void push();
		void push(Scene* scene);

		void pop();

		void run(Scene*  scene);

		Scene* current();

		void pause();
		void start();

		bool isRunning();
		void setAutoSwapBuffers(bool swap);

	public:
		virtual void draw();
		virtual void update(float dt);

	protected:
		Director();
		~Director();
		void init();
		void destruct();
		void repace(Scene* scene);

		void drawScene();
		void swapBuffers();

		void touchBegin(float x,float y);
		void touchMove(float x,float y);
		void touchEnd(float x,float y);
		void touchesBegin(TouchEvent* event);
		void touchesPointerDown(TouchEvent* event);
		void touchesMove(TouchEvent* event);
		void touchesPointerUp(TouchEvent* event);
		void touchesEnd(TouchEvent* event);

		void keypadEvent(int type,int keycode);

		void inputTextEvent(const char* text,int length);

	private:
		Scene* m_current;

		Scene* m_next;

		bool m_sceneChange;

		FsArray* m_secenQueue;

		bool m_stop;
		bool m_autoSwapBuffers;

		DirectorTouchEventListener* m_touchEventListener;
		DirectorKeypadEventListener* m_keypadEventListener;
		DirectorInputTextEventListener* m_inputTextEventListener;

		friend class DirectorTouchEventListener;
		friend class DirectorKeypadEventListener;
		friend class DirectorInputTextEventListener;

};

NS_FS_END

#endif /*_FS_DIRECTOR_H_*/


text:
import { template, types as t } from "@babel/core";
import type { NodePath } from "@babel/traverse";

export default function transpileNamespace(path, t, allowNamespaces) {
  if (path.node.declare || path.node.id.type === "StringLiteral") {
    path.remove();
    return;
  }

  if (!allowNamespaces) {
    throw path.hub.file.buildCodeFrameError(
      path.node.id,
      "Namespace not marked type-only declare." +
        " Non-declarative namespaces are only supported experimentally in Babel." +
        " To enable and review caveats see:" +
        " https://babeljs.io/docs/en/babel-plugin-transform-typescript",
    );
  }

  const name = path.node.id.name;
  const value = handleNested(path, t, t.cloneDeep(path.node));
  const bound = path.scope.hasOwnBinding(name);
  if (path.parent.type === "ExportNamedDeclaration") {
    if (!bound) {
      path.parentPath.insertAfter(value);
      path.replaceWith(getDeclaration(t, name));
      path.scope.registerDeclaration(path.parentPath);
    } else {
      path.parentPath.replaceWith(value);
    }
  } else if (bound) {
    path.replaceWith(value);
  } else {
    path.scope.registerDeclaration(
      path.replaceWithMultiple([getDeclaration(t, name), value])[0],
    );
  }
}

function getDeclaration(t, name) {
  return t.variableDeclaration("let", [
    t.variableDeclarator(t.identifier(name)),
  ]);
}

function getMemberExpression(t, name, itemName) {
  return t.memberExpression(t.identifier(name), t.identifier(itemName));
}

/**
 * Convert export const foo = 1 to Namepsace.foo = 1;
 *
 * @param {t.VariableDeclaration} node given variable declaration, e.g. `const foo = 1`
 * @param {string} name the generated unique namespace member name
 * @param {*} hub An instance implements HubInterface defined in `@babel/traverse` that can throw a code frame error
 */
function handleVariableDeclaration(
  node: t.VariableDeclaration,
  name: string,
  hub: any,
): t.Statement[] {
  if (node.kind !== "const") {
    throw hub.file.buildCodeFrameError(
      node,
      "Namespaces exporting non-const are not supported by Babel." +
        " Change to const or see:" +
        " https://babeljs.io/docs/en/babel-plugin-transform-typescript",
    );
  }
  const { declarations } = node;
  if (
    declarations.every(
      (declarator): declarator is t.VariableDeclarator & { id: t.Identifier } =>
        t.isIdentifier(declarator.id),
    )
  ) {
    // `export const a = 1` transforms to `const a = N.a = 1`, the output
    // is smaller than `const a = 1; N.a = a`;
    for (const declarator of declarations) {
      declarator.init = t.assignmentExpression(
        "=",
        getMemberExpression(t, name, declarator.id.name),
        declarator.init,
      );
    }
    return [node];
  }
  // Now we have pattern in declarators
  // `export const [a] = 1` transforms to `const [a] = 1; N.a = a`
  const bindingIdentifiers = t.getBindingIdentifiers(node);
  const assignments = [];
  // getBindingIdentifiers returns an object without prototype.
  // eslint-disable-next-line guard-for-in
  for (const idName in bindingIdentifiers) {
    assignments.push(
      t.assignmentExpression(
        "=",
        getMemberExpression(t, name, idName),
        t.cloneNode(bindingIdentifiers[idName]),
      ),
    );
  }
  return [node, t.expressionStatement(t.sequenceExpression(assignments))];
}

function buildNestedAmbiendModuleError(path: NodePath, node: t.Node) {
  throw path.hub.buildError(
    node,
    "Ambient modules cannot be nested in other modules or namespaces.",
    Error,
  );
}

function handleNested(
  path: NodePath,
  t: typeof import("@babel/types"),
  node: t.TSModuleDeclaration,
  parentExport?,
) {
  const names = new Set();
  const realName = node.id;
  t.assertIdentifier(realName);

  const name = path.scope.generateUid(realName.name);

  const namespaceTopLevel: t.Statement[] = t.isTSModuleBlock(node.body)
    ? node.body.body
    : // We handle `namespace X.Y {}` as if it was
      //   namespace X {
      //     export namespace Y {}
      //   }
      [t.exportNamedDeclaration(node.body)];

  for (let i = 0; i < namespaceTopLevel.length; i++) {
    const subNode = namespaceTopLevel[i];

    // The first switch is mainly to detect name usage. Only export
    // declarations require further transformation.
    switch (subNode.type) {
      case "TSModuleDeclaration": {
        if (!t.isIdentifier(subNode.id)) {
          throw buildNestedAmbiendModuleError(path, subNode);
        }

        const transformed = handleNested(path, t, subNode);
        const moduleName = subNode.id.name;
        if (names.has(moduleName)) {
          namespaceTopLevel[i] = transformed;
        } else {
          names.add(moduleName);
          namespaceTopLevel.splice(
            i++,
            1,
            getDeclaration(t, moduleName),
            transformed,
          );
        }
        continue;
      }
      case "TSEnumDeclaration":
      case "FunctionDeclaration":
      case "ClassDeclaration":
        names.add(subNode.id.name);
        continue;
      case "VariableDeclaration": {
        // getBindingIdentifiers returns an object without prototype.
        // eslint-disable-next-line guard-for-in
        for (const name in t.getBindingIdentifiers(subNode)) {
          names.add(name);
        }
        continue;
      }
      default:
        // Neither named declaration nor export, continue to next item.
        continue;
      case "ExportNamedDeclaration":
      // Export declarations get parsed using the next switch.
    }

    // Transform the export declarations that occur inside of a namespace.
    switch (subNode.declaration.type) {
      case "TSEnumDeclaration":
      case "FunctionDeclaration":
      case "ClassDeclaration": {
        const itemName = subNode.declaration.id.name;
        names.add(itemName);
        namespaceTopLevel.splice(
          i++,
          1,
          subNode.declaration,
          t.expressionStatement(
            t.assignmentExpression(
              "=",
              getMemberExpression(t, name, itemName),
              t.identifier(itemName),
            ),
          ),
        );
        break;
      }
      case "VariableDeclaration": {
        const nodes = handleVariableDeclaration(
          subNode.declaration,
          name,
          path.hub,
        );
        namespaceTopLevel.splice(i, nodes.length, ...nodes);
        i += nodes.length - 1;
        break;
      }
      case "TSModuleDeclaration": {
        if (!t.isIdentifier(subNode.declaration.id)) {
          throw buildNestedAmbiendModuleError(path, subNode.declaration);
        }

        const transformed = handleNested(
          path,
          t,
          subNode.declaration,
          t.identifier(name),
        );
        const moduleName = subNode.declaration.id.name;
        if (names.has(moduleName)) {
          namespaceTopLevel[i] = transformed;
        } else {
          names.add(moduleName);
          namespaceTopLevel.splice(
            i++,
            1,
            getDeclaration(t, moduleName),
            transformed,
          );
        }
      }
    }
  }

  // {}
  let fallthroughValue: t.Expression = t.objectExpression([]);

  if (parentExport) {
    const memberExpr = t.memberExpression(parentExport, realName);
    fallthroughValue = template.expression.ast`
      ${t.cloneNode(memberExpr)} ||
        (${t.cloneNode(memberExpr)} = ${fallthroughValue})
    `;
  }

  return template.statement.ast`
    (function (${t.identifier(name)}) {
      ${namespaceTopLevel}
    })(${realName} || (${t.cloneNode(realName)} = ${fallthroughValue}));
  `;
}


text:
<?php

class diaryCommentActions extends opDiaryPluginDiaryCommentActions
{
}


text:
package org.jetbrains.plugins.scala.lang.psi.impl.expr

import com.intellij.lang.ASTNode
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes.kRETURN
import org.jetbrains.plugins.scala.lang.psi.api.expr._
import org.jetbrains.plugins.scala.lang.psi.types.api.Nothing
import org.jetbrains.plugins.scala.lang.psi.types.result._

class ScReturnImpl(node: ASTNode) extends ScExpressionImplBase(node) with ScReturn {

  override def keyword: PsiElement = findChildByType(kRETURN)

  protected override def innerType: TypeResult = Right(Nothing)

  override def toString: String = "ReturnStatement"
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using DotVVM.Framework.ViewModel;

namespace DotVVM.Samples.BasicSamples.ViewModels.FeatureSamples.Validation
{
    public class ClientSideValidationDisablingViewModel : DotvvmViewModelBase, IDisposable
    {
        [Required]
        public string RequiredString { get; set; }

        [EmailAddress]
        public string EmailString { get; set; }

        public bool ClientSideValidationEnabled => Context.Configuration.ClientSideValidation;

        public ClientSideValidationDisablingViewModel()
        {
        }

        public override Task Init()
        {
            bool value;
            //if there`s paremeter ClientSideValidationEnabled which controls if client side valid validation will be active than set it according to it
            //else disable client side validation
            if (Context.Parameters.ContainsKey("ClientSideValidationEnabled") &&
                Boolean.TryParse(Context.Parameters["ClientSideValidationEnabled"].ToString(), out value))
            {
                Context.Configuration.ClientSideValidation = value;
            }
            else
            {
                Context.Configuration.ClientSideValidation = false;
            }

            return base.Init();
        }

        public void Dispose()
        {
            Context.Configuration.ClientSideValidation = true;
        }
    }
}


text:
package gnu.classpath.tools.orbd;

import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
import gnu.CORBA.NamingService.Ext;
import gnu.classpath.tools.common.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
import gnu.classpath.tools.getopt.Parser;

import org.omg.CosNaming.NamingContextExt;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

/**
 * The server for the GNU Classpath persistent naming service.
 *
 * GNU Classpath currently works with this naming service and is also
 * interoperable with the Sun Microsystems naming services from releases 1.3 and
 * 1.4, both transient tnameserv and persistent orbd.
 *
 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
 */
public class Main
{
  /**
   * The default port (900), on that the naming service starts if no
   * -ORBInitialPort is specified in the command line.
   */
  public static final int PORT = 900;

  private int port = PORT;
  private String iorf;
  private boolean cold;
  private String directory = "";

  /**
   * Get the object key for the naming service. The default key is the string
   * "NameService" in ASCII.
   *
   * @return the byte array.
   */
  public static byte[] getDefaultKey()
  {
    try
      { // NameService
        return "NameService".getBytes("UTF-8");
      }
    catch (UnsupportedEncodingException ex)
      {
        throw new InternalError("UTF-8 unsupported");
      }
  }

  private Parser initializeParser()
  {
    Parser parser = new ClasspathToolParser("orbd", true); //$NON-NLS-1$
    parser.setHeader(Messages.getString("Main.Usage")); //$NON-NLS-1$

    parser.add(new Option("ORBInitialPort", //$NON-NLS-1$
                          Messages.getString("Main.ORBInitialPort"), //$NON-NLS-1$
                          Messages.getString("Main.Port")) //$NON-NLS-1$
      {
        public void parsed(String portArgument) throws OptionException
        {
          port = Integer.parseInt(portArgument);
        }
      });

    parser.add(new Option("ior", //$NON-NLS-1$
                          Messages.getString("Main.IOR"), //$NON-NLS-1$
                          Messages.getString("Main.IORFile")) //$NON-NLS-1$
      {
        public void parsed(String fileArgument) throws OptionException
        {
          iorf = fileArgument;
        }
      });
    parser.add(new Option("directory", //$NON-NLS-1$
                          Messages.getString("Main.Directory"), //$NON-NLS-1$
                          Messages.getString("Main.DirectoryArgument")) //$NON-NLS-1$
      {
        public void parsed(String argument) throws OptionException
        {
          directory = argument;
        }
      });
    parser.add(new Option("restart", //$NON-NLS-1$
                          Messages.getString("Main.Restart")) //$NON-NLS-1$
      {
        public void parsed(String argument) throws OptionException
        {
          cold = true;
        }
      });

    return parser;
  }

  private void run(String[] args)
  {
    Parser parser = initializeParser();
    parser.parse(args);

    try
      {
        // Create and initialize the ORB
        final OrbFunctional orb = new OrbFunctional();
        OrbFunctional.setPort(port);

        // Create the servant and register it with the ORB
        File dataDirectory = new File(directory);
        System.out.println("Persistent data stored at "
                           + dataDirectory.getAbsolutePath());
        dataDirectory.mkdirs();

        // / TODO support more starting modes.
        NamingContextExt namer = new Ext(
                                         new PersistentContext(
                                                               orb,
                                                               dataDirectory,
                                                               cold));

        // Case with the key "NameService".
        orb.connect(namer, "NameService".getBytes());

        // Storing the IOR reference.
        String ior = orb.object_to_string(namer);
        IOR iorr = IOR.parse(ior);
        if (iorf != null)
          {
            FileOutputStream f = new FileOutputStream(iorf);
            PrintStream p = new PrintStream(f);
            p.print(ior);
            p.close();
          }

        System.out.println("GNU Classpath persistent naming service "
                           + "started at " + iorr.Internet.host + ":"
                           + iorr.Internet.port + " key 'NameService'.\n\n"
                           + "Copyright (C) 2008 Free Software Foundation\n"
                           + "This tool comes with ABSOLUTELY NO WARRANTY. "
                           + "This is free software, and you are\nwelcome to "
                           + "redistribute it under conditions, defined in "
                           + "GNU Classpath license.\n\n" + ior);

        new Thread()
        {
          public void run()
          {
            // Wait for invocations from clients.
            orb.run();
          }
        }.start();
      }
    catch (FileNotFoundException e)
      {
        throw new RuntimeException(e);
      }
    finally
      {
        // Restore the default value for allocating ports for the subsequent
        // objects.
        OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
      }
  }

  /**
   * The persistent naming service entry point.
   */
  public static void main(String[] args)
  {
    Main orbdprogram = new Main();
    try
      {
        orbdprogram.run(args);
      }
    catch (Exception e)
      {
        System.err.println(Messages.getString("Main.InternalError")); //$NON-NLS-1$
        e.printStackTrace(System.err);
        System.exit(1);
      }
  }
}


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.flowable.standalone.jpa;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * @author Frederik Heremans
 */
@Entity(name = "SHORT_ID_ENTITY")
public class ShortIdJPAEntity {

    @Id
    @Column(name = "ID_")
    private short shortId;

    public short getShortId() {
        return shortId;
    }

    public void setShortId(short shortId) {
        this.shortId = shortId;
    }

}


text:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "primpl.h"

#include <string.h> /* for memset() */

/************************************************************************/

PRLock *_pr_flock_lock;
PRCondVar *_pr_flock_cv;

#ifdef WINCE
/*
 * There are no stdin, stdout, stderr in Windows CE.  INVALID_HANDLE_VALUE
 * should cause all I/O functions on the handle to fail.
 */
#define STD_INPUT_HANDLE  ((DWORD)-10)
#define STD_OUTPUT_HANDLE ((DWORD)-11)
#define STD_ERROR_HANDLE  ((DWORD)-12)

static HANDLE GetStdHandle(DWORD nStdHandle)
{
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    return INVALID_HANDLE_VALUE;
}
#endif

void _PR_InitIO(void)
{
    const PRIOMethods *methods = PR_GetFileMethods();

    _PR_InitFdCache();

    _pr_flock_lock = PR_NewLock();
    _pr_flock_cv = PR_NewCondVar(_pr_flock_lock);

#ifdef WIN32
    _pr_stdin = PR_AllocFileDesc((PROsfd)GetStdHandle(STD_INPUT_HANDLE),
            methods);
    _pr_stdout = PR_AllocFileDesc((PROsfd)GetStdHandle(STD_OUTPUT_HANDLE),
            methods);
    _pr_stderr = PR_AllocFileDesc((PROsfd)GetStdHandle(STD_ERROR_HANDLE),
            methods);
#ifdef WINNT
    _pr_stdin->secret->md.sync_file_io = PR_TRUE;
    _pr_stdout->secret->md.sync_file_io = PR_TRUE;
    _pr_stderr->secret->md.sync_file_io = PR_TRUE;
#endif
#else
    _pr_stdin = PR_AllocFileDesc(0, methods);
    _pr_stdout = PR_AllocFileDesc(1, methods);
    _pr_stderr = PR_AllocFileDesc(2, methods);
#endif
    _PR_MD_INIT_FD_INHERITABLE(_pr_stdin, PR_TRUE);
    _PR_MD_INIT_FD_INHERITABLE(_pr_stdout, PR_TRUE);
    _PR_MD_INIT_FD_INHERITABLE(_pr_stderr, PR_TRUE);
}

void _PR_CleanupIO(void)
{
    PR_FreeFileDesc(_pr_stdin);
    _pr_stdin = NULL;
    PR_FreeFileDesc(_pr_stdout);
    _pr_stdout = NULL;
    PR_FreeFileDesc(_pr_stderr);
    _pr_stderr = NULL;

    if (_pr_flock_cv) {
        PR_DestroyCondVar(_pr_flock_cv);
        _pr_flock_cv = NULL;
    }
    if (_pr_flock_lock) {
        PR_DestroyLock(_pr_flock_lock);
        _pr_flock_lock = NULL;
    }

    _PR_CleanupFdCache();
}

PR_IMPLEMENT(PRFileDesc*) PR_GetSpecialFD(PRSpecialFD osfd)
{
    PRFileDesc *result = NULL;
    PR_ASSERT((int) osfd >= PR_StandardInput && osfd <= PR_StandardError);

    if (!_pr_initialized) _PR_ImplicitInitialization();

    switch (osfd)
    {
        case PR_StandardInput: result = _pr_stdin; break;
        case PR_StandardOutput: result = _pr_stdout; break;
        case PR_StandardError: result = _pr_stderr; break;
        default:
            (void)PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
    }
    return result;
}

PR_IMPLEMENT(PRFileDesc*) PR_AllocFileDesc(
    PROsfd osfd, const PRIOMethods *methods)
{
    PRFileDesc *fd;

#ifdef XP_UNIX
	/*
	 * Assert that the file descriptor is small enough to fit in the
	 * fd_set passed to select
	 */
	PR_ASSERT(osfd < FD_SETSIZE);
#endif
    fd = _PR_Getfd();
    if (fd) {
        /* Initialize the members of PRFileDesc and PRFilePrivate */
        fd->methods = methods;
        fd->secret->state = _PR_FILEDESC_OPEN;
	fd->secret->md.osfd = osfd;
        _PR_MD_INIT_FILEDESC(fd);
    } else {
	    PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
    }

    return fd;
}

PR_IMPLEMENT(void) PR_FreeFileDesc(PRFileDesc *fd)
{
    PR_ASSERT(fd);
    _PR_Putfd(fd);
}

/*
** Wait for some i/o to finish on one or more more poll descriptors.
*/
PR_IMPLEMENT(PRInt32) PR_Poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
{
	return(_PR_MD_PR_POLL(pds, npds, timeout));
}

/*
** Set the inheritance attribute of a file descriptor.
*/
PR_IMPLEMENT(PRStatus) PR_SetFDInheritable(
    PRFileDesc *fd,
    PRBool inheritable)
{
#if defined(XP_UNIX) || defined(WIN32) || defined(XP_OS2) || defined(XP_BEOS)
    /*
     * Only a non-layered, NSPR file descriptor can be inherited
     * by a child process.
     */
    if (fd->identity != PR_NSPR_IO_LAYER) {
        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
        return PR_FAILURE;
    }
    if (fd->secret->inheritable != inheritable) {
        if (_PR_MD_SET_FD_INHERITABLE(fd, inheritable) == PR_FAILURE) {
            return PR_FAILURE;
        }
        fd->secret->inheritable = inheritable;
    }
    return PR_SUCCESS;
#else
    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    return PR_FAILURE;
#endif
}

/*
** This function only has a useful implementation in the debug build of
** the pthreads version.
*/
PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
{
    /* do nothing */
}  /* PT_FPrintStats */


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package gameshop.advance.manager;

import gameshop.advance.exceptions.QuantityException;
import gameshop.advance.interfaces.IDescrizioneProdotto;
import gameshop.advance.interfaces.IPrenotazione;
import gameshop.advance.interfaces.remote.forniture.IInformazioniProdottoRemote;
import gameshop.advance.interfaces.remote.sales.IRigaDiTransazioneRemote;
import gameshop.advance.interfaces.remote.utility.IIteratorWrapperRemote;
import gameshop.advance.interfaces.remote.utility.IRemoteObserver;
import gameshop.advance.model.transazione.RigaDiTransazione;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Recupera e gestisce le informazioni sui prodotti e alle prenotazioni effettuate su di questi
 *
 * @author Lorenzo Di Giuseppe
 */
public class ManagerFornitureSingleton {

    private static ManagerFornitureSingleton instance;

    private final LinkedList<IRemoteObserver> listeners = new LinkedList<>();
    private LinkedList<IRemoteObserver> removeListener = new LinkedList<IRemoteObserver>();

    private HashMap<String, IInformazioniProdottoRemote> informazioni;

    private ManagerFornitureSingleton(){
        try {
            this.informazioni = new HashMap<>();
            this.aggiornaDescrizioni(ManagerProdottiSingleton.getInstance().getMonitored());
            this.aggiornaPrenotazioni(ManagerPrenotazioniSingleton.getInstance().getNotProcessed());
        } catch (RemoteException ex) {
            Logger.getLogger(ManagerFornitureSingleton.class.getName()).log(Level.SEVERE, null, ex);
        } catch (QuantityException ex)
        {
            Logger.getLogger(ManagerFornitureSingleton.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static ManagerFornitureSingleton getInstance(){

        if (ManagerFornitureSingleton.instance == null){
            ManagerFornitureSingleton.instance = new ManagerFornitureSingleton();
        }
        return ManagerFornitureSingleton.instance;
    }

    public void addListener(IRemoteObserver obs){
        this.listeners.add(obs);
    }

    public void removeListener(IRemoteObserver obs){
        if(obs != null)
            this.listeners.remove(obs);
        else
            this.listeners.clear();
    }

    protected void notificaListeners()
    {
        if(this.listeners.size() > 0)
        {
            for(IRemoteObserver obs:this.listeners)
            {
                try
                {
                    obs.notifica(new FornitureRemoteProxy(this));
                } catch (RemoteException ex)
                {
                    Logger.getLogger(ManagerFornitureSingleton.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }

    protected void notificaRemoveListeners(IInformazioniProdottoRemote info)
    {
        if(this.removeListener.size() > 0)
        {
            for(IRemoteObserver obs:this.removeListener)
            {
                try
                {
                    obs.notifica(info);
                } catch (RemoteException ex)
                {
                    Logger.getLogger(ManagerFornitureSingleton.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }

    /**
     *
     * @param descrizioni
     * @throws java.rmi.RemoteException
     */
    public void aggiornaDescrizioni(List<IDescrizioneProdotto> descrizioni) throws RemoteException
    {
        System.err.println("Descrizioni forniture: "+descrizioni.size());
        if(descrizioni != null && !descrizioni.isEmpty())
        {
            Iterator<IDescrizioneProdotto> iter = descrizioni.iterator();
            while(iter.hasNext())
            {
                this.addDescrizione(iter.next());
            }
            this.notificaListeners();
        }
    }
    /**
     *
     * @param desc
     * @throws java.rmi.RemoteException
     */
    public void addDescrizione(IDescrizioneProdotto desc) throws RemoteException
    {
        if(this.informazioni.containsKey(desc.getCodiceProdotto().getCodice()))
        {
            InformazioniProdotto ip = (InformazioniProdotto) this.informazioni.get(desc.getCodiceProdotto().getCodice());
            ip.setDescrizione(desc);
        }
        else{
            InformazioniProdotto ip = new InformazioniProdotto(desc);
            this.informazioni.put(desc.getCodiceProdotto().getCodice(), ip);
        }
        this.notificaListeners();
    }
    /**
     *
     * @param desc
     * @throws java.rmi.RemoteException
     */
    public void removeDescrizione(IDescrizioneProdotto desc) throws RemoteException
    {
        System.err.println("Rimuovi da manager "+desc.getNomeProdotto());
        if(this.informazioni.containsKey(desc.getCodiceProdotto().getCodice()))
        {
            InformazioniProdotto ip = (InformazioniProdotto) this.informazioni.get(desc.getCodiceProdotto().getCodice());
            if(ip.getDescrizione().getQuantitaDisponibile() - ip.getPrenotati() > ip.getDescrizione().getQuantitaDiSoglia()) {
                this.informazioni.remove(desc.getCodiceProdotto().getCodice());
            }
            this.notificaRemoveListeners(ip);
        }
    }

    /**
     *
     * @param prenotazioni
     * @throws java.rmi.RemoteException
     * @throws gameshop.advance.exceptions.QuantityException
     */
    private void aggiornaPrenotazioni(List<IPrenotazione> prenotazioni) throws RemoteException, QuantityException
    {
        if(prenotazioni != null && !prenotazioni.isEmpty())
        {
            Iterator<IPrenotazione> iterator = prenotazioni.iterator();
            while(iterator.hasNext())
            {
                IPrenotazione pren = iterator.next();
                this.addPrenotazione(pren);
            }
        }
    }
    /**
     *
     * @param pren
     * @throws java.rmi.RemoteException
     * @throws gameshop.advance.exceptions.QuantityException
     */
    public void addPrenotazione(IPrenotazione pren) throws RemoteException, QuantityException{
        IIteratorWrapperRemote<IRigaDiTransazioneRemote> iter = pren.getRigheDiVendita();
        boolean notify = false;
        while(iter.hasNext())
        {
            RigaDiTransazione rdt = (RigaDiTransazione) iter.next();
            IDescrizioneProdotto desc = rdt.getDescrizione();
            if(this.informazioni.containsKey(desc.getCodiceProdotto().getCodice()))
            {
                InformazioniProdotto ip = (InformazioniProdotto) this.informazioni.get(desc.getCodiceProdotto().getCodice());
                ip.setPrenotati(ip.getPrenotati()+rdt.getQuantity());
            }
            else{
                if(!notify)
                    notify = true;
                InformazioniProdotto ip = new InformazioniProdotto(desc, rdt.getQuantity());
                this.informazioni.put(desc.getCodiceProdotto().getCodice(), ip);
            }
        }
        if(notify)
            this.notificaListeners();
    }

    /**
     *
     * @param pren
     * @throws java.rmi.RemoteException
     * @throws gameshop.advance.exceptions.QuantityException
     */
    public void removePrenotazione(IPrenotazione pren) throws RemoteException, QuantityException{
        IIteratorWrapperRemote<IRigaDiTransazioneRemote> iter = pren.getRigheDiVendita();
        while(iter.hasNext())
        {
            RigaDiTransazione rdt = (RigaDiTransazione) iter.next();
            IDescrizioneProdotto desc = rdt.getDescrizione();
            if(this.informazioni.containsKey(desc.getCodiceProdotto().getCodice()))
            {
                InformazioniProdotto ip = (InformazioniProdotto) this.informazioni.get(desc.getCodiceProdotto().getCodice());
                int prenQty = ip.getPrenotati()-rdt.getQuantity();
                if(prenQty > 0)
                    ip.setPrenotati(prenQty);
                else
                    ip.setPrenotati(0);
            }
        }
    }
    /**
     *
     * @return L'iteratore delle informazioni prodotto
     */
    public Iterator<IInformazioniProdottoRemote> getInformazioni(){
        return this.informazioni.values().iterator();
    }

    public void addRemoveListener(IRemoteObserver obs) {
        this.removeListener.add(obs);
    }
}