blob: dc7adee965c878ad6bb34319a2cfeaea84cf3ac2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.intent.model;
/**
* A representation of an intent behind a query. Intents have no structure but are just id's of a
* set which is predefined in the application.
* <p>
* Intents are Value Objects.
* <p>
* Intent ids should be human readable, start with lower case and use camel casing
*
* @author bratseth
*/
public class Intent {
private String id;
public static final Intent Default=new Intent("default");
/** Creates an intent from a string id */
public Intent(String id) {
this.id=id;
}
/** Returns the id of this intent, never null */
public String getId() { return id; }
@Override
public int hashCode() { return id.hashCode(); }
@Override
public boolean equals(Object other) {
if (other==this) return true;
if ( ! (other instanceof Intent)) return false;
return this.id.equals(((Intent)other).id);
}
/** Returns the id of this intent */
@Override
public String toString() { return id; }
}
|