001package gudusoft.gsqlparser.dlineage.dataflow.model; 002 003import gudusoft.gsqlparser.ESqlClause; 004import gudusoft.gsqlparser.nodes.TParseTreeNode; 005import java.util.ArrayList; 006import java.util.List; 007 008public class ArgumentRelationshipElement implements RelationshipElement<Argument> { 009 private Argument argument; 010 private Integer argumentIndex; 011 private ESqlClause relationLocation; 012 private List<Transform> transforms = new ArrayList(); 013 014 public ArgumentRelationshipElement(Argument argument) { 015 this.argument = argument; 016 } 017 018 public ArgumentRelationshipElement(Argument argument, int index) { 019 this.argument = argument; 020 this.argumentIndex = index; 021 } 022 023 public ArgumentRelationshipElement(Argument argument, ESqlClause relationLocation) { 024 this.argument = argument; 025 this.relationLocation = relationLocation; 026 } 027 028 public Argument getElement() { 029 return this.argument; 030 } 031 032 public ESqlClause getRelationLocation() { 033 return this.relationLocation; 034 } 035 036 public int hashCode() { 037 int result = 1; 038 result = 31 * result + (this.argument == null ? 0 : this.argument.hashCode()); 039 result = 31 * result + (this.relationLocation == null ? 0 : this.relationLocation.hashCode()); 040 return result; 041 } 042 043 public boolean equals(Object obj) { 044 if (this == obj) { 045 return true; 046 } else if (obj == null) { 047 return false; 048 } else if (this.getClass() != obj.getClass()) { 049 return false; 050 } else { 051 ArgumentRelationshipElement other = (ArgumentRelationshipElement)obj; 052 if (this.argument == null) { 053 if (other.argument != null) { 054 return false; 055 } 056 } else if (!this.argument.equals(other.argument)) { 057 return false; 058 } 059 060 return this.relationLocation == other.relationLocation; 061 } 062 } 063 064 public Integer getColumnIndex() { 065 return this.argumentIndex; 066 } 067 068 public List<Transform> getTransforms() { 069 return this.transforms; 070 } 071 072 public void addTransform(String type, TParseTreeNode code) { 073 if (ModelBindingManager.getGlobalOption() == null || ModelBindingManager.getGlobalOption().isTransform()) { 074 Transform transform = new Transform(); 075 transform.setType(type); 076 transform.setCode(code); 077 this.transforms.add(transform); 078 } 079 } 080}