Set interface ristriction

Hi all
     We say that "Set is a collection that can not contain duplicate elements". But how can we make just an interface to specify the behavior of its methods.
I mean, I can create a class that implements Set and I brake this property. (or this property (can not contain duplicate elements) is just an agreement between Java programmers.
Thanks for all

Hi,
...just an agreement between Java programmers...This is all that any API is anyway. Just an agreement. Any programmer is free to break any agreement like this at any time. If you really want something to rigidly adhere to some specification then you're going to have to write code to enforce it.
In this case, you could write a DefinitelyASet class, which would implement Set by wrapping another Set and checking absolutely everything that the other Set returns. If your code then only used instances of DefinitelyASet you can be more sure of what you are using.
In general you have to assume that code implements what it says it does. Programming would be impossible otherwise.
Ol.

Similar Messages

  • Error while inserting record in Key-Flex Values Set interface

    Guys
    on 11.5.10.2
    Actually the problem is being occurred while inserting value in Job Flex Field Value set, we have created two segment for job key flex filed, No and name, it was working fine, but since we have uploaded bulk data via api "fnd_flex_values_pkg.INSERT_ROW" which was around 100 off record, but after completion this task system is not taking new value by Values set interface, and show message "APPS-FND-01206: You entered duplicate values or sequence of value that must be unique for every record",
    However, we insert the job number through api, it is inserting without error while
    Interface is not taking value and raise duplicate message error,
    which is APPS-FND-01206
    Please Advice.

    Thanks for supporting dunacan
    I have mentioned both of segment detail . please advice,
    1.One is Job No segment
    Segment1 number 10
    Required Check Yes
    Value set Info JOB_NO
    List Type : List of Values
    Security Type : No Security
    Format Validation : select number 7,0 and check on number only (0-9)
    Validation Type Independent
    2.One is Job Name segment
    Segment2 number 20
    Required Check Yes
    Value set Info JOB_NAME
    List Type : List of Values
    Security Type : No Security
    Format Validation : select CHAR 60 Validation Type Independent
    It was strange that how could it possible duplication value without having database,i am unable to find this issued,
    Edited by: oracle0282 on Jan 17, 2011 3:32 AM

  • SIOCSIFFLAGS: Unknown error 132, could not set interface eth1 UP. Help

    After lots of trouble getting my wireless card working and installing the ipw2200-fw drivers to get it working i have encountered an other problem.
    I set up a netcfg profile called mynetwork but now whenever i try to connect using netcfg mynetork, i get:
    SIOCSIFFLAGS: Unknown error 132
    Could not set interface 'eth1' UP
    Being a noob I have no clue how to fix this. Anyone know how to make it work?

    See this bug report for some clues:
    https://bugs.archlinux.org/task/19507
    Also, duck duck go/google is your friend: please search before posting...

  • Implementing Set Interface

    i have to implement the set interface without using any features, other thaset itself, from java.util. i have to create my own data structure(s) to implement it. any suggestions on which way to go.
    thanks in advance.

    Hi,
    Use java.util.Vector class as your data structure. A set is just a list that doesn't allow duplicates. You can use the Vector method: contains to figure out if it already exists or not.
    import java.util.*;
    public class MySet
      Vector data = new Vector();
      public Object get( int i )
        if( i >= 0 && i < data.size() )
          return( data.elementAt( i ) );
        return( null );
      public boolean add( Object ob )
        if( !data.contains( ob ) )
          data.add( ob );
          return( true );
        return( false );
    }Regards,
    Manfred.

  • Implement Set Interface

    I have been give the task of "implementing the Set interface" in Java for a project. I believe what needs to be done is overwriting the methods I need from the Set interface, but I'm not exactly sure if this is correct, or how I would start to do this. Could anyone point me in the right direction? TIA
    Edited by: prem1era on Jul 8, 2009 7:19 AM
    Edited by: prem1era on Jul 8, 2009 7:25 AM

    Ok, now that I understand more what I am doing, I have another question and maybe I should post a new topic for it, but I'll see if I can get any responses here first. Now that I am implementing Set correctly my goal is to use Set to store an object in a file instead of in memory. So this is what I have so far. For the add method, I am planning on using the object as an argument. I want to check to make sure that the object being added is not already included in that file. So within the add method I am going to read through the file, look for that object and if it is not present I am going to add it. Else, I will be returning false. Does this sound correct?
    import java.io.FileWriter;
    import java.io.PrintWriter;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.Set;
    public class RegistrySet implements Set {
         private String registryFile;
         private PrintWriter pw;
         public RegistrySet(String registryFile){
              this.registryFile = registryFile;
         public boolean add(Object o) {
              return false;
         }

  • Setting interface properties in zone definition?

    Hello,
    is there any way to set interface properties in a zone definition?
    In my case I want to set the zone's interface in the deprecated state.
    While I can do this from the global zone (ifconfig ce0:3 deprecated) without problems, I would like to ensure that the interface is in that state if the zone boots up.
    Googling around didn't show any usable results.
    Thanks,
    Joern

    I opened a case with sun and got the following workaround:
    It is not possible to set interface properties within the zone and it isn't possible to set any properties in the zonedefinition.
    It is possible however to make a smf service that has dependencies to the zone service.
    In the method script you could manually set the desired interface in the deprecated state.
    Regards,
    Joern

  • List or Set interface

    if any List or Set interface not allows null values....?

    Where exactly are you trying to stick the NULL?
    I would have to check but I am fairly certain most of the collections will except a NULL as a data member, some of them will automatically skip over the NULL however, and others will combine all your NULLs into one single NULL.
    I am unsure why you would want to put a NULL in a collection anyways.
    Why don't you try giving more information so we can know exactly what you are after here.
    JSG
    EDIT: and this is what i get for starting to reply, becoming engaged in conversation with a co-worker, and then continueing my reply after some time has passed.
    Edited by: JustSomeGuy on Oct 1, 2008 6:24 AM

  • Setting interface name dynamically from client for SOAP Adapter...

    Hi,
    does anyone have experience in setting the sender interface name in the HTTP-SOAP request dynamically? I have followed the instructions in "How To Use the XI 3.0 SOAP Adapter" on page 17 (see also SAP Note 856597) which say:
    "If you select Use Encoded Headers and Use Query String,
    [...]The sender SOAP adapter creates the XI message header according to the
    information provided in the query string. [...] In the sender SOAP adapter, you can use only some of the parameters, but the first
    parameter must always be the version. For example, you send from the Web service client to the following URL: http://<host>:<j2ee-port>/XISOAPAdapter/MessageServlet?channel=<party>:<service>:<channel>&version=3.0&Interface=http%3A
    %2F%2Fsap.com%2Ftest%5ETest
    This will overwrite the default interface and namespace of the sender channel."
    This is exactly what I need! However, what I actually get as a response following this description is a SOAP:Fault with a java.lang.StringIndexOutOfBoundsException: String index out of range: -1.
    Has anyone got this to work properly?
    Thanks in advance.

    Thank you for your input. I am using the following format for the call (with "x" standing for one letter each):
    http://xix.xxx.xx.xxx:5xx00/XISOAPAdapter/MessageServlet?channel=:xx_xxx_xxx_xxxx:xx_xxx_x_SOAP_S&version=3.0&Interface=http%3A%2F%2Fxxxxxxxx.xx%2Fxxxxxx%2Fxxxxxxxxxxxxxxxxxxxxxxxx%5Exxxxxxxxxxxxxxxxxxxxxx
    Anything wrong with that? With unchecked "Use Encoded Headers" and "Use Query String" it works fine (default interface) but as soon as I set these flags I get the SOAP-Fault response.
    We are on XI 3.0 SPS18.

  • Missing key in OCR, can't set interfaces with oifcfg

    (also posted in Metalink Unix Installation/OS: RDBMS Technical Forum)
    I have installed clusterware on a 2 node cluster running RedHat 5.
    OCR and voting disks are on raw devices, but everthing else is shared using GFS.
    I can start both nodes but I can't seem to add interfaces through oifcfg.
    In fact the SYSTEM.css.interfaces key does not exist in my OCR.
    I applied fixs in Oracle MetaLink Note #414163.1, but when I try to do oifcfg to set my interfaces
    I get a "registry key does not exist" error.
    [root@ora2 bin]# ./oifcfg setif -global eth0/128.159.132.0:public eth2/172.16.5.0:cluster_interconnect
    PROC-4: The cluster registry key to be operated on does not exist.
    PRIF-11: cluster registry error
    [root@ora2 bin]# ./oifcfg iflist
    eth2 172.16.5.0
    eth0 128.159.132.0
    Checking the oifcfg.log I could see it was trying to update key SYSTEM.css.interfaces
    2008-02-05 17:36:12.504: [ default][2897118400]OCR api procr_open_key failed for key SYSTEM.css.interfaces
    I did a dump of my OCR and confirmed that this key does not exist.
    I even tried regenerating my OCR with ./clscfg -install. The new one is exactly the same as the old
    just different time stamps.
    So now I am stuck. vipca won't run until the interfaces are defined and oifcfg won't them
    because the OCR is missing a key. Does anyone know how to create this key in the OCR?
    Does it need to be there?
    I have thought reinstalling from scratch but I do not think anything will change as the only
    thing that creates the OCR is clscfg -install in the rootconfig script.

    in the $CRS_HOME/install/rootconfig, some people comment out a section that Fails. Specifically this section.
    if $CH/bin/ocrconfig -upgrade $CRS_ORACLE_OWNER $CRS_DBA_GROUP;
    then
    $ECHO "Oracle Cluster Registry configuration upgraded successfully"
    else
    $ECHO "Failed to upgrade Oracle Cluster Registry configuration"
    exit 1
    fi
    DO NOT COMMENT IT OUT.
    $CH/bin/ocrconfig -upgrade $CRS_ORACLE_OWNER $CRS_DBA_GROUP is what writes these keys. People get the failed error when it fails the root.sh and decide to comment it out. Everything looks like it completes, but thiis key is not there. Instead, get the patch below which replaces the clsfmt.bin on all nodes. Uncomment the code in your rootconfig and that should fix you up. Good Luck!
    PATCH 4679769 has the fixed clsfmt.bin
    Also, check the permissions on your disks! Sometimes that causes it to fail as well.
    Also, if on RHEL5, you will need to do the unset on LD_ASSUME_KERNEL in the vipca and srvctl files under $CRS_HOME/bin (which is fixed in 10.2.0.4 so no uncommenting needed)
    Edited by: troach on Oct 6, 2009 6:49 PM

  • EEM Script to set interface passive

    Hello All,
    I am running OSPF in my domain. I want to put an interface in the passive state after a flap or multiple flaps. For example, if I get a log that states:
    2012 Sep  1 00:08:47 %ETHPORT-5-IF_DOWN_LINK_FAILURE: Interface Ethernet1/44 is down (Link failure)
    to be able to perform:
    enable
    conf t
    interface Ethernet1/44
    ip ospf passive-interface
    end wr
    FYI this concerns a Nexus 3K running NX-OS 5.0(3)U3(2).
    Thanks for your help.

    I haven't used EEM on the 3K yet.  However, I think it has similar support to the 7K, so this should work:
    event manager applet ethport override __ethpm_link_flap
       event policy-default count 2 time 1000
       action 1 cli conf t
       action 2 cli int $interface
       action 3 cli ip ospf passive-interface
       action 4 cli end
    You can't use syslog here since you can't parse the message to get the interface.  While you could using Python or Tcl to do this, executing scripts out of EEM applets is not officially supported.  So this applet should set an interface that flaps twice within 1000 seconds to be an OSPF passive interface.

  • Remote XUL no longer available in Firefox to set interface speed to broadband by internet provider

    We had some problems with thunderbird lately and had to redo some settings. When resetting my email account on the server to 'Interface speed' from Simple (Dialup) to Advanced(Broadband) it comes up with the message: REMOTE XUL - this page uses an unsupported technology that is no longer available by default in Firefox. I have version 7.0.1

    Support for remote XUL was dropped a while back because it was a constant source of security concerns. If you find any website or application still using it you should report it as a bug to its developers.
    There is a [https://addons.mozilla.org/firefox/addon/remote-xul-manager/ Remote XUL Manager extension] which can be used to allow it to trusted sites on an individual basis if you really need it, but the only cases where this should legitimately come up are XUL code examples and some enterprise's internal software systems.

  • JList implementing Set interface

    It seems that the JList's DefaultListModel implement a Vector as it's
    underlying data structure. Any ideas on how to have the JList implement
    a TreeSet as it's underlying data structure - I don't want duplicates and
    also would like to have it in sorted order - thanks.

    Here are the main methods that you need to implment. They are the bulk of the work. All the others can be created using these.
    boolean contains(Object o) Start at the head of your list and compare (using equals()) to each
         element in the list.
    add(Object o) Simple, first call contains.  If contains returns true, return false.  If contains returns 
         true add the element to the list (anywhere)
    boolean remove(Object o) same as contains() except if you find the element, remove it and return   
         true.
    int size() You can do this two ways.  Either keep a int in the class that you increment on an add  
         and decrement on a delete, or count all the elements each time it is called.
    Iterator iterator() A little tricky.  We'll get back to this one.
    Object[] toArray() Create an new Object array the size of your set.  go through each element and
         put it into the arrayThis should get you started. Write the methods here, (except Iterator) and post your code.

  • Set interface

    Hello,
    Does anyone know of a method to retrieve one particular object out of a Set?
    I can't seem to find any in the specification, but i guess there should be a possibility to do that?
    thanks

    The reason there is no API for retrieving one particular object from a Set, is that there is no way to reference the object, i.e. you can't say "give me the n'th object" (because a Set is unordered) and you can't say "give me the object related to this other object" (because a Set does not contain a mapping of one object to another, that's what a Map is for). You can only reference a particular object if you already hold a reference to that object, in which case you don't need to retrieve it from the Set anyway.
    If you want to retrieve just one ("random") object, use the iterator without the while loop.
    Useful analogy (maybe?): imagine a cookie-jar. There is no way to retrieve a specific cookie unless you already have that cookie in your hand. However, you can get one or more "random" cookies from the jar by tilting it and shaking gently till one or more slide out.

  • Why doesn't the set interface define a get method?

    I think it'd be nice to have.

    Subcool wrote:
    I think it'd be nice to have.Usually this means Set has been confused for a Map.
    The elements for a Set and the keys for a Map are assumed to be immutable (not just in Java!), so mutating them is not an option.
    What you want to do is have the immutable keys in one class which forms the key of the Map and the mutable values in another class which form the values. You can place these in a Map as a key/value pair.
    To change the values, create a new key object to lookup/get() the value object in the Map.

  • Open DeviceNet interface error when TestStand call VIs of NI PCI-8532

    Hello,
    We use NI PCI-8532 was used as DeviceNet master to do functionality test with a slave (AC Drive).
    But when open DeviceNet interface, it happen the error.
    We can't find the solution and hope to find help from you.
    The basic sequence in TestStand is:
    1). Call "Open DeviceNet Interface.vi" to open interface and creat interface object.
         Interface(master) setting: interface name=dnet0, MAC ID=0, baudrate=125000bps
    2). Call "Open DeviceNet IO.vi" to creat DeviceNet IO object.
         Device(slave) setting: MAC ID=63
    3). Call "Operate DeviceNet Interface.vi" and operation code=start
    4). Call "Wait For State.vi"
    5). Call "Read DeviceNet IO.vi" to read data from IO object
    6). Call "Close Object.vi" to close IO object handle
    7). Call "Close Object.vi" to close interface object handle
    Remark, these DeviceNet VIs locates at "C:\Program Files\National Instruments\LabVIEW 2012\vi.lib\DeviceNet\VIAPI".
    First time to run sequece in TestStand, it can pass to run step 1) to open DeviceNet interface.
    But once there is some error with these steps, and it will happen "Open DeviceNet Interface" error (error code=0xBFF62006) when run these steps again.
    Then even use LabVIEW DeviceNet example to test, and it happen the same error except restart computer.
    The DeviceNet example locates at "C:\Program Files\National Instruments\LabVIEW 2012\examples\NI-Industrial Communications for DeviceNet\Basic Examples\PXI & PCI\MixedCommunication.vi".
    Some information more:
    PC operate system: Windows XP SP3
    LabVIEW version: 2012 SP1
    TestStand version: 2012 SP1
    PCI 8532 driver version: 2.3.0
    Other installed PCI board: PCI 8531 CANOpen

    The following errors may be resolved by resetting the CAN, DeviceNET or LIN device:
    Error -1074388986 occurred at ...
    NI-CAN:  (Hex 0xBFF62006) The object is already open in another application.  Solutions: Ensure that only one application at a time uses an object , and that you close all objects prior to exiting your application (don't use LabVIEW toolbar's Abort button).
    Error -1074388969 occurred at ...
    NI-CAN: (Hex 0xBFF62017) This attribute's value must be provided prior to the Open. Solutions: Set the attribute using the Config function before the Open, and do not set the attribute at any later time; Do not configure multiple CAN Objects for the same ID.
    SO,you should reset the DeviceNet.
    And another similar issue can explain some points of your problem  http://digital.ni.com/public.nsf/allkb/7D9383E9BEAD0B21862571640002F687?OpenDocument

Maybe you are looking for