Exemple #1
0
		public WordCollection(Synset synset, SpeechTypes type)
		{
			_synset = synset;
			_words = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)type + _synset.ID);
			if(_words == null) _words = new java.util.ArrayList();
			_it = _words.iterator();
		}
        static void Main()
        {
            java.util.ArrayList <int> primeNumbers = new java.util.ArrayList <int>();
            primeNumbers.add(1);
            primeNumbers.add(2);
            primeNumbers.add(3);
            primeNumbers.add(5);
            primeNumbers.add(7);

            java.lang.SystemJ.outJ.println("Work with all collection elements");

            java.lang.SystemJ.outJ.println("Using collection with for loop");
            for (int i = 0; i < primeNumbers.size(); i++)
            {
                java.lang.SystemJ.outJ.println(primeNumbers.get(i));
            }

            java.lang.SystemJ.outJ.println("Using collection with iterator while loop");
            java.util.Iterator <int> it = primeNumbers.iterator();
            while (it.hasNext())
            {
                java.lang.SystemJ.outJ.println(it.next());
            }

            java.lang.SystemJ.outJ.println("Using Java collection with .NET foreach loop");
            foreach (int prime in primeNumbers)
            {
                java.lang.SystemJ.outJ.println(prime);
            }

            java.lang.SystemJ.outJ.print("");
        }
Exemple #3
0
 public WordCollection(Synset synset)
 {
     _synset = synset;
     _words  = new java.util.ArrayList();
     java.util.ArrayList nouns = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Noun + _synset.ID);
     java.util.ArrayList verbs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Verb + _synset.ID);
     java.util.ArrayList adjs  = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adjective + _synset.ID);
     java.util.ArrayList advs  = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adverb + _synset.ID);
     if (nouns != null)
     {
         _words.addAll(nouns);
     }
     if (verbs != null)
     {
         _words.addAll(verbs);
     }
     if (adjs != null)
     {
         _words.addAll(adjs);
     }
     if (advs != null)
     {
         _words.addAll(advs);
     }
     _it = _words.iterator();
 }
        //
        // GetNestedTypes
        //

        public override Type[] GetNestedTypes(BindingFlags bindingAttr)
        {
            bool takePublic    = (bindingAttr & BindingFlags.Public) != 0;
            bool takeNonPublic = (bindingAttr & BindingFlags.NonPublic) != 0;

            if (takePublic || takeNonPublic)
            {
                var innerClasses = JavaClass.getDeclaredClasses();
                if (innerClasses.Length > 0)
                {
                    var list = new java.util.ArrayList();
                    for (int i = 0; i < innerClasses.Length; i++)
                    {
                        var innerCls = innerClasses[i];
                        var isPublic = (0 != (innerCls.getModifiers()
                                              & java.lang.reflect.Modifier.PUBLIC));

                        if (takePublic == isPublic || takeNonPublic != isPublic)
                        {
                            var innerType = GetType(innerCls);
                            var generic   = ((RuntimeType)innerType).Generic;
                            list.add(generic != null ? generic.PrimaryType : innerType);
                        }
                    }

                    return((Type[])list.toArray(system.RuntimeType.EmptyTypeArray));
                }
            }

            return(system.RuntimeType.EmptyTypeArray);
        }
 /// <summary>
 /// Gets the response and modify the headers.
 /// </summary>
 /// <returns>The response.</returns>
 /// <param name="request">Request.</param>
 public override WebResponse getResponse(WebRequest request)
 {
     WebResponse response = base.getResponse(request);
     //
     // Only if Url matches
     //
     if (request.getUrl().toExternalForm().Contains("mb.aspx")) {
         string content = response.getContentAsString("UTF-8");
         java.util.ArrayList newheaders = new java.util.ArrayList();
         java.util.List headers = response.getResponseHeaders();
         java.util.Iterator it = headers.iterator();
         //
         // Remove the 'Access-Control-Allow-Origin' header
         //
         while (it.hasNext()) {
             com.gargoylesoftware.htmlunit.util.NameValuePair o = (com.gargoylesoftware.htmlunit.util.NameValuePair)it.next();
             if (o.getName().Equals("Access-Control-Allow-Origin")) {
                 string value = response.getResponseHeaderValue("Access-Control-Allow-Origin");
                 Console.WriteLine("Found header 'Access-Control-Allow-Origin' = \"{0}\" and stripping it from new headers for response", value);
                 continue; //headers.remove(o);
             }
             newheaders.add(o);
         }
         byte[] utf = System.Text.Encoding.UTF8.GetBytes(content);
         WebResponseData data = new WebResponseData(utf,
             response.getStatusCode(), response.getStatusMessage(), newheaders);
         response = new WebResponse(data, request, response.getLoadTime());
         return response;
     }
     return response;
 }
		public HeaderViewListAdapter(java.util.ArrayList<android.widget.ListView.FixedViewInfo
			> headerViewInfos, java.util.ArrayList<android.widget.ListView.FixedViewInfo> footerViewInfos
			, android.widget.ListAdapter adapter)
		{
			// These two ArrayList are assumed to NOT be null.
			// They are indeed created when declared in ListView and then shared.
			// Used as a placeholder in case the provided info views are indeed null.
			// Currently only used by some CTS tests, which may be removed.
			mAdapter = adapter;
			mIsFilterable = adapter is android.widget.Filterable;
			if (headerViewInfos == null)
			{
				mHeaderViewInfos = EMPTY_INFO_LIST;
			}
			else
			{
				mHeaderViewInfos = headerViewInfos;
			}
			if (footerViewInfos == null)
			{
				mFooterViewInfos = EMPTY_INFO_LIST;
			}
			else
			{
				mFooterViewInfos = footerViewInfos;
			}
			mAreAllFixedViewsSelectable = areAllListInfosSelectable(mHeaderViewInfos) && areAllListInfosSelectable
				(mFooterViewInfos);
		}
