@@ -33,16 +33,17 @@ public class Song extends SpecializedTinkerVertex implements Serializable {
3333 public static final String NAME = "name" ;
3434 public static final String SONG_TYPE = "songType" ;
3535 public static final String PERFORMANCES = "performances" ;
36- public static final String TEST_PROP = "testProperty" ;
37- public static final Set <String > SPECIFIC_KEYS = new HashSet <>(Arrays .asList (NAME , SONG_TYPE , PERFORMANCES , TEST_PROP ));
36+ public static final Set <String > SPECIFIC_KEYS = new HashSet <>(Arrays .asList (NAME , SONG_TYPE , PERFORMANCES ));
3837 public static final Set <String > ALLOWED_IN_EDGE_LABELS = new HashSet <>(Arrays .asList (FollowedBy .label ));
3938 public static final Set <String > ALLOWED_OUT_EDGE_LABELS = new HashSet <>(Arrays .asList (FollowedBy .label , SungBy .label , WrittenBy .label ));
39+ public static final int NAME_IDX = 0 ;
40+ public static final int SONG_TYPE_IDX = 1 ;
41+ public static final int PERFORMANCES_IDX = 2 ;
4042
4143 // properties
4244 private String name ;
4345 private String songType ;
4446 private Integer performances ;
45- private int [] testProp ;
4647
4748 public Song (Long id , TinkerGraph graph ) {
4849 super (id , Song .label , graph );
@@ -76,8 +77,6 @@ public Integer getPerformances() {
7677 return performances ;
7778 }
7879
79- public int [] getTestProp () { return testProp ; }
80-
8180 @ Override
8281 protected Set <String > specificKeys () {
8382 return SPECIFIC_KEYS ;
@@ -103,8 +102,6 @@ protected <V> Iterator<VertexProperty<V>> specificProperties(String key) {
103102 return IteratorUtils .of (new TinkerVertexProperty (this , key , songType ));
104103 } else if (key == PERFORMANCES && performances != null ) {
105104 return IteratorUtils .of (new TinkerVertexProperty (this , key , performances ));
106- } else if (key == TEST_PROP && testProp != null ) {
107- return IteratorUtils .of (new TinkerVertexProperty (this , key , testProp ));
108105 } else {
109106 return Collections .emptyIterator ();
110107 }
@@ -116,13 +113,16 @@ public Map<String, Object> valueMap() {
116113 if (name != null ) properties .put (NAME , name );
117114 if (songType != null ) properties .put (SONG_TYPE , songType );
118115 if (performances != null ) properties .put (PERFORMANCES , performances );
119- if (testProp != null ) properties .put (TEST_PROP , testProp );
120116 return properties ;
121117 }
122118
123119 @ Override
124120 public SortedMap <Integer , Object > propertiesByStorageIdx () {
125- throw new NotImplementedException ("TODO" );
121+ SortedMap <Integer , Object > ret = new TreeMap <>();
122+ if (name != null ) ret .put (NAME_IDX , name );
123+ if (songType != null ) ret .put (SONG_TYPE_IDX , songType );
124+ if (performances != null ) ret .put (PERFORMANCES_IDX , performances );
125+ return ret ;
126126 }
127127
128128 @ Override
@@ -134,8 +134,6 @@ protected <V> VertexProperty<V> updateSpecificProperty(
134134 this .songType = (String ) value ;
135135 } else if (PERFORMANCES .equals (key )) {
136136 this .performances = ((Integer ) value );
137- } else if (TEST_PROP .equals (key )) {
138- this .testProp = (int []) value ;
139137 } else {
140138 throw new RuntimeException ("property with key=" + key + " not (yet) supported by " + this .getClass ().getName ());
141139 }
@@ -151,8 +149,6 @@ protected void removeSpecificProperty(String key) {
151149 this .songType = null ;
152150 } else if (PERFORMANCES .equals (key )) {
153151 this .performances = null ;
154- } else if (TEST_PROP .equals (key )) {
155- this .testProp = null ;
156152 } else {
157153 throw new RuntimeException ("property with key=" + key + " not (yet) supported by " + this .getClass ().getName ());
158154 }
0 commit comments