You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.8 KiB
65 lines
1.8 KiB
14 years ago
|
/**
|
||
|
* ContentDomain
|
||
|
* Copyright 2011 by Michael Christen
|
||
|
* First released 18.05.2011 at http://yacy.net
|
||
|
*
|
||
|
* $LastChangedDate$
|
||
|
* $LastChangedRevision$
|
||
|
* $LastChangedBy$
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2.1 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public License
|
||
|
* along with this program in the file lgpl21.txt
|
||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
package net.yacy.search.snippet;
|
||
15 years ago
|
|
||
|
public enum ContentDomain {
|
||
|
|
||
|
ALL(-1),
|
||
|
TEXT(0),
|
||
|
IMAGE(1),
|
||
|
AUDIO(2),
|
||
|
VIDEO(3),
|
||
|
APP(4);
|
||
|
|
||
|
private int code;
|
||
|
|
||
|
ContentDomain(int code) {
|
||
|
this.code = code;
|
||
|
}
|
||
|
|
||
|
public int getCode() {
|
||
|
return this.code;
|
||
|
}
|
||
|
|
||
|
public static ContentDomain contentdomParser(final String dom) {
|
||
14 years ago
|
if ("text".equals(dom)) return TEXT;
|
||
|
else if ("image".equals(dom)) return IMAGE;
|
||
|
else if ("audio".equals(dom)) return AUDIO;
|
||
|
else if ("video".equals(dom)) return VIDEO;
|
||
|
else if ("app".equals(dom)) return APP;
|
||
15 years ago
|
return TEXT;
|
||
|
}
|
||
|
|
||
15 years ago
|
@Override
|
||
15 years ago
|
public String toString() {
|
||
|
if (this == TEXT) return "text";
|
||
|
else if (this == IMAGE) return "image";
|
||
|
else if (this == AUDIO) return "audio";
|
||
|
else if (this == VIDEO) return "video";
|
||
|
else if (this == APP) return "app";
|
||
|
return "text";
|
||
|
}
|
||
|
}
|