public List<List<Criterion>> getCriteriaByLevels() { List<List<Criterion>> result = new ArrayList<List<Criterion>>(); result.add(new ArrayList<Criterion>(getGoals())); for (Goal g : getGoals()) result.addAll(g.getCriteriaByLevels()); return result; }
private void addgoalinfoActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addgoalinfoActionPerformed // TODO add your handling code here: String[] types = {"Product", "Project"}; JComboBox typeList = new JComboBox(types); typeList.setSelectedIndex(0); JTextArea description = new JTextArea(); description.setRows(5); description.setColumns(10); description.setLineWrap(true); JScrollPane pane = new JScrollPane(description); Object[] message = { "Goal type:", typeList, "Goal Description:", pane, }; int option = JOptionPane.showConfirmDialog( this, message, "Enter Goal Information", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { Goal goal = new Goal(); goal.setGoalDesc(description.getText()); goal.setGoalType(typeList.getSelectedItem().toString()); currentProject.getGoals().add(goal); goalmodel.addElement(typeList.getSelectedItem().toString() + " " + description.getText()); goallist.setModel(goalmodel); } } // GEN-LAST:event_addgoalinfoActionPerformed
public boolean isFirstGoalTillMinute(int minute) { Goal goal = match.getScore().getGoalByIndex(1); if (goal == null) { return false; } return (goal.getMinute() + (20 * (goal.getPeriod() - 1))) < minute; }
/** * Selects a goal from all of the possible goals tied to the output layer of implicit module in * this module using the specified collection of drive strengths. * * <p>If a new goal is selected that is different than the currently chosen goal then the * currently chosen goal is removed from the goal structure and the new goal is set as the * currently chosen goal. If the goal structure has not been initialized or does not contain any * possible goals, this method does nothing. * * @param ModuleInput The drive strengths of relevant drives. * @param TimeStamp The current time stamp. * @throws MissingGoalStructureException If no instance of the goal structure has been attached to * this module. */ public void performMetaCognition(DimensionValueCollection ModuleInput, long TimeStamp) throws MissingGoalStructureException { if (GS == null || GS.getPossibleGoals() == null) throw new MissingGoalStructureException( "The Goal Selection Module does not have a goal structure specified or " + "the goal structure does not contain a list of possible goals over which to select. " + "To specify a goal structure for this module, use the attachGoalStructure method. To add possible goals " + "to the goal structure, use the addPossibleGoal methods in the GoalStructure class."); ImplicitModule.setInput(ModuleInput); ImplicitModule.forwardPass(); if (GS.getCurrentGoal() != null) { for (AbstractOutputChunk g : ImplicitModule.getOutput()) { Goal pg = GS.getPossibleGoals().get(g.getID()); pg.setActivation(g.getActivation()); if (GS.getCurrentGoal().equalsID(g)) pg.setBLSelectionMeasure( g.adjustSelectionMeasure(g.getActivation(), g.FULL_ACTIVATION_LEVEL)); else pg.setBLSelectionMeasure( g.adjustSelectionMeasure(g.getActivation(), g.MINIMUM_ACTIVATION_THRESHOLD)); } GS.remove(GS.getCurrentGoal()); } Goal newgoal = (Goal) SELECTOR.select(GS.getPossibleGoals().values()); GS.add(newgoal, TimeStamp); }
public List<String> getAllGoalsAsString() { List<String> strings = new ArrayList<String>(); List<Goal> allGoals = getAllGoals(); for (Goal allGoal : allGoals) { strings.add(allGoal.getCommandLine()); } return strings; }
public boolean allGoalsComplete() { for (Goal i : goals) { if (!i.isComplete()) { return false; } } return true; }
public void reset() { LinkedListNode walker = goals.getRoot(); while (walker != null) { Goal goal = (Goal) walker.object; goal.reset(); walker = walker.Next; } }
public List<Goal> getGoals(GoalType type) { List<Goal> result = new ArrayList<Goal>(); Iterator<Goal> git = getGoals().iterator(); while (git.hasNext()) { Goal next = git.next(); if (type.equals(next.getGoalType())) result.add(next); } return result; }
public Goal getGoal(String name) { Iterator<Goal> iti = getGoals().iterator(); Goal help = null; while (iti.hasNext()) { help = iti.next(); if (help.getName().equals(name)) return help; } return null; }
public boolean isStrongWilledVictory() { Goal goal = match.getScore().getGoalByIndex(1); if (goal == null) { return false; } return goal.getWhoScored() == TeamLocation.GUEST ? match.getFulltimeResults() == Results.HOME : match.getFulltimeResults() == Results.GUEST; }
private static ContentValues getContentValues_goal(Goal goal) { ContentValues values = new ContentValues(); values.put(Schema.GoalTable.Cols.STATUS, goal.getStatus().toString()); values.put(Schema.GoalTable.Cols.PROGRESS, goal.getProgress()); values.put(Schema.GoalTable.Cols.NAME, goal.getName()); return values; }
public Decision<T> clone() { Decision<T> dec = new Decision<T>(getName()); dec.setDescription(getDescription()); dec.setUserId(getUserId()); for (T a : getAlternatives()) dec.addAlternative((T) a.clone()); for (Goal g : getGoals()) dec.addGoal(g.clone()); return dec; }
public void update() { if (Ball.getPosition().x + Ball.getSize().x < Goal.getPositionHome().x + Goal.getSizeHome().x && Ball.getPosition().y > Goal.getPositionHome().y && GameWorld.goalScore == false) { score.x++; GameWorld.goalScore = true; // Wait 2 second and then to setPosition } if (Ball.getPosition().x > Goal.getPositionOut().x && Ball.getPosition().y > Goal.getPositionOut().y && GameWorld.goalScore == false) { score.y++; GameWorld.goalScore = true; // Wait 2 second and then to setPosition } }
// returns the current progress of the goal of given name public int checkProgress(String name) { int progress = 0; try (DatabaseCursorWrapper wrapper = queryGoal("NAME=?", new String[] {name})) { wrapper.moveToFirst(); while (!wrapper.isAfterLast()) { Goal goal = wrapper.getGoal(); progress = goal.getProgress(); wrapper.moveToNext(); } } return progress; }
public void addGoals(GoalManager other) { for (Goal i : other.getGoals()) { boolean add = true; for (Goal j : goals) { if (j.equals(i)) { add = false; if (i.isComplete()) { j.setComplete(true); } } } if (add) { goals.add(i); } } }
// returns the current status of the goal of given name public GoalStatus checkStatus(String name) { GoalStatus status = null; try (DatabaseCursorWrapper wrapper = queryGoal("NAME=?", new String[] {name})) { wrapper.moveToFirst(); while (!wrapper.isAfterLast()) { Goal goal = wrapper.getGoal(); status = goal.getStatus(); wrapper.moveToNext(); } } return status; }
/** * Find a matching goal from a line, according the goal regular expression. * * @param line The line to control. * @return Found goal. */ private Goal getMatchingGoal(String line) { Goal res = null; Goal[] goals = Goal.values(); Pattern pattern; Matcher matcher; for (Goal goal : goals) { pattern = goal.getPattern(); matcher = pattern.matcher(line); if (matcher.find()) { res = goal; break; } } return res; }
public int checkGoals() { LinkedListNode walker = goals.getRoot(); int status = Goal.ALIVE; // go through goal list to check status of each goal if (GameInfo.player.isDead()) return status; while (walker != null) { Goal goal = (Goal) walker.object; int thisStatus = goal.checkGoal(); // give player benefit of doubt if (thisStatus == Goal.WIN) return Goal.WIN; else if (thisStatus == Goal.LOSE) status = Goal.LOSE; walker = walker.Next; } return status; }
@Override @pausable public void execute() throws Exception { try { markAsDone(goal.evaluate()); } catch (OutOfMemoryError e) { memoryHog = null; Runtime.getRuntime().gc(); throw e; } }
/** DFS over all parent states to find a match. */ public GoalState findGoalStateByGoal(Goal<?> goal) { // TODO: handle wrap-around (though it's not likely to occur anyway) int mark = nextVisitationMark++; List<GoalState> stack = newArrayListWithCapacity(activeGoalStates.size()); stack.add(this); this.visitationMark = mark; while (!stack.isEmpty()) { GoalState state = stack.remove(stack.size() - 1); if (state.goal.hashCode() == goal.hashCode() && state.goal.equals(goal)) return state; for (GoalState parent : state.parentStates) if (parent.visitationMark < mark) { parent.visitationMark = mark; stack.add(parent); } } return null; }
public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof Goal)) return false; Goal other = (Goal) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.goalType == null && other.getGoalType() == null) || (this.goalType != null && this.goalType.equals(other.getGoalType()))) && ((this.unitType == null && other.getUnitType() == null) || (this.unitType != null && this.unitType.equals(other.getUnitType()))) && ((this.units == null && other.getUnits() == null) || (this.units != null && this.units.equals(other.getUnits()))); __equalsCalc = null; return _equals; }
public List<Criterion> getLeafCriteria(CriterionType type) { List<Criterion> result = new ArrayList<Criterion>(); for (Goal g : getGoals()) result.addAll(g.getLeafCriteria(type)); return result; }
@Override public int hashCode() { int result = goal != null ? goal.hashCode() : 0; result = 31 * result + (job != null ? job.hashCode() : 0); return result; }
// Updating goal status / progress using the name of the goal public void updateGoal(Goal goal) { ContentValues values = getContentValues_goal(goal); String name = goal.getName(); Database.update( Schema.GoalTable.NAME, values, Schema.GoalTable.Cols.NAME + "=?", new String[] {name}); }
protected <R extends Result> R createRecursiveResult(GoalState parentState, Goal<R> goal) { return goal.createRecursiveResult(); }
public void interaction(String name1, String name2) { for (Goal i : goals) { i.checkGoal(name1, name2); } }
private void updateUI() { mGoal.setText(goal.getGoal()); mSteps.setText(Integer.toString(steps)); mCal.setText(Double.toString(calories)); mDistance.setText(Double.toString(distance)); }
public void setPruned() { pruned = true; markAsDone(goal.createRecursiveResult()); }
@Test public void getFormulaReturnsSameFormula() { Formula mockFormula = mock(Formula.class); Goal goal = new Goal(mockFormula); assertEquals(mockFormula, goal.getFormula()); }
public ViewProject(int id) { initComponents(); currentProject = new Project(); currentProject.setProjectID(id); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection( "jdbc:mysql://127.0.0.1:3306/projectmanagementsystem?zeroDateTimeBehavior=convertToNull", "root", "password"); String query2 = "select * from project where idproject = ?"; PreparedStatement pst2 = con.prepareStatement(query2); int projectid = id + 1; pst2.setInt(1, projectid); ResultSet rs = pst2.executeQuery(); if (rs.next()) { projectname.setText(rs.getString("projectname")); projectdescription.setText(rs.getString("projectdesc")); } String query3 = "select * from teammember where teammember_FK = ?"; PreparedStatement pst3 = con.prepareStatement(query3); pst3.setInt(1, projectid); ResultSet rs2 = pst3.executeQuery(); while (rs2.next()) { Person p = new Person(); p.setFirstName(rs2.getString("firstname")); p.setLastName(rs2.getString("lastname")); p.setPosition(rs2.getString("position")); p.setPersonID(rs2.getInt("idteammember")); teammembers.add(p); teammodel.addElement(p.getFirstName() + " " + p.getLastName() + " " + p.getPosition()); } teamlist.setModel(teammodel); String query4 = "select * from goal where goal_FK = ?"; PreparedStatement pst4 = con.prepareStatement(query4); pst4.setInt(1, projectid); ResultSet rs3 = pst4.executeQuery(); while (rs3.next()) { Goal g = new Goal(); g.setGoalID(rs3.getInt("idgoal")); g.setGoalDesc(rs3.getString("goaldesc")); g.setGoalType(rs3.getString("goaltype")); goals.add(g); goalmodel.addElement(g.getGoalType() + " " + g.getGoalDesc()); } goallist.setModel(goalmodel); String query5 = "select * from requirement where requirement_FK = ?"; PreparedStatement pst5 = con.prepareStatement(query5); pst5.setInt(1, projectid); ResultSet rs4 = pst5.executeQuery(); while (rs4.next()) { Requirement r = new Requirement(); String type; r.setRequirementID(rs4.getInt("idrequirement")); r.setRequirementDescription(rs4.getString("requirementdesc")); if (rs4.getInt("isFunctionalRequirement") == 0) { r.setIsFunctionalRequirement(false); type = "Non-functional"; } else type = "Functional"; requirements.add(r); requirementmodel.addElement(type + " " + r.getRequirementDescription()); } requirementlist.setModel(requirementmodel); String query6 = "select * from risk where risk_FK = ?"; PreparedStatement pst6 = con.prepareStatement(query6); pst6.setInt(1, projectid); ResultSet rs5 = pst6.executeQuery(); while (rs5.next()) { Risk r = new Risk(); r.setRiskID(rs5.getInt("idrisk")); r.setRiskName(rs5.getString("riskname")); r.setRiskStatus(rs5.getString("riskstatus")); risks.add(r); riskmodel.addElement(r.getRiskStatus() + " " + r.getRiskName()); } risklist.setModel(riskmodel); String query7 = "select * from effort join requirement on effort.effort_FK = requirement.idrequirement" + " where requirement.requirement_FK = ?"; PreparedStatement pst7 = con.prepareStatement(query7); pst7.setInt(1, projectid); ResultSet rs6 = pst7.executeQuery(); while (rs6.next()) { Effort e = new Effort(); e.setEffortID(rs6.getInt("ideffort")); e.setEffortDate(rs6.getString("effortdate")); e.setEffortDevPhase(rs6.getString("effortdevphase")); e.setEffortHours(rs6.getInt("efforthours")); e.setRequirementID(rs6.getInt("effort_FK")); e.setRequirementDesc(rs6.getString("requirementdesc")); efforts.add(e); effortmodel.addElement( "For req: " + e.getRequirementDesc() + " " + e.getEffortDevPhase() + " " + e.getEffortDate() + " " + e.getEffortHours()); } effortlist.setModel(effortmodel); } catch (Exception e) { System.out.println(e.toString()); } }