COmparing object using console...

Hi ,
I want to compare the objects in between the two db schemas. I am using Oracle enterprise console. Here when i am click the compare objects for the tables, i got the below error.
Cannot perform operation for product"Oracle Change Manager" because another operation is already in progress for the product,or a previous ooperation on the product failed..
I am getting the above errr. I need to compare the objects now. So how can remove the old operation on the product failes ,
I am fist time using this console in comparing schems.
My oracle client is 10.2 cleint ..
please help me out in comparing the objects ...

hi:
Whether did you understand your stub that input by IDL compiler?
Because the stub extends the org.omg.CORBA.portable.ObjectImpl and provide method _orb() to get current local ORB reference. you do so and repeat your steps in your text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • I can't seem to get individual elements when comparing 2 arrays using Compare-Object

    My backup software keeps track of servers with issues using a 30 day rolling log, which it emails to me once a week in CSV format. What I want to do is create a master list of servers, then compare that master list against the new weekly lists to identify
    servers that are not in the master list, and vice versa. That way I know what servers are new problem and which ones are pre-existing and which ones dropped off the master list. At the bottom is the entire code for the project. I know it's a bit much
    but I want to provide all the information, hopefully making it easier for you to help me :)
    Right now the part I am working on is in the Compare-NewAgainstMaster function, beginning on line 93. After putting one more (fake) server in the master file, the output I get looks like this
    Total entries (arrMasterServers): 245
    Total entries (arrNewServers): 244
    Comparing new against master
    There are 1 differences.
    InputObject SideIndicator
    @{Agent= Virtual Server in vCenterServer; Backupse... <=
    What I am trying to get is just the name of the server, which should be $arrDifferent[0] or possibly $arrDifferent.Client. Once I have the name(s) of the servers that are different, then I can do stuff with that. So either I am not accessing the array
    right, building the array right, or using Compare-Object correctly.
    Thank you!
    Sample opening lines from the report
    " CommCells > myComCellServer (Reports) >"
    " myComCellServer -"
    " 30 day SLA"
    CommCell Details
    " Client"," Agent"," Instance"," Backupset"," Subclient"," Reason"," Last Job Id"," Last Job End"," Last Job Status"
    " myServerA"," vCenterServer"," VMware"," defaultBackupSet"," default"," No Job within SLA Period"," 496223"," Nov 17, 2014"," Killed"
    " myServerB"," Oracle Database"," myDataBase"," default"," default"," No Job within SLA Period"," 0"," N/A"," N/A"
    Entire script
    # things to add
    # what date was server entered in list
    # how many days has server been on list
    # add temp.status = pre-existing, new, removed from list
    # copy sla_master before making changes. Copy to archive folder, automate rolling 90 days?
    ## 20150114 Created script ##
    #declare global variables
    $global:arrNewServers = @()
    $global:arrMasterServers = @()
    $global:countNewServers = 1
    function Get-NewServers
    Param($path)
    Write-Host "Since we're skipping the 1st 6 lines, create test to check for opening lines of report from CommVault."
    write-host "If not original report, break out of script"
    Write-Host ""
    #skip 5 to include headers, 6 for no headers
    (Get-Content -path $path | Select-Object -Skip 6) | Set-Content $path
    $sourceNewServers = get-content -path $path
    $global:countNewServers = 1
    foreach ($line in $sourceNewServers)
    #declare array to hold object temporarily
    $temp = @{}
    $tempLine = $line.Split(",")
    #get and assign values
    $temp.Client = $tempLine[0].Substring(2, $tempLine[0].Length-3)
    $temp.Agent = $tempLine[1].Substring(2, $tempLine[1].Length-3)
    $temp.Backupset = $tempLine[3].Substring(2, $tempLine[3].Length-3)
    $temp.Reason = $tempLine[5].Substring(2, $tempLine[5].Length-3)
    #write temp object to array
    $global:arrNewServers += New-Object -TypeName psobject -Property $temp
    #increment counter
    $global:countNewServers ++
    Write-Host ""
    $exportYN = Read-Host "Do you want to export new servers to new master list?"
    $exportYN = $exportYN.ToUpper()
    if ($exportYN -eq "Y")
    $exportPath = Read-Host "Enter full path to export to"
    Write-Host "Exporting to $($exportPath)"
    foreach ($server in $arrNewServers)
    $newtext = $Server.Client + ", " + $Server.Agent + ", " + $Server.Backupset + ", " + $Server.Reason
    Add-Content -Path $exportPath -Value $newtext
    function Get-MasterServers
    Param($path)
    $sourceMaster = get-content -path $path
    $global:countMasterServers = 1
    foreach ($line in $sourceMaster)
    #declare array to hold object temporarily
    $temp = @{}
    $tempLine = $line.Split(",")
    #get and assign values
    $temp.Client = $tempLine[0]
    $temp.Agent = $tempLine[1]
    $temp.Backupset = $tempLine[2]
    $temp.Reason = $tempLine[3]
    #write temp object to array
    $global:arrMasterServers += New-Object -TypeName psobject -Property $temp
    #increment counter
    $global:countMasterServers ++
    function Compare-NewAgainstMaster
    Write-Host "Total entries (arrMasterServers): $($countMasterServers)"
    Write-Host "Total entries (arrNewServers): $($countNewServers)"
    Write-Host "Comparing new against master"
    #Compare-Object $arrMasterServers $arrNewServers
    $arrDifferent = @(Compare-Object $arrMasterServers $arrNewServers)
    Write-Host "There are $($arrDifferent.Count) differences."
    foreach ($item in $arrDifferent)
    $item
    ## BEGIN CODE ##
    cls
    $getMasterServersYN = Read-Host "Do you want to get master servers?"
    $getMasterServersYN = $getMasterServersYN.ToUpper()
    if ($getMasterServersYN -eq "Y")
    $filePathMaster = Read-Host "Enter full path and file name to master server list"
    $temp = Test-Path $filePathMaster
    if ($temp -eq $false)
    Read-Host "File not found ($($filePathMaster)), press any key to exit script"
    exit
    Get-MasterServers -path $filePathMaster
    $getNewServersYN = Read-Host "Do you want to get new servers?"
    $getNewServersYN = $getNewServersYN.ToUpper()
    if ($getNewServersYN -eq "Y")
    $filePathNewServers = Read-Host "Enter full path and file name to new server list"
    $temp = Test-Path $filePathNewServers
    if ($temp -eq $false)
    Read-Host "File not found ($($filePath)), press any key to exit script"
    exit
    Get-NewServers -path $filePathNewServers
    #$global:arrNewServers | format-table client, agent, backupset, reason -AutoSize
    #Write-Host ""
    #Write-Host "Total entries (arrNewServers): $($countNewServers)"
    #Write-Host ""
    #$global:arrMasterServers | format-table client, agent, backupset, reason -AutoSize
    #Write-Host ""
    #Write-Host "Total entries (arrMasterServers): $($countMasterServers)"
    #Write-Host ""
    Compare-NewAgainstMaster

    do not do this:
    $arrDifferent = @(Compare-Object $arrMasterServers $arrNewServers)
    Try this:
    $arrDifferent = Compare-Object $arrMasterServers $arrNewServers -PassThru
    ¯\_(ツ)_/¯
    This is what made the difference. I guess you don't have to declare arrDifferent as an array, it is automatically created as an array when Compare-Object runs and fills it with the results of the compare operation. I'll look at that "pass thru" option
    in a little more detail. Thank you very much!
    Yes - this is the way PowerShell works.  You do not need to write so much code once you understand what PS can and is doing.
    ¯\_(ツ)_/¯

  • Sorting a vector of objects using attribute of object class as comparator

    i would like to sort a vector of objects using an attribute of object class as comparator. let me explain, i'm not sure to be clear.
    class MyObject{
    String name;
    int value1;
    int value2;
    int value3;
    i've got a Vector made of MyObject objects, and i would sort it, for instance, into ascending numerical order of the value1 attribute. Could someone help me please?
    KINSKI.

    Vector does not implement a sorted collection, so you can't use a Comparator. Why don't you use a TreeSet? Then you couldclass MyObject
      String name;
      int value1;
      int value2;
      int value3;
      // Override equals() in this class to match what our comparator does
      boolean equals (Object cand)
        // Verify comparability; this will also allow subclasses.
        if (cand !instanceof MyObject)
          throw new ClassCastException();
        return value1 = cand.value1;
      // Provide the comparator for this class. Make it static; instance not required
      static Comparator getComparator ()
        // Return this class's comparator
        return new MyClassComparator();
      // Define a comparator for this class
      private static class MyClassComparator implements Comparator
        compare (Object cand1, Object cand2)
          // Verify comparability; this will also allow subclasses.
          if ((cand1 !instanceof MyObject) || (cand2 !instanceof MyObject))
            throw new ClassCastException();
          // Compare. Less-than return -1
          if ((MyObject) cand1.value1 < (MyObject) cand2.value1))
            return -1;
          // Greater-than return 1
          else if ((MyObject) cand1.value1 > (MyObject) cand2.value1))
            return 1;
          // Equal-to return 0.
          else
            return 0;
    }then just pass MyObject.getComparator() (you don't need to create an instance) when you create the TreeSet.

  • Disconnect object using a script (not from FIM Management console)

    Hi,
    Is there any way to disconnect a connector from its connected Metaverse object using a PowerShell command or wathever?
    For the moment we use the Management Console to achieve this operation by clicking on "disconnect" to force the connector to become "disconnector". 
    Thanks for your help.

    Thank you for your reply,
    The deprovisioning process works fine and is not the purpose of what I want to achieve.
    What I want to do is to disconnect an Connector from a MV object to reconnect it to another MV object because the join rule isn't valid anymore.
    The case is as follow : 
    An Active Directory user is linked to an identity in our Identity Management System using a UserID which is mapped to employeeId attribute in AD user.
    If the employeeID in AD is modified (by another Management Agent for example), I want to connect the user, with the new employeeID, to the correct MV object and hence to the correct ID in our system.
    The main idea is to store some information from AD user such as UserPrincipaleName or sAMAccountName in the correct identity.
    Unfortunately, the join rule isn't evaluated for the "connected" Connectors but only for "disconnectors" (unless there is an option to re evaluate the join rules for all objects that I don't know). 
    So to connect the user to the correct MV object, I have to disconnect manually the Connector to make it disconnector and re-sync. The sync process connect automatically the user to the correct MV Object which provision attributes from AD user to the right
    ID and "delete" attributes from the former ID in our system.
    Thanks for your help.

  • Userdefined Sorting the objects using comparator

    Hi All,
    I want to display the objects in a userdefined order. I have placed the code snippet below. Kindly help me on this to resolve this issue.
    public class ApplicabilityObject1 implements Comparable{
         private String str;
         public ApplicabilityObject1(String str) {
              this.str = str;
         public boolean equals(Object obj) {
              return getStr().equals(((ApplicabilityObject1)obj).getStr());
         public String toString() {
              return str;
         public String getStr() {
              return str;
         public void setStr(String str) {
              this.str = str;
         public int compareTo(Object arg0) {
              final int equal = 0;
              final int before = -1;
              final int after= 1;
              int returnvalues  = 0;
              System.out.println(this);
                                    if ("Mexico"==((ApplicabilityObject1)arg0).getStr())
                   returnvalues = -1;
              else if (((ApplicabilityObject1)arg0).getStr()== "Canada")
                   returnvalues =  0;
              else if (((ApplicabilityObject1)arg0).getStr()== "USA")
                   returnvalues = 1;
              return returnvalues;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Collections;
    import java.util.Comparator;
    import java.util.List;
    /*import org.apache.commons.beanutils.BeanComparator;
    import org.apache.commons.collections.comparators.FixedOrderComparator;*/
    public class SortOrder {
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              APPComparator app1 = new APPComparator();
              ApplicabilityObject1 obj1 = new ApplicabilityObject1("Mexico");
              ApplicabilityObject1 obj2 = new ApplicabilityObject1("Canada");
              ApplicabilityObject1 obj3 = new ApplicabilityObject1("USA");
              ApplicabilityObject1 obj4 = new ApplicabilityObject1("Mexico");
              ApplicabilityObject1 obj5 = new ApplicabilityObject1("USA");
              ApplicabilityObject1 obj6 = new ApplicabilityObject1("USA");
              ApplicabilityObject1 obj7 = new ApplicabilityObject1("Mexico");
              ApplicabilityObject1 obj8 = new ApplicabilityObject1("Mexico");
              ApplicabilityObject1 obj9 = new ApplicabilityObject1("Canada");
              List list = new ArrayList();
              list.add(obj1);
              list.add(obj2);
              list.add(obj3);
              list.add(obj4);
              list.add(obj5);
              list.add(obj6);
              list.add(obj7);
              list.add(obj8);
              list.add(obj9);
              Collections.sort(list, app1);
              System.err.println(list);
              System.out.println(Integer.MAX_VALUE);
    class APPComparator implements Comparator
         ApplicabilityObject1 appO = new ApplicabilityObject1("USA");
         @Override
         public int compare(Object arg0, Object arg1) {
              // TODO Auto-generated method stub
              return ((ApplicabilityObject1)arg0).compareTo(arg1);
    }I'm expecting the result in the Order of USA, CANADA, MEXICO.
    But now the above code giving the result of [USA, USA, USA, Mexico, Canada, Mexico, Mexico, Mexico, Canada]
    Kindly help me to resolve this issue.
    Thanks in advance,
    Maheswaran

    An alternative way to reduce the size of your code.
    //Un-Compiled
    ApplicabilityObject1[] appObs = {
      new ApplicabilityObject1("Mexico"),
      new ApplicabilityObject1("Canada"),
      new ApplicabilityObject1("USA"),
      new ApplicabilityObject1("Mexico"),
      new ApplicabilityObject1("USA"),
      new ApplicabilityObject1("USA"),
      new ApplicabilityObject1("Mexico"),
      new ApplicabilityObject1("Mexico"),
      new ApplicabilityObject1("Canada")};
    List list = new ArrayList(Arrays.asList(appObs));Mel

  • Convert String Object to Comparable Object

    Getting all types of warnings in Eclipse when I try to cast. I have a method that wants to accept a Comparable<Object> and I would like to pass in a string, float, or integer, and make sure of the Comparable interface.

    EJP wrote:
    Try Comparable<?>. If that doesn't work please post some code.I will continue this thread then.
    inserInSubTree() is to take an attribute and compare it to another using Comparable.
    Here is my code:
    private PrimaryIndexNode insertInSubtree(Comparable<?> newAttribute,
                                            int newByteIndex, PrimaryIndexNode subTreeRoot)
              if (subTreeRoot == null)
                   return new PrimaryIndexNode(newAttribute, newByteIndex, null, null);
              else if(newAttribute.compareTo(subTreeRoot.attribute) < 0)
                   subTreeRoot.leftLink = insertInSubtree(newAttribute,
                                                      newByteIndex, subTreeRoot.leftLink);
                   return subTreeRoot;
              else
                   subTreeRoot.rightLink = insertInSubtree(newAttribute,
                                                      newByteIndex, subTreeRoot.rightLink);
                   return subTreeRoot;
         }I am unfamiliar with generics or the proper use of Comparable. what I desire to do is compare any object for ordering it and subsequently inserting it into a binary tree. I figured Comparable could do this and with auto up and down boxing I can do this for primitives and objects.
    However, unfamiliarity with what I need to do and having no clear example in my resources has left me without remedy.

  • Help comparing objects

    Hi,
    My java app's purpose is to find out if I must update my simulated framework if the real framework has changed ( interfaces).
    My app loads two jar files ( real framework and simulated framwork) and use bcel to make an static analysis of the classes ( bcel created 'JavaClass' to describe the class).
    In order to determine if the classes are equal i create a 'DataClass' object with the following information:
    className
    Field [] fields (bcel 'Field' not java.lang.reflect.Field)
    Method [] methods (bcel 'Method' not java.lang.reflect.Method)
    I retrieve the information from JavaClass and put it in my 'DataClass'.
    This is the code I use to create a Vector for each framework ( Listing 1). This is where I store the data describing my classes in the api (Listing 2). Then I compare each 'DataClass' contained in the Vector.
    My intention is to compare the 'data' of the 'DataClass'. But since I get that all DataClass objects are NOT equal I guess I compare references. How can I do this.
    All hints are vey much welcome.
    cheers,
    //mikael
    Listing 1
    ==========
    Note: ClassSet is a 'Set' of JavaClass' objects.
    public static Vector makeDataObjects(ClassSet classes){
            Vector api = new Vector();
            JavaClass [] clazzes = classes.toArray();
            for (int i = 0; i < clazzes.length; i++) {
             JavaClass clazz = clazzes;
    DataClass dc = new DataClass();
    dc.setClassName(clazz.getClassName());
    Field [] fields = clazz.getFields();
    for(int j = 0; j < fields.length; j++){
    dc.setField(fields[j].toString());
    Method [] methods = clazz.getMethods();
    for (int k = 0; k < methods.length; k++) {
    dc.setMethod(methods[k].toString());
    api.add(dc);
    return api;
    Listing 2
    =========
    import java.util.ArrayList;
    public class DataClass implements Comparable{
        private String className = null;
        private ArrayList fields = new ArrayList();
        private ArrayList  methods = new ArrayList();
        public void setClassName(String className){
            this.className = className;
        public String getClassName(){
            return className;
        public void setField(String field){
            fields.add(field);
        public void setMethod(String method){
            methods.add(method);
        public int compareTo(Object o){
    }This is where I compare the content of my two api:s
    Listing 3
    =========
    public static void compare(Vector api1, Vector api2) {
    for (Iterator iter = api1.iterator(); iter.hasNext();) {
       DataClass clazz1 = (DataClass) iter.next();
       String className = (String) clazz1.getClassName();
       DataClass clazz2 = (DataClass) toBeCompared(className, api2);
       // compare object values
       System.out.println("clazz1 is " + clazz1.toString());
       System.out.println("clazz2 is " + clazz2.toString());
       if (clazz1.equals(clazz2)) {
        System.out.println("Objects are the SAME" + className);
       } else {
        System.out.println("Objects are NOT the same" + className);
    private static DataClass toBeCompared(String className, Vector api){
      DataClass dao = null;
      for (Iterator iter = api.iterator(); iter.hasNext();) {
        DataClass element = (DataClass) iter.next();
        String otherClassName = element.getClassName();
        if (className.equals(otherClassName)){
        dao = element;
    return dao;

    Your error is that you implement Comparable and the compareTo method instead of the equals method of Object class. Comparable is needed for ordering items. Equals instead is used to check if two objects are equal. Per convinience it is expected that there is no inconsistency if both equals and compateTo are implemented.
    So you should implement a method in DataClass:
    public boolean equals(Obejct o) {
      boolean result = false;
      if (o instanceof DataClass) {
        DataClass c = (DataClass) o;
        result = className.equals(c.className) &&
             fields.equals(c.fields) &&
             methods.equals(c.methods);
        // keep in mind here, that the arrays fields and
        // methods should be sorted / ordered. use Collections.sort(fields)
        // for this when you create or modify it
      return result;
    }You could also simplify the compare(Vector api1, Vector api2) method when you keep these Vectors sorted for className or use Set (what i dont recommand because of properbly performance drawbacks):
    public static void compare(Vector api1, Vector api2) {
      Collections.sort(api1, new ClassNameComparator());
      Collections.sort(api2, new ClassNameComparator());
      // you should possibly dont do this sorting here because the
      // method name does not state that the vectors are modified
      // but it's a precondition for make the following work properly:
      return api1.equals(api2);
    }i did not compile the code, so i hope i did not make many errors.
    regards
    Sven

  • Intersecting Objects using Java

    Hullo everyone,
    I've got a problem at the moment so I've decided to turn to these forums once again for some helpful insight as 2 + hours of Googling hasn't helped me in the slightest. I'm trying to create a mini-scale Katamari game (hopefully you're familiar with it, basically it's one ball rolling over other balls to grow in size) on Java and I've finally got all my graphics and move directions in place. Now though I can't seem to get the collision to work...
    I'm trying to make the Katamari circle intersect with the little circle items on the playing field but currently the ball circle just ghosts over them. So basically I'm trying to get a circle to collide with other circles but I have no idea where to start. :S
    My circle items contain int x, y and radius fields and have been automatically set to their respective sizes by the game.
    I was thinking of working something out like:
    boolean testIntersection(Item item)
    if (distance between katamari ball and item <= radius of ball + radius of item)
    return true;
    else return false;
    But whenever I put something like that in, it still doesn't detect collision. Any thoughts or help on this would be very much appreciated. :)

    If you use object that implement Shape, then there is a contains and a collision implemented in the Shape interface.
    Aside from that, you need to calculate from the center point of both your objects to get a true distance:
    if your objects use an upper left corner for the drawing location and that is what your x and y represent, then you need to translate that to the center of your object. The distance between you objects can be given by:
    sqrt((X2-X1)^2 + (Y2-Y1)^2)
    Where X1, X2, Y1, and Y2 are center coordinates of your object.
    Note this well always be a positive value.
    The tolerance of your distances for an intersection would be R1+R2 so you will get the resulting conditional:
    if((R1+R2)<sqrt((X2-X1)^2 + (Y2-Y1)^2) {
      //what ever collision code you want
    }Please note, that you may want to include equality into your conditional and use the "<=" comparator, to include the condition that they "kiss".
    Also please note that these values need to be implemented in double, rather than int to do away with errors introduced by integer math and when you do implement using double, then double introduces it's own set of errors due to incapability to absolutely represent values not inherently reproducible by the double type. To over come that you may want to implement using a delta value or "close enough:
    {code}
    if(delta < abs(((R1+R2)-sqrt((X2-X1)^2 + (Y2-Y1)^2)) {
    //what ever collision code you want
    {code}

  • Someone please help creating comparable objects

    I have been given a second part to an assignement that wants me to create a program for comparing student obejects. The assignment description and code are below. I can' t see how the find to method interlocks with the findsmallest because find smallest is already finding the smallest value. I also don't see where the new diffinitions for UMUC_Comparable goes.
    In the second part of this project, you will also find the smallest element in the array, but now the array will be of UMUC_Comparable objects. It will use the compareTo method to compare objects to find the smallest one. This method will also have the name findSmallest, but will take an array of UMUC_Comparable objects. This findSmallest method will have a definition as follows:
    UMUC_Comparable findSmallest(UMUC_Comparable[] array);
    The findSmallest method will use the compareTo method in the UMUC_Comparable interface. You will be using it with the Student objects from module V, section III, so you do not have to rewrite the compareTo method; you can simply use the one defined in the Student object in module V.
    For the second part of this project, you should:
    Create a main that creates an array of Student objects, as in section III of module V. You can use the same array as defined module V. You do not have to read these objects in from a file.
    Call the findSmallest method to find the smallest Student object.
    Use the getName and getAverage methods in the Student object to print out the smallest object.
    Note that the return from the method is a UMUC_Comparable object, not a Student object, so you must cast the returned object to a Student object before printing it out. You can do so as follows:
    Student[] students ....; // Fill in the declaration // of the student array.
    Student s = (Student)findSmallest(UMUC_Comparable[] array);
    /* File: Student.java
    * Author: Darrell Clark
    * Date: December 3, 2006
    * Purpose: Shows how to find the smallest Int value in an array
    import java.util.*;
    import java.io.*;
    public class Student {
    private int average;
    private String name;
    /* public constructor. Note that because no default
    * constructor exists, Student objects will always
    * be constructed with a name and an average.
    public Student(String name, int average) {
    this.average = average;
    this.name = name;
    } // end method
    * return name
    public String getName() {
    return name;
    } // end method
    * return average
    public int getAverage() {
    return average;
    } // end method
    * compare to method for locating smallest value
         public static int findSmallest(int[] array) {
              int min = Integer.MAX_VALUE;
              for (int i = 1; i < (array.length); i++) {
                   if (array[i] < min)
                        min = array;
              return min;
    * compare student value
    public int compareTo(Student student) {
    return (this.average - student.average);
    } // end method
         public static void main(String[] args) {
    Student[] studentArray = { new Student("Tom", 87),
    new Student("Cindy", 100),
    new Student("Pat", 75),
    new Student("Anne", 92),
    new Student("Matt", 82)};
    for (int i = 0; i < studentArray.length; i++) {
    System.out.println(studentArray[i].name + " " +
    studentArray[i].average);
    } // end for
    } // end method
    } // end class

    Were you given the UMUC_Comparable interface, or do you have to write it?
    (1) In the latter case, that is where to start. It includes the method
    compareTo(UMUC_Comparable). This will almost certainly return an
    int - check out the API documentatuon for the Comparable interface.
    (2) What I think the assignment is asking you to do is rewrite the Student
    class so that it implements UMUC_Comparable.
    Then you write the findSmallest(UMUC_Comparable[]) method. There is
    already a static method like this in the (existing) Student class. It's anybody's
    guess where this method is supposed to go - perhaps you could ask
    whoever gave you the assignment. The problem is that it can't go in
    UMUC_Comparable because that's an interface. And it doesn't really belong
    in Student because it is a sort of utility function that deals with any
    UNUC_Comparable array.
    (3) Let's assume that findSmallest(UMUC_Comparable[]) goes in the
    Student class. So you replace the existing findSmallest() with the new one.
    The new one goes through the array using the UMUC_Comparable's
    compareTo() method to find the smallest UMUC_Comparable.
    (4) Finally in main() you create a test array, use the newly rewritten
    findSmallest() to find the smallest Student, and print their name and
    average.

  • Comparing objects from system other  system

    Hi,
    I need to compare the multiprovider from development system to production system.Is there is any program  avilable to compare objects. Please share.
    Thanks,
    vikk

    Hi Vikk,
    The important thing for multiprovider is characteristics and key figures identification.
    Use table RSDICMULTIIOBJ for getting the complete list of infoobjects having identification in multiprovider. Now you can either download the complete mapping in two excel sheet and then do the comparison using some vlookup technique.
    Or You can simply do the online comparison over development and production system.
    Regards,
    Durgesh.

  • Directly access specified item in Compare-object results

    I have done a Compare-Object and assigned the results to the array variable $NeedToConform. I can iterate through the variable with foreach ($Item in $NeedToConform) and get $Item.SideIndicator, but in my case I already have the item in question in $Package,
    and I need to get at the SideIndicator of that specific item. Basically $NeedToConform.$Package.SideIndicator, but that doesn't work. I tried using a dictionary instead of an array, with no joy. 
    Is there a trick here, or should I just punt and step through the array each time?
    EDIT: Damn, why do I so often find a solution right after posting the question. And why don't I learn and post the question sooner, so I'll find the solution sooner? ;) Anyway, this works.
    if ($NeedToConform[[array]::indexof($NeedToConform,$Package)].SideIndicator -eq '<=')
    I just wonder, is indexof really just a convenience method that iterates for me? If I might have a hundred or more results in the $NeedToConform array, and I might need to test against a hundred values for $Package, do I have any performance implications
    to worry about?
    Gordon

    mjolinor,
    my failure with Dictionary was on multiple fronts.
    One, you need to compare two dictionaries. But one of my objects needs to be ordered, and it needs to work in v2, so an ordered dictionary isn't an option. I may have been able to get it to work, but indexof works with the array, so that is my solution for
    now. But I am flagging this to come back to for review down the road. Always something new to learn.
    Thanks!
    Gordon
    You can have an ordered dictionary in V2:
    $OrderedHT = New-Object collections.specialized.ordereddictionary
    You just didn't see it used very often because you couldn't use it to create an object very easily.  The -properties parameter of New-Object would only take a generic/unordered dictionary as an argument.
    They fixed that in V3, along with adding the type accelerator ([ordered]) to make it easier to create an ordered dictionary.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How java Comparator is used ?

    Here is a compare method of a Comparator
    class AgeComparator implements Comparator{
        public int compare(Object emp1, Object emp2){
             * parameter are of type Object, so we have to downcast it
             * to Employee objects
            int emp1Age = ((Employee)emp1).getAge();       
            int emp2Age = ((Employee)emp2).getAge();
            if(emp1Age > emp2Age)
                return 1;
            else if(emp1Age < emp2Age)
                return -1;
            else
                return 0;   
    Question: How does these return  makes a list in ascending / descending order ?
    We use the above comparator this way.
            //Employee array which will hold employees
            Employee employee[] = new Employee[2];
            //set different attributes of the individual employee.
            employee[0] = new Employee();
            employee[0].setAge(40);
            employee[0].setName("Joe");
            employee[1] = new Employee();
            employee[1].setAge(20);
            employee[1].setName("Mark");
            //Sorting array on the basis of employee age by passing AgeComparator
            Arrays.sort(employee, new AgeComparator());

    user575089 wrote:
    If so, I dont get the point why a FLAG return > is mapped with a ascending order ? whats the analogy here ?There's no "analogy." It's just convention. The rules say, "Our sort routine will ask you which of two objects is "less". If you return a negative number, we will take that to mean that the first object is "less than" the second," and so on.
    Imagine someone gives you a deck of cards that's been shuffled and tells you to put it back in order. What would that order look like?
    It might be:
    A-spades
    2-spades
    3-spades
    K-spades
    A-clubs
    and so on. That is, you might sort first by suit, then by rank, with spades being "less than" clubs, and so on.
    Or it might be:
    A-spades
    A-clubs
    A-hearts
    A-diamonds
    2-spades
    with all the aces first, and the cards of the same rank being ordered by suit according to some rule.
    Now, stop and think about the actual process of sorting the cards. There are several different approaches, but many of them involve the step: "Compare card X with card Y, and if they're in the wrong order, switch them." You understand that, right?
    That is, if you're physically sorting cards, you will look at two cards, determine which one should come first, because it's "less than" the other card by whatever rules you're using, and then, if those cards are in the wrong order, you switch them. Do you understand this?
    Now, if you understand that, do you understand that you can apply that step no matter what rules you have for determining which card is "less than" the other. In the first sample order I gave above, you might have the Ace of Diamonds in your left hand, and the King of Spades in your right. Since all Spades come first, you would switch them. But in the second example ordering, the rules say that all Aces come before anything else, so you would not switch them.
    Your algorithm is: "Pick two cards, and if they're in the wrong order, switch them." That is, "if the one in the lower position is 'greater than' the other one, then switch them.".
    That's what Arrays.sort() and Collections.sort() and SortedSet and SortedMap do. All that your Comparable.compareTo() or Comparator.compare() method does is tell the sort() methods which object is "less".
    For example:
    Card c0 = cardList.get(0);
    Card c1 = cardList.get(1);
    // if the card at position 0 is "greater than" the card at position 1...
    if (c0.compareTo(c1)) > 0) {
      // ... then switch c0 with c1
    }Of course, the indices aren't hardcoded, and the choice of which pairs to compare is done intelligently, so that we will, on average, not make too many unnecessary comparisons, but this is the basic idea.

  • Java Comparator - Sorting - using predefined order

    I want to sort the items in my list with a predefined order....Is it possible? I can sort my List using a natural sort as in the below example. But that is not am looking for.....Am looking for sorting my list using an already defined order which i can hold using another list. IS IT POSSIBLE USING Comparator
    package com.nationwide.ag.integration.adapter.party;
    import java.util.*;
    public class TestUsingMe {
    static class AppComparator implements
    Comparator {
    public int compare(Object o1, Object o2) {
    int cc = ((Integer)o1).compareTo(o2);
    return (cc < 0 ? 1 : cc > 0 ? -1 : 0);
    static Comparator appcomparator =
    new AppComparator();
    static void sort(List list1) {
    Collections.sort(list1, appcomparator);
    public static void main(String[] args) {
    List list1 = new ArrayList();
    list1.add(new Integer(90));
    list1.add(new Integer(43));
    list1.add(new Integer(21));
    sort(list1);
    System.out.println(list1);
    Please reply................

    Tried as per your advice, as below. But, it didn't work out. (Hope I have done the changes correctly). Please find the changed code below:
    import java.util.*;
    import com.dto.search.PersonDTO;
    public class TestUsingMe {
    public static void main(String[] args) {
         PersonDTO pDTO0 = new PersonDTO();
         pDTO0.setCifId("Named Non-Owner");
         PersonDTO pDTO1 = new PersonDTO();
         pDTO1.setCifId("Restored");
         PersonDTO pDTO2 = new PersonDTO();
         pDTO2.setCifId("Antique/Classic");
    List list1 = new ArrayList();
    list1.add(pDTO0);
    list1.add(pDTO1);
    list1.add(pDTO2);
    List list2 = new ArrayList();
    list2.add("Private Passenger");
    list2.add("Restored");
    list2.add("Antique/Classic");
    list2.add("Named Non-Owner");
    list2.add("Trailer");
    AppComparator appcomparator = new AppComparator(list2);
    Collections.sort(list1, appcomparator);
    static class AppComparator implements Comparator {
    private List list;
    public AppComparator(List list) {
    this.list = list;
    public int compare(Object o1, Object o2) {
    return list.indexOf("cifId") - list.indexOf("cifId");
    Please respond...................

  • Report to check authorization object used in customized programs

    Hi Guys,
    An auditor came and he raised a question to us, he asked whether all of our customized transactions and programs are maintained with authorization checks? The question is how can we check what authorization objects are used for our customized programs and transaction codes? The developer did not maintain the objects used for that program in SU24 table. Is there a program or a report to show us all the authorization object used for a customised program or transaction? Example : T-code MIGO we can check in SU24 table for all the authorization object used. How do we check for customized tcodes? Please advise. Thanks!
    Edited by: Jarod Tan on Nov 25, 2010 9:42 AM

    Note that some programs are built in such a way that no (visible) auth check is necessary, or even desired at all.
    To determine the necessity of an auth check, you should check that starting it has an entry point (tcode, rfc, service) which is appropriately restricted. The rest (whether and where and how a further check is evaluated) is entirely dependent to what the program actually does.
    Well designed applications generally have centralized functions and methods, and the checks are in there or a "base check" they use.
    Others again use the same in UI programming to determine the visibility of functions, to make the application more intuitive for the user. This on it's own is however not a sufficient auth check to rely on.
    Code review is an art form!
    Cheers,
    Julius

  • Dynamic Creation of Objects using Tree Control

    I am able to Create Dynamic Objets using List control in
    flex,but not able to create objects using TreeControl,currently iam
    using switch case to do that iam embedding source code please help
    me how to do that
    <?xml version="1.0" encoding="utf-8"?>
    <!--This Application Deals With How to Create Objects
    Dynamically -->
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:XML id="treeDP">
    <node label="Controls">
    <node label="Button"/>
    <node label="ComboBox"/>
    <node label="ColorPicker"/>
    <node label="Hslider"/>
    <node label="Vslider"/>
    <node label="Checkbox"/>
    </node>
    </mx:XML>
    <mx:Script>
    <![CDATA[
    import mx.core.UIComponentGlobals;
    import mx.containers.HBox;
    import mx.controls.*;
    import mx.controls.VSlider;
    import mx.controls.Button;
    import mx.controls.Alert;
    import mx.core.UIComponent;
    import mx.controls.Image;
    import mx.managers.DragManager;
    import mx.events.DragEvent;
    import mx.controls.Tree;
    import mx.core.DragSource
    import mx.core.IFlexDisplayObject;
    /*This function accepts the item as on when it is dragged
    from tree Component */
    private function ondragEnter(event:DragEvent) : void
    if (event.dragSource.hasFormat("treeItems"))
    DragManager.acceptDragDrop(Canvas(event.currentTarget));
    DragManager.showFeedback(DragManager.COPY);
    return;
    else{
    DragManager.acceptDragDrop(Canvas(event.currentTarget));
    return;
    /*This Function creates objects as the items are Dragged
    from the TreeComponent
    And Creates Objects as and When They Are Dropped on the
    Container */
    private function ondragDrop(event:DragEvent) : void
    if (event.dragSource.hasFormat("treeItems"))
    var items:Array =event.dragSource.dataForFormat("treeItems")
    as Array;
    for (var i:int = items.length - 1; i >= 0; i--)
    switch(items
    [email protected]())
    case "Button":
    var b:Button=new Button();
    b.x = event.localX;
    b.y = event.localY;
    b.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
    myCanvas.addChild(b);
    break;
    case "ComboBox":
    var cb:ComboBox=new ComboBox();
    myCanvas.addChild(cb);
    cb.x = event.localX;
    cb.y = event.localY;
    cb.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
    break;
    case "ColorPicker":
    var cp:ColorPicker=new ColorPicker();
    myCanvas.addChild(cp);
    cp.x = event.localX;
    cp.y = event.localY;
    cp.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
    break;
    case "Vslider":
    var vs:VSlider=new VSlider();
    myCanvas.addChild(vs);
    vs.x = event.localX;
    vs.y = event.localY;
    vs.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
    break;
    case "Hslider":
    var hs:HSlider=new HSlider();
    myCanvas.addChild(hs);
    hs.x = event.localX;
    hs.y = event.localY;
    hs.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
    break;
    case "Checkbox":
    var check:CheckBox=new CheckBox();
    myCanvas.addChild(check);
    check.x = event.localX;
    check.y = event.localY;
    check.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
    break;
    else {
    var Component:UIComponent =
    event.dragSource.dataForFormat("items") as UIComponent ;
    Component.x = event.localX;
    Component.y = event.localY;
    Component.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
    myCanvas.addChild(Component);
    /*How to move the Objects within the Container */
    public function mouseMoveHandler(event:MouseEvent):void{
    var
    dragInitiator:UIComponent=UIComponent(event.currentTarget);
    var ds:DragSource = new DragSource();
    ds.addData(dragInitiator,"items")
    DragManager.doDrag(dragInitiator, ds, event);
    ]]>
    </mx:Script>
    <mx:Tree dataProvider="{treeDP}" labelField="@label"
    dragEnabled="true" width="313" left="0" bottom="-193" top="0"/>
    <mx:Canvas id="myCanvas" dragEnter="ondragEnter(event)"
    dragDrop="ondragDrop(event)" backgroundColor="#DDDDDD"
    borderStyle="solid" left="321" right="-452" top="0"
    bottom="-194"/>
    </mx:Application>
    iwant to optimize the code in the place of switch case
    TextText

    Assuming your objects are known and what you need are simply
    variable names created by the program, try using objects as
    associative arrays:
    var asArray:Object = new Object();
    for (var n:int = 0; n < 10; n++) {
    asArray["obj" + n] = new WHAT_EVER();

Maybe you are looking for