Giter VIP home page Giter VIP logo

Comments (6)

ghaffarian avatar ghaffarian commented on July 20, 2024

Can you send me the above Java code so I can use it as test-case to debug the issue?
Sending the resulting JSON file can also help.

from progex.

Jisoo-Min avatar Jisoo-Min commented on July 20, 2024

I cannot put files which type are json and java. Instead, I put codes
1-1. Array1Unlucky1.java

class Array1Unlucky1{ 
/* We'll say that a 1 immediately followed by a 3 in an array is an "unlucky" 
 * 1. Return true if the given array contains an unlucky 1 in the first 2 or 
 * last 2 positions in the array.
 */
public boolean unlucky1(int[] nums) {
    if(nums.length >= 2 && 
        (nums[0] == 1 && nums[1] == 3 || nums[nums.length - 2] == 1 && 
        nums[nums.length - 1] == 3))
        return true;
                       
    if(nums.length >= 3 && nums[1] == 1 && nums[2] == 3)
        return true;
                                 
    return false;
}
}

1-2. Array1Unlucky1-CFG.json

{
  "directed": true,
  "multigraph": true,
  "label": "CFG of Array1Unlucky1.java",
  "type": "Control Flow Graph (CFG)",
  "file": "Array1Unlucky1.java",
  "package": "",

  "nodes": [
    {
      "id": 0,
      "line": 6,
      "label": "boolean unlucky1(int[] nums)"
    },
    {
      "id": 1,
      "line": 7,
      "label": "if (nums.length >= 2 && 
        (nums[0] == 1 && nums[1] == 3 || nums[nums.length - 2] == 1 && 
        nums[nums.length - 1] == 3))"
    },
    {
      "id": 2,
      "line": 10,
      "label": "return true;"
    },
    {
      "id": 3,
      "line": 0,
      "label": "endif"
    },
    {
      "id": 4,
      "line": 12,
      "label": "if (nums.length >= 3 && nums[1] == 1 && nums[2] == 3)"
    },
    {
      "id": 5,
      "line": 13,
      "label": "return true;"
    },
    {
      "id": 6,
      "line": 0,
      "label": "endif"
    },
    {
      "id": 7,
      "line": 15,
      "label": "return false;"
    }
  ],

  "edges": [
    {
      "id": 0,
      "source": 0,
      "target": 1,
      "label": ""
    },
    {
      "id": 1,
      "source": 1,
      "target": 2,
      "label": "True"
    },
    {
      "id": 2,
      "source": 1,
      "target": 3,
      "label": "False"
    },
    {
      "id": 3,
      "source": 3,
      "target": 4,
      "label": ""
    },
    {
      "id": 4,
      "source": 4,
      "target": 5,
      "label": "True"
    },
    {
      "id": 5,
      "source": 4,
      "target": 6,
      "label": "False"
    },
    {
      "id": 6,
      "source": 6,
      "target": 7,
      "label": ""
    }
  ]
}

If you can read json file using Sublime text, you can also see the highlights which are the problems.
image

from progex.

Jisoo-Min avatar Jisoo-Min commented on July 20, 2024

2-1. Array2Twotwo.java

class Array2Twotwo{ 
/* Given an array of ints, return true if every 2 that appears in the array 
 * is next to another 2.
 */
public boolean twoTwo(int[] nums) {
    if(nums.length == 1 && nums[0] == 2)
        return false;
          
    if(nums.length >= 2 && ((nums[0] == 2 && nums[1] != 2) ||
        (nums[nums.length-1] == 2 && nums[nums.length-2] != 2)))
        return false;
                            
    for(int i = 1; i <= nums.length - 2; i++) {
        if(nums[i] == 2 && nums[i-1] != 2 && nums[i+1] != 2)
            return false;
    }
                                            
    return true;
}
}

2-2. Array2Twotwo-CFG.json

{
  "directed": true,
  "multigraph": true,
  "label": "CFG of Array2Twotwo.java",
  "type": "Control Flow Graph (CFG)",
  "file": "Array2Twotwo.java",
  "package": "",

  "nodes": [
    {
      "id": 0,
      "line": 5,
      "label": "boolean twoTwo(int[] nums)"
    },
    {
      "id": 1,
      "line": 6,
      "label": "if (nums.length == 1 && nums[0] == 2)"
    },
    {
      "id": 2,
      "line": 7,
      "label": "return false;"
    },
    {
      "id": 3,
      "line": 0,
      "label": "endif"
    },
    {
      "id": 4,
      "line": 9,
      "label": "if (nums.length >= 2 && ((nums[0] == 2 && nums[1] != 2) ||
        (nums[nums.length-1] == 2 && nums[nums.length-2] != 2)))"
    },
    {
      "id": 5,
      "line": 11,
      "label": "return false;"
    },
    {
      "id": 6,
      "line": 0,
      "label": "endif"
    },
    {
      "id": 7,
      "line": 13,
      "label": "int i = 1"
    },
    {
      "id": 8,
      "line": 13,
      "label": "for (i <= nums.length - 2)"
    },
    {
      "id": 9,
      "line": 13,
      "label": "i++"
    },
    {
      "id": 10,
      "line": 0,
      "label": "endfor"
    },
    {
      "id": 11,
      "line": 14,
      "label": "if (nums[i] == 2 && nums[i-1] != 2 && nums[i+1] != 2)"
    },
    {
      "id": 12,
      "line": 15,
      "label": "return false;"
    },
    {
      "id": 13,
      "line": 0,
      "label": "endif"
    },
    {
      "id": 14,
      "line": 18,
      "label": "return true;"
    }
  ],

  "edges": [
    {
      "id": 0,
      "source": 0,
      "target": 1,
      "label": ""
    },
    {
      "id": 1,
      "source": 1,
      "target": 2,
      "label": "True"
    },
    {
      "id": 2,
      "source": 1,
      "target": 3,
      "label": "False"
    },
    {
      "id": 3,
      "source": 3,
      "target": 4,
      "label": ""
    },
    {
      "id": 4,
      "source": 4,
      "target": 5,
      "label": "True"
    },
    {
      "id": 5,
      "source": 4,
      "target": 6,
      "label": "False"
    },
    {
      "id": 6,
      "source": 6,
      "target": 7,
      "label": ""
    },
    {
      "id": 7,
      "source": 7,
      "target": 8,
      "label": ""
    },
    {
      "id": 8,
      "source": 8,
      "target": 10,
      "label": "False"
    },
    {
      "id": 9,
      "source": 8,
      "target": 11,
      "label": "True"
    },
    {
      "id": 10,
      "source": 11,
      "target": 12,
      "label": "True"
    },
    {
      "id": 11,
      "source": 11,
      "target": 13,
      "label": "False"
    },
    {
      "id": 12,
      "source": 13,
      "target": 9,
      "label": ""
    },
    {
      "id": 13,
      "source": 9,
      "target": 8,
      "label": ""
    },
    {
      "id": 14,
      "source": 10,
      "target": 14,
      "label": ""
    }
  ]
}

from progex.

ghaffarian avatar ghaffarian commented on July 20, 2024

Thanks for the data.
I will look into it and inform you on the situation.

from progex.

ghaffarian avatar ghaffarian commented on July 20, 2024

This issue is now fixed in master with the latest commit.
Next week I will publish a new release with this bug-fix.
Please continue testing and reporting issues till next week.

from progex.

ghaffarian avatar ghaffarian commented on July 20, 2024

I just released a new version of PROGEX (v3.4.5).
This issue is now fixed in this release.

from progex.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.