Re: [Jsdsi-users] extending jsdsi.Tag
Status: Pre-Alpha
Brought to you by:
sajma
From: Sameer A. <aj...@cs...> - 2004-04-27 14:56:03
|
Ok, I've just checked a change into CVS that makes toTagSexp protected. Sameer > Sameer Ajmani <aj...@cs...> writes: > >> Would making toTagSexp() protected solve your problem? We can >> probably do this. > > yes, it will be perfect. > > I think it will allow others to provide specific tags with their own > intersect() methods without modifying the jsdsi package by extending > Tag. (again, I don't know if it is a good practice or if it should be > allowed, but at least i find it useful). > > > guillermo > >> >> Sameer >> >>> >>> Thanks a lot for the answer and the advice, >>> >>>> To construct application-specific tags, just use the Tag subclasses. >>> >>> I wanted to create a new Tag object because the semantics of my >>> authorization tag require a different intersect() function. I just >>> though that I could extend jsdsi.Tag implementing the abstract >>> methods, and providing my own intersect algorithm for my specific >>> tag. >>> >>> If I implement my own Tag extending jsdsi.Tag I get an error because >>> I cannot implement the abstract method Tag.toTagSexp(). Making it >>> public in Tag solves the error, although I don't know if this is a >>> good practice. >>> >>> Thanks again, >>> >>> Guillermo >>> >>> >>> Sameer Ajmani <aj...@cs...> writes: >>> >>>> Tag.toSexp() returns (tag <tag-material>), while Tag.toTagSexp() >>>> just returns <tag-material>. This just matters for when you write >>>> tags to a file or to the network (you should always use toSexp(), so >>>> that the receiver knows that it's getting a Tag). To construct >>>> application-specific tags, just use the Tag subclasses. For >>>> example, a tag like this: >>>> (tag (file (*set read write) (*prefix /home/ajmani))) >>>> Is constructed as: >>>> new SimpleTag("file", >>>> new ExprTag[] { >>>> new SetTag(new ExprTag[] { new StringTag("read"), >>>> new StringTag("write") }), >>>> new PrefixTag("/home/ajmani"); >>>> }; >>>> ).toSexp(); >>>> >>>> or parse the original string into an object: >>>> >>>> Tag myTag = (Tag)Obj.parseObj >>>> (new SexpInputString >>>> (new ByteArrayInputStream >>>> (Sexp.encodeString >>>> ("(tag (file (*set read write) (*prefix /home/ajmani)))") >>>> )).readSexp()); >>>> >>>> Sameer >>>> >>>>> Hi, >>>>> >>>>> I have a little question regarding jsdsi.Tag. I need to create an >>>>> application specific Tag and I was wondering if the abstract class >>>>> Tag is intended to be extended by external sw packages. >>>>> >>>>> If this is the case, the method Tag.toTagSexp() shouldn't it be >>>>> declared public or protected? In the latests stable version and >>>>> current CVS version is is package-private. And if this is not the >>>>> case, which is the best way to implement an application-specific >>>>> tag? >>>>> >>>>> >>>>> thanks, >>>>> >>>>> Guillermo >>>>> >>>>> -- >>>>> --------------------------------------------------------------- >>>>> Guillermo Navarro (gna...@cc...) >>>>> Phone: +34 93 581 3577 >>>>> FAX: +34 93 581 3033 >>>>> Home: http://www.ccd.uab.es/~guille >>>>> Combinatoria i Comunicacio Digital (http://www.ccd.uab.es) >>>>> Universitat Autonoma de Barcelona - 08193 Bellaterra, Spain >>>>> --------------------------------------------------------------- >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------- >>>>> This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek >>>>> For a limited time only, get FREE Ground shipping on all orders of >>>>> $35 or more. Hurry up and shop folks, this offer expires April >>>>> 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 >>>>> _______________________________________________ >>>>> Jsdsi-users mailing list >>>>> Jsd...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/jsdsi-users >>>> >>>> >>>> http://ajmani.net >>>> >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------- >>>> This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek >>>> For a limited time only, get FREE Ground shipping on all orders of >>>> $35 or more. Hurry up and shop folks, this offer expires April 30th! >>>> http://www.thinkgeek.com/freeshipping/?cpg=12297 >>>> _______________________________________________ >>>> Jsdsi-users mailing list >>>> Jsd...@li... >>>> https://lists.sourceforge.net/lists/listinfo/jsdsi-users >>>> >>> >>> -- >>> --------------------------------------------------------------- >>> Guillermo Navarro (gna...@cc...) >>> Phone: +34 93 581 3577 >>> FAX: +34 93 581 3033 >>> Home: http://www.ccd.uab.es/~guille >>> Combinatoria i Comunicacio Digital (http://www.ccd.uab.es) >>> Universitat Autonoma de Barcelona - 08193 Bellaterra, Spain >>> --------------------------------------------------------------- >> >> >> http://ajmani.net >> >> >> > > -- > --------------------------------------------------------------- > Guillermo Navarro (gna...@cc...) > Phone: +34 93 581 3577 > FAX: +34 93 581 3033 > Home: http://www.ccd.uab.es/~guille > Combinatoria i Comunicacio Digital (http://www.ccd.uab.es) > Universitat Autonoma de Barcelona - 08193 Bellaterra, Spain > --------------------------------------------------------------- http://ajmani.net |