예제 #1
0
 /**
  * Returns a tag list that has a copy of {@code tags}. Each tag value
  * is expected to be a string parseable using {@link BasicTag#parseTag}.
  */
 public static BasicTagList copyOf(IEnumerable <String> tags)
 {
     SmallTagMap.Builder builder = SmallTagMap.builder();
     foreach (var tag in tags)
     {
         builder.add(Tags.parseTag(tag));
     }
     return(new BasicTagList(builder.result()));
 }
예제 #2
0
        /**
         * Returns a tag list that has a copy of {@code tags}.
         */
        public static BasicTagList copyOf(IDictionary <String, String> tags)
        {
            SmallTagMap.Builder builder = SmallTagMap.builder();
            foreach (var tag in tags)
            {
                builder.add(Tags.newTag(tag.Key, tag.Value));
            }

            return(new BasicTagList(builder.result()));
        }
예제 #3
0
        /**
         * Returns a tag list from the list of key values passed.
         * <p/>
         * Example:
         * <p/>
         * <code>
         * BasicTagList tagList = BasicTagList.of("id", "someId", "class", "someClass");
         * </code>
         */
        public static BasicTagList of(params string[] tags)
        {
            //Preconditions.checkArgument(tags.Length % 2 == 0, "tags must be a sequence of key,value pairs");

            SmallTagMap.Builder builder = SmallTagMap.builder();
            for (int i = 0; i < tags.Length; i += 2)
            {
                ITag t = Tags.newTag(tags[i], tags[i + 1]);
                builder.add(t);
            }
            return(new BasicTagList(builder.result()));
        }
예제 #4
0
        /** {@inheritDoc} */
        public bool equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            if (obj == null || !(obj is SmallTagMap))
            {
                return(false);
            }

            SmallTagMap that = (SmallTagMap)obj;

            return(Equals(tagArray, that.tagArray));
        }
예제 #5
0
 /**
  * Creates a new instance with a fixed set of tags.
  *
  * @param entries entries to include in this tag list
  */
 public BasicTagList(IEnumerable <ITag> entries)
 {
     SmallTagMap.Builder builder = SmallTagMap.builder();
     builder.addAll(entries);
     tagMap = builder.result();
 }
예제 #6
0
 /**
  * Create a BasicTagList from a {@link SmallTagMap}.
  */
 public BasicTagList(SmallTagMap tagMap)
 {
     this.tagMap        = tagMap;
     this.sortedTaglist = new SortedDictionary <string, string>();
 }