Question on conditional compliation

I want to include some classes (and the code which calls them) only if certain parameters are set. The sort of thing which C++ would do in the preprocessor, but Java doesn't have one.
If I set public static final variables (e.g. WANTED) can I write
if (WANTED) {
NewOne=new SomeClass();
SomeClass NewOne;
and will the complier notice that NewOne is never instantiated, so it doesn't need to bring in the code for SomeClass at all? I've found that I can't enclose the second part of the code in the same conditional, but that's reasonable.
Peter

Hi Kaj,
What I'm doing is to design code which allows me to say which of various facilities a user may have (and he'll have to pay for each option). These facilities are, effectively, written as separate classes, and I'd prefer not to distribute code (albeit compiled) to someone who hasn't paid for them.
I think this is a reasonable idea, and if there's an alternative design method, please let me know. If there isn't I'll find some way of writing 2^N versions of the code for each of the N facilities. Currently only 2 facilities, but this will grow - expnentially. It's hard enough as it is with just 2.
I should point out that the code's still being designed and a prototype written, so there's plenty of time for me to get the correct ideas.
Peter

Similar Messages

  • Question on conditional text design

    I have a relatively large book (230 pages) with dozens of tables and 100's of graphics. I need 4 versions of this book. One for each grade level (3) and one if content for all 3 grades is sold as a "master course."  Other than implementing the conditional text, the book is ready to go. I have tried a couple different ways to approach the  tables conditionally (some of which are in Text Frames, some just anchored to a page ) but I don't get very far.  Applying the Conditional Text tags ( with different colors and markers for each)seems to make it crash (i.e. almost duplicatable unlike the "normal" 3-4 crashes I experience on a daily basis the last month that are just random). Sidenote: I was very happy to see that they are going to fix the book printing crash...
    Cross reference markers are involved in these conditional sections, and I have my suspicions that they are a root culprit of my other crash problems, but then FM crashed when applying conditional text to a section that *didn't* have a x-ref, so I don't know what to think.
    I need to get this out by Monday. So my question is this, if I need 4 tables in a page (one for each version) am I better off just making 4 copies of the book and compiling that way? I sold the client on FM mostly because of the ability to compile multiple docs from one base book..so I really hate to have 4 copies when I give her the source. I know you can highlight individual rows in a table for a version (so I could make one really big table for 3 of the versions and just choose different rows), but this is a thing that seems almost certain to make it crash as well.  And the master tables have an additional column as well as a row so I would still need 2 tables per doc if I could get the conditionals to quit crashing. Is there some better way to "design" this that an experienced FMer could suggest? Some custom utility that works?
    Just in case someone asks this:
    System Config
    FM 11
    new install in August, not upgraded
    Files are all new and native to FM11
    Windows 7-64 bit
    20 gig of memory
    2 TB drive - local C:/
    Thanks for any suggestions on this.

    I think you picked the wrong thread - this one deals with importing or linking FM content into RoboHelp with the TCS.
    I haven't heard of anybody talking about conditional text crashing their FM11 - only issues with Track Changes and Conditions. Have you been reporting these crashes to Adobe Support? Have you submitted your crash logs? Can you reproduce the crashing with a sample book or is it only with this project? Have you tried MIF-washing your content?

  • A question about conditional if

    Hi guys
    I have a function that checks if something is happening before keep on going...
    Now, my question is, if I want it to check 3 conditions, instead of one only, how do I have to code it?
    Here is what I have:
    function hRelease(event:MouseEvent):void {
        var item5:MovieClip=letritaH(event.target);
        item5.stopDrag();      
        if (targeth.hitTestPoint(item5.x,item5.y)) {
            item5.x=targeth.x;
            item5.y=targeth.y;
            myTween.stop();
            addChild (flecha2);
            var t1:Timer=new Timer(1000,1);
            t1.addEventListener(TimerEvent.TIMER,removeFl);
            t1.start();
            function removeFl(e:TimerEvent):void{
            if (flecha2.parent) {
                flecha2.parent.removeChild(flecha2);}
        } else {
           item5.x=276;
           item5.y=(stage.stageHeight - 100);
    and what I want to do is: before the "myTween.stop();" I want it to check if i.x=273, letrao.x=447, and letral.x=575,50
    Thanks once again for all your help

    To check all three in one conditional you would use:
       if(i.x == 273 && letrao.x == 447 && letral.x == 575){
    Two other things...
    1) you should not nest named functions within other functions
    2) Within that function that you are nesting, you are testing if an object has a parent using...
           if (flecha2.parent) {
    IF fletcha2 is an object in the timeline such that you can target it that way, that timeline is the parent, so there is no need to test for its parent, nor do you need to target its parent to remove it.  YOu can just target fletcha2 directly to test for its existence and to remove it.

  • A question about Condition#await(long, timeunit)

    Hello, all:
    I am testing Condition#await(long, Timeunit).
    In my testing code there are two threads. Thread#1 acquires the lock first, releases it by calling condtion.await(50, TimeUnit.MILLISECONDS), and print sth.
    Thread#2 acquires the lock as soon as Thread#1 release it, but in its run(), it sleeps for 2000 millsec, during which time Thread#1's waiting should have expired and the code should have proceeded. Nevertheless, Thread#1 still suspend till Thread#2 run to its completion.
    My explaination is that the fact that Thread#1's waiting expired only means now it's mode switch to runnable, still it can't run until it re-acuquire the lock.
    Am I right?
    Thanks for your input
    The code is as below
    public class SyncTest {
         private Lock lock = new ReentrantLock();
         private Condition cond = lock.newCondition();
          class Task1 implements Runnable{
              public void run(){
                   if(lock.tryLock()){
                        try{
                             Thread.sleep(500);
                             cond.await(50,TimeUnit.MILLISECONDS);
                             System.out.println("Task1.");
                        } catch (InterruptedException e) {
                             e.printStackTrace();
                        finally{
                             lock.unlock();
          class Task2 implements Runnable{
              public void run(){
                   boolean locked = false;
                   try {
                        locked = lock.tryLock(510, TimeUnit.MILLISECONDS);
                   } catch (InterruptedException e) {
                        e.printStackTrace();
                   if(locked){
                        try{
                             Thread.sleep(2000);
                             System.out.println("Task2.");
                             cond.signalAll();
                        } catch (InterruptedException e) {
                             e.printStackTrace();
                        finally{
                             lock.unlock();
         public static void main(String[] args){
              SyncTest st = new SyncTest();
              new Thread(st.new Task1()).start();
              new Thread(st.new Task2()).start();
    }

    Johnny_hunter wrote:
    My explaination is that the fact that Thread#1's waiting expired only means now it's mode switch to runnable, still it can't run until it re-acuquire the lock.
    Am I right?yes, you are correct.

  • Question for condition type

    I have a condition type that doesn't have an access sequense.
    The condition type is both header and item condition and I allow mannual changes.
    Though when I use it, I have the following problem.
    I want the user to enter manually the condtion type in header. There are case though where for a specific line the condition type should be changed. At that point I am not able to change the amount of the condition type since it is only in display mode.

    Dear Stilianos,
    As per my knowledge, you cant have a condition type for header as well as for item. In the sense you can make it so but, as you know header condition would be distributed proportionately at item level. Moreover, you wont be able to change the same at item level.
    As already told by our friend you can either have additional manual condition type for such cases or you can enter the same condition type for that specific item so that earlier price would be inactive.
    > For a specific reason the last item of the sales order that has a discount of 20% due to the condtion type set at header level, I want to make it 30%
    In this case, you can enter the same condition type with new value i.e. 30% for that specific item so that earlier discount i.e. 20% would be inactive.
    Or enter additional new manual condition type with the variation i.e. 10%
    Hope you get some inputs
    regards,
    Sagar

  • Question on conditional formatting

    HI
    I have a chart which is aggregated at year level and could be drilled down to day level, I have to specify a condition that the bars have to change color when the day level value > X. If i use conditional formatting at day level, and say change color when value >x, the year level also chart changes color as its the sum of various day values.
    My requirement is in same chart i want to change the color if the value is > X at year level and when they drill down, has to change at certain value in quater level, at certain value of month... certain value at week level... and certain vale at day level.
    Is this possible... pls advise! its urgent!

    regarding your conditional item display and our built-in dml process, it does appear that things behave the way you're saying they do. i don't think that's expected functionality (and so i'll log it if needs be), but here are some workarounds for now:
    1) consider moving your display condition to the Read Only section of your item definition screen (using the opposite of your original condition, of course). that way the lost_update value will still show on your form, but only EMILY will be able to update it.
    2) consider using two forms (or two conditionally displayed form regions on the same page): one that shows the field and one that doesn't.
    3) manually coding the page (using your own dml processes instead of ours)
    regarding your first issue: if you just want to do things behind-the-scenes, you could simply put an after_submit computation on your page that stripped out the non-numeric characters from your field so users wouldn't have to worry so much about that formatting. i'm pretty sure you could best handle your request, though, by putting a format mask into the "Format Mask" field that's on the item definition
    screen for your numeric item. if you click the flashlight icon next to that field, you'll see what i mean. if you wanted to get extra user-friendly, you'd could consider throwing in validations to check for the particular formatting in which you're interested. the trade offs are pretty obvious, so the choices are really yours.
    hope this helps,
    raj

  • I have a question about Condition wanrranty for my ipad mini

    hi guys
    I have a ipad mini. Its version is 16Gb and only Wifi. SR: DQ*******193 Estimated Expiration Date: 05 May 2014
    Because I have used a protective cover for my ipad, it was scratched. The scratch is very tiny. it's about 2-3mm. Please see my picture.
    If my ipad has a problem, will it has full warranty?
    and what is the email support about warranty of apple in US? I dont know it.
    Thank for reading

    Do you know email support about warranty of apple in US?

  • Conditional creation of accounts in a resource - required field not working

    Hi,
    We want to conditionally create account objects in a resource, based upon whether or not the users account has a non-empty value for a particular atttribute.
    To me this seems to be what the 'required' attribute on a field is for, in theory I should be able to tag a field as required, and then if an account dosn't have a value for the attribute, it won't be created on the resource.
    The Help, from IDM6.0, says the following:
    Required -- If this attribute is required to create an account on the resource,
    select the option. This selection applies only when creating accounts.
    When I try to do this though, it fails, it goes ahead and creates the account within the resource anyway.
    So what did I do wrong, or am I misunderstanding the meaning of this.
    To test this, I created 2 XML Resources, Res1, and Res2.
    I specified that Res1 had accountId, and email as attributes.
    I specified that Res2 had accountId, and email as attributes, but ticked email as required.
    I made accountId the idntity template in both cases.
    I then created 2 test accounts test1, and test2, but only gave an email address to test1, but assigned both resources to both accounts.
    Both resource xml files had both users listed.
    For those who care more, the reason we want to do this is that we are running an LDAP with a sendmail tree, and want to populate this via IDM, all our users have email accounts, but not all have email aliases. Therefore, we only need some of the users to have entries that look like this.
    sendmailMTAKey=fred.bloggs, ou=sendmail, o=anu.edu.au
    sendmailMTAHost=anu.edu.au
    sendmailMTAAliasValue=u1234567
    sendmailMTAKey=fred.bloggs
    sendmailMTAAliasGrouping=aliases
    objectClass=sendmailMTA
    objectClass=sendmailMTAAlias
    objectClass=sendmailMTAAliasObject
    objectClass=top
    So I guess the question is really 2 things, what am I doing wrong with conditional account creation? Is this the right way to create these entries in the LDAP sendmail tree?

    Hi again,
    For those who care, I've got a resolution to the specific problem I mentioned in the above post, even if no answer to the general question of conditionally adding accounts on resources.
    In this specific case, I had been given a poor description of the requirements of the sendmail schema. It turned out on closer investigation that a single ldap record could hold all the information needed. It seems the sendmai schema had been implemented inefficiently locally, before we looked to run it through IDM.

  • Conditional display of list box in form (depends on other report column)

    Hello,
    i have one question regarding conditional display in forms.
    I have a tabular form where only one column ("flag") is updateable, all other columns are visible only.
    I changed the column "flag" from "standard report column" to "Select list (static lov)", which has the values "yes" and "no".
    This works fine. But in the running form i want to display the list box only if the column "status" = 'ERROR'.
    The column "status" can have the values 'ERROR' and 'OK'.
    When one record has "status" = 'OK', the column "flag" should not display the list box (only empty column row),
    when one record has "status" = 'ERROR" the column "flag" should display the list box.
    The idea behind is that if a record has "status" = 'ERROR' i have the possibility to confirm that "error" and update the column "flag" with "YES". This should only be possible for errors.
    This is my main problem.
    I tried with conditional display, but this hides or shows the column for the whole report/form, not on record level...
    The second problem then is, that if the column "flag" is changed to "YES" in case of column "status" = 'ERROR', then it should not be possible to change it again to 'NO". At the beginning it is 'NO', but once changed to 'YES' it should not be changeable any more.
    Is this possible?
    Thank you in advance,
    Matthias

    Hello Mike
    your solution sounds good, but unfortunately it is not working.
    None of my 2 columns are displayed, although i tried it as you wrote and the conditions should match...
    But i am no sure if this can work. If so, the 2 columns must fuse to 1 column:
    ID STATUS FLAG
    1 ERROR yes/no => comes from column1
    2 OK (null => comes from column2
    so "FLAG" must display column1 and column2 in one column. is that possible?
    regards,
    Matthias

  • Displaying conditional gif in report

    for a column in a report, is it possible to display a picture dependent on the column value ( i.e. checkmark for yes values)

    this is a pretty easy one to accomplish using straight sql, actually. you'd simply decode your column in question and conditionally select the image link out based on your decoded value. for example, if our table was Foo and our column in question was Col_1. you could write your query for that region like this...
    select decode(f.Col_1,'Yes','<IMG SRC="/i/my_checkmark.gif">',f.Col_1) my_column_alias
    from foo;
    put into plain english, this query selects all values of Col_1 from the foo table. as it renders the results, it checks the values of Col_1. if that value is a 'Yes' it then returns the HTML to display your checkmark gif. if the value is something other than a 'Yes', the query returns that value.
    hope this helps,
    raj

  • Is there any power pivot feature similar to" conditional block " property in cognos reports?

    I have a report with multiple power pivot charts. My requirement is to create a prompt which prompts the user with the list of charts and based on his selection , one of the charts will be displayed at a time. ie, user will have a choice for display
    of the chart. and these charts should have a common filter. I am using excel 2013 and SSAS tabular model.
    Could anyone please help me on this
    Thanks in advance

    Hi BLtechie, 
    If you are ok with using VBA (precluding the workbook from functioning correctly within SharePoint in an Excel Web Access web part) then you should be able to adapt the solution here: 
    http://www.mrexcel.com/forum/excel-questions/525495-conditionally-show-hide-charts.html
    Alternatively, if you have a tabular model and access to SharePoint 2013 with Reporting Services Integrated mode running SQL 2012 SP1 CU 4 or higher you could instead create a power view report that used the pinned filters property and simply presented
    each of the pivot charts on named sheets (forming your user's selection choice). 
    http://blogs.msdn.com/b/riccardomuti/archive/2013/05/24/pinning-filters-in-power-view.aspx
    Hope this helps, 
    Mike

  • Updating a text field in  aform based on conditions

    Hi ,
    We are developing a custom form which has a database datablocks.
    This form is a master detail form . It has a field called "status" whose initial values is 'Draft' and this field is present in the master part of the form.
    The Logic for "Draft" is written in Pre-Insert trigger of the header block.
    Question
    If condition "A" is met and "B" is met , status should be set as a value called as 'Submitted';
    If condition a is not met and B is met , status should be set as a value called as 'Created';
    We are doing this in the post-update trigger at block level. But the changes are not taking effect.
    Please let us know if this is the correct approach to handle the column. Note that the column "Status" is a database column.
    Thanks and Regards
    SR

    The above is not working
    Let me restate the problem statement
    Hi ,
    We are developing a custom form which has a database datablocks. This form is a master detail form . It has a field called "status" whose initial values is 'Draft' and this field is present in the master part of the form.
    The Logic for "Draft" is written in Pre-Insert trigger of the header block.
    Question
    The record is created with a status of Draft initially.
    Query and requery back and if condition is met , the value of status should be updated as follows......Condition A and B involves going an chekcing in some other table and based on that , we set the status column....
    If condition "A" is met and "B" is not met , status should be set as a value called as 'Submitted';
    If condition "A" is not met and B is met , status should be set as a value called as 'Created';
    We are doing this in the post-update trigger at block level. But the changes are not taking effect.
    Please let us know if this is the correct approach to handle the column. Note that the column "Status" is a database column.
    Also tried the following
    1) When validate item at block level by capturing the item in a parameter and then assigning the parameter to the status column in pre-update column . This is not working
    Thanks and Regards
    SR
    ----------------------------------

  • Duplicate Condition Record Number !

    Hi Experts,
    I have a question on condition record number:
    I have a Material SH00001 in  more than one Sales Orgs. Example: MTD and NTD.
    1. Is it possible SAP generates the same condition record number (field- KNUMH) for both sales organisation when I created two records separately at VK11 for each sales orgs for price?
    2. Is it possible SAP automatically generates two condition record numbers when I create a ccondition record at  VK11 (for price )
    for a material SH00001 for a sales org MTD for two unit of measures. (e.g PC and KG)
    3. Is it possible SAP automatically generates two condition record numbers when I change a ccondition record at  VK12 (for price )for a material SH00001 for a sales org MTD from one unit of measure KG to PC??
    Thanks

    Hi
    For one condition record in VK11, system will create one number. And if your are creating new record with slight difference, new number will generate.
    Conclusion, no two condition records can have same number.
    Secondly, if you change record in VK12, record number will not change.

  • Puzzling condition type value

    I am puzzled by this scenario
    In the sales pricing procedure there is a condition type(for the sake of simplicity let's call it zabcd), this condition type has been assigned a routine in the column Alternative Condition base value (VOFM>Formulas>Condition base value)
    This condition type(via abap code/routine) is picking the value of a condition record of condition type zefgh. My head went spinning when this condition type (zefgh) was not even found in the pricing procedure.
    I was always under the impression that for a condition type's value to be picked up it necessarily had to exist in the pricing procedure.  Am I wrong somewhere? Please correct me.
    How can zabcd pick the value of condtion record of zefgh when zefgh is not at all present in the pricing procedure.I am puzzled by this scenario In the sales pricing procedure there is a condition type(for the sake of simplicity lets call it zabcd), this condition type has been assigned a routine in the column
    Alternative Condition base value (VOFM>Formulas>Condition base value)
    My question:
    This condition type zabcd(via abap code/routine) is picking the value of a condition record of condition type zefgh. My head went spinning when this condition type (zefgh) was not even found in the pricing procedure. I was always under the impression that for a condition type's value to be picked up  it necessarily had to exist in the pricing procedure.
    Am I wrong somewhere? Please correct me.
    How can zabcd pick the value of condtion record of zefgh when zefgh is not at all present in the pricing procedure.
    Thanks,

    With condition supplement, you can have values of condition types populating in your sales order, for cond types NOT in your pricing procedure.
    The business example for this could be -
    With PR00 (price) you shall always give KA00; thus in pricing procedure your give PR00 & NOT KA00, but you see the value of KA00 too.
    To not include KA00 everytime in the pricing procedure concept of condition supplement is used.
    KA00 is included in the pricing procedure assigned to PR00. So check in your condition type V/06, field "Pricing procedure". Then go to V/08 and go into that pricing procedure and search for ZEFG cond type.

  • Conditional probes

    Hello everyone,
    I have a question regarding conditional probes. What conditions allow you to have a conditional probe. I have seen in some of my subvis that the condtional probes are not always available. See attached picture. I can have conditional probe on the output of one add function, but not the other. Why is this?
    thanks
    Attachments:
    conditional probe.PNG ‏204 KB

    Under "Custom Probe" you can normally see the list of the last Customized Probes you used. LabVIEW has a list of already defined Conditional Probes which are already programmed.
    You should go to "Custom Probe -> New... -> Create from existing Probe and choose the Probe (f.e. Conditional Double Probe.vi) you want to use. After choosing, the probe will appear directly by "Custom Probe".
    Regards
    Ken

Maybe you are looking for

  • Mac Help no longer searches

    Mac Help, in all apps that I've tried is no longer searchable. When I open Mac Help in say iTunes and search for the term Cover Flow the Help app doesn't find anything and the search icon just spins. When I click to stop the search the icon continues

  • Document Splitting not happening

    Dear Friends, I have done the configuration required for Document Spitting. When i post a document with expenses and tax from two cost centres which has two different profit centres then according to principle of document spliting the tax amount for

  • Wait for end of DVD chapter

    Hi, How can I play a DVD chapter but only until it ends and then jump back to a frame in my Director movie? I know that I can use: member("DVD").play([#title:1, #chapter:1]) Will that pause at the end of chapter 1? Does anything special have to be en

  • OT (a little): colors in ff vs safari

    when i view the same jpg in ff vs. safari, the colors look dramatically different. ff is more muted and less contrasty. anyone else notice this?

  • Size restrictions on arrays and vectors

    Hi all!!! I want to know whether there is any restriction on maximum size of array and vectors. If I have thousands of records to be displayed on browser through JSP, can I initialise the arrays/vectors with that no. Whether it will have adverse effe