Esempio n. 1
0
        /*
         * Returns an enumeration of the entries. The entries are listed in the
         * order in which they appear in the ZIP archive.
         *
         * @return the enumeration of the entries.
         * @throws IllegalStateException if this ZIP file has been closed.
         */
        public Enumeration <ZipEntry> entries()
        {
            checkNotClosed();
            Iterator <ZipEntry> iterator = mEntries.values().iterator();

            return(new IAC_ZipEntryEnumeration(iterator, this));
        }
Esempio n. 2
0
 public virtual void reset(IRenderingEngine re)
 {
     foreach (Texture texture in cache.values())
     {
         texture.deleteTexture(re);
     }
     cache.clear();
     resetTextureAlreadyHashed();
 }
Esempio n. 3
0
        public virtual void reset(IRenderingEngine re)
        {
            lock (this)
            {
                foreach (VertexInfo vertexInfo in cache.values())
                {
                    vertexInfo.deleteVertex(re);
                }

                cache.clear();
            }
        }
Esempio n. 4
0
        private static ICollection <Path> HitsToPaths(ICollection <Hit> depthHits, Node start, Node end, bool stopAsap, int maxResultCount)
        {
            LinkedHashMap <string, Path> paths = new LinkedHashMap <string, Path>();

            foreach (Hit hit in depthHits)
            {
                foreach (Path path in HitToPaths(hit, start, end, stopAsap))
                {
                    paths.put(path.ToString(), path);
                    if (paths.size() >= maxResultCount)
                    {
                        break;
                    }
                }
            }
            return(paths.values());
        }
Esempio n. 5
0
        /**
         * Iterate over all possible values assignments for the Random Variables
         * comprising this ProbabilityTable that are not in the fixed set of values.
         * This allows you to iterate over a subset of possible combinations.
         *
         * @param pti
         *            the ProbabilityTable Iterator to iterate
         * @param fixedValues
         *            Fixed values for a subset of the Random Variables comprising
         *            this Probability Table.
         */

        public void iterateOverTable(Factor.Iterator pti,
                                     params AssignmentProposition[] fixedValues)
        {
            Map <RandomVariable, Object> possibleWorld = new LinkedHashMap <RandomVariable, Object>();
            MixedRadixNumber             tableMRN      = new MixedRadixNumber(0, radices);

            int[] tableRadixValues = new int[radices.Length];

            // Assert that the Random Variables for the fixed values
            // are part of this probability table and assign
            // all the fixed values to the possible world.
            foreach (AssignmentProposition ap in fixedValues)
            {
                if (!randomVarInfo.ContainsKey(ap.getTermVariable()))
                {
                    throw new ArgumentException("Assignment proposition ["
                                                + ap + "] does not belong to this probability table.");
                }
                possibleWorld.Add(ap.getTermVariable(), ap.getValue());
                RVInfo fixedRVI = randomVarInfo.get(ap.getTermVariable());
                tableRadixValues[fixedRVI.getRadixIdx()] = fixedRVI
                                                           .getIdxForDomain(ap.getValue());
            }
            // If have assignments for all the random variables
            // in this probability table
            if (fixedValues.Length == randomVarInfo.Count)
            {
                // Then only 1 iteration call is required.
                pti.iterate(possibleWorld, getValue(fixedValues));
            }
            else
            {
                // Else iterate over the non-fixed values
                List <RandomVariable> freeVariables = SetOps.difference(
                    new List <RandomVariable>(randomVarInfo.Keys), new List <RandomVariable>(possibleWorld.Keys));
                Map <RandomVariable, RVInfo> freeVarInfo = new LinkedHashMap <RandomVariable, RVInfo>();
                // Remove the fixed Variables
                foreach (RandomVariable fv in freeVariables)
                {
                    freeVarInfo.put(fv, new RVInfo(fv));
                }
                int[]            freeRadixValues = createRadixs(freeVarInfo);
                MixedRadixNumber freeMRN         = new MixedRadixNumber(0, freeRadixValues);
                Object           fval            = null;
                // Iterate through all combinations of the free variables
                do
                {
                    // Put the current assignments for the free variables
                    // into the possible world and update
                    // the current index in the table MRN
                    foreach (RVInfo freeRVI in freeVarInfo.values())
                    {
                        fval = freeRVI.getDomainValueAt(freeMRN
                                                        .getCurrentNumeralValue(freeRVI.getRadixIdx()));
                        possibleWorld.put(freeRVI.getVariable(), fval);

                        tableRadixValues[randomVarInfo.get(freeRVI.getVariable())
                                         .getRadixIdx()] = freeRVI.getIdxForDomain(fval);
                    }
                    pti.iterate(possibleWorld, values[(int)tableMRN
                                                      .getCurrentValueFor(tableRadixValues)]);
                } while (freeMRN.increment());
            }
        }
