Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 38148 invoked from network); 2 Nov 2003 16:52:51 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 2 Nov 2003 16:52:51 -0000 Received: (qmail 7496 invoked by uid 500); 2 Nov 2003 16:52:42 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 7300 invoked by uid 500); 2 Nov 2003 16:52:41 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 7285 invoked from network); 2 Nov 2003 16:52:41 -0000 Received: from unknown (HELO out2.smtp.messagingengine.com) (66.111.4.26) by daedalus.apache.org with SMTP; 2 Nov 2003 16:52:41 -0000 X-Sasl-enc: 31tSgGI90klRN9paasQsmQ 1067791962 Received: from fry (cpc1-oxfd2-4-0-cust70.oxfd.cable.ntl.com [62.254.142.70]) by www.fastmail.fm (Postfix) with ESMTP id 563603A655E for ; Sun, 2 Nov 2003 11:52:42 -0500 (EST) Message-ID: <001401c3a161$bbe73fa0$468efe3e@fry> From: "Rob Oxspring" To: "Jakarta Commons Developers List" References: <31EBB9D2-0540-11D8-AD5D-00039379521C@mac.com> <003901c39950$dad6ced0$398ffe3e@fry> <001001c3a01a$5853b2e0$468efe3e@fry> <2A3C13FF-0CCC-11D8-939E-00039379521C@mac.com> <3FA455FF.1080001@imapmail.org> <15AA393E-0CD2-11D8-939E-00039379521C@mac.com> Subject: Re: [CLI] 2.x Tasks Date: Sun, 2 Nov 2003 16:52:41 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ----- Original Message ----- From: "John Keyes" To: "Jakarta Commons Developers List" Sent: Sunday, November 02, 2003 1:15 AM Subject: Re: [CLI] 2.x Tasks > Here's a toy example: > > -topleft -x 10 -y 10 -bottomright -x 20 -y 20 > > where the group is the x and y Arguments. > > Does that make any sense? Annoyingly, yes. :) So the problem is that when querying a CommandLine configured by the above we have no way of which -x and -y go with which -topleft and -bottomright. The only way to achive this query is to use the path of the options along the lines of: xValue = commandLine.getValue("-topleft","-x"); I don't see any reason for limiting the path length so I guess the api needs to allow for an array / list / iterator or similar. Of course this means that the current option->values map is no longer up to the job, and some path->values is going to be needed. I'm beginning to think that we need an object to represent a option's path to key from. For this to work we need to arrange for the pathToValues map to be populated. One option would make all option instances aware of their parent and so make it easy to identify the path, unfortunately this means that the same option/group can't appear in multiple places within the structure which is a useful feature IMHO. Perhaps the easiest solution is to make all the process(..) methods take an additional Path argument. This way, as control is delegated to other arguments / children / group members, the appropriate Path can be constructed based on the one passed in and can be passed to the delagate's process method. Begin able to deal with option paths is also relevant to processing Properties / Prefs / xml / etc into a CommandLine. Given a property "topleft.x" we need to first verify that the path topleft>x is valid and then associate any values / switches in the CommandLine. I guess the easiest thing here would be to add a method in Option along the lines of: /** Finds the option associated with the path from this option or null if the path is invalid */ Option find(Path path); This is fine if the we can use the properties to drive the options but this might not always be the best way forward but adding another method to Option to find the valid paths should allow options to drive the prefs too. /** Finds all the valid option paths rooted at this option */ Set findPaths(); Thoughts ? Rob > > -John K > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-dev-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org