Mercurial Hosting > luan
comparison core/src/luan/AbstractLuanTable.java @ 222:b76fcb72d97d
add AbstractLuanTable and improve HttpLuan
git-svn-id: https://luan-java.googlecode.com/svn/trunk@223 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 21 Jul 2014 02:23:05 +0000 |
parents | |
children | 05eb2837ddbf |
comparison
equal
deleted
inserted
replaced
221:ec016471c6eb | 222:b76fcb72d97d |
---|---|
1 package luan; | |
2 | |
3 import java.util.Iterator; | |
4 import java.util.ListIterator; | |
5 import java.util.Map; | |
6 import java.util.HashMap; | |
7 import java.util.List; | |
8 import java.util.ArrayList; | |
9 import java.util.Collections; | |
10 import java.util.Comparator; | |
11 import java.util.Set; | |
12 import java.util.HashSet; | |
13 import java.util.IdentityHashMap; | |
14 import java.util.regex.Pattern; | |
15 | |
16 | |
17 public abstract class AbstractLuanTable implements LuanTable { | |
18 | |
19 @Override public List<Object> asList() { | |
20 return Collections.emptyList(); | |
21 } | |
22 | |
23 @Override public Map<Object,Object> asMap() { | |
24 return Collections.emptyMap(); | |
25 } | |
26 | |
27 protected abstract String type(); | |
28 | |
29 @Override public final String toString() { | |
30 return type() + ": " + Integer.toHexString(hashCode()); | |
31 } | |
32 | |
33 @Override public Object put(Object key,Object val) { | |
34 throw new UnsupportedOperationException("can't put into a "+type()); | |
35 } | |
36 | |
37 @Override public void insert(int pos,Object value) { | |
38 throw new UnsupportedOperationException("can't insert into a "+type()); | |
39 } | |
40 | |
41 @Override public void add(Object value) { | |
42 throw new UnsupportedOperationException("can't add to a "+type()); | |
43 } | |
44 | |
45 @Override public Object remove(int pos) { | |
46 throw new UnsupportedOperationException("can't remove from a "+type()); | |
47 } | |
48 | |
49 @Override public void sort(Comparator<Object> cmp) { | |
50 } | |
51 | |
52 @Override public int length() { | |
53 return 0; | |
54 } | |
55 | |
56 @Override public LuanTable subList(int from,int to) { | |
57 throw new UnsupportedOperationException("can't get a sub-list of a "+type()); | |
58 } | |
59 | |
60 @Override public LuanTable getMetatable() { | |
61 return null; | |
62 } | |
63 | |
64 @Override public void setMetatable(LuanTable metatable) { | |
65 throw new UnsupportedOperationException("can't set a metatable on a "+type()); | |
66 } | |
67 } |