public Group getGroup(String groupName) { for (Group g : groups) { if (g.getName().equalsIgnoreCase(groupName)) return g; } return null; }
public void parseGroup(Group g) throws Hdf5Exception, EndOfSequenceException { startGroup(g); java.util.List members = g.getMemberList(); // NOTE: parsing contents twice to ensure subgroups are handled before datasets // This is mainly because synapse_props groups will need to be parsed before dataset of // connections for (int j = 0; j < members.size(); j++) { HObject obj = (HObject) members.get(j); if (obj instanceof Group) { Group subGroup = (Group) obj; logger.logComment("--------- Found a sub group: " + subGroup.getName()); parseGroup(subGroup); } } for (int j = 0; j < members.size(); j++) { HObject obj = (HObject) members.get(j); if (obj instanceof Dataset) { Dataset ds = (Dataset) obj; logger.logComment("Found a dataset: " + ds.getName()); dataSet(ds); } } endGroup(g); }
/** Method for creating Stream Direction Group */ protected void createStreamDirectionGroup( int horizontalSpan, int verticalSpan, boolean isBothButton) { streamDirectionGroup = new Group(shell, SWT.NONE); streamDirectionGroup.setText("Stream direction"); GridData gridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false); gridData.horizontalSpan = horizontalSpan; gridData.verticalSpan = verticalSpan; streamDirectionGroup.setLayoutData(gridData); streamDirectionGroup.setLayout(new GridLayout()); // Downstream Radio Button downstreamButton = new Button(streamDirectionGroup, SWT.RADIO); downstreamButton.setText("Downstream"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); downstreamButton.setLayoutData(gridData); // Upstream Radio Button upstreamButton = new Button(streamDirectionGroup, SWT.RADIO); upstreamButton.setText("Upstream"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); upstreamButton.setLayoutData(gridData); // Downstream & Upstream Radio Button if (isBothButton) { bothButton = new Button(streamDirectionGroup, SWT.RADIO); bothButton.setText("Both"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); bothButton.setLayoutData(gridData); } }
public Flexible copyToGroup(String group) { String newName; if (group.equals(nullString)) newName = Group.substractObjectName(getName()); else newName = group + Constants.GROUP_SEPARATOR + Group.substractObjectName(getName()); // object with new name already exists, add suffix ///!!! while (Group.getRoot().findObject(newName, true) != null) newName = StringUtils.incrementName(newName, Constants.COPY_SUFFIX); Box grBox = new Box( newName, null, startVertex.getX(), startVertex.getY(), endVertex.getX(), endVertex.getY()); grBox.setColor(getColor()); Group.getRoot().addSubObject(newName, grBox, true); // ViewState view = ViewState.getInstance(); // grBox.move(20 - view.getRx(), 20 - view.getRy()); unconditionalValidation(); return grBox; }
/** * @param group * @return * @throws Exception */ @Override public String createGroup(Group group) throws Exception { Group specificGroup = new Group(group); try { // Set supergroup specific Id if (StringUtil.isDefined(group.getSuperGroupId())) { // Get the user information GroupRow gr = getOrganization().group.getGroup(idAsInt(group.getSuperGroupId())); if (gr == null) { throw new AdminException( "DomainDriverManager.createGroup", SilverpeasException.ERROR, "admin.EX_ERR_GROUP_NOT_FOUND", "group Id: '" + group.getSuperGroupId() + "'"); } specificGroup.setSuperGroupId(gr.specificId); } // Set subUsers specific Id specificGroup.setUserIds( translateUserIdsToSpecificIds(idAsInt(group.getDomainId()), group.getUserIds())); // Get a DomainDriver instance DomainDriver domainDriver = this.getDomainDriver(idAsInt(group.getDomainId())); // Update Group in specific domain return domainDriver.createGroup(specificGroup); } catch (AdminException e) { throw new AdminException( "DomainDriverManager.createGroup", SilverpeasException.ERROR, "admin.EX_ERR_UPDATE_GROUP", "group Id: '" + group.getId() + "'", e); } }
public Group getGroupForPlayer(String playerName) { for (Group group : groups) { if (group.isInGroup(playerName)) return group; } return null; }
/** * Retrieves whole application object from DB (authz in parent methods) * * @param sess PerunSession for Authz and to resolve User * @param vo VO to get application for * @param group Group * @return application object / null if not exists */ private Application getLatestApplication( PerunSession sess, Vo vo, Group group, Application.AppType type) { try { if (sess.getPerunPrincipal().getUser() != null) { if (group != null) { return jdbc.queryForObject( RegistrarManagerImpl.APP_SELECT + " where a.id=(select max(id) from application where vo_id=? and group_id=? and apptype=? and user_id=? )", RegistrarManagerImpl.APP_MAPPER, vo.getId(), group.getId(), String.valueOf(type), sess.getPerunPrincipal().getUserId()); } else { return jdbc.queryForObject( RegistrarManagerImpl.APP_SELECT + " where a.id=(select max(id) from application where vo_id=? and apptype=? and user_id=? )", RegistrarManagerImpl.APP_MAPPER, vo.getId(), String.valueOf(type), sess.getPerunPrincipal().getUserId()); } } else { if (group != null) { return jdbc.queryForObject( RegistrarManagerImpl.APP_SELECT + " where a.id=(select max(id) from application where vo_id=? and group_id=? and apptype=? and created_by=? and extsourcename=? )", RegistrarManagerImpl.APP_MAPPER, vo.getId(), group.getId(), String.valueOf(type), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getExtSourceName()); } else { return jdbc.queryForObject( RegistrarManagerImpl.APP_SELECT + " where a.id=(select max(id) from application where vo_id=? and apptype=? and created_by=? and extsourcename=? )", RegistrarManagerImpl.APP_MAPPER, vo.getId(), String.valueOf(type), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getExtSourceName()); } } } catch (EmptyResultDataAccessException ex) { return null; } }
private void createRight(final Composite parent) { parent.setLayout(new FillLayout()); Group styleGroup = new Group(parent, SWT.NONE); styleGroup.setText("Styles and Parameters"); styleGroup.setLayout(new FillLayout()); styleComp = new Composite(styleGroup, SWT.NONE); styleComp.setLayout(new RowLayout(SWT.VERTICAL)); }
protected void addPropertiesWithPrefix(Properties properties, Group group) { if (properties != null) { if (group != null) { String prefix = group.getName() + "."; Properties suffixProperties = group.getProperties(); addPropertiesWithPrefix(properties, prefix, suffixProperties); } } }
public Group copy() { Group dst = new Group(); copyValues(dst); if (identifier != null) { dst.identifier = new ArrayList<Identifier>(); for (Identifier i : identifier) dst.identifier.add(i.copy()); } ; dst.type = type == null ? null : type.copy(); dst.actual = actual == null ? null : actual.copy(); dst.code = code == null ? null : code.copy(); dst.name = name == null ? null : name.copy(); dst.quantity = quantity == null ? null : quantity.copy(); if (characteristic != null) { dst.characteristic = new ArrayList<GroupCharacteristicComponent>(); for (GroupCharacteristicComponent i : characteristic) dst.characteristic.add(i.copy()); } ; if (member != null) { dst.member = new ArrayList<GroupMemberComponent>(); for (GroupMemberComponent i : member) dst.member.add(i.copy()); } ; return dst; }
protected void createLimitTypesGroup() { GridData gridData; // Group for lengthLimitButton and shortestPlusKButton Group limitTypeGroup = new Group(shell, SWT.NONE); limitTypeGroup.setText("Stop distance"); gridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false); gridData.horizontalSpan = 2; gridData.verticalSpan = 2; limitTypeGroup.setLayoutData(gridData); limitTypeGroup.setLayout(new GridLayout(2, true)); // Length limit radio button lengthLimitLabel = new Label(limitTypeGroup, SWT.NONE); lengthLimitLabel.setText("Length limit"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); lengthLimitLabel.setLayoutData(gridData); // Length limit text lengthLimit = new Text(limitTypeGroup, SWT.BORDER); lengthLimit.addKeyListener(keyAdapter); gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); lengthLimit.setLayoutData(gridData); // Shortest+k radio button shortestPlusKButton = new Button(limitTypeGroup, SWT.CHECK); shortestPlusKButton.setText("Shortest+k"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); shortestPlusKButton.setLayoutData(gridData); shortestPlusKButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { shortestPlusK.setEnabled(shortestPlusKButton.getSelection()); } }); // Shortest+k text shortestPlusK = new Text(limitTypeGroup, SWT.BORDER); shortestPlusK.addKeyListener(keyAdapter); gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); shortestPlusK.setLayoutData(gridData); // Strict check box strictButton = new Button(shell, SWT.CHECK | SWT.WRAP); strictButton.setText("Ignore source-source/target-target paths"); gridData = new GridData(GridData.CENTER, GridData.CENTER, false, false); gridData.verticalSpan = 2; gridData.horizontalSpan = 4; strictButton.setLayoutData(gridData); }
/** Creates a text that controls whether a border radius is set on the registered controls. */ protected void cteateRoundedBorderGroup() { Group group = new Group(styleComp, SWT.NONE); group.setText("Rounded Border"); group.setLayout(new GridLayout(2, false)); new Label(group, SWT.NONE).setText("Width"); final Text textWidth = new Text(group, SWT.SINGLE | SWT.BORDER); textWidth.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(group, SWT.NONE).setText("Color"); final Button buttonColor = new Button(group, SWT.PUSH); buttonColor.setLayoutData(new GridData(20, 20)); buttonColor.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { rbIndex = (rbIndex + 1) % bgColors.length; if (bgColors[rbIndex] == null) { buttonColor.setText(""); } else { buttonColor.setText("\u2588"); } buttonColor.setForeground(bgColors[rbIndex]); } }); new Label(group, SWT.NONE).setText("Radius "); Composite radiusGroup = new Composite(group, SWT.NONE); radiusGroup.setLayout(new GridLayout(4, false)); new Label(radiusGroup, SWT.NONE).setText("T-L"); final Text textTopLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textTopLeft.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("T-R"); final Text textTopRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textTopRight.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("B-L"); final Text textBottomLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textBottomLeft.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("B-R"); final Text textBottomRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textBottomRight.setLayoutData(new GridData(20, SWT.DEFAULT)); Button button = new Button(group, SWT.PUSH); button.setText("Set"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { int width = parseInt(textWidth.getText()); Color color = buttonColor.getBackground(); int topLeft = parseInt(textTopLeft.getText()); int topRight = parseInt(textTopRight.getText()); int bottomRight = parseInt(textBottomRight.getText()); int bottomLeft = parseInt(textBottomLeft.getText()); updateRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft); } }); }
public boolean isInGroup(String playerName, String groupName) { // boolean returnValue = false; for (Group group : groups) { if (group.getName().equalsIgnoreCase(groupName)) { return group.isInGroup(playerName); } } // Kikkit.MinecraftLog.info("isInGroup(" + playerName +", " + groupName + "): " + returnValue); return false; }
private void loadGroups() { FileInputStream inputStream; InputStreamReader reader; Scanner scanner = null; try { inputStream = new FileInputStream(currentGroupFileName); reader = new InputStreamReader(inputStream, "UTF-8"); scanner = new Scanner(reader); String line = ""; while (scanner.hasNextLine()) { line = scanner.nextLine(); // Check for comments. if (line.startsWith("#") || line.startsWith("//")) continue; String[] data = line.split(":"); if (data.length < 2) continue; if (data.length >= 2) { Group newGroup = new Group(data[0]); groups.add(newGroup); newGroup.setColor(ChatColor.getByCode(Integer.parseInt(data[1]))); if (Kikkit.IsDebugging) Kikkit.MinecraftLog.info(" Added group: " + newGroup.getName()); if (data.length > 2) { String[] commands = data[2].split(","); // TODO: Why must we do a foreach here? // Because java doesn't understand IEnumerable for (String str : commands) { if (Kikkit.IsDebugging) Kikkit.MinecraftLog.info(" command: " + str); newGroup.Commands.add(str); } } } } } catch (Exception e) { // TODO Auto-generated catch block // e.printStackTrace(); Kikkit.MinecraftLog.info(e.getMessage()); } finally { if (scanner != null) scanner.close(); } }
/* * Loads a concept group from XML element */ private Group loadGroup(Element element) { Group group = new Group(); group.name = element.getAttributeValue("name"); List children = element.getChildren("concept"); for (Iterator it = children.iterator(); it.hasNext(); ) { Concept concept = new Concept(); Element e = (Element) it.next(); concept.id = (e.getAttributeValue("id")); concept.rubric = (e.getAttributeValue("rubric")); group.addConcept(concept); } return group; }
public static void update(Long idGroup, List<SqlRow> gpms) { Group group = Group.findById(idGroup); if (group == null) return; Ebean.beginTransaction(); try { deleteForGroup(idGroup); Integer i = 1; for (SqlRow man : gpms) { Profile prof = Profile.lastProfileByGpmId(man.getLong("gpm")); if (prof == null) continue; CacheClassifier cc = new CacheClassifier( group, i++, prof.gpm.idGpm, prof.name, prof.image, (prof.gender == null) ? null : prof.gender.value, (prof.relationshipStatus == null) ? null : prof.relationshipStatus.status, prof.nFollowers); if (cc.name == null || cc.name.isEmpty()) cc.name = Profile.getLastNotEmptyField(prof.gpm.id, "name"); cc.save(); } Ebean.commitTransaction(); } finally { Ebean.endTransaction(); } }
private void recordUnidentifiableModifiedResidues(List<ModifiedCompound> modComps) { Set<StructureGroup> identifiedComps = new HashSet<StructureGroup>(); for (ModifiedCompound mc : modComps) { identifiedComps.addAll(mc.getGroups(true)); } // TODO: use the ModifiedAminoAcid after Andreas add that. for (Group group : residues) { if (group.getType().equals(GroupType.HETATM)) { StructureGroup strucGroup = StructureUtil.getStructureGroup(group, true); if (!identifiedComps.contains(strucGroup)) { unidentifiableModifiedResidues.add(strucGroup); } } } }
public static List<Group> getAllGroups() { List<Group> groups = new ArrayList<Group>(); List<Map<String, Object>> rows = null; rows = getJdbcTemplate().queryForList(GET_ALL_GROUPS); if (rows != null) { for (Map row : rows) { String name = (String) row.get(UserRowMapper.USER_FULL_NAME_COLUMN); if (StringUtils.isNotBlank(name)) { Group group = new Group(); group.name = name; groups.add(group); } } } return groups; }
public static Group findOrCreate(String name) { Group it = Group.find("name", name).first(); if (it == null) { it = new Group(name); } return it; }
public boolean rename(String newName) { String newObjName = Group.substractObjectName(newName); String oldObjName = Group.substractObjectName(getName()); if (!oldObjName.equals(newObjName)) { getParent().removeObject(oldObjName); String fullName = StringUtils.replaceEnding(getName(), oldObjName, newObjName); name = fullName; getParent().addSubObject(newObjName, this); } // move if needed moveToGroup(Group.substractParentName(newName)); return true; }
public void destroy() { super.destroy(); if (getParent() != null) getParent().removeObject(Group.substractObjectName(name)); if (!startVertex.isDestroyed()) startVertex.destroy(); if (!endVertex.isDestroyed()) endVertex.destroy(); }
/** * Record unidentifiable atom linkages in a chain. Only linkages between two residues or one * residue and one ligand will be recorded. */ private void recordUnidentifiableAtomLinkages( List<ModifiedCompound> modComps, List<Group> ligands) { // first put identified linkages in a map for fast query Set<StructureAtomLinkage> identifiedLinkages = new HashSet<StructureAtomLinkage>(); for (ModifiedCompound mc : modComps) { identifiedLinkages.addAll(mc.getAtomLinkages()); } // record // cross link int nRes = residues.size(); for (int i = 0; i < nRes - 1; i++) { Group group1 = residues.get(i); for (int j = i + 1; j < nRes; j++) { Group group2 = residues.get(j); List<Atom[]> linkages = StructureUtil.findAtomLinkages(group1, group2, true, bondLengthTolerance); for (Atom[] atoms : linkages) { StructureAtomLinkage link = StructureUtil.getStructureAtomLinkage(atoms[0], true, atoms[1], true); unidentifiableAtomLinkages.add(link); } } } // attachment int nLig = ligands.size(); for (int i = 0; i < nRes; i++) { Group group1 = residues.get(i); for (int j = 0; j < nLig; j++) { Group group2 = ligands.get(j); if (group1.equals(group2)) { // overlap between residues and ligands continue; } List<Atom[]> linkages = StructureUtil.findAtomLinkages(group1, group2, false, bondLengthTolerance); for (Atom[] atoms : linkages) { StructureAtomLinkage link = StructureUtil.getStructureAtomLinkage(atoms[0], true, atoms[1], false); unidentifiableAtomLinkages.add(link); } } } }
GroupInvite(User sender, User receiver, Group group) { this.sender = sender; this.receiver = receiver; this.group = group; this.text = "<a href = profile.jsp?ID=" + sender.getID() + ">" + sender.getDisplayName() + "</a>" + " has invited you to join " + "<a href profile.jsp?ID=" + group.getID() + ">" + group.getDisplayName() + "</a>"; type = "GroupInvite"; }
private void loadPlayers() { FileInputStream inputStream; InputStreamReader reader; Scanner scanner = null; try { inputStream = new FileInputStream(currentPlayerFileName); reader = new InputStreamReader(inputStream, "UTF-8"); scanner = new Scanner(reader); String line = ""; while (scanner.hasNextLine()) { line = scanner.nextLine(); // Check for comments. if (line.startsWith("#") || line.startsWith("//")) continue; String[] data = line.split(":"); if (data.length < 2) continue; if (data.length == 2) { Group group = getGroup(data[1]); if (group == null) { // TODO: Log here continue; } group.Players.add(data[0]); if (Kikkit.IsDebugging) Kikkit.MinecraftLog.info(" Added player to " + group.getName() + ": " + data[0]); } } } catch (Exception e) { // TODO Auto-generated catch block // e.printStackTrace(); Kikkit.MinecraftLog.info(e.getMessage()); } finally { if (scanner != null) scanner.close(); } }
private GroupIndex( Group group, String indexName, Integer indexId, Boolean isUnique, Boolean isPrimary, JoinType joinType) { super(group.getName(), indexName, indexId, isUnique, isPrimary, null, joinType); this.group = group; }
public void findStudentResult(String name) { System.out.println("Student name:" + name); Map<Subject, Double> subjectDoubleMap = new HashMap<>(); Map<Subject, Integer> subjectIntegerMap = new HashMap<>(); /** * бежим по группам с типом результатов double и ищем студента если есть, то записываем в * subjectDoubleMap */ for (Group<Double> indexDGroup : dGroups) { if (indexDGroup.getEvalByName(name) == null) { continue; } else { subjectDoubleMap.put(indexDGroup.getSubject(), indexDGroup.getEvalByName(name)); } } /* * результируюзщий map не пустой, то выводим на экран * */ if (!subjectDoubleMap.isEmpty()) { System.out.println(subjectDoubleMap); double max1 = Collections.max(subjectDoubleMap.values()); for (Subject s : subjectDoubleMap.keySet()) { if (subjectDoubleMap.get(s) == max1) { System.out.println(s + ":" + max1); } } } /** * бежим по группам с типом результатов integer и ищем студента если есть, то записываем в * subjectDoubleMap */ for (Group<Integer> indexIGroup : iGroups) { if (indexIGroup.getEvalByName(name) == null) { continue; } else { subjectIntegerMap.put(indexIGroup.getSubject(), indexIGroup.getEvalByName(name)); } } if (!subjectIntegerMap.isEmpty()) { System.out.println(subjectIntegerMap); int max2 = Collections.max(subjectIntegerMap.values()); for (Subject s : subjectIntegerMap.keySet()) { if (subjectIntegerMap.get(s) == max2) { System.out.println(s + ":" + max2); } } } }
/** * Insert the method's description here. Creation date: (28.1.2001 13:12:23) * * @param field com.cosylab.vdct.vdb.VDBFieldData */ public void fieldValueChanged(VDBFieldData field) { Record visualRecord = (Record) Group.getRoot().findObject(getName(), true); if (visualRecord == null) { // com.cosylab.vdct.Console.getInstance().println("o) Internal error: no visual representation // of record "+getName()+" found."); return; } com.cosylab.vdct.inspector.InspectorManager.getInstance().updateProperty(visualRecord, field); visualRecord.fieldChanged(field); }
/** * Insert the method's description here. Creation date: (9.12.2000 18:13:17) * * @param newComment java.lang.String */ public void setComment(java.lang.String newComment) { comment = newComment; Inspectable visualObj = (Inspectable) Group.getRoot().findObject(getName(), true); if (visualObj == null) { // com.cosylab.vdct.Console.getInstance().println("o) Internal error: no visual representation // of record "+getName()+" found."); return; } com.cosylab.vdct.inspector.InspectorManager.getInstance().updateCommentProperty(visualObj); }
private Composite createScrollArea(Composite parent) { Group container = new Group(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = layout.marginHeight = 6; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; container.setLayoutData(gd); container.setText(PDEUIMessages.ImportWizard_DetailedPage_filter); Label filterLabel = new Label(container, SWT.NONE); filterLabel.setText(PDEUIMessages.ImportWizard_DetailedPage_search); fFilterText = new Text(container, SWT.BORDER); fFilterText.setText(""); // $NON-NLS-1$ gd = new GridData(GridData.FILL_HORIZONTAL); fFilterText.setLayoutData(gd); return container; }
public boolean canUseCommand(String player, String command) { if (Kikkit.IsDebugging) Kikkit.MinecraftLog.info("Groups to search: " + groups.size()); for (Group group : groups) { if (Kikkit.IsDebugging) Kikkit.MinecraftLog.info(" canUseCommand is looking at " + group.getName()); boolean ingroup = group.isInGroup(player); boolean canuse = group.canUseCommand(command); if (Kikkit.IsDebugging) { Kikkit.MinecraftLog.info(" isInGroup: " + ingroup); Kikkit.MinecraftLog.info(" canUseCommand: " + canuse); } // if(group.isInGroup(player) && group.canUseCommand(command)) return true; if (ingroup && canuse) return true; } return false; }