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