org.fosstrak.ale.server
Class Tag

java.lang.Object
  extended by org.fosstrak.ale.server.Tag

public class Tag
extends java.lang.Object

represents a tag that has been read on one of the readers in the Logical Reader API.

Author:
sawielan, alessio orlando, roberto vergallo

Constructor Summary
Tag()
          constructor for a tag.
Tag(java.lang.String origin)
          constructor for a tag.
Tag(java.lang.String origin, byte[] tagId, java.lang.String tagIDAsPureURI, long timestamp)
          assignment constructor for Tag.
Tag(Tag tag)
          constructs a tag from another existing tag.
 
Method Summary
 void addTrace(java.lang.String suffix)
          prepends a trace to the given trace.
static java.lang.String convert_to_LEGACY(java.lang.String tagLength, java.lang.String filter, java.lang.String companyPrefixLength, java.lang.String tag)
          converts a given tag through tdt into LEGACY format.
static java.lang.String convert_to_PURE_IDENTITY(java.lang.String tagLength, java.lang.String filter, java.lang.String companyPrefixLength, java.lang.String tag)
          converts a given tag through tdt into PURE_IDENTITY format.
static java.lang.String convert_to_TAG_ENCODING(java.lang.String tagLength, java.lang.String filter, java.lang.String companyPrefixLength, java.lang.String tag)
           
 boolean equals(java.lang.Object obj)
           
 boolean equals(Tag tag)
           
 boolean equalsTag(Tag tag)
          comparator to check whether two tags are the same.
 java.lang.String getCompanyPrefixLength()
           
 java.lang.String getFilter()
           
 java.lang.String getOrigin()
          returns the name of the baseReader where the tag has been read.
 java.lang.String getReader()
          gets the name of the reader that read this tag.
 java.lang.String getTagAsBinary()
           
 byte[] getTagID()
          returns the id of this tag.
 java.lang.String getTagIDAsPureURI()
          returns the id of this tag as pure uri.
 java.lang.String getTagLength()
           
static org.fosstrak.tdt.TDTEngine getTDTEngine()
           
 long getTimestamp()
          returns the timestamp when the tag occured.
 java.lang.String getTrace()
          returns the trace path of the tag.
 int hashCode()
           
 void prettyPrint(org.apache.log4j.Logger log, org.apache.log4j.Level level)
          prints a pretty print to the provided logger.
 void setCompanyPrefixLength(java.lang.String companyPrefixLength)
           
 void setFilter(java.lang.String filter)
           
 void setOrigin(java.lang.String origin)
          sets the origin (baseReader) where the tag has been read.
 void setReader(java.lang.String reader)
          sets the name of the reader that read this tag. when a reader is part of a composite reader then the reader will set to the name of the compositeReader. if you want to get the original reader refer to origin.
 void setTagAsBinary(java.lang.String binary)
          sets the tag in binary format.
 void setTagID(byte[] tagID)
          sets the tag id.
 void setTagIDAsPureURI(java.lang.String tagIDAsPureURI)
          sets the tag id as pure uri.
 void setTagLength(java.lang.String tagLength)
           
 void setTimestamp(long timestamp)
          sets the timestamp when a tag has been read.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tag

public Tag()
constructor for a tag. (default constructor).


Tag

public Tag(java.lang.String origin,
           byte[] tagId,
           java.lang.String tagIDAsPureURI,
           long timestamp)
assignment constructor for Tag.

Parameters:
origin - reader where the tag was read originally
tagId - the tagID
timestamp - the timestamp

Tag

public Tag(java.lang.String origin)
constructor for a tag.(assignment constructor).

Parameters:
origin - the baseReader where the tag has been read

Tag

public Tag(Tag tag)
constructs a tag from another existing tag. (copy constructor).

Parameters:
tag - the tag to be copied into a new tag
Method Detail

getReader

public java.lang.String getReader()
gets the name of the reader that read this tag.

Returns:
name of a logicalReader

setReader

public void setReader(java.lang.String reader)
sets the name of the reader that read this tag. when a reader is part of a composite reader then the reader will set to the name of the compositeReader. if you want to get the original reader refer to origin.

Parameters:
reader - a name of a logicalReader

getTagID

public byte[] getTagID()
returns the id of this tag.

Returns:
byte[] containing the tag id

setTagID

public void setTagID(byte[] tagID)
sets the tag id.

