<commit_before>//
//  Paginator.swift
//  reddift
//
//  Created by sonson on 2015/04/14.
//  Copyright (c) 2015年 sonson. All rights reserved.
//

import Foundation

/**
Paginator object for paiging listing object.
*/
public class Paginator : Thing {
	var after:String
	var before:String
    var modhash:String
    
    public override init() {
        self.after = ""
        self.before = ""
        self.modhash = ""
        super.init()
    }
	
    public init(after:String, before:String, modhash:String) {
		self.after = after
		self.before = before
        self.modhash = modhash
        super.init()
	}
	
	public var isVacant : Bool {
		if (!after.isEmpty) || (!before.isEmpty) {
			return true
		}
		return false
	}
    
    /**
    Generate dictionary to add query parameters to URL.
	If paginator is vacant, returns vacant dictionary as [String:String].
    
    :returns: Dictionary object for paging.
    */
    public func parameters() -> [String:String] {
        var dict:[String:String] = [:]
        if count(after) > 0 {
            dict["after"] = after
        }
        if count(before) > 0 {
            dict["before"] = before
        }
        return dict
    }
}<commit_msg>Fixed bug of Paginator.<commit_after>//
//  Paginator.swift
//  reddift
//
//  Created by sonson on 2015/04/14.
//  Copyright (c) 2015年 sonson. All rights reserved.
//

import Foundation

/**
Paginator object for paiging listing object.
*/
public class Paginator : Thing {
	var after:String
	var before:String
    var modhash:String
    
    public override init() {
        self.after = ""
        self.before = ""
        self.modhash = ""
        super.init()
    }
	
    public init(after:String, before:String, modhash:String) {
		self.after = after
		self.before = before
        self.modhash = modhash
        super.init()
	}
	
	public var isVacant : Bool {
		if (!after.isEmpty) || (!before.isEmpty) {
			return false
		}
		return true
	}
    
    /**
    Generate dictionary to add query parameters to URL.
	If paginator is vacant, returns vacant dictionary as [String:String].
    
    :returns: Dictionary object for paging.
    */
    public func parameters() -> [String:String] {
        var dict:[String:String] = [:]
        if count(after) > 0 {
            dict["after"] = after
        }
        if count(before) > 0 {
            dict["before"] = before
        }
        return dict
    }
}
{'fraction_non_alphanumeric': 0.11659751037344399, 'fraction_numerical': 0.011618257261410789, 'mean_word_length': 2.079182630906769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '98006', 'n_tokens_mistral': 786, 'n_tokens_neox': 725, 'n_words': 207}