Exemple #7
0
        static void Main()
        {
            java.util.ArrayList<int> primeNumbers = new java.util.ArrayList<int>();
            primeNumbers.add(1);
            primeNumbers.add(2);
            primeNumbers.add(3);
            primeNumbers.add(5);
            primeNumbers.add(7);

            java.lang.SystemJ.outJ.println("Work with all collection elements");

            java.lang.SystemJ.outJ.println("Using collection with for loop");
            for (int i = 0; i < primeNumbers.size(); i++)
                java.lang.SystemJ.outJ.println(primeNumbers.get(i));

            java.lang.SystemJ.outJ.println("Using collection with iterator while loop");
            java.util.Iterator<int> it = primeNumbers.iterator();
            while (it.hasNext())
                java.lang.SystemJ.outJ.println(it.next());

            java.lang.SystemJ.outJ.println("Using Java collection with .NET foreach loop");
            foreach (int prime in primeNumbers)
                java.lang.SystemJ.outJ.println(prime);

            java.lang.SystemJ.outJ.print("");
        }
        public override void updateMenuView(bool cleared)
        {
            [email protected] menuView = ([email protected]
                                                                 )mMenuView;
            if (mMaxItems < 0)
            {
                mMaxItems = menuView.getMaxItems();
            }
            java.util.ArrayList <*****@*****.**> itemsToShow = mMenu
                                                                                         .getNonActionItems();
            bool needsMore = itemsToShow.size() > mMaxItems;

            base.updateMenuView(cleared);
            if (needsMore && (mMoreView == null || mMoreView.getParent() != menuView))
            {
                if (mMoreView == null)
                {
                    mMoreView = menuView.createMoreItemView();
                    mMoreView.setBackgroundDrawable(menuView.getItemBackgroundDrawable());
                }
                menuView.addView(mMoreView);
            }
            else
            {
                if (!needsMore && mMoreView != null)
                {
                    menuView.removeView(mMoreView);
                }
            }
            menuView.setNumActualItemsShown(needsMore ? mMaxItems - 1 : itemsToShow.size());
        }
 /// <summary>
 /// Merges all the listeners registered on the specified observer with the listeners
 /// registered on this object.
 /// </summary>
 /// <remarks>
 /// Merges all the listeners registered on the specified observer with the listeners
 /// registered on this object. After this method is invoked, the specified observer
 /// will return false in
 /// <see cref="isAlive()">isAlive()</see>
 /// and should not be used anymore.
 /// </remarks>
 /// <param name="observer">The ViewTreeObserver whose listeners must be added to this observer
 ///     </param>
 internal void merge(android.view.ViewTreeObserver observer)
 {
     if (observer.mOnGlobalFocusListeners != null)
     {
         if (mOnGlobalFocusListeners != null)
         {
             mOnGlobalFocusListeners.addAll(observer.mOnGlobalFocusListeners);
         }
         else
         {
             mOnGlobalFocusListeners = observer.mOnGlobalFocusListeners;
         }
     }
     if (observer.mOnGlobalLayoutListeners != null)
     {
         if (mOnGlobalLayoutListeners != null)
         {
             mOnGlobalLayoutListeners.addAll(observer.mOnGlobalLayoutListeners);
         }
         else
         {
             mOnGlobalLayoutListeners = observer.mOnGlobalLayoutListeners;
         }
     }
     if (observer.mOnPreDrawListeners != null)
     {
         if (mOnPreDrawListeners != null)
         {
             mOnPreDrawListeners.addAll(observer.mOnPreDrawListeners);
         }
         else
         {
             mOnPreDrawListeners = observer.mOnPreDrawListeners;
         }
     }
     if (observer.mOnTouchModeChangeListeners != null)
     {
         if (mOnTouchModeChangeListeners != null)
         {
             mOnTouchModeChangeListeners.addAll(observer.mOnTouchModeChangeListeners);
         }
         else
         {
             mOnTouchModeChangeListeners = observer.mOnTouchModeChangeListeners;
         }
     }
     if (observer.mOnComputeInternalInsetsListeners != null)
     {
         if (mOnComputeInternalInsetsListeners != null)
         {
             mOnComputeInternalInsetsListeners.addAll(observer.mOnComputeInternalInsetsListeners
                                                      );
         }
         else
         {
             mOnComputeInternalInsetsListeners = observer.mOnComputeInternalInsetsListeners;
         }
     }
     observer.kill();
 }
Exemple #10
0
		public SynsetCollection()
		{
			_synsets = new java.util.ArrayList();
			_synsets.addAll(SUMO.WordNet.Intern.nounSUMOHash.keySet());
			java.util.Iterator it = SUMO.WordNet.Intern.verbSUMOHash.keySet().iterator();
			while(it.hasNext())
			{
				string s = it.next().ToString();
				if(_synsets.contains(s)) continue;
				_synsets.add(s);
			}
			it = SUMO.WordNet.Intern.adjectiveSUMOHash.keySet().iterator();
			while(it.hasNext())
			{
				string s = it.next().ToString();
				if(_synsets.contains(s)) continue;
				_synsets.add(s);
			}
			it = SUMO.WordNet.Intern.adverbSUMOHash.keySet().iterator();
			while(it.hasNext())
			{
				string s = it.next().ToString();
				if(_synsets.contains(s)) continue;
				_synsets.add(s);
			}
			_it = _synsets.iterator();
		}
Exemple #11
0
 public bool remove(Object o)
 {
     if (root.fast)
     {
         lock (root)
         {
             java.util.ArrayList <Object> temp = (java.util.ArrayList <Object>)root.list.clone();
             bool r = get(temp).remove(o);
             if (r)
             {
                 last--;
             }
             root.list = temp;
             expected  = temp;
             return(r);
         }
     }
     else
     {
         lock (root.list)
         {
             return(get(expected).remove(o));
         }
     }
 }
Exemple #12
0
 public override void initializeInvalidateRegion(int left, int top, int right, int
                                                 bottom)
 {
     android.graphics.RectF region = mPreviousRegion;
     region.set(left, top, right, bottom);
     region.inset(-1.0f, -1.0f);
     if (mFillBefore)
     {
         int count = mAnimations.size();
         java.util.ArrayList <android.view.animation.Animation> animations = mAnimations;
         android.view.animation.Transformation temp = mTempTransformation;
         android.view.animation.Transformation previousTransformation = mPreviousTransformation;
         {
             for (int i = count - 1; i >= 0; --i)
             {
                 android.view.animation.Animation a = animations.get(i);
                 temp.clear();
                 android.view.animation.Interpolator interpolator = a.mInterpolator;
                 a.applyTransformation(interpolator != null ? interpolator.getInterpolation(0.0f) :
                                       0.0f, temp);
                 previousTransformation.compose(temp);
             }
         }
     }
 }
 /**
  * Removes a collection from the those being decorated in this composite.
  *
  * @param coll  collection to be removed
  */
 public virtual void removeComposited(java.util.Collection <Object> coll)
 {
     java.util.ArrayList <Object> list = new java.util.ArrayList <Object>(this.all.Length);
     list.addAll(java.util.Arrays <Object> .asList <Object>(this.all));
     list.remove(coll);
     this.all = (java.util.Collection <Object>[])list.toArray(new java.util.Collection <Object> [list.size()]);
 }
Exemple #14
0
 internal static void gatherLinks(java.util.ArrayList <android.text.util.LinkSpec>
                                  links, android.text.Spannable s, java.util.regex.Pattern pattern, string[] schemes
                                  , android.text.util.Linkify.MatchFilter matchFilter, android.text.util.Linkify.TransformFilter
                                  transformFilter)
 {
     throw new System.NotImplementedException();
 }
Exemple #15
0
        public void evaluate(org.openrdf.query.TupleQueryResultHandler tqrh)
        {
            SparqlResultSet rset = this.EvaluateQuery();

            java.util.ArrayList vars = new java.util.ArrayList();
            foreach (String var in rset.Variables)
            {
                vars.add(var);
            }

            tqrh.startQueryResult(vars);
            SesameMapping mapping = new SesameMapping(new Graph(), new dotSesame.impl.GraphImpl());

            foreach (SparqlResult r in rset)
            {
                dotSesameQuery.impl.MapBindingSet binding = new org.openrdf.query.impl.MapBindingSet();
                foreach (String var in r.Variables)
                {
                    binding.addBinding(var, SesameConverter.ToSesameValue(r[var], mapping));
                }
                tqrh.handleSolution(binding);
            }

            tqrh.endQueryResult();
        }
Exemple #16
0
        private void readObject(java.io.ObjectInputStream stream)
        {//throws IOException, ClassNotFoundException {
            stream.defaultReadObject();

            systemList = (java.util.ArrayList <T>)stream.readObject();
            userList   = (java.util.ArrayList <T>)stream.readObject();
        }