Parameters:
tagID - a byte[] holding the tag id.

getTimestamp

public long getTimestamp()
returns the timestamp when the tag occured.

Returns:
timestamp

setTimestamp

public void setTimestamp(long timestamp)
sets the timestamp when a tag has been read.

Parameters:
timestamp - time when tag has been read.

addTrace

public void addTrace(java.lang.String suffix)
prepends a trace to the given trace.

Parameters:
suffix - a trace path item

getTrace

public java.lang.String getTrace()
returns the trace path of the tag.

Returns:
a string containing the tracepath

prettyPrint

public void prettyPrint(org.apache.log4j.Logger log,
                        org.apache.log4j.Level level)
prints a pretty print to the provided logger.

Parameters:
log - log facility to write the pretty print to

getOrigin

public java.lang.String getOrigin()
returns the name of the baseReader where the tag has been read.

Returns:
returns the name of the baseReader where the tag has been read.

setOrigin

public void setOrigin(java.lang.String origin)
sets the origin (baseReader) where the tag has been read.

Parameters:
origin - the name of the baseReader where the tag has been read.

equalsTag

public boolean equalsTag(Tag tag)
comparator to check whether two tags are the same.

Parameters:
tag - the other tag to be checked.
Returns:
boolean value flagging whether equal or not

equals

public boolean equals(Tag tag)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getTagIDAsPureURI

public java.lang.String getTagIDAsPureURI()
returns the id of this tag as pure uri.

Returns:
String containing the tag id

setTagIDAsPureURI

public void setTagIDAsPureURI(java.lang.String tagIDAsPureURI)
sets the tag id as pure uri.

Parameters:
tagIDAsPureURI - a string holding the tag id.

setTagAsBinary

public void setTagAsBinary(java.lang.String binary)
sets the tag in binary format.

Parameters:
binary - the tag in binary format.

getTagAsBinary

public java.lang.String getTagAsBinary()
Returns:
the tag in binary format.

setTagLength

public void setTagLength(java.lang.String tagLength)
Parameters:
tagLength - the tagLength to set

getTagLength

public java.lang.String getTagLength()
Returns:
the tagLength

setFilter

public void setFilter(java.lang.String filter)
Parameters:
filter - the filter to set

getFilter

public java.lang.String getFilter()
Returns:
the filter

setCompanyPrefixLength

public void setCompanyPrefixLength(java.lang.String companyPrefixLength)
Parameters:
companyPrefixLength - the companyPrefixLength to set

getCompanyPrefixLength

public java.lang.String getCompanyPrefixLength()
Returns:
the companyPrefixLength

getTDTEngine

public static org.fosstrak.tdt.TDTEngine getTDTEngine()

convert_to_LEGACY

public static java.lang.String convert_to_LEGACY(java.lang.String tagLength,
                                                 java.lang.String filter,
                                                 java.lang.String companyPrefixLength,
                                                 java.lang.String tag)
converts a given tag through tdt into LEGACY format.

Parameters:
tagLength - the inbound taglength must be specified as "64" or "96".
filter - the inbound filter value must be specified - range depends on coding scheme.
companyPrefixLength - length of the EAN.UCC Company Prefix must be specified for GS1 coding schemes. if set to null paramter is ignored.
tag - the tag to convert in binary format or in TAG_ENCODING.
Returns:
a converted tag or null if exception during conversion.

convert_to_PURE_IDENTITY

public static java.lang.String convert_to_PURE_IDENTITY(java.lang.String tagLength,
                                                        java.lang.String filter,
                                                        java.lang.String companyPrefixLength,
                                                        java.lang.String tag)
converts a given tag through tdt into PURE_IDENTITY format.

Parameters:
tagLength - the inbound taglength must be specified as "64" or "96".
filter - the inbound filter value must be specified - range depends on coding scheme.
companyPrefixLength - length of the EAN.UCC Company Prefix must be specified for GS1 coding schemes. if set to null paramter is ignored.
tag - the tag to convert in binary format or in TAG_ENCODING.
Returns:
a converted tag or null if exception during conversion.

convert_to_TAG_ENCODING

public static java.lang.String convert_to_TAG_ENCODING(java.lang.String tagLength,
                                                       java.lang.String filter,
                                                       java.lang.String companyPrefixLength,
                                                       java.lang.String tag)


Copyright © 2009. All Rights Reserved.