PageRenderTime 26ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/src/com/google/maps/extras/xmlparsers/atom/Link.as

http://gmaps-utility-library-flash.googlecode.com/
ActionScript | 140 lines | 52 code | 15 blank | 73 comment | 0 complexity | fc13fcbd043fb606693c64a80f451d55 MD5 | raw file
  1/*
  2        Copyright (c) 2008, Adobe Systems Incorporated
  3        All rights reserved.
  4
  5        Redistribution and use in source and binary forms, with or without 
  6        modification, are permitted provided that the following conditions are
  7        met:
  8
  9    * Redistributions of source code must retain the above copyright notice, 
 10        this list of conditions and the following disclaimer.
 11    * Redistributions in binary form must reproduce the above copyright
 12                notice, this list of conditions and the following disclaimer in the 
 13        documentation and/or other materials provided with the distribution.
 14    * Neither the name of Adobe Systems Incorporated nor the names of its 
 15        contributors may be used to endorse or promote products derived from 
 16        this software without specific prior written permission.
 17
 18        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 19        IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 20        THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 21        PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
 22        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 23        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 24        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 25        PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 26        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 27        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 28        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29*/
 30package com.google.maps.extras.xmlparsers.atom
 31{
 32	import com.google.maps.extras.xmlparsers.XmlElement;
 33	import com.google.maps.extras.xmlparsers.XmlParser;
 34	import com.google.maps.extras.xmlparsers.ParsingTools;
 35	import com.google.maps.extras.xmlparsers.Namespaces;
 36	
 37	/**
 38	*	Class that represents a Link element within an Atom feed.
 39	* 
 40	* 	@langversion ActionScript 3.0
 41	*	@playerversion Flash 8.5
 42	*	@tiptext
 43	* 
 44	* 	@see http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.2.7
 45	*/
 46	public class Link extends XmlElement
 47	{
 48		private var atom:Namespace = Namespaces.ATOM_NS;
 49		
 50		/**
 51		*	Constant for the "alternate" value of the rel property.
 52		* 
 53		* 	@langversion ActionScript 3.0
 54		*	@playerversion Flash 8.5
 55		*	@tiptext
 56		*/			
 57		public static const REL_ALTERNATE:String = "alternate";
 58		
 59		/**
 60		*	Constant for the "related" value of the rel property.
 61		* 
 62		* 	@langversion ActionScript 3.0
 63		*	@playerversion Flash 8.5
 64		*	@tiptext
 65		*/			
 66		public static const REL_RELATED:String = "related";
 67		
 68		/**
 69		*	Constant for the "self" value of the rel property.
 70		* 
 71		* 	@langversion ActionScript 3.0
 72		*	@playerversion Flash 8.5
 73		*	@tiptext
 74		*/			
 75		public static const REL_SELF:String = "self";
 76		
 77		/**
 78		*	Constant for the "enclosure" value of the rel property.
 79		* 
 80		* 	@langversion ActionScript 3.0
 81		*	@playerversion Flash 8.5
 82		*	@tiptext
 83		*/			
 84		public static const REL_ENCLOSURE:String = "enclosure";
 85		
 86		/**
 87		*	Constant for the "via" value of the rel property.
 88		* 
 89		* 	@langversion ActionScript 3.0
 90		*	@playerversion Flash 8.5
 91		*	@tiptext
 92		*/			
 93		public static const REL_VIA:String = "via";
 94		
 95		private var _rel:String;
 96		private var _type:String;
 97		private var _hreflang:String;
 98		private var _href:String;
 99		private var _title:String;
100		private var _length:Number;
101		
102		public function Link(x:XMLList)
103		{
104			super(x);
105			
106			this._rel = ParsingTools.nullCheck(this.x.atom::link.@rel);
107			this._type = ParsingTools.nullCheck(this.x.atom::link.@type);
108			this._hreflang = ParsingTools.nullCheck(this.x.atom::link.@hreflang);
109			this._href = ParsingTools.nullCheck(this.x.atom::link.@href);
110			this._title = ParsingTools.nullCheck(this.x.atom::link.@title);
111			this._length = ParsingTools.nanCheck(this.x.atom::link.@["length"]);
112		}
113		
114	
115		public function get rel():String
116		{
117			return this._rel;
118		}
119		
120		public function get type():String
121		{
122			return this._type;
123		}
124		
125		public function get hreflang():String
126		{
127			return this._hreflang;
128		}
129		
130		public function get title():String
131		{
132			return this._title;
133		}
134		
135		public function get length():Number
136		{
137			return this._length;
138		}
139	}
140}