Exemple #17
0
 public HeaderViewListAdapter(java.util.ArrayList <android.widget.ListView.FixedViewInfo
                                                   > headerViewInfos, java.util.ArrayList <android.widget.ListView.FixedViewInfo> footerViewInfos
                              , android.widget.ListAdapter adapter)
 {
     // These two ArrayList are assumed to NOT be null.
     // They are indeed created when declared in ListView and then shared.
     // Used as a placeholder in case the provided info views are indeed null.
     // Currently only used by some CTS tests, which may be removed.
     mAdapter      = adapter;
     mIsFilterable = adapter is android.widget.Filterable;
     if (headerViewInfos == null)
     {
         mHeaderViewInfos = EMPTY_INFO_LIST;
     }
     else
     {
         mHeaderViewInfos = headerViewInfos;
     }
     if (footerViewInfos == null)
     {
         mFooterViewInfos = EMPTY_INFO_LIST;
     }
     else
     {
         mFooterViewInfos = footerViewInfos;
     }
     mAreAllFixedViewsSelectable = areAllListInfosSelectable(mHeaderViewInfos) && areAllListInfosSelectable
                                       (mFooterViewInfos);
 }
Exemple #18
0
 protected internal override void onDraw(android.graphics.Canvas canvas)
 {
     android.graphics.drawable.Drawable drawable = mHorizontalDivider;
     if (drawable != null)
     {
         // If we have a horizontal divider to draw, draw it at the remembered positions
         java.util.ArrayList <android.graphics.Rect> rects = mHorizontalDividerRects;
         {
             for (int i = rects.size() - 1; i >= 0; i--)
             {
                 drawable.setBounds(rects.get(i));
                 drawable.draw(canvas);
             }
         }
     }
     drawable = mVerticalDivider;
     if (drawable != null)
     {
         // If we have a vertical divider to draw, draw it at the remembered positions
         java.util.ArrayList <android.graphics.Rect> rects = mVerticalDividerRects;
         {
             for (int i = rects.size() - 1; i >= 0; i--)
             {
                 drawable.setBounds(rects.get(i));
                 drawable.draw(canvas);
             }
         }
     }
 }
        public static object ConvertToJavaTypes(object value)
        {
            if (value is Boolean) return new java.lang.Boolean((bool)value);
            if (value is int) return new java.lang.Integer((int)value);
            if (value is Int64) return new java.lang.Long((Int64)value);
            if (value is double) return new java.lang.Double((double)value);
            if (value is DateTime)
            {
                var datetime = (DateTime) value;
                return new java.util.Date(
                    datetime.Year, datetime.Month, datetime.Day,
                    datetime.Hour, datetime.Minute, datetime.Second);
            }
            if (value is string) return java.lang.String.valueOf(value);
            if (value is IEnumerable)
            {
                var enumerable = value as IEnumerable;
                var iterable = new java.util.ArrayList();
                foreach (var resultItem in enumerable)
                {
                    iterable.Add(resultItem);
                }
                return iterable;
            }

            return value;
        }
Exemple #20
0
        public static string[] SplitStringByChar(string e, char p)
        {
            if (null == e)
            {
                throw new InvalidOperationException();
            }

            var a = new java.util.ArrayList();

            int  i = -1;
            bool b = true;

            while (b)
            {
                int j = e.IndexOf(p, i + 1);

                if (j == -1)
                {
                    a.add(e.Substring(i + 1));
                    b = false;
                }
                else
                {
                    a.add(e.Substring(i + 1, j - i - 1));
                    i = j;
                }
            }

            return((string[])a.toArray(new string[a.size()]));
        }
Exemple #21
0
 public bool addAll(int i, java.util.Collection <Object> o)
 {
     if (root.fast)
     {
         lock (root)
         {
             java.util.ArrayList <Object> temp = (java.util.ArrayList <Object>)root.list.clone();
             bool r = get(temp).addAll(i, o);
             root.list = temp;
             if (r)
             {
                 last += o.size();
             }
             expected = temp;
             return(r);
         }
     }
     else
     {
         lock (root.list)
         {
             return(get(expected).addAll(i, o));
         }
     }
 }
Exemple #22
0
 public bool removeAll(java.util.Collection <Object> o)
 {
     if (root.fast)
     {
         lock (root)
         {
             java.util.ArrayList <Object> temp = (java.util.ArrayList <Object>)root.list.clone();
             java.util.List <Object>      sub  = get(temp);
             bool r = sub.removeAll(o);
             if (r)
             {
                 last = first + sub.size();
             }
             root.list = temp;
             expected  = temp;
             return(r);
         }
     }
     else
     {
         lock (root.list)
         {
             return(get(expected).removeAll(o));
         }
     }
 }
Exemple #23
0
        /// <summary>
        /// Gets the response and modify the headers.
        /// </summary>
        /// <returns>The response.</returns>
        /// <param name="request">Request.</param>
        public override WebResponse getResponse(WebRequest request)
        {
            WebResponse response = base.getResponse(request);

            //
            // Only if Url matches
            //
            if (request.getUrl().toExternalForm().Contains("com"))
            {
                string content = response.getContentAsString("UTF-8");
                java.util.ArrayList newheaders = new java.util.ArrayList();
                java.util.List      headers    = response.getResponseHeaders();
                java.util.Iterator  it         = headers.iterator();
                //
                // Remove the 'Access-Control-Allow-Origin' header
                //
                while (it.hasNext())
                {
                    com.gargoylesoftware.htmlunit.util.NameValuePair o = (com.gargoylesoftware.htmlunit.util.NameValuePair)it.next();
                    if (o.getName().Equals("Access-Control-Allow-Origin"))
                    {
                        string value = response.getResponseHeaderValue("Access-Control-Allow-Origin");
                        Console.WriteLine("Found header 'Access-Control-Allow-Origin' = \"{0}\" and stripping it from new headers for response", value);
                        continue; //headers.remove(o);
                    }
                    newheaders.add(o);
                }
                byte[]          utf  = System.Text.Encoding.UTF8.GetBytes(content);
                WebResponseData data = new WebResponseData(utf,
                                                           response.getStatusCode(), response.getStatusMessage(), newheaders);
                response = new WebResponse(data, request, response.getLoadTime());
                return(response);
            }
            return(response);
        }
        /// <summary>
        /// Create a value from a list of items
        /// </summary>
        /// <param name="items">An enumerator providing the items to make up the sequence. Every
        /// member of this list must be an instance of <c>XdmItem</c>
        /// </param>

        public XdmValue(IEnumerable items) {
            JArrayList list = new JArrayList();
            foreach (XdmItem c in items) {
                list.add((Item)c.Unwrap());
            }
            value = new SequenceExtent(list);
        }
Exemple #25
0
        public static string[] split(java.util.regex.Pattern pattern, string re, string input
                                     , int limit)
        {
            string[] fastResult = fastSplit(re, input, limit);
            if (fastResult != null)
            {
                return(fastResult);
            }
            // Unlike Perl, which considers the result of splitting the empty string to be the empty
            // array, Java returns an array containing the empty string.
            if (string.IsNullOrEmpty(input))
            {
                return(new string[] { string.Empty });
            }
            // Collect text preceding each occurrence of the separator, while there's enough space.
            java.util.ArrayList <string> list = new java.util.ArrayList <string>();
            int maxSize = limit <= 0 ? int.MaxValue : limit;

            java.util.regex.Matcher matcher = new java.util.regex.Matcher(pattern, java.lang.CharSequenceProxy.Wrap
                                                                              (input));
            int begin = 0;

            while (matcher.find() && list.size() + 1 < maxSize)
            {
                list.add(Sharpen.StringHelper.Substring(input, begin, matcher.start()));
                begin = matcher.end();
            }
            return(finishSplit(list, input, begin, maxSize, limit));
        }
Exemple #26
0
        /// <summary>
        /// Run the validation of the supplied source document, optionally
        /// writing the validated document to the supplied destination.
        /// </summary>

        public void Run()
        {
            if (source == null)
            {
                if (sources.Count == 0)
                {
                    throw new StaticError(new net.sf.saxon.trans.XPathException("No source(s) set for the SchemaValidator"));
                }
                java.util.List iter = new java.util.ArrayList();
                foreach (JSource src in sources)
                {
                    iter.add(src);
                }
                try
                {
                    schemaValidator.validateMultiple(iter);
                }
                catch (net.sf.saxon.s9api.SaxonApiException ex) {
                    throw new StaticError(ex);
                }
            }
            else
            {
                JAugmentedSource aug = JAugmentedSource.makeAugmentedSource(source);
                aug.setSchemaValidationMode(lax ? JValidation.LAX : JValidation.STRICT);
                try {
                    schemaValidator.validate(aug);
                }
                catch (net.sf.saxon.s9api.SaxonApiException ex)
                {
                    throw new StaticError(ex);
                }
            }
        }
Exemple #27
0
        private imageio.IIOImage GetIIOImageContainer(PlainImage pi)
        {
            java.util.ArrayList al = null;

            // prepare thumbnails list
            if (pi.Thumbnails != null)
            {
                al = new java.util.ArrayList(pi.Thumbnails.Length);
                for (int i = 0; i < pi.Thumbnails.Length; i++)
                {
                    al.add(pi.Thumbnails[i]);
                }
            }

            // prepare IIOImage container
            if (pi.NativeImage is image.BufferedImage)
            {
                imageio.IIOImage iio = new javax.imageio.IIOImage(
                    (image.BufferedImage)pi.NativeImage, al, null /*pi.NativeMetadata*/);
                return(iio);
            }
            else
            {
                // TBD: This codec is for raster formats only
                throw new NotSupportedException("Only raster formats are supported");
            }
        }
        /*
         * Returns a string containing a concise, human-readable description of this
         * {@code PermissionCollection}.
         *
         * @return a printable representation for this {@code PermissionCollection}.
         */
        public override String ToString()
        {
            java.util.ArrayList <String>       elist  = new java.util.ArrayList <String>(100);
            java.util.Enumeration <Permission> elenum = elements();
            String superStr    = base.ToString();
            int    totalLength = superStr.length() + 5;

            if (elenum != null)
            {
                while (elenum.hasMoreElements())
                {
                    String el = elenum.nextElement().toString();
                    totalLength += el.length();
                    elist.add(el);
                }
            }
            int esize = elist.size();

            totalLength += esize * 4;
            java.lang.StringBuilder result = new java.lang.StringBuilder(totalLength).append(superStr)
                                             .append(" ("); //$NON-NLS-1$
            for (int i = 0; i < esize; i++)
            {
                result.append("\n ").append(elist.get(i).toString()); //$NON-NLS-1$
            }
            return(result.append("\n)\n").toString());                //$NON-NLS-1$
        }
Exemple #29
0
        // Returns all the public fields of the current System.Type.
        public __FieldInfo[] GetFields()
        {
            var f = this.InternalTypeDescription.getDeclaredFields();
            var a = new java.util.ArrayList <__FieldInfo>();

            for (int i = 0; i < f.Length; i++)
            {
                var fi = f[i];

                // via https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2012/20120-1/20120817-wordpress
                var isPublic = Modifier.isPublic(fi.getModifiers());
                var isFinal  = Modifier.isFinal(fi.getModifiers());

                if (isPublic || isFinal)
                {
                    a.add(
                        new __FieldInfo {
                        InternalField = fi
                    }
                        );
                }
            }


            // otherwise, a new array of the same runtime type is allocated
            return(a.toArray(new __FieldInfo[0]));
        }
Exemple #30
0
        private static void SplitCharacter(java.lang.String str, int length,
                                           java.util.ArrayList list, int maxCount,
                                           bool omit, char[] anyOf)
        {
            int listCount = 0;
            int lastIndex = -1;

            for (int index = 0; index < length; index++)
            {
                if (!CharAtIsAnyOf(str, index, anyOf))
                {
                    continue;
                }
                if (index == ++lastIndex && omit)
                {
                    continue;
                }
                if (++listCount == maxCount)
                {
                    list.add(str.substring(lastIndex));
                    return;
                }
                list.add(str.substring(lastIndex, index));
                lastIndex = index;
            }
            if (length != ++lastIndex || !omit)
            {
                list.add(str.substring(lastIndex));
            }
        }
Exemple #31
0
        private weka.core.Instances CreateEmptyInstances()
        {
            var atts = new java.util.ArrayList();

            atts.add(new weka.core.Attribute("x"));
            atts.add(new weka.core.Attribute("y"));

            if (!ckbClassIsNominal.Checked)
            {
                atts.add(new weka.core.Attribute("v"));
            }
            else
            {
                // - nominal
                var attVals = new java.util.ArrayList();
                //for(int i=0; i<MAXCLASSNUM; ++i)
                //    attVals.add(i.ToString());
                attVals.add("0");
                attVals.add("1");
                atts.add(new weka.core.Attribute("v", attVals));
            }

            weka.core.Instances data = new weka.core.Instances("MyRelation", atts, 0);
            data.setClassIndex(data.numAttributes() - 1);

            return(data);
        }
Exemple #32
0
 public static android.content.Intent newChooseAccountIntent(android.accounts.Account
                                                             selectedAccount, java.util.ArrayList <android.accounts.Account> allowableAccounts
                                                             , string[] allowableAccountTypes, bool alwaysPromptForAccount, string descriptionOverrideText
                                                             , string addAccountAuthTokenType, string[] addAccountRequiredFeatures, android.os.Bundle
                                                             addAccountOptions)
 {
     throw new System.NotImplementedException();
 }
 private void ProcessOpenIERelationTriple(edu.stanford.nlp.util.CoreMap sentence)
 {
     java.util.ArrayList array = sentence.get(openieAnnotation) as java.util.ArrayList;
     foreach (edu.stanford.nlp.ie.util.RelationTriple element in array)
     {
         var sss = element;
     }
 }
Exemple #34
0
 /// <summary>Removes all listeners from this object.</summary>
 /// <remarks>
 /// Removes all listeners from this object. This is equivalent to calling
 /// <code>getListeners()</code> followed by calling <code>clear()</code> on the
 /// returned list of listeners.
 /// </remarks>
 public virtual void removeAllListeners()
 {
     if (mListeners != null)
     {
         mListeners.clear();
         mListeners = null;
     }
 }
Exemple #35
0
 /**
  * Constructs a new MultiRectArea and append rectangle from array
  */
 public MultiRectArea(java.util.ArrayList <java.awt.Rectangle> buf)
     : this()
 {
     for (int i = 0; i < buf.size(); i++)
     { //Basties note: also foreach available...
         add(buf.get(i));
     }
 }
Exemple #36
0
 /**
  * Adds system listener to this list.
  *
  * @param listener - listener to be added.
  */
 public void addSystemListener(T listener)
 {
     if (systemList == null)
     {
         systemList = new java.util.ArrayList <T>();
     }
     systemList.add(listener);
 }
Exemple #37
0
 internal override android.widget.Filter.FilterResults performFiltering(java.lang.CharSequence
                                                                        prefix)
 {
     android.widget.Filter.FilterResults results = new android.widget.Filter.FilterResults
                                                       ();
     if (this._enclosing.mUnfilteredData == null)
     {
         this._enclosing.mUnfilteredData = new java.util.ArrayList <java.util.Map <string, object
                                                                                   > >(this._enclosing.mData);
     }
     if (prefix == null || prefix.Length == 0)
     {
         java.util.ArrayList <java.util.Map <string, object> > list = this._enclosing.mUnfilteredData;
         results.values = list;
         results.count  = list.size();
     }
     else
     {
         string prefixString = prefix.ToString().ToLower();
         java.util.ArrayList <java.util.Map <string, object> > unfilteredValues = this._enclosing
                                                                                  .mUnfilteredData;
         int count = unfilteredValues.size();
         java.util.ArrayList <java.util.Map <string, object> > newValues = new java.util.ArrayList
                                                                           <java.util.Map <string, object> >(count);
         {
             for (int i = 0; i < count; i++)
             {
                 java.util.Map <string, object> h = unfilteredValues.get(i);
                 if (h != null)
                 {
                     int len = this._enclosing.mTo.Length;
                     {
                         for (int j = 0; j < len; j++)
                         {
                             string   str       = (string)h.get(this._enclosing.mFrom[j]);
                             string[] words     = XobotOS.Runtime.Util.SplitStringRegex(str, " ");
                             int      wordCount = words.Length;
                             {
                                 for (int k = 0; k < wordCount; k++)
                                 {
                                     string word = words[k];
                                     if (word.ToLower().StartsWith(prefixString))
                                     {
                                         newValues.add(h);
                                         break;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         results.values = newValues;
         results.count  = newValues.size();
     }
     return(results);
 }
 public override java.util.Enumeration<Permission> elements()
 {
     java.util.Collection<Permission> all = new java.util.ArrayList<Permission>();
     for (java.util.Iterator<java.util.Collection<Permission>> iter = klasses.values().iterator(); iter.hasNext(); )
     {
         all.addAll((java.util.Collection<Permission>)iter.next());
     }
     return java.util.Collections<Permission>.enumeration(all);
 }
 /**
  * Answers an iterator over the list of available charsets.
  *
  * @return available charsets.
  */
 public override java.util.Iterator<java.nio.charset.Charset> charsets()
 {
     java.util.ArrayList<java.nio.charset.Charset> charset = new java.util.ArrayList<java.nio.charset.Charset>();
     EncodingInfo [] ei = Encoding.GetEncodings();
     foreach (EncodingInfo info in ei)
     {
         CharsetImpl ci = new CharsetImpl(info.GetEncoding());
         charset.add(ci);
     }
     return charset.iterator();
 }
Exemple #40
0
        public void CanLoadRepository()
        {
            Directory.CreateDirectory(OutRepoLocation);
            var log = LogManager.Create("repo");
            var repos = new java.util.ArrayList();
            var mgr = CeylonUtils.makeRepositoryManager(repos, OutRepoLocation, log);

            foreach (var str in mgr.getRepositoriesDisplayString().Enumerate<string>(Convert.ToString))
            {
                Console.Out.WriteLine(str);
            }
        }
        public static void Invoke()
        {
            var nongeneric = new java.util.ArrayList();

            nongeneric.add(new Class1());

            var generic = new java.util.ArrayList<Class1>();

            generic.add(new Class1());


        }
Exemple #42
0
		public WordCollection(Synset synset)
		{
			_synset = synset;
			_words = new java.util.ArrayList();
			java.util.ArrayList nouns = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Noun + _synset.ID);
			java.util.ArrayList verbs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Verb + _synset.ID);
			java.util.ArrayList adjs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adjective + _synset.ID);
			java.util.ArrayList advs = (java.util.ArrayList)SUMO.WordNet.Intern.synsetsToWords.get((int)SpeechTypes.Adverb + _synset.ID);
			if(nouns != null) _words.addAll(nouns);
			if(verbs != null) _words.addAll(verbs);
			if(adjs != null) _words.addAll(adjs);
			if(advs != null) _words.addAll(advs);
			_it = _words.iterator();
		}
Exemple #43
0
		// The RI allows regular expressions beginning with ] or }, but that's probably a bug.
		/// <summary>
		/// Returns a result equivalent to
		/// <code>s.split(separator, limit)</code>
		/// if it's able
		/// to compute it more cheaply than ICU, or null if the caller should fall back to
		/// using ICU.
		/// </summary>
		public static string[] fastSplit(string re, string input, int limit)
		{
			// Can we do it cheaply?
			int len = re.Length;
			if (len == 0)
			{
				return null;
			}
			char ch = re[0];
			if (len == 1 && METACHARACTERS.IndexOf(ch) == -1)
			{
			}
			else
			{
				// We're looking for a single non-metacharacter. Easy.
				if (len == 2 && ch == '\\')
				{
					// We're looking for a quoted character.
					// Quoted metacharacters are effectively single non-metacharacters.
					ch = re[1];
					if (METACHARACTERS.IndexOf(ch) == -1)
					{
						return null;
					}
				}
				else
				{
					return null;
				}
			}
			// We can do this cheaply...
			// Unlike Perl, which considers the result of splitting the empty string to be the empty
			// array, Java returns an array containing the empty string.
			if (string.IsNullOrEmpty(input))
			{
				return new string[] { string.Empty };
			}
			// Collect text preceding each occurrence of the separator, while there's enough space.
			java.util.ArrayList<string> list = new java.util.ArrayList<string>();
			int maxSize = limit <= 0 ? int.MaxValue : limit;
			int begin = 0;
			int end;
			while ((end = input.IndexOf(ch, begin)) != -1 && list.size() + 1 < maxSize)
			{
				list.add(Sharpen.StringHelper.Substring(input, begin, end));
				begin = end + 1;
			}
			return finishSplit(list, input, begin, maxSize, limit);
		}
Exemple #44
0
        public void CanLoadTypeChecker()
        {
            var log = LogManager.Create("repo");
            var repos = new java.util.ArrayList();
            var mgr = CeylonUtils.makeRepositoryManager(repos, OutRepoLocation, log);

            var tcb = new TypeCheckerBuilder();
            tcb.verbose(true);
            tcb.setRepositoryManager(mgr);
            var srcFile=new java.io.File("hello.ceylon");
            tcb.addSrcDirectory(srcFile);

               var typeChecker= tcb.getTypeChecker();
              typeChecker.process();
        }
Exemple #45
0
        public void CanInheritVisitor()
        {
            var log = LogManager.Create("repo");
            var repos = new java.util.ArrayList();
            var mgr = CeylonUtils.makeRepositoryManager(repos, OutRepoLocation, log);

            var tcb = new TypeCheckerBuilder();
            tcb.verbose(true);
            tcb.setRepositoryManager(mgr);
            var srcFile = new java.io.File("hello.ceylon");
            tcb.addSrcDirectory(srcFile);

            var tc = tcb.getTypeChecker();
            tc.process();

            var v = new TestVisitor(log);

            foreach(var unit in  tc.getPhasedUnits().getPhasedUnits().Enumerate<PhasedUnit>())
            {
               unit.getCompilationUnit().visit(v);
            }
        }
Exemple #46
0
        private weka.core.Instances CreateEmptyInstances()
        {
            var atts = new java.util.ArrayList();
            atts.add(new weka.core.Attribute("x"));
            atts.add(new weka.core.Attribute("y"));

            if (!ckbClassIsNominal.Checked)
            {
                atts.add(new weka.core.Attribute("v"));
            }
            else
            {
                // - nominal
                var attVals = new java.util.ArrayList();
                //for(int i=0; i<MAXCLASSNUM; ++i)
                //    attVals.add(i.ToString());
                attVals.add("0");
                attVals.add("1");
                atts.add(new weka.core.Attribute("v", attVals));
            }

            weka.core.Instances data = new weka.core.Instances("MyRelation", atts, 0);
            data.setClassIndex(data.numAttributes() - 1);

            return data;
        }
 /**
  * Factory method to create a SetList using the supplied list to retain order.
  * <p>
  * If the list contains duplicates, these are removed (first indexed one kept).
  * A <code>HashSet</code> is used for the set behaviour.
  *
  * @param list  the list to decorate, must not be null
  * @throws IllegalArgumentException if list is null
  */
 public static SetUniqueList decorate(java.util.List<Object> list)
 {
     if (list == null)
     {
         throw new java.lang.IllegalArgumentException("List must not be null");
     }
     if (list.isEmpty())
     {
         return new SetUniqueList(list, new java.util.HashSet<Object>());
     }
     else
     {
         java.util.List<Object> temp = new java.util.ArrayList<Object>(list);
         list.clear();
         SetUniqueList sl = new SetUniqueList(list, new java.util.HashSet<Object>());
         sl.addAll(temp);
         return sl;
     }
 }
Exemple #48
0
			internal override android.widget.Filter.FilterResults performFiltering(java.lang.CharSequence
				 prefix)
			{
				android.widget.Filter.FilterResults results = new android.widget.Filter.FilterResults
					();
				if (this._enclosing.mUnfilteredData == null)
				{
					this._enclosing.mUnfilteredData = new java.util.ArrayList<java.util.Map<string, object
						>>(this._enclosing.mData);
				}
				if (prefix == null || prefix.Length == 0)
				{
					java.util.ArrayList<java.util.Map<string, object>> list = this._enclosing.mUnfilteredData;
					results.values = list;
					results.count = list.size();
				}
				else
				{
					string prefixString = prefix.ToString().ToLower();
					java.util.ArrayList<java.util.Map<string, object>> unfilteredValues = this._enclosing
						.mUnfilteredData;
					int count = unfilteredValues.size();
					java.util.ArrayList<java.util.Map<string, object>> newValues = new java.util.ArrayList
						<java.util.Map<string, object>>(count);
					{
						for (int i = 0; i < count; i++)
						{
							java.util.Map<string, object> h = unfilteredValues.get(i);
							if (h != null)
							{
								int len = this._enclosing.mTo.Length;
								{
									for (int j = 0; j < len; j++)
									{
										string str = (string)h.get(this._enclosing.mFrom[j]);
										string[] words = XobotOS.Runtime.Util.SplitStringRegex(str, " ");
										int wordCount = words.Length;
										{
											for (int k = 0; k < wordCount; k++)
											{
												string word = words[k];
												if (word.ToLower().StartsWith(prefixString))
												{
													newValues.add(h);
													break;
												}
											}
										}
									}
								}
							}
						}
					}
					results.values = newValues;
					results.count = newValues.size();
				}
				return results;
			}
Exemple #49
0
		/// <summary>Read an ArrayList object from an XmlPullParser.</summary>
		/// <remarks>
		/// Read an ArrayList object from an XmlPullParser.  The XML data could
		/// previously have been generated by writeListXml().  The XmlPullParser
		/// must be positioned <em>after</em> the tag that begins the list.
		/// </remarks>
		/// <param name="parser">The XmlPullParser from which to read the list data.</param>
		/// <param name="endTag">Name of the tag that will end the list, usually "list".</param>
		/// <param name="name">
		/// An array of one string, used to return the name attribute
		/// of the list's tag.
		/// </param>
		/// <returns>HashMap The newly generated list.</returns>
		/// <seealso cref="readListXml(java.io.InputStream)">readListXml(java.io.InputStream)
		/// 	</seealso>
		/// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static java.util.ArrayList<object> readThisListXml(org.xmlpull.v1.XmlPullParser
			 parser, string endTag, string[] name)
		{
			java.util.ArrayList<object> list = new java.util.ArrayList<object>();
			int eventType = parser.getEventType();
			do
			{
				if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG)
				{
					object val = readThisValueXml(parser, name);
					list.add(val);
				}
				else
				{
					//System.out.println("Adding to list: " + val);
					if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG)
					{
						if (parser.getName().Equals(endTag))
						{
							return list;
						}
						throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: "
							 + parser.getName());
					}
				}
				eventType = parser.next();
			}
			while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT);
			throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag
				 + " end tag");
		}
Exemple #50
0
		/// <hide></hide>
		/// <param name="child"></param>
		/// <param name="visibility"></param>
		protected internal virtual void onChildVisibilityChanged(android.view.View child, 
			int visibility)
		{
			if (mTransition != null)
			{
				if (visibility == VISIBLE)
				{
					mTransition.showChild(this, child);
				}
				else
				{
					mTransition.hideChild(this, child);
				}
				if (visibility != VISIBLE)
				{
					// Only track this on disappearing views - appearing views are already visible
					// and don't need special handling during drawChild()
					if (mVisibilityChangingChildren == null)
					{
						mVisibilityChangingChildren = new java.util.ArrayList<android.view.View>();
					}
					mVisibilityChangingChildren.add(child);
					if (mTransitioningViews != null && mTransitioningViews.contains(child))
					{
						addDisappearingView(child);
					}
				}
			}
			// in all cases, for drags
			if (mCurrentDrag != null)
			{
				if (visibility == VISIBLE)
				{
					notifyChildOfDrag(child);
				}
			}
		}
Exemple #51
0
		/// <summary>Add a view which is removed from mChildren but still needs animation</summary>
		/// <param name="v">View to add</param>
		private void addDisappearingView(android.view.View v)
		{
			java.util.ArrayList<android.view.View> disappearingChildren = mDisappearingChildren;
			if (disappearingChildren == null)
			{
				disappearingChildren = mDisappearingChildren = new java.util.ArrayList<android.view.View
					>();
			}
			disappearingChildren.add(v);
		}
Exemple #52
0
			protected internal override bool onTransact(int code, android.os.Parcel data, android.os.Parcel
				 reply, int flags)
			{
				switch (code)
				{
					case android.os.IBinderClass.INTERFACE_TRANSACTION:
					{
						reply.writeString(DESCRIPTOR);
						return true;
					}

					case TRANSACTION_startListening:
					{
						data.enforceInterface(DESCRIPTOR);
						[email protected] _arg0;
						_arg0 = [email protected](data.readStrongBinder
							());
						string _arg1;
						_arg1 = data.readString();
						int _arg2;
						_arg2 = data.readInt();
						java.util.List<android.widget.RemoteViews> _arg3;
						_arg3 = new java.util.ArrayList<android.widget.RemoteViews>();
						int[] _result = this.startListening(_arg0, _arg1, _arg2, _arg3);
						reply.writeNoException();
						reply.writeIntArray(_result);
						reply.writeTypedList(_arg3);
						return true;
					}

					case TRANSACTION_stopListening:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						this.stopListening(_arg0);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_allocateAppWidgetId:
					{
						data.enforceInterface(DESCRIPTOR);
						string _arg0;
						_arg0 = data.readString();
						int _arg1;
						_arg1 = data.readInt();
						int _result = this.allocateAppWidgetId(_arg0, _arg1);
						reply.writeNoException();
						reply.writeInt(_result);
						return true;
					}

					case TRANSACTION_deleteAppWidgetId:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						this.deleteAppWidgetId(_arg0);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_deleteHost:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						this.deleteHost(_arg0);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_deleteAllHosts:
					{
						data.enforceInterface(DESCRIPTOR);
						this.deleteAllHosts();
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_getAppWidgetViews:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						android.widget.RemoteViews _result = this.getAppWidgetViews(_arg0);
						reply.writeNoException();
						if ((_result != null))
						{
							reply.writeInt(1);
							_result.writeToParcel(reply, android.os.ParcelableClass.PARCELABLE_WRITE_RETURN_VALUE
								);
						}
						else
						{
							reply.writeInt(0);
						}
						return true;
					}

					case TRANSACTION_updateAppWidgetIds:
					{
						data.enforceInterface(DESCRIPTOR);
						int[] _arg0;
						_arg0 = data.createIntArray();
						android.widget.RemoteViews _arg1;
						if ((0 != data.readInt()))
						{
							_arg1 = android.widget.RemoteViews.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg1 = null;
						}
						this.updateAppWidgetIds(_arg0, _arg1);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_partiallyUpdateAppWidgetIds:
					{
						data.enforceInterface(DESCRIPTOR);
						int[] _arg0;
						_arg0 = data.createIntArray();
						android.widget.RemoteViews _arg1;
						if ((0 != data.readInt()))
						{
							_arg1 = android.widget.RemoteViews.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg1 = null;
						}
						this.partiallyUpdateAppWidgetIds(_arg0, _arg1);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_updateAppWidgetProvider:
					{
						data.enforceInterface(DESCRIPTOR);
						android.content.ComponentName _arg0;
						if ((0 != data.readInt()))
						{
							_arg0 = android.content.ComponentName.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg0 = null;
						}
						android.widget.RemoteViews _arg1;
						if ((0 != data.readInt()))
						{
							_arg1 = android.widget.RemoteViews.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg1 = null;
						}
						this.updateAppWidgetProvider(_arg0, _arg1);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_notifyAppWidgetViewDataChanged:
					{
						data.enforceInterface(DESCRIPTOR);
						int[] _arg0;
						_arg0 = data.createIntArray();
						int _arg1;
						_arg1 = data.readInt();
						this.notifyAppWidgetViewDataChanged(_arg0, _arg1);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_getInstalledProviders:
					{
						data.enforceInterface(DESCRIPTOR);
						java.util.List<android.appwidget.AppWidgetProviderInfo> _result = this.getInstalledProviders
							();
						reply.writeNoException();
						reply.writeTypedList(_result);
						return true;
					}

					case TRANSACTION_getAppWidgetInfo:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						android.appwidget.AppWidgetProviderInfo _result = this.getAppWidgetInfo(_arg0);
						reply.writeNoException();
						if ((_result != null))
						{
							reply.writeInt(1);
							_result.writeToParcel(reply, android.os.ParcelableClass.PARCELABLE_WRITE_RETURN_VALUE
								);
						}
						else
						{
							reply.writeInt(0);
						}
						return true;
					}

					case TRANSACTION_bindAppWidgetId:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						android.content.ComponentName _arg1;
						if ((0 != data.readInt()))
						{
							_arg1 = android.content.ComponentName.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg1 = null;
						}
						this.bindAppWidgetId(_arg0, _arg1);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_bindRemoteViewsService:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						android.content.Intent _arg1;
						if ((0 != data.readInt()))
						{
							_arg1 = android.content.Intent.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg1 = null;
						}
						android.os.IBinder _arg2;
						_arg2 = data.readStrongBinder();
						this.bindRemoteViewsService(_arg0, _arg1, _arg2);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_unbindRemoteViewsService:
					{
						data.enforceInterface(DESCRIPTOR);
						int _arg0;
						_arg0 = data.readInt();
						android.content.Intent _arg1;
						if ((0 != data.readInt()))
						{
							_arg1 = android.content.Intent.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg1 = null;
						}
						this.unbindRemoteViewsService(_arg0, _arg1);
						reply.writeNoException();
						return true;
					}

					case TRANSACTION_getAppWidgetIds:
					{
						data.enforceInterface(DESCRIPTOR);
						android.content.ComponentName _arg0;
						if ((0 != data.readInt()))
						{
							_arg0 = android.content.ComponentName.CREATOR.createFromParcel(data);
						}
						else
						{
							_arg0 = null;
						}
						int[] _result = this.getAppWidgetIds(_arg0);
						reply.writeNoException();
						reply.writeIntArray(_result);
						return true;
					}
				}
				return base.onTransact(code, data, reply, flags);
			}
Exemple #53
0
		/// <summary>
		/// This method tells the ViewGroup that the given View object, which should have this
		/// ViewGroup as its parent,
		/// should be kept around  (re-displayed when the ViewGroup draws its children) even if it
		/// is removed from its parent.
		/// </summary>
		/// <remarks>
		/// This method tells the ViewGroup that the given View object, which should have this
		/// ViewGroup as its parent,
		/// should be kept around  (re-displayed when the ViewGroup draws its children) even if it
		/// is removed from its parent. This allows animations, such as those used by
		/// <see cref="android.app.Fragment">android.app.Fragment</see>
		/// and
		/// <see cref="android.animation.LayoutTransition">android.animation.LayoutTransition
		/// 	</see>
		/// to animate
		/// the removal of views. A call to this method should always be accompanied by a later call
		/// to
		/// <see cref="endViewTransition(View)">endViewTransition(View)</see>
		/// , such as after an animation on the View has finished,
		/// so that the View finally gets removed.
		/// </remarks>
		/// <param name="view">The View object to be kept visible even if it gets removed from its parent.
		/// 	</param>
		public virtual void startViewTransition(android.view.View view)
		{
			if (view.mParent == this)
			{
				if (mTransitioningViews == null)
				{
					mTransitioningViews = new java.util.ArrayList<android.view.View>();
				}
				mTransitioningViews.add(view);
			}
		}
		private void InitSPNProviders () {
			if (SPNProviders != null)
				return;
			java.util.ArrayList spnProviders = new java.util.ArrayList ();
			NameValueCollection configAttributes = System.Configuration.ConfigurationSettings.AppSettings;
			string providersList = configAttributes ["SPNProviders"];
			if (providersList == null)
				return;
			string[] tokens = providersList.Split (',');
			foreach (string spnClass in tokens) {
				try {
					spnProviders.add (Activator.CreateInstance (Type.GetType (spnClass)));
				}
				catch (Exception) { }
			}
			SPNProviders = spnProviders;
		}
 /**
  * Transforms a collection.
  * <p>
  * The transformer itself may throw an exception if necessary.
  *
  * @param coll  the collection to transform
  * @return a transformed object
  */
 protected virtual java.util.Collection<Object> transform(java.util.Collection<Object> coll)
 {
     java.util.List<Object> list = new java.util.ArrayList<Object>(coll.size());
     for (java.util.Iterator<Object> it = coll.iterator(); it.hasNext(); )
     {
         list.add(transform(it.next()));
     }
     return list;
 }
		private void InitClient()
		{
			lock(LOCK_OBJECT)
			{
				if((!_disableHttpConnectionPooling) && (_client == null))
				{
					_client = _sclient;
				}
				if(_client == null)
				{
					mainsoft.apache.commons.httpclient.MultiThreadedHttpConnectionManager manager =
						new mainsoft.apache.commons.httpclient.MultiThreadedHttpConnectionManager();
					manager.setConnectionStaleCheckingEnabled(false);
					manager.setMaxTotalConnections(200);
					//by some reasons RFC something - the default 
					//value will be 2 , so we need to change it ...
					manager.setMaxConnectionsPerHost(20);
					_client = new HttpClient(manager);
					_client.getParams().setIntParameter(HttpClientParams.MAX_REDIRECTS, _defaultMaxRedirectsNum);
					_client.getParams().setParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, new java.lang.Boolean(true));
					_client.getParams().setParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT, new java.lang.Long(30000));
					_client.getParams().setParameter(HttpClientParams.USER_AGENT, 
							"VMW4J HttpClient (based on Jakarta Commons HttpClient)");
					_client.getParams ().setBooleanParameter (HttpClientParams.SINGLE_COOKIE_HEADER, true);
					java.util.ArrayList schemas = new java.util.ArrayList ();
					schemas.add ("Ntlm");
					schemas.add ("Digest");
					schemas.add ("Basic");
					schemas.add ("Negotiate");
					_client.getParams ().setParameter (AuthPolicy.AUTH_SCHEME_PRIORITY, schemas);
					if (!_disableHttpConnectionPooling) {
						_sclient = _client;
					}
				}
			}
		}
Exemple #57
0
        // Update provider Services if the properties was changed
        private void updatePropertyServiceTable()
        {
            Object _key;
            Object _value;
            Provider.Service s;
            String serviceName;
            String algorithm;
            if (changedProperties == null || changedProperties.isEmpty())
            {
                return;
            }
            java.util.Iterator<java.util.MapNS.Entry<String, String>> it = changedProperties.entrySet().iterator();
            for (; it.hasNext(); )
            {
                java.util.MapNS.Entry<String, String> entry = it.next();
                _key = entry.getKey();
                _value = entry.getValue();
                if (_key == null || _value == null || !(_key is String)
                        || !(_value is String))
                {
                    continue;
                }
                String key = (String)_key;
                String value = (String)_value;
                if (key.startsWith("Provider"))
                { // Provider service type is reserved //$NON-NLS-1$
                    continue;
                }
                int i;
                if (key.startsWith("Alg.Alias."))
                { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$
                    String aliasName;
                    String service_alias = key.substring(10);
                    i = service_alias.indexOf('.');
                    serviceName = service_alias.substring(0, i);
                    aliasName = service_alias.substring(i + 1);
                    algorithm = value;
                    String algUp = algorithm.toUpperCase();
                    Object o = null;
                    if (propertyServiceTable == null)
                    {
                        propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128);
                    }
                    else
                    {
                        o = propertyServiceTable.get(serviceName, algUp);
                    }
                    if (o != null)
                    {
                        s = (Provider.Service)o;
                        s.aliases.add(aliasName);
                        if (propertyAliasTable == null)
                        {
                            propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256);
                        }
                        propertyAliasTable.put(serviceName,
                                aliasName.toUpperCase(), s);
                    }
                    else
                    {
                        String className = (String)changedProperties
                                .get(serviceName + "." + algorithm); //$NON-NLS-1$
                        if (className != null)
                        {
                            java.util.ArrayList<String> l = new java.util.ArrayList<String>();
                            l.add(aliasName);
                            s = new Provider.Service(this, serviceName, algorithm,
                                    className, l, new java.util.HashMap<String, String>());
                            propertyServiceTable.put(serviceName, algUp, s);
                            if (propertyAliasTable == null)
                            {
                                propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256);
                            }
                            propertyAliasTable.put(serviceName, aliasName
                                    .toUpperCase(), s);
                        }
                    }
                    continue;
                }
                int j = key.indexOf('.');
                if (j == -1)
                { // unknown format
                    continue;
                }
                i = key.indexOf(' ');
                if (i == -1)
                { // <crypto_service>.<algorithm_or_type>=<className>
                    serviceName = key.substring(0, j);
                    algorithm = key.substring(j + 1);
                    String alg = algorithm.toUpperCase();
                    Object o = null;
                    if (propertyServiceTable != null)
                    {
                        o = propertyServiceTable.get(serviceName, alg);
                    }
                    if (o != null)
                    {
                        s = (Provider.Service)o;
                        s.className = value;
                    }
                    else
                    {
                        s = new Provider.Service(this, serviceName, algorithm,
                                value, new java.util.ArrayList<String>(), new java.util.HashMap<String, String>());
                        if (propertyServiceTable == null)
                        {
                            propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128);
                        }
                        propertyServiceTable.put(serviceName, alg, s);

                    }
                }
                else
                { // <crypto_service>.<algorithm_or_type>
                    // <attribute_name>=<attrValue>
                    serviceName = key.substring(0, j);
                    algorithm = key.substring(j + 1, i);
                    String attribute = key.substring(i + 1);
                    String alg = algorithm.toUpperCase();
                    Object o = null;
                    if (propertyServiceTable != null)
                    {
                        o = propertyServiceTable.get(serviceName, alg);
                    }
                    if (o != null)
                    {
                        s = (Provider.Service)o;
                        s.attributes.put(attribute, value);
                    }
                    else
                    {
                        String className = (String)changedProperties
                                .get(serviceName + "." + algorithm); //$NON-NLS-1$
                        if (className != null)
                        {
                            java.util.HashMap<String, String> m = new java.util.HashMap<String, String>();
                            m.put(attribute, value);
                            s = new Provider.Service(this, serviceName, algorithm,
                                    className, new java.util.ArrayList<String>(), m);
                            if (propertyServiceTable == null)
                            {
                                propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128);
                            }
                            propertyServiceTable.put(serviceName, alg, s);
                        }
                    }
                }
            }
            servicesChanged();
            changedProperties.clear();
        }
