001package com.astrolabsoftware.FinkBrowser.Januser; 002 003import java.util.Objects; 004 005// Tinker Pop 006import org.apache.tinkerpop.gremlin.structure.Vertex; 007 008/** <code>OCol</code> captures <em>OCol</em> {@link Vertex}. 009 * @opt attributes 010 * @opt operations 011 * @opt types 012 * @opt visibility 013 * @author <a href="mailto:Julius.Hrivnac@cern.ch">J.Hrivnac</a> */ 014public class OCol implements Comparable<OCol> { 015 016 /** Create}. 017 * @param ocol The <em>OCol</em> {@link Vertex}. */ 018 public OCol(Vertex ocol) { 019 _survey = ocol.property("survey" ).value().toString(); 020 _classifier = ocol.property("classifier").value().toString(); 021 _flavor = ocol.property("flavor" ).value().toString(); 022 _cls = ocol.property("cls" ).value().toString(); 023 } 024 025 @Override 026 public int compareTo(OCol o) { 027 int comparison = _survey.compareTo(o._survey); 028 if (comparison == 0) { 029 comparison = _classifier.compareTo(o._classifier); 030 } 031 if (comparison == 0) { 032 comparison = _flavor.compareTo(o._flavor); 033 } 034 if (comparison == 0) { 035 comparison = _cls.compareTo(o._cls); 036 } 037 return comparison; 038 } 039 040 @Override 041 public boolean equals(Object o) { 042 if (o == this) { 043 return true; 044 } 045 if (!(o instanceof OCol)) { 046 return false; 047 } 048 OCol other = (OCol)o; 049 return Objects.equals(_survey, other._survey) && 050 Objects.equals(_classifier, other._classifier) && 051 Objects.equals(_flavor, other._flavor) && 052 Objects.equals(_cls, other._cls); 053 } 054 055 @Override 056 public int hashCode() { 057 return Objects.hash(_survey, _classifier, _flavor, _cls); 058 } 059 060 /** Give contained classifier survey. 061 * @return The contained classifier survey. */ 062 public String survey() { 063 return _survey; 064 } 065 066 /** Give contained classifier name. 067 * @return The contained classifier name. */ 068 public String classifier() { 069 return _classifier; 070 } 071 072 /** Give contained classifier flavor. 073 * @return The contained classifier flavor. */ 074 public String flavor() { 075 return _flavor; 076 } 077 078 /** Give contained classifier class. 079 * @return The contained classifier class. */ 080 public String cls() { 081 return _cls; 082 } 083 084 @Override 085 // as in Classifier 086 public String toString() { 087 String ts = _cls + " of " + _classifier; 088 if (_flavor != null && !_flavor.equals("")) { 089 ts += "=" + _flavor; 090 } 091 ts += "[" + _survey + "]"; 092 return ts; 093 } 094 095 private String _survey; 096 097 private String _classifier; 098 099 private String _flavor; 100 101 private String _cls; 102 103 }