Esempio n. 6
0
 public virtual IEnumerator <SpecificationSubModel> GetEnumerator()
 {
     return(subModelMap.values().GetEnumerator());
 }
Esempio n. 7
0
        /**
         * Iterate over all possible values assignments for the Random Variables
         * comprising this ProbabilityTable that are not in the fixed set of values.
         * This allows you to iterate over a subset of possible combinations.
         * 
         * @param pti
         *            the ProbabilityTable Iterator to iterate
         * @param fixedValues
         *            Fixed values for a subset of the Random Variables comprising
         *            this Probability Table.
         */

        public void iterateOverTable(Factor.Iterator pti,
                                     params AssignmentProposition[] fixedValues)
        {
            Map<RandomVariable, Object> possibleWorld = new LinkedHashMap<RandomVariable, Object>();
            MixedRadixNumber tableMRN = new MixedRadixNumber(0, radices);
            int[] tableRadixValues = new int[radices.Length];

            // Assert that the Random Variables for the fixed values
            // are part of this probability table and assign
            // all the fixed values to the possible world.
            foreach (AssignmentProposition ap in fixedValues)
            {
                if (!randomVarInfo.ContainsKey(ap.getTermVariable()))
                {
                    throw new ArgumentException("Assignment proposition ["
                                                + ap + "] does not belong to this probability table.");
                }
                possibleWorld.Add(ap.getTermVariable(), ap.getValue());
                RVInfo fixedRVI = randomVarInfo.get(ap.getTermVariable());
                tableRadixValues[fixedRVI.getRadixIdx()] = fixedRVI
                    .getIdxForDomain(ap.getValue());
            }
            // If have assignments for all the random variables
            // in this probability table
            if (fixedValues.Length == randomVarInfo.Count)
            {
                // Then only 1 iteration call is required.
                pti.iterate(possibleWorld, getValue(fixedValues));
            }
            else
            {
                // Else iterate over the non-fixed values
                List<RandomVariable> freeVariables = SetOps.difference(
                    new List<RandomVariable>(randomVarInfo.Keys), new List<RandomVariable>(possibleWorld.Keys));
                Map<RandomVariable, RVInfo> freeVarInfo = new LinkedHashMap<RandomVariable, RVInfo>();
                // Remove the fixed Variables
                foreach (RandomVariable fv in freeVariables)
                {
                    freeVarInfo.put(fv, new RVInfo(fv));
                }
                int[] freeRadixValues = createRadixs(freeVarInfo);
                MixedRadixNumber freeMRN = new MixedRadixNumber(0, freeRadixValues);
                Object fval = null;
                // Iterate through all combinations of the free variables
                do
                {
                    // Put the current assignments for the free variables
                    // into the possible world and update
                    // the current index in the table MRN
                    foreach (RVInfo freeRVI in freeVarInfo.values())
                    {
                        fval = freeRVI.getDomainValueAt(freeMRN
                                                            .getCurrentNumeralValue(freeRVI.getRadixIdx()));
                        possibleWorld.put(freeRVI.getVariable(), fval);

                        tableRadixValues[randomVarInfo.get(freeRVI.getVariable())
                                             .getRadixIdx()] = freeRVI.getIdxForDomain(fval);
                    }
                    pti.iterate(possibleWorld, values[(int) tableMRN
                                                                .getCurrentValueFor(tableRadixValues)]);

                } while (freeMRN.increment());
            }
        }