View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.support.model;
17  
18  import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
19  
20  /**
21   * @author TK Kocheran <rfkrocktk@gmail.com>
22   */
23  public class SearchResult {
24  
25      protected String result;
26  
27      protected UnsignedIntegerFourBytes count;
28  
29      protected UnsignedIntegerFourBytes totalMatches;
30  
31      protected UnsignedIntegerFourBytes containerUpdateID;
32  
33      public SearchResult(String result, UnsignedIntegerFourBytes count,
34                          UnsignedIntegerFourBytes totalMatches,
35                          UnsignedIntegerFourBytes containerUpdateID) {
36          this.result = result;
37          this.count = count;
38          this.totalMatches = totalMatches;
39          this.containerUpdateID = containerUpdateID;
40      }
41  
42      public SearchResult(String result, long count, long totalMatches) {
43          this(result, count, totalMatches, 0);
44      }
45  
46      public SearchResult(String result, long count, long totalMatches, long updateID) {
47          this(
48                  result,
49                  new UnsignedIntegerFourBytes(count),
50                  new UnsignedIntegerFourBytes(totalMatches),
51                  new UnsignedIntegerFourBytes(updateID)
52          );
53      }
54  
55      public String getResult() {
56          return result;
57      }
58  
59      public UnsignedIntegerFourBytes getCount() {
60          return count;
61      }
62  
63      public long getCountLong() {
64          return count.getValue();
65      }
66  
67      public UnsignedIntegerFourBytes getTotalMatches() {
68          return totalMatches;
69      }
70  
71      public long getTotalMatchesLong() {
72          return totalMatches.getValue();
73      }
74  
75      public UnsignedIntegerFourBytes getContainerUpdateID() {
76          return containerUpdateID;
77      }
78  
79      public long getContainerUpdateIDLong() {
80          return containerUpdateID.getValue();
81      }
82  }