Exemple #58
0
		public ActionMenu(android.content.Context context)
		{
			mContext = context;
			mItems = new java.util.ArrayList<*****@*****.**>();
		}
Exemple #59
0
		internal java.util.ArrayList<android.content.ComponentCallbacks2> collectComponentCallbacksLocked
			(bool allActivities, android.content.res.Configuration newConfig)
		{
			java.util.ArrayList<android.content.ComponentCallbacks2> callbacks = new java.util.ArrayList
				<android.content.ComponentCallbacks2>();
			if (mActivities.size() > 0)
			{
				java.util.Iterator<android.app.ActivityThread.ActivityClientRecord> it = mActivities
					.values().iterator();
				while (it.hasNext())
				{
					android.app.ActivityThread.ActivityClientRecord ar = it.next();
					android.app.Activity a = ar.activity;
					if (a != null)
					{
						android.content.res.Configuration thisConfig = applyConfigCompatMainThread(newConfig
							, ar.packageInfo.mCompatibilityInfo.getIfNeeded());
						if (!ar.activity.mFinished && (allActivities || (a != null && !ar.paused)))
						{
							// If the activity is currently resumed, its configuration
							// needs to change right now.
							callbacks.add(a);
						}
						else
						{
							if (thisConfig != null)
							{
								// Otherwise, we will tell it about the change
								// the next time it is resumed or shown.  Note that
								// the activity manager may, before then, decide the
								// activity needs to be destroyed to handle its new
								// configuration.
								ar.newConfig = thisConfig;
							}
						}
					}
				}
			}
			if (mServices.size() > 0)
			{
				java.util.Iterator<android.app.Service> it = mServices.values().iterator();
				while (it.hasNext())
				{
					callbacks.add(it.next());
				}
			}
			lock (mProviderMap)
			{
				if (mLocalProviders.size() > 0)
				{
					java.util.Iterator<android.app.ActivityThread.ProviderClientRecord> it = mLocalProviders
						.values().iterator();
					while (it.hasNext())
					{
						callbacks.add(it.next().mLocalProvider);
					}
				}
			}
			int N = mAllApplications.size();
			{
				for (int i = 0; i < N; i++)
				{
					callbacks.add(mAllApplications.get(i));
				}
			}
			return callbacks;
		}
                public override void Init(Variable[] variables)
                {
                    java.util.ArrayList vars = new java.util.ArrayList();
                    foreach (Variable b in variables)
                        if (varMap[b] != null) // because of bad treatment of meta
                            vars.add((SparqlVariable)varMap[b]);

                    bindings = new RdfBindingSetImpl(vars);
                }