query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Collect only objects modified since a certain date
private static void collectObjectDataModifiedSinceDate(Date collectionTime, Integer numberOfDays) { List<String> hosts = Arrays.asList(ecsHosts.split(",")); // instantiate billing BO BillingBO billingBO = new BillingBO( ecsMgmtAccessKey, ecsMgmtSecretKey, hosts, ecsMgmtPort, null, // dao is not required in this case objectCount ); // Instantiate DAO ObjectDAO objectDAO = null; if(!elasticHosts.isEmpty()) { // Instantiate ElasticSearch DAO ElasticDAOConfig daoConfig = new ElasticDAOConfig(); daoConfig.setHosts(Arrays.asList(elasticHosts.split(","))); daoConfig.setPort(elasticPort); daoConfig.setClusterName(elasticCluster); daoConfig.setCollectionTime(collectionTime); daoConfig.setCollectionType(EcsCollectionType.object); initXPackConfig(daoConfig); objectDAO = new ElasticS3ObjectDAO(daoConfig); // init indexes objectDAO.initIndexes(collectionTime); } else { // Instantiate file DAO objectDAO = new FileObjectDAO(); } ObjectBO objectBO = new ObjectBO(billingBO, hosts, objectDAO, threadPoolExecutor, futures, objectCount ); // query criteria should look like ( LastModified >= 'since date' ) Date sinceDate = new Date( (collectionTime.getTime() - (TimeUnit.MILLISECONDS.convert(numberOfDays, TimeUnit.DAYS)) )); String yesterdayDateTime = DATA_DATE_FORMAT.format( sinceDate ); String queryCriteria = "( " + ECS_OBJECT_LAST_MODIFIED_MD_KEY + " >= '" + yesterdayDateTime + "' )"; // Start collection objectBO.collectObjectData(collectionTime, queryCriteria); objectBO.shutdown(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Date getModifiedDate();", "public Date getModifiedDate();", "public Date getModifiedDate();", "public Date getDateModified();", "ImmutableList<SchemaOrgType> getDateModifiedList();", "public Date getDateModifed(){return dateModified;}", "public Date getUpdatedOn();", "@Override\n\tpublic Date getModifiedDate();", "@Override\n\tpublic Date getModifiedDate();", "@RequestMapping(path=\"/resources\", method=RequestMethod.GET)\n public @ResponseBody List<Level> getDateBased(@RequestParam(\"modifiedafter\") String date, HttpServletResponse response) {\n List<Node> nodes = jdbct.getModifiedAfter(date);\n return convertNodeListToLevelList(nodes);\n }", "public Date getModificationTime()\n {\n return modified;\n }", "public String lastModifiedAll() {\n\t\tNSTimestamp lastMod = null;\n\t\tNSTimestamp\ttoday = new NSTimestamp();\n\n\t\tEnumeration enumer = allChildren().objectEnumerator();\n\t\twhile(enumer.hasMoreElements()) {\n\t\t\tItem anItem = (Item)enumer.nextElement();\n\t\t\tif(lastMod == null) {\n\t\t\t\tlastMod = anItem.lastdiffed();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(lastMod.compare(anItem.lastdiffed()) < 0) {\n\t\t\t\t\tlastMod = anItem.lastdiffed();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn elapsedTimeSimple(lastMod, today);\n\t}", "@Override\n public Set PatientsOlderThenEnlistedAfter() {\n Set<Patient> patients = new HashSet<>();\n patientRepository.findAll().forEach(patients::add);\n Set<Patient>olderThanEnlistedSince = new HashSet<>();\n if(patients != null)\n {\n patients.forEach((patient) ->\n {\n if(patient.getAge() > 21 && patient.getEnlistmentDate().after(new Date(01-01-2020))){\n olderThanEnlistedSince.add(patient);\n }else {\n System.out.println(\"No patients older than 21 enlisted after 1.1.2020.\");\n }\n });\n }\n\n return olderThanEnlistedSince;\n }", "Builder addDateModified(Date value);", "public Date getModifiedDate() {\r\n return modifiedDate;\r\n }", "public Date getModifiedDate() {\r\n return modifiedDate;\r\n }", "public void setDateModified(Date dateModified);", "public Date getModifiedDate() {\n return modifiedDate;\n }", "Set<Modification> filterModifications(ModificationHolder modificationHolder, Set<Modification> modifications);", "public Date getModifieddate() {\n return modifieddate;\n }", "private ArrayList<Task> filterByDate(ArrayList<Task> toFilter, Date date) {\n ArrayList<Integer> toDelete = new ArrayList<Integer>();\n Calendar calAim = Calendar.getInstance();\n Calendar calTest = Calendar.getInstance();\n calAim.setTime(date);\n\n //remove all on different dates\n for (int i = 0; i < toFilter.size(); i++) {\n if (toFilter.get(i).getClass().equals(Deadline.class)) {\n Deadline temp = (Deadline) toFilter.get(i);\n calTest.setTime(temp.getTime());\n } else if (toFilter.get(i).getClass().equals(Event.class)) {\n Event temp = (Event) toFilter.get(i);\n calTest.setTime(temp.getTime());\n } else if (toFilter.get(i).getClass().equals(Period.class)) {\n Period temp = (Period) toFilter.get(i);\n calTest.setTime(temp.getStart());\n }\n boolean sameDay = calAim.get(Calendar.DAY_OF_YEAR) == calTest.get(Calendar.DAY_OF_YEAR)\n && calAim.get(Calendar.YEAR) == calTest.get(Calendar.YEAR);\n if (!sameDay) {\n toDelete.add(i);\n }\n }\n\n for (int i = toDelete.size() - 1; i >= 0; ) {\n toFilter.remove((int) toDelete.get(i));\n i--;\n }\n return toFilter;\n }", "public InstantFilter getLastModifiedDate() {\n\t\treturn lastModifiedDate;\n\t}", "XMLGregorianCalendar getModified();", "public void setModifiedDate(Date modifiedDate);", "public void setModifiedDate(Date modifiedDate);", "public void setModifiedDate(Date modifiedDate);", "public Set getModified() {\r\n return Collections.unmodifiableSet(modified);\r\n }", "Builder addDateModified(DateTime value);", "public Date getModifiedDate() {\n return this.modifiedDate;\n }", "public Date getModifiedDate() {\n return this.modifiedDate;\n }", "public long getModificationTime();", "Date getModifyDate();", "private Iterable<File> findUpdateFilesAfter(long minimumLastModified) {\r\n\t\t String dataFileName = dataFile.getName();\r\n\t\t int period = dataFileName.indexOf('.');\r\n\t\t String startName = period < 0 ? dataFileName : dataFileName.substring(0, period);\r\n\t\t File parentDir = dataFile.getParentFile();\r\n\t\t Map<Long, File> modTimeToUpdateFile = new TreeMap<Long,File>();\r\n\t\t for (File updateFile : parentDir.listFiles()) {\r\n\t\t String updateFileName = updateFile.getName();\r\n\t\t if (updateFileName.startsWith(startName)\r\n\t\t && !updateFileName.equals(dataFileName)\r\n\t\t && updateFile.lastModified() >= minimumLastModified) {\r\n\t\t modTimeToUpdateFile.put(updateFile.lastModified(), updateFile);\r\n\t\t }\r\n\t\t }\r\n\t\t return modTimeToUpdateFile.values();\r\n\t\t }", "Date getDateUpdated();", "public Date getModified() {\r\n\t\treturn modified;\r\n\t}", "public Date getModifiedon()\n {\n return (Date)getAttributeInternal(MODIFIEDON);\n }", "public Date getDATE_MODIFIED() {\r\n return DATE_MODIFIED;\r\n }", "public Date getDATE_MODIFIED() {\r\n return DATE_MODIFIED;\r\n }", "public Date getDATE_MODIFIED() {\r\n return DATE_MODIFIED;\r\n }", "public Date getMODIFIED_DATE() {\r\n return MODIFIED_DATE;\r\n }", "public boolean canHaveAsModificationTime(Date date) {\r\n return (date == null) ||\r\n ( (date.getTime() >= getCreationTime().getTime()) &&\r\n (date.getTime() <= System.currentTimeMillis()) );\r\n }", "public void setModified(Date v) \n {\n \n if (!ObjectUtils.equals(this.modified, v))\n {\n this.modified = v;\n setModified(true);\n }\n \n \n }", "public List<PartDto> getAllPartsModify(LocalDate date, Integer order) throws Exception {\n List<Part> result = this.repoParts.findByLastModificationAfter(date);\n if(order > 0){\n orderParts(order, result);\n }\n return mapper.mapList(result, false);\n }", "public java.util.Date getDateModified(){\r\n\t\treturn dateModified;\r\n\t}", "public void setModifiedDate(Date value) {\n this.modifiedDate = value;\n }", "public void setModifiedDate(Date value) {\n this.modifiedDate = value;\n }", "Date getUpdatedDate();", "@Override\n\tpublic Date getModifiedDate() {\n\t\treturn _changesetEntry.getModifiedDate();\n\t}", "public void updateDateModified() {\n dateModified = DateTime.now();\n }", "public DateAdp Modified_latest() {return modified_latest;}", "public List<DBObject> WhichWatch();", "List<ChangedFile> getChangedFiles(Project project);", "List<NotificationEntity> findUnseenRecentByLogin(String login, Date date);", "public Date getModifiedBy() {\n return modifiedBy;\n }", "public Date getModifiedDate() {\n\t\treturn modifiedDate;\n\t}", "public List getModifications(Date lastBuild, Date now) {\n //(PENDING) extract buildHistoryCommand, execHistoryCommand\n // See CVSElement\n \n \t\t//call vss, write output to intermediate file\n String[] cmdArray = {\"ss.exe\", \"history\", ssdir, \"-R\", \"-Vd\" +\n formatDateForVSS(now) + \"~\" + formatDateForVSS(lastBuild),\n \"-Y\" + login, \"-I-N\", \"-O\" + VSS_TEMP_FILE};\n \t\ttry {\n \t\t\tProcess p = Runtime.getRuntime().exec(cmdArray);\n \t\t\tp.waitFor();\n \n \t\t\tBufferedReader reader = new BufferedReader(new FileReader(\n new File(VSS_TEMP_FILE)));\n \n \t\t\tString currLine = reader.readLine();\n \t\t\twhile (currLine != null) {\n \t\t\t\tif (currLine.startsWith(\"***** \")) {\n \t\t\t\t\tArrayList vssEntry = new ArrayList();\n \t\t\t\t\tvssEntry.add(currLine);\n \t\t\t\t\tcurrLine = reader.readLine();\n \t\t\t\t\twhile (currLine != null && !currLine.startsWith(\"***** \")) {\n \t\t\t\t\t\tvssEntry.add(currLine);\n \t\t\t\t\t\tcurrLine = reader.readLine();\n \t\t\t\t\t}\n Modification mod = handleEntry(vssEntry);\n if(mod != null)\n modifications.add(mod);\n \t\t\t\t} else {\n \t\t\t\t\tcurrLine = reader.readLine();\n \t\t\t\t}\n \t\t\t}\n \n \t\t\treader.close();\n \t\t\tnew File(VSS_TEMP_FILE).delete();\n \t\t} catch (Exception e) {\n \t\t\te.printStackTrace();\n \t\t}\n \n \t\tif (_property != null && modifications.size() > 0) {\n _properties.put(_property, \"true\");\n \t\t}\n \n \t\treturn modifications;\n \t}", "@Override\n\tpublic java.util.Date getModifiedDate() {\n\t\treturn _candidate.getModifiedDate();\n\t}", "public List<Pipeline> getAllUpdatedPipelines() {\n List<Pipeline> pipelines = (List<Pipeline>) this.pipelineService.getAll().getEntity();\n\n List<Pipeline> filteredPipelines = pipelines\n .stream()\n .filter(p -> p.areMaterialsUpdated() && (p.getStatus() == PipelineStatus.IN_PROGRESS) && !(p.isPrepared()))\n .sorted((p1, p2) -> p1.getStartTime().compareTo(p2.getStartTime()))\n .collect(Collectors.toList());\n\n return filteredPipelines;\n }", "void optimizeTimestamps(TRepo repo);", "@Override\n\tpublic Date getModifiedDate() {\n\t\treturn model.getModifiedDate();\n\t}", "@Override\n\tpublic Date getModifiedDate() {\n\t\treturn model.getModifiedDate();\n\t}", "@Override\n\tpublic Date getModifiedDate() {\n\t\treturn model.getModifiedDate();\n\t}", "public List<cn.edu.nju.teamwiki.jooq.tables.pojos.Document> fetchByModifiedTime(LocalDateTime... values) {\n return fetch(Document.DOCUMENT.MODIFIED_TIME, values);\n }", "Set<VisitedResource> getVisitingStatistic(Date date);", "@java.lang.Override\n public com.google.protobuf.TimestampOrBuilder getModifiedAtOrBuilder() {\n return getModifiedAt();\n }", "public Date getModificationTime()\n\t{\n\t\treturn modificationTime;\n\t}", "@Override\n\tpublic Date getModifiedDate() {\n\t\treturn _second.getModifiedDate();\n\t}", "public OccurrenceInfoCollection getModifiedOccurrences()\n\t\t\tthrows ServiceLocalException {\n\t\treturn (OccurrenceInfoCollection) this.getPropertyBag()\n\t\t\t\t.getObjectFromPropertyDefinition(\n\t\t\t\t\t\tAppointmentSchema.ModifiedOccurrences);\n\t}", "Date getWorkfileLastChangedDate();", "public Timestamp getModifiedDate() {\r\n return (Timestamp) getAttributeInternal(MODIFIEDDATE);\r\n }", "ImmutableList<SchemaOrgType> getDateCreatedList();", "@Test\n public void testGetOrdersByDate() {\n\n LocalDate ld = LocalDate.parse(\"2017-06-23\");\n List<Order> orderListByDate = service.getOrdersByDate(ld);\n List<Order> filteredList = new ArrayList<>();\n\n for (Order currentOrder : orderListByDate) {\n if (currentOrder.getOrderDate().contains(\"06232017\")) {\n filteredList.add(currentOrder);\n }\n }\n\n assertEquals(2, filteredList.size());\n }", "public java.sql.Timestamp getModified() throws java.rmi.RemoteException, javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException {\n return (((java.sql.Timestamp) __getCache(\"modified\")));\n }", "@Override\n\tpublic Date getModifiedDate() {\n\t\treturn _userTracker.getModifiedDate();\n\t}", "public Set getCreated() {\r\n return Collections.unmodifiableSet(created);\r\n }", "private List<Event> getEventsOnDate(Date date) {\r\n List<Event> eventsOnDate = new ArrayList<>();\r\n for (Event event : this.events) {\r\n if (event.getDate().equals(date)) {\r\n eventsOnDate.add(event);\r\n }\r\n }\r\n\r\n return eventsOnDate;\r\n }", "public Date getModifyDate() {\n return modifyDate;\n }", "public Date getModifyDate() {\n return modifyDate;\n }", "public Date getModifyDate() {\n return modifyDate;\n }", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public Timestamp getUpdated();", "public abstract Date getChanged(int lineNumber);", "@Override\n\tpublic void setModifiedDate(Date modifiedDate);", "@Override\n\tpublic void setModifiedDate(Date modifiedDate);", "public boolean isStatusdateModified() {\n return statusdate_is_modified; \n }", "@Raw @Basic\r\n public Date getModificationTime() {\r\n return modificationTime;\r\n }", "public Date getModifiedTime() {\n return modifiedTime;\n }", "@Override\n\tpublic Date getModifiedDate() {\n\t\treturn _paper.getModifiedDate();\n\t}", "public Date getModificationDate() {\r\n\t\treturn oModificationDate;\r\n\t}" ]
[ "0.62957585", "0.62957585", "0.62957585", "0.62254167", "0.6113187", "0.60876054", "0.58535606", "0.57148564", "0.57148564", "0.5691028", "0.5670661", "0.5667204", "0.5663733", "0.56464654", "0.5604172", "0.5604172", "0.5588063", "0.55680174", "0.55575347", "0.5534625", "0.5521785", "0.5508365", "0.54646564", "0.5456134", "0.5456134", "0.5456134", "0.5440802", "0.54348445", "0.54293436", "0.54293436", "0.5418675", "0.5387895", "0.5382834", "0.5382093", "0.5358438", "0.5354249", "0.53506815", "0.53506815", "0.53506815", "0.53499204", "0.53253704", "0.53234583", "0.5290325", "0.5288936", "0.5288494", "0.5288494", "0.52834344", "0.52792716", "0.52749074", "0.5269704", "0.52528775", "0.5252445", "0.52501565", "0.5245711", "0.5234479", "0.5234223", "0.52327716", "0.5221246", "0.5202932", "0.5201868", "0.5201868", "0.5201868", "0.5201193", "0.5183864", "0.51615727", "0.515791", "0.51549333", "0.51396483", "0.5131571", "0.5131545", "0.5129656", "0.51204586", "0.5117009", "0.51127774", "0.5111384", "0.51032174", "0.5099263", "0.5099263", "0.5099263", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.50990754", "0.5094202", "0.5090499", "0.5090499", "0.50895464", "0.5088166", "0.50874317", "0.50805783", "0.5080155" ]
0.59265375
6
Collects object version data
private static void collectObjectVersionData(Date collectionTime) { List<String> hosts = Arrays.asList(ecsHosts.split(",")); // instantiate billing BO BillingBO billingBO = new BillingBO( ecsMgmtAccessKey, ecsMgmtSecretKey, hosts, ecsMgmtPort, null, // dao is not required in this case objectCount ); // Instantiate DAO ObjectDAO objectDAO = null; if(!elasticHosts.isEmpty()) { // Instantiate ElasticSearch DAO ElasticDAOConfig daoConfig = new ElasticDAOConfig(); daoConfig.setHosts(Arrays.asList(elasticHosts.split(","))); daoConfig.setPort(elasticPort); daoConfig.setClusterName(elasticCluster); daoConfig.setCollectionTime(collectionTime); daoConfig.setCollectionType(EcsCollectionType.object_version); initXPackConfig(daoConfig); objectDAO = new ElasticS3ObjectDAO(daoConfig); // init indexes objectDAO.initIndexes(collectionTime); } else { // Instantiate file DAO objectDAO = new FileObjectDAO(); } ObjectBO objectBO = new ObjectBO(billingBO, hosts, objectDAO, threadPoolExecutor, futures, objectCount ); //objectBO. // Start collection objectBO.collectObjectVersionData(collectionTime); objectBO.shutdown(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected VersionData() {}", "public interface ObjectVersionReference {\n\n /**\n * Gets the ObjectReference object that encapsualtes everything about\n * the underlying Fedora 3 object.\n */\n public ObjectReference getObject();\n\n /**\n * Gets all the basic object information. This is unversioned information.\n */\n public ObjectInfo getObjectInfo();\n\n /**\n * Gets all the object properties. This is unversioned information.\n */\n public ObjectProperties getObjectProperties();\n\n /**\n * Gets the lastModifiedDate proeperty for this version. This is formatted as\n * all Fedora 3 dates are formatted.\n */\n public String getVersionDate();\n\n /**\n * Lists the current version of all datastreams changed from the pervious version\n * to this one.\n * @return a List containing a DatastreamVersion for each datastream that changed\n * from the last version to this one.\n */\n public List<DatastreamVersion> listChangedDatastreams();\n\n /**\n * Indicates whether this is the first version.\n */\n public boolean isLastVersion();\n\n /**\n * Indicates whether this is the last version.\n */\n public boolean isFirstVersion();\n\n /**\n * Gets the version index (0 for first, 1 for second, etc.) in chronological\n * order from oldest to newest.\n */\n public int getVersionIndex();\n\n /**\n * Determines whether a datastream with the given DSID changed as part of the\n * update that contributed to this version.\n */\n public boolean wasDatastreamChanged(String dsId);\n}", "@Override\n\tpublic void getDatas() {\n\t\tAutoUpdate autoUpdate=new AutoUpdate();\n\t\tautoUpdate.getVersionData(this, \"0\");\n\t}", "boolean visitVersionable(Object o);", "public static Iterator getVersionables(Object o) {\r\n checkVersionable(o);\r\n Collection c = new ArrayList();\r\n Field[] fields = o.getClass().getFields();\r\n for (int i = 0; i < fields.length; i++) {\r\n Field field = fields[i];\r\n if (field.getName().equals(Instrumentor.VERSIONFIELD) ||\r\n field.getType().isPrimitive())\r\n continue;\r\n Object fieldObject;\r\n try {\r\n fieldObject = field.get(o);\r\n } catch (Exception e) {\r\n continue;\r\n }\r\n if (isVersionable(fieldObject)) {\r\n c.add(fieldObject);\r\n }\r\n }\r\n return c.iterator();\r\n }", "public VersionInfoExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "@SuppressWarnings(\"unused\")\n\tprivate void version() {\n\n\t}", "@Override\n public String toString() {\n return versionString;\n }", "private static void traverseVersionable(Object o, SmartVisitor visitor) {\r\n checkVersionable(o);\r\n if (!visitor.visitVersionable(o)) return;\r\n for (Iterator it = getVersionables(o); it.hasNext(); ) {\r\n traverseGraph(it.next(), visitor);\r\n }\r\n }", "@Test\n public void testVersioningInitialState() {\n\n String id = objService.createDocument(repositoryId, createBaseDocumentProperties(\"newdoc2\", \"cmis:document\"),\n rootFolderId, null, VersioningState.MAJOR, null, null, null, null);\n ObjectData ob = getObject(id);\n\n checkValue(PropertyIds.IS_LATEST_VERSION, Boolean.TRUE, ob);\n checkValue(PropertyIds.IS_MAJOR_VERSION, Boolean.TRUE, ob);\n checkValue(PropertyIds.IS_LATEST_MAJOR_VERSION, Boolean.TRUE, ob);\n checkValue(PropertyIds.VERSION_LABEL, \"1.0\", ob);\n checkValue(PropertyIds.VERSION_SERIES_ID, NOT_NULL, ob);\n checkValue(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, Boolean.FALSE, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, null, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, null, ob);\n checkValue(PropertyIds.CHECKIN_COMMENT, null, ob);\n checkValue(NuxeoTypeHelper.NX_ISVERSION, Boolean.FALSE, ob); // ...\n\n // copy from checked in source as checked out\n\n id = objService.createDocumentFromSource(repositoryId, id, null, rootFolderId, VersioningState.CHECKEDOUT, null,\n null, null, null);\n ob = getObject(id);\n checkValue(PropertyIds.IS_LATEST_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.IS_MAJOR_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.IS_LATEST_MAJOR_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.VERSION_LABEL, null, ob);\n checkValue(PropertyIds.VERSION_SERIES_ID, NOT_NULL, ob);\n checkValue(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, Boolean.TRUE, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, id, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, USERNAME, ob);\n checkValue(PropertyIds.CHECKIN_COMMENT, null, ob);\n checkValue(NuxeoTypeHelper.NX_ISVERSION, Boolean.FALSE, ob);\n\n // creation as minor version\n\n id = objService.createDocument(repositoryId, createBaseDocumentProperties(\"newdoc2\", \"cmis:document\"),\n rootFolderId, null, VersioningState.MINOR, null, null, null, null);\n ob = getObject(id);\n\n checkValue(PropertyIds.IS_LATEST_VERSION, Boolean.TRUE, ob);\n checkValue(PropertyIds.IS_MAJOR_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.IS_LATEST_MAJOR_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.VERSION_LABEL, \"0.1\", ob);\n checkValue(PropertyIds.VERSION_SERIES_ID, NOT_NULL, ob);\n checkValue(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, Boolean.FALSE, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, null, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, null, ob);\n checkValue(PropertyIds.CHECKIN_COMMENT, null, ob);\n checkValue(NuxeoTypeHelper.NX_ISVERSION, Boolean.FALSE, ob); // ...\n\n // creation checked out\n\n id = objService.createDocument(repositoryId, createBaseDocumentProperties(\"newdoc3\", \"cmis:document\"),\n rootFolderId, null, VersioningState.CHECKEDOUT, null, null, null, null);\n ob = getObject(id);\n\n checkValue(PropertyIds.IS_LATEST_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.IS_MAJOR_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.IS_LATEST_MAJOR_VERSION, Boolean.FALSE, ob);\n checkValue(PropertyIds.VERSION_LABEL, null, ob);\n checkValue(PropertyIds.VERSION_SERIES_ID, NOT_NULL, ob);\n checkValue(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, Boolean.TRUE, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, id, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, USERNAME, ob);\n checkValue(PropertyIds.CHECKIN_COMMENT, null, ob);\n checkValue(NuxeoTypeHelper.NX_ISVERSION, Boolean.FALSE, ob);\n\n // copy from checked out source as checked in\n\n id = objService.createDocumentFromSource(repositoryId, id, null, rootFolderId, VersioningState.MAJOR, null,\n null, null, null);\n ob = getObject(id);\n checkValue(PropertyIds.IS_LATEST_VERSION, Boolean.TRUE, ob);\n checkValue(PropertyIds.IS_MAJOR_VERSION, Boolean.TRUE, ob);\n checkValue(PropertyIds.IS_LATEST_MAJOR_VERSION, Boolean.TRUE, ob);\n checkValue(PropertyIds.VERSION_LABEL, \"1.0\", ob);\n checkValue(PropertyIds.VERSION_SERIES_ID, NOT_NULL, ob);\n checkValue(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, Boolean.FALSE, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, null, ob);\n checkValue(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, null, ob);\n checkValue(PropertyIds.CHECKIN_COMMENT, null, ob);\n checkValue(NuxeoTypeHelper.NX_ISVERSION, Boolean.FALSE, ob); // ...\n }", "@Override\n public List<List<Integer>> getObjectInfo() {\n List<List<Integer>> currObjectConfig = getVisualInfoFromPieces(OBJECT_INFO_IDENTIFIER);\n return Collections.unmodifiableList(currObjectConfig);\n }", "com.google.protobuf.ByteString getVersion();", "public ObjectInfo getObjectInfo();", "public interface FS2MetaSnapshot {\r\n\r\n Date createdOn();\r\n\r\n String createdBy();\r\n \r\n void dump(PrintStream printStream);\r\n\r\n // obtain a single header\r\n String[] getHeader(String key);\r\n\r\n // get the set of all header names\r\n Set<String> getHeaderNames();\r\n\r\n // set of key/value pairs providing metadata for this object\r\n FS2ObjectHeaders getHeaders();\r\n\r\n URI getURI();\r\n\r\n // when was this snapshot taken?\r\n Date snapshotTime();\r\n\r\n // TODO add these later... should be pluggable config...\r\n // boolean isEncrypted();\r\n // boolean isCompressed();\r\n\r\n // JSON representation of this snapshot\r\n String toJSON();\r\n\r\n}", "@Override\n\tpublic boolean supportsVersioning()\n\t{\n\t\treturn true;\n\t}", "com.google.protobuf.ByteString\n getVersionBytes();", "com.google.protobuf.ByteString\n getVersionBytes();", "com.google.protobuf.ByteString\n getVersionBytes();", "@Override\n\tpublic void setVersions(SsaForm obj){\n\n\t\tAbstractBaseExt defSymbol = (AbstractBaseExt) resolve(getContext().getText());\n\t\tString str=allHdrFieldsMap.get(defSymbol);\n\t\tif(str!=null) {\n\t\t\tmapUsedStructFields.put(defSymbol, str);\n\t\t}\n\t\tif(obj.getParentCtx() instanceof IfStatementContextExt){\n\t\t\tif(obj.getMinMap().get(defSymbol)==null) {\n\t\t\t\tobj.getMinMap().put(defSymbol, defSymbol.getVersion());\n\t\t\t}\n\t\t} else {\n\t\t\tobj.getMinMap().put(defSymbol, defSymbol.getVersion());\n\t\t}\n\n\t\tdefSymbol.incVersion();\n\t\tthis.ssaVersion=defSymbol.getVersion();\n\t\tList<Pair<AbstractBaseExt,AbstractBaseExt> > tempList=obj.getAllVer().get(defSymbol);\n\t\tif(tempList!=null){\n\t\t\ttempList.add(new Pair(getExtendedContext(getContext()),obj.getAssignCtx()));\n\t\t} else {\n\t\t\tList<Pair<AbstractBaseExt,AbstractBaseExt> > newtempList=new ArrayList<>();\n\t\t\tnewtempList.add(new Pair(getExtendedContext(getContext()),obj.getAssignCtx()));\n\t\t\tobj.getAllVer().put(defSymbol, newtempList);\n\t\t}\n\t}", "@java.lang.Override\n public long getVersion() {\n return instance.getVersion();\n }", "ImmutableList<SchemaOrgType> getVersionList();", "public long getVersion(){\n return localVersion;\n }", "com.google.protobuf.ByteString\n getVersionBytes();", "com.google.protobuf.ByteString\n getVersionBytes();", "public void analyzeLifetimeClass(){\n currentClassCommitData = new ArrayList<>();\n String classPath = currentExtractMethod.getRefactoringData().getFileLoc();\n Iterable<RevCommit> commits = null;\n try {\n commits = git.log().addPath(classPath).call();\n } catch (GitAPIException e) {\n e.printStackTrace();\n }\n\n List<RevCommit> orderedList = Utils.reverseIterable(commits);\n for(int i = 0; i < orderedList.size(); i++){\n RevCommit commit = orderedList.get(i);\n Date commitDate = commit.getAuthorIdent().getWhen();\n currentClassCommitData.add(new ClassCommitData(\n commitDate,\n i==0,\n currentExtractMethod.getRefactoringData().getCommitDate().equals(commitDate)));\n }\n }", "public void loadObjData() {\n this.updateGeometryAndUVs(SquareCoords, UVCoords, DrawOrder);\n SquareCoords = new float[0];\n UVCoords = new float[0];\n DrawOrder = new int[0];\n }", "public VersionVO getUnused(){\n return localUnused;\n }", "@Test\n public void getObjectsWithVersioningUsingHelpers() throws IOException, URISyntaxException, InterruptedException {\n final Path tempDirectory = Files.createTempDirectory(Paths.get(\".\"), null);\n\n try {\n HELPERS.ensureBucketExists(TEST_ENV_NAME, envDataPolicyId);\n final String objectName = \"object_with_versions\";\n\n // Put different content for object twice\n loadTestBook(CLIENT, BOOKS[0], objectName, TEST_ENV_NAME); // putting beowulf as content\n loadTestBook(CLIENT, BOOKS[1], objectName, TEST_ENV_NAME); // putting sherlock holmes as content\n\n // Get the version of the objects\n final GetBucketRequest getBucketRequest = new GetBucketRequest(TEST_ENV_NAME).withVersions(true);\n final GetBucketResponse getBucketResponse = CLIENT.getBucket(getBucketRequest);\n\n assertThat(getBucketResponse.getListBucketResult().getObjects().size(), is(0));\n assertThat(getBucketResponse.getListBucketResult().getVersionedObjects().size(), is(2));\n\n // Create bulk get job with the oldest version of the object\n final List<Ds3Object> objects = getBucketResponse.getListBucketResult().getVersionedObjects().stream()\n .filter(obj -> !obj.getIsLatest()) // filters out the latest version of the object\n .map(obj -> new Ds3Object(obj.getKey(), obj.getVersionId()))\n .collect(Collectors.toList());\n\n final Ds3ClientHelpers.Job readJob = HELPERS.startReadJob(TEST_ENV_NAME, objects);\n\n readJob.transfer(new FileObjectGetter(tempDirectory));\n\n // Check content is beowulf, which was the first version of content\n final File originalFile = ResourceUtils.loadFileResource(RESOURCE_BASE_NAME + BOOKS[0]).toFile();\n final File fileCopiedFromBP = Paths.get(tempDirectory.toString(), objectName).toFile();\n assertTrue(FileUtils.contentEquals(originalFile, fileCopiedFromBP));\n\n } finally {\n cancelAllJobsForBucket(CLIENT, TEST_ENV_NAME);\n deleteAllContents(CLIENT, TEST_ENV_NAME);\n FileUtils.deleteDirectory(tempDirectory.toFile());\n }\n }", "@Override\n\tpublic List<String> getVersionDifferences() {\n\t\t\n\t\t\n\t\treturn versionDifferences;\n\t}", "com.google.protobuf.ByteString\n getVersionBytes();", "com.google.protobuf.ByteString\n getVersionBytes();", "com.google.protobuf.ByteString\n getVersionBytes();", "public Number getObjectVersionNumber() {\n return (Number)getAttributeInternal(OBJECTVERSIONNUMBER);\n }", "@java.lang.Override\n public long getVersion() {\n return version_;\n }", "public int getVersion() { return 1; }", "Collection<String> getVersions();", "public abstract String getVersion();", "public abstract String getVersion();", "public abstract String getVersion();", "public com.google.protobuf.ByteString\n getVersionBytes() {\n throw new RuntimeException(\"Must not be called\");\n\n }", "public void collectDeviceInfo(Context context) {\n try {\n PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 1);\n if (packageInfo != null) {\n String string2 = packageInfo.versionName == null ? \"null\" : packageInfo.versionName;\n String string3 = String.valueOf((int)packageInfo.versionCode);\n this.infos.put((Object)\"versionName\", (Object)string2);\n this.infos.put((Object)\"versionCode\", (Object)string3);\n }\n }\n catch (PackageManager.NameNotFoundException var2_5) {\n Log.e((String)\"CrashHandler\", (String)\"an error occured when collect package info\", (Throwable)var2_5);\n }\n Field[] arrfield = Build.class.getDeclaredFields();\n int n = arrfield.length;\n int n2 = 0;\n while (n2 < n) {\n Field field = arrfield[n2];\n try {\n field.setAccessible(true);\n this.infos.put((Object)field.getName(), (Object)field.get((Object)null).toString());\n Log.d((String)\"CrashHandler\", (String)(String.valueOf((Object)field.getName()) + \" : \" + field.get((Object)null)));\n }\n catch (Exception var8_10) {\n Log.e((String)\"CrashHandler\", (String)\"an error occured when collect crash info\", (Throwable)var8_10);\n }\n ++n2;\n }\n return;\n }", "protected raVersionInfo() {\n }", "Object getRev();", "protected abstract void declareVersions();", "public com.google.protobuf.ByteString\n getVersionBytes() {\n throw new UnsupportedOperationException();\n }", "public Date getVersionDate ();", "@SuppressWarnings(\"unused\")\n private Long getVersion() {\n return version;\n }", "private void getInterfaceInfo(JSONObject jsonObj) {\n\t\t@SuppressWarnings(\"unused\")\n\t\tString version = (String) jsonObj.get(\"Version\");\n\t}", "private VersionFactory() {\n\t\tversions = ClassResolverUtils.findImpl(Version.class);\n\t}", "@Override\r\n\tpublic int getVersion() {\n\t\treturn 0;\r\n\t}", "public String getVersionDate();", "public abstract int getVersion();", "@Override\n public int getVersion() {\n return 0;\n }", "java.lang.String getVersion();", "java.lang.String getVersion();", "java.lang.String getVersion();", "java.lang.String getVersion();", "java.lang.String getVersion();", "java.lang.String getVersion();", "java.lang.String getVersion();", "java.lang.String getVersion();", "@Override\n public double getVersion() {\n return 0;\n }", "public java.lang.String getDataModelCatalogueVersion() {\n return dataModelCatalogueVersion;\n }", "private static void checkVersionable(Object o) {\r\n if (!isVersionable(o))\r\n throw new IllegalArgumentException(\"passed non-versionable object\");\r\n }", "public List<String> getVersionList() {\r\n return versionList;\r\n }", "Collection<ComponentState> getVersions();", "public java.lang.String getDataModelCatalogueVersion() {\n return dataModelCatalogueVersion;\n }", "private void writeObject(ObjectOutputStream oos) throws IOException {\n\t\toos.defaultWriteObject();\r\n\t\tGdx.app.log(\"L/S\", \"entityInfoCollector size: \" + manList.size() + \":\" + buildingsList.size() + \":\" + buildingsList.size());\r\n\t\t\r\n\t}", "public ZlnfVersionInfoExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "@Override\n\tpublic String toString() {\n\t\treturn new StringBuilder()\n\t\t\t.append(this.getClass().getSimpleName())\n\t\t\t.append(\" { id:\").append(id)\n\t\t\t.append(\", version:\").append(version)\n\t\t\t.append(\" }\")\n\t\t\t.toString();\n\t}", "public interface Version {\n\n /**\n * Check if this version is a major version.\n * \n * @return true if major version, false if it is a minor version\n */\n boolean isMajor();\n\n /**\n * Check if this version is a private working copy.\n * \n * @return true if it a PWC, false if not\n */\n boolean isPwc();\n\n /**\n * make the private working copy an official version.\n * \n * @param isMajor\n * true if major version, false if it is a minor version\n */\n void commit(boolean isMajor);\n\n /**\n * Set the check.in comment.\n * \n * @param comment\n * check-in comment\n */\n void setCheckinComment(String comment);\n\n /**\n * Get the check-in comment.\n * \n * @return check-in comment\n */\n String getCheckinComment();\n\n /**\n * Get the version label.\n * \n * @return the version label\n */\n String getVersionLabel();\n\n /**\n * Get the versioned document (parent) of this version.\n * \n * @return versioned document\n */\n VersionedDocument getParentDocument();\n}", "@Override\n public double getVersion() {\n return classVersion;\n }", "@Override\n public String getVersionString() {\n return versionString;\n }", "public java.util.List<String> getVersions() {\n if (versions == null) {\n versions = new java.util.ArrayList<String>();\n }\n return versions;\n }", "@Override\n public HashedVersion getEndVersion() {\n return getSnapshot().getHashedVersion();\n }", "public String getVersion(){\r\n return version;\r\n }", "public short getVersions()\n {\n return this.versions;\n }", "public VersionInfo getCurrentInfo() {\n return myVersionInfo;\n }", "@ApiModelProperty(value = \"The version is used for optimistic locking and incremented whenever the object is updated.\")\n public Integer getVersion() {\n return version;\n }", "com.google.protobuf.ByteString getObj();", "public String getVersion();", "public String getVersion();", "public String getVersion();", "public String getVersion();", "@Parameters()\n\tpublic static Collection<Object[]> data() {\n\t\treturn Arrays.asList(new Object[][] { { Oldfile_empty, Newfile }, { Oldfile, Newfile_empty },\n\t\t\t\t{ Oldfile_empty, Newfile_empty } });\n\t}", "@Test\n public void dataVersionTest() {\n // TODO: test dataVersion\n }", "@SuppressWarnings(\"unchecked\")\n public <O> List<O> activeVersions() {\n return (List<O>) journal.journal\n .retrieve(BarbelQueries.allActive(journal.id), BarbelQueryOptions.sortAscendingByEffectiveFrom())\n .stream().map(d -> journal.processingState.expose(journal.context, (Bitemporal) d))\n .collect(Collectors.toList());\n }", "public interface VersionedContent {\n /**\n * Version of the content.\n */\n long version();\n\n /**\n * Actual content\n */\n String content();\n }", "@Test\n public void testVersions() throws Exception {\n for (String name : new String[]{\n //\"LibreOfficeBase_odb_1.3.odb\",\n \"LibreOfficeCalc_ods_1.3.ods\",\n \"LibreOfficeDraw_odg_1.3.odg\",\n \"LibreOfficeImpress_odp_1.3.odp\",\n \"LibreOfficeWriter_odt_1.3.odt\",\n }) {\n List<Metadata> metadataList = getRecursiveMetadata(\"/versions/\" + name);\n Metadata metadata = metadataList.get(0);\n assertEquals(\"1.3\", metadata.get(OpenDocumentMetaParser.ODF_VERSION_KEY), \"failed on \" + name);\n }\n }", "public void init() {\r\n\t\tdbVersion = new DBVersion( getDefaultDatabase(), progress, upgradeFile.versionTableName, upgradeFile.logTableName );\r\n\t}", "public com.google.protobuf.ByteString getVersion() {\n return version_;\n }", "protected abstract VersionInformation fetchVersionInformation() throws ExecutorException;", "public VersionVO get_return(){\n return local_return;\n }", "public static VersionVO parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n VersionVO object =\n new VersionVO();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"VersionVO\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (VersionVO)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://ws.platform.blackboard/xsd\",\"version\").equals(reader.getName())){\n \n java.lang.String content = reader.getElementText();\n \n object.setVersion(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToLong(content));\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n object.setVersion(java.lang.Long.MIN_VALUE);\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "@Override\n public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { in.readByte(); // version\n type = in.readUTF();\n subType = in.readUTF();\n // allow for more data from future version\n int extra = in.readShort();\n if (extra > 0) {\n byte[] extraBytes = new byte[extra];\n in.read(extraBytes, 0, extra);\n }\n }", "long version();", "@Override\n public void onMapVersionSet() {\n\n }", "public static List<String> getLoadedOXMVersions() throws SchemaProviderException {\n // If we haven't already loaded in the available OXM models, then do so now.\n if (versionContextMap == null || versionContextMap.isEmpty()) {\n loadModels();\n }\n // If there are still no models available, then there's not much we can do...\n if (versionContextMap.isEmpty()) {\n logger.error(SchemaProviderMsgs.SCHEMA_LOAD_ERROR, \"No available OXM schemas to get versions for.\");\n throw new SchemaProviderException(\"No available OXM schemas to get latest version for.\");\n }\n List<String> versions = new ArrayList<String>();\n for (String versionKey : versionContextMap.keySet()) {\n Matcher matcher = versionPattern.matcher(versionKey);\n if (matcher.find()) {\n versions.add(\"V\" + matcher.group(1));\n }\n }\n return versions;\n }", "long getVersion();", "long getVersion();" ]
[ "0.6435303", "0.6191046", "0.61249685", "0.57716954", "0.56813407", "0.55896527", "0.5514263", "0.54786813", "0.54436636", "0.5430057", "0.5403705", "0.5398561", "0.5385498", "0.53379977", "0.5328605", "0.5324276", "0.5324276", "0.5324276", "0.53041536", "0.52951753", "0.529364", "0.5292315", "0.52710867", "0.52710867", "0.52421254", "0.5239626", "0.5200936", "0.5194174", "0.5181076", "0.5173507", "0.5173507", "0.5173507", "0.5160458", "0.51289684", "0.51257026", "0.5110718", "0.51075155", "0.51075155", "0.51075155", "0.5097061", "0.5096319", "0.5091045", "0.50716275", "0.50530154", "0.50525796", "0.5049366", "0.5032843", "0.5021073", "0.5019319", "0.50110304", "0.50038373", "0.50022686", "0.49965313", "0.4988337", "0.4988337", "0.4988337", "0.4988337", "0.4988337", "0.4988337", "0.4988337", "0.4988337", "0.4982386", "0.49754757", "0.49697754", "0.49672338", "0.49670798", "0.49656636", "0.4952918", "0.49488732", "0.49487284", "0.49480125", "0.49427515", "0.49383396", "0.4933285", "0.4933209", "0.49289837", "0.49281925", "0.49273103", "0.49266064", "0.49228844", "0.49214134", "0.49214134", "0.49214134", "0.49214134", "0.4919929", "0.4918893", "0.4917412", "0.4917092", "0.49169233", "0.49108306", "0.48907882", "0.4890201", "0.48797056", "0.48783633", "0.4878125", "0.48777986", "0.48705766", "0.4860466", "0.48585704", "0.48585704" ]
0.67662066
0
Collects Namespace details data
private static void collectNamespaceDetails(Date collectionTime) { NamespaceDAO namespaceDAO = null; if(!elasticHosts.isEmpty()) { // Instantiate file DAO ElasticDAOConfig daoConfig = new ElasticDAOConfig(); daoConfig.setHosts(Arrays.asList(elasticHosts.split(","))); daoConfig.setPort(elasticPort); daoConfig.setClusterName(elasticCluster); daoConfig.setCollectionTime(collectionTime); initXPackConfig(daoConfig); namespaceDAO = new ElasticNamespaceDetailDAO(daoConfig); // init indexes namespaceDAO.initIndexes(collectionTime); } else { // Instantiate file DAO namespaceDAO = new FileNamespaceDAO(null); } // instantiate billing BO NamespaceBO namespaceBO = new NamespaceBO( ecsMgmtAccessKey, ecsMgmtSecretKey, Arrays.asList(ecsHosts.split(",")), ecsMgmtPort, namespaceDAO, objectCount ); // Start collection namespaceBO.collectNamespaceDetails(collectionTime); namespaceBO.shutdown(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Map getNamespaceMap() {\n/* 130 */ return this.nsMap;\n/* */ }", "Namespaces namespaces();", "public java.util.Map<String,String> getNamespaces() {\n return (_namespaces);\n }", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){\n java.util.Map returnMap = new java.util.HashMap();\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\n while (namespaceIterator.hasNext()) {\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\n returnMap.put(ns.getPrefix(),ns.getNamespaceURI());\n }\n return returnMap;\n }", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){\n java.util.Map returnMap = new java.util.HashMap();\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\n while (namespaceIterator.hasNext()) {\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\n returnMap.put(ns.getPrefix(),ns.getNamespaceURI());\n }\n return returnMap;\n }", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){\n java.util.Map returnMap = new java.util.HashMap();\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\n while (namespaceIterator.hasNext()) {\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\n returnMap.put(ns.getPrefix(),ns.getNamespaceURI());\n }\n return returnMap;\n }", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){\n java.util.Map returnMap = new java.util.HashMap();\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\n while (namespaceIterator.hasNext()) {\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\n returnMap.put(ns.getPrefix(),ns.getNamespaceURI());\n }\n return returnMap;\n }", "private List<Namespace> namespaces() {\n\t\tList<Namespace> namespaces = new ArrayList<>();\n\t\tfor (OwnerTraceData ancestor = data; ancestor != null; ancestor = ancestor.parent) {\n\t\t\tNamespace ns = new Namespace();\n\t\t\tns.data = ancestor;\n\t\t\tnamespaces.add(ns);\n\t\t}\n\t\tCollections.reverse(namespaces);\n\t\tObject2IntMap<String> numbering = new Object2IntOpenHashMap<>(namespaces.size());\n\t\tfor (Namespace ns : namespaces) {\n\t\t\t/*\n\t\t\t * Make a copy since the alias could be changed in another thread (unlikely but possible).\n\t\t\t */\n\t\t\tString alias = ns.data.alias;\n\t\t\tif (!numbering.containsKey(alias)) {\n\t\t\t\tns.name = alias;\n\t\t\t\tnumbering.put(alias, 2);\n\t\t\t} else {\n\t\t\t\tint number = numbering.getInt(alias);\n\t\t\t\tns.name = alias + number;\n\t\t\t\tnumbering.put(alias, number + 1);\n\t\t\t}\n\t\t}\n\t\treturn namespaces;\n\t}", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){\r\n java.util.Map returnMap = new java.util.HashMap();\r\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\r\n while (namespaceIterator.hasNext()) {\r\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\r\n returnMap.put(ns.getPrefix(),ns.getNamespaceURI());\r\n }\r\n return returnMap;\r\n }", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){\n java.util.Map returnMap = new java.util.HashMap();\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\n while (namespaceIterator.hasNext()) {\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\n returnMap.put(ns.getPrefix(),ns.getNamespaceURI());\n }\n return returnMap;\n }", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){\r\n java.util.Map returnMap = new java.util.HashMap();\r\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\r\n while (namespaceIterator.hasNext()) {\r\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\r\n returnMap.put(ns.getPrefix(),ns.getNamespaceURI());\r\n }\r\n return returnMap;\r\n }", "@Override\n protected void initializeNamespaces() {\n\n cds.nsUriToPrefixMap.put(XMI_NS_URI, XMI_NS_PREFIX);\n\n // Add any namespace prefix mappings used by out of type system data.\n // Need to do this before the in-typesystem namespaces so that the prefix\n // used here are reserved and won't be reused for any in-typesystem namespaces.\n\n if (cds.sharedData != null) {\n Iterator<OotsElementData> ootsIter = cds.sharedData.getOutOfTypeSystemElements().iterator();\n while (ootsIter.hasNext()) {\n OotsElementData oed = ootsIter.next();\n String nsUri = oed.elementName.nsUri; // http://... etc\n String qname = oed.elementName.qName; // xxx:yyy\n String localName = oed.elementName.localName; // yyy\n String prefix = qname.substring(0, qname.indexOf(localName) - 1); // xxx\n cds.nsUriToPrefixMap.put(nsUri, prefix);\n cds.nsPrefixesUsed.add(prefix);\n }\n }\n\n /*\n * Convert x.y.z.TypeName to prefix-uri, TypeName, and ns:TypeName\n */\n Iterator<Type> it = cds.tsi.getTypeIterator();\n while (it.hasNext()) {\n TypeImpl t = (TypeImpl) it.next();\n // this also populates the nsUriToPrefix map\n cds.typeCode2namespaceNames[t.getCode()] = uimaTypeName2XmiElementName(t.getName());\n }\n }", "public ArrayList getNamespaces() {\n return m_namespaces;\n }", "public Map<String,String> getNamespaces() {\n return namespaces;\n }", "java.lang.String getNamespace();", "private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env) {\r\n java.util.Map returnMap = new java.util.HashMap();\r\n java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\r\n while (namespaceIterator.hasNext()) {\r\n org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();\r\n returnMap.put(ns.getPrefix(), ns.getNamespaceURI());\r\n }\r\n return returnMap;\r\n }", "@JsonProperty(\"Sns\") abstract Object getSNS();", "String getNamespace();", "String getNamespace();", "String getNamespace();", "@DISPID(1091) //= 0x443. The runtime will prefer the VTID if present\n @VTID(11)\n @ReturnValue(type=NativeType.Dispatch)\n com4j.Com4jObject namespaces();", "private java.util.Map getEnvelopeNamespaces(\n\t\t\torg.apache.axiom.soap.SOAPEnvelope env) {\n\t\tjava.util.Map returnMap = new java.util.HashMap();\n\t\tjava.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();\n\t\twhile (namespaceIterator.hasNext()) {\n\t\t\torg.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator\n\t\t\t\t\t.next();\n\t\t\treturnMap.put(ns.getPrefix(), ns.getNamespaceURI());\n\t\t}\n\t\treturn returnMap;\n\t}", "public String getNamespace();", "public String getNamespace()\n/* */ {\n/* 357 */ return this.namespace;\n/* */ }", "@Override\n\tpublic String getNamespace() {\n\t\treturn nameSpace;\n\t}", "@Override\n\tprotected String getNamespace() {\n\t\treturn NAMESPACE;\n\t}", "@Updatable\n public String getNamespace() {\n return namespace;\n }", "String getNamespaceStringValue(Object ns);", "@Test\n public void testNamespace() throws Exception {\n NamespaceMeta ns1Meta = new NamespaceMeta.Builder().setName(\"ns1\").build();\n NamespaceMeta ns2Meta = new NamespaceMeta.Builder().setName(\"ns2\").build();\n NamespaceMeta anotherNsMeta = new NamespaceMeta.Builder().setName(\"anotherNs\").build();\n when(nsClient.list()).thenReturn(ImmutableList.of(ns1Meta, ns2Meta, anotherNsMeta));\n\n ResourceLookupContext resourceLookupContext = new ResourceLookupContext();\n resourceLookupContext.setResourceName(\"namespace\");\n // user is entering n and we expect the completion to show ns1 and ns2 as they start with n and not anotherNs\n resourceLookupContext.setUserInput(\"n\");\n resourceLookupContext.setResources(ImmutableMap.of(\"namespace\", Collections.emptyList()));\n List<String> resources = client.getResources(resourceLookupContext);\n Assert.assertEquals(2, resources.size());\n Assert.assertEquals(ImmutableList.of(\"ns1\", \"ns2\"), resources);\n }", "public String getNameSpace() {\n return this.namespace;\n }", "private NamespaceHelper() {}", "public String getNamespace() {\n return namespace;\n }", "private String getNamespace(String qname) {\n StringTokenizer tok = new StringTokenizer(qname, \":\");\n String prefix;\n\n if (tok.countTokens() == 1) {\n return \"\";\n }\n prefix = tok.nextToken();\n\n NamedNodeMap map = mDoc.getDocumentElement().getAttributes();\n for (int j = 0; j < map.getLength(); j++) {\n Node n = map.item(j);\n\n if (n.getLocalName().trim().equals(prefix.trim())) {\n return n.getNodeValue();\n }\n }\n\n return \"\";\n }", "public NsNamespaces() {\n this(DSL.name(\"ns_namespaces\"), null);\n }", "void visit(Namespace namespace);", "protected MapNamespaceContext createNamespaceContext() {\r\n // create the xpath with fedora namespaces built in\r\n MapNamespaceContext nsc = new MapNamespaceContext();\r\n nsc.setNamespace(\"fedora-types\", \"http://www.fedora.info/definitions/1/0/types/\");\r\n nsc.setNamespace(\"sparql\", \"http://www.w3.org/2001/sw/DataAccess/rf1/result\");\r\n nsc.setNamespace(\"foxml\", \"info:fedora/fedora-system:def/foxml#\");\r\n nsc.setNamespace(\"rdf\", \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\");\r\n nsc.setNamespace(\"fedora\", \"info:fedora/fedora-system:def/relations-external#\");\r\n nsc.setNamespace(\"rdfs\", \"http://www.w3.org/2000/01/rdf-schema#\");\r\n nsc.setNamespace(\"fedora-model\", \"info:fedora/fedora-system:def/model#\");\r\n nsc.setNamespace(\"oai\", \"http://www.openarchives.org/OAI/2.0/\");\r\n nsc.setNamespace(\"oai_dc\", \"http://www.openarchives.org/OAI/2.0/oai_dc/\", \"http://www.openarchives.org/OAI/2.0/oai_dc.xsd\");\r\n nsc.setNamespace(\"dc\", \"http://purl.org/dc/elements/1.1/\"); \r\n nsc.setNamespace(\"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\");\r\n nsc.setNamespace(\"fedora-management\", \"http://www.fedora.info/definitions/1/0/management/\", \"http://www.fedora.info/definitions/1/0/datastreamHistory.xsd\");\r\n return nsc;\r\n }", "public String getNamespace()\n {\n return NAMESPACE;\n }", "@Override\r\n\tpublic List<String> getXMLNamespaces() {\n\t\treturn null;\r\n\t}", "@Override\n\tpublic String toString() {\n\t\t/*\n\t\t * Just materializing the complete tag map is the simplest implementation.\n\t\t * This is not performance-critical code, so we aim for code simplicity rather than performance.\n\t\t * We are constructing a TreeMap in order to force display in sorted order.\n\t\t */\n\t\tMap<String, Object> sorted = new TreeMap<>();\n\t\tList<Namespace> namespaces = namespaces();\n\t\tfor (Namespace ns : namespaces)\n\t\t\tfor (OwnerTag tag = ns.data.tags; tag != null; tag = tag.next)\n\t\t\t\tsorted.put(ns.name + \".\" + tag.key, tag.value);\n\t\treturn namespaces.stream().map(ns -> ns.name).collect(joining(\".\")) + sorted;\n\t}", "public String getNamespace() {\n return this.namespace;\n }", "public final String[] getNamespaces() {\n return m_uris;\n }", "public NamespaceContext getNamespaceContext() {\n LOGGER.entering(JsonXmlStreamReader.class.getName(), \"getNamespaceContext\");\n NamespaceContext result = new JsonNamespaceContext();\n LOGGER.exiting(JsonXmlStreamReader.class.getName(), \"getNamespaceContext\", result);\n return result;\n }", "protected final Namespace getNamespace()\n {\n return m_namespace;\n }", "public boolean namespace() {\n\t\ttry {\n\t\t\tArrayList<String[]> records = dh.getNamespaces();\n\t\t\tif (records != null) {\n\t\t\t\t// System.out.println(\"NAMESPACE RECORDS FOUND\");\n\t\t\t\tint l = records.size();\n\t\t\t\tbyte[] startPacket = (\"NAMESPACE\").getBytes();\n\t\t\t\toos.writeObject(startPacket);\n\t\t\t\t// System.out.println(\"Start packet sent!!!\");\n\t\t\t\tAckThread ack = new AckThread(dh, ois, records);\n\t\t\t\tack.start();\n\t\t\t\tfor (int i = 0; i < l; i++) {\n\t\t\t\t\tString method = records.get(i)[0];\n\t\t\t\t\tString user = records.get(i)[1];\n\t\t\t\t\tString namespace = records.get(i)[2];\n\t\t\t\t\tString permission = records.get(i)[3];\n\t\t\t\t\tString data = method + \"\\n\" + user + \"\\n\" + namespace\n\t\t\t\t\t\t\t+ \"\\n\" + permission;\n\t\t\t\t\tBundle b = new Bundle();\n\t\t\t\t\tb.data = data.getBytes();\n\t\t\t\t\tb.userId = userId;\n\t\t\t\t\tb.transactionId = i;\n\t\t\t\t\tb.bundleType = b.DATA;\n\t\t\t\t\tb.noOfBundles = 1;\n\t\t\t\t\tb.bundleNumber = 0;\n\t\t\t\t\tb.bundleSize = b.data.length;\n\t\t\t\t\tbyte[] bundle = b.getBytes();\n\t\t\t\t\toos.writeObject(bundle);\n\t\t\t\t\toos.flush();\n\t\t\t\t\t// System.out.println(\"Sent bundle -> Transaction id : \" + i\n\t\t\t\t\t// + \" Bundle No. : \" + 0);\n\t\t\t\t}\n\t\t\t\tack.join();\n\t\t\t\tBundle b = new Bundle();\n\t\t\t\tb.userId = userId;\n\t\t\t\tb.transactionId = -1;\n\t\t\t\tb.bundleType = b.STOP;\n\t\t\t\tb.noOfBundles = 1;\n\t\t\t\tb.bundleNumber = -1;\n\t\t\t\tb.bundleSize = 0;\n\t\t\t\tb.data = null;\n\t\t\t\toos.writeObject(b.getBytes());\n\t\t\t\toos.flush();\n\t\t\t\t// System.out.println(\"Sent STOP bundle\");\n\t\t\t}\n\t\t\treturn true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t}", "public abstract INameSpace getNameSpace();", "String getTargetNamespace();", "@Override\n\tpublic void namespace() {\n\t\t\n\t}", "public void setNamespace(String namespace) {\n\t\t\r\n\t}", "abstract protected NamespaceProperties retrieveFullNamespaceProperties(long nsContext)\n throws NamespacePropertiesRetrievalException;", "public String getNamespace() {\n return namespace;\n }", "public String getNamespace() {\n return namespace;\n }", "public String getNamespace() {\n return namespace;\n }", "public static void main(String[] args) {\n System.out.println(\"namespace = \" + namespace);\n }", "String getNameSpace();", "String getNamespacePrefix(Object ns);", "private SubscriptionList getNamespaceSubscriptions(String baseNS) throws RepositoryException {\n \tSubscriptionResource sr = namespaceCache.get( baseNS );\n \t\n \tif (sr == null) {\n \t\ttry {\n\t\t\t\tsr = new SubscriptionResource( fileUtils, baseNS, null, null );\n\t\t\t\tnamespaceCache.put( baseNS, sr );\n\t\t\t\t\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RepositoryException(\"Error loading subscription list content.\", e);\n\t\t\t}\n \t}\n \treturn sr.getResource();\n }", "@Override\n\tpublic Namespace getNamespace(Address addr) {\n\t\tif (addr.isMemoryAddress()) {\n\t\t\tfor (TraceSymbol sym : symbolManager.labels().getAt(program.snap, null, addr, true)) {\n\t\t\t\tif (sym instanceof TraceNamespaceSymbol /* Function */) {\n\t\t\t\t\treturn (TraceNamespaceSymbol) sym;\n\t\t\t\t}\n\t\t\t\treturn sym.getParentNamespace();\n\t\t\t}\n\t\t}\n\t\treturn symbolManager.getGlobalNamespace();\n\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "String getReferenceNamespace();", "public String getNamespace() {\n\t\treturn EPPNameVerificationMapFactory.NS;\n\t}", "private String getNamespace(Package pkg) {\n/* */ String nsUri;\n/* 223 */ if (pkg == null) return \"\";\n/* */ \n/* */ \n/* 226 */ XmlNamespace ns = pkg.<XmlNamespace>getAnnotation(XmlNamespace.class);\n/* 227 */ if (ns != null) {\n/* 228 */ nsUri = ns.value();\n/* */ } else {\n/* 230 */ nsUri = \"\";\n/* 231 */ } return nsUri;\n/* */ }", "public boolean isNamespaceAware () {\n return true;\n }", "public Map<Integer, String> getAllBindingNamespaces()\n {\n Map<Integer, String> allNs = new HashMap<Integer, String>();\n \n for (BindingExpression be : bindingExpressions)\n {\n if (be.getNamespaces() != null)\n {\n allNs.putAll(be.getNamespaces());\n }\n }\n \n return allNs;\n }", "private void genFillNamespacePrefixes(ArrayList nss, MethodBuilder mb) {\n if (nss != null) {\n for (int i = 0; i < nss.size(); i++) {\n mb.appendDUP();\n mb.appendLoadConstant(i);\n String prefix = ((NamespaceDefinition)nss.get(i)).getPrefix();\n if (prefix == null) {\n prefix = \"\";\n }\n mb.appendLoadConstant(prefix);\n mb.appendAASTORE();\n }\n }\n }", "public YANG_NameSpace getNameSpace() {\n\t\treturn namespace;\n\t}", "@Override\r\n\tpublic String getNamespace() {\n\t\treturn null;\r\n\t}", "@Override\n\tpublic String getNamespace() {\n\t\treturn null;\n\t}", "public String getAllBindingNamespaceDeclarations() \t \n { \t \n return BindingExpression.getNamespaceDeclarations(getAllBindingNamespaces()); \t \n }", "public String getNameSpace() {\n return nameSpace;\n }", "Map<String, Object> getAllMetadata();", "private String updateNamespaces(final net.simpleframework.lib.org.jsoup.nodes.Element el) {\n\t\t\t// scan the element for namespace declarations\n\t\t\t// like: xmlns=\"blah\" or xmlns:prefix=\"blah\"\n\t\t\tfinal Attributes attributes = el.attributes();\n\t\t\tfor (final Attribute attr : attributes) {\n\t\t\t\tfinal String key = attr.getKey();\n\t\t\t\tString prefix;\n\t\t\t\tif (key.equals(xmlnsKey)) {\n\t\t\t\t\tprefix = \"\";\n\t\t\t\t} else if (key.startsWith(xmlnsPrefix)) {\n\t\t\t\t\tprefix = key.substring(xmlnsPrefix.length());\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tnamespacesStack.peek().put(prefix, attr.getValue());\n\t\t\t}\n\n\t\t\t// get the element prefix if any\n\t\t\tfinal int pos = el.tagName().indexOf(\":\");\n\t\t\treturn pos > 0 ? el.tagName().substring(0, pos) : \"\";\n\t\t}", "CompletionItem populateNamespaceDeclarationCompletionItem(SymbolInfo symbolInfo) {\n CompletionItem completionItem = new CompletionItem();\n completionItem.setLabel(symbolInfo.getSymbolName());\n String[] delimiterSeparatedTokens = (symbolInfo.getSymbolName()).split(\"\\\\.\");\n completionItem.setInsertText(delimiterSeparatedTokens[delimiterSeparatedTokens.length - 1]);\n completionItem.setDetail(ItemResolverConstants.XMLNS);\n\n return completionItem;\n }", "@Override\n public ListenableFuture<Set<String>> getActiveNamespaces(AuthHeader authHeader) {\n return Futures.immediateFuture(timelockNamespaces.getActiveClients().stream()\n .map(Client::value)\n .filter(value -> !value.equals(PaxosTimeLockConstants.LEADER_PAXOS_NAMESPACE))\n .collect(Collectors.toSet()));\n }", "@Nullable public String getNamespace() {\n return namespace;\n }", "public String getNamespace () throws java.io.IOException, com.linar.jintegra.AutomationException;", "public void setNamespace(String namespace) {\n this.namespace = namespace;\n }", "public void setNamespace(String namespace) {\n this.namespace = namespace;\n }", "int getNamespaceUri();", "@Override\n\tpublic Set<String> getNamespaces(ResourcePackType p_195759_1_) {\n\t\treturn null;\n\t}", "public String getNamespaceName() {\n return namespaceName;\n }", "public XMLNamespaces() {\n this(libsbmlJNI.new_XMLNamespaces__SWIG_0(), true);\n }", "public final int getTotalNsCount() {\n return mNamespaces.size() >> 1;\n }", "private void collectMetricsInfo() {\n // Retrieve a list of all references to registered metric services\n ServiceReference[] metricsList = null;\n try {\n metricsList = bc.getServiceReferences(null, SREF_FILTER_METRIC);\n } catch (InvalidSyntaxException e) {\n logError(INVALID_FILTER_SYNTAX);\n }\n \n // Retrieve information about all registered metrics found\n if ((metricsList != null) && (metricsList.length > 0)) {\n \n for (int nextMetric = 0;\n nextMetric < metricsList.length;\n nextMetric++) {\n \n ServiceReference sref_metric = metricsList[nextMetric];\n MetricInfo metric_info = getMetricInfo(sref_metric);\n \n // Add this metric's info to the list\n if (metric_info != null) {\n registeredMetrics.put(\n metric_info.getServiceID(),\n metric_info);\n }\n }\n }\n else {\n logInfo(\"No pre-existing metrics were found!\");\n }\n }", "public Optional<String> namespace() {\n return Codegen.stringProp(\"namespace\").config(config).get();\n }", "protected static Map<String, String> readKVPNamespaces(String argValue) throws SOSException\n {\n //if (!NS_DECL_PATTERN.matcher(argValue).matches())\n // throw new SOSException(SOSException.invalid_param_code, \"namespaces\", null, null);\n \n Map<String, String> namespaceMap = new HashMap<String, String>();\n String[] nsList = NS_DECL_SPLIT.split(argValue);\n for (String ns: nsList)\n {\n if (ns.length() > 0)\n {\n String[] nsElts = ns.split(\",\");\n namespaceMap.put(nsElts[0], nsElts[1]);\n }\n }\n \n return namespaceMap;\n }", "public java.lang.String getNameSpaceURI()\n {\n return nsURI;\n }", "public java.lang.String getNameSpaceURI()\n {\n return nsURI;\n }", "public java.lang.String getNameSpaceURI()\n {\n return nsURI;\n }", "@Override\n public ListenableFuture<Set<String>> getNamespaces(AuthHeader authHeader) {\n return Futures.immediateFuture(namespaceLoaders.stream()\n .map(PersistentNamespaceLoader::getAllPersistedNamespaces)\n .flatMap(Set::stream)\n .filter(namespace -> !namespace.value().equals(PaxosTimeLockConstants.LEADER_PAXOS_NAMESPACE))\n .map(Client::value)\n .collect(Collectors.toSet()));\n }", "@Override\n public Class<NsNamespacesRecord> getRecordType() {\n return NsNamespacesRecord.class;\n }", "void setNamespace(java.lang.String namespace);", "@XmlElement(required = true, name = \"namespace\")\n public String getNamespace() {\n return namespace;\n }", "private void handleNamespaceDeclaration() throws IOException {\r\n if (this.tempMapping != null) {\r\n PrefixMapping pm = null;\r\n for (int i = 0; i < tempMapping.size(); i++) {\r\n pm = (PrefixMapping)tempMapping.get(i);\r\n this.writer.write(\" xmlns\");\r\n // specify a prefix if different from \"\"\r\n if (!\"\".equals(pm.prefix)) {\r\n this.writer.write(':');\r\n this.writer.write(pm.prefix);\r\n }\r\n this.writer.write(\"=\\\"\");\r\n this.writer.write(pm.uri);\r\n this.writer.write(\"\\\"\");\r\n }\r\n this.tempMapping = null;\r\n }\r\n }", "@Override\r\n\tpublic String[] getNamespacePrefixes() throws RepositoryException {\n\t\treturn null;\r\n\t}", "Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException;", "private String getNamespace(int endIndex) {\n return data.substring(tokenStart, endIndex);\n }" ]
[ "0.6288201", "0.6267803", "0.61238164", "0.59332144", "0.59332144", "0.59332144", "0.59332144", "0.59149456", "0.59128606", "0.5890139", "0.5874332", "0.5802557", "0.5787466", "0.5786097", "0.5759004", "0.57105553", "0.56399584", "0.56183606", "0.56183606", "0.56183606", "0.5577187", "0.55535847", "0.5540943", "0.55405086", "0.55193454", "0.55171573", "0.5462941", "0.54466933", "0.538718", "0.5383336", "0.5377713", "0.5377695", "0.536619", "0.53626084", "0.53483886", "0.5343491", "0.53300416", "0.5275913", "0.5271543", "0.5270752", "0.5269064", "0.52655846", "0.52603644", "0.52589893", "0.52455795", "0.5228429", "0.5222699", "0.52145165", "0.5193156", "0.5185275", "0.5185275", "0.5185275", "0.5169807", "0.5160479", "0.5125427", "0.51127064", "0.5089395", "0.5089356", "0.5089356", "0.5089356", "0.5089356", "0.5089356", "0.50758106", "0.50705945", "0.5052963", "0.5043073", "0.5040853", "0.5038993", "0.5029146", "0.50147164", "0.5008572", "0.4995028", "0.49805903", "0.49765027", "0.49733853", "0.4972757", "0.4970394", "0.49678406", "0.49623063", "0.49609396", "0.49609396", "0.4945653", "0.4936576", "0.49186397", "0.49157533", "0.49046156", "0.48959816", "0.4871276", "0.48657364", "0.4856604", "0.4856604", "0.4856604", "0.48551172", "0.48497564", "0.48446628", "0.48368946", "0.48333913", "0.48323765", "0.482661", "0.48208836" ]
0.69534487
0
Collects Namespace quota data
private static void collectNamespaceQuota(Date collectionTime) { NamespaceDAO namespaceDAO = null; if(!elasticHosts.isEmpty()) { // Instantiate file DAO ElasticDAOConfig daoConfig = new ElasticDAOConfig(); daoConfig.setHosts(Arrays.asList(elasticHosts.split(","))); daoConfig.setPort(elasticPort); daoConfig.setClusterName(elasticCluster); daoConfig.setCollectionTime(collectionTime); initXPackConfig(daoConfig); namespaceDAO = new ElasticNamespaceQuotaDAO(daoConfig); // init indexes namespaceDAO.initIndexes(collectionTime); } else { // Instantiate file DAO namespaceDAO = new FileNamespaceDAO(null); } // instantiate billing BO NamespaceBO namespaceBO = new NamespaceBO( ecsMgmtAccessKey, ecsMgmtSecretKey, Arrays.asList(ecsHosts.split(",")), ecsMgmtPort, namespaceDAO, objectCount ); // Start collection namespaceBO.collectNamespaceQuota(collectionTime); namespaceBO.shutdown(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int getQuotaMetricsCount();", "public Quota.Counts computeQuotaUsage4CurrentDirectory(Quota.Counts counts) {\r\n counts.add(Quota.NAMESPACE, 1);\r\n return counts; \r\n }", "java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> getQuotaMetricsList();", "com.google.api.servicecontrol.v1.MetricValueSet getQuotaMetrics(int index);", "private void getQuota() {\n getProgressDialog().show();\n new Handler().postDelayed(this::onQuotaDownloadComplete, 2000);\n }", "private static void collectNamespaceDetails(Date collectionTime) {\n\t\t\n\t\tNamespaceDAO namespaceDAO = null;\n\t\tif(!elasticHosts.isEmpty()) {\n\t\t\t// Instantiate file DAO\n\t\t\tElasticDAOConfig daoConfig = new ElasticDAOConfig();\n\t\t\tdaoConfig.setHosts(Arrays.asList(elasticHosts.split(\",\")));\n\t\t\tdaoConfig.setPort(elasticPort);\n\t\t\tdaoConfig.setClusterName(elasticCluster);\n\t\t\tdaoConfig.setCollectionTime(collectionTime);\n\t\t\tinitXPackConfig(daoConfig);\n\t\t\tnamespaceDAO = new ElasticNamespaceDetailDAO(daoConfig);\n\t\t\t// init indexes\n\t\t\tnamespaceDAO.initIndexes(collectionTime);\n\t\t} else {\n\t\t\t// Instantiate file DAO\n\t\t\tnamespaceDAO = new FileNamespaceDAO(null);\n\t\t}\n\t\t\n\t\t// instantiate billing BO\n\t\tNamespaceBO namespaceBO = new NamespaceBO( ecsMgmtAccessKey, \n\t\t\t\t\t\t\t\t\t\t\t ecsMgmtSecretKey,\n\t\t\t\t\t\t\t\t\t\t\t Arrays.asList(ecsHosts.split(\",\")),\n\t\t\t\t\t\t\t\t\t\t\t ecsMgmtPort,\n\t\t\t\t\t\t\t\t\t\t\t namespaceDAO,\n\t\t\t\t\t\t\t\t\t\t\t objectCount );\n\t\t\n\t\t// Start collection\n\t\tnamespaceBO.collectNamespaceDetails(collectionTime);\n\t\tnamespaceBO.shutdown();\n\t}", "@Override\n\tpublic int quotaCount(int studyno) {\n\t\treturn mapper.quotaCount(studyno);\n\t}", "@Override\n public abstract float calculaQuota(float quotaBase) throws ExcepcioClub;", "com.google.api.servicecontrol.v1.MetricValueSetOrBuilder getQuotaMetricsOrBuilder(int index);", "private SubscriptionList getNamespaceSubscriptions(String baseNS) throws RepositoryException {\n \tSubscriptionResource sr = namespaceCache.get( baseNS );\n \t\n \tif (sr == null) {\n \t\ttry {\n\t\t\t\tsr = new SubscriptionResource( fileUtils, baseNS, null, null );\n\t\t\t\tnamespaceCache.put( baseNS, sr );\n\t\t\t\t\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RepositoryException(\"Error loading subscription list content.\", e);\n\t\t\t}\n \t}\n \treturn sr.getResource();\n }", "java.util.List<? extends com.google.api.servicecontrol.v1.MetricValueSetOrBuilder>\n getQuotaMetricsOrBuilderList();", "List<StorageResourceUsage> getStorageResourceUsage();", "public Quota getQuota() {\n\t\treturn this.quota;\n\t}", "private QuotaConsumer getQuotaConsumer(AppEngineTaskAttemptContext taskAttemptContext) {\n QuotaManager manager = new QuotaManager(MemcacheServiceFactory.getMemcacheService());\n QuotaConsumer consumer = new QuotaConsumer(\n manager, taskAttemptContext.getTaskAttemptID().toString(), DEFAULT_QUOTA_BATCH_SIZE);\n return consumer;\n }", "BigDecimal getCacheSpaceAvailable();", "public String quotaId() {\n return this.quotaId;\n }", "@Override\n\tpublic String dettaglioAggiornaQuota(){\n\t return super.dettaglioAggiornaQuota();\n\t}", "com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode getQuotaMode();", "public double getQuotaLimit() {\n\t\treturn this.quotaLimit;\n\t}", "public Map getNamespaceMap() {\n/* 130 */ return this.nsMap;\n/* */ }", "public MicrosoftGraphQuota() {\n }", "@Override\n\tpublic String dettaglioConsultaQuota(){\n\t return super.dettaglioConsultaQuota();\n\t}", "@Override\n public <T> Collection<ResourceAllocation> getResourceAllocations(DiscreteResourceId parent, Class<T> cls) {\n return null;\n }", "private void collectMetricsInfo() {\n // Retrieve a list of all references to registered metric services\n ServiceReference[] metricsList = null;\n try {\n metricsList = bc.getServiceReferences(null, SREF_FILTER_METRIC);\n } catch (InvalidSyntaxException e) {\n logError(INVALID_FILTER_SYNTAX);\n }\n \n // Retrieve information about all registered metrics found\n if ((metricsList != null) && (metricsList.length > 0)) {\n \n for (int nextMetric = 0;\n nextMetric < metricsList.length;\n nextMetric++) {\n \n ServiceReference sref_metric = metricsList[nextMetric];\n MetricInfo metric_info = getMetricInfo(sref_metric);\n \n // Add this metric's info to the list\n if (metric_info != null) {\n registeredMetrics.put(\n metric_info.getServiceID(),\n metric_info);\n }\n }\n }\n else {\n logInfo(\"No pre-existing metrics were found!\");\n }\n }", "private int getResourceListSize() {\n return dataList.getResourceEndIndex();\n }", "public ArrayList<ResourceScopeInfoDTO> getResourceScopeData() throws APIMigrationException {\n try (Connection conn = APIMgtDBUtil.getConnection()) {\n try (PreparedStatement ps = conn.prepareStatement(GET_RESOURCE_SCOPE_SQL)) {\n try (ResultSet resultSet = ps.executeQuery()) {\n ArrayList<ResourceScopeInfoDTO> scopeInfoList = new ArrayList<>();\n while (resultSet.next()) {\n ResourceScopeInfoDTO scopeInfo = new ResourceScopeInfoDTO();\n scopeInfo.setResourcePath(resultSet.getString(RESOURCE_PATH));\n scopeInfo.setScopeId(resultSet.getString(SCOPE_ID));\n scopeInfo.setTenantID(resultSet.getString(TENANT_ID));\n scopeInfoList.add(scopeInfo);\n }\n return scopeInfoList;\n }\n }\n } catch (SQLException ex) {\n throw new APIMigrationException(\"Failed to get data from IDN_OAUTH2_RESOURCE_SCOPE\", ex);\n }\n }", "public interface StorageStats {\n\n /**\n * Returns storage usage for all resources.\n *\n * @return a list of storage resource usage objects\n */\n List<StorageResourceUsage> getStorageResourceUsage();\n\n /**\n * Returns the storage usage for the specified resource.\n *\n * @param resourceName the name of the resource\n * @return a storage resource usage object\n */\n StorageResourceUsage getStorageResourceUsage(String resourceName);\n\n\n long getTotalStorageUsage(DataCategory dataCategory);\n\n long getTotalStorageUsage(DataCategory dataCategory, String projectId);\n\n}", "private static KafkaUserQuotas emptyQuotas() {\n KafkaUserQuotas emptyQuotas = new KafkaUserQuotas();\n emptyQuotas.setProducerByteRate(null);\n emptyQuotas.setConsumerByteRate(null);\n emptyQuotas.setRequestPercentage(null);\n emptyQuotas.setControllerMutationRate(null);\n\n return emptyQuotas;\n }", "@Test\n public void testNamespace() throws Exception {\n NamespaceMeta ns1Meta = new NamespaceMeta.Builder().setName(\"ns1\").build();\n NamespaceMeta ns2Meta = new NamespaceMeta.Builder().setName(\"ns2\").build();\n NamespaceMeta anotherNsMeta = new NamespaceMeta.Builder().setName(\"anotherNs\").build();\n when(nsClient.list()).thenReturn(ImmutableList.of(ns1Meta, ns2Meta, anotherNsMeta));\n\n ResourceLookupContext resourceLookupContext = new ResourceLookupContext();\n resourceLookupContext.setResourceName(\"namespace\");\n // user is entering n and we expect the completion to show ns1 and ns2 as they start with n and not anotherNs\n resourceLookupContext.setUserInput(\"n\");\n resourceLookupContext.setResources(ImmutableMap.of(\"namespace\", Collections.emptyList()));\n List<String> resources = client.getResources(resourceLookupContext);\n Assert.assertEquals(2, resources.size());\n Assert.assertEquals(ImmutableList.of(\"ns1\", \"ns2\"), resources);\n }", "public int getSpace(){\n // iterate through nodes\n int totalSpace = 0;\n Collection<SupplyNode> nodeCol = t.values();\n Iterator<SupplyNode> it = nodeCol.iterator();\n \n // multiply resource count by resource space\n while (it.hasNext()){\n SupplyNode s = it.next();\n totalSpace += (s.getCurrent()*s.getResource().getCost());\n }\n \n // return\n return totalSpace;\n }", "@Override\n public Collection<ResourceAllocation> getResourceAllocations(ResourceConsumer consumer) {\n return null;\n }", "public static void initializeMetrics()\n {\n // Get the Java runtime\n Runtime runtime = Runtime.getRuntime();\n // Run the garbage collector\n runtime.gc();\n \tstartingMemory = runtime.totalMemory() - runtime.freeMemory();\n }", "private void initialize() { \n inbox = getDcopInfoProvider().getAllDcopSharedInformation().get(getRegionID());\n \n currentDcopRun = inbox.getAsynchronousMessage().getIteration();\n \n LOGGER.info(\"DCOP Run {} Region {} read inbox {}\",currentDcopRun, getRegionID(), inbox);\n \n summary = getDcopInfoProvider().getDcopResourceSummary();\n \n retrieveAggregateCapacity(summary);\n retrieveNeighborSetFromNetworkLink(summary);\n retrieveAllService(summary);\n \n LOGGER.info(\"DCOP Run {} Region {} has Region Capacity {}\", currentDcopRun, getRegionID(), getRegionCapacity());\n }", "public abstract int getPageFreeSpace(int bucket);", "public static Collection<Access.AccessStatsEntry> getStatistics() {\n accessorQueueLen.count = accessorQueue.size();\n\n return stats;\n }", "@Nonnull\n Map<String, Set<TCSResource<?>>> getAllocations();", "public ListSubscriptionForAllNamespaces limit(Number limit) {\n put(\"limit\", limit);\n return this;\n }", "public long getTotalSpace(){\n return totalSpace;\n }", "private List<Namespace> namespaces() {\n\t\tList<Namespace> namespaces = new ArrayList<>();\n\t\tfor (OwnerTraceData ancestor = data; ancestor != null; ancestor = ancestor.parent) {\n\t\t\tNamespace ns = new Namespace();\n\t\t\tns.data = ancestor;\n\t\t\tnamespaces.add(ns);\n\t\t}\n\t\tCollections.reverse(namespaces);\n\t\tObject2IntMap<String> numbering = new Object2IntOpenHashMap<>(namespaces.size());\n\t\tfor (Namespace ns : namespaces) {\n\t\t\t/*\n\t\t\t * Make a copy since the alias could be changed in another thread (unlikely but possible).\n\t\t\t */\n\t\t\tString alias = ns.data.alias;\n\t\t\tif (!numbering.containsKey(alias)) {\n\t\t\t\tns.name = alias;\n\t\t\t\tnumbering.put(alias, 2);\n\t\t\t} else {\n\t\t\t\tint number = numbering.getInt(alias);\n\t\t\t\tns.name = alias + number;\n\t\t\t\tnumbering.put(alias, number + 1);\n\t\t\t}\n\t\t}\n\t\treturn namespaces;\n\t}", "long getEvictions();", "public final int getTotalNsCount() {\n return mNamespaces.size() >> 1;\n }", "@Override\r\n\tpublic int collect(Map<String, String> arguments) {\r\n\t\tinitialize(arguments);\r\n\t\tint count = 0;\r\n\r\n\t\t// Setup the authorization\r\n\t\tinitializeAuthorizationData();\r\n\r\n\t\tReportingServiceManager reportingManager = new ReportingServiceManager(authorizationData);\r\n\t\treportingManager.setStatusPollIntervalInMilliseconds(5000);\r\n\r\n\t\t// Setup the observable window range\r\n\t\tCalendar minRange = Calendar.getInstance();\r\n\t\tminRange.add(Calendar.HOUR, 0-lag-obsWindow);\r\n\t\tCalendar maxRange = Calendar.getInstance();\r\n\t\tmaxRange.add(Calendar.HOUR, 0-lag);\r\n\t\tLOG(\"Query range from: (\"+minRange.getTime()+\" - \"+maxRange.getTime()+\")\");\r\n\r\n\t\t// collect the data\r\n\t\t// do we load from offline or online source ?\r\n\t\tboolean bLoadFromFile = false;\r\n\t\tFile fromFile = null;\r\n\t\tif (loadFromFile != null) {\r\n\t\t\ttry {\r\n\t\t\t\tString[] files = loadFromFile.split(\";\");\r\n\t\t\t\tfromFile = new File(files[files.length-1]);\r\n\t\t\t\tbLoadFromFile = fromFile.exists() && fromFile.isFile();\r\n\t\t\t\tif (files.length > 1) {\r\n\t\t\t\t\tfor (int f = 0; f < files.length - 1; f++) {\r\n\t\t\t\t\t\tprocessFile(new File(files[f]), minRange, maxRange, false, false, null);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t} catch (Exception ea) {\r\n\t\t\t\tbLoadFromFile = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (!bLoadFromFile) {\r\n\t\t\t// Load From API (online)\r\n\t\t\t\r\n\t\t\t// 1. Prepare report request for AdPerformance\r\n\t\t\tReportRequest reportRequest = getAdReport(minRange, maxRange);\r\n\t\t\t// 2. Set Download options\r\n\t\t\tReportingDownloadParameters reportingDownloadParameters = new ReportingDownloadParameters();\r\n\t\t\treportingDownloadParameters.setReportRequest(reportRequest);\r\n\t\t\treportingDownloadParameters.setResultFileDirectory(new File(reportDirectory));\r\n\t\t\treportingDownloadParameters.setResultFileName(System.currentTimeMillis()+\"_AdReport.csv\");\r\n\t\t\treportingDownloadParameters.setOverwriteResultFile(true);\r\n\t\t\t// 3. Download report file from BingAds API (unfortunately Microsoft insists on using the file, there is no stream option)\r\n\t\t\t// We may optionally cancel the downloadFileAsync operation after a specified time interval.\r\n\t\t\tFile resultAdReportFile = null;;\r\n\t\t\ttry {\r\n\t\t\t\tresultAdReportFile = reportingManager.downloadFileAsync(\r\n\t\t\t\t\t\treportingDownloadParameters, \r\n\t\t\t\t\t\tnull).get(3600000, TimeUnit.MILLISECONDS);\r\n\r\n\t\t\t} catch (InterruptedException | ExecutionException | TimeoutException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// 4. Prepare the AdGroupPerformance request\r\n\t\t\treportRequest = getAdGroupReport(minRange, maxRange);\r\n\t\t\tFile resultAdGroupReportFile = null;\r\n\r\n\t\t\t// 5. Set Download options\r\n\t\t\treportingDownloadParameters.setReportRequest(reportRequest);\r\n\t\t\treportingDownloadParameters.setResultFileName(System.currentTimeMillis()+\"_AdGroupReport.csv\");\r\n\t\t\t\r\n\t\t\t// 6. Download the report file\r\n\t\t\ttry {\r\n\t\t\t\tresultAdGroupReportFile = reportingManager.downloadFileAsync(\r\n\t\t\t\t\t\treportingDownloadParameters, \r\n\t\t\t\t\t\tnull).get(3600000, TimeUnit.MILLISECONDS);\r\n\r\n\t\t\t} catch (InterruptedException | ExecutionException | TimeoutException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\r\n\t\t\t// 7. prepare the DB\r\n\t\t\tinitializeMongoDb();\r\n\r\n\t\t\t// 8. process downloaded files\r\n\t\t\tList<Document> adList = new ArrayList<>(32);\r\n\t\t\tcount += processFile(resultAdReportFile, minRange, maxRange, true, true, adList);\r\n\t\t\tList<Document> adGroupList = new ArrayList<>(32);\r\n\t\t\tcount += processFile(resultAdGroupReportFile, minRange, maxRange, false, true, adGroupList);\r\n\t\t\t\r\n\t\t\tList<Document> allDocs = extrapolateHourlyPerformance(adList, adGroupList);\r\n\t\t\tinsertDocuments(allDocs);\r\n\t\t\t// 9. cleanup\r\n\t\t\tmongoClient.close();\r\n\t\t\tif (removeDownloadedReportFile) {\r\n\t\t\t\tif (resultAdReportFile != null) {\r\n\t\t\t\t\tresultAdReportFile.deleteOnExit();\r\n\t\t\t\t}\r\n\t\t\t\tif (resultAdGroupReportFile != null) {\r\n\t\t\t\t\tresultAdGroupReportFile.deleteOnExit();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t// 1. Prepare DB\r\n\t\t\tinitializeMongoDb();\r\n\t\t\t\r\n\t\t\t// 2. load from provided offline file\r\n\t\t\tList<Document> adGroupList = new ArrayList<>(32);\r\n\t\t\tcount += processFile(fromFile, minRange, maxRange, false, true, null);\r\n\t\t\t\r\n\t\t\t// 3. cleanup\r\n\t\t\tmongoClient.close();\r\n\t\t}\r\n\t\treturn count;\r\n\t}", "protected void returnTotalQuestQuota(Key ownerKey) throws ApiException {\n\t\tUser user = dao.get(ownerKey, User.class);\n\t\tint totalUsed = user.getQuota().getUsedQuestNum();\n\t\tuser.getQuota().setUsedQuestNum(totalUsed - 1);\n\t\tdao.save(user);\n\t}", "public CachetMetricList getMetrics() {\n throw new RuntimeException(\"Method not implemented.\");\n }", "public DataUsage getusageData(int uid)\n {\n Calendar calendar=Calendar.getInstance();\n long to=calendar.getTimeInMillis();\n calendar.add(Calendar.DAY_OF_MONTH,-30);\n long from=calendar.getTimeInMillis();\n\n double total=0;\n if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {\n NetworkStatsManager service=context.getSystemService(NetworkStatsManager.class);\n NetworkStats bucket= null;\n try {\n bucket = service.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,\"\",from,to,uid);\n double received=0;\n double send=0;\n\n //get the details along with the time of data usage of an application\n while (bucket.hasNextBucket())\n {\n NetworkStats.Bucket tempbucket=new NetworkStats.Bucket();\n bucket.getNextBucket(tempbucket);\n received=(double)tempbucket.getRxBytes()+received;\n send=(double)tempbucket.getTxBytes()+send;\n }\n bucket.close();\n DataUsage temp =new DataUsage();\n double uploaded=send/(1024*1024);\n double downloaded=received/(1024*1024);\n\n total=(received+send)/(1024*1024);\n\n temp.setDownload(\"\"+String.format(\"%.2f\",downloaded));\n temp.setUpload(\"\"+String.format(\"%.2f\",uploaded));\n temp.setTotal(\"\"+String.format(\"%.2f\",total));\n return temp;\n\n } catch (RemoteException e) {\n e.printStackTrace();\n }\n\n }\n\n return null;\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tsynchronized (DefaultResourceAllocator.this) {\n\t\t\t\t\tAgent agent = agentManager.load(agentId);\n\t\t\t\t\tagentResourceQuotas.put(agentId, agent.getResources());\n\t\t\t\t\tagentResourceUsages.put(agentId, new HashMap<>());\n\t\t\t\t\n\t\t\t\t\tfor (QueryCache cache: queryCaches.values()) {\n\t\t\t\t\t\tif (cache.query.matches(agent))\n\t\t\t\t\t\t\tcache.result.add(agentId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "public int getCapacity( Resource.Type type );", "public JSONObject getAllStatistics() throws UnirestException;", "private void getBatchStatisticsRequest() {\r\n\t\tBasicXmlDocument document = new BasicXmlDocument();\r\n\t\tdocument.parseString(\"<\" + TransactionType.GET_BATCH_STATISTICS.getValue()\r\n\t\t\t\t+ \" xmlns = \\\"\" + XML_NAMESPACE + \"\\\" />\");\r\n\r\n\t\taddAuthentication(document);\r\n\t\taddReportingBatchId(document);\r\n\r\n\t\tcurrentRequest = document;\r\n\t}", "void getRequests();", "@Override\n\tpublic List<StreamCounterVO> getStreamCounterList(int startLimit,\n\t\t\tint endLimit) throws DataAccessFailedException {\n\t\treturn null;\n\t}", "public String getBucket();", "com.google.protobuf.ByteString\n getNameKeySpaceBytes();", "public CostItem[] getCostReport(String start, String end) throws CostManagerException;", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "@Override\r\n\t\t\t\t\tpublic Iterator getPrefixes(String namespaceURI) {\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}", "List<IDiskSpace> getDiskSpace(List<String> filesystems) throws P4JavaException;", "@JsonIgnore public Collection<String> getServingSizes() {\n final Object current = myData.get(\"servingSize\");\n if (current == null) return Collections.emptyList();\n if (current instanceof Collection) {\n return (Collection<String>) current;\n }\n return Arrays.asList((String) current);\n }", "private void scanDocuments()\n{\n document_counts = new HashMap<>();\n kgram_counts = new HashMap<>();\n for (File f : root_files) {\n addDocuments(f);\n }\n}", "public void run()\n {\n \tAuthenticationUtil.runAs(new RunAsWork<String>()\n \t{\n \t\tpublic String doWork() throws Exception\n \t\t{\n \t\t\tRetryingTransactionCallback<Long> callback = new RetryingTransactionCallback<Long>()\n \t\t\t{\n \t\t\t\tpublic Long execute() throws Throwable\n \t\t\t\t{\n \t\t\t\t\tLong currentSize = (Long) serviceRegistry.getNodeService().getProperty(quotaFolder, FolderQuotaConstants.PROP_FQ_SIZE_CURRENT);\n \t\t\t\t\tif (currentSize == null) {\n \t\t\t\t\t\tcurrentSize=0L;\n \t\t\t\t\t}\n \t\t\t\t\tLong newSize = currentSize + sizeChange;\n \t\t\t\t\tserviceRegistry.getNodeService().setProperty(quotaFolder, FolderQuotaConstants.PROP_FQ_SIZE_CURRENT, newSize);\n \t\t\t\t\tlogger.debug(String.format(\"Property %s set to %s\",FolderQuotaConstants.PROP_FQ_SIZE_CURRENT, newSize));\n \t\t\t\t\treturn newSize;\n \t\t\t\t}\n \t\t\t};\n \t\t\ttry\n \t\t\t{\n \t\t\t\tRetryingTransactionHelper txnHelper = serviceRegistry.getTransactionService().getRetryingTransactionHelper();\n \t\t\t\tLong newSize = txnHelper.doInTransaction(callback, false, true);\n\n \t\t\t\tif (logger.isDebugEnabled())\n \t\t\t\t{\n \t\t\t\t\tlogger.debug(\n \t\t\t\t\t\t\t\"Incremented folder size on quota folder node: \\n\" +\n \t\t\t\t\t\t\t\t\t\" Node: \" + quotaFolder + \"\\n\" +\n \t\t\t\t\t\t\t\t\t\" New Size: \" + newSize);\n \t\t\t\t}\n \t\t\t}\n \t\t\tcatch (InvalidNodeRefException e)\n \t\t\t{\n \t\t\t\tif (logger.isDebugEnabled())\n \t\t\t\t{\n \t\t\t\t\tlogger.debug(\"Unable to update folder size on quota folder node: \" + quotaFolder);\n \t\t\t\t}\n \t\t\t}\n \t\t\tcatch (Throwable e)\n \t\t\t{\n \t\t\t\tif (logger.isDebugEnabled())\n \t\t\t\t{\n \t\t\t\t\tlogger.debug(e);\n \t\t\t\t}\n \t\t\t\tlogger.error(\"Failed to update folder size on quota folder node: \" + quotaFolder);\n \t\t\t}\n \t\t\treturn \"\";\n \t\t}\n \t}, AuthenticationUtil.getSystemUserName());\n }", "String getNameSpace();", "public DownloadScopeList getAvailableScopeList( )\r\n {\r\n if ( System.currentTimeMillis() >\r\n availableRangeSetTime + AVAILABLE_RANGE_SET_TIMEOUT )\r\n {\r\n setAvailableRangeSet( null );\r\n }\r\n return availableScopeList;\r\n }", "@Test\n public void testGetTimeUntilQuotaConsumedLocked_EqualTimeRemaining() {\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n setStandbyBucket(FREQUENT_INDEX);\n\n // Overlap boundary.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n now - (24 * HOUR_IN_MILLIS + 11 * MINUTE_IN_MILLIS),\n 4 * HOUR_IN_MILLIS,\n 5), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n now - (8 * HOUR_IN_MILLIS + MINUTE_IN_MILLIS), 3 * MINUTE_IN_MILLIS, 5),\n false);\n\n synchronized (mQuotaController.mLock) {\n // Both max and bucket time have 8 minutes left.\n assertEquals(8 * MINUTE_IN_MILLIS,\n mQuotaController.getRemainingExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n // Max time essentially free. Bucket time has 2 min phase out plus original 8 minute\n // window time.\n assertEquals(10 * MINUTE_IN_MILLIS,\n mQuotaController.getTimeUntilQuotaConsumedLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE).clear();\n // Overlap boundary.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n now - (24 * HOUR_IN_MILLIS + MINUTE_IN_MILLIS), 2 * MINUTE_IN_MILLIS, 5),\n false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n now - (20 * HOUR_IN_MILLIS),\n 3 * HOUR_IN_MILLIS + 48 * MINUTE_IN_MILLIS,\n 5), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n now - (8 * HOUR_IN_MILLIS + MINUTE_IN_MILLIS), 3 * MINUTE_IN_MILLIS, 5),\n false);\n\n synchronized (mQuotaController.mLock) {\n // Both max and bucket time have 8 minutes left.\n assertEquals(8 * MINUTE_IN_MILLIS,\n mQuotaController.getRemainingExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n // Max time only has one minute phase out. Bucket time has 2 minute phase out.\n assertEquals(9 * MINUTE_IN_MILLIS,\n mQuotaController.getTimeUntilQuotaConsumedLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n }", "private String getNamespace(String qname) {\n StringTokenizer tok = new StringTokenizer(qname, \":\");\n String prefix;\n\n if (tok.countTokens() == 1) {\n return \"\";\n }\n prefix = tok.nextToken();\n\n NamedNodeMap map = mDoc.getDocumentElement().getAttributes();\n for (int j = 0; j < map.getLength(); j++) {\n Node n = map.item(j);\n\n if (n.getLocalName().trim().equals(prefix.trim())) {\n return n.getNodeValue();\n }\n }\n\n return \"\";\n }", "private void refreshLimits() throws IOException, PrivilegedActionException {\n try (InputStream newInputStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {\n @Override\n public InputStream run() throws Exception {\n return delegate.newInputStream(configPath, StandardOpenOption.READ);\n }\n })) {\n Properties properties = new Properties();\n properties.load(newInputStream);\n total = Long.parseLong(properties.getProperty(\"total\"));\n remaining = Long.parseLong(properties.getProperty(\"remaining\"));\n }\n }", "@Override\n\tpublic Namespace getNamespace(Address addr) {\n\t\tif (addr.isMemoryAddress()) {\n\t\t\tfor (TraceSymbol sym : symbolManager.labels().getAt(program.snap, null, addr, true)) {\n\t\t\t\tif (sym instanceof TraceNamespaceSymbol /* Function */) {\n\t\t\t\t\treturn (TraceNamespaceSymbol) sym;\n\t\t\t\t}\n\t\t\t\treturn sym.getParentNamespace();\n\t\t\t}\n\t\t}\n\t\treturn symbolManager.getGlobalNamespace();\n\t}", "@Test\n public void testGetTimeUntilQuotaConsumedLocked_QuotaBump_CrucialBumps() {\n setDeviceConfigLong(QcConstants.KEY_QUOTA_BUMP_ADDITIONAL_DURATION_MS, MINUTE_IN_MILLIS);\n setDeviceConfigLong(QcConstants.KEY_QUOTA_BUMP_WINDOW_SIZE_MS, 8 * HOUR_IN_MILLIS);\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (25 * HOUR_IN_MILLIS),\n 30 * MINUTE_IN_MILLIS, 25), false);\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE)\n .add(new QuotaBump(now - 16 * HOUR_IN_MILLIS));\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE)\n .add(new QuotaBump(now - 12 * HOUR_IN_MILLIS));\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE)\n .add(new QuotaBump(now - 8 * HOUR_IN_MILLIS));\n // Without the valid quota bumps, the app would only 3 minutes until the quota was consumed.\n // The quota bumps provide enough quota to bridge the gap between the two earliest sessions.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (8 * HOUR_IN_MILLIS), 3 * MINUTE_IN_MILLIS, 1), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (8 * HOUR_IN_MILLIS - 5 * MINUTE_IN_MILLIS),\n 2 * MINUTE_IN_MILLIS, 5), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (2 * HOUR_IN_MILLIS + MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS, 1), false);\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE)\n .add(new QuotaBump(now - 15 * MINUTE_IN_MILLIS));\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (9 * MINUTE_IN_MILLIS), 2 * MINUTE_IN_MILLIS, 1), false);\n\n setStandbyBucket(FREQUENT_INDEX);\n synchronized (mQuotaController.mLock) {\n assertEquals(2 * MINUTE_IN_MILLIS,\n mQuotaController.getRemainingExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n assertEquals(7 * MINUTE_IN_MILLIS,\n mQuotaController.getTimeUntilQuotaConsumedLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n }", "java.lang.String getNamespace();", "@Override\n\tprotected String getNamespace() {\n\t\treturn NAMESPACE;\n\t}", "int getQuotaModeValue();", "Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException;", "@Override\n public List<Scope> getAllSharedScopes(String tenantDomain) throws APIManagementException {\n\n if (log.isDebugEnabled()) {\n log.debug(\"Retrieving all the shared scopes for tenant: \" + tenantDomain);\n }\n //Get all shared scopes\n List<Scope> allSharedScopes = ApiMgtDAO.getInstance().getAllSharedScopes(tenantDomain);\n //Get all scopes from KM\n List<Scope> allScopes = scopesDAO.getScopes(APIUtil.getTenantIdFromTenantDomain(tenantDomain));\n for (Scope scope : allSharedScopes) {\n for (Scope tempScope : allScopes) {\n if (scope.getKey().equals(tempScope.getKey())) {\n scope.setName(tempScope.getName());\n scope.setDescription(tempScope.getDescription());\n scope.setRoles(tempScope.getRoles());\n break;\n }\n }\n }\n return allSharedScopes;\n }", "@Override\n public int requestAvailableCapacity() {\n int total = facility.getCapacity();\n for (Facility facility : facilities) {\n total += facility.getCapacity();\n }\n return total;\n }", "private void gather(final Session s) throws Exception {\n\t\t//final MeasureHandler mHandler = Appctx.getBean(\"measurehandler\");\n\t\t//final List<CacheClusterBean> cache = s.createQuery(\n\t\t//\t\t\"from CacheClusterBean\").list();\n\t\t//for (final CacheClusterBean cluster : cache) {\n\t\t\t// if (!cluster.getLbStatus().endsWith(\"ready\")) {\n\t\t\t// logger.debug(\"Ignoring AC \" + cluster.getUserId() + \" LB \"\n\t\t\t// + cluster.getLoadBalancerName() + \" Status \"\n\t\t\t// + cluster.getLbStatus());\n\t\t\t// continue;\n\t\t\t// }\n\t\t\t// final long acid = cluster.getAccount().getId();\n\t\t\t// logger.debug(\"Gather AC \" + acid + \" Cluster \" +\n\t\t\t// cluster.getName());\n\t\t\t// final AccountBean acb = cluster.getAccount();\n\t\t\t// final AccountType ac = AccountUtil.toAccount(acb);\n\t\t\t//\n\t\t\t// final DimensionBean dim = CWUtil.getDimensionBean(s, acb.getId(),\n\t\t\t// \"CacheClusterId\", cluster.getName(), true);\n\t\t\t// final Set<DimensionBean> dims = new HashSet<DimensionBean>();\n\t\t\t// dims.add(dim);\n\t\t\t// BinLogDiskUsage Bytes\n\t\t\t// CPUUtilization Percent\n\t\t\t// DatabaseConnections Count\n\t\t\t// FreeableMemory Bytes\n\t\t\t// FreeStorageSpace Bytes\n\t\t\t// ReplicaLag Seconds\n\t\t\t// SwapUsage Bytes\n\t\t\t// ReadIOPS Count/Second\n\t\t\t// WriteIOPS Count/Second\n\t\t\t// ReadLatency Seconds\n\t\t\t// WriteLatency Seconds\n\t\t\t// ReadThroughput Bytes/Second\n\t\t\t// WriteThroughput Bytes/Second\n\n\t\t//}\n\t}", "@Override\n\tpublic String getNamespace() {\n\t\treturn nameSpace;\n\t}", "@Override\n protected void initializeNamespaces() {\n\n cds.nsUriToPrefixMap.put(XMI_NS_URI, XMI_NS_PREFIX);\n\n // Add any namespace prefix mappings used by out of type system data.\n // Need to do this before the in-typesystem namespaces so that the prefix\n // used here are reserved and won't be reused for any in-typesystem namespaces.\n\n if (cds.sharedData != null) {\n Iterator<OotsElementData> ootsIter = cds.sharedData.getOutOfTypeSystemElements().iterator();\n while (ootsIter.hasNext()) {\n OotsElementData oed = ootsIter.next();\n String nsUri = oed.elementName.nsUri; // http://... etc\n String qname = oed.elementName.qName; // xxx:yyy\n String localName = oed.elementName.localName; // yyy\n String prefix = qname.substring(0, qname.indexOf(localName) - 1); // xxx\n cds.nsUriToPrefixMap.put(nsUri, prefix);\n cds.nsPrefixesUsed.add(prefix);\n }\n }\n\n /*\n * Convert x.y.z.TypeName to prefix-uri, TypeName, and ns:TypeName\n */\n Iterator<Type> it = cds.tsi.getTypeIterator();\n while (it.hasNext()) {\n TypeImpl t = (TypeImpl) it.next();\n // this also populates the nsUriToPrefix map\n cds.typeCode2namespaceNames[t.getCode()] = uimaTypeName2XmiElementName(t.getName());\n }\n }", "public Set collectFontInfo()\n\t{\n\t Style root = getStyle(\"base\");\n\t\tHashSet set = new HashSet();\n\t collectFontInfo(root,set);\n\t\treturn set;\n\t}", "private SubscriptionList getAllVersionsSubscriptions(String baseNamespace, String libraryName) throws RepositoryException {\n \tString cacheKey = baseNamespace + \"~\" + libraryName;\n \tSubscriptionResource sr = allVersionsCache.get( cacheKey );\n \t\n \tif (sr == null) {\n \t\ttry {\n\t\t\t\tsr = new SubscriptionResource( fileUtils, baseNamespace, libraryName, null );\n\t\t\t\tallVersionsCache.put( cacheKey, sr );\n\t\t\t\t\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RepositoryException(\"Error loading subscription list content.\", e);\n\t\t\t}\n \t}\n \treturn sr.getResource();\n }", "@Override\n\t\n\tpublic QuotaReturn getUserQuota(String key, String userName) {\n\t\tcustom_types.wservices.ObjectFactory of = new custom_types.wservices.ObjectFactory();\n\t\tQuotaReturn qr = of.createQuotaReturn();\n\t\t// setQuota(JAXBElement<QuotaType> value)\n\t\tQuotaType qt = of.createQuotaType();\n\t\tqt.setBasicQuota(of.createQuotaTypeBasicQuota(new Double(10)));\n\t\tqt.setConsumedTopupQuota(of.createQuotaTypeConsumedTopupQuota(new Double(5)));\n\t\tqt.setEndDate(of.createQuotaTypeEndDate(\"1/8/2019\"));\n\t\tqt.setRemainingTopupQuota(of.createQuotaTypeRemainingTopupQuota(new Double(7)));\n\t\tqt.setService(of.createQuotaTypeService(userName));\n\t\tqt.setStartDate(of.createQuotaTypeStartDate(\"1/1/2019\"));\n\t\tqt.setTotalAllowedQuota(of.createQuotaTypeTotalAllowedQuota(new Double(30)));\n\t\tqt.setTotalConsumedQuota(of.createQuotaTypeTotalConsumedQuota(new Double(12)));\n\t\tqt.setTotalTopupQuota(of.createQuotaTypeTotalTopupQuota(new Double(5)));\n\t\t\n\t\tProducerTemplate producer = camelContext.createProducerTemplate();\n\t\tproducer.requestBodyAndHeader(\"direct:start\", userName, \"userName\", userName, String.class);\n\t\t \n\t\t//String result = producer.requestBodyAndHeader(\"direct:start\", userName, \"userName\", userName, String.class);\n\t\t//System.out.println(\"---s----\");\n\t\t//System.out.println(result); \n\t\t\n //String result = producer.requestBody(\"direct:start\", userName, String.class);\n //qt.setService(of.createQuotaTypeService(result));\n \n\t\tqr.setQuota(of.createQuotaType(qt));\n\t\tqr.setSuccess(of.createBasicReturnSuccess(true));\n\t\t\n\t\t\n\t\treturn qr;\n\t}", "public String getNameSpace() {\n return this.namespace;\n }", "public java.util.Map<String,String> getNamespaces() {\n return (_namespaces);\n }", "private void genFillNamespacePrefixes(ArrayList nss, MethodBuilder mb) {\n if (nss != null) {\n for (int i = 0; i < nss.size(); i++) {\n mb.appendDUP();\n mb.appendLoadConstant(i);\n String prefix = ((NamespaceDefinition)nss.get(i)).getPrefix();\n if (prefix == null) {\n prefix = \"\";\n }\n mb.appendLoadConstant(prefix);\n mb.appendAASTORE();\n }\n }\n }", "@DefaultValue(\"300000\")\n long getNodeGcTtlMs();", "@Override\n public RateLimiter load(String token) {\n Map<String, Integer> customizeTenantQpsRate = trafficConfiguration.getCustomizeTenantQpsRate();\n int tenantQuota = trafficConfiguration.getDefaultTenantQpsRate();\n if (MapUtils.isNotEmpty(customizeTenantQpsRate)) {\n tenantQuota = customizeTenantQpsRate.getOrDefault(token, trafficConfiguration.getDefaultTenantQpsRate());\n }\n // use tenant default rate limit\n return RateLimiter.create(tenantQuota, 1, TimeUnit.SECONDS);\n }", "protected Collection getNewBucket()\n {\n return new ArrayList();\n }", "long getRequestsCount();", "public List<Map<String, Object>> ListStatistics(Timestamp start, Timestamp end) {\n\t\treturn statisticsMapper.ListStatistics(start,end);\n\t}", "public long getFreeSpace(){\n return freeSpace;\n }", "abstract protected NamespaceProperties retrieveFullNamespaceProperties(long nsContext)\n throws NamespacePropertiesRetrievalException;", "public double getTotalRamGB () { return n.getResources(RESOURCETYPE_RAM).stream().mapToDouble(r->r.getCapacity()).sum (); }", "public ArrayList getNamespaces() {\n return m_namespaces;\n }", "public XmlWorkerUserstats(){\r\n \t\tthis.statsDS = new UserstatsDS();\r\n \t\titemResolver = new hModItemResolver(new File(statsDS.getDataFolder(),\"items.txt\"));\r\n \t\tresolveCats = new String[]{\"blockdestroy\", \"blockcreate\", \"itemdrop\", \"itempickup\"};\r\n \t}", "StorageResourceUsage getStorageResourceUsage(String resourceName);", "private static List<GdalS3DataRequest> requestList(String bucketName) \n throws AmazonServiceException, AmazonClientException{\n\n List<GdalS3DataRequest> res = new ArrayList<GdalS3DataRequest>();\n\n AmazonS3 s3Client = new AmazonS3Client(new EnvironmentVariableCredentialsProvider());\n ListObjectsV2Request req = new ListObjectsV2Request().withBucketName(bucketName);\n ListObjectsV2Result result;\n\n do {\n result = s3Client.listObjectsV2(req);\n result.setMaxKeys(20);\n for (S3ObjectSummary objectSummary: result.getObjectSummaries()) {\n GdalS3DataRequest dr = new GdalS3DataRequest(bucketName, \n objectSummary.getKey());\n res.add(dr);\n }\n } while (result.isTruncated() == true);\n\n //return res.subList(0,10); //for testing and cost reduction during dev\n return res;\n }", "private SensorData collectMemoryInfo() throws SigarException {\n \n if (LOG.isDebugEnabled()) {\n LOG.debug(\"Collecting Memory Utilization Information\");\n }\n SensorData data = new SensorData();\n \n Mem mem = sigar.getMem();\n \n data.add(SensorAttributeConstants.MemoryConstants.TOTAL_MEMORY, (mem.getTotal() / (1024 * 1024)));\n data.add(SensorAttributeConstants.MemoryConstants.FREE_MEMORY, (mem.getFree() / (1024 * 1024)));\n data.add(SensorAttributeConstants.MemoryConstants.MEM_ACTUAL_USED, (mem.getActualUsed() / (1024 * 1024)));\n \n return data;\n }", "public final int getNamespaceCount() {\n int count = m_uris.length;\n if (m_extensionUris != null) {\n for (int i = 0; i < m_extensionUris.length; i++) {\n count += m_extensionUris[i].length;\n }\n }\n return count;\n }", "@Override\n\tpublic long getUsedSpace()\n\t{\n\t\treturn 0;\n\t}" ]
[ "0.62808937", "0.6196239", "0.61383444", "0.57307744", "0.5670178", "0.5651722", "0.5495213", "0.54546016", "0.5452423", "0.53564346", "0.5321322", "0.5263029", "0.5229553", "0.5201699", "0.51655835", "0.5017903", "0.500623", "0.50041914", "0.4992819", "0.49797747", "0.49778622", "0.48896328", "0.48679608", "0.48603073", "0.48517933", "0.4834195", "0.4832398", "0.47827235", "0.4762761", "0.47473115", "0.4721269", "0.47032237", "0.47032025", "0.4699379", "0.46967253", "0.46903703", "0.46733704", "0.4654995", "0.46345696", "0.4624867", "0.46178272", "0.45932204", "0.45908096", "0.45681074", "0.45640796", "0.45560333", "0.45542872", "0.45424712", "0.4542161", "0.45404872", "0.45370212", "0.45359287", "0.45276004", "0.45263404", "0.45246473", "0.45246473", "0.45246473", "0.45246473", "0.45246473", "0.4517566", "0.45131078", "0.45113236", "0.4511195", "0.45096463", "0.45074016", "0.45026562", "0.44990245", "0.44973537", "0.44966546", "0.44850737", "0.44828036", "0.44822764", "0.44734272", "0.44704103", "0.4467451", "0.44599515", "0.44564855", "0.44539374", "0.4453558", "0.44510138", "0.44462982", "0.4436102", "0.44347253", "0.44330886", "0.44279945", "0.44222212", "0.44196892", "0.4418547", "0.44043183", "0.43995807", "0.43986782", "0.43984112", "0.43919706", "0.43880633", "0.43811423", "0.43787214", "0.43729356", "0.43675035", "0.43669525", "0.43669084" ]
0.7177791
0
creating request handler object
@Override protected String doInBackground(Void... voids) { RequestHandler requestHandler = new RequestHandler(); String id = String.valueOf(SharedPrefManagerTechnician.getInstance(context).getTechnician().getId()); //creating request parameters HashMap<String, String> params = new HashMap<>(); params.put("technician_id", id); //returing the response return requestHandler.sendPostRequest(Apis.GET_CREATE_JOB_LIST_URL, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "CreateHandler()\n {\n }", "private Handler getHandler(Request request) {\n return resolver.get(request.getClass().getCanonicalName()).create();\n }", "Object handle(Object request);", "public void handleRequest(Request req) {\n\n }", "public RequestUrlHandler() {\n // requestService = SpringContextHolder.getBean(ScfRequestService.class);\n }", "ResponseHandler createResponseHandler();", "public GenericHandler() {\n\n }", "protected Object getHandlerInternal(HttpServletRequest request) {\n String lookupPath = WebUtils.getLookupPathForRequest(request, this.alwaysUseFullPath);\n logger.debug(\"Looking up handler for: \" + lookupPath);\n return lookupHandler(lookupPath);\n }", "public Object handleRequest(P request) throws Exception;", "public RequestHandler getRequestHandlerInstance() {\n Object obj;\n try {\n obj = klass.newInstance();\n } catch (Exception e) {\n throw new RuntimeException(\"Problem during the Given class instanciation please check your contribution\", e);\n }\n if (obj instanceof RequestHandler) {\n RequestHandler rh = (RequestHandler) obj;\n rh.init(properties);\n return rh;\n }\n\n throw new RuntimeException(\"Given class is not a \" + RequestHandler.class + \" implementation\");\n }", "void handleRequest();", "public interface RequestHandler {\n\tpublic Map<String,Object> handleRequest(Map<String,Object> request,\n\t\t\t InetAddress client);\n}", "public void create(HandlerContext context, Management request, Management response) {\n\t\t// TODO Auto-generated method stub\n\n\t}", "void init(HandlerContext context);", "default Handler asHandler() {\n return new HandlerBuffer(this);\n }", "private CustomRequest getCustomRequestFor(HttpRequest aRequest,\n Handler aHandler) {\n int lRequestMapped = mapToVolleyMethodCode(aRequest.getMethod());\n RequestComposite lMap = new RequestComposite();\n lMap.setHttpReq(aRequest);\n Handler lHandler = aHandler == null ? mainHandler : aHandler;\n Listener<String> lListener = getListenerForRequest(lMap, lHandler);\n Response.ErrorListener lErrorListener = getErrorListenerForRequest(lMap,\n lHandler);\n CustomRequest lReq = new CustomRequest(lRequestMapped,\n aRequest.getUrl(), lListener, lErrorListener, aRequest);\n // update the reference in the map.\n lMap.setVolleyReq(lReq);\n return lReq;\n }", "public Handler getHandler();", "BodyHandler getBodyHandler();", "private void requestHandler(Object context)\n {\n final String funcName = \"requestHandler\";\n @SuppressWarnings(\"unchecked\")\n TrcRequestQueue<Request>.RequestEntry entry = (TrcRequestQueue<Request>.RequestEntry) context;\n Request request = entry.getRequest();\n\n if (debugEnabled)\n {\n dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.TASK, \"request=%s\", request);\n }\n\n request.canceled = entry.isCanceled();\n if (!request.canceled)\n {\n if (request.readRequest)\n {\n request.buffer = readData(request.address, request.length);\n if (debugEnabled)\n {\n if (request.buffer != null)\n {\n dbgTrace.traceInfo(funcName, \"readData(addr=0x%x,len=%d)=%s\",\n request.address, request.length, Arrays.toString(request.buffer));\n \n }\n }\n }\n else\n {\n request.length = writeData(request.address, request.buffer, request.length);\n }\n }\n\n if (request.completionEvent != null)\n {\n request.completionEvent.set(true);\n }\n\n if (request.completionHandler != null)\n {\n request.completionHandler.notify(request);\n }\n\n if (debugEnabled)\n {\n dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.TASK);\n }\n }", "public RequestAction geRequestHandler(String request){\n RequestAction requestHandler =requestHandlerMap.get(request);\n if(requestHandler ==null)\n return requestHandlerMap.get(\"notSupported\");\n return requestHandler;\n }", "protected synchronized ScriptHandler getScriptHandler(String request, String[] params) {\r\n \thandlerLock.lock();\r\n if (currentLoader != null || currentScriptHandler != null) {\r\n }\r\n if (params == null)\r\n currentScriptHandler = new ScriptHandler(request);\r\n else\r\n currentScriptHandler = new ScriptHandler(request, params);\r\n return currentScriptHandler;\r\n }", "PaymentHandler createPaymentHandler();", "public HandlerExecutionChain getHandler(HttpServletRequest request) {\n\t\tString url = request.getServletPath();\n\t\tSystem.out.println(url+\" 123\");\n\t\tController ctl = (Controller) ApplicationContext.getBean(url);\n\t\tHandlerExecutionChain chain = new HandlerExecutionChain();\n\t\tchain.setHandler(ctl);\n\t\treturn chain;\n\t}", "public interface Handler {\n boolean supports(HttpServletRequest request);\n\n void handle(HttpServletRequest request, HttpServletResponse response);\n}", "public abstract void handle(Request request, Response response) throws Exception;", "@FunctionalInterface\n\tinterface RequestHandler {\n\t public Request handle(Request req);\n\n\t // !!! write a method handle that accept request and returns new request here\n\t // it allows to use lambda expressions for creating handlers below\n\n\t // !!! write a default method for combining this and other handler single one\n\t // the order of execution may be any but you need to consider it when composing handlers\n\t // the method may has any name\n\t \n\t default RequestHandler combine(RequestHandler h) {\n\t \t\n\t \treturn req -> h.handle(this.handle(req));\n\t }\n\t \n\t \n\t}", "public interface Controller {\r\n Object handle(WebRequest request);\r\n}", "Handler<Q, R> handler();", "protected Object lookupHandler(String urlPath, HttpServletRequest request) throws Exception\r\n\t{\n\t\tObject handler = super.lookupHandler(urlPath, request);\r\n\t\tif (handler == null)\r\n\t\t{ // 800, 如果uri直接查找不到,则匹配前面一个\r\n\t\t\tString path = urlPath.substring(0, urlPath.indexOf('/', 2));\r\n\t\t\thandler = super.lookupHandler(path, request);\r\n//\t\t\tSystem.out.println(\"path: \" + path + \":\" + handler);\r\n\t\t}\r\n\t\thandler = handler == null ? getRootHandler() : handler;\r\n//\t\tSystem.out.println(\"urlPath: \" + urlPath + \":\" + handler);\r\n\t\treturn handler;\r\n\t}", "public interface Handler {\n void handleRequest(String s);\n}", "public RESTWorkItemHandler() {\n\t}", "private Handler wrap (BiFunction<Request, Response, Object> h) {\n return request -> h.apply (request, request.response);\n }", "private void addHandlers()\n {\n handlers.add(new FileHTTPRequestHandler());\n }", "public interface RequestHandler {\r\n /**\r\n * Handle the request and response.\r\n *\r\n *\r\n * @param xmlRequest\r\n * the xml request element\r\n * @param req\r\n * the http request\r\n * @param res\r\n * the http response\r\n * @throws IllegalArgumentException\r\n * if argument is null\r\n * @throws IOException\r\n * if I/O error occurs\r\n */\r\n public void handle(Element xmlRequest, HttpServletRequest req, HttpServletResponse res) throws IOException;\r\n\r\n}", "abstract public TelnetServerHandler createHandler(TelnetSocket s);", "public interface HttpRequestHandler {\n public boolean canHandle(String uri);\n public httpResponse handle(httpRequest request);\n}", "static HttpRequestInitializer getRequestInitializer() {\n return new HttpRequestInitializer() {\n @Override\n public void initialize(final HttpRequest arg0) {\n }\n };\n }", "private HandlerBuilder() {\n }", "void createHandler(final String handlerClassName);", "public interface IHttpRequestHandler extends INamedObject\r\n{\t\r\n public HandlerResponse handleRequest( HttpRequestData httpRequest ) throws IOException;\r\n}", "public void handler(AbstractRequest request) {\n\t\tSystem.out.println(\"===handle1\" + request.getContent());\n\t}", "private Request() {}", "private Request() {}", "private Handler<org.vertx.java.core.http.HttpClientResponse> createResponseHandler(Env env, Callback handler) {\n return new Handler<org.vertx.java.core.http.HttpClientResponse>(env, handler, new ArgumentModifier<org.vertx.java.core.http.HttpClientResponse, HttpClientResponse>() {\n @Override\n public HttpClientResponse modify(org.vertx.java.core.http.HttpClientResponse response) {\n return new HttpClientResponse(response);\n }\n });\n }", "void filterCreate(ServerContext context, CreateRequest request,\n ResultHandler<Resource> handler, RequestHandler next);", "public Class<?> getHandler();", "public RequestHandler(ThreadPoolExecutor taskExecutor) {\n super();\n this.taskExecutor = taskExecutor;\n }", "public HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception {\n String uri = request.getRequestURI();\n return new SpecHandlerExecutionChain(new SpecHandler(uri));\n }", "private void initializeHandler() {\n if (handler == null) {\n handler = AwsHelpers.initSpringBootHandler(Application.class);\n }\n }", "static String getHandler(HttpServletRequest request) {\n String requestURI = request.getRequestURI();\n return requestURI.substring(getDividingIndex(requestURI) + 1);\n }", "public interface BeforeHandler {\n void execute(Map<String, Object> body,HttpServletRequest request) throws Exception;\n}", "public Hello(Handler handler){\n this.handler = handler;\n }", "default RequestHandler combine(RequestHandler h) {\n\t \t\n\t \treturn req -> h.handle(this.handle(req));\n\t }", "@Override\n\tpublic void postHandle(WebRequest request, ModelMap model) throws Exception {\n\n\t}", "public interface ResponseHandlerInterface {\n\n /**\n * Returns data whether request completed successfully\n *\n * @param response HttpResponse object with data\n * @throws java.io.IOException if retrieving data from response fails\n */\n void sendResponseMessage(HttpResponse response) throws IOException;\n\n /**\n * Notifies callback, that request started execution\n */\n void sendStartMessage();\n\n /**\n * Notifies callback, that request was completed and is being removed from thread pool\n */\n void sendFinishMessage();\n\n /**\n * Notifies callback, that request (mainly uploading) has progressed\n *\n * @param bytesWritten number of written bytes\n * @param bytesTotal number of total bytes to be written\n */\n void sendProgressMessage(int bytesWritten, int bytesTotal);\n\n /**\n * Notifies callback, that request was cancelled\n */\n void sendCancelMessage();\n\n /**\n * Notifies callback, that request was handled successfully\n *\n * @param statusCode HTTP status code\n * @param headers returned headers\n * @param responseBody returned data\n */\n void sendSuccessMessage(int statusCode, Header[] headers, byte[] responseBody);\n\n /**\n * Returns if request was completed with error code or failure of implementation\n *\n * @param statusCode returned HTTP status code\n * @param headers returned headers\n * @param responseBody returned data\n * @param error cause of request failure\n */\n void sendFailureMessage(int statusCode, Header[] headers, byte[] responseBody, Throwable error);\n\n /**\n * Notifies callback of retrying request\n *\n * @param retryNo number of retry within one request\n */\n void sendRetryMessage(int retryNo);\n\n /**\n * Returns URI which was used to request\n *\n * @return uri of origin request\n */\n public URI getRequestURI();\n\n /**\n * Returns Header[] which were used to request\n *\n * @return headers from origin request\n */\n public Header[] getRequestHeaders();\n\n /**\n * Helper for handlers to receive Request URI info\n *\n * @param requestURI claimed request URI\n */\n public void setRequestURI(URI requestURI);\n\n /**\n * Helper for handlers to receive Request Header[] info\n *\n * @param requestHeaders Headers, claimed to be from original request\n */\n public void setRequestHeaders(Header[] requestHeaders);\n\n /**\n * Can set, whether the handler should be asynchronous or synchronous\n *\n * @param useSynchronousMode whether data should be handled on background Thread on UI Thread\n */\n void setUseSynchronousMode(boolean useSynchronousMode);\n\n /**\n * Returns whether the handler is asynchronous or synchronous\n *\n * @return boolean if the ResponseHandler is running in synchronous mode\n */\n boolean getUseSynchronousMode();\n}", "public static IProtocolHandler createHandler(String type) {\n if (type==null) {\n return new RestHandler(); //use REST by default\n } else if (type.equalsIgnoreCase(\"rest\")) {\n return new RestHandler();\n } else if (type.equalsIgnoreCase(\"soap\")) {\n //for future use\n return null;\n } else {\n throw new IllegalArgumentException(\"Unknown protocol type: \" + type);\n }\n }", "RequestDelegator getDelegator();", "public void handleRequest () {\n\t// TODO: move this method to separate thread, \n\t// TODO: it may block in many places.\n\tRequestHandler rh = new RequestHandler ();\t\n\tCache<HttpHeader, HttpHeader> cache = proxy.getCache ();\n\tString method = request.getMethod ();\n\tif (!method.equals (\"GET\") && !method.equals (\"HEAD\"))\n\t cache.remove (request);\n\t\t\n\trh.entry = cache.getEntry (request);\n\tif (rh.entry != null)\n\t rh.dataHook = rh.entry.getDataHook (proxy.getCache ());\n\n\tcheckNoStore (rh.entry);\n\tif (!rh.cond.checkMaxStale (request, rh) && checkMaxAge (rh))\n\t setMayUseCache (false);\n\t\n\trh.conditional = rh.cond.checkConditional (this, request, rh);\n\tif (partialContent (rh)) \n\t fillupContent (rh);\n\tcheckIfRange (rh);\n\n\tboolean mc = getMayCache ();\n\tif (getMayUseCache ()) {\n\t // in cache?\n\t if (rh.entry != null) {\n\t\tCacheChecker cc = new CacheChecker ();\n\t\tif (cc.checkCachedEntry (this, request, rh)) {\n\t\t return;\n\t\t}\n\t }\n\t}\n\t\n\tif (rh.content == null) {\n\t // Ok cache did not have a usable resource, \n\t // so get the resource from the net.\n\t // reset value to one before we thought we could use cache...\n\t mayCache = mc;\n\t SWC swc = new SWC (this, proxy.getOffset (), request, requestBuffer,\n\t\t\t tlh, clientResourceHandler, rh);\n\t swc.establish ();\n\t} else {\n\t resourceEstablished (rh);\n\t}\n }", "public interface ZmoteHTTPDRequestHandler{\n\tpublic String getURI();\n\tpublic Response serve(String uri, String method, Properties header, Properties parms, Properties files, ZmoteHTTPD httpd);\t\n\tpublic ZmoteHTTPDRequestHandler clone();\n}", "HandlerHelper getHandlerHelper() {\n return handlerHelper;\n }", "private PersonHandler() {\n }", "public interface HttpHandler {\n public void handle(HttpExchange httpExchange) throws IOException;\n}", "public Object createContext(ApplicationRequest request,\n ApplicationResponse response);", "private Request() {\n initFields();\n }", "public abstract Response create(Request request, Response response);", "Call mo35727a(Request request);", "public StreamHandler createStreamHandler (OutputStream outStream) {\r\n\t\t\t\t\t\r\n\t\tStreamHandler streamHandler = null;\r\n\r\n\t\ttry {\r\n\t\t\t\t \t\r\n\t\t\tstreamHandler = new StreamHandler(outStream, new SimpleFormatter());\r\n\t\t\t\t\t\t\r\n\t\t} catch (SecurityException e) {\r\n\t\t\t\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\t\t \r\n\t\t\treturn streamHandler;\r\n\t}", "protected FedoraContentModelHandler() {\r\n }", "public HttpHandler createProxyHandler() {\n return ProxyHandler.builder()\n .setProxyClient(container.getProxyClient())\n .setMaxRequestTime(maxRequestTime)\n .setMaxConnectionRetries(maxRetries)\n .setReuseXForwarded(reuseXForwarded)\n .build();\n }", "public Handler getHandler(RouteRequest request) {\n List<Route> routes = methodRoutes.get(request.getMethod());\n if (routes != null) {\n for (Route r : routes) {\n RouteTemplate template = r.getRouteTemplate();\n Optional<HashMap<String, Parameter>> match = template.match(request.getPath());\n if (match.isPresent()) {\n request.setPathParameters(match.get());\n return r.getHandler();\n }\n }\n }\n\n return r -> new HandlerResponse(new ExceptionView(new RouteNotFoundException(r.getPath())))\n .setStatusCode(StatusCode.NOT_FOUND);\n }", "private RequestExecution() {}", "public CallAppAbilityConnnectionHandler createHandler() {\n EventRunner create = EventRunner.create();\n if (create != null) {\n return new CallAppAbilityConnnectionHandler(create);\n }\n HiLog.error(LOG_LABEL, \"createHandler: no runner.\", new Object[0]);\n return null;\n }", "public ConsoleHandler createConsoleHandler () {\r\n\t\t\t\r\n\t\tConsoleHandler consoleHandler = null;\r\n\t\t\t\r\n\t\ttry {\r\n\t\t \t\r\n\t\t\tconsoleHandler = new ConsoleHandler();\r\n\t\t\t\t\r\n\t\t} catch (SecurityException e) {\r\n\t\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t \r\n\t\t return consoleHandler;\r\n\t}", "public interface HttpRequestFactory\n{\n\n\tpublic abstract HttpRequest buildHttpRequest(HttpMethod httpmethod, String s);\n\n\tpublic abstract HttpRequest buildHttpRequest(HttpMethod httpmethod, String s, Map map);\n\n\tpublic abstract PinningInfoProvider getPinningInfoProvider();\n\n\tpublic abstract void setPinningInfoProvider(PinningInfoProvider pinninginfoprovider);\n}", "public static HandlerBuilder newHandlerBuilder() {\n return new HandlerBuilder();\n }", "public Message handleRequest(Message request){\n\n Message error = new Message(Message.GENERIC_ERROR);\n\n switch (request.getId()){\n\n case Message.LOGIN:\n return handleLogin(request);\n case Message.CREATE_DOCUMENT:\n return handleCreate(request);\n case Message.REMOVE_INVITE:\n controlServer.removeInvite(request.getUserName(),request.getDocumentName());\n return request;\n case Message.PORTIONS:\n System.out.println(\"HANDLER pre-handle: \" +request.getDocumentName());\n request.setSectionNumbers(controlServer.getPortions(request.getDocumentName()));\n return request;\n case Message.ADMINS:\n Message response = new Message(Message.ADMINS);\n response.setStringVector(new Vector<>(controlServer.getAdmins(request.getDocumentName())));\n return response;\n case Message.USERS:\n request.setStringVector(controlServer.getUserNames());\n return request;\n case Message.INVITATION:\n controlServer.addAdmin(request.getDocumentName(),request.getReceiver());\n controlServer.addInvite(request.getReceiver(),request.getDocumentName());\n request.setId(Message.INVITE_SENT);\n return request;\n case Message.GET_INVITES:\n String owner = request.getUserName();\n request.setStringVector(controlServer.getUserData(owner).getInvites());\n return request;\n case Message.GET_USERDATA:\n return handleGetUserData(request);\n case Message.LOCK:\n if(!controlServer.lock(request.getDocumentName(),request.getSectionNumbers()))\n request.setId(Message.LOCK_NOK);\n else\n request.setId(Message.LOCK_OK);\n return request;\n case Message.UNLOCK:\n if(controlServer.unlock(request.getDocumentName(),request.getSectionNumbers()))\n request.setId(Message.UNLOCK_OK);\n return request;\n case Message.EDIT:\n String DocumentName = request.getDocumentName();\n int SectionNumbers = request.getSectionNumbers();\n request.setText(controlServer.getSection(DocumentName,SectionNumbers));\n return request;\n case Message.END_EDIT:\n controlServer.editDoc(request.getDocumentName(),request.getSectionNumbers(),request.getText());\n return request;\n case Message.PRINT:\n request.setText(controlServer.getDocumentString(request.getDocumentName()));\n return request;\n case Message.SHOW:\n String text = controlServer.getSection(request.getDocumentName(),request.getSectionNumbers());\n request.setText(text);\n return request;\n default:\n controlServer.showMessage(\"unknown request\");\n break;\n }return error;\n }", "public interface HttpServletRequestHandler {\r\n\tpublic void handle(HttpServletRequest request, HttpServletResponse response) throws IOException;\r\n}", "public void registerHandler(Object handler)\n {\n\n }", "@Override\n public MockResponse handleCreate(RecordedRequest request) {\n return process(request, postHandler);\n }", "public static Runnable getServiceHandler(TcpPacket request, Socket socket, IndexFile index) {\n MessageType requestType = request.getMessageType();\n Request toProcess = null;\n if (requestType != MessageType.LIST){\n toProcess = NetworkUtils.getPacketContents(request);\n }\n switch (requestType) {\n case DOWNLOAD:\n return new DownloadServiceHandler(socket, toProcess, index);\n case UPLOAD:\n return new UploadServiceHandler(socket, toProcess, index);\n case DELETE:\n return new DeleteServiceHandler(socket, toProcess, index);\n case LIST:\n return new FileListServiceHandler(socket, index);\n default:\n //\n // throw new Exception(\"Wrong request type\");\n return null;\n }\n\n }", "Map<String, Handler> handlers();", "public DefaultHttpRequest() {\n }", "@Override\n public void handleRequest(HttpServerExchange exchange) throws Exception {\n if (exchange.isInIoThread()) {\n exchange.dispatch(this);\n return;\n }\n\n // We check if the engine was initially loaded or at least tried to be loaded\n if (currentEngine.get() == null) {\n Optional<ScriptRunner> optRunner = loadAndSetScriptRunner();\n if (Boolean.parseBoolean(refresh)) {\n optRunner.ifPresent(runner -> {\n reloadOnChange(runner.getFile());\n });\n }\n }\n\n Optional<ScriptRunner> runner = currentEngine.get();\n if (runner.isPresent()) {\n try {\n Invocable invocable = (Invocable) runner.get().getEngine();\n JSFilterData data = new JSFilterData(exchange, next, runner.get().getScriptLogger());\n invocable.invokeFunction(\"handleRequest\", data);\n } catch (ScriptException | NoSuchMethodException invocationException) {\n LOGGER.warning(\"undertow-jsfilters: failure calling method '\" + \"handleRequest\" + \"' in file => \" + this.fileName);\n LOGGER.throwing(fileName, \"handleRequest\", invocationException);\n next.handleRequest(exchange);\n return;\n }\n } else {\n next.handleRequest(exchange);\n return;\n }\n }", "private void callHandler(String method, HttpServletRequest request, HttpServletResponse response) throws IOException {\n JsonElement payload = getPayload(request, response);\n RequestContext context = new RequestContext(\n request, response, urlVariables, request.getParameterMap(), payload);\n PathNode apiStructure = getApiStructure(method);\n\n if (request.getPathInfo() == null) {\n logger.warn(\"Received \" + method + \" request with empty path.\");\n return;\n }\n\n PathNode.PathNodeResult result = apiStructure.getBindingForSubPath(request.getPathInfo());\n if (result != null) {\n urlVariables.putAll(result.getArgValues());\n result.getApiSpec().apiInterface.call(context);\n }\n }", "void onHTTPRequest(HTTPRequest request, HTTPResponse response);", "public interface Request {\n public String toXml();\n\n\n public String getHandlerId();\n\n\n public String getRequestId();\n}", "public void build() {\n\t\t\tRequest request = new Request();\n request.context = context;\n\t\t\trequest.requestType = requestType;\n\t\t\trequest.url = url;\n\t\t\trequest.envelope = envelope;\n\t\t\trequest.headers = headers;\n\n\t\t\trequest.responseListener = responseListener;\n\t\t\trequest.onValidateResponseListener = validateResponseListener;\n\n\t\t\trequest.isDebug = isDebug;\n\n\t\t\trequest.start();\n\t\t}", "public static QueryParamHandler create(QueryParamMapping mapping) {\n return new QueryParamHandler(mapping);\n }", "private final static HttpRequest createRequest() {\r\n\r\n HttpRequest req = new BasicHttpRequest\r\n (\"GET\", \"/\", HttpVersion.HTTP_1_1);\r\n //(\"OPTIONS\", \"*\", HttpVersion.HTTP_1_1);\r\n\r\n return req;\r\n }", "public SocketHandler createSocketHandler (String host, int port) {\r\n\t\t\t\t\t\t\t\r\n\t\tSocketHandler socketHandler = null;\r\n\r\n\t\ttry {\r\n\t\t\t\t\t\t \t\r\n\t\t\tsocketHandler = new SocketHandler(host, port);\r\n\t\t\t\t\t\t\t\t\r\n\t\t} catch (SecurityException | IOException e) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\t\t\t\t \r\n\t\treturn socketHandler;\r\n\t}", "public RequestHandler(DatagramPacket requestPacket) {\n this.requestPacket = requestPacket;\n }", "public Handler getHandler() {\r\n return handler;\r\n }", "public Handler getHandler() {\r\n return handler;\r\n }", "public interface RequestModifier {\n\n /**\n * Set HTTP request method, only support get, post,put , delete method.\n *\n * @param method\n *\n */\n public void setMethod(HTTPMethod method);\n\n /**\n * Set HTTP Protocol.\n *\n * @param protocol\n *\n */\n public void setProtocol(String protocol);\n\n /**\n * Set HTTP version , such as HTTP1.1.\n *\n * @param version\n *\n */\n public void setVersion(String version);\n\n /**\n * Set HTTP domain.\n *\n * @param domain\n *\n */\n public void setDomain(String domain);\n\n /**\n * Set path in the url.\n *\n * @param path\n *\n */\n public void setPath(String path);\n\n /**\n * Set web server port\n *\n * @param port\n *\n */\n public void setPort(int port);\n\n /**\n * Set HTTP url\n *\n * @param url\n *\n */\n public void setUrl(URL url);\n\n /**\n * Set HTTP url string\n *\n * @param url\n *\n */\n public void setUrl(String url);\n\n /**\n * Modify the exist argument in url.\n *\n * @param urlArg\n *\n * @return boolean, if success to modfiy this argument, return true.\n * if fail to modfiy this argument, return false.\n */\n public boolean modifyURIArgContent(URLArg urlArg);\n\n /**\n * Modify the exist header in HTTP request headers.\n *\n * @param header\n *\n * @return boolean, if success to modfiy this argument, return true.\n * if fail to modfiy this argument, return false.\n */\n public boolean modifyHeaderContent(Header header);\n\n /**\n * Add the request header, if this header is exist, modfiy this value.\n *\n * @param key\n *\n * @param header\n *\n */\n public void addHeader(String key, String header);\n\n /**\n * Add the request header, if this header is exist, modfiy this value.\n *\n * @param key\n *\n * @param header\n *\n */\n public void delHeader(String key);\n\n /**\n * Add the post arg in request header, if this argument is exist, modfiy this value.\n *\n * @param key\n *\n * @param value\n *\n */\n public void addPostArg(String key, String value);\n\n /**\n * Add the url arg in request url, if this argument is exist, modfiy this value.\n *\n * @param key\n *\n * @param value\n *\n */\n public void addUrlArg(String key, String value);\n}", "private NettyServerHandler createHandler(ServerTransportListener transportListener) {\n return NettyServerHandler.newHandler(\n transportListener, streamTracerFactories, maxStreams,\n flowControlWindow, maxHeaderListSize, maxMessageSize,\n keepAliveTimeInNanos, keepAliveTimeoutInNanos,\n maxConnectionIdleInNanos,\n maxConnectionAgeInNanos, maxConnectionAgeGraceInNanos,\n permitKeepAliveWithoutCalls, permitKeepAliveTimeInNanos);\n }", "@Override\n\tpublic void initRequest() {\n\n\t}", "public interface Handler\r\n{\r\n\r\n\t/**\r\n\t * <p>\r\n\t * The http DELETE method delete the resource at pointed to by the request.\r\n\t * If sucessfull, it will 204 (no content), if not found 404, if error 500.\r\n\t * Extract from the RFC on delete follows.\r\n\t * </p>\r\n\t * <p>\r\n\t * The DELETE method requests that the origin server delete the resource\r\n\t * identified by the Request-URI. This method MAY be overridden by human\r\n\t * intervention (or other means) on the origin server. The client cannot be\r\n\t * guaranteed that the operation has been carried out, even if the status\r\n\t * code returned from the origin server indicates that the action has been\r\n\t * completed successfully. However, the server SHOULD NOT indicate success\r\n\t * unless, at the time the response is given, it intends to delete the\r\n\t * resource or move it to an inaccessible location.\r\n\t * </p>\r\n\t * <p>\r\n\t * A successful response SHOULD be 200 (OK) if the response includes an\r\n\t * entity describing the status, 202 (Accepted) if the action has not yet\r\n\t * been enacted, or 204 (No Content) if the action has been enacted but the\r\n\t * response does not include an entity.\r\n\t * </p>\r\n\t * <p>\r\n\t * If the request passes through a cache and the Request-URI identifies one\r\n\t * or more currently cached entities, those entries SHOULD be treated as\r\n\t * stale. Responses to this method are not cacheable.\r\n\t * </p>\r\n\t * \r\n\t * @param request\r\n\t * @param response\r\n\t * @throws ServletException\r\n\t * @throws IOException\r\n\t */\r\n\tvoid doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;\r\n\r\n\t/**\r\n\t * <p>\r\n\t * The GET method means retrieve whatever information (in the form of an\r\n\t * entity) is identified by the Request-URI. If the Request-URI refers to a\r\n\t * data-producing process, it is the produced data which shall be returned\r\n\t * as the entity in the response and not the source text of the process,\r\n\t * unless that text happens to be the output of the process.\r\n\t * </p>\r\n\t * <p>\r\n\t * The semantics of the GET method change to a \"conditional GET\" if the\r\n\t * request message includes an If-Modified-Since, If-Unmodified-Since,\r\n\t * If-Match, If-None-Match, or If-Range header field. A conditional GET\r\n\t * method requests that the entity be transferred only under the\r\n\t * circumstances described by the conditional header field(s). The\r\n\t * conditional GET method is intended to reduce unnecessary network usage by\r\n\t * allowing cached entities to be refreshed without requiring multiple\r\n\t * requests or transferring data already held by the client.\r\n\t * </p>\r\n\t * <p>\r\n\t * The semantics of the GET method change to a \"partial GET\" if the request\r\n\t * message includes a Range header field. A partial GET requests that only\r\n\t * part of the entity be transferred, as described in section <a rel=\"xref\"\r\n\t * href=\"rfc2616-sec14.html#sec14.35\">14.35</a>. The partial GET method is\r\n\t * intended to reduce unnecessary network usage by allowing\r\n\t * partially-retrieved entities to be completed without transferring data\r\n\t * already held by the client.\r\n\t * </p>\r\n\t * <p>\r\n\t * The response to a GET request is cacheable if and only if it meets the\r\n\t * requirements for HTTP caching described in section 13.\r\n\t * </p>\r\n\t * <p>\r\n\t * See section <a\r\n\t * href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec15.html#sec15.1.3\">15.1.3</a>\r\n\t * for security considerations when used for forms.\r\n\t * </p>\r\n\t * <p>\r\n\t * Section <a\r\n\t * href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9\"\r\n\t * >14.9</a> specifies cache control headers.\r\n\t * </p>\r\n\t * \r\n\t * @param request\r\n\t * @param response\r\n\t * @throws ServletException\r\n\t * @throws IOException\r\n\t */\r\n\tvoid doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;\r\n\r\n\t/**\r\n\t * <a id=\"sec9.4\">9.4</a> HEAD</h3>\r\n\t * <p>\r\n\t * The HEAD method is identical to GET except that the server MUST NOT\r\n\t * return a message-body in the response. The metainformation contained in\r\n\t * the HTTP headers in response to a HEAD request SHOULD be identical to the\r\n\t * information sent in response to a GET request. This method can be used\r\n\t * for obtaining metainformation about the entity implied by the request\r\n\t * without transferring the entity-body itself. This method is often used\r\n\t * for testing hypertext links for validity, accessibility, and recent\r\n\t * modification.\r\n\t * </p>\r\n\t * <p>\r\n\t * The response to a HEAD request MAY be cacheable in the sense that the\r\n\t * information contained in the response MAY be used to update a previously\r\n\t * cached entity from that resource. If the new field values indicate that\r\n\t * the cached entity differs from the current entity (as would be indicated\r\n\t * by a change in Content-Length, Content-MD5, ETag or Last-Modified), then\r\n\t * the cache MUST treat the cache entry as stale.\r\n\t * </p>\r\n\t * \r\n\t * @param request\r\n\t * @param response\r\n\t * @throws ServletException\r\n\t * @throws IOException\r\n\t */\r\n\tvoid doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;\r\n\r\n\t/**\r\n\t * @param request\r\n\t * @param response\r\n\t * @throws ServletException\r\n\t * @throws IOException\r\n\t */\r\n\tvoid doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;\r\n\r\n\t/**\r\n\t/**\r\n\t * <p>\r\n\t * The PUT method requests that the enclosed entity be stored under the\r\n\t * supplied Request-URI. If the Request-URI refers to an already existing\r\n\t * resource, the enclosed entity SHOULD be considered as a modified version\r\n\t * of the one residing on the origin server. If the Request-URI does not\r\n\t * point to an existing resource, and that URI is capable of being defined\r\n\t * as a new resource by the requesting user agent, the origin server can\r\n\t * create the resource with that URI. If a new resource is created, the\r\n\t * origin server MUST inform the user agent via the 201 (Created) response.\r\n\t * If an existing resource is modified, either the 200 (OK) or 204 (No\r\n\t * Content) response codes SHOULD be sent to indicate successful completion\r\n\t * of the request. If the resource could not be created or modified with the\r\n\t * Request-URI, an appropriate error response SHOULD be given that reflects\r\n\t * the nature of the problem. The recipient of the entity MUST NOT ignore\r\n\t * any Content-* (e.g. Content-Range) headers that it does not understand or\r\n\t * implement and MUST return a 501 (Not Implemented) response in such cases.\r\n\t * </p>\r\n\t * <p>\r\n\t * If the request passes through a cache and the Request-URI identifies one\r\n\t * or more currently cached entities, those entries SHOULD be treated as\r\n\t * stale. Responses to this method are not cacheable.\r\n\t * </p>\r\n\t * <p>\r\n\t * The fundamental difference between the POST and PUT requests is reflected\r\n\t * in the different meaning of the Request-URI. The URI in a POST request\r\n\t * identifies the resource that will handle the enclosed entity. That\r\n\t * resource might be a data-accepting process, a gateway to some other\r\n\t * protocol, or a separate entity that accepts annotations. In contrast, the\r\n\t * URI in a PUT request identifies the entity enclosed with the request --\r\n\t * the user agent knows what URI is intended and the server MUST NOT attempt\r\n\t * to apply the request to some other resource. If the server desires that\r\n\t * the request be applied to a different URI,\r\n\t * </p>\r\n\t * <p>\r\n\t * it MUST send a 301 (Moved Permanently) response; the user agent MAY then\r\n\t * make its own decision regarding whether or not to redirect the request.\r\n\t * </p>\r\n\t * <p>\r\n\t * A single resource MAY be identified by many different URIs. For example,\r\n\t * an article might have a URI for identifying \"the current version\" which\r\n\t * is separate from the URI identifying each particular version. In this\r\n\t * case, a PUT request on a general URI might result in several other URIs\r\n\t * being defined by the origin server.\r\n\t * </p>\r\n\t * <p>\r\n\t * HTTP/1.1 does not define how a PUT method affects the state of an origin\r\n\t * server.\r\n\t * </p>\r\n\t * <p>\r\n\t * PUT requests MUST obey the message transmission requirements set out in\r\n\t * section 8.2.\r\n\t * </p>\r\n\t * <p>\r\n\t * Unless otherwise specified for a particular entity-header, the\r\n\t * entity-headers in the PUT request SHOULD be applied to the resource\r\n\t * created or modified by the PUT.\r\n\t * </p>\r\n\t * \r\n\t * @param request\r\n\t * @param response\r\n\t * @throws ServletException\r\n\t * @throws IOException\r\n\t */\r\n\tvoid doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;\r\n\r\n\r\n\t/**\r\n\t * @param config\r\n\t * @throws ServletException\r\n\t */\r\n\tvoid init(Map<String, String> config) throws ServletException;\r\n\r\n\t/**\r\n\t * @param response\r\n\t */\r\n\tvoid setHandlerHeaders(HttpServletResponse response);\r\n\r\n\t/**\r\n\t * Sends an error to the client\r\n\t * \r\n\t * @param ex\r\n\t * @throws IOException\r\n\t */\r\n\tvoid sendError(HttpServletRequest request,\r\n\t\t\tHttpServletResponse response, Throwable ex) throws IOException;\r\n\r\n\t/**\r\n\t * Serailize a Map strucutre to the output stream\r\n\t * \r\n\t * @param uploads\r\n\t * @throws IOException\r\n\t */\r\n\tvoid sendMap(HttpServletRequest request,\r\n\t\t\tHttpServletResponse response, Map<String, Object> contetMap)\r\n\t\t\tthrows IOException;\r\n\r\n}", "static SecurityHandler create() {\n return DEFAULT_INSTANCE;\n }", "ByteHandler getInstance();", "public Handler createHandler(Looper looper) {\n return new CatchingWorkerHandler(looper);\n }", "public static synchronized INSURLHandler getINSURLHandler() {\n/* 50 */ if (insURLHandler == null) {\n/* 51 */ insURLHandler = new INSURLHandler();\n/* */ }\n/* 53 */ return insURLHandler;\n/* */ }" ]
[ "0.73784363", "0.7327999", "0.6984377", "0.6888248", "0.66800064", "0.6640932", "0.66393524", "0.6623903", "0.65493894", "0.6454828", "0.64295924", "0.63787603", "0.6311171", "0.62942547", "0.6291829", "0.6269873", "0.6250737", "0.6243524", "0.61719954", "0.61604834", "0.61547637", "0.613907", "0.61323845", "0.61184436", "0.6104674", "0.60931677", "0.60879445", "0.6085925", "0.6062635", "0.604821", "0.6034472", "0.60033625", "0.6000398", "0.59695953", "0.5968376", "0.59485435", "0.5942915", "0.5939136", "0.59357995", "0.5914857", "0.59077674", "0.58933234", "0.58933234", "0.58567876", "0.5853604", "0.57929116", "0.57864356", "0.57862604", "0.5782986", "0.5761538", "0.57554924", "0.5753815", "0.573995", "0.5720829", "0.57194924", "0.5712752", "0.570173", "0.5699533", "0.56969464", "0.5687631", "0.56864697", "0.5681638", "0.5663573", "0.5647588", "0.56472206", "0.5639344", "0.5638004", "0.5635125", "0.56275266", "0.56273323", "0.5618332", "0.5616773", "0.56151307", "0.56117433", "0.56018263", "0.56017447", "0.5598494", "0.5596962", "0.55921996", "0.5585902", "0.55813307", "0.55750537", "0.5570489", "0.5568125", "0.55679214", "0.55651116", "0.5550695", "0.5527603", "0.55254024", "0.5524649", "0.5519294", "0.55115104", "0.55115104", "0.550707", "0.55062735", "0.5505546", "0.5495393", "0.5492394", "0.54858387", "0.54788756", "0.54637915" ]
0.0
-1
TODO Autogenerated method stub
@Override public void focusLost(FocusEvent e) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public void focusGained(FocusEvent e) { chat_field.setText(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public void actionPerformed(ActionEvent e) { if(name_field.getText().equals("")) { JOptionPane.showMessageDialog(null, "사용자 이름을 설정해 주세요.", "warning",JOptionPane.WARNING_MESSAGE); }else { id = name_field.getText(); JOptionPane.showMessageDialog(null, "설정되었습니다.", "success",JOptionPane.INFORMATION_MESSAGE); setting.setEnabled(false); name_field.setEnabled(false); wt.sendMsg(); // who_area.append(id + "\n"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public void actionPerformed(ActionEvent e) { if(chat_field.getText().equals("")) { JOptionPane.showMessageDialog(null, "채팅을 입력해주세요.", "warning",JOptionPane.WARNING_MESSAGE); } chat_area.append("[" + id + "]" + chat_field.getText() + "\n"); wt.sendMsg(); chat_field.setText(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
============================= Constructor ============================// Constructs a new instance of the ION search from the input PAGs
public IonJoeModifications(List<Graph> pags) { for (Graph pag : pags) { this.input.add(pag); } for (Graph pag : input) { for (Node node : pag.getNodes()) { if (!variables.contains(node.getName())) { this.variables.add(node.getName()); } } for (Triple triple : getAllTriples(pag)) { if (pag.isDefNoncollider(triple.getX(), triple.getY(), triple.getZ())) { pag.addUnderlineTriple(triple.getX(), triple.getY(), triple.getZ()); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<Graph> search() {\n\n long start = System.currentTimeMillis();\n TetradLogger.getInstance().log(\"info\", \"Starting ION Search.\");\n logGraphs(\"\\nInitial Pags: \", this.input);\n TetradLogger.getInstance().log(\"info\", \"Transfering local information.\");\n long steps = System.currentTimeMillis();\n\n /*\n * Step 1 - Create the empty graph\n */\n List<Node> varNodes = new ArrayList<>();\n for (String varName : variables) {\n varNodes.add(new GraphNode(varName));\n }\n Graph graph = new EdgeListGraph(varNodes);\n\n /*\n * Step 2 - Transfer local information from the PAGs (adjacencies\n * and edge orientations)\n */\n // transfers edges from each graph and finds definite noncolliders\n transferLocal(graph);\n // adds edges for variables never jointly measured\n for (NodePair pair : nonIntersection(graph)) {\n graph.addEdge(new Edge(pair.getFirst(), pair.getSecond(), Endpoint.CIRCLE, Endpoint.CIRCLE));\n }\n TetradLogger.getInstance().log(\"info\", \"Steps 1-2: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n System.out.println(\"step2\");\n System.out.println(graph);\n\n /*\n * Step 3\n *\n * Branch and prune step that blocks problematic undirectedPaths, possibly d-connecting undirectedPaths\n */\n steps = System.currentTimeMillis();\n Queue<Graph> searchPags = new LinkedList<>();\n // place graph constructed in step 2 into the queue\n searchPags.offer(graph);\n // get d-separations and d-connections\n List<Set<IonIndependenceFacts>> sepAndAssoc = findSepAndAssoc(graph);\n this.separations = sepAndAssoc.get(0);\n this.associations = sepAndAssoc.get(1);\n Map<Collection<Node>, List<PossibleDConnectingPath>> paths;\n// Queue<Graph> step3PagsSet = new LinkedList<Graph>();\n HashSet<Graph> step3PagsSet = new HashSet<>();\n Set<Graph> reject = new HashSet<>();\n // if no d-separations, nothing left to search\n if (separations.isEmpty()) {\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(graph);\n step3PagsSet.add(graph);\n }\n // sets length to iterate once if search over path lengths not enabled, otherwise set to 2\n int numNodes = graph.getNumNodes();\n int pl = numNodes - 1;\n if (pathLengthSearch) {\n pl = 2;\n }\n // iterates over path length, then adjacencies\n for (int l = pl; l < numNodes; l++) {\n if (pathLengthSearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path lengths: \" + l + \" of \" + (numNodes - 1));\n }\n int seps = separations.size();\n int currentSep = 1;\n int numAdjacencies = separations.size();\n for (IonIndependenceFacts fact : separations) {\n if (adjacencySearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path nonadjacencies: \" + currentSep + \" of \" + numAdjacencies);\n }\n seps--;\n // uses two queues to keep up with which PAGs are being iterated and which have been\n // accepted to be iterated over in the next iteration of the above for loop\n searchPags.addAll(step3PagsSet);\n recGraphs.add(searchPags.size());\n step3PagsSet.clear();\n while (!searchPags.isEmpty()) {\n System.out.println(\"ION Step 3 size: \" + searchPags.size());\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n // deques first PAG from searchPags\n Graph pag = searchPags.poll();\n // Part 3.a - finds possibly d-connecting undirectedPaths between each pair of nodes\n // known to be d-separated\n List<PossibleDConnectingPath> dConnections = new ArrayList<>();\n // checks to see if looping over adjacencies\n if (adjacencySearch) {\n for (Collection<Node> conditions : fact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, fact.getX(), fact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, fact.getX(), fact.getY(), conditions));\n }\n }\n } else {\n for (IonIndependenceFacts allfact : separations) {\n for (Collection<Node> conditions : allfact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, allfact.getX(), allfact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, allfact.getX(), allfact.getY(), conditions));\n }\n }\n }\n }\n // accept PAG go to next PAG if no possibly d-connecting undirectedPaths\n if (dConnections.isEmpty()) {\n// doFinalOrientation(pag);\n// Graph p = screenForKnowledge(pag);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(pag);\n continue;\n }\n // maps conditioning sets to list of possibly d-connecting undirectedPaths\n paths = new HashMap<>();\n for (PossibleDConnectingPath path : dConnections) {\n List<PossibleDConnectingPath> p = paths.get(path.getConditions());\n if (p == null) {\n p = new LinkedList<>();\n }\n p.add(path);\n paths.put(path.getConditions(), p);\n }\n // Part 3.b - finds minimal graphical changes to block possibly d-connecting undirectedPaths\n List<Set<GraphChange>> possibleChanges = new ArrayList<>();\n for (Set<GraphChange> changes : findChanges(paths)) {\n Set<GraphChange> newChanges = new HashSet<>();\n for (GraphChange gc : changes) {\n boolean okay = true;\n for (Triple collider : gc.getColliders()) {\n\n if (pag.isUnderlineTriple(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n\n }\n if (!okay) {\n continue;\n }\n for (Triple collider : gc.getNoncolliders()) {\n if (pag.isDefCollider(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n }\n if (okay) {\n newChanges.add(gc);\n }\n }\n if (!newChanges.isEmpty()) {\n possibleChanges.add(newChanges);\n } else {\n possibleChanges.clear();\n break;\n }\n }\n float starthitset = System.currentTimeMillis();\n Collection<GraphChange> hittingSets = IonHittingSet.findHittingSet(possibleChanges);\n recHitTimes.add((System.currentTimeMillis() - starthitset) / 1000.);\n // Part 3.c - checks the newly constructed graphs from 3.b and rejects those that\n // cycles or produce independencies known not to occur from the input PAGs or\n // include undirectedPaths from definite nonancestors\n for (GraphChange gc : hittingSets) {\n boolean badhittingset = false;\n for (Edge edge : gc.getRemoves()) {\n Node node1 = edge.getNode1();\n Node node2 = edge.getNode2();\n Set<Triple> triples = new HashSet<>();\n triples.addAll(gc.getColliders());\n triples.addAll(gc.getNoncolliders());\n if (triples.size() != (gc.getColliders().size() + gc.getNoncolliders().size())) {\n badhittingset = true;\n break;\n }\n for (Triple triple : triples) {\n if (node1.equals(triple.getY())) {\n if (node2.equals(triple.getX()) ||\n node2.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n if (node2.equals(triple.getY())) {\n if (node1.equals(triple.getX()) ||\n node1.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n }\n if (badhittingset) {\n break;\n }\n for (NodePair pair : gc.getOrients()) {\n if ((node1.equals(pair.getFirst()) && node2.equals(pair.getSecond())) ||\n (node2.equals(pair.getFirst()) && node1.equals(pair.getSecond()))) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (!badhittingset) {\n for (NodePair pair : gc.getOrients()) {\n for (Triple triple : gc.getNoncolliders()) {\n if (pair.getSecond().equals(triple.getY())) {\n if (pair.getFirst().equals(triple.getX()) &&\n pag.getEndpoint(triple.getZ(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n\n }\n if (pair.getFirst().equals(triple.getZ()) &&\n pag.getEndpoint(triple.getX(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n }\n if (badhittingset) {\n continue;\n }\n Graph changed = gc.applyTo(pag);\n // if graph change has already been rejected move on to next graph\n if (reject.contains(changed)) {\n continue;\n }\n // if graph change has already been accepted move on to next graph\n if (step3PagsSet.contains(changed)) {\n continue;\n }\n // reject if null, predicts false independencies or has cycle\n if (predictsFalseIndependence(associations, changed)\n || changed.existsDirectedCycle()) {\n reject.add(changed);\n }\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(changed);\n // now add graph to queue\n\n// Graph p = screenForKnowledge(changed);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(changed);\n }\n }\n // exits loop if not looping over adjacencies\n if (!adjacencySearch) {\n break;\n }\n }\n }\n TetradLogger.getInstance().log(\"info\", \"Step 3: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n Queue<Graph> step3Pags = new LinkedList<>(step3PagsSet);\n\n /*\n * Step 4\n *\n * Finds redundant undirectedPaths and uses this information to expand the list\n * of possible graphs\n */\n steps = System.currentTimeMillis();\n Map<Edge, Boolean> necEdges;\n Set<Graph> outputPags = new HashSet<>();\n\n while (!step3Pags.isEmpty()) {\n Graph pag = step3Pags.poll();\n necEdges = new HashMap<>();\n // Step 4.a - if x and y are known to be unconditionally associated and there is\n // exactly one trek between them, mark each edge on that trek as necessary and\n // make the tiples on the trek definite noncolliders\n // initially mark each edge as not necessary\n for (Edge edge : pag.getEdges()) {\n necEdges.put(edge, false);\n }\n // look for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n List<List<Node>> treks = treks(pag, fact.x, fact.y);\n if (treks.size() == 1) {\n List<Node> trek = treks.get(0);\n List<Triple> triples = new ArrayList<>();\n for (int i = 1; i < trek.size(); i++) {\n // marks each edge in trek as necessary\n necEdges.put(pag.getEdge(trek.get(i - 1), trek.get(i)), true);\n if (i == 1) {\n continue;\n }\n // makes each triple a noncollider\n pag.addUnderlineTriple(trek.get(i - 2), trek.get(i - 1), trek.get(i));\n }\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // Part 4.b - branches by generating graphs for every combination of removing\n // redundant undirectedPaths\n boolean elimTreks;\n // checks to see if removing redundant undirectedPaths eliminates every trek between\n // two variables known to be nconditionally assoicated\n List<Graph> possRemovePags = possRemove(pag, necEdges);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n for (Graph newPag : possRemovePags) {\n elimTreks = false;\n // looks for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n if (treks(newPag, fact.x, fact.y).isEmpty()) {\n elimTreks = true;\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // add new PAG to output unless a necessary trek has been eliminated\n if (!elimTreks) {\n outputPags.add(newPag);\n }\n }\n }\n outputPags = removeMoreSpecific(outputPags);\n// outputPags = applyKnowledge(outputPags);\n\n TetradLogger.getInstance().log(\"info\", \"Step 4: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n\n /*\n * Step 5\n *\n * Generate the Markov equivalence classes for graphs and accept only\n * those that do not predict false d-separations\n */\n steps = System.currentTimeMillis();\n Set<Graph> outputSet = new HashSet<>();\n for (Graph pag : outputPags) {\n Set<Triple> unshieldedPossibleColliders = new HashSet<>();\n for (Triple triple : getPossibleTriples(pag)) {\n if (!pag.isAdjacentTo(triple.getX(), triple.getZ())) {\n unshieldedPossibleColliders.add(triple);\n }\n }\n\n PowerSet<Triple> pset = new PowerSet<>(unshieldedPossibleColliders);\n for (Set<Triple> set : pset) {\n Graph newGraph = new EdgeListGraph(pag);\n for (Triple triple : set) {\n newGraph.setEndpoint(triple.getX(), triple.getY(), Endpoint.ARROW);\n newGraph.setEndpoint(triple.getZ(), triple.getY(), Endpoint.ARROW);\n }\n doFinalOrientation(newGraph);\n }\n for (Graph outputPag : finalResult) {\n if (!predictsFalseIndependence(associations, outputPag)) {\n Set<Triple> underlineTriples = new HashSet<>(outputPag.getUnderLines());\n for (Triple triple : underlineTriples) {\n outputPag.removeUnderlineTriple(triple.getX(), triple.getY(), triple.getZ());\n }\n outputSet.add(outputPag);\n }\n }\n }\n\n// outputSet = applyKnowledge(outputSet);\n outputSet = checkPaths(outputSet);\n\n output.addAll(outputSet);\n TetradLogger.getInstance().log(\"info\", \"Step 5: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n runtime = ((System.currentTimeMillis() - start) / 1000.);\n logGraphs(\"\\nReturning output (\" + output.size() + \" Graphs):\", output);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n return output;\n }", "protected OpinionFinding() {/* intentionally empty block */}", "public OnionooParser() {\n\n\t}", "public Analyzer (int n0, int n1)\n\t{\n this.begN = n0;\n this.endN = n1;\n }", "public Parser() {\n\t\tpopulateMaps();\n\t}", "public AStarPathfinder()\n\t{\n\t\tsuper();\n\t\t\n\t\t_comparator = new AStarHeuristicComparator();\n\t\t_visited = new HashSet<PathfindingNode>();\n\t\t_toVisit = new PriorityQueue<PathfindingNode>(1, _comparator);\n\t\t_parents = new HashMap<PathfindingNode, PathfindingNode>();\n\t\t_costsFromStart = new HashMap<PathfindingNode, Integer>();\n\t\t_totalCosts = new HashMap<PathfindingNode, Integer>();\n\t\t_reversePath = new Stack<PathfindingNode>();\n\t}", "protected GeneTAG() {/* intentionally empty block */}", "public APIOp(final String log) {\r\n\r\n\t\t}", "public LogAnalyzer()\n { \n // Create the array object to hold the hourly\n // access counts.\n hourCounts = new int[24];\n // Create the reader to obtain the data.\n reader = new LogfileReader();\n }", "public PCLParser(java_cup.runtime.Scanner s) {super(s);}", "private void analyze() {\n\t\tdouble org = 0;\n\t\tdouble avgIndPerDoc = 0;\n\t\tdouble avgTotalPerDoc = 0;\n\n\t\tfor (Instance instance : instanceProvider.getInstances()) {\n\n\t\t\tint g = 0;\n\t\t\tSet<AbstractAnnotation> orgM = new HashSet<>();\n\n//\t\t\torgM.addAll(instance.getGoldAnnotations().getAnnotations());\n//\t\t\tg += instance.getGoldAnnotations().getAnnotations().size();\n\n\t\t\tfor (AbstractAnnotation instance2 : instance.getGoldAnnotations().getAnnotations()) {\n\n\t\t\t\tResult r = new Result(instance2);\n\n\t\t\t\t{\n////\t\t\t\t\tList<AbstractAnnotation> aa = Arrays.asList(r.getTrend());\n//\t\t\t\t\tList<AbstractAnnotation> aa = Arrays.asList(r.getInvestigationMethod());\n////\t\t\t\t\tList<AbstractAnnotation> aa = new ArrayList<>(\n////\t\t\t\t\t\t\tr.getDefinedExperimentalGroups().stream().map(a -> a.get()).collect(Collectors.toList()));\n//\n//\t\t\t\t\torgM.addAll(aa);\n//\t\t\t\t\tg += aa.size();\n\t\t\t\t}\n\n\t\t\t\t{\n\t\t\t\t\t/**\n\t\t\t\t\t * props of exp\n\t\t\t\t\t */\n\t\t\t\t\tfor (DefinedExperimentalGroup instance3 : r.getDefinedExperimentalGroups()) {\n\n//\t\t\t\t\tList<AbstractAnnotation> aa = Arrays.asList(instance3.getOrganismModel());\n//\t\t\t\t\tList<AbstractAnnotation> aa = new ArrayList<>(instance3.getTreatments());\n//\t\t\t\t\t\tList<AbstractAnnotation> aa = Arrays.asList(instance3.getInjury());\n\n\t\t\t\t\t\tList<AbstractAnnotation> ab = Arrays.asList(instance3.getInjury());\n\n\t\t\t\t\t\tList<AbstractAnnotation> aa = ab.stream().filter(i -> i != null)\n\t\t\t\t\t\t\t\t.map(et -> et.asInstanceOfEntityTemplate()).map(et -> new Injury(et))\n\t\t\t\t\t\t\t\t.filter(i -> i != null).flatMap(i -> i.getDeliveryMethods().stream())\n\t\t\t\t\t\t\t\t.filter(i -> i != null).collect(Collectors.toList());\n\n\t\t\t\t\t\taa.addAll(instance3.getTreatments().stream().filter(i -> i != null)\n\t\t\t\t\t\t\t\t.map(et -> et.asInstanceOfEntityTemplate()).map(et -> new Treatment(et))\n\t\t\t\t\t\t\t\t.filter(i -> i != null).map(i -> i.getDeliveryMethod()).filter(i -> i != null)\n\t\t\t\t\t\t\t\t.collect(Collectors.toList()));\n\n//\t\t\t\t\t\tList<AbstractAnnotation> aa = ab.stream().filter(i -> i != null)\n//\t\t\t\t\t\t\t\t.map(et -> et.asInstanceOfEntityTemplate()).map(et -> new Injury(et))\n//\t\t\t\t\t\t\t\t.filter(i -> i != null).flatMap(i -> i.getAnaesthetics().stream())\n//\t\t\t\t\t\t\t\t.filter(i -> i != null).collect(Collectors.toList());\n\n//\t\t\t\t\t\tList<AbstractAnnotation> aa = ab.stream().filter(i -> i != null)\n//\t\t\t\t\t\t\t\t.map(et -> et.asInstanceOfEntityTemplate()).map(et -> new Injury(et))\n//\t\t\t\t\t\t\t\t.filter(i -> i != null).map(i -> i.getInjuryDevice()).filter(i -> i != null)\n//\t\t\t\t\t\t\t\t.collect(Collectors.toList());\n\n\t\t\t\t\t\t// List<AbstractAnnotation> aa = ab.stream().filter(i -> i != null)\n//\t\t\t\t\t\t\t\t.map(et -> et.asInstanceOfEntityTemplate()).map(et -> new Injury(et))\n//\t\t\t\t\t\t\t\t.filter(i -> i != null).map(i -> i.getInjuryLocation()).filter(i -> i != null)\n//\t\t\t\t\t\t\t\t.collect(Collectors.toList());\n\n\t\t\t\t\t\torgM.addAll(aa);\n\t\t\t\t\t\tg += aa.size();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tavgIndPerDoc += orgM.size();\n\t\t\tavgTotalPerDoc += g;\n\n\t\t\torg += ((double) orgM.size()) / (g == 0 ? 1 : g);\n//\t\t\tSystem.out.println(((double) orgM.size()) / g);\n\n\t\t}\n\t\tSystem.out.println(\"avgTotalPerDoc = \" + avgTotalPerDoc / instanceProvider.getInstances().size());\n\t\tSystem.out.println(\"avgIndPerDoc = \" + avgIndPerDoc / instanceProvider.getInstances().size());\n\t\tSystem.out.println(\"org = \" + org);\n\t\tSystem.out.println(\"avg. org = \" + (org / instanceProvider.getInstances().size()));\n\t\tSystem.out.println(new DecimalFormat(\"0.00\").format(avgTotalPerDoc / instanceProvider.getInstances().size())\n\t\t\t\t+ \" & \" + new DecimalFormat(\"0.00\").format(avgIndPerDoc / instanceProvider.getInstances().size())\n\t\t\t\t+ \" & \" + new DecimalFormat(\"0.00\").format(org / instanceProvider.getInstances().size()));\n\t\tSystem.exit(1);\n\n\t\tStats.countVariables(0, instanceProvider.getInstances());\n\n\t\tint count = 0;\n\t\tfor (SlotType slotType : EntityType.get(\"Result\").getSlots()) {\n\n\t\t\tif (slotType.isExcluded())\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tSystem.out.println(slotType.name);\n\n\t\t}\n\t\tSystem.out.println(count);\n\t\tSystem.exit(1);\n\t}", "public AI(){\n super();\n }", "public SAP(Digraph G) {\n this.G = new Digraph(G);\n test = G.size();\n }", "private CoverageParser() {\n }", "public parserCapas(java_cup.runtime.Scanner s) {super(s);}", "public GeneSplicerParser() {\n acceptors = new ArrayList<Integer>();\n donors = new ArrayList<Integer>();\n }", "public PileSearchRecode() {\n }", "public Asintactico(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Ia(String ibase_url) {\n base_url=ibase_url;\n byte[] reader = callers.getApiInfo(base_url+\"/Stations\");\n lstations = new ArrayList<TreeMap<String, String>>();\n callers.reader_to_trees(reader,lstations);\n reader = callers.getApiInfo(base_url+\"/Trips\");\n ltrips = new ArrayList<TreeMap<String, String>>();\n callers.reader_to_trees(reader,ltrips);\n reader = callers.getApiInfo(base_url+\"/Schedules\");\n lschedules = new ArrayList<TreeMap<String, String>>();\n callers.reader_to_trees(reader,lschedules);\n }", "public AI(String n) {//constructor for super class\n super(n);\n }", "public PopulationFilter(int nr)\n { \n super();\n inhabitants = nr;\n }", "public Pig() {\n this.id = \"\";\n this.weight = 0;\n this.earTag = \"1230\";\n }", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public ExplorerStrategy() {\n\t\tmap = new AIMap();\n\t}", "public A4Parser(java_cup.runtime.Scanner s) {super(s);}", "public A4Parser(java_cup.runtime.Scanner s) {super(s);}", "public AnnotationSearchResultItem() {\n }", "protected Population(Infrastructure infra)\n\t\t{\tinds = new Individual[NUMBER_INDIVIDUALS];\n\t\t\tfor(int i=0;i<NUMBER_INDIVIDUALS;i++)\n\t\t\t\tinds[i] = new Individual(infra);\n\t\t\tthis_ind = 0;\n\t\t\tthis_gen = 0;\n\t\t}", "public SAP(Digraph G){\n if(G == null)\n throw new NullPointerException(\"null arguments\");\n this.G=G;\n }", "public PeptideHit(String sequence, int start, int end) {\r\n this.sequence = sequence;\r\n this.start = start;\r\n this.end = end;\r\n }", "public InstConstraintVisitor(){}", "public PedGenie ( IOManager im, String application_id ) throws GEException\n {\n io_mgr = im;\n spec = io_mgr.getSpecification();\n Study[] study = io_mgr.getStudy();\n tSim = spec.getTopSim();\n dSim = spec.getDropSim();\n theAnalyses = spec.getCCAnalyses();\n nCycles = spec.getNumberOfSimulations();\n \n if( nCycles < 1000 )\n {\n sigCycles = nCycles;\n }\n else\n {\n sigCycles = 1000;\n }\n \n numGDef = spec.getGDef().getLocusCount();\n app_id = application_id;\n \n initializeSimulator(tSim, spec, study);\n initializeSimulator(dSim, spec, study);\n \n if( app_id.equals(\"hapConstructor\") )\n {\n int[] loci = new int[numGDef];\n \n for( int j =0; j < numGDef; j ++ )\n {\n loci[j] = j;\n }\n \n Study[] istudy = spec.getStudy();\n study_Gtypes = new compressGtype[istudy.length];\n initiate_cGtypes(istudy,loci);\n \n String[] models = spec.gethapC_models();\n List<String>a = new ArrayList<String>();\n \n for( int j = 0; j < models.length; j++ )\n {\n a.add(models[j]);\n }\n setupModels(a, spec);\n }\n \n if ( theAnalyses.length > 0 )\n {\n System.out.println(\"Getting subjects...\");\n for ( int i = 0; i < theAnalyses.length; ++i )\n {\n theAnalyses[i].setStudySubjects(study);\n }\n }\n }", "public Parser() {}", "public Parser()\n {\n //nothing to do\n }", "public PointOfInterest() {\n }", "public AccessSqlParser ()\n\t{\n\t}", "public PioneeringMission(AIMain aiMain, XMLStreamReader in)\n throws XMLStreamException {\n super(aiMain);\n readFromXML(in);\n }", "private Parser () { }", "public interface IKataSolution\n extends IKataCommonSolution {\n\n public enum ACTION {\n TURN_LEFT, TURN_RIGHT, FORWARD, STAY\n }\n\n public enum ORIENTATION {\n UP (270), DOWN(90), LEFT(0), RIGHT(180);\n public int angle;\n ORIENTATION (int _angle) {\n angle = _angle;\n }\n public ORIENTATION moveLeft () {\n switch (this) {\n case UP: return LEFT;\n case DOWN: return RIGHT;\n case LEFT: return DOWN;\n case RIGHT: return UP;\n }\n return this;\n }\n public ORIENTATION moveRight () {\n switch (this) {\n case UP: return RIGHT;\n case DOWN: return LEFT;\n case LEFT: return UP;\n case RIGHT: return DOWN;\n }\n return this;\n }\n }\n\n public enum ITEM {\n EMPTY, PLANT, ANIMAL, END\n }\n\n public abstract class Animal {\n /**\n * Number of plants the animal ate\n */\n public int points;\n /**\n * Method to react to changing environmental conditions\n *\n * @param orientation animal's current orientation\n * @param view item currently in front of animal\n * @return action to do\n */\n public abstract ACTION react (ORIENTATION orientation, ITEM view);\n }\n\n /**\n * Factory method for an animal\n *\n * @param count count of animals to create\n * @param lastGeneration array of 'Animal' from last generation\n * @return array of 'Animal' instances\n */\n public abstract Animal[] createGeneration (int count, Animal[] lastGeneration);\n\n /**\n * If true, last generation will be visualized\n */\n public boolean visualizeLastGeneration ();\n\n /**\n * Defines how many generations of evolution should be tested\n * (minimum is 100, maximum is 10000)\n *\n * @return count of generations to test\n */\n public int countOfGenerations ();\n}", "private Approche(String identifiantRunway, ArrayList<LatitudeLongitude> balises) {\n super(\"APPR\", identifiantRunway, balises);\n }", "public AstParser(AstParserTokenManager tm) {\n token_source = tm;\n token = new Token();\n jj_ntk = -1;\n jj_gen = 0;\n for (int i = 0; i < 9; i++) jj_la1[i] = -1;\n }", "public OpinionFinding(int addr, TOP_Type type) {\n super(addr, type);\n readObject();\n }", "public IntPar() { }", "public NewlyAllocatedIntraprocAnalysis(UnitGraph graph,\r\n\t\t\tNewlyAllocatedInterprocAnalysis interprocAnalysis,\r\n\t\t\tNewlyAllocatedFlowSet parameters) {\r\n\t\tsuper(graph);\r\n\r\n\t\tthis.interprocAnalysis = interprocAnalysis;\r\n\t\tthis.database = NewlyAllocatedDatabase.getInstance();\r\n\r\n\t\tthis.sootMethod = graph.getBody().getMethod();\r\n\t\tthis.sootClass = sootMethod.getDeclaringClass();\r\n\r\n\t\tthis.paramSet = parameters;\r\n\t\tthis.returnValue = NewlyAllocatedCommon.defaultReturnValue(sootMethod);\r\n\r\n\t\tValueNumber.reset();\r\n\r\n\t\tSystem.out.println(\"Analyzing method: \" + sootMethod.toString());\r\n\t\tdoAnalysis();\r\n\t}", "public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public SpamAnalyzer( )\n\t{\n\t\tsuper( );\n\t}", "public PlaceOfInterest(String _name,String _classifcation,String _shortExplanation,boolean _accessibleToSpecialNeeds)\r\n\t{\r\n\t\tthis._mapsArrayContainsThisPlaceOfInterest=new ArrayList<Map>();\r\n\t\tthis._tourArrayContainsThisPlaceOfInterest=new ArrayList<Tour>();\r\n\t\tthis._name=_name;\r\n\t\tthis._classifcation=_classifcation;\r\n\t\tthis._accessibleToSpecialNeeds=_accessibleToSpecialNeeds;\r\n\t}", "public ArrayAccess()\r\n {\r\n }", "public Gov() {\n }", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "protected GenTreeOperation() {}", "public PjxParser()\r\n {\r\n LOG.info(this + \" instantiated\");\r\n }", "public Orbiter() {\n }", "private AttestationOccurrence(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {\n super(builder);\n }", "public NormalSearch() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {\n super();\n //ins = new globalInstance();\n // TODO Auto-generated constructor stub\n }", "public AggregationInfo(StreamInput in) throws IOException {\n aggs = new TreeMap<>();\n final int size = in.readVInt();\n for (int i = 0; i < size; i++) {\n String key = in.readString();\n final int keys = in.readVInt();\n final Set<String> types = new TreeSet<>();\n for (int j = 0; j < keys; j++) {\n types.add(in.readString());\n }\n aggs.put(key, types);\n }\n }", "public PegArray(int n) {\r\n\t\tpegs = new Peg[n];\r\n\t\tfor(int i=0; i<n; i++)\r\n\t\t\tpegs[i] = new Peg();\r\n\t\texactMatch = partialMatch = -1;\r\n\t}", "public IndicatorExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "public Astar2(int[] s, int[] g) \n\t{\n\t\t//sets up the gameState for the foal node with the nessacery set functions\n\t\tgoal = g;\n\t\tstart = s;\n\t\tgoalS.setBoard(goal);\n\t\tgoalS.setStateID(2);\n\t\tgoalS.setG();\n\t\tgoalS.setH(goalS.findZero());\n\t\tgoalS.setF();\n\t\t//goalS.printGameState();\n\t\t\n\t\t//sets up the gameState for the foal node with the nessacery set functions\n\t\tstartS.setBoard(start);\n\t\tstartS.setStateID(1);\n\t\tstartS.setG();\n\t\tstartS.setH(goalS.findZero());\n\t\tstartS.setF();\n\t\tstartS.setParentStateID(-1);\n\t\tstartS.setPriority(0);\n\t\t//startS.printGameState();\n\t}", "public PIMPage()throws IOException\n\t{\n\t\tPageFactory.initElements(driver,this);\n\t\t\n\t}", "public SolutionStack()\n {\n stack = new ArrayList<ILocation>(0);\n top = 0;\n }", "public /* synthetic */ SearchPrediction(String str, String str2, String str3, int i2, f fVar) {\n this(str, (i2 & 2) != 0 ? null : str2, (i2 & 4) != 0 ? e.a() : str3);\n }", "public SAP(Digraph G) {this.G = new Digraph(G);}", "public Genetic() {\r\n }", "public GAIndividual()\n {\n m_fitness = 0;\n m_genome = new ArrayList<Integer>();\n }", "public AStar(ArrayList<Point> spaces, Point start, Point goal) {\n\t\tthis.spaces = spaces;\n\t\tthis.start = start;\n\t\tthis.goal = goal;\n\t\tthis.fscores = new HashMap<Point, Double>( spaces.size() );\n\t\tthis.gscores = new HashMap<Point, Double>( spaces.size() );\n\t\tthis.openset = new HashSet<Point>( spaces.size() );\n\t\tthis.closedset = new HashSet<Point>( spaces.size() );\n\t\tfscores.put(start, Double.MAX_VALUE);\n\t\tfscores.put(goal, Double.MAX_VALUE);\n\t\tgscores.put(start, Double.MAX_VALUE);\n\t\tgscores.put(goal, Double.MAX_VALUE);\n\n\t\tfor (Point space : spaces) {\n\t\t\tfscores.put(space, Double.MAX_VALUE);\n\t\t\tgscores.put(space, Double.MAX_VALUE);\n\t\t}\n\t}", "public InflectionPoints(ILineString geom) {\n this.geom = geom;\n }", "protected abstract List<O> parseFileForObservations(Scanner scn);", "public Visita() {\n initialize();\n }", "public LexicalScanner() throws IOException {\n this.codesMap = new CodesMap();\n this.keyWords = loadKeywords();\n this.specialCharacters = loadSpecialCharacters();\n this.identifierAutomata = new FA(IDENTIFIER_AUTOMATA_FILE);\n this.constantAutomata = new FA(CONSTANT_AUTOMATA_FILE);\n }", "public FeatureExtraction() {\n\t}", "public SearchTrack() {\n\t\tsuper();\n\t}", "public parserCapas(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public AtraceParser(int processId) {\n myProcessId = processId;\n myCaptureTreeNodes = new HashMap<>();\n myThreadStateData = new HashMap<>();\n myCpuSchedulingToCpuData = new HashMap<>();\n myCpuUtilizationSeries = new ArrayList<>();\n }", "private void initializeDNA() {\n\t\tint numInputs = population.numInputs;\n\t\tint numOutputs = population.numOutputs;\n\t\tfor (int i = 1; i <= numInputs; i++) {\n\t\t\tsubmitNewNode(new NNode(i, NNode.INPUT));\n\t\t}\n\t\tfor (int j = numInputs + 1; j <= numInputs + numOutputs; j++) {\n\t\t\tsubmitNewNode(new NNode(j, NNode.OUTPUT));\n\t\t}\n\n\t\tfor (int i = 0; i < numInputs; i++) {\n\t\t\tfor (int j = 0; j < numOutputs; j++) {\n\t\t\t\tint start = i + 1;\n\t\t\t\tint end = numInputs + 1 + j;\n\t\t\t\tint innovation = population.getInnovation(start, end);\n\t\t\t\tGene g = new Gene(innovation, start, end, Braincraft\n\t\t\t\t\t\t.randomWeight(), true);\n\t\t\t\tpopulation.registerGene(g);\n\t\t\t\tsubmitNewGene(g);\n\t\t\t}\n\t\t}\n\t}", "public NarrativeStructInterpreter()\n {\n\n }", "public ScanCommonVisitor() {\n\t\tannotationVisitors = new HashMap<String, AnnotationVisitor>();\n\t}", "public PCLParser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}", "public Parser()\n{\n //nothing to do\n}", "public SimOI() {\n super();\n }", "public Population(int indivCount) {\n this.indivCount = indivCount;\n layers = new ArrayList<>();\n individuals = new Individual[indivCount];\n }", "@Before\r\n\tpublic void constructObj (){\r\n\t\tproteinSeq = new ProteinSequence(new char[]{'A','A','T','G','C','C','A','G','T','C','A','G','C','A','T','A','G','C','G'});\r\n\t}", "public Tag() {\n\t}" ]
[ "0.56353396", "0.52647895", "0.524639", "0.5201267", "0.50106", "0.49595895", "0.48779866", "0.48546293", "0.4852471", "0.48513255", "0.48320517", "0.48262015", "0.48044258", "0.48019075", "0.47926924", "0.478546", "0.47774085", "0.47769243", "0.47712883", "0.47659895", "0.47652397", "0.47642568", "0.47393924", "0.47393924", "0.47393924", "0.47393924", "0.47393924", "0.47393924", "0.47357595", "0.47339472", "0.47339472", "0.47326595", "0.47325993", "0.4731532", "0.47246373", "0.47220182", "0.47215617", "0.47201124", "0.47137064", "0.47129655", "0.47005376", "0.46966028", "0.4685179", "0.4681662", "0.46627074", "0.4657867", "0.464898", "0.46460474", "0.4631647", "0.4624685", "0.4624685", "0.4624685", "0.4624685", "0.4624685", "0.4624685", "0.4624685", "0.462354", "0.46173912", "0.46113172", "0.46100983", "0.4609973", "0.4609973", "0.4609973", "0.4609973", "0.4609973", "0.4609973", "0.4609973", "0.4609973", "0.46064916", "0.46019518", "0.4599839", "0.45973158", "0.45928955", "0.4592408", "0.45896673", "0.4586829", "0.4583322", "0.45820057", "0.45784667", "0.45730296", "0.45704868", "0.45687044", "0.4565622", "0.4564932", "0.45640972", "0.45588508", "0.45585594", "0.45526147", "0.45514914", "0.45446706", "0.45446494", "0.45432597", "0.45393115", "0.45379037", "0.45285466", "0.4527739", "0.4526063", "0.45243776", "0.4521558", "0.45211866", "0.45204273" ]
0.0
-1
============================= Public Methods ============================// Sets path length search on or off
public void setPathLengthSearch(boolean b) { pathLengthSearch = b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setPathLength(Integer pathLength) {\n this.pathLength = pathLength;\n }", "public int getPathLength();", "void setFoundLength(final int foundLength) {\n this.vars.put(\"foundLength\", String.valueOf(foundLength));\n }", "public boolean setLength(double Length);", "void setLength(int length);", "public void setLength(long length);", "public void setLength(long length);", "void setLength( long length );", "synchronized void setLength(int length) {\n this.length = length;\n }", "public void setLength(double newLength) {\n length = newLength;\n }", "public Integer getPathLength() {\n return pathLength;\n }", "int getSearchLength();", "public void setCurrentLength(long currentLength) { \n this.currentLength = currentLength; \n }", "@Override\n\tpublic void setLength(int length) {\n\t\t\n\t}", "public void setLength(int length)\n {\n this.length = length;\n }", "public void setLength(int length) {\r\n this.length = length;\r\n }", "public void setLength(int length) {\r\n this.length = length;\r\n }", "public void setLength(long length) { \n this.length = length; \n }", "public void setLength(long newLength) throws IOException {\n flush();\n this.randomAccessFile.setLength(newLength);\n if (newLength < this.fileOffset) {\n this.fileOffset = newLength;\n }\n }", "public int getPathLength()\r\n\t{\r\n\t\treturn path.size();\r\n\t}", "public ShortestPathFinder() {\r\n\t\t\r\n\t}", "@Test\n\tpublic void testGetPathLength() {\n\t\tController control = new Controller();\n\t\tBasicRobot robot = new BasicRobot();\n\t\tExplorer explorer = new Explorer();\n\t\tcontrol.setBuilder(Order.Builder.DFS);\n\t\tcontrol.setRobotAndDriver(robot, explorer);\n\t\trobot.setMaze(control);\n\t\tcontrol.turnOffGraphics();\n\t\tcontrol.setSkillLevel(0);\n\t\tcontrol.switchFromTitleToGenerating(0);\n\t\tcontrol.waitForPlayingState();\n\t\texplorer.setRobot(robot);\n\t\tassertTrue(explorer.getPathLength() == 0);\n\t\t// moving the robot one unit and checking the odometer\n\t\tif(robot.distanceToObstacle(Direction.FORWARD) > 0) {\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 1);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.RIGHT) > 0) {\n\t\t\trobot.rotate(Turn.RIGHT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 1);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.LEFT) > 0) {\n\t\t\trobot.rotate(Turn.LEFT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 1);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.BACKWARD) > 0) {\n\t\t\trobot.rotate(Turn.AROUND);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 1);\n\t\t}\n\t\tassertTrue(explorer.getPathLength() > 0);\n\t\t\n\t\t// moving the robot again to get a reading of 2\n\t\tif(robot.distanceToObstacle(Direction.FORWARD) > 0) {\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 2);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.RIGHT) > 0) {\n\t\t\trobot.rotate(Turn.RIGHT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 2);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.LEFT) > 0) {\n\t\t\trobot.rotate(Turn.LEFT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 2);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.BACKWARD) > 0) {\n\t\t\trobot.rotate(Turn.AROUND);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 2);\n\t\t}\n\t\t\n\t\t\n\t\t// moving the robot a third time to make sure that the odometer is updating correctly\n\t\tif(robot.distanceToObstacle(Direction.FORWARD) > 0) {\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 3);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.RIGHT) > 0) {\n\t\t\trobot.rotate(Turn.RIGHT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 3);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.LEFT) > 0) {\n\t\t\trobot.rotate(Turn.LEFT);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 3);\n\t\t}\n\t\telse if(robot.distanceToObstacle(Direction.BACKWARD) > 0) {\n\t\t\trobot.rotate(Turn.AROUND);\n\t\t\trobot.move(1, false);\n\t\t\tassertTrue(explorer.getPathLength() == 3);\n\t\t}\n\t}", "public void setLength(int length) {\r\n\t\tthis.length = length;\r\n\t}", "public void setLength(int length) {\n\t\tloadProgress.setLength(length);\n\t}", "public void setLength(long length) {\r\n\t\tthis.length = length;\r\n\t}", "public void setMAX_DIRS() {\n\n\t}", "public void setLength(int length) {\n\t\tthis.length = length;\n\t}", "public void setLength(int length) {\n\t\tthis.length = length;\n\t}", "public void setLength(int length) {\n\t\tthis.length = length;\n\t}", "boolean hasSearchLength();", "public void setLength(double length)\r\n {\r\n this.length = length;\r\n }", "public void setLength(double length) {\r\n this.length = length;\r\n }", "public void setLength(Double newlength)\n {\n length = newlength;\n }", "public void setLength(double length) {\n this.length = length;\n }", "public void setLength(double length){this.length=length;}", "public double avePathLength();", "public void setLength(double length) {\n\t\tthis.length = length;\n\t}", "public void setRoadLength(int roadLength) {\n \t\tif (roadLength > this.roadLength)\n \t\t\tthis.roadLength = roadLength;\n \t}", "public void setLength( int length ) { setCapacity( length ); this.length = length; }", "public void setWordLength(String wordSearched){\r\n wordLength = wordSearched.length();\r\n this.wordLength = wordLength;\r\n }", "public void setLength(int length){\n\t\tif(length > 0){\n\t\t\tthis.length = length; //this.length is the length were in right now. and = length is the length the object is given\n\t\t}\n\t\t\n\t\t\n\t}", "public void setLength(){\n this.length = 0;\n for (Music track : this.tracks){\n this.length += track.getLength();\n }\n }", "public void setLength(java.lang.String value) {\r\n\t\tBase.set(this.model, this.getResource(), LENGTH, value);\r\n\t}", "public void expandFile(long length) throws IOException {\n\n\t}", "@Override\n\tpublic int totalPathLength() {\n\t\treturn totalPathLength(root, sum);// returns total path lenght number\n\t}", "public void setLSearch (boolean value) {\r\n l_search = value; }", "public int getMinionPathLength() {\n return getStandardPathLength() + Constants.EFFECT_REPULSE_WEIGHT * (minionRepulse ? 1 : 0);\n }", "@Test\r\n public void testVeryShortPath() {\r\n int[][] path =\r\n {{1, 0},\r\n {0, 0}};\r\n assertEquals(1, RecursiveMethods.maxPathLength(path));\r\n }", "public void setRunwayLength(float runwayLength) {\n\t\tif(this.getRunwayLength() != 0f){\n\t\t\treturn;\n\t\t}\n\t\tthis.runwayLength = runwayLength;\n\t}", "public Builder setLength(int value) {\n \n length_ = value;\n onChanged();\n return this;\n }", "public void setLength(float length) { // l = 2.3\r\n\t\tthis.length = length; // length = 2.3\r\n\t\t\r\n\t}", "public final void setTermLength(int length) {\n initTermBuffer();\n termLength = length;\n }", "public void setLength(int newLength) {\r\n\t\tif (cursor + newLength > buffer.length)\r\n\t\t\tthrow new IllegalArgumentException(\"Can't set new length if it exceeds buffer\");\r\n\t\tlimit = cursor + newLength;\r\n\t}", "int getPathsCount();", "public boolean setPlayLength(int newLength)\n\t{\n\t\tif (newLength >= 1 && (startTime + newLength) <= fileLength)\n\t\t{\n\t\t\tplaybackLength = newLength;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "@Override\n public void setVisibleLength(int length) {}", "public void setLength( org.ontoware.rdf2go.model.node.Node value) {\r\n\t\tBase.set(this.model, this.getResource(), LENGTH, value);\r\n\t}", "public void findLength()\n\t{\n\t\tlength = name.length();\n\t}", "public void setTreeSize(Double newtreesize)\n {\n treesize = newtreesize; \n }", "public void setMaximumPatternLength(int length) {\n\t\tthis.maxItemsetSize = length;\n\t}", "public free_args setPath(String path) {\n this.path = path;\n return this;\n }", "int sizeOfPathArray();", "public void setLength(int n){ // Setter method\n \n length = n; // set the class attribute (variable) radius equal to num\n }", "public checkConsistency_args setPath(String path) {\n this.path = path;\n return this;\n }", "@Override\n\tpublic void SetLength(long value)\n\t{\n\t\tthrow new UnsupportedOperationException(\"TarInputStream SetLength not supported\");\n\t}", "@Test\r\n public void testVeryVeryShortPath() {\r\n int[][] path =\r\n {{1}};\r\n assertEquals(1, RecursiveMethods.maxPathLength(path));\r\n }", "public SamFilterParamsBuilder minLength(int value) {\n mMinReadLength = value;\n return this;\n }", "public void setPath(String path)\n {\n try\n {\n // Tokenize the path\n pathArray = getPathResolved(path);\n \n // Set path property\n this.path = path;\n }\n catch (NumberFormatException nfe)\n {\n // Reset path property\n this.path = \"\";\n }\n }", "private Path(\n\t\tint size,\n\t\tXRISegment... components\n ) {\n \tthis(\n \t\tsize == 0 ? null : size == 1 ? ROOT : new Path(size - 1, components),\n \t\tsize == 0 ? null : components[size - 1]\n \t);\n }", "public void setFuseLength(long newFuseLength) {\n\t\tthis.fuseLength = newFuseLength;\n\t}", "@Test\r\n public void testSimplePath() {\r\n int[][] path =\r\n {{1, 1, 0, 0, 0, 0},\r\n {0, 1, 1, 0, 0, 0},\r\n {0, 0, 1, 1, 0, 0},\r\n {0, 0, 0, 1, 1, 0},\r\n {0, 0, 0, 0, 1, 1}};\r\n assertEquals(10, RecursiveMethods.maxPathLength(path));\r\n }", "@ApiModelProperty(required = true, value = \"The length of the file/folder.\")\n public Long getLength() {\n return length;\n }", "private void setTextAreaLenght(int len) {\n // check for logical error\n if(len <= 0) {\n // error ..\n eHandler.newError(ErrorType.INVALID_ARGUMENT, \"setTextAreaLenght\", \"Zero or negative lenght\");\n\n // set to default\n textAreaLenght = DEFAULT_TEXT_AREA_LENGHT;\n\n // exit from method\n return;\n } // end of if statement\n\n // set the textAreaLenght\n textAreaLenght = len;\n\n }", "public void setLength(int length) {\n\t\tif (length <= 0)\n\t\t\tthrow new IllegalArgumentException(\"length must be > 0\");\n\n\t\tthis.length = length;\n\t}", "public void pathFinder() {\n String oldPath = path;\n ProcessHandle.allProcesses()\n .forEach(process -> checkProcess(process.info()));\n writePath();\n //return (oldPath != path);\n }", "public int getPathCount() {\n return path_.size();\n }", "public void setLineLength(int len) {\n lineLength = len / 4 * 4;\n }", "default void setLength(double t) {\r\n scaleDirection(t / getLength());\r\n }", "public int getPathCount() {\n return path_.size();\n }", "public void setEdgeLen(double len) {\n fEdgeLen = len;\n }", "void updatePathListings() {\n\t\tpathSelector.updatePathListings();\n\t}", "void setStartSearch(int startSearch);", "public void setVestLength(String vestLength) {\r\n\t\tthis.vestLength = vestLength;\r\n\t}", "public void updatePath() {\n\t\tString oldPath = this.path;\n\t\tif (materializePath()) {\n\t\t\tPageAlias.create(this, oldPath);\n\t\t\tupdateChildPaths();\n\t\t}\n\t}", "public RADIUSAttribute setLength(final byte length) {\n this.length = length;\n return this;\n }", "public void setLength(double len) throws IllegalArgumentException\n {\n if (len<0) throw new IllegalArgumentException (\"Length cannot be negative\" + len);\n else length = len;\n }", "public int setLengthDependent(String lengthDependent) {\r\n return setAttribute(MEConstants.lengthDependent, lengthDependent);\r\n }", "public void setLengthOfStay(int len) {\n this.length_of_stay=len;\n }", "private void cleanFieldPathLength() {\n\t\tfor (int i = 0; i < fieldPathLength.length; i++) {\n\t\t\tfieldPathLength[i] = -1;\n\t\t}\n\t}", "public void setPath(int path){\n\t\tthis.path = path;\n\t}", "public int getNumOfPath(){\r\n\t\treturn numOfPath;\r\n\t}", "void setEndSearch(int endSearch);", "public void set(String path) throws FileNotFoundException {\n counterSeveralLines = linesAfter;\n arrayPreviousLines = new String[prevSize];\n currentPath = path;\n fileReader = new FileReader(currentPath);\n bufferReader = new BufferedReader(fileReader);\n resetDateBefore();\n }", "public void setLength(int length)\n {\n encryptionDictionary.setInt(\"Length\", length);\n }", "public void initPath() {\r\n\t\tpath = new Path();\r\n\t}", "public void setMarkerLength(int length) {\n\t\tm_nMarkerLength = length;\n\t}", "public void setFieldLength(int fieldLength)\n\t{\n\t\tthis.fieldLength = fieldLength;\n\t}", "public void setKeyLength(int keyLength) {\n\t\tthis.keyLength = keyLength;\n\t}", "@Override\n\tpublic LSystemBuilder setUnitLength(double unitLength) {\n\t\tthis.unitLength = unitLength;\n\t\treturn this;\n\t}", "public int getPathsCount() {\n return paths_.size();\n }" ]
[ "0.6855215", "0.59793645", "0.5706507", "0.5662909", "0.5592294", "0.55887216", "0.55887216", "0.5555064", "0.54986095", "0.5455036", "0.5432193", "0.53680617", "0.53514254", "0.5317966", "0.52953017", "0.52814144", "0.52814144", "0.52809834", "0.5274729", "0.5263939", "0.52634364", "0.5260807", "0.5254357", "0.524068", "0.52364993", "0.52075404", "0.5197113", "0.5197113", "0.5197113", "0.5193078", "0.5178145", "0.5160868", "0.51290214", "0.51284516", "0.5097155", "0.50932926", "0.5080422", "0.507634", "0.50553197", "0.5055068", "0.5033125", "0.5010206", "0.5009222", "0.49950567", "0.49823388", "0.4971841", "0.4919322", "0.49164638", "0.49105003", "0.4906818", "0.49066126", "0.49052775", "0.4900944", "0.48972714", "0.48760948", "0.48738652", "0.48636043", "0.4856959", "0.4855967", "0.48539445", "0.4845936", "0.48302385", "0.48300067", "0.48291832", "0.48120397", "0.48071426", "0.47849604", "0.4781439", "0.47638503", "0.4734242", "0.4729915", "0.47276276", "0.47266975", "0.47260144", "0.47038513", "0.46672586", "0.46667123", "0.46554995", "0.4655404", "0.4647661", "0.4643155", "0.4641414", "0.46210328", "0.46095395", "0.46037063", "0.46000552", "0.4600019", "0.45910433", "0.45859876", "0.45818385", "0.45813495", "0.4574808", "0.45648274", "0.45549688", "0.45466232", "0.45418808", "0.45290864", "0.45229328", "0.45209116", "0.45062518" ]
0.7869652
0
Sets adjacency search on or off
public void setAdjacencySearch(boolean b) { adjacencySearch = b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setVisited(boolean value){this.visited = value;}", "public AdjacencyListGraph(boolean isDirected) {\r\n\t\tthis.isDirected = isDirected;\r\n\t\tvertices = new HashMap<>();\r\n\t\tadjacencyLists = new HashMap<>();\r\n\t}", "void setIndexed(boolean indexed);", "Dijk(){\n grp = new HashMap<>();\n seen = new HashSet<>();\n dlist = new HashMap<>();\n id = new HashMap<>();\n lowlink = new HashMap<>();\n orid = 0;\n }", "public void setNodesToUnvisited(){\n for(GraphNode node: graphNode){\n if(node.visited){\n node.visited = false;\n }\n }\n }", "public void setVisited(boolean flag) {\n\t\tvisited = flag;\n\t}", "public void setVisited()\n {\n visited = true;\n }", "public void setVisited(Boolean b){\n visited = b;\n }", "public void set_graph() throws ParseException, IOException {\n \tg = new WeightedUndirectedGraph(words.length);\n //g = new WeightedUndirectedGraph(most_important_terms.size());\n \n Directory dir = new SimpleFSDirectory(new File(\".\\\\data\\\\lucene_index_r_r\"));\n Analyzer analyzer = new StandardAnalyzer(LUCENE_41);\n \n // creat a map that stores, for each word (in the cluster), a set of all the documents that contain that word\n HashMap<String,HashSet<Integer>> word_to_docs_map = new HashMap<String,HashSet<Integer>>();\n int n_strings = words.length; \n \n // for each word...\n for (int idx = 0; idx < n_strings; idx++) {\n // query the index with that given word and retrieve all the documents that contains that word\n String query = words[idx]; \n QueryParser parser = new QueryParser(Version.LUCENE_41, \"text\", analyzer); \n Query q = parser.parse(query); \n\n IndexReader reader = DirectoryReader.open(dir);\n IndexSearcher searcher = new IndexSearcher(reader);\n TopDocs docs = searcher.search(q, reader.numDocs());\n ScoreDoc[] hits = docs.scoreDocs;\n \n // update map from word to docs it appears in \n //HashSet<Integer> tmp = null;\n // tmp is the set of all the document ids in which the current word is contained\n HashSet<Integer> tmp = new HashSet<>();\n //word_to_docs_map.put(query, tmp);\n \n // for each document, retrieved from the query\n for(Integer i=0;i<hits.length;i++) {\n Integer docId = hits[i].doc;\n // tmp = word_to_docs_map.get(query); \n // if the document is a document written by an user of interest \n if(indices.contains(docId)) {\n tmp.add(docId);\n }\n //word_to_docs_map.put(query, tmp); \n }\n word_to_docs_map.put(query, tmp);\n\t }\n\t \n\t // add edges: iterate over possible term pairs ...\n\t for(int idx_1 = 0; idx_1 < n_strings - 1; idx_1++) {\n\t \n\t for(int idx_2 = idx_1 + 1 ; idx_2 < n_strings ; idx_2 ++ ) {\n\t \n\t // extract document sets associated with the considered terms \n\t HashSet<Integer> set_a = word_to_docs_map.get(words[idx_1]); \n\t HashSet<Integer> set_b = word_to_docs_map.get(words[idx_2]); \n\t \n\t // compute set intersection \n\t int n = intersectionSize(set_a, set_b);\n\t \n\t // if the terms appear in at least one common document\n\t if(n>0) {\n\t // add edge \n\t g.testAndAdd(idx_1, idx_2 , n); \n\t }\n\t } \n\t }\n\t}", "public void setLSearch (boolean value) {\r\n l_search = value; }", "public static strictfp void main(String... args) {\n\t\tArrayList<Vertex> graph = new ArrayList<>();\r\n\t\tHashMap<Character, Vertex> map = new HashMap<>();\r\n\t\t// add vertices\r\n\t\tfor (char c = 'a'; c <= 'i'; c++) {\r\n\t\t\tVertex v = new Vertex(c);\r\n\t\t\tgraph.add(v);\r\n\t\t\tmap.put(c, v);\r\n\t\t}\r\n\t\t// add edges\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tif (v.getNodeId() == 'a') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'b') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'c') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'd') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'e') {\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'f') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t} else if (v.getNodeId() == 'g') {\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'h') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'i') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t// graph created\r\n\t\t// create disjoint sets\r\n\t\tDisjointSet S = null, V_S = null;\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tchar c = v.getNodeId();\r\n\t\t\tif (c == 'a' || c == 'b' || c == 'd' || c == 'e') {\r\n\t\t\t\tif (S == null) {\r\n\t\t\t\t\tS = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (V_S == null) {\r\n\t\t\t\t\tV_S = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(V_S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Disjoint sets created\r\n\t\tfor (Vertex u: graph) {\r\n\t\t\tfor (Vertex v: u.getAdjacents()) {\r\n\t\t\t\tif (DisjointSet.findSet((DisjointSet) u.getDisjointSet()) == \r\n\t\t\t\t DisjointSet.findSet((DisjointSet) v.getDisjointSet())) {\r\n\t\t\t\t\tSystem.out.println(\"The cut respects (\" + u.getNodeId() + \", \" + v.getNodeId() + \").\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void startSearch() {\n if (solving) {\n Alg.Dijkstra();\n }\n pause(); //pause state\n }", "private void setAllUnvisited(){\n\t\tfor(int i = 0; i < this.getDimension(); i++)\n\t\t\tthis.getGraph().setUnvisited(i);\n\t\tthis.visited = 0;\n\t}", "@Override\n public boolean isConnected() { //i got help from the site https://www.geeksforgeeks.org/shortest-path-unweighted-graph/\n if(this.ga.edgeSize()<this.ga.nodeSize()-1) return false;\n initializeInfo();//initialize all the info fields to be null for the algorithm to work\n if(this.ga.nodeSize()==0||this.ga.nodeSize()==1) return true;//if there is not node or one its connected\n WGraph_DS copy = (WGraph_DS) (copy());//create a copy graph that the algorithm will on it\n LinkedList<node_info> qValues = new LinkedList<>();//create linked list that will storage all nodes that we didn't visit yet\n int firstNodeKey = copy.getV().iterator().next().getKey();//first key for get the first node(its doesnt matter which node\n node_info first = copy.getNode(firstNodeKey);//get the node\n qValues.add(first);//without limiting generality taking the last node added to graph\n int counterVisitedNodes = 0;//counter the times we change info of node to \"visited\"\n while (qValues.size() != 0) {\n node_info current = qValues.removeFirst();\n if (current.getInfo() != null) continue;//if we visit we can skip to the next loop because we have already marked\n current.setInfo(\"visited\");//remark the info\n counterVisitedNodes++;\n\n Collection<node_info> listNeighbors = copy.getV(current.getKey());//create a collection for the neighbors list\n LinkedList<node_info> Neighbors = new LinkedList<>(listNeighbors);//create the neighbors list\n if (Neighbors == null) continue;\n for (node_info n : Neighbors) {\n if (n.getInfo() == null) {//if there is a node we didn't visited it yet, we will insert it to the linkedList\n qValues.add(n);\n }\n }\n }\n if (this.ga.nodeSize() != counterVisitedNodes) return false;//check that we visited all of the nodes\n\n return true;\n }", "void initialize(Graph graph, Node targetStart, Node searchStart, ExpandCounter counter);", "public CustomGraphSearch(boolean bInsertFront) {\n\tSystem.out.println(\"bInsertFront: \" + bInsertFront);\n\tinsertFront = bInsertFront;\n }", "public static void setIndexing(boolean b) {\n\t\tINDEXING_MODE=b;\n\t}", "public void setNodeCoherent(boolean b) {\n }", "public void setVisited(boolean b) {\n\t\t_visited = b;\n\t}", "void findSearchOrder() {\n boolean filled = false;\n for(int node: queryGraphNodes.keySet()) {\n\n vertexClass vc = queryGraphNodes.get(node);\n searchOrderSeq.add(node);\n for(int edge: queryGraphNodes.get(node).edges.keySet()) {\n filled = calcOrdering(edge);\n if (filled)\n break;\n }\n if(searchOrderSeq.size() == queryGraphNodes.size())\n break;\n\n }\n\n }", "public void setEnableGraphQueries(boolean v) {\n enableGraphQueries = v;\n }", "@PortedFrom(file = \"Taxonomy.h\", name = \"setVisited\")\n public void setVisited(TaxonomyVertex node) {\n node.setChecked(visitedLabel);\n }", "Bfs_search(int v) \r\n { \r\n V = v; \r\n \r\n adj = new LinkedList[v]; \r\n \r\n for (int i=0; i<v; ++i) \r\n adj[i] = new LinkedList(); \r\n }", "public void setVisited(Boolean visited) {\n this.visited = visited;\n }", "public void index(Ring<DocumentReference> ring, boolean transitively) throws RingException\n {\n // Index ringSet only if the relation is not empty.\n if (ring != null && ring.hasRelation()) {\n try {\n logger.debug(\"Add ringSet: {}\", ring);\n // TODO: cross-wikis graphs\n // TODO: see also the Solr reference serializers\n // TODO: add a default relation RRing:getDefaultRelation\n String fieldName = getFieldName(ring.getRelation());\n if (ring.hasRelatum()) {\n // Add index directly to the document so that the documents can be queried by their rings.\n SolrInputDocument originDocument = getSolrInputDocument(ring.getReferent(), true);\n addFieldValueOnce(originDocument, fieldName, serializer.serialize(ring.getRelatum()));\n\n // Also index relation IS_CONNECTED_TO because 1) if two vertices are connected by a any other relation,\n // that can be handy to browse them by the more generic IS_CONNECTED_TO relation, 2) this relation\n // is used by the user interface GraphMacros to retrieve all vertices that are connected to the current\n // page.\n if (!ring.getRelation()\n .equals(factory.getIdentifier(Names.IS_CONNECTED_TO_RELATION_NAME)))\n {\n fieldName = getFieldName(Names.IS_CONNECTED_TO_RELATION_NAME);\n addFieldValueOnce(originDocument, fieldName, serializer.serialize(ring.getRelatum()));\n }\n // TODO: check that originDocument is not added twice, typically when this method\n // is called from XWikiRingSolrMetadataExtractor\n save(originDocument);\n\n // Add inverse ringSet, using the IS_CONNECTED_TO relation, so it's not the exact inverse\n SolrInputDocument destinationDocument = getSolrInputDocument(ring.getRelatum(), true);\n addFieldValueOnce(destinationDocument, getFieldName(Names.IS_CONNECTED_TO_RELATION_NAME),\n serializer.serialize(ring.getReferent()));\n save(destinationDocument);\n\n // Add destinations by transitivity if parameter \"transitively\" is true\n /*if (transitively) {\n XWikiRelation relation = ringSet.getRelation(ringSet.getRelation());\n if (relation.isTransitive()) {\n List<XWikiRing> secondLevelEdges =\n ringSet.getRingsFrom(ringSet.getRelatum(), ringSet.getRelation());\n for (XWikiRing secondLevelEdge : secondLevelEdges) {\n XWikiRing ringByTransitivity =\n new DefaultXWikiRing(ringSet.getReferent(), ringSet.getRelation(),\n secondLevelEdge.getRelatum(), ringSet);\n // Handle \"is a\" \"type\" specifically because \"A is a B\" and \"B is a Type\" does not\n // imply \"A is a Type\" unless we refactor the \"is a\" relation into \"is instance of\"\n // in that case. We need to decide wheter \"A is a B\" and \"A is instance of B\" absolutely\n // need to be covered by two distinct relations or if the two relations share the same\n // nature.\n if (!(ringSet.getRelation()\n .equals(ringSet.getIdentifier(DefaultXWikiRRing.IS_A_RELATION_NAME))\n && secondLevelEdge.getRelatum()\n .equals(ringSet.getIdentifier(DefaultXWikiRRing.TYPE_TERM_NAME))))\n {\n index(ringByTransitivity, false);\n }\n }\n }\n }*/\n } else if (ring.hasValue()) {\n // TODO: handle cases where the value is not a string\n SolrInputDocument originDocument = getSolrInputDocument(ring.getReferent(), true);\n addFieldValueOnce(originDocument, fieldName, ring.getValue());\n save(originDocument);\n }\n } catch (RingException | IOException | SolrServerException e) {\n logger.error(\"Index ringSet {}\", ring, e);\n throw new RingException(e);\n }\n }\n }", "void Explore(int vertex){\n // first mark it as true as it has been visited\n visited[vertex]=true;\n\n //now make the pre at the counterPre index this vertex\n pre[counterPre] = vertex;\n // also increase the counterPre for next iteration\n counterPre+=1;\n\n // do exploration\n // using Iterator to iterate the adjList\n Iterator<Integer> i = adjList[vertex].listIterator();\n while(i.hasNext()){\n int ver = i.next();\n\n // check is it visited or not if not then again explore that ver\n if (visited[ver]==false){\n Explore(ver);\n }\n }\n }", "EdgeIteratorState setFlags(IntsRef edgeFlags);", "public void setMergeDuplicateEdge( boolean on )\n \t{\n \t\tmergeDuplicateEdge = on;\n \t}", "public void setVisited(boolean visited)\n\t{\n\t\tthis.visited = visited;\n\t}", "public void setVisited(boolean visited) {\n this.visited = visited;\n }", "private void setAtomsToUnVisited(IMolecule molecule) {\n\t\tfor (int i = 0; i < molecule.getAtomCount(); i++) {\n\t\t\tmolecule.getAtom(i).setFlag(CDKConstants.VISITED, false);\n\t\t}\n\t}", "ArrayList<Edge> getAdjacencies();", "void DFSearch(BFSNode n){\n\t\tn.discovered=true;\r\n\t\tSystem.out.print(\" discovered\");\r\n\t\tn.preProcessNode();\r\n\t\tfor( Integer edg: n.edges){\r\n\t\t\tn.processEdge(edg);\r\n\t\t\tif(!nodes[edg].discovered){\r\n\t\t\t\tnodes[edg].parent = n; \r\n\t\t\t\tnodes[edg].depth = n.depth +1;\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.print(\"{new track with parent [\"+ nodes[edg].parent.value+\"] }\");\r\n\t\t\t\tDFSearch(nodes[edg]);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tif(nodes[edg] != n.parent){\r\n\t\t\t\t\tSystem.out.print(\"{LOOP}\");\r\n\t\t\t\t\tif(nodes[edg].depth < n.reachableLimit.depth){\r\n\t\t\t\t\t\tn.reachableLimit = nodes[edg];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tSystem.out.print(\"{second visit}\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"back from node [ \"+n.value +\" ]\");\r\n\t\tn.postProcessNode();\r\n\t\tn.processed = true;\r\n\t\t\r\n\t}", "protected void search(V v) {\n if(markedVertices.get(v))\n return;\n markedVertices.put(v, true);\n for(V w : graph.adjVertices(v))\n search(w);\n }", "@Override\n\tpublic void search() {\n\t\tpq = new IndexMinPQ<>(graph.getNumberOfStations());\n\t\tpq.insert(startIndex, distTo[startIndex]);\n\t\twhile (!pq.isEmpty()) {\n\t\t\tint v = pq.delMin();\n\t\t\tnodesVisited.add(graph.getStation(v));\n\t\t\tnodesVisitedAmount++;\n\t\t\tfor (Integer vertex : graph.getAdjacentVertices(v)) {\t\n\t\t\t\trelax(graph.getConnection(v, vertex));\n\t\t\t}\n\t\t}\n\t\tpathWeight = distTo[endIndex];\n\t\tpathTo(endIndex);\n\t}", "public void setVisited(int v) {\n visited.set(v, true);\n nodeEnum.add(v);\n }", "void dfs(){\n // start from the index 0\n for (int vertex=0; vertex<v; vertex++){\n // check visited or not\n if (visited[vertex]==false){\n Explore(vertex);\n }\n }\n }", "public MutableNodeSet(Graph graph) {\n\t\tsuper(graph);\n\t\tthis.members = new TreeSet<Integer>();\n\t\tinitializeInOutWeights();\n\t}", "public void enableDnsSearch(boolean enable);", "@Override\r\n\tpublic void FloydWarshall() {\r\n\t\tgraphForWarshall = new AdjacencyMatrixGraph<>(getOrder(), isDirected);\r\n\t\tvertices.forEach((E t, Vertex<E> u) -> {\r\n\t\t\tgraphForWarshall.insertVertex(t);\r\n\t\t});\r\n\t\tadjacencyLists.forEach((E t, ArrayList<Edge<E>> u) -> {\r\n\t\t\tfor(Edge<E> ale : u) {\r\n\t\t\t\tgraphForWarshall.link(ale.getSrc(), ale.getDst(), ale.getWeight());\r\n\t\t\t}\r\n\t\t});\r\n\t\tgraphForWarshall.FloydWarshall();\r\n\t}", "public void makeOneHopsVisible(boolean use_digraph) {\n RTGraphComponent.RenderContext myrc = (RTGraphComponent.RenderContext) getRTComponent().rc; if (myrc == null) return;\n // Get the visible links, extract the nodes\n Iterator<String> it = myrc.graphedgeref_to_link.keySet().iterator(); Set<Integer> nodes = new HashSet<Integer>();\n while (it.hasNext()) {\n String linkref = it.next();\n nodes.add(digraph.linkRefFm(linkref));\n nodes.add(digraph.linkRefTo(linkref));\n }\n // Go through the nodes, find all their edges, and re-add the bundles to the set\n SimpleMyGraph<Bundle> g = use_digraph ? digraph : graph;\n Set<Bundle> set = new HashSet<Bundle>();\n\n Iterator<Integer> iti = nodes.iterator();\n while (iti.hasNext()) {\n int node_i = iti.next();\n for (int i=0;i<g.getNumberOfNeighbors(node_i);i++) {\n int nbor_i = g.getNeighbor(node_i,i);\n String linkref = g.getLinkRef(node_i,nbor_i);\n\n // Add the associated bundles\n\tIterator<Bundle> itb = g.linkRefIterator(linkref);\n\twhile (itb.hasNext()) set.add(itb.next());\n }\n }\n // Add the no mapping set and push it to the RTParent\n set.addAll(getRTComponent().getNoMappingSet()); getRTParent().push(getRTParent().getRootBundles().subset(set));\n }", "public void depthFirstSearch() {\n List<Vertex> visited = new ArrayList<Vertex>();\r\n // start the recursive depth first search on the current vertex\r\n this.dfs(visited);\r\n }", "@Test\r\n\tpublic void testAdjacency00() {\r\n\t\tBoardCell cell = board.getCell(0, 0);\r\n\t\tSet<BoardCell> testList = board.getAdjList(cell);\r\n\t\tassertTrue(testList != null);\r\n\t\tassertTrue(testList.contains(board.getCell(1, 0)));\r\n\t\tassertTrue(testList.contains(board.getCell(0, 1)));\r\n\t\tassertEquals(2, testList.size());\r\n\r\n\t}", "public void setVisited(boolean visited) {\r\n\t\t\tthis.visited = visited;\r\n\t\t}", "@Override\n public boolean isConnected() {\n for (node_data n : G.getV()) {\n bfs(n.getKey());\n for (node_data node : G.getV()) {\n if (node.getTag() == 0)\n return false;\n }\n }\n return true;\n }", "private void optimizeEdgePropFlag() {\n TreeNode currentTreeNode = treeLeaf;\n while (!(currentTreeNode instanceof SourceTreeNode)) {\n if (currentTreeNode instanceof EdgeTreeNode) {\n EdgeTreeNode edgeTreeNode = EdgeTreeNode.class.cast(currentTreeNode);\n TreeNode nextTreeNode = edgeTreeNode.getOutputNode();\n if (null != nextTreeNode &&\n edgeTreeNode.beforeRequirementList.isEmpty() &&\n edgeTreeNode.afterRequirementList.isEmpty()) {\n if (nextTreeNode instanceof EdgeVertexTreeNode ||\n (nextTreeNode.getNodeType() == NodeType.AGGREGATE &&\n !(nextTreeNode instanceof GroupTreeNode))) {\n edgeTreeNode.setFetchPropFlag(true);\n }\n\n }\n }\n currentTreeNode = UnaryTreeNode.class.cast(currentTreeNode).getInputNode();\n }\n }", "private void astarSetup(AStarNode end){\n\tfor(AStarNode node : getNodes()){\n node.setVisited(false);\n node.setFound(false);\n node.updateDist(Float.POSITIVE_INFINITY);\n\t}\n }", "public native void setSearchAsChild(boolean value) /*-{\n\t\tvar jso = [email protected]::getJsObj()();\n\t\tjso.searchAsChild = value;\n }-*/;", "public void setVisited(boolean visited) {\n isVisited = visited;\n }", "public void setEdge(int v1, int v2, int weight) {\n LinkedList<Integer> tmp = adjList.elementAt(v1);\n if(adjList.elementAt(v1).contains(v2) == false) {\n tmp.add(v2);\n adjList.set(v1, tmp);\n totalEdges ++;\n LinkedList<Integer> tmp2 = adjWeight.elementAt(v1);\n tmp2.add(weight);\n adjWeight.set(v1, tmp2);\n }\n }", "public void setNodeVistied(boolean nodeVisit){\r\n\t \tthis.nodeVisited = nodeVisit;\r\n\t }", "public void dfs() {\n\t\tfor (Vertice v : vertices) {\n\t\t\tv.setVisited(false);\n\t\t}\n\t\tfor (Vertice v : vertices) {\n\t\t\tif (!v.getVisited()) {\n\t\t\t\tVisitar(v, -1);\n\t\t\t}\n\t\t}\n\t}", "void findMatchings(boolean isProtein) {\n\n GraphDatabaseFactory dbFactory = new GraphDatabaseFactory();\n HashSet<String > searchSpaceList = new HashSet<>();\n GraphDatabaseService databaseService = dbFactory.newEmbeddedDatabase(graphFile);\n for (int id: queryGraphNodes.keySet()) {\n if(isProtein)\n searchSpaceList.add(queryGraphNodes.get(id).label);\n else\n searchSpaceList.add(String.valueOf(queryGraphNodes.get(id).labels.get(0)));\n }\n for(String x: searchSpaceList) {\n ResourceIterator<Node> xNodes;\n try(Transaction tx = databaseService.beginTx()) {\n xNodes = databaseService.findNodes(Label.label(x));\n tx.success();\n }\n\n while (xNodes.hasNext()) {\n Node node = xNodes.next();\n if (searchSpaceProtein.containsKey(x))\n searchSpaceProtein.get(x).add(node.getId());\n else {\n HashSet<Long> set = new HashSet<>();\n set.add(node.getId());\n searchSpaceProtein.put(x, set);\n }\n }\n\n }\n\n if(isProtein)\n search(0, databaseService, true);\n else\n search(0, databaseService, false);\n databaseService.shutdown();\n }", "public void setDijkstra(boolean dijkstra)\n {\n this.dijkstra = dijkstra;\n }", "public static boolean Util(Graph<V, DefaultEdge> g, ArrayList<V> set, int colors, HashMap<String, Integer> coloring, int i, ArrayList<arc> arcs, Queue<arc> agenda)\n {\n /*if (i == set.size())\n {\n System.out.println(\"reached max size\");\n return true;\n }*/\n if (set.isEmpty())\n {\n System.out.println(\"Set empty\");\n return true;\n }\n //V currentVertex = set.get(i);\n\n /*System.out.println(\"vertices and mrv:\");\n V start = g.vertexSet().stream().filter(V -> V.getID().equals(\"0\")).findAny().orElse(null);\n Iterator<V> iterator = new DepthFirstIterator<>(g, start);\n while (iterator.hasNext()) {\n V v = iterator.next();\n System.out.println(\"vertex \" + v.getID() + \" has mrv of \" + v.mrv);\n }*/\n\n // Find vertex with mrv\n V currentVertex;\n int index = -1;\n int mrv = colors + 10;\n for (int it = 0; it < set.size(); it++)\n {\n if (set.get(it).mrv < mrv)\n {\n mrv = set.get(it).mrv;\n index = it;\n }\n }\n currentVertex = set.remove(index);\n\n //System.out.println(\"Got vertex: \" + currentVertex.getID());\n\n\n // Try to assign that vertex a color\n for (int c = 0; c < colors; c++)\n {\n currentVertex.color = c;\n if (verifyColor(g, currentVertex))\n {\n\n // We can assign color c to vertex v\n // See if AC3 is satisfied\n /*currentVertex.domain.clear();\n currentVertex.domain.add(c);*/\n if (!agenda.isEmpty()) numAgenda++;\n while(!agenda.isEmpty())\n {\n arc temp = agenda.remove();\n\n // Make sure there exists v1, v2, in V1, V2, such that v1 != v2\n V v1 = g.vertexSet().stream().filter(V -> V.getID().equals(temp.x)).findAny().orElse(null);\n V v2 = g.vertexSet().stream().filter(V -> V.getID().equals(temp.y)).findAny().orElse(null);\n\n\n\n // No solution exists in this branch if a domain is empty\n //if ((v1.domain.isEmpty()) || (v2.domain.isEmpty())) return false;\n\n if (v2.color == -1) continue;\n else\n {\n Boolean[] toRemove = new Boolean[colors];\n Boolean domainChanged = false;\n for (Integer it : v1.domain)\n {\n if (it == v2.color)\n {\n toRemove[it] = true;\n }\n }\n for (int j = 0; j < toRemove.length; j++)\n {\n if ((toRemove[j] != null))\n {\n v1.domain.remove(j);\n domainChanged = true;\n }\n }\n // Need to check constraints with v1 on the right hand side\n if (domainChanged)\n {\n for (arc it : arcs)\n {\n // Add arc back to agenda to check constraints again\n if (it.y.equals(v1.getID()))\n {\n agenda.add(it);\n }\n }\n }\n }\n if ((v1.domain.isEmpty()) || (v2.domain.isEmpty()))\n {\n System.out.println(\"returning gfalse here\");\n return false;\n }\n }\n\n // Reset agenda to check arc consistency on next iteration\n for (int j = 0; j < arcs.size(); j++)\n {\n agenda.add(arcs.get(i));\n }\n\n\n //System.out.println(\"Checking if vertex \" + currentVertex.getID() + \" can be assigned color \" + c);\n coloring.put(currentVertex.getID(), c);\n updateMRV(g, currentVertex);\n if (Util(g, set, colors, coloring, i + 1, arcs, agenda))\n {\n\n return true;\n }\n\n //System.out.println(\"Assigning vertex \" + currentVertex.getID() + \" to color \" + currentVertex.color + \" did not work\");\n coloring.remove(currentVertex.getID());\n currentVertex.color = -1;\n }\n }\n return false;\n }", "public void changingNeighbor() {\n }", "public void setIndexedVariable() {\n indexed = true;\n }", "public UndirectedSearch(boolean minimum) {\r\n\t\tsuper();\r\n\t\tthis.minimum = minimum;\r\n\t}", "@Override public int set(L source, L target, int weight) {\r\n \r\n \tif(weight>0) {\r\n \t\tboolean flag=false;\r\n \t\tif(!vertices.contains(source)) {\r\n \t\t\tvertices.add(source);\r\n \t\t\tflag=true;\r\n \t\t}\r\n \tif(!vertices.contains(target)) {\r\n \t\tvertices.add(target);\r\n \t\tflag=true;\r\n \t}\r\n \tEdge<L> e=new Edge<L>(source,target,weight);\r\n \tif(flag==true) {//加点,直接把新边写入,\r\n \t\t\r\n \tedges.add(e);\r\n \tcheckRep();\r\n \treturn 0;\r\n \t}\r\n \telse {//点已经在了,可能边已经在了,考虑重复问题\r\n \t\tint n=edges.size();\r\n \t\tif(n==0) {\r\n \t\t\t\r\n \tedges.add(e);\r\n \tcheckRep();\r\n \treturn 0;\r\n \t\t}\r\n \t\telse {\r\n \t\t\tboolean tag=false;\t\r\n \t\t\tfor(int i=0;i<n;i++) {\r\n \t\t\t\t//这一步太关键了,之前一直判断是false\r\n \t\t\t\tif(edges.get(i).getSource().equals(source) && edges.get(i).getTarget().equals(target)) {\r\n \t\t\t//\tif(edges.get(i).getSource()==source && edges.get(i).getTarget()==target) {\r\n \t\t\t\t\tint res=edges.get(i).getWeight();\r\n \t\t\t\t\tedges.set(i,e);\r\n \t\t\t\t\tcheckRep();\r\n \t\t\t\t\ttag=true;\r\n \t\t\t\t\treturn res;//边已经在了,重新写权重\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t\t//边不在里面,直接写入\r\n \t\t\tif(tag==false) {\r\n \t\t\t\tedges.add(e);\r\n \t\t\t\tcheckRep();\r\n \t\t\t\treturn 0;\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n \t\r\n \t}\r\n \telse if(weight==0) {\r\n \t\tif(!vertices.contains(source)||!vertices.contains(target)) return 0;\r\n \t\tint n=edges.size();\r\n \t\tfor(int i=0;i<n;i++) {\r\n \t\t\t//改了\r\n\t\t\t\tif(edges.get(i).getSource().equals(source) && edges.get(i).getTarget().equals(target)) {\r\n \t\t\t//if(edges.get(i).getSource()==source && edges.get(i).getTarget()==target) {\t\r\n \t\t\t//把已经在的边移除\r\n\t\t\t\t\tint res=edges.get(i).getWeight();\r\n\t\t\t\t\tedges.remove(i);\r\n\t\t\t\t\tcheckRep();\r\n\t\t\t\t\treturn res;\r\n\t\t\t\t}\r\n\t\t\t}\r\n \t\treturn 0;\r\n \t}\r\n \tcheckRep();\r\n \treturn 0;\r\n \t\r\n }", "DFS(int ver){\n // assign the nu,mber of vertex\n v = ver;\n // assign the number of boolean at it's vertex\n visited = new boolean[ver];\n // assisgn the array with the vertex length\n pre = new int[ver];\n // asssigning the adjList length\n adjList = new ArrayList[ver];\n\n // now going throgh the loop and adding the newList to adjList each index , in pre making all -1, and false in all visited\n for (int x=0; x<ver; x+=1){\n adjList[x] = new ArrayList();\n\n // for the visited boolean value false\n visited[x] = false;\n\n // pre \n pre[x]=-1;\n }\n }", "private void clearVisited(){\r\n\t\tfor(int i=0; i<graphSize; i++){\r\n\t\t\tmyGraph[i].visited = false;\r\n\t\t\tAdjVertex vert = myGraph[i].adjVertexHead;\r\n\t\t\twhile(vert != null){\r\n\t\t\t\tvert.visited = false;\r\n\t\t\t\tvert= vert.next;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void setSeparateCommonEdges(boolean a) {\n\t\tthis.separateCommonEdges = a;\n\t}", "public int depthFirstSearch(List<Integer>[] adj){\n int connected = 0;\n for(int i = 0; i < n; i++){\n if(visited[i] == false){\n connected ++;\n dfsRecursive(adj, i);\n }\n }\n return connected;\n }", "protected void DijkstrasAlgoritm(Vertex<T> target){\n\t\ttarget.setStatus(Vertex.Status.Used);\n\t\tIterator<Edge> i = target.getConnections().iterator();\n\t\twhile(i.hasNext()){\n\t\t\tEdge e = i.next();\n\t\t\tVertex<T> next = (Vertex<T>) e.getTo();\n\t\t\tDouble calced = e.getWeight() + target.getDistance();\n\t\t\tif(next.getDistance() > calced){\n\t\t\t\tonOverwrite();\n\t\t\t\tnext.setDistance(calced);\n\t\t\t\tnext.setPrevious(target);\n\t\t\t}\n\t\t\tonLoopEnd(next);\n\t\t}\n\t}", "public StreetSearcher() {\n vertices = new HashMap<>();\n graph = new SparseGraph<>();\n //double smDistance = 0;\n //previous = new HashMap<>();\n }", "void renewNeighbourClusters() {\n neighbourClusters = new HashMap<Cluster, Integer>();\n\n for (Person p : members) {\n for (Person x : p.getFriends()) {\n if (!members.contains(x)) {\n Cluster xC = x.getCluster();\n if (!neighbourClusters.containsKey(xC)) {\n neighbourClusters.put(xC, 1);\n } else {\n neighbourClusters.put(xC, neighbourClusters.get(xC) + 1);\n }\n }\n }\n }\n\n }", "private void queryIndex() {\n if (predicate == TruePredicate.INSTANCE) {\n return;\n }\n\n // get indexes\n MapService mapService = nodeEngine.getService(SERVICE_NAME);\n MapServiceContext mapServiceContext = mapService.getMapServiceContext();\n Indexes indexes = mapServiceContext.getMapContainer(name).getIndexes();\n // optimize predicate\n QueryOptimizer queryOptimizer = mapServiceContext.getQueryOptimizer();\n predicate = queryOptimizer.optimize(predicate, indexes);\n\n Set<QueryableEntry> querySet = indexes.query(predicate);\n if (querySet == null) {\n return;\n }\n\n List<Data> keys = null;\n for (QueryableEntry e : querySet) {\n if (keys == null) {\n keys = new ArrayList<Data>(querySet.size());\n }\n keys.add(e.getKeyData());\n }\n\n hasIndex = true;\n keySet = keys == null ? Collections.<Data>emptySet() : InflatableSet.newBuilder(keys).build();\n }", "public void setMark(int neighbour, boolean mark){\n\tedgMark[neighbour] = mark;\n }", "void setBind() {\n for (int i = 1; i < size(); i++) {\n Exp f = get(i);\n if (f.isFilter() && f.size() > 0) {\n Exp bind = f.first();\n if (bind.type() == OPT_BIND\n // no bind (?x = ?y) in case of JOIN\n && (!Query.testJoin || bind.isBindCst())) {\n int j = i - 1;\n while (j > 0 && get(j).isFilter()) {\n j--;\n }\n if (j >= 0) {\n Exp g = get(j);\n if ((g.isEdge() || g.isPath())\n && (bind.isBindCst() ? g.bind(bind.first().getNode()) : true)) {\n bind.status(true);\n g.setBind(bind);\n }\n }\n }\n }\n }\n }", "IDbQuery<R> setStraightJoin(boolean straightJoin);", "public boolean isDirected();", "public boolean isDirected();", "public abstract boolean isUsing(Long graphNode);", "boolean isDirected();", "void setDisjoint(DisjointSet disjoint);", "AdjacencyGraph(){\r\n vertices = new HashMap<>();\r\n }", "private void breadthFirstSearch (int start, int[] visited, int[] parent){\r\n Queue< Integer > theQueue = new LinkedList< Integer >();\r\n boolean[] identified = new boolean[getNumV()];\r\n identified[start] = true;\r\n theQueue.offer(start);\r\n while (!theQueue.isEmpty()) {\r\n int current = theQueue.remove();\r\n visited[current] = 1; //ziyaret edilmis vertexler queuedan cikarilan vertexlerdir\r\n Iterator < Edge > itr = edgeIterator(current);\r\n while (itr.hasNext()) {\r\n Edge edge = itr.next();\r\n int neighbor = edge.getDest();\r\n if (!identified[neighbor]) {\r\n identified[neighbor] = true;\r\n theQueue.offer(neighbor);\r\n parent[neighbor] = current;\r\n }\r\n }\r\n }\r\n }", "void changeVisited(){\n\t \t\tthis.isVisited = true;}", "void DFS(int v, boolean visited[]) {\n visited[v] = true;\n connected++;\n //LinkedList Iterator to Recursively traverse all adjacent nodes of v\n Iterator<Integer> itr = adj[v].listIterator();\n\n while(itr.hasNext()) {\n int x = itr.next();\n if(visited[x] == false)\n DFS(x,visited);\n }\n }", "@Override\n\tpublic boolean isConnected() {\n\t\tif(this.GA.nodeSize() ==1 || this.GA.nodeSize()==0) return true;\n\t\tgraph copied = this.copy();\n\t\ttagZero(copied);\n\t\tCollection<node_data> s = copied.getV();\n\t\tIterator it = s.iterator();\n\t\tnode_data temp = (node_data) it.next();\n\t\tDFSUtil(copied,temp);\n\t\tfor (node_data node : s) {\n\t\t\tif (node.getTag() == 0) return false;\n\t\t}\n\t\ttransPose(copied);\n\t\ttagZero(copied);\n\t Collection<node_data> s1 = copied.getV();\n\t\tIterator it1 = s1.iterator();\n\t\tnode_data temp1 = (node_data) it1.next();\n\t\tDFSUtil(copied,temp1);\n\t\tfor (node_data node1 : s1) {\n\t\t\tif (node1.getTag() == 0) return false;\n\t\t}\n\n\t\treturn true;\n\t}", "public void addVertex(int vertex) {\n if (!adjacencyMap.containsKey(vertex)) {\n adjacencyMap.put(vertex, new HashSet<>());\n }\n }", "public WeightedAdjacencyGraph() {\n this.vertices = new HashMap<>();\n }", "public abstract boolean isUsing(Edge graphEdge);", "private static void depthFirstSearch(Vertex v, ArrayList<Vertex> visitedArrayList, Graph graph){\n visitedArrayList.add(v);\n Iterator<Vertex> iter=graph.getNeighbors(v).iterator();\n while (iter.hasNext()){\n Vertex v1=iter.next();\n if(!visitedArrayList.contains(v1)){\n depthFirstSearch(v1,visitedArrayList,graph);\n }\n }\n for(Vertex v1 : graph.getNeighbors(v)){\n if(!visitedArrayList.contains(v1)){\n depthFirstSearch(v1,visitedArrayList,graph);\n }\n }\n }", "public void setDirectedEdge(Vertex start, Vertex end, int weight) \n\t{\n\t\ttry {\n\t\t\tint vI = vertices.indexOf(start);\n\t\t\tint uI = vertices.indexOf(end);\n\t\t\tedges[vI][uI] = weight;\n\t\t} \n\t\tcatch (Exception e) {\n\t\t\treturn;\n\t\t}\n\t\t\n\n\t}", "public Graph() // constructor\n{\n vertexList = new Vertex[MAX_VERTS];\n // adjacency matrix\n adjMat = new int[MAX_VERTS][MAX_VERTS];\n nVerts = 0;\n for (int j = 0; j < MAX_VERTS; j++) // set adjacency\n for (int k = 0; k < MAX_VERTS; k++) // matrix to 0\n adjMat[j][k] = INFINITY;\n}", "public boolean resetEdges();", "public void setFalse(){\n for (int i = 0; i < Nodes.size(); i++){\n this.MinDistanceStatus.add(false);\n }\n }", "public void setShowNodes(Boolean value) {\n showNodes = value;\n }", "private int[][] searchAdjNodes(int nodeA) {\n\t\tint[] backNodes = new int[vertices[nodeA].length];\n\t\tint backNodesIndex = 0;\n\t\tint[] forwardNodes = new int[vertices[nodeA].length];\n\t\tint forwardNodesIndex = 0;\n\t\tfor (int nodeB : vertices[nodeA]) {\n\t\t\tif (edgeVisited[connectivity[nodeA][nodeB]])\n\t\t\t\tcontinue;\n\t\t\telse if (nodeVisited[nodeB] >= 0)\n\t\t\t\tbackNodes[backNodesIndex++] = nodeB;\n\t\t\telse\n\t\t\t\tforwardNodes[forwardNodesIndex++] = nodeB;\n\t\t}\n\t\tint[][] result = new int[2][];\n\t\t// Then arrange backNodes with depth from small to large\n\t\tint[] backNodesKey = new int[backNodesIndex];\n\t\tfor (int i = 0; i < backNodesIndex; i++)\n\t\t\tbackNodesKey[i] = nodeVisited[backNodes[i]];\n\t\tresult[0] = SortIntSet.sort(Arrays.copyOf(backNodes, backNodesIndex),\n\t\t\t\tbackNodesKey);\n\n\t\t// arrange forward edge/nodes with label from small to large\n\t\tint[] forwardNodesKey = new int[forwardNodesIndex];\n\t\tint[] forwardEdgeKey = new int[forwardNodesIndex];\n\t\tfor (int i = 0; i < forwardNodesIndex; i++) {\n\t\t\tint nodeID = forwardNodes[i];\n\t\t\tforwardNodesKey[i] = connectivity[nodeID][nodeID];\n\t\t\tforwardEdgeKey[i] = edgeLabel[connectivity[nodeA][nodeID]];\n\t\t}\n\t\tresult[1] = SortIntSet.sort(\n\t\t\t\tArrays.copyOf(forwardNodes, forwardNodesIndex), forwardEdgeKey,\n\t\t\t\tforwardNodesKey);\n\t\treturn result;\n\t}", "public boolean setNeighbour(int index, TriangleElt3D element) {\n\t\tswitch (index) {\n\t\tcase 0:\n\t\t\tthis.eltZero = element;\n\t\t\treturn true;\n\t\tcase 1:\n\t\t\tthis.eltOne = element;\n\t\t\treturn true;\n\t\tcase 2:\n\t\t\tthis.eltTwo = element;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public Builder setIsClusteringKey(boolean value) {\n\n isClusteringKey_ = value;\n onChanged();\n return this;\n }", "public void resetVisited() {\n\t\tthis.visited = new HashSet<Point>();\n\t}", "public void run() {\n\t\tArrays.fill(label, NOT_AN_INDEX);\r\n\t\t\r\n\t\t// while there is a u in V with considered[u]=0 and mate[u]=0 do\r\n\t\tstage: for (int u = 0; u < gOrig.numVertices(); u++ ) {\r\n\t\t\t// if(mate[u] == NOT_AN_INDEX){\r\n\t\t\tif (gOrig.vertex(u) == null) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (matching.matches() == gOrig.numVertices() / 2) {\r\n\t\t\t\t// we are done\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tSystem.out.print(String.format(\"considering vertex u%d\\n\", u));\r\n\t\t\tif ( ! matching.isMatched(u)) {\r\n\t\t\t\t\r\n\t\t\t\t// considered[u]=1,A={empty}\r\n\t\t\t\t// A = new WeightedDigraph(gOrig.numVertices()/2);\r\n\t\t\t\tA.clear();\r\n\t\t\t\t\r\n\t\t\t\t// forall v in V do exposed[v]=0\r\n\t\t\t\tArrays.fill(exposed, NOT_AN_INDEX);\r\n\t\t\t\t\r\n\t\t\t\t// Construct the auxiliary digraph\r\n\t\t\t\t\r\n\t\t\t\t// for all (v,w) in E do\r\n\t\t\t\tfor (int v = 0; v < gOrig.numVertices(); v++ ) {\r\n\t\t\t\t\tfor (Edge e : gOrig.eOuts(v)) {\r\n\t\t\t\t\t\tint w = e.right;\r\n\t\t\t\t\t\tassert e.left == v : \"vertex correspondence is wrong\";\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// if mate[w]=0 and w!=u then exposed[v]=w else if mate[w] !=v,0 then A=union(A,{v,mate[w]})\r\n\t\t\t\t\t\t// if(mate[w] == NOT_AN_INDEX && w != u){\r\n\t\t\t\t\t\t// exposed[v] = w;\r\n\t\t\t\t\t\t// }else if(mate[w] != v && mate[w] != NOT_AN_INDEX){\r\n\t\t\t\t\t\t// A.addEdge(new Edge(v,mate[w]));\r\n\t\t\t\t\t\t// }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ( ! matching.isMatched(w) && w != u) {\r\n\t\t\t\t\t\t\t// DEBUG(String.format(\"adding (%d,%d) to exposed\\n\", v, w));\r\n\t\t\t\t\t\t\tif (exposed[v] == NOT_AN_INDEX) {\r\n\t\t\t\t\t\t\t\texposed[v] = w;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if (matching.mate(w) != v && matching.isMatched(w)) {\r\n\t\t\t\t\t\t\t// DEBUG(String.format(\"adding (%d,%d) to A\\n\", v, matching.mate(w)));\r\n\t\t\t\t\t\t\tA.add(new Edge(v, matching.mate(w)));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tDEBUG(String.format(\"Exposed vertices={%s}\\n\", printExposed()));\r\n\t\t\t\tif (exposed().size() == 0) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// forall v in V do seen[v]=0\r\n\t\t\t\tArrays.fill(seen, false);\r\n\t\t\t\t\r\n\t\t\t\t// Q={u}; label[u]=0; if exposed[u]!=0 then augment(u), goto stage;\r\n\t\t\t\tQ.clear();\r\n\t\t\t\tQ.add(u);\r\n\t\t\t\tArrays.fill(label, NOT_AN_INDEX);// unsure whether it was meant to clear label or just unset label[u] OLD_CODE=label[u] = NOT_AN_INDEX;\r\n\t\t\t\tif (isExposed(u)) {\r\n\t\t\t\t\taugment(u);\r\n\t\t\t\t\tDEBUG(String.format(\"new matching %s\\n\", matching.toString()));\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t// need to figure out how to handle blossom()\r\n\t\t\t\t\r\n\t\t\t\t// while Q != {empty} do\r\n\t\t\t\twhile ( ! Q.isEmpty()) {\r\n\t\t\t\t\tint v = Q.pop();\r\n\t\t\t\t\t\r\n\t\t\t\t\t// forall unlabeled nodes w in V such that (v,w) in A\r\n\t\t\t\t\tfor (Edge e : A) {\r\n\t\t\t\t\t\tint w = e.left;\r\n\t\t\t\t\t\tif (e.right == v && label[w] == NOT_AN_INDEX && label[v] != w) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Q=union(Q,w), label[w]=v\r\n\t\t\t\t\t\t\tif ( ! Q.contains(w)) {\r\n\t\t\t\t\t\t\t\tQ.offer(w);\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tcontinue; ///THIS CONTINUE WAS ADDED LATE AT NIGHT\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tlabel[w] = v;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// seen[mate[w]] = 1;\r\n\t\t\t\t\t\t\ttry{\r\n\t\t\t\t\t\t\t\tint mate = findMate(w);\r\n\t\t\t\t\t\t\t\tseen[mate] = true;\r\n\t\t\t\t\t\t\t}catch(Exception err){\r\n\t\t\t\t\t\t\t\tDEBUG(String.format(\"error marking mate of %d as seen, mate not found\\n\", w));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// if exposed[w]!=0 then augment(w) goto stage;\r\n\t\t\t\t\t\t\tif (isExposed(w)) {\r\n\t\t\t\t\t\t\t\taugment(w);\r\n\t\t\t\t\t\t\t\tDEBUG(String.format(\"new matching %s\\n\", matching.toString()));\r\n\t\t\t\t\t\t\t\tcontinue stage;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// if seen[w]=1 then blossom(w)\r\n\t\t\t\t\t\t\tif (seen[w]) {\r\n\t\t\t\t\t\t\t\tblossom(w);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// remove loops created by the blossoms\r\n\t\t\t\t\tremoveSelfLoops(A);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public NeighbourhoodCache(boolean disable) {\n this.disable = disable;\n this.cachedNeighborhoods = new HashMap<CacheKey, List<AdjacentVertexWithEdge>>(MaxCacheSize);\n this.lruQueue = new ArrayDeque<CacheKey>(MaxCacheSize);\n }", "private void fillAdjacencyMatrix( int x, int y )\n\t{\n\t\tfor( int i = 1; i < 9; i++ )\n\t\t{\n\t\t\tfor( int j = 1; j < 9; j++ )\n\t\t\t{\n\t\t\t\tif( x == i || y == j || (Math.floorDiv(x, 3) == Math.floorDiv(i, 3) && Math.floorDiv(y, 3) == Math.floorDiv(j,3)))\n\t\t\t\t\t;\n\t\t\t\telse\n\t\t\t\t\t;\n\t\t\t}\n\t\t}\n\t}", "private static void addAllEdgeInstances (Graph graph, boolean isDirected){\n Collection<Node> noteSet = graph.getNodeSet();\n\n for (Iterator<Node> iterator = noteSet.iterator(); iterator.hasNext();) {\n Node startNode = (Node) iterator.next();\n\n for (Iterator<Node> iterator2 = noteSet.iterator(); iterator2.hasNext();) {\n Node endNode = (Node) iterator2.next();\n\n if (!(startNode == endNode)){\n graph.addEdge(startNode.toString().concat(endNode.toString()), startNode, endNode, isDirected);\n }\n\n }\n }\n }", "public static void setFound(boolean a){\n found = a;\n }", "private void reset() throws ParallelException {\r\n\t\tif (_k==2) _g.makeNNbors(true); // force reset (from cache)\r\n\t\t// else _g.makeNbors(true); // don't force reset (from cache): no need\r\n _nodesq = new TreeSet(_origNodesq);\r\n }", "public static void main(String[] args) throws IOException {\n File file = new File(args[0]);\r\n //FileOutputStream f = new FileOutputStream(\"prat_dfs_data2.txt\");\r\n //System.setOut(new PrintStream(f));\r\n BufferedReader reader = new BufferedReader(new FileReader(file));\r\n String line;\r\n line = reader.readLine();\r\n int nodecount = 0;\r\n HashMap <String , Integer> nodeMap = new HashMap <String , Integer>(); \r\n while ((line = reader.readLine()) != null ) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n if (!nodeMap.containsKey(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"))){\r\n nodeMap.put(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"), nodecount);\r\n nodecount++;\r\n }\r\n }\r\n reader.close();\r\n Vertex adjList[] = new Vertex[nodecount];\r\n Vertex sortVer[] = new Vertex[nodecount];\r\n for(int it = 0; it < nodecount; it++){\r\n adjList[it] = new Vertex(it);\r\n }\r\n nodeMap.forEach((k, v) -> adjList[v].val = k);\r\n File file2 = new File(args[1]);\r\n BufferedReader reader2 = new BufferedReader(new FileReader(file2));\r\n line = reader2.readLine();\r\n while ((line = reader2.readLine()) !=null) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n String source = data[0].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n String target = data[1].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n\r\n int weight = Integer.parseInt(data[2]);\r\n Vertex current = adjList[nodeMap.get(source)];\r\n Vertex newbie = new Vertex(nodeMap.get(target));\r\n current.countN++;\r\n current.co_occur += weight;\r\n if (adjList[nodeMap.get(source)].next == null){\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n else{\r\n current.next.prev = newbie;\r\n newbie.next = current.next;\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n Vertex current1 = adjList[nodeMap.get(target)];\r\n Vertex newbie1 = new Vertex(nodeMap.get(source));\r\n current1.co_occur += weight;\r\n current1.countN++;\r\n if (current1.next == null){\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n else{\r\n current1.next.prev = newbie1;\r\n newbie1.next = current1.next;\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n }\r\n reader2.close();\r\n \r\n for(int it = 0; it < nodecount; it++){\r\n sortVer[it] = new Vertex(adjList[it].id);\r\n sortVer[it].val = adjList[it].val;\r\n sortVer[it].co_occur = adjList[it].co_occur;\r\n }\r\n if (args[2].equals(\"average\")){\r\n double countdeg = 0;\r\n for(int it = 0; it<nodecount; it++){\r\n countdeg+= (double) adjList[it].countN;\r\n }\r\n countdeg = countdeg / (double) (nodecount);\r\n System.out.printf(\"%.2f\", countdeg);\r\n System.out.println();\r\n //long toc= System.nanoTime();\r\n //System.out.println((toc- startTime)/1000000000.0);\r\n }\r\n \r\n if(args[2].equals(\"rank\")){\r\n Graph.mergesort(sortVer, 0, nodecount-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n System.out.print(sortVer[0].val);\r\n for(int kk=1; kk<nodecount; kk++){\r\n System.out.print(\",\" + sortVer[kk].val.toString());\r\n }\r\n System.out.println();\r\n }\r\n if(args[2].equals(\"independent_storylines_dfs\")){\r\n boolean visited[] = new boolean[nodecount];\r\n int ind = 0;\r\n ArrayList<ArrayList<Vertex>> comps = new ArrayList<ArrayList<Vertex>>();\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n visited[it1] = false;\r\n }\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n if (visited[it1] == false){\r\n ArrayList<Vertex> temp = new ArrayList<Vertex>();\r\n Graph.dfs(it1, visited, ind, adjList, temp);\r\n ind++;\r\n Graph.mergesort2(temp, 0, temp.size()-1);\r\n comps.add(temp);\r\n }\r\n }\r\n Graph.mergesort3(comps, 0, comps.size()-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n for(int a1 = 0; a1 < ind; a1++){\r\n System.out.print(comps.get(a1).get(0).val);\r\n for(int j1 = 1; j1<comps.get(a1).size(); j1++){\r\n System.out.print(\",\" + comps.get(a1).get(j1).val);\r\n }\r\n System.out.println();\r\n }\r\n }\r\n }" ]
[ "0.58435965", "0.5608546", "0.5606652", "0.5499805", "0.54875183", "0.54812425", "0.54105", "0.5384961", "0.5351501", "0.534259", "0.5322368", "0.53071725", "0.5294218", "0.52686214", "0.52137876", "0.52078444", "0.51721334", "0.51659644", "0.51645666", "0.5156271", "0.5140599", "0.5133081", "0.512898", "0.51173985", "0.5113441", "0.50969166", "0.5091138", "0.5072264", "0.506099", "0.50534207", "0.5052762", "0.50404423", "0.5040397", "0.50263226", "0.5022215", "0.50218016", "0.5019093", "0.50147593", "0.50076085", "0.5006918", "0.49961495", "0.4965241", "0.49648175", "0.49612853", "0.49435222", "0.49377778", "0.4937626", "0.49374", "0.49337018", "0.49283385", "0.49234465", "0.4923", "0.49156898", "0.49134594", "0.4913327", "0.49129203", "0.49107376", "0.4905538", "0.49031037", "0.48963192", "0.48955172", "0.4884558", "0.48658618", "0.48562568", "0.48363274", "0.48321414", "0.48320603", "0.48315156", "0.48263714", "0.4807831", "0.4804866", "0.4804866", "0.48023582", "0.47986296", "0.4786783", "0.47829953", "0.47757125", "0.47678614", "0.4764725", "0.4764134", "0.47563004", "0.47505936", "0.47467434", "0.47412482", "0.47363403", "0.47361284", "0.47344637", "0.4724256", "0.47220448", "0.47213325", "0.47197837", "0.47098112", "0.47058737", "0.4702811", "0.47027394", "0.46996173", "0.46949428", "0.46769604", "0.46736935", "0.46660385" ]
0.8401874
0
Begins the ION search procedure, described at each step
public List<Graph> search() { long start = System.currentTimeMillis(); TetradLogger.getInstance().log("info", "Starting ION Search."); logGraphs("\nInitial Pags: ", this.input); TetradLogger.getInstance().log("info", "Transfering local information."); long steps = System.currentTimeMillis(); /* * Step 1 - Create the empty graph */ List<Node> varNodes = new ArrayList<>(); for (String varName : variables) { varNodes.add(new GraphNode(varName)); } Graph graph = new EdgeListGraph(varNodes); /* * Step 2 - Transfer local information from the PAGs (adjacencies * and edge orientations) */ // transfers edges from each graph and finds definite noncolliders transferLocal(graph); // adds edges for variables never jointly measured for (NodePair pair : nonIntersection(graph)) { graph.addEdge(new Edge(pair.getFirst(), pair.getSecond(), Endpoint.CIRCLE, Endpoint.CIRCLE)); } TetradLogger.getInstance().log("info", "Steps 1-2: " + (System.currentTimeMillis() - steps) / 1000. + "s"); System.out.println("step2"); System.out.println(graph); /* * Step 3 * * Branch and prune step that blocks problematic undirectedPaths, possibly d-connecting undirectedPaths */ steps = System.currentTimeMillis(); Queue<Graph> searchPags = new LinkedList<>(); // place graph constructed in step 2 into the queue searchPags.offer(graph); // get d-separations and d-connections List<Set<IonIndependenceFacts>> sepAndAssoc = findSepAndAssoc(graph); this.separations = sepAndAssoc.get(0); this.associations = sepAndAssoc.get(1); Map<Collection<Node>, List<PossibleDConnectingPath>> paths; // Queue<Graph> step3PagsSet = new LinkedList<Graph>(); HashSet<Graph> step3PagsSet = new HashSet<>(); Set<Graph> reject = new HashSet<>(); // if no d-separations, nothing left to search if (separations.isEmpty()) { // makes orientations preventing definite noncolliders from becoming colliders // do final orientations // doFinalOrientation(graph); step3PagsSet.add(graph); } // sets length to iterate once if search over path lengths not enabled, otherwise set to 2 int numNodes = graph.getNumNodes(); int pl = numNodes - 1; if (pathLengthSearch) { pl = 2; } // iterates over path length, then adjacencies for (int l = pl; l < numNodes; l++) { if (pathLengthSearch) { TetradLogger.getInstance().log("info", "Braching over path lengths: " + l + " of " + (numNodes - 1)); } int seps = separations.size(); int currentSep = 1; int numAdjacencies = separations.size(); for (IonIndependenceFacts fact : separations) { if (adjacencySearch) { TetradLogger.getInstance().log("info", "Braching over path nonadjacencies: " + currentSep + " of " + numAdjacencies); } seps--; // uses two queues to keep up with which PAGs are being iterated and which have been // accepted to be iterated over in the next iteration of the above for loop searchPags.addAll(step3PagsSet); recGraphs.add(searchPags.size()); step3PagsSet.clear(); while (!searchPags.isEmpty()) { System.out.println("ION Step 3 size: " + searchPags.size()); double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); if (currentUsage > maxMemory) maxMemory = currentUsage; // deques first PAG from searchPags Graph pag = searchPags.poll(); // Part 3.a - finds possibly d-connecting undirectedPaths between each pair of nodes // known to be d-separated List<PossibleDConnectingPath> dConnections = new ArrayList<>(); // checks to see if looping over adjacencies if (adjacencySearch) { for (Collection<Node> conditions : fact.getZ()) { // checks to see if looping over path lengths if (pathLengthSearch) { dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength (pag, fact.getX(), fact.getY(), conditions, l)); } else { dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths (pag, fact.getX(), fact.getY(), conditions)); } } } else { for (IonIndependenceFacts allfact : separations) { for (Collection<Node> conditions : allfact.getZ()) { // checks to see if looping over path lengths if (pathLengthSearch) { dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength (pag, allfact.getX(), allfact.getY(), conditions, l)); } else { dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths (pag, allfact.getX(), allfact.getY(), conditions)); } } } } // accept PAG go to next PAG if no possibly d-connecting undirectedPaths if (dConnections.isEmpty()) { // doFinalOrientation(pag); // Graph p = screenForKnowledge(pag); // if (p != null) step3PagsSet.add(p); step3PagsSet.add(pag); continue; } // maps conditioning sets to list of possibly d-connecting undirectedPaths paths = new HashMap<>(); for (PossibleDConnectingPath path : dConnections) { List<PossibleDConnectingPath> p = paths.get(path.getConditions()); if (p == null) { p = new LinkedList<>(); } p.add(path); paths.put(path.getConditions(), p); } // Part 3.b - finds minimal graphical changes to block possibly d-connecting undirectedPaths List<Set<GraphChange>> possibleChanges = new ArrayList<>(); for (Set<GraphChange> changes : findChanges(paths)) { Set<GraphChange> newChanges = new HashSet<>(); for (GraphChange gc : changes) { boolean okay = true; for (Triple collider : gc.getColliders()) { if (pag.isUnderlineTriple(collider.getX(), collider.getY(), collider.getZ())) { okay = false; break; } } if (!okay) { continue; } for (Triple collider : gc.getNoncolliders()) { if (pag.isDefCollider(collider.getX(), collider.getY(), collider.getZ())) { okay = false; break; } } if (okay) { newChanges.add(gc); } } if (!newChanges.isEmpty()) { possibleChanges.add(newChanges); } else { possibleChanges.clear(); break; } } float starthitset = System.currentTimeMillis(); Collection<GraphChange> hittingSets = IonHittingSet.findHittingSet(possibleChanges); recHitTimes.add((System.currentTimeMillis() - starthitset) / 1000.); // Part 3.c - checks the newly constructed graphs from 3.b and rejects those that // cycles or produce independencies known not to occur from the input PAGs or // include undirectedPaths from definite nonancestors for (GraphChange gc : hittingSets) { boolean badhittingset = false; for (Edge edge : gc.getRemoves()) { Node node1 = edge.getNode1(); Node node2 = edge.getNode2(); Set<Triple> triples = new HashSet<>(); triples.addAll(gc.getColliders()); triples.addAll(gc.getNoncolliders()); if (triples.size() != (gc.getColliders().size() + gc.getNoncolliders().size())) { badhittingset = true; break; } for (Triple triple : triples) { if (node1.equals(triple.getY())) { if (node2.equals(triple.getX()) || node2.equals(triple.getZ())) { badhittingset = true; break; } } if (node2.equals(triple.getY())) { if (node1.equals(triple.getX()) || node1.equals(triple.getZ())) { badhittingset = true; break; } } } if (badhittingset) { break; } for (NodePair pair : gc.getOrients()) { if ((node1.equals(pair.getFirst()) && node2.equals(pair.getSecond())) || (node2.equals(pair.getFirst()) && node1.equals(pair.getSecond()))) { badhittingset = true; break; } } if (badhittingset) { break; } } if (!badhittingset) { for (NodePair pair : gc.getOrients()) { for (Triple triple : gc.getNoncolliders()) { if (pair.getSecond().equals(triple.getY())) { if (pair.getFirst().equals(triple.getX()) && pag.getEndpoint(triple.getZ(), triple.getY()).equals(Endpoint.ARROW)) { badhittingset = true; break; } if (pair.getFirst().equals(triple.getZ()) && pag.getEndpoint(triple.getX(), triple.getY()).equals(Endpoint.ARROW)) { badhittingset = true; break; } } if (badhittingset) { break; } } if (badhittingset) { break; } } } if (badhittingset) { continue; } Graph changed = gc.applyTo(pag); // if graph change has already been rejected move on to next graph if (reject.contains(changed)) { continue; } // if graph change has already been accepted move on to next graph if (step3PagsSet.contains(changed)) { continue; } // reject if null, predicts false independencies or has cycle if (predictsFalseIndependence(associations, changed) || changed.existsDirectedCycle()) { reject.add(changed); } // makes orientations preventing definite noncolliders from becoming colliders // do final orientations // doFinalOrientation(changed); // now add graph to queue // Graph p = screenForKnowledge(changed); // if (p != null) step3PagsSet.add(p); step3PagsSet.add(changed); } } // exits loop if not looping over adjacencies if (!adjacencySearch) { break; } } } TetradLogger.getInstance().log("info", "Step 3: " + (System.currentTimeMillis() - steps) / 1000. + "s"); Queue<Graph> step3Pags = new LinkedList<>(step3PagsSet); /* * Step 4 * * Finds redundant undirectedPaths and uses this information to expand the list * of possible graphs */ steps = System.currentTimeMillis(); Map<Edge, Boolean> necEdges; Set<Graph> outputPags = new HashSet<>(); while (!step3Pags.isEmpty()) { Graph pag = step3Pags.poll(); necEdges = new HashMap<>(); // Step 4.a - if x and y are known to be unconditionally associated and there is // exactly one trek between them, mark each edge on that trek as necessary and // make the tiples on the trek definite noncolliders // initially mark each edge as not necessary for (Edge edge : pag.getEdges()) { necEdges.put(edge, false); } // look for unconditional associations for (IonIndependenceFacts fact : associations) { for (List<Node> nodes : fact.getZ()) { if (nodes.isEmpty()) { List<List<Node>> treks = treks(pag, fact.x, fact.y); if (treks.size() == 1) { List<Node> trek = treks.get(0); List<Triple> triples = new ArrayList<>(); for (int i = 1; i < trek.size(); i++) { // marks each edge in trek as necessary necEdges.put(pag.getEdge(trek.get(i - 1), trek.get(i)), true); if (i == 1) { continue; } // makes each triple a noncollider pag.addUnderlineTriple(trek.get(i - 2), trek.get(i - 1), trek.get(i)); } } // stop looping once the empty set is found break; } } } // Part 4.b - branches by generating graphs for every combination of removing // redundant undirectedPaths boolean elimTreks; // checks to see if removing redundant undirectedPaths eliminates every trek between // two variables known to be nconditionally assoicated List<Graph> possRemovePags = possRemove(pag, necEdges); double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); if (currentUsage > maxMemory) maxMemory = currentUsage; for (Graph newPag : possRemovePags) { elimTreks = false; // looks for unconditional associations for (IonIndependenceFacts fact : associations) { for (List<Node> nodes : fact.getZ()) { if (nodes.isEmpty()) { if (treks(newPag, fact.x, fact.y).isEmpty()) { elimTreks = true; } // stop looping once the empty set is found break; } } } // add new PAG to output unless a necessary trek has been eliminated if (!elimTreks) { outputPags.add(newPag); } } } outputPags = removeMoreSpecific(outputPags); // outputPags = applyKnowledge(outputPags); TetradLogger.getInstance().log("info", "Step 4: " + (System.currentTimeMillis() - steps) / 1000. + "s"); /* * Step 5 * * Generate the Markov equivalence classes for graphs and accept only * those that do not predict false d-separations */ steps = System.currentTimeMillis(); Set<Graph> outputSet = new HashSet<>(); for (Graph pag : outputPags) { Set<Triple> unshieldedPossibleColliders = new HashSet<>(); for (Triple triple : getPossibleTriples(pag)) { if (!pag.isAdjacentTo(triple.getX(), triple.getZ())) { unshieldedPossibleColliders.add(triple); } } PowerSet<Triple> pset = new PowerSet<>(unshieldedPossibleColliders); for (Set<Triple> set : pset) { Graph newGraph = new EdgeListGraph(pag); for (Triple triple : set) { newGraph.setEndpoint(triple.getX(), triple.getY(), Endpoint.ARROW); newGraph.setEndpoint(triple.getZ(), triple.getY(), Endpoint.ARROW); } doFinalOrientation(newGraph); } for (Graph outputPag : finalResult) { if (!predictsFalseIndependence(associations, outputPag)) { Set<Triple> underlineTriples = new HashSet<>(outputPag.getUnderLines()); for (Triple triple : underlineTriples) { outputPag.removeUnderlineTriple(triple.getX(), triple.getY(), triple.getZ()); } outputSet.add(outputPag); } } } // outputSet = applyKnowledge(outputSet); outputSet = checkPaths(outputSet); output.addAll(outputSet); TetradLogger.getInstance().log("info", "Step 5: " + (System.currentTimeMillis() - steps) / 1000. + "s"); runtime = ((System.currentTimeMillis() - start) / 1000.); logGraphs("\nReturning output (" + output.size() + " Graphs):", output); double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); if (currentUsage > maxMemory) maxMemory = currentUsage; return output; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void searchFunction() {\n\t\t\r\n\t}", "private void goSearch() {\n\t\tThread t = new Thread(this);\n\t\tt.start();\n\t}", "@Override\n\tpublic boolean onSearchRequested()\n\t{\n \tstartSearch(getCurSearch(), true, null, false);\n \treturn true;\n\t}", "public void startSearch() {\n if (solving) {\n Alg.Dijkstra();\n }\n pause(); //pause state\n }", "public void search() {\r\n \t\r\n }", "void searchStarted (Search search);", "public void initialSearch() {\n Kinematics k = getTrustedRobotKinematics();\n //logger.info(\"Kinematics position is \" + k.getPosition());\n\n // Set the default planner.\n setPlanner(PlannerType.TRAPEZOIDAL);\n\n // For gateway no zones were defined yet.\n m_robot.setCheckZones(false);\n\n // Do a preliminary trajectory in a lawnmower pattern.\n Point startPoint = k.getPosition();\n runTrajectory(startPoint, m_lawnmowerTrajectory);\n m_initialSearchDone = true;\n }", "private void startSearch() {\n for (int i = 0; i < this.threadsSaerch.length; i++) {\n this.threadsSaerch[i] = this.threads.getSearchThread();\n this.threadsSaerch[i].start();\n }\n }", "public void search() {\n }", "private void startSearch()\n {\n model.clear();\n ArrayList<String> result;\n if (orRadio.isSelected())\n {\n SearchEngine.search(highTerms.getText(), lowTerms.getText());\n result = SearchEngine.getShortForm();\n }\n else\n {\n SearchEngine.searchAnd(highTerms.getText(), lowTerms.getText());\n result = SearchEngine.getShortForm();\n }\n for (String s : result)\n {\n model.addElement(s);\n }\n int paragraphsRetrieved = result.size();\n reviewedField.setText(\" Retrieved \" + paragraphsRetrieved + \" paragraphs\");\n }", "@Override\n protected void beforeSearch() {\n index = 0;\n numberOfIterations = 0;\n pageCounter = 0;\n }", "public abstract void startSingleScan();", "public abstract void PrepareSearchSpace();", "@Override\n protected void search() {\n \n obtainProblem();\n if (prioritizedHeroes.length > maxCreatures){\n frame.recieveProgressString(\"Too many prioritized creatures\");\n return;\n }\n bestComboPermu();\n if (searching){\n frame.recieveDone();\n searching = false;\n }\n }", "@Override\n\tpublic void search() {\n\t}", "public boolean iterate() {\n\t\tupdated = false;\n//\t\tSystem.out.println(\"QN iterations \"+iterations);\n\t\tif( mode == 0 ) {\n\t\t\treturn computeSearchDirection();\n\t\t} else {\n\t\t\treturn performLineSearch();\n\t\t}\n\t}", "@Override\r\n\tpublic void search() {\n\r\n\t}", "public void search() {\n try {\n for(int i = 0; i < this.queries.size(); i++){\n search(i);\n // in case of error stop\n if(!this.searchOK(i)){\n System.out.println(\"\\t\" + new Date().toString() + \" \" + db + \" Search for rest queries cancelled, because failed for query \" + i + \" : \" + this.queries.get(i));\n break;\n }\n }\n } catch (UnsupportedEncodingException ex) {\n Logger.getLogger(EntrezSearcher.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public void onSearchStarted();", "@Override\n protected void start() throws Exception {\n LogManager.getLogger().log(ALGORITHM, \"STARTING TABU SEARCH...\");\n LogManager.getLogger().log(ALGORITHM, \"MAX ITERATIONS: \" + maxIterations);\n LogManager.getLogger().log(ALGORITHM, \"MAX ITERATIONS WITHOUT IMPROVEMENTS: \" + maxIterationsWithoutImprovement);\n LogManager.getLogger().log(ALGORITHM, \"MIN QUEUE: \" + minQueue);\n LogManager.getLogger().log(ALGORITHM, \"RISING TREND: \" + risingTrend);\n LogManager.getLogger().log(ALGORITHM, \"MAX THREADS: \" + (maxThreads != null ? maxThreads : \"DEFAULT\"));\n LogManager.getLogger().log(ALGORITHM, \"MULTI-STARTS -> # OF GREEDY: \" + greedyMultiStart + \", # OF RANDOM: \" + randomMultiStart);\n\n String iSettings = null;\n if (intensificationLearning) {\n iSettings = \"LEARNING\";\n }\n if (localSearchIntensification) {\n if (iSettings != null) {\n iSettings += \", \";\n } else {\n iSettings = \"\";\n }\n iSettings += \"LOCAL SEARCH\";\n }\n if (pathRelinking) {\n if (iSettings != null) {\n iSettings += \", \";\n } else {\n iSettings = \"\";\n }\n iSettings += \"PATH RELINKING\";\n }\n if (intensification) {\n if (iSettings != null) {\n iSettings += \", \";\n } else {\n iSettings = \"\";\n }\n iSettings += \"INTENSIFICATION\";\n }\n if (iSettings == null) {\n iSettings = \"NONE\";\n }\n LogManager.getLogger().log(ALGORITHM, \"INTENSIFICATION SETTINGS: \" + iSettings);\n\n String dSettings = null;\n if (diversificationLearning) {\n dSettings = \"LEARNING\";\n }\n if (greedyMultiStart + randomMultiStart > 1) {\n if (dSettings != null) {\n dSettings += \", \";\n } else {\n dSettings = \"\";\n }\n dSettings += \"MULTI-STARTS\";\n }\n if (moveDiversification) {\n if (dSettings != null) {\n dSettings += \", \";\n } else {\n dSettings = \"\";\n }\n dSettings += \"MOVE DIVERSIFY\";\n }\n if (diversification) {\n if (dSettings != null) {\n dSettings += \", \";\n } else {\n dSettings = \"\";\n }\n dSettings += \"DIVERSIFICATION\";\n }\n if (dSettings == null) {\n dSettings = \"NONE\";\n }\n LogManager.getLogger().log(ALGORITHM, \"DIVERSIFICATION SETTINGS: \" + dSettings);\n\n LabeledUndirectedGraph<N, E> zero = getZeroGraph(minGraph);\n\n if (!zero.isConnected()) {\n minCost = zero.calculateCost() + 1;\n\n Queue<LabeledUndirectedGraph<N, E>> startsQueue = new LinkedList<>();\n for (int i = 0; i < greedyMultiStart; i++) {\n startsQueue.add(applyMVCA());\n }\n for (int i = 0; i < randomMultiStart; i++) {\n startsQueue.add(new LabeledUndirectedGraph<>(getSpanningTree(graph)));\n }\n int nthreads = Runtime.getRuntime().availableProcessors();\n if (maxThreads != null) {\n if (maxThreads <= 1) {\n nthreads = 1;\n } else {\n nthreads = maxThreads;\n }\n }\n nthreads = Integer.min(nthreads, (greedyMultiStart + randomMultiStart));\n\n LogManager.getLogger().log(ALGORITHM, \"THREADS: \" + nthreads);\n\n //PRINT PROGRESS\n prog = 0;\n tot = startsQueue.size();\n print(Ansi.ansi().cursor().save().erase().eraseLine().a(String.format(\"\\t%.2f%%\", prog)));\n\n if (nthreads == 1) {\n while (!startsQueue.isEmpty()) {\n compute(startsQueue.poll());\n\n //PRINT PROGRESS\n// prog = (tot - startsQueue.size()) * 100 / tot;\n prog = 100;\n print(Ansi.ansi().cursor().load().erase().eraseLine().a(String.format(\"\\t%.2f%%\", prog)));\n }\n } else {\n\n List<Thread> pool = new ArrayList<>();\n for (int i = 0; i < nthreads; i++) {\n Thread th = new Thread(() -> {\n try {\n boolean empty;\n synchronized (lock) {\n empty = startsQueue.isEmpty();\n }\n\n while (!empty) {\n LabeledUndirectedGraph<N, E> g;\n\n synchronized (lock) {\n g = startsQueue.poll();\n }\n compute(g);\n synchronized (lock) {\n empty = startsQueue.isEmpty();\n\n //PRINT PROGRESS\n// prog = (tot - startsQueue.size()) * 100 / tot;\n prog++;\n double _prog = this.prog * 100 / tot;\n print(Ansi.ansi().cursor().load().erase().eraseLine().a(String.format(\"\\t%.2f%%\", _prog)));\n }\n }\n } catch (Exception ex) {\n throw new RuntimeException(ex);\n }\n });\n th.setDaemon(false);\n th.setName(\"TabuSearch_Calc_\" + i);\n th.setPriority(Thread.MAX_PRIORITY);\n th.start();\n pool.add(th);\n }\n for (Thread th : pool) {\n th.join();\n }\n }\n\n println();\n\n minGraphs.forEach(_min -> {\n if (_min.calculateCost() < minGraph.calculateCost()) {\n minGraph = _min;\n }\n });\n\n LogManager.getLogger().log(ALGORITHM, \"END TABU SEARCH.\");\n LogManager.getLogger().log(ALGORITHM, \"BEST AT THIS POINT: \" + minGraph.calculateCost());\n\n if (pathRelinking) {\n LogManager.getLogger().log(ALGORITHM, \"STARTING PATH RELINKING...\");\n\n pathRelinking(pathRelinkingAlt);\n\n println();\n LogManager.getLogger().log(ALGORITHM, \"BEST AT THIS POINT: \" + minGraph.calculateCost());\n }\n } else {\n minGraph = zero;\n }\n\n LogManager.getLogger().log(ALGORITHM, \"END.\");\n }", "void stateProcessed (Search search);", "void setStartSearch(int startSearch);", "public void run()\r\n {\n\ttopLevelSearch=FIND_TOP_LEVEL_PAGES;\r\n\ttopLevelPages=new Vector();\r\n\tnextLevelPages=new Vector();\r\n \r\n\t// Check to see if a proxy is being used. If so then we use IP Address rather than host name.\r\n\tproxyDetected=detectProxyServer();\r\n\t \r\n\tstartSearch();\r\n \r\n\tapp.enableButtons();\r\n\tapp.abort.disable();\r\n \r\n\tif(hitsFound == 0 && pageOpened == true)\r\n\t app.statusArea.setText(\"No Matches Found\");\r\n else if(hitsFound==1)\r\n\t app.statusArea.setText(hitsFound+\" Match Found\");\r\n else app.statusArea.setText(hitsFound+\" Matches Found\");\r\n }", "public void okFind()\n {\n ASPManager mgr = getASPManager();\n\n trans.clear();\n q = trans.addQuery(headblk);\n q.addWhereCondition(\"WO_NO<(SELECT Number_Serie_API.Get_Last_Wo_Number FROM DUAL) AND CONTRACT IN(SELECT User_Allowed_Site_API.Authorized(CONTRACT) FROM DUAL)\");\n q.addWhereCondition(\"CONNECTION_TYPE_DB = 'EQUIPMENT'\");\n q.includeMeta(\"ALL\");\n\n // nimhlk - Begin\n if (mgr.dataTransfered())\n {\n ASPBuffer retBuffer = mgr.getTransferedData();\n if (retBuffer.itemExists(\"WO_NO\"))\n {\n String ret_wo_no = retBuffer.getValue(\"WO_NO\");\n q.addWhereCondition(\"WO_NO = ?\");\n q.addParameter(\"WO_NO\",ret_wo_no);\n }\n else\n q.addOrCondition(mgr.getTransferedData());\n }\n // nimhlk - End\n\n mgr.querySubmit(trans,headblk);\n\n if (headset.countRows() == 0)\n {\n mgr.showAlert(mgr.translate(\"PCMWACTIVESEPARATENODATA: No data found.\"));\n headset.clear();\n }\n if (headset.countRows() == 1)\n {\n lay.setLayoutMode(lay.SINGLE_LAYOUT);\n }\n mgr.createSearchURL(headblk);\n }", "abstract public void search();", "public void run() {\n System.out.println(StartCodonFinder.StartCodon.header() + \"\\texpect\\troles\");\n // Loop through the contigs.\n for (Contig contig : this.genome.getContigs()) {\n String contigId = contig.getId();\n if (debug) System.err.println(\"Processing contig \" + contigId);\n ContigStarts roleMapper = this.startRoleMap.get(contigId);\n ContigOrfTracker orfTracker = this.orfTrackerMap.get(contigId);\n String contigSeq = contig.getSequence();\n StartCodonFinder startFinder = new StartCodonFinder(contigId, contigSeq, orfTracker);\n // Loop through the starts in the contig.\n for (StartCodonFinder.StartCodon start : startFinder) {\n String expect;\n String roles = roleMapper.getRoles(start.getLoc());\n if (roles == null) {\n expect = \"other\";\n roles = \"\";\n } else {\n expect = \"start\";\n }\n System.out.println(start.toString() + \"\\t\" + expect + \"\\t\" + roles);\n }\n }\n }", "public void requestStart(){\r\n\t\t\r\n\t\tIterator <NavigationObserver> navOb = this.navega.iterator();\r\n\t\twhile ( navOb.hasNext()){\r\n\t\t\tnavOb.next().initNavigationModule(this.navega.getCurrentPlace(), this.direction);\r\n\t\t}\r\n\t\tIterator <RobotEngineObserver> robOb = this.iterator();\r\n\t\twhile (robOb.hasNext()){\r\n\t\t\trobOb.next().robotUpdate(fuel, recycledMaterial);\r\n\t\t}\r\n\t}", "void search();", "void search();", "private void fetch(int i){\n // if Search completes succesfully\n if(searchOK(i)){// proceed to fetch\n int docs = Integer.parseInt(counts.get(i));\n int start = 0;\n // while end of results not reached\n // i.e. stops when the last document of the last batch (start + step) is grater than the total count of docs\n while(start < docs){\n //get next part of results\n fetchPart(i,start,step);\n start += step;\n }\n } else { // print a message for wrong search of specific query\n // Log printing\n if(debugMode) {\n System.out.println(\" \" + new Date().toString() + \" \" + db + \" Fetch > No succesful search for query : \" + this.queries.get(i));\n }\n }\n }", "public void incomingSearchRequest(APDUEvent e)\n {\n LOGGER.finer(\"Processing incomingSearch_Request\");\n \n SearchRequest_type search_request = (SearchRequest_type) (e.getPDU().o);\n \n // Create a search response\n PDU_type pdu = new PDU_type();\n pdu.which=PDU_type.searchresponse_CID;\n SearchResponse_type response = new SearchResponse_type();\n pdu.o = response;\n \n int ssub = search_request.smallSetUpperBound.intValue();\n int lslb = search_request.largeSetLowerBound.intValue();\n int mspn = search_request.mediumSetPresentNumber.intValue();\n \n LOGGER.finer(\"ssub = \" + ssub + \" lslb = \" + lslb + \" mspn = \" + mspn);\n \n response.referenceId = search_request.referenceId; \n \n // Assume failure unless something below sets to true\n response.searchStatus = Boolean.FALSE;\n \n RootNode rn = null;\n \n try\n {\n switch(search_request.query.which)\n {\n case Query_type.type_0_CID:\n LOGGER.finer(\"Processing Any Query\");\n // Any\n break;\n case Query_type.type_1_CID:\n case Query_type.type_101_CID:\n // RPN query\n LOGGER.finer(\"Processing RPN Query\");\n rn = com.k_int.z3950.util.RPN2Internal.zRPNStructure2RootNode\n \t ((RPNQuery_type)(search_request.query.o));\n break;\n case Query_type.type_2_CID:\n case Query_type.type_100_CID:\n case Query_type.type_102_CID:\n LOGGER.finer(\"Processing OctetString Query\");\n // Octet String\n break;\n }\n \n if ( rn != null )\n {\n LOGGER.finer(\"Got root node\");\n \n IRQuery q = new IRQuery();\n q.collections = search_request.databaseNames;\n q.query = new com.k_int.IR.QueryModels.RPNTree(rn);\n \n // Process the query\n LOGGER.finer(\"Create Search Task with query:\" + q);\n SearchTask st = search_service.createTask\n \t (q, search_request.referenceId);\n \t\n \n // Evaluate the query, waiting 10 seconds for the task to complete. \n \t//We really want to be\n // able to pass in a predicate to wait for here, \n \t//e.g. evaluate(10000, \"NumHits > 100 OR Status=Complete\");\n LOGGER.finer(\"Evaluate Search Task\");\n try\n {\n st.evaluate(10000);\n }\n catch ( TimeoutExceededException tee )\n {\n LOGGER.finer(\"Timeout exceeded waiting for search to complete\");\n }\n \n if ( search_request.resultSetName != null ) {\n \t LOGGER.finer(\"putting st with name \" + \n \t\t\t search_request.resultSetName);\n \t active_searches.put(search_request.resultSetName, st);\n \t}\n \tactive_searches.put(\"Default\", st);\n \t\n // Result records processing\n int result_count = st.getTaskResultSet().getFragmentCount();\n LOGGER.finer(\"result count is \"+result_count);\n \n // Number of hits\n response.resultCount = BigInteger.valueOf(result_count);\n \n // Figure out Search Status\n if ( ( st.getTaskStatusCode() != SearchTask.TASK_FAILURE ) )\n {\n response.searchStatus = Boolean.TRUE;\n }\n else\n {\n // Figure out Result Set Status\n switch ( st.getTaskStatusCode() )\n {\n case SearchTask.TASK_EXECUTING_ASYNC:\n case SearchTask.TASK_EXECUTING_SYNC:\n // resultSetStatus = 2 (interim) Partial results available, \n \t\t//not necessarily valid\n response.resultSetStatus = BigInteger.valueOf(2);\n break;\n case SearchTask.TASK_FAILURE:\n // resultSetStatus = 3 (none) No result set\n response.resultSetStatus = BigInteger.valueOf(3);\n break;\n }\n }\n \n LOGGER.finer(\"Is \"+result_count+\" <= \"+lslb +\" or <= \"+ssub);\n \n if ( ( result_count <= lslb ) || ( result_count <= ssub ) )\n {\n LOGGER.finer(\"Yep\");\n \n int start = 1;\n int count = ( result_count <= ssub ? result_count : mspn );\n \n if ( count > 0 )\n \t {\n \t\t LOGGER.finer(\"Asking for \"+count+\n \t\t\t \" response records from \"+start);\n \t\t LOGGER.finer(\"Search request default = \" \n \t\t\t + search_request.preferredRecordSyntax);\n \t\t response.records = createRecordsFor\n \t\t (st, search_request.preferredRecordSyntax, start, \n \t\t count, GeoProfile.BREIF_SET);\n \t\t \n \n \t\t if (response.records.which == \n \t\t Records_type.responserecords_CID ){\n \t\t LOGGER.finer(\"We have records\");\n \t\t \n \t\t // Looks like we managed to present some records OK..\n \t\t response.numberOfRecordsReturned = \n \t\t\t BigInteger.valueOf(((Vector)\n \t\t\t\t\t (response.records.o)).size());\n \t\t response.nextResultSetPosition = \n \t\t\t BigInteger.valueOf(count+1);\n \t\t response.presentStatus = BigInteger.valueOf(0);\n \t\t } else { // Non surrogate diagnostics ( Single or Multiple )\n \t\t \n \t\t LOGGER.finer(\"Diagnostics\");\n \t\t response.presentStatus = BigInteger.valueOf(5);\n \t\t response.numberOfRecordsReturned = \n \t\t\t BigInteger.valueOf(0);\n \t\t response.nextResultSetPosition = \n \t\t\t BigInteger.valueOf(1);\n \t\t }\n \t } else {\n \t\t LOGGER.finer(\"No need to piggyback records....\");\n \t\t response.numberOfRecordsReturned = BigInteger.valueOf(0);\n \t\t response.nextResultSetPosition = BigInteger.valueOf(1);\n \t\t response.presentStatus = BigInteger.valueOf(0);\n \t }\n } else {\n \t response.presentStatus = BigInteger.valueOf(5);\n \t response.numberOfRecordsReturned = BigInteger.valueOf(0);\n \t response.nextResultSetPosition = BigInteger.valueOf(1); \t\n \t}\n }\n else\n \t LOGGER.finer(\"Unable to process query into root node\");\n }\n catch ( com.k_int.IR.InvalidQueryException iqe )\n \t{\n \t // Need to send a diagnostic\n \t iqe.printStackTrace();\n \t response.resultCount = BigInteger.valueOf(0);\n \t response.presentStatus = BigInteger.valueOf(5); // Failure\n \t response.numberOfRecordsReturned = BigInteger.valueOf(0);\n \t response.nextResultSetPosition = BigInteger.valueOf(0);\n \t response.resultSetStatus = BigInteger.valueOf(3);\n \t // No result set available\n \t response.records = createNSD(null, iqe.toString());\n \t}\n catch ( SearchException se )\n \t{\n \t // We need to populate a diagnostic here\n \t LOGGER.finer(\"Search returning diagnostic. Reason:\"+se.toString());\n \t se.printStackTrace();\n \t response.resultCount = BigInteger.valueOf(0);\n \t response.presentStatus = BigInteger.valueOf(5); // Failure\n \t response.numberOfRecordsReturned = BigInteger.valueOf(0);\n \t response.nextResultSetPosition = BigInteger.valueOf(0);\n \t response.resultSetStatus = BigInteger.valueOf(3); \n \t // No result set available\n \t response.records = createNSD((String)(se.additional), \n \t\t\t\t\t se.toString());\n \t}\n \n LOGGER.finer(\"Send search response : \");\n try\n \t{\n \t assoc.encodeAndSend(pdu);\n \t}\n catch ( java.io.IOException ioe )\n \t{\n \t ioe.printStackTrace();\n \t} \n }", "public void start()\n {\n FileVector = FileHandler.getFileList( harvesterDirName , filterArray, false );\n iter = FileVector.iterator();\n }", "private void run()\n {\n searchLexDb(\"^providing_\", true);\n }", "public void run(){\n\t\tif(searchHow==0){\n\t\t\tint isbnCount = 0;\n\t\t\tfor(int i=0; i<db.size(); i++){\n\t\t\t\t\tSearchRequest requestIsbn = new SearchRequest(db, searchForThis, isbnCount, db.size());\n\t\t\t\t\tdb.searchByISBN(requestIsbn);\n\t\t\t\t\tisbnCount = requestIsbn.foundPos;\n\t\t\t\t\tif (requestIsbn.foundPos >= 0) {\n\t\t\t\t\t\tisbnCount++;\n\t\t\t\t\t\tString formatThis = \"Matched ISBN at position: \" + requestIsbn.foundPos;\n\t\t\t\t\t\tSystem.out.printf(\"%-35s || Title: \"+db.getBook(requestIsbn.foundPos)+\"\\n\",formatThis);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\ti=db.size();\n\t\t\t}\n\t\t}\n\t\tif(searchHow==1){\n\t\t\tint titleCount = 0;\n\t\t\tfor(int i=0; i<db.size(); i++){\n\t\t\t\t\tSearchRequest requestTitle = new SearchRequest(db, searchForThis, titleCount, db.size());\n\t\t\t\t\tdb.searchByTitle(requestTitle);\n\t\t\t\t\ttitleCount = requestTitle.foundPos;\n\t\t\t\t\tif (requestTitle.foundPos >= 0) {\n\t\t\t\t\t\ttitleCount++;\n\t\t\t\t\t\tString formatThis = \"Matched title at position: \" + requestTitle.foundPos;\n\t\t\t\t\t\tSystem.out.printf(\"%-35s || Title: \"+db.getBook(requestTitle.foundPos)+\"\\n\",formatThis);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\ti=db.size();\n\t\t\t}\n\t\t}\n\t\tif(searchHow==2){\n\t\t\tint authorCount = 0;\n\t\t\tfor(int i=0; i<db.size(); i++){\n\t\t\t\t\tSearchRequest requestAuthor = new SearchRequest(db, searchForThis, authorCount, db.size());\n\t\t\t\t\tdb.searchByAuthor(requestAuthor);\n\t\t\t\t\tauthorCount = requestAuthor.foundPos;\n\t\t\t\t\tif (requestAuthor.foundPos >= 0) {\n\t\t\t\t\t\tauthorCount++;\n\t\t\t\t\t\tString formatThis = \"Matched author at position: \" + requestAuthor.foundPos;\n\t\t\t\t\t\tSystem.out.printf(\"%-35s || Title: \"+db.getBook(requestAuthor.foundPos)+\"\\n\",formatThis);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\ti=db.size();\n\t\t\t}\n\t\t}\n\t\tif(searchHow==3){\n\t\t\tint pageCount = 0;\n\t\t\tfor(int i=0; i<db.size(); i++){\n\t\t\t\t\tSearchRequest requestPage = new SearchRequest(db, searchForThis, pageCount, db.size());\n\t\t\t\t\tdb.searchByNumPages(requestPage);\n\t\t\t\t\tpageCount = requestPage.foundPos;\n\t\t\t\t\tif (requestPage.foundPos >= 0) {\n\t\t\t\t\t\tpageCount++;\n\t\t\t\t\t\tString formatThis = \"Matched pages at position: \" + requestPage.foundPos;\n\t\t\t\t\t\tSystem.out.printf(\"%-35s || Title: \"+db.getBook(requestPage.foundPos)+\"\\n\",formatThis);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\ti=db.size();\n\t\t\t}\n\t\t}\n\t\tif(searchHow==4){\n\t\t\tint yearCount = 0;\n\t\t\tfor(int i=0; i<db.size(); i++){\n\t\t\t\t\tSearchRequest requestYear = new SearchRequest(db, searchForThis, yearCount, db.size());\n\t\t\t\t\tdb.searchByYear(requestYear);\n\t\t\t\t\tyearCount = requestYear.foundPos;\n\t\t\t\t\tif (requestYear.foundPos >= 0) {\n\t\t\t\t\t\tyearCount++;\n\t\t\t\t\t\tString formatThis = \"Matched year at position: \" + requestYear.foundPos;\n\t\t\t\t\t\tSystem.out.printf(\"%-35s || Title: \"+db.getBook(requestYear.foundPos)+\"\\n\",formatThis);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\ti=db.size();\n\t\t\t}\n\t\t}\n\t}", "void searchProbed (Search search);", "protected void reportPointsInSearch( ) {\n\t\tfor( SearchProgressCallback progress : progressListeners )\n\t\t\tprogress.pointsInSearch(this, open_from_start.size() + (bidirectional ? open_from_goal.size() : 0), closed_from_start.size() + (bidirectional ? closed_from_goal.size() : 0));\n\t}", "int getStartSearch();", "public void performSearch() {\n OASelect<QueryInfo> sel = getQueryInfoSearch().getSelect();\n sel.setSearchHub(getSearchFromHub());\n sel.setFinder(getFinder());\n getHub().select(sel);\n }", "@Override\n\tprotected void startSearchResultActivity(String[] search_ifs) {\n\t\tItemSearchResultActivity.startThisActivity(this, getString(R.string.detail_search), search_ifs);\n\t}", "void searchFinished (Search search);", "private void search(){\n solo.waitForView(R.id.search_action_button);\n solo.clickOnView(solo.getView(R.id.search_action_button));\n\n //Click on search bar\n SearchView searchBar = (SearchView) solo.getView(R.id.search_experiment_query);\n solo.clickOnView(searchBar);\n solo.sleep(500);\n\n //Type in a word from the description\n solo.clearEditText(0);\n solo.typeText(0, searchTerm);\n }", "public search()\n\t { b = new char[INC];\n\t i = 0;\n\t i_end = 0;\n\t }", "public void performSearch() throws IOException {\n configuration();\n\n File fileDir = new File(queryFilePath);\n if (fileDir.isDirectory()) {\n File[] files = fileDir.listFiles();\n Arrays.stream(files).forEach(file -> performSearchUsingFileContents(file));\n }\n }", "@Override public void searchStarted() {\n progressBar.setVisibility(View.VISIBLE);\n }", "public void searchNextPage() {\n if (!isPerformingQuery\n && isViewingRecipes\n && !isQueryExhausted().getValue()) {\n recipeRepository.searchNextPage();\n }\n }", "public void firstSearch() {\n\n\t\tif ((workspaceSearchField.getText() == null) || \"\".equals(workspaceSearchField.getText())) {\n\t\t\tworkspaceSearchField.setText(mainGUI.getSearchFieldText());\n\t\t\tsearchInWorkspaceFor(workspaceSearchField.getText());\n\t\t}\n\t}", "public void star() {\n log.info(\"start: Start frame search\");\n frameSearch.getTpDataBase().getBtSave();\n frameSearch.getPnSearch().getBtSearch().addActionListener(a -> getAtribut());\n frameSearch.getTpDataBase().getBtSave().addActionListener(a -> getAtributOne());\n }", "abstract public boolean performSearch();", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tdoSearch(name, count);\n\t\t\t}", "private void find(boolean forward) {\n \tif (this.currentFindResultPage != null) {\n \t\t/* searching again */\n \t\tint nextResultNum = forward ? this.currentFindResultNumber + 1 : this.currentFindResultNumber - 1;\n \t\tif (nextResultNum >= 0 && nextResultNum < this.pagesView.getFindResults().size()) {\n \t\t\t/* no need to really find - just focus on given result and exit */\n \t\t\tthis.currentFindResultNumber = nextResultNum;\n \t\t\tthis.pagesView.scrollToFindResult(nextResultNum);\n \t\t\tthis.pagesView.invalidate();\n \t\t\treturn;\n \t\t}\n \t}\n\n \t/* finder handles next/prev and initial search by itself */\n \tFinder finder = new Finder(this, forward);\n \tThread finderThread = new Thread(finder);\n \tfinderThread.start();\n }", "public void Start() {\n OCCwrapJavaJNI.Interface_EntityIterator_Start(swigCPtr, this);\n }", "public void performSearch() {\n final String url = String.format(BING_SEARCH_URL, Words.getRandomWord(), Words.getRandomWord());\n\n //open page with custom data\n openWebPage(url, \"Search url: \" + url);\n }", "public static void start(){\n mngr.getStpWds();\n mngr.getDocuments();\n mngr.calculateWeights();\n mngr.getInvertedIndex();\n mngr.getClusters();\n mngr.getCategories();\n mngr.getUserProfiles();\n mngr.makeDocTermMatrix();\n\n }", "private void executeSearch() {\n if (!view.getSearchContent().getText().isEmpty()) {\n SearchModuleDataHolder filter = SearchModuleDataHolder.getSearchModuleDataHolder();\n //set search content text for full text search\n filter.setSearchText(view.getSearchContent().getText());\n forwardToCurrentView(filter);\n } else {\n eventBus.showPopupNoSearchCriteria();\n }\n }", "private void searchCode() {\n }", "@Override\n\t\tpublic void search() {\n\t\t\tSystem.out.println(\"새로운 조회\");\n\t\t}", "public void performSearch() {\n History.newItem(MyWebApp.SEARCH_RESULTS);\n getMessagePanel().clear();\n if (keywordsTextBox.getValue().isEmpty()) {\n getMessagePanel().displayMessage(\"Search term is required.\");\n return;\n }\n mywebapp.getResultsPanel().resetSearchParameters();\n //keyword search does not restrict to spots\n mywebapp.addCurrentLocation();\n if (markFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setLicensePlate(markFilterCheckbox.getValue());\n }\n if (contestFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setContests(contestFilterCheckbox.getValue());\n }\n if (geoFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setGeospatialOff(!geoFilterCheckbox.getValue());\n }\n if (plateFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setLicensePlate(plateFilterCheckbox.getValue());\n }\n if (spotFilterCheckbox != null) {\n mywebapp.getResultsPanel().getSearchParameters().setSpots(spotFilterCheckbox.getValue());\n }\n String color = getValue(colorsListBox);\n mywebapp.getResultsPanel().getSearchParameters().setColor(color);\n String manufacturer = getValue(manufacturersListBox);\n if (manufacturer != null) {\n Long id = new Long(manufacturer);\n mywebapp.getResultsPanel().getSearchParameters().setManufacturerId(id);\n }\n String vehicleType = getValue(vehicleTypeListBox);\n mywebapp.getResultsPanel().getSearchParameters().setVehicleType(vehicleType);\n// for (TagHolder tagHolder : tagHolders) {\n// mywebapp.getResultsPanel().getSearchParameters().getTags().add(tagHolder);\n// }\n mywebapp.getResultsPanel().getSearchParameters().setKeywords(keywordsTextBox.getValue());\n mywebapp.getMessagePanel().clear();\n mywebapp.getResultsPanel().performSearch();\n mywebapp.getTopMenuPanel().setTitleBar(\"Search\");\n //mywebapp.getResultsPanel().setImageResources(resources.search(), resources.searchMobile());\n }", "public void Case15(){\n System.out.println(\"Testing Case 14\");\n for(int z=1; z<=7; z++) {\n docuSequence();\n if(z==1) {\n //Insert search here\n //Click Magnifying Glass Icon\n MobileElement searchBtn = (MobileElement) driver.findElementByXPath(\"//android.widget.ImageButton[contains(@resource-id,'search_button')]\");\n searchBtn.click();\n System.out.println(\"Document Sequence done\");\n }\n else if(z==2){\n byShortName();\n }\n else if(z==3){\n byItemCode();\n }\n else if(z==4){\n byDescription();\n }\n else if(z==5){\n byBrand();\n }\n else if(z==6){\n byKeyword();\n }\n else if(z==7){\n byPrincipal();\n }\n clear();\n }\n System.out.println(\"Case 14 Done\");\n }", "public void actionPerformed(ActionEvent InputEvent)\r\n {\r\n performSearch();\r\n }", "public static void searchBtnPressed() throws IOException {\r\n // define a search model to search PCs\r\n PC search_model = new PC();\r\n if (nameFilter != null && !nameFilter.isEmpty())\r\n search_model.setName(nameFilter);\r\n if (descriptionFilter != null && !descriptionFilter.isEmpty())\r\n search_model.setDescription(descriptionFilter);\r\n if (instalationDateFilter != null)\r\n search_model.setInstallDate(instalationDateFilter);\r\n switch (statusFilter) {\r\n case 1:\r\n search_model.setStatus(Status.ENABLE);\r\n break;\r\n case 2:\r\n search_model.setStatus(Status.DISABLE);\r\n break;\r\n case 3:\r\n search_model.setStatus(Status.SUSPENDED);\r\n break;\r\n }\r\n if (selectedComponentsFilter != null)\r\n for (int i = 0 ; i < selectedComponentsFilter.length ; i ++)\r\n if (selectedComponentsFilter[i]) {\r\n Calendar cal = Calendar.getInstance();\r\n cal.add(Calendar.DAY_OF_MONTH, 1);\r\n search_model.setInstalledComps(new PCComp(enaComp.get(i).getID(), cal.getTime()));\r\n }\r\n \r\n // define search model options\r\n String search_options = installationDateModeFilter + \",\" + warrentyModeFilter;\r\n if (selectedSpecsFilter != null)\r\n for (int i = 0 ; i < selectedSpecsFilter.length ; i ++)\r\n if (selectedSpecsFilter[i])\r\n search_options = search_options + \",\" + enaSpec.get(i).toString();\r\n PCNMClientModel.sendMessageToServer(new Message(MessageType.PC_SEARCH, search_model, search_options));\r\n }", "protected void doWork() throws Exception {\n\t\tSet<PluginInfo> plis = PluginManager.getInstance()\n\t\t\t\t.getPluginsFor(Defaults.MC_METAINFORMATION_PROVIDER);\n\n\t\tsetProgress(0, \"Searching ...\");\n\t\t\n\t\tint step = 10000 / plis.size();\t\t\n\t\t\n\t\tfor (PluginInfo pli : plis) {\n\n\t\t\t// check if task has being canceled\n\t\t\tif(getTaskState() == TaskStateEvent.TASK_CANCELLING) {\n\t\t\t\tdoCancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t// instantiate it\n\t\t\tAbstractPlugin abstractPlugin = pli.getInstance();\n\n\t\t\t// check if this is a real AnnotationProvider\n\t\t\tif (abstractPlugin instanceof AbstractAnnotationProvider) {\n\t\t\t\tAbstractAnnotationProvider abstractProvider = (AbstractAnnotationProvider) abstractPlugin;\n\t\n\t\t\t\tsetProgress(getProgress(), abstractProvider.getName());\n\t\t\t\t\n\t\t\t\t// try to initialize it\n\t\t\t\tif (!abstractProvider.getStatus())\n\t\t\t\t\tabstractProvider.initProvider();\n\n\t\t\t\t\n\t\t\t\t// if it worked, add it to the working AnnotationProviders\n\t\t\t\t// and add IdSettings\n\t\t\t\tif (abstractProvider.getStatus())\n\t\t\t\t\tannotationManager.addProvider(abstractProvider);\n\t\t\t\telse\n\t\t\t\t\t// write a short error log\n\t\t\t\t\twriteLog(abstractProvider.getName()\n\t\t\t\t\t\t\t+ \" initialization failed!\\n\");\n\t\t\t\n\t\t\t\t\tif(abstractProvider.getErrorLog().size() > 0) {\n\t\t\t\t\t\tfor(String errorMessage : abstractProvider.getErrorLog()) {\n\t\t\t\t\t\twriteLog(abstractProvider.getName()\n\t\t\t\t\t\t\t\t+ \" -> \" + errorMessage + \"!\\n\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\tsetProgress(getProgress() + step, abstractProvider.getName());\n\t\t\t}\n\t\t}\n\t\tsetProgress(10000);\n\t}", "private void search()\n {\n JTextField searchField = (currentSearchView.equals(SEARCH_PANE_VIEW))? searchBar : resultsSearchBar;\n String searchTerm = searchField.getText();\n \n showTransition(2000);\n \n currentPage = 1;\n showResultsView(true);\n paginate(1, getResultsPerPage());\n\n if(searchWeb) showResultsTableView(WEB_RESULTS_PANE);\n else showResultsTableView(IMAGE_RESULTS_PANE);\n\n \n showSearchView(RESULTS_PANE_VIEW);\n resultsSearchBar.setText(searchTerm);\n }", "void analysisStarting();", "private void readyToSearch() {\n Intent intent = new Intent(this, SearchActivity.class);\n startActivityForResult(intent, 21);\n }", "public void start(boolean resume) {\n if (resume) {\n resData = dbm.getResumeIndv();\n if(resData==null)\n {\n iFirstIntro=false;\n resume = false;\n }\n else\n {\n //load the necessary search resume data\n IndividualDesign in0 = resData.get(0);\n this.chosenBMPs = in0.chosenBMPs;\n this.chosenFF = in0.chosenFF;\n idm.chosenFF = this.chosenFF;\n idm.chosenBMPs = this.chosenBMPs;\n ResumeSearchInfo = in0.searcInfo;\n sdmm = new SDMManager(idm, statm, chosenFF, localSubbasinLoc, useLocalPreference, chosenBMPs, useANFIS);\n idm.setSearchId(ResumeSearchInfo.getSearchid());\n this.global_sessionId = ResumeSearchInfo.getGlobalSessionid();\n this.local_sessionId = ResumeSearchInfo.getLocalSessionid();\n this.session_type = ResumeSearchInfo.getSessionType();\n this.hdmGenerationId = ResumeSearchInfo.getSessionid();\n idm.introspectionNo = local_sessionId + 1;//Human Search Based Introspection is +1.\n if (session_type == 1) //SDM search\n {\n sdmGenerationId = hdmGenerationId;\n agent1 = false;//use HDM\n agent2 = true;\n }\n }\n }\n \n dbm.doLocalCleanUp(UserId); //pre search cleanup for current user\n \n nsga2Handle = new SWAT_BMPs_NSGA2Handler(UserId,regionSubbasinId, MUTATION_PROBABILITY, CROSSOVER_PROBABILITY, HDMPopulation, chosenBMPs, chosenFF, tenure_regionSubbasinId);\n nsga2Handle.initNSGA2();\n idm.nsga2Handle = nsga2Handle;\n idm.nsga2 = nsga2Handle.getNSGA2Instace();\n\n bmpId = getBMPID(chosenBMPs);\n\n //the very first introspection\n if (!resume && iFirstIntro) {\n LinkedList<IndividualDesign> resData = dbm.getInitCBMIndv(bmpId, tenure_type, chosenFF);\n im.doIntrospection(\"iFistIntrospection\", resData, global_sessionId, chosenFF);\n local_sessionId = 0;\n }\n\n VTimer time1 = new VTimer();\n time1.startTimer();\n\n while (global_sessionId < NoOfglobalSessions) {\n //Anget I\n if (agent1) {\n VTimer time2 = new VTimer();\n time2.startTimer();\n\n //Inject the start population from the CBM\n int newIndvNeeded = ((int) (HDMPopulation * (100 - percentCBM) / 400)) * 4; //100\n int CBMIndvNeeded = HDMPopulation - newIndvNeeded;\n nsga2Handle = new SWAT_BMPs_NSGA2Handler(UserId,regionSubbasinId, MUTATION_PROBABILITY, CROSSOVER_PROBABILITY, HDMPopulation, chosenBMPs, chosenFF, tenure_regionSubbasinId);\n nsga2Handle.initNSGA2();\n idm.nsga2Handle = nsga2Handle;\n idm.nsga2 = nsga2Handle.getNSGA2Instace();\n idm.global_sessionId = global_sessionId;\n idm.session_type_search = session_type;\n idm.local_sessionId = local_sessionId;\n\n try {\n evaluator = new PopulationEvaluation(idm, true, sdmm);//true to take human feedback also\n idm.nsga2.setPopulationEvaluator(evaluator); //set a new Population Evaluator Instance\n\n if (!resume) { //start a new search\n session_type = 0;//HDM interactive session\n\n LinkedList<IndividualDesign> restartData = dbm.getCBMIndv(UserId, 0, global_sessionId, chosenFF);\n \n hdmGenerationId = 0;\n nsga2Handle.createUsingCBM(chosenFF, UserId, restartData, CBMIndvNeeded, newIndvNeeded);\n idm.IndvPopulation = nsga2Handle.startPopulation;\n\n idm.sessionId = hdmGenerationId;\n idm.IndvPopulation = idm.nsga2.EvaluateGeneration(idm.IndvPopulation);\n idm.saveArchive();\n statm.doEvaluationConfidence(idm.IndvPopulation);\n this.statm.UserStatKendal(global_sessionId, local_sessionId,hdmGenerationId);\n \n }\n else //resume the old search\n {\n //Generation between 0 and < noOfGenerations\n if (session_type == 0 && this.hdmGenerationId >= 0 && this.hdmGenerationId <= noHDMGenerations) {\n idm.TotalIndvs = nsga2Handle.generateIndividual(resData, chosenFF, chosenBMPs, this.UserId);\n //select the Indv for the last generations\n int strtId = idm.getStartIndvId() + this.local_sessionId * ((noHDMGenerations + 1) * this.HDMPopulation) + this.hdmGenerationId * this.HDMPopulation; //Indv startId of the last generation\n LinkedList<Individual> indvlst = new LinkedList(); //Indv for current generations\n for (int i = 0; i < idm.TotalIndvs.size(); i++) {\n Individual in = idm.TotalIndvs.get(i);\n if (in.IndvId >= strtId) {\n indvlst.add(in);\n }\n }\n int newStrtId = indvlst.getLast().IndvId + 1;//for next set if Indvs\n idm.setStartIndvId(newStrtId);\n idm.sessionId = hdmGenerationId;\n idm.introspectionNo = local_sessionId + 1;//Human Search Based Introspection is +1.\n if (indvlst.size() != HDMPopulation) {\n System.out.println(\"Error in Resuming Search for User \" + this.UserId);\n }\n idm.IndvPopulation = indvlst;\n idm.HDMPopulation_child = indvlst;\n \n //load Kendal Stats\n int kendalVal = statm.loadKendalStats(this.kendall, this.global_sessionId, this.local_sessionId, this.hdmGenerationId);\n if (kendalVal == (hdmGenerationId + 2)) //if sufficient no of introspection sessions already done.\n {\n noIntrospection = true;\n }\n //load previously saved SDMs \n try{ \n sdmm.loadPrevSDMs();\n }catch(Exception ex)\n {\n ex.printStackTrace();\n } \n }\n //make resume false for next local session\n resume = false;\n System.out.println(\"Search Resuming for User \"+this.UserId +\" with Ids (G:L:S) \"+global_sessionId +\":\" + local_sessionId + \":\"+idm.sessionId+\" Introspection No \"+idm.introspectionNo);\n } \n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n //Run the GA Loop\n while (hdmGenerationId < noHDMGenerations)\n {\n hdmGenerationId++;//count no of generations, increment in beginning, because 0 is already used for First Parents\n if (hdmGenerationId == noHDMGenerations) //last feedback session\n {\n idm.nowait = 1; //stop the interface from waiting, not implemented yet\n }\n //Optimization\n idm.sessionId = hdmGenerationId;\n om.optimize(type_optimize); //only one generation \n statm.doEvaluationConfidence(idm.IndvPopulation);\n this.statm.UserStatKendal(global_sessionId, local_sessionId,hdmGenerationId);\n idm.saveArchive();\n noIntrospection = false; //second introspection has to be done\n }\n //do the second introspection\n if (!noIntrospection) {\n //save the last Pareto front of the nondominated population\n idm.addLastPareto(idm.IndvPopulation);\n idm.saveBestIndv(); //save the best indv from the last pareto \n im.doIntrospection(\"iSecondIntrospection\", null, global_sessionId, chosenFF);\n statm.doEvaluationConfidence(idm.iFinalIndvs);\n this.statm.UserStatKendal(global_sessionId, local_sessionId, hdmGenerationId + 1);\n decideTraining();//just one time, modify it to give more training in future\n //decide the next initiative\n }\n \n nextInitiative(); //check the next initiative\n \n idm.reInitIndv();//reset the design handler for next session\n time2.endTimer();\n System.out.println(\"\\n HDM Took time \" + time2.getTimeHHMMSS());\n local_sessionId++;//increment for the next HDM session\n\n } \n \n else if (agent2) //Run the Automated Search\n {\n System.out.println(\"\\n SDM Took over the User \" + UserId);\n\n if(resume)//use to relearn the data when resuming\n {\n relernNN();\n }\n if(!resume)\n idm.informAutomatedSearch(); //inform the user to leave as the automated search is started\n\n session_type = 1;//SDM Non-interactive session\n idm.global_sessionId = global_sessionId;\n idm.session_type_search = session_type;\n idm.local_sessionId = local_sessionId;\n\n if(!resume)\n sdmGenerationId = 0;\n idm.sessionId = sdmGenerationId;\n VTimer time2 = new VTimer();\n time2.startTimer();\n int POPULATION_SIZE = SDMPopulation;\n int newIndvNeeded = ((int) (SDMPopulation * (100 - percentCBM) / 400)) * 4; //100\n int CBMIndvNeeded = SDMPopulation - newIndvNeeded;\n\n nsga2Handle = new SWAT_BMPs_NSGA2Handler(UserId,regionSubbasinId, MUTATION_PROBABILITY, CROSSOVER_PROBABILITY, POPULATION_SIZE, chosenBMPs, chosenFF, tenure_regionSubbasinId);\n nsga2Handle.initNSGA2();\n idm.nsga2Handle = nsga2Handle;\n idm.nsga2 = nsga2Handle.getNSGA2Instace();\n\n try {\n\n if(!resume)\n {\n LinkedList<IndividualDesign> restartData = dbm.getCBMIndv(UserId, 0, global_sessionId, chosenFF); //use all the CBM\n nsga2Handle.createUsingCBM(chosenFF, UserId, restartData, CBMIndvNeeded, newIndvNeeded);\n idm.nsga2 = nsga2Handle.getNSGA2Instace();\n evaluator = new PopulationEvaluation(idm, false, sdmm);//SDM gives feedback\n idm.nsga2.setPopulationEvaluator(evaluator);\n idm.IndvPopulation = nsga2Handle.startPopulation;\n idm.IndvPopulation = idm.nsga2.EvaluateGeneration(idm.IndvPopulation);\n idm.saveArchive();\n }\n else //resming the search\n {\n evaluator = new PopulationEvaluation(idm, false, sdmm);//SDM gives feedback\n idm.nsga2.setPopulationEvaluator(evaluator);\n \n //Generation between 0 and < noOfGenerations\n if (session_type == 1 && this.sdmGenerationId >= 0 && this.sdmGenerationId <= noSDMGenerations) {\n idm.TotalIndvs = nsga2Handle.generateIndividual(resData, chosenFF, chosenBMPs, this.UserId);\n //select the Indv for the last generations\n //int strtId = idm.getStartIndvId() + this.local_sessionId * ((noHDMGenerations + 1) * this.HDMPopulation) + this.hdmGenerationId * this.HDMPopulation; //Indv startId of the last generation\n int strtId = idm.TotalIndvs.getLast().IndvId - SDMPopulation;\n \n LinkedList<Individual> indvlst = new LinkedList(); //Indv for current generations\n for (int i = 0; i < idm.TotalIndvs.size(); i++) {\n Individual in = idm.TotalIndvs.get(i);\n if (in.IndvId > strtId) {\n indvlst.add(in);\n }\n }\n int newStrtId = indvlst.getLast().IndvId + 1;//for next set if Indvs\n idm.setStartIndvId(newStrtId);\n idm.sessionId = sdmGenerationId;\n idm.introspectionNo = 4;//local_sessionId + 1;//always be 4, the last\n if (indvlst.size() != SDMPopulation) {\n System.out.println(\"Error in Resuming Search for User \" + this.UserId);\n }\n idm.IndvPopulation = indvlst;\n idm.HDMPopulation_child = indvlst;\n //clear TotalIndvs\n idm.TotalIndvs = new LinkedList(); //make it free\n //load previously saved SDMs \n try\n {\n sdmm.loadPrevSDMs();//one less model for current model\n }catch(Exception ex)\n {\n ex.printStackTrace();\n }\n }\n //make resume false for next HS session\n resume = false;\n System.out.println(\"Search Resuming for User \"+this.UserId +\" with Ids (G:L:S) \"+global_sessionId +\":\" + local_sessionId + \":\"+idm.sessionId+\" Introspection No \"+idm.introspectionNo);\n }\n \n } catch (IOException ex) {\n ex.printStackTrace();\n }\n //Loop the GA search\n for (int i = sdmGenerationId; i < noSDMGenerations; i++) {\n //Optimization\n sdmGenerationId++;\n idm.sessionId = sdmGenerationId;\n om.optimize(type_optimize);\n idm.saveArchive(); \n } \n agent1 = true;//use HDM\n agent2 = false;\n global_sessionId++;//later global session\n //inform the visualization about last introspection\n idm.stop = 1;\n idm.session_type_search=0;\n im.doIntrospection(\"SDMfinalIntrospection\", null, global_sessionId, chosenFF);\n local_sessionId = 0;//reset the local_sessionId for new global session of Agent1\n }\n }\n //idm.informSearchFinished();\n dbm.doLocalCleanUp(UserId); //for next search\n //System.out.println(\"Finished search for User \"+UserId);\n if(dumpData)\n {\n idm.dumpData();\n }\n }", "@Override\n public void onSearchConfirmed(CharSequence text) {\n startSearch(text);\n\n }", "@Override\n\tprotected void executeSearch(String term) {\n\t\t\n\t}", "@Override\n public void start() {\n // get the SpotifyInteractor for connect to the internet\n mSpotifyInteractor = mSearchChildView.getSpotifyInteractor();\n // start search bar anim in view and setup searchbar\n setupSearchBar();\n // setup recyclerview and setup adapter\n setupList();\n }", "@ActionTrigger(action=\"KEY-ENTQRY\", function=KeyFunction.SEARCH)\n\t\tpublic void spriden_Search()\n\t\t{\n\t\t\t\n\t\t\t\texecuteAction(\"QUERY\");\n\t\t\t\tgetTask().getGoqrpls().gCheckFailure();\n\t\t\t}", "void startIndexing();", "private void showSearch() {\n\t\tonSearchRequested();\n\t}", "@Override\n public void onSearchConfirmed(CharSequence text) {\n startSearch(text);\n }", "@Test(enabled = true, timeOut = 100000, groups = {\"search\", \"home\"})\n public void searchPackage() throws IOException {\n logger.debug(\"Page is initialised.\");\n logger.trace(\"Searching City Name.\");\n// assertThat(driver.getCurrentUrl(), containsString(\"cleartrip\"));\n// home.search(typeofSearch, fromPlace, toPlace, date, numberOfAdults);\n }", "@Override\n public void onSearchConfirmed(CharSequence text) {\n startSearch(text);\n\n }", "@Override\n public void onSearchConfirmed(CharSequence text) {\n startSearch(text);\n\n }", "@Override\n\tpublic boolean startSearch() {\n\t\tString str = \"\";\n\t\t\n\t\tDimension d = view.getInit();\n\t\tif (d == null) {\n\t\t\tstr = str + \"Falta la posicion de inicio.\\n\";\n\t\t} else {\n\t\t\ty0 = (int) d.getHeight();\n\t\t\tx0 = (int) d.getWidth();\n\t\t}\n\t\t\n\t\td = view.getGoal();\n\t\tif (d == null) {\n\t\t\tstr = str + \"Falta la posicion de meta.\\n\";\n\t\t} else {\n\t\t\tyf = (int) d.getHeight();\n\t\t\txf = (int) d.getWidth();\n\t\t}\n\t\t\n\t\tif (view.isBreadth()) {\n\t\t\tstrategy = new Breadth();\n\t\t} else if (view.isDepth()) {\n\t\t\tstrategy = new Depth();\n\t\t} else if (view.isAStar()) {\n\t\t\tstrategy = new AStar();\n\t\t\tif (view.isH0()) {\n\t\t\t\theuristic = Horse.H0;\n\t\t\t} else if (view.isH1()) {\n\t\t\t\theuristic = Horse.H1;\n\t\t\t} else if (view.isH2()) {\n\t\t\t\theuristic = Horse.H2;\n\t\t\t} else\n\t\t\t\tstr = str + \"Falta por escoger el tipo de heur’stica.\\n\";\n\t\t} else\n\t\t\tstr = str + \"Falta la estrategia de bœsqueda.\\n\";\n\t\t\n\t\tboard = view.getBoard();\n\t\t\n\t\tif (str.equals(\"\")) {\n\t\t\trootNode = new Node(new Horse(x0,y0,xf,yf, board, heuristic));\n\t\t}\n\t\t\n\t\tif (view.isTree()) {\n\t\t\tif (str.equals(\"\"))\n\t\t\t\tsearch = new Tree(rootNode, strategy);\n\t\t} else if (view.isGraph()) {\n\t\t\tif (str.equals(\"\"))\n\t\t\t\tsearch = new Graph(rootNode, strategy);\n\t\t} else \n\t\t\tstr = str + \"Falta el algoritmo de bœsqueda.\\n\";\n\t\t\n\t\tif (!str.equals(\"\")) {\n\t\t\tview.showError(str);\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tgoSearch();\n\t\treturn true;\n\t}", "public void searchInkAndTonnerItem(String itemnum){\t\r\n\t\tString searchitem = getValue(itemnum);\r\n\t\tclass Local {};\r\n\t\tReporter.log(\"TestStepComponent\"+Local.class.getEnclosingMethod().getName());\r\n\t\tReporter.log(\"TestStepInput:-\"+searchitem);\r\n\t\tReporter.log(\"TestStepOutput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepExpectedResult:- Item should be searched in the Ink and Tonner search box\");\r\n\t\ttry{\r\n\t\t\t//editSubmit(locator_split(\"txtSearch\"));\r\n\t\t\twaitforElementVisible(locator_split(\"txtInkSearch\"));\r\n\t\t\tclearWebEdit(locator_split(\"txtInkSearch\"));\r\n\t\t\tsendKeys(locator_split(\"txtInkSearch\"), searchitem);\r\n\t\t\tThread.sleep(2000);\r\n\t\t\tReporter.log(\"PASS_MESSAGE:- Item is searched in the Ink and Tonner search box\");\r\n\t\t\tSystem.out.println(\"Ink and Tonner Search item - \"+searchitem+\" is entered\");\r\n\r\n\t\t}\r\n\t\tcatch(Exception e){\r\n\t\t\tReporter.log(\"FAIL_MESSAGE:- Item is not entered in the search box \"+elementProperties.getProperty(\"txtSearch\"));\r\n\t\t\tthrow new NoSuchElementException(\"The element with \"\r\n\t\t\t\t\t+ elementProperties.getProperty(\"txtInkSearch\").toString().replace(\"By.\", \" \")\r\n\t\t\t\t\t+ \" not found\");\r\n\r\n\t\t}\r\n\t}", "@Override\n public void passSearchRequest(SearchReq searchReq) {\n\n// if (searchRequest.getCredential().getIp() == node.getCredential().getIp() && searchRequest.getCredential().getPort() == node.getCredential().getPort()) {\n if (searchReq.getCred().equals(node.getCred())) {\n return; // search query loop has eliminated\n }\n List<String> searchResult = checkFilesInFileList(searchReq.getFileName(), node.getFileList());\n logMe(\"Received SEARCH for \\\"\" + searchReq.getFileName() + \"\\\" from \" + searchReq.getCred().getNodeIp() + \":\" + searchReq.getCred().getNodePort() + \" at \" + getCurrentTime());\n if (!searchResult.isEmpty()) {\n SearchRes searchRes = new SearchRes(searchReq.getSeqNumber(), searchResult.size(), searchReq.getCred(), searchReq.getHopCount(), searchResult);\n searchOk(searchRes);\n } else {\n //logMe(\"File is not available at \" + node.getCredential().getIp() + \" : \" + node.getCredential().getPort() + \"\\n\");\n if (searchReq.getHopCount() <= TTL) {\n searchReq.setHopCount(searchReq.incHops());\n List<NetworkDetails> StatTableSearchResult = checkFilesInStatTable(searchReq.getFileName(), node.getNetworkDetailsTable());\n // Send search request to stat table members\n for (NetworkDetails networkDetails : StatTableSearchResult) {\n if (networkDetails.getQuery().equals(searchReq.getFileName())) {\n Cred cred = networkDetails.getServedNode();\n node.incForwardedQueryCount();\n search(searchReq, cred);\n }\n }\n //TODO: Wait and see for stat members rather flooding whole routing table\n // Send search request to routing table members\n for (Cred cred : node.getRoutingTable()) {\n node.incForwardedQueryCount();\n if (search(searchReq, cred)) {\n break;\n }\n }\n } else {\n// logMe(\"Search request from\" + searchRequest.getCredential().getIp() + \":\" + searchRequest.getCredential().getPort() + \"is blocked by hop TTL\\n\");\n }\n }\n// Thread.currentThread().interrupt();\n }", "private void performSearch() {\n String text = txtSearch.getText();\n String haystack = field.getText();\n \n // Is this case sensitive?\n if (!chkMatchCase.isSelected()) {\n text = text.toLowerCase();\n haystack = haystack.toLowerCase();\n }\n \n // Check if it is a new string that the user is searching for.\n if (!text.equals(needle)) {\n needle = text;\n curr_index = 0;\n }\n \n // Grab the list of places where we found it.\n populateFoundList(haystack);\n \n // Nothing was found.\n if (found.isEmpty()) {\n Debug.println(\"FINDING\", \"No occurrences of \" + needle + \" found.\");\n JOptionPane.showMessageDialog(null, \"No occurrences of \" + needle + \" found.\",\n \"Nothing found\", JOptionPane.INFORMATION_MESSAGE);\n \n return;\n }\n \n // Loop back the indexes if we have reached the end.\n if (curr_index == found.size()) {\n curr_index = 0;\n }\n \n // Go through the findings one at a time.\n int indexes[] = found.get(curr_index);\n field.select(indexes[0], indexes[1]);\n curr_index++;\n }", "private void performNewQuery(){\n\n // update the label of the Activity\n setLabelForActivity();\n // reset the page number that is being used in queries\n pageNumberBeingQueried = 1;\n // clear the ArrayList of Movie objects\n cachedMovieData.clear();\n // notify our MovieAdapter about this\n movieAdapter.notifyDataSetChanged();\n // reset endless scroll listener when performing a new search\n recyclerViewScrollListener.resetState();\n\n /*\n * Loader call - case 3 of 3\n * We call loader methods as we have just performed reset of the data set\n * */\n // initiate a new query\n manageLoaders();\n\n }", "public void enterSearchMode(String initialQueryTerm) {\n initSearchViews();\n if (isInSearchMode()) {\n return;\n }\n if (!TextUtils.isEmpty(initialQueryTerm)) {\n mSearchView.setQuery(initialQueryTerm, false);\n } else {\n mSearchView.setQuery(\"\", false);\n }\n mSearchView.setQueryHint(mCallback.getSearchHint());\n\n mSearchMode = MODE_SEARCH;\n\n // Focus on the search input box and throw up the IME if specified.\n // TODO: HACK. this is a workaround IME not popping up.\n mSearchView.setIconified(false);\n\n refresh();\n mCallback.onSearchStarted();\n }", "public void runTestSearch() throws TorqueException {\r\n\t}", "public static void search(){\n\t\tfor (Page p:heap){\n\t\t\tfor(Building b:p.buildings){\n\t\t\t\t\n\t\t\t\t//System.out.println(b.buildingName);\n\t\t\t\tif(b.getBuildingName()!=null) {\n\t\t\t\t\tif(b.getBuildingName().contains(searchQuery)){\n\t\t\t\t\t\tSystem.out.println(\"======================================================\");\n\t\t\t\t\t\tSystem.out.println(\"Building Name: \" + b.getBuildingName());\n\t\t\t\t\t\tSystem.out.println(\"Property ID: \" + b.getPropID());\n\t\t\t\t\t\tSystem.out.println(\"Census year: \" + b.getCensusYear());\n\t\t\t\t\t\tSystem.out.println(\"======================================================\");\n\t\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t\tbuildingsFound++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpagesSearched++;\n\t\t}\n\t}", "public void searchTest() {\n\t\ttry {\n\t\t\tString keyword = \"操作道具\";\n\t\t\t// 使用IKQueryParser查询分析器构造Query对象\n\t\t\tQuery query = IKQueryParser.parse(LogsEntry.INDEX_FILED_CONTENT, keyword);\n\n\t\t\t// 搜索相似度最高的5条记录\n\t\t\tint querySize = 5;\n\t\t\tTopDocs topDocs = isearcher.search(query, null, querySize, sort);\n\t\t\tlogger.info(\"命中:{}\", topDocs.totalHits);\n\t\t\t// 输出结果\n\t\t\tScoreDoc[] scoreDocs = topDocs.scoreDocs;\n\t\t\tfor (int i = 0; i < scoreDocs.length; i++) {\n\t\t\t\tDocument targetDoc = isearcher.doc(scoreDocs[i].doc);\n\t\t\t\tlogger.info(\"内容:{}\", targetDoc.toString());\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tlogger.error(e.getMessage(), e);\n\t\t}\n\t}", "@Override\n protected void onPreExecute() {\n callbackListener.onScanStart(\"Running a deep scan... this will take awhile...\");\n super.onPreExecute();\n }", "void setNilSearchWindowStart();", "private void findNext() {\n \tthis.find(true);\n }", "private void performSearch() {\n try {\n final String searchVal = mSearchField.getText().toString().trim();\n\n if (searchVal.trim().equals(\"\")) {\n showNoStocksFoundDialog();\n }\n else {\n showProgressDialog();\n sendSearchResultIntent(searchVal);\n }\n }\n catch (final Exception e) {\n showSearchErrorDialog();\n logError(e);\n }\n }", "@Override\n public void updateItemSearchIndex() {\n try {\n // all item IDs that don't have a search index yet\n int[] allMissingIds = mDatabaseAccess.itemsDAO().selectMissingSearchIndexIds();\n // Selects the item to the id, extract all parts of the item name to create the\n // search index (all ItemSearchEntity's) and insert them into the database\n for (int missingId : allMissingIds) {\n try {\n ItemEntity item = mDatabaseAccess.itemsDAO().selectItem(missingId);\n List<ItemSearchEntity> searchEntities = createItemSearchIndex(item);\n mDatabaseAccess.itemsDAO().insertItemSearchParts(searchEntities);\n } catch (Exception ex) {\n Log.e(TAG, \"An error occurred trying to create the search index to the id\" +\n missingId, ex);\n }\n }\n } catch (Exception ex) {\n Log.e(TAG, \"A general failure has occurred while trying to load and process all \" +\n \"item IDs to generate a search index\", ex);\n }\n }", "private void startFilterCriteria() {\n\n\t\tLog.i(TAG, \"startFilterCriteria()\");\n\n\t\tFindUtilsImpl utils = new FindUtilsImpl();\n\t\tSet<String> tSet = utils.getTypeSet((ArrayList<BELEvent>) eventsListFind);\n\t\tArrayList<String> tList = new ArrayList<String>(cleanSet(tSet));\n\n\t\tString str = \"start FilterCriteria.class\";\n\t\tLog.i(TAG, \"Search Activity: \" +str);\n\n\t\t\tIntent intent = new Intent(context, FilterCriteria.class);\n\t\t\tintent.putStringArrayListExtra(\"TypesKey\", tList);\n\t\t\t//TODO capture activity not found exception\n\t\t\t//\t((Activity) context).startActivityForResult(intent,Constants.FIND_REQ);\n\t\t\tstartActivityForResult(intent,Constants.FIND_REQ);\n\n\t\t\tstr = \"startActivity(intent,Constants.FIND_REQ)\";\n\t\t\t//\tstr = \"startActivityForResult(intent,Constants.FIND_REQ)\";\n\t\t\tLog.e(\"Search Dlg: \", str);\n\t\t}", "public void run() {\n\t\tString result;\n\t\tthis.running = true;\n\t\tdouble position[] = new double[3];\n\t\tdouble measures[] = new double[360];\n\n\t\twhile (running) {\n\t\t\ttry {\n\t\t\t\tPipedInputStream pipeIn = new PipedInputStream();\n\t\t\t\tBufferedReader input = new BufferedReader(new InputStreamReader(pipeIn));\n\t\t\t\tPrintWriter output = new PrintWriter(new PipedOutputStream(pipeIn), true);\n\t\t\t\trobot.setOutput(output);\n\n\t\t\t\t//ases where a variable value is never used after its assignment, i.e.:\n\t\t\t\tSystem.out.println(\"intelligence running\");\n\n\t\t\t\trobot.sendCommand(\"R1.GETPOS\");\n\t\t\t\tresult = input.readLine();\n\t\t\t\tparsePosition(result, position);\n\t\t\t\trecords.clear();\n\t\t\t\trobot.sendCommand(\"L1.SCAN\");\n\t\t\t\tresult = input.readLine();\n\t\t\t\tif (result.substring(0, 4).equalsIgnoreCase(\"SCAN\")) {\n\t\t\t\t\tparseMeasures(result, measures);\n\t\t\t\t}\n\t\t\t\trobot.sendCommand(\"S1.SCAN\");\n\t\t\t\tresult = input.readLine();\n\t\t\t\tif (result.substring(0, 4).equalsIgnoreCase(\"SCAN\")) {\n\t\t\t\t\tparseMeasures(result, measures);\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tif (result.substring(0, 4).equalsIgnoreCase(\"SCAN\")) {\n\t\t\t\t\t\t//addCommandToRobot(result,measures);\n\t\t\t\t\t\t//parseMeasures(result, measures);\n\t\t\t\t\t\tif (!addCommand()) //If it doesn't add any command go forward\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trobot.sendCommand(\"P1.MOVEFW 15\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tSystem.err.println(\"E! :(\");\n\t\t\t\t\tSystem.err.println(e.getMessage());\n\t\t\t\t}\n\t\t\t\tmap.drawLaserScan(position, measures);\n\n\t\t\t\tpipeIn.close();\n\t\t\t\tinput.close();\n\t\t\t\toutput.close();\n\n\t\t\t} catch (IOException ioe) {\n\t\t\t\tSystem.err.println(\"IOE! :(\");\n\t\t\t\tSystem.err.println(\"execution stopped\");\n\t\t\t\trunning = false;\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic void onLoadMore() {\n\t\tpage++;\n\t\texecutorService.submit(new Runnable() {\n\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\ttry {\n\t\t\t\t\tgetResultByKeyword(page);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "@Override\n\tpublic void startIBK() {\n\t\talgo.algoIBK();\n\t}", "@Override\n public void onSearchConfirmed(CharSequence text) {\n startSearchResults(text);\n }", "public void testSearchResultsListener() {\n prepareScenarioWithTestFile(\"jasmine1/jasmineTestCaretTop.js\");\n jasmineFile = new JasmineFile(getProject(), virtualFile);\n final boolean[] buildDone = new boolean[1];\n\n // And given that you register for changes.\n jasmineFile.addResultsReadyListener(new ChangeListener() {\n @Override\n public void stateChanged(ChangeEvent changeEvent) {\n buildDone[0] = true;\n }\n });\n\n // When you process the files.\n jasmineFile.buildTreeNodeAsync();\n\n // Then ensure the change event was broadcasted.\n assertTrue(buildDone[0]);\n assertEquals(\"top describe\", jasmineFile.getTreeNode().getNodeValue().getTestText());\n }", "public void startDocument() throws SAXException {\r\n\t\terrorMessages = new StringBuilder();\r\n\r\n\t\t// Get all the data sources in our Database\r\n\t\tEFGDataSourceHelperInterface dsHelper =\r\n\t\t\tEFGSpringFactory.getDatasourceHelper();\r\n\t\t\r\n\t\tEFGDisplayObjectList lists = dsHelper.getDataSourceNames();\r\n\t\tIterator iter = lists.getIterator();\r\n\r\n\t\tdataSources = new ArrayList();\r\n\r\n\t\twhile (iter.hasNext()) {\r\n\t\t\tEFGDisplayObject datasource = (EFGDisplayObject) iter.next();\r\n\t\t\tString str = datasource.getDatasourceName();\r\n\t\t\tdataSources.add(str);\r\n\t\t}\r\n\r\n\t\trequestedDataSources = new LinkedList();\r\n\r\n\t\tstack = new Stack();\r\n\t\tstack2 = new Stack();\r\n\r\n\t\tinStack = new Stack();\r\n\t\t/*\r\n\t\t * holds the contents of the list of elements in the IN operator e.g\r\n\t\t * <IN> <list...> <genus>Mechanitis</genus> <genus>Greta</genus>\r\n\t\t * ...... </list> </IN>\r\n\t\t */\r\n\r\n\t\t// used to get the start and limit attributes of a record element\r\n\t\tstart = \"0\";\r\n\t\tlimit = \"0\";\r\n\r\n\t\t_countType = -1; // signifies that we are processing a count element.\r\n\t\t_sourceType = 0; // signifies that we are processing a source\r\n\t\t\t\t\t\t\t// element.\r\n\t\t_destinationType = 0; // signifies that we are processing a\r\n\t\t\t\t\t\t\t\t// destination element\r\n\t\t_filterType = 0; // signifies that we are processing a filter element\r\n\t\t_inventoryType = 0; // signifies that we are processing an inventory\r\n\t\t\t\t\t\t\t// element\r\n\r\n\t\t_type = -1; // signifies that we are processing a DiGIR search type\r\n\t\tERROR_CODE = 0; // set to -1 if Error occurs\r\n\t\tsearchFlag = false; // We are processing a search element\r\n\t\theaderFlag = true; // we are processing a header\r\n\t\tinOp = false; // true if we see an IN operator\r\n\t\tinList = new EFGQueryList(); // Will hold a list of searchable type\r\n\t\t\t\t\t\t\t\t\t\t// when an IN operator is seen\r\n\t}", "private void execute() {\n Print.pr(\"Running ANNIE...\");\n try {\n annieController.execute();\n } catch (ExecutionException ex) {\n Out.prln(ex);\n }\n Print.prln(\"...ANNIE execution completed\");\n\n\n \n }", "public void performSearch()\r\n {\r\n setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) );\r\n\r\n try\r\n {\r\n // Create the search pattern.\r\n String SearchPatternString = SearchPatternField.getText();\r\n if ( SearchPatternString == null\r\n || SearchPatternString.equals(\"\") )\r\n throw new ScreenInputException(\"No search pattern entered\",\r\n SearchPatternField);\r\n SearchPattern = new Regex(SearchPatternString);\r\n SearchPattern.optimize();\r\n\r\n // Build the definition of the root directory to search.\r\n String FilePatternString = FilePatternField.getText();\r\n if ( FilePatternString == null\r\n || FilePatternString.equals(\"\") )\r\n throw new ScreenInputException(\"No file pattern entered\",\r\n FilePatternField);\r\n\r\n String DirPathString = DirPatternField.getText();\r\n if ( DirPathString == null\r\n || DirPathString.equals(\"\") )\r\n throw new ScreenInputException(\"No directory specified\",\r\n DirPatternField);\r\n File DirectoryFile = new File(DirPathString);\r\n if (!DirectoryFile.exists() )\r\n throw new ScreenInputException(\"Directory '\" + DirPathString + \"'does not exist\",\r\n DirPatternField);\r\n\r\n // Prepare the walker that performs the grep on each directory.\r\n GrepSubDirWalker.prepareSearch(SearchPattern,\r\n FilePatternString,\r\n DirPathString,\r\n ResultsDocument);\r\n\r\n if (SubDirsTooCheckBox.isSelected() )\r\n {\r\n // Process named directory and its sub-directories.\r\n Directory RootDirectory = new Directory(DirPathString);\r\n RootDirectory.walk(GrepSubDirWalker);\r\n }\r\n else\r\n // Process just the named directory.\r\n GrepSubDirWalker.processDirectory(DirPathString);\r\n\r\n GrepSubDirWalker.appendStatistics(); // Show statistics\r\n }\r\n catch (NoClassDefFoundError InputException)\r\n {\r\n showPatMissingDialog();\r\n }\r\n catch (ScreenInputException InputException)\r\n {\r\n InputException.requestComponentFocus();\r\n showExceptionDialog(InputException);\r\n }\r\n catch (Exception InputException)\r\n {\r\n showExceptionDialog(InputException);\r\n }\r\n setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR) );\r\n }", "protected void inRun() {\r\n\t\tSystem.out.println(\"begin\");\r\n\t\tIterator<RoutePair> pairIterator = this.pairs.iterator();\r\n\t\tint count = 0;\r\n\t\twhile (pairIterator.hasNext()) {\r\n\t\t\tcount++;\r\n\t\t\tif (count >= this.pairs.size() / 100) {\r\n\t\t\t\tSystem.out.print(\".\");\r\n\t\t\t\tcount = 0;\r\n\t\t\t}\r\n\t\t\tRoutePair pair = pairIterator.next();\r\n\t\t\tRouteResult result = this.dcn.route(pair.getHome(), pair.getAway());\r\n\t\t\tif (result.isSuccessful()) {\r\n\t\t\t\tthis.flows.add(result.getFlow());\r\n\t\t\t\t// System.out.println(result.getFlow().toString());\r\n\t\t\t\tassert result.getFlow().isValid();\r\n\t\t\t\tthis.attachFlow(result);\r\n\t\t\t\tthis.successfulCount++;\r\n\t\t\t} else {\r\n\t\t\t\tthis.failedCount++;\r\n\t\t\t\tSystem.out.println(String.format(\"[inRun] failure count %1d\\n\",\r\n\t\t\t\t\t\tthis.failedCount));\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"finish\");\r\n\t}", "public void searchByAccount() {\n\t\t\n\t\tlog.log(Level.INFO, \"Please Enter the account number you want to search: \");\n\t\tint searchAccountNumber = scan.nextInt();\n\t\tbankop.search(searchAccountNumber);\n\n\t}" ]
[ "0.6326334", "0.63061506", "0.6230616", "0.6228422", "0.61832505", "0.61830366", "0.6172838", "0.6030307", "0.60160726", "0.60034674", "0.598179", "0.594412", "0.59435785", "0.5885258", "0.58598673", "0.58478606", "0.58380914", "0.5810887", "0.5797676", "0.5777879", "0.5771417", "0.5753029", "0.5672282", "0.5670061", "0.56531376", "0.5627526", "0.56233376", "0.56224453", "0.56224453", "0.56190205", "0.5604674", "0.55956197", "0.55803114", "0.55773103", "0.55758774", "0.55703354", "0.5570211", "0.55587924", "0.5538504", "0.55358833", "0.55174667", "0.55099833", "0.55037034", "0.55027854", "0.54895383", "0.5447558", "0.5446281", "0.5434489", "0.54327726", "0.5429628", "0.54251456", "0.5422618", "0.5417394", "0.5416596", "0.54073274", "0.5399381", "0.538463", "0.53700536", "0.5363931", "0.53628165", "0.53547543", "0.53485036", "0.5333136", "0.53174156", "0.5316373", "0.5299829", "0.5295879", "0.52895504", "0.52852446", "0.5283857", "0.5276469", "0.52744746", "0.52615315", "0.52565503", "0.52565503", "0.52557224", "0.52514243", "0.52488786", "0.52404934", "0.52367187", "0.5220433", "0.52174604", "0.5213136", "0.5213028", "0.52089864", "0.52040577", "0.52009904", "0.520093", "0.51919544", "0.51650727", "0.5161159", "0.51569116", "0.5155786", "0.5148312", "0.5124309", "0.51213163", "0.51203", "0.51134074", "0.5112184", "0.5110639" ]
0.5955484
11
returns total runtime and times for hitting set calculations
public List<String> getRuntime() { double totalhit = 0; double longesthit = 0; double averagehit = 0; for (Double i : recHitTimes) { totalhit += i; averagehit += i / recHitTimes.size(); if (i > longesthit) { longesthit = i; } } List<String> list = new ArrayList<>(); list.add(Double.toString(runtime)); list.add(Double.toString(totalhit)); list.add(Double.toString(longesthit)); list.add(Double.toString(averagehit)); return list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getStats() {\n String stats = \"Total running time: \" + runtime + \"\\\\\\\\\";\n int totalit = 0;\n int largestit = 0;\n int averageit = 0;\n for (Integer i : recGraphs) {\n totalit += i;\n averageit += i;\n if (i > largestit) {\n largestit = i;\n }\n }\n averageit /= recGraphs.size();\n double totalhit = 0;\n double longesthit = 0;\n double averagehit = 0;\n for (Double i : recHitTimes) {\n totalhit += i;\n averagehit += i / recHitTimes.size();\n if (i > longesthit) {\n longesthit = i;\n }\n }\n stats += \"Total iterations in step 3: \" + totalit + \"\\\\\\\\\";\n stats += \"Largest set of iterations in step 3: \" + largestit + \"\\\\\\\\\";\n stats += \"Average iterations set in step 3: \" + averageit + \"\\\\\\\\\";\n stats += \"Total hitting sets calculation time: \" + totalhit + \"\\\\\\\\\";\n stats += \"Average hitting set calculation time: \" + averagehit + \"\\\\\\\\\";\n stats += \"Longest hitting set calculation time: \" + longesthit + \"\\\\\\\\\";\n return stats;\n }", "protected int getTimesOptimized()\r\n {\r\n return timesOptimized;\r\n }", "public abstract void setTotalRunTime();", "public int getTotalRunTime() {\n return totalRunTime;\n }", "public static long getTotalHitTime() {\r\n return _time;\r\n }", "private int calcTotalTime() {\n\t\tint time = 0;\n\t\tfor (Taxi taxi : taxis) {\n\t\t\ttime += taxi.calcTotalTime();\n\t\t}\n\t\treturn time;\n\t}", "public static double doThroughPut() {\n double totalProgramRunTime = endProgramTime - startProgramTime;\n return (count / totalProgramRunTime) * 100000.0;\n\n }", "private int totalTime()\n\t{\n\t\t//i'm using this varaible enough that I should write a separate method for it\n\t\tint totalTime = 0;\n\t\tfor(int i = 0; i < saveData.size(); i++)//for each index of saveData\n\t\t{\n\t\t\t//get the start time\n\t\t\tString startTime = saveData.get(i).get(\"startTime\");\n\t\t\t//get the end time\n\t\t\tString endTime = saveData.get(i).get(\"endTime\");\n\t\t\t//****CONTINUE\n\t\t\t//total time in minutes\n\t\t}\n\t}", "Double getTotalSpent();", "private static void calculateTotalHitsRequired()\n {\n totalHitsRequired = 0;\n \n // add all the ship lengths together to get\n // the total number of hits required\n for (int length : SHIP_LENGTHS)\n {\n totalHitsRequired += length;\n }\n }", "public float averageTime() {\n\t\tfloat out = 0;\n\t\t\n\t\tIterator<SolveResult> iter = super.iterator();\n\t\t\n\t\twhile(iter.hasNext()) {\n\t\t\tout += iter.next().timeTaken;\n\t\t}\n\t\t\n\t\treturn out / super.size();\n\t}", "public void calculations(){\n\n int temp_size1 = fight_list.get(0).t1.members.size();\n int[] t1_counter = new int[temp_size1 + 1]; //counter for deaths: 0, 1, 2..., party size.\n float t1_avg = 0; //Average number of deaths.\n\n //We don't need to calculate for t2 right now, because t2 is just monsters.\n //temp_size = fight_list.get(0).t2.members.size();\n //int[] t2_counter = new int[temp_size + 1];\n\n for(FightResult fig : this.fight_list){\n int i = 0;\n while(i != fig.t1_deaths){\n i++;\n }\n t1_counter[i]++;\n t1_avg += fig.t1_deaths;\n }//end for\n\n System.out.println(t1_avg);\n System.out.println(Float.toString(t1_avg/fight_list.size()) + \" / \" + Integer.toString(temp_size1));\n\n String axis = \"# of deaths: \\t\";\n int axis_int = 0;\n String t1_results = \"Happened: \\t\";\n for(int i : t1_counter){\n axis += Integer.toString(axis_int++) + \"\\t\";\n t1_results += Integer.toString(i) + \"\\t\";\n }//end for\n System.out.println(axis);\n System.out.println(t1_results);\n\n float tpk_amount = t1_counter[temp_size1]; //by taking the size, we take the item at the end of the array. In this case, the number where everyone dies.\n tpk_amount = (tpk_amount/fight_list.size())*100;\n System.out.println(\"Probability of TPK: \" + Float.toString(tpk_amount) + \" %.\");\n\n System.out.println(\"\\n--------\\n\");\n }", "public double getTotalTime()\n\t{\n\t\tdouble elapsedTime = 0. ;\n\t\tEnumeration<SpItem> children = children() ;\n\t\tSpItem child = null ;\n\t\tboolean hasObsChild = false ;\n\n\t\twhile( children.hasMoreElements() )\n\t\t{\n\t\t\tchild = children.nextElement() ;\n\t\t\tif( child instanceof SpObs )\n\t\t\t{\n\t\t\t\thasObsChild = true ;\n\t\t\t\telapsedTime += (( SpObs )child).getElapsedTime() ;\n\t\t\t}\n\t\t\telse if( child instanceof SpMSB )\n\t\t\t{\n\t\t\t\telapsedTime += (( SpMSB )child).getTotalTime() ;\n\t\t\t}\n\t\t}\n\n\t\t// If there is an Obs child, we should add a slew time as well,\n\t\t// which is just the instrument slew time times the number of\n\t\t// targets. We don't do this if the child is an MSB since this\n\t\t// already adds a slew time\n\t\tdouble slewTime = 0. ;\n\t\tif( hasObsChild )\n\t\t{\n\t\t\tSpInstObsComp inst = SpTreeMan.findInstrument( this ) ;\n\t\t\tif( inst != null )\n\t\t\t\tslewTime = inst.getSlewTime() * size() ;\n\t\t}\n\n\t\t// Get the total number of repeats for each target\n\t\tint totRemaining = 0 ;\n\t\tfor( int i = 0 ; i < size() ; i++ )\n\t\t\ttotRemaining += getRemaining( i ) ;\n\n\t\telapsedTime *= totRemaining ;\n\t\telapsedTime += slewTime ;\n\n\t\treturn elapsedTime ;\n\t}", "double getThroughput();", "public long totalTime() {\n\t\tlong ret = 0;\n\t\tfor (Task l : plan) {\n\t\t\tret += l.getTaskLength();\n\t\t}\n\n\t\treturn ret;\n\t}", "public void addPerformance(Set<MyTriangle> someSet) {\n String fileName = someSet.getClass().toString();\n long[] arrayForEstimatedTime = new long[size];\n WriteToFile creationOfFile = new WriteToFile(\"./second task/set/add\" + fileName + \".txt\");\n creationOfFile.clearingOfFile();\n\n for (int i = 0; i < size; i++) {\n startTime = System.nanoTime();\n someSet.add(arrayOfTriangles[i]);\n estimatedTime = System.nanoTime() - startTime;\n arrayForEstimatedTime[i] = estimatedTime;\n creationOfFile.functionForWritingInFile(arrayForEstimatedTime[i]);\n }\n creationOfFile.functionToCloseFile();\n\n }", "public long calculateExecutionTime(int[][] solutiongrid){ \n long startTime = System.currentTimeMillis();\n //Run the program\n validateSudoku(solutiongrid); \n long endTime = System.currentTimeMillis();\n long totalTime = endTime - startTime; \n \n return totalTime;\n }", "public static void startTimeMeasure() {\n \tstartTime = System.nanoTime();\n }", "private void calcEfficiency() {\n \t\tdouble possiblePoints = 0;\n \t\tfor (int i = 0; i < fermentables.size(); i++) {\n \t\t\tFermentable m = ((Fermentable) fermentables.get(i));\n \t\t\tpossiblePoints += (m.getPppg() - 1) * m.getAmountAs(\"lb\")\n \t\t\t\t\t/ postBoilVol.getValueAs(\"gal\");\n \t\t}\n \t\tefficiency = (estOg - 1) / possiblePoints * 100;\n \t}", "public void AlgoTimeTrials() {\n\t\n\tSystem.out.println( \"\\nQuestion (7) AlgoTimeTrials\" );\n\tSystem.out.println( \"---------------------------\");\n\tint start = 100 , end = 1000000 , mult = 10;\n\tint NTrials = 5;\n\tdouble Range = 9.0;\n\tStopWatch watch = new StopWatch();\n\tdouble target = Math.PI;\n\tSystem.out.format( \"%10s %12s %12s %12s\\n\" , \"Size\" , \"AvgSort(us)\" , \"AvgBinary(us)\" , \"AvgLinear(us)\" );\n\tSystem.out.format( \"%10s %12s %12s %12s\\n\" , \"----\" , \"-----------\" , \"-------------\" , \"-------------\" );\n\tfor( int Size = start ; Size <= end ; Size *= mult ) {\n\t double [] sortTimes = new double[NTrials];\n\t double [] binarySearchTimes = new double[NTrials];\n\t double [] linearSearchTimes = new double[NTrials];\n\t for( int i = 0; i < NTrials ; i++ ) {\n\t\tdouble [] A = createRandomDoubleArray(Size,Range);\n\t\tA[A.length-1] = target;\n\t\tsortTimes[i] = getSortTime( A , watch );\n\t\tbinarySearchTimes[i] = getBinarySearchTime(A,target,watch);\n\t\tlinearSearchTimes[i] = getLinearSearchTime(A,target,watch);\n\t }\n\t double avgSort = getAverage( sortTimes );\n\t double avgBinary = getAverage( binarySearchTimes);\n\t double avgLinear = getAverage( linearSearchTimes);\n\t System.out.format( \"%10d %12.1f %12.1f %12.1f\\n\" , Size , avgSort , avgBinary , avgLinear );\n\t}\n }", "protected double getElapsedTime() {\n\t\treturn Utilities.getTime() - startTime;\n\t}", "private double getTverskyScore(Set<String> setOne, Set<String> setTwo) {\n\t\tdouble tverskyScore = 0.0;\n\t\tSet<String> intersectionOfSets = new HashSet<String>(setOne);\n\t\tintersectionOfSets.retainAll(setTwo);\t\t\n\t\t\n\t\tSet<String> differenceOfSets = new HashSet<String>(setOne);\n\t\tdifferenceOfSets.removeAll(setTwo);\n\t\ttverskyScore = (double) intersectionOfSets.size() / (intersectionOfSets.size() + differenceOfSets.size());\n\t\t\n\t\treturn tverskyScore;\n\t}", "public void performAnalysis (Launcher launcher) {\n //Iterates through each class and method the program was supplied with\n for (CtClass<?> classObject : Query.getElements(launcher.getFactory(), new TypeFilter<CtClass<?>>(CtClass.class))) {\n for (CtMethod<?> methodObject : Query.getElements(classObject, new TypeFilter<CtMethod<?>>(CtMethod.class))) {\n //Counts the number of various types of decision points that calculate cyclomatic complexity\n int ifCount = 0, conditionCount = 0, forCount = 0, whileCount = 0, caseCount = 0;\n ifCount = countIfs(methodObject);\n conditionCount = countConditions(methodObject);\n forCount = countFors(methodObject);\n whileCount = countWhiles(methodObject);\n caseCount = countCases(methodObject);\n localresults.put(\"IF\", ifCount);\n localresults.put(\"CONDITIONS\", conditionCount);\n localresults.put(\"FOR\", forCount);\n localresults.put(\"WHILE\", whileCount);\n localresults.put(\"CASE\", caseCount);\n //Totals the values per method and adds them to the hashmap\n int total = ifCount + conditionCount + forCount + whileCount + caseCount;\n total += 1;\n totalCMCValue += total;\n classCMCScores.put(classObject.getQualifiedName()+\".\"+methodObject.getSimpleName(), total);\n }\n }\n }", "public long calulateAverageTime()\r\n {\r\n long sum = 0;\r\n long avgTime = 0;\r\n\r\n //Get the sum of all the times \r\n for(long time : this.listOfTimes)\r\n {\r\n sum += time;\r\n }//end for \r\n\r\n //calculate the average time \r\n if(this.gamesCompleted>0)\r\n avgTime = sum / this.gamesCompleted;\r\n else\r\n avgTime = sum;\r\n\r\n return avgTime;\r\n }", "String measureAlgorithmTime(int x, int y, int z) throws Exception;", "int getMetricCostsCount();", "@Override\n public double explorationTime(){\n return timespent;\n }", "public static long getAverageHitTime() {\r\n if (_count == 0)\r\n return 0L;\r\n return _time / _count;\r\n }", "public abstract void calculateSufficientStatistics();", "public double getElapsedTime()\n\t{\n\t\tdouble elapsedTime = 0. ;\n\t\tEnumeration<SpItem> children = children() ;\n\t\tSpItem child = null ;\n\n\t\twhile( children.hasMoreElements() )\n\t\t{\n\t\t\tchild = children.nextElement() ;\n\t\t\tif( child instanceof SpObs && (( SpObs )child).isOptional() )\n\t\t\t\t\telapsedTime += ( ( SpObs )child ).getElapsedTime() ;\n\t\t\telse if( child instanceof SpMSB )\n\t\t\t\telapsedTime += (( SpMSB )child).getElapsedTime() ;\n\t\t}\n\n\t\tint totRemaining = 0 ;\n\t\tfor( int i = 0 ; i < size() ; i++ )\n\t\t\ttotRemaining += getRemaining( i ) ;\n\n\t\telapsedTime *= totRemaining ;\n\t\treturn elapsedTime ;\n\t}", "public int getTotalTime();", "double getTotalCost();", "public int totalTime() {\n int time = 0;\n for (List l : lists.getList()) time += l.obtainTotalTime();\n return time;\n }", "private static void calcSingleTms() {\n\t\tFloat avgLenInitial = 0f;\n\t\tFloat avgLenSc = 0f;\n\t\tInteger countSCsingle = 0;\n\t\t// get all the single TM proteins from the hash\n\t\t\n\t\t// for the initial set\n\t\tfor(int i =0;i<=singleTmProts.size()-1;i++){\n\t\t\tint id = singleTmProts.get(i);\n\t\t\tavgLenInitial = avgLenInitial + Sequences_length.get(id);\n\t\t}\n\t\tavgLenInitial = (avgLenInitial / singleTmProts.size());\n\t\t\n\t\tSystem.out.print(\"\\nNumber of Single TM proteins in initial Set \"+singleTmProts.size()+\"\\n\");\n\t\tSystem.out.print(\"\\nAvg Len of Single TM proteins in initial Set \"+avgLenInitial+\"\\n\");\n\t\t\n\t\t//for the SC\n\t\tgetSCset();\n\t\t// for all the proteins in SC_sequences\n\t\t\n\t\tfor(Integer key : SC_sequences.keySet()){\n\t\t\tif (singleTmProts.contains(key)){\n\t\t\t\t// is in SC and is single TM\n\t\t\t\tavgLenSc = avgLenSc + Sequences_length.get(key);\n\t\t\t\tcountSCsingle ++;\n\t\t\t}\n\t\t\tavgLenSc = (avgLenSc / countSCsingle); \n\t\t}\n\t\tSystem.out.print(\"\\nNumber of Single TM proteins in SC \"+countSCsingle+\"\\n\");\n\t\tSystem.out.print(\"\\nAvg Len of Single TM proteins in SC Set \"+avgLenSc+\"\\n\");\n\t\t\n\t\t\n\t\t\n\t}", "long getTotalDoExamTime();", "public static int performanceCountGet() { return 0; }", "public long getTimeTaken();", "private double getOEEPerformance(Batch batch) {\n return 1;\n }", "@DISPID(70)\r\n\t// = 0x46. The runtime will prefer the VTID if present\r\n\t@VTID(68)\r\n\tint averageCPUTime_Seconds();", "public static double doCPU_usage() {\n double totalProgramRunTime = endProgramTime - startProgramTime;\n return (processingTimeTotal / totalProgramRunTime) * 100;\n }", "double getTotal();", "@Override\n\tpublic int calculateEffort() {\n\t\treturn 0;\n\t}", "void forceStats(long operations, long hits);", "long getHits();", "private void totalWaitingTime(){\n int totalWaitingTime =0;\r\n for (Ride ride : rides) {\r\n totalWaitingTime += ride.getWaitingTime();\r\n }\r\n System.out.println(\"\\nTotal waiting time of the entire park is \" + totalWaitingTime / 60 + \" hours\");\r\n }", "public long getTotalTime() {\n/* 73 */ return this.totalTime;\n/* */ }", "public double getCosts();", "private void computePerformance(int ticks) {\n System.out.println(\"Avergae number of packets in queue: \" + (_cumulativePacketsInQueue / (double)ticks));\n \n // Average time spent in queue per packet\n System.out.println(\"Average sojurn time: \" + (_totalSojurnTime / (double)_numPacketsProcessed));\n\n // Percentage idle time\n System.out.println(\"Percentage idle time: \" + ((_totalIdleTime / (double)ticks) * 100) + \"%\");\n\n // Packet loss probability\n System.out.println(\"Packet loss proability: \" + ((_numPacketsDropped / (double)(_numPacketsDropped + _numPacketsProcessed)) * 100) + \"%\");\n }", "public double calcTuition(){\r\n return getNumCredits() * COST_PER_CREDIT_HOUR;\r\n }", "public void reportStats() {\n System.out.println(\"Number of requests: \" + (requestCount - warmUpRequests));\n System.out.println(\"Number of hits: \" + hitCount);\n System.out.println(\"hit ratio: \" + (double) hitCount / (requestCount - warmUpRequests));\n System.out.println(\"Average hit cost: \" + (double) hitCost / hitCount);\n }", "public long getElapsedTime(){\n long timePassed = endTime - startTime;\n return timePassed;\n }", "@Override\n public long getTotalHarvestingTime()\n {\n return 0;\n }", "private Set calculateTimeSet() {\n List choices = getDataChoices();\n if (choices.isEmpty()) {\n return null;\n }\n Set newSet = null;\n for (int i = 0; i < choices.size(); i++) {\n try {\n VerticalProfileInfo info = getVPInfo(i);\n GridDataInstance dataInstance = info.getDataInstance();\n Set set = GridUtil.getTimeSet(dataInstance.getGrid());\n //System.out.println(\"di.timeset[\"+i+\"] = \" + set);\n if (set != null) {\n if (newSet == null) {\n newSet = set;\n } else {\n newSet = newSet.merge1DSets(set);\n }\n }\n } catch (Exception e) {\n logger.error(\"Problem calculating TimeSet\", e);\n }\n }\n //System.out.println(\"merged time set = \" + newSet);\n return newSet;\n }", "double calculateCost() {\n double cost = 0;\n InspectionDTO[] DTOArray = this.currentInspectionChecklist.inspectionDTOArray;\n for (int i = 0; i <= DTOArray.length - 1; i++) {\n cost += DTOArray[i].getCost();\n }\n return cost;\n }", "private long getPTSUs() {\n long result = System.nanoTime() / 1000L;\n if (result < prevOutputPTSUs)\n result = (prevOutputPTSUs - result) + result;\n return result;\n }", "private SimulationReport calculateDataPerSimulation(SimulationReport simulationReport){\n Long numerator = 0L, denominator = 0L, catalogNumerator = 0L, reportNumerator = 0L;\n\n Map<String, Map<String, Long>> maps = simulationReport.getNodeMeanResponseTimes();\n Set<Map.Entry<String, Map<String, Long>>> responseTimeEntrySet = maps.entrySet();\n for(Map.Entry<String, Map<String, Long>> nodeEntry : responseTimeEntrySet){\n Map<String, Long> means = nodeEntry.getValue();\n SimulationConfig simConf = getSimConfig(simulationReport.getSimulationConfig(), nodeEntry.getKey());\n Set<Map.Entry<String, Long>> meanEntrySet = means.entrySet();\n for(Map.Entry<String, Long> meanEntry : meanEntrySet){\n String meanKey = meanEntry.getKey();\n Long meanValue = meanEntry.getValue();\n if (meanKey.equals(\"agent\")){\n numerator += (simConf.getNumberInstances() * simConf.getNumberRepetitions()) * meanValue;\n }\n else if (meanKey.equals(\"catalog\")){\n catalogNumerator += (simConf.getNumberInstances() * simConf.getNumberRepetitions()) * meanValue;\n }\n else if (meanKey.equals(\"report\")){\n reportNumerator += (simConf.getNumberInstances() * simConf.getNumberRepetitions()) * meanValue;\n }\n }\n denominator += (long) simConf.getNumberInstances() * simConf.getNumberRepetitions();\n }\n\n if (denominator > 0){\n simulationReport.setTotalMeanAgentRunTime((numerator / denominator));\n simulationReport.setTotalMeanCatalogResponseTime((catalogNumerator / denominator));\n simulationReport.setTotalReportResponseTime((reportNumerator / denominator));\n logger.println(\"[PuppetGatling] - The Agent total mean response time for \" + simulationReport.getName() + \": \" + simulationReport.getTotalMeanAgentRunTime());\n logger.println(\"[PuppetGatling] - The Catalog total mean response time for \" + simulationReport.getName() + \": \" + simulationReport.getTotalMeanCatalogResponseTime());\n logger.println(\"[PuppetGatling] - The Report total mean response time for \" + simulationReport.getName() + \": \" + simulationReport.getTotalReportResponseTime());\n }\n\n return simulationReport;\n }", "public void time(int value) \n{\n runtimes = value;\n}", "long getElapsedTime();", "Execution getAverageExecutions();", "public long timeAlg(){\n long startTime = System.nanoTime();\n \n this.doTheAlgorithm();\n \n long endTime = System.nanoTime();\n long elapsedTime = endTime - startTime;\n \n return elapsedTime;\n }", "public float getRunTime() {\r\n return runTime;\r\n }", "private long CurrentTime(){\n return (TotalRunTime + System.nanoTime() - StartTime)/1000000;\n }", "public double calculate()\n {\n return ((this.getProduction() * this.getNumberOfStillages() + this.getLastCount() - this.getPrevCount()) * this.getProfileLength());\n }", "private static void compute_performances(Server server) {\n System.out.println(\"E[N]: Average number of packets in the buffer/queue: \" + round((double) runningBufferSizeCount / totalTicks));\n System.out.println(\"E[T]: Average sojourn time: \" + round((double) server.getTotalPacketDelay() / totalPackets + (double) serviceTime)\n + \"/packet\");\n System.out.println(\"P(idle): The proportion of time the server is idle: \"\n + round((double) server.getIdleServerCount() / totalTicks * 100) + \"%\");\n if (maxBufferSize >= 0) {\n System.out.println(\"P(loss): The packet loss probability: \" + round((double) droppedPacketCount / totalPackets * 100) + \"%\");\n }\n }", "public int getTimeTaken() {\n return this.getTreeNode().getBuilding().getTotalTimeTaken();\n }", "public void measureRuntime() throws IOException {\n int[] ns = new int[]{10, 100, 1000};\n for (int i : ns) {\n System.out.println(String.format(\"%d times input read took %fms\", i, (float) measureReadInput(i)));\n }\n for (int i : ns) {\n System.out.println(String.format(\"%d times pca took %fms\", i, (float) measurePCA(i)));\n }\n for (int i : ns) { // all cubes\n System.out.println(String.format(\"%d skeleton generations all cubes took %fms\", i, (float) measureAlgorithmWithoutPCA(i, true, true)));\n }\n for (int i : ns) { // low res\n System.out.println(String.format(\"%d skeleton generations low res took %fms\", i, (float) measureAlgorithmWithoutPCA(i, false, true)));\n }\n for (int i : ns) { // high res\n System.out.println(String.format(\"%d skeleton generations high res took %fms\", i, (float) measureAlgorithmWithoutPCA(i, false, false)));\n }\n }", "public void calculateMetrics(){\n //precision\n precisionFinal = precision.stream().mapToDouble(f -> f).sum()/precision.size();\n System.out.print(\"Precision: \");\n System.out.println(precisionFinal);\n //recall\n recallFinal = recall.stream().mapToDouble(f -> f).sum()/recall.size();\n System.out.print(\"Recall: \");\n System.out.println(recallFinal);\n //fMeasures\n fMeausureFinal = fMeasures.stream().mapToDouble(f -> f).sum()/fMeasures.size();\n System.out.print(\"Fmeasure: \");\n System.out.println(fMeausureFinal);\n\n //MAP\n mapFinal = apRes.stream().mapToDouble(d->d).sum()/apRes.size();\n System.out.print(\"Mean Avarage Precision: \");\n System.out.println(mapFinal);\n \n mapLimitedFinal = apResRankedTopLimited.stream().mapToDouble(d->d).sum()/apResRankedTopLimited.size();\n System.out.print(\"Mean Precision at rank 10: \");\n System.out.println(mapLimitedFinal);\n \n //NDCG\n ndcgResultsFinal =0;\n ndcgResults.stream().forEach(l-> {\n //it is always true, only added to ensure that doesnt' break with another examples where some queries doens't have results.\n if(l.size()>0){\n ndcgResultsFinal= l.get(l.size()-1)+ndcgResultsFinal;\n }\n });\n ndcgResultsFinal=ndcgResultsFinal/ndcgResults.size();\n \n System.out.print(\"NDCG: \");\n System.out.println(ndcgResultsFinal);\n }", "public int getComplexity() { return 4 + getSettingValue(\"radius\") * 2 + getSettingValue(\"duration\") / 5; }", "private static int benchmarkedMethod() {\n return 3;\n }", "public Map<String,Long> getOnJobTotalTimes(String accessKey, Set<String> entityIds, long startTime, long endTime) throws org.apache.thrift.TException;", "public double getTotalTime()\n\t{\n\t\treturn this.timeBallHitsGround;\n\t}", "public long getBestSolutionTime();", "@DISPID(68)\r\n\t// = 0x44. The runtime will prefer the VTID if present\r\n\t@VTID(66)\r\n\tint averageCPUTime_Hours();", "public double timeAllPath(Packman p)\r\n\t{\r\n\t\tdouble sum = 0;\r\n\t\tfor(int i = 0 ; i < FruitList.size() ; i++)\r\n\t\t{\r\n\t\t\tsum+=time(p , FruitList.get(i).location);\r\n\t\t}\r\n\t\treturn sum;\r\n\t}", "int measure();", "public abstract int getPerTagAvgPoseSolveTime();", "@DISPID(22)\r\n\t// = 0x16. The runtime will prefer the VTID if present\r\n\t@VTID(24)\r\n\tjava.lang.String averageRunTime();", "public double measurePowerUsage(String packageNameString, HashMap<String, Long> appCpuTimeBefor, long r_time) {\n //targetAppTime: CPU Running time of app, totalTime: Total CPU Running time\n HashMap<String, Long> appCpuTimeAfter = new HashMap<String, Long>();\n appCpuTimeAfter = getAppCpuTime(packageNameString);\n\n double targetAppTimeAfter = appCpuTimeAfter.get(\"targetAppTime\");\n double targetAppTimeBefor = appCpuTimeBefor.get(\"targetAppTime\");\n Log.i(TAG, \"appCpuTimeAfter \" + targetAppTimeAfter);\n Log.i(TAG, \"appCpuTimeBefor \" + targetAppTimeBefor);\n\n double totalTimeAfter = appCpuTimeAfter.get(\"totalTime\");\n double totalTimeBefor = appCpuTimeBefor.get(\"totalTime\");\n Log.i(TAG, \"totalTimeAfter \" + totalTimeAfter);\n Log.i(TAG, \"totalTimeBefor \" + totalTimeBefor);\n\n double ratio = (targetAppTimeAfter - targetAppTimeBefor + r_time ) / (totalTimeAfter - totalTimeBefor + r_time);\n Log.i(TAG, \"ratio \" + ratio);\n double[] currentSteps = getCurrentSteps();\n\n Log.i(TAG, \"currentSteps.length \" + currentSteps.length);\n\n\n return ratio; //second to hour\n }", "public void calculate()\n {\n \tVector<Instructor> instructors = instructorDB.getAllInstructors();\n \tSchedule schedule = AdminGenerating.getSchedule();\n \tsections = schedule.getAllSections();\n \n for (Instructor instructor : instructors) {\n calculateIndividual(instructor);\n }\n \n calculateOverall();\n }", "public void computeStats() {\n\t\tstats = new Stats();\t\t\n\t}", "public void getCosts() {\n\t}", "private static void writeExecutionTime() {\n \t\n \tendMs = System.currentTimeMillis();\n \tlong elapsed = endMs - startMs;\n \tlong hours = elapsed / 3600000;\n long minutes = (elapsed % 3600000) / 60000;\n long seconds = ((elapsed % 3600000) % 60000) / 1000;\n \n try {\n \t\n \tFileSystem fs = FileSystem.get(Mediator.getConfiguration());\n \tPath outputPath = new Path(Mediator.getHDFSLocation()+\"/\"+Mediator.getLearnerOutputPath()+\"/time.txt\");\n \tOutputStream os = fs.create(outputPath);\n \tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));\n \t\n \t/**\n \t * Write total execution time\n \t */\n \tbw.write(\"Total execution time (hh:mm:ss): \"+String.format(\"%02d\",hours)+\":\"+String.format(\"%02d\",minutes)+\":\"+\n \t\t\tString.format(\"%02d\",seconds)+\" (\"+(elapsed/1000)+\" seconds)\\n\");\n \t\n \t/**\n \t * Write Mappers execution time avg.\n \t */\n \tPath inputPath = new Path(Mediator.getHDFSLocation()+\"/\"+Mediator.getLearnerOutputPath()+\"/\"+Mediator.TIME_STATS_DIR);\n \tFileStatus[] status = fs.listStatus(inputPath);\n \tBufferedReader br = null;\n \tString buffer;\n \tlong sumMappers = 0;\n \tint numMappers = 0;\n \tfor (FileStatus fileStatus:status){\n \t\t// Read Stage 1\n \t\tif (fileStatus.getPath().getName().contains(\"mapper\")){\n \t\t\tnumMappers ++;\n \t\t\tbr=new BufferedReader(new InputStreamReader(fs.open(fileStatus.getPath())));\n \t\t\tbuffer = br.readLine();\n \t\t\tsumMappers += Long.parseLong(buffer.substring(buffer.indexOf(\":\")+1).trim());\n \t\t}\n \t\tbr.close();\n \t}\n \t// Write AVG\n \telapsed = sumMappers / numMappers;\n \thours = elapsed / 3600;\n minutes = (elapsed % 3600) / 60;\n seconds = (elapsed % 3600) % 60;\n bw.write(\"Mappers avg. execution time (hh:mm:ss): \"+String.format(\"%02d\",hours)+\":\"+String.format(\"%02d\",minutes)+\":\"+\n \t\t\tString.format(\"%02d\",seconds)+\" (\"+elapsed+\" seconds)\\n\");\n \t\n \tbw.close();\n \tos.close();\n \t\n \t// Remove time stats directory\n \tfs.delete(inputPath,true);\n \t\n }\n catch(Exception e){\n \tSystem.err.println(\"\\nERROR WRITING EXECUTION TIME\");\n\t\t\te.printStackTrace();\n }\n \t\n }", "@DISPID(23)\r\n\t// = 0x17. The runtime will prefer the VTID if present\r\n\t@VTID(25)\r\n\tjava.lang.String averageCPUTime();", "public double measurePowerUsage(String packageNameString, HashMap<String, Long> appCpuTimeBefor, long r_time) {\n HashMap<String, Long> appCpuTimeAfter = new HashMap<String, Long>();\n appCpuTimeAfter = getAppCpuTime(packageNameString);\n\n double totalPower = 0;\n double targetAppTimeAfter = appCpuTimeAfter.get(\"targetAppTime\");\n double targetAppTimeBefor = appCpuTimeBefor.get(\"targetAppTime\");\n Log.i(\"TAG\", \"appCpuTimeAfter \" + targetAppTimeAfter);\n Log.i(\"TAG\", \"appCpuTimeBefor \" + targetAppTimeBefor);\n\n double totalTimeAfter = appCpuTimeAfter.get(\"totalTime\");\n double totalTimeBefor = appCpuTimeBefor.get(\"totalTime\");\n Log.i(\"TAG\", \"totalTimeAfter \" + totalTimeAfter);\n Log.i(\"TAG\", \"totalTimeBefor \" + totalTimeBefor);\n\n Log.i(\"AAAAAAAAA\", \"targetAppTimeAfter-targetAppTimeBefor\"+String.valueOf(targetAppTimeAfter-targetAppTimeBefor));\n Log.i(\"AAAAAAAAA\", \"totalTimeAfter-totalTimeBefor\"+String.valueOf(totalTimeAfter-totalTimeBefor));\n //double ratio = (targetAppTimeAfter - targetAppTimeBefor + r_time) / (totalTimeAfter - totalTimeBefor + r_time);\n //double ratio = (targetAppTimeAfter - targetAppTimeBefor ) / (totalTimeAfter - totalTimeBefor );\n //double ratio = (targetAppTimeAfter - targetAppTimeBefor + r_time/10) / (totalTimeAfter - totalTimeBefor + r_time/10);\n double ratio= (r_time/10)/(totalTimeAfter - totalTimeBefor);\n\n Log.i(\"TAG\", \"ratio\" + ratio);\n\n return ratio; //second to hour\n }", "@DISPID(69)\r\n\t// = 0x45. The runtime will prefer the VTID if present\r\n\t@VTID(67)\r\n\tint averageCPUTime_Minutes();", "private static void getStat(){\n\t\tfor(int key : Initial_sequences.keySet()){\n\t\t\tint tmNo = Initial_sequences.get(key);\n\t\t\tif (tmNo > 13){\n\t\t\t\ttmInitLarge ++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(tmInit.containsKey(tmNo)){\n\t\t\t\t\tint temp = tmInit.get(tmNo);\n\t\t\t\t\ttemp++;\n\t\t\t\t\ttmInit.put(tmNo, temp);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttmInit.put(tmNo, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Go through all the proteins in SC\n\t\tfor(int key : SC_sequences.keySet()){\n\t\t\tint tmNo = SC_sequences.get(key);\n\t\t\t\n\t\t\tint loop = Loop_lengths.get(key);\n\t\t\tint tmLen = TM_lengths.get(key);\n\t\t\t\n\t\t\tLoopTotalLen = LoopTotalLen + loop;\n\t\t\tTMTotalLen = TMTotalLen + tmLen;\n\t\t\t\n\t\t\t\n\t\t\tif (tmNo > 13){\n\t\t\t\ttmSCLarge ++;\n\t\t\t\tLoopLargeLen = LoopLargeLen + loop;\n\t\t\t\tTMLargeLen = TMLargeLen + tmLen;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(tmSC.containsKey(tmNo)){\n\t\t\t\t\tint temp = tmSC.get(tmNo);\n\t\t\t\t\ttemp++;\n\t\t\t\t\ttmSC.put(tmNo, temp);\n\t\t\t\t\t\n\t\t\t\t\tint looptemp = Loop_SC.get(tmNo);\n\t\t\t\t\tlooptemp = looptemp + loop;\n\t\t\t\t\tLoop_SC.put(tmNo, looptemp);\n\t\t\t\t\t\n\t\t\t\t\tint tmlenTemp = TM_len_SC.get(tmNo);\n\t\t\t\t\ttmlenTemp = tmlenTemp + tmLen;\n\t\t\t\t\tTM_len_SC.put(tmNo, tmlenTemp);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttmSC.put(tmNo, 1);\n\t\t\t\t\t\n\t\t\t\t\tLoop_SC.put(tmNo, 1);\n\t\t\t\t\tTM_len_SC.put(tmNo, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int getTotRuptures();", "public float calculate(Ticket t) {\n\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\tlong start=System.currentTimeMillis();\r\n\t\t\t\tHashSetAdd hsd=new HashSetAdd();\r\n\t\t\t\tHashSet<String> hs1=hsd.add();\r\n\t\t\t\tSystem.out.println(\"size1=:\"+hs1.size());\r\n\t\t\t\tfor(String result:hs1){\r\n\t\t\t\t\tresult.toString();\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tlong end=System.currentTimeMillis();\r\n\t\t\t\tSystem.out.println(\"time1=: \"+(end-start));\r\n\t\t\t}", "public void print_metrics(){\n\t\tHashMap<Integer, HashSet<Integer>> pairs=return_pairs();\n\t\tint total=gold.data.getTuples().size();\n\t\ttotal=total*(total-1)/2;\n\t\tSystem.out.println(\"Reduction Ratio is: \"+(1.0-(double) countHashMap(pairs)/total));\n\t\tint count=0;\n\t\tfor(int i:pairs.keySet())\n\t\t\tfor(int j:pairs.get(i))\n\t\t\tif(goldContains(i,j))\n\t\t\t\tcount++;\n\t\tSystem.out.println(\"Pairs Completeness is: \"+(double) count/gold.num_dups);\n\t}", "private void calculateTotalStats() {\n int totHp = calculateHp(baseStats.hp, ivStats.hp, evStats.hp);\n int totAtk = calculateStat(baseStats.atk, ivStats.atk, evStats.atk, natureStats.atk);\n int totDef = calculateStat(baseStats.def, ivStats.def, evStats.def, natureStats.def);\n int totSpAtk = calculateStat(baseStats.spAtk, ivStats.spAtk, evStats.spAtk, natureStats.spAtk);\n int totSpDef = calculateStat(baseStats.spDef, ivStats.spDef, evStats.spDef, natureStats.spDef);\n int totSpd = calculateStat(baseStats.spd, ivStats.spd, evStats.spd, natureStats.spd);\n totalStats = new Stats(totHp, totAtk, totDef, totSpAtk, totSpDef, totSpd);\n combatStats = new Stats(totHp, 0, 0, 0, 0, 0);\n }", "public void evaluate() {\r\n Statistics.evaluate(this);\r\n }", "double getHitRate();", "double getHitRate();", "@Override\n public int count() {\n return this.bench.size();\n }", "public double evaluate(){\n trialsSoFar++;\n double tot = 0;\n int ix = 0;\n while (ix < genome.getGenome().size()) {\n // directly access the current value field of each bandit\n boolean block = true;\n for (int j=0; j<blockSize; j++) {\n if (genome.getGenome().get(ix).getX() != 1)\n block = false;\n ix++;\n }\n if (block) {\n tot += blockSize;\n }\n }\n return tot;\n }", "public static void main(String[] args) {\n double SumOfTimes = 0;\n for(int j=0; j<100; j++) {\n\n TimeCounter timer = new TimeCounter();\n timer.StartToCount();\n\n for (int i = 1; i <= 100000; i++) {\n if (i % 3 == 0) {\n System.out.print(\"fizz \");\n }\n if (i % 5 == 0) {\n System.out.print(\"buzz\");\n }\n if (i % 3 != 0 && i % 5 != 0) {\n System.out.print(i);\n }\n System.out.println();\n }\n\n timer.FinishToCount();\n SumOfTimes+=timer.GetCountedTime();\n\n }\n System.out.println(\"Average time = \"+SumOfTimes/100); // Average time = 0.318....... (in my processor)\n }", "public void caltotaltraveltime()\n {\n \t\n \t switch(this.mLegs.size())\n \t {\n \t case 0:\n \t {\n \t\t this.mTravelTime=0;\n \t\t break;\n \t }\n \t case 1:\n \t { \n \t\t this.mTravelTime=this.mLegs.get(0).flighttime();\n \t\t break;\n \t }\n \t case 2:\n \t {\n \t\t Date arrivalt = this.mLegs.get(1).arrivaldate();\n \t\t Date departt = this.mLegs.get(0).departuredate();\n \t\t long diff = (arrivalt.getTime() - departt.getTime())/60000;\n \t\t this.mTravelTime=diff;\n \t\t break;\n \t }\n \t case 3:\n \t {\n \t Date arrivalt = this.mLegs.get(2).arrivaldate();\n \t Date departt = this.mLegs.get(0).departuredate();\n \t long diff = (arrivalt.getTime() - departt.getTime())/60000;\n \t this.mTravelTime=diff;\n \t break;\n \t }\n \t }\n }", "public abstract double calculateStartTime();", "Optional<Duration> totalCpuTime();" ]
[ "0.68819416", "0.66673344", "0.64965546", "0.645114", "0.6450323", "0.6447129", "0.6394125", "0.6345206", "0.62643045", "0.6173303", "0.61066794", "0.6080876", "0.60678536", "0.6055198", "0.60505223", "0.6035829", "0.59609", "0.5958504", "0.59583086", "0.59500396", "0.5949353", "0.5941451", "0.5939484", "0.5937849", "0.5922081", "0.59006864", "0.5899227", "0.58843064", "0.5879556", "0.5876986", "0.5876781", "0.5867682", "0.5850526", "0.58255994", "0.5821596", "0.5790973", "0.5771981", "0.57612973", "0.5756504", "0.5754552", "0.57536507", "0.5749441", "0.57483506", "0.574178", "0.57302475", "0.5723899", "0.5712113", "0.5677546", "0.5670326", "0.56525195", "0.5650315", "0.56393147", "0.5623178", "0.56220895", "0.561803", "0.56163627", "0.56151175", "0.5612706", "0.56015676", "0.559595", "0.55946136", "0.5584494", "0.5579169", "0.55754524", "0.5573297", "0.5570105", "0.5569735", "0.556762", "0.55654293", "0.5564236", "0.5562076", "0.55596924", "0.55581576", "0.5557052", "0.55562615", "0.555404", "0.55520904", "0.5543079", "0.5541655", "0.5537469", "0.55254173", "0.551964", "0.5516237", "0.55126584", "0.550962", "0.54875124", "0.54809487", "0.54753804", "0.54746944", "0.5470341", "0.54621166", "0.5457393", "0.54499793", "0.54499793", "0.5447716", "0.54455394", "0.5440466", "0.5438851", "0.54372394", "0.5435936" ]
0.61546195
10
returns the maximum memory used in a run of ION
public double getMaxMemUsage() { return maxMemory; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "long getMaxMemory();", "abstract int getMaxMemoryUsage();", "long getMemLimit();", "public static native int getMaxCacheMem();", "public long getMemMax() {\n return memMax;\n }", "public long getMemUsedMax() {\n return memUsedMax;\n }", "public static double getMaxMemory()\n {\n \treturn (double) Runtime.getRuntime().maxMemory() / 1024/1024;\n }", "public static long getMaxNonHeapMemory() {\n\t\tMemoryMXBean memBean = ManagementFactory.getMemoryMXBean();\n\t\tMemoryUsage nonHeap = memBean.getNonHeapMemoryUsage();\n\n\t\treturn nonHeap.getMax();\n\t}", "default long getUnusedMemory() {\n return getMaxMemory() - getMemory();\n }", "long getMemory();", "long getMemory();", "public long memoriaRamDisponivel(){\n return hardware.getMemory().getAvailable();\n }", "public native static int getMaximumMTU() throws IOException,IllegalArgumentException;", "public static long getMaxMemory() {\r\n\t\tmaxMemory = Runtime.getRuntime().maxMemory();\r\n\t\treturn maxMemory;\r\n\t}", "public Integer getMemoryMb() {\n return memoryMb;\n }", "@Nullable\n BigInteger getMemoryMb();", "int getMaximumCacheSize();", "public static native int getMaxCache();", "private long getCurrentJvmMaxMemoryInGB() throws IOException {\n String currentXmx = getCurrentXmxValue();\n char units = '-';\n Long value = 0L;\n if (currentXmx.length() > 1) {\n units = currentXmx.charAt(currentXmx.length() - 1);\n value = Long.parseLong(currentXmx.substring(0, currentXmx.length() - 1));\n } else {\n throw new IOException(\"No memory setting found in String: \" + currentXmx);\n }\n //some older .conf files might have the units as megabytes instead of gigabytes\n switch (units) {\n case 'g':\n case 'G':\n return value;\n case 'm':\n case 'M':\n return value / MEGA_IN_GIGA;\n default:\n throw new IOException(\"Units were not recognized as parsed: \" + units);\n }\n }", "public static long getMaxHeapMemory() {\n\t\tMemoryMXBean memBean = ManagementFactory.getMemoryMXBean();\n\t\tMemoryUsage heap = memBean.getHeapMemoryUsage();\n\n\t\treturn heap.getMax();\n\t}", "public int getMemory()\n\t{\n\t\treturn memorySize;\n\t}", "long memoryUsed();", "public final synchronized int getMaximumSize() {\n\t\treturn cacheSize;\n\t}", "public int getMaximumSize() {\n return maximumSize;\n }", "private long getMemoryFootprint() {\n Runtime runtime = Runtime.getRuntime();\n long memAfter = runtime.totalMemory() - runtime.freeMemory();\n long memBefore = memAfter + 1;\n while (memBefore != memAfter) {\n memBefore = memAfter;\n System.gc();\n memAfter = runtime.totalMemory() - runtime.freeMemory();\n }\n return memAfter;\n }", "double getMaxTfCapacity();", "@Override\n public int getLocalMaxMemory() {\n if (offHeap && !localMaxMemoryExists) {\n int value = computeOffHeapLocalMaxMemory();\n if (localMaxMemoryExists) {\n // real value now exists so set it and return\n localMaxMemory = value;\n }\n }\n checkLocalMaxMemoryExists();\n return localMaxMemory;\n }", "int memSize() {\n // treat Code as free\n return BASE_NODE_SIZE + 3 * 4;\n }", "private long getSystemMemoryInGB() {\n long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory\n .getOperatingSystemMXBean()).getTotalPhysicalMemorySize();\n return memorySize / ONE_BILLION;\n }", "static long getPresumableFreeMemory() {\n System.gc();\n final long allocatedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n return Runtime.getRuntime().maxMemory() - allocatedMemory;\n }", "public long getMaxRIT() {\n return localMaxRIT;\n }", "public long estimateMaxMemSize() {\n return timeOut.size()\n + valueOut.size()\n + timeEncoder.getMaxByteSize()\n + valueEncoder.getMaxByteSize();\n }", "public BigInteger getMaxUses() {\r\n return maxUses;\r\n }", "public long memoriaDisponível() {\n int numeroDeParticoes = numeroDeParticoesDeDisco();\n long memoriaDisponivel = 0;\n for (int i = 0; i < numeroDeParticoes; i++) {\n memoriaDisponivel += operatingSystem.getFileSystem().getFileStores()[i].getUsableSpace();\n }\n return memoriaDisponivel;\n }", "public abstract int getMaxIntermediateSize();", "int getMaxSetSize(Object modelID) throws Exception;", "private float getMemoryUsage() {\n\t\tRuntime runtime = Runtime.getRuntime();\n\t\tlong allocatedMemory = runtime.totalMemory();\n\t\tlong freeMemory = runtime.freeMemory();\n\t\treturn (allocatedMemory - freeMemory);\n\t}", "public int getMaximalSize() {\n return maximalSize;\n }", "public long memory() {\n\treturn 0;\n }", "public static int size_max() {\n return (8 / 8);\n }", "int memSize() {\r\n\t\treturn BASE_NODE_SIZE + 5 * 4;\r\n\t}", "public abstract long estimateMemorySize();", "public int getLocalMaxMemoryForValidation() {\n if (offHeap && !hasLocalMaxMemory && !localMaxMemoryExists) {\n int value = computeOffHeapLocalMaxMemory();\n if (localMaxMemoryExists) { // real value now exists so set it and return\n localMaxMemory = value;\n }\n }\n return localMaxMemory;\n }", "public Long get_cachemaxmemorykb() throws Exception {\n\t\treturn this.cachemaxmemorykb;\n\t}", "public abstract long getMaxSize();", "public int getSize() {\n return memory.length;\n }", "public long getMaximum() {\n\t\treturn this._max;\n\t}", "private int computeOffHeapLocalMaxMemory() {\n\n long availableOffHeapMemoryInMB = 0;\n if (testAvailableOffHeapMemory != null) {\n availableOffHeapMemoryInMB =\n OffHeapStorage.parseOffHeapMemorySize(testAvailableOffHeapMemory) / (1024 * 1024);\n } else if (InternalDistributedSystem.getAnyInstance() == null) {\n localMaxMemoryExists = false;\n // fix 52033: return non-negative, non-zero temporary placeholder for offHeapLocalMaxMemory\n return OFF_HEAP_LOCAL_MAX_MEMORY_PLACEHOLDER;\n } else {\n String offHeapSizeConfigValue =\n InternalDistributedSystem.getAnyInstance().getOriginalConfig().getOffHeapMemorySize();\n availableOffHeapMemoryInMB =\n OffHeapStorage.parseOffHeapMemorySize(offHeapSizeConfigValue) / (1024 * 1024);\n }\n\n if (availableOffHeapMemoryInMB > Integer.MAX_VALUE) {\n logger.warn(\n \"Reduced local max memory for partition attribute when setting from available off-heap memory size\");\n return Integer.MAX_VALUE;\n }\n\n localMaxMemoryExists = true;\n return (int) availableOffHeapMemoryInMB;\n }", "public Long get_cache64maxmemorykb() throws Exception {\n\t\treturn this.cache64maxmemorykb;\n\t}", "public static long getAvailableInternalMemorySize() {\r\n File path = Environment.getDataDirectory();\r\n StatFs stat = new StatFs(path.getPath());\r\n long blockSize = stat.getBlockSize();\r\n long availableBlocks = stat.getAvailableBlocks();\r\n return availableBlocks * blockSize;\r\n }", "default int getMaximumCount(int slot) {\n\t\treturn 64;\n\t}", "public int getMaxDiskCacheSize() {\n return mMaxDiskCacheSize;\n }", "public double getOccupiedRamGB () { return getRamBaseResource().getOccupiedCapacity(); }", "public int getMaximumCacheSize() {\n return this.maximumCacheSize;\n }", "public int getMaxSize()\n {\n return m_MaxSize;\n }", "public Long get_cachemaxmemoryactivekb() throws Exception {\n\t\treturn this.cachemaxmemoryactivekb;\n\t}", "public int getMaximum() {\r\n return max;\r\n }", "public final int getAllocateLimit() {\n return allocateLimit;\n }", "@Override\n\tpublic long maxSize() {\n\t\treturn Main.chunkStoreAllocationSize;\n\t}", "public int maximumSizeInBytes() {\n return maximumSizeInBytes;\n }", "public int getMaximumValue() {\n/* 359 */ return Math.min(32767, (this.c.getMaximumSize()).width);\n/* */ }", "public static long getTotalInternalMemorySize() {\r\n File path = Environment.getDataDirectory();\r\n StatFs stat = new StatFs(path.getPath());\r\n long blockSize = stat.getBlockSize();\r\n long totalBlocks = stat.getBlockCount();\r\n return totalBlocks * blockSize;\r\n }", "public int getMemoryUsage() {\n\t\ttry {\n\t\t\treturn super.getProperty(\"MemoryUsage\", Integer.class);\n\t\t} catch (Exception e) {\n\t\t\treturn -1;\n\t\t}\n\t}", "public int getMaxTiles(int width) {\r\n\r\n // get an instance of java.lang.Runtime, force garbage collection\r\n java.lang.Runtime runtime=java.lang.Runtime.getRuntime();\r\n runtime.gc();\r\n\r\n // calculate free memory for ARGB (4 byte) data, giving some slack\r\n // to out of memory crashes.\r\n int num=(int)(Math.sqrt(\r\n (float)(runtime.freeMemory()/4)*0.925f))/width;\r\n p.println(((float)runtime.freeMemory()/(1024*1024))+\"/\"+\r\n ((float)runtime.totalMemory()/(1024*1024)));\r\n\r\n // warn if low memory\r\n if(num==1) {\r\n p.println(\"Memory is low. Consider increasing memory settings.\");\r\n num=2;\r\n }\r\n\r\n return num;\r\n }", "public Long peakPagedMemorySize64() {\n return this.peakPagedMemorySize64;\n }", "public static long getMemoryFree() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryFree();\r\n }", "@Override\n public int getMaxCapacity() {\n return 156250000;\n }", "abstract int calculateMaximumSize(int axis);", "public Long get_cacheutilizedmemorykb() throws Exception {\n\t\treturn this.cacheutilizedmemorykb;\n\t}", "private int getPRFurthestUse() {\n int max = -1;\n int maxPR = -1;\n for (int i = 0; i < numPhysRegs - 1; i++) {\n if (PRNU[i] > max) {\n max = PRNU[i];\n maxPR = i;\n }\n }\n return maxPR; // no free physical register\n }", "public int getMaximum() {\n return this.iMaximum;\n }", "public abstract String getMaxUsage();", "public int getMaxSize(){\n return maxSize;\n }", "public Integer getMemorySize() {\n return this.memorySize;\n }", "long getUsedSpace() throws IOException;", "public int getMaximumCapacity() { // get the max capacity\n\t\treturn maximumCapacity;\n\t}", "public final int getMaxForKernels()\r\n\t{\r\n\t\treturn maxForKernels;\r\n\t}", "public static int offset_max() {\n return (64 / 8);\n }", "public long getMaxXIT() {\n return localMaxXIT;\n }", "public int getMaxSize() {\n return maxSize;\n }", "public int getMaxSize() {\n return maxSize;\n }", "public int getMaxSize() {\n return maxSize;\n }", "public int getPROC_MAX() {\r\n return PROC_MAX;\r\n }", "int getLocalOffHeapSize();", "public native int getTotalMemory();", "public int memUsage(){\n\t\tint usage = 36;\n\t\tusage += 12 * point.length;\n\t\tusage += 4 * glComannd.length;\n\t\tusage += 12 * glVertex.length;\n\t\tusage += 24 * state.length;\n\t\treturn usage;\n\t}", "public long getMemoryInternalAvail() {\n StatFs stat = new StatFs(Environment.getDataDirectory().getPath());\n long blockSize = stat.getBlockSize();\n long availableBlocks = stat.getAvailableBlocks();\n return availableBlocks * blockSize;\n }", "public int getMaximumEPC(int metadata);", "public int getMaxSize() {\n return maxSize_;\n }", "public int getMaximum() {\n \tcheckWidget();\n \treturn maximum;\n }", "long getMemorySize() {\n return MemoryBudget.DELTAINFO_OVERHEAD +\n MemoryBudget.byteArraySize(key.length);\n }", "public int getCapacity() {\n\t\treturn this.maxCapacity;\n\t}", "public Number getMaximumNumber() {\n/* 221 */ if (this.maxObject == null) {\n/* 222 */ this.maxObject = new Long(this.max);\n/* */ }\n/* 224 */ return this.maxObject;\n/* */ }", "public static long getMemoryUsed() throws IOException, InterruptedException {\n \treturn pi4jSystemInfoConnector.getMemoryUsed();\r\n }", "public static String retornaPercentualUsadoDeMemoriaJVM() {\r\n\t\tRuntime runtime = Runtime.getRuntime();\r\n\t\t\r\n\t\tlong max = runtime.maxMemory();\r\n\t\tlong free = runtime.freeMemory();\r\n\t\tlong used = max - free;\r\n\r\n\t\tNumberFormat format = NumberFormat.getInstance();\r\n\r\n\t\t// Retorna o percentual da memoria usada\r\n\t\tString percentualMemoriaUsada = format.format(((used * 100) / max));\r\n\r\n\t\treturn percentualMemoriaUsada;\r\n\t}", "public Integer getMaxQuota() {\n return (Integer) getAttributeInternal(MAXQUOTA);\n }", "public int getMaxSize() {\n return maxSize_;\n }", "public int getMaxSize() {\n return maxSize_;\n }", "int getMaximum();", "public int getMaximumPoints();" ]
[ "0.7995515", "0.7780597", "0.7517388", "0.7334496", "0.7329411", "0.73031896", "0.7071999", "0.6847173", "0.6842302", "0.6795751", "0.6795751", "0.67892635", "0.67881876", "0.67787623", "0.67282504", "0.66230196", "0.65753853", "0.65708226", "0.6570246", "0.6518058", "0.64902806", "0.64539", "0.64430684", "0.64325476", "0.642672", "0.63964236", "0.6384396", "0.63640726", "0.6359801", "0.6356444", "0.6331741", "0.6318817", "0.63012594", "0.629978", "0.62847346", "0.6284337", "0.62823987", "0.62774587", "0.62770754", "0.627034", "0.62667894", "0.6249567", "0.62402683", "0.6235694", "0.62345016", "0.6223736", "0.6201348", "0.6194512", "0.61776185", "0.617587", "0.6172462", "0.6172051", "0.61720467", "0.6171399", "0.6171242", "0.6170129", "0.6153666", "0.6144182", "0.6139624", "0.61388177", "0.6136877", "0.61275053", "0.61212426", "0.61077034", "0.60961604", "0.60954255", "0.6076545", "0.60762006", "0.60761225", "0.60730195", "0.607021", "0.6068217", "0.60680723", "0.606778", "0.6063491", "0.6056651", "0.60466236", "0.6039598", "0.6038314", "0.6031807", "0.6031807", "0.6031807", "0.6028804", "0.6024131", "0.60223997", "0.60149115", "0.6014033", "0.60133165", "0.6007722", "0.60039496", "0.5997695", "0.5978048", "0.59768194", "0.5972896", "0.5971386", "0.59662414", "0.5960659", "0.5960659", "0.59564483", "0.5954431" ]
0.72049576
6
return hitting set sizes
public List<Integer> getIterations() { int totalit = 0; int largestit = 0; int averageit = 0; for (Integer i : recGraphs) { totalit += i; averageit += i / recGraphs.size(); if (i > largestit) { largestit = i; } } List<Integer> list = new ArrayList<>(); list.add(totalit); list.add(largestit); list.add(averageit); return list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int size(){\n return set.length;\n }", "Dimension[] getSizes();", "public int[] getSizes() {\n\t\treturn new int[] { quoteMap.size(), bookMap.size(), _cumulativeVolumeTable.size() };\n\t}", "@Override\n public int size() {\n return theSet.size();\n }", "public int getSetSize(){ return Integer.parseInt(setSize.getText()); }", "public int size() {\n return set.size();\n }", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "int getSize();", "@Override\r\n public int getSize() {\n return vs.size();\r\n }", "public int getSize();", "public int getSize();", "public int getSize();", "public int getSize();", "public int getSize();", "public int getSize();", "public int getSize();", "public int getSize();", "public int getSize();", "public int getSize();", "double getSize();", "public int size() {\n \n return point2DSET.size();\n }", "private int size() {\n assert _vertices.size() == _edges.size();\n return _edges.size();\n }", "public int size() {\r\n\t\treturn set.size();\r\n\t}", "protected long getLiveSetSize() {\n\t\t// Sum of bytes removed from the containers.\n\t\tlong removed = 0;\n\n\t\tfor (int i = 0; i < sets.length; i++)\n\t\t\tremoved += sets[i].getContainer().getBytesRemoved();\n\n\t\t/*\n\t\t * The total number of butes still alive is the throughput minus the number of\n\t\t * bytes either removed from the container or never added in the first place.\n\t\t */\n\t\tlong size = getThroughput() - removed - producerThreadPool.getBytesNeverAdded();\n\n\t\treturn (size > 0) ? size : 0;\n\t}", "public int getSize() { return size; }", "@Override\r\n\tpublic int size() {\n\t\treturn set.size();\r\n\t}", "private void calculateMapSize() {\n calculateMapSize(true);\n }", "public Dimension getSize() {\n\t\t\t\tfor(Rectangle rec : boxes){\r\n\t\t\t\t\tbounds.union(rec);\r\n\t\t\t\t}\r\n\t\t\t\treturn bounds.getSize();\r\n\t\t\t}", "public int getSize()\n\t{\n\t\treturn setSize;\n\t}", "public int size() {\n return pointSet.size();\n }", "public int size() {\n\t\treturn set.size();\n\t}", "@Override\n public int getCacheSize() {\n return 4 + this.arraySet.getTotalBytesSize();\n }", "public int getSize(){return this.size;}", "public int size() {\n return pointsSet.size();\n }", "long getOccupiedSize();", "int getLostedSize();", "public int getSize() {return size;}", "@Test\r\n public void testSize1() {\r\n Assert.assertEquals(5, set1.size());\r\n }", "private int getSize() {\r\n\t\treturn this.size;\r\n\t}", "int givePropSize(List<Integer[]> coordsInProp) throws Exception;", "public int getSize() {\r\n return size;\r\n }", "public abstract int getSize();", "public abstract int getSize();", "public abstract int getSize();", "public abstract int getSize();", "@Override\n protected int mapSize() {\n return left.size()+right.size()-hidden.size();\n }", "Dimension getSize();", "Dimension getSize();", "public double getSize() \n {\n return size;\n }", "@Override\n public int getSize() {\n return map.size();\n }", "public int getFeaturesSize();", "private void thenInControllerSizeMustBe(int setSize) {\n log.info(\"Checking how many recipe items are in the set\");\n ArgumentCaptor<Set<Recipe>> argumentCaptor = ArgumentCaptor.forClass(Set.class);\n Mockito.verify(model, times(1)).addAttribute(eq(\"recipes\"), argumentCaptor.capture());\n\n Set setIncontroller = argumentCaptor.getValue();\n assertEquals(setSize, setIncontroller.size());\n }", "public int size() {\n \tint currentSize = 0;\n \t\n \tIterator<E> iterateSet = this.iterator();\n \t\n \t// calculates number of elements in this set\n \twhile(iterateSet.hasNext()) {\n \t\titerateSet.next();\n \t\tcurrentSize++;\t\t\n \t}\n \t\n \treturn currentSize;\n \t\n }", "@Test\n public void mapSize() {\n check(MAPSIZE);\n query(MAPSIZE.args(MAPENTRY.args(1, 2)), 1);\n }", "public int getSize() { \n return size;\n }", "public int getSize( )\n {\n return size;\n }", "int getSize ();", "@Override\n public int estimateSize() {\n return 8 + 8 + 1 + 32 + 64;\n }", "float getSize(float[] sizes);", "private int getSize() {\n\t\t\treturn size;\n\t\t}", "public long getSize() {\n\t\treturn Math.abs(getXSize() * getYSize() * getZSize());\n\t}", "public int get_size();", "public int get_size();", "public int getTotalSize();", "public void sizeHasBeenSet() {\n isSizeSet = true;\n }", "public int getSize(){\n return size;\n }", "int getTileSize();", "public int getSize()\r\n {\r\n return size;\r\n }", "public int size() {\n return itemsets.size();\n }", "public int getSize()\r\n {\r\n return size;\r\n }", "public int getSize(){\n return size;\n }", "public int getSize(){\n return size;\n }", "public int getSize(){\n return size;\n }", "public void setSize() {\n\t\t\tthis.size = 1;\n\t\t\tint leftSize = 0;\n\t\t\tint rightSize = 0;\n\t\t\tif (this.getLeft().getKey() != -1) {\n\t\t\t\tleftSize = this.getLeft().getSize();\n\t\t\t}\n\t\t\tif (this.getRight().getKey() != -1) {\n\t\t\t\trightSize = this.getRight().getSize();\n\t\t\t}\n\t\t\tthis.size += leftSize + rightSize;\n\n\t\t\t/**\n\t\t\t * this.size = 1; int leftSize = 0; int rightSize = 0; try { leftSize =\n\t\t\t * this.getLeft().getSize(); this.size += leftSize; } catch\n\t\t\t * (NullPointerException e) { this.size += leftSize; } try { rightSize =\n\t\t\t * this.getRight().getSize(); this.size += rightSize; } catch\n\t\t\t * (NullPointerException e) { this.size += rightSize; } if (this.getSize() >\n\t\t\t * 990) { System.out.println(\"actual size is:\" + this.getSize()); }\n\t\t\t */\n\t\t}", "int getCurrentSize();", "public XYPoint getMapSize();", "public int size() { return this.size; }", "int getTotalSize();", "public int getSize() {\r\n return size;\r\n }", "long getSize();", "@Override\n public int size(){\n return sizeHelper(this.first);\n }", "int getLocalSize();", "public int getSize() {\n return size;\n }", "@Override\n\tpublic double getSize() {\n\t\treturn Math.sqrt(getMySize())/2;\n\t}", "public int getSize()\n {\n return size;\n }", "public int getSize()\n {\n return size;\n }", "public int getSize()\n {\n return size;\n }", "public int getSize(){\n //To be written by student\n return localSize;\n }", "public int getSize() {\r\n \treturn size;\r\n }", "public abstract double getRangeSize();" ]
[ "0.66374683", "0.6636576", "0.6550133", "0.6436562", "0.6428125", "0.6367287", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6365625", "0.6354162", "0.6325157", "0.6325157", "0.6325157", "0.6325157", "0.6325157", "0.6325157", "0.6325157", "0.6325157", "0.6325157", "0.6325157", "0.63229674", "0.63095087", "0.6295479", "0.6292603", "0.6284581", "0.62741834", "0.6271268", "0.6264057", "0.625683", "0.62522876", "0.62511146", "0.6228261", "0.6226164", "0.62214726", "0.6213676", "0.6211809", "0.6206275", "0.6205369", "0.6196118", "0.61908144", "0.6171578", "0.6125251", "0.6124025", "0.6124025", "0.6124025", "0.6124025", "0.61121505", "0.6111782", "0.6111782", "0.610481", "0.61022323", "0.6101835", "0.6101055", "0.61007106", "0.6098812", "0.60981506", "0.608857", "0.60857254", "0.6085476", "0.60797995", "0.60780424", "0.6067544", "0.6061503", "0.6061503", "0.6058992", "0.6053402", "0.60532427", "0.60520864", "0.6047215", "0.6044434", "0.6036573", "0.60347295", "0.60347295", "0.60347295", "0.6033739", "0.6025967", "0.60210043", "0.6018573", "0.6017801", "0.601672", "0.6015694", "0.6015009", "0.60132915", "0.60123193", "0.6011883", "0.6004272", "0.6004272", "0.6004272", "0.59952676", "0.59907424", "0.5987543" ]
0.0
-1
summarizes time and hitting set time and size information for latex
public String getStats() { String stats = "Total running time: " + runtime + "\\\\"; int totalit = 0; int largestit = 0; int averageit = 0; for (Integer i : recGraphs) { totalit += i; averageit += i; if (i > largestit) { largestit = i; } } averageit /= recGraphs.size(); double totalhit = 0; double longesthit = 0; double averagehit = 0; for (Double i : recHitTimes) { totalhit += i; averagehit += i / recHitTimes.size(); if (i > longesthit) { longesthit = i; } } stats += "Total iterations in step 3: " + totalit + "\\\\"; stats += "Largest set of iterations in step 3: " + largestit + "\\\\"; stats += "Average iterations set in step 3: " + averageit + "\\\\"; stats += "Total hitting sets calculation time: " + totalhit + "\\\\"; stats += "Average hitting set calculation time: " + averagehit + "\\\\"; stats += "Longest hitting set calculation time: " + longesthit + "\\\\"; return stats; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void createTotalTime(BufferedWriter writer) throws IOException {\r\n\t\tMap<String, String> dataMap = data.getTotalTime();\r\n\t\tString parent = \"<div style='width: 260px;background-color: #FFFFFF;box-shadow: 1px 1px 1px #888888;height: 85px;position: absolute;top: 67px;left: 281px;'>\";\r\n\t\tString subChild = \"<label style='position: absolute;margin-top: 5px;'>\";\r\n\t\tString totalTimeLabel = \"<span style='font-weight: bold;color: #000000;padding-left: 8px;font-family: Roboto, sans-serif;'>Total Time</span></label>\";\r\n\t\tString subChild1 = \"<label style='margin-top: 57px;position: absolute;'>\";\r\n\t\tString totatlTime = \"<span style='font-weight: bold;color: #000000;padding-left: 8px;font-family: Roboto, sans-serif;'>\"\r\n\t\t\t\t+ dataMap.get(\"total-time\") + \"</span></label></div>\";\r\n\t\twriter.write(parent + subChild + totalTimeLabel + subChild1\r\n\t\t\t\t+ totatlTime);\r\n\r\n\t\tString startTimePanel = \"<div style='width: 260px;background-color: #00E676;box-shadow: 1px 1px 1px #888888;height: 85px;position: absolute;top: 67px;left: 554px;'>\";\r\n\t\tString labelTime = \"<label style='position: absolute;margin-left: 8px;'>\";\r\n\t\tString startTimeLabel = \"<span style='font-weight: bold;color: gray;padding-top: 3px;font-family: Roboto, sans-serif;'>Start Time</span></label>\";\r\n\t\tString timeContainer = \"<label style='position: absolute;margin-top: 58px;padding-left: 118px;font-weight: bold;color: white;'><span style='font-family: Roboto, sans-serif;font-size:smaller'>\";\r\n\t\tString startTime = dataMap.get(\"start-time\") + \"</span></label></div>\";\r\n\t\twriter.write(startTimePanel + labelTime + startTimeLabel\r\n\t\t\t\t+ timeContainer + startTime);\r\n\r\n\t\tString endTimePanel = \"<div style='width: 260px;background-color: #F44336;box-shadow: 1px 1px 1px #888888;height: 85px;position: absolute;top: 67px;left: 828px;'>\";\r\n\t\tString endlabelTime = \"<label style='position: absolute;margin-left: 8px;'>\";\r\n\t\tString endTimeLabel = \"<span style='font-weight: bold;color: gray;padding-top: 3px;font-family: Roboto, sans-serif;'>End Time</span></label>\";\r\n\t\tString endTimeContainer = \"<label style='position: absolute;margin-top: 58px;padding-left: 118px; font-weight: bold;color: white;'><span style='font-family: Roboto, sans-serif;font-size:smaller'>\";\r\n\t\tString endTime = dataMap.get(\"end-time\") + \"</span></label></div>\";\r\n\t\twriter.write(endTimePanel + endlabelTime + endTimeLabel\r\n\t\t\t\t+ endTimeContainer + endTime);\r\n\r\n\t}", "@Override\r\n\tpublic String scheda() {\n\t\treturn getNome() + \"\\t\" + getDescrizione() + \"\\t\" + benchmark;\r\n\t}", "public static void _generateStatistics() {\n\t\ttry {\n\t\t\t// Setup info\n\t\t\tPrintStream stats = new PrintStream(new File (_statLogFileName + \".txt\"));\n\n\t\t\tScanner scan = new Scanner(new File(_logFileName+\".txt\"));\n\t\t\twhile (scan.hasNext(SETUP.toString())) {\n\t\t\t\t// Append setup info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tstats.append(\"\\n\");\n\n\t\t\twhile (scan.hasNext(DETAILS.toString()) || scan.hasNext(RUN.toString())) {\n\t\t\t\t// Throw detailed info away\n\t\t\t\tscan.nextLine();\n\t\t\t}\n\n\t\t\twhile (scan.hasNext()) {\n\t\t\t\t// Append post-run info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tscan.close();\n\t\t\tstats.append(\"\\n\");\n\n\t\t\t// Perf4J info\n\t\t\tReader reader = new FileReader(_logFileName+\".txt\");\n\t\t\tLogParser parser = new LogParser(reader, stats, null, 10800000, true, new GroupedTimingStatisticsTextFormatter());\n\t\t\tparser.parseLog();\n\t\t\tstats.close();\n\t\t}\n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void startTimeMeasure() {\n \tstartTime = System.nanoTime();\n }", "public void show() {\n\t\t\n\t\tSystem.out.println(\"time (tree setup) = \" + treeSetup + \" ms\");\n\t\tSystem.out.println(\"time (average search) = \" + (totalSearch/(float)countSearch) + \" ms\");\n\t\tSystem.out.println(\"time (average at) = \" + (totalAt/(float)countAt) + \" ms\");\n \t}", "public String stats()\n\t{\n\t\tString a = \"\"; //initialize string\n\t\t\n\t\tString size1 = points.length + \"\"; //put size into string\n\t\t\n\t\twhile(size1.length() < 12) //go until string is 12 long\n\t\t{\n\t\t\tsize1 += \" \"; //add a new blank space\n\t\t}\n\t\ta = a + algorithm + \" \" + size1 + time; //put string together \n\t\treturn a; \n\t}", "public void printStatistics() {\r\n\t\tLog.info(\"*** Statistics of Sequence Selector ***\");\r\n\r\n\t\t// chains\r\n\t\tLog.info(String.format(\"Chains: %d\", chains.size()));\r\n\t\tLog.info(String.format(\"Executable Chains: %d\", execChains.size()));\r\n\t\tLog.info(String.format(\"Causal Executable Chains: %d\",\r\n\t\t\t\tcausalExecChains.size()));\r\n\r\n\t\t// bushes\r\n\t\tLog.info(String.format(\"Bushes: %d\", bushes.size()));\r\n\t\tLog.info(String.format(\"Executable Bushes: %d\", execBushes.size()));\r\n\t\tLog.info(String.format(\"Required Bushes: %d\", requiredExecBushes.size()));\r\n\t\tLog.info(String.format(\"Redundant Bushes: %d\",\r\n\t\t\t\tredundantExecBushes.size()));\r\n\r\n\t\t// total\r\n\t\tLog.info(String.format(\"Bushes in Chains: %d\", bushesInChains.size()));\r\n\t\tLog.info(String.format(\"Total Sequences: %d\", totalSequences.size()));\r\n\r\n\t\t// time\r\n\t\tLog.info(String.format(\"Total Time: %d ms\", stopWatch.getTime()));\r\n\t\tLog.info(String.format(\"Time per Event: %d ms\", stopWatch.getTime()\r\n\t\t\t\t/ events.size()));\r\n\t}", "public void printStats() {\n\t\tSystem.out.println(\"============= RULEGROWTH - STATS ========\");\n\t\tSystem.out.println(\"Sequential rules count: \" + ruleCount);\n\t\tSystem.out.println(\"Total time: \" + (timeEnd - timeStart) + \" ms\");\n\t\tSystem.out.println(\"Max memory: \" + MemoryLogger.getInstance().getMaxMemory());\n\t\tSystem.out.println(\"==========================================\");\n\t}", "private static void calcSingleTms() {\n\t\tFloat avgLenInitial = 0f;\n\t\tFloat avgLenSc = 0f;\n\t\tInteger countSCsingle = 0;\n\t\t// get all the single TM proteins from the hash\n\t\t\n\t\t// for the initial set\n\t\tfor(int i =0;i<=singleTmProts.size()-1;i++){\n\t\t\tint id = singleTmProts.get(i);\n\t\t\tavgLenInitial = avgLenInitial + Sequences_length.get(id);\n\t\t}\n\t\tavgLenInitial = (avgLenInitial / singleTmProts.size());\n\t\t\n\t\tSystem.out.print(\"\\nNumber of Single TM proteins in initial Set \"+singleTmProts.size()+\"\\n\");\n\t\tSystem.out.print(\"\\nAvg Len of Single TM proteins in initial Set \"+avgLenInitial+\"\\n\");\n\t\t\n\t\t//for the SC\n\t\tgetSCset();\n\t\t// for all the proteins in SC_sequences\n\t\t\n\t\tfor(Integer key : SC_sequences.keySet()){\n\t\t\tif (singleTmProts.contains(key)){\n\t\t\t\t// is in SC and is single TM\n\t\t\t\tavgLenSc = avgLenSc + Sequences_length.get(key);\n\t\t\t\tcountSCsingle ++;\n\t\t\t}\n\t\t\tavgLenSc = (avgLenSc / countSCsingle); \n\t\t}\n\t\tSystem.out.print(\"\\nNumber of Single TM proteins in SC \"+countSCsingle+\"\\n\");\n\t\tSystem.out.print(\"\\nAvg Len of Single TM proteins in SC Set \"+avgLenSc+\"\\n\");\n\t\t\n\t\t\n\t\t\n\t}", "private void summarizeTimeslot ()\n {\n if (null == brokers) {\n // first time through\n brokers = new ArrayList<>();\n stats = new HashMap<>();\n\n data.print(\"Broker Name,\");\n data.print(\"Power Type,\");\n data.print(\"Customers,\");\n data.print(\"Usage (kWh),\");\n data.println(\"Income Gained\");\n\n // set up the maps of brokers, and stats by power type\n for (Broker broker : brokerRepo.findRetailBrokers())\n {\n brokers.add(broker);\n stats.put(broker, new HashMap<>());\n for (PowerType type : powerTypes)\n {\n StatsTracked theseStats = new StatsTracked();\n HashMap<PowerType, StatsTracked> map = stats.get(broker);\n map.put(type, theseStats);\n stats.put(broker, map);\n }\n }\n\n // store customer statistics\n\n }\n\n if (ttx.size() > 0) {\n // there are some signups and withdraws here\n for (TariffTransaction tx : ttx) {\n Broker broker = tx.getBroker();\n PowerType type = tx.getTariffSpec().getPowerType();\n HashMap<PowerType, StatsTracked> brokerMap = stats.get(broker);\n StatsTracked theseStats = brokerMap.get(type);\n if (tx.getTxType() == TariffTransaction.Type.CONSUME ||\n tx.getTxType() == TariffTransaction.Type.PRODUCE) {\n theseStats.updateUsage(tx.getKWh());\n theseStats.updateProfit(tx.getCharge());\n }\n else if (tx.getTxType() == TariffTransaction.Type.SIGNUP)\n theseStats.updateCustomers(tx.getCustomerCount());\n\n // reupdate the tracking...\n brokerMap.put(type, theseStats);\n stats.put(broker, brokerMap);\n }\n }\n ttx.clear();\n }", "private void createFinalTimeLabel(WritableSheet sheet)\n throws WriteException {\n WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);\n // Define the cell format\n times = new WritableCellFormat(times10pt);\n // Lets automatically wrap the cells\n times.setWrap(true);\n\n // create create a bold font with unterlines\n WritableFont times10ptBoldUnderline = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false,\n UnderlineStyle.SINGLE);\n timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);\n // Lets automatically wrap the cells\n timesBoldUnderline.setWrap(true);\n\n CellView cv = new CellView();\n cv.setFormat(times);\n cv.setFormat(timesBoldUnderline);\n cv.setAutosize(true);\n\n // Write a few headers\n addCaption(sheet, 0, 0, \"File\");\n addCaption(sheet, 1, 0, \"Time\");\n\n }", "private void appointmentReport() {\n Set<String> types = new HashSet<>();\n Set<Month> months = new HashSet<>();\n HashMap<String, Integer> numberByType = new HashMap<>();\n HashMap<Month, Integer> numberByMonth = new HashMap<>();\n\n for (Appointment appointment: Data.getAppointments()) {\n months.add(appointment.getStart().toLocalDateTime().getMonth());\n types.add(appointment.getType());\n }\n\n for (String type: types) {\n int count = 0;\n for (Appointment appointment: Data.getAppointments()) {\n\n if (type.equals(appointment.getType())) {\n count++;\n }\n numberByType.put(type, count);\n }\n }\n for (Month month: months) {\n int count = 0;\n for (Appointment appointment: Data.getAppointments()) {\n if (month.equals(appointment.getStart().toLocalDateTime().getMonth())) {\n count++;\n }\n numberByMonth.put(month, count);\n }\n }\n\n reportText.appendText(\"Report of the number of appointments by type:\\n\\n\");\n reportText.appendText(\"Count \\t\\tType\\n\");\n numberByType.forEach((k,v) -> reportText.appendText(v + \"\\t\\t\" + k + \"\\n\"));\n reportText.appendText(\"\\n\\n\\nReport of the number of appointments by Month:\\n\\n\");\n reportText.appendText(\"Count \\t\\tMonth\\n\");\n numberByMonth.forEach((k,v) -> reportText.appendText(v + \"\\t\\t\" + k + \"\\n\"));\n\n }", "private static void writeExecutionTime() {\n \t\n \tendMs = System.currentTimeMillis();\n \tlong elapsed = endMs - startMs;\n \tlong hours = elapsed / 3600000;\n long minutes = (elapsed % 3600000) / 60000;\n long seconds = ((elapsed % 3600000) % 60000) / 1000;\n \n try {\n \t\n \tFileSystem fs = FileSystem.get(Mediator.getConfiguration());\n \tPath outputPath = new Path(Mediator.getHDFSLocation()+\"/\"+Mediator.getLearnerOutputPath()+\"/time.txt\");\n \tOutputStream os = fs.create(outputPath);\n \tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));\n \t\n \t/**\n \t * Write total execution time\n \t */\n \tbw.write(\"Total execution time (hh:mm:ss): \"+String.format(\"%02d\",hours)+\":\"+String.format(\"%02d\",minutes)+\":\"+\n \t\t\tString.format(\"%02d\",seconds)+\" (\"+(elapsed/1000)+\" seconds)\\n\");\n \t\n \t/**\n \t * Write Mappers execution time avg.\n \t */\n \tPath inputPath = new Path(Mediator.getHDFSLocation()+\"/\"+Mediator.getLearnerOutputPath()+\"/\"+Mediator.TIME_STATS_DIR);\n \tFileStatus[] status = fs.listStatus(inputPath);\n \tBufferedReader br = null;\n \tString buffer;\n \tlong sumMappers = 0;\n \tint numMappers = 0;\n \tfor (FileStatus fileStatus:status){\n \t\t// Read Stage 1\n \t\tif (fileStatus.getPath().getName().contains(\"mapper\")){\n \t\t\tnumMappers ++;\n \t\t\tbr=new BufferedReader(new InputStreamReader(fs.open(fileStatus.getPath())));\n \t\t\tbuffer = br.readLine();\n \t\t\tsumMappers += Long.parseLong(buffer.substring(buffer.indexOf(\":\")+1).trim());\n \t\t}\n \t\tbr.close();\n \t}\n \t// Write AVG\n \telapsed = sumMappers / numMappers;\n \thours = elapsed / 3600;\n minutes = (elapsed % 3600) / 60;\n seconds = (elapsed % 3600) % 60;\n bw.write(\"Mappers avg. execution time (hh:mm:ss): \"+String.format(\"%02d\",hours)+\":\"+String.format(\"%02d\",minutes)+\":\"+\n \t\t\tString.format(\"%02d\",seconds)+\" (\"+elapsed+\" seconds)\\n\");\n \t\n \tbw.close();\n \tos.close();\n \t\n \t// Remove time stats directory\n \tfs.delete(inputPath,true);\n \t\n }\n catch(Exception e){\n \tSystem.err.println(\"\\nERROR WRITING EXECUTION TIME\");\n\t\t\te.printStackTrace();\n }\n \t\n }", "public void printMetrics() {\n System.out.println(\"\\nPROG_SIZE = \" + Metrics.getProgSize() + '\\n' + \"EXEC_TIME = \" + Metrics.getExecTime() + \" ms\" + '\\n' + \"EXEC_MOVE = \" + Metrics.getExecMove() + '\\n' + \"DATA_MOVE = \" + Metrics.getDataMove() + '\\n' + \"DATA_READ = \" + Metrics.getDataRead() + '\\n' + \"DATA_WRITE = \" + Metrics.getDataWrite() + '\\n');\n }", "static String getTimeAndSizeFromLog(String fileName){\n\t\tString res = \"\";\n\t\t\n//\t\tFile logFile = new File(\"R:/Eclipse/Partitionner/out/log_atl2_AllRanges_1000_30_20_20150629-1640.log\");\n//\t\tArrayList<ArrayList<String>> fileNames = Utils.extractModelsFromLogFile(logFile);\n\t\tArrayList<String> listNames = new ArrayList<>();\n\t\t\n\t\tString l = \"\", listModels = \"\", timeElapsed = \"\", checkRates = \"\";\n\t\t\n\t\tFile f = new File(Config.DIR_OUT+fileName);\n\t\t\n\t\tSystem.out.println(\"Reading '\"+f.getAbsolutePath()+\"'...\\t\");\n\t\ttry {\n\t\t\tPattern p=Pattern.compile(\"\\\\{.*\\\\}\");\n\t\t\tScanner scanner = new Scanner(f);\n while (scanner.hasNextLine()) { \n l = scanner.nextLine();\n if(l.trim().startsWith(\"Time\")){//Time elapsed : 5:28:19:125\n\t\t\t\t\tMatcher ma=Pattern.compile(\"\\\\:.*\").matcher(l);\n\t\t\t\t\t while(ma.find()) \n\t\t\t\t\t\t timeElapsed = ma.group().substring(1, ma.group().length()-1).trim();\n\t\t\t\t}\n if(l.trim().startsWith(\"Best\")){//Time elapsed : 5:28:19:125\n\t\t\t\t\tMatcher ma=Pattern.compile(\"Best\\\\:[\\\\S]*,{1}\").matcher(l);\n\t\t\t\t\t while(ma.find()) \n\t\t\t\t\t\t checkRates = ma.group().substring(\"Best:\".length(), ma.group().length()-1).trim();\n\t\t\t\t}\n \n\t\t\t\tif(l.trim().startsWith(\"Best\")){//Best:0.89...8,0.96...4,10 (MS15386:10 Models):(COV:89,DIS:96) rd(0,0)\t 10{model_00581.xmi,mo[...]8551.xmi}\n\t\t\t\t\tMatcher ma=p.matcher(l);\n\t\t\t\t\t while(ma.find()) \n\t\t\t listModels = ma.group().substring(1, ma.group().length()-1);\n\t\t\t\t}\n\t\t\t}\n scanner.close();\n listNames = Utils.extractModelsFromList(Config.DIR_INSTANCES+Config.METAMODEL_NAME+File.separator, \n \t\t\t\tlistModels\t\t\t\t\n \t\t\t\t,\",\");\n\n \t\tModelSet ms = new ModelSet(listNames);\n \t\tint totalClasses = 0, totalProperties = 0;\n \t\tfor (Model m : ms.getModels()) {\n \t\t\ttotalClasses += m.getNbClasses();\n \t\t\ttotalProperties += m.getNbProperties();\n \t\t}\n \t\tfloat avgClasses = (float)totalClasses / ms.size();\n \t\tfloat avgProperties = (float)totalProperties / ms.size();\n \t\tres= \";\"+timeElapsed+\";\"+avgClasses+\";\"+avgProperties;\n \t\tSystem.out.println(\" Average model size : \"+checkRates+\"..\\t\"+res);\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"WARNING : Could not process file '\"+f.getAbsolutePath()+\"'\");\n//\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t\n\t\t\n\n\t\treturn res;\n\t}", "private void printTotalComputeTime\n\t\t(PrintWriter out)\n\t\t{\n\t\tif (myTotalComputeTime < 1000000L)\n\t\t\t{\n\t\t\tout.print (myTotalComputeTime / 1000L);\n\t\t\t}\n\t\telse if (myTotalComputeTime < 1000000000L)\n\t\t\t{\n\t\t\tout.print (\"Over \");\n\t\t\tout.print (myTotalComputeTime / 1000000L);\n\t\t\tout.print (\" thousand\");\n\t\t\t}\n\t\telse if (myTotalComputeTime < 1000000000000L)\n\t\t\t{\n\t\t\tout.print (\"Over \");\n\t\t\tout.print (myTotalComputeTime / 1000000000L);\n\t\t\tout.print (\" million\");\n\t\t\t}\n\t\telse if (myTotalComputeTime < 1000000000000000L)\n\t\t\t{\n\t\t\tout.print (\"Over \");\n\t\t\tout.print (myTotalComputeTime / 1000000000000L);\n\t\t\tout.print (\" billion\");\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tout.print (\"Over \");\n\t\t\tout.print (myTotalComputeTime / 1000000000000000L);\n\t\t\tout.print (\" trillion\");\n\t\t\t}\n\t\tout.println (\" CPU seconds served\");\n\t\t}", "private void aggregateStats() {\n\t\tfor (Map.Entry<Integer, ProcStats> entry : procStats.entrySet()) {\n\t\t\tfor (Map.Entry<Instant, Instant> startEndPair : entry.getValue().csStartAndEndTime)\n\t\t\t\taggStats.add(new HashMap.SimpleEntry(entry.getKey(), startEndPair));\n\t\t\ttotalWaitTime += entry.getValue().waitTime;\n\t\t\tnTotalReceived += entry.getValue().nReceived;\n\t\t\tnTotalSent += entry.getValue().nSent;\n\t\t}\n\t\tCollections.sort(aggStats, new SortByStartTime());\n\t\tint nTotalCS = aggStats.size();\n\t\tSystem.out.println(String.format(\"Total no. of CSs executed : %d\", nTotalCS));\n\t\tfor (Map.Entry<Integer, Map.Entry<Instant, Instant>> entry : aggStats)\n\t\t\tSystem.out.println(entry);\n\t\t\n\t\tfor (int i = 1; i < aggStats.size(); i++)\n\t\t\ttotalSyncDelay += Duration.between(aggStats.get(i - 1).getValue().getValue(), aggStats.get(i).getValue().getKey()).toNanos();\n\t\t\n\t\tSystem.out.println(String.format(\"\\nTotal synchronization delay in nanoseconds : %d\", totalSyncDelay));\n\t\tSystem.out.println(String.format(\"Average synchronization delay in nanoseconds : %f\\n\", (double)totalSyncDelay/(double)(nTotalCS - 1)));\n\t\t\n\t\tSystem.out.println(String.format(\"\\nTotal wait time in milliseconds : %d\", totalWaitTime));\n\t\tSystem.out.println(String.format(\"Average wait time in milliseconds : %f\\n\", (double)totalWaitTime/(double)nTotalCS));\n\t\t\n\t\tSystem.out.println(String.format(\"Total messages received : %d\", nTotalReceived));\n\t\tSystem.out.println(String.format(\"Average messages received : %f\\n\", (double)nTotalReceived/(double)nTotalCS));\n\t\t\n\t\tSystem.out.println(String.format(\"Total messages sent : %d\", nTotalSent));\n\t\tSystem.out.println(String.format(\"Average messages sent : %f\\n\", (double)nTotalSent/(double)nTotalCS));\n\t}", "@Override\n public void makeOutPutData(File file) {\n\n prepareHtmlDataList();\n\n PrintWriter pw = null;\n int cnt = 0;\n\n try {\n pw = new PrintWriter(new FileOutputStream(file, true));\n\n pw.println(\"******************** MainData info ********************\");\n pw.println(\"startLoggingTime : \"\n + ALTHelper\n .DateToString(ALTHelper\n .getTimeStartedBefore(1000)));\n pw.println(\"endLoggingTime : \"\n + ALTHelper\n .DateToString(ALTHelper\n .getTimeLaunched()));\n\n pw.println(\"\");\n\n pw.println(\"******************** Launched info ********************\");\n\n // should implement\n\n pw.println(\"\");\n\n pw.println(\"******************** gc info (top5) sorted by total_time ********************\");\n\n // -----------------------\n\n pw.println(String.format(\"%-20s\", \"time\")\n + String.format(\"%-10s\", \"PID\")\n + String.format(\"%-15s\", \"GC_cause\")\n + String.format(\"%-12s\", \"freedObject\")\n + String.format(\"%-10s\", \"freedByte\")\n + String.format(\"%-13s\", \"freedLObject\")\n + String.format(\"%-11s\", \"freedLByte\")\n + String.format(\"%-13s\", \"percent_free\")\n + String.format(\"%-18s\", \"current_heap_size\")\n + String.format(\"%-13s\", \"total_memory\")\n + String.format(\"%-11s\", \"pause_time\")\n + String.format(\"%-11s\", \"Total_time\"));\n\n ArrayList<GCData> totalTimeList = (ArrayList<GCData>)getGCDataList()\n .clone();\n Collections.sort(totalTimeList, new GCDataComparator(\n GCDataComparator.DataSortType.TOTAL_TIME));\n\n for (GCData gc : totalTimeList) {\n\n if (cnt >= 5)\n break;\n\n pw.println(String.format(\"%-20s\",\n ALTHelper.DateToString(gc.valutOfdate))\n + String.format(\"%-10s\", gc.PID)\n + String.format(\"%-15s\", gc.GC_cause)\n + String.format(\"%-12s\", gc.freedObject)\n + String.format(\"%-10s\", gc.freedByte)\n + String.format(\"%-13s\", gc.freedLObject)\n + String.format(\"%-11s\", gc.freedLByte)\n + String.format(\"%-13s\", gc.percent_free)\n + String.format(\"%-18s\", gc.current_heap_size)\n + String.format(\"%-13s\", gc.total_memory)\n + String.format(\"%-11s\", gc.pause_time)\n + String.format(\"%-11s\", gc.Total_time));\n cnt++;\n }\n\n pw.println(\"\");\n\n // -----------------------\n\n pw.println(\"******************** gc info sorted by date ********************\");\n\n pw.println(String.format(\"GC Total count : %5s\", getGCDataList()\n .size() + \" times\"));\n\n pw.println(String.format(\"%-20s\", \"time\")\n + String.format(\"%-10s\", \"processName\")\n + String.format(\"%-15s\", \"GC_cause\")\n + String.format(\"%-12s\", \"freedObject\")\n + String.format(\"%-10s\", \"freedByte\")\n + String.format(\"%-13s\", \"freedLObject\")\n + String.format(\"%-11s\", \"freedLByte\")\n + String.format(\"%-13s\", \"percent_free\")\n + String.format(\"%-18s\", \"current_heap_size\")\n + String.format(\"%-13s\", \"total_memory\")\n + String.format(\"%-11s\", \"pause_time\")\n + String.format(\"%-11s\", \"Total_time\"));\n\n for (GCData gc : getGCDataList()) {\n pw.println(String.format(\"%-20s\",\n ALTHelper.DateToString(gc.valutOfdate))\n + String.format(\"%-10s\", gc.PID)\n + String.format(\"%-15s\", gc.GC_cause)\n + String.format(\"%-12s\", gc.freedObject)\n + String.format(\"%-10s\", gc.freedByte)\n + String.format(\"%-13s\", gc.freedLObject)\n + String.format(\"%-11s\", gc.freedLByte)\n + String.format(\"%-13s\", gc.percent_free)\n + String.format(\"%-18s\", gc.current_heap_size)\n + String.format(\"%-13s\", gc.total_memory)\n + String.format(\"%-11s\", gc.pause_time)\n + String.format(\"%-11s\", gc.Total_time));\n }\n pw.println(\"\");\n\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n } finally {\n if (pw != null)\n pw.close();\n }\n }", "@Override\n public String getSummary() {\n return super.getSummary() + SYMBOL_SEPARATOR + getTimingString();\n }", "private void setStats()\r\n {\r\n solutionText.setText(\"Solution Length: \"\r\n + Integer.toString(problem.getSolutionLength())\r\n + \"\\n# Queue Ops: \" + Integer.toString(problem.getQueueOps())\r\n + \"\\nMaxQueueSize: \" + Integer.toString(problem.getMaxQueueSize())\r\n //+ \"\\nOpen Discoveries: \" + Integer.toString(problem.getOR())\r\n //+ \"\\nClosed Discoveries: \" + Integer.toString(problem.getCR())\r\n );\r\n\r\n // resize\r\n solutionText.setFont(new Font(Font.SANS_SERIF, Font.BOLD | Font.ITALIC, 12));\r\n solutionText.setPreferredSize(\r\n new Dimension(calculateTextWidth(solutionText.getText().split(\"\\\\n\"),\r\n solutionText.getFontMetrics(solutionText.getFont())) + 60,\r\n calculateTextHeight(solutionText.getText().split(\"\\\\n\"),\r\n solutionText.getFontMetrics(solutionText.getFont()))));\r\n solutionLabel.setPreferredSize(new Dimension(solutionText.getPreferredSize().width,\r\n solutionText.getPreferredSize().height + solutionLabel.getIconTextGap() * 2));\r\n }", "private void createTimeLabel(WritableSheet sheet)\n throws WriteException {\n WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);\n // Define the cell format\n times = new WritableCellFormat(times10pt);\n // Lets automatically wrap the cells\n times.setWrap(true);\n\n // create create a bold font with unterlines\n WritableFont times10ptBoldUnderline = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false,\n UnderlineStyle.SINGLE);\n timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);\n // Lets automatically wrap the cells\n timesBoldUnderline.setWrap(true);\n\n CellView cv = new CellView();\n cv.setFormat(times);\n cv.setFormat(timesBoldUnderline);\n cv.setAutosize(true);\n\n // Write a few headers\n addCaption(sheet, 0, 0, \"File\");\n addCaption(sheet, 1, 0, \"Time\");\n\n }", "@Override\n public void report() {\n\n try {\n File mFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/metrics.txt\");\n File eFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/latency_throughput.txt\");\n if (!mFile.exists()) {\n mFile.createNewFile();\n }\n if (!eFile.exists()) {\n eFile.createNewFile();\n }\n\n FileOutputStream mFileOut = new FileOutputStream(mFile, true);\n FileOutputStream eFileOut = new FileOutputStream(eFile, true);\n\n StringBuilder builder = new StringBuilder((int) (this.previousSize * 1.1D));\n StringBuilder eBuilder = new StringBuilder((int) (this.previousSize * 1.1D));\n\n// Instant now = Instant.now();\n LocalDateTime now = LocalDateTime.now();\n\n builder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n eBuilder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n\n builder.append(lineSeparator).append(\"---------- Counters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- records counter ----------\").append(lineSeparator);\n for (Map.Entry metric : counters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n if (( (String)metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Gauges ----------\").append(lineSeparator);\n for (Map.Entry metric : gauges.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Gauge) metric.getKey()).getValue()).append(lineSeparator);\n }\n\n builder.append(lineSeparator).append(\"---------- Meters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- throughput ----------\").append(lineSeparator);\n for (Map.Entry metric : meters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n if (((String) metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Histograms ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- lantency ----------\").append(lineSeparator);\n for (Map.Entry metric : histograms.entrySet()) {\n HistogramStatistics stats = ((Histogram) metric.getKey()).getStatistics();\n builder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n eBuilder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n }\n\n mFileOut.write(builder.toString().getBytes());\n eFileOut.write(eBuilder.toString().getBytes());\n mFileOut.flush();\n eFileOut.flush();\n mFileOut.close();\n eFileOut.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "public void printRuntimes() {\n\t\tfor(long x: runtimes){\n\t\t\tSystem.out.println(\"run with time \"+x+\" nanoseconds\");\n\t\t}\t\n\t}", "@Override\n\tpublic String genResult() {\n\t\tCollections.sort(meanTimes, new Comparator<Time>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(Time a, Time b) {\n\t\t\t\treturn a.toString().compareTo(b.toString());\n\t\t\t}\n\t\t});\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(realLaps()).append(\"; \");\n\t\tsb.append(totalTime()).append(\"; \");\n\t\tLinkedList<Time> times = new LinkedList<>();\n\t\tif(!startTimes.isEmpty()) times.add(startTimes.getFirst());\n\t\tfor(Time t: meanTimes) times.addLast(t);\n\t\tif(!finishTimes.isEmpty()) times.addLast(finishTimes.getFirst());\n\t\tint i = 0;\n\t\tif(startTimes.isEmpty()) {\n\t\t\ti++;\n\t\t\tsb.append(\"; \");\n\t\t}\n\t\tfor (; i < maxLaps; i++) {\n\t\t\tif (times.size() > 1) {\n\t\t\t\tTime t = times.removeFirst();\n\t\t\t\tsb.append(Time.diff(times.getFirst(), t).toString());\n\t\t\t}\n\t\t\tsb.append(\"; \");\n\t\t}\n\t\tString out = sb.toString();\n\t\treturn out.substring(0, out.length() - 2);\n\n\t}", "public static void main(String[] args) {\n\n System.out.println(\"Numbers of seconds in a year: \" + (60 * 60 * 24 * 365));\n System.out.println(\"Numbers of birth per year: \" + (31536000 / 7.0));\n System.out.println(\"Numbers of death per year: \" + (31536000 / 13.0));\n System.out.println(\"Numbers of immigrants per year: \" + (31536000 / 45.0));\n\n System.out.println(\"Year\\t\\t\\tPopulation\" +\n \"\\n0\\t\\t\\t\\t312032486\" +\n \"\\n1\\t\\t\\t\\t\" + (312032486 + 4505142.857142857 - 2425846.153846154 + 700800.0) +\n \"\\n2\\t\\t\\t\\t\" + (3.148125827032967E8 + 4505142.857142857 - 2425846.153846154 + 700800.0) +\n \"\\n3\\t\\t\\t\\t\" + (3.1759267940659344E8 + 4505142.857142857 - 2425846.153846154 + 700800.0) +\n \"\\n4\\t\\t\\t\\t\" + (3.2037277610989016E8 + 4505142.857142857 - 2425846.153846154 + 700800.0) +\n \"\\n5\\t\\t\\t\\t\" + (3.231528728131869E8 + 4505142.857142857 - 2425846.153846154 + 700800.0)\n );\n }", "private void statsOutput(long startTime, long endTime ,Stat stat, int taskSize, List<Stat> listStat) {\n\n System.out.println();\n System.out.println(\" !!! END OF REQUEST !!!\");\n System.out.println();\n System.out.println(\"----------------------------------\");\n System.out.println(\" STATISTICS\");\n System.out.println(\"----------------------------------\");\n System.out.println(\"1. Number of threads: \" + taskSize);\n System.out.println(\"2. Total run time: \" + (endTime - startTime));\n System.out.println(\"3. Total request sent: \" + stat.getSentRequestsNum());\n System.out.println(\"4. Total successful request: \" + stat.getSuccessRequestsNum());\n System.out.println(\"5. Mean latency: \" + stat.getMeanLatency());\n System.out.println(\"6. Median latency: \" + stat.getMedianLatency());\n System.out.println(\"7. 95th percentile latency: \" + stat.get95thLatency());\n System.out.println(\"8. 99th percentile latency: \" + stat.get99thLatency());\n\n if(listStat!=null){\n OutputChart outputChart = new OutputChart(listStat);\n outputChart.generateChart(\"Part 1\");\n }\n\n }", "private void checkPaintMeasures() {\r\n\t\t\r\n\t\t//Check from change\r\n\t\tint sizeNow = fontSize;\r\n\t\tif(sizeNow == sizeThen)return;\r\n\t\tsizeThen = sizeNow;\r\n\t\t\r\n\t\t//Set units\r\n\t\tmarkWidth = (double) sizeNow / 15;\r\n\t\tsizePaintLength = p.textLength(text, surface, sizeNow, bold, italic);\r\n\t\tif (viewPaintLength != viewPaintLength) viewPaintLength = sizePaintLength;\r\n\t}", "private void updateTable()\n\t{\n\t\ttable = new StringBuilder(String.format(\"%-7s %-30s %-30s %-5s\\n\", \"Song#\", \"Title\", \"Artist\", \"Time\"));\n\t\tdouble time = 0.0;\n\t\tfor(int i = 0; i < numOfSongs; i++)\n\t\t{\n\t\t\ttime = (double)song[i].getMinLength() + (song[i].getSecLength()/100.0); \n\t\t\ttable.append(String.format(\"%-7d %-30s %-30s %-5s\", (i+1), song[i].getTitle(), song[i].getArtist(), time));\n\t\t\tif(i < (numOfSongs-1))\n\t\t\t\ttable.append(\"\\n\");\n\t\t}\n\t}", "public static void tstatSheet(){\n\t\tSystem.out.println(\"\\tStats\");\n\t\tSystem.out.println(\"--------------------------\");\n\t\tSystem.out.println(\"Strength - \" + tstr + \"\\tMagic Power - \" + tmag);\n\t\tSystem.out.println(\"Luck - \" + tluc + \" \\tAccuaracy - \" + tacc);\n\t\tSystem.out.println(\"Defense - \" + tdef + \" \\tSpeed - \" + tspe);\n\t\tSystem.out.println(\"Health - \" + tHP + \" \\tMystic Energy - \" + tMP);\n\t}", "public String printActivityPatterns()\n\t{\n\t\tStringBuilder toReturn = new StringBuilder();\n\n\t\ttoReturn.append(\"ACTIVITY PATTERNS\\n\");\n\t\ttoReturn.append(\" Activity in one-hour segments - Species (Number of pictures in one hour segments/Total number of pics)\\n\");\n\n\t\tfor (Species species : analysis.getAllImageSpecies())\n\t\t{\n\t\t\tStringBuilder toAdd = new StringBuilder();\n\t\t\tList<ImageEntry> imagesWithSpecies = new ImageQuery().speciesOnly(species).query(analysis.getImagesSortedByDate());\n\t\t\tInteger totalImages = imagesWithSpecies.size();\n\t\t\t// Activity / All\n\t\t\ttoAdd.append(\" All months Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec\\n\");\n\t\t\ttoAdd.append(\" Hour Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency Number Frequency\\n\");\n\n\t\t\tint[] totals = new int[13];\n\t\t\tint[] totalActivities = new int[13];\n\n\t\t\t// 12 months + all months\n\t\t\tfor (int i = -1; i < 12; i++)\n\t\t\t{\n\t\t\t\tInteger activity;\n\t\t\t\t// -1 = all months\n\t\t\t\tif (i == -1)\n\t\t\t\t\tactivity = analysis.activityForImageList(imagesWithSpecies);\n\t\t\t\telse\n\t\t\t\t\tactivity = analysis.activityForImageList(new ImageQuery().monthOnly(i).query(imagesWithSpecies));\n\t\t\t\ttotalActivities[i + 1] = activity;\n\t\t\t}\n\n\t\t\t// 24 hrs\n\t\t\tfor (int i = 0; i < 24; i++)\n\t\t\t{\n\t\t\t\tList<ImageEntry> imagesWithSpeciesAtTime = new ImageQuery().timeFrame(i, i + 1).query(imagesWithSpecies);\n\t\t\t\ttoAdd.append(String.format(\"%02d:00-%02d:00 \", i, i + 1));\n\t\t\t\t// 12 months\n\t\t\t\tfor (int j = -1; j < 12; j++)\n\t\t\t\t{\n\t\t\t\t\tInteger activity;\n\t\t\t\t\t// -1 = all months\n\t\t\t\t\tif (j == -1)\n\t\t\t\t\t\tactivity = analysis.activityForImageList(imagesWithSpeciesAtTime);\n\t\t\t\t\telse\n\t\t\t\t\t\tactivity = analysis.activityForImageList(new ImageQuery().monthOnly(j).query(imagesWithSpeciesAtTime));\n\n\t\t\t\t\tif (activity != 0)\n\t\t\t\t\t\ttoAdd.append(String.format(\"%6d %10.3f\", activity, (double) activity / totalActivities[j + 1]));\n\t\t\t\t\telse\n\t\t\t\t\t\ttoAdd.append(\" \");\n\t\t\t\t\ttotals[j + 1] = totals[j + 1] + activity;\n\t\t\t\t}\n\t\t\t\ttoAdd.append(\"\\n\");\n\t\t\t}\n\n\t\t\ttoAdd.append(\"Total \");\n\n\t\t\tfor (int total : totals) toAdd.append(String.format(\"%6d 100.000\", total));\n\n\t\t\ttoAdd.append(\"\\n\");\n\n\t\t\t// Print the header first\n\t\t\ttoReturn.append(String.format(\"%-28s (%6d/ %6d)\\n\", species.getName(), totals[0], totalImages));\n\n\t\t\ttoReturn.append(toAdd);\n\n\t\t\ttoReturn.append(\"\\n\");\n\t\t}\n\n\t\treturn toReturn.toString();\n\t}", "private void createTimeLabel(WritableSheet sheet, int number)\n throws WriteException {\n WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);\n // Define the cell format\n times = new WritableCellFormat(times10pt);\n // Lets automatically wrap the cells\n times.setWrap(true);\n\n // create create a bold font with unterlines\n WritableFont times10ptBoldUnderline = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false,\n UnderlineStyle.SINGLE);\n timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);\n // Lets automatically wrap the cells\n timesBoldUnderline.setWrap(true);\n\n CellView cv = new CellView();\n cv.setFormat(times);\n cv.setFormat(timesBoldUnderline);\n cv.setAutosize(true);\n\n // Write a few headers\n addCaption(sheet, 0, 0, \"File\");\n for (int index = 0; index < number; index++) {\n if (number == 1) {\n addCaption(sheet, index + 1, 0, \"Time\");\n } else {\n addCaption(sheet, index + 1, 0, \"Time \" + index);\n }\n }\n\n }", "public void testSummaryStatsPartialLog() {\n\n // TODO: Create File in platform independent way.\n File testFile = new File(\"src/test/data/dataset98.txt\");\n GcManager gcManager = new GcManager();\n File preprocessedFile = gcManager.preprocess(testFile, null);\n gcManager.store(preprocessedFile, false);\n JvmRun jvmRun = gcManager.getJvmRun(new Jvm(null, null), Constants.DEFAULT_BOTTLENECK_THROUGHPUT_THRESHOLD);\n Assert.assertEquals(\"GC event type count not correct.\", 2, jvmRun.getEventTypes().size());\n Assert.assertEquals(\"GC blocking event count not correct.\", 2, jvmRun.getBlockingEventCount());\n Assert.assertEquals(\"GC pause total not correct.\", 61, jvmRun.getTotalGcPause());\n Assert.assertEquals(\"GC first timestamp not correct.\", 1002192, jvmRun.getFirstGcEvent().getTimestamp());\n Assert.assertEquals(\"GC last timestamp not correct.\", 1002847, jvmRun.getLastGcEvent().getTimestamp());\n Assert.assertEquals(\"GC last duration not correct.\", 41, jvmRun.getLastGcEvent().getDuration());\n Assert.assertEquals(\"Stopped Time event count not correct.\", 6, jvmRun.getStoppedTimeEventCount());\n Assert.assertEquals(\"Stopped time total not correct.\", 1064, jvmRun.getTotalStoppedTime());\n Assert.assertEquals(\"Stopped first timestamp not correct.\", 1000964,\n jvmRun.getFirstStoppedEvent().getTimestamp());\n Assert.assertEquals(\"Stopped last timestamp not correct.\", 1003884,\n jvmRun.getLastStoppedEvent().getTimestamp());\n Assert.assertEquals(\"Stopped last duration not correct.\", 1000688, jvmRun.getLastStoppedEvent().getDuration());\n Assert.assertEquals(\"JVM first event timestamp not correct.\", 1000964, jvmRun.getFirstEvent().getTimestamp());\n Assert.assertEquals(\"JVM last event timestamp not correct.\", 1003884, jvmRun.getLastEvent().getTimestamp());\n Assert.assertEquals(\"JVM run duration not correct.\", 3920, jvmRun.getJvmRunDuration());\n Assert.assertEquals(\"GC throughput not correct.\", 98, jvmRun.getGcThroughput());\n Assert.assertEquals(\"Stopped time throughput not correct.\", 73, jvmRun.getStoppedTimeThroughput());\n Assert.assertTrue(Analysis.WARN_GC_STOPPED_RATIO + \" analysis not identified.\",\n jvmRun.getAnalysis().contains(Analysis.WARN_GC_STOPPED_RATIO));\n }", "public abstract void setTotalRunTime();", "public static void print(ArrayList<Process> processes, int firstProcessTime, int lastProcessTime){\r\n\t\tprocesses = sortProcessId(processes);\r\n\t\tdouble avgWaitTime = 0;\r\n\t\tdouble avgTurnAroundTime = 0;\r\n\t\t\r\n\t\t\r\n\t\tSystem.out.println(\"+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+\");\r\n\t\tSystem.out.println(\"| Process ID | Arrival Time | Burst Time | Priority | Waiting Time | Turn-Around Time| End Time |\");\r\n\t\tSystem.out.println(\"+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+\");\t\t\r\n\t\t//loop that prints cells and align them to center\r\n\t\t\t\r\n\t for(Process process : processes){\r\n\t \tSystem.out.print(String.format(\"%s%17s%s\",\"|\",center(process.getId()),\"|\"));\r\n\t \tSystem.out.print(String.format(\"%17s%s\",center(process.getArrivalTime()),\"|\"));\r\n\t \tSystem.out.print(String.format(\"%17s%s\",center(process.getDecBurstTime()),\"|\"));\r\n\t \tSystem.out.print(String.format(\"%17s%s\",center(process.getPriorityNum()),\"|\"));\r\n\t \tSystem.out.print(String.format(\"%17s%s\",center(process.getWaitingTime()),\"|\"));\r\n\t \tSystem.out.print(String.format(\"%17s%s\",center(process.getTurnaroundTime()),\"|\"));\r\n\t \tSystem.out.print(String.format(\"%17s%s\",center(process.getEndTime()),\"|\\n\"));\r\n\t \t//get the total waiting time and turn around time\r\n\t \tavgWaitTime += process.getWaitingTime();\r\n\t \tavgTurnAroundTime += process.getTurnaroundTime();\r\n\t }\r\n\t //divide by # of processes\r\n\t avgWaitTime = (double)Math.round((avgWaitTime/processes.size())*1000)/1000;\r\n\t avgTurnAroundTime = (double)Math.round((avgTurnAroundTime/processes.size()) * 1000)/1000;\r\n\t \r\n\t System.out.println(\"+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+\");\r\n\t System.out.println(\"| Average | -- | -- | -- |\" + String.format(\"%17s\", center(avgWaitTime)) + \"|\" + String.format(\"%17s\", center(avgTurnAroundTime)) + \"| -- |\");\r\n\t System.out.println(\"+-----------------+-----------------+-----------------------------------+-----------------+-----------------+-----------------+\");\r\n\t System.out.println(String.format(\"%-108s%s\",\"| Throughput: | \" + processes.size() + \"/\" + (lastProcessTime - firstProcessTime) + \r\n\t\t\t\t\" (\" + (double)processes.size()/(lastProcessTime - firstProcessTime) + \")\", \" |\"));\r\n\t System.out.println(\"+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+-----------------+\");\r\n\t}", "private static void getStat(){\n\t\tfor(int key : Initial_sequences.keySet()){\n\t\t\tint tmNo = Initial_sequences.get(key);\n\t\t\tif (tmNo > 13){\n\t\t\t\ttmInitLarge ++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(tmInit.containsKey(tmNo)){\n\t\t\t\t\tint temp = tmInit.get(tmNo);\n\t\t\t\t\ttemp++;\n\t\t\t\t\ttmInit.put(tmNo, temp);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttmInit.put(tmNo, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Go through all the proteins in SC\n\t\tfor(int key : SC_sequences.keySet()){\n\t\t\tint tmNo = SC_sequences.get(key);\n\t\t\t\n\t\t\tint loop = Loop_lengths.get(key);\n\t\t\tint tmLen = TM_lengths.get(key);\n\t\t\t\n\t\t\tLoopTotalLen = LoopTotalLen + loop;\n\t\t\tTMTotalLen = TMTotalLen + tmLen;\n\t\t\t\n\t\t\t\n\t\t\tif (tmNo > 13){\n\t\t\t\ttmSCLarge ++;\n\t\t\t\tLoopLargeLen = LoopLargeLen + loop;\n\t\t\t\tTMLargeLen = TMLargeLen + tmLen;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(tmSC.containsKey(tmNo)){\n\t\t\t\t\tint temp = tmSC.get(tmNo);\n\t\t\t\t\ttemp++;\n\t\t\t\t\ttmSC.put(tmNo, temp);\n\t\t\t\t\t\n\t\t\t\t\tint looptemp = Loop_SC.get(tmNo);\n\t\t\t\t\tlooptemp = looptemp + loop;\n\t\t\t\t\tLoop_SC.put(tmNo, looptemp);\n\t\t\t\t\t\n\t\t\t\t\tint tmlenTemp = TM_len_SC.get(tmNo);\n\t\t\t\t\ttmlenTemp = tmlenTemp + tmLen;\n\t\t\t\t\tTM_len_SC.put(tmNo, tmlenTemp);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttmSC.put(tmNo, 1);\n\t\t\t\t\t\n\t\t\t\t\tLoop_SC.put(tmNo, 1);\n\t\t\t\t\tTM_len_SC.put(tmNo, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void timeStats(String identity, long time, String revisionRef, PrintWriter out) {\n\t\t\n\t\tif (timeDiffHigh / 1000 / 60 < 1){\n\t\t\tSystem.out.println(identity + \" Time Between Revisions: \" + time / 1000 + \" seconds between Revisions \" + revisionRef);\n\t\t\tout.println(identity + \" Time Between Revisions: \" + time / 1000 + \" seconds between Revisions \" + revisionRef);\n\t\t}\n\t\t\n\t\telse if (timeDiffHigh/1000 / 60 / 60 < 1){\n\t\t\tSystem.out.println(identity + \" Time Between Revisions: \" + time / 1000 / 60 + \" minutes between Revisions \" + revisionRef);\n\t\t\tout.println(identity + \" Time Between Revisions: \" + time / 1000 / 60 + \" minutes between Revisions \" + revisionRef);\n\t\t}\n\t\t\n\t\telse if (timeDiffHigh / 1000 / 60 / 60 < 1000) {\n\t\t\tSystem.out.println(identity + \" Time Between Revisions: \" + time / 1000 / 60 / 60 + \" hours between Revisions \" + revisionRef);\n\t\t\tout.println(identity + \" Time Between Revisions: \" + time / 1000 / 60 / 60 + \" hours between Revisions \" + revisionRef);\n\t\t}\n\t\t\n\t\telse {\n\t\t\tSystem.out.println(identity + \" Time Between Revisions: \" + time/ 1000 / 60 / 60 / 24 + \" days between Revisions \" + revisionRef);\n\t\t\tout.println(identity + \" Time Between Revisions: \" + time / 1000 / 60 / 60 / 24 + \" days between Revisions \" + revisionRef);\n\t\t}\n\t}", "@Override\n\tpublic void process(JCas jcas) throws AnalysisEngineProcessException {\n\t\t@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n\t\tAnnotationIndex<Annotation> sentIndex = jcas\n\t\t\t\t.getAnnotationIndex(Sentence.type);\n\t\tAnnotationIndex<Annotation> timeIndex = jcas\n\t\t\t\t.getAnnotationIndex(Timex3.type);\n\t\tAnnotationIndex<Annotation> tokenIndex = jcas\n\t\t\t\t.getAnnotationIndex(Token.type);\n\n\t\tboolean addTimespan = false;\n\n\t\t// for every sentence\n\t\tfor (Annotation an : sentIndex) {\n\t\t\tSentence sent = (Sentence) an;\n\t\t\tint sentBegin = sent.getBegin();\n\t\t\tint sentEnd = sent.getEnd();\n\n\t\t\tFSIterator<Annotation> timeIter = timeIndex.subiterator(sent);\n\t\t\t// save begins and ends of all timex tokens adjust index to sentence\n\t\t\tArrayList<Integer> begins = new ArrayList<Integer>();\n\t\t\tArrayList<Integer> ends = new ArrayList<Integer>();\n\t\t\tArrayList<Timex3> timexs = new ArrayList<Timex3>();\n\t\t\t// get all timex annot. that are no durations like 6 minutes\n\t\t\twhile (timeIter.hasNext()) {\n\t\t\t\tTimex3 time = (Timex3) timeIter.next();\n\t\t\t\tif (!time.getTimexType().equals(\"DURATION\")) {\n\t\t\t\t\ttimexs.add(time);\n\t\t\t\t\t// begins.add(time.getBegin());// - sentBegin);\n\t\t\t\t\t// ends.add(time.getEnd());// - sentBegin);\n\n\t\t\t\t}\n\t\t\t\t// //System.out.println(sent.getCoveredText());\n\t\t\t}\n\n\t\t\t// if at least 2 found check text between timex expressions\n\t\t\tint timexCount = timexs.size();\n\t\t\tint interval;\n\t\t\tint begin1, end1, begin2, end2;\n\t\t\tif (timexCount >= 2) {\n\t\t\t\t// TODO change if direct access to sents of jcas per id is\n\t\t\t\t// possible\n\t\t\t\tString docText = jcas.getDocumentText(); // .getCoveredText();\n\t\t\t\tfor (int i = 0; i < timexCount - 1; i++) {\n\t\t\t\t\t// get postitons of timexs and scale to sentence\n\t\t\t\t\tbegin1 = timexs.get(i).getBegin() - sentBegin;\n\t\t\t\t\tbegin2 = timexs.get(i + 1).getBegin() - sentBegin;\n\t\t\t\t\t;\n\t\t\t\t\tend1 = timexs.get(i).getEnd() - sentBegin;\n\t\t\t\t\t;\n\t\t\t\t\tend2 = timexs.get(i + 1).getEnd() - sentBegin;\n\t\t\t\t\t;\n\t\t\t\t\t// //System.out.println(begins.get(i) + \" \" + ends.get(i +\n\t\t\t\t\t// 1) + \" \" +\n\t\t\t\t\t// sentBegin + \" \"+ sent.getEnd());\n\t\t\t\t\t// interval = begins.get(i + 1) - ends.get(i);\n\t\t\t\t\t// only cut text if interval under max length\n\t\t\t\t\tinterval = begin2 - end1;\n\t\t\t\t\tif (interval < 10 && interval > 0) {\n\t\t\t\t\t\tString sentText = sent.getCoveredText();\n\t\t\t\t\t\t// String betweenText = docText.substring(ends.get(i),\n\t\t\t\t\t\t// begins.get(i\n\t\t\t\t\t\t// + 1));\n\t\t\t\t\t\t// get text between timex expr. and removes surrounding\n\t\t\t\t\t\t// whitespace\n\t\t\t\t\t\t// String betweenText = docText.substring(end1,\n\t\t\t\t\t\t// begin2).trim();\n\t\t\t\t\t\tString betweenText = sentText.substring(end1, begin2)\n\t\t\t\t\t\t\t\t.trim();\n\n\t\t\t\t\t\t// System.out.println(betweenText);\n\t\t\t\t\t\t// String output = \"\";\n\t\t\t\t\t\t// output += \"|#\" + betweenText + \"#\" +\n\t\t\t\t\t\t// sentText.substring(begin1, end2) + \" ##\"\n\t\t\t\t\t\t// + sentText.substring(begin1, end1) + \"|\" +\n\t\t\t\t\t\t// sentText.substring(begin2, end2) + \"||\";\n\t\t\t\t\t\t// TODO make check nicer not or but set\n\t\t\t\t\t\tif (betweenText.equals(\"-\") || betweenText.equals(\"to\")\n\t\t\t\t\t\t\t\t|| betweenText.equals(\"through\")) {\n\t\t\t\t\t\t\taddTimespan = true;\n\t\t\t\t\t\t\t// System.out.println(\"Found to or - \");\n\t\t\t\t\t\t} else if (betweenText.equals(\"and\")) {\n\t\t\t\t\t\t\t// for 'and' check if 'between' is before first\n\t\t\t\t\t\t\t// timex\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t// System.out.println((begin1 - 8));\n\t\t\t\t\t\t\t\tif (begin1 - 8 >= 0) {\n\t\t\t\t\t\t\t\t\tString preText = sentText\n\t\t\t\t\t\t\t\t\t\t\t.substring(begin1 - 8, begin1)\n\t\t\t\t\t\t\t\t\t\t\t.trim().toLowerCase();\n\t\t\t\t\t\t\t\t\t// System.out.println(\"Pre: \" + preText);\n\t\t\t\t\t\t\t\t\tif (preText.equals(\"between\")) {\n\t\t\t\t\t\t\t\t\t\taddTimespan = true;\n\t\t\t\t\t\t\t\t\t\t// System.out.println(\"Found between and\");\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// System.out.println(\"not Found and: \"\n\t\t\t\t\t\t\t\t\t\t// + preText);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t// System.err.println(\"Cut error\" +\n\t\t\t\t\t\t\t\t// sent.getCoveredText());\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// add new annotation\n\t\t\t\t\t\tif (addTimespan) {\n\t\t\t\t\t\t\tTimespan timespan = new Timespan(jcas);\n\t\t\t\t\t\t\t// set text span\n\t\t\t\t\t\t\ttimespan.setBegin(timexs.get(i).getBegin());\n\t\t\t\t\t\t\ttimespan.setEnd(timexs.get(i + 1).getEnd());\n\t\t\t\t\t\t\t// set times\n\t\t\t\t\t\t\ttimespan.setStartTime(timexs.get(i));\n\t\t\t\t\t\t\ttimespan.setEndTime(timexs.get(i + 1));\n\t\t\t\t\t\t\t// System.out.println(\"ADDED\");\n\t\t\t\t\t\t\ttimespan.addToIndexes(jcas);\n\t\t\t\t\t\t\t// remove timex annotations form jcas\n\t\t\t\t\t\t\ttimexs.get(i).removeFromIndexes(jcas);\n\t\t\t\t\t\t\ttimexs.get(i + 1).removeFromIndexes(jcas);\n\t\t\t\t\t\t\taddTimespan = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// output += sentText;\n\t\t\t\t\t\t// System.out.println(output.replace(\"\\n\", \" \"));\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}", "public void formatoTiempo() {\n String segundos, minutos, hora;\n\n hora = hrs < 10 ? String.valueOf(\"0\" + hrs) : String.valueOf(hrs);\n\n minutos = min < 10 ? String.valueOf(\"0\" + min) : String.valueOf(min);\n\n jLabel3.setText(hora + \" : \" + minutos + \" \" + tarde);\n }", "@Override\n\tpublic void measures() {\n\t\t\n\t\tsetTempo(240);\n\t\t\n\t\tkey = \"G\";\n\t\t\n\t\tmeasure(0);\n\t\t\n\t\taddNote(\"D5q\",A,T);\n\t\t\n\t\taddRest(\"q\",B);\n\t\t\n\t\tmeasure(1);\n\t\t\n\t\taddNotes(\"G5q G5i A5i G5i F5i\",T);\n\t\t\n\t\taddRest(\"q\",B);\n\t\taddNotes(\"B3q G4q\",B);\n\t\t\n\t\tmeasure(2);\n\t\t\n\t\taddNotes(\"E5q E5q E5q\",T);\n\t\t\n\t\taddNotes(\"C4h+E4h\",B);\n\t\taddRest(\"q\",B);\n\t\t\n\t\tmeasure(3);\n\t\t\n\t\taddNotes(\"A5q A5i B5i A5i G5i\",T);\n\t\t\n\t\taddRest(\"q\",B);\n\t\taddNotes(\"C#4q A4q\",B);\n\t\t\n\t\tmeasure(4);\n\t\t\n\t\taddNotes(\"F5q D5q D5q\",T);\n\t\t\n\t\taddNotes(\"D4h+F4h\",B);\n\t\taddRest(\"q\",B);\n\t\t\n\t\tmeasure(5);\n\t\t\n\t\taddNotes(\"B5q B5i C6i B5i A5i\",T);\n\t\t\n\t\taddRest(\"q\",B);\n\t\taddNotes(\"G4q D5q\",B);\n\t\t\n\t\tmeasure(6);\n\t\t\n\t\taddNotes(\"G5q E5q D5i D5i\",T);\n\t\t\n\t\taddNotes(\"C5h+E5h\",B);\n\t\taddRest(\"q\",B);\n\t\t\n\t\tmeasure(7);\n\t\t\n\t\taddNotes(\"E5q A5q F5q\",T);\n\t\t\n\t\taddNotes(\"C5h D5q\",B);\n\t\t\n\t\tmeasure(8);\n\t\t\n\t\taddNotes(\"G5h D5q\",T);\n\t\t\n\t\taddNotes(\"G4h+B4h\",B);\n\t\taddRest(\"q\",B);\n\t\t\n\t\tmeasure(9);\n\t\t\n\t\taddNotes(\"G5q G5q G5q\",T);\n\t\t\n\t\taddNote(\"B4h.\",A,B);\n\t\t\n\t\tmeasure(10);\n\t\t\n\t\taddNotes(\"F5h F5q\",T);\n\t\t\n\t\taddNotes(\"A4h A4q\",B);\n\t\t\n\t\tmeasure(11);\n\t\t\n\t\taddNotes(\"G5q F5q E5q\",T);\n\t\t\n\t\taddNotes(\"B4q A4q G4q\",B);\n\t\t\n\t\tmeasure(12);\n\t\t\n\t\taddNotes(\"D5h A5q\",T);\n\t\t\n\t\taddNotes(\"F4h A4q\",B);\n\t\t\n\t\tmeasure(13);\n\t\t\n\t\taddNotes(\"B5q A5q G5q\",T);\n\t\t\n\t\taddNotes(\"B4q A4q G4q\",B);\n\t\t\n\t\tmeasure(14);\n\t\t\n\t\taddNotes(\"D6q D5q D5i D5i\",T);\n\t\t\n\t\taddNotes(\"D5q D4q\",B);\n\t\taddRest(\"q\",B);\n\t\t\n\t\tmeasure(15);\n\t\t\n\t\taddNotes(\"E5q A5q F5q\",T);\n\t\t\n\t\taddNotes(\"C5h D5q\",B);\n\t\t\n\t\tmeasure(16);\n\t\t\n\t\taddNote(\"G5h\",A,T);\n\t\taddRest(\"q\",T);\n\t\t\n\t\taddNotes(\"G4h+B4h\",B);\n\t\taddRest(\"q\",B);\n\t\t\n\t\tmeasure(17);\n\t}", "void genReport() {\n\n current_part.save_state(); \n\n JTextArea ta = text;\n\n ta.setText(\"\");\n\n if (!t_foil_name.equals(\"Test\"))\n ta.append(\"Hydrofoil: \" + t_foil_name);\n\n java.util.Date date = new java.util.Date();\n ta.append(\"\\n Date: \" + date);\n \n wing.print( \"Main Wing\", ta);\n stab.print( \"Stabilizer Wing\", ta);\n strut.print(\"Mast (a.k.a. Strut)\", ta);\n fuse.print( \"Fuselage\", ta);\n\n ta.append( \"\\n\\n\");\n // tail volume is LAElev * AreaElev / (MACWing * AreaWing)\n // LAElev : The elevator's Lever Arm measured at the wing's and elevator's quarter chord point\n double LAElev = stab.xpos + stab.chord_xoffs + 0.25*stab.chord - (wing.xpos + wing.chord_xoffs + 0.25*wing.chord);\n // MAC : The main wing's Mean Aerodynamic Chord\n // AreaWing : The main wing's area\n // AreaElev : The elevator's area\n \n ta.append( \"\\nTail Voulume: \" + LAElev*stab.span*stab.chord/(wing.chord*wing.chord*wing.span));\n \n\n ta.append( \"\\n\\n\");\n switch (planet) {\n case 0: { \n ta.append( \"\\n Standard Earth Atmosphere\" );\n break;\n }\n case 1: { \n ta.append( \"\\n Martian Atmosphere\" );\n break;\n }\n case 2: { \n ta.append( \"\\n Water\" );\n break;\n }\n case 3: { \n ta.append( \"\\n Specified Conditions\" );\n break;\n }\n case 4: { \n ta.append( \"\\n Specified Conditions\" );\n break;\n }\n }\n\n // ta.append( \"\\n Altitude = \" + filter0(alt_val) );\n // if (lunits == IMPERIAL) ta.append( \" ft ,\" );\n // else /*METRIC*/ ta.append( \" m ,\" );\n \n switch (lunits) {\n case 0: { /* English */\n ta.append( \"\\n Density = \" + filter5(rho_EN) );\n ta.append( \"slug/cu ft\" );\n ta.append( \"\\n Pressure = \" + filter3(ps0/144.) );\n ta.append( \"lb/sq in,\" );\n ta.append( \" Temperature = \" + filter0(ts0 - 460.) );\n ta.append( \"F,\" );\n break;\n }\n case 1: { /* Metric */\n ta.append( \" Density = \" + filter3(rho_EN*515.4) );\n ta.append( \"kg/cu m\" );\n ta.append( \"\\n Pressure = \" + filter3(101.3/14.7*ps0/144.) );\n ta.append( \"kPa,\" );\n ta.append( \" Temperature = \" + filter0(ts0*5.0/9.0 - 273.1) );\n ta.append( \"C,\" );\n break;\n }\n }\n\n ta.append( \"\\n Speed = \" + filter1(velocity * (lunits==IMPERIAL? 0.868976 : 0.539957 )) + \"Kts, or\" );\n ta.append( \" \" + filter1(velocity) );\n if (lunits == IMPERIAL) ta.append( \" mph ,\" );\n else /*METRIC*/ ta.append( \" km/hr ,\" );\n\n // if (out_aux_idx == 1)\n // ta.append( \"\\n Lift Coefficient = \" + filter3(current_part.cl) );\n // if (out_aux_idx == 0) {\n // if (Math.abs(lift) <= 10.0) ta.append( \"\\n Lift = \" + filter3(lift) );\n // if (Math.abs(lift) > 10.0) ta.append( \"\\n Lift = \" + filter0(lift) );\n // if (lunits == IMPERIAL) ta.append( \" lbs \" );\n // else /*METRIC*/ ta.append( \" Newtons \" );\n // }\n // if ( polarOut == 1)\n // ta.append( \"\\n Drag Coefficient = \" + filter3(current_part.cd) );\n // if (out_aux_idx == 0) {\n // ta.append( \"\\n Drag = \" + filter0(drag) );\n // if (lunits == IMPERIAL) ta.append( \" lbs \" );\n // else /*METRIC*/ ta.append( \" Newtons \" );\n // }\n\n ta.append( \"\\n Lift = \" + dash.outTotalLift.getText());\n ta.append( \"\\n Drag = \" + dash.outTotalDrag.getText());\n\n if (min_takeoff_speed_info != null) \n ta.append( \"\\n\\n\" + min_takeoff_speed_info);\n\n if (cruising_info != null) \n ta.append( \"\\n\\n\" + cruising_info);\n\n if (max_speed_info != null) \n ta.append( \"\\n\\n\" + max_speed_info);\n\n // ensure end ta.setCaretPosition(ta.getText().length());\n // ensure start\n ta.setCaretPosition(0);\n }", "private static void printData(List<Long> runningTimes) {\n\t\tlong min = Collections.min(runningTimes);\n\t\tlong max = Collections.max(runningTimes);\n\t\t\n\t\tlong total = 0;\n\t\tfor(long runTime : runningTimes)\n\t\t\ttotal+=runTime;\n\t\t\n\t\tSystem.out.println(\"******* SEQUENTIAL RESULTS *******\");\n\t\tSystem.out.println(\"MIN RUNNING TIME(ms): \"+min);\n\t\tSystem.out.println(\"MAX RUNNING TIME(ms): \"+max);\n\t\tSystem.out.println(\"AVG RUNNING TIME(ms): \"+(total/runningTimes.size()));\n\t\tSystem.out.println(\"***********************************\");\n\t\tSystem.out.println();\n\t}", "@Override\r\n public long problem0(int size) {\r\n System.out.println(\"This is just an example, but please follow this template.\");\r\n String s = \"\";\r\n long start = System.currentTimeMillis();\r\n\r\n for (int i=0; i<size; i++) {\r\n s = s + i;\r\n }\r\n \r\n long end = System.currentTimeMillis();\r\n return end - start;\r\n }", "private void drawTimeLine (Graphics g) {\n g.setColor (parent.parent.parent.rulerColor);\n g.fillRect (0, _yPix - 3 * parent.lineSize, _xPix, 3 * parent.lineSize);\n \n g.setColor (Color.black);\n g.drawLine (0, _yPix - 3 * parent.lineSize, _xPix, _yPix - 3 * parent.lineSize);\n double inchT = parent.getTime (parent.dpi); if (inchT <= 0) return;\n int i = (int)Math.rint (begT / inchT);\n double t = i * inchT;\n while (t < endT) {\n int xcord = i * parent.dpi - parent.getEvtXCord (begT) - \n (int)Math.rint (parent.fm.charWidth ('|') / 2.0);\n \n g.drawString (\"|\", xcord, _yPix - 2 * parent.lineSize - parent.fDescent);\n \n String t1 = (new Float (t)).toString (), t2;\n \n if (t1.indexOf ('E') == -1) {\n\tint index = max;\n\tif (index > t1.length ()) index = t1.length ();\n\tt2 = t1.substring (0, index);\n }\n else {\n\tint exp = t1.indexOf ('E');\n\tString e = t1.substring (exp, t1.length ());\n\t\n\tint si = 5; if (exp < si) si = exp;\n\tString a = t1.substring (0, si);\n\t\n\tt2 = a + e;\n }\n \n g.drawString (t2,\n xcord - (int)Math.rint (parent.fm.stringWidth (t2) / 2.0),\n _yPix - (parent.lineSize + parent.fDescent));\n t = (++i * inchT);\n }\n }", "public static void printTimesTable(int tableSize) {\n System.out.format(\" \");\n for(int i = 1; i<=tableSize;i++ ) {\n System.out.format(\"%4d\",i);\n }\n System.out.println();\n System.out.println(\"--------------------------------------------------------\");\n\n for (int row = 1; row<=tableSize; row++){\n \n System.out.format(\"%4d\",row);\n System.out.print(\" |\");\n \n for (int column = 1; column<=tableSize; column++){\n System.out.format(\"%4d\",column*row);\n }\n System.out.print(\"\\n\");\n }\n\n }", "private void displayTimeInfo(final long startTime, final long endTime) {\n long diff = endTime - startTime;\n long seconds = diff / MSEC_PER_SECOND;\n long millisec = diff % MSEC_PER_SECOND;\n println(\"Time: \" + seconds + \".\" + millisec + \"s\\n\");\n }", "@Override\r\n\tpublic String finalReport() {\r\n\t\tif (ETParser.getLogger() != null) {\r\n\t\t\tETParser.getLogger()\r\n\t\t\t\t\t.getLogger()\r\n\t\t\t\t\t.info((float) multiples.size() / totalObjectsInHeap\r\n\t\t\t\t\t\t\t* PERCENTAGE\r\n\t\t\t\t\t\t\t+ \" % objects were created more than once.\");\r\n\t\t}\r\n\t\treturn (float) multiples.size() / totalObjectsInHeap * PERCENTAGE\r\n\t\t\t\t+ \" % objects were created more than once\";\r\n\t}", "private static void printStats(Stats stats) {\n long elapsedTime = (System.nanoTime() - startTime) / 1000000;\n System.out.println(\"Analysis completed - \" + keyCount + \" keys processed in \" + elapsedTime + \" ms\");\n getConsole().println(\"Analysis completed - \" + keyCount + \" keys processed in \" + elapsedTime + \" ms\");\n stats.print();\n }", "public void printt() {\n for (int i=0 ; i<number ; i++) {\n System.out.println(\"LAB\" + (i+1) + \" ON \" + labs[i].getDay() + \" TEACHING BY: \" + labs[i].getTeacher());\n for (int j=0 ; j<labs[i].getCurrentSize() ; j++) {\n System.out.println(labs[i].getStudents()[j].getFirstName() + \" \" + labs[i].getStudents()[j].getLastName() + \" \" + labs[i].getStudents()[j].getId() + \" \" +labs[i].getStudents()[j].getGrade());\n }\n System.out.println(\"THE CAPACITY OF THE LAB IS: \" + labs[i].getCapacity());\n System.out.println(\"THE AVERAGE IS : \" + labs[i].getAvg());\n System.out.println();\n }\n }", "public void updateTime(){\r\n\t\tBlock selectedBlock = experiment.getBlocking().getSelectedBlockStructure();\r\n\t\testimatedTimeTotal.setText(secondsToString(estimateTime()));\r\n\t\testimatedTimeSubject.setText(secondsToString((long)(estimateTime()/selectedBlock.get(0).getReplications())));\r\n\t}", "private void updateTimes(final String[] args) throws IOException {\r\n final BufferedReader[] bf = new BufferedReader[args.length];\r\n for(int j = 0; j < bf.length; j++)\r\n bf[j] = new BufferedReader(new FileReader(args[j]));\r\n \r\n final int numdb = 10;\r\n final double[] qut = new double[nqueries * numdb];\r\n String l;\r\n int i = 0;\r\n while((l = bf[0].readLine()) != null) {\r\n qut[i++] = Double.parseDouble(l.substring(0, l.indexOf(';')));\r\n }\r\n bf[0].close();\r\n \r\n for(int j = 1; j < bf.length; j++) {\r\n i = 0;\r\n while((l = bf[j].readLine()) != null) {\r\n qut[i] = Math.min(qut[i], Double.parseDouble(l));\r\n i++;\r\n }\r\n bf[j].close();\r\n }\r\n \r\n final double[] tmp = new double[nqueries];\r\n for(int j = 0; j < tmp.length; j++) {\r\n for(int z = 0; z < numdb; z++) {\r\n tmp[j] += qut[j + z * nqueries];\r\n }\r\n }\r\n \r\n final BufferedReader br =\r\n new BufferedReader(new FileReader(SUBMISSION));\r\n final PrintOutput o = new PrintOutput(SUBMISSIONU);\r\n i = 0;\r\n while((l = br.readLine()) != null) {\r\n if(l.contains(\"<topic topic-id=\")) {\r\n final int s = l.indexOf(\"total_time_ms=\\\"\") +\r\n \"total_time_ms=\\\"\".length();\r\n final int e = l.lastIndexOf('\"');\r\n final double ti = Double.parseDouble(l.substring(s, e));\r\n if(ti > tmp[i] || ti == 0) {\r\n o.print(l.substring(0, s) + tmp[i] + l.substring(e));\r\n } else {\r\n o.print(l);\r\n }\r\n i++;\r\n } else o.print(l);\r\n o.print(NL);\n }\r\n br.close();\r\n o.flush();\r\n o.close();\r\n Main.outln(\"Updated\");\r\n }", "@Override\n public void printStatistics(\n PrintStream out, Result result, ReachedSet reached) {\n Preconditions.checkNotNull(out);\n Preconditions.checkNotNull(result);\n // reached set can be NULL\n\n if (analysisTime.isRunning()) {\n analysisTime.stop();\n }\n if (programTime.isRunning()) {\n programTime.stop();\n }\n if (memStats != null) {\n memStatsThread.interrupt(); // stop memory statistics collection\n }\n\n // print CFA statistics\n printCfaStatistics(out);\n\n // print global time statistics\n printTimeStatistics(out);\n\n // print global memory statistics\n printMemoryStatistics(out);\n\n }", "@Test\n public void printApplicationTimePrintTenuringDistribution() throws Exception {\n TestLogHandler handler = new TestLogHandler();\n handler.setLevel(Level.WARNING);\n GCResource gcResource = new GcResourceFile(\"SampleSun1_7_0_02PrintApplicationTimeTenuringDistribution.txt\");\n gcResource.getLogger().addHandler(handler);\n DataReader reader = getDataReader(gcResource);\n GCModel model = reader.read();\n Assert.assertEquals(\"number of events\", 9, model.size());\n Assert.assertEquals(\"number of concurrent events\", 2, model.getConcurrentEventPauses().size());\n GCEvent youngEvent = ((GCEvent) (model.get(0)));\n Assert.assertEquals(\"gc pause (young)\", 0.00784501, youngEvent.getPause(), 1.0E-9);\n Assert.assertEquals(\"heap (young)\", (20 * 1024), youngEvent.getTotal());\n GCEvent partialEvent = ((GCEvent) (model.get(7)));\n Assert.assertEquals(\"gc pause (partial)\", 0.02648319, partialEvent.getPause(), 1.0E-9);\n Assert.assertEquals(\"heap (partial)\", (128 * 1024), partialEvent.getTotal());\n Assert.assertEquals(\"number of errors\", 0, handler.getCount());\n }", "private static void LogOverall() throws IOException {\n\t\tBufferedWriter out;\n\t\tIterator entries = allPatternOne.entrySet().iterator();\n\t\t\n\t\t out = new BufferedWriter(new FileWriter(singlePatternPath+\"allPatternOne.txt\"));\n\t\t int count1 = 0;\n\t\t entries = allPatternOne.entrySet().iterator();\n\t\t\twhile (entries.hasNext()) {\n\t\t\t Map.Entry entry = (Map.Entry) entries.next();\n\t\t\t Integer value = (Integer)entry.getKey();\n\t\t\t HashSet<SequencePair> set = (HashSet<SequencePair>) entry.getValue();\n\t\t\t count1+=set.size();\n\t\t\t out.write(\"!size \" + value + \" \" + set.size() + \"\\n\");\n\t\t\t Iterator itr = set.iterator();\n\t\t\t while(itr.hasNext()) {\n\t\t\t \tSequencePair current = (SequencePair) itr.next();\n\t\t\t \t//System.out.println(\"[\" + current.firstSeq +\":\"+current.secondSeq +\"]\");\n\t\t\t out.write(\"[\" + current.firstSeq +\":\"+current.secondSeq +\"]\"+\"\\n\");\n\t\t\t }\n\t\t\t}\n\t\t\tout.write(\"! total \" + count1);\n\t\t\t//System.out.println(count2);\n\t\t\tif(out!=null)\n\t\t\t\tout.close();\n\t\t\n\t\n\t\t\n\t\t\n\t out = new BufferedWriter(new FileWriter(newSinglePatternPath+\"allPatternTwo.txt\"));\n\t int count2 = 0;\n\t entries = allPatternTwo.entrySet().iterator();\n\t\twhile (entries.hasNext()) {\n\t\t Map.Entry entry = (Map.Entry) entries.next();\n\t\t Integer value = (Integer)entry.getKey();\n\t\t HashSet<SequencePair> set = (HashSet<SequencePair>) entry.getValue();\n\t\t count2+=set.size();\n\t\t out.write(\"!size \" + value + \" \" + set.size() + \"\\n\");\n\t\t Iterator itr = set.iterator();\n\t\t while(itr.hasNext()) {\n\t\t \tSequencePair current = (SequencePair) itr.next();\n\t\t \t\n\t\t out.write(\"[\" + current.firstSeq +\":\"+current.secondSeq +\"]\"+\"\\n\");\n\t\t }\n\t\t}\n\t\tout.write(\"! total \" + count2);\n\t\t//System.out.println(count2);\n\t\tif(out!=null)\n\t\t\tout.close();\n\t\t\n\t\t\n\t}", "public void measure(){\n \tend = System.nanoTime(); \n \tlong elapsedTime = end - start;\n\n \t//convert to seconds \n \tseconds = (double)elapsedTime / 1000000000.0f;\n \tend =0; //歸零\n \tstart =0;\n }", "private void printStats()\n\t{\n\t\t// X\n\t\tSystem.out.println(\"X:\");\n\t\tfor(int i = 0; i < xPosList.size(); i++)\n\t\t{\n\t\t\tSystem.out.println(xPosList.get(i));\n\t\t}\n\n\t\t// Y\n\t\tSystem.out.println(\"Y:\");\n\t\tfor(int i = 0; i < yPosList.size(); i++)\n\t\t{\n\t\t\tSystem.out.println(yPosList.get(i));\n\t\t}\n\n\t\t// Time\n\t\tSystem.out.println(\"Time:\");\n\t\tfor(int i = 0; i < timeList.size(); i++)\n\t\t{\n\t\t\tSystem.out.println(timeList.get(i));\n\t\t}\n\t}", "public String getTotalTime() {\r\n if (recipe != null) {\r\n return readableTime(recipe.getCookTime() + recipe.getPrepTime());\r\n } else {\r\n return \"\";\r\n }\r\n }", "public long getTotalTime() {\n/* 73 */ return this.totalTime;\n/* */ }", "public void testSummaryStatsStoppedTime() {\n File testFile = new File(\"src/test/data/dataset41.txt\");\n GcManager gcManager = new GcManager();\n File preprocessedFile = gcManager.preprocess(testFile, null);\n gcManager.store(preprocessedFile, false);\n JvmRun jvmRun = gcManager.getJvmRun(new Jvm(null, null), Constants.DEFAULT_BOTTLENECK_THROUGHPUT_THRESHOLD);\n Assert.assertTrue(JdkUtil.LogEventType.G1_YOUNG_PAUSE.toString() + \" collector not identified.\",\n jvmRun.getEventTypes().contains(LogEventType.G1_YOUNG_PAUSE));\n Assert.assertTrue(JdkUtil.LogEventType.APPLICATION_STOPPED_TIME.toString() + \" not identified.\",\n jvmRun.getEventTypes().contains(LogEventType.APPLICATION_STOPPED_TIME));\n Assert.assertEquals(\"GC Event count not correct.\", 2, jvmRun.getEventTypes().size());\n Assert.assertEquals(\"GC pause total not correct.\", 61, jvmRun.getTotalGcPause());\n Assert.assertEquals(\"GC first timestamp not correct.\", 2192, jvmRun.getFirstGcEvent().getTimestamp());\n Assert.assertEquals(\"GC last timestamp not correct.\", 2847, jvmRun.getLastGcEvent().getTimestamp());\n Assert.assertEquals(\"GC last duration not correct.\", 41, jvmRun.getLastGcEvent().getDuration());\n Assert.assertEquals(\"Stopped Time event count not correct.\", 6, jvmRun.getStoppedTimeEventCount());\n Assert.assertEquals(\"Stopped time total not correct.\", 1064, jvmRun.getTotalStoppedTime());\n Assert.assertEquals(\"Stopped first timestamp not correct.\", 964, jvmRun.getFirstStoppedEvent().getTimestamp());\n Assert.assertEquals(\"Stopped last timestamp not correct.\", 3884, jvmRun.getLastStoppedEvent().getTimestamp());\n Assert.assertEquals(\"Stopped last duration not correct.\", 1000688, jvmRun.getLastStoppedEvent().getDuration());\n Assert.assertEquals(\"JVM first event timestamp not correct.\", 964, jvmRun.getFirstEvent().getTimestamp());\n Assert.assertEquals(\"JVM last event timestamp not correct.\", 3884, jvmRun.getLastEvent().getTimestamp());\n Assert.assertEquals(\"JVM run duration not correct.\", 4884, jvmRun.getJvmRunDuration());\n Assert.assertEquals(\"GC throughput not correct.\", 99, jvmRun.getGcThroughput());\n Assert.assertEquals(\"Stopped time throughput not correct.\", 78, jvmRun.getStoppedTimeThroughput());\n Assert.assertTrue(Analysis.WARN_GC_STOPPED_RATIO + \" analysis not identified.\",\n jvmRun.getAnalysis().contains(Analysis.WARN_GC_STOPPED_RATIO));\n }", "public static void displaySta() {\n System.out.println(\"\\n\\n\");\n System.out.println(\"average service time: \" + doAvgProcessingTime() /100 + \" milliseconds\");\n System.out.println(\"max service time: \" + maxProcessingTime /100 + \" milliseconds\");\n System.out.println(\"average turn around time \" + doAvgTurnAroundTime()/100 + \" milliseconds\");\n System.out.println(\"max turn around time \" + maxTurnAroundTime/100 + \" milliseconds\");\n System.out.println(\"average wait time \" + doAvgWaitTime()/10000 + \" milliseconds\");\n System.out.println(\"max wait time \" + maxWaitTime/10000 + \" milliseconds\");\n System.out.println(\"end time \" + endProgramTime);\n System.out.println(\"start time \" + startProgramTime);\n System.out.println(\"processor utilization: \" + doCPU_usage() + \" %\");\n System.out.println(\"Throughput: \" + doThroughPut());\n System.out.println(\"---------------------------\");\n\n\n }", "private static void format() {\n\t\tSystem.out.println(\"\\nThe following is a sample input file.\");\n\t\tSystem.out.println(\"-----------------------------------------\");\n\t\tSystem.out.println(\"low\\t\\t\\t // The first line should be the wind speed (low or high\");\n\t\tSystem.out.println(\"Babe:cscow:32.54\\r\\n\" + \n\t\t\t\t\"Renegade:420:38.01\\r\\n\" + \n\t\t\t\t\"Top:xboat:41.20\\r\\n\" + \n\t\t\t\t\"Jeanie-K:xboat:41.35\\r\\n\" + \n\t\t\t\t\"JuiceBox:capri:42.40\\r\\n\" + \n\t\t\t\t\"LadyBug:nj2k:55.40\\r\\n\" + \n\t\t\t\t\"XQ'sMe:xboat:56.58\\r\\n\" + \n\t\t\t\t\"Steve:mcscow:57.29\\r\\n\" + \n\t\t\t\t\"TunaFish:nj2k:60.32\\r\\n\" + \n\t\t\t\t\"NoName:nj2k:67.20\");\n\t\tSystem.out.println(\"-----------------------------------------\");\n\t\tSystem.out.println(\"Each boat entry follows the pattern of name:type:time\");\n\t\tSystem.out.println(\"Boat times should be formatted as mm.ss\");\n\t\tSystem.out.println(\"\\nThe total list of boat types can be seen with the types command.\\n\");\n\t}", "private void printNameWithTimes(Course course, String name, String type) {\n String startTime = \"\";\n String endTime = \"\";\n int[][] selection;\n\n if (type.equals(\"Section\")) {\n selection = course.getSubClassTimes().get(name);\n } else if (type.equals(\"Lab\")) {\n selection = course.getLabTimes().get(name);\n } else {\n selection = course.getTutorialTimes().get(name);\n }\n\n if (selection[0][1] == 0) {\n startTime = String.valueOf(selection[0][0]) + \":00\";\n } else {\n startTime = String.valueOf(selection[0][0]) + \":\" + String.valueOf(selection[0][1]);\n }\n\n if (selection[1][1] == 0) {\n endTime = String.valueOf(selection[1][0]) + \":00\";\n } else {\n endTime = String.valueOf(selection[1][0]) + \":\" + String.valueOf(selection[1][1]);\n }\n\n String days = intsToDays(selection[2]);\n\n System.out.println(\"\\t\" + type + \": \" + name + \"\\t Start: \" + startTime\n + \"\\t End: \" + endTime + \"\\t Days: \" + days);\n }", "String report() {\n StringBuilder sb = new StringBuilder();\n // Header\n for (int i = 0; i < Stat.values().length; i++) {\n if (i > 0) {\n sb.append(\",\");\n }\n sb.append(Stat.values()[i].name);\n }\n // One line per job\n for (JobResult result : jobResults) {\n result.computeMetrics();\n sb.append(\"\\n\").append(result);\n }\n // Include aggregates for jobs and overall\n if (jobTypeResults.containsKey(\"ForwardChain\")) {\n jobTypeResults.get(\"ForwardChain\").computeMetrics();\n sb.append(\"\\n\").append(jobTypeResults.get(\"ForwardChain\"));\n }\n if (jobTypeResults.containsKey(\"DuplicateElimination\")) {\n jobTypeResults.get(\"DuplicateElimination\").computeMetrics();\n sb.append(\"\\n\").append(jobTypeResults.get(\"DuplicateElimination\"));\n }\n totals.computeMetrics();\n sb.append(\"\\n\").append(totals);\n return sb.toString();\n }", "public void printStats() {\n\t\tSystem.out.println(\"========== LCMFreq v0.96r18 - STATS ============\");\n\t\tSystem.out.println(\" Freq. itemsets count: \" + frequentCount);\n\t\tSystem.out.println(\" Total time ~: \" + (endTimestamp - startTimestamp)\n\t\t\t\t+ \" ms\");\n\t\tSystem.out.println(\" Max memory:\" + MemoryLogger.getInstance().getMaxMemory());\n\t\tSystem.out.println(\"=====================================\");\n\t}", "public static String humanize (long size)\n {\n\n long b = 1;\n long Kb = b * 1024;\n long Mb = Kb * 1024;\n long Gb = Mb * 1024;\n long Tb = Gb * 1024;\n long Pb = Tb * 1024;\n long Eb = Pb * 1024;\n\n if (size < Kb) return format2( size ) + \" byte\";\n if (size >= Kb && size < Mb) return format2((double)size / Kb) + \" Kb\";\n if (size >= Mb && size < Gb) return format2((double)size / Mb) + \" Mb\";\n if (size >= Gb && size < Tb) return format2((double)size / Gb) + \" Gb\";\n if (size >= Tb && size < Pb) return format2((double)size / Tb) + \" Tb\";\n if (size >= Pb && size < Eb) return format2((double)size / Pb) + \" Pb\";\n if (size >= Eb) return format2((double)size / Eb) + \" Eb\";\n\n return \"???\";\n }", "private int calcTotalTime() {\n\t\tint time = 0;\n\t\tfor (Taxi taxi : taxis) {\n\t\t\ttime += taxi.calcTotalTime();\n\t\t}\n\t\treturn time;\n\t}", "public void getSecsDetail( );", "static void setTiming(){\n killTime=(Pars.txType!=0) ? Pars.txSt+Pars.txDur+60 : Pars.collectTimesB[2]+Pars.dataTime[1]+60;//time to kill simulation\n tracksTime=(Pars.tracks && Pars.txType==0) ? Pars.collectTimesI[1]:(Pars.tracks)? Pars.collectTimesBTx[1]:100*24*60;//time to record tracks\n }", "void print_statistics(long tot_arrived, long tot_processed, Double end_time){\n\n CloudEvent cloudEvent = new CloudEvent();\n CloudletEvent cletEvent = new CloudletEvent();\n PrintFile print = new PrintFile();\n\n\n // System response time & throughput\n\n float system_response_time = (float)(sum_service_times1_clet+ sum_service_times1_cloud + sum_service_times2_clet+ sum_service_times2_cloud)/ tot_processed;\n float response_time_class1 = (float) ((sum_service_times1_clet+ sum_service_times1_cloud)/ (completition_clet_type1 + completition_cloud_type1));\n float response_time_class2 = (float) ((sum_service_times2_clet+ sum_service_times2_cloud)/ (completition_clet_type2 + completition_cloud_type2));\n\n float lambda_tot = (float) (tot_arrived/end_time);\n float lambda_1 = (float)((arrival_type1_clet+arrival_type1_cloud)/end_time);\n float lambda_2 = (float)((arrival_type2_clet+arrival_type2_cloud)/end_time);\n\n\n // per-class effective cloudlet throughput\n\n float task_rate_clet1 = (float) ((float)completition_clet_type1 / end_time);\n float task_rate_clet2 = (float) ((float)completition_clet_type2 / end_time);\n\n\n // per-class cloud throughput\n\n float lambda_cloud1 = (float) ((arrival_type1_cloud)/end_time);\n float lambda_cloud2 = (float) ((arrival_type2_cloud)/end_time);\n\n\n // class response time and mean population\n\n float response_time_cloudlet = (float) (sum_service_times1_clet+ sum_service_times2_clet)/ (completition_clet_type1 + completition_clet_type2);\n float response_time_cloudlet1 = (float) sum_service_times1_clet/ completition_clet_type1;\n float response_time_cloudlet2 = (float) (sum_service_times2_clet/ completition_clet_type2);\n\n float response_time_cloud = (float) ((sum_service_times1_cloud+ sum_service_times2_cloud)/ (completition_cloud_type1 + completition_cloud_type2));\n float response_time_cloud1 = (float) (sum_service_times1_cloud/ completition_cloud_type1);\n float response_time_cloud2 = (float) (sum_service_times2_cloud/ completition_cloud_type2);\n\n // E[N] cloudlet\n float mean_cloudlet_jobs = cletEvent.mean_cloudlet_jobs_number();\n // E[N] class 1 cloudlet\n float mean_cloudlet_jobs1 = cletEvent.mean_cloudlet_jobs_number1();\n // E[N] class 2 cloudlet\n float mean_cloudlet_jobs2 = cletEvent.mean_cloudlet_jobs_number2();\n\n // E[N] cloud\n float mean_cloud_jobs = cloudEvent.mean_cloud_jobs_number();\n // E[N] class 1 cloud\n float mean_cloud_jobs1 = cloudEvent.mean_cloud_jobs_number1();\n // E[N] class 2 cloud\n float mean_cloud_jobs2 = cloudEvent.mean_cloud_jobs_number2();\n\n\n // Altre statistiche di interesse\n\n float lambda_clet = (float) ((arrival_type1_clet+ arrival_type2_clet)/end_time);\n float lambda_clet1 = (float) ((arrival_type1_clet)/end_time);\n float lambda_clet2 = (float) ((arrival_type2_clet)/end_time);\n float lambda_cloud = (float) ((arrival_type1_cloud+ arrival_type2_cloud)/end_time);\n\n double rate1_clet = mean_cloudlet_jobs1*0.45;\n double rate2_clet = mean_cloudlet_jobs2*0.27;\n\n\n\n NumberFormat numForm = NumberFormat.getInstance();\n numForm.setMinimumFractionDigits(6);\n numForm.setMaximumFractionDigits(6);\n numForm.setRoundingMode(RoundingMode.HALF_EVEN);\n\n\n System.out.println(\"\\n\\n\\n 1) SYSTEM RESPONSE TIME & THROUGHPUT \" + \"(GLOBAL & PER-CLASS)\");\n\n System.out.println(\"\\n Global System response time ...... = \" + numForm.format( system_response_time));\n System.out.println(\" Response time class 1 ...... = \" + numForm.format( response_time_class1));\n System.out.println(\" Response time class 2 ...... = \" + numForm.format( response_time_class2));\n\n System.out.println(\"\\n Global System throughput ...... = \" + numForm.format( lambda_tot));\n System.out.println(\" Throughput class 1 ...... = \" + numForm.format( lambda_1));\n System.out.println(\" Throughput class 2 ...... = \" + numForm.format( lambda_2));\n\n\n System.out.println(\"\\n\\n\\n 2) PER_CLASS EFFECTIVE CLOUDLET THROUGHPUT \");\n System.out.println(\" Task-rate cloudlet class 1 ...... = \" + numForm.format( rate1_clet));\n System.out.println(\" Task-rate cloudlet class 2 ...... = \" + numForm.format( rate2_clet));\n\n\n System.out.println(\"\\n\\n\\n 3) PER_CLASS CLOUD THROUGHPUT \");\n System.out.println(\" Throughput cloud class 1 ...... = \" + numForm.format( lambda_cloud1));\n System.out.println(\" Throughput cloud class 2 ...... = \" + numForm.format( lambda_cloud2));\n\n\n System.out.println(\"\\n\\n\\n 4) CLASS RESPONSE TIME & MEAN POPULATION \" + \"(CLOUDLET & CLOUD)\");\n\n System.out.println(\"\\n Response Time class 1 cloudlet ...... = \" + numForm.format( response_time_cloudlet1));\n System.out.println(\" Response Time class 2 cloudlet ...... = \" + numForm.format(response_time_cloudlet2));\n System.out.println(\" Response Time class 1 cloud ...... = \" + numForm.format( response_time_cloud1));\n System.out.println(\" Response Time class 2 cloud ...... = \" + numForm.format( response_time_cloud2));\n\n System.out.println(\"\\n Mean Population class 1 cloudlet ...... = \" + numForm.format( mean_cloudlet_jobs1));\n System.out.println(\" Mean Population class 2 cloudlet ...... = \" + numForm.format( mean_cloudlet_jobs2));\n System.out.println(\" Mean Population class 1 cloud ...... = \" + numForm.format( mean_cloud_jobs1));\n System.out.println(\" Mean Population class 2 cloud ...... = \" + numForm.format( mean_cloud_jobs2));\n\n }", "private void setTxtTimeTotal()\n {\n SimpleDateFormat dinhDangGio= new SimpleDateFormat(\"mm:ss\");\n txtTimeTotal.setText(dinhDangGio.format(mediaPlayer.getDuration()));\n //\n skSong.setMax(mediaPlayer.getDuration());\n }", "private int totalTime()\n\t{\n\t\t//i'm using this varaible enough that I should write a separate method for it\n\t\tint totalTime = 0;\n\t\tfor(int i = 0; i < saveData.size(); i++)//for each index of saveData\n\t\t{\n\t\t\t//get the start time\n\t\t\tString startTime = saveData.get(i).get(\"startTime\");\n\t\t\t//get the end time\n\t\t\tString endTime = saveData.get(i).get(\"endTime\");\n\t\t\t//****CONTINUE\n\t\t\t//total time in minutes\n\t\t}\n\t}", "public void printDetails() {\r\n\t\tSystem.out.println(\" \");\r\n\t\tSystem.out.println(showtimeId + \" \" + movie.getTitle() + \" starts at \" + startTime.toString());\r\n\t}", "private void parse() throws IOException {\n\n\t\tStats statsObject = new Stats();\n\n\t\tstatsObject.setProcessName(process);\n\n\t\tList<String> lines = Files.readAllLines(Paths.get(filename), Charset.defaultCharset());\n\n\t\tPattern timePattern = Pattern.compile(\"((\\\\d+)-)*(\\\\d+)\\\\W((\\\\d+):)*(\\\\d+)\\\\.(\\\\d+)\");\n\n\t\tSystem.out.println(filename+\" \"+lines.get(0));\n\t\tMatcher matcher = timePattern.matcher(lines.get(0));\n\t\twhile (matcher.find()) {\n\t\t\tstatsObject.setStartTime(matcher.group(0));\n\t\t\tbreak;\n\t\t}\n\n\t\tmatcher = timePattern.matcher(lines.get(lines.size() - 1));\n\t\twhile (matcher.find()) {\n\t\t\tstatsObject.setEndTime(matcher.group(0));\n\t\t\tbreak;\n\t\t}\n\t\tString error = new String();\n\t\tfor (String line : lines) {\n\n\t\t\tif (line.startsWith(\"[\")) {\n\t\t\t\tif (!error.isEmpty()) {\n\t\t\t\t\tstatsObject.addError(error);\n\t\t\t\t\terror = \"\";\n\t\t\t\t}\n\n\t\t\t\tif (line.contains(\"Number of records processed: \")) {\n\n\t\t\t\t\tPattern numberPattern = Pattern.compile(\"\\\\d+\");\n\t\t\t\t\tmatcher = numberPattern.matcher(line);\n\t\t\t\t\t\n\t\t\t\t\tString numberOfRecordsProcessed = \"N/A\";\n\t\t\t\t\t\n\t\t\t\t\twhile (matcher.find()) {\n\t\t\t\t\t\tnumberOfRecordsProcessed = matcher.group();\n\t\t\t\t\t}\n\t\t\t\t\tstatsObject.setRecordsProcessed(numberOfRecordsProcessed);\n\n\t\t\t\t}\n\n\t\t\t\telse if (line.contains(\"WARNING\")) {\n\t\t\t\t\tif (line.contains(\"MISSING Property\")) {\n\t\t\t\t\t\tstatsObject.incrementErrorCounter();\n\t\t\t\t\t\tstatsObject.addError(line);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatsObject.incrementWarningCounter();\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else if (line.contains(\"Exception\") || (line.contains(\"Error\"))) {\n\t\t\t\tif (!error.isEmpty()) {\n\t\t\t\t\tstatsObject.addError(error);\n\t\t\t\t\terror = \"\";\n\t\t\t\t}\n\t\t\t\tstatsObject.incrementErrorCounter();\n\t\t\t\terror = error + line;\n\t\t\t} else {\n\t\t\t\terror = error + line ;\n\t\t\t}\n\n\t\t}\n\t\t// reader.close();\n\t\tif (statsObject.getErrorCounter() > 0) {\n\t\t\tstatsObject.setStatus(\"Failure\");\n\t\t}\n\n\t\tPattern pattern = Pattern.compile(\"\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\");\n\t\tmatcher = pattern.matcher(filename);\n\t\tString date = null;\n\t\twhile (matcher.find()) {\n\t\t\tdate = matcher.group(0);\n\t\t\tbreak;\n\t\t}\n\t\tboolean saveSuccessful = OutputManipulator.addToStatFile(username, process, date, statsObject);\n\n\t\tif (saveSuccessful) {\n\t\t\tFileParseScheduler.addSuccessfulParsedFileName(username, process, filename);\n\t\t}\n\n\t\tFileParseScheduler.removeLatestKilledThreads(process + filename);\n\t}", "public String getTotalThreadTimeInfo(long[] tids) {\n\n\t\tStringBuffer sb = new StringBuffer();\n\t\n\t\tThreadMXBean bean = ManagementFactory.getThreadMXBean();\t\t\n\t\tif(!bean.isThreadCpuTimeSupported()) \t\t\t\t\t\t\t\n\t\t\treturn timeInfo;\n\t\tfor(long i : tids) {\n\t\t\tlong currentUserTime = bean.getThreadUserTime(i);\n\t\t\tlong currentCpuTime = bean.getThreadCpuTime(i);\n\t\t\tif(currentCpuTime != -1) {\t\t\t\t\t\t\t\t\t\t\n\t\t\t\ttotalCpuTime += currentCpuTime;\n\t\t\t\ttotalUserTime += currentUserTime;\n\t\t\t}\n\t\t\n\t\t}\n\t\tsb.append(totalUserTime).append(\"#\").append(totalCpuTime);\n\t\ttimeInfo = sb.toString();\n\t\treturn timeInfo;\n\n\t}", "private void printTable(String type){\n\t\tSystem.out.println(\"\\n\\t\\t\\t\\t \" + type + \" Probing Analysis (Table size = \" + tableSize + \")\");\n\t\tSystem.out.println(\"\\t\\t ----- Inserts ------ ----------- Probes ---------- --------- Clusters ---------\");\n\t\tSystem.out.printf(\"%5s %10s %10s %10s %10s %10s %10s %10s %10s %10s\\n\", \n\t\t\t\t\"N\", \"lambda\", \"success\", \"failed\", \"total\", \"avg\", \"max\", \"number\", \"avg\", \"max\");\n\t}", "private void summarize() {\n System.out.println();\n System.out.println(totalErrors + \" errors found in \" +\n totalTests + \" tests.\");\n }", "private void summarize() {\n System.out.println();\n System.out.println(totalErrors + \" errors found in \" +\n totalTests + \" tests.\");\n }", "public void generateTimes() {\n\n\t\tLocalTime currentTime = PropertiesConfig.getMorningSessionBegin();\n\t\tfor (Talk talk : morningSession.getTalks()) {\n\t\t\ttalk.setTime(currentTime);\n\t\t\tcurrentTime = currentTime.plusMinutes(talk.getLength());\n\t\t}\n\n\t\tTalk lunch = new Talk(PropertiesConfig.LUNCH_TITLE);\n\t\tlunch.setTime(PropertiesConfig.getLunchBegin());\n\t\tlunchSession.addTalk(lunch);\n\n\t\tcurrentTime = PropertiesConfig.getAfternoonSessionBegin();\n\t\tfor (Talk talk : afternoonSession.getTalks()) {\n\t\t\ttalk.setTime(currentTime);\n\t\t\tcurrentTime = currentTime.plusMinutes(talk.getLength());\n\t\t}\n\n\t\tTalk meetEvent = new Talk(PropertiesConfig.MEET_EVENT_TITLE);\n\t\tmeetEvent.setTime(currentTime);\n\t\tmeetSession.addTalk(meetEvent);\n\t}", "private String renderTTThroughput(PetriNetView pnmldata, double[] data) {\n\t\tif (data.length == 0) {\n\t\t\treturn \"n/a\";\n\t\t}\n\n\t\tint transCount = data.length;\n\t\tArrayList result = new ArrayList();\n\t\t// add headers to table\n\t\tresult.add(\"Transition\");\n\t\tresult.add(\"Throughput\");\n\t\tDecimalFormat f = new DecimalFormat();\n\t\tf.setMaximumFractionDigits(5);\n\t\tfor (int i = 0; i < transCount; i++) {\n\t\t\tif (pnmldata.getTransitionViews()[i].isTimed()) {\n\t\t\t\tresult.add(pnmldata.getTransitionViews()[i].getName());\n\t\t\t\tresult.add(f.format(data[i]));\n\t\t\t}\n\n\t\t}\n\n\t\treturn ResultsHTMLPane.makeTable(result.toArray(), 2, false, true,\n\t\t\t\ttrue, true);\n\t}", "public String getLatexQuickStat() {\n String stat = \"\";\n stat = \"$\" + formatter.format(getAverage()) + \" \\\\pm \" + formatter.format(getUnbiasedStandardDeviation()) + \"$\";\n return stat;\n }", "private void calc_screen_size(){\r\n \tscn_grid.setFont(scn_font);\r\n \tscn_context = scn_grid.getFontRenderContext();\r\n \t scn_layout = new TextLayout(\"X\",scn_font,scn_context);\r\n scn_char_rect = scn_layout.getBlackBoxBounds(0,1).getBounds();\r\n scn_char_height = (int) (scn_char_rect.getHeight()); // RPI 630 was Width in err, 6 to *1.5\r\n \tscn_char_base = scn_char_height/2+1;\r\n \tscn_char_height = scn_char_height + scn_char_base+2;\r\n scn_char_width = (int) (scn_char_rect.getWidth()); // RPI 630 was Height in err\r\n \tscn_height = scn_rows * scn_char_height; // RPI 408 + 5 \r\n \tscn_width = scn_cols * scn_char_width + 3; // RPI 408 + 5 \r\n \tscn_size = new Dimension(scn_width,scn_height);\r\n \tscn_image = new BufferedImage(scn_width,scn_height,BufferedImage.TYPE_INT_ARGB);\r\n \tscn_grid = scn_image.createGraphics();\r\n \tscn_grid.setFont(scn_font); \r\n scn_grid.setColor(scn_text_color);\r\n \t scn_context = scn_grid.getFontRenderContext();\r\n scn_grid.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r\n RenderingHints.VALUE_ANTIALIAS_ON);\r\n }", "public double getTotalTime()\n\t{\n\t\tdouble elapsedTime = 0. ;\n\t\tEnumeration<SpItem> children = children() ;\n\t\tSpItem child = null ;\n\t\tboolean hasObsChild = false ;\n\n\t\twhile( children.hasMoreElements() )\n\t\t{\n\t\t\tchild = children.nextElement() ;\n\t\t\tif( child instanceof SpObs )\n\t\t\t{\n\t\t\t\thasObsChild = true ;\n\t\t\t\telapsedTime += (( SpObs )child).getElapsedTime() ;\n\t\t\t}\n\t\t\telse if( child instanceof SpMSB )\n\t\t\t{\n\t\t\t\telapsedTime += (( SpMSB )child).getTotalTime() ;\n\t\t\t}\n\t\t}\n\n\t\t// If there is an Obs child, we should add a slew time as well,\n\t\t// which is just the instrument slew time times the number of\n\t\t// targets. We don't do this if the child is an MSB since this\n\t\t// already adds a slew time\n\t\tdouble slewTime = 0. ;\n\t\tif( hasObsChild )\n\t\t{\n\t\t\tSpInstObsComp inst = SpTreeMan.findInstrument( this ) ;\n\t\t\tif( inst != null )\n\t\t\t\tslewTime = inst.getSlewTime() * size() ;\n\t\t}\n\n\t\t// Get the total number of repeats for each target\n\t\tint totRemaining = 0 ;\n\t\tfor( int i = 0 ; i < size() ; i++ )\n\t\t\ttotRemaining += getRemaining( i ) ;\n\n\t\telapsedTime *= totRemaining ;\n\t\telapsedTime += slewTime ;\n\n\t\treturn elapsedTime ;\n\t}", "private void updateStartTime() {\n Date date = startTimeCalendar.getTime();\n String startTime = new SimpleDateFormat(\"HH:mm\").format(date);\n startHourText.setText(startTime);\n }", "@Override\n public long getTotalHarvestingTime()\n {\n return 0;\n }", "public void findavgTime(){\n findWaitingTime(ProcessesNumber, ProcessesNumber.length, BurestTime, WaitingTime, quantum);\n \n // Function to find turn around time \n findTurnAroundTime(ProcessesNumber, ProcessesNumber.length, BurestTime, WaitingTime, TurnaroundTime);\n \n \n System.out.println(\"Processes \" + \" Burst time \" +\n \" Waiting time \" + \" Turn around time\");\n \n \n // around time\n for (int i=0; i<ProcessesNumber.length; i++)\n {\n Total_WaitingTime = Total_WaitingTime + WaitingTime[i];\n Total_TurnaroundTime = Total_TurnaroundTime + TurnaroundTime[i];\n System.out.println(\" \" + (i+1) + \"\\t\\t\" + BurestTime[i] +\"\\t \" +\n WaitingTime[i] +\"\\t\\t \" + TurnaroundTime[i]);\n }\n \n Average_WaitingTime = (float)Total_WaitingTime / (float)ProcessesNumber.length ;\n Average_TurnaroundTime = (float)Total_TurnaroundTime / (float)ProcessesNumber.length ;\n \n System.out.println(\"Average waiting time = \" + (float)Average_WaitingTime);\n System.out.println(\"Average turn around time = \" + (float)Average_TurnaroundTime);\n \n\n//for ( int k = 0; k < ProcessMoved[k].length; k++) {\n// \n// for (int j = 0; j < ProcessMoved.length; j++) {\n//\n// System.out.println(ProcessMoved[j][k]);\n// }\n//\n// }\n \n Gantt_Chart_Pre per = new Gantt_Chart_Pre(ProcessMoved ,endtime ,WaitingTime , TurnaroundTime , Names ,ProcessesNumber ,Total_WaitingTime,Average_WaitingTime,Total_TurnaroundTime,Average_TurnaroundTime);\n per.setTitle(\"Solution !!\");\n per.setSize(1000,700);\n per.setLocationRelativeTo(null);\n per.setVisible(true);\n }", "private void showTime()\n {\n showText(\"Time: \" + time, 700, 25);\n }", "public double getElapsedTime()\n\t{\n\t\tdouble elapsedTime = 0. ;\n\t\tEnumeration<SpItem> children = children() ;\n\t\tSpItem child = null ;\n\n\t\twhile( children.hasMoreElements() )\n\t\t{\n\t\t\tchild = children.nextElement() ;\n\t\t\tif( child instanceof SpObs && (( SpObs )child).isOptional() )\n\t\t\t\t\telapsedTime += ( ( SpObs )child ).getElapsedTime() ;\n\t\t\telse if( child instanceof SpMSB )\n\t\t\t\telapsedTime += (( SpMSB )child).getElapsedTime() ;\n\t\t}\n\n\t\tint totRemaining = 0 ;\n\t\tfor( int i = 0 ; i < size() ; i++ )\n\t\t\ttotRemaining += getRemaining( i ) ;\n\n\t\telapsedTime *= totRemaining ;\n\t\treturn elapsedTime ;\n\t}", "private void printThroughput(long duration) {\n double runningTime = duration / 1000.0;\n\n System.out.println(\"Total running time: \" + runningTime + \"s\");\n System.out.println(\"Number of requests / second: \"\n + (nbRequests / runningTime));\n System.out.println(\"Number of transactions / second: \"\n + (nbTransactions / runningTime));\n System.out.println(\"Number of interactions / second: \"\n + (nbInteractions / runningTime));\n }", "private static void displayHeaders( float t ) {\n\t\t/** Traverse the list of all outputs and display their\n\t\t * names and then scheduling the first output display event.\n\t\t * All names are output in a 5-space field.\n\t\t * Following the headers, display the associated values.\n\t\t */\n\t\tfor (Output o: outputList) {\n\t\t\tString n = o.name;\n\n\t\t\t// long names must be truncated\n\t\t\tif (n.length() > 4) {\n\t\t\t\tn = n.substring( 0, 4 );\n\t\t\t}\n\n\t\t\t// output leading blank\n\t\t\tSystem.out.append( ' ' );\n\n\t\t\t// output edited name\n\t\t\tSystem.out.append( n );\n\n\t\t\t// output padding up to next column\n\t\t\tif (n.length() < 4) {\n\t\t\t\tSystem.out.append(\n\t\t\t\t\t\" \".substring( 0, 4 - n.length() )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\n\t\t// headers preceed first output of values\n\t\tdisplayOutput( t );\n\t}", "void printStats();", "public void calculateStastics() {\t\t\n\t\t\n\t\t/* remove verboten spectra */\n\t\tArrayList<String> verbotenSpectra = new ArrayList<String>();\n\t\tverbotenSpectra.add(\"USP_std_run1_100504135936.7436.7436.2.dta\");\n\t\tverbotenSpectra.add(\"USP_std_run1_100504135936.5161.5161.2.dta\");\n\t\tverbotenSpectra.add(\"USP_std_run1_100504135936.4294.4294.2.dta\");\n\t\tverbotenSpectra.add(\"USP_std_run1_100504135936.4199.4199.2.dta\");\n\t\tverbotenSpectra.add(\"USP_std_run1_100504135936.5085.5085.2.dta\");\n\t\tverbotenSpectra.add(\"USP_std_run1_100504135936.4129.4129.2.dta\");\n\t\tfor (int i = 0; i < positiveMatches.size(); i++) {\n\t\t\tMatch match = positiveMatches.get(i);\n\t\t\tfor (String name: verbotenSpectra) {\n\t\t\t\tif (name.equals(match.getSpectrum().getFile().getName())) {\n\t\t\t\t\tpositiveMatches.remove(i);\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < spectra.size(); i++) {\n\t\t\tSpectrum spectrum = spectra.get(i);\n\t\t\tfor (String name: verbotenSpectra) {\n\t\t\t\tif (name.equals(spectrum.getFile().getName())) {\n\t\t\t\t\tspectra.remove(i);\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t/* finding how much time per spectrum */\n\t\tmilisecondsPerSpectrum = (double) timeElapsed / spectra.size();\n\n\n\t\tMatch.setSortParameter(Match.SORT_BY_SCORE);\n\t\tCollections.sort(positiveMatches);\n\t\t\n\t\t\n\t\t/* Identify if each match is true or false */\n\t\ttestedMatches = new ArrayList<MatchContainer>(positiveMatches.size());\n\t\tfor (Match match: positiveMatches) {\n\t\t\tMatchContainer testedMatch = new MatchContainer(match);\n\t\t\ttestedMatches.add(testedMatch);\n\t\t}\n\t\t\n\t\t/* sort the tested matches */\n\t\tCollections.sort(testedMatches);\n\t\t\n\t\t\n\n\t\t/*account for the fact that these results might have the wrong spectrum ID due to\n\t\t * Mascot having sorted the spectra by mass\n\t\t */\n\t\tif (Properties.scoringMethodName.equals(\"Mascot\")){\n\t\t\t\n\t\t\t/* hash of true peptides */\n\t\t\tHashtable<String, Peptide> truePeptides = new Hashtable<String, Peptide>();\n\t\t\tfor (MatchContainer mc: testedMatches) {\n\t\t\t\tString truePeptide = mc.getCorrectAcidSequence();\n\t\t\t\ttruePeptides.put(truePeptide, mc.getTrueMatch().getPeptide());\n\t\t\t}\n\t\t\t\n\t\t\t/* making a hash of the best matches */\n\t\t\tHashtable<Integer, MatchContainer> bestMascotMatches = new Hashtable<Integer, MatchContainer>(); \n\t\t\tfor (MatchContainer mc: testedMatches) {\n\t\t\t\tMatchContainer best = bestMascotMatches.get(mc.getMatch().getSpectrum().getId());\n\t\t\t\tif (best == null) {\n\t\t\t\t\tbestMascotMatches.put(mc.getMatch().getSpectrum().getId(), mc);\n\t\t\t\t} else {\n\t\t\t\t\tif (truePeptides.get(mc.getMatch().getPeptide().getAcidSequenceString()) != null) {\n\t\t\t\t\t\tbestMascotMatches.put(mc.getMatch().getSpectrum().getId(), mc);\n\t\t\t\t\t\t\n\t\t\t\t\t\t/* need to set the peptide, because though it may have found a correct peptide, it might not be the right peptide for this particular spectrum */\n\t\t\t\t\t\tmc.getMatch().setPeptide(mc.getTrueMatch().getPeptide());\n\t\t\t\t\t\tmc.validate();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttestedMatches = new ArrayList<MatchContainer>(bestMascotMatches.values());\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t/* reduce the tested matches to one per spectrum, keeping the one that is correct if there is a correct one \n\t\t * else keep the match with the best score */\n\t\tArrayList<MatchContainer> reducedTestedMatches = new ArrayList<MatchContainer>(testedMatches.size());\n\t\tfor (Spectrum spectrum: spectra) {\n\t\t\tMatchContainer toAdd = null;\n\t\t\tfor (MatchContainer mc: testedMatches) {\n\t\t\t\tif (mc.getMatch().getSpectrum().getId() == spectrum.getId()) {\n\t\t\t\t\tif (toAdd == null) {\n\t\t\t\t\t\ttoAdd = mc; \n\t\t\t\t\t}\n\t\t\t\t\tif (toAdd.getMatch().getScore() < mc.getMatch().getScore()) {\n\t\t\t\t\t\ttoAdd = mc;\n\t\t\t\t\t}\n\t\t\t\t\tif (toAdd.getMatch().getScore() == mc.getMatch().getScore() && mc.isTrue()) {\n\t\t\t\t\t\ttoAdd = mc;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (toAdd != null) {\n\t\t\t\treducedTestedMatches.add(toAdd);\n\t\t\t}\n\t\t}\n\t\ttestedMatches = reducedTestedMatches;\n\t\t\n\t\t/* ensure the testedMatches are considering the correct peptide */\n\t\tif (Properties.scoringMethodName.equals(\"Peppy.Match_IMP\")){\n\t\t\tfor (MatchContainer mc: testedMatches) {\n\t\t\t\tif (mc.getMatch().getScore() < mc.getTrueMatch().getScore()) {\n\t\t\t\t\tmc.getMatch().setPeptide(mc.getTrueMatch().getPeptide());\n\t\t\t\t\tmc.getMatch().calculateScore();\n\t\t\t\t\tmc.validate();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t/* again sort the tested matches */\n\t\tCollections.sort(testedMatches);\n\t\n\t\t\n\t\t//count total true;\n\t\tfor (MatchContainer match: testedMatches) {\n\t\t\tif (match.isTrue()) {\n\t\t\t\ttrueTally++;\n\t\t\t} else {\n\t\t\t\tfalseTally++;\n\t\t\t}\n\t\t\tif ((double) falseTally / (trueTally + falseTally) <= 0.01) {\n\t\t\t\ttrueTallyAtOnePercentError = trueTally;\n\t\t\t\tpercentAtOnePercentError = (double) trueTallyAtOnePercentError / spectra.size();\n\t\t\t}\n\t\t\tif ((double) falseTally / (trueTally + falseTally) <= 0.05) {\n\t\t\t\ttrueTallyAtFivePercentError = trueTally;\n\t\t\t\tpercentAtFivePercentError = (double) trueTallyAtFivePercentError / spectra.size();\n\t\t\t}\n\t\t}\n\t\t\n\t\tgeneratePrecisionRecallCurve();\n\t}", "private void writeSizeReport()\n {\n Writer reportOut = null;\n try\n {\n reportOut = new BufferedWriter(new OutputStreamWriter(\n new FileOutputStream(sizeReportFile), \"UTF8\"));\n reportOut.write(report.generate());\n reportOut.flush();\n }\n catch (Exception e)\n {\n // TODO: report a problem\n throw new RuntimeException(e);\n }\n finally\n {\n if (reportOut != null)\n try\n {\n reportOut.close();\n }\n catch (IOException e)\n {\n // ignore\n }\n }\n }", "public void printGanttChart() {\n\t\t\n\t\tSystem.out.println(\"\\n\\n=======================FCFS ASSIGNMENT=======================\");\n\t\t\t\t\n\t\t\t\t\n\t\tArrayList<Process> copyProcesses = new ArrayList<Process>(processes);\n\t\t\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(\"=============================================================\\n\");\n\t\tsb.append(\"\\t ID \\t AT \\t BT \\t CT \\t TAT \\t WT\\t\\n\");\n\t\tsb.append(\"=============================================================\\n\");\n\t\tcopyProcesses.forEach(p -> {\n\t\t\tsb.append(p.toString());\n\t\t});\n\t\tSystem.out.println(sb.toString());\n\t}", "private void exportMinutes() {\n boolean modOK = modIfChanged();\n int exported = 0;\n if (modOK) {\n fileChooser.setDialogTitle (\"Export to Minutes\");\n fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);\n File selectedFile = fileChooser.showSaveDialog (this);\n if (selectedFile != null) {\n MarkupWriter writer \n = new MarkupWriter(selectedFile, MarkupWriter.MARKDOWN_FORMAT);\n boolean ok = writer.openForOutput();\n if (ok) {\n textMergeScript.clearSortAndFilterSettings();\n int lastSeq = -1;\n for (int i = 0; i < clubEventList.size(); i++) {\n ClubEvent nextClubEvent = clubEventList.get(i);\n if (nextClubEvent != null\n && nextClubEvent.getStatusAsString().contains(\"Current\")) {\n String what = nextClubEvent.getWhat();\n if (exported == 0) {\n writer.writeHeading (1, \"Minutes for \" + what, \"\");\n }\n String seqStr = nextClubEvent.getSeq();\n int seq = Integer.parseInt(seqStr);\n String seqTitle = \"\";\n switch (seq) {\n case 1:\n seqTitle = \"Open Meeting\";\n break;\n case 2:\n seqTitle = \"Finance\";\n break;\n case 3:\n seqTitle = \"Board Info\";\n break;\n case 4:\n seqTitle = \"Recent Events\";\n break;\n case 5:\n seqTitle = \"Upcoming\";\n break;\n case 8:\n seqTitle = \"Communication\";\n break;\n case 9:\n seqTitle = \"Close Meeting\";\n break;\n }\n String category = nextClubEvent.getCategory();\n if (seq != lastSeq) {\n writer.writeHeading (2, seqTitle, \"\");\n lastSeq = seq;\n }\n String ymd = nextClubEvent.getYmd();\n String when = nextClubEvent.getWhen();\n StringBuilder h3 = new StringBuilder();\n if (ymd != null && ymd.length() > 7) {\n h3.append(when);\n h3.append(\" -- \");\n }\n if (category != null && category.length() > 0) {\n h3.append(category);\n h3.append(\": \");\n }\n h3.append(what);\n writer.writeHeading(3, h3.toString(), \"\");\n \n // Print Who\n exportMinutesField \n (writer, \n \"Who\", \n nextClubEvent.getWho());\n \n // Print Where\n exportMinutesField \n (writer, \n \"Where\", \n nextClubEvent.getWhere());\n \n // Print Finance Projection\n exportMinutesField \n (writer, \n \"Finance Projection\", \n nextClubEvent.getFinanceProjection());\n \n // Print Finance Projection\n exportMinutesField \n (writer, \n \"Over/Under\", \n nextClubEvent.getOverUnder());\n \n // Print Discussion\n exportMinutesField \n (writer, \"For Discussion\", nextClubEvent.getDiscuss());\n \n if (nextClubEvent.sizeEventNoteList() > 0) {\n EventNote note = nextClubEvent.getEventNote(0);\n String via = note.getNoteVia();\n if (via != null && via.equalsIgnoreCase(\"Minutes\")) {\n writer.writeLine(\"Minutes: \");\n writer.writeLine(note.getNote());\n }\n }\n exported++;\n }\n }\n writer.close();\n JOptionPane.showMessageDialog(this,\n String.valueOf(exported) + \" Club Events exported successfully to\"\n + GlobalConstants.LINE_FEED\n + selectedFile.toString(),\n \"Export Results\",\n JOptionPane.INFORMATION_MESSAGE,\n Home.getShared().getIcon());\n logger.recordEvent (LogEvent.NORMAL, String.valueOf(exported) \n + \" Club Events exported as minutes to \" \n + selectedFile.toString(),\n false);\n statusBar.setStatus(String.valueOf(exported) \n + \" Club Events exported\");\n } \n if (! ok) {\n logger.recordEvent (LogEvent.MEDIUM,\n \"Problem exporting Club Events as minutes to \" + selectedFile.toString(),\n false);\n trouble.report (\"I/O error attempting to export club events to \" \n + selectedFile.toString(),\n \"I/O Error\");\n statusBar.setStatus(\"Trouble exporting Club Events\");\n } // end if I/O error\n } // end if user selected an output file\n } // end if were able to save the last modified record\n }", "private final void updateStatistics(){\r\n\t\tstatisticsText_.setLength(0); \t//reset\r\n\t\t\r\n\t\tRegion[][] regions = Map.getInstance().getRegions();\r\n\t\tVehicle[] vehicles;\r\n\t\tVehicle vehicle;\r\n\t\tint i, j, k;\r\n\t\tint activeVehicles = 0;\r\n\t\tint travelledVehicles = 0;\r\n\t\tint wifiVehicles = 0;\r\n\t\tlong messagesCreated = 0;\r\n\t\tlong IDsChanged = 0;\r\n\t\tdouble messageForwardFailed = 0;\r\n\t\tdouble travelDistance = 0;\r\n\t\tdouble travelTime = 0;\r\n\t\tdouble speed = 0;\r\n\t\tdouble knownVehicles = 0;\r\n\t\tfor(i = 0; i < regions.length; ++i){\r\n\t\t\tfor(j = 0; j < regions[i].length; ++j){\r\n\t\t\t\tvehicles = regions[i][j].getVehicleArray();\r\n\t\t\t\tfor(k = 0; k < vehicles.length; ++k){\r\n\t\t\t\t\tvehicle = vehicles[k];\r\n\t\t\t\t\tif(vehicle.getTotalTravelTime() > 0){\r\n\t\t\t\t\t\t++travelledVehicles;\r\n\t\t\t\t\t\ttravelDistance += vehicle.getTotalTravelDistance();\r\n\t\t\t\t\t\ttravelTime += vehicle.getTotalTravelTime();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(vehicle.isActive()){\r\n\t\t\t\t\t\t++activeVehicles;\r\n\t\t\t\t\t\tspeed += vehicle.getCurSpeed();\r\n\t\t\t\t\t\tif(vehicle.isWiFiEnabled()){\r\n\t\t\t\t\t\t\t++wifiVehicles;\r\n\t\t\t\t\t\t\tmessageForwardFailed += vehicle.getKnownMessages().getFailedForwardCount();\r\n\t\t\t\t\t\t\tknownVehicles += vehicle.getKnownVehiclesList().getSize();\r\n\t\t\t\t\t\t\tIDsChanged += vehicle.getIDsChanged();\r\n\t\t\t\t\t\t\tmessagesCreated += vehicle.getMessagesCreated();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.currentTime\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(Renderer.getInstance().getTimePassed()));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.activeVehicles\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(activeVehicles));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageSpeed\")); //$NON-NLS-1$\r\n\t\tif(activeVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(speed/activeVehicles/100000*3600));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\" km/h\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageTravelDistance\")); //$NON-NLS-1$\r\n\t\tif(travelledVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(travelDistance/travelledVehicles/100));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\" m\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageTravelTime\")); //$NON-NLS-1$\r\n\t\tif(travelledVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(travelTime/travelledVehicles/1000));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\" s\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.wifiVehicles\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(wifiVehicles));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageKnownVehicles\")); //$NON-NLS-1$\r\n\t\tif(wifiVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(knownVehicles/wifiVehicles));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.uniqueMessages\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(messagesCreated));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.failedMessages\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(messageForwardFailed));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.totalIDchanges\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(IDsChanged));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\t\r\n\t\tstatisticsTextArea_.setText(statisticsText_.toString());\r\n\t}", "public void reportStats() {\n System.out.println(\"Number of requests: \" + (requestCount - warmUpRequests));\n System.out.println(\"Number of hits: \" + hitCount);\n System.out.println(\"hit ratio: \" + (double) hitCount / (requestCount - warmUpRequests));\n System.out.println(\"Average hit cost: \" + (double) hitCost / hitCount);\n }", "long getTotalDoExamTime();", "public PlotViewStatsAndMaths() {\n \t}", "private void displayStats(CheckListView<String> checkview, TextArea stats) {\n\t\tStringBuilder start = new StringBuilder();\n\t\tfor(String critter_name:checkview.getCheckModel().getCheckedItems()){\n\t\t\ttry {\n\t\t\t\tClass classTemp = Class.forName(this.getClass().getPackage().getName() + \".\" + critter_name);\n\t\t\t\tMethod m = classTemp.getMethod(\"runStats\", List.class); //Get method\n\t\t\t\tList<Critter> instances = Critter.getInstances(critter_name);\n\t\t\t\tString output = (String)m.invoke(null, instances); //Invoke with instances\n\t\t\t\tstart.append(output).append(\"\\n\");\n\t\t\t} catch (Exception e) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tstats.clear();\n\t\tstats.appendText(start.toString());\n\t}", "public void createSummary(){\n\n for(int j=0;j<=noOfParagraphs;j++){\n int primary_set = paragraphs.get(j).sentences.size()/5;\n\n //Sort based on score (importance)\n Collections.sort(paragraphs.get(j).sentences,new SentenceComparator());\n for(int i=0;i<=primary_set;i++){\n contentSummary.add(paragraphs.get(j).sentences.get(i));\n }\n }\n\n //To ensure proper ordering\n Collections.sort(contentSummary,new SentenceComparatorForSummary());\n printSummary();\n }", "private void addAnalysisSummary()\r\n throws XMLStreamException\r\n {\r\n SimpleStartElement start;\r\n SimpleEndElement end;\r\n\r\n addNewline();\r\n\r\n start = new SimpleStartElement(\"analysis_summary\");\r\n start.addAttribute(\"analysis\", mimicXpress ? \"xpress\" : \"q3\");\r\n start.addAttribute(\"time\", now);\r\n// start.addAttribute(\"xmlns\",\"\");\r\n add(start);\r\n\r\n addNewline();\r\n\r\n String tagName = mimicXpress ? \"xpressratio_summary\" : \"q3ratio_summary\";\r\n start = new SimpleStartElement(tagName);\r\n start.addAttribute(\"version\", mimicXpress ? \"0.0\" : Q3.VERSION);\r\n start.addAttribute(\"author\", Q3.AUTHOR);\r\n\r\n // ???? Must ensure format of multiples is compatible with TPP\r\n StringBuilder residues = new StringBuilder();\r\n StringBuilder specs = new StringBuilder();\r\n boolean first = true;\r\n for (IsotopicLabel label : labels.values())\r\n {\r\n residues.append(label.getResidue());\r\n if (first)\r\n first = false;\r\n else\r\n specs.append(' ');\r\n specs.append(label.getResidue());\r\n specs.append(',');\r\n specs.append(String.format(\"%f\", label.getMassDiff()));\r\n }\r\n\r\n start.addAttribute(\"labeled_residues\", residues.toString());\r\n start.addAttribute(\"massdiff\", specs.toString());\r\n\r\n start.addAttribute(\"massTol\", mimicXpress ? \"0.75\" : \".1\");\r\n\r\n if (mimicXpress)\r\n {\r\n start.addAttribute(\"same_scan_range\", \"Y\");\r\n start.addAttribute(\"xpress_light\", \"0\");\r\n }\r\n\r\n add(start);\r\n\r\n end = new SimpleEndElement(tagName);\r\n add(end);\r\n\r\n addNewline();\r\n\r\n end = new SimpleEndElement(\"analysis_summary\");\r\n add(end);\r\n }" ]
[ "0.56317085", "0.558515", "0.55580676", "0.5532689", "0.55153173", "0.54914767", "0.54027253", "0.53999144", "0.5388539", "0.53433263", "0.53009677", "0.5298649", "0.52845615", "0.5267844", "0.52654487", "0.52573603", "0.5242679", "0.519337", "0.5188936", "0.51858306", "0.51713085", "0.51533425", "0.5148738", "0.51444656", "0.5104155", "0.50983864", "0.5087498", "0.50712335", "0.5067539", "0.50671625", "0.50616205", "0.50549364", "0.5051217", "0.5048102", "0.50408936", "0.5040659", "0.5029138", "0.5024068", "0.5022477", "0.5021058", "0.5018514", "0.50149417", "0.5013469", "0.500017", "0.4987419", "0.49815786", "0.49782366", "0.49737445", "0.49693745", "0.49676475", "0.49639702", "0.49587876", "0.49569142", "0.4956341", "0.4931445", "0.4927682", "0.49249065", "0.49226904", "0.4920964", "0.4916776", "0.49124366", "0.4909681", "0.48851967", "0.48840398", "0.4879174", "0.48776886", "0.48746154", "0.48700526", "0.48567772", "0.48561156", "0.48518232", "0.48508117", "0.4847803", "0.48458168", "0.484243", "0.484243", "0.48423725", "0.48389488", "0.48334885", "0.48317498", "0.48292056", "0.48266384", "0.48078144", "0.48016602", "0.47999582", "0.47986662", "0.4792657", "0.47883704", "0.47878093", "0.47816437", "0.4777146", "0.47708106", "0.47692642", "0.47686335", "0.47623768", "0.47602683", "0.47598407", "0.47551826", "0.47547683", "0.4750541" ]
0.57476074
0
============================= Private Methods ============================// Logs a set of graphs with a corresponding message
private void logGraphs(String message, List<? extends Graph> graphs) { if (message != null) { TetradLogger.getInstance().log("graph", message); } for (Graph graph : graphs) { TetradLogger.getInstance().log("graph", graph.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void logGraph(@NonNull String graph) {\n if (getLogger().isDebugEnabled()) {\n getLogger().debug(\"logGraph {}\", graph);\n }\n\n sendSynchronously(restApiClient::logGraph, createGraphRequest(graph));\n }", "private void log(String message) {\r\n\t\tif (ChartFrameSelectParametersMenuActionListener.printLog && Main.isLoggingEnabled()) {\r\n\t\t\tSystem.out.println(this.getClass().getName() + \".\" + message);\r\n\t\t}\r\n\t}", "public void printGraph(){\n\t\tSystem.out.println(\"[INFO] Graph: \" + builder.nrNodes + \" nodes, \" + builder.nrEdges + \" edges\");\r\n\t}", "private <T extends BaseGraph<?, ?>> void printGraphs(final List<T> graphs) {\n final int writeFirstGraphWithSizeSmallerThan = 50;\n\n try ( final PrintStream graphWriter = new PrintStream(graphOutputPath) ) {\n graphWriter.println(\"digraph assemblyGraphs {\");\n for ( final T graph : graphs ) {\n if ( debugGraphTransformations && graph.getKmerSize() >= writeFirstGraphWithSizeSmallerThan ) {\n logger.info(\"Skipping writing of graph with kmersize \" + graph.getKmerSize());\n continue;\n }\n\n graph.printGraph(graphWriter, false, pruneFactor);\n\n if ( debugGraphTransformations )\n break;\n }\n\n graphWriter.println(\"}\");\n }\n catch ( IOException e ) {\n throw new UserException.CouldNotCreateOutputFile(graphOutputPath, e);\n }\n }", "private void writeLog(){\n\t\tStringBuilder str = new StringBuilder();\r\n\t\tstr.append(System.currentTimeMillis() + \", \");\r\n\t\tstr.append(fileInfo.getCreator() + \", \");\r\n\t\tstr.append(fileInfo.getFileName() + \", \");\r\n\t\tstr.append(fileInfo.getFileLength() + \", \");\r\n\t\tstr.append(networkSize + \", \");\r\n\t\tstr.append(fileInfo.getN1() + \", \");\r\n\t\tstr.append(fileInfo.getK1() + \", \");\r\n\t\tstr.append(fileInfo.getN2() + \", \");\r\n\t\tstr.append(fileInfo.getK2() + \", \");\r\n\t\tstr.append(logger.getDiff(logger.topStart, logger.topEnd-Constants.TOPOLOGY_DISCOVERY_TIMEOUT)+ \", \");\r\n\t\tstr.append(logger.getDiff(logger.optStart, logger.optStop) + \", \");\r\n\t\tstr.append(logger.getDiff(logger.encryStart, logger.encryStop) + \", \");\r\n\t\tstr.append(logger.getDiff(logger.distStart, logger.distStop) + \"\\n\");\r\n\t\t\r\n\t\tString tmp=\"\t\";\r\n\t\tfor(Integer i : fileInfo.getKeyStorage())\r\n\t\t\ttmp += i + \",\";\r\n\t\ttmp += \"\\n\";\r\n\t\tstr.append(tmp);\r\n\t\t\r\n\t\ttmp=\"\t\";\r\n\t\tfor(Integer i : fileInfo.getFileStorage())\r\n\t\t\ttmp += i + \",\";\r\n\t\ttmp += \"\\n\";\r\n\t\tstr.append(tmp);\t\t\r\n\t\t//dataLogger.appendSensorData(LogFileName.FILE_CREATION, str.toString());\t\t\r\n\t\t\r\n\t\t// Topology Discovery\r\n\t\tstr.delete(0, str.length()-1);\r\n\t\tstr.append(Node.getInstance().getNodeId() + \", \");\t\t\t\r\n\t\tstr.append(\"TopologyDisc, \");\r\n\t\tstr.append(networkSize + \", \" + n1 + \", \" + k1 + \", \" + n2 + \", \" + k2 + \", \");\r\n\t\tstr.append(logger.topStart + \", \");\r\n\t\tstr.append(logger.getDiff(logger.topStart, logger.topEnd-Constants.TOPOLOGY_DISCOVERY_TIMEOUT ) + \", \");\r\n\t\tstr.append(\"\\n\");\t\t\t\t\r\n\t\t//dataLogger.appendSensorData(LogFileName.TIMES, str.toString());\r\n\t\t\r\n\t\t// Optimization\r\n\t\tstr.delete(0, str.length()-1);\r\n\t\tstr.append(Node.getInstance().getNodeId() + \", \");\t\t\t\r\n\t\tstr.append(\"Optimization, \");\r\n\t\tstr.append(networkSize + \", \" + n1 + \", \" + k1 + \", \" + n2 + \", \" + k2 + \", \");\r\n\t\tstr.append(logger.optStart + \", \");\r\n\t\tstr.append(logger.getDiff(logger.optStart, logger.optStop) + \", \");\r\n\t\tstr.append(\"\\n\");\r\n\t\t//dataLogger.appendSensorData(LogFileName.TIMES, str.toString());\t\t\r\n\t\t\r\n\t\t\r\n\t\t// File Distribution\r\n\t\tstr.delete(0, str.length()-1);\r\n\t\tstr.append(Node.getInstance().getNodeId() + \", \");\t\t\t\r\n\t\tstr.append(\"FileDistribution, \");\r\n\t\tstr.append(networkSize + \", \" + n1 + \", \" + k1 + \", \" + n2 + \", \" + k2 + \", \");\r\n\t\tstr.append(fileInfo.getFileLength() + \", \");\r\n\t\tstr.append(logger.distStart + \", \");\r\n\t\tstr.append(logger.getDiff(logger.distStart, logger.distStop) + \", \");\r\n\t\tstr.append(\"\\n\\n\");\r\n\t\t//dataLogger.appendSensorData(LogFileName.TIMES, str.toString());\t\t\r\n\t}", "public void displayGraphErrMsg(String message) {\r\n \t\t// per ora faccio printare nell'output, assolutamente provvisorio.\r\n \t\tSystem.out.println(\"message = \" + message);\r\n \t}", "void printCommonGraph(List<Station> stations, Map<Integer, Sensor> sensors, Map<Integer, MeasurementData> dataMap, LocalDateTime since, LocalDateTime until, ParamType paramType, Double range);", "void printGraph();", "public void globallog() {\n for (Comm currcomm: allcomms.values()) {\n System.out.println(\"===\");\n System.out.println(\"commit \" + currcomm.getCommitID());\n if (currcomm.getMergepointer() != null) {\n System.out.println(\"Merge: \"\n + currcomm.getParent()\n .getCommitID().substring(0, 7) + \" \"\n + currcomm\n .getMergepointer().getCommitID().substring(0, 7));\n }\n System.out.println(\"Date: \" + currcomm.getDate());\n System.out.println(currcomm.getMessage());\n System.out.println();\n }\n }", "private void log(String message) {\r\n\t\tif (AxisDisplaySettingsPanel.printLog && Main.isLoggingEnabled()) {\r\n\t\t\tSystem.out.println(this.getClass().getName() + \".\" + message);\r\n\t\t}\r\n\t}", "@Override\n public void compute(Iterable<IMessage<LongWritable,Text>> messages) {\n\t\t{\n\t\t\t// LOAD QUERY AND INITIALIZE LUCENE\n\t\t\tint count=0;\n\t\t\tint localecount=0;\n\t\t\tif(getSuperstep() == 0){\n\t\t\t\t\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tWriter vertexWriter = new BufferedWriter(new OutputStreamWriter(\n\t\t\t\t new FileOutputStream(\"/home/abhilash/SuccinctSubgraphFilesRerun/Sub\"+getSubgraph().getSubgraphId() + \"VertexData\" ), \"utf-8\"));\n\t\t\t\t\tWriter edgeWriter = new BufferedWriter(new OutputStreamWriter(\n\t\t\t\t new FileOutputStream(\"/home/abhilash/SuccinctSubgraphFilesRerun/Sub\"+getSubgraph().getSubgraphId() + \"edgeData\" ), \"utf-8\"));\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\tfor(IVertex<MapValue, MapValue, LongWritable, LongWritable> v : getSubgraph().getLocalVertices()) {\n//\t\t\t\t\tcount++;\n//\t\t\t\t\tif(count==1000) {\n//\t\t\t\t\t\tbreak;\n//\t\t\t\t\t}\n\t\t\t\t\tvertexWriter.write(getSubgraph().getSubgraphId().toString()+\"#\" + v.getValue().get(\"patid\") + \"@\" + v.getValue().get(\"country\") + \"$\" + v.getValue().get(\"nclass\") + \"|\\n\" );\n\t\t\t\t\tvertexWriter.flush();\n\t\t\t\t\tlocalecount=0;\n//\t\t\t\t\tArrayList<Long> localSinkArray = new ArrayList<>();\n\t\t\t\t\tArrayList<Long> remoteSinkArray = new ArrayList<>();\n\t\t\t\t\tStringBuilder str = new StringBuilder();\n\t\t\t\t\tfor(IEdge<MapValue, LongWritable, LongWritable> e:v.getOutEdges()) {\n\t\t\t\t\t\t\n\t\t\t\n//\t\t\t\t\t\tSystem.out.println(\"STR:\" + str.toString());\n\t\t\t\t\t\tif(!getSubgraph().getVertexById(e.getSinkVertexId()).isRemote()) {\n\t\t\t\t\t\t\tif(localecount==0) {\n\t\t\t\t\t\t\t\tstr.append(e.getSinkVertexId().get());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tstr.append(\":\").append(e.getSinkVertexId().get());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlocalecount++;\n//\t\t\t\t\t\t\tlocalSinkArray.add(e.getSinkVertexId().get());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tremoteSinkArray.add(e.getSinkVertexId().get());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tStringBuilder remoteStr = new StringBuilder();\n\t\t\t\t\tint rcount=0;\n\t\t\t\t\tfor(long rsink:remoteSinkArray) {\n\t\t\t\t\t\tif(rcount==0) {\n\t\t\t\t\t\t\tremoteStr.append(rsink);\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\tremoteStr.append(\":\").append(rsink);\n\t\t\t\t\t\t}\n\t\t\t\t\t\trcount++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(localecount==0) {\n\t\t\t\t\t\tedgeWriter.write(getSubgraph().getSubgraphId().toString()+\"#\" + v.getVertexId() + \"@\" + localecount + \"%\" + remoteStr.toString() + \"|\\n\" );\n\t\t\t\t\t}else {\n\t\t\t\t\t\tif(rcount==0) {\n\t\t\t\t\t\t\tedgeWriter.write(getSubgraph().getSubgraphId().toString()+\"#\" + v.getVertexId() + \"@\" + localecount + \"%\" + str.toString() + \"|\\n\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tedgeWriter.write(getSubgraph().getSubgraphId().toString()+\"#\" + v.getVertexId() + \"@\" + localecount + \"%\" +str.toString()+\":\"+ remoteStr.toString() + \"|\\n\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tedgeWriter.flush();\n\t\t\t\t}\n\t\t\t\tvertexWriter.close();\n\t\t\t\tedgeWriter.close();\n\t\t\t}catch(Exception e) {\n\t\t\t\t\n\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\n\n\t\t}\n\t\t\n\t\t\t\tvoteToHalt();\n\n \t\n \t\n }", "private void logAllMessages() {\r\n HistoricalMessage message;\r\n SessionProvider provider = SessionProvider.createSystemProvider();\r\n while (!logQueue.isEmpty()) {\r\n message = logQueue.poll();\r\n if (message != null) {\r\n this.addHistoricalMessage(message, provider);\r\n }\r\n }\r\n provider.close();\r\n }", "public void printGraph() {\n\t\tStringJoiner j = new StringJoiner(\", \");\n\t\tfor(Edge e : edgeList) {\n\t\t\tj.add(e.toString());\n\t\t}\n\t\t\n\t\tSystem.out.println(j.toString());\n\t}", "public static void processGraphInformation () {\n\n for (int i = 0; i < data.length(); i++) {\n if (data.charAt(i) == ',')\n cutPoints.add(i);\n }\n if(isNumeric(data.substring(1, cutPoints.get(0))))\n tempPPGWaveBuffer.add(Double.parseDouble(data.substring(1, cutPoints.get(0))));\n for (int j = 0; j < cutPoints.size(); j++) {\n\n if (j==cutPoints.size()-1){\n if(isNumeric(data.substring(cutPoints.get(j)+1,endOfLineIndex )))\n tempPPGWaveBuffer.add(Double.parseDouble(data.substring(cutPoints.get(j)+1,endOfLineIndex )));\n } else{\n if(isNumeric(data.substring(cutPoints.get(j) + 1, cutPoints.get(j+1))))\n tempPPGWaveBuffer.add(Double.parseDouble(data.substring(cutPoints.get(j) + 1, cutPoints.get(j+1))));\n }\n\n }\n graphIn.obtainMessage(handlerState4, Integer.toString(tempSampleTime)).sendToTarget(); //Comment this part to run junit tests\n if (tempSampleTime != 0) {\n tempReceived = true;\n graphIn.obtainMessage(handlerState2, Boolean.toString(tempReceived)).sendToTarget(); //Comment this part to run junit tests\n graphIn.obtainMessage(handlerState1, tempPPGWaveBuffer).sendToTarget(); //Comment this part to run junit tests\n } else {\n tempReceived = false;\n graphIn.obtainMessage(handlerState2, Boolean.toString(tempReceived)).sendToTarget(); //Comment this part to run junit tests\n }\n }", "void log() {\n\t\tm_drivetrain.log();\n\t\tm_forklift.log();\n\t}", "public void serializeLogs();", "public void logCmds(String[] cmds){\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tfor(int i = 0;i< cmds.length; i++){\r\n\t\tsb.append(cmds[i]);\r\n\t\tsb.append(\" \");\r\n\t\t}\r\n\t\t\r\n\t\tlog.info(\"logCmds Commands = \"+sb.toString());\r\n\t\t\r\n\t}", "public void print (){\r\n for (int i = 0; i < graph.size(); ++i){\r\n graph.get(i).print();\r\n }\r\n }", "static void showGraph(ArrayList<ArrayList<Integer>> graph) {\n for(int i=0;i< graph.size(); i++ ){\n System.out.print(\"Vertex : \" + i + \" : \");\n for(int j = 0; j < graph.get(i).size(); j++) {\n System.out.print(\" -> \"+ graph.get(i).get(j));\n }\n }\n }", "public void viewLogs() {\n\t}", "private void log(String message) {\n if (this.listener != null) {\n message = \"CollabNet Tracker: \" + message;\n this.listener.getLogger().println(message);\n }\n }", "private void showGraphFilterDiaglog() {\n mSeletedGraphDialogItems = new ArrayList();\n\n boolean[] checkedSelections = new boolean[6];\n Arrays.fill(checkedSelections, Boolean.FALSE);\n\n String userSelections = sharedPrefsUtilInst.getDoctorGraphFilter(defValueGraphFilters);\n\n if (userSelections.equals(\"\") == false) {\n\n String[] parts = userSelections.split(\"@\");\n\n for (int i = 0; i < parts.length; ++i) {\n\n int ind = Integer.parseInt(parts[i]);\n checkedSelections[ind] = true;\n mSeletedGraphDialogItems.add(ind);\n }\n }\n\n AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());\n View convertView = getActivity().getLayoutInflater().inflate(R.layout.patient_alert_dialog_title, null);\n alertDialog.setCustomTitle(convertView);\n alertDialog.setMultiChoiceItems(mGraphDialogItems, checkedSelections, new DialogInterface.OnMultiChoiceClickListener() {\n\n @Override\n public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) {\n\n if (isChecked == true) {\n\n mSeletedGraphDialogItems.add(indexSelected);\n }\n else if (mSeletedGraphDialogItems.contains(indexSelected)) {\n\n mSeletedGraphDialogItems.remove(Integer.valueOf(indexSelected));\n }\n }\n })\n .setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n\n @Override\n public void onClick(DialogInterface dialog, int id) {\n }\n })\n .setPositiveButton(\"OK\", new DialogInterface.OnClickListener() {\n\n @Override\n public void onClick(DialogInterface dialog, int id) {\n\n saveGraphFilters();\n }\n });\n\n // Set the line color\n Dialog d = alertDialog.show();\n int dividerId = d.getContext().getResources().getIdentifier(\"android:id/titleDivider\", null, null);\n View divider = d.findViewById(dividerId);\n divider.setBackground(new ColorDrawable(Color.parseColor(\"#00274c\")));\n }", "void printSubgraphs() {\n StringBuilder sb = new StringBuilder();\n for(int sgKey: listOfSolutions.keySet()) {\n HashMap<Integer, Long> soln = listOfSolutions.get(sgKey);\n // inside a soln\n //sb.append(\"S:8:\");\n for(int key: soln.keySet()) {\n sb.append(key + \",\" + soln.get(key) + \";\");\n\n }\n sb.setLength(sb.length() - 1);\n sb.append(\"\\n\");\n }\n System.out.println(\"\\n\" + sb.toString());\n }", "private void log() {\n logger.error(\"insert queue (last {}, current {}, change {}/minute)\",\n insertQueueLast, insertQueueCurrent,\n insertQueueDelta);\n logger.error(\"commits (last {}, current {}, change {}/minute)\",\n commitLast, commitCurrent, commitDelta);\n logger.error(\"dropped (last {}, current {}, change {}/minute)\",\n droppedLast, droppedCurrent, droppedDelta);\n logger.error(\"total memory {}; free memory {}\",\n Runtime.getRuntime().totalMemory(),\n Runtime.getRuntime().freeMemory());\n }", "private void addVerticesToGraph()\n\t{\n\t\tString vertexName;\n\n\t\tMap<Long, IOFSwitch> switches = this.floodlightProvider.getSwitches();\n\t\tfor(IOFSwitch s :switches.values())\n\t\t{\n\t\t\tvertexName =Long.toString(s.getId());\n\t\t\tm_graph.addVertex(vertexName);\t\t\t \t\t\t \n\t\t}\n\t\tSystem.out.println(m_graph);\n\t}", "@Override\n public void report() {\n\n try {\n File mFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/metrics.txt\");\n File eFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/latency_throughput.txt\");\n if (!mFile.exists()) {\n mFile.createNewFile();\n }\n if (!eFile.exists()) {\n eFile.createNewFile();\n }\n\n FileOutputStream mFileOut = new FileOutputStream(mFile, true);\n FileOutputStream eFileOut = new FileOutputStream(eFile, true);\n\n StringBuilder builder = new StringBuilder((int) (this.previousSize * 1.1D));\n StringBuilder eBuilder = new StringBuilder((int) (this.previousSize * 1.1D));\n\n// Instant now = Instant.now();\n LocalDateTime now = LocalDateTime.now();\n\n builder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n eBuilder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n\n builder.append(lineSeparator).append(\"---------- Counters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- records counter ----------\").append(lineSeparator);\n for (Map.Entry metric : counters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n if (( (String)metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Gauges ----------\").append(lineSeparator);\n for (Map.Entry metric : gauges.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Gauge) metric.getKey()).getValue()).append(lineSeparator);\n }\n\n builder.append(lineSeparator).append(\"---------- Meters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- throughput ----------\").append(lineSeparator);\n for (Map.Entry metric : meters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n if (((String) metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Histograms ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- lantency ----------\").append(lineSeparator);\n for (Map.Entry metric : histograms.entrySet()) {\n HistogramStatistics stats = ((Histogram) metric.getKey()).getStatistics();\n builder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n eBuilder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n }\n\n mFileOut.write(builder.toString().getBytes());\n eFileOut.write(eBuilder.toString().getBytes());\n mFileOut.flush();\n eFileOut.flush();\n mFileOut.close();\n eFileOut.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "private static void print(final String format, final Object...params) {\n // we prefix all our messages with \">>> \" so as to distinguish them from the driver, node and client messages\n final String msg = String.format(\">>> \" + format, params);\n log.info(msg);\n System.out.println(msg);\n }", "public void beginLogging() {\n\t\ttry {\n\t\t\tserverSocket.setSoTimeout(0);\n\t\t} catch(SocketException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tSystem.out.println(\"Beginning logging...\");\t\t\n\n\t\twhile(keepRunning) {\n\n\t\t\ttry {\n\t\t\t\tSocket clientSocket = serverSocket.accept();\n\n\t\t\t\tSystem.out.println(\"Accepted a client for a NetworkDatum log!\");\n\t\t\t\t\n\t\t\t\tObjectInputStream inputData = new ObjectInputStream(clientSocket.getInputStream());\n\n\t\t\t\tSystem.out.println(\"Trying to add NetworkDatum to our list...\");\n\n\t\t\t\ttry {\n\t\t\t\t\tNetworkDatum nd = (NetworkDatum) inputData.readObject();\n\t\t\t\t\tnetworkLog.add(nd);\n\n\t\t\t\t\tSystem.out.println(\"NetworkDatum added from \" + nd.username + \" at playback time: \" + nd.time);\n\n\t\t\t\t} catch (ClassNotFoundException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t} catch(IOException e) {\n\t\t\t\tnetworkLog.registerError();\n\t\t\t}\n\n\t\t}\n\t}", "void log(Message message);", "private static void printGraph(ArrayList<Vertex> graph) {\n\t\tSystem.out.print(\"---GRAPH PRINT START---\");\n\t\tfor (Vertex vertex: graph) {\n\t\t\tSystem.out.println(\"\\n\\n\" + vertex.getValue());\n\t\t\tSystem.out.print(\"Adjacent nodes: \");\n\t\t\tfor (Vertex v: vertex.getAdjacencyList()) {\n\t\t\t\tSystem.out.print(v.getValue() + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\\n\\n---GRAPH PRINT END---\\n\\n\");\n\t}", "public void logs(Object message) {\n System.out.println(message.toString());\n }", "void printGraph(Station station, Sensor sensor, MeasurementData data, LocalDateTime since, LocalDateTime until, ParamType paramType, double range);", "public void dotGraph(BufferedWriter out) throws IOException {\n out.write(\"digraph \\\"\"+this.method+\"\\\" {\\n\");\n IndexMap m = new IndexMap(\"MethodCallMap\");\n for (Iterator i=nodeIterator(); i.hasNext(); ) {\n Node n = (Node) i.next();\n out.write(\"n\"+n.id+\" [label=\\\"\"+n.toString_short()+\"\\\"];\\n\");\n }\n for (Iterator i=getCalls().iterator(); i.hasNext(); ) {\n ProgramLocation mc = (ProgramLocation) i.next();\n int k = m.get(mc);\n out.write(\"mc\"+k+\" [label=\\\"\"+mc+\"\\\"];\\n\");\n }\n for (Iterator i=nodeIterator(); i.hasNext(); ) {\n Node n = (Node) i.next();\n for (Iterator j=n.getNonEscapingEdges().iterator(); j.hasNext(); ) {\n Map.Entry e = (Map.Entry) j.next();\n String fieldName = \"\"+e.getKey();\n Iterator k;\n if (e.getValue() instanceof Set) k = ((Set)e.getValue()).iterator();\n else k = Collections.singleton(e.getValue()).iterator();\n while (k.hasNext()) {\n Node n2 = (Node) k.next();\n out.write(\"n\"+n.id+\" -> n\"+n2.id+\" [label=\\\"\"+fieldName+\"\\\"];\\n\");\n }\n }\n for (Iterator j=n.getAccessPathEdges().iterator(); j.hasNext(); ) {\n Map.Entry e = (Map.Entry) j.next();\n String fieldName = \"\"+e.getKey();\n Iterator k;\n if (e.getValue() instanceof Set) k = ((Set)e.getValue()).iterator();\n else k = Collections.singleton(e.getValue()).iterator();\n while (k.hasNext()) {\n Node n2 = (Node) k.next();\n out.write(\"n\"+n.id+\" -> n\"+n2.id+\" [label=\\\"\"+fieldName+\"\\\",style=dashed];\\n\");\n }\n }\n if (n.getPassedParameters() != null) {\n for (Iterator j=n.getPassedParameters().iterator(); j.hasNext(); ) {\n PassedParameter pp = (PassedParameter) j.next();\n int k = m.get(pp.m);\n out.write(\"n\"+n.id+\" -> mc\"+k+\" [label=\\\"p\"+pp.paramNum+\"\\\",style=dotted];\\n\");\n }\n }\n if (n instanceof ReturnedNode) {\n ReturnedNode rn = (ReturnedNode) n;\n int k = m.get(rn.m);\n out.write(\"mc\"+k+\" -> n\"+n.id+\" [label=\\\"r\\\",style=dotted];\\n\");\n }\n }\n for (Iterator i=castMap.entrySet().iterator(); i.hasNext(); ) {\n Map.Entry e = (Map.Entry) i.next();\n Node n = (Node)((Pair)e.getKey()).left;\n Node n2 = (Node)e.getValue();\n if (nodes.containsKey(n2))\n out.write(\"n\"+n.id+\" -> n\"+n2.id+\" [label=\\\"(cast)\\\"];\\n\");\n }\n out.write(\"}\\n\");\n }", "public abstract String rawGraphToString();", "void visualizeGraph(double input, double dvallog) {\n synchronized (this) {\n graph.beginDraw();\n graph.stroke(50);\n graph.strokeWeight(2);\n graph.clear();\n float py = graph.height;\n for (int a = 1; a < graph.width; a++) {\n double db = graphSize * ((double)a / graph.width - 1) / 20;\n float cy = -graph.height * 20 * (float)getOutput(db, db) / graphSize;\n graph.line(a - 1, py, a, cy);\n py = cy;\n }\n graph.noFill();\n //if (sideChain != null) {\n graph.ellipse(graph.width * Math.min(1, 20 * (float)dvallog / graphSize + 1), -graph.height * 20 * (float)getOutput(dvallog, dvallog) / graphSize, 10, 10);\n //graph.ellipse(graph.width * Math.min(1, 20 * (float)Math.log10(input) / graphSize + 1), -graph.height * 20 * (float)Math.log10(getRMS(bufOut)) / graphSize, 10, 10);\n graph.endDraw();\n }\n }", "static void displayMessage() {\n\n System.out.println(\"\\nA total of \" + graphVisited.size() + \" vertices visited\");\n\n System.out.println(\"Found \" + silhouetteAnalyzer(numberOfVertices)\n + \" silhouettes\");\n }", "private void printGraph() {\r\n\t\tSortedSet<String> keys = new TreeSet<String>(vertexMap.keySet());\r\n\t\tIterator it = keys.iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tVertex v = vertexMap.get(it.next());\r\n\t\t\tif (v.isStatus())\r\n\t\t\t\tSystem.out.println(v.getName());\r\n\t\t\telse\r\n\t\t\t\tSystem.out.println(v.getName() + \" DOWN\");\r\n\t\t\tsortEdges(v.adjacent);\r\n\t\t\tfor (Iterator i = v.adjacent.iterator(); i.hasNext();) {\r\n\t\t\t\t// v.adjacent.sort();\r\n\t\t\t\tEdge edge = (Edge) i.next();\r\n\t\t\t\tif (edge.isStatus())\r\n\t\t\t\t\tSystem.out.println(\" \" + edge.getDestination() + \" \" + edge.getCost());\r\n\t\t\t\telse\r\n\t\t\t\t\tSystem.out.println(\" \" + edge.getDestination() + \" \" + edge.getCost() + \" DOWN\");\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void showLogs() {\n String headID = Utils.readObject(HEADFILE, String.class);\n File asFile = new File(Main.ALL_COMMITS, headID);\n Commit associatedCommit = Utils.readObject(asFile, Commit.class);\n while (associatedCommit != null) {\n printCommitLog(associatedCommit);\n String parent = associatedCommit.getParent();\n if (parent == null) {\n break;\n }\n File commitFile = new File(Main.ALL_COMMITS, parent);\n associatedCommit = Utils.readObject(commitFile, Commit.class);\n }\n }", "public void log(String message) {\n\t\tfor(LoggerInterface logger: loggers) {\n\t\t\tlogger.log(message);\n\t\t}\n\t}", "public void showInformationMessages(final List<String> messages) {\r\n\r\n final StringBuilder sb = new StringBuilder();\r\n\r\n for (String message : messages) {\r\n sb.append(message).append(LINE_SEPARATOR);\r\n }\r\n\r\n showInformationMessage(sb.toString());\r\n }", "public void buildGraph(){\n\t}", "private void addLinkesToGraph()\n\t{\n\t\tString from,to;\n\t\tshort sourcePort,destPort;\n\t\tMap<Long, Set<Link>> mapswitch= linkDiscover.getSwitchLinks();\n\n\t\tfor(Long switchId:mapswitch.keySet())\n\t\t{\n\t\t\tfor(Link l: mapswitch.get(switchId))\n\t\t\t{\n\t\t\t\tfrom = Long.toString(l.getSrc());\n\t\t\t\tto = Long.toString(l.getDst());\n\t\t\t\tsourcePort = l.getSrcPort();\n\t\t\t\tdestPort = l.getDstPort();\n\t\t\t\tm_graph.addEdge(from, to, Capacity ,sourcePort,destPort);\n\t\t\t} \n\t\t}\n\t\tSystem.out.println(m_graph);\n\t}", "private void processMessageQueue(){\n\t\tKIDSGUIAlert m = null;\n\t\tStringBuilder newText = new StringBuilder(logLines.getText());\n\t\twhile ((m = this.logMessages.poll()) != null){\n\t\t\tnewText.append(String.format(\"%s\\n\", m.toString()));\n\t\t}\n\t\tlogLines.setText(newText.toString());\n\t}", "private static void log(String aMsg){\n\t System.out.println(aMsg);\n\t }", "@Override\n public void log(String message) {\n }", "@Override\n public void log(Class<?> clazz, String message,Object... bizObjects) {\n Logger.i(clazz.getSimpleName(),message);\n }", "public void printGraph() {\n System.out.println( );\n // the cell number corresponding to a location on a GameBoard\n String cell = \"\"; \n // the distance a cell is from the starting location\n String dist = \"\"; \n\n // for every cell in the graph\n for ( int i = 0; i < graph.length; i++ ) {\n\n // format graph by prefixing a 0 if the number is less\n // than 10. this will ensure output is uniform\n if ( graph[i].graphLoc < 10 )\n cell = \"0\" + graph[i].graphLoc;\n else\n cell = graph[i].graphLoc + \"\";\n\n // format distance by prefixing a space if the number\n // is between 0 and 9 inclusive\n if ( graph[i].dist < 10 && graph[i].dist >= 0 )\n dist = graph[i].dist + \" \";\n // give red color if the cell was never checked\n else if ( graph[i].dist == -1 )\n dist = ANSI_RED + graph[i].dist + \"\" + ANSI_RESET;\n else\n dist = graph[i].dist + \"\";\n\n // print the cell and distance\n // an example output is [13: 5]\n System.out.print(\"[\"+cell+\":\"+dist+\"]\");\n\n // create a new line for the next row\n if ( (i+1) % GameBoard.COLUMNS == 0 )\n System.out.println(\"\\n\");\n }\n }", "@Override\n\tpublic void log(Level level, Marker marker, String message, Object... params) {\n\n\t}", "private void drawGraph() {\n // you can show warning messages now\n imrGuiBean.showWarningMessages(true);\n addGraphPanel();\n setButtonsEnable(true);\n }", "public void logMsg(String msg, String... param) {\n messageContainer.setVisible(true);\n messageContainer.setText(msg);\n for (String string : param) {\n System.out.println(string); \n }\n }", "private void drawLoglines(Canvas canvas) {\n\n for(int i = 0; i < log.logLines.size(); i ++) {\n float txtYpos = (float) (\n firstLineYpos + // The height of the top bar\n (lineGap * (i + 0.5d)) + // Move down the log to the right spot\n (paint.getTextSize() / 3d) // Centering the text vertically\n );\n\n String dadTime = MyTime.getDadTime(\n log.logLines.get(i).startTime.hour,\n log.logLines.get(i).startTime.minute\n );\n canvas.drawText(\n String.valueOf(dadTime.charAt(0)), \n sideLimit,// Correct x-position according to the chart above\n txtYpos,\n paint\n );\n canvas.drawText(\n String.valueOf(dadTime.charAt(1)),\n sideLimit + paint.measureText(\"8\"), // Correct x-position according to the chart above\n txtYpos,\n paint\n );\n canvas.drawText(\n String.valueOf(dadTime.charAt(2)),\n sideLimit + paint.measureText(\"88\"), // Correct x-position according to the chart above\n txtYpos,\n paint\n );\n canvas.drawText(\n \"-\",\n sideLimit + paint.measureText(\"888N\"), // Correct x-position according to the chart above\n txtYpos,\n paint\n );\n canvas.drawText(\n log.logLines.get(i).subject.name,\n sideLimit + paint.measureText(\"888N-N\"), // Correct x-position according to the chart above\n txtYpos,\n paint\n );\n }\n }", "public void log(String message, Severity sev) {\n\t\tfor(LoggerInterface logger: loggers) {\n\t\t\tlogger.log(message, sev);\n\t\t}\n\t}", "public void printMessagesAsInfo() {\n logger.info(Thread.currentThread().getStackTrace()[1].getMethodName());\n if(messages != null) {\n for (String message : messages) {\n logger.debug(message);\n }\n }\n }", "private void printChannels(GuildMessageReceivedEvent event) {\n // All hail the LAMBDA!\n event.getGuild().getCategories().forEach(category -> {\n System.out.println(category.getName());\n event.getChannel().sendMessage(category.getName()).queue();\n category.getChannels().forEach(guildChannel -> {\n if (guildChannel.getType().equals(ChannelType.TEXT)){\n System.out.println(guildChannel.getName() +\n \":\\thttps://www.discord.com/channels/\" + category.getGuild().getId() + \"/\" + guildChannel.getId());\n event.getChannel().sendMessage(guildChannel.getName() +\n \":\\thttps://www.discord.com/channels/\" + category.getGuild().getId() + \"/\" + guildChannel.getId()).queue();\n }});\n });\n }", "@Override\n public void logs() {\n \n }", "public final void toLogFile() {\n\t\tRetroTectorEngine.toLogFile(\"Error message from \" + THESTRINGS[0] + \":\");\n\t\tfor (int i=1; i<THESTRINGS.length; i++) {\n\t\t\tRetroTectorEngine.toLogFile(THESTRINGS[i]);\n\t\t}\n\t}", "java.lang.String getLogMessage();", "private void logMessage(String msg) {\n\n\t\tlog.logMsg(\"(L\" + lexAnalyser.getLineCount() + \")\" + msg + \"\\n\");\n\n\t\t// System.out.println(\"(L\" + lexAnalyser.getLineCount() + \")\" + msg);\n\n\t}", "public void log(String message) {\n logger.log(\"[\" + game.getName() + \"] \" + message);\n }", "@Override\n\tpublic void trace(Marker marker, Message msg) {\n\n\t}", "@Override\r\n\tprotected void logMessage(String message) {\n\t\t\r\n\t}", "protected void log(String msg) {\n\t\tif(isLogging) {\n\t\t\tSystem.out.println(\"[TRACKER \" + id() + \"] \" + msg);\n\t\t}\n\t}", "static void log(\r\n Level level, String message, Iterable<? extends Module> modules)\r\n {\r\n logger.log(level, message);\r\n for (Module module : modules)\r\n {\r\n logger.log(level, \" \" + module);\r\n }\r\n }", "public void printMessages(){\n for(int i =0; i<msgCount;++i){\n System.out.printf(\"%s %s\\n\",messages[i].getRecipient()+\":\",messages[i].getDecodedMessage());\n }\n }", "public void printMessages() {\n logger.info(Thread.currentThread().getStackTrace()[1].getMethodName());\n if(messages != null) {\n logger.debug(\"Printing out Error Messages\");\n for (String message: messages) {\n logger.error(message);\n }\n }\n if(exception != null) {\n exception.printStackTrace();\n }\n }", "private void logIt(String msg) {\n\tSystem.out.println(\"PLATINUM-SYNC-LOG: \" + msg);\n}", "public void displayPaths() {\r\n\t\tlog.debug(\"startPaths\");\r\n\t\tfor ( Map.Entry<Integer, Vector<Edge>> entry: startPaths.entrySet()) {\r\n\t\t\tfor ( Edge edge: entry.getValue()) {\r\n\t\t\t\tlog.debug( entry.getKey() + \": \" + edge.StartRoom + \"->\" + edge.door + \"->\" + edge.DestinationRoom );\r\n\t\t\t}\r\n\t\t}\r\n\t\tlog.debug(\"destinationPaths\");\r\n\t\tfor ( Map.Entry<Integer, Vector<Edge>> entry: destinationPaths.entrySet()) {\r\n\t\t\tfor ( Edge edge: entry.getValue()) {\r\n\t\t\t\tlog.debug( entry.getKey() + \": \" + edge.StartRoom + \"->\" + edge.door + \"->\" + edge.DestinationRoom );\r\n\t\t\t}\r\n\t\t}\r\n\t}", "protected void log(Object msg) {\n\t\n\t\tSystem.out.println(\"MusicDataAccessor: \" + msg);\n\t}", "public static void printGraph( Graph graph ){\n\t\tint size = graph.getGraph().size();\n\t\tStringBuilder sb = new StringBuilder(); \n\t\tint weight = 0;\n\t\tfor( String start: graph.getGraph().keySet() ) {\n\t\t\tfor( String end : graph.getGraph().get(start).keySet() ) {\n\t\t\t\tweight = graph.getGraph().get(start).get(end);\n\t\t\t\tsb.append( start + end + String.valueOf(weight) + \", \" );\n\t\t\t}\n\t\t}\n\t\tsb.delete(sb.length()-2, sb.length());\n\t\tSystem.out.println(sb.toString());\n\t}", "public static void extractConsoleLogs(WorkflowRun workflowRun) {\n FlowExecution execution = workflowRun.getExecution();\n ExecutionNodeExtractor visitor = new ExecutionNodeExtractor(workflowRun);\n if (execution != null) {\n ForkScanner.visitSimpleChunks(execution.getCurrentHeads(), visitor, new LabelledChunkFinder());\n }\n\n Map<String, String> nodeWithNames = visitor.getStages().stream()\n .filter(stageNodeExt -> !stageNodeExt.getStatus().equals(StatusExt.NOT_EXECUTED))\n .collect(Collectors.toMap(StageNodeExt::getId, StageNodeExt::getName));\n\n Map<String, Set<String>> logsNodeWise = new HashMap<>();\n\n FlowExecution exec = workflowRun.getExecution();\n if (exec != null) {\n FlowGraphWalker walker = new FlowGraphWalker(exec);\n for (FlowNode node : walker) {\n try {\n LogAction action = node.getAction(LogAction.class);\n LinkedHashSet<String> messages = new LinkedHashSet<>();\n if (action != null && action.getLogText() != null) {\n AnnotatedLargeText<? extends FlowNode> logText = action.getLogText();\n StringWriter writer = new StringWriter();\n\n logText.writeLogTo(0, writer);\n if (StringUtils.isNotEmpty(writer.toString())) {\n messages.add(writer.toString());\n }\n writer.close();\n }\n\n ErrorAction error = node.getError();\n if (error != null) {\n Throwable throwable = error.getError();\n messages.add(throwable.getMessage());\n }\n\n String nodeName = getLogPrefix(node, nodeWithNames);\n\n if (CollectionUtils.isNotEmpty(messages)) {\n if (logsNodeWise.containsKey(nodeName)) {\n logsNodeWise.get(nodeName).addAll(messages);\n } else {\n logsNodeWise.put(nodeName, messages);\n }\n }\n } catch (Exception e) {\n LOG.log(Level.WARNING, \"Error Sending console Logs\", e);\n }\n }\n logsNodeWise.forEach((nodeName, messages) -> {\n StringBuilder stringBuilder = new StringBuilder();\n messages.forEach(s -> {\n stringBuilder.append(\"[\").append(DATETIME_FORMATTER.format(new Date()))\n .append(\"] \").append(\" \")\n .append(s).append(\"\\n\");\n });\n logSenderHelper.sendConsoleLogs(stringBuilder.toString(), workflowRun.getParent().getFullName(), workflowRun.getNumber(), nodeName);\n });\n }\n }", "private void buildGraph() {\n\t\tfor (Map<String, Channel> map: this.channels.values()) {\n\t\t\t// Add all channels\n\t\t\t\n\t\t\t// TODO: deal with channels spread over multiple redis instances (replicated)\n\t\t\t\n\t\t\t// Add all but ignore if some channels should be ignored\n\t\t\tfor (Map.Entry<String, Channel> entry: map.entrySet()) {\n\t\t\t\tif (IGNORE_UNICAST_AND_SUBSCRIBE) {\n\t\t\t\t\tif (entry.getKey().startsWith(\"unicast\") == false && entry.getKey().startsWith(\"sub\") == false) {\n\t\t\t\t\t\tif (entry.getKey().startsWith(\"tile\")) {\n\t\t\t\t\t\t\tchannelList.add(entry.getValue());\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tchannelList.add(entry.getValue());\n\t\t\t\t}\n\t\t\t}\n\t\t\t//channelList.addAll(map.values());\n\t\t}\n\t\t\n\t\t// Double-iteration to build pairs\n\t\tfor (Channel channel1: channelList) {\n\t\t\tfor (Channel channel2: channelList) {\n\t\t\t\tif (channel1 != channel2) {\n\t\t\t\t\t// Put channels as nodes in the set\n\t\t\t\t\tthis.nodes.add(channel1.getChannelName());\n\t\t\t\t\tthis.nodes.add(channel2.getChannelName());\n\t\t\t\t\t\n\t\t\t\t\t// Build pair\n\t\t\t\t\tChannelPair pair = new ChannelPair(channel1.getChannelName(), channel2.getChannelName());\n\t\t\t\t\t\n\t\t\t\t\t// Check if it is contained in the map\n\t\t\t\t\tif (this.pairMultiplicity.containsKey(pair) == false) {\n\t\t\t\t\t\t// Count common subscribers\n\t\t\t\t\t\tint commonSubscribers = countCommonSubscribers(channel1, channel2);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (commonSubscribers > 0) {\n\t\t\t\t\t\t\t// Perform computation and add it\n\t\t\t\t\t\t\tthis.pairMultiplicity.put(pair, commonSubscribers);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t}", "private void logMinimalForms(List<Set<Mask>> minimalForms) {\n\t\tLOG.log(Level.FINE, () -> \"\");\n\t\tLOG.log(Level.FINE, () -> \"Minimalni oblici funkcije su:\");\n\t\tfor (Set<Mask> set : minimalForms) {\n\t\t\tLOG.log(Level.FINE, set::toString);\n\n\t\t}\n\t}", "private void logMetric(Metric m) {\n getProject().log(\n \"Metric \" + m.getName() + \" for type \" + m.getType()\n + \" has result \" + m.getResult()\n + \" the old value is: \" + m.getOldValue()\n + \" the new value is: \" + m.getNewValue());\n }", "private void log(String message) {\n System.out.println(message);\n }", "abstract void logMessage(String message);", "public static void metricsPrintln(String arg0) {\n MDC.clear();\n metricsLogger.info(arg0);\n }", "@Override\n\tpublic void trace(Marker marker, String message) {\n\n\t}", "public void logDebugData() {\n SmartDashboard.putNumber(\"Ele Pos\", getPosition());\n SmartDashboard.putBoolean(\"Ele Switch\", bottomSwitchValue());\n SmartDashboard.putNumber(\"Ele Current\", getCurrent());\n SmartDashboard.putNumber(\"Ele Out %\", elevatorSpark.getAppliedOutput());\n }", "void printGraph() {\n for (Vertex u : this) {\n System.out.print(u + \": \");\n for (Edge e : u.Adj) {\n System.out.print(e);\n }\n System.out.println();\n }\n }", "public void printDGraph(){\n System.out.println(this.toString());\n }", "public void log(String message) {\r\n log.append(\"[\" + new SimpleDateFormat(\"HH:mm:ss\").format(new Date()) + \"] \" + message + \"\\n\");\r\n System.out.println(\"[\" + new SimpleDateFormat(\"HH:mm:ss\").format(new Date()) + \"] \" + message);\r\n }", "void log(String message) {\n System.out.println(buildMessage(message));\n }", "@Override\n public void log() {\n switch (this.level) {\n case trace: if (!this.logger.isTraceEnabled()) return;\n break;\n case debug: if (!this.logger.isDebugEnabled()) return;\n break;\n case info: if (!this.logger.isInfoEnabled()) return;\n break;\n case warn: if (!this.logger.isWarnEnabled()) return;\n break;\n case error: if (!this.logger.isErrorEnabled()) return;\n break;\n }\n\n if (this.logger.getClass().equals(ch.qos.logback.classic.Logger.class)) {\n if (!((ch.qos.logback.classic.Logger)this.logger).isAdditive()) {\n return;\n }\n }\n\n this.mdcWriters.forEach(MDCWriter::write);\n\n switch (this.level) {\n case trace:\n this.logger.trace(this.message, this.args.toJavaArray());\n break;\n case debug:\n this.logger.debug(this.message, this.args.toJavaArray());\n break;\n case info:\n this.logger.info(this.message, this.args.toJavaArray());\n break;\n case warn:\n this.logger.warn(this.message, this.args.toJavaArray());\n break;\n case error:\n this.logger.error(this.message, this.args.toJavaArray());\n break;\n }\n }", "public void logChat(String text) {\n\t\ttry {\n\n\t\t\tDateFormat df = new SimpleDateFormat(\"'On' MM/dd/yyyy 'at' HH:mm:ss\");\n\t\t\tDate d = new Date();\n\n\t\t\tchatLog.add(df.format(d) + \", \" + c.getDisplayName() + \" said: \" + text + \"\");\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\n\t\t} finally {\n\t\t\twriteChatLog();\n\t\t}\n\t}", "public void log() {\n String headID = head.getCommitID();\n while (headID != null) {\n File curr = new File(\".gitlet/commits/\" + headID);\n Comm currcomm = Utils.readObject(curr, Comm.class);\n System.out.println(\"===\");\n System.out.println(\"commit \" + currcomm.getCommitID());\n if (currcomm.getMergepointer() != null) {\n System.out.println(\"Merge: \"\n + currcomm.getParent().getCommitID()\n .substring(0, 7) + \" \"\n + currcomm.getMergepointer().getCommitID()\n .substring(0, 7));\n }\n System.out.println(\"Date: \" + currcomm.getDate());\n System.out.println(currcomm.getMessage());\n System.out.println();\n if (currcomm.getParent() == null) {\n break;\n } else {\n headID = currcomm.getParent().getCommitID();\n }\n }\n }", "String targetGraph();", "private void log(String message) {\n System.out.println( message );\n sb.append( message ).append( \"\\n\" );\n }", "abstract protected void _log(TrackingActivity activity) throws Exception;", "private void logMessage(ReceivedStuff mess, User user, boolean iAmSender){\n HistMessage histMessage = new HistMessage(mess, iAmSender, new Date());\n user.addMessage(histMessage);\n }", "public void log(String message) {\n\t}", "private void doLogAction(List<HipaaLogMessage> logMsgList) {\n logMsgList.forEach(logMsg -> {\n try {\n logger.log(logMsg);\n } catch (HipaaException e) {\n log.warn(\"Exception: [{}]\", e.getMessage());\n }\n });\n }", "private void NodeandMessage (String nodes, String Message) {\n\t\tNodeandnetwork.put(nodes, Message);\n\t}", "private void createGraphs() {\n initialGraphCreation.accept(caller, listener);\n graphCustomization.accept(caller, listener);\n caller.generateAndAdd(params.getNumCallerEvents(), callerAddToGraphTest);\n listener.generateAndAdd(params.getNumListenerEvents(), listenerAddToGraphTest);\n generationDefinitions.accept(caller, listener);\n }", "@Override\n\tpublic void trace(Marker marker, Object message) {\n\n\t}", "void printGraph() {\n System.out.println(\n \"All vertices in the graph are presented below.\\n\" +\n \"Their individual edges presented after a tab. \\n\" +\n \"-------\");\n\n for (Map.Entry<Vertex, LinkedList<Vertex>> entry : verticesAndTheirEdges.entrySet()) {\n LinkedList<Vertex> adj = entry.getValue();\n System.out.println(\"Vertex: \" + entry.getKey().getName());\n for (Vertex v : adj) {\n System.out.println(\" \" + v.getName());\n }\n }\n }", "public void onLogMessage(String message);", "public void outputCurrentGraphStatistics(ONDEXGraph graph) {\n fireEventOccurred(new GeneralOutputEvent(\"\\nGraph Statistics for \" + graph.getName(), getCurrentMethodName()));\n ONDEXIterator<ONDEXConcept> cit = graph.getConcepts();\n fireEventOccurred(new GeneralOutputEvent(\"\\nConcepts: \" + cit.size(), getCurrentMethodName()));\n cit.close();\n cit = null;\n ONDEXIterator<ONDEXRelation> rit = graph.getRelations();\n if (rit == null) {\n fireEventOccurred(new GeneralOutputEvent(\"\\nRelations: 0\", getCurrentMethodName()));\n } else {\n fireEventOccurred(new GeneralOutputEvent(\"\\nRelations: \" + rit.size(), getCurrentMethodName()));\n rit.close();\n }\n rit = null;\n ONDEXIterator<CV> cvit = graph.getMetaData().getCVs();\n fireEventOccurred(new GeneralOutputEvent(\"\\nCVs: \" + cvit.size(), getCurrentMethodName()));\n cvit.close();\n cvit = null;\n ONDEXIterator<ConceptClass> ccit = graph.getMetaData().getConceptClasses();\n fireEventOccurred(new GeneralOutputEvent(\"\\nCCs: \" + ccit.size(), getCurrentMethodName()));\n ccit.close();\n ccit = null;\n ONDEXIterator<RelationType> rtit = graph.getMetaData().getRelationTypes();\n fireEventOccurred(new GeneralOutputEvent(\"\\nRTs: \" + rtit.size(), getCurrentMethodName()));\n rtit.close();\n rtit = null;\n ONDEXIterator<RelationType> rtsetit = graph.getMetaData().getRelationTypes();\n fireEventOccurred(new GeneralOutputEvent(\"\\nRTsets: \" + rtsetit.size(), getCurrentMethodName()));\n rtsetit.close();\n rtsetit = null;\n }", "protected void logList(List<String> log) {\n\t\tfor (String string : log) {\n\t\t\tlogMsg(string);\t\n\t\t\tif (string.startsWith(\"error \")) {\n\t\t\t\talert(string.replaceFirst(\"^error \", \"\"));\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2,\n\t\t\tObject p3, Object p4, Object p5, Object p6) {\n\n\t}", "@Override\n\tpublic void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2,\n\t\t\tObject p3, Object p4, Object p5, Object p6, Object p7) {\n\n\t}" ]
[ "0.58653265", "0.5620501", "0.5561195", "0.5546202", "0.5483517", "0.53807855", "0.5359266", "0.5358611", "0.5349227", "0.53401893", "0.53134036", "0.5303085", "0.52837855", "0.5254636", "0.524579", "0.5240814", "0.52211344", "0.52208483", "0.52041477", "0.51327974", "0.5111655", "0.5111369", "0.5109236", "0.51038975", "0.5098146", "0.50833696", "0.5068491", "0.5058459", "0.5056948", "0.5048883", "0.50483865", "0.503099", "0.502396", "0.5017795", "0.50088495", "0.50083864", "0.50004476", "0.49941093", "0.4983196", "0.49825", "0.4973607", "0.49734136", "0.4970792", "0.49662247", "0.49653527", "0.4960885", "0.49604163", "0.49578464", "0.49422166", "0.4937428", "0.4927888", "0.49259734", "0.49145648", "0.49009117", "0.48986667", "0.48928654", "0.48918316", "0.487226", "0.48712337", "0.48711777", "0.48688263", "0.48685154", "0.48637107", "0.48625672", "0.4860842", "0.48570228", "0.48555008", "0.48529872", "0.48470217", "0.48443255", "0.48345247", "0.48290673", "0.48202348", "0.48163214", "0.48130244", "0.48117223", "0.48086756", "0.48037356", "0.4796329", "0.47949147", "0.47878575", "0.47827476", "0.4781465", "0.4777061", "0.47744963", "0.47578606", "0.4756616", "0.4756442", "0.47512957", "0.4750868", "0.47463384", "0.47455597", "0.47451675", "0.47450265", "0.47445142", "0.4741704", "0.4738825", "0.47327724", "0.4727871", "0.47248843" ]
0.790797
0
Generates NodePairs of all possible pairs of nodes from given list of nodes.
private List<NodePair> allNodePairs(List<Node> nodes) { List<NodePair> nodePairs = new ArrayList<>(); for (int j = 0; j < nodes.size() - 1; j++) { for (int k = j + 1; k < nodes.size(); k++) { nodePairs.add(new NodePair(nodes.get(j), nodes.get(k))); } } return nodePairs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void generatePointPairs() {\n\t\tfinal int mod = SIZE_OF_ORIGINAL_LIST * 8; \n\t\t\n\t\tif(DEBUG) System.out.println(\"----- Generating Point Pairs...\");\n\n\t\tint counter = 0;\n\t\tint j = 0;\n\t\t\n\t\tfor(int i = 0; i < myPoints.length; i++) {\n\t\t\t//while(j++ < myPoints.length) {\n\t\t\tfor( ; j < myPoints.length; j++) {\n\t\t\t\t// i and j are the same point, so ignore that pair.\n\t\t\t\tif(i != j) {\n\t\t\t\t\tmyPairs.add(new PointPair(myPoints[i], myPoints[j]));\n\t\t\t\t\tif(DEBUG && ++counter % mod == 0) System.out.print(\"pair \");\n\t\t\t\t}\n\t\t\t\t// Not yet colinear, just a unique pair to use later.\n\t\t\t}\n\n\t\t}\n\t\tif(DEBUG) System.out.println(\"\\n----- ----- \" + counter + \" pairs found.\\n\");\n\t}", "private void phaseTwo(){\r\n\r\n\t\tCollections.shuffle(allNodes, random);\r\n\t\tList<Pair<Node, Node>> pairs = new ArrayList<Pair<Node, Node>>();\r\n\t\t\r\n\t\t//For each node in allNode, get all relationshpis and iterate through each relationship.\r\n\t\tfor (Node n1 : allNodes){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//If a node n1 is related to any other node in allNodes, add those relationships to rels.\r\n\t\t\t\t//Avoid duplication, and self loops.\r\n\t\t\t\tIterable<Relationship> ite = n1.getRelationships(Direction.BOTH);\t\t\t\t\r\n\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\tNode n2 = rel.getOtherNode(n1);\t//Get the other node\r\n\t\t\t\t\tif (allNodes.contains(n2) && !n1.equals(n2)){\t\t\t\t\t//If n2 is part of allNodes and n1 != n2\r\n\t\t\t\t\t\tif (!rels.contains(rel)){\t\t\t\t\t\t\t\t\t//If the relationship is not already part of rels\r\n\t\t\t\t\t\t\tPair<Node, Node> pA = new Pair<Node, Node>(n1, n2);\r\n\t\t\t\t\t\t\tPair<Node, Node> pB = new Pair<Node, Node>(n2, n1);\r\n\r\n\t\t\t\t\t\t\tif (!pairs.contains(pA)){\r\n\t\t\t\t\t\t\t\trels.add(rel);\t\t\t\t\t\t\t\t\t\t\t//Add the relationship to the lists.\r\n\t\t\t\t\t\t\t\tpairs.add(pA);\r\n\t\t\t\t\t\t\t\tpairs.add(pB);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}", "@Test\n public void pairNumbers_passTwoListsNumbers_returnListOfPairs() {\n List<int[]> output = Java8Streams.pairNumbers(new ArrayList<>(Arrays.asList(1, 2, 3)), new ArrayList<>(Arrays.asList(3, 4)));\n assertThat(output).containsExactly(new int[]{1, 3}, new int[]{1, 4}, new int[]{2, 3}, new int[]{2, 4}, new int[]{3, 3}, new int[]{3, 4});\n }", "abstract ArrayList<Pair<Integer,Double>> adjacentNodes(int i);", "public List<Pair> getPairList()\n\t{\n\t\tList<Pair> pairs = new ArrayList<>();\n\t\tfor (Map.Entry<String, AbstractNode> entry : this.pairs.entrySet())\n\t\t\tpairs.add(new Pair(entry.getKey(), entry.getValue()));\n\t\treturn pairs;\n\t}", "private void generate_pairs(ArrayList<Point> pointSet) {\n\t\tfor (int i = 0; i < pointSet.size(); i++) {\n\t\t\tfor (int j = i + 1; j < pointSet.size(); j++) {\n\n\t\t\t\tPair new_pair;\n\t\t\t\ttry {\n\t\t\t\t\tnew_pair = new Pair(pointSet.get(i), pointSet.get(j));\n\t\t\t\t\tunmarked_pairs.add(new_pair);\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// Dimensions don't match exception\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}", "private List<List<Node>> combinationHelper(int k, int n) {\n\t\tList<List<Node>> res = new ArrayList<List<Node>>();\n\t\tList<int[]> combRes = combinationHelperImpl(k, n);\n\t\tfor (int[] elem : combRes) {\n\t\t\tArrays.sort(elem);\n\t\t\tList<Node> tmp = new ArrayList<Node>();\n\t\t\tfor (int i : elem) {\n\t\t\t\ttmp.add(queryNodes.get(i));\n\t\t\t}\n\t\t\tres.add(new ArrayList<Node>(tmp));\n\t\t}\n\t\treturn res;\n\t}", "public static List<Vertex> randomPairs(double R, int N) {\n final List<Vertex> result = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n result.add(new Vertex(i, randomPair(R)));\n }\n return result;\n }", "public static void main(String[] args) {\n ListNode n1 = new ListNode(1);\n ListNode n2 = new ListNode(2);\n ListNode n3 = new ListNode(3);\n ListNode n4 = new ListNode(4);\n n1.next=n2;\n n2.next=n3;\n n3.next=n4;\n SwapPairs24 a = new SwapPairs24();\n a.print(a.swapPairs(n1));\n }", "static <A, B> List<Pair<A, B>> pairs(List<A> as, List<B> bs) {\n return as.stream().flatMap(a -> bs.stream().map(b -> Pair.of(a, b))).collect(toList());\n }", "public static long journeyToMoon(int n, List<List<Integer>> astronaut) {\n // Write your code here\n Map<Integer, Node<Integer>> countryMap = new HashMap<>();\n for(List<Integer> pairs: astronaut) {\n Node<Integer> node1 = countryMap.computeIfAbsent(pairs.get(0), Node::new);\n Node<Integer> node2 = countryMap.computeIfAbsent(pairs.get(1), Node::new);\n node1.connected.add(node2);\n node2.connected.add(node1);\n }\n\n List<Integer> countryCluster = new ArrayList<>();\n for(Node<Integer> node: countryMap.values()) {\n if(node.connected.size() == 0) {\n countryCluster.add(1);\n } else if(!node.visited){\n countryCluster.add(getNodeCount3(node));\n }\n }\n List<Integer> countryNodes = countryMap.values().stream().map(nn -> nn.value).collect(Collectors.toList());\n List<Integer> missingNodes = new ArrayList<>();\n for(int i=0; i < n; i++) {\n if(!countryNodes.contains(i))\n missingNodes.add(i);\n }\n\n for(int i=0; i < missingNodes.size(); i++) {\n countryCluster.add(1);\n }\n\n long ans = 0;\n //For one country we cannot pair with any other astronauts\n if(countryCluster.size() >= 2) {\n ans = (long) countryCluster.get(0) * countryCluster.get(1);\n if(countryCluster.size() > 2) {\n int sum = countryCluster.get(0) + countryCluster.get(1);\n for(int i=2; i < countryCluster.size(); i++) {\n ans += (long) sum * countryCluster.get(i);\n sum += countryCluster.get(i);\n }\n }\n }\n\n /*\n permutation of two set with size A and B = AxB\n permutation of three set with size A,B,C = AxB + AxC + BxC = AxB + (A+B)xC\n permutation of four set with size A,B,C,D = AxB + AxC + AxD + BxC + BxD + CxD = AxB + (A+B)xC + (A+B+C)xD\n */\n /*\n if(keys.length == 1) {\n ans = keys[0].size();\n } else {\n ans = keys[0].size() * keys[1].size();\n if(keys.length > 2) {\n int sum = keys[0].size() + keys[1].size();\n for (int i = 2; i < keys.length; i++) {\n ans += sum * keys[i].size();\n sum += keys[i].size();\n }\n }\n }\n */\n return ans;\n }", "private static Collection<Integer[]> getPairArray(\n List<Integer[]> listA, List<Integer[]> listB, boolean flip) {\n Collection<Integer[]> encoderPortPairs = new ArrayList<Integer[]>();\n for (Integer[] portPairsA : listA) {\n Integer[] inputs = new Integer[5];\n inputs[0] = portPairsA[0]; // InputA\n inputs[1] = portPairsA[1]; // InputB\n\n for (Integer[] portPairsB : listB) {\n inputs[2] = portPairsB[0]; // OutputA\n inputs[3] = portPairsB[1]; // OutputB\n inputs[4] = flip ? 0 : 1; // The flip bit\n }\n\n ArrayList<Integer[]> construtorInput = new ArrayList<Integer[]>();\n construtorInput.add(inputs);\n\n inputs = inputs.clone();\n for (Integer[] portPairsB : listB) {\n inputs[2] = portPairsB[1]; // OutputA\n inputs[3] = portPairsB[0]; // OutputB\n inputs[4] = flip ? 0 : 1; // The flip bit\n }\n construtorInput.add(inputs);\n encoderPortPairs.addAll(construtorInput);\n }\n return encoderPortPairs;\n }", "private List<GPairRecord<S,S>> getCrossingPairs(final Predicate<Pair<S, S>> predicate) {\n\n // get first and last terminal for each non-terminal\n Pair<S, S>[] pairs = getFirstLastMappingArray();\n\n // list of records of crossing pairs\n List<GPairRecord<S,S>> recordList = new ArrayList<>();\n\n // scan for crossing pairs in the right order\n slp.getOrderedProductions().stream().map(p -> p.getLeft()).forEach(nonTerminal -> consumeCrossingPairs(nonTerminal, recordList::add, pairs, predicate));\n return recordList;\n }", "public List<GPairRecord<S, S>> getPairs(final Predicate<Pair<S, S>> predicate) {\n List<GPairRecord<S, S>> pairs = getNonCrossingPairs(predicate);\n pairs.addAll(getCrossingPairs(predicate));\n\n sortPairs(pairs);\n return pairs;\n }", "private List<T> transform(List<T> nodes) {\n List<T> transformed = new ArrayList<>();\n for (T node : nodes) {\n transformed.add(node);\n }\n return transformed;\n }", "public static ListNode swapPairs(ListNode node) {\r\n\t\tif (node == null || node.next == null) {\r\n\t\t\treturn node;\r\n\t\t}\r\n\t\tListNode first = node;\r\n\t\tListNode second = node.next;\r\n\t\tListNode third = node.next.next;\r\n\t\tListNode ret = second;\r\n\t\tret.next = first;\r\n\t\tret.next.next = swapPairs(third);\r\n\t\treturn ret;\r\n\t}", "private List<Pair<MyNode, MyNode>> generateMex(List<MyNode> nodes){\r\n\r\n\t\t//Sanity check\r\n\t\tif (numMex <= 0){\r\n\t\t\treturn new ArrayList<Pair<MyNode, MyNode>>();\r\n\t\t}\r\n\r\n\t\t//Generate all possible mutual exclusion constraints. \r\n\t\tList<Pair<MyNode, MyNode>> result = new ArrayList<Pair<MyNode, MyNode>>();\r\n\t\tfor (int idxA = 0; idxA < nodes.size(); idxA++){\r\n\t\t\tfor (int idxB = idxA+1; idxB < nodes.size(); idxB++){\r\n\t\t\t\tPair<MyNode, MyNode> mex = new Pair<MyNode, MyNode>(nodes.get(idxA), nodes.get(idxB));\r\n\t\t\t\tresult.add(mex);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//Shuffle the result list for random order.\r\n\t\tCollections.shuffle(result, random);\r\n\r\n\t\t//Repeatedly remove constraints from the list until we reach the numMex size.\r\n\t\twhile (result.size() > numMex){\r\n\t\t\tresult.remove(random.nextInt(result.size()));\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}", "public static void main(String[] args) {\n // int[] a = {1, 2, 1, 4, 5, 4, 4};\n int[] a = {1,2,1,2,1,2,1};\n System.out.println(pairs(a));\n }", "public static List<SimpleSSBNNode>[] individualizeDisconnectedNetworks(\r\n\t\t\tList<SimpleSSBNNode> simpleSSBNNodeList){\r\n\t\t\r\n\t\tList<SimpleSSBNNodeNetworkAssociation> nodeNetAssociationList = \r\n\t\t\tnew ArrayList<SimpleSSBNNodeNetworkAssociation>(); \r\n\t\t\r\n\t\tfor(SimpleSSBNNode simpleSSBNNode: simpleSSBNNodeList){\r\n\t\t\tSimpleSSBNNodeNetworkAssociation nodeNetAssociation = \r\n\t\t\t\tnew SimpleSSBNNodeNetworkAssociation(simpleSSBNNode); \r\n\t\t\tnodeNetAssociationList.add(nodeNetAssociation); \r\n\t\t}\r\n\t\t\r\n\t\tint nextNetworkId = 0; \r\n\t\t\r\n\t\tfor(SimpleSSBNNodeNetworkAssociation nodeNetAssociation: nodeNetAssociationList){\r\n\t\t\t\r\n\t\t\tif(nodeNetAssociation.getNetworkId() == -1){\r\n\t\t\t\tnodeNetAssociation.setNetworkId(nextNetworkId); \r\n\t\t\t\tnextNetworkId++; \r\n\t\t\t\tsetNetIdToAdjacentNodes(nodeNetAssociation, nodeNetAssociationList); \r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tList<SimpleSSBNNode>[] nodesPerNetworkArray = new List[nextNetworkId]; \r\n\t\t\r\n\t\tfor(int i = 0; i < nodesPerNetworkArray.length; i++){\r\n\t\t\tnodesPerNetworkArray[i] = new ArrayList<SimpleSSBNNode>(); \r\n\t\t}\r\n\t\t\r\n\t\tfor(SimpleSSBNNodeNetworkAssociation nodeNetAssociation: nodeNetAssociationList){\r\n\t\t\tnodesPerNetworkArray[nodeNetAssociation.getNetworkId()].add(nodeNetAssociation.getNode()); \r\n\t\t}\r\n\t\t\r\n\t\treturn nodesPerNetworkArray; \r\n\t}", "public WordPairList(String[] words) {\n allPairs = new ArrayList<>();\n for (int i = 0; i < words.length; i++) {\n for (int j = i+1; j < words.length; j++) {\n allPairs.add(new WordPair(words[i], words[j]));\n }\n }\n }", "public static List<AliasedKeyPair> generate(final String[] prefixes) {\n\t\tfinal MultiAddressGenerator generator = createGenerator(prefixes);\n\n\t\tfinal int numThreads = Runtime.getRuntime().availableProcessors();\n\t\tfinal CompletableFuture[] futures = new CompletableFuture[numThreads];\n\n\t\tSystem.out.println(String.format(\"Generating addresses on %d threads\", numThreads));\n\t\tfor (int i = 0; i < numThreads; ++i) {\n\t\t\tfutures[i] = CompletableFuture.runAsync(() -> {\n\t\t\t\twhile (generator.numPrefixes() > generator.numPrefixesFound()) {\n\t\t\t\t\tgenerator.generate();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tCompletableFuture.allOf(futures).join();\n\t\tfinal List<AliasedKeyPair> keyPairs = generator.keyPairs();\n\t\tfor (final AliasedKeyPair keyPair : keyPairs) {\n\t\t\tSystem.out.println(String.format(\"'%s' -> '%s'\", keyPair.alias(), keyPair.address()));\n\t\t}\n\n\t\treturn keyPairs;\n\t}", "@Test\n public void pairNumbersDivisibleBy3_passTwoListsNumbers_returnListsOfPairs() {\n List<int[]> output = Java8Streams.pairNumbersDivisibleBy3(new ArrayList<>(Arrays.asList(1, 2, 3)), new ArrayList<>(Arrays.asList(3, 4)));\n assertThat(output).containsExactly(new int[]{2, 4}, new int[]{3, 3});\n }", "public Graph(Node... nodes)\r\n\t{\r\n\t\tedges = new ArrayList<>();\r\n\r\n\t\tfor (int i = 0; i < nodes.length - 1; i += 2)\r\n\t\t{\r\n\t\t\tedges.add(new Node[]\r\n\t\t\t{\r\n\t\t\t\tnodes[i], nodes[i + 1]\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (nodes.length % 2 == 1)\r\n\t\t{\r\n\t\t\tedges.add(new Node[]\r\n\t\t\t{\r\n\t\t\t\tnodes[nodes.length - 1]\r\n\t\t\t});\r\n\t\t}\r\n\t}", "Node[] merge(List<Node> nodeList1, List<Node> nodeList2, List<Node> exhaustedNodes);", "public Map<Node, MyNode> extractNodes(int numNodes){\r\n\t\t//If numNodes is less than one or there aren't enough nodes, return null\r\n\t\tif (numNodes < 1 || nodesMap.size() < numNodes){\r\n\t\t\treturn null;\r\n\t\t} \r\n\r\n\t\t//Initialize the result set\r\n\t\tMap<Node, MyNode> result = new HashMap<Node, MyNode>();\r\n\r\n\t\t//Special case: If there are no relationships, then return all nodes.\r\n\t\tif(rels.size() == 0){\r\n\t\t\tfor (Node node : nodesMap.keySet()){\r\n\t\t\t\tresult.put(node, nodesMap.get(node));\r\n\t\t\t}\r\n\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\t//tempRels (used for crawling through the gp)\r\n\t\tList<Relationship> tempRels = new ArrayList<Relationship>();\r\n\t\ttempRels.addAll(relsMap.keySet());\r\n\r\n\t\t//Shuffle the tempRels list for random order.\r\n\t\tCollections.shuffle(tempRels, random);\r\n\r\n\t\tboolean first = true;\t//flag for first run\r\n\r\n\t\twhile (result.size() < numNodes) {\t//Loop until we have reached the required result size.\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\t\t\t\t\r\n\t\t\t\tif (first){\t\t\t//On the first run\r\n\t\t\t\t\tfirst = false;\t//Update flag\r\n\r\n\t\t\t\t\t//Pick a random relationship and extract its nodes\r\n\t\t\t\t\tRelationship rel = tempRels.get(random.nextInt(tempRels.size()));\r\n\t\t\t\t\ttempRels.remove(rel);\r\n\t\t\t\t\tNode src = rel.getStartNode();\r\n\t\t\t\t\tNode tgt = rel.getEndNode();\r\n\r\n\r\n\t\t\t\t\tif (numNodes > 1){\r\n\t\t\t\t\t\t//If numNodes > 1, then add both nodes to result\r\n\t\t\t\t\t\tresult.put(src, nodesMap.get(src));\r\n\t\t\t\t\t\tresult.put(tgt, nodesMap.get(tgt));\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//If numNodes == 1, then randomly pick one of the nodes to add to result\r\n\t\t\t\t\t\tif (random.nextBoolean()){\r\n\t\t\t\t\t\t\tresult.put(src, nodesMap.get(src));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tresult.put(tgt, nodesMap.get(tgt));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\t//On subsequent runs\r\n\r\n\t\t\t\t\tboolean done = false;\t//Flag to specify we're done with this iteration\r\n\t\t\t\t\tint idx = 0;\t\t\t//Loop index counter\r\n\t\t\t\t\twhile (!done){\r\n\t\t\t\t\t\t//Pick the next relationship in tempRels\r\n\t\t\t\t\t\tRelationship rel = tempRels.get(idx);\r\n\t\t\t\t\t\tidx++;\r\n\t\t\t\t\t\tNode other = null;\r\n\r\n\t\t\t\t\t\tif (result.keySet().contains(rel.getStartNode()) && (!result.keySet().contains(rel.getEndNode()))){\r\n\t\t\t\t\t\t\t//If the startNode of the relationship is already in results, but not the end node\r\n\t\t\t\t\t\t\t//then set other to be the end node\r\n\t\t\t\t\t\t\tother = rel.getEndNode();\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t} else if ((!result.keySet().contains(rel.getStartNode())) && result.keySet().contains(rel.getEndNode())){\r\n\t\t\t\t\t\t\t//If the startNode of the relationship is not in results, but the end node is\r\n\t\t\t\t\t\t\t//then set other to be the start node\r\n\t\t\t\t\t\t\tother = rel.getStartNode();\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t} else if (result.keySet().contains(rel.getStartNode()) && result.keySet().contains(rel.getEndNode())){\r\n\t\t\t\t\t\t\t//If both of the nodes of the relationship are in result, remove it from the list\r\n\t\t\t\t\t\t\ttempRels.remove(rel);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t//If we found a matching relationship\r\n\t\t\t\t\t\tif (done){\r\n\t\t\t\t\t\t\t//Add other to the result, and its corresponding mapping\r\n\t\t\t\t\t\t\tresult.put(other, nodesMap.get(other));\r\n\t\t\t\t\t\t\t//Remove rel from the list\r\n\t\t\t\t\t\t\ttempRels.remove(rel);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "public static Set<ClassPair> pairUp(Set<String> labels) {\n Set<ClassPair> set = new HashSet<>();\n for (String str1:labels) {\n for (String str2:labels) {\n if (!str1.equals(str2)) {\n set.add(new ClassPair(str1, str2));\n }\n }\n }\n return set;\n }", "public ListNode swapPairs(ListNode head) {\n if (head == null || head.next == null) {\n return head;\n }\n ListNode result = head.next;\n ListNode tempNode = null;\n while (swapTwoNodes(head, tempNode)) {\n tempNode = head;\n head = head.next;\n }\n return result;\n }", "private Set<NodePair> nonadjacencies(Graph graph) {\n Set<NodePair> nonadjacencies = new HashSet<>();\n for (Graph inputPag : input) {\n for (NodePair pair : allNodePairs(inputPag.getNodes())) {\n if (!inputPag.isAdjacentTo(pair.getFirst(), pair.getSecond())) {\n nonadjacencies.add(new NodePair(graph.getNode(pair.getFirst().getName()), graph.getNode(pair.getSecond().getName())));\n }\n }\n }\n return nonadjacencies;\n }", "private static List<Pair<String,String>> product(String[] alist, String[] blist){\n\n List<Pair<String, String>> prod = new ArrayList<>();\n\n for(String a : alist){\n for(String b : blist){\n prod.add(new Pair<>(a,b));\n }\n }\n return prod;\n }", "static List<Permutation> genPermutations(int n) {\n List<Permutation> result = IntStream.rangeClosed(0, n - 2)\n .parallel()\n .mapToObj(fixed -> {\n List<Permutation> ls = new ArrayList<>();\n\n // Recall our logic about permutation configurations:\n //\n // N = fixed + l_1 + l_2 + ... + l_k\n //\n // Since we know the `fixed`, we need to generate the list\n // of l_i, we just need to generate all the list of numbers\n // that sum to N-fixed.\n List<int[]> cyclesList = numbersSumToN(n - fixed);\n\n for (int[] cycles : cyclesList) {\n Permutation p = makePermutation(n, fixed, cycles);\n ls.add(p);\n }\n return ls;\n })\n .flatMap(Collection::stream)\n .collect(Collectors.toList());\n\n // Our result would be incomplete without the identity permutation.\n result.add(new Permutation(n, new int[0], ONE));\n return result;\n }", "public ListNode swapPairs(ListNode head) {\n if (head == null || head.next == null) {\n return head;\n }\n ListNode dummy = new ListNode(0);\n ListNode l1 = dummy;\n ListNode l2 = head;\n while (l2 != null && l2.next != null) {\n ListNode nextStart = l2.next.next;\n l1.next = l2.next;\n l2.next.next = l2;\n l2.next = nextStart;\n l1 = l2;\n l2 = nextStart;\n }\n return dummy.next;\n }", "private static <A,B> List<Map<A,B>> generateAllPossibilities(List<Pair<A,Set<B>>> input){\n\t\tif(input.size()==0){\n\t\t\tList<Map<A,B>> l = new ArrayList<Map<A,B>>();\n\t\t\tl.add(new HashMap<A,B>());\n\t\t\treturn l;\n\t\t} else {\n\t\t\tPair<A, Set<B>> entry = input.get(0);\n\t\t\t\n\t\t\tList<Pair<A,Set<B>>> newList = new ArrayList<Pair<A,Set<B>>>();\n\t\t\tfor(int i=1;i<input.size();i++){\n\t\t\t\tnewList.add(input.get(i));\n\t\t\t}\n\t\t\t\n\t\t\tList<Map<A,B>> results = generateAllPossibilities(newList);\n\t\t\tList<Map<A,B>> newResults = new ArrayList<Map<A,B>>();\n\t\t\t\n\t\t\tfor(B newEntry : entry.second()){\n\t\t\t\tfor(Map<A,B> previousMap : results){\n\t\t\t\t\tMap<A,B> newMap = new HashMap<A,B>();\n\t\t\t\t\tfor(Entry<A,B> e : previousMap.entrySet()){\n\t\t\t\t\t\tnewMap.put(e.getKey(), e.getValue());\n\t\t\t\t\t}\n\t\t\t\t\tnewMap.put(entry.first(), newEntry);\n\t\t\t\t\tnewResults.add(newMap);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn newResults;\n\t\t}\n\t}", "private List<PairOfNodeIndexIntervals> getListOfSuspiciousNodeIndexIntervalPairs() {\n\n\t\tList<PairOfNodeIndexIntervals> listOfPairs = new ArrayList<PairOfNodeIndexIntervals>();\n\n\t\t// compare the two node list by Greedy String Tilling algorithm\n\t\tSet<Match> matchedSubstrings = compareTwoNodeLists(programANodeList, programBNodeList);\n\t\tIterator<Match> it = matchedSubstrings.iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tMatch match = it.next();\n\t\t\t\n\t\t\t// Given the node is represented by abbreviation of its type with fixed length: 2\n\t\t\t// not all results that are returned from GST are valid, we need to find out \n\t\t\t// valid block pairs\n\t\t\tPairOfNodeIndexIntervals validIntervalPair = getValidNodeIndexIntervalPair(match);\n\n\t\t\t// if the current match does not produce a valid block pair, the validIntervalPair will be null\n\t\t\t// otherwise, add it to the list of pairs\n\t\t\tif (validIntervalPair != null) {\n\t\t\t\tlistOfPairs.add(validIntervalPair);\n\t\t\t}\n\t\t}\n\n\t\treturn listOfPairs;\n\t}", "private static List<List<Integer[]>> getDIOCrossConnect() {\n List<List<Integer[]>> pairs = new ArrayList<List<Integer[]>>();\n List<Integer[]> setA =\n Arrays.asList(\n new Integer[][] {\n {DIOCrossConnectA1, DIOCrossConnectA2},\n {DIOCrossConnectA2, DIOCrossConnectA1}\n });\n pairs.add(setA);\n\n List<Integer[]> setB =\n Arrays.asList(\n new Integer[][] {\n {DIOCrossConnectB1, DIOCrossConnectB2},\n {DIOCrossConnectB2, DIOCrossConnectB1}\n });\n pairs.add(setB);\n // NOTE: IF MORE DIOCROSSCONNECT PAIRS ARE ADDED ADD THEM HERE\n return pairs;\n }", "protected static int[] composeRange(int... pairs) {\n if(pairs.length % 2 != 0)\n throw new IllegalArgumentException(\"Pairs has to be a multiple of 2!\");\n\n List<Integer> nums = new ArrayList<>();\n\n for(int start = 0, end = 1; end < pairs.length; start+=2, end+=2) {\n int[] semiRange = range(pairs[start], pairs[end]);\n for(Integer i : semiRange)\n nums.add(i); //potencjalna optymalizacja: dodac caly array do listy\n }\n\n //potencjalna optymalizacja: zwrocic bezposrednio z listy\n int[] finalRange = new int[nums.size()];\n for(int id = 0; id < nums.size(); id++)\n finalRange[id] = nums.get(id);\n\n return finalRange;\n }", "public static void main(String[] args) {\n List<Integer> nums1 = Arrays.asList(1,2,2);\n List<Integer> nums2 = Arrays.asList(2,2);\n\n List<int[]> pairs = nums1.stream().flatMap(\n i-> nums2.stream().map(j -> new int[] {i,j})\n ).collect(Collectors.toList());\n\n pairs.stream().map(Arrays::toString).forEach(System.out::println);\n System.out.println(\"*********************************************\");\n //return only pairs whose sum is divisible by 3\n List<int[]> pairs2 = nums1.stream().flatMap(\n i-> nums2.stream().filter(j -> (i+j)%3==0)\n .map(j -> new int[]{i,j})\n ).collect(Collectors.toList());\n pairs2.stream().map(Arrays::toString).forEach(System.out::println);\n System.out.println(\"*********************************************\");\n //return pairs whose sum is equal to 6\n List<int []> pairs3 = nums1.stream().flatMap(\n i -> nums2.stream().filter(j -> (i+j)==4).map(j -> new int[]{i,j})\n ).collect(Collectors.toList());\n pairs3.stream().map(Arrays::toString).forEach(System.out::println);\n }", "public static List<Range> toRanges(List<Node> nodes)\n {\n List<Long> tokens = new ArrayList<>();\n for (Node node : nodes)\n {\n if (node.token != Long.MIN_VALUE)\n tokens.add(node.token);\n }\n tokens.add(Long.MIN_VALUE);\n tokens.sort(Long::compareTo);\n\n List<Range> ranges = new ArrayList<>(tokens.size() + 1);\n long prev = tokens.get(0);\n for (int i = 1; i < tokens.size(); i++)\n {\n long current = tokens.get(i);\n ranges.add(new Range(prev, current));\n prev = current;\n }\n ranges.add(new Range(prev, Long.MIN_VALUE));\n return Collections.unmodifiableList(ranges);\n }", "public static NavigableMap<Range, List<Node>> replicate(List<Node> nodes, int rf)\n {\n nodes.sort(Node::compareTo);\n List<Range> ranges = toRanges(nodes);\n return replicate(ranges, nodes, rf);\n }", "private void connectAll()\n {\n\t\tint i = 0;\n\t\tint j = 1;\n\t\twhile (i < getNodes().size()) {\n\t\t\twhile (j < getNodes().size()) {\n\t\t\t\tLineEdge l = new LineEdge(false);\n\t\t\t\tl.setStart(getNodes().get(i));\n\t\t\t\tl.setEnd(getNodes().get(j));\n\t\t\t\taddEdge(l);\n\t\t\t\tj++;\n\t\t\t}\n\t\t\ti++; j = i+1;\n\t\t}\n\n }", "private static Set<List<Integer>> createNtuples(Dataset dataset) {\r\n\t\tList<Set<Integer>> ntupleList = new ArrayList<>();\r\n\r\n\t\tfor (Integer dimensionSize : dataset.getSize()) {\r\n\t\t\tSet<Integer> set = new TreeSet<>();\r\n\t\t\tfor (Integer i = 0; i < dimensionSize; i++) {\r\n\t\t\t\tset.add(i);\r\n\t\t\t}\r\n\t\t\tntupleList.add(set);\r\n\t\t}\r\n\r\n\t\treturn Sets.cartesianProduct(ntupleList);\r\n\t}", "private List<GlobalState> generateGlobalStates(List<Node> nodes) {\n // Creating a list of global states with an empty state\n List<GlobalState> gStates = new ArrayList();\n gStates.add(new GlobalState(nodes,binding));\n \n // Generating all possible global states\n for(Node n : nodes) {\n // Generating a new list of global states by adding a new pair\n // for each state of current node to those already generated\n List<GlobalState> newGStates = new ArrayList();\n for(String s : n.getProtocol().getStates()) {\n for(GlobalState g : gStates) {\n GlobalState newG = new GlobalState(nodes,binding);\n newG.addMapping(g);\n newG.addMapping(n.getName(),s);\n newGStates.add(newG);\n }\n }\n // Updating the list of global states with the new one\n gStates = newGStates;\n }\n return gStates;\n }", "@DataProvider(name = \"allPairs\")\n public Object[][] allPairs() {\n final List<Object[]> tests = new ArrayList<>();\n\n for (final Allele ref : Arrays.asList(refA, refC, refG, refT)){\n for (final Allele alt : Arrays.asList(altA, altC, altG, altT)){\n if (!ref.getBaseString().equals(alt.getBaseString())){\n tests.add(new Object[]{ref, alt});\n }\n }\n }\n\n return tests.toArray(new Object[][]{});\n }", "private static List<List<Integer>> threeSum(int[] nums) {\n int len = nums.length;\n int start = 0;\n List<List<Integer>> result = new LinkedList<>();\n\n Arrays.sort(nums);\n\n while (start < len - 2) {\n if (start > 0 && nums[start] == nums[start - 1]) {\n start++;\n continue;\n }\n findPair(nums, -nums[start], start + 1, result);\n start++;\n }\n return result;\n }", "TripleGraph createTripleGraph();", "private List<List<Edge>> combine(List<List<Edge>> left, List<List<Edge>> right, List<Edge> middle) {\n List<List<Edge>> combination = new ArrayList<>();\n\n /** \n * return the right list if left is empty\n */\n if (left.isEmpty() && !right.isEmpty()) {\n combination = right;\n\n /**\n * return the left list if right is empty \n */\n } else if (!left.isEmpty() && right.isEmpty()) {\n combination = left;\n\n /**\n * combines both left and right lists\n */\n } else {\n for (int i = 0; i < left.size(); i++) {\n for (int j = 0; j < right.size(); j++) {\n\n List<Edge> temp = new ArrayList<>();\n temp.addAll(left.get(i));\n temp.addAll(right.get(j));\n combination.add(temp);\n\n }\n }\n }\n\n /**\n * adds the internal edges to every possible tessellation gathered from \n * the left and right tessellation\n */\n combination.forEach((curr) -> {\n curr.addAll(middle);\n });\n\n return combination;\n }", "public List<BayesNode> getNodes(String[] nodeList){\r\n\t\tList<BayesNode> parentList = new ArrayList<BayesNode>();\r\n\t\tfor (String p:nodeList){\r\n\t\t\tif (nodeExists(p)){\r\n\t\t\t\tparentList.add(getNode(p));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn parentList;\r\n\t}", "public static ListNode swapPairs(ListNode head) {\n\t\t ListNode dummy = new ListNode(-1);\n\t\t dummy.next = head;\n\t\t \n\t\t // move 3 pointer together until all or two of them are null\n\t\t ListNode p1 = dummy;\n\t\t ListNode p2 = p1 != null ? p1.next : null;\n\t\t ListNode p3 = p2 != null? p2.next: null;\n\t\t \n\t\t while(p2 != null && p3 != null) {\n\t\t\t //swap p2 & p3\n\t\t\t p1.next = p3;\n\t\t\t p2.next = p3.next;\n\t\t\t p3.next = p2;\n\t\t\t \n\t\t\t // p1 moves two steps forward\n\t\t\t p1 = p1.next;\n\t\t\t p1 = p1 != null ? p1.next : null;\n\t\t\t p2 = p1 != null ? p1.next : null;\n\t\t\t p3 = p2 != null? p2.next: null;\n\t\t }\n\t\t \n\t\t return dummy.next;\n\t }", "public static List<SSBNNode> translateSimpleSSBNNodeListToSSBNNodeList( \r\n\t\t\tList<SimpleSSBNNode> simpleSSBNNodeList, \r\n\t\t\tProbabilisticNetwork pn) throws \r\n\t\t\t SSBNNodeGeneralException, \r\n\t\t\t ImplementationRestrictionException{\r\n\t\t\r\n\t\tList<SSBNNode> listSSBNNodes = new ArrayList<SSBNNode>(); \r\n\t\tcorrespondencyMap = new HashMap<SimpleSSBNNode, SSBNNode>(); \r\n\t\t\r\n\t\tMap<ContextNode, ContextFatherSSBNNode> mapContextNode = \r\n\t\t\t new HashMap<ContextNode, ContextFatherSSBNNode>(); \r\n\t\t\r\n\t\t//1 Create all nodes with its states \r\n\t\t\r\n\t\tfor(SimpleSSBNNode simple: simpleSSBNNodeList){\r\n\t\t\t\r\n\t\t\tSSBNNode ssbnNode = SSBNNode.getInstance(pn, simple.getResidentNode()); \r\n\t\t\tcorrespondencyMap.put(simple, ssbnNode);\r\n\t\t\tlistSSBNNodes.add(ssbnNode); \r\n\t\t\t\r\n\t\t\t//Arguments. \r\n\t\t\tfor(int i = 0; i < simple.getOvArray().length; i++){\r\n\t\t\t\tOVInstance ovInstance = OVInstance.getInstance(\r\n\t\t\t\t\t\tsimple.getOvArray()[i],\tsimple.getEntityArray()[i]); \r\n\t\t\t\tssbnNode.addArgument(ovInstance);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//Finding. \r\n\t\t\tif(simple.isFinding()){\r\n\t\t\t\tssbnNode.setValue(simple.getState()); \r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//Default distribution\r\n\t\t\tif(simple.isDefaultDistribution()){\r\n\t\t\t\tssbnNode.setUsingDefaultCPT(true); \r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tssbnNode.setPermanent(true); \r\n\t\t\t\r\n\t\t\t//The values of the ordinary variables are different depending in \r\n\t\t\t//which MFrag we are dealing. \r\n\t\t\t\r\n\t\t\t//The key for do the match is the order of the arguments. The order\r\n\t\t\t//should be the same in every MFrags of the node. \r\n\t\t\t\r\n\t\t\t//Lets deal first with Resident MFrag\r\n\r\n\t\t\tOrdinaryVariable[] residentOvArray = \r\n\t\t\t\t\tssbnNode.getResident().getOrdinaryVariableList().toArray(\r\n\t\t\t\t\t\t\tnew OrdinaryVariable[ssbnNode.getResident().getOrdinaryVariableList().size()]\r\n\t\t\t\t\t\t\t); \r\n\t\t\t\r\n\t\t\tList<OVInstance> argumentsForResidentMFrag = new ArrayList<OVInstance>(); \r\n\t\t\tfor(int i = 0; i < residentOvArray.length; i++){\r\n\t\t\t\tOVInstance ovInstance = OVInstance.getInstance(residentOvArray[i], \r\n\t\t\t\t\t\tsimple.getEntityArray()[i]); \r\n\t\t\t\targumentsForResidentMFrag.add(ovInstance); \r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tssbnNode.addArgumentsForMFrag(\r\n\t\t\t\t\tssbnNode.getResident().getMFrag(), \r\n\t\t\t\t\targumentsForResidentMFrag); \r\n\t\t\t\r\n\t\t\t\r\n\t\t\t// Lets map OVs of every input node pointing to current SSBNNode\r\n\t\t\t\r\n\t\t\tfor(InputNode inputNode: simple.getResidentNode().getInputInstanceFromList()){\r\n\t\t\t\t\r\n\t\t\t\tOrdinaryVariable[] ovArray = \r\n\t\t\t\t\tinputNode.getResidentNodePointer().getOrdinaryVariableArray(); \r\n\t\t\t\t\r\n\t\t\t\tList<OVInstance> argumentsForMFrag = new ArrayList<OVInstance>();\r\n\r\n// OLD CODE\t\t\t\t\r\n//\t\t\t\tfor(int i = 0; i < ovArray.length; i++){\r\n//\t\t\t\t\tOVInstance ovInstance = OVInstance.getInstance(ovArray[i], simple.getEntityArray()[i]); \r\n// argumentsForMFrag.add(ovInstance); \t\r\n//\t\t\t\t}\r\n\r\n// NEW CODE \r\n\t\t\t\tif( ! (simple.getOvArrayForMFrag(inputNode.getMFrag()) == null )){\r\n\t\t\t\t\tfor(int i = 0; i < ovArray.length; i++){\r\n\t\t\t\t\t\tOrdinaryVariable ov = simple.getOvArrayForMFrag(inputNode.getMFrag())[i]; \r\n\t\t\t\t\t\tOVInstance ovInstance = OVInstance.getInstance(ov,simple.getEntityArray()[i]); \t\t\t\t\t\r\n\t\t\t\t\t\targumentsForMFrag.add(ovInstance); \r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}else{\r\n//TODO This is an old bug... when we don't have an input instance of the node, we won't have a MFrag Instance \r\n// for it... what makes the throws one exception. \r\n\t\t\t\t\tfor(int i = 0; i < ovArray.length; i++){\r\n\t\t\t\t\t\tOVInstance ovInstance = OVInstance.getInstance(ovArray[i], simple.getEntityArray()[i]);\r\n\t\t\t\t\t\targumentsForMFrag.add(ovInstance); \t\t\t\t\t\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tssbnNode.addArgumentsForMFrag(\r\n\t\t\t\t\t\tinputNode.getMFrag(), \r\n\t\t\t\t\t\targumentsForMFrag); \r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//Treat the context node father\r\n\t\t\tList<SimpleContextNodeFatherSSBNNode> simpleContextNodeList = \r\n\t\t\t\tsimple.getContextParents(); \r\n\t\t\t\r\n\t\t\tif(simpleContextNodeList.size() > 0){\r\n\t\t\t\tif(simpleContextNodeList.size() > 1){\r\n\t\t\t\t\tthrow new ImplementationRestrictionException(\r\n\t\t\t\t\t\t\tImplementationRestrictionException.MORE_THAN_ONE_CTXT_NODE_SEARCH); \r\n\t\t\t\t}else{\r\n\t\t\t\t\t//We have only one context node father\r\n\t\t\t\t\tContextNode contextNode = simpleContextNodeList.get(0).getContextNode(); \r\n\t\t\t\t\tContextFatherSSBNNode contextFather = mapContextNode.get(contextNode); \r\n\t\t\t\t\tif(contextFather == null){\r\n\t\t\t\t\t\tcontextFather = new ContextFatherSSBNNode(pn, contextNode, new ProbabilisticNode(), \r\n\t\t\t\t\t\t\t\tsimpleContextNodeList.get(0).getOvProblematic(), simple.getMFragInstance().getOVInstanceList());\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tList<ILiteralEntityInstance> possibleValueList = \r\n\t\t\t\t\t\t\t\tnew ArrayList<ILiteralEntityInstance>(); \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor(String entity: simpleContextNodeList.get(0).getPossibleValues()){\r\n\t\t\t\t\t\t\tpossibleValueList.add(LiteralEntityInstance.getInstance(\r\n\t\t\t\t\t\t\t\t\tentity, \r\n\t\t\t\t\t\t\t\t\tsimpleContextNodeList.get(0).getOvProblematic().getValueType())); \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor(ILiteralEntityInstance lei: possibleValueList){\r\n\t\t\t\t\t\t\tcontextFather.addPossibleValue(lei);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n//\t\t\t\t\t\tcontextFather.setOvProblematic(simpleContextNodeList.get(0).getOvProblematic());\r\n\t\t\t\t\t\tmapContextNode.put(contextNode, contextFather); \r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tssbnNode.setContextFatherSSBNNode(contextFather);\r\n\t\t\t\t\t} catch (InvalidParentException e) {\r\n\t\t\t\t\t\t//This exception don't occur in this case... \r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\tthrow new RuntimeException(e.getMessage()); \r\n\t\t\t\t\t} \r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tif (simple.isNodeInAVirualChain()) {\r\n\t\t\t\t// change the name of chain nodes\r\n\t\t\t\tssbnNode.getProbNode().setName(\"Chain\"+ simple.getStepsForChainNodeToReachMainNode() + \"_\" + ssbnNode.getProbNode().getName());\r\n\t\t\t\tDebug.println(ssbnNode.getProbNode().getName());\r\n\t\t\t}\r\n\t\t\tsimple.setProbNode(ssbnNode.getProbNode());\r\n\t\t}\r\n\t\t\r\n\t\t//Create the parent structure \r\n\t\t\r\n\t\tfor(SimpleSSBNNode simple: simpleSSBNNodeList){\r\n\t\t\t\r\n//\t\t\tif(simple.getParents().size()==0){\r\n//\t\t\t\tif(simple.getChildNodes().size()==0){\r\n//\t\t\t\t\tcontinue; //This node is out of the network. \r\n//\t\t\t\t}\r\n//\t\t\t}\r\n\t\t\t\r\n\t\t\tSSBNNode ssbnNode = correspondencyMap.get(simple); \r\n\t\t\t\r\n\t\t\tfor(SimpleSSBNNode parent: simple.getParents()){\r\n\t\t\t\tSSBNNode parentSSBNNode = correspondencyMap.get(parent); \r\n\t\t\t\tssbnNode.addParent(parentSSBNNode, false); \r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\treturn listSSBNNodes; \r\n\t}", "public void addPairs(\n\t\tIterable<? extends Pair>\tpairs)\n\t{\n\t\tfor (Pair pair : pairs)\n\t\t\tadd(pair);\n\t}", "private List<GPairRecord<S, S>> getNonCrossingPairs(final Predicate<Pair<S, S>> predicate) {\n List<GPairRecord<S, S>> recordList = new ArrayList<>();\n slp.getOrderedProductions().stream().map(p -> p.getLeft()).forEach(nonTerminal -> consumeNonCrossingPairs(nonTerminal, recordList::add, predicate));\n return recordList;\n }", "public static void main(String[] args) {\n\t\tList<List<Integer>> res = combinationSum2(new int[]{1,1,2,2,4,5,5,6,7,8,9}, 17);\n\t\t//expected:<[[8, 9], [1, 7, 9], [2, 6, 9], [2, 7, 8], [4, 5, 8], [4, 6, 7], [5, 5, 7], \n\t\t//[1, 1, 6, 9], [1, 1, 7, 8], [1, 2, 5, 9], [1, 2, 6, 8], [1, 4, 5, 7], [1, 5, 5, 6], \n\t\t//[2, 2, 4, 9], [2, 2, 5, 8], [2, 2, 6, 7], [2, 4, 5, 6], [1, 1, 2, 4, 9], [1, 1, 2, 5, 8], \n\t\t//[1, 1, 2, 6, 7], [1, 1, 4, 5, 6], [1, 2, 2, 4, 8], [1, 2, 2, 5, 7], [1, 2, 4, 5, 5], [1, 1, 2, 2, 4, 7], \n\t\t//[1, 1, 2, 2, 5, 6]]>\n\t\t//but was:\n\t\tfor (int i = 0; i < res.size(); i++) {\n\t\t\tfor (int num : res.get(i)) {\n\t\t\t\tSystem.out.print(num + \", \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public Map<String, List<Pair<String, String>>> getControlAndDataFlowPairs(GraphNode root, List<String> graphNodeIdList){\n\n this.getControlFlow(root);\n\n List<Pair<String, String>> controlFlowAndDataFlowPairs = new ArrayList<>(this.controlFlowPairs);\n controlFlowAndDataFlowPairs.retainAll(this.dataFlowPairs);\n\n this.controlFlowPairs.removeAll(controlFlowAndDataFlowPairs);\n\n this.dataFlowPairs.removeAll(controlFlowAndDataFlowPairs);\n\n // 删除不存在的数据流边(这种情况出现在:变量被定义的结点存在,但是使用变量的结点因为无法解析等原因而不存在)\n this.dataFlowPairs.removeIf(pair -> !graphNodeIdList.contains(pair.a) || !graphNodeIdList.contains(pair.b));\n\n Map<String, List<Pair<String, String>>> result = new HashMap<>();\n result.put(\"d\", this.dataFlowPairs);\n result.put(\"c\", this.controlFlowPairs);\n result.put(\"cd\", controlFlowAndDataFlowPairs);\n\n return result;\n }", "public List<List<Integer>> threeSum(int[] nums) {\n \n Arrays.sort(nums);\n Set<List<Integer>> set = new HashSet<>();\n for (int i = 0; i < nums.length; i++) {\n int left = i + 1, right = nums.length - 1;\n // two sum sorted list\n while (left < right) {\n int currentSum = nums[i] + nums[left] + nums[right];\n if (currentSum > 0) {\n right--;\n } else if (currentSum < 0) {\n left++;\n } else {\n set.add(Arrays.asList(nums[i], nums[left], nums[right]));\n left++;// keep going for other pairs\n right--;\n }\n }\n }\n \n return new ArrayList<>(set);\n }", "public Collection<MatchingPair> matchingPairs(Collection<Integer> values, Integer targetSum)\n {\n HashMap<Integer, Integer> tableCompteur = new HashMap<>();\n LinkedHashMap<Integer, Integer> tablePaire = new LinkedHashMap<Integer, Integer>();\n Collection<MatchingPair> paireSansDuplication = new LinkedList();\n Collection<MatchingPair> solution = new LinkedList();\n\n // On itere sur les valeurs donnee pour savoir le compte de chaque valeur\n for (Integer valeur : values)\n {\n if (tableCompteur.containsKey(valeur))\n {\n // Partie Compteur\n Integer compteur = tableCompteur.get(valeur);\n compteur++;\n tableCompteur.put(valeur, compteur);\n }\n else {\n tableCompteur.put(valeur, 0);\n }\n\n }\n\n // On itere sur les valeurs donnee pour savoir les paires\n for (Integer element : values)\n {\n int temp = targetSum - element;\n if (tablePaire.containsKey(element))\n {\n if (tablePaire.get(element) != null)\n {\n paireSansDuplication.add(new MatchingPair(element, temp));\n }\n // si la table contient l'element on met nul pour ne pas avoir de repetition\n tablePaire.put(temp, null);\n }\n else if (!tablePaire.containsKey(element))\n {\n tablePaire.put(temp, element);\n }\n }\n\n // On trouve le minimum count entre les paire et leur compte pour tenir en compte de toutes les possibilites. Ici le meilleur cas reste O(n) ( pas de paire)\n for (MatchingPair paire : paireSansDuplication)\n {\n if (paire != null) { // verification au debug pr erreur nullpointer\n int a = tableCompteur.get(paire.first);\n int b = tableCompteur.get(paire.second);\n int minCount = Math.min(a+1, b+1);\n for (int i = 0; i < pow(minCount, 2); i++)\n {\n solution.add(new MatchingPair(paire.first, paire.second));\n }\n }\n }\n return solution;\n }", "public ListNode swapPairs(ListNode head) {\n if(head == null)\n return head;\n \n \n int count = 0;\n ListNode h = head;\n ListNode end = head;\n ListNode preH = null;\n\n // we prefer to track a linked list using a head and a tail\n ListNode newHead = null;\n ListNode newTail = null;\n \n while(end != null)\n {\n count = 0;\n while(count < 2 && end != null)\n {\n count++;\n end = end.next;\n }\n \n if(count == 2)\n {\n ListNode temp = helper(preH, h, end);\n if(newHead == null)\n {\n newHead = temp;\n newTail = h;\n }else\n {\n newTail.next = temp; //link to the existing linked list\n }\n \n newTail = h; // !!! update tail pointer\n h = end;\n \n }\n if(count < 2 && end == null)\n {\n break;\n }\n \n /*\n if(count == 2 && end == null)\n {\n ListNode temp = helper(preH, h, end);\n if(newHead == null)\n {\n newHead = temp;\n newTail = h;\n }else\n {\n newTail.next = temp;\n \n }\n \n newTail = h; \n h = end;\n }\n */\n }\n \n if(newHead != null)\n return newHead;\n return head;\n }", "public List<GraphNode> reverse (List<GraphNode> list){\n\t\tMap<GraphNode, GraphNode> map = new HashMap<> ();\n\t\tfor(GraphNode node : list){\n\t\t\tmap.put(node, new GraphNode(node.key));\n\t\t}\n\t\tfor(GraphNode node : list){\n\t\t\tfor(GraphNode nei : node.neighbors){\n\t\t\t\tmap.get(nei).addNeibor(map.get(node));\n\t\t\t}\n\t\t}\n\t\tList<GraphNode> sol = new ArrayList<GraphNode>();\n\t\tfor(Map.Entry<GraphNode, GraphNode> node : map.entrySet()){\n\t\t\tsol.add(node.getValue());\n\t\t}\n\t\treturn sol;\n\t}", "public List<List<T>> cartesianProduct(List<List<T>> inputs) throws CartesianProductException {\n \n if (inputs==null || inputs.isEmpty()) {\n \n throw new CartesianProductException(\"inputs List cannot be null or empty\");\n }\n \n for (List<T> input : inputs) {\n \n if (input==null || input.isEmpty()) {\n \n throw new CartesianProductException(\"inputs cannot contain null or empty List\");\n }\n }\n \n List<Integer> indices = new ArrayList<>();\n \n List<List<T>> outputs = new ArrayList<>();\n\n while (nextIndices(inputs, indices)) {\n \n List<T> output = new ArrayList<>();\n \n for (int i=0; i<inputs.size(); i++) {\n \n output.add(inputs.get(i).get(indices.get(i)));\n }\n \n outputs.add(output);\n }\n \n return outputs;\n }", "public Pair(Node s, Node d) {\n this.source = s;\n this.destination = d;\n requestGenerators = new ArrayList<RequestGenerator>();\n }", "static <T> ListNode<T> listZipping(ListNode<T> list) {\n int size = 1;\n\n ListNode<T> current = list;\n while (current.next != null) {\n size++;\n current = current.next;\n }\n\n if (size < 2) return list;\n\n current = list;\n for (int i = 0; i < (size - 1) / 2; i++) current = current.next;\n\n ListNode<T> secondHalf = current.next;\n current.next = null;\n\n // reverse the second half\n current = secondHalf;\n while (current.next != null) {\n ListNode<T> tmp = current.next;\n current.next = tmp.next;\n tmp.next = secondHalf;\n secondHalf = tmp;\n }\n\n // merge\n ListNode<T> firstHalf = list;\n for (int i = 0; i < size / 2; i++) {\n ListNode<T> firstHalfNext = firstHalf.next;\n firstHalf.next = secondHalf;\n ListNode<T> secondHalfNext = secondHalf.next;\n secondHalf.next = firstHalfNext;\n\n firstHalf = firstHalfNext;\n secondHalf = secondHalfNext;\n }\n\n\n return list;\n }", "private void fillBindingPairs(List<Binding> bindingList,\n\t\t\tList<BindingPair> bindingPairs,\n\t\t\tMultipleVariable multipleCommonVariable,\n\t\t\tHashMap<Integer, List<Binding>> parentMappings) {\n\t\tfor (Binding binding : bindingList) {\n\t\t\t// generate hash code for the binding\n\t\t\tint multipleNodeHash = generateHashCode(multipleCommonVariable,\n\t\t\t\t\tbinding);\n\t\t\t// get parent bindings for this binding\n\t\t\tList<Binding> parentBindings = parentMappings.get(multipleNodeHash);\n\t\t\t// check for these parents is not null\n\t\t\tif (parentBindings != null) {\n\t\t\t\t// create a binding pair for each parent binding\n\t\t\t\tfor (Binding parentBinding : parentBindings) {\n\t\t\t\t\tbindingPairs.add(new BindingPair(binding, parentBinding));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public ArrayList<Person> allPairsDeduplication(){\n\tArrayList<Person> unduplicated = new ArrayList<>();\n\tfor (int i=0;i<this.lst.size();i++){\n\t int dup =0;\n\t //compare each element to elements after it in the list\n\t for(int j=i+1; j< this.lst.size();j++){\n\t\tif (lst.get(i).compareTo(lst.get(j)) == 0 ) dup++;\n\t }\n\t if (dup == 0) unduplicated.add(lst.get(i));\n\t}\n\treturn unduplicated;\n }", "public ListNode swapPairs(ListNode head) {\n if (head == null)\n return null;\n if (head.next == null)\n return head;\n ListNode tmp = null;\n ListNode newhead = null;\n ListNode pre = null;\n while (head != null) {\n if (tmp == null) {\n tmp = head;\n head = head.next;\n }\n else {\n if (pre == null) {\n pre = head;\n }\n else {\n pre.next = head;\n pre = pre.next;\n }\n tmp.next = pre.next;\n pre.next = tmp;\n if (newhead == null)\n newhead = pre;\n pre = pre.next;\n tmp = null;\n head = pre.next;\n }\n }\n if (tmp != null)\n pre.next = tmp;\n else {\n pre.next = null;\n }\n return newhead;\n }", "public static void main(String[] args) {\n\n Node n1 = new Node(1);\n Node n2 = new Node(2);\n Node n3 = new Node(3);\n Node n4 = new Node(4);\n\n n1.neighbors.add(n2);\n n1.neighbors.add(n4);\n n2.neighbors.add(n1);\n n2.neighbors.add(n4);\n n3.neighbors.add(n2);\n n3.neighbors.add(n4);\n n4.neighbors.add(n1);\n n4.neighbors.add(n3);\n\n for (Node n : n1.neighbors) {\n System.out.print(n.val + \" \");\n }\n for (Node n : n2.neighbors) {\n System.out.print(n.val + \" \");\n }\n for (Node n : n3.neighbors) {\n System.out.print(n.val + \" \");\n }\n for (Node n : n4.neighbors) {\n System.out.print(n.val + \" \");\n }\n\n System.out.println();\n Node result = Solution.cloneGraph(n1);\n printGraph(result, 4);\n\n }", "Iterable<PortPairGroup> getPortPairGroups();", "public static long taskOfPairing(List<Long> freq) {\n // Write your code here\n long pairs = 0;\n boolean isOdd = false;\n boolean hasRemained = false;\n long curNum = 0;\n for (int weight = 1; weight <= freq.size(); weight++) {\n curNum = freq.get(weight - 1);\n pairs += (curNum / 2);\n if (curNum % 2 != 0) {\n if (hasRemained) {\n pairs++;\n hasRemained = false;\n } else {\n hasRemained = true;\n }\n isOdd = true;\n } else {\n if (!isOdd) {\n hasRemained = false;\n }\n isOdd = false;\n }\n\n }\n\n return pairs;\n\n }", "int[] getInEdges(int... nodes);", "public static Iterable<Node> iterableOf(@Nonnull final NodeList nodeList) {\n\t\treturn () -> new NodeListIterator(nodeList);\n\t}", "private SortedSet<NodeStation> generateNodeStations() throws GenerationException {\n // create Set of NodeStations\n SortedSet<NodeStation> nodeStations = new TreeSet<>();\n for (ReferenceStation referenceStation : referenceStations) {\n nodeStationGenerator.referenceStation(referenceStation).generate()\n .ifPresent(nodeStations::add);\n }\n return nodeStations;\n }", "public List<GraphNode> copy(List<GraphNode> graph) {\n Map<GraphNode, GraphNode> map = new HashMap<>();\n List<GraphNode> res = new ArrayList<>();\n for(GraphNode node : graph) {\n subCopy(node, map, res);\n }\n return res;\n }", "public List<GraphNode> copy(List<GraphNode> graph) {\n Map<GraphNode, GraphNode> map = new HashMap<>();\n List<GraphNode> res = new ArrayList<>();\n for(GraphNode node : graph) {\n subCopy(node, map, res);\n }\n return res;\n }", "private void fourNodesTopo() {\n ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();\n n(tx, true, \"n1\", Stream.of(pB(\"n1:1\"), pB(\"n1:2\"), pI(\"n1:3\"), pO(\"n1:4\"), pO(\"n1:5\")));\n n(tx, true, \"n2\", Stream.of(pB(\"n2:1\"), pB(\"n2:2\"), pO(\"n2:3\"), pI(\"n2:4\"), pI(\"n2:5\")));\n n(tx, true, \"n3\", Stream.of(pB(\"n3:1\"), pB(\"n3:2\"), pO(\"n3:3\"), pO(\"n3:4\"), pI(\"n3:5\")));\n n(tx, true, \"n4\", Stream.of(pB(\"n4:1\"), pB(\"n4:2\"), pI(\"n4:3\"), pI(\"n4:4\"), pO(\"n4:5\")));\n l(tx, \"n1\", \"n1:5\", \"n2\", \"n2:5\", OperationalState.ENABLED, ForwardingDirection.UNIDIRECTIONAL);\n l(tx, \"n1\", \"n1:4\", \"n4\", \"n4:4\", OperationalState.ENABLED, ForwardingDirection.UNIDIRECTIONAL);\n l(tx, \"n2\", \"n2:3\", \"n4\", \"n4:3\", OperationalState.ENABLED, ForwardingDirection.UNIDIRECTIONAL);\n l(tx, \"n3\", \"n3:4\", \"n2\", \"n2:4\", OperationalState.ENABLED, ForwardingDirection.UNIDIRECTIONAL);\n l(tx, \"n4\", \"n4:5\", \"n3\", \"n3:5\", OperationalState.ENABLED, ForwardingDirection.UNIDIRECTIONAL);\n try {\n tx.submit().checkedGet();\n } catch (TransactionCommitFailedException e) {\n e.printStackTrace();\n }\n }", "public static List<Heuristic> nextGeneration(List<Heuristic> parents, int populationSize, double mutationProb) {\n\t\tif(parents.size() % 2 != 0 || parents.size() < 2)\n\t\t\tthrow new IllegalArgumentException(\"Must be an even number of parents\");\n\t\t\t\t\n\t\tList<Heuristic> ret = new ArrayList<>();\n\t\t\n\t\tfor(Heuristic par : parents)\n\t\t\tret.add(par.copy());\n\t\t\n\t\tfor(int i=0; i<parents.size(); i+=2) {\n\t\t\tList<Heuristic> children = parents.get(i).crossover(parents.get(i+1));\n\t\t\t\n\t\t\tfor(Heuristic child : children)\n\t\t\t\tret.add(child.copy());\n\t\t\t\n\t\t\twhile(ret.size() < (i+2)/parents.size() * populationSize)\n\t\t\t\tfor(Heuristic child : children) {\n\t\t\t\t\tret.add(child.copy().mutate(mutationProb));\n\t\t\t\t\tif(ret.size() == populationSize) return ret;\n\t\t\t\t}\n\t\t}\n\t\t\n\t\treturn ret;\n\t}", "public List<List<Integer>> topologicalSort(int vertices, int[][] edges) {\n List<List<Integer>> result = new LinkedList<>();\n // corner case\n if (vertices == 0 || edges == null || edges.length == 0) {\n return result;\n }\n\n // 0 - define two hashmaps, one stores the vertices and its adjacent nodes;\n // the other stores the vertices and the times that vertex is an adjacent node of others\n Map<Integer, List<Integer>> adjacency = new HashMap<>();\n Map<Integer, Integer> freq = new HashMap<>();\n\n // 1 - initialize two hashMaps\n for (int vertex = 0; vertex < vertices; vertex++) {\n adjacency.put(vertex, new LinkedList<Integer>());\n freq.put(vertex, 0);\n }\n\n // 2 - build two hashmaps using the given input data\n for (int[] edge : edges) {\n // edge[0] - source vertex\n // edge[1] - destination vertex\n adjacency.get(edge[0]).add(edge[1]);\n freq.put(edge[1], freq.get(edge[1]) + 1);\n }\n\n // 3 - find all source vertices (vertices that have no incoming edges and have only outgoing edges)\n Queue<Integer> sources = new LinkedList<>();\n for (int vertex : freq.keySet()) {\n if (freq.get(vertex) == 0) {\n sources.offer(vertex);\n }\n }\n\n // 4 - find the next sources recursively\n findSources(result, new LinkedList<Integer>(), adjacency, freq, sources);\n\n return result;\n }", "public List<List<Integer>> allTriples(int[] array, int target) {\n List<List<Integer>> res = new ArrayList<>();\n int n = array.length;\n Arrays.sort(array);\n for (int i = 0; i < n - 2; i++) {\n if (i > 0 && array[i] == array[i - 1]) { // remove dups for the 1st member\n continue;\n }\n int left = i + 1, right = n - 1;\n while (left < right) {\n int subsum = array[left] + array[right];\n if (subsum == target - array[i]) {\n res.add(Arrays.asList(array[i], array[left], array[right]));\n left++; // without this line, you will get infinite loop\n while (left < right && array[left] == array[left - 1]) {\n left++;\n }\n } else if (subsum < target - array[i]) {\n left++;\n } else { \n right--;\n }\n }\n }\n return res;\n }", "public FloydWarshallAlgorithm(final Node[] nodes, final Edge[] edges) {\n D = initializeWeight(nodes, edges);\n P = new Node[nodes.length][nodes.length];\n /**\n * Add all vertices one by one to the set of intermediate\n * vertices.\n * Before start of a iteration, we have shortest\n * distances between all pairs of vertices such that\n * the shortest distances consider only the vertices in\n * set {0, 1, 2, .. k-1} as intermediate vertices.\n * After the end of a iteration, vertex no. k is added\n * to the set of intermediate vertices and the set\n * becomes {0, 1, 2, .. k}\n */\n\n for (int k = 0; k < nodes.length; k++) {\n // Pick all vertices as source one by one\n for (int i = 0; i < nodes.length; i++) {\n // Pick all vertices as destination for the\n // above picked source\n for (int j = 0; j < nodes.length; j++) {\n // If vertex k is on the shortest path from\n // i to j, then update the value of D[i][j]\n if (D[i][k] != Integer.MAX_VALUE\n && D[k][j] != Integer.MAX_VALUE\n && D[i][k] + D[k][j] < D[i][j]) {\n D[i][j] = D[i][k] + D[k][j];\n P[i][j] = nodes[k];\n }\n }\n }\n }\n }", "private static <T> List<T> pairList(T a, T b) {\n ArrayList<T> res = new ArrayList<T>();\n res.add(a);\n res.add(b);\n return res;\n }", "@Deprecated\n public List<Pair<String, String>> getControlFlow2(GraphNode root){\n this.controlFlowPairs = new ArrayList<>();\n\n List<GraphNode> graphNodes = breadthFirstTraversal(root);\n\n for(GraphNode graphNode : CollectionUtils.emptyIfNull(graphNodes)){\n for(GraphNode childNode : CollectionUtils.emptyIfNull(graphNode.getChildNodes())){\n controlFlowPairs.add(new Pair<>(graphNode.getId(), childNode.getId()));\n }\n }\n\n // System.out.println(controlFlowPairs.size());\n\n return this.controlFlowPairs;\n }", "int[] getOutEdges(int... nodes);", "public static List<List<Integer>> createGraph(int n) {\n List<List<Integer>> graph = new ArrayList<>();\n for (int i = 0; i < n; i++) graph.add(new ArrayList<>());\n return graph;\n }", "public static <T> List<Pair<Integer, T>> listToIndexElementPairList(List<T> list) {\n List<Pair<Integer, T>> ret = new ArrayList<Pair<Integer, T>>();\n Iterator<T> listIter = list.iterator();\n for (int i=0; i<list.size(); i++) {\n ret.add(Pair.make(i, listIter.next()));\n }\n \n return ret;\n }", "@Override\n\tpublic List<AbstractNode> getChildren()\n\t{\n\t\treturn new ArrayList<>(pairs.values());\n\t}", "public void pairPlayers() {\n List<UUID> lis = new ArrayList<UUID>(playerRegistry.keySet());\n \n Collections.shuffle(lis);\n UUID first = lis.get(0);\n\n for(int i = 0; i <= lis.size(); i++) {\n UUID temp = lis.get(i);\n if(i == lis.size()) {\n pairedPlayers.put(temp, first);\n break;\n }\n\n UUID tempNext = lis.get(i + 1);\n pairedPlayers.put(temp, tempNext);\n }\n\n SecretSanta._this().logDebug(\"[GiftManager] Pairing complete: \" + pairedPlayers.toString());\n }", "static public List<Pair<String, List<Stroke>>> generateTrainingPairs() {\n\t\tList<String> refFiles = new ArrayList<String>();\n\n\t\t// list of files containing actual stroke data points\n\t\tList<String> dataFiles = new ArrayList<String>();\n\n\t\tString[] dirs = FileUtil.subDirectoryNames(TRAINING_DATA_SET_DIR\n\t\t\t\t+ \"/ref\");\n\n\t\tfor (String dir : dirs) {\n\t\t\tString[] files = FileUtil\n\t\t\t\t\t.fileNamesInDirectory(TRAINING_DATA_SET_DIR + \"/ref/\" + dir);\n\t\t\tfor (String file : files) {\n\t\t\t\trefFiles.add(TRAINING_DATA_SET_DIR + \"/ref/\" + dir + \"/\" + file);\n\t\t\t\tdataFiles.add(TRAINING_DATA_SET_DIR + \"/data/\" + dir + \"/\"\n\t\t\t\t\t\t+ file);\n\t\t\t}\n\t\t}\n\n\t\treturn generatePairs(refFiles, dataFiles);\n\t}", "public ListNode swapPairs2(ListNode head) {\n if ((head == null)||(head.next == null))\n return head;\n ListNode n = head.next;\n head.next = swapPairs2(head.next.next);\n n.next = head;\n return n;\n }", "void shortestPaths( Set<Integer> nodes );", "public static void printPairsUsingSet(int[] numbers, int n) {\r\n\t\tif (numbers.length < 2) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tSet set = new HashSet(numbers.length);\r\n\t\tfor (int value : numbers) {\r\n\t\t\tint target = n - value;\r\n\t\t\t// if target number is not in set then add\r\n\t\t\tif (!set.contains(target)) {\r\n\t\t\t\tset.add(value);\r\n\t\t\t} else {\r\n\t\t\t\tSystem.out.printf(\"(%d, %d) %n\", value, target);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void addPairs(\n\t\tPair...\tpairs)\n\t{\n\t\tfor (Pair pair : pairs)\n\t\t\tadd(pair);\n\t}", "public static List<UsernameNodeUrnsMap> convertToUsernameNodeUrnsMap(\n\t\t\tfinal List<SecretAuthenticationKey> secretAuthenticationKeys,\n\t\t\tfinal List<NodeUrn> nodeUrns) throws InvalidAttributesException {\n\n\t\t/*\n\t\t * Check whether two tuples of user names and urn prefixes share an urn prefix\n\t\t */\n\t\tfinal Set<NodeUrnPrefix> prefixes = new HashSet<NodeUrnPrefix>();\n\n\t\tfor (SecretAuthenticationKey secretAuthenticationKey : secretAuthenticationKeys) {\n\t\t\tif (!prefixes.add(secretAuthenticationKey.getUrnPrefix())) {\n\t\t\t\tthrow new InvalidAttributesException(\"The node urn prefix '\"\n\t\t\t\t\t\t+ secretAuthenticationKey.getUrnPrefix()\n\t\t\t\t\t\t+ \"' is associated to multiple user names.\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tfinal List<UsernameNodeUrnsMap> mappings = new LinkedList<UsernameNodeUrnsMap>();\n\n\t\tfor (SecretAuthenticationKey secretAuthenticationKey : secretAuthenticationKeys) {\n\n\t\t\tfinal NodeUrnPrefix urnPrefix = secretAuthenticationKey.getUrnPrefix();\n\t\t\tfinal String username = secretAuthenticationKey.getUsername();\n\n\t\t\tfinal UsernameNodeUrnsMap mapping = new UsernameNodeUrnsMap();\n\t\t\tmapping.setUrnPrefix(urnPrefix);\n\t\t\tmapping.setUsername(username);\n\t\t\tmappings.add(mapping);\n\n\t\t\tfor (NodeUrn nodeUrn : nodeUrns) {\n\t\t\t\tif (nodeUrn.belongsTo(urnPrefix)) {\n\t\t\t\t\tmapping.getNodeUrns().add(nodeUrn);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn mappings;\n\t}", "public List<List<Integer>> createGraph(int n) {\r\n List<List<Integer>> graph = new ArrayList<>(n);\r\n for (int i = 0; i < n; i++) graph.add(new ArrayList<>());\r\n return graph;\r\n }", "public ShortestPathMatrix<V,E> allPairsShortestPaths();", "private List<AxiomTreeMapping> matchNodeLists(List<AxiomTreeNode> t1s, List<AxiomTreeNode> t2s, AxiomTreeMapping mapping) {\n\n // no more child nodes left\n if (t1s.isEmpty()) {\n return Collections.singletonList(mapping);\n }\n\n List<AxiomTreeMapping> matches = new ArrayList<AxiomTreeMapping>();\n\n // get the first child node in the list\n AxiomTreeNode t1 = t1s.get(0);\n List<AxiomTreeNode> t1sReduced = reduceNodeList(t1s, 0);\n //System.out.println(\"FIRST CHILD NODES: \" + t1sReduced);\n // loop over child nodes in t2s\n for (int i = 0; i < t2s.size(); i++) {\n AxiomTreeNode t2 = t2s.get(i);\n List<AxiomTreeNode> t2sReduced = reduceNodeList(t2s, i);\n //System.out.println(\"SECOND CHILD NODES: \" + t2sReduced);\n // try and match the first element in t1s and some element in t2\n for (AxiomTreeMapping match : match(t1, t2, mapping)) {\n matches.addAll(matchNodeLists(t1sReduced, t2sReduced, match));\n }\n }\n \n return matches;\n }", "private List<SquareNode> createCluster(boolean skip, int ...levels ) {\n\n\t\tint total = 0;\n\t\tfor (int i = 0; i < levels.length; i++) {\n\t\t\ttotal += levels[i];\n\t\t}\n\n\t\tList<SquareNode> out = new ArrayList<>();\n\t\tfor (int i = 0; i < total; i++) {\n\t\t\tout.add( new SquareNode());\n\t\t\tout.get(i).graph = SquareNode.RESET_GRAPH;\n\t\t\tout.get(i).square = new Polygon2D_F64(4);\n\t\t}\n\n\t\tint previous = 0;\n\t\tfor (int i = 0; i < levels.length-1; i++) {\n\t\t\tint current = previous + levels[i];\n\t\t\tint next = current + levels[i + 1];\n\t\t\tfor (int a = 0; a < levels[i]; a++) {\n\t\t\t\tSquareNode n = out.get(previous + a);\n\n\t\t\t\tint right = skip ? current + a + 1 : current + a;\n\t\t\t\tint left = right - 1;\n\n\t\t\t\tif (right < next)\n\t\t\t\t\tconnect(n, 2, out.get(right), 0);\n\t\t\t\tif (left >= current) {\n\t\t\t\t\tconnect(n, 3, out.get(left), 1);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tprevious = current;\n\t\t\tskip = !skip;\n\t\t}\n\n\t\treturn out;\n\t}", "public abstract List<TreeNode> orderNodes(List<? extends TreeNode> nodes);", "private <T> List<T> contactNNodes(byte[] nodeKey, byte[] key, TreeSet<KademliaNodeWrapper> shortList, TreeSet<KademliaNodeWrapper> probedNodes, int n, TwoParameterFunction<KademliaNode, byte[], Pair<KademliaNode, List<T>> > rpc) {\n // Select alpha nodes to query\n List<KademliaNodeWrapper> tempAlphaList = new ArrayList<>();\n Iterator it = shortList.iterator();\n while (tempAlphaList.size() < KademliaUtils.alpha && it.hasNext()) {\n KademliaNodeWrapper node = (KademliaNodeWrapper) it.next();\n\n if (probedNodes.contains(node))\n continue;\n\n tempAlphaList.add(node);\n }\n\n// logger.log(Level.INFO, \"tempAlphaList with \" + tempAlphaList.size() + \" nodes\");\n\n // Variable to store the returned objects in case the RPC is Find_Value\n List<T> ret = new ArrayList<>();\n\n // Query selected alpha nodes\n for(KademliaNodeWrapper node : tempAlphaList) {\n boolean received = false;\n\n if(badNodes.containsKey(Utils.bytesToHexString(node.getNodeID()))){\n if(badNodes.get(Utils.bytesToHexString(node.getNodeID())).getLastSeen() > Instant.now().getEpochSecond() + KademliaUtils.badNodeTimeoutSecs) {\n badNodes.remove(Utils.bytesToHexString(node.getNodeID()));\n }\n else\n continue;\n }\n\n Pair<KademliaNode, List<T>> retAux = rpc.apply(node, key);\n\n if(retAux.getFirst() == null) {\n// logger.log(Level.INFO, \"Node \" + node + \" didn't respond. Removing from shortlist.\");\n shortList.remove(node);\n badNodes.put(Utils.bytesToHexString(node.getNodeID()), node);\n bucketManager.removeNode(node);\n }\n else {\n// logger.log(Level.INFO, \"Node \" + node + \" returned some things.\");\n bucketManager.insertNode(retAux.getFirst());\n probedNodes.add(node);\n }\n\n\n // Set node timestamp as the distance\n for(T aux : retAux.getSecond()) {\n if (aux.getClass() == KademliaNode.class) {\n KademliaNode aux2 = (KademliaNode) aux;\n// bucketManager.insertNode(aux2);\n\n KademliaNodeWrapper aux3 = new KademliaNodeWrapper(aux2, KademliaUtils.distanceTo(aux2.getNodeID(), nodeKey));\n if(!badNodes.containsKey(Utils.bytesToHexString(aux3.getNodeID())))\n shortList.add(aux3);\n else if(badNodes.get(Utils.bytesToHexString(aux3.getNodeID())).getLastSeen() > Instant.now().getEpochSecond() + KademliaUtils.badNodeTimeoutSecs){\n badNodes.remove(Utils.bytesToHexString(aux3.getNodeID()));\n shortList.add(aux3);\n }\n\n// logger.log(Level.INFO, \"Node \" + aux2 + \" added.\");\n }\n else {\n// logger.log(Level.INFO, \"Added some information.\");\n ret.add(aux);\n received = true;\n }\n }\n\n if(received)\n return ret;\n }\n\n return ret;\n }", "private static Node createLoopedList()\n {\n Node n1 = new Node(1);\n Node n2 = new Node(2);\n Node n3 = new Node(3);\n Node n4 = new Node(4);\n Node n5 = new Node(5);\n Node n6 = new Node(6);\n Node n7 = new Node(7);\n Node n8 = new Node(8);\n Node n9 = new Node(9);\n Node n10 = new Node(10);\n Node n11 = new Node(11);\n\n n1.next = n2;\n n2.next = n3;\n n3.next = n4;\n n4.next = n5;\n n5.next = n6;\n n6.next = n7;\n n7.next = n8;\n n8.next = n9;\n n9.next = n10;\n n10.next = n11;\n n11.next = n5;\n\n return n1;\n }", "List<Node> nodes();", "public List<List<Integer>> permute(int[] nums) {\n List<List<Integer>> res = new ArrayList<>();\n List<Integer> numList = new ArrayList<>();\n for (int n : nums) numList.add(n);\n permute(numList, 0, res);\n return res;\n }", "public List<List<Integer>> threeSum(int[] nums) {\n HashMap<Integer, Integer> new_nums = new HashMap<Integer, Integer>();\n for (int i = 0; i < nums.length; i++) {\n new_nums.put(nums[i], i);\n }\n \n // find triplets\n HashSet<List<Integer>> product = new HashSet<List<Integer>>();\n for (int i = 0; i < nums.length; i++) {\n int nums_i = nums[i];\n for (int j = i + 1; j < nums.length; j++) {\n int target = 0 - (nums_i + nums[j]);\n int index = new_nums.get(target) != null ? new_nums.get(target) : -1;\n if (index != -1 && index > j) {\n List<Integer> triplet = new ArrayList<Integer>();\n int[] list = findOrder(nums_i, nums[j], target);\n triplet.add(list[0]);\n triplet.add(list[1]);\n triplet.add(list[2]);\n product.add(triplet);\n }\n }\n }\n return new ArrayList<List<Integer>>(product);\n \n }", "public List<List<Integer>> palindromePairs(String[] words) {\n\t\t\t\n\t\t\tif(words == null) return null;\n\t\t\tList<List<Integer>> res = new LinkedList<>();\n\t\t\tList<Integer> tempList = new LinkedList<>();\n\t\t\tif(words.length == 0) return res;\n\t\t\t\n\t\t\t// but seems all possible is too many, let try brutal force first, cannot, exceed the time limit.\n//\t\t\tfor(int i = 0; i< words.length ; i++){\n//\t\t\t\ttempList.clear();\n//\t\t\t\ttempList.add(i);\n//\t\t\t\tfor(int j = 0; j < words.length ; j++){\n//\t\t\t\t\tif(j == i) continue;\n//\t\t\t\t\tif(isPalindrome(words[i]+words[j])){\n//\t\t\t\t\t\ttempList.add(j);\n//\t\t\t\t\t\tres.add(new LinkedList<>(tempList));\n//\t\t\t\t\t\ttempList.remove(tempList.size()-1);\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t}\n\t\t\tMap<String, Integer> map = new HashMap<String, Integer>();\n\t\t\tfor(int i = 0; i<words.length; i++) map.put(words[i], i);\n\t\t\tfor(int i = 0; i<words.length; i++){\n\t\t\t\t\tfor(int j = 0; j <= words[i].length(); j++){\n\t\t\t\t\t\tString pre = words[i].substring(0, j);\n\t\t\t\t\t\tString after = words[i].substring(j);\n\t\t\t\t\t\tif(isPalindrome(pre)){\n\t\t\t\t\t\t\tString afterrev =new StringBuffer(after).reverse().toString();\n\t\t\t\t\t\t\tif(map.containsKey(afterrev) &&map.get(afterrev) != i){\n\t\t\t\t\t\t\t\ttempList.clear();\n\t\t\t\t\t\t\t\ttempList.add(map.get(afterrev));\n\t\t\t\t\t\t\t\ttempList.add(i);\n\t\t\t\t\t\t\t\tres.add(new LinkedList<>(tempList));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(isPalindrome(after)){\n\t\t\t\t\t\t\tString prerev =new StringBuffer(pre).reverse().toString();\n\t\t\t\t\t\t\tif(map.containsKey(prerev) &&map.get(prerev) != i && after.length() != 0){\n\t\t\t\t\t\t\t\ttempList.clear();\n\t\t\t\t\t\t\t\ttempList.add(i);\n\t\t\t\t\t\t\t\ttempList.add(map.get(prerev));\n\t\t\t\t\t\t\t\tres.add(new LinkedList<>(tempList));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t\treturn res;\n }", "public static void main(String[] args) {\n ListNode node1 = new ListNode(1, new ListNode(4, new ListNode(5)));\n // ListNode[] arr = new ListNode[3];\n // ListNode node1 = new ListNode(1, new ListNode(4, new ListNode(5)));\n // ListNode node2 = new ListNode(1, new ListNode(3, new ListNode(4)));\n // ListNode node3 = new ListNode(3, new ListNode(6));\n // arr[0] = node1;\n // arr[1] = node2;\n // arr[2] = node3;\n\n // ListNode result = new ListNode();\n System.out.println(node1.toString());\n // System.out.println(arr.toString());\n // result = mergeArraysHelper(arr, 0, arr.length - 1);\n // System.out.println(result.toString());\n }" ]
[ "0.6049518", "0.56802857", "0.56484526", "0.56027126", "0.5465934", "0.54330546", "0.5393137", "0.5388823", "0.5350224", "0.534209", "0.53418183", "0.52832866", "0.5220392", "0.5214971", "0.5179633", "0.5119694", "0.509907", "0.50071245", "0.49729323", "0.49702463", "0.4939553", "0.49345148", "0.49227774", "0.49195835", "0.49144888", "0.48999622", "0.48995852", "0.48994648", "0.4896523", "0.48911262", "0.4891099", "0.48710144", "0.4869455", "0.4835899", "0.48308152", "0.48210987", "0.48017368", "0.47931197", "0.47768918", "0.4754367", "0.474754", "0.47457153", "0.4735472", "0.4719477", "0.47115088", "0.46958476", "0.46928546", "0.4669441", "0.46563706", "0.46379277", "0.4634603", "0.4622942", "0.4621889", "0.46166", "0.4616163", "0.45969278", "0.45951736", "0.45831352", "0.4581285", "0.4548423", "0.45457995", "0.4542404", "0.45351562", "0.45347035", "0.45319086", "0.4529859", "0.45285186", "0.4522957", "0.45047557", "0.45047557", "0.44988775", "0.4495623", "0.447694", "0.44755122", "0.44714096", "0.44665447", "0.4464175", "0.44631657", "0.4461522", "0.44535118", "0.44531444", "0.4447257", "0.44469005", "0.44405964", "0.44404352", "0.44351253", "0.44317114", "0.44250873", "0.44248265", "0.44225508", "0.44191837", "0.4412965", "0.44109127", "0.44103426", "0.44080442", "0.4404635", "0.43841222", "0.43811744", "0.43765494", "0.43718472" ]
0.834163
0
Finds all node pairs that are not adjacent in an input graph
private Set<NodePair> nonadjacencies(Graph graph) { Set<NodePair> nonadjacencies = new HashSet<>(); for (Graph inputPag : input) { for (NodePair pair : allNodePairs(inputPag.getNodes())) { if (!inputPag.isAdjacentTo(pair.getFirst(), pair.getSecond())) { nonadjacencies.add(new NodePair(graph.getNode(pair.getFirst().getName()), graph.getNode(pair.getSecond().getName()))); } } } return nonadjacencies; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@SuppressWarnings(\"unchecked\")\n\tpublic ArrayList<Node<A>> neighbours(){\n\t\t\n\t\tArrayList<Node<A>> output = new ArrayList<Node<A>>();\n\t\t\n\t\tif (g == null) return output;\n\t\t\n\t\tfor (Object o: g.getEdges()){\n\n\t\t\t\n\t\t\tif (((Edge<?>)o).getTo().equals(this)) {\n\t\t\t\t\n\t\t\t\tif (!output.contains(((Edge<?>)o).getFrom()))\n\t\t\t\t\t\toutput.add((Node<A>) ((Edge<?>)o).getFrom());\n\t\t\t\t\n\t\t\t}\n\n\t\t} \n\t\treturn output;\n\t\t\n\t}", "public List<Integer> eventualSafeNodes(int[][] graph) {\n int N = graph.length;\n int[] color = new int[N];\n List<Integer> ans = new ArrayList<>();\n\n for (int i = 0; i < N; i++) {\n if (hasNoCycle(i, color, graph))\n ans.add(i);\n }\n\n return ans;\n }", "int[] getOutEdges(int... nodes);", "private List<Node> getAdjacentNodes(Node current, List<Node> closedSet, Node dest) {\n\t\tList<Node> adjacent = new ArrayList<Node>();\n\t\t\n\t\tfor (int i = -1; i <=1; i++) {\n\t\t\tinner:\n\t\t\tfor (int j = -1; j <=1; j++) {\n\t\t\t\tif (i == 0 && j == 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint x = current.getX() + i;\n\t\t\t\tint y = current.getY() + j;\n\t\t\t\tif (!currentState.inBounds(x, y)\n\t\t\t\t\t\t|| board.getHasTree(x, y)\n\t\t\t\t\t\t|| peasantAt(x,y)\n\t\t\t\t\t\t|| board.getTowerProbability(x, y) == 1\n\t\t\t\t\t\t|| isTownHallAt(x, y, dest)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tNode node = new Node(x, y, getHitProbability(x, y), current);\n\t\t\t\tfor (Node visitedNode : closedSet) {\n\t\t\t\t\tif (node.equals(visitedNode)) {\n\t\t\t\t\t\tcontinue inner;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tadjacent.add(node);\n\t\t\t}\n\t\t}\n//\t\tSystem.out.println(\"AT \" + current);\n//\t\tSystem.out.println(\"NEIGHBORS:\");\n//\t\tfor (Node node : adjacent) {\n//\t\t\tSystem.out.println(\"\\t\" + node);\n//\t\t}\n\t\t\n\t\treturn adjacent;\n\t}", "public Set<Pair<V,V>> neighbourEdgesOf(V vertex);", "abstract ArrayList<Pair<Integer,Double>> adjacentNodes(int i);", "private List<Node> getNeighbors(Node node) {\n List<Node> neighbors = new LinkedList<>();\n\n for(Node adjacent : node.getAdjacentNodesSet()) {\n if(!isSettled(adjacent)) {\n neighbors.add(adjacent);\n }\n }\n\n return neighbors;\n }", "Set<Edge> getIncomingNeighborEdges(boolean onUpwardPass) {\n//\t\t\tif(_outgoingEdges.size() == 0) { // only compute if we have to\n\t\t\t\tSet<Edge> outgoingEdges = new HashSet<Edge>();\n\t\t\t\tIterator<Edge> it = _neighborEdges.keySet().iterator();\n\t\t\t\twhile(it.hasNext()) {\n\t\t\t\t\tEdge e = it.next();\n\t\t\t\t\tVertex v = e.getOtherVertex(this);\n\t\t\t\t\tif(this._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops i am unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(v._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops neighbor unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(this._orderID < v._orderID) {\n\t\t\t\t\t\toutgoingEdges.add(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_outgoingEdges = outgoingEdges;\n//\t\t\t}\n//\t\t\treturn _outgoingEdges;\n\t\t\t\treturn outgoingEdges;\n\t\t}", "public static ArrayList<String> connectors2(Graph g) {\n boolean[] visits = new boolean[g.members.length]; \n for (int i=0;i<=g.members.length-1;i++) {\n \tvisits[i]=false;\n }\n int[] dfsnum = new int[g.members.length];\n int[] back = new int[g.members.length];\n ArrayList<String> answer = new ArrayList<String>();\n\n //driver portion\n for (Person person : g.members) {\n //if it hasn't been visited\n if (visits[g.map.get(person.name)]==false){\n //for different islands\n dfsnum = new int[g.members.length];\n dfs(g.map.get(person.name), g.map.get(person.name), g, visits, dfsnum, back, answer);\n }\n }\n \n //check if vertex has one neighbor\n for (int i = 0; i < answer.size(); i++) {\n Friend ptr = g.members[g.map.get(answer.get(i))].first;\n //counts number of neighbors\n int count = 0;\n while (ptr != null) {\n ptr = ptr.next;\n count++;\n }\n if (count == 1) answer.remove(i);\n if (count == 0) answer.remove(i);\n } \n for (Person member : g.members) {\n if (member.first!=null&& member.first.next == null) {\n if (answer.contains(g.members[member.first.fnum].name)==false)\n \t\t answer.add(g.members[member.first.fnum].name);\n }\n }\n answer=modify(answer,g);\n if (answer==null||answer.size()==0) return null;\n return answer;\n }", "private List<PlainEdge> getNotEdge(PlainGraph graph, PlainEdge edge) {\n return graph.edgeSet().stream().filter(e ->\n e.source().equals(edge.source())\n && e.target().equals(edge.target())\n && e.label().text().equals(String.format(\"%s:\", NOT)))\n .collect(Collectors.toList());\n }", "public List<Integer> eventualSafeNodes(int[][] graph) {\n boolean[] visited = new boolean[graph.length];\n boolean[] onStack = new boolean[graph.length];\n boolean[] onCycle = new boolean[graph.length];\n\n for (int i = 0; i < graph.length; i++) {\n if (!visited[i]) {\n if (hasCycle(i, graph, visited, onStack, onCycle)) {\n onCycle[i] = true;\n }\n }\n // System.out.println(i+ \"-->\"+Arrays.toString(onCycle));\n }\n\n List<Integer> res = new ArrayList<>(visited.length);\n for (int i = 0; i < onCycle.length; i++) {\n if (!onCycle[i]) {\n res.add(i);\n }\n }\n return res;\n }", "private Set<Integer>[] getKernelDAG(List<Integer>[] adjacent) {\n Set<Integer>[] adjacentComponents = (HashSet<Integer>[]) new HashSet[sccCount];\n for (int i = 0; i < adjacentComponents.length; i++) {\n adjacentComponents[i] = new HashSet<>();\n }\n\n for (int vertexId = 0; vertexId < adjacent.length; vertexId++) {\n int currentComponent = sccIds[vertexId];\n\n for (int neighbor : adjacent[vertexId]) {\n if (currentComponent != sccIds[neighbor]) {\n adjacentComponents[currentComponent].add(sccIds[neighbor]);\n }\n }\n }\n return adjacentComponents;\n }", "protected ArrayList<int[]> findAdjacentUnknown(int[] pair) {\n\t\tint x = pair[0];\n\t\tint y = pair[1];\n\t\tArrayList<int[]> neighbors = new ArrayList<int[]>();\n\t\tfor (int i = x - 1; i <= x + 1; i++) {\n\t\t\tfor (int j = y - 1; j <= y + 1; j++) {\n\t\t\t\tif (i >= 0 && i < maxX && j >= 0 && j < maxY && coveredMap[i][j] == SIGN_UNKNOWN) {\n\t\t\t\t\tneighbors.add(new int[]{i, j});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn neighbors;\n\t}", "private List<NodePair> allNodePairs(List<Node> nodes) {\n List<NodePair> nodePairs = new ArrayList<>();\n for (int j = 0; j < nodes.size() - 1; j++) {\n for (int k = j + 1; k < nodes.size(); k++) {\n nodePairs.add(new NodePair(nodes.get(j), nodes.get(k)));\n }\n }\n return nodePairs;\n }", "public Vector getAdjacentNodes()\n\t{\n\t\tVector vAdjNodes = new Vector();\n\t\t\n\t\tfor (int i = 0; i < m_vConnectedNodes.size(); i++)\n\t\t{\n\t\t\tif ( ((NodeConnection)m_vConnectedNodes.get(i)).getCost() > 0 )\n\t\t\t{\n\t\t\t\tvAdjNodes.add(((NodeConnection)m_vConnectedNodes.get(i)).getLinkedNode());\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn vAdjNodes;\n\t}", "@Test\n void test08_getAllAdjacentVertices() {\n graph.addEdge(\"a\", \"b\");\n graph.addEdge(\"a\", \"c\"); // add two edges\n\n List<String> check = new ArrayList<>();\n check.add(\"b\");\n check.add(\"c\"); // create mock up adjacent list\n\n if (!check.equals(graph.getAdjacentVerticesOf(\"a\"))) { // checks if both are same\n fail(\"graph didn't record adjacent vertices correctly\");\n }\n }", "private final void pruneParallelSkipEdges() {\n // TODO: IF THERE ARE MULTIPLE EDGES WITH THE SAME EDGE WEIGHT, WE ARBITRARILY PICK THE FIRST EDGE TO KEEP\n // THE ORDERING MAY BE DIFFERENT FROM BOTH SIDES OF THE EDGE, WHICH CAN LEAD TO A NONSYMMETRIC GRAPH\n // However, no issues have cropped up yet. Perhaps the ordering happens to be the same for both sides,\n // due to how the graph is constructed. This is not good to rely upon, however.\n Memory.initialise(maxSize, Float.POSITIVE_INFINITY, -1, false);\n \n int maxDegree = 0;\n for (int i=0;i<nNodes;++i) {\n maxDegree = Math.max(maxDegree, nSkipEdgess[i]);\n }\n \n int[] neighbourIndexes = new int[maxDegree];\n int[] lowestCostEdgeIndex = new int[maxDegree];\n float[] lowestCost = new float[maxDegree];\n int nUsed = 0;\n \n for (int i=0;i<nNodes;++i) {\n nUsed = 0;\n int degree = nSkipEdgess[i];\n int[] sEdges = outgoingSkipEdgess[i];\n float[] sWeights = outgoingSkipEdgeWeightss[i];\n \n for (int j=0;j<degree;++j) {\n int dest = sEdges[j];\n float weight = sWeights[j];\n \n int p = Memory.parent(dest);\n int index = -1;\n \n if (p == -1) {\n index = nUsed;\n ++nUsed;\n \n Memory.setParent(dest, index);\n neighbourIndexes[index] = dest;\n \n lowestCostEdgeIndex[index] = j;\n lowestCost[index] = weight;\n } else {\n index = p;\n if (weight < lowestCost[index]) {\n // Remove existing\n \n /* ________________________________\n * |______E__________C____________L_|\n * ________________________________\n * |______C__________L____________E_|\n * ^\n * |\n * nSkipEdges--\n */\n swapSkipEdges(i, lowestCostEdgeIndex[index], j);\n swapSkipEdges(i, j, degree-1);\n --j; --degree;\n \n // lowestCostEdgeIndex[index] happens to be the same as before.\n lowestCost[index] = weight;\n } else {\n // Remove this.\n \n /* ________________________________\n * |______E__________C____________L_|\n * ________________________________\n * |______E__________L____________C_|\n * ^\n * |\n * nSkipEdges--\n */\n swapSkipEdges(i, j, degree-1);\n --j; --degree;\n }\n }\n \n }\n nSkipEdgess[i] = degree;\n \n // Cleanup\n for (int j=0;j<nUsed;++j) {\n Memory.setParent(neighbourIndexes[j], -1); \n }\n }\n }", "protected ArrayList<int[]> findAdjacentSafe(int[] pair) {\n\t\tint x = pair[0];\n\t\tint y = pair[1];\n\t\tArrayList<int[]> neighbors = new ArrayList<int[]>();\n\t\tfor (int i = x - 1; i <= x + 1; i++) {\n\t\t\tfor (int j = y - 1; j <= y + 1; j++) {\n\t\t\t\tif (i >= 0 && i < maxX && j >= 0 && j < maxY && coveredMap[i][j] != SIGN_UNKNOWN && coveredMap[i][j] != SIGN_MARK) {\n\t\t\t\t\tneighbors.add(new int[]{i, j});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn neighbors;\n\t}", "public List<V> getTopologicalOrdering() {\n var result = new ArrayList<V>();\n var noIncomingEdgeVertices = getVerticesWithoutIncomingEdge();\n\n while (!noIncomingEdgeVertices.isEmpty()) {\n V next = noIncomingEdgeVertices.iterator().next();\n noIncomingEdgeVertices.remove(next);\n result.add(next);\n for (V neighbourVertex : new HashSet<>(getOutgoingAdjacentVertices(next))) {\n removeEdge(next, neighbourVertex);\n if (getIncomingAdjacentVertices(neighbourVertex).isEmpty()) {\n noIncomingEdgeVertices.add(neighbourVertex);\n }\n }\n }\n\n if (edges.values().stream().mapToLong(Collection::size).sum() != 0L) {\n throw new IllegalStateException(\"Cyclic dependency!\"); // TODO: Error message to state what is causing cyclic dependency\n } else {\n return result;\n }\n }", "int[] getInEdges(int... nodes);", "@Test \r\n void create_edge_between_to_nonexisted_vertexes() {\r\n graph.addEdge(\"A\", \"B\");\r\n List<String> adjacentA = graph.getAdjacentVerticesOf(\"A\");\r\n List<String> adjacentB = graph.getAdjacentVerticesOf(\"B\");\r\n if(!adjacentA.contains(\"B\")) { \r\n fail();\r\n }\r\n if(adjacentB.contains(\"A\")) { \r\n fail();\r\n }\r\n }", "List<V> getAdjacentVertexList(V v);", "private List<Vertex> getNeighbors(Vertex node) {\n return edges.stream()\n .filter( edge ->edge.getSource().equals(node) && !settledNodes.contains(edge.getDestination()))\n .map(edge -> edge.getDestination())\n .collect(Collectors.toList());\n }", "public int[] findRedundantConnection(int[][] edges) {\n int[] parent = new int[2*edges.length];\n int[] sz = new int[parent.length];\n // initialize parent array, every element points to itself\n for (int i = 0; i < parent.length; i++) parent[i] = i;\n Arrays.fill(sz, 1);\n\n for (int[] edge : edges) {\n int p = find(parent, edge[0]);\n int q = find(parent, edge[1]);\n if (p==q) return edge;\n union(parent, sz, p, q);\n }\n return new int[2]; // default return, if no such edge found\n }", "public List<Node> getAdjacent(Node node){\n\n int nodeX, x = node.getX();\n int nodeY, y = node.getY();\n List<Node> adj = new ArrayList<Node>();\n\n for(Node n:allNodes){\n if(n.isReachable()) {\n nodeX = n.getX();\n nodeY = n.getY();\n if ((Math.abs(nodeX - x) == 1 && nodeY == y) || (nodeX == x && Math.abs(nodeY - y) == 1)) {\n adj.add(n);\n //if(node.getCost()==n.getCost()||n.getCost()==1) n.setCost(node.getCost()+1);\n }\n }\n }\n\n return adj;\n }", "private List<GPairRecord<S, S>> getNonCrossingPairs(final Predicate<Pair<S, S>> predicate) {\n List<GPairRecord<S, S>> recordList = new ArrayList<>();\n slp.getOrderedProductions().stream().map(p -> p.getLeft()).forEach(nonTerminal -> consumeNonCrossingPairs(nonTerminal, recordList::add, predicate));\n return recordList;\n }", "private Set<Edge> reachableDAG(Vertex start, Vertex obstacle) {\n \tHashSet<Edge> result = new HashSet<Edge>();\n \tVector<Vertex> currentVertexes = new Vector<Vertex>();\n \tint lastResultNumber = 0;\n \tcurrentVertexes.add(start);\n \t\n \tdo {\n \t\t//System.out.println(\"size of currentVertexes:\" + currentVertexes.size());\n \t\t\n \t\tVector<Vertex> newVertexes = new Vector<Vertex>();\n \t\tlastResultNumber = result.size();\n \t\t\n \t\tfor (Vertex v : currentVertexes) {\n \t\t\t//System.out.println(\"layerID:\" + v.layerID + \"\\tlabel:\" + v.label);\n \t\t\taddIncomingEdges(v, obstacle, result, newVertexes);\n \t\t\taddOutgoingEdges(v, obstacle, result, newVertexes);\n \t\t}\n \t\t\n \t\t//System.out.println(\"size of newVertexes:\" + newVertexes.size());\n \t\t\n \t\tcurrentVertexes = newVertexes;\t\n \t\t//System.out.println(\"lastResultNumber:\" + lastResultNumber);\n \t\t//System.out.println(\"result.size():\" + result.size());\n \t} while (lastResultNumber != result.size());\n \t\n\t\treturn result;\n }", "Set<String> bfsTraversal(Graph graph, String root) {\n Set<String> seen = new LinkedHashSet<String>();\n Queue<String> queue = new LinkedList<String>();\n queue.add(root);\n seen.add(root);\n\n while (!queue.isEmpty()) {\n String node = queue.poll();\n for (Node n : graph.getAdjacentNodes(node)) {\n if (!seen.contains(n.data)) {\n seen.add(n.data);\n queue.add(n.data);\n }\n }\n }\n\n return seen;\n }", "private ArrayList<Edge>getFullyConnectedGraph(){\n\t\tArrayList<Edge> edges = new ArrayList<>();\n\t\tfor(int i=0;i<nodes.size();i++){\n\t\t\tfor(int j=i+1;j<nodes.size();j++){\n\t\t\t\tEdge edge = new Edge(nodes.get(i), nodes.get(j),Utils.distance(nodes.get(i), nodes.get(j)));\n\t\t\t\tedges.add(edge);\n\t\t\t}\n\t\t}\n\t\treturn edges;\n\t}", "private void removeNoMoreExistingOriginalNodes() {\n for (Node mirrorNode : mirrorGraph.nodes()) {\n if (!isPartOfMirrorEdge(mirrorNode) && !originalGraph.has(mirrorNode)) {\n mirrorGraph.remove(mirrorNode);\n }\n }\n }", "public List<Point> getPossibleNeighbours() {\n List<Point> points = new ArrayList<>();\n int x = point.getX();\n int y = point.getY();\n Arrays.asList(x - 1, x, x + 1).forEach(i -> {\n Arrays.asList(y - 1, y, y + 1).forEach(j -> {\n points.add(new Point(i, j));\n });\n });\n // remove self\n points.remove(new Point(x, y));\n return points;\n }", "private List<V> getNewVertexOrderIfAcyclic () {\n Map<V, Integer> indegree = inDegree();\n // Determine all vertices with zero in-degree\n Stack<V> zeroIncomingVertex = new Stack<V>(); \n for (V v: indegree.keySet()) {\n if (indegree.get(v) == 0) zeroIncomingVertex.push(v);\n }\n \n // Determine the vertex order\n List<V> result = new ArrayList<V>();\n while (!zeroIncomingVertex.isEmpty()) {\n V v = zeroIncomingVertex.pop(); // Choose a vertex with zero in-degree\n result.add(v); // Vertex v is next in vertex ordering\n // \"Remove\" vertex v by updating its neighbors\n for (V neighbor: dag.get(v)) {\n indegree.put(neighbor, indegree.get(neighbor) - 1);\n // Remember any vertices that now have zero in-degree\n if (indegree.get(neighbor) == 0) zeroIncomingVertex.push(neighbor);\n }\n }\n // Check that we have used the entire graph. If not then there was a cycle.\n if (result.size() != dag.size()) return null;\n return result;\n }", "@Override\n public Iterable<V> adjacentTo(V from)\n {\n if (from.equals(null)){\n throw new IllegalArgumentException();\n }\n Iterator graphIterator = graph.entrySet().iterator();\n \t Map.Entry graphElement = (Map.Entry) graphIterator.next();\n \t V vert = (V)graphElement.getKey();\n \t while (graphIterator.hasNext() && vert != from){\n \t\tgraphElement = (Map.Entry) graphIterator.next();\n \t\tvert = (V)graphElement.getKey();\n \t }\n \t ArrayList <V> edges = graph.get(vert);\n \t //Iterable <V> e = edges;\n \t return edges;\n }", "public Collection<IntPair> findEmptyNeighbors(int x, int y);", "public static int[] findRedundantConnection(int[][] edges) {\n UnionDataStructure obj = new UnionDataStructure();\n \n int nodes = edges.length;\n Set<int[]> set = new HashSet<>();\n \n for( int i = 1; i<=nodes; i++ ){\n\t\t\tobj.makeSet( i );\n\t\t}\n\t\t\n for( int[] edge: edges ){\n\t\t\tint edge1 = edge[0];\n\t\t\tint edge2 = edge[1];\n\t\t\tset.add( edge );\n\t\t\t\n\t\t\tif( obj.findSet_representative( edge1 ) != obj.findSet_representative( edge2 ) ){\n\t\t\t\tset.remove( edge );\n\t\t\t\tobj.union( edge1, edge2 );\n\t\t\t}\n\t\t}\n\n Iterator<int[]> iterator = set.iterator();\n\n return iterator.next();\n }", "List<Node> getAdjacentNodes(String data) {\n return adjacentNodes.get(new Node(data));\n }", "private List<PairOfNodeIndexIntervals> getListOfSuspiciousNodeIndexIntervalPairs() {\n\n\t\tList<PairOfNodeIndexIntervals> listOfPairs = new ArrayList<PairOfNodeIndexIntervals>();\n\n\t\t// compare the two node list by Greedy String Tilling algorithm\n\t\tSet<Match> matchedSubstrings = compareTwoNodeLists(programANodeList, programBNodeList);\n\t\tIterator<Match> it = matchedSubstrings.iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tMatch match = it.next();\n\t\t\t\n\t\t\t// Given the node is represented by abbreviation of its type with fixed length: 2\n\t\t\t// not all results that are returned from GST are valid, we need to find out \n\t\t\t// valid block pairs\n\t\t\tPairOfNodeIndexIntervals validIntervalPair = getValidNodeIndexIntervalPair(match);\n\n\t\t\t// if the current match does not produce a valid block pair, the validIntervalPair will be null\n\t\t\t// otherwise, add it to the list of pairs\n\t\t\tif (validIntervalPair != null) {\n\t\t\t\tlistOfPairs.add(validIntervalPair);\n\t\t\t}\n\t\t}\n\n\t\treturn listOfPairs;\n\t}", "public void setNodesToUnvisited(){\n for(GraphNode node: graphNode){\n if(node.visited){\n node.visited = false;\n }\n }\n }", "private LinkedList<T> getUnvisitedNeighbors(T vertex){\n LinkedList<T> neighbors = getNeighbors(vertex);\n LinkedList<T> unvisitedNeighbors = new LinkedList<T>();\n \n for (T neighbor : neighbors){\n if (!visited.contains(neighbor)){\n unvisitedNeighbors.add(neighbor);\n }\n }\n return unvisitedNeighbors;\n }", "public static Long neighborPairsSingle(Set<Integer>[] graph) {\n long triangleCount = 0;\n int degv, degu, degw;\n for (int v = 0; v < graph.length; v++) {\n degv = graph[v].size();\n for (Integer u : graph[v]) {\n degu = graph[u].size();\n if (degu > degv || (degu == degv && v < u)) {\n for (Integer w : graph[v]) {\n if (w <= u)\n continue;\n degw = graph[w].size();\n if (degw > degv || (degw == degv && v < w)) {\n if (graph[u].contains(w))\n triangleCount++;\n }\n }\n }\n }\n }\n return triangleCount;\n }", "Set<String> dfsTraversal(Graph graph, String root) {\n Set<String> seen = new LinkedHashSet<String>();\n Stack<String> stack = new Stack<String>();\n stack.push(root);\n\n while (!stack.isEmpty()) {\n String node = stack.pop();\n if (!seen.contains(node)) {\n seen.add(node);\n for (Node n : graph.getAdjacentNodes(node)) {\n stack.push(n.data);\n }\n\n }\n }\n\n return seen;\n }", "private TIntSet removeUnconnectedMentionEntityPairs(Graph g, Map<ResultMention, List<ResultEntity>> solution) {\n TIntSet mentionsToRemove = new TIntHashSet();\n for (int mentionId : g.getMentionNodesIds().values()) {\n GraphNode mentionNode = g.getNode(mentionId);\n Mention mention = (Mention) mentionNode.getNodeData();\n TIntDoubleHashMap entityCandidates = mentionNode.getSuccessors();\n if (entityCandidates.size() == 0) {\n continue;\n }\n // Remove all mentions without any entities that have coherence edges.\n if (g.isLocalMention(mentionId)) {\n logger.debug(\"local mention removed: \" + mentionId + \" \" + mention);\n mentionsToRemove.add(mentionId);\n GraphTracer.gTracer.addMentionToDangling(g.getName(), mention.getMention(), mention.getCharOffset());\n // Set solution to best local candidate.\n Pair<Integer, Double> bestEntityScore = getBestLocalCandidateAndScore(entityCandidates);\n int bestEntity = bestEntityScore.getKey();\n double score = bestEntityScore.getValue();\n updateSolution(solution, g, mention, bestEntity, score);\n }\n\n }\n TIntSet entitiesToRemove = new TIntHashSet();\n // Remove entities that are only connected to removed mentions.\n for (int entityId : g.getEntityNodesIds().values()) {\n GraphNode entityNode = g.getNode(entityId);\n TIntDoubleHashMap successors = entityNode.getSuccessors();\n int removedCount = 0;\n for (TIntDoubleIterator itr = successors.iterator(); itr.hasNext(); ) {\n itr.advance();\n int neighborId = itr.key();\n if (mentionsToRemove.contains(neighborId)) {\n ++removedCount;\n }\n }\n if (removedCount == successors.size()) {\n entitiesToRemove.add(entityId);\n }\n }\n // Remove mentions + entity candidates from graph, trace.\n TIntSet nodesToRemove = new TIntHashSet(mentionsToRemove.size() + entitiesToRemove.size());\n nodesToRemove.addAll(mentionsToRemove);\n nodesToRemove.addAll(entitiesToRemove);\n return nodesToRemove;\n }", "ArrayList<PathFindingNode> neighbours(PathFindingNode node);", "private List<Graph> possRemove(Graph pag, Map<Edge, Boolean> necEdges) {\n // list of edges that can be removed\n List<Edge> remEdges = new ArrayList<>();\n for (Edge remEdge : necEdges.keySet()) {\n if (!necEdges.get(remEdge))\n remEdges.add(remEdge);\n }\n // powerset of edges that can be removed\n PowerSet<Edge> pset = new PowerSet<>(remEdges);\n List<Graph> possRemove = new ArrayList<>();\n // for each set of edges in the powerset remove edges from graph and add to PossRemove\n for (Set<Edge> set : pset) {\n Graph newPag = new EdgeListGraph(pag);\n for (Edge edge : set) {\n newPag.removeEdge(edge);\n }\n possRemove.add(newPag);\n }\n return possRemove;\n }", "@Test\r\n void remove_nonexistent_vertex() {\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"B\", \"C\");\r\n graph.removeVertex(\"D\");\r\n List<String> adjacent;\r\n vertices = graph.getAllVertices(); \r\n // Check that graph has all added vertexes\r\n if(!vertices.contains(\"A\")| !vertices.contains(\"B\")|\r\n !vertices.contains(\"C\")) {\r\n fail();\r\n }\r\n adjacent = graph.getAdjacentVerticesOf(\"A\");\r\n if (!adjacent.contains(\"B\"))\r\n fail();\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if (!adjacent.contains(\"C\"))\r\n fail();\r\n \r\n }", "private List<Integer> getAdjacent(int node) {\n List<Integer> adjacent = new ArrayList<>();\n for (int i = 0; i < this.matrix[node].length; i++) {\n if (this.matrix[node][i]) {\n adjacent.add(i);\n }\n }\n return adjacent;\n }", "private static <N> ImmutableMap<N, GraphConnections<N, GraphConstants.Presence>> getNodeConnections(Graph<N> paramGraph) {\n }", "public static void main(String[] args) throws IOException {\n\n // read in graph\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt(), m = scanner.nextInt();\n ArrayList<Integer>[] graph = new ArrayList[n];\n for (int i = 0; i < n; i++)\n graph[i] = new ArrayList<>();\n\n for (int i = 0; i < m; i++) {\n scanner.nextLine();\n int u = scanner.nextInt() - 1, v = scanner.nextInt() - 1; // convert to 0 based index\n graph[u].add(v);\n graph[v].add(u);\n }\n\n int[] dist = new int[n];\n Arrays.fill(dist, -1);\n // partition the vertices in each of the components of the graph\n for (int u = 0; u < n; u++) {\n if (dist[u] == -1) {\n // bfs\n Queue<Integer> queue = new LinkedList<>();\n queue.add(u);\n dist[u] = 0;\n while (!queue.isEmpty()) {\n int w = queue.poll();\n for (int v : graph[w]) {\n if (dist[v] == -1) { // unvisited\n dist[v] = (dist[w] + 1) % 2;\n queue.add(v);\n } else if (dist[w] == dist[v]) { // visited and form a odd cycle\n System.out.println(-1);\n return;\n } // otherwise the dist will not change\n }\n }\n }\n\n }\n\n BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));\n // vertices with the same dist are in the same group\n List<Integer>[] groups = new ArrayList[2];\n groups[0] = new ArrayList<>();\n groups[1] = new ArrayList<>();\n for (int u = 0; u < n; u++) {\n groups[dist[u]].add(u + 1);\n }\n for (List<Integer> g: groups) {\n writer.write(String.valueOf(g.size()));\n writer.newLine();\n for (int u: g) {\n writer.write(String.valueOf(u));\n writer.write(' ');\n }\n writer.newLine();\n }\n\n writer.close();\n\n\n }", "protected static void checkForDisconnectedDataNodes(final EnactmentGraph graph) {\n for (final Task task : graph) {\n if (TaskPropertyService.isCommunication(task) && graph.getIncidentEdges(task).isEmpty()) {\n throw new IllegalStateException(\n \"The generated graph contains a disconnected data node: \" + task.getId());\n }\n }\n }", "@Override\n\tpublic Set<ET> getAdjacentEdges(N node)\n\t{\n\t\t// implicitly returns null if gn is not in the nodeEdgeMap\n\t\tSet<ET> adjacentEdges = nodeEdgeMap.get(node);\n\t\treturn adjacentEdges == null ? null : new HashSet<ET>(adjacentEdges);\n\t}", "ArrayList<Edge> getAdjacencies();", "private static int nonIsolatedVertex(Graph G) {\n for (int v = 0; v < G.V(); v++)\n if (G.degree(v) > 0)\n return v;\n return -1;\n }", "Set<Edge> getUpwardOutgoingNeighborEdges() {\n\t\t\tif(!_bumpOnUpwardPass) {\n\t\t\t\tSystem.err.println(\"calling upward pass neighbor method on downward pass!\");\n\t\t\t}\n//\t\t\tif(_outgoingEdges.size() == 0) { // only compute if we have to\n\t\t\t\tSet<Edge> outgoingEdges = new HashSet<Edge>();\n\t\t\t\tIterator<Edge> it = _neighborEdges.keySet().iterator();\n\t\t\t\twhile(it.hasNext()) {\n\t\t\t\t\tEdge e = it.next();\n\t\t\t\t\tVertex v = e.getOtherVertex(this);\n\t\t\t\t\tif(this._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops i am unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(v._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops neighbor unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(this._orderID > v._orderID) {\n\t\t\t\t\t\toutgoingEdges.add(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_outgoingEdges = outgoingEdges;\n//\t\t\t}\n//\t\t\treturn outgoingEdges;\n\t\t\t\tSystem.out.println(this.toString()+\"'s outgoing edges:\\n\"+ outgoingEdges);\n\t\t\t\treturn outgoingEdges;\n\t\t}", "public boolean isAdjacent(int from, int to) {\n//your code here\n// LinkedList<Edge> list = adjLists[from];\n// for (Edge a : list) {\n// if(a.from()==from&&a.to()==to){\n// return true;\n// }\n// };\n// return false;\n return pathExists(from, to);\n }", "public void testRemoveEdge_betweenVertices() {\n System.out.println(\"removeEdge\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n\n for (int i = 0; i < 25; i++) {\n for (int j = 0; j < 25; j++) {\n if ((i + j) % 2 != 0) {\n continue;\n }\n\n Assert.assertNotNull(graph.removeEdge(new Integer(i), new Integer(j)));\n Assert.assertFalse(graph.containsEdge(new Integer(i), new Integer(j)));\n }\n }\n }", "List<AirportNode> getUnreachableAirportNodes(Map<String, AirportNode> airportGraph,\n List<String> airports,\n String curAirport) {\n Set<String> visitedAirports = new HashSet<>();\n dfsFindAllReachableAirports(airportGraph, curAirport, visitedAirports); // dfs populates the visitedAirports\n // any unreachable airport will be identified\n List<AirportNode> unreachableAirportNodes = new ArrayList<>();\n // iterate through all the airports and find the ones that are not\n // in the visitedAirports list (unreachable)\n for (String airport : airports) {\n if (visitedAirports.contains(airport)) continue;\n AirportNode airportNode = airportGraph.get(airport);\n airportNode.isReachable = false;\n unreachableAirportNodes.add(airportNode);\n }\n return unreachableAirportNodes;\n }", "public int[] findRedundantDirectedConnection(int[][] edges) {\n int N = edges.length;\n int[] parent = new int[N+1];\n int[] canA = new int[2];\n int[] canB = new int[2];\n // This loop is for checking whether there is a node having two parents\n // If there is such a node, then one of the two edges connecting it to its two parents must be redundant\n // And we keep them in canA and canB (canB occurs later than canA)\n for (int[] e : edges) {\n if (parent[e[1]] != 0) {\n canA = new int[]{parent[e[1]], e[1]};\n canB = Arrays.copyOf(e, 2);\n } else {\n parent[e[1]] = e[0];\n }\n }\n\n // This loop is for checking whether there is still a circle if we ignore the edge canB\n // If there is not a circle anymore, then return canB\n // If there is still a circle, then we check whether canA/canB has been filled in the first loop\n // If canA/canB has been filled, then return canA\n // If canA/canB has not been filled, then it is the case that every node has exactly one parent,\n // so return the current edge\n UnionFind uf = new UnionFind(N);\n for (int[] e : edges) {\n if (Arrays.equals(e, canB))\n continue;\n if (uf.union(e[0], e[1])) {\n if (canA[0] != 0)\n return canA;\n else\n return e;\n }\n }\n\n return canB;\n }", "boolean containsJewel(Graph<V, E> g)\n {\n for (V v2 : g.vertexSet()) {\n for (V v3 : g.vertexSet()) {\n if (v2 == v3 || !g.containsEdge(v2, v3))\n continue;\n for (V v5 : g.vertexSet()) {\n if (v2 == v5 || v3 == v5)\n continue;\n\n Set<V> F = new HashSet<>();\n for (V f : g.vertexSet()) {\n if (f == v2 || f == v3 || f == v5 || g.containsEdge(f, v2)\n || g.containsEdge(f, v3) || g.containsEdge(f, v5))\n continue;\n F.add(f);\n }\n\n List<Set<V>> componentsOfF = findAllComponents(g, F);\n\n Set<V> X1 = new HashSet<>();\n for (V x1 : g.vertexSet()) {\n if (x1 == v2 || x1 == v3 || x1 == v5 || !g.containsEdge(x1, v2)\n || !g.containsEdge(x1, v5) || g.containsEdge(x1, v3))\n continue;\n X1.add(x1);\n }\n Set<V> X2 = new HashSet<>();\n for (V x2 : g.vertexSet()) {\n if (x2 == v2 || x2 == v3 || x2 == v5 || g.containsEdge(x2, v2)\n || !g.containsEdge(x2, v5) || !g.containsEdge(x2, v3))\n continue;\n X2.add(x2);\n }\n\n for (V v1 : X1) {\n if (g.containsEdge(v1, v3))\n continue;\n for (V v4 : X2) {\n if (v1 == v4 || g.containsEdge(v1, v4) || g.containsEdge(v2, v4))\n continue;\n for (Set<V> FPrime : componentsOfF) {\n if (hasANeighbour(g, FPrime, v1) && hasANeighbour(g, FPrime, v4)) {\n if (certify) {\n Set<V> validSet = new HashSet<>();\n validSet.addAll(FPrime);\n validSet.add(v1);\n validSet.add(v4);\n GraphPath<V, E> p = new DijkstraShortestPath<>(\n new AsSubgraph<>(g, validSet)).getPath(v1, v4);\n List<E> edgeList = new LinkedList<>();\n edgeList.addAll(p.getEdgeList());\n if (p.getLength() % 2 == 1) {\n edgeList.add(g.getEdge(v4, v5));\n edgeList.add(g.getEdge(v5, v1));\n\n } else {\n edgeList.add(g.getEdge(v4, v3));\n edgeList.add(g.getEdge(v3, v2));\n edgeList.add(g.getEdge(v2, v1));\n\n }\n\n double weight =\n edgeList.stream().mapToDouble(g::getEdgeWeight).sum();\n certificate = new GraphWalk<>(g, v1, v1, edgeList, weight);\n }\n return true;\n }\n }\n }\n }\n }\n }\n }\n\n return false;\n }", "List<List<Node>> findUndirectedPaths(Node s, Node d) {\n\t\tList<List<Node>> paths = new ArrayList<>();\n\t\tpath(s, d, new HashSet<>(), new ArrayList<>(), paths);\n System.out.println(\"Computed paths: \" + paths);\n return paths;\n\t}", "@Test\n void test03_addEdgeBetweenVerticesWhichDontExist() {\n graph.addEdge(\"a\", \"b\");\n Set<String> vertices = new LinkedHashSet<>();\n vertices.add(\"a\");\n vertices.add(\"b\"); // creates mock up vertex list\n if (!graph.getAllVertices().equals(vertices)) { // compares vertices list\n fail(\"Graph didn't add the vertices correctly\");\n }\n List<String> adjOfA = new ArrayList<>();\n adjOfA.add(\"b\"); // creates mock up adjacent list\n if (!graph.getAdjacentVerticesOf(\"a\").equals(adjOfA)) { // compares adjacent lists\n fail(\"Graph didn't correctly place adjacent vertices\");\n }\n }", "public Set<V> getNeighbours(V vertex);", "private void awayFromAncestorCycle(Graph graph) {\n while (changeFlag) {\n changeFlag = false;\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n List<Node> adj = graph.getAdjacentNodes(B);\n\n if (adj.size() < 2) {\n continue;\n }\n\n ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2);\n int[] combination;\n\n while ((combination = cg.next()) != null) {\n Node A = adj.get(combination[0]);\n Node C = adj.get(combination[1]);\n\n //choice gen doesnt do diff orders, so must switch A & C around.\n awayFromAncestor(graph, A, B, C);\n awayFromAncestor(graph, C, B, A);\n awayFromCycle(graph, A, B, C);\n awayFromCycle(graph, C, B, A);\n }\n }\n }\n changeFlag = true;\n }", "private void phaseTwo(){\r\n\r\n\t\tCollections.shuffle(allNodes, random);\r\n\t\tList<Pair<Node, Node>> pairs = new ArrayList<Pair<Node, Node>>();\r\n\t\t\r\n\t\t//For each node in allNode, get all relationshpis and iterate through each relationship.\r\n\t\tfor (Node n1 : allNodes){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//If a node n1 is related to any other node in allNodes, add those relationships to rels.\r\n\t\t\t\t//Avoid duplication, and self loops.\r\n\t\t\t\tIterable<Relationship> ite = n1.getRelationships(Direction.BOTH);\t\t\t\t\r\n\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\tNode n2 = rel.getOtherNode(n1);\t//Get the other node\r\n\t\t\t\t\tif (allNodes.contains(n2) && !n1.equals(n2)){\t\t\t\t\t//If n2 is part of allNodes and n1 != n2\r\n\t\t\t\t\t\tif (!rels.contains(rel)){\t\t\t\t\t\t\t\t\t//If the relationship is not already part of rels\r\n\t\t\t\t\t\t\tPair<Node, Node> pA = new Pair<Node, Node>(n1, n2);\r\n\t\t\t\t\t\t\tPair<Node, Node> pB = new Pair<Node, Node>(n2, n1);\r\n\r\n\t\t\t\t\t\t\tif (!pairs.contains(pA)){\r\n\t\t\t\t\t\t\t\trels.add(rel);\t\t\t\t\t\t\t\t\t\t\t//Add the relationship to the lists.\r\n\t\t\t\t\t\t\t\tpairs.add(pA);\r\n\t\t\t\t\t\t\t\tpairs.add(pB);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}", "private boolean discrimPaths(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node b : nodes) {\n\n //potential A and C candidate pairs are only those\n // that look like this: A<-oBo->C or A<->Bo->C\n List<Node> possAandC = graph.getNodesOutTo(b, Endpoint.ARROW);\n\n //keep arrows and circles\n List<Node> possA = new LinkedList<>(possAandC);\n possA.removeAll(graph.getNodesInTo(b, Endpoint.TAIL));\n\n //keep only circles\n List<Node> possC = new LinkedList<>(possAandC);\n possC.retainAll(graph.getNodesInTo(b, Endpoint.CIRCLE));\n\n for (Node a : possA) {\n for (Node c : possC) {\n if (!graph.isParentOf(a, c)) {\n continue;\n }\n\n LinkedList<Node> reachable = new LinkedList<>();\n reachable.add(a);\n if (reachablePathFindOrient(graph, a, b, c, reachable)) {\n return true;\n }\n }\n }\n }\n return false;\n }", "protected abstract Graph filterGraph();", "@Test\r\n void remove_null() {\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"B\", \"C\");\r\n graph.removeVertex(null);\r\n List<String> adjacent;\r\n vertices = graph.getAllVertices(); \r\n // Check that graph has all added vertexes\r\n if(!vertices.contains(\"A\")| !vertices.contains(\"B\")|\r\n !vertices.contains(\"C\")) {\r\n fail();\r\n }\r\n adjacent = graph.getAdjacentVerticesOf(\"A\");\r\n if (!adjacent.contains(\"B\"))\r\n fail();\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if (!adjacent.contains(\"C\"))\r\n fail();\r\n \r\n }", "Set<Edge> getDownwardOutgoingNeighborEdges() {\n\t\t\tif(_bumpOnUpwardPass) {\n\t\t\t\tSystem.err.println(\"calling downward pass neighbor method on upward pass!\");\n\t\t\t}\n//\t\t\tif(_outgoingEdges.size() == 0) { // only compute if we have to\n\t\t\t\tSet<Edge> outgoingEdges = new HashSet<Edge>();\n\t\t\t\tIterator<Edge> it = _neighborEdges.keySet().iterator();\n\t\t\t\twhile(it.hasNext()) {\n\t\t\t\t\tEdge e = it.next();\n\t\t\t\t\tVertex v = e.getOtherVertex(this);\n\t\t\t\t\tif(this._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops i am unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(v._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops neighbor unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(this._orderID < v._orderID) {\n\t\t\t\t\t\toutgoingEdges.add(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_outgoingEdges = outgoingEdges;\n//\t\t\t}\n//\t\t\treturn _outgoingEdges;\n\t\t\t\tSystem.out.println(this.toString()+\"'s outgoing edges:\\n\"+ outgoingEdges);\n\t\t\t\treturn outgoingEdges;\n\t\t}", "public static void MakeDirectedNoCycle(graphUndir G) {\r\n\r\n\t\tfor (int i = 0; i < G.Adj.size(); i++) {\r\n\t\t\tG.Adj.elementAt(i).color = \"grey\";\r\n\t\t\tSystem.out.println(G.Adj.elementAt(i).name + \" is \"\r\n\t\t\t\t\t+ G.Adj.elementAt(i).color);\r\n\t\t\tfor (int j = 0; j < G.Adj.elementAt(i).next.size(); j++) {\r\n\t\t\t\tif (G.Adj.elementAt(i).next.elementAt(j).color == \"white\") {\r\n\t\t\t\t\tG.Adj.elementAt(i).next.elementAt(j).color = \"grey\";\r\n\t\t\t\t\tSystem.out\r\n\t\t\t\t\t\t\t.println(G.Adj.elementAt(i).next.elementAt(j).name\r\n\t\t\t\t\t\t\t\t\t+ \" is \"\r\n\t\t\t\t\t\t\t\t\t+ G.Adj.elementAt(i).next.elementAt(j).color);\r\n\t\t\t\t} else if (G.Adj.elementAt(i).next.elementAt(j).color == \"black\") {\r\n\t\t\t\t\tSystem.out\r\n\t\t\t\t\t\t\t.println(G.Adj.elementAt(i).next.elementAt(j).name\r\n\t\t\t\t\t\t\t\t\t+ \" is rempved from \"\r\n\t\t\t\t\t\t\t\t\t+ G.Adj.elementAt(i).name);\r\n\t\t\t\t\tG.Adj.elementAt(i).next.remove(j);\r\n\t\t\t\t\tj--;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tG.Adj.elementAt(i).color = \"black\";\r\n\t\t\tSystem.out.println(G.Adj.elementAt(i).name + \" is \"\r\n\t\t\t\t\t+ G.Adj.elementAt(i).color);\r\n\r\n\t\t}\r\n\r\n\t}", "Set<E> getForwardNeighbors();", "public Enumeration undirectedEdges();", "private int[][] searchAdjNodes(int nodeA) {\n\t\tint[] backNodes = new int[vertices[nodeA].length];\n\t\tint backNodesIndex = 0;\n\t\tint[] forwardNodes = new int[vertices[nodeA].length];\n\t\tint forwardNodesIndex = 0;\n\t\tfor (int nodeB : vertices[nodeA]) {\n\t\t\tif (edgeVisited[connectivity[nodeA][nodeB]])\n\t\t\t\tcontinue;\n\t\t\telse if (nodeVisited[nodeB] >= 0)\n\t\t\t\tbackNodes[backNodesIndex++] = nodeB;\n\t\t\telse\n\t\t\t\tforwardNodes[forwardNodesIndex++] = nodeB;\n\t\t}\n\t\tint[][] result = new int[2][];\n\t\t// Then arrange backNodes with depth from small to large\n\t\tint[] backNodesKey = new int[backNodesIndex];\n\t\tfor (int i = 0; i < backNodesIndex; i++)\n\t\t\tbackNodesKey[i] = nodeVisited[backNodes[i]];\n\t\tresult[0] = SortIntSet.sort(Arrays.copyOf(backNodes, backNodesIndex),\n\t\t\t\tbackNodesKey);\n\n\t\t// arrange forward edge/nodes with label from small to large\n\t\tint[] forwardNodesKey = new int[forwardNodesIndex];\n\t\tint[] forwardEdgeKey = new int[forwardNodesIndex];\n\t\tfor (int i = 0; i < forwardNodesIndex; i++) {\n\t\t\tint nodeID = forwardNodes[i];\n\t\t\tforwardNodesKey[i] = connectivity[nodeID][nodeID];\n\t\t\tforwardEdgeKey[i] = edgeLabel[connectivity[nodeA][nodeID]];\n\t\t}\n\t\tresult[1] = SortIntSet.sort(\n\t\t\t\tArrays.copyOf(forwardNodes, forwardNodesIndex), forwardEdgeKey,\n\t\t\t\tforwardNodesKey);\n\t\treturn result;\n\t}", "private void negateOclIsOps(PlainGraph graph) {\n List<PlainEdge> typeEdges = graph.edgeSet().stream()\n .filter(e -> labelContainsType(e.label().text()))\n .sorted((i1, i2) ->\n Integer.compare(i2.source().getNumber(), i1.source().getNumber()))\n .collect(Collectors.toList());\n\n // negate all except for the first, starting node (which is on the last index)\n for (int i = 0; i < typeEdges.size() - 1; i++) {\n PlainEdge edge = typeEdges.get(i);\n // negate the edge\n List<PlainEdge> notEdge = getNotEdge(graph, edge);\n if (notEdge.isEmpty()) {\n // add not edge\n addEdge(graph, edge.source(), String.format(\"%s:\", NOT), edge.target());\n } else {\n // remove not edge\n removeEdge(graph, notEdge.get(0));\n }\n }\n }", "@Test\n public void notConnectedDueToRestrictions() {\n int sourceNorth = graph.edge(0, 1).setDistance(1).set(speedEnc, 10, 10).getEdge();\n int sourceSouth = graph.edge(0, 3).setDistance(2).set(speedEnc, 10, 10).getEdge();\n int targetNorth = graph.edge(1, 2).setDistance(3).set(speedEnc, 10, 10).getEdge();\n int targetSouth = graph.edge(3, 2).setDistance(4).set(speedEnc, 10, 10).getEdge();\n\n assertPath(calcPath(0, 2, sourceNorth, targetNorth), 0.4, 4, 400, nodes(0, 1, 2));\n assertNotFound(calcPath(0, 2, sourceNorth, targetSouth));\n assertNotFound(calcPath(0, 2, sourceSouth, targetNorth));\n assertPath(calcPath(0, 2, sourceSouth, targetSouth), 0.6, 6, 600, nodes(0, 3, 2));\n }", "private boolean hasANonneighbourInX(Graph<V, E> g, V v, Set<V> X)\n {\n return X.stream().anyMatch(x -> !g.containsEdge(v, x));\n }", "int isCycle( Graph graph){\n int parent[] = new int[graph.V]; \n \n // Initialize all subsets as single element sets \n for (int i=0; i<graph.V; ++i) \n parent[i]=-1; \n \n // Iterate through all edges of graph, find subset of both vertices of every edge, if both subsets are same, then there is cycle in graph. \n for (int i = 0; i < graph.E; ++i){ \n int x = graph.find(parent, graph.edge[i].src); \n int y = graph.find(parent, graph.edge[i].dest); \n \n if (x == y) \n return 1; \n \n graph.Union(parent, x, y); \n } \n return 0; \n }", "public List<List<Integer>> allPathsSourceTarget(int[][] graph) {\n \n boolean[] visited = new boolean[graph.length];\n \n List<Integer> paths = new ArrayList();\n paths.add(0);\n \n List<List<Integer>> allPaths = new ArrayList();\n \n dfs(0,graph.length-1, paths,allPaths,visited,graph);\n \n return allPaths;\n }", "private void removeNoMoreExistingOriginalEdges() {\n for (MirrorEdge mirrorEdge : directEdgeMap.values()) {\n if (!originalGraph.has(mirrorEdge.original)) {\n for (Edge segment : mirrorEdge.segments) {\n mirrorGraph.forcedRemove(segment);\n reverseEdgeMap.remove(segment);\n }\n for (Node bend : mirrorEdge.bends) {\n mirrorGraph.forcedRemove(bend);\n reverseEdgeMap.remove(bend);\n }\n directEdgeMap.remove(mirrorEdge.original);\n }\n }\n }", "Set<Set<V>> routine3(Graph<V, E> g)\n {\n Set<Set<V>> NuvList = new HashSet<>();\n for (V u : g.vertexSet()) {\n for (V v : g.vertexSet()) {\n if (u == v || !g.containsEdge(u, v))\n continue;\n NuvList.add(N(g, u, v));\n }\n }\n\n Set<Set<V>> tripleList = new HashSet<>();\n for (V a : g.vertexSet()) {\n for (V b : g.vertexSet()) {\n if (a == b || g.containsEdge(a, b))\n continue;\n Set<V> Nab = N(g, a, b);\n for (V c : g.vertexSet()) {\n if (isTripleRelevant(g, a, b, c)) {\n tripleList.add(X(g, Nab, c));\n }\n }\n }\n }\n Set<Set<V>> res = new HashSet<>();\n for (Set<V> Nuv : NuvList) {\n for (Set<V> triple : tripleList) {\n Set<V> temp = new HashSet<>();\n temp.addAll(Nuv);\n temp.addAll(triple);\n res.add(temp);\n }\n }\n return res;\n }", "private boolean containsShortestOddHole(Graph<V, E> g, Set<V> X)\n {\n for (V y1 : g.vertexSet()) {\n if (X.contains(y1))\n continue;\n\n for (V x1 : g.vertexSet()) {\n if (x1 == y1)\n continue;\n GraphPath<V, E> rx1y1 = getPathAvoidingX(g, x1, y1, X);\n for (V x3 : g.vertexSet()) {\n if (x3 == x1 || x3 == y1 || !g.containsEdge(x1, x3))\n continue;\n for (V x2 : g.vertexSet()) {\n if (x2 == x3 || x2 == x1 || x2 == y1 || g.containsEdge(x2, x1)\n || !g.containsEdge(x3, x2))\n continue;\n\n GraphPath<V, E> rx2y1 = getPathAvoidingX(g, x2, y1, X);\n\n double n;\n if (rx1y1 == null || rx2y1 == null)\n continue;\n\n V y2 = null;\n for (V y2Candidate : rx2y1.getVertexList()) {\n if (g.containsEdge(y1, y2Candidate) && y2Candidate != x1\n && y2Candidate != x2 && y2Candidate != x3 && y2Candidate != y1)\n {\n y2 = y2Candidate;\n break;\n }\n }\n if (y2 == null)\n continue;\n\n GraphPath<V, E> rx3y1 = getPathAvoidingX(g, x3, y1, X);\n GraphPath<V, E> rx3y2 = getPathAvoidingX(g, x3, y2, X);\n GraphPath<V, E> rx1y2 = getPathAvoidingX(g, x1, y2, X);\n if (rx3y1 != null && rx3y2 != null && rx1y2 != null\n && rx2y1.getLength() == (n = rx1y1.getLength() + 1)\n && n == rx1y2.getLength() && rx3y1.getLength() >= n\n && rx3y2.getLength() >= n)\n {\n if (certify) {\n List<E> edgeList = new LinkedList<>();\n edgeList.addAll(rx1y1.getEdgeList());\n for (int i = rx2y1.getLength() - 1; i >= 0; i--)\n edgeList.add(rx2y1.getEdgeList().get(i));\n edgeList.add(g.getEdge(x2, x3));\n edgeList.add(g.getEdge(x3, x1));\n\n double weight =\n edgeList.stream().mapToDouble(g::getEdgeWeight).sum();\n certificate = new GraphWalk<>(g, x1, x1, edgeList, weight);\n }\n return true;\n }\n }\n }\n }\n }\n return false;\n }", "List<WeightedEdge<Vertex>> neighbors(Vertex v);", "ArrayList<Node> DFSIter( Graph graph, final Node start, final Node end)\n {\n boolean visited[] = new boolean[graph.numNodes];\n Stack<Node> stack = new Stack<Node>();\n Map< Node,Node> parentPath = new HashMap< Node,Node>(); \n stack.push(start);\n\n while ( !stack.isEmpty() )\n {\n Node currNode = stack.pop();\n // end loop when goal node is found\n if ( currNode == end )\n break;\n // If node has already been visited, skip it\n if ( visited[currNode.id] )\n continue;\n else\n {\n visited[currNode.id] = true;\n int numEdges = currNode.connectedNodes.size();\n\n for ( int i = 0; i < numEdges; i++ )\n {\n Node edgeNode = currNode.connectedNodes.get(i);\n if ( !visited[edgeNode.id] )\n {\n stack.push( edgeNode );\n parentPath.put( edgeNode, currNode);\n }\n }\n \n }\n }\n\n ArrayList<Node> path = new ArrayList<Node>();\n Node currNode = end;\n while ( currNode != null )\n {\n path.add(0, currNode);\n currNode = parentPath.get(currNode);\n }\n\n return path;\n }", "public abstract List<? extends DiGraphEdge<N, E>> getOutEdges(N nodeValue);", "public abstract List<AStarNode> getNeighbours();", "public int[] findRedundantConnection(int[][] edges) {\n if (edges == null || edges.length == 0) return new int[]{};\n \n UF uf = new UF(edges.length);\n \n int[] res = new int[2];\n for (int i = 0; i < edges.length; i++) {\n int x = edges[i][0] - 1, y = edges[i][1] - 1;\n int rx = uf.find(x), ry = uf.find(y);\n \n if (rx == ry) {\n res[0] = x + 1;\n res[1] = y + 1;\n } else {\n uf.union(rx, ry);\n }\n }\n \n return res;\n }", "private boolean hasNoCycle(int node, int[] color, int[][] graph) {\n if (color[node] > 0)\n return color[node] == 2;\n\n color[node] = 1;\n for (int nei : graph[node]) {\n if (color[nei] == 2)\n continue;\n if (color[nei] == 1 || !hasNoCycle(nei, color, graph))\n return false;\n }\n\n color[node] = 2;\n return true;\n }", "private Collection<Node> keepOnlySetElement(Collection<Node> nodes) {\n Set<Node> elements = new HashSet<>();\n for (Node node : nodes) {\n Edge originalEdge = synchronizer().getOriginalEdge(node);\n if ((originalEdge != null && !boundaries.edges.contains(originalEdge))\n || !boundaries.nodes.contains(node)) {\n elements.add(node);\n }\n }\n return elements;\n }", "public List<Graph> createGraphs(Graph g) {\n List<Graph> gg = new ArrayList<>();\n Graph tmpG = g, tmp;\n\n boolean hasDisconnG = true;\n while (hasDisconnG) {\n // get one vertex as source vertex\n List<Vertex> vertexes = new ArrayList<>(tmpG.getVertices().values());\n calcSP(tmpG, vertexes.get(0));\n gg.add(tmpG);\n hasDisconnG = false;\n List<Vertex> vv = new ArrayList<>();\n for (Vertex v : tmpG.getVertices().values()) {\n if (v.minDistance == Double.POSITIVE_INFINITY) {\n // System.out.println(\"Vertex: \" + v.name + \", dist: \" + v.minDistance);\n vv.add(v);\n hasDisconnG = true;\n }\n }\n\n if (hasDisconnG) {\n tmp = new Graph();\n for (Vertex v: vv) {\n tmpG.removeVertex(v.name);\n for (Edge e: v.neighbours) {\n tmp.addEdge(v.name, e.target.name, 1);\n }\n }\n tmpG = tmp;\n }\n }\n return gg;\n }", "List<GraphEdge> getNeighbors(NodeKey key);", "boolean detectCycleUndirected(ArrayList<Integer> G[]) {\n\t\tint[] vis = new int[G.length];\n\t\tfor (int i = 0; i < G.length; i++) {\n\t\t\tif (vis[i] == 0) {\n\t\t\t\tif (detectCycleUtil(G, i, vis, -1))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private void awayFromColliderAncestorCycle(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n List<Node> adj = graph.getAdjacentNodes(B);\n\n if (adj.size() < 2) {\n continue;\n }\n\n ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2);\n int[] combination;\n\n while ((combination = cg.next()) != null) {\n Node A = adj.get(combination[0]);\n Node C = adj.get(combination[1]);\n\n //choice gen doesnt do diff orders, so must switch A & C around.\n// awayFromCollider(graph, A, B, C);\n// awayFromCollider(graph, C, B, A);\n// awayFromAncestor(graph, A, B, C);\n// awayFromAncestor(graph, C, B, A);\n// awayFromCycle(graph, A, B, C);\n// awayFromCycle(graph, C, B, A);\n ruleR1(A, B, C, graph);\n ruleR1(C, B, A, graph);\n ruleR2(A, B, C, graph);\n ruleR2(C, B, A, graph);\n\n }\n }\n }", "@Test \r\n void add_mutiple_edges_check_size(){\r\n for(int i = 0; i < 20; i++) {\r\n graph.addEdge(\"\" + i, \"\" + (i + 1));\r\n } \r\n List<String> adjacent;\r\n for(int i = 0; i < 20; i++) {\r\n adjacent = graph.getAdjacentVerticesOf(\"\"+i);\r\n if(!adjacent.contains(\"\" + (i+1))) {\r\n fail();\r\n }\r\n }\r\n if(graph.size() != 20 | graph.order() != 21) {\r\n fail();\r\n }\r\n \r\n }", "public boolean isBipartiteUndirectedGraph (){\r\n int[] vertices = new int[getNumV()];\r\n for (int i = 0; i < getNumV(); ++i)\r\n vertices[i] = -1;\r\n\r\n vertices[0] = 1;\r\n\r\n Stack <Integer> q = new Stack<Integer>();\r\n q.push(0);\r\n\r\n while (!q.isEmpty()) {\r\n int current = q.pop();\r\n Iterator<Edge> iter = edgeIterator(current);\r\n while (iter.hasNext()) {\r\n Edge edge = iter.next();\r\n int neighbor = edge.getDest();\r\n if (vertices[neighbor] == -1) {\r\n vertices[neighbor] = 1 - vertices[current];\r\n q.push(neighbor);\r\n }\r\n else if (vertices[neighbor] == vertices[current])\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "@Test\r\n void test_remove_same_edge_twice() {\r\n // Add two vertices with one edge\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"A\", \"C\");\r\n graph.removeEdge(\"A\", \"B\");\r\n graph.removeEdge(\"A\", \"B\");\r\n if (graph.size() != 1) {\r\n fail();\r\n }\r\n if (graph.getAdjacentVerticesOf(\"A\").contains(\"B\")) {\r\n fail();\r\n } \r\n }", "protected ArrayList<int[]> findAdjacentMark(int[] pair) {\n\t\tint x = pair[0];\n\t\tint y = pair[1];\n\t\tArrayList<int[]> neighbors = new ArrayList<int[]>();\n\t\tfor (int i = x - 1; i <= x + 1; i++) {\n\t\t\tfor (int j = y - 1; j <= y + 1; j++) {\n\t\t\t\tif (i >= 0 && i < maxX && j >= 0 && j < maxY && coveredMap[i][j] == SIGN_MARK) {\n\t\t\t\t\tneighbors.add(new int[]{i, j});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn neighbors;\n\t}", "public static long journeyToMoon(int n, List<List<Integer>> astronaut) {\n // Write your code here\n Map<Integer, Node<Integer>> countryMap = new HashMap<>();\n for(List<Integer> pairs: astronaut) {\n Node<Integer> node1 = countryMap.computeIfAbsent(pairs.get(0), Node::new);\n Node<Integer> node2 = countryMap.computeIfAbsent(pairs.get(1), Node::new);\n node1.connected.add(node2);\n node2.connected.add(node1);\n }\n\n List<Integer> countryCluster = new ArrayList<>();\n for(Node<Integer> node: countryMap.values()) {\n if(node.connected.size() == 0) {\n countryCluster.add(1);\n } else if(!node.visited){\n countryCluster.add(getNodeCount3(node));\n }\n }\n List<Integer> countryNodes = countryMap.values().stream().map(nn -> nn.value).collect(Collectors.toList());\n List<Integer> missingNodes = new ArrayList<>();\n for(int i=0; i < n; i++) {\n if(!countryNodes.contains(i))\n missingNodes.add(i);\n }\n\n for(int i=0; i < missingNodes.size(); i++) {\n countryCluster.add(1);\n }\n\n long ans = 0;\n //For one country we cannot pair with any other astronauts\n if(countryCluster.size() >= 2) {\n ans = (long) countryCluster.get(0) * countryCluster.get(1);\n if(countryCluster.size() > 2) {\n int sum = countryCluster.get(0) + countryCluster.get(1);\n for(int i=2; i < countryCluster.size(); i++) {\n ans += (long) sum * countryCluster.get(i);\n sum += countryCluster.get(i);\n }\n }\n }\n\n /*\n permutation of two set with size A and B = AxB\n permutation of three set with size A,B,C = AxB + AxC + BxC = AxB + (A+B)xC\n permutation of four set with size A,B,C,D = AxB + AxC + AxD + BxC + BxD + CxD = AxB + (A+B)xC + (A+B+C)xD\n */\n /*\n if(keys.length == 1) {\n ans = keys[0].size();\n } else {\n ans = keys[0].size() * keys[1].size();\n if(keys.length > 2) {\n int sum = keys[0].size() + keys[1].size();\n for (int i = 2; i < keys.length; i++) {\n ans += sum * keys[i].size();\n sum += keys[i].size();\n }\n }\n }\n */\n return ans;\n }", "private void transferLocal(Graph graph) {\n Set<NodePair> nonadjacencies = nonadjacencies(graph);\n for (Graph pag : input) {\n for (Edge edge : pag.getEdges()) {\n NodePair graphNodePair = new NodePair(graph.getNode(edge.getNode1().getName()), graph.getNode(edge.getNode2().getName()));\n if (nonadjacencies.contains(graphNodePair)) {\n continue;\n }\n if (!graph.isAdjacentTo(graphNodePair.getFirst(), graphNodePair.getSecond())) {\n graph.addEdge(new Edge(graphNodePair.getFirst(), graphNodePair.getSecond(), edge.getEndpoint1(), edge.getEndpoint2()));\n continue;\n }\n Endpoint first = edge.getEndpoint1();\n Endpoint firstCurrent = graph.getEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst());\n if (!first.equals(Endpoint.CIRCLE)) {\n if ((first.equals(Endpoint.ARROW) && firstCurrent.equals(Endpoint.TAIL)) ||\n (first.equals(Endpoint.TAIL) && firstCurrent.equals(Endpoint.ARROW))) {\n graph.setEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst(), Endpoint.CIRCLE);\n } else {\n graph.setEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst(), edge.getEndpoint1());\n }\n }\n Endpoint second = edge.getEndpoint2();\n Endpoint secondCurrent = graph.getEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond());\n if (!second.equals(Endpoint.CIRCLE)) {\n if ((second.equals(Endpoint.ARROW) && secondCurrent.equals(Endpoint.TAIL)) ||\n (second.equals(Endpoint.TAIL) && secondCurrent.equals(Endpoint.ARROW))) {\n graph.setEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond(), Endpoint.CIRCLE);\n } else {\n graph.setEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond(), edge.getEndpoint2());\n }\n }\n }\n for (Triple triple : pag.getUnderLines()) {\n Triple graphTriple = new Triple(graph.getNode(triple.getX().getName()), graph.getNode(triple.getY().getName()), graph.getNode(triple.getZ().getName()));\n if (graphTriple.alongPathIn(graph)) {\n graph.addUnderlineTriple(graphTriple.getX(), graphTriple.getY(), graphTriple.getZ());\n definiteNoncolliders.add(graphTriple);\n }\n }\n }\n }", "public static void findIndependent(GraphPattern graphPattern) {\n\t\tfor (DependencyNode dependency : graphPattern.getDependencyGraph().getNodes()) {\r\n\t\t\tif (dependency.getOutgoings().isEmpty()) {\r\n\t\t\t\tgraphPattern.getDependencyGraph().getIndependent().add(dependency);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "int[] getEdgesIncidentTo(int... nodes);", "protected ArrayList<int[]> findAdjacentRisk(int[] pair) {\n\t\tint x = pair[0];\n\t\tint y = pair[1];\n\t\tArrayList<int[]> neighbors = new ArrayList<int[]>();\n\t\tfor (int i = x - 1; i <= x + 1; i++) {\n\t\t\tfor (int j = y - 1; j <= y + 1; j++) {\n\t\t\t\tif (i >= 0 && i < maxX && j >= 0 && j < maxY ) {\n\t\t\t\t\tif (coveredMap[i][j] == SIGN_UNKNOWN || coveredMap[i][j] == SIGN_MARK) {\n\t\t\t\t\t\tneighbors.add(new int[]{i, j});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn neighbors;\n\t}", "public void topologicalSort() {\n HashMap<Integer, Integer> inDegrees = new HashMap<>();\n Queue<Integer> queue = new LinkedList<>();\n int numTotalNodes = 0;\n\n // Build the inDegree HashMap\n for (Entry<Integer, LinkedList<Edge<Integer>>> entry : g.adj.entrySet()) {\n LinkedList<Edge<Integer>> vList = entry.getValue();\n int currentVertex = entry.getKey();\n\n inDegrees.put(currentVertex, inDegrees.getOrDefault(currentVertex, 0));\n for (Edge<Integer> e : vList) {\n inDegrees.put(e.dest, inDegrees.getOrDefault(e.dest, 0) + 1);\n numTotalNodes++;\n }\n }\n\n // Add Elements with inDegree zero toe the queue\n for (int v : inDegrees.keySet()) {\n if (inDegrees.get(v) > 0)\n continue;\n queue.add(v);\n }\n\n int visitedNodes = 0;\n\n while (!queue.isEmpty()) {\n int v = queue.remove();\n System.out.print(v + \" \");\n for (int u : g.getNeighbors(v)) {\n int inDeg = inDegrees.get(u) - 1;\n if (inDeg == 0)\n queue.add(u);\n inDegrees.put(u, inDeg);\n }\n visitedNodes++;\n }\n\n if (visitedNodes != numTotalNodes) {\n System.out.println(\"Graph is not a DAG\");\n }\n }" ]
[ "0.6582746", "0.6470498", "0.6284552", "0.6254425", "0.62415856", "0.61844003", "0.6178847", "0.6153618", "0.61299306", "0.61292666", "0.6120783", "0.6091862", "0.6036511", "0.60212076", "0.59832036", "0.59690404", "0.5957887", "0.5956588", "0.59278315", "0.5890939", "0.5875806", "0.587549", "0.58492535", "0.58446515", "0.5831459", "0.5823996", "0.5807581", "0.57966423", "0.5777952", "0.57670206", "0.5730252", "0.5730188", "0.5724583", "0.57021564", "0.56926185", "0.5660947", "0.56450385", "0.5640395", "0.56335574", "0.56175286", "0.5604334", "0.56005555", "0.5599985", "0.5591935", "0.55917084", "0.5590121", "0.5585826", "0.5560399", "0.555912", "0.5543506", "0.5531048", "0.5530914", "0.5527842", "0.5517389", "0.5493406", "0.54891056", "0.54826844", "0.54799664", "0.54777014", "0.5467928", "0.54676574", "0.546344", "0.5462545", "0.546156", "0.54583836", "0.54576457", "0.5438845", "0.54346967", "0.54267883", "0.54177636", "0.54174614", "0.5416868", "0.54053473", "0.53943515", "0.5393733", "0.53907466", "0.53871894", "0.5382976", "0.5371149", "0.5367138", "0.5362888", "0.5361339", "0.5354628", "0.5352008", "0.5350191", "0.5343122", "0.5341731", "0.5341332", "0.5339225", "0.53377247", "0.53314066", "0.53262925", "0.5320535", "0.531827", "0.53162956", "0.53137445", "0.53103256", "0.5309649", "0.5309276", "0.530701" ]
0.8322748
0
/ Transfers local information from the input PAGs by adding edges from local PAGs with their orientations and unorienting the edges if there is a conflict and recording definite noncolliders.
private void transferLocal(Graph graph) { Set<NodePair> nonadjacencies = nonadjacencies(graph); for (Graph pag : input) { for (Edge edge : pag.getEdges()) { NodePair graphNodePair = new NodePair(graph.getNode(edge.getNode1().getName()), graph.getNode(edge.getNode2().getName())); if (nonadjacencies.contains(graphNodePair)) { continue; } if (!graph.isAdjacentTo(graphNodePair.getFirst(), graphNodePair.getSecond())) { graph.addEdge(new Edge(graphNodePair.getFirst(), graphNodePair.getSecond(), edge.getEndpoint1(), edge.getEndpoint2())); continue; } Endpoint first = edge.getEndpoint1(); Endpoint firstCurrent = graph.getEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst()); if (!first.equals(Endpoint.CIRCLE)) { if ((first.equals(Endpoint.ARROW) && firstCurrent.equals(Endpoint.TAIL)) || (first.equals(Endpoint.TAIL) && firstCurrent.equals(Endpoint.ARROW))) { graph.setEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst(), Endpoint.CIRCLE); } else { graph.setEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst(), edge.getEndpoint1()); } } Endpoint second = edge.getEndpoint2(); Endpoint secondCurrent = graph.getEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond()); if (!second.equals(Endpoint.CIRCLE)) { if ((second.equals(Endpoint.ARROW) && secondCurrent.equals(Endpoint.TAIL)) || (second.equals(Endpoint.TAIL) && secondCurrent.equals(Endpoint.ARROW))) { graph.setEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond(), Endpoint.CIRCLE); } else { graph.setEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond(), edge.getEndpoint2()); } } } for (Triple triple : pag.getUnderLines()) { Triple graphTriple = new Triple(graph.getNode(triple.getX().getName()), graph.getNode(triple.getY().getName()), graph.getNode(triple.getZ().getName())); if (graphTriple.alongPathIn(graph)) { graph.addUnderlineTriple(graphTriple.getX(), graphTriple.getY(), graphTriple.getZ()); definiteNoncolliders.add(graphTriple); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void preFlow() {\n\t\tg.getVertex(source).h = g.getV();\n\t\tg.getVertex(sink).h = 0;\n\t\t\n\t\tfor (int i : g.getAdjacents(source)) {\n\t\t\tpushFillingFlow(source, i);\n\t\t}\n\t}", "static void bridge()\n {\n // Mark all the vertices as not visited\n boolean visited[] = new boolean[V];\n int disc[] = new int[V];\n int low[] = new int[V];\n int parent[] = new int[V];\n \n \n // Initialize parent and visited, and ap(articulation point)\n // arrays\n for (int i = 0; i < V; i++)\n {\n parent[i] = NIL;\n }\n \n // Call the recursive helper function to find Bridges\n // in DFS tree rooted with vertex 'i'\n for (int i = 0; i < V; i++)\n if (!visited[i])\n bridgeUtil(i, visited, disc, low, parent);\n }", "private void calculateGlobals() {\n if (!edge.getIncomingLinks().isEmpty()) {\n this.source = edge.getIncomingLinks().get(0);\n } else\n throw new RuntimeException(\"edge hs no source : \" + edge.getId());\n if (!edge.getOutgoingLinks().isEmpty()) {\n this.target = edge.getOutgoingLinks().get(0);\n } else\n throw new RuntimeException(\"edge hs no target : \" + edge.getId());\n\n this.sourceGeometry = source.getGeometry();\n this.targetGeometry = target.getGeometry();\n\n // get relative centers of elements\n this.sourceRelativCenterX = this.sourceGeometry.getWidth() / 2;\n this.sourceRelativCenterY = this.sourceGeometry.getHeight() / 2;\n this.targetRelativCenterX = this.targetGeometry.getWidth() / 2;\n this.targetRelativCenterY = this.targetGeometry.getHeight() / 2;\n\n // get parent adjustments\n double sourceParentAdjustmentX = 0;\n double sourceParentAdjustmentY = 0;\n LayoutingElement parent = this.source.getParent();\n while (parent != null) {\n sourceParentAdjustmentX += parent.getGeometry().getX();\n sourceParentAdjustmentY += parent.getGeometry().getY();\n parent = parent.getParent();\n }\n\n double targetParentAdjustmentX = 0;\n double targetParentAdjustmentY = 0;\n parent = this.target.getParent();\n while (parent != null) {\n targetParentAdjustmentX += parent.getGeometry().getX();\n targetParentAdjustmentY += parent.getGeometry().getY();\n parent = parent.getParent();\n }\n\n // get absolute coordinates\n double sourceAbsoluteX = this.sourceGeometry.getX() + sourceParentAdjustmentX;\n this.sourceAbsoluteY = this.sourceGeometry.getY() + sourceParentAdjustmentY;\n this.sourceAbsoluteX2 = this.sourceGeometry.getX2() + sourceParentAdjustmentX;\n this.sourceAbsoluteY2 = this.sourceGeometry.getY2() + sourceParentAdjustmentY;\n\n this.targetAbsoluteX = this.targetGeometry.getX() + targetParentAdjustmentX;\n this.targetAbsoluteY = this.targetGeometry.getY() + targetParentAdjustmentY;\n this.targetAbsoluteY2 = this.targetGeometry.getY2() + targetParentAdjustmentY;\n\n this.sourceAbsoluteCenterX = sourceAbsoluteX + this.sourceRelativCenterX;\n this.sourceAbsoluteCenterY = this.sourceAbsoluteY + this.sourceRelativCenterY;\n this.targetAbsoluteCenterX = this.targetAbsoluteX + this.targetRelativCenterX;\n this.targetAbsoluteCenterY = this.targetAbsoluteY + this.targetRelativCenterY;\n\n // layout hints\n this.sourceJoin = this.source.isJoin();\n this.sourceSplit = this.source.isSplit();\n this.targetJoin = this.target.isJoin();\n this.target.isSplit();\n this.backwards = this.sourceAbsoluteCenterX > this.targetAbsoluteCenterX;\n }", "private void attachEdges(Diagram d) {\n for (EdgeData edgeData : figEdges) {\n final FigEdge edge = edgeData.getFigEdge();\n\n Object modelElement = modelElementsByFigEdge.get(edge);\n if (modelElement != null) {\n if (edge.getOwner() == null) {\n edge.setOwner(modelElement);\n }\n }\n }\n\n for (EdgeData edgeData : figEdges) {\n final FigEdge edge = edgeData.getFigEdge();\n\n Fig sourcePortFig = findFig(edgeData.getSourcePortFigId());\n Fig destPortFig = findFig(edgeData.getDestPortFigId());\n final FigNode sourceFigNode = getFigNode(edgeData\n .getSourceFigNodeId());\n final FigNode destFigNode = getFigNode(edgeData.getDestFigNodeId());\n\n if (sourceFigNode instanceof FigEdgePort) {\n sourcePortFig = sourceFigNode;\n }\n\n if (destFigNode instanceof FigEdgePort) {\n destPortFig = destFigNode;\n }\n\n if (sourcePortFig == null && sourceFigNode != null) {\n sourcePortFig = getPortFig(sourceFigNode);\n }\n\n if (destPortFig == null && destFigNode != null) {\n destPortFig = getPortFig(destFigNode);\n }\n\n if (sourcePortFig == null || destPortFig == null\n || sourceFigNode == null || destFigNode == null) {\n LOG.log(Level.SEVERE,\n \"Can't find nodes for FigEdge: \" + edge.getId() + \":\"\n + edge.toString());\n edge.removeFromDiagram();\n } else {\n edge.setSourcePortFig(sourcePortFig);\n edge.setDestPortFig(destPortFig);\n edge.setSourceFigNode(sourceFigNode);\n edge.setDestFigNode(destFigNode);\n }\n }\n\n // Once all edges are connected do a compute route on each to make\n // sure that annotations and the edge port is positioned correctly\n // Only do this after all edges are connected as compute route\n // requires all edges to be connected to nodes.\n // TODO: It would be nice not to have to do this and restore annotation\n // positions instead.\n for (Object edge : d.getLayer().getContentsEdgesOnly()) {\n FigEdge figEdge = (FigEdge) edge;\n figEdge.computeRouteImpl();\n }\n }", "private static void handlePolymorphismAlt() {\n for(Transition t : petrinet.getTransitions()) {\n Stack<Place> inputs = new Stack<>();\n Set<Flow> inEdges = t.getPresetEdges();\n for(Flow f : inEdges) {\n for(int i = 0; i < f.getWeight(); i++) {\n inputs.push(f.getPlace());\n }\n }\n Stack<Place> trueInputs = new Stack<>();\n generatePolymophism(t, 0, inputs, trueInputs);\n }\n }", "public void moveAgants(game_service game, directed_weighted_graph g) {\n String lg = game.move();\n List<CL_Agent> log = Arena.getAgents(lg, g);\n this.arna.setAgents(log);\n\n String fs = game.getPokemons();\n List<CL_Pokemon> ffs = Arena.json2Pokemons(fs);\n //System.out.println(ffs.get(1).get_edge());\n this.arna.setPokemons(ffs);\n for (int i = 0; i < log.size(); i++) {\n CL_Agent agent = log.get(i);\n int id = agent.getID();\n int dest = agent.getNextNode();\n // System.out.println(dest);\n int src = agent.getSrcNode();\n double v = agent.getValue();\n if (dest == -1) {\n dest = nextNode(g, agent, src, this.arna.getPokemons());\n if (dest != -1) {\n //dest = nextNode(gg,src);\n\n game.chooseNextEdge(agent.getID(), dest);\n System.out.println(\"Agent: \" + id + \" src:\" + src + \", val: \" + v + \" turned to node: \" + dest);\n try {\n Thread.sleep(SLEEP);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n\n }\n\n }\n\n }", "public void handleAdvertisement() {\n BGPUpdate nextUpdate = this.incUpdateQueue.poll();\n if (nextUpdate == null) {\n return;\n }\n\n /*\n * Fetch some fields in the correct form\n */\n int advPeer, dest;\n if (nextUpdate.isWithdrawal()) {\n advPeer = nextUpdate.getWithdrawer().asn;\n dest = nextUpdate.getWithdrawnDest();\n } else {\n advPeer = nextUpdate.getPath().getNextHop();\n dest = nextUpdate.getPath().getDest();\n }\n\n /*\n * Setup some objects if this the first time seeing a peer/dest\n */\n if (this.inRib.get(dest) == null) {\n this.inRib.put(dest, new ArrayList<BGPPath>());\n }\n\n /*\n * If there was a rotue to remove from the adjInRib, clean up the inRib\n * as well\n */\n List<BGPPath> destRibList = this.inRib.get(dest);\n for (int counter = 0; counter < destRibList.size(); counter++) {\n if (destRibList.get(counter).getNextHop() == advPeer) {\n destRibList.remove(counter);\n\n break;\n }\n }\n\n /*\n * Add the new route to the ribs, if it is a loop then DON'T add it to\n * ribs\n */\n if ((!nextUpdate.isWithdrawal()) && (!nextUpdate.getPath().containsLoop(this.asn))) {\n destRibList.add(nextUpdate.getPath());\n }\n\n recalcBestPath(dest);\n }", "private void updateHighLevelInfo() {\n\t\t// update activities mapping at high level petri net\n\t\tfor (HLActivity activity : process.getActivities()) {\n\t\t\t// update the choice node itself\n\t\t\tTransition transNode = (Transition) highLevelPN.findModelGraphVertexForActivity(activity.getID());\n\t\t\tColoredTransition transNsim = (ColoredTransition) this.findTransition(transNode);\n\t\t\thighLevelPN.replaceModelGraphVertexForActivity(transNode, transNsim);\n\t\t}\n\t\t// update choices mapping at high level petri net\n\t\tfor (HLChoice choice : process.getChoices()) {\n\t\t\t// update the choice node itself\n\t\t\tPlace choiceNode = (Place) highLevelPN.findModelGraphVertexForChoice(choice.getID());\n\t\t\tColoredPlace choiceNsim = (ColoredPlace) this.findPlace(choiceNode.getIdentifier());\n\t\t\thighLevelPN.replaceModelGraphVertexForChoice(choiceNode, choiceNsim);\n\t\t}\n\t\t// update the hlActivity links at the ColoredTransition\n\t\tIterator it = this.getTransitions().iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tColoredTransition simTrans = (ColoredTransition) it.next();\n\t\t\tHLActivity hlTrans = highLevelPN.findActivity(simTrans);\n\t\t\tsimTrans.setHighLevelTransition(hlTrans);\n\t\t}\n\t\t\n\t\t// Add the group for all resources to each transition and to the process\n\t\t// the group for all resources may only be attached to a transition in the case\n\t\t// that no group has been defined for that transition\n\t\tArrayList<HLID> allResourceIDs = new ArrayList<HLID>();\n\t\tIterator<HLResource> resourceIt = process.getResources().iterator();\n\t\twhile (resourceIt.hasNext()) {\n\t\t\tallResourceIDs.add(resourceIt.next().getID());\n\t\t}\n\t}", "private void transPose(graph g) {\n\t\tIterator it = g.getV().iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tnode_data temp = (node_data) it.next();\n\t\t\tif(g.getE(temp.getKey())!=null) {\n\t\t\t\tIterator it1 = g.getE(temp.getKey()).iterator();\n\t\t\t\twhile (it1.hasNext()) {\n\t\t\t\t\tedge_data temp1 = (edge_data) it1.next();\n\t\t\t\t\tif (temp1 != null && temp1.getTag() == 0) {\n\t\t\t\t\t\tif (g.getEdge(temp1.getDest(), temp1.getSrc()) != null) {\n\t\t\t\t\t\t\tEdge temps = new Edge((Edge)g.getEdge(temp1.getSrc(),temp1.getDest()));\n\t\t\t\t\t\t\tdouble weight1 = g.getEdge(temp1.getSrc(),temp1.getDest()).getWeight();\n\t\t\t\t\t\t\tdouble weight2 = g.getEdge(temp1.getDest(),temp1.getSrc()).getWeight();\n\t\t\t\t\t\t\tg.connect(temp1.getSrc(),temp1.getDest(),weight2);\n\t\t\t\t\t\t\tg.connect(temps.getDest(),temps.getSrc(),weight1);\n\t\t\t\t\t\t\tg.getEdge(temps.getDest(), temps.getSrc()).setTag(1);\n\t\t\t\t\t\t\tg.getEdge(temps.getSrc(),temps.getDest()).setTag(1);\n\t\t\t\t\t\t\tit1 = g.getE(temp.getKey()).iterator();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tg.connect(temp1.getDest(), temp1.getSrc(), temp1.getWeight());\n\t\t\t\t\t\t\tg.getEdge(temp1.getDest(), temp1.getSrc()).setTag(1);\n\t\t\t\t\t\t\tg.removeEdge(temp1.getSrc(), temp1.getDest());\n\t\t\t\t\t\t\tit1 = g.getE(temp.getKey()).iterator();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void fillEdges() {\n\t\tfor (int y = 0; y < mapSize; y++) {\n\t\t\tfor (int x = 0; x < mapSize; x++) {\n\t\t\t\tCoordinates coordinates = new Coordinates(x, y);\n\t\t\t\tint vertexSrc = coordinateToVertex(coordinates);\n\n\t\t\t\tif (deletedVertices.contains(vertexSrc)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tDirection[] directions = Direction.values();\n\n\t\t\t\tfor (Direction direction : directions) {\n\t\t\t\t\tCoordinates destCoordinates = new Coordinates(x, y);\n\n\t\t\t\t\tdestCoordinates = destCoordinates.addCoordinates(direction.coordinates());\n\n\t\t\t\t\tif (destCoordinates.areCorrect(mapSize)) {\n\t\t\t\t\t\tint vertexDest = coordinateToVertex(destCoordinates);\n\t\t\t\t\t\tif (!deletedVertices.contains(vertexDest)) {\n\t\t\t\t\t\t\taddEdge(vertexSrc, vertexDest);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void run() {\n\t\tArrays.fill(label, NOT_AN_INDEX);\r\n\t\t\r\n\t\t// while there is a u in V with considered[u]=0 and mate[u]=0 do\r\n\t\tstage: for (int u = 0; u < gOrig.numVertices(); u++ ) {\r\n\t\t\t// if(mate[u] == NOT_AN_INDEX){\r\n\t\t\tif (gOrig.vertex(u) == null) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (matching.matches() == gOrig.numVertices() / 2) {\r\n\t\t\t\t// we are done\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tSystem.out.print(String.format(\"considering vertex u%d\\n\", u));\r\n\t\t\tif ( ! matching.isMatched(u)) {\r\n\t\t\t\t\r\n\t\t\t\t// considered[u]=1,A={empty}\r\n\t\t\t\t// A = new WeightedDigraph(gOrig.numVertices()/2);\r\n\t\t\t\tA.clear();\r\n\t\t\t\t\r\n\t\t\t\t// forall v in V do exposed[v]=0\r\n\t\t\t\tArrays.fill(exposed, NOT_AN_INDEX);\r\n\t\t\t\t\r\n\t\t\t\t// Construct the auxiliary digraph\r\n\t\t\t\t\r\n\t\t\t\t// for all (v,w) in E do\r\n\t\t\t\tfor (int v = 0; v < gOrig.numVertices(); v++ ) {\r\n\t\t\t\t\tfor (Edge e : gOrig.eOuts(v)) {\r\n\t\t\t\t\t\tint w = e.right;\r\n\t\t\t\t\t\tassert e.left == v : \"vertex correspondence is wrong\";\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// if mate[w]=0 and w!=u then exposed[v]=w else if mate[w] !=v,0 then A=union(A,{v,mate[w]})\r\n\t\t\t\t\t\t// if(mate[w] == NOT_AN_INDEX && w != u){\r\n\t\t\t\t\t\t// exposed[v] = w;\r\n\t\t\t\t\t\t// }else if(mate[w] != v && mate[w] != NOT_AN_INDEX){\r\n\t\t\t\t\t\t// A.addEdge(new Edge(v,mate[w]));\r\n\t\t\t\t\t\t// }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ( ! matching.isMatched(w) && w != u) {\r\n\t\t\t\t\t\t\t// DEBUG(String.format(\"adding (%d,%d) to exposed\\n\", v, w));\r\n\t\t\t\t\t\t\tif (exposed[v] == NOT_AN_INDEX) {\r\n\t\t\t\t\t\t\t\texposed[v] = w;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if (matching.mate(w) != v && matching.isMatched(w)) {\r\n\t\t\t\t\t\t\t// DEBUG(String.format(\"adding (%d,%d) to A\\n\", v, matching.mate(w)));\r\n\t\t\t\t\t\t\tA.add(new Edge(v, matching.mate(w)));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tDEBUG(String.format(\"Exposed vertices={%s}\\n\", printExposed()));\r\n\t\t\t\tif (exposed().size() == 0) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// forall v in V do seen[v]=0\r\n\t\t\t\tArrays.fill(seen, false);\r\n\t\t\t\t\r\n\t\t\t\t// Q={u}; label[u]=0; if exposed[u]!=0 then augment(u), goto stage;\r\n\t\t\t\tQ.clear();\r\n\t\t\t\tQ.add(u);\r\n\t\t\t\tArrays.fill(label, NOT_AN_INDEX);// unsure whether it was meant to clear label or just unset label[u] OLD_CODE=label[u] = NOT_AN_INDEX;\r\n\t\t\t\tif (isExposed(u)) {\r\n\t\t\t\t\taugment(u);\r\n\t\t\t\t\tDEBUG(String.format(\"new matching %s\\n\", matching.toString()));\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t// need to figure out how to handle blossom()\r\n\t\t\t\t\r\n\t\t\t\t// while Q != {empty} do\r\n\t\t\t\twhile ( ! Q.isEmpty()) {\r\n\t\t\t\t\tint v = Q.pop();\r\n\t\t\t\t\t\r\n\t\t\t\t\t// forall unlabeled nodes w in V such that (v,w) in A\r\n\t\t\t\t\tfor (Edge e : A) {\r\n\t\t\t\t\t\tint w = e.left;\r\n\t\t\t\t\t\tif (e.right == v && label[w] == NOT_AN_INDEX && label[v] != w) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Q=union(Q,w), label[w]=v\r\n\t\t\t\t\t\t\tif ( ! Q.contains(w)) {\r\n\t\t\t\t\t\t\t\tQ.offer(w);\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tcontinue; ///THIS CONTINUE WAS ADDED LATE AT NIGHT\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tlabel[w] = v;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// seen[mate[w]] = 1;\r\n\t\t\t\t\t\t\ttry{\r\n\t\t\t\t\t\t\t\tint mate = findMate(w);\r\n\t\t\t\t\t\t\t\tseen[mate] = true;\r\n\t\t\t\t\t\t\t}catch(Exception err){\r\n\t\t\t\t\t\t\t\tDEBUG(String.format(\"error marking mate of %d as seen, mate not found\\n\", w));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// if exposed[w]!=0 then augment(w) goto stage;\r\n\t\t\t\t\t\t\tif (isExposed(w)) {\r\n\t\t\t\t\t\t\t\taugment(w);\r\n\t\t\t\t\t\t\t\tDEBUG(String.format(\"new matching %s\\n\", matching.toString()));\r\n\t\t\t\t\t\t\t\tcontinue stage;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// if seen[w]=1 then blossom(w)\r\n\t\t\t\t\t\t\tif (seen[w]) {\r\n\t\t\t\t\t\t\t\tblossom(w);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// remove loops created by the blossoms\r\n\t\t\t\t\tremoveSelfLoops(A);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public List<Graph> search() {\n\n long start = System.currentTimeMillis();\n TetradLogger.getInstance().log(\"info\", \"Starting ION Search.\");\n logGraphs(\"\\nInitial Pags: \", this.input);\n TetradLogger.getInstance().log(\"info\", \"Transfering local information.\");\n long steps = System.currentTimeMillis();\n\n /*\n * Step 1 - Create the empty graph\n */\n List<Node> varNodes = new ArrayList<>();\n for (String varName : variables) {\n varNodes.add(new GraphNode(varName));\n }\n Graph graph = new EdgeListGraph(varNodes);\n\n /*\n * Step 2 - Transfer local information from the PAGs (adjacencies\n * and edge orientations)\n */\n // transfers edges from each graph and finds definite noncolliders\n transferLocal(graph);\n // adds edges for variables never jointly measured\n for (NodePair pair : nonIntersection(graph)) {\n graph.addEdge(new Edge(pair.getFirst(), pair.getSecond(), Endpoint.CIRCLE, Endpoint.CIRCLE));\n }\n TetradLogger.getInstance().log(\"info\", \"Steps 1-2: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n System.out.println(\"step2\");\n System.out.println(graph);\n\n /*\n * Step 3\n *\n * Branch and prune step that blocks problematic undirectedPaths, possibly d-connecting undirectedPaths\n */\n steps = System.currentTimeMillis();\n Queue<Graph> searchPags = new LinkedList<>();\n // place graph constructed in step 2 into the queue\n searchPags.offer(graph);\n // get d-separations and d-connections\n List<Set<IonIndependenceFacts>> sepAndAssoc = findSepAndAssoc(graph);\n this.separations = sepAndAssoc.get(0);\n this.associations = sepAndAssoc.get(1);\n Map<Collection<Node>, List<PossibleDConnectingPath>> paths;\n// Queue<Graph> step3PagsSet = new LinkedList<Graph>();\n HashSet<Graph> step3PagsSet = new HashSet<>();\n Set<Graph> reject = new HashSet<>();\n // if no d-separations, nothing left to search\n if (separations.isEmpty()) {\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(graph);\n step3PagsSet.add(graph);\n }\n // sets length to iterate once if search over path lengths not enabled, otherwise set to 2\n int numNodes = graph.getNumNodes();\n int pl = numNodes - 1;\n if (pathLengthSearch) {\n pl = 2;\n }\n // iterates over path length, then adjacencies\n for (int l = pl; l < numNodes; l++) {\n if (pathLengthSearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path lengths: \" + l + \" of \" + (numNodes - 1));\n }\n int seps = separations.size();\n int currentSep = 1;\n int numAdjacencies = separations.size();\n for (IonIndependenceFacts fact : separations) {\n if (adjacencySearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path nonadjacencies: \" + currentSep + \" of \" + numAdjacencies);\n }\n seps--;\n // uses two queues to keep up with which PAGs are being iterated and which have been\n // accepted to be iterated over in the next iteration of the above for loop\n searchPags.addAll(step3PagsSet);\n recGraphs.add(searchPags.size());\n step3PagsSet.clear();\n while (!searchPags.isEmpty()) {\n System.out.println(\"ION Step 3 size: \" + searchPags.size());\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n // deques first PAG from searchPags\n Graph pag = searchPags.poll();\n // Part 3.a - finds possibly d-connecting undirectedPaths between each pair of nodes\n // known to be d-separated\n List<PossibleDConnectingPath> dConnections = new ArrayList<>();\n // checks to see if looping over adjacencies\n if (adjacencySearch) {\n for (Collection<Node> conditions : fact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, fact.getX(), fact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, fact.getX(), fact.getY(), conditions));\n }\n }\n } else {\n for (IonIndependenceFacts allfact : separations) {\n for (Collection<Node> conditions : allfact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, allfact.getX(), allfact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, allfact.getX(), allfact.getY(), conditions));\n }\n }\n }\n }\n // accept PAG go to next PAG if no possibly d-connecting undirectedPaths\n if (dConnections.isEmpty()) {\n// doFinalOrientation(pag);\n// Graph p = screenForKnowledge(pag);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(pag);\n continue;\n }\n // maps conditioning sets to list of possibly d-connecting undirectedPaths\n paths = new HashMap<>();\n for (PossibleDConnectingPath path : dConnections) {\n List<PossibleDConnectingPath> p = paths.get(path.getConditions());\n if (p == null) {\n p = new LinkedList<>();\n }\n p.add(path);\n paths.put(path.getConditions(), p);\n }\n // Part 3.b - finds minimal graphical changes to block possibly d-connecting undirectedPaths\n List<Set<GraphChange>> possibleChanges = new ArrayList<>();\n for (Set<GraphChange> changes : findChanges(paths)) {\n Set<GraphChange> newChanges = new HashSet<>();\n for (GraphChange gc : changes) {\n boolean okay = true;\n for (Triple collider : gc.getColliders()) {\n\n if (pag.isUnderlineTriple(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n\n }\n if (!okay) {\n continue;\n }\n for (Triple collider : gc.getNoncolliders()) {\n if (pag.isDefCollider(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n }\n if (okay) {\n newChanges.add(gc);\n }\n }\n if (!newChanges.isEmpty()) {\n possibleChanges.add(newChanges);\n } else {\n possibleChanges.clear();\n break;\n }\n }\n float starthitset = System.currentTimeMillis();\n Collection<GraphChange> hittingSets = IonHittingSet.findHittingSet(possibleChanges);\n recHitTimes.add((System.currentTimeMillis() - starthitset) / 1000.);\n // Part 3.c - checks the newly constructed graphs from 3.b and rejects those that\n // cycles or produce independencies known not to occur from the input PAGs or\n // include undirectedPaths from definite nonancestors\n for (GraphChange gc : hittingSets) {\n boolean badhittingset = false;\n for (Edge edge : gc.getRemoves()) {\n Node node1 = edge.getNode1();\n Node node2 = edge.getNode2();\n Set<Triple> triples = new HashSet<>();\n triples.addAll(gc.getColliders());\n triples.addAll(gc.getNoncolliders());\n if (triples.size() != (gc.getColliders().size() + gc.getNoncolliders().size())) {\n badhittingset = true;\n break;\n }\n for (Triple triple : triples) {\n if (node1.equals(triple.getY())) {\n if (node2.equals(triple.getX()) ||\n node2.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n if (node2.equals(triple.getY())) {\n if (node1.equals(triple.getX()) ||\n node1.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n }\n if (badhittingset) {\n break;\n }\n for (NodePair pair : gc.getOrients()) {\n if ((node1.equals(pair.getFirst()) && node2.equals(pair.getSecond())) ||\n (node2.equals(pair.getFirst()) && node1.equals(pair.getSecond()))) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (!badhittingset) {\n for (NodePair pair : gc.getOrients()) {\n for (Triple triple : gc.getNoncolliders()) {\n if (pair.getSecond().equals(triple.getY())) {\n if (pair.getFirst().equals(triple.getX()) &&\n pag.getEndpoint(triple.getZ(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n\n }\n if (pair.getFirst().equals(triple.getZ()) &&\n pag.getEndpoint(triple.getX(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n }\n if (badhittingset) {\n continue;\n }\n Graph changed = gc.applyTo(pag);\n // if graph change has already been rejected move on to next graph\n if (reject.contains(changed)) {\n continue;\n }\n // if graph change has already been accepted move on to next graph\n if (step3PagsSet.contains(changed)) {\n continue;\n }\n // reject if null, predicts false independencies or has cycle\n if (predictsFalseIndependence(associations, changed)\n || changed.existsDirectedCycle()) {\n reject.add(changed);\n }\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(changed);\n // now add graph to queue\n\n// Graph p = screenForKnowledge(changed);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(changed);\n }\n }\n // exits loop if not looping over adjacencies\n if (!adjacencySearch) {\n break;\n }\n }\n }\n TetradLogger.getInstance().log(\"info\", \"Step 3: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n Queue<Graph> step3Pags = new LinkedList<>(step3PagsSet);\n\n /*\n * Step 4\n *\n * Finds redundant undirectedPaths and uses this information to expand the list\n * of possible graphs\n */\n steps = System.currentTimeMillis();\n Map<Edge, Boolean> necEdges;\n Set<Graph> outputPags = new HashSet<>();\n\n while (!step3Pags.isEmpty()) {\n Graph pag = step3Pags.poll();\n necEdges = new HashMap<>();\n // Step 4.a - if x and y are known to be unconditionally associated and there is\n // exactly one trek between them, mark each edge on that trek as necessary and\n // make the tiples on the trek definite noncolliders\n // initially mark each edge as not necessary\n for (Edge edge : pag.getEdges()) {\n necEdges.put(edge, false);\n }\n // look for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n List<List<Node>> treks = treks(pag, fact.x, fact.y);\n if (treks.size() == 1) {\n List<Node> trek = treks.get(0);\n List<Triple> triples = new ArrayList<>();\n for (int i = 1; i < trek.size(); i++) {\n // marks each edge in trek as necessary\n necEdges.put(pag.getEdge(trek.get(i - 1), trek.get(i)), true);\n if (i == 1) {\n continue;\n }\n // makes each triple a noncollider\n pag.addUnderlineTriple(trek.get(i - 2), trek.get(i - 1), trek.get(i));\n }\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // Part 4.b - branches by generating graphs for every combination of removing\n // redundant undirectedPaths\n boolean elimTreks;\n // checks to see if removing redundant undirectedPaths eliminates every trek between\n // two variables known to be nconditionally assoicated\n List<Graph> possRemovePags = possRemove(pag, necEdges);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n for (Graph newPag : possRemovePags) {\n elimTreks = false;\n // looks for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n if (treks(newPag, fact.x, fact.y).isEmpty()) {\n elimTreks = true;\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // add new PAG to output unless a necessary trek has been eliminated\n if (!elimTreks) {\n outputPags.add(newPag);\n }\n }\n }\n outputPags = removeMoreSpecific(outputPags);\n// outputPags = applyKnowledge(outputPags);\n\n TetradLogger.getInstance().log(\"info\", \"Step 4: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n\n /*\n * Step 5\n *\n * Generate the Markov equivalence classes for graphs and accept only\n * those that do not predict false d-separations\n */\n steps = System.currentTimeMillis();\n Set<Graph> outputSet = new HashSet<>();\n for (Graph pag : outputPags) {\n Set<Triple> unshieldedPossibleColliders = new HashSet<>();\n for (Triple triple : getPossibleTriples(pag)) {\n if (!pag.isAdjacentTo(triple.getX(), triple.getZ())) {\n unshieldedPossibleColliders.add(triple);\n }\n }\n\n PowerSet<Triple> pset = new PowerSet<>(unshieldedPossibleColliders);\n for (Set<Triple> set : pset) {\n Graph newGraph = new EdgeListGraph(pag);\n for (Triple triple : set) {\n newGraph.setEndpoint(triple.getX(), triple.getY(), Endpoint.ARROW);\n newGraph.setEndpoint(triple.getZ(), triple.getY(), Endpoint.ARROW);\n }\n doFinalOrientation(newGraph);\n }\n for (Graph outputPag : finalResult) {\n if (!predictsFalseIndependence(associations, outputPag)) {\n Set<Triple> underlineTriples = new HashSet<>(outputPag.getUnderLines());\n for (Triple triple : underlineTriples) {\n outputPag.removeUnderlineTriple(triple.getX(), triple.getY(), triple.getZ());\n }\n outputSet.add(outputPag);\n }\n }\n }\n\n// outputSet = applyKnowledge(outputSet);\n outputSet = checkPaths(outputSet);\n\n output.addAll(outputSet);\n TetradLogger.getInstance().log(\"info\", \"Step 5: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n runtime = ((System.currentTimeMillis() - start) / 1000.);\n logGraphs(\"\\nReturning output (\" + output.size() + \" Graphs):\", output);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n return output;\n }", "private void processOverlay(){\n \n // go for as long as edges still exist.\n while(this.availableVertices.size() > 0)\n {\n \n // pick the least weight vertex.\n Vertex next = this.availableVertices.poll(); // finding the least weight vertex.\n int distanceToNext = this.distances.get(convertToString(next.getVertexPortNum())); // must use the string version of the portnum.\n \n // and for each available squad member of the chosen vertex\n List<Edge> nextSquad = next.getSquad(); \n for(Edge e: nextSquad)\n {\n Vertex other = e.getNeighbor(next);\n if(this.visitedVertices.contains(other))\n {\n continue; // continue the while loop in this case.\n }\n \n // check for a shorter path, update if a new path is found within the overlay.\n int currentWeight = this.distances.get(convertToString(other.getVertexPortNum())); // using string version of the port number.\n int newWeight = distanceToNext + e.getWeight();\n \n if(newWeight < currentWeight){\n this.predecessors.put(convertToString(other.getVertexPortNum()), convertToString(next.getVertexPortNum())); // use the string versions of the port numbers.\n this.distances.put(convertToString(other.getVertexPortNum()), newWeight); // use the string version of the port numbers.\n // updating here.\n this.availableVertices.remove(other);\n this.availableVertices.add(other);\n }\n \n }\n \n this.visitedVertices.add(next); // add this vertex as \"visited\" so we do not visit it again.\n }\n }", "public static void main(String[] args) throws CantAdd, CoronaWarn {\n\t\tTravelAgency TravelAgency = new TravelAgency();\r\n\r\n\t\tPlane p=new Plane(200,2,\"first plane max travelers\");\r\n\t\tPlane p1=new Plane(100,1,\"second plan min traelers\");\r\n\r\n\t\tTrip i=new Trip(p,Country.Australia,Country.Canada);\r\n\t\tTrip io=new Trip(p1,Country.Australia,Country.Canada);\r\n\t\t \r\n\t\tDate date=new Date(1,2,5);\r\n\t\tPassport passprt1=new Passport(\"anton\",44,date);\r\n\t\tPassport passprt2=new Passport(\"abdo\",44,date);\r\n\t\tPassport passprt3=new Passport(\"julie\",44,date);\r\n\t\tPassport passprt4=new Passport(\"juliana\",44,date);\r\n\t\tPassport passprt5=new Passport(\"bella\",44,date);\r\n\t\tPassport passprt6=new Passport(\"geris\",44,date);\r\n\t\tTraveler t1=new Traveler(passprt1,true,true);\r\n\t\tTraveler t2=new Traveler(passprt2,true,true);\r\n\t\tTraveler t3=new Traveler(passprt3,true,true);\r\n\t\tTraveler t4=new Traveler(passprt4,true,true);\r\n\t\tTraveler t5=new Traveler(passprt5,true,true);\r\n\t\tTraveler t6=new Traveler(passprt6,true,true);\r\n\t\t\r\n\t\t\r\n\t\tio.addTraveler(t1);\r\n\t\tio.addTraveler(t2);\r\n\t\tio.addTraveler(t3);\r\n\t\tio.addTraveler(t6);\r\n\t\tio.addTraveler(t5);\r\n\t\tio.addTraveler(t4);\r\n\t\tio.addTraveler(t6);\r\n \r\n\t\ti.addTraveler(t1);\r\n\t\ti.addTraveler(t2);\r\n\t\ti.addTraveler(t3);\r\n\t\ti.addTraveler(t4);\r\n\t\r\n\t\ti.addTraveler(t6);\r\n\t\t\r\n\t\tTravelAgency.addTrip(i);\t\r\n\t\tTravelAgency.addTrip(io);\r\n\t\tSystem.out.print(TravelAgency.findUnsafeTrips());\r\n\r\n\t\t\r\n\t\tTravelAgency.AddTraveler(t1);\r\n\t\tTravelAgency.AddTraveler(t2);\r\n\t\tTravelAgency.AddTraveler(t3);\r\n\t\tTravelAgency.AddTraveler(t4);\r\n\t\tTravelAgency.AddTraveler(t5);\r\n\t\tTravelAgency.AddTraveler(t6);\r\n\t\t\r\n\t}", "private static void postProcess() {\n Set<Transition> ts = petrinet.getTransitions();\n for(Transition t : ts) {\n List<Flow> outEdges = new ArrayList<Flow>(t.getPostsetEdges());\n List<Flow> inEdges = new ArrayList<Flow>(t.getPresetEdges());\n try {\n Flow f = petrinet.getFlow(t.getId(), \"void\");\n System.out.println(\"contain void!\");\n assert(f.getWeight() == 1);\n //if (outEdges.size() == 1) { // Delete the transition.\n f.setWeight(0);\n //}\n } catch (NoSuchEdgeException e) {}\n }\n }", "public OptInfo createInitialRoutes() {\t\n\t\t//OptInfo has old and new attributes\n\t\tOptInfo info = new OptInfo();\n\t\tTSPDepot currDepot = null; //current depot\n\t\tTSPShipment currShip = null; //current shipment\n\t\t//int countLoop=0;\n\n\t\t//check if selection and insertion type methods have been selected\n\t\tif (ProblemInfo.selectShipType == null) {\n\t\t\tSettings.printDebug(Settings.ERROR,\n\t\t\t\t\t\"No selection shipment type has been assigned\");\n\n\t\t}\n\t\tif (ProblemInfo.insertShipType == null) {\n\t\t\tSettings.printDebug(Settings.ERROR,\n\t\t\t\t\t\"No insertion shipment type has been assigned\");\n\t\t}\n\n\t\t//capture the old attributes\n\t\tinfo.setOldAttributes(mainDepots.getAttributes());\n\t\twhile (!mainShipments.isAllShipsAssigned()) {\n\n\n\t\t\tcurrDepot = (TSPDepot) mainDepots.getTSPHead();\n\t\t\t//Send the entire mainDepots and mainShipments to get the next shipment\n\t\t\t//to be inserted including the current depot\n\t\t\tTSPShipment theShipment = mainShipments.getNextInsertShipment(mainDepots,\n\t\t\t\t\tcurrDepot, mainShipments, currShip);\n\t\t\tif (theShipment == null) { //shipment is null, print error message\n\t\t\t\tSettings.printDebug(Settings.COMMENT, \"No shipment was selected\");\n\t\t\t}\n\t\t\t//The selected shipment will be inserted into the route\n\t\t\tif (!mainDepots.insertShipment(theShipment)) {\n\t\t\t\tSettings.printDebug(Settings.COMMENT, \"The Shipment: <\" + theShipment.getIndex() +\n\t\t\t\t\t\t\"> cannot be routed\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//Settings.printDebug(Settings.COMMENT,\n\t\t\t\t//\t\t\"The Shipment: <\" + theShipment.getIndex() +// \" \" + theShipment +\n\t\t\t\t//\t\t\"> was routed\");\n\t\t\t\t//tag the shipment as being routed\n\t\t\t\ttheShipment.setIsAssigned(true);\n\t\t\t}\n\t\t}\n\t\tProblemInfo.depotLLLevelCostF.calculateTotalsStats(mainDepots);\n\t\tinfo.setNewAtributes(mainDepots.getAttributes());\n\t\treturn info;\n\t}", "public void dft() {\r\n\t\tHashMap<String, Boolean> processed = new HashMap<>();\r\n\t\tLinkedList<Pair> stack = new LinkedList<>();\r\n\r\n\t\tArrayList<String> vnames = new ArrayList<>(vces.keySet());\r\n\t\tfor (String vname : vnames) {\r\n\t\t\tif (processed.containsKey(vname)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tPair rootpair = new Pair(vname, vname);\r\n\t\t\tstack.addFirst(rootpair);\r\n\t\t\twhile (stack.size() != 0) {\r\n\t\t\t\t// 1. removeFirst\r\n\t\t\t\tPair rp = stack.removeFirst();\r\n\r\n\t\t\t\t// 2. check if processed, mark if not\r\n\t\t\t\tif (processed.containsKey(rp.vname)) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tprocessed.put(rp.vname, true);\r\n\r\n\t\t\t\t// 3. Check, if an edge is found\r\n\t\t\t\tSystem.out.println(rp.vname + \" via \" + rp.psf);\r\n\r\n\t\t\t\t// 4. Add the unprocessed nbrs back\r\n\t\t\t\tArrayList<String> nbrnames = new ArrayList<>(rp.vtx.nbrs.keySet());\r\n\t\t\t\tfor (String nbrname : nbrnames) {\r\n\t\t\t\t\tif (!processed.containsKey(nbrname)) {\r\n\t\t\t\t\t\tPair np = new Pair(nbrname, rp.psf + nbrname);\r\n\t\t\t\t\t\tstack.addFirst(np);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void readEdges(){\n for ( j= 0;j<edgesNum;j++){\n lineElements = lines.get(j+2).split(\" \");\n // System.out.println(lineElements[0]+\" \"+lineElements[1]);\n int start = Integer.parseInt(lineElements[0])-1;\n int end = Integer.parseInt(lineElements[1])-1;\n vertices.get(start).addAdj(vertices.get(end));\n vertices.get(end).addAdj(vertices.get(start));\n }\n\n // Read the edges for AI agents\n\n for ( j= 0;j<edgesNum;j++){\n lineElements = lines.get(j+2).split(\" \");\n // System.out.println(lineElements[0]+\" \"+lineElements[1]);\n int start = Integer.parseInt(lineElements[0]);\n int end = Integer.parseInt(lineElements[1]);\n allSCountries.get(start).adj.add(end);\n allSCountries.get(end).adj.add(start);\n }\n }", "public static void articulationPoints(graph g) throws IOException\n\t{\n\t\tint[] visited = new int[g.V];\n\t\tint[] discovered = new int[g.V];\n\t\tint[] low = new int[g.V];\n\t\tint[] parent = new int[g.V];\n\t\tfor(int i = 0 ; i < g.V ; i++)\n\t\t{\n\t\t\tparent[i] = -1;\n\t\t} \n\t\tfor(int i = 0 ; i < g.V ; i++) // Here i m taking 0th node as source node but prog can be easily modified for general node.\n\t\t{\n\t\t\tif(visited[i] == 0)\n\t\t\t{\n\t\t\t\texplore(g,i,visited,discovered,low,parent);\t\n\t\t\t}\t\t\n\t\t}\n\t\tSystem.out.println(\"\\n\\n\\n\\nYou can check if the algo did the correct job by checking if the low[] and discovered[]\\n arrays have the right value or not\");\n\t\tSystem.out.println(\"Press 1 if u want to check the arrays and 0 if not\");\n\t\tint ans = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in)).readLine());\n\t\tif(ans == 1)\n\t\t\tprintLowAndDiscovered(g,discovered,low);\t\n\t}", "protected void _updateG2AttributesFromLocal(Structure atts)\n {\n }", "public void automerge() {\n\t\tif (automerge) {\n\t\t\tfor(int i = 0; i<create_modifier+1;i++) {\n\t\t\t\tmerge();\n\t\t\t}\n\t\tif(autoidentify) {\n\t\t\tauto_identify_crystal(autoIdentifyTier); // replace this eventually\n\t\t}\n\t\t\t//collection();\n\t\t}\n\t}", "public void knowVillages() {\n\t\tleave.setKnown(true);\n\t\tarrive.setKnown(true);\n\t}", "private void doDdpOrientation(Graph graph, Node l, Node a, Node b, Node c) {\n changeFlag = true;\n for (IonIndependenceFacts iif : separations) {\n if ((iif.getX().equals(l) && iif.getY().equals(c)) ||\n iif.getY().equals(l) && iif.getX().equals(c)) {\n for (List<Node> condSet : iif.getZ()) {\n if (condSet.contains(b)) {\n graph.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(graph);\n return;\n }\n }\n break;\n }\n }\n Graph newGraph1 = new EdgeListGraph(graph);\n newGraph1.setEndpoint(a, b, Endpoint.ARROW);\n newGraph1.setEndpoint(c, b, Endpoint.ARROW);\n discrimGraphs.add(newGraph1);\n Graph newGraph2 = new EdgeListGraph(graph);\n newGraph2.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(newGraph2);\n }", "private void updateOriginalEdgesInMirror() {\n for (Edge edge : originalGraph.edges()) {\n if (!directEdgeMap.containsKey(edge)) {\n constructMirrorEdge(edge);\n }\n MirrorEdge mirrorEdge = directEdgeMap.get(edge);\n updateMirrorEdgeBends(edge, mirrorEdge);\n updateMirrorEdgeSegments(mirrorEdge);\n originalAttributesToMirror(edge);\n }\n }", "void reset(boolean preparingForUpwardPass) {\n\t\t\t_orderID = UNMARKED;\n\t\t\t_outgoingEdges.clear();\n\t\t\t//TODO when do we call this? when should we mark all edges as received?\n\t\t\tfor(Edge e : getIncomingNeighborEdges(preparingForUpwardPass)) {\n\t\t\t\t_neighborEdges.put(e, false);\n\t\t\t}\n\t\t}", "void ResolveUnreleasedMovements() {\n\t\t// if (isMove_down())\n\t\t// moveDown();\n\t\tif (isMove_left())\n\t\t\tmoveLeft();\n\t\tif (isMove_right())\n\t\t\tmoveRight();\n\t\t// if (isMove_up())\n\t\t// moveUP();\n\t\t// setBlock_down(false);\n\t\t// if (!isMove_left() && !isMove_right())\n\t\t// getSpeed().setX(0);\n\t\t// if (!isMove_down() && !isMove_up())\n\t\t// getSpeed().setY(0);\n\t}", "private List<LPGActionGraph> handleUnsupportedPrecondition(UnsupportedPrecondition inconsistency) {\n\t\t\n\t\tList<LPGActionGraph> neighborhood = Collections.synchronizedList(new ArrayList<LPGActionGraph>());\n\t\tint currentLevel = inconsistency.getCurrentLevel();\n\t\tPlanGraphLiteral unsupportedLiteral = inconsistency.getUnsupportedPrecondition();\n\t\t\n\t\t/* steps we can add to resolve the USP */\n\t\t// List<PlanGraphStep> addChoices = unsupportedLiteral.getParentNodes();\n\t\tList<PlanGraphStep> addChoices = findAddChoices(unsupportedLiteral);\n\t\tList<Thread> threads = new ArrayList<Thread>();\n\t\tfor (PlanGraphStep stepToAdd : addChoices) {\n\t\t\tint initialLevel = stepToAdd.getInitialLevel();\n\t\t\tif (initialLevel != -1 && initialLevel <= currentLevel) {\n\t\t\t\t/* evaluate each level we can add this step to to solve inconsistency at currentLevel */\n\t\t\t\tfor(int i = initialLevel; i <= currentLevel; i++) {\n\t\t\t\t\t\n\t\t\t\t\tfinal int index = i;\n\t\t\t\t\tThread t = new Thread( new Runnable() {\n\t\t\t\t\t\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\tLPGActionGraph newAG = getAddNeighbor(stepToAdd, inconsistency, index);\n\t\t\t\t\t\t\tif (newAG != null){\n\t\t\t\t\t\t\t\tneighborhood.add(newAG);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tthreads.add(t);\n\t\t\t\t\tt.start();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t/* block until all threads are done */\n\t\tfor(Thread t : threads){\n\t\t\ttry {\n\t\t\t\tt.join();\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t\t/* steps we can remove to resolve the USP*/\n\t\tList<PlanGraphStep> removeChoices = findRemoveChoices(unsupportedLiteral, currentLevel);\n\t\tif (removeChoices != null)\n\t\t\tneighborhood.add(getDeleteNeighbor(removeChoices, inconsistency, currentLevel));\n\t\t\n\t\treturn neighborhood;\n\t\t\n\t}", "protected void _updateLocalAttributesFromG2(Structure atts)\n {\n }", "void driveTracker()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tlong time = System.currentTimeMillis();\r\n\t\t\tint last_direction = 0;\r\n\t\t\twhile(System.currentTimeMillis()-time < 20000 && status.equals(\"wait\"))\r\n\t\t\t{\r\n\t\t\t\tint direction = -1;\r\n\t\t\t\tint flow_min = Main.MAX_INT;\r\n\t\t\t\tif((loc.i-1)>=0 && BFS.adj_const[(loc.i-1)*80+loc.j][loc.i*80+loc.j]==1 && Flow.flows[loc.i-1][loc.j][1] < flow_min)\r\n\t\t\t\t{\r\n\t\t\t\t\tdirection = 0;//up\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i-1][loc.j][1];\r\n\t\t\t\t}\r\n\t\t\t\tif((loc.i+1)<80 && BFS.adj_const[(loc.i+1)*80+loc.j][loc.i*80+loc.j]==1 && Flow.flows[loc.i][loc.j][1] < flow_min)\r\n\t\t\t\t{\t\r\n\t\t\t\t\tdirection = 1;//down\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i][loc.j][1];\r\n\t\t\t\t}\r\n\t\t\t\tif((loc.j-1)>=0 && BFS.adj_const[loc.i*80+loc.j][loc.i*80+loc.j-1]==1 && Flow.flows[loc.i][loc.j-1][0] < flow_min)\r\n\t\t\t\t{\t\r\n\t\t\t\t\tdirection = 2;//left\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i][loc.j-1][0];\r\n\t\t\t\t}\r\n\t\t\t\tif((loc.j+1)<80 && BFS.adj_const[loc.i*80+loc.j][loc.i*80+loc.j+1]==1 && Flow.flows[loc.i][loc.j][0] < flow_min)\r\n\t\t\t\t{\r\n\t\t\t\t\tdirection = 3;//right\r\n\t\t\t\t\tflow_min = Flow.flows[loc.i][loc.j][0];\r\n\t\t\t\t}\r\n\t\t\t\tLight light = Traffic.findLight(loc.i,loc.j);\r\n\t\t\t\tif(light!=null)\r\n\t\t\t\t{\r\n\t\t\t\t\twhile(!leaveLight(light,last_direction,direction))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmeet_light = true;\r\n\t\t\t\t\t\tThread.sleep(100);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmeet_light = false;\r\n\t\t\t\t}\r\n\t\t\t\tswitch(direction)\r\n\t\t\t\t{\r\n\t\t\t\tcase 0 ://up\r\n\t\t\t\t\tif(BFS.adj_matrix[(loc.i-1)*80+loc.j][loc.i*80+loc.j] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i-1][loc.j][1]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.i -= 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 1 ://down\r\n\t\t\t\t\tif(BFS.adj_matrix[(loc.i+1)*80+loc.j][loc.i*80+loc.j] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i][loc.j][1]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.i += 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2 ://left\r\n\t\t\t\t\tif(BFS.adj_matrix[loc.i*80+loc.j][loc.i*80+loc.j-1] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i][loc.j-1][0]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.j -= 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3 ://right\r\n\t\t\t\t\tif(BFS.adj_matrix[loc.i*80+loc.j][loc.i*80+loc.j+1] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[loc.i][loc.j][0]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tloc.j += 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tThread.sleep(100);\r\n\t\t\t\tlast_direction = direction;\r\n\t\t\t}\r\n\t\t\tif(status.equals(\"wait\"))\r\n\t\t\t{\r\n\t\t\t\tstatus = \"stop\";\r\n\t\t\t\tThread.sleep(1000);//stop\r\n\t\t\t\tstatus = \"wait\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttransStatus();\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Sorry to catch Exception!\");\r\n\t\t}\r\n\t}", "public void fixEdges() {\n\tfor (LayoutEdge lEdge: edgeList) {\n\t // Get the underlying edge\n\t CyEdge edge = lEdge.getEdge();\n\t CyNode target = (CyNode) edge.getTarget();\n\t CyNode source = (CyNode) edge.getSource();\n\n\t if (nodeToLayoutNode.containsKey(source) && nodeToLayoutNode.containsKey(target)) {\n\t\t// Add the connecting nodes\n\t\tlEdge.addNodes((LayoutNode) nodeToLayoutNode.get(source),\n\t\t\t (LayoutNode) nodeToLayoutNode.get(target));\n\t }\n\t}\n }", "protected void resetGraph() {\n for (List<Edge> path : graph) {\r\n for (Edge e : path) {\r\n e.flow = 0;\r\n }\r\n }\r\n }", "private void doFinalOrientation(Graph graph) {\n discrimGraphs.clear();\n Set<Graph> currentDiscrimGraphs = new HashSet<>();\n currentDiscrimGraphs.add(graph);\n while (changeFlag) {\n changeFlag = false;\n currentDiscrimGraphs.addAll(discrimGraphs);\n discrimGraphs.clear();\n for (Graph newGraph : currentDiscrimGraphs) {\n doubleTriangle(newGraph);\n awayFromColliderAncestorCycle(newGraph);\n if (!discrimPaths(newGraph)) {\n if (changeFlag) {\n discrimGraphs.add(newGraph);\n } else {\n finalResult.add(newGraph);\n }\n }\n }\n currentDiscrimGraphs.clear();\n }\n changeFlag = true;\n }", "private static void addDepotToGraph(Depot newDepot, Graph<Node, WeightEdge> graph, List<Node> depots, List<Node> trips, Problem problem){\n Node depotSource = new Node(newDepot, newDepot.getNumberOfVehicles(), true);\n graph.addVertex(depotSource);\n depots.add(depotSource);\n\n // add the depot sink vertex\n Node depotSink = new Node(newDepot, -newDepot.getNumberOfVehicles(), false);\n graph.addVertex(depotSink);\n depots.add(depotSink);\n\n // add edges from this depot source to all existing trips entry\n // add edges from all existing trips exit to this depot sink\n for(Node trip : trips){\n if(!trip.isExitNode()){\n // from depot source to trip startPoint\n WeightEdge depotToTripWeightEdge = new BoundedWeightEdge(0, 1);\n graph.addEdge(depotSource, trip, depotToTripWeightEdge);\n graph.setEdgeWeight(depotToTripWeightEdge, problem.getCost(depotSource.getLocation(), trip.getLocation()).toMinutes());\n }else{ //ending point\n // from trip endPoint to depot sink\n WeightEdge tripToDepotWeightEdge = new BoundedWeightEdge(0, 1);\n graph.addEdge(trip, depotSink, tripToDepotWeightEdge);\n graph.setEdgeWeight(tripToDepotWeightEdge, problem.getCost(trip.getLocation(), depotSink.getLocation()).toMinutes());\n }\n }\n\n // add arc from depot source to depot sink with lowerBound: 0 end upperBound: depot.numberOfAvailableVehicles\n // this arc is necessary when some vehicles in the depot are nod used\n Integer numberOfAvailableVehicles = ((Depot) depotSource.getLocation()).getNumberOfVehicles();\n WeightEdge sourceToSinkWeightEdge = new BoundedWeightEdge(0, numberOfAvailableVehicles);\n graph.addEdge(depotSource, depotSink, sourceToSinkWeightEdge);\n graph.setEdgeWeight(sourceToSinkWeightEdge, 0);\n\n }", "public void setVertices(){\n\t\tvertices = new ArrayList<V>();\n\t\tfor (E e : edges){\n\t\t\tV v1 = e.getOrigin();\n\t\t\tV v2 = e.getDestination();\n\t\t\tif (!vertices.contains(v1))\n\t\t\t\tvertices.add(v1);\n\t\t\tif (!vertices.contains(v2))\n\t\t\t\tvertices.add(v2);\n\t\t}\n\t}", "private void duplicateTags(Topology topology) {\n // This one pass implementation is dependent on Edges being\n // topologically sorted - ancestor Edges appear before their descendants.\n for (Edge e : topology.graph().getEdges()) {\n Object o = e.getTarget().getInstance();\n if (o instanceof Peek || o instanceof FanOut) {\n duplicateTags(e);\n }\n }\n }", "public void updateTravelledAndVisited() {\n Storage storage = Main.getStorage();\n routeStatsCalculator.updateLeastTravelledRoute(storage.getHistory());\n routeStatsCalculator.updateMostTravelledRoute(storage.getHistory());\n airportStatsCalculator.updateMostVisitedSrcAirports(storage.getHistorySrcAirports());\n airportStatsCalculator.updateLeastVisitedSrcAirports(storage.getHistorySrcAirports());\n airportStatsCalculator.updateMostVisitedDestAirports(storage.getHistoryDestAirports());\n airportStatsCalculator.updateLeastVisitedDestAirports(storage.getHistoryDestAirports());\n }", "private Map<VertexObject, VertexRelation> createProteinsRelationsMap(VertexObject proteinVertex) {\n // first get the PAG of the proteinVertex\n IntermediateProtein protein;\n Object vObject = proteinVertex.getObject();\n if (vObject instanceof Collection) {\n vObject = ((Collection<?>)vObject).iterator().next();\n }\n if (vObject instanceof IntermediateProtein) {\n protein = (IntermediateProtein)vObject;\n } else {\n return null;\n }\n \n InferenceProteinGroup pag = getProteinsPAG(protein);\n Map<VertexObject, VertexRelation> relations = new HashMap<>();\n if (pag != null) {\n for (VertexObject relatedVertex : graph.getVertices()) {\n Object objElement = relatedVertex.getObject();\n boolean done = false;\n \n if (objElement instanceof IntermediateGroup) {\n // groups have no relation\n continue;\n }\n \n // check for same PAG\n if (isObjectInPAG(objElement, pag)) {\n relations.put(relatedVertex, VertexRelation.IN_SAME_PAG);\n continue;\n }\n \n // check for sub-PAG\n for (InferenceProteinGroup subPAG : pag.getSubGroups()) {\n if (isObjectInPAG(objElement, subPAG)) {\n relations.put(relatedVertex, VertexRelation.IN_SUB_PAG);\n done = true;\n }\n \n if (done) {\n break;\n }\n }\n if (!done) {\n VertexRelation highestRelation = VertexRelation.IN_NO_PAG;\n \n // check for super- and parallel-PAG\n for (InferenceProteinGroup mainPAG : piaModeller.getProteinModeller().getInferredProteins()) {\n if (mainPAG.getSubGroups().contains(pag)) {\n // check for super-PAG\n if (isObjectInPAG(objElement, mainPAG)) {\n relations.put(relatedVertex, VertexRelation.IN_SUPER_PAG);\n done = true;\n }\n \n // check for parallel-PAG\n for (InferenceProteinGroup parallelPAG : mainPAG.getSubGroups()) {\n if (isObjectInPAG(objElement, parallelPAG)) {\n highestRelation = VertexRelation.IN_PARALLEL_PAG;\n }\n }\n }\n \n if (done) {\n break;\n }\n \n // record, if it is in any PAG at all\n if (highestRelation.equals(VertexRelation.IN_NO_PAG)) {\n if (isObjectInPAG(objElement, mainPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n for (InferenceProteinGroup subPAG : mainPAG.getSubGroups()) {\n if (isObjectInPAG(objElement, subPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n }\n }\n }\n \n if (!done) {\n relations.put(relatedVertex, highestRelation);\n }\n }\n }\n } else {\n // no PAG for this vertex -> all vertices are either unrelated or in no PAG\n \n for (VertexObject relatedVertex : graph.getVertices()) {\n Object objElement = relatedVertex.getObject();\n VertexRelation highestRelation = VertexRelation.IN_NO_PAG;\n \n for (InferenceProteinGroup mainPAG : piaModeller.getProteinModeller().getInferredProteins()) {\n // check, if it is in any PAG at all\n if (highestRelation.equals(VertexRelation.IN_NO_PAG)) {\n if (isObjectInPAG(objElement, mainPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n for (InferenceProteinGroup subPAG : mainPAG.getSubGroups()) {\n if (isObjectInPAG(objElement, subPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n }\n } else {\n break;\n }\n }\n \n relations.put(relatedVertex, highestRelation);\n }\n }\n \n return relations;\n }", "public void fordFulkerson() {\r\n\r\n\r\n\t\twhile(true) {\r\n\t\t\tResidualGraph resGraph = new ResidualGraph(net);\r\n\t\t\tLinkedList<Edge> augmentingPath = resGraph.findAugmentingPath();\r\n\t\t\tif(augmentingPath.isEmpty()) {\r\n\t\t\t\tbreak; // found the max flow\r\n\t\t\t} else {\r\n\t\t\t\t// Find the minimum capacity\r\n\t\t\t\tint minCap = Integer.MAX_VALUE;\r\n\t\t\t\tfor (Edge e : augmentingPath) {\r\n\t\t\t\t\tif (e.getCap() < minCap) minCap = e.getCap();\r\n\t\t\t\t}\r\n\t\t\t\t// Edit the path according to what we've found in the augmenting path\r\n\t\t\t\tfor (Edge e : augmentingPath) {\r\n\t\t\t\t\t// if e is a forward edge:\r\n\t\t\t\t\tVertex source = e.getSourceVertex();\r\n\t\t\t\t\tVertex target = e.getTargetVertex();\r\n\t\t\t\t\tEdge originalEdge = net.getAdjMatrixEntry(source, target);\r\n\t\t\t\t\tif (net.getAdjList(source).contains(target) && originalEdge.getFlow() + minCap <= originalEdge.getCap()) {\r\n\t\t\t\t\t\toriginalEdge.setFlow(originalEdge.getFlow() + minCap);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\toriginalEdge = net.getAdjMatrixEntry(target, source);\r\n\t\t\t\t\t\toriginalEdge.setFlow(net.getAdjMatrixEntry(target, source).getFlow() - minCap);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tnet.printFlow();\r\n\t\t}\r\n\t}", "private ArrayList<Integer> getAugmentingPath(){\n Queue<Integer> queue = new LinkedList<Integer>();\n int[] pre = new int[network.V()];\n Arrays.fill(pre, -1);\n\n queue.add(source);\n pre[source] = source;\n while(!queue.isEmpty()){\n int cur = queue.poll();\n if(cur == sink) break; // find one augmentation\n for(int nei : residualGraph.adj(cur)){\n if(pre[nei] == -1 && residualGraph.getWeight(cur, nei) > 0){\n pre[nei] = cur;\n queue.add(nei);\n }\n }\n }\n ArrayList<Integer> res = new ArrayList<>();\n if(pre[sink] == -1) return res; // no augmentation path\n\n int cur = sink;\n while(cur != source){\n res.add(cur);\n cur = pre[cur];\n }\n res.add(source);\n Collections.reverse(res);\n return res;\n }", "public void update(HashMap um) {\n if (false) {\n if (TRACE_INTRA) out.println(\"Updating edges for node \"+this.toString_long());\n Map m = this.predecessors;\n if (m != null) {\n this.predecessors = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.predecessors);\n }\n m = this.addedEdges;\n if (m != null) {\n this.addedEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.addedEdges);\n }\n m = this.accessPathEdges;\n if (m != null) {\n this.accessPathEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.accessPathEdges);\n }\n if (this.passedParameters != null) {\n Set pp = SortedArraySet.FACTORY.makeSet(HashCodeComparator.INSTANCE);\n pp.addAll(this.passedParameters); \n this.passedParameters = pp;\n }\n addGlobalEdges(this);\n }\n }", "public void update(HashMap um) {\n if (false) {\n if (TRACE_INTRA) out.println(\"Updating edges for node \"+this.toString_long());\n Map m = this.predecessors;\n if (m != null) {\n this.predecessors = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.predecessors);\n }\n m = this.addedEdges;\n if (m != null) {\n this.addedEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.addedEdges);\n }\n m = this.accessPathEdges;\n if (m != null) {\n this.accessPathEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.accessPathEdges);\n }\n if (this.passedParameters != null) {\n Set pp = SortedArraySet.FACTORY.makeSet(HashCodeComparator.INSTANCE);\n pp.addAll(this.passedParameters); \n this.passedParameters = pp;\n }\n addGlobalEdges(this);\n }\n }", "private void createGraphFromIntermediateStructure() {\n // initialize the graph to be a directed sparse graph\n graph = new DirectedSparseGraph<>();\n \n groupVertices = new HashMap<>();\n \n mainScoreAccession = piaModeller.getPSMModeller().getFilesMainScoreAccession(1);\n \n // go through the clusters and create the graph\n for (Set<IntermediateGroup> cluster : piaModeller.getIntermediateStructure().getClusters().values()) {\n for (IntermediateGroup group : cluster) {\n VertexObject groupV = addGroupVertex(group);\n\n // connect to the child-groups\n if (group.getChildren() != null) {\n for (IntermediateGroup child : group.getChildren()) {\n VertexObject childV = addGroupVertex(child);\n String edgeName = \"groupGroup_\" + groupV.getLabel() + \"_\" + childV.getLabel();\n graph.addEdge(edgeName, groupV, childV);\n }\n }\n\n // add the proteins collapsed\n if ((group.getProteins() != null) && (group.getProteins().size() > 0)) {\n addProteinVertices(groupV, true);\n }\n\n // add the peptides\n if ((group.getPeptides() != null) && (group.getPeptides().size() > 0)) {\n addPeptideVertices(groupV, true);\n \n for (IntermediatePeptide peptide : group.getPeptides()) {\n for (IntermediatePeptideSpectrumMatch psm : peptide.getAllPeptideSpectrumMatches()) {\n Double score = psm.getScore(mainScoreAccession);\n \n if ((score != null) && !score.equals(Double.NaN)) {\n if ((highestMainScore == null) || highestMainScore.equals(Double.NaN)) {\n highestMainScore = score;\n } else if (score > highestMainScore){\n highestMainScore = score;\n }\n \n if ((lowestMainScore == null) || lowestMainScore.equals(Double.NaN)) {\n lowestMainScore = score;\n } else if (score < lowestMainScore){\n lowestMainScore = score;\n }\n }\n }\n }\n }\n }\n }\n }", "public final void populateGraphWithArena(final Arena arena) {\r\n for (final GraphNode node : vertexCorrespondence.values()) {\r\n node.dispose();\r\n }\r\n vertexCorrespondence.clear();\r\n for (final GraphConnection connection : edgeCorrespondence.values()) {\r\n connection.dispose();\r\n }\r\n edgeCorrespondence.clear();\r\n\r\n final Collection<? extends ParityVertex> vertices = arena.getVertices();\r\n for (final ParityVertex vertex : vertices) {\r\n GraphNode node = new GraphNode(graph, vertex.getPlayer()\r\n .getZestStyleFlag(), Integer.toString(vertex.getPriority()));\r\n node.setTooltip(new Label(vertex.getName()));\r\n vertexCorrespondence.put(vertex, node);\r\n }\r\n for (final ParityVertex fromVertex : vertices) {\r\n for (final ParityVertex toVertex : fromVertex.getSuccessors()) {\r\n final GraphConnection connection = new GraphConnection(graph,\r\n ZestStyles.CONNECTIONS_DIRECTED,\r\n vertexCorrespondence.get(fromVertex),\r\n vertexCorrespondence.get(toVertex));\r\n if (fromVertex.equals(toVertex)) {\r\n connection.setCurveDepth(20);\r\n } else if (toVertex.getSuccessors().contains(fromVertex)) {\r\n connection.setCurveDepth(10);\r\n }\r\n connection.setLineColor(BLACK);\r\n edgeCorrespondence.put(new ParityEdge(fromVertex, toVertex),\r\n connection);\r\n }\r\n }\r\n\r\n graph.setLayoutAlgorithm(new SpringLayoutAlgorithm(\r\n LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);\r\n }", "private void maintainMergeLocal() {\n logger.info(\"Maintaining Merge Local\");\n try {\n Bin mergeBin;\n synchronized (geometricParts) {\n mergeBin = geometricParts.findMergeCandidates();\n }\n if (!mergeBin.isEmpty()) {\n File indexShard = getNextIndexShardFolder(mergeBin.size + 1);\n // otherwise there's something to merge\n logger.info(\"Performing merge!\");\n\n\n // merge the shards\n Parameters p = this.globalParameters.clone();\n // override each of these particular parameters\n p.set(\"indexPath\", indexShard.getAbsolutePath());\n p.set(\"inputPath\", new ArrayList<>(mergeBin.getBinPaths()));\n p.set(\"renumberDocuments\", false);\n\n App.run(\"merge-index\", p, System.out);\n\n // should make sure that these two are uninteruppable\n synchronized (geometricParts) {\n geometricParts.add(mergeBin.size + 1, indexShard.getAbsolutePath());\n geometricParts.removeShards(mergeBin);\n updateIndex();\n }\n\n // now can delete the merged indexshard folders...\n for (String file : mergeBin.getBinPaths()) {\n FSUtil.deleteDirectory(new File(file));\n }\n\n logger.info(\"Done merging.\");\n }\n } catch (Exception ex) {\n Logger.getLogger(GeometricIndex.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "private static void addTripToGraph(Trip newTrip, Graph<Node, WeightEdge> graph, List<Node> depots, List<Node> trips, Problem problem){\n Node tripStart = new Node(newTrip, 0, false);\n Node tripEnd = new Node(newTrip, 0, true);\n\n graph.addVertex(tripStart);\n graph.addVertex(tripEnd);\n\n // Add weightEdgeWithBounders from trip startPoint to trip endPoint\n // lowerBound and upperBound for this edges is 1, because we are looking for solution that saturates all trips\n WeightEdge tripInternalWeightEdge = new BoundedWeightEdge(1,1);\n graph.addEdge(tripStart, tripEnd, tripInternalWeightEdge);\n graph.setEdgeWeight(tripInternalWeightEdge, 0);\n\n for(Node depot : depots){\n if(depot.isExitNode()){ // is source\n // add weightEdgeWithBounders from depot source to trip startPoint\n WeightEdge depotToTripWeightEdge = new BoundedWeightEdge(0, 1);\n graph.addEdge(depot, tripStart, depotToTripWeightEdge);\n graph.setEdgeWeight(depotToTripWeightEdge, problem.getCost(depot.getLocation(), tripStart.getLocation()).toMinutes());\n }else{ // is depot sink\n // add weightEdgeWithBounders from trip endPoint to depot sink\n WeightEdge tripToDepotWeightEdge = new BoundedWeightEdge(0, 1);\n graph.addEdge(tripEnd, depot, tripToDepotWeightEdge);\n graph.setEdgeWeight(tripToDepotWeightEdge, problem.getCost(tripEnd.getLocation(), depot.getLocation()).toMinutes());\n }\n }\n\n for(Node otherTrip : trips){\n if(otherTrip.isExitNode()){\n // add feasible edges from all trips endPoints to this trip startPoint\n if(isFeasibleEdge(otherTrip, tripStart, problem)){\n WeightEdge otherTripToThisTrip = new BoundedWeightEdge(0, 1);\n graph.addEdge(otherTrip, tripStart, otherTripToThisTrip);\n graph.setEdgeWeight(otherTripToThisTrip, problem.getCost(otherTrip.getLocation(), tripStart.getLocation()).toMinutes());\n }\n }else{\n // add feasible edges from this trip endPoint to all trips startPoints\n if(isFeasibleEdge(tripEnd, otherTrip, problem)){\n WeightEdge thisTripToOtherTrip = new BoundedWeightEdge(0, 1);\n graph.addEdge(tripEnd, otherTrip, thisTripToOtherTrip);\n graph.setEdgeWeight(thisTripToOtherTrip, problem.getCost(tripEnd.getLocation(), otherTrip.getLocation()).toMinutes());\n }\n }\n }\n\n // add this nodes in our trips list;\n trips.add(tripStart);\n trips.add(tripEnd);\n }", "private final void constructGraph() {\n losScanner = new LineOfSightScannerDouble(graph);\n queue = new int[11];\n\n queueSize = 0;\n\n // STEP 1: Construct SVG (Strict Visibility Graph)\n \n // Initialise SVG Vertices\n xPositions = new int[11];\n yPositions = new int[11];\n nNodes = 0;\n addNodes();\n \n // Now xPositions and yPositions should be correctly initialised.\n // We then initialise the rest of the node data.\n originalSize = nNodes;\n maxSize = nNodes + 2;\n xPositions = Arrays.copyOf(xPositions, maxSize);\n yPositions = Arrays.copyOf(yPositions, maxSize);\n hasEdgeToGoal = new boolean[maxSize];\n nOutgoingEdgess = new int[maxSize];\n outgoingEdgess = new int[maxSize][];\n outgoingEdgeIndexess = new int[maxSize][];\n outgoingEdgeOppositeIndexess = new int[maxSize][];\n outgoingEdgeIsMarkeds = new boolean[maxSize][];\n for (int i=0;i<maxSize;++i) {\n nOutgoingEdgess[i] = 0;\n outgoingEdgess[i] = new int[11];\n outgoingEdgeIndexess[i] = new int[11];\n outgoingEdgeOppositeIndexess[i] = new int[11];\n outgoingEdgeIsMarkeds[i] = new boolean[11];\n }\n\n // Initialise SVG Edges + edgeWeights\n edgeWeights = new float[11];\n nEdges = 0;\n addAllEdges();\n\n \n // Now all the edges, indexes and weights should be correctly initialise.\n // Now we initialise the rest of the edge data.\n originalNEdges = nEdges;\n int maxPossibleNEdges = nEdges + nNodes*2;\n edgeWeights = Arrays.copyOf(edgeWeights, maxPossibleNEdges);\n edgeLevels = new int[maxPossibleNEdges];\n Arrays.fill(edgeLevels, LEVEL_W);\n isMarked = new boolean[maxPossibleNEdges];\n //Arrays.fill(isMarked, false); // default initialises to false anyway.\n \n \n // Reserve space in level w edge and marked edge arrays.\n nLevelWNeighbourss = new int[maxSize];\n levelWEdgeOutgoingIndexess = new int[maxSize][];\n nMarkedEdgess = new int[maxSize];\n outgoingMarkedEdgeIndexess = new int[maxSize][];\n for (int i=0;i<nNodes;++i) {\n levelWEdgeOutgoingIndexess[i] = new int[nOutgoingEdgess[i]];\n outgoingMarkedEdgeIndexess[i] = new int[nOutgoingEdgess[i]];\n }\n for (int i=nNodes;i<maxSize;++i) {\n levelWEdgeOutgoingIndexess[i] = new int[11];\n outgoingMarkedEdgeIndexess[i] = new int[11];\n }\n\n \n // STEP 2: Label edge levels in SVG.\n computeAllEdgeLevelsFast();\n addLevelWEdgesToLevelWEdgesArray();\n\n nSkipEdgess = new int[maxSize];\n outgoingSkipEdgess = new int[maxSize][];\n outgoingSkipEdgeNextNodess = new int[maxSize][];\n outgoingSkipEdgeNextNodeEdgeIndexess = new int[maxSize][];\n outgoingSkipEdgeWeightss = new float[maxSize][]; \n\n // STEP 3: Initialise the skip-edges & Group together Level-W edges using isMarkedIndex.\n setupSkipEdges();\n \n pruneParallelSkipEdges();\n }", "protected void createTopologyGraph() {\n graph = new TopologyGraph(roots, boundaries);\n\n // check and resolve conflicts about input priorities\n AbstractExecNodeExactlyOnceVisitor inputPriorityVisitor =\n new AbstractExecNodeExactlyOnceVisitor() {\n @Override\n protected void visitNode(ExecNode<?> node) {\n if (!boundaries.contains(node)) {\n visitInputs(node);\n }\n updateTopologyGraph(node);\n }\n };\n roots.forEach(n -> n.accept(inputPriorityVisitor));\n }", "public Graph createGraph() {\n String fileName;\n// fileName =\"./428333.edges\";\n String line;\n Graph g = new Graph();\n// List<String> vertexNames = new ArrayList<>();\n// try\n// {\n// BufferedReader in=new BufferedReader(new FileReader(fileName));\n// line=in.readLine();\n// while (line!=null) {\n////\t\t\t\tSystem.out.println(line);\n// String src = line.split(\" \")[0];\n// String dst = line.split(\" \")[1];\n//// vertexNames.add(src);\n//// vertexNames.add(dst);\n//// System.out.println(src+\" \"+dst);\n// g.addEdge(src, dst, 1);\n// line=in.readLine();\n// }\n// in.close();\n// } catch (Exception e) {\n//\t\t\te.printStackTrace();\n// }\n\n fileName=\"./788813.edges\";\n// List<String> vertexNames = new ArrayList<>();\n try\n {\n BufferedReader in=new BufferedReader(new FileReader(fileName));\n line=in.readLine();\n while (line!=null) {\n//\t\t\t\tSystem.out.println(line);\n String src = line.split(\" \")[0];\n String dst = line.split(\" \")[1];\n g.addEdge(src, dst, 1);\n line=in.readLine();\n }\n in.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n// Graph g = new Graph(new String[]{\"v0\", \"v1\", \"v2\", \"v3\", \"v4\", \"v5\", \"v6\", \"v7\", \"v8\"});\n// // Add the required edges.\n// g.addEdge(\"v0\", \"v1\", 4); g.addEdge(\"v0\", \"v7\", 8);\n// g.addEdge(\"v1\", \"v2\", 8); g.addEdge(\"v1\", \"v7\", 11); g.addEdge(\"v2\", \"v1\", 8);\n// g.addEdge(\"v2\", \"v8\", 2); g.addEdge(\"v2\", \"v5\", 4); g.addEdge(\"v2\", \"v3\", 7);\n// g.addEdge(\"v3\", \"v2\", 7); g.addEdge(\"v3\", \"v5\", 14); g.addEdge(\"v3\", \"v4\", 9);\n// g.addEdge(\"v4\", \"v3\", 9); g.addEdge(\"v4\", \"v5\", 10);\n// g.addEdge(\"v5\", \"v4\", 10); g.addEdge(\"v5\", \"v3\", 9); g.addEdge(\"v5\", \"v2\", 4);\n// g.addEdge(\"v5\", \"v6\", 2);\n// g.addEdge(\"v6\", \"v7\", 1); g.addEdge(\"v6\", \"v8\", 6); g.addEdge(\"v6\", \"v5\", 2);\n// g.addEdge(\"v7\", \"v0\", 8); g.addEdge(\"v7\", \"v8\", 7); g.addEdge(\"v7\", \"v1\", 11);\n// g.addEdge(\"v7\", \"v6\", 1);\n// g.addEdge(\"v8\", \"v2\", 2); g.addEdge(\"v8\", \"v7\", 7); g.addEdge(\"v8\", \"v6\", 6);\n\n//\n return g;\n }", "private void updateSegments(){\n\t\tfor (int i = 0; i < getSegmentCount(); i++) {\n\t\t\tSegment s = segments.get(i);\n\n\t\t\tfor (int j = 0; j < s.getFaceCount(); j++) {\n\t\t\t\tFace f = s.getFace(j);\n\n\t\t\t\tint[] vtIndex = f.getVertexIndices();\n\t\t\t\tint[] nmIndex = f.getNormalIndices();\n\t\t\t\tint[] uvIndex = f.getTextureIndices();\n\n\t\t\t\tf.vertices.clear();\n\t\t\t\tf.normals.clear();\n\t\t\t\tf.uvs.clear();\n\t\t\t\t// three for loops for safety. if there are no normals or\n\t\t\t\t// uv's then nothing will break\n\t\t\t\tfor (int k = 0; k < vtIndex.length; k++)\n\t\t\t\t\tf.vertices.add(modelVertices.get(vtIndex[k]));\n\n\t\t\t\tfor (int k = 0; k < nmIndex.length; k++)\n\t\t\t\t\tf.normals.add(normalVertices.get(nmIndex[k]));\n\n\t\t\t\tif(textureVertices.size() > 0){\n\t\t\t\t\tfor (int k = 0; k < uvIndex.length; k++)\n\t\t\t\t\t\tf.uvs.add(textureVertices.get(uvIndex[k]));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void importGraphUndirective() {\n }", "public void createEdges() {\n \tfor(String key : ways.keySet()) {\n \t Way way = ways.get(key);\n \t if(way.canDrive()) {\n \t\tArrayList<String> refs = way.getRefs();\n \t\t\t\n \t\tif(refs.size() > 0) {\n \t\t GPSNode prev = (GPSNode) this.getNode(refs.get(0));\n \t\t drivableNodes.add(prev);\n \t\t \n \t\t GPSNode curr = null;\n \t\t for(int i = 1; i <refs.size(); i++) {\n \t\t\tcurr = (GPSNode) this.getNode(refs.get(i));\n \t\t\tif(curr == null || prev == null)\n \t\t\t continue;\n \t\t\telse {\n \t\t\t double distance = calcDistance(curr.getLatitude(), curr.getLongitude(),\n \t\t\t\t prev.getLatitude(), prev.getLongitude());\n\n \t\t\t GraphEdge edge = new GraphEdge(prev, curr, distance, way.id);\n \t\t\t prev.addEdge(edge);\n \t\t\t curr.addEdge(edge);\n \t\t\t \n \t\t\t drivableNodes.add(curr);\n \t\t\t prev = curr;\n \t\t\t}\n \t\t }\t\n \t\t}\n \t }\n \t}\n }", "private void fillDataStructures()\n \t{\n \t\tfor (Field field : fields) {\n \t\t\tif (field.object != null) {\n \t\t\t\tObject o = field.object;\n \t\t\t\tif (o instanceof Agent) {\n \t\t\t\t\tagents.add((Agent)o);\n \t\t\t\t\t((Agent) o).td = this;\n \t\t\t\t} else { // Box\n \t\t\t\t\tboxes.add((Box)o);\n \t\t\t\t\t((Box) o).td = this;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t\n \t\t\n \t\t// sort boxes and agents by color\n \t\tfor (int i=0; i<8; i++) {\n \t\t\tboxesByColor.add(new ArrayList<Box>());\n \t\t\tagentsByColor.add(new ArrayList<Agent>());\n \t\t\tgoalsByColor.add(new ArrayList<Goal>());\n \t\t}\n \t\tfor (Box box : boxes) {\n \t\t\tboxesByColor.get(box.color.ordinal()).add(box);\n \t\t}\n \t\tfor (Agent agent : agents) {\n \t\t\tagentsByColor.get(agent.color.ordinal()).add(agent);\n \t\t}\n \t\tfor (Goal goal : goals) {\n \t\t\tgoalsByColor.get(goal.color.ordinal()).add(goal);\n \t\t}\n \n \t\t\n \t\t// sort boxes and goals by ID\n \t\tfor (Box box : boxes) {\n \t\t\tif (boxesByID.get(box.id) == null) {\n \t\t\t\tboxesByID.put(box.id,new ArrayList<Box>());\n \t\t\t}\n \t\t\tboxesByID.get(box.id).add(box);\n \t\t}\n \t\tfor (Goal goal : goals) {\n \t\t\tif (goalsByID.get(goal.id) == null) {\n \t\t\t\tgoalsByID.put(goal.id,new ArrayList<Goal>());\n \t\t\t}\n \t\t\tgoalsByID.get(goal.id).add(goal);\n \t\t}\n \n \t\t\n \t\t// sort boxes and agents by Node\n \t\tfor (Node node : graph) {\n \t\t\tboxesByNode.put(node, new ArrayList<Box>());\n \t\t\tagentsByNode.put(node,new ArrayList<Agent>());\n \t\t}\n \t\tfor (Box box : boxes) {\n \t\t\tNode node = box.atField.node;\n \t\t\tboxesByNode.get(node).add(box);\n \t\t}\n \t\tfor (Agent agent : agents) {\n \t\t\tNode node = agent.atField.node;\n \t\t\tagentsByNode.get(node).add(agent);\n \t\t}\n \t}", "protected void levelUp() {\n\t\tlevel++;\n\t\t// set up floors for next level\n\t\tint[] nextFloors = floors[level];\n\t\tint[] nextFurnishing = furnishings[level];\n\t\tfor(int i = 0; i < nextFloors.length; i++) {\n\t\t\tFloor newFloor = game.getFloorByKey(nextFloors[i]);\n\t\t\ttiles[i].setFloor(newFloor);\n\t\t\tif(nextFurnishing[i] != 0) {\n\t\t\t\tFurnishingDirectory newFurn = game.getFurnishingByKey(nextFurnishing[i]);\n\t\t\t\tnew Furnishing(newFurn, tiles[i]);\n\t\t\t}\n\t\t}\n\t}", "private void populateConnections()\n {\n IndoorVertex elevatorFloor1 = new IndoorVertex(building, new XYPos(1050, 40), 1);\n IndoorVertex stairsFloor1 = new IndoorVertex(building, new XYPos(1056.25, 28.13), 1);\n\n firstFloorStairsElevator.add(stairsFloor1);\n firstFloorStairsElevator.add(elevatorFloor1);\n\n IndoorVertex stairsFloor2 = new IndoorVertex(building, new XYPos(1049.43, 160.49), 2);\n IndoorVertex elevatorFloor2 = new IndoorVertex(building, new XYPos(1044.19, 151.19), 2);\n\n secondFloorStairsElevator.add(stairsFloor2);\n secondFloorStairsElevator.add(elevatorFloor2);\n\n IndoorVertex stairsFloor3 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 3);\n IndoorVertex elevatorFloor3 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 3);\n\n thirdFloorStairsElevator.add(stairsFloor3);\n thirdFloorStairsElevator.add(elevatorFloor3);\n\n IndoorVertex stairsFloor4 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 4);\n IndoorVertex elevatorFloor4 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 4);\n\n fourthFloorStairsElevator.add(stairsFloor4);\n fourthFloorStairsElevator.add(elevatorFloor4);\n\n IndoorVertex stairsFloor5 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 5);\n IndoorVertex elevatorFloor5 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 5);\n\n firstFloorStairsElevator.add(stairsFloor5);\n fifthFloorStairsElevator.add(elevatorFloor5);\n\n //Stair connections to one another\n connectVertex(stairsFloor1, stairsFloor2);\n connectVertex(stairsFloor1, stairsFloor3);\n connectVertex(stairsFloor1, stairsFloor4);\n connectVertex(stairsFloor1, stairsFloor5);\n connectVertex(stairsFloor2, stairsFloor3);\n connectVertex(stairsFloor2, stairsFloor4);\n connectVertex(stairsFloor2, stairsFloor5);\n connectVertex(stairsFloor3, stairsFloor4);\n connectVertex(stairsFloor3, stairsFloor5);\n connectVertex(stairsFloor4, stairsFloor5);\n\n //Elevator connections to one another\n connectVertex(elevatorFloor1, elevatorFloor2);\n connectVertex(elevatorFloor1, elevatorFloor3);\n connectVertex(elevatorFloor1, elevatorFloor4);\n connectVertex(elevatorFloor1, elevatorFloor5);\n connectVertex(elevatorFloor2, elevatorFloor3);\n connectVertex(elevatorFloor2, elevatorFloor4);\n connectVertex(elevatorFloor2, elevatorFloor5);\n connectVertex(elevatorFloor3, elevatorFloor4);\n connectVertex(elevatorFloor3, elevatorFloor5);\n connectVertex(elevatorFloor4, elevatorFloor5);\n\n //Creation of each floors connections\n createFloor1Connections(stairsFloor1, elevatorFloor1);\n createFloor2Connections(stairsFloor2, elevatorFloor2);\n createFloor3Connections(stairsFloor3, elevatorFloor3);\n createFloor4Connections(stairsFloor4, elevatorFloor4);\n createFloor5Connections(stairsFloor5, elevatorFloor5);\n }", "private final void setupLocal() {\n _topLocal = true;\n // Check for global vs local work\n if( _nlo >= 0 && _nlo < _nhi-1 ) { // Have global work?\n // Note: some top-level calls have no other global work, so\n // \"topLocal==true\" does not imply \"nlo < nhi-1\".\n int selfidx = H2O.SELF.index();\n if( _nlo < selfidx ) _nleft = remote_compute(_nlo, selfidx );\n if( selfidx+1 < _nhi ) _nrite = remote_compute(selfidx+1,_nhi);\n }\n _lo = 0; _hi = _fr.firstReadable().nChunks(); // Do All Chunks\n // If we have any output vectors, make a blockable Futures for them to\n // block on.\n if( _fr.hasAppendables() )\n _fs = new Futures();\n init(); // Setup any user's shared local structures\n }", "private final void postLocal() {\n reduce3(_nleft); // Reduce global results from neighbors.\n reduce3(_nrite);\n _profile._remoteBlkDone = System.currentTimeMillis();\n _fs.blockForPending();\n _profile._localBlkDone = System.currentTimeMillis();\n // Finally, must return all results in 'this' because that is the API -\n // what the user expects\n int nlo = subShift(H2O.SELF.index());\n int nhi = _nhi; // Save before copyOver crushes them\n if( _res == null ) _nhi=-1; // Flag for no local results *at all*\n else if( _res != this ) { // There is a local result, and its not self\n _res._profile = _profile; // Use my profile (not childs)\n copyOver(_res); // So copy into self\n }\n closeLocal();\n if( nlo==0 && nhi == H2O.CLOUD.size() ) {\n // Do any post-writing work (zap rollup fields, etc)\n _fr.reloadVecs();\n for( int i=0; i<_fr.numCols(); i++ )\n _fr.vecs()[i].postWrite();\n postGlobal();\n }\n }", "private void setUpRelations() {\n g[0].getAuthorities().add(a[0]);\n g[1].getAuthorities().add(a[0]);\n g[1].getAuthorities().add(a[1]);\n g[2].getAuthorities().add(a[2]);\n\n u[0].getGroups().add(g[0]);\n u[0].getOwnAuthorities().add(a[2]);\n u[1].getGroups().add(g[1]);\n u[1].getOwnAuthorities().add(a[2]);\n u[2].getOwnAuthorities().add(a[2]);\n u[2].getOwnAuthorities().add(a[3]);\n u[3].getGroups().add(g[1]);\n u[3].getGroups().add(g[2]);\n merge();\n }", "protected void merge(FlowGraph graph){\r\n for(FlowGraphNode node : this.from){\r\n node.addTo(graph.start);\r\n node.to.remove(this);\r\n }\r\n for(FlowGraphNode node : this.to){\r\n graph.end.addTo(node);\r\n node.from.remove(this);\r\n }\r\n }", "void reorganizeTriples(ProgressListener listener);", "public void update(HashMap um) {\n if (TRACE_INTRA) out.println(\"Updating edges for node \"+this.toString_long());\n Map m = this.predecessors;\n if (m != null) {\n this.predecessors = new LinkedHashMap();\n updateMap(um, m.entrySet().iterator(), this.predecessors);\n }\n m = this.addedEdges;\n if (m != null) {\n this.addedEdges = new LinkedHashMap();\n updateMap(um, m.entrySet().iterator(), this.addedEdges);\n }\n m = this.accessPathEdges;\n if (m != null) {\n this.accessPathEdges = new LinkedHashMap();\n updateMap(um, m.entrySet().iterator(), this.accessPathEdges);\n }\n if (this.passedParameters != null) {\n Set pp = SortedArraySet.FACTORY.makeSet(HashCodeComparator.INSTANCE);\n pp.addAll(this.passedParameters);\n this.passedParameters = pp;\n }\n addGlobalEdges(this);\n }", "private Pair<Track,Pair<List<LCRelation>,List<HelicalTrackHit>>> fitNewTrack(Track track, TrackerHit hitL1, List<LCRelation> helicalTrackHitToStripHitRelations){\n String[] strategyResources = new String[4];\n strategyResources[0] = \"/org/hps/recon/tracking/strategies/HPS_s345_c2_e16.xml\";\n strategyResources[1] = \"/org/hps/recon/tracking/strategies/HPS_s456_c3_e21.xml\";\n strategyResources[2] = \"/org/hps/recon/tracking/strategies/HPS_s123_c4_e56.xml\";\n strategyResources[3] = \"/org/hps/recon/tracking/strategies/HPS_s123_c5_e46.xml\";\n \n List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromInputStream(this.getClass().getResourceAsStream(strategyResources[0]));\n List<LCRelation> hthToStripHitRefitList = new ArrayList<LCRelation>();\n List<HelicalTrackHit> helicalHits = new ArrayList<HelicalTrackHit>();\n\n HelicalTrackStrip strip1 = null;\n HelicalTrackStrip strip2 = null;\n TrackerHit hit1 = null;\n TrackerHit hit2 = null;\n HelicalTrackHit hth = null;\n \n //Build the HelicalTrackStrip for the first layer refit\n for(LCRelation rel:helicalTrackHitToStripHitRelations){\n if(((TrackerHit) rel.getFrom()).equals(hitL1)){\n HelicalTrackStrip strip = makeDigiStrip(new SiTrackerHitStrip1D((TrackerHit) rel.getTo()));\n if(strip1 == null){\n strip1 = strip;\n hit1 = (TrackerHit) rel.getTo();\n }\n else{\n strip2 = strip;\n hit2 = (TrackerHit) rel.getTo();\n break;\n }\n }\n }\n \n //Build the HelicalTrackHit for the first layer refit\n if(strip1 != null && strip2 != null){\n HelicalTrackCross trackCross = new HelicalTrackCross(strip1,strip2);\n hth = (HelicalTrackHit) trackCross;\n helicalHits.add(hth);\n }\n \n List<TrackerHit> hits = track.getTrackerHits();\n \n //Build the HelicalTrackStrips for the remaining layers\n for(TrackerHit hit:hits){\n if(hit.equals(hits.get(0))){\n hthToStripHitRefitList.add(new BaseLCRelation(hth,hit1));\n hthToStripHitRefitList.add(new BaseLCRelation(hth,hit2));\n continue;\n }\n strip1 = null;\n strip2 = null;\n for(LCRelation rel:helicalTrackHitToStripHitRelations){\n if(checkSameHit((TrackerHit) rel.getFrom(),hit)){\n HelicalTrackStrip strip = makeDigiStrip(new SiTrackerHitStrip1D((TrackerHit) rel.getTo()));\n if(strip1 == null){\n strip1 = strip;\n hit1 = (TrackerHit) rel.getTo();\n }\n else{\n strip2 = strip;\n hit2 = (TrackerHit) rel.getTo();\n break;\n }\n }\n }\n //Build the HelicalTrackHit for the remaining layers\n if(strip1 != null && strip2 != null){\n HelicalTrackCross trackCross = new HelicalTrackCross(strip1,strip2);\n hth = (HelicalTrackHit) trackCross;\n helicalHits.add(hth);\n hthToStripHitRefitList.add(new BaseLCRelation(hth,hit1));\n hthToStripHitRefitList.add(new BaseLCRelation(hth,hit2));\n }\n }\n \n SeedCandidate trackseed = new SeedCandidate(helicalHits, sFinallist.get(0), TrackUtils.getHTF(track.getTrackStates().get(0)), bfield);\n \n // Initialize the reference point to the origin\n double[] ref = new double[] {0., 0., 0.};\n \n // Create a new SeedTrack (SeedTrack extends BaseTrack)\n SeedTrack trk = new SeedTrack();\n \n // Add the hits to the track\n for (HelicalTrackHit hit : trackseed.getHits()) {\n trk.addHit((TrackerHit) hit);\n }\n \n // Retrieve the helix and save the relevant bits of helix info\n HelicalTrackFit helix = trackseed.getHelix();\n trk.setTrackParameters(helix.parameters(), bfield); // Sets first TrackState.\n trk.setCovarianceMatrix(helix.covariance()); // Modifies first TrackState.\n trk.setChisq(helix.chisqtot());\n trk.setNDF(helix.ndf()[0]+helix.ndf()[1]);\n \n // Flag that the fit was successful and set the reference point\n trk.setFitSuccess(true);\n trk.setReferencePoint(ref); // Modifies first TrackState.\n trk.setRefPointIsDCA(true);\n \n // Set the strategy used to find this track\n trk.setStratetgy(trackseed.getSeedStrategy());\n \n // Set the SeedCandidate this track is based on\n trk.setSeedCandidate(trackseed);\n \n return new Pair<>((Track) trk,new Pair<>(hthToStripHitRefitList,helicalHits));\n }", "public interface ProgramDependenceGraph extends MutableEdgeLabelledDirectedGraph {\n\n\t/**\n\t * @return A List of weak regions, generated by RegionAnalysis for the corresponding\n\t * control flow graph (These are Regions and not PDGRegions.)\n\t */\n\tpublic List<Region> getWeakRegions();\n\t/**\n\t * @return A List of strong regions, generated when constructing the program dependence graph\n\t * (These are Regions and not PDGRegions.)\n\t */\n\tpublic List<Region> getStrongRegions();\n\t/**\n\t * This method returns the list of PDGRegions computed by the construction method.\n\t * @return The list of PDGRegions\n\t */\n\tpublic List<PDGRegion> getPDGRegions();\n\t/**\n\t * @return The root region of the PDG.\n\t */\n\tpublic IRegion GetStartRegion();\n\n\t/**\n\t * @return The root node of the PDG, which is essentially the same as the start region\n\t * but packaged in its PDGNode, which can be used to traverse the graph, etc.\n\t */\n\tpublic PDGNode GetStartNode();\n\n\t/**\n\t * This method determines if node1 is control-dependent on node2 in this PDG.\n\t * @param node1\n\t * @param node2\n\t * @return returns true if node1 is dependent on node2\n\t */\n\tpublic boolean dependentOn(PDGNode node1, PDGNode node2);\n\t/**\n\t * This method returns the list of all dependents of a node in the PDG.\n\t * @param node is the PDG node whose dependents are desired.\n\t * @return a list of dependent nodes\n\t */\n\t@SuppressWarnings(\"unchecked\")\n\tpublic List getDependents(PDGNode node);\n\n\n\t/**\n\t * This method returns the PDGNode in the PDG corresponding to the given\n\t * CFG node. Note that currently the CFG node has to be a Block.\n\t * @param cfgNode is expected to be a node in CFG (currently only Block).\n\t * @return The node in PDG corresponding to cfgNode.\n\t */\n\n\tpublic PDGNode getPDGNode(Object cfgNode);\n\n\t/**\n\t *\n\t * @return A human readable description of the PDG.\n\t */\n\tpublic String toString();\n\n}", "private void addIncomingEdges(Vertex v, Vertex obstacle, Set<Edge> result, Vector<Vertex> newVertexes) {\n \t// Vertexes in the top layer have no incoming edges\n \tif (v.getLayerID() == 0)\n \t\treturn;\n \t\n \t// Fetch the edges from the layer above\n \tint edgeLayerID = v.getLayerID() - 1;\n \tVector<Edge> es = edges.get(edgeLayerID);\n \t\n \tfor (Edge e : es) {\n \t\t// Finds an incoming edge of v\n \t\tif (e.getTail().equals(v.getLabel())) {\n \t\t\tVertex tmp = new Vertex(edgeLayerID, e.getHead());\n \t\t\t// If the incoming edge does not come from obstacle, add the edge and its head\n \t\t\tif (!tmp.theSameAs(obstacle)) {\n \t\t\t\tresult.add(e);\n \t\t\t\tnewVertexes.add(tmp);\n \t\t\t\t//System.out.println(\"TEMP is added: layerID:\" + tmp.layerID + \"\\tlabel:\" + tmp.label);\n \t\t\t}\n \t\t}\n \t}\t\n }", "protected void addEdges(IWeightedGraph<GraphNode, WeightedEdge> graph) {\r\n\t\tQueue<GraphNode> nodesToWorkOn = new LinkedList<GraphNode>();\r\n\r\n\t\taddDefaultEdges(graph, nodesToWorkOn);\r\n\r\n\t\t// Check each already connected once node against all other nodes to\r\n\t\t// find a possible match between the combined effects of the path + the\r\n\t\t// worldState and the preconditions of the current node.\r\n\t\twhile (!nodesToWorkOn.isEmpty()) {\r\n\t\t\tGraphNode node = nodesToWorkOn.poll();\r\n\r\n\t\t\t// Select only node to which a path can be created (-> targets!)\r\n\t\t\tif (!node.equals(this.startNode) && !this.endNodes.contains(node)) {\r\n\t\t\t\ttryToConnectNode(graph, node, nodesToWorkOn);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void createGraph() {\n System.out.println(\"The overlay graph will be created from scratch\");\n graph = new MatrixOverlayGraph();\n parse(dumpPath);\n saveGraph();\n graph.createSupporters(kdTreeSupporterActived);\n saveSupporters();\n }", "private PlainGraph mergeGraphsInternal(PlainGraph g1, PlainGraph g2) {\n // Create all nodes of g2 in g1\n // AddNode does check if the node does exist already, if so it doesn't create a new one\n for (Map.Entry<String, PlainNode> entry: graphNodeMap.get(g2).entrySet()){\n addNode(g1, entry.getKey(), null);\n }\n\n // create all edges of g2 in g1\n for (PlainEdge edge: g2.edgeSet()) {\n // check if the edge exists in g1, if so check if the variable names of the source and the target are also the same and not just the node names\n // Since the node names are numbered in each graph starting with 0, collisions could exists without the 2nd and 3rd check\n // Inverse the whole such that if this edge doesn't exist create it in g1\n if (! (g1.containsEdge(edge) && getVarName(g2, edge.source()).equals(getVarName(g1, edge.source())) && getVarName(g2, edge.target()).equals(getVarName(g1, edge.target())))) {\n addEdge(g1, getVarName(g2, edge.source()), edge.label().text(), getVarName(g2, edge.target()));\n }\n }\n return g1;\n }", "private void createEdges() throws IOException {\r\n\t\tString line;\r\n\t\tString fromVertex=null;\r\n\t\tString toVertex=null;\r\n\t\twhile((line=next(1))!=null) {\r\n\t\t\tif(line.startsWith(\"[\"))\r\n\t\t\t\t{\r\n\t\t\t\tthis.buffer=line;\r\n\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\tint colon=line.indexOf(':');\r\n\t\t\tif(colon==-1) continue;\r\n\t\t\tif(line.startsWith(\"id:\"))\r\n\t\t\t\t{\r\n\t\t\t\ttoVertex= line.substring(colon+1).trim();\r\n\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\tif(line.startsWith(\"is_a:\"))\r\n\t\t\t\t{\r\n\t\t\t\tfromVertex = nocomment(line.substring(colon+1));\r\n\t\t\t\t//System.out.println(fromVertex+\" to be connected to: \"+toVertex);\r\n\t\t\t\tTerm fromNode = terms.get(fromVertex);\r\n\t\t\t\tTerm toNode = terms.get(toVertex);\r\n\t\t\t\tif (fromNode.namespace.equals(\"molecular_function\") && toNode.namespace.equals(\"molecular_function\")){\r\n\t\t\t\t\tdagMF.addEdge(fromNode, toNode);\r\n\t\t\t\t}\r\n\t\t\t\telse if (fromNode.namespace.equals(\"biological_process\") && toNode.namespace.equals(\"biological_process\")){\r\n\t\t\t\t\tdagBP.addEdge(fromNode, toNode);\r\n\t\t\t\t} \r\n\t\t\t\telse if (fromNode.namespace.equals(\"cellular_component\") && toNode.namespace.equals(\"cellular_component\")){\r\n\t\t\t\t\tdagCC.addEdge(fromNode, toNode);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tSystem.out.println(\"FAILED TO ADD TO DAG, not belonging to the same NAMESPACE\");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t}\r\n\t}", "private void processUnprocessed()\n {\n List<Geometry> unprocAdds;\n myUnprocessedGeometryLock.lock();\n try\n {\n // Processing the unprocessed geometries may result in them being\n // added back to one of the unprocessed maps, so create a clean set\n // of maps for them to be added to.\n if (myUnprocessedAdds.isEmpty())\n {\n unprocAdds = null;\n }\n else\n {\n unprocAdds = myUnprocessedAdds;\n myUnprocessedAdds = New.list();\n }\n }\n finally\n {\n myUnprocessedGeometryLock.unlock();\n }\n\n if (unprocAdds != null)\n {\n distributeGeometries(unprocAdds, Collections.<Geometry>emptyList());\n }\n }", "void addEdges(Collection<ExpLineageEdge> edges);", "public void setupPortrayals()\n {\n edgePortrayal.setField(new SpatialNetwork2D(((ACOSim)state).environment, \n\t\t\t\t\t\t((ACOSim)state).network));\n\n SimpleEdgePortrayal2D p = new SimpleEdgePortrayal2D(Color.lightGray, \n\t\t\t\t\t\t\tColor.lightGray, \n\t\t\t\t\t\t\tColor.black);\n p.setShape(SimpleEdgePortrayal2D.SHAPE_LINE);\n edgePortrayal.setPortrayalForAll(p);\n nodePortrayal.setField(((ACOSim)state).environment);\n\n // reschedule the displayer\n display.reset();\n display.setBackdrop(Color.white);\n\n // redraw the display\n display.repaint();\n }", "private List<Vertex> prepareGraphAdjacencyList() {\n\n\t\tList<Vertex> graph = new ArrayList<Vertex>();\n\t\tVertex vertexA = new Vertex(\"A\");\n\t\tVertex vertexB = new Vertex(\"B\");\n\t\tVertex vertexC = new Vertex(\"C\");\n\t\tVertex vertexD = new Vertex(\"D\");\n\t\tVertex vertexE = new Vertex(\"E\");\n\t\tVertex vertexF = new Vertex(\"F\");\n\t\tVertex vertexG = new Vertex(\"G\");\n\n\t\tList<Edge> edges = new ArrayList<Edge>();\n\t\tedges.add(new Edge(vertexB, 2));\n\t\tedges.add(new Edge(vertexD, 6));\n\t\tedges.add(new Edge(vertexF, 5));\n\t\tvertexA.incidentEdges = edges;\n\n\t\tedges = new ArrayList<Edge>();\n\t\tedges.add(new Edge(vertexA, 2));\n\t\tedges.add(new Edge(vertexC, 7));\n\t\tvertexB.incidentEdges = edges;\n\n\t\tedges = new ArrayList<Edge>();\n\t\tedges.add(new Edge(vertexB, 7));\n\t\tedges.add(new Edge(vertexD, 9));\n\t\tedges.add(new Edge(vertexF, 1));\n\t\tvertexC.incidentEdges = edges;\n\n\t\tedges = new ArrayList<Edge>();\n\t\tedges.add(new Edge(vertexA, 6));\n\t\tedges.add(new Edge(vertexC, 9));\n\t\tedges.add(new Edge(vertexE, 4));\n\t\tedges.add(new Edge(vertexG, 8));\n\t\tvertexD.incidentEdges = edges;\n\n\t\tedges = new ArrayList<Edge>();\n\t\tedges.add(new Edge(vertexD, 4));\n\t\tedges.add(new Edge(vertexF, 3));\n\t\tvertexE.incidentEdges = edges;\n\n\t\tedges = new ArrayList<Edge>();\n\t\tedges.add(new Edge(vertexA, 5));\n\t\tedges.add(new Edge(vertexC, 1));\n\t\tedges.add(new Edge(vertexE, 3));\n\t\tvertexF.incidentEdges = edges;\n\n\t\tedges = new ArrayList<Edge>();\n\t\tedges.add(new Edge(vertexD, 8));\n\t\tvertexG.incidentEdges = edges;\n\n\t\tgraph.add(vertexA);\n\t\tgraph.add(vertexB);\n\t\tgraph.add(vertexC);\n\t\tgraph.add(vertexD);\n\t\tgraph.add(vertexE);\n\t\tgraph.add(vertexF);\n\t\tgraph.add(vertexG);\n\n\t\treturn graph;\n\t}", "void topologicalSort() {\n\n\t\tfor (SimpleVertex vertice : allvertices) {\n\n\t\t\tif (vertice.isVisited == false) {\n\t\t\t\tlistset.add(vertice.Vertexname);\n\t\t\t\ttopologicalSortUtil(vertice);\n\n\t\t\t}\n\t\t}\n\n\t}", "public HashMap<Integer, Integer> findAugumentPath() {\n if (debug == 1) printFree();\n HashMap<Integer, Integer> Path = new HashMap<>();\n if (V1.isEmpty() || V2.isEmpty()) {\n if (debug == 1) System.out.println(\"V1||V2 is empty\");\n return Path;\n }\n\n GM.clearAllEdge();\n for (int i = 0; i < x.length; i++) {\n for (int j : x[i].getDomain()) {\n GM.addEdge(i, Map.get(j));\n }\n }\n GM.adjList[X].clear();\n for (int i : V1) {\n GM.addEdge(X, i);\n }\n for (int i = 0; i < x.length; i++) {\n if (MaxMatch[i] != 0) GM.addEdge(MaxMatch[i], i);\n }\n if (debug == 1) System.out.println(GM);\n\n // DFS từ X. Gặp 1 đỉnh thuộc V2 thì break\n boolean[] visited = new boolean[nbOfVertex + 10];\n int[] prev = new int[nbOfVertex + 10];\n prev[X] = -1;\n int last = -1;\n\n Stack<Integer> S = new Stack<>();\n S.push(X);\n while (!S.isEmpty() && last == -1) {\n int top = S.pop();\n //System.out.println(\"Popped \" + top);\n if (!visited[top]) {\n visited[top] = true;\n for (int next : GM.adjList[top])\n if (!visited[next]) {\n prev[next] = top;\n if (V2.contains(next)) {\n last = next;\n //System.out.println(\"Here \" + next);\n break;\n }\n S.push(next);\n //System.out.println(\"Pushed \" + next);\n }\n }\n }\n if (last == -1) {\n //System.out.println(\"Cant find any augument path\\n\");\n } else {\n //System.out.println(\"Constructing augument path\");\n //int step = 0;\n while (last != -1) {\n int from = prev[last];\n if (from == X) break;\n Path.put(from, last);\n ////System.out.println(Math.min(from, last) + \" --> \" + Math.max(from, last));\n last = from;\n //step++;\n //if(step>10) break;\n }\n if (debug == 1) System.out.println(\"Construct augument path completed \" + Path.size());\n if (debug == 1) printCurrentAugumentPath(Path);\n }\n //System.out.println(Path.size());\n return Path;\n }", "private void postLocal() {\n reduce3(_nleft); // Reduce global results from neighbors.\n reduce3(_nrite);\n if( _fs != null ) // Block on all other pending tasks, also\n _fs.blockForPending();\n // Finally, must return all results in 'this' because that is the API -\n // what the user expects\n int nlo = _nlo, nhi = _nhi; // Save these before copyOver crushes them\n if( _res == null ) _nlo = -1; // Flag for no local results *at all*\n else if( _res != this ) // There is a local result, and its not self\n copyOver(_res); // So copy into self\n if( nlo==0 && nhi == H2O.CLOUD.size() ) // All-done on head of whole MRTask tree?\n _fr.closeAppendables(); // Final close ops on any new appendable vec\n }", "protected void addVertices(IWeightedGraph<GraphNode, WeightedEdge> graph, List<GoapState> goalState) {\r\n\t\t// The effects from the world state as well as the precondition of each\r\n\t\t// goal have to be set at the beginning, since these are the effects the\r\n\t\t// unit tries to archive with its actions. Also the startNode has to\r\n\t\t// overwrite the existing GraphNode as an initialization of a new Object\r\n\t\t// would not be reflected to the function caller.\r\n\t\tGraphNode start = new GraphNode(null, this.goapUnit.getWorldState());\r\n\t\tthis.startNode.overwriteOwnProperties(start);\r\n\t\tgraph.addVertex(this.startNode);\r\n\r\n\t\tfor (GoapState state : goalState) {\r\n\t\t\tHashSet<GoapState> goalStateHash = new HashSet<GoapState>();\r\n\t\t\tgoalStateHash.add(state);\r\n\r\n\t\t\tGraphNode end = new GraphNode(goalStateHash, null);\r\n\t\t\tgraph.addVertex(end);\r\n\t\t\tthis.endNodes.add(end);\r\n\t\t}\r\n\r\n\t\tHashSet<GoapAction> possibleActions = extractPossibleActions();\r\n\r\n\t\t// Afterward all other possible actions have to be added as well.\r\n\t\tif (possibleActions != null) {\r\n\t\t\tfor (GoapAction goapAction : possibleActions) {\r\n\t\t\t\tgraph.addVertex(new GraphNode(goapAction));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws IOException {\n File file = new File(args[0]);\r\n //FileOutputStream f = new FileOutputStream(\"prat_dfs_data2.txt\");\r\n //System.setOut(new PrintStream(f));\r\n BufferedReader reader = new BufferedReader(new FileReader(file));\r\n String line;\r\n line = reader.readLine();\r\n int nodecount = 0;\r\n HashMap <String , Integer> nodeMap = new HashMap <String , Integer>(); \r\n while ((line = reader.readLine()) != null ) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n if (!nodeMap.containsKey(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"))){\r\n nodeMap.put(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"), nodecount);\r\n nodecount++;\r\n }\r\n }\r\n reader.close();\r\n Vertex adjList[] = new Vertex[nodecount];\r\n Vertex sortVer[] = new Vertex[nodecount];\r\n for(int it = 0; it < nodecount; it++){\r\n adjList[it] = new Vertex(it);\r\n }\r\n nodeMap.forEach((k, v) -> adjList[v].val = k);\r\n File file2 = new File(args[1]);\r\n BufferedReader reader2 = new BufferedReader(new FileReader(file2));\r\n line = reader2.readLine();\r\n while ((line = reader2.readLine()) !=null) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n String source = data[0].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n String target = data[1].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n\r\n int weight = Integer.parseInt(data[2]);\r\n Vertex current = adjList[nodeMap.get(source)];\r\n Vertex newbie = new Vertex(nodeMap.get(target));\r\n current.countN++;\r\n current.co_occur += weight;\r\n if (adjList[nodeMap.get(source)].next == null){\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n else{\r\n current.next.prev = newbie;\r\n newbie.next = current.next;\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n Vertex current1 = adjList[nodeMap.get(target)];\r\n Vertex newbie1 = new Vertex(nodeMap.get(source));\r\n current1.co_occur += weight;\r\n current1.countN++;\r\n if (current1.next == null){\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n else{\r\n current1.next.prev = newbie1;\r\n newbie1.next = current1.next;\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n }\r\n reader2.close();\r\n \r\n for(int it = 0; it < nodecount; it++){\r\n sortVer[it] = new Vertex(adjList[it].id);\r\n sortVer[it].val = adjList[it].val;\r\n sortVer[it].co_occur = adjList[it].co_occur;\r\n }\r\n if (args[2].equals(\"average\")){\r\n double countdeg = 0;\r\n for(int it = 0; it<nodecount; it++){\r\n countdeg+= (double) adjList[it].countN;\r\n }\r\n countdeg = countdeg / (double) (nodecount);\r\n System.out.printf(\"%.2f\", countdeg);\r\n System.out.println();\r\n //long toc= System.nanoTime();\r\n //System.out.println((toc- startTime)/1000000000.0);\r\n }\r\n \r\n if(args[2].equals(\"rank\")){\r\n Graph.mergesort(sortVer, 0, nodecount-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n System.out.print(sortVer[0].val);\r\n for(int kk=1; kk<nodecount; kk++){\r\n System.out.print(\",\" + sortVer[kk].val.toString());\r\n }\r\n System.out.println();\r\n }\r\n if(args[2].equals(\"independent_storylines_dfs\")){\r\n boolean visited[] = new boolean[nodecount];\r\n int ind = 0;\r\n ArrayList<ArrayList<Vertex>> comps = new ArrayList<ArrayList<Vertex>>();\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n visited[it1] = false;\r\n }\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n if (visited[it1] == false){\r\n ArrayList<Vertex> temp = new ArrayList<Vertex>();\r\n Graph.dfs(it1, visited, ind, adjList, temp);\r\n ind++;\r\n Graph.mergesort2(temp, 0, temp.size()-1);\r\n comps.add(temp);\r\n }\r\n }\r\n Graph.mergesort3(comps, 0, comps.size()-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n for(int a1 = 0; a1 < ind; a1++){\r\n System.out.print(comps.get(a1).get(0).val);\r\n for(int j1 = 1; j1<comps.get(a1).size(); j1++){\r\n System.out.print(\",\" + comps.get(a1).get(j1).val);\r\n }\r\n System.out.println();\r\n }\r\n }\r\n }", "public void topologicalSort() {\n\t\tboolean[] visited = new boolean[edges.length];\n\n\t\tfor (int i = 0; i < visited.length; i++) {\n\t\t\tif (visited[i] == false) {\n\t\t\t\tdfs(i, visited);\n\t\t\t}\n\t\t}\n\n\t}", "private void processData(\n ApplicationEntranceTopologyQueryRequest request,\n LinkTopologyDTO applicationEntrancesTopology,\n ApplicationEntranceTopologyResponse applicationEntranceTopologyResponse) {\n Map<String, LinkNodeDTO> nodeMap = Maps.newHashMap();\n /* key:nodeId ,value: 访问到node的边 */\n Map<String, List<LinkEdgeDTO>> providerEdgeMap = Maps.newHashMap();\n /* key:nodeId ,value: 从node开始的边 */\n Map<String, List<LinkEdgeDTO>> callEdgeMap = Maps.newHashMap();\n /* key:applicationName ,value: managerName */\n Map<String, String> managerMap = Maps.newHashMap();\n /* key:applicationName ,value: 应用实例节点 */\n Map<String, List<ApplicationNodeDTO>> appNodeMap = Maps.newHashMap();\n\n // nodes\n List<LinkNodeDTO> nodes = applicationEntrancesTopology.getNodes();\n if (CollectionUtils.isNotEmpty(nodes)) {\n nodeMap = nodes.stream().collect(Collectors.toMap(LinkNodeDTO::getNodeId, self -> self));\n managerMap = this.getManagers(nodes);\n appNodeMap = this.getAppNodes(nodes);\n }\n\n // edges\n List<LinkEdgeDTO> edges = applicationEntrancesTopology.getEdges();\n if (CollectionUtils.isNotEmpty(edges)) {\n providerEdgeMap = edges.stream().collect(Collectors.groupingBy(LinkEdgeDTO::getTargetId));\n callEdgeMap = edges.stream().collect(Collectors.groupingBy(LinkEdgeDTO::getSourceId));\n }\n\n // 节点转换\n applicationEntranceTopologyResponse.setNodes(this.convertNodes(applicationEntrancesTopology, nodeMap,\n providerEdgeMap, callEdgeMap, managerMap, appNodeMap));\n // 边 转换\n applicationEntranceTopologyResponse.setEdges(this.convertEdges(applicationEntrancesTopology, nodeMap,\n providerEdgeMap, callEdgeMap, request, applicationEntranceTopologyResponse));\n\n // 异常转换\n applicationEntranceTopologyResponse.setExceptions(\n this.getExceptionsFromNodes(applicationEntranceTopologyResponse.getNodes()));\n }", "private void assignPairingStatus(ArrayList p_segment)\n {\n ArrayList tags = new ArrayList(p_segment);\n Object o1, o2;\n int i_start, i_end, i_max;\n int i_level, i_partner = 1;\n HtmlObjects.Tag t_start, t_tag;\n HtmlObjects.EndTag t_end;\n HtmlObjects.CFTag t_CFstart, t_CFtag;\n\n i_start = 0;\n i_max = tags.size();\n outer: while (i_start < i_max)\n {\n o1 = tags.get(i_start);\n\n if (o1 instanceof HtmlObjects.Tag)\n {\n t_start = (HtmlObjects.Tag) o1;\n\n // don't consider tags that are already closed (<BR/>)\n if (t_start.isClosed)\n {\n tags.remove(i_start);\n --i_max;\n continue outer;\n }\n\n // handle recursive tags\n i_level = 0;\n\n // see if the current opening tag has a closing tag\n for (i_end = i_start + 1; i_end < i_max; ++i_end)\n {\n o2 = tags.get(i_end);\n\n if (o2 instanceof HtmlObjects.Tag)\n {\n t_tag = (HtmlObjects.Tag) o2;\n\n if (t_start.tag.equalsIgnoreCase(t_tag.tag))\n {\n ++i_level;\n continue;\n }\n }\n else if (o2 instanceof HtmlObjects.EndTag)\n {\n t_end = (HtmlObjects.EndTag) o2;\n\n if (t_start.tag.equalsIgnoreCase(t_end.tag))\n {\n if (i_level > 0)\n {\n --i_level;\n continue;\n }\n\n // found a matching buddy in this segment\n t_start.isPaired = t_end.isPaired = true;\n t_start.partnerId = t_end.partnerId = i_partner;\n i_partner++;\n tags.remove(i_end);\n tags.remove(i_start);\n i_max -= 2;\n continue outer;\n }\n }\n }\n\n // done with this tag, don't consider again\n tags.remove(i_start);\n --i_max;\n continue outer;\n }\n else if (o1 instanceof HtmlObjects.CFTag)\n {\n t_CFstart = (HtmlObjects.CFTag) o1;\n\n // don't consider tags that are already closed (<BR/>)\n if (t_CFstart.isClosed)\n {\n tags.remove(i_start);\n --i_max;\n continue outer;\n }\n\n // handle recursive tags\n i_level = 0;\n\n // see if the current opening tag has a closing tag\n for (i_end = i_start + 1; i_end < i_max; ++i_end)\n {\n o2 = tags.get(i_end);\n\n if (o2 instanceof HtmlObjects.CFTag)\n {\n t_CFtag = (HtmlObjects.CFTag) o2;\n\n if (t_CFstart.tag.equalsIgnoreCase(t_CFtag.tag))\n {\n ++i_level;\n continue;\n }\n }\n else if (o2 instanceof HtmlObjects.EndTag)\n {\n t_end = (HtmlObjects.EndTag) o2;\n\n if (t_CFstart.tag.equalsIgnoreCase(t_end.tag))\n {\n if (i_level > 0)\n {\n --i_level;\n continue;\n }\n\n // found a matching buddy in this segment\n t_CFstart.isPaired = t_end.isPaired = true;\n t_CFstart.partnerId = t_end.partnerId = i_partner;\n i_partner++;\n tags.remove(i_end);\n tags.remove(i_start);\n i_max -= 2;\n continue outer;\n }\n }\n }\n\n // done with this tag, don't consider again\n tags.remove(i_start);\n --i_max;\n continue outer;\n }\n else if (!(o1 instanceof HtmlObjects.EndTag))\n {\n // don't consider non-tag tags in the list\n tags.remove(i_start);\n --i_max;\n continue outer;\n }\n\n ++i_start;\n }\n }", "@Override\n public void migrate(OccupiedLocations ols) {\n for (Population pop:ols.copyList()) {\n setCoordinate(pop.getCoordinate());\n\n Population migrating_pop = pop.collectMigrants(getRate());\n if (migrating_pop.getSize() > 0) {\n migrating_pop.setCoordinate(getPicker().pick());\n migrating_pop.setResource(0.0);\n\n // alter *actual* populations\n ols.addOrMix(migrating_pop);\n }\n }\n }", "public static ArrayList<Integer> LBFSviaPartition (Graph<Integer,String> g) {\n\t\t\r\n\t\tArrayList<Integer> LBFS = new ArrayList<Integer>();\r\n\r\n\t\tArrayList<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>();\r\n\r\n\t\tArrayList<Integer> vertexSet = new ArrayList<Integer>(g.getVertices());\r\n\t\t\r\n\t\tArrayList<Integer> sortedDegree = new ArrayList<Integer>();\r\n\t\tsortedDegree = DegreeSort(g,vertexSet);\r\n\t\t\r\n\t\tlist.add(sortedDegree);\t\t\r\n\r\n\t\tSystem.out.print(\"step 1\\n\"+list+\"\\n\");\r\n\t\t\r\n\t\twhile (list.size() > 0) {\r\n\t\t\tArrayList<Integer> pivotSet = list.get(0);\r\n\t\t\t\r\n\t\t\tif (pivotSet.size() > 0) {\r\n\t\t\t\tInteger pivot = pivotSet.get(0);\r\n\r\n\t\t\t\tSystem.out.print(\"pivot = \"+pivot+ \"and list=\\n\"+list+\"\\n\");\r\n\t\t\t\tLBFS.add(pivot);\r\n\t\t\t\tpivotSet.remove(0);\r\n\t\t\t\tSystem.out.print(\"\\n LBFS order so far is \\n\"+LBFS+\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tfor (int i = 0; i<list.size(); i+=1) {\r\n\t\t\t\t\t// since we found a pivot, we will create a new sublist\r\n\t\t\t\t\t// so we increment by 2 to make sure we don't process it on this pass\r\n\t\t\t\t\tif (list.get(i).size()<=1) continue;\r\n\t\t\t\t\tArrayList<Integer> newPartition = new ArrayList<Integer>();\r\n\r\n\t\t\t\t\tfor (int j =0; j<list.get(i).size(); j++) {\r\n\t\t\t\t\r\n\t\t\t\t\t\tif (g.isNeighbor(pivot, list.get(i).get(j))) {\r\n\t\t\t\t\t\t\tnewPartition.add(list.get(i).get(j));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlist.get(i).removeAll(newPartition);\r\n\t\t\t\t\tlist.add(i, newPartition);\r\n\t\t\t\t\ti+=1; // need to do this to skip processing the same set, which has now moved \r\n\t\t\t\t}\r\n\r\n\t\t\t\t// done creating new partitions for the pivot. Now remove pivot.\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t//here, pivotSet is the first set and is empty\r\n\t\t\t\tlist.remove(0);\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\t\t\r\n\t\t//System.out.print(\"LBFS order from partition? :\\n\"+LBFS);\r\n\t\t\t\t\t\r\n\t\treturn LBFS;\t\t\r\n\t\t\r\n\t}", "public void updateOriginal() {\n for (Node node : originalGraph.nodes()) {\n mirrorAttributesToOriginal(node);\n }\n for (Edge edge : originalGraph.edges()) {\n mirrorAttributesToOriginal(directEdgeMap.get(edge));\n }\n }", "private void overlayBubbleSets(GL2 gl) {\n\n\t\tif (isBubbleTextureDirty) {\n\t\t\t// //allPaths\n\t\t\t// System.out.println(\"overlayBubbleSets\");\n\t\t\tthis.bubbleSet.clear();\n\t\t\tthis.alternativeBubbleSet.clear();\n\t\t\tthis.bubbleSet.setPathwayGraph(pathway);\n\t\t\tthis.alternativeBubbleSet.setPathwayGraph(pathway);\n\n\t\t\t// if(selectedPathID>=0)\n\t\t\t// allPathsList.get(allPathsList.size()-1).setSecond(this.selectedPathID);\n\t\t\t// else\n\t\t\t// allPathsList.get(allPathsList.size()-1).setSecond(0);\n\t\t\t// if(allPathsList.size()>0)\n\t\t\t// {\n\n\t\t\tboolean renderAlternatives = false;\n\t\t\tfor (PathSegment pathSegment : pathSegments) {\n\t\t\t\tif (pathSegment.getPathway() == pathway) {\n\t\t\t\t\trenderAlternatives = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!renderAlternatives) {\n\t\t\t\tallPathsList.clear();\n\t\t\t}\n\t\t\tfor (Pair<List<GraphPath<PathwayVertexRep, DefaultEdge>>, Integer> pathsPair : allPathsList) {\n\t\t\t\t// this.bubbleSet.addAllPaths(paths);\n\t\t\t\tList<GraphPath<PathwayVertexRep, DefaultEdge>> paths = pathsPair.getFirst();\n\t\t\t\tthis.alternativeBubbleSet.addAllPaths(paths, pathsPair.getSecond());\n\t\t\t}\n\t\t\t// }\n\t\t\t//\n\t\t\t// System.out.println(\"overlayBubbleSets pathSegments.size\"+pathSegments.size());\n\t\t\t// this.bubbleSet.addPathSegements(pathSegments);\n\t\t\tthis.bubbleSet.addPathSegements(pathSegments);\n\n\t\t\tif (this.highlightVertices) {\n\t\t\t\t((BubbleSet) (bubbleSet.getBubbleSetGLRenderer().setOutline)).setParameter(100, 20, 3, 10.0, 7.0, 0.5,\n\t\t\t\t\t\t2.5, 15.0, 8);\n\t\t\t} else {\n\t\t\t\t// this.bubbleSet.addPathSegements(pathSegments);\n\t\t\t\t((BubbleSet) (bubbleSet.getBubbleSetGLRenderer().setOutline)).setParameter(10, 10, 3, 10.0, 20.0, 20.5,\n\t\t\t\t\t\t15.5, 5.0, 5);\n\t\t\t}\n\n\t\t\t// this.bubbleSet.addPortals(portalVertexReps);\n\n\t\t\t// update texture\n\t\t\tthis.bubbleSet.getBubbleSetGLRenderer().setSize(pathway.getWidth(), pathway.getHeight());\n\t\t\tthis.bubbleSet.getBubbleSetGLRenderer().update(gl, null, 0);\n\n\t\t\talternativeBubbleSet.getBubbleSetGLRenderer().setSize(pathway.getWidth(), pathway.getHeight());\n\t\t\t// this.bubbleSet.getBubbleSetGLRenderer().update(gl, SelectionType.SELECTION.getColor(), selectedPathID);\n\t\t\talternativeBubbleSet.getBubbleSetGLRenderer().update(gl, null, 0);\n\n\t\t\tisBubbleTextureDirty = false;\n\t\t}\n\n\t\tgl.glPushName(ViewManager.get().getPickingManager()\n\t\t\t\t.getPickingID(uniqueID, EPickingType.PATHWAY_TEXTURE_SELECTION.name(), 0));\n\n\t\tthis.alternativeBubbleSet.getBubbleSetGLRenderer().render(gl,\n\t\t\t\tpixelGLConverter.getGLWidthForPixelWidth(pathway.getWidth()),\n\n\t\t\t\tpixelGLConverter.getGLHeightForPixelHeight(pathway.getHeight()), 0.25f);\n\n\t\tif (this.highlightVertices) {\n\t\t\tthis.bubbleSet.getBubbleSetGLRenderer().render(gl,\n\t\t\t\t\tpixelGLConverter.getGLWidthForPixelWidth(pathway.getWidth()),\n\t\t\t\t\tpixelGLConverter.getGLHeightForPixelHeight(pathway.getHeight()));\n\t\t} else {\n\n\t\t\tthis.bubbleSet.getBubbleSetGLRenderer().render(gl,\n\t\t\t\t\tpixelGLConverter.getGLWidthForPixelWidth(pathway.getWidth()),\n\t\t\t\t\tpixelGLConverter.getGLHeightForPixelHeight(pathway.getHeight()), 1.0f);\n\t\t}\n\n\t\tgl.glPopName();\n\n\t}", "protected void merge(FlowGraphNode victim){\r\n for(FlowGraphNode node : victim.to){\r\n this.addTo(node);\r\n node.from.remove(victim);\r\n }\r\n for(FlowGraphNode node : victim.from){\r\n node.addTo(this);\r\n node.to.remove(victim);\r\n }\r\n }", "public void topologicalSort() {\n HashMap<Integer, Integer> inDegrees = new HashMap<>();\n Queue<Integer> queue = new LinkedList<>();\n int numTotalNodes = 0;\n\n // Build the inDegree HashMap\n for (Entry<Integer, LinkedList<Edge<Integer>>> entry : g.adj.entrySet()) {\n LinkedList<Edge<Integer>> vList = entry.getValue();\n int currentVertex = entry.getKey();\n\n inDegrees.put(currentVertex, inDegrees.getOrDefault(currentVertex, 0));\n for (Edge<Integer> e : vList) {\n inDegrees.put(e.dest, inDegrees.getOrDefault(e.dest, 0) + 1);\n numTotalNodes++;\n }\n }\n\n // Add Elements with inDegree zero toe the queue\n for (int v : inDegrees.keySet()) {\n if (inDegrees.get(v) > 0)\n continue;\n queue.add(v);\n }\n\n int visitedNodes = 0;\n\n while (!queue.isEmpty()) {\n int v = queue.remove();\n System.out.print(v + \" \");\n for (int u : g.getNeighbors(v)) {\n int inDeg = inDegrees.get(u) - 1;\n if (inDeg == 0)\n queue.add(u);\n inDegrees.put(u, inDeg);\n }\n visitedNodes++;\n }\n\n if (visitedNodes != numTotalNodes) {\n System.out.println(\"Graph is not a DAG\");\n }\n }", "private void initializeEdges() {\n for (NasmInst inst : nasm.listeInst) {\n if (inst.source == null || inst.destination == null)\n return;\n Node from = inst2Node.get(label2Inst.get(inst.source.toString()));\n Node to = inst2Node.get(label2Inst.get(inst.destination.toString()));\n if (from == null || to == null)\n return;\n graph.addEdge(from, to);\n }\n }", "private void transformVehicles(APDataCollection apData) throws APDataCollectionTransformationException {\n\n\t\t// Loop through the CommlRateState elements (one per state)\n\t\tfor (int[] vehicleIndexes = { 0, 0 }; vehicleIndexes[0] < apData.getCount(ICommlAutoConstants.COMML_RATE_STATE_XPATH); vehicleIndexes[0]++) {\n\n\t\t\t// Loop through the vehicles under that CommlRateState\n\t\t\tfor (vehicleIndexes[1] = 0; vehicleIndexes[1] < apData.getCount(ICommlAutoConstants.COMML_VEHICLE_XPATH, vehicleIndexes[0]); vehicleIndexes[1]++) {\n\n\t\t\t\t// This step changes the way garaging locations are stored from\n\t\t\t\t// the Turnstile method to the Portal method.\n\t\t\t\t// In turnstile, garaging locations are stored underneath the\n\t\t\t\t// vehicles:\n\t\t\t\t// CommlAutoLineBusiness.CommlRateState.CommlVeh.CommlVehSupplement.Addr\n\t\t\t\t// In Portal, all locations are stored in \"Location\" elements,\n\t\t\t\t// and the vehicle is linked to the Location\n\t\t\t\t// with an idref:\n\t\t\t\t// CommlAutoLineBusiness.CommlRateState.CommlVeh.@LocationRef\n\t\t\t\t//\n\t\t\t\tmoveGaragingAddress(apData, vehicleIndexes);\n\n\t\t\t\tmoveRegistrationState(apData, vehicleIndexes);\n\n\t\t\t\tsetVehicleType(apData, vehicleIndexes);\n\n\n\t\t\t}\n\t\t}\n\t}", "void FlowMaintain() {\n newFlowCap[0] = Integer.MAX_VALUE; // initial value\n\n // check the smallest in the edgesInPath, if edgesInPath is empty ==> new flow is INF\n for (Edge<E> edge : edgesInPath) {\n if (edge.getCapability() < newFlowCap[0]) {\n newFlowCap[0] = edge.getCapability();\n }\n }\n }", "public void flowAlgorithm(){\n while(!augmentedPath()){\n ArrayList<Integer> flowList = new ArrayList<>();//this is here just so we can print out the path\n int minFlow = 10000;\n int currentID = t;\n GraphNode node = graphNode[currentID];\n //very simply this part will start at the last node and go back through the path that was selected and fin the minimum flow\n flowList.add(t);\n while(node != graphNode[s]){\n int parent = node.parent;\n flowList.add(parent);\n if(graph.flow[parent][currentID][1] < minFlow){\n minFlow = graph.flow[parent][currentID][1];\n }\n node = graphNode[parent];\n currentID = parent;\n }\n currentID = t;//should this be here\n displayMaxFlow(flowList, minFlow);\n node = graphNode[t];\n //this will go back through the same list as the one up above and change their current value\n while(node != graphNode[s]){\n int parent = node.parent;\n graph.flow[parent][currentID][1] = graph.flow[parent][currentID][1] - minFlow;\n node = graphNode[parent];\n currentID = parent;\n }\n }\n }", "public void reproduceVirus() {\n\t\tOrganism newOrg;\n\t\t\n\t\tfor (int i=0; i < 1; i++) {\n\t\t\tnewOrg = new Organism(_world);\n\t\t\tif (newOrg.inherit(this, i==0)) {\n\t\t\t\t// It can be created\n\t\t\t\t_nTotalChildren++;\n\t\t\t\t_world.addOrganism(newOrg,this);\n\t\t\t\t_infectedGeneticCode = null;\n\t\t\t}\n\t\t\t_timeToReproduce = 20;\n\t\t}\n\t}", "public void markLocalConfigApnMerge() throws JNCException {\n markLeafMerge(\"localConfigApn\");\n }", "private void parseLocalReferentialForLocalAuthority(final String localAuthorityName) {\n \n synchronized(this) {\n \n // add entry for local authority and default request type\n addLocalReferentialForLocalAuthority(localAuthorityName,\n commonReferentialFilename, \"All\");\n \n // for all already known request type services, add an entry for local authority\n Iterator requestServicesIt = parsedRequestServices.iterator();\n while (requestServicesIt.hasNext()) {\n IRequestService service = (IRequestService) requestServicesIt.next();\n if (service.getLocalReferentialFilename() != null) {\n addLocalReferentialForLocalAuthority(localAuthorityName,\n service.getLocalReferentialFilename(),\n service.getLabel());\n }\n }\n }\n }", "private void setupGraph() {\n graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());\n try {\n\n WritableGraph wg = graph.getWritableGraph(\"\", true);\n\n // Create LayerMask attributes\n layerMaskV = LayersConcept.VertexAttribute.LAYER_MASK.ensure(wg);\n layerMaskT = LayersConcept.TransactionAttribute.LAYER_MASK.ensure(wg);\n\n // Create LayerVisilibity Attributes\n layerVisibilityV = LayersConcept.VertexAttribute.LAYER_VISIBILITY.ensure(wg);\n layerVisibilityT = LayersConcept.TransactionAttribute.LAYER_VISIBILITY.ensure(wg);\n\n // Create Selected Attributes\n selectedV = VisualConcept.VertexAttribute.SELECTED.ensure(wg);\n selectedT = VisualConcept.TransactionAttribute.SELECTED.ensure(wg);\n\n // Adding 2 Vertices - not selected, layer 1, visible\n vxId1 = wg.addVertex();\n wg.setIntValue(layerMaskV, vxId1, 1);\n wg.setFloatValue(layerVisibilityV, vxId1, 1.0f);\n wg.setBooleanValue(selectedV, vxId1, false);\n\n vxId2 = wg.addVertex();\n wg.setIntValue(layerMaskV, vxId2, 1);\n wg.setFloatValue(layerVisibilityV, vxId2, 1.0f);\n wg.setBooleanValue(selectedV, vxId2, false);\n\n // Adding 2 Transactions - not selected, layer 1, visible\n txId1 = wg.addTransaction(vxId1, vxId2, true);\n wg.setIntValue(layerMaskT, txId1, 1);\n wg.setFloatValue(layerVisibilityT, txId1, 1.0f);\n wg.setBooleanValue(selectedT, txId1, false);\n\n txId2 = wg.addTransaction(vxId1, vxId2, false);\n wg.setIntValue(layerMaskT, txId2, 1);\n wg.setFloatValue(layerVisibilityT, vxId2, 1.0f);\n wg.setBooleanValue(selectedT, vxId2, false);\n\n wg.commit();\n\n } catch (final InterruptedException ex) {\n Exceptions.printStackTrace(ex);\n Thread.currentThread().interrupt();\n }\n }", "Set<Edge> getIncomingNeighborEdges(boolean onUpwardPass) {\n//\t\t\tif(_outgoingEdges.size() == 0) { // only compute if we have to\n\t\t\t\tSet<Edge> outgoingEdges = new HashSet<Edge>();\n\t\t\t\tIterator<Edge> it = _neighborEdges.keySet().iterator();\n\t\t\t\twhile(it.hasNext()) {\n\t\t\t\t\tEdge e = it.next();\n\t\t\t\t\tVertex v = e.getOtherVertex(this);\n\t\t\t\t\tif(this._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops i am unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(v._orderID == UNMARKED) {\n\t\t\t\t\t\tSystem.err.println(\"whoops neighbor unmarked\");\n\t\t\t\t\t}\n\t\t\t\t\tif(this._orderID < v._orderID) {\n\t\t\t\t\t\toutgoingEdges.add(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_outgoingEdges = outgoingEdges;\n//\t\t\t}\n//\t\t\treturn _outgoingEdges;\n\t\t\t\treturn outgoingEdges;\n\t\t}", "private HashMap<Transition, ArrayList<Transition>> fusionSeriesTransitions(\n\t\t\tPetriNet newPN, ArrayList nodes, ArrayList placesToExamine,\n\t\t\tPetriNet oldPN) {\n\t\tHashMap<Transition, ArrayList<Transition>> mappingActivityToOldTransitions = new HashMap<Transition, ArrayList<Transition>>();\n\t\tArrayList<Transition> mergedTransitions = new ArrayList<Transition>();\n\t\tif (nodes.size() == 5) {\n\t\t\t// check whether the in- and outdegree of the places are 1\n\t\t\t// check whether the indegree of the last two transitions is 1\n\t\t\tPlace p1 = (Place) nodes.get(1);\n\t\t\tPlace p2 = (Place) nodes.get(3);\n\t\t\tTransition t2 = (Transition) nodes.get(2);\n\t\t\tTransition t3 = (Transition) nodes.get(4);\n\t\t\tif (p1.inDegree() == 1 && p1.outDegree() == 1 && p2.inDegree() == 1\n\t\t\t\t\t&& p2.outDegree() == 1 && t2.inDegree() == 1\n\t\t\t\t\t&& t3.inDegree() == 1) {\n\t\t\t\tTransition t1 = (Transition) nodes.get(0);\n\t\t\t\t// find the transitions in the old PN that are going to be\n\t\t\t\t// merged\n\t\t\t\tTransition t1Old = oldPN.findTransition(t1);\n\t\t\t\tmergedTransitions.add(t1Old);\n\t\t\t\tTransition t2Old = oldPN.findTransition(t2);\n\t\t\t\tmergedTransitions.add(t2Old);\n\t\t\t\tTransition t3Old = oldPN.findTransition(t3);\n\t\t\t\tmergedTransitions.add(t3Old);\n\n\t\t\t\t// fusion for t1, p1 and t2\n\t\t\t\tnewPN.delPlace(p1);\n\t\t\t\t// merge t1 and t2\n\t\t\t\tHashSet succT2 = t2.getSuccessors();\n\t\t\t\t// create an edge from t1 to each successor of t2\n\t\t\t\tIterator succs = succT2.iterator();\n\t\t\t\twhile (succs.hasNext()) {\n\t\t\t\t\tPlace successor = (Place) succs.next();\n\t\t\t\t\tPNEdge newEdge = new PNEdge(t1, successor);\n\t\t\t\t\tnewPN.addEdge(newEdge);\n\t\t\t\t}\n\t\t\t\t// remove t2\n\t\t\t\tnewPN.delTransition(t2);\n\n\t\t\t\t// fusion for t1, p2, t3\n\t\t\t\tnewPN.delPlace(p2);\n\t\t\t\t// merge t1 and t3\n\t\t\t\tHashSet succT3 = t3.getSuccessors();\n\t\t\t\t// create an edge from t1 to each successor of t3\n\t\t\t\tIterator succs2 = succT3.iterator();\n\t\t\t\twhile (succs2.hasNext()) {\n\t\t\t\t\tPlace successor = (Place) succs2.next();\n\t\t\t\t\tPNEdge newEdge = new PNEdge(t1, successor);\n\t\t\t\t\tnewPN.addEdge(newEdge);\n\t\t\t\t}\n\t\t\t\t// remove t3\n\t\t\t\tnewPN.delTransition(t3);\n\t\t\t\t//\n\t\t\t\tplacesToExamine.remove(p1);\n\t\t\t\tplacesToExamine.remove(p2);\n\t\t\t\t// rename t1 and remove logevent\n\t\t\t\tt1.setIdentifier(getActivityName(t1));\n\t\t\t\t// report which transitions are merged into an activity\n\t\t\t\tmappingActivityToOldTransitions.put(t1, mergedTransitions);\n\t\t\t\t// make a fake log event for the transition that is now an\n\t\t\t\t// activity\n\t\t\t\tLogEvent fake = new LogEvent(getActivityName(t1), \"none\");\n\t\t\t\tt1.setLogEvent(fake);\n\t\t\t}\n\t\t} else if (nodes.size() == 3) {\n\t\t\t// check whether the in- and outdegree of the place is 1\n\t\t\t// and that the indegree of transition t2 is 1.\n\t\t\tPlace p1 = (Place) nodes.get(1);\n\t\t\tTransition t1 = (Transition) nodes.get(0);\n\t\t\tTransition t2 = (Transition) nodes.get(2);\n\t\t\tif ((p1.inDegree() == 1 && p1.outDegree() == 1)\n\t\t\t\t\t&& t2.inDegree() == 1) {\n\n\t\t\t\t// find the transitions in the old PN that are going to be\n\t\t\t\t// merged\n\t\t\t\tTransition t1Old = oldPN.findTransition(t1);\n\t\t\t\tmergedTransitions.add(t1Old);\n\t\t\t\tTransition t2Old = oldPN.findTransition(t2);\n\t\t\t\tmergedTransitions.add(t2Old);\n\n\t\t\t\t// fusion for t1, p1 and t2\n\t\t\t\tnewPN.delPlace(p1);\n\t\t\t\t// merge t1 and t2\n\t\t\t\tHashSet succT2 = t2.getSuccessors();\n\t\t\t\t// create an edge from t1 to each successor of t2\n\t\t\t\tIterator succs = succT2.iterator();\n\t\t\t\twhile (succs.hasNext()) {\n\t\t\t\t\tPlace successor = (Place) succs.next();\n\t\t\t\t\tPNEdge newEdge = new PNEdge(t1, successor);\n\t\t\t\t\tnewPN.addEdge(newEdge);\n\t\t\t\t}\n\t\t\t\t// remove t2\n\t\t\t\tnewPN.delTransition(t2);\n\n\t\t\t\t// rename t1 and remove logevent\n\t\t\t\tt1.setIdentifier(getActivityName(t1));\n\t\t\t\t// report which transitions are merged into an activity\n\t\t\t\tmappingActivityToOldTransitions.put(t1, mergedTransitions);\n\t\t\t\t// make a fake log event for the transition that is now an\n\t\t\t\t// activity\n\t\t\t\tLogEvent fake = new LogEvent(getActivityName(t1), \"none\");\n\t\t\t\tt1.setLogEvent(fake);\n\t\t\t}\n\t\t} else {\n\t\t\t// generate exception\n\t\t}\n\n\t\treturn mappingActivityToOldTransitions;\n\t}", "private void update()\r\n\t{\r\n\t\tfor (Agent agent : agents)\r\n\t\t{\r\n\t\t\tint i = agent.getIndex();\r\n\t\t\tp.setEntry(i, agent.getP());\r\n\t\t\tq.setEntry(i, agent.getQ());\r\n\t\t\tvabs.setEntry(i, agent.getVabs());\r\n\t\t\tvarg.setEntry(i, agent.getVarg());\r\n\t\t\tlambdaP.setEntry(i, agent.getLambdaP());\r\n\t\t\tlambdaQ.setEntry(i, agent.getLambdaQ());\r\n\t\t}\r\n\t}", "boolean reflow(DirectedGraph g)\n {\n ArrayList<Node> nodes = g.getNodes();\n int reset = 0;\n for(Node n: nodes)\n {\n ArrayList<Node> incoming = n.getIncomingLinks();\n ArrayList<Node> outgoing = n.getOutgoingLinks();\n // compute the total push force acting on this node\n int dx = 0;\n int dy = 0;\n for(Node ni: incoming) {\n dx += (ni.x-n.x);\n dy += (ni.y-n.y); }\n float len = (float) Math.sqrt(dx * dx + dy * dy);\n float angle = utility.getDirection(dx, dy);\n int[] motion = utility.rotateCoordinate((float) 0.9 * repulsion, (float) 0.0, angle);\n // move node\n int px = n.x;\n int py = n.y;\n n.x += motion[0];\n n.y += motion[1];\n if(n.x<0) { n.x=0; } else if(n.x>parent.width) { n.x=parent.width; }\n if(n.y<0) { n.y=0; } else if(n.y>parent.height) { n.y=parent.height; }\n // undo repositioning if elasticity is violated\n float shortest = n.getShortestLinkLength();\n if(shortest<min_size || shortest>elasticity*2) {\n reset++;\n n.x=px; n.y=py; }\n }\n return reset==nodes.size();\n }", "public void rescanBGPTable() {\n if (this.isWardenAS() && this.poisonMode != AS.ReversePoisonMode.NONE) {\n if (!this.locRib.containsKey(this.asn * -1)) {\n this.advPath(new BGPPath(this.getASN() * -1));\n } else {\n this.dirtyDest.add(this.getASN() * -1);\n }\n }\n\n for (int tDest : this.locRib.keys()) {\n this.recalcBestPath(tDest);\n }\n\n /*\n * If we're a warden and we're in a mode where we're playing around with\n * MPLS games clear out the MPLS table for this round\n */\n if (this.isWardenAS() && this.avoidMode == AS.AvoidMode.LEGACY) {\n this.mplsRoutes.clear();\n }\n }", "public void findNewAStarPath(PedSimCity state) {\n\n\t\tRouteData route = new RouteData();\n\t\troute.origin = originNode.getID();\n\t\troute.destination = destinationNode.getID();\n\t\t//\t\toriginNode = PedSimCity.nodesMap.get(9406);\n\t\t//\t\tdestinationNode = PedSimCity.nodesMap.get(4456);\n\n\t\tif (UserParameters.empiricalABM) {\n\t\t\tSystem.out.println(\" Agent nr. \"+this.agentID + \" group \" + this.agp.groupName + \" OD \" + originNode.getID()+\" \" +destinationNode.getID());\n\t\t\tagp.defineRouteChoiceParameters();\n\t\t\tCombinedNavigation combinedNavigation = new CombinedNavigation();\n\t\t\tnewPath = combinedNavigation.path(originNode, destinationNode, agp);\n\t\t\troute.group = this.agp.groupID;\n\t\t\troute.localH = this.agp.localHeuristic;\n\t\t\troute.routeID = this.agentID.toString()+\"-\"+originNode.getID().toString()+\"-\"+destinationNode.getID().toString();\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(originNode.getID() + \" \"+ destinationNode.getID()+ \" \"+ap.routeChoice);\n\t\t\tselectRouteChoice();\n\t\t\troute.routeChoice = ap.routeChoice;\n\t\t\t//\t\t\troute.routeID = numTrips;\n\t\t}\n\n\t\tList<Integer> sequenceEdges = new ArrayList<Integer>();\n\n\t\tfor (GeomPlanarGraphDirectedEdge o : newPath) {\n\t\t\t// update edge data\n\t\t\tupdateEdgeData((EdgeGraph) o.getEdge());\n\t\t\tint edgeID = ((EdgeGraph) o.getEdge()).getID();\n\t\t\tsequenceEdges.add(edgeID);\n\t\t}\n\t\troute.sequenceEdges = sequenceEdges;\n\t\tPedSimCity.routesData.add(route);\n\t\tindexOnPath = 0;\n\t\tpath = newPath;\n\n\t\t// set up how to traverse this first link\n\t\tEdgeGraph firstEdge = (EdgeGraph) newPath.get(0).getEdge();\n\t\tsetupEdge(firstEdge); //Sets the Agent up to proceed along an Edge\n\n\t\t// update the current position for this link\n\t\tupdatePosition(segment.extractPoint(currentIndex));\n\t\tnumTrips += 1;\n\t}", "private void applyLocationAlgorithms() {\n List<NodeState> states = new ArrayList<NodeState>();\n List<RemoteNode> nodes = new ArrayList<RemoteNode>(nodeManager.getNodes());\n AlgorithmMatchCriteria criteria;\n\n for (Algorithm la : algorithmManager.getAlgorithms()) {\n if (!la.isEnabled()) continue;\n criteria = algorithmManager.getCriteria(la);\n\n List<Node> filteredNodes = criteria.filter(nodes);\n if (filteredNodes.size() > 0) {\n states.add(la.applyTo(nodeManager.getLocalNode(), filteredNodes));\n }\n }\n for (NodeState s : states) {\n nodeManager.getLocalNode().addPending(s);\n }\n }" ]
[ "0.5140432", "0.49932358", "0.49661303", "0.49345478", "0.49290448", "0.48162726", "0.48129866", "0.48083872", "0.48019508", "0.47721297", "0.47666028", "0.47265494", "0.4633755", "0.4619854", "0.4596171", "0.45909056", "0.45722234", "0.4572064", "0.45615143", "0.4560236", "0.45585644", "0.4547052", "0.45422888", "0.453754", "0.45330155", "0.45296133", "0.45040703", "0.44681135", "0.44637924", "0.44616967", "0.44616935", "0.44341606", "0.4410187", "0.4409168", "0.43989423", "0.43978572", "0.43946293", "0.4381468", "0.4380768", "0.43766198", "0.43766198", "0.43615153", "0.43559262", "0.43533978", "0.43507", "0.43483034", "0.43468294", "0.43239754", "0.43050158", "0.430274", "0.4301495", "0.4297075", "0.42891905", "0.42876196", "0.4281567", "0.42788655", "0.42737976", "0.42708573", "0.42700103", "0.42649376", "0.42563194", "0.4253515", "0.4250467", "0.42493564", "0.42483327", "0.4221352", "0.42211568", "0.42134938", "0.421054", "0.4208081", "0.4207412", "0.41964164", "0.4194335", "0.41922882", "0.418588", "0.41853094", "0.41697666", "0.41691777", "0.41637972", "0.4162011", "0.41508734", "0.41485888", "0.41483492", "0.41454908", "0.41446722", "0.41406474", "0.4129389", "0.41276422", "0.41236165", "0.41175747", "0.4115432", "0.4114513", "0.4110363", "0.41088656", "0.41024446", "0.41006523", "0.40968782", "0.40938652", "0.4087639", "0.40862784" ]
0.5484684
0
Finds the association or seperation sets for every pair of nodes.
private List<Set<IonIndependenceFacts>> findSepAndAssoc(Graph graph) { Set<IonIndependenceFacts> separations = new HashSet<>(); Set<IonIndependenceFacts> associations = new HashSet<>(); List<NodePair> allNodes = allNodePairs(graph.getNodes()); for (NodePair pair : allNodes) { Node x = pair.getFirst(); Node y = pair.getSecond(); List<Node> variables = new ArrayList<>(graph.getNodes()); variables.remove(x); variables.remove(y); List<Set<Node>> subsets = SearchGraphUtils.powerSet(variables); IonIndependenceFacts indep = new IonIndependenceFacts(x, y, new HashSet<List<Node>>()); IonIndependenceFacts assoc = new IonIndependenceFacts(x, y, new HashSet<List<Node>>()); boolean addIndep = false; boolean addAssoc = false; for (Graph pag : input) { for (Set<Node> subset : subsets) { if (containsAll(pag, subset, pair)) { Node pagX = pag.getNode(x.getName()); Node pagY = pag.getNode(y.getName()); ArrayList<Node> pagSubset = new ArrayList<>(); for (Node node : subset) { pagSubset.add(pag.getNode(node.getName())); } if (pag.isDSeparatedFrom(pagX, pagY, new ArrayList<>(pagSubset))) { if (!pag.isAdjacentTo(pagX, pagY)) { addIndep = true; indep.addMoreZ(new ArrayList<>(subset)); } } else { addAssoc = true; assoc.addMoreZ(new ArrayList<>(subset)); } } } } if (addIndep) separations.add(indep); if (addAssoc) associations.add(assoc); } List<Set<IonIndependenceFacts>> facts = new ArrayList<>(2); facts.add(0, separations); facts.add(1, associations); return facts; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void phaseTwo(){\r\n\r\n\t\tCollections.shuffle(allNodes, random);\r\n\t\tList<Pair<Node, Node>> pairs = new ArrayList<Pair<Node, Node>>();\r\n\t\t\r\n\t\t//For each node in allNode, get all relationshpis and iterate through each relationship.\r\n\t\tfor (Node n1 : allNodes){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//If a node n1 is related to any other node in allNodes, add those relationships to rels.\r\n\t\t\t\t//Avoid duplication, and self loops.\r\n\t\t\t\tIterable<Relationship> ite = n1.getRelationships(Direction.BOTH);\t\t\t\t\r\n\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\tNode n2 = rel.getOtherNode(n1);\t//Get the other node\r\n\t\t\t\t\tif (allNodes.contains(n2) && !n1.equals(n2)){\t\t\t\t\t//If n2 is part of allNodes and n1 != n2\r\n\t\t\t\t\t\tif (!rels.contains(rel)){\t\t\t\t\t\t\t\t\t//If the relationship is not already part of rels\r\n\t\t\t\t\t\t\tPair<Node, Node> pA = new Pair<Node, Node>(n1, n2);\r\n\t\t\t\t\t\t\tPair<Node, Node> pB = new Pair<Node, Node>(n2, n1);\r\n\r\n\t\t\t\t\t\t\tif (!pairs.contains(pA)){\r\n\t\t\t\t\t\t\t\trels.add(rel);\t\t\t\t\t\t\t\t\t\t\t//Add the relationship to the lists.\r\n\t\t\t\t\t\t\t\tpairs.add(pA);\r\n\t\t\t\t\t\t\t\tpairs.add(pB);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}", "private List<NodePair> allNodePairs(List<Node> nodes) {\n List<NodePair> nodePairs = new ArrayList<>();\n for (int j = 0; j < nodes.size() - 1; j++) {\n for (int k = j + 1; k < nodes.size(); k++) {\n nodePairs.add(new NodePair(nodes.get(j), nodes.get(k)));\n }\n }\n return nodePairs;\n }", "void findMatchings(boolean isProtein) {\n\n GraphDatabaseFactory dbFactory = new GraphDatabaseFactory();\n HashSet<String > searchSpaceList = new HashSet<>();\n GraphDatabaseService databaseService = dbFactory.newEmbeddedDatabase(graphFile);\n for (int id: queryGraphNodes.keySet()) {\n if(isProtein)\n searchSpaceList.add(queryGraphNodes.get(id).label);\n else\n searchSpaceList.add(String.valueOf(queryGraphNodes.get(id).labels.get(0)));\n }\n for(String x: searchSpaceList) {\n ResourceIterator<Node> xNodes;\n try(Transaction tx = databaseService.beginTx()) {\n xNodes = databaseService.findNodes(Label.label(x));\n tx.success();\n }\n\n while (xNodes.hasNext()) {\n Node node = xNodes.next();\n if (searchSpaceProtein.containsKey(x))\n searchSpaceProtein.get(x).add(node.getId());\n else {\n HashSet<Long> set = new HashSet<>();\n set.add(node.getId());\n searchSpaceProtein.put(x, set);\n }\n }\n\n }\n\n if(isProtein)\n search(0, databaseService, true);\n else\n search(0, databaseService, false);\n databaseService.shutdown();\n }", "private Set<NodePair> nonadjacencies(Graph graph) {\n Set<NodePair> nonadjacencies = new HashSet<>();\n for (Graph inputPag : input) {\n for (NodePair pair : allNodePairs(inputPag.getNodes())) {\n if (!inputPag.isAdjacentTo(pair.getFirst(), pair.getSecond())) {\n nonadjacencies.add(new NodePair(graph.getNode(pair.getFirst().getName()), graph.getNode(pair.getSecond().getName())));\n }\n }\n }\n return nonadjacencies;\n }", "public static ArrayList<String> connectors2(Graph g) {\n boolean[] visits = new boolean[g.members.length]; \n for (int i=0;i<=g.members.length-1;i++) {\n \tvisits[i]=false;\n }\n int[] dfsnum = new int[g.members.length];\n int[] back = new int[g.members.length];\n ArrayList<String> answer = new ArrayList<String>();\n\n //driver portion\n for (Person person : g.members) {\n //if it hasn't been visited\n if (visits[g.map.get(person.name)]==false){\n //for different islands\n dfsnum = new int[g.members.length];\n dfs(g.map.get(person.name), g.map.get(person.name), g, visits, dfsnum, back, answer);\n }\n }\n \n //check if vertex has one neighbor\n for (int i = 0; i < answer.size(); i++) {\n Friend ptr = g.members[g.map.get(answer.get(i))].first;\n //counts number of neighbors\n int count = 0;\n while (ptr != null) {\n ptr = ptr.next;\n count++;\n }\n if (count == 1) answer.remove(i);\n if (count == 0) answer.remove(i);\n } \n for (Person member : g.members) {\n if (member.first!=null&& member.first.next == null) {\n if (answer.contains(g.members[member.first.fnum].name)==false)\n \t\t answer.add(g.members[member.first.fnum].name);\n }\n }\n answer=modify(answer,g);\n if (answer==null||answer.size()==0) return null;\n return answer;\n }", "static ArrayList<XTupleSet> getCompleteTupleSets(String rel, ArrayList<String> rels, Connection dbConn) throws SQLException {\n\t\n\t// evaluate tables\n\tXTable targetTable = new XTable(rel, dbConn);\n\tArrayList<XTable> otherTables = new ArrayList<XTable>();\n\tfor (int i = 0; i < rels.size(); i++) {\n\t if (!rel.equals(rels.get(i))) { // exclude the target table\n\t\totherTables.add(new XTable(rels.get(i), dbConn));\n\t }\n\t}\n\t\n\tArrayList<XTupleSet> complete = new ArrayList<XTupleSet>();\n\tArrayList<XTupleSet> inComplete = new ArrayList<XTupleSet>();\n\t\n\tfor (int i = 0; i < targetTable.size(); i++) {\n\t inComplete.add(new XTupleSet(targetTable.getTuple(i))); // line 3-4\n\t}\n\t\n\twhile (!inComplete.isEmpty()) {\n\t XTupleSet tupleSet = pop(inComplete);\n\t \n\t // check all other tuples which are JCC with is tuple set. Line 7-8\n\t for (XTable table : otherTables) {\n\t\tfor (int i = 0; i < table.size(); i++) {\n\t\t XTuple tuple = table.getTuple(i);\n\t\t if (tupleSet.jcc(tuple) && (!tupleSet.contains(tuple))) {\n\t\t\ttupleSet.add(tuple);\n\t\t\t// here, we should break, because there can not be\n\t\t\t// two tuples in a single table which are JCC with\n\t\t\t// the same tuple set.\n\t\t\tbreak;\n\t\t }\n\t\t}\n\t }\n\t \n\t // Line 9 - 20\n\t for (XTable table : otherTables) { // Line 9\n\t\tfor (int i = 0; i < table.size(); i++) {\n\t\t XTuple tuple = table.getTuple(i);\n\t\t if (!tupleSet.contains(tuple)) { // Line 9\n\t\t\tXTupleSet prime = getPrime(tuple, tupleSet); // Line 11\n\t\t\t\n\t\t\tif (prime.hasTupleFrom(targetTable)) { // Line 12\n\t\t\t boolean inserted = false; // Line 13\n\t\t\t if (isInComplete(prime, complete)) {\n\t\t\t\tinserted = true; // Line 15\n\t\t\t\tfor (int j = 0 ; j < inComplete.size(); i++) { // Line 16\n\t\t\t\t XTupleSet ts = inComplete.get(j); // Line 16\n\t\t\t\t if (prime.jcc(ts)) { // Line 17\n\t\t\t\t\tts.addAll(prime);\n\t\t\t\t\tinserted = true;\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t\tif (!inserted) {\n\t\t\t\t inComplete.add(prime);\n\t\t\t\t}\n\t\t\t }\n\t\t\t}\n\t\t }\n\t\t}\n\t }\n\t \n\t // Line 22\n\t complete.add(tupleSet);\n\t}\n\t\n\treturn complete;\n }", "public Map<Node, MyNode> extractNodes(int numNodes){\r\n\t\t//If numNodes is less than one or there aren't enough nodes, return null\r\n\t\tif (numNodes < 1 || nodesMap.size() < numNodes){\r\n\t\t\treturn null;\r\n\t\t} \r\n\r\n\t\t//Initialize the result set\r\n\t\tMap<Node, MyNode> result = new HashMap<Node, MyNode>();\r\n\r\n\t\t//Special case: If there are no relationships, then return all nodes.\r\n\t\tif(rels.size() == 0){\r\n\t\t\tfor (Node node : nodesMap.keySet()){\r\n\t\t\t\tresult.put(node, nodesMap.get(node));\r\n\t\t\t}\r\n\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\t//tempRels (used for crawling through the gp)\r\n\t\tList<Relationship> tempRels = new ArrayList<Relationship>();\r\n\t\ttempRels.addAll(relsMap.keySet());\r\n\r\n\t\t//Shuffle the tempRels list for random order.\r\n\t\tCollections.shuffle(tempRels, random);\r\n\r\n\t\tboolean first = true;\t//flag for first run\r\n\r\n\t\twhile (result.size() < numNodes) {\t//Loop until we have reached the required result size.\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\t\t\t\t\r\n\t\t\t\tif (first){\t\t\t//On the first run\r\n\t\t\t\t\tfirst = false;\t//Update flag\r\n\r\n\t\t\t\t\t//Pick a random relationship and extract its nodes\r\n\t\t\t\t\tRelationship rel = tempRels.get(random.nextInt(tempRels.size()));\r\n\t\t\t\t\ttempRels.remove(rel);\r\n\t\t\t\t\tNode src = rel.getStartNode();\r\n\t\t\t\t\tNode tgt = rel.getEndNode();\r\n\r\n\r\n\t\t\t\t\tif (numNodes > 1){\r\n\t\t\t\t\t\t//If numNodes > 1, then add both nodes to result\r\n\t\t\t\t\t\tresult.put(src, nodesMap.get(src));\r\n\t\t\t\t\t\tresult.put(tgt, nodesMap.get(tgt));\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//If numNodes == 1, then randomly pick one of the nodes to add to result\r\n\t\t\t\t\t\tif (random.nextBoolean()){\r\n\t\t\t\t\t\t\tresult.put(src, nodesMap.get(src));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tresult.put(tgt, nodesMap.get(tgt));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\t//On subsequent runs\r\n\r\n\t\t\t\t\tboolean done = false;\t//Flag to specify we're done with this iteration\r\n\t\t\t\t\tint idx = 0;\t\t\t//Loop index counter\r\n\t\t\t\t\twhile (!done){\r\n\t\t\t\t\t\t//Pick the next relationship in tempRels\r\n\t\t\t\t\t\tRelationship rel = tempRels.get(idx);\r\n\t\t\t\t\t\tidx++;\r\n\t\t\t\t\t\tNode other = null;\r\n\r\n\t\t\t\t\t\tif (result.keySet().contains(rel.getStartNode()) && (!result.keySet().contains(rel.getEndNode()))){\r\n\t\t\t\t\t\t\t//If the startNode of the relationship is already in results, but not the end node\r\n\t\t\t\t\t\t\t//then set other to be the end node\r\n\t\t\t\t\t\t\tother = rel.getEndNode();\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t} else if ((!result.keySet().contains(rel.getStartNode())) && result.keySet().contains(rel.getEndNode())){\r\n\t\t\t\t\t\t\t//If the startNode of the relationship is not in results, but the end node is\r\n\t\t\t\t\t\t\t//then set other to be the start node\r\n\t\t\t\t\t\t\tother = rel.getStartNode();\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t} else if (result.keySet().contains(rel.getStartNode()) && result.keySet().contains(rel.getEndNode())){\r\n\t\t\t\t\t\t\t//If both of the nodes of the relationship are in result, remove it from the list\r\n\t\t\t\t\t\t\ttempRels.remove(rel);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t//If we found a matching relationship\r\n\t\t\t\t\t\tif (done){\r\n\t\t\t\t\t\t\t//Add other to the result, and its corresponding mapping\r\n\t\t\t\t\t\t\tresult.put(other, nodesMap.get(other));\r\n\t\t\t\t\t\t\t//Remove rel from the list\r\n\t\t\t\t\t\t\ttempRels.remove(rel);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "ArrayList<Edge> getAdjacencies();", "public static int[] findRedundantConnection(int[][] edges) {\n UnionDataStructure obj = new UnionDataStructure();\n \n int nodes = edges.length;\n Set<int[]> set = new HashSet<>();\n \n for( int i = 1; i<=nodes; i++ ){\n\t\t\tobj.makeSet( i );\n\t\t}\n\t\t\n for( int[] edge: edges ){\n\t\t\tint edge1 = edge[0];\n\t\t\tint edge2 = edge[1];\n\t\t\tset.add( edge );\n\t\t\t\n\t\t\tif( obj.findSet_representative( edge1 ) != obj.findSet_representative( edge2 ) ){\n\t\t\t\tset.remove( edge );\n\t\t\t\tobj.union( edge1, edge2 );\n\t\t\t}\n\t\t}\n\n Iterator<int[]> iterator = set.iterator();\n\n return iterator.next();\n }", "private static List<List<Integer[]>> getDIOCrossConnect() {\n List<List<Integer[]>> pairs = new ArrayList<List<Integer[]>>();\n List<Integer[]> setA =\n Arrays.asList(\n new Integer[][] {\n {DIOCrossConnectA1, DIOCrossConnectA2},\n {DIOCrossConnectA2, DIOCrossConnectA1}\n });\n pairs.add(setA);\n\n List<Integer[]> setB =\n Arrays.asList(\n new Integer[][] {\n {DIOCrossConnectB1, DIOCrossConnectB2},\n {DIOCrossConnectB2, DIOCrossConnectB1}\n });\n pairs.add(setB);\n // NOTE: IF MORE DIOCROSSCONNECT PAIRS ARE ADDED ADD THEM HERE\n return pairs;\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic void colleceRelatedPairs() {\n\t\trelatedPairs = new HashSet[words.size()];\n\t\tfor(int i = 0; i < relatedPairs.length; i++){\n\t\t\tSet<Integer> related = new HashSet<Integer>();\n\t\t\trelatedPairs[i] = related;\n\t\t}\n\t\t\n\t\tlong uniquePairs = 0;\n\t\tfor(int i = 0; i < words.size(); i++){\n\t\t\tif(goodWords.get(i)){\n\t\t\t\tString word1 = words.get(i);\n\t\t\t\tfor(int j = i+1; j < words.size(); j++){\n\t\t\t\t\tif(goodWords.get(j)){\n\t\t\t\t\t\tString word2 = words.get(j);\n\t\t\t\t\t\t\n\t\t\t\t\t\tuniquePairs++;\n\t\t\t\t\t\tint similarity = binDst.getSimilarity(word1, word2);\n\t\t\t\t\t\tif(similarity == 1){\n\t\t\t\t\t\t\t//System.out.println(word1 + \"\\t\" + word2);\n\t\t\t\t\t\t\taddPair(i, j);\n\t\t\t\t\t\t\taddPair(j, i);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i % 1000 == 0){\n\t\t\t\tLOGGER.info(\"Pairs: \" + i);\n\t\t\t}\n\t\t}\n\t\tLOGGER.info(\"Unique Pairs: \" + uniquePairs);\n\t}", "public static long journeyToMoon(int n, List<List<Integer>> astronaut) {\n // Write your code here\n Map<Integer, Node<Integer>> countryMap = new HashMap<>();\n for(List<Integer> pairs: astronaut) {\n Node<Integer> node1 = countryMap.computeIfAbsent(pairs.get(0), Node::new);\n Node<Integer> node2 = countryMap.computeIfAbsent(pairs.get(1), Node::new);\n node1.connected.add(node2);\n node2.connected.add(node1);\n }\n\n List<Integer> countryCluster = new ArrayList<>();\n for(Node<Integer> node: countryMap.values()) {\n if(node.connected.size() == 0) {\n countryCluster.add(1);\n } else if(!node.visited){\n countryCluster.add(getNodeCount3(node));\n }\n }\n List<Integer> countryNodes = countryMap.values().stream().map(nn -> nn.value).collect(Collectors.toList());\n List<Integer> missingNodes = new ArrayList<>();\n for(int i=0; i < n; i++) {\n if(!countryNodes.contains(i))\n missingNodes.add(i);\n }\n\n for(int i=0; i < missingNodes.size(); i++) {\n countryCluster.add(1);\n }\n\n long ans = 0;\n //For one country we cannot pair with any other astronauts\n if(countryCluster.size() >= 2) {\n ans = (long) countryCluster.get(0) * countryCluster.get(1);\n if(countryCluster.size() > 2) {\n int sum = countryCluster.get(0) + countryCluster.get(1);\n for(int i=2; i < countryCluster.size(); i++) {\n ans += (long) sum * countryCluster.get(i);\n sum += countryCluster.get(i);\n }\n }\n }\n\n /*\n permutation of two set with size A and B = AxB\n permutation of three set with size A,B,C = AxB + AxC + BxC = AxB + (A+B)xC\n permutation of four set with size A,B,C,D = AxB + AxC + AxD + BxC + BxD + CxD = AxB + (A+B)xC + (A+B+C)xD\n */\n /*\n if(keys.length == 1) {\n ans = keys[0].size();\n } else {\n ans = keys[0].size() * keys[1].size();\n if(keys.length > 2) {\n int sum = keys[0].size() + keys[1].size();\n for (int i = 2; i < keys.length; i++) {\n ans += sum * keys[i].size();\n sum += keys[i].size();\n }\n }\n }\n */\n return ans;\n }", "private List<AxiomTreeMapping> matchNodeLists(List<AxiomTreeNode> t1s, List<AxiomTreeNode> t2s, AxiomTreeMapping mapping) {\n\n // no more child nodes left\n if (t1s.isEmpty()) {\n return Collections.singletonList(mapping);\n }\n\n List<AxiomTreeMapping> matches = new ArrayList<AxiomTreeMapping>();\n\n // get the first child node in the list\n AxiomTreeNode t1 = t1s.get(0);\n List<AxiomTreeNode> t1sReduced = reduceNodeList(t1s, 0);\n //System.out.println(\"FIRST CHILD NODES: \" + t1sReduced);\n // loop over child nodes in t2s\n for (int i = 0; i < t2s.size(); i++) {\n AxiomTreeNode t2 = t2s.get(i);\n List<AxiomTreeNode> t2sReduced = reduceNodeList(t2s, i);\n //System.out.println(\"SECOND CHILD NODES: \" + t2sReduced);\n // try and match the first element in t1s and some element in t2\n for (AxiomTreeMapping match : match(t1, t2, mapping)) {\n matches.addAll(matchNodeLists(t1sReduced, t2sReduced, match));\n }\n }\n \n return matches;\n }", "public Set<Edge<V>> edgeSet();", "public Set<V> findCycles()\n {\n // ProbeIterator can't be used to handle this case,\n // so use StrongConnectivityAlgorithm instead.\n StrongConnectivityAlgorithm<V, E> inspector =\n new KosarajuStrongConnectivityInspector<>(graph);\n List<Set<V>> components = inspector.stronglyConnectedSets();\n\n // A vertex participates in a cycle if either of the following is\n // true: (a) it is in a component whose size is greater than 1\n // or (b) it is a self-loop\n\n Set<V> set = new LinkedHashSet<>();\n for (Set<V> component : components) {\n if (component.size() > 1) {\n // cycle\n set.addAll(component);\n } else {\n V v = component.iterator().next();\n if (graph.containsEdge(v, v)) {\n // self-loop\n set.add(v);\n }\n }\n }\n\n return set;\n }", "public HashSet<N> getNodes()\r\n/* 99: */ {\r\n/* 100:182 */ assert (checkRep());\r\n/* 101: */ \r\n/* 102:184 */ return new HashSet(this.map.keySet());\r\n/* 103: */ }", "LinkedList<Loop> getCommonEnclosingLoops();", "public static ArrayList<Set<String>> getConnectedComponentsInDistrict(\n District district,\n HashMap<String, PrecinctNeighborRelation> precinctNeighborRelationMap) {\n // ( precinctGeoId : PrecinctNeighborRelation } pair in precinctNeighborRelationMap\n\n // first, build from -> to_list hash map\n HashMap<String, ArrayList<String>> fromToList = new HashMap<>();\n for(PrecinctNeighborRelation pnr : precinctNeighborRelationMap.values()) {\n ArrayList<NeighborData> ndList = pnr.getNeighborDataList();\n ArrayList<String> toGeoidList = new ArrayList<>();\n for(NeighborData nd : ndList)\n toGeoidList.add(nd.getToGeoId());\n fromToList.put(pnr.getFromGeoId(), toGeoidList);\n }\n\n Set<Precinct> precinctsOfDistrict = district.getPrecincts();\n\n ArrayList<String> pgeoidsOfDistrict = new ArrayList<>();\n ArrayList<Set<String>> connectedComponentList = new ArrayList<>();\n HashMap<String, Set<String>> referenceToItsSet = new HashMap<>();\n\n for(Precinct p : precinctsOfDistrict) {\n Set<String> connectedComponent = new HashSet<>();\n connectedComponent.add(p.getGeoId());\n connectedComponentList.add(connectedComponent);\n referenceToItsSet.put(p.getGeoId(), connectedComponent);\n pgeoidsOfDistrict.add(p.getGeoId());\n }\n\n for(Precinct p : precinctsOfDistrict) {\n ArrayList<String> toGeoidList = fromToList.get(p.getGeoId());\n Set<String> itsSet = referenceToItsSet.get(p.getGeoId());\n for(String neighborGeoid : toGeoidList) {\n // if the neighbor is in same district\n // if itsSet not yet contains the neighbor\n if(pgeoidsOfDistrict.contains(neighborGeoid)\n && !itsSet.contains(neighborGeoid)) {\n // neighbors set will be removed from the memory\n Set<String> neighborsSet = referenceToItsSet.get(neighborGeoid);\n for(String elementFromNeighborSet : neighborsSet) {\n referenceToItsSet.put(elementFromNeighborSet, itsSet);\n itsSet.add(elementFromNeighborSet);\n }\n connectedComponentList.remove(neighborsSet);\n }\n }\n }\n\n // stubbed\n// Set<Precinct> oneset = new HashSet<>();\n// ArrayList<Set<Precinct>> listSizeOne = new ArrayList<>();\n// listSizeOne.add(oneset);\n if(connectedComponentList.size() > 1) {\n //System.out.println(\"District: \" + district.getGeoId() + \" has \" + connectedComponentList.size() + \" components\");\n }\n return connectedComponentList;\n }", "public Set<Set<Entity>> getEdgeBetweennessClusters(double ratioEdgesToRemove)\r\n\t{\r\n\t\tint numEdgesToRemove = (int) (getNumberOfEdges() * ratioEdgesToRemove);\r\n\t\tEdgeBetweennessClusterer<Entity, EntityGraphEdge> betweenClusterer = new EdgeBetweennessClusterer<Entity, EntityGraphEdge>(\r\n\t\t\t\tnumEdgesToRemove);\r\n\r\n\t\tList<Set<Entity>> clusters = new ArrayList<Set<Entity>>(\r\n\t\t\t\tbetweenClusterer.transform(directedGraph));\r\n\t\tlogger.info(\"Number of edge-betweenness clusters: \" + clusters.size());\r\n\t\tCollections.sort(clusters, sortListBySizeDescending);\r\n\r\n\t\tIterator<Set<Entity>> clusterIter = clusters.iterator();\r\n\t\tSet<Set<Entity>> clusterSet = new HashSet<Set<Entity>>();\r\n\r\n\t\twhile (clusterIter.hasNext()) {\r\n\t\t\tSet<Entity> nodeCluster = clusterIter.next();\r\n\t\t\tSet<Entity> entCluster = new HashSet<Entity>();\r\n\t\t\tfor (Entity node : nodeCluster) {\r\n\t\t\t\tentCluster.add(node);\r\n\t\t\t}\r\n\t\t\tlogger.info(\"Cluster's size: \" + entCluster.size());\r\n\t\t\tclusterSet.add(entCluster);\r\n\t\t}\r\n\t\treturn clusterSet;\r\n\t}", "private Set<Integer>[] getKernelDAG(List<Integer>[] adjacent) {\n Set<Integer>[] adjacentComponents = (HashSet<Integer>[]) new HashSet[sccCount];\n for (int i = 0; i < adjacentComponents.length; i++) {\n adjacentComponents[i] = new HashSet<>();\n }\n\n for (int vertexId = 0; vertexId < adjacent.length; vertexId++) {\n int currentComponent = sccIds[vertexId];\n\n for (int neighbor : adjacent[vertexId]) {\n if (currentComponent != sccIds[neighbor]) {\n adjacentComponents[currentComponent].add(sccIds[neighbor]);\n }\n }\n }\n return adjacentComponents;\n }", "private TreeSet<Integer> getNeightborSets(DisjointSets<Pixel> ds, int root)\n {\n return null; //TODO: remove and replace this line\n }", "public Set<E> getEdges();", "private List<List<Node>> combinationHelper(int k, int n) {\n\t\tList<List<Node>> res = new ArrayList<List<Node>>();\n\t\tList<int[]> combRes = combinationHelperImpl(k, n);\n\t\tfor (int[] elem : combRes) {\n\t\t\tArrays.sort(elem);\n\t\t\tList<Node> tmp = new ArrayList<Node>();\n\t\t\tfor (int i : elem) {\n\t\t\t\ttmp.add(queryNodes.get(i));\n\t\t\t}\n\t\t\tres.add(new ArrayList<Node>(tmp));\n\t\t}\n\t\treturn res;\n\t}", "Relations getGroupOfRelations();", "public static void pseudoTrueTuples(LogicProblem logicProblem, boolean applyChanges)\r\n throws RelationshipConflictException {\n \r\n HashMap<ItemPair,Relationship> relationshipTable = logicProblem.getRelationshipTable();\r\n HashSet<CategoryPair> categoryPairs = logicProblem.getCategoryPairs();\r\n \r\n// System.out.println(\"searching...\");\r\n //within a subgrid\r\n for (CategoryPair categoryPair : categoryPairs) {\r\n// System.out.println(\"Category pair:\" + categoryPair);\r\n //vertical and horizontal search\r\n for (final boolean verticalOrientation : new boolean[] { false, true } ) {\r\n\r\n Category subrowCategory = verticalOrientation?categoryPair.first():categoryPair.last();\r\n Category subcolumnCategory = verticalOrientation?categoryPair.last():categoryPair.first();\r\n\r\n //commenting \"vertical search\" \r\n //(subrows match first category's items\r\n // subcolumns match second category's items)\r\n\r\n //i (2 to floor(n/2)) is the number of elements in the combination tuple\r\n // i=2 in pseudoTrue pairs\r\n //(for subgrids of 5x5 items, looking for both pairs and triplets becomes redundant\r\n for (int i=2; i<=floor(logicProblem.getNumCategories()/2);i++) {\r\n\r\n //https://github.com/dpaukov/combinatoricslib3/wiki/v3.3.0#1-simple-combinations\r\n List<List<Item>> columnCombinations = Generator.combination(subcolumnCategory.getItems())\r\n .simple(i) //for pseudo true pairs, i=2\r\n .stream()\r\n .collect(Collectors.<List<Item>>toList());\r\n //for i=2, this would contain \r\n //Bethany, Donovan\r\n //Bethany, Elizabeth\r\n //...\r\n //Frederick, Peyton\r\n// columnCombinations.stream().forEach(l -> System.out.println(\r\n// (verticalOrientation?\"vertical\":\"horizontal\")+ \" combo: \"+l.toString()));\r\n\r\n //create the sets\r\n //for each combination, start over\r\n \r\n //columnTuple contains i items with which we will compute set intersections\r\n for (List<Item> columnItemTuple : columnCombinations) {\r\n //Bethany, Donovan\r\n \r\n //similarly, valueNoSets contains i sets of VALUE_NO relationships\r\n List<Set<Item>> valueNoSets = new ArrayList<>(); //size=i\r\n //build a set for each i item of columnTuple\r\n for (Item columnItem : columnItemTuple) {\r\n //Bethany\r\n Set<Item> valueNoSet = new HashSet<>(); //size = n\r\n for (Item rowItem : subrowCategory.getItems()) {\r\n //Haley's Comet ....\r\n if (relationshipTable.get(new ItemPair(rowItem, columnItem)).getValue() == Relationship.ValueType.VALUE_NO)\r\n //stacking all VALUE_NO relationship into vertical set\r\n valueNoSet.add(rowItem); //store into single subcolumn set \r\n }\r\n //adding each vertical set into list of sets\r\n if (valueNoSet.size() >= logicProblem.getNumItems() - i //for pairs, we need three VALUE_NO in the set\r\n && valueNoSet.size() < logicProblem.getNumItems()-1) //uniqueness will take or n-1 cases\r\n valueNoSets.add(valueNoSet); //store single subcolumn into multi-set\r\n }\r\n //magic!\r\n Set<Item> intersectionSet = new HashSet<>(); //avoid NPE when the next call is made\r\n if (valueNoSets.size()>=2) //don't compute intersections otherwise\r\n intersectionSet = Processor.multiSetIntersection(valueNoSets);\r\n\r\n if (intersectionSet.size()==logicProblem.getNumItems()-i) {\r\n \r\n// System.out.println(\"----> found candidates for pseudo true pairs!\");\r\n// intersectionSet.stream().forEach(l -> System.out.println(\"\\t\" + l.toString()));\r\n// System.out.println(\"\\t\\tvs.\");\r\n// columnItemTuple.stream().forEach(l -> System.out.println(\"\\t\" + l.toString()));\r\n \r\n //create predecessor list\r\n //we can only add the intersection output as predecessors\r\n ArrayList<Dependable> predecessors = new ArrayList<Dependable>();\r\n for (Item intersectionColumn : intersectionSet) {\r\n for (Item rowItem : columnItemTuple) {\r\n predecessors.add(relationshipTable.get(new ItemPair(rowItem, intersectionColumn)));\r\n }\r\n }\r\n\r\n\r\n //we have a bunch of work to do\r\n for (Item everyRowItem : subrowCategory.getItems()) {\r\n //for every row item not in the intersectionSet\r\n if (!intersectionSet.contains(everyRowItem)) {\r\n for (Item everyColumnItem : subcolumnCategory.getItems()) {\r\n //for every column item not in any of the columnTuple list\r\n if (!columnItemTuple.contains(everyColumnItem)) {\r\n Relationship rel = relationshipTable.get(new ItemPair(everyRowItem,everyColumnItem));\r\n if (rel.getValue()!=Relationship.ValueType.VALUE_NO)\r\n Processor.setRelationship(logicProblem, applyChanges, rel, \r\n Relationship.ValueType.VALUE_NO, Relationship.LogicType.PSEUDOTRUE,\r\n predecessors.toArray(new Relationship[predecessors.size()])); \r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "@Override\r\n\tpublic Set<Set<Entity>> getStructuralEquivalences()\r\n\t{\r\n\t\tStructurallyEquivalent<Entity, EntityGraphEdge> equivalent = new StructurallyEquivalent<Entity, EntityGraphEdge>();\r\n\t\tVertexPartition<Entity, EntityGraphEdge> vertexPartition = equivalent\r\n\t\t\t\t.transform(directedGraph);\r\n\r\n\t\treturn new HashSet<Set<Entity>>(vertexPartition.getVertexPartitions());\r\n\t}", "public abstract Multigraph buildMatchedGraph();", "private void traverseSets() {\n\t\tArrayList<PayloadBuilderSet> sets = new ArrayList<PayloadBuilderSet>();\n\t\tArrayList<PayloadBuilder> builders = new ArrayList<PayloadBuilder>();\n\n\t\tfor (PayloadSetConfiguration payloadSetConfiguration : workloadConfiguration.getPayloadSetConfigurations()) {\n\t\t\tConcurrentLinkedQueue<PayloadSetConfiguration> queue = new ConcurrentLinkedQueue<PayloadSetConfiguration>();\n\t\t\tqueue.offer(payloadSetConfiguration);\n\n\t\t\twhile (!queue.isEmpty()) {\n\t\t\t\tPayloadSetConfiguration setConfiguration = queue.poll();\n\n\t\t\t\t// If the configuration has payloads, create a new set and add it.\n\t\t\t\tif (setConfiguration.getNumPayloads() > 0) {\n\t\t\t\t\tPayloadBuilderSet set = new PayloadBuilderSet(setConfiguration, this);\n\n\t\t\t\t\tsets.add(set);\n\n\t\t\t\t\tfor (PayloadBuilder builder : set.getBuilders())\n\t\t\t\t\t\tbuilders.add(builder);\n\t\t\t\t}\n\n\t\t\t\t// Enqueue child sets for traversal\n\t\t\t\tfor (PayloadSetConfiguration childSetConfiguration : setConfiguration\n\t\t\t\t\t\t.getChildPayloadSetConfigurations()) {\n\t\t\t\t\tqueue.offer(childSetConfiguration);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.sets = sets.toArray(new PayloadBuilderSet[0]);\n\t\tthis.builders = builders.toArray(new PayloadBuilder[0]);\n\n\t}", "public int[] findRedundantConnection(int[][] edges) {\n int[] parent = new int[2*edges.length];\n int[] sz = new int[parent.length];\n // initialize parent array, every element points to itself\n for (int i = 0; i < parent.length; i++) parent[i] = i;\n Arrays.fill(sz, 1);\n\n for (int[] edge : edges) {\n int p = find(parent, edge[0]);\n int q = find(parent, edge[1]);\n if (p==q) return edge;\n union(parent, sz, p, q);\n }\n return new int[2]; // default return, if no such edge found\n }", "public static ArrayList<HashSet<Integer>> clustersFromEdges(ArrayList<ImageSegmentNode> nodes,\n ArrayList<ImageSegmentEdge> edges,\n int k) {\n boolean[] inCluster = new boolean[nodes.size()];\n Arrays.fill(inCluster, false);\n\n ArrayList<HashSet<Integer>> clusters = Stream.generate(HashSet<Integer>::new)\n .limit(k)\n .collect(Collectors.toCollection(ArrayList::new));\n\n\n @SuppressWarnings(\"unchecked\")\n ArrayList<ImageSegmentEdge> edgeList = (ArrayList<ImageSegmentEdge>) edges.clone();\n\n int i = 0;\n for (int j = 0; j < nodes.size(); j++) {\n boolean incrementI = false;\n ArrayList<Integer> queue = new ArrayList<>();\n\n if (!inCluster[j]) {\n queue.add(j);\n incrementI = true;\n }\n\n while (!queue.isEmpty()) {\n int node = queue.remove(0);\n\n if (!inCluster[node]) {\n clusters.get(i).add(node);\n inCluster[node] = true;\n\n for (ImageSegmentEdge edgeTwo : edgeList) {\n if (edgeTwo.getA() == node && !inCluster[edgeTwo.getB()]) {\n queue.add(edgeTwo.getB());\n } else if (edgeTwo.getB() == node && !inCluster[edgeTwo.getA()]) {\n queue.add(edgeTwo.getA());\n }\n }\n }\n }\n if (incrementI) {\n i++;\n }\n }\n return clusters;\n }", "private TIntSet removeUnconnectedMentionEntityPairs(Graph g, Map<ResultMention, List<ResultEntity>> solution) {\n TIntSet mentionsToRemove = new TIntHashSet();\n for (int mentionId : g.getMentionNodesIds().values()) {\n GraphNode mentionNode = g.getNode(mentionId);\n Mention mention = (Mention) mentionNode.getNodeData();\n TIntDoubleHashMap entityCandidates = mentionNode.getSuccessors();\n if (entityCandidates.size() == 0) {\n continue;\n }\n // Remove all mentions without any entities that have coherence edges.\n if (g.isLocalMention(mentionId)) {\n logger.debug(\"local mention removed: \" + mentionId + \" \" + mention);\n mentionsToRemove.add(mentionId);\n GraphTracer.gTracer.addMentionToDangling(g.getName(), mention.getMention(), mention.getCharOffset());\n // Set solution to best local candidate.\n Pair<Integer, Double> bestEntityScore = getBestLocalCandidateAndScore(entityCandidates);\n int bestEntity = bestEntityScore.getKey();\n double score = bestEntityScore.getValue();\n updateSolution(solution, g, mention, bestEntity, score);\n }\n\n }\n TIntSet entitiesToRemove = new TIntHashSet();\n // Remove entities that are only connected to removed mentions.\n for (int entityId : g.getEntityNodesIds().values()) {\n GraphNode entityNode = g.getNode(entityId);\n TIntDoubleHashMap successors = entityNode.getSuccessors();\n int removedCount = 0;\n for (TIntDoubleIterator itr = successors.iterator(); itr.hasNext(); ) {\n itr.advance();\n int neighborId = itr.key();\n if (mentionsToRemove.contains(neighborId)) {\n ++removedCount;\n }\n }\n if (removedCount == successors.size()) {\n entitiesToRemove.add(entityId);\n }\n }\n // Remove mentions + entity candidates from graph, trace.\n TIntSet nodesToRemove = new TIntHashSet(mentionsToRemove.size() + entitiesToRemove.size());\n nodesToRemove.addAll(mentionsToRemove);\n nodesToRemove.addAll(entitiesToRemove);\n return nodesToRemove;\n }", "public Set<Pair<State, State>> getRefinementPairs() {\n\t\tSet<Pair<State, State>> result = new HashSet<Pair<State, State>>();\r\n\t\tIterator<SpoilerVertice> it = spoilerVertices.iterator();\r\n\t\tSpoilerVertice vertice;\r\n\t\tPair<State, State> pair;\r\n\t\twhile(it.hasNext())\r\n\t\t{\r\n\t\t\tvertice = it.next();\r\n\t\t\tpair = new Pair<State, State>(vertice.getSpecificationState(), vertice.getModelState());\r\n\t\t\tresult.add(pair);\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "private void connectAll()\n {\n\t\tint i = 0;\n\t\tint j = 1;\n\t\twhile (i < getNodes().size()) {\n\t\t\twhile (j < getNodes().size()) {\n\t\t\t\tLineEdge l = new LineEdge(false);\n\t\t\t\tl.setStart(getNodes().get(i));\n\t\t\t\tl.setEnd(getNodes().get(j));\n\t\t\t\taddEdge(l);\n\t\t\t\tj++;\n\t\t\t}\n\t\t\ti++; j = i+1;\n\t\t}\n\n }", "public abstract ArrayList<Pair<Vector2, Vector2>> getEdges();", "protected abstract Collection<Street> findConnectedStreets(\r\n StreetNode streetNode);", "Set<Set<V>> routine3(Graph<V, E> g)\n {\n Set<Set<V>> NuvList = new HashSet<>();\n for (V u : g.vertexSet()) {\n for (V v : g.vertexSet()) {\n if (u == v || !g.containsEdge(u, v))\n continue;\n NuvList.add(N(g, u, v));\n }\n }\n\n Set<Set<V>> tripleList = new HashSet<>();\n for (V a : g.vertexSet()) {\n for (V b : g.vertexSet()) {\n if (a == b || g.containsEdge(a, b))\n continue;\n Set<V> Nab = N(g, a, b);\n for (V c : g.vertexSet()) {\n if (isTripleRelevant(g, a, b, c)) {\n tripleList.add(X(g, Nab, c));\n }\n }\n }\n }\n Set<Set<V>> res = new HashSet<>();\n for (Set<V> Nuv : NuvList) {\n for (Set<V> triple : tripleList) {\n Set<V> temp = new HashSet<>();\n temp.addAll(Nuv);\n temp.addAll(triple);\n res.add(temp);\n }\n }\n return res;\n }", "private int[][] generateCandidates(int[][] usageM){\n\t\t// 1. start with the complete set of attributes\n\t\tMap<Integer, List<Integer>> partitionAttributes = new HashMap<Integer,List<Integer>>();\n\t\tList<Integer> attributes = new ArrayList<Integer>();\n\t\tfor(int i=0;i<usageM[0].length;i++)\n\t\t\tattributes.add(i);\n\t\tpartitionAttributes.put(0, attributes);\n\t\t\n\t\t// 2. for each query, split this set of attributes into two set:\n\t\t// (i) attributes accessed by the query\n\t\t//\t (ii) attributes not-accessed by the query\n\t\tfor(int[] query: usageM){\n\t\t\tMap<Integer, List<Integer>> newPartitionAttributes = new HashMap<Integer,List<Integer>>();\n\t\t\tint partitionCount = partitionAttributes.size();\n\t\t\t\n\t\t\t// check each partition\n\t\t\tfor(int p: partitionAttributes.keySet()){\n\t\t\t\tList<Integer> attrs = partitionAttributes.get(p);\n\t\t\t\tboolean fullPartitionAccess = true;\n\t\t\t\tfor(int a: attrs){\n\t\t\t\t\tif(query[a]==0)\n\t\t\t\t\t\tfullPartitionAccess = false;\n\t\t\t\t}\n\n\t\t\t\tif(fullPartitionAccess){\n\t\t\t\t\tnewPartitionAttributes.put(p, attrs);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t//int newPartition = partitionAttributes.size();\n\t\t\t\t\tList<Integer> accessedAttrs = new ArrayList<Integer>();\n\t\t\t\t\tList<Integer> nonAccessedAttrs = new ArrayList<Integer>();\n\t\t\t\t\tfor(int a: attrs){\n\t\t\t\t\t\tif(query[a]==1)\n\t\t\t\t\t\t\taccessedAttrs.add(a);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnonAccessedAttrs.add(a);\n\t\t\t\t\t}\n\t\t\t\t\tif(nonAccessedAttrs.size() > 0)\n\t\t\t\t\t\tnewPartitionAttributes.put(p, nonAccessedAttrs);\n\t\t\t\t\tif(accessedAttrs.size() > 0)\n\t\t\t\t\t\tnewPartitionAttributes.put(partitionCount++, accessedAttrs);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//System.out.println(newPartitionAttributes);\n\t\t\t\n\t\t\tpartitionAttributes = newPartitionAttributes;\n\t\t}\n\t\t\n\t\t\n\t\t// 3. we end up with a set of attribute sets; all attributes in \n\t\t//\t an attribute set are always accessed together.\n\t\tint[][] primaryPartitions = new int[partitionAttributes.size()][];\n\t\tint i=0;\n\t\tfor(int p: partitionAttributes.keySet()){\n\t\t\tList<Integer> attrs = partitionAttributes.get(p);\n\t\t\tprimaryPartitions[i] = new int[attrs.size()];\n\t\t\tfor(int j=0;j<attrs.size();j++)\n\t\t\t\tprimaryPartitions[i][j] = attrs.get(j);\n\t\t\ti++;\n\t\t}\n\t\t\n\t\treturn primaryPartitions;\n\t}", "private Set<E> toSet(Node<E> n) {\n Set<E> result = new HashSet<>();\n toSet(result, n);\n return result;\n }", "public DisjointSets getSets()\n\t{\n\t\treturn sets;\n\t}", "public JavaPairRDD<String, Tuple2<Iterable<Integer>, Iterable<Integer>>> cogroupExample(){\n return firstSet\n .cogroup(secondSet);\n }", "public void testEdgesSet_ofVertices() {\n System.out.println(\"edgesSet\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n\n for (int i = 0; i < 25; i++) {\n for (int j = 0; j < 25; j++) {\n Set<Edge<Integer>> set = graph.edgesSet(new Integer(i), new Integer(j));\n\n if ((i + j) % 2 == 0) {\n Assert.assertEquals(set.size(), 1);\n } else {\n Assert.assertEquals(set.size(), 0);\n }\n }\n }\n }", "public Set<T> common(T item1, T item2) {\n\t\tSet<T> commomFriends = new HashSet<>();\n\n\t\tif (getNodeIndex(item1)>=0 && getNodeIndex(item2)>=0 ) {//si existen los nodos\n\t\t\tfor (EDEdge<W> edge : nodes.get(getNodeIndex(item1)).lEdges) {\n\t\t\t\tT friend = getNodeValue(edge.getTarget());\n\n\t\t\t\tfor (EDEdge<W> edge2 : nodes.get(getNodeIndex(item2)).lEdges) {\n\t\t\t\t\tT friend2 = getNodeValue(edge2.getTarget());\n\n\t\t\t\t\tif (friend.equals(friend2)) { \n\t\t\t\t\t\tcommomFriends.add(friend2);\n\t\t\t\t\t} \n\t\t\t\t}\t\n\t\t\t}//end for edge\t\t\t\n\t\t\treturn commomFriends;\t\t\t\n\t\t}\n\t\treturn null;\n\t}", "private SortedSet<NodeStation> generateNodeStations() throws GenerationException {\n // create Set of NodeStations\n SortedSet<NodeStation> nodeStations = new TreeSet<>();\n for (ReferenceStation referenceStation : referenceStations) {\n nodeStationGenerator.referenceStation(referenceStation).generate()\n .ifPresent(nodeStations::add);\n }\n return nodeStations;\n }", "@Override\n\tpublic Set<ET> getAdjacentEdges(N node)\n\t{\n\t\t// implicitly returns null if gn is not in the nodeEdgeMap\n\t\tSet<ET> adjacentEdges = nodeEdgeMap.get(node);\n\t\treturn adjacentEdges == null ? null : new HashSet<ET>(adjacentEdges);\n\t}", "public Set<String> LCS(String instance1, String instance2)\r\n\t{\r\n\t\tSet<String> parents1 = new HashSet<String>();\t\r\n\t\tfor(Iterator<String> iter = listBelongingClasses(instance1);iter.hasNext(); )\r\n\t\t\tparents1.add(iter.next());\r\n\t\t\r\n\r\n\t\tSet<String> parents2 = new HashSet<String>();\t\r\n\t\tfor(Iterator<String> iter = listBelongingClasses(instance2);iter.hasNext(); )\r\n\t\t\tparents2.add(iter.next());\t\r\n\t\t\r\n\t\tSet<String> res = new HashSet<String>();\r\n\t\tint maxProf = Integer.MIN_VALUE;\r\n\t\t\r\n\t\tparents1.retainAll(parents2);\r\n\t\tfor(String c: parents1)\r\n\t\t{\r\n\t\t\tint pc = this.profConcept(c);\r\n\t\t\tif(pc>maxProf)\r\n\t\t\t{\r\n\t\t\t\tres.clear();\r\n\t\t\t\tres.add(c);\r\n\t\t\t\tmaxProf = pc;\r\n\t\t\t}\r\n\t\t\telse if(pc==maxProf)\r\n\t\t\t{\r\n\t\t\t\tres.add(c);\r\n\t\t\t\tmaxProf = pc;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn res;\r\n\t\t\r\n\t\t\r\n\t\t/*\r\n\t\tSet<String> res = new HashSet<String>();\r\n\t\t\r\n\t\tSet<String> sc1 = new HashSet<String>();\t\r\n\t\tfor(Iterator<String> iter = listDeclaredBelongingClasses(instance1);iter.hasNext(); )\r\n\t\t\tsc1.add(iter.next());\r\n\t\t\r\n\t\tSet<String> sc2 = new HashSet<String>();\t\r\n\t\tfor(Iterator<String> iter = listDeclaredBelongingClasses(instance2);iter.hasNext(); )\r\n\t\t\tsc2.add(iter.next());\r\n\t\t\r\n\t\tSet<String> inter = new HashSet<String>(sc1);\r\n\t\tinter.retainAll(sc2);\r\n\t\t\r\n\t\tres.addAll(inter);\r\n\t\t\r\n\t\tsc1.removeAll(inter);\r\n\t\tsc2.removeAll(inter);\r\n\t\t\r\n\t\t\r\n\t\tSet<String> sparentsc1 = new HashSet<String>();\r\n\t\tSet<String> sparentsc2 = new HashSet<String>();\r\n\r\n\t\twhile(!sc1.isEmpty() && !sc2.isEmpty())\r\n\t\t{\r\n\t\t\t\r\n\t\t\tfor(String c1: sc1)\r\n\t\t\t{\r\n\t\t\t\tIterator<String> iter = listSuperClasses(c1, true);\r\n\t\t\t\tif(iter != null)\r\n\t\t\t\t\twhile(iter.hasNext())\r\n\t\t\t\t\t\tsparentsc1.add(iter.next());\r\n\t\t\t}\r\n\t\t\tfor(String c2: sc2)\r\n\t\t\t{\r\n\t\t\t\tIterator<String> iter = listSuperClasses(c2, true);\r\n\t\t\t\tif(iter != null)\r\n\t\t\t\t\twhile(iter.hasNext())\r\n\t\t\t\t\t\tsparentsc2.add(iter.next());\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tinter.clear();\r\n\t\t\tinter.addAll(sparentsc1);\r\n\t\t\tinter.retainAll(sparentsc2);\r\n\t\t\t\r\n\t\t\tres.addAll(inter);\r\n\t\t\tsparentsc1.removeAll(inter);\r\n\t\t\tsparentsc2.removeAll(inter);\r\n\t\t\t\r\n\t\t\tsc1 = new HashSet<String>(sparentsc1);\r\n\t\t\tsc2 = new HashSet<String>(sparentsc2);\r\n\t\t}\r\n\t\treturn inter;\r\n\t\t*/\r\n\t}", "protected abstract Set<T> findNeighbors(T node, Map<T, T> parentMap);", "Set<CyEdge> getExternalEdgeList();", "public Set getNodesThatCall(PassedParameter pp) {\n if (USE_PARAMETER_MAP) {\n Set s = (Set)passedParamToNodes.get(pp);\n if (s == null) return Collections.EMPTY_SET;\n return s;\n }\n Set s = NodeSet.FACTORY.makeSet();\n getNodesThatCall(pp, s);\n return s;\n }", "@SuppressWarnings({\"unchecked\"})\n public <T extends FamixAssociation> List<T> queryAssociationsBetweenEntitySets(\n List<? extends AbstractFamixEntity> set1, \n List<? extends AbstractFamixEntity> set2, \n java.lang.Class<T> associationType) throws EvolizerRuntimeException {\n\n associationType = (associationType != null) ? associationType : (Class<T>) org.evolizer.famix.model.entities.FamixAssociation.class;\n\n List<T> associations = new ArrayList<T>();\n try {\n Criteria invocationQuery = getHibernateSession().createCriteria(associationType).add(\n Restrictions.or(\n Restrictions.and(Restrictions.in(\"from\", set1), Restrictions.in(\"to\", set2)),\n Restrictions.and(Restrictions.in(\"to\", set1), Restrictions.in(\"from\", set2))\n )\n );\n\n associations = invocationQuery.list();\n } catch (HibernateException he) {\n fLogger.error(\"Error in queryAssociationsBetweenEntities \" + he.getMessage());\n throw new EvolizerRuntimeException(\"Error in queryAssociationsBetweenEntitySets\", he);\n } catch (EvolizerException ee) {\n fLogger.error(\"Error in queryAssociationsBetweenEntities \" + ee.getMessage());\n throw new EvolizerRuntimeException(\"Error in queryAssociationsBetweenEntitySets\", ee);\n }\n\n return associations;\n }", "private void categoriseNodes(final CyNetwork result, final Set<CyNode> leftSet,\n\t\t\t\t final Set<CyNode> rightSet)\n\t{\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal Set<CyNode> orig1 = new HashSet<CyNode>(network1.nodesList());\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal Set<CyNode> orig2 = new HashSet<CyNode>(network2.nodesList());\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal List<CyNode> resultNodes = (List<CyNode>)result.nodesList();\n\t\t\n\t\tfinal CyAttributes nodeAttr = Cytoscape.getNodeAttributes();\n\t\t\n\t\tfor (final CyNode node : resultNodes) {\n\t\t\tfinal boolean inNetwork1 = orig1.contains(node);\n\t\t\tfinal boolean inNetwork2 = orig2.contains(node);\n\t\t\t\n\t\t\tif (inNetwork1 && inNetwork2)\n\t\t\t\t/* Do Nothing. */;\n\t\t\telse if (inNetwork1 && !inNetwork2) {\n\t\t\t\tleftSet.add(node);\n\t\t\t\tnodeAttr.setAttribute(node.getIdentifier(), visualStyleName, network1.getTitle());\n\t\t\t} else if (!inNetwork1 && inNetwork2) {\n\t\t\t\trightSet.add(node);\n\t\t\t\tnodeAttr.setAttribute(node.getIdentifier(), visualStyleName, network2.getTitle());\n\t\t\t} else // This should never happen!\n\t\t\t\tthrow new IllegalStateException(\"Do not know how to categorise a node!\");\n\t\t}\n\t}", "private void findConceptsForInstances() {\n\t\tSet<String> temp = new HashSet<String>();\n\n\t\tfor (String s : taskInput)\n\t\t\ttemp.add(taxonomyMap.get(s).parents.get(0).value);\n\t\ttaskInput.clear();\n\t\ttaskInput.addAll(temp);\n\n\t\ttemp.clear();\n\t\tfor (String s : taskOutput)\n\t\t\ttemp.add(taxonomyMap.get(s).parents.get(0).value);\n\t\ttaskOutput.clear();\n\t\ttaskOutput.addAll(temp);\n\n\t\tfor (Node s : serviceMap.values()) {\n\t\t\ttemp.clear();\n\t\t\tSet<String> inputs = s.getInputs();\n\t\t\tfor (String i : inputs)\n\t\t\t\ttemp.add(taxonomyMap.get(i).parents.get(0).value);\n\t\t\tinputs.clear();\n\t\t\tinputs.addAll(temp);\n\n\t\t\ttemp.clear();\n\t\t\tSet<String> outputs = s.getOutputs();\n\t\t\tfor (String o : outputs)\n\t\t\t\ttemp.add(taxonomyMap.get(o).parents.get(0).value);\n\t\t\toutputs.clear();\n\t\t\toutputs.addAll(temp);\n\t\t}\n\t}", "int[] getInEdges(int... nodes);", "public HashSet<N> getSuccessors(N node)\r\n/* 26: */ {\r\n/* 27: 56 */ assert (checkRep());\r\n/* 28: 57 */ return new HashSet(((Map)this.map.get(node)).keySet());\r\n/* 29: */ }", "public Map<K, Set<V>> coreGetAllSupersetsOf(Collection<?> set, int mode) {\n // Skip elements in the collection having an incorrect type, as we are looking for subsets which simply\n // cannot contain the conflicting items\n Set<V> navSet = createNavigableSet(set, true);\n Iterator<V> it = navSet.iterator();\n\n List<SetTrieNode> frontier = new ArrayList<>();\n frontier.add(superRootNode);\n\n // For every value, extend the frontier with the successor nodes for that value.\n V from = null;\n V upto = null;\n\n // Use a flag for null safety so we do not rely on the comparator to treat null as the least element\n boolean isLeastFrom = true;\n while(it.hasNext()) {\n from = upto;\n upto = it.next();\n\n List<SetTrieNode> nextNodes = new ArrayList<>();\n\n // Based on the frontier, we need to keep scanning nodes whose values is in the range [from, upto]\n // until we find the nodes whose values equals upto\n // Only these nodes then constitute the next frontier\n Collection<SetTrieNode> currentScanNodes = frontier;\n do {\n Collection<SetTrieNode> nextScanNodes = new ArrayList<>();\n for(SetTrieNode currentNode : currentScanNodes) {\n if(currentNode.nextValueToChild != null) {\n NavigableMap<V, SetTrieNode> candidateNodes = isLeastFrom\n ? currentNode.nextValueToChild.headMap(upto, true)\n : currentNode.nextValueToChild.subMap(from, true, upto, true);\n\n for(SetTrieNode candidateNode : candidateNodes.values()) {\n if(Objects.equals(candidateNode.value, upto)) {\n nextNodes.add(candidateNode);\n } else {\n nextScanNodes.add(candidateNode);\n }\n }\n }\n }\n currentScanNodes = nextScanNodes;\n } while(!currentScanNodes.isEmpty());\n\n frontier = nextNodes;\n\n isLeastFrom = false;\n }\n\n Map<K, Set<V>> result = new HashMap<>();\n\n // Copy all data entries associated with the frontier to the result\n Stream<SetTrie<K, V>.SetTrieNode> stream = frontier.stream();\n\n if(mode != 0) {\n stream = stream.flatMap(node -> reachableNodesAcyclic(\n node,\n x -> (x.nextValueToChild != null ? x.nextValueToChild.values() : Collections.<SetTrieNode>emptySet()).stream()));\n }\n\n stream.forEach(currentNode -> {\n if(currentNode.keyToSet != null) {\n for(Entry<K, NavigableSet<V>> e : currentNode.keyToSet.entrySet()) {\n result.put(e.getKey(), e.getValue());\n }\n }\n });\n\n return result;\n }", "private Collection<Node> keepOnlySetElement(Collection<Node> nodes) {\n Set<Node> elements = new HashSet<>();\n for (Node node : nodes) {\n Edge originalEdge = synchronizer().getOriginalEdge(node);\n if ((originalEdge != null && !boundaries.edges.contains(originalEdge))\n || !boundaries.nodes.contains(node)) {\n elements.add(node);\n }\n }\n return elements;\n }", "@Override\n public List<GraphRelationship> getRelationships() {\n int localMax=1;\n Hashtable checkIfRelationExists = new Hashtable();\n List<GraphRelationship> relatonships = new ArrayList<>();\n List<String> filePaths = ProjectFileNamesUtil.getFileNamesFromProject(project.getBaseDir());\n for (String filePath : filePaths){ //foreach filepath - node name\n String str[] = filePath.split(\"/\");\n String name = str[str.length-1];\n CoverageNode startNode = (CoverageNode) nodeHashTable.get(name); //relations from this node\n ImportFileUtil importFileUtil = (ImportFileUtil) relations.get(name); //get relations for node\n if (importFileUtil != null && startNode != null){\n for (ImportFrom importFrom : importFileUtil.getImportFromList()) //for each relation\n {\n NodeRelationship relation;\n CoverageNode endNode = (CoverageNode) nodeHashTable.get(importFrom.getName());//end node of relation\n String nameOfRelation = startNode.getId() + \"->\" + endNode.getId();\n if (checkIfRelationExists.get(nameOfRelation) != null){\n continue;\n }\n relation = new NodeRelationship(nameOfRelation);\n relation.setWeight(getRelationWeight(importFrom));\n if (localMax < getRelationWeight(importFrom)){localMax=getRelationWeight(importFrom);} //localMax of weights for proper logScale\n relation.setCallsCount(\"\" + (int) relation.getWeight());\n relation.setStartNode(startNode);\n relation.setEndNode(endNode);\n setRelationTypes(relation.getTypes(),relation.getWeight()); //sets trivia\n HashMap<String, Object> properties = new HashMap<>();\n getPropertiesForRelations(properties, importFrom);\n ResultsPropertyContainer resultsPropertyContainer = new ResultsPropertyContainer(properties);\n relation.setPropertyContainer(resultsPropertyContainer);\n checkIfRelationExists.put(relation.getId(), relation);\n relatonships.add(relation);\n }\n }\n }\n for(GraphRelationship relationship : relatonships){\n relationship.setWeight(normalizeWeight(relationship.getWeight(), localMax));\n }\n return relatonships;\n }", "public ResultMap<Association> associations();", "static int[] connectedCities(int n, int g, int[] originCities, int[] destinationCities) {\n Map<Integer, TreeSet<Integer>> m1 = new HashMap<>();\n\n Map<Integer, TreeSet<Integer>> m2 = new HashMap<>();\n\n for (int i = 0; i <originCities.length ; i++) {\n TreeSet<Integer> s1 = new TreeSet<>();\n int c=originCities[i];\n for (int j = c; j>=1 ; j--) {\n if(c%j==0)\n s1.add(j);\n }\n m1.put(c,s1);\n }\n\n\n for (int i = 0; i <destinationCities.length ; i++) {\n TreeSet<Integer> s1 = new TreeSet<>();\n int c=destinationCities[i];\n for (int j = c/2; j>=1 ; j--) {\n if(c%j==0)\n s1.add(j);\n }\n m2.put(c,s1);\n }\n\n\n int result [] = new int[originCities.length];\n for (int i = 0; i <originCities.length ; i++) {\n\n int max1 =m1.get(originCities[i]).last();\n\n int max2 =m2.get(destinationCities[i]).last();\n if(max1 <=g)\n result[i]=0;\n else if(max2 <=g)\n result[i]=0;\n else{\n TreeSet<Integer> s1 =m1.get(originCities[i]);\n TreeSet<Integer> s2 =m2.get(destinationCities[i]);\n for (Integer x: s1) {\n if(s2.contains(x)) {\n result[i] = 1;\n break;\n }\n\n }\n }\n\n }\n\n return result;\n\n }", "int[] getEdgesIncidentTo(int... nodes);", "public static Map<List<Integer>, List<List<Integer>>> CollectTableInstasnces(List<List<Integer>> candidateList,\n Map<Integer,Map<List<Integer>, List<List<Integer>>>> starNeighbor,\n Map<List<Integer>, List<List<Integer>>> tableInstanceSizekSub1,\n int k){\n\n\n // [A, B]:[[1,2],[1,3]]\n // Return table instances\n Map<List<Integer>, List<List<Integer>>> tableInstances = new HashMap<>();\n\n // convert candidate to hashset\n Set<List<Integer>> candidateSet = new HashSet<>(candidateList);\n\n for(List<Integer> candidate: candidateSet){\n if (starNeighbor.containsKey(candidate.get(0))){\n\n // get remain candidate list\n List<Integer> remainCandidateElement = candidate.subList(1, k+1);\n\n // store the table instance of the current candidate\n List<List<Integer>> realCliquesAll = new ArrayList<>();\n\n // Loop hashmap\n Iterator<Map.Entry<List<Integer>, List<List<Integer>>>> itr = starNeighbor.get(candidate.get(0)).entrySet().iterator();\n while (itr.hasNext()){\n Map.Entry<List<Integer>, List<List<Integer>>> entry = itr.next();\n // put remain instance\n List<List<Integer>> tempRemain = new ArrayList<>();\n\n for (Integer feature : remainCandidateElement) {\n List<Integer> remainPoint = entry.getValue().parallelStream().filter( point ->\n point.get(0).equals(feature))\n .map(inst -> inst.get(1))\n .collect(Collectors.toList());\n\n if (!remainPoint.isEmpty()) {\n tempRemain.add(remainPoint);\n }\n }\n\n if (tempRemain.size() == k){\n // store the first instance into it\n tempRemain.add(0, Arrays.asList(entry.getKey().get(1)));\n\n // Cartesian product tempRemain based on combinatoricslib lib\n List<List<Integer>> remainFeatureInstance = MyGenerator.cartesianProductInteger(tempRemain);\n\n // Check real cliques\n List<List<Integer>> realClique = remainFeatureInstance.parallelStream().filter( row -> {\n\n return tableInstanceSizekSub1.get(remainCandidateElement).contains(row.subList(1, k+1));\n\n }).collect(Collectors.toList());\n\n if (!realClique.isEmpty()){\n realCliquesAll.addAll(realClique);\n }\n\n }\n }\n // put in table instances\n if(!realCliquesAll.isEmpty()){\n tableInstances.put(candidate, realCliquesAll);\n }\n }\n\n }\n return tableInstances;\n }", "private Set<Integer> getSynsetKeys(String word) {\n HashSet<Integer> kset = new HashSet<Integer>();\n\n for (ArrayList<String> o : synsetRev.keySet()) {\n for (String p : o) {\n if (p.equals(word)) {\n kset.add(synsetRev.get(o));\n }\n }\n }\n return kset;\n }", "public Set<Node<E>> getNeighbors(Node<E> node){\n Set<Node<E>> result = new HashSet<>();\n result = nodes.get(node);\n return result;\n }", "@Override\n\tpublic Set<K> keySet() {\n\t\tArrayList<K> claves = new ArrayList<K>();\n\t\tIterator it = tabla.iterator();\n\t\tint i = 0;\n\t\twhile (it.hasNext()) {\n\t\t\tIterator it2 = tabla.get(i).keySet().iterator();\n\t\t\tit.next();\n\t\t\tint j = 0;\n\t\t\twhile (it2.hasNext()) {\n\t\t\t\tit2.next();\n\t\t\t\tclaves.add(tabla.get(i).keySet().get(j));\n\t\t\t\tj++;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\treturn new HashSet<K>(claves);\n\t}", "private List<Set<GraphChange>> findChanges(Map<Collection<Node>, List<PossibleDConnectingPath>> paths) {\n List<Set<GraphChange>> pagChanges = new ArrayList<>();\n\n Set<Map.Entry<Collection<Node>, List<PossibleDConnectingPath>>> entries = paths.entrySet();\n /* Loop through each entry, ie each conditioned set of variables. */\n for (Map.Entry<Collection<Node>, List<PossibleDConnectingPath>> entry : entries) {\n Collection<Node> conditions = entry.getKey();\n List<PossibleDConnectingPath> dConnecting = entry.getValue();\n\n /* loop through each path */\n for (PossibleDConnectingPath possible : dConnecting) {\n List<Node> possPath = possible.getPath();\n /* Created with 2*# of undirectedPaths as appoximation. might have to increase size once */\n Set<GraphChange> pathChanges = new HashSet<>(2 * possPath.size());\n\n /* find those conditions which are not along the path (used in colider) */\n List<Node> outsidePath = new ArrayList<>(conditions.size());\n for (Node condition : conditions) {\n if (!possPath.contains(condition))\n outsidePath.add(condition);\n }\n\n /* Walk through path, node by node */\n for (int i = 0; i < possPath.size() - 1; i++) {\n Node current = possPath.get(i);\n Node next = possPath.get(i + 1);\n GraphChange gc;\n\n /* for each pair of nodes, add the operation to remove their edge */\n gc = new GraphChange();\n gc.addRemove(possible.getPag().getEdge(current, next));\n pathChanges.add(gc);\n\n /* for each triple centered on a node which is an element of the conditioning\n * set, add the operation to orient as a nonColider around that node */\n if (conditions.contains(current) && i > 0) {\n gc = new GraphChange();\n Triple nonColider = new Triple(possPath.get(i - 1), current, next);\n gc.addNonCollider(nonColider);\n pathChanges.add(gc);\n }\n\n /* for each node on the path not in the conditioning set, make a colider. It\n * is necessary though to ensure that there are no undirectedPaths implying that a\n * conditioned variable (even outside the path) is a decendant of a colider */\n if ((!conditions.contains(current)) && i > 0) {\n Triple colider = new Triple(possPath.get(i - 1), current, next);\n\n if (possible.getPag().isUnderlineTriple(possPath.get(i - 1), current, next))\n continue;\n\n Edge edge1 = possible.getPag().getEdge(colider.getX(), colider.getY());\n Edge edge2 = possible.getPag().getEdge(colider.getZ(), colider.getY());\n\n if (edge1.getNode1().equals(colider.getY())) {\n if (edge1.getEndpoint1().equals(Endpoint.TAIL)) {\n continue;\n }\n } else if (edge1.getNode2().equals(colider.getY())) {\n if (edge1.getEndpoint2().equals(Endpoint.TAIL)) {\n continue;\n }\n }\n\n if (edge2.getNode1().equals(colider.getY())) {\n if (edge2.getEndpoint1().equals(Endpoint.TAIL)) {\n continue;\n }\n } else if (edge2.getNode2().equals(colider.getY())) {\n if (edge2.getEndpoint2().equals(Endpoint.TAIL)) {\n continue;\n }\n }\n\n /* Simple case, no conditions outside the path, so just add colider */\n if (outsidePath.size() == 0) {\n gc = new GraphChange();\n gc.addCollider(colider);\n pathChanges.add(gc);\n continue;\n }\n\n /* ensure nondecendency in possible path between getModel and each conditioned\n * variable outside the path */\n for (Node outside : outsidePath) {\n\n /* list of possible decendant undirectedPaths */\n\n List<PossibleDConnectingPath> decendantPaths = new ArrayList<>();\n decendantPaths\n = PossibleDConnectingPath.findDConnectingPaths\n (possible.getPag(), current, outside, new ArrayList<Node>());\n\n if (decendantPaths.isEmpty()) {\n gc = new GraphChange();\n gc.addCollider(colider);\n pathChanges.add(gc);\n continue;\n }\n\n /* loop over each possible path which might indicate decendency */\n for (PossibleDConnectingPath decendantPDCPath : decendantPaths) {\n List<Node> decendantPath = decendantPDCPath.getPath();\n\n /* walk down path checking orientation (path may already\n * imply non-decendency) and creating changes if need be*/\n boolean impliesDecendant = true;\n Set<GraphChange> colideChanges = new HashSet<>();\n for (int j = 0; j < decendantPath.size() - 1; j++) {\n Node from = decendantPath.get(j);\n // chaneges from +1\n Node to = decendantPath.get(j + 1);\n Edge currentEdge = possible.getPag().getEdge(from, to);\n\n if (currentEdge.getEndpoint1().equals(Endpoint.ARROW)) {\n impliesDecendant = false;\n break;\n }\n\n gc = new GraphChange();\n gc.addCollider(colider);\n gc.addRemove(currentEdge);\n colideChanges.add(gc);\n\n gc = new GraphChange();\n gc.addCollider(colider);\n gc.addOrient(to, from);\n colideChanges.add(gc);\n }\n if (impliesDecendant)\n pathChanges.addAll(colideChanges);\n }\n }\n }\n }\n\n pagChanges.add(pathChanges);\n }\n }\n return pagChanges;\n }", "public Iterable<Relationship> getRelationships();", "int[] getOutEdges(int... nodes);", "@Override\n \tpublic Collection<Collection<Integer>> call() throws Exception {\n \t\tEdgeWeighter<HomologyEdge> weighter = new EdgeWeighter<HomologyEdge>() {\n \t\t\t@Override\n \t\t\tpublic double getWeight(HomologyEdge e) {\n \t\t\t\treturn e.getWeight();\n \t\t\t}\n \t\t};\n \t\tProbabilisticDistanceClusterer<Integer, HomologyEdge> alg = new ProbabilisticDistanceClusterer<Integer, HomologyEdge>(\n \t\t\t\tweighter, xi);\n \t\tSet<Set<Integer>> ccs = alg.transform(graph.getHomology());\n \n \t\t// now map each cluster to a root for that cluster\n \t\t// the choice of root is arbitrary and just for hashing\n \t\tMap<Integer, Integer> map = new HashMap<Integer, Integer>();\n \t\tfor (Set<Integer> cc : ccs) {\n \t\t\tint v0 = -1;\n \t\t\tint i = 0;\n \t\t\tfor (int v : cc) {\n \t\t\t\tif (i == 0) v0 = v;\n \t\t\t\tmap.put(v, v0);\n \t\t\t\ti++;\n \t\t\t}\n \t\t}\n \n \t\t// find the cliques\n \t\tBronKerboschCliqueFinder<Integer, HomologyEdge> finder = new BronKerboschCliqueFinder<>();\n \t\tCollection<Set<Integer>> cliques = finder.transform(graph.getHomology());\n \n \t\t// group the cliques by sets of interactions\n \t\tNavigableMap<String, Collection<Integer>> cliqueGroups = new TreeMap<>();\n \t\tfor (Set<Integer> clique : cliques) {\n \t\t\tfor (int v : clique) {\n \t\t\t\tCollection<Integer> neighbors = graph.getInteractionNeighbors(v);\n \t\t\t\tString hash = hashVertexInteractions(neighbors, map);\n \t\t\t\tCollection<Integer> group = cliqueGroups.get(hash);\n \t\t\t\tif (group == null) group = new TreeSet<>();\n \t\t\t\tgroup.add(v);\n \t\t\t}\n \t\t}\n \n \t\t// now we just want a set to return\n \t\tSet<Collection<Integer>> set = new TreeSet<>();\n \t\tset.addAll(cliqueGroups.values());\n \n \t\treturn set;\n \t}", "private List<Set<V>> findAllComponents(Graph<V, E> g, Set<V> F)\n {\n return new ConnectivityInspector<>(new AsSubgraph<>(g, F)).connectedSets();\n }", "public Set<Pair<V,V>> neighbourEdgesOf(V vertex);", "private List<SimilarNode> astCCImplmentation(HashMap<ASTNode, NodeInfo> fileNodeMap1, HashMap<ASTNode, NodeInfo> fileNodeMap2) {\n TreeMap<Integer, List<NodeInfo>> treeMap1 = convertToTreeMap(fileNodeMap1);\n TreeMap<Integer, List<NodeInfo>> treeMap2 = convertToTreeMap(fileNodeMap2);\n List<SimilarNode> result = new ArrayList<>();\n int[] array1 = getArray(treeMap1.keySet());\n int[] array2 = getArray(treeMap2.keySet());\n int i = 0;\n int j = 0;\n int sum = 0;\n while (i < array1.length && j < array2.length) {\n if (array1[i] == array2[j]) {\n // obtain list of nodeInfos for both and compare them if match found then add it to report\n List<NodeInfo> list1 = treeMap1.get(array1[i]);\n List<NodeInfo> list2 = treeMap2.get(array2[j]);\n for (NodeInfo nodeInfo1 : list1) {\n for (NodeInfo nodeInfo2 : list2) {\n if ((nodeInfo1.hashValue == nodeInfo2.hashValue) && (nodeInfo1.nodeType == nodeInfo2.nodeType)) {\n result.add(new SimilarNode(nodeInfo1, nodeInfo2));\n\n }\n }\n }\n i++;\n j++;\n\n } else if (array1[i] > array2[j]) {\n j++;\n } else if (array1[i] < array2[j]) {\n i++;\n }\n }\n return result;\n }", "private Set<Edge> reachableDAG(Vertex start, Vertex obstacle) {\n \tHashSet<Edge> result = new HashSet<Edge>();\n \tVector<Vertex> currentVertexes = new Vector<Vertex>();\n \tint lastResultNumber = 0;\n \tcurrentVertexes.add(start);\n \t\n \tdo {\n \t\t//System.out.println(\"size of currentVertexes:\" + currentVertexes.size());\n \t\t\n \t\tVector<Vertex> newVertexes = new Vector<Vertex>();\n \t\tlastResultNumber = result.size();\n \t\t\n \t\tfor (Vertex v : currentVertexes) {\n \t\t\t//System.out.println(\"layerID:\" + v.layerID + \"\\tlabel:\" + v.label);\n \t\t\taddIncomingEdges(v, obstacle, result, newVertexes);\n \t\t\taddOutgoingEdges(v, obstacle, result, newVertexes);\n \t\t}\n \t\t\n \t\t//System.out.println(\"size of newVertexes:\" + newVertexes.size());\n \t\t\n \t\tcurrentVertexes = newVertexes;\t\n \t\t//System.out.println(\"lastResultNumber:\" + lastResultNumber);\n \t\t//System.out.println(\"result.size():\" + result.size());\n \t} while (lastResultNumber != result.size());\n \t\n\t\treturn result;\n }", "void unionTreeCoreset(int k,int n_1,int n_2,int d, Point[] setA,Point[] setB, Point[] centres, MTRandom clustererRandom) {\n\t\t//printf(\"Computing coreset...\\n\");\n\t\t//total number of points\n\t\tint n = n_1+n_2;\n\n\t\t//choose the first centre (each point has the same probability of being choosen)\n\t\t\n\t\t//stores, how many centres have been choosen yet\n\t\tint choosenPoints = 0; \n\t\t\n\t\t//only choose from the n-i points not already choosen\n\t\tint j = clustererRandom.nextInt(n-choosenPoints); \n\n\t\t//copy the choosen point\n\t\tif(j < n_1){\n\t\t\t//copyPointWithoutInit(&setA[j],&centres[choosenPoints]);\n\t\t\tcentres[choosenPoints] = setA[j].clone();\n\t\t} else {\n\t\t\tj = j - n_1;\n\t\t\t//copyPointWithoutInit(&setB[j],&centres[choosenPoints]);\n\t\t\tcentres[choosenPoints] = setB[j].clone();\n\t\t}\n\t\ttreeNode root = new treeNode(setA,setB,n_1,n_2, centres[choosenPoints],choosenPoints); //??\n\t\tchoosenPoints = 1;\n\t\t\n\t\t//choose the remaining points\n\t\twhile(choosenPoints < k){\n\t\t\tif(root.cost > 0.0){\n\t\t\t\ttreeNode leaf = selectNode(root, clustererRandom);\n\t\t\t\tPoint centre = chooseCentre(leaf, clustererRandom);\n\t\t\t\tsplit(leaf,centre,choosenPoints);\n\t\t\t\t//copyPointWithoutInit(centre,&centres[choosenPoints]);\n\t\t\t\tcentres[choosenPoints] = centre;\n\t\t\t} else {\n\t\t\t\t//create a dummy point\n\t\t\t\t//copyPointWithoutInit(root.centre,&centres[choosenPoints]);\n\t\t\t\tcentres[choosenPoints] = root.centre;\n\t\t\t\tint l;\n\t\t\t\tfor(l=0;l<root.centre.dimension;l++){\n\t\t\t\t\tcentres[choosenPoints].coordinates[l] = -1 * 1000000;\n\t\t\t\t}\n\t\t\t\tcentres[choosenPoints].id = -1;\n\t\t\t\tcentres[choosenPoints].weight = 0.0;\n\t\t\t\tcentres[choosenPoints].squareSum = 0.0;\n\t\t\t}\n\t\t\t\n\t\t\tchoosenPoints++;\n\t\t}\n\n\t\t//free the tree\n\t\tfreeTree(root);\n\n\t\t//recalculate clustering features\n\t\tint i;\n\t\tfor(i=0;i<n;i++){\n\t\t\t\t\n\t\t\tif(i < n_1) {\n\t\t\t\t\n\t\t\t\tint index = setA[i].centreIndex;\n\t\t\t\tif(centres[index].id != setA[i].id){\n\t\t\t\t\tcentres[index].weight += setA[i].weight;\n\t\t\t\t\tcentres[index].squareSum += setA[i].squareSum;\n\t\t\t\t\tint l;\n\t\t\t\t\tfor(l=0;l<centres[index].dimension;l++){\n\t\t\t\t\t\tif(setA[i].weight != 0.0){\n\t\t\t\t\t\t\tcentres[index].coordinates[l] += setA[i].coordinates[l];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\tint index = setB[i-n_1].centreIndex;\n\t\t\t\tif(centres[index].id != setB[i-n_1].id){\n\t\t\t\t\tcentres[index].weight += setB[i-n_1].weight;\n\t\t\t\t\tcentres[index].squareSum += setB[i-n_1].squareSum;\n\t\t\t\t\tint l;\n\t\t\t\t\tfor(l=0;l<centres[index].dimension;l++){\n\t\t\t\t\t\tif(setB[i-n_1].weight != 0.0){\n\t\t\t\t\t\t\tcentres[index].coordinates[l] += setB[i-n_1].coordinates[l];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private boolean containsAll(Graph g, Set<Node> nodes, NodePair pair) {\n List<String> nodeNames = g.getNodeNames();\n if (!nodeNames.contains(pair.getFirst().getName()) || !nodeNames.contains(pair.getSecond().getName())) {\n return false;\n }\n for (Node node : nodes) {\n if (!nodeNames.contains(node.getName())) {\n return false;\n }\n }\n return true;\n }", "@SuppressWarnings( \"unchecked\" )\n public List<Node> getSecondChoices() {\n final List<Part> relatedParts = findRelatedParts();\n final Node node = getNode();\n final Node other = getOther();\n return (List<Node>) CollectionUtils.select(\n IteratorUtils.toList( node.getSegment().parts() ),\n new Predicate() {\n @Override\n public boolean evaluate( Object object ) {\n Part part = (Part) object;\n return !part.equals( node )\n && !part.equals( other )\n && !relatedParts.contains( part );\n }\n }\n );\n }", "Set<E> getForwardNeighbors();", "private ArrayList<ArrayList<ComparableExpression>> relationToTuples(HashMap<ComparableExpression,\n HashSet<ComparableExpression>> rel) {\n ArrayList<ArrayList<ComparableExpression>> list = new ArrayList<>();\n for (Map.Entry<ComparableExpression, HashSet<ComparableExpression>> mapEntry : rel.entrySet()) {\n ComparableExpression c1 = mapEntry.getKey();\n for (ComparableExpression c2 : mapEntry.getValue()) {\n list.add(new ArrayList<>(Arrays.asList(c1, c2)));\n }\n }\n return list;\n }", "Set<MacAddress> neighbors();", "private ArrayList<Integer> commonEdges(ArrayList<HashMap<Integer,Integer>> table, ArrayList<Integer> pool, int city_id){\n ArrayList<Integer> subPool = new ArrayList<Integer>();\n\n //Find the higest amount of common edges in the pool using the table hashmaps\n //Realistically, this should only be at most 2\n int most_common_edges = 0;\n for(int i = 1; i <= 2; i++){\n if(table.get(city_id).containsValue(i) && most_common_edges < i){\n most_common_edges = i;\n }\n }\n\n for(int i = 0; i < pool.size(); i++){\n if(table.get(city_id).get(pool.get(i)) == most_common_edges){\n subPool.add(pool.get(i));\n }\n }\n\n //If all options have no edges left, return the original list\n if(subPool.size() <= 0){\n return pool;\n }\n\n return subPool;\n }", "public static <T> Set<List<T>> findSimpleCycles(Map<T, Set<T>> graph) {\n if (graph == null) {\n return null;\n }\n Set<List<T>> result = new HashSet<>();\n Set<T> vertices = new HashSet<>(graph.keySet());\n while (!graph.isEmpty()) {\n Set<Set<T>> components = findStronglyConnectedComponents(graph);\n Set<T> maxComponent = null;\n for (Set<T> component : components) {\n if (component.size() < 2) {\n if (isSelfCycle(graph, component)) {\n result.add(new ArrayList<>(component));\n }\n vertices.removeAll(component);\n } else if ((maxComponent == null) || (component.size() > maxComponent.size())) {\n maxComponent = component;\n }\n }\n if (maxComponent != null) {\n Map<T, Set<T>> subgraph = project(graph, maxComponent);\n T startVertex = maxComponent.iterator().next();\n result.addAll(findSimpleCycles(subgraph, startVertex));\n vertices.remove(startVertex);\n }\n graph = project(graph, vertices);\n }\n return result;\n }", "private static List<Integer> getCommonElementsAlgo2(int [] arr1, int [] arr2) {\n\t\t\n\t\tList<Integer> duplicates = new ArrayList<>();\n\t\t\n\t\tHashtable<Integer, Integer> table = new Hashtable<>();\n\t\t\n\t\tfor (int i : arr1) {\n\t\t\tif (table.containsKey(i)) {\n\t\t\t\ttable.put(i, table.get(i) + 1);\n\t\t\t}\n\t\t\ttable.put(i, 1);\n\t\t}\n\t\t\n\t\tfor (int j : arr2) {\n\t\t\tif (table.containsKey(j)) {\n\t\t\t\tduplicates.add(j);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn duplicates;\n\t\t\n\t}", "public List<Set<SDGNode>> secondPass() {\n Object[] edges = icfg.edgeSet().toArray();\n\n // first, temporarily remove all edges but CF and RT\n for (int i = 0; i < edges.length; i++) {\n SDGEdge e = (SDGEdge) edges[i];\n if (e.getKind() != SDGEdge.Kind.CONTROL_FLOW && e.getKind() != SDGEdge.Kind.RETURN) {\n buffer.addFirst(e);\n icfg.removeEdge(e);\n }\n }\n\n // then compute SCCs\n StrongConnectivityInspector<SDGNode, SDGEdge> sci = new StrongConnectivityInspector<SDGNode, SDGEdge>(icfg);\n List<Set<SDGNode>> erg = sci.stronglyConnectedSets();\n\n // put call edges back\n for (SDGEdge e : buffer) {\n icfg.addEdge(e);\n }\n buffer.clear();\n\n return erg;\n }", "public List<? extends Node> getOtherNodes() {\n Node node = getNode();\n Node other = getOther();\n Segment segment = node.getSegment();\n Set<Node> result = new HashSet<Node>();\n\n // Add other parts of this segment\n Iterator<Node> nodes = segment.nodes();\n while ( nodes.hasNext() ) {\n Node n = nodes.next();\n if ( !node.equals( n ) ) {\n if ( n.equals( other ) ) {\n result.add( n );\n } else if ( n.isConnector() ) {\n Connector connector = (Connector) n;\n Flow connectorFlow = connector.getInnerFlow();\n if ( isEmptyOrEquivalent( connectorFlow ) ) {\n if ( isSend() ) {\n if ( connector.isSource()\n && !connectorFlow.getTarget().equals( node )\n && !isRedundant( connector ) )\n result.add( connector );\n } else {\n if ( connector.isTarget()\n && !connectorFlow.getSource().equals( node )\n && !isRedundant( connector ) )\n result.add( connector );\n }\n }\n }\n /**\n else {\n // a part in segment with same flow to/from part\n if ( hasPartFlowWithSameName( n ) ) result.add( n );\n }\n **/\n }\n }\n // Add inputs/outputs of other segments\n QueryService queryService = getQueryService();\n for ( Segment s : queryService.list( Segment.class ) ) {\n if ( !segment.equals( s ) ) {\n Iterator<Connector> c = isSend() ? s.inputs() : s.outputs();\n while ( c.hasNext() ) {\n Connector connector = c.next();\n Flow connectorFlow = connector.getInnerFlow();\n if ( isEmptyOrEquivalent( connectorFlow ) ) {\n if ( other.equals( connector )\n || ( !node.isConnectedTo( isSend(), connector, getFlow().getName() )\n && !isRedundant( connector )\n )\n )\n result.add( connector );\n }\n }\n }\n }\n return new ArrayList<Node>( result );\n }", "@Override\r\n public Set<List<String>> findAllPaths(int sourceId, int targetId, int reachability) {\r\n //all paths found\r\n Set<List<String>> allPaths = new HashSet<List<String>>();\r\n //collects path in one iteration\r\n Set<List<String>> newPathsCollector = new HashSet<List<String>>();\r\n //same as the solution but with inverted edges\r\n Set<List<String>> tmpPathsToTarget = new HashSet<List<String>>();\r\n //final solution\r\n Set<List<String>> pathsToTarget = new HashSet<List<String>>();\r\n \r\n String[] statementTokens = null; \r\n Set<Integer> allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n List<String> statementsFound = new ArrayList<String>();\r\n \r\n for (int i = 0; i < reachability; i++) {\r\n if (i == 0) { \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(sourceId);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n //allProcessedNodes.add(inNodeId); \r\n //Incoming nodes are reversed\r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n allPaths.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(sourceId);\r\n \r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n statementsFound.add(outEdge);\r\n allPaths.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n } else {\r\n newPathsCollector = new HashSet<List<String>>();\r\n\r\n for (List<String> statements: allPaths) {\r\n allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n int lastNodeInPath = 0;\r\n \r\n for (String predicate: statements) {\r\n if (predicate.contains(\">-\")) {\r\n statementTokens = predicate.split(\">-\");\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[0]).reverse().toString()));\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString()));\r\n lastNodeInPath = Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString());\r\n } else {\r\n statementTokens = predicate.split(\"->\"); \r\n allProcessedNodes.add(Integer.parseInt(statementTokens[0]));\r\n allProcessedNodes.add(Integer.parseInt(statementTokens[2]));\r\n lastNodeInPath = Integer.parseInt(statementTokens[2]);\r\n }\r\n }\r\n \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(lastNodeInPath);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n if (allProcessedNodes.contains(inNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n newPathsCollector.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(lastNodeInPath);\r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n if (allProcessedNodes.contains(outNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(outEdge);\r\n newPathsCollector.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n }\r\n allPaths.addAll(newPathsCollector);\r\n }\r\n \r\n //System.out.println(\"*****End of iteration \" + i);\r\n //System.out.println(\"#SIZE OF allPaths: \" + allPaths.size());\r\n int numItems = 0;\r\n for (List<String> currList: allPaths) {\r\n numItems = numItems + currList.size();\r\n }\r\n //System.out.println(\"#NUMBER OF ELEMS OF ALL LISTS: \" + numItems);\r\n //System.out.println(\"#SIZE OF tmpPathsToTarget : \" + tmpPathsToTarget.size());\r\n }\r\n \r\n //We need to reverse back all the predicates\r\n for (List<String> statements: tmpPathsToTarget) { \r\n List<String> fixedStatements = new ArrayList<String>(); \r\n for (int i = 0; i < statements.size(); i++) { \r\n String statement = statements.get(i); \r\n if (statement.contains(\">-\")) {\r\n fixedStatements.add(new StringBuilder(statement).reverse().toString());\r\n } else {\r\n fixedStatements.add(statement);\r\n } \r\n }\r\n pathsToTarget.add(fixedStatements);\r\n }\r\n return pathsToTarget;\r\n }", "@Override\n public Set<String> getRelations() {\n if (cachedRelations != null) {\n return cachedRelations;\n }\n cachedRelations = new LinkedHashSet<String>();\n for (EventNode node : nodes) {\n cachedRelations.addAll(node.getNodeRelations());\n }\n return cachedRelations;\n }", "private Map<String, Set<String>> getAliases(List<String> curies, Collection<Node> nodes) {\n\t\tMap<String, Set<String>> result = new HashMap<>();\n\t\t\n\t\tfor (Node node : nodes) {\n\t\t\tString nodeName = translator.makeId(node);\n\t\t\t\n\t\t\tString nodeId = null;\n\t\t\tString represents = node.getRepresents();\n\t\t\tif (represents != null && curies.stream().anyMatch(represents::equalsIgnoreCase)) {\n\t\t\t\tnodeId = node.getRepresents();\n\t\t\t} else if (curies.stream().anyMatch(nodeName::equalsIgnoreCase)) {\n\t\t\t\tnodeId = nodeName;\n\t\t\t}\n\t\t\t\n\t\t\tif (nodeId != null && !result.containsKey(nodeId)) {\n\t\t\t\tresult.put(nodeId.toLowerCase(), new HashSet<>());\n\t\t\t}\n\t\t\t\n\t\t\tfor (Attribute attribute : node.getAttributes()) {\n\t\t\t\tif (attribute.getName().equals(\"alias\")) {\n\t\t\t\t\tif (nodeId == null) {\n\t\t\t\t\t\tnodeId = curieInAttributes(curies, attribute);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (nodeId != null) {\n\t\t\t\t\t\n\t\t\t\t\t\tSet<String> aliases = new HashSet<>();\n\t\t\t\t\t\tfor (String value : attribute.getValues()) {\n\t\t\t\t\t\t\taliases.add(value.trim());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tnodeId = nodeId.toLowerCase();\n\t\t\t\t\t\tif (result.containsKey(nodeId)) {\n\t\t\t\t\t\t\taliases.addAll(result.get(nodeId));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tresult.put(nodeId, aliases);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public void disjointSetMethod(Graph g)\n\t{\n\t\tsets = new DisjointSets(g.getNumNodes());\n\t\tsetup(g.getNumNodes());\n\t\tsets.print();\n\t\t\n\t}", "private static List<Integer> getCommonElementsAlgo1(int [] arr1, int [] arr2) {\n\t\t\n\t\tList<Integer> list1 = new ArrayList<Integer>();\n\t\tfor (int i : arr1) {\n\t\t\tlist1.add(i);\n\t\t}\n\t\tList<Integer> list2 = new ArrayList<Integer>();\n\t\tfor (int i : arr2) {\n\t\t\tlist2.add(i);\n\t\t}\n\t\tif (list1.size() > list2.size()) {\n\t\t\tlist1.retainAll(list2);\n\t\t\treturn list1;\n\t\t}\n\t\telse {\n\t\t\tlist2.retainAll(list1);\n\t\t\treturn list2;\n\t\t}\n\t\t\n\t}", "public static List<SimpleSSBNNode>[] individualizeDisconnectedNetworks(\r\n\t\t\tList<SimpleSSBNNode> simpleSSBNNodeList){\r\n\t\t\r\n\t\tList<SimpleSSBNNodeNetworkAssociation> nodeNetAssociationList = \r\n\t\t\tnew ArrayList<SimpleSSBNNodeNetworkAssociation>(); \r\n\t\t\r\n\t\tfor(SimpleSSBNNode simpleSSBNNode: simpleSSBNNodeList){\r\n\t\t\tSimpleSSBNNodeNetworkAssociation nodeNetAssociation = \r\n\t\t\t\tnew SimpleSSBNNodeNetworkAssociation(simpleSSBNNode); \r\n\t\t\tnodeNetAssociationList.add(nodeNetAssociation); \r\n\t\t}\r\n\t\t\r\n\t\tint nextNetworkId = 0; \r\n\t\t\r\n\t\tfor(SimpleSSBNNodeNetworkAssociation nodeNetAssociation: nodeNetAssociationList){\r\n\t\t\t\r\n\t\t\tif(nodeNetAssociation.getNetworkId() == -1){\r\n\t\t\t\tnodeNetAssociation.setNetworkId(nextNetworkId); \r\n\t\t\t\tnextNetworkId++; \r\n\t\t\t\tsetNetIdToAdjacentNodes(nodeNetAssociation, nodeNetAssociationList); \r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tList<SimpleSSBNNode>[] nodesPerNetworkArray = new List[nextNetworkId]; \r\n\t\t\r\n\t\tfor(int i = 0; i < nodesPerNetworkArray.length; i++){\r\n\t\t\tnodesPerNetworkArray[i] = new ArrayList<SimpleSSBNNode>(); \r\n\t\t}\r\n\t\t\r\n\t\tfor(SimpleSSBNNodeNetworkAssociation nodeNetAssociation: nodeNetAssociationList){\r\n\t\t\tnodesPerNetworkArray[nodeNetAssociation.getNetworkId()].add(nodeNetAssociation.getNode()); \r\n\t\t}\r\n\t\t\r\n\t\treturn nodesPerNetworkArray; \r\n\t}", "private void buildGraph() {\n\t\tfor (Map<String, Channel> map: this.channels.values()) {\n\t\t\t// Add all channels\n\t\t\t\n\t\t\t// TODO: deal with channels spread over multiple redis instances (replicated)\n\t\t\t\n\t\t\t// Add all but ignore if some channels should be ignored\n\t\t\tfor (Map.Entry<String, Channel> entry: map.entrySet()) {\n\t\t\t\tif (IGNORE_UNICAST_AND_SUBSCRIBE) {\n\t\t\t\t\tif (entry.getKey().startsWith(\"unicast\") == false && entry.getKey().startsWith(\"sub\") == false) {\n\t\t\t\t\t\tif (entry.getKey().startsWith(\"tile\")) {\n\t\t\t\t\t\t\tchannelList.add(entry.getValue());\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tchannelList.add(entry.getValue());\n\t\t\t\t}\n\t\t\t}\n\t\t\t//channelList.addAll(map.values());\n\t\t}\n\t\t\n\t\t// Double-iteration to build pairs\n\t\tfor (Channel channel1: channelList) {\n\t\t\tfor (Channel channel2: channelList) {\n\t\t\t\tif (channel1 != channel2) {\n\t\t\t\t\t// Put channels as nodes in the set\n\t\t\t\t\tthis.nodes.add(channel1.getChannelName());\n\t\t\t\t\tthis.nodes.add(channel2.getChannelName());\n\t\t\t\t\t\n\t\t\t\t\t// Build pair\n\t\t\t\t\tChannelPair pair = new ChannelPair(channel1.getChannelName(), channel2.getChannelName());\n\t\t\t\t\t\n\t\t\t\t\t// Check if it is contained in the map\n\t\t\t\t\tif (this.pairMultiplicity.containsKey(pair) == false) {\n\t\t\t\t\t\t// Count common subscribers\n\t\t\t\t\t\tint commonSubscribers = countCommonSubscribers(channel1, channel2);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (commonSubscribers > 0) {\n\t\t\t\t\t\t\t// Perform computation and add it\n\t\t\t\t\t\t\tthis.pairMultiplicity.put(pair, commonSubscribers);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t}", "Set<Node<K, V>> entrySet();", "public static Collection<Integer[]> getDIOCrossConnectCollection() {\n Collection<Integer[]> pairs = new ArrayList<Integer[]>();\n for (Collection<Integer[]> collection : getDIOCrossConnect()) {\n pairs.addAll(collection);\n }\n return pairs;\n }", "private Map<Integer, SortedSet> getInvariants(\n Partition partition, Set<Integer> targetBlock) {\n Map<Integer, SortedSet> setList = new HashMap<Integer, SortedSet>();\n for (int u : partition.getCell(currentBlockIndex)) {\n int h = neighboursInBlock(targetBlock, u);\n if (setList.containsKey(h)) {\n setList.get(h).add(u);\n } else {\n SortedSet set = new TreeSet();\n set.add(u);\n setList.put(h, set);\n }\n }\n// System.out.println(\"current block \" + partition.getCell(currentBlockIndex) + \" target block \" + targetBlock + \" inv \" + setList);\n return setList;\n }", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tTreeSet<Integer> treeset = new TreeSet<Integer>();\n\t\ttreeset.add(1);\n\t\tint a=0,b=0;\n\t\tint number = sc.nextInt();\n\t\tint pairnumber = sc.nextInt();\n\t\tArrayList<matching> arraylist = new ArrayList<matching>();\n\t\t//연결 정보를 arraylist에 저장\n\t\tfor(int i =0;i<pairnumber;i++) {\n\t\t\ta=sc.nextInt();\n\t\t\tb=sc.nextInt();\n\t\t\tarraylist.add(new matching(a,b));\n\t\t}\n\n\t\tIterator<matching> itr = arraylist.iterator();\n\t\t//연결된 컴퓨터를 set에 넣는다.\n\t\tfor(int i =0;i<pairnumber;i++)\n\t\t{\n\t\t\titr = arraylist.iterator();\n\t\t\twhile(itr.hasNext()) {\n\t\t\t\tmatching temp2 = itr.next();\n\t\t\t\t//System.out.println(temp2.getnum1());\n\t\t\t\tif(treeset.contains(temp2.getnum1())|| treeset.contains(temp2.getnum2())) {\n\t\t\t\t\ttreeset.add(temp2.getnum2());\n\t\t\t\t\ttreeset.add(temp2.getnum1());\n\t\t\t\t\titr.remove();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(treeset.size()-1);\n\t}", "private void buildGraph(String[] words,int indegree[], HashMap<Character, Set<Character>> adjList){\n // initialise the adj list graph with all charac ters in all words\n for(String word:words ){\n for(char c: word.toCharArray()){\n adjList.putIfAbsent(c, new HashSet());\n }\n }// once u fill with init, then u eatblish relationships\n \n // wrt and er \n for(int i=1; i<words.length;i++){\n String first = words[i-1];\n String second = words[i];\n // now compare each char in thos words\n for(int j=0; j< Math.min(first.length(),second.length());j++){\n if(first.charAt(j) != second.charAt(j)){\n // a->b here out=a, in=b\n char out = first.charAt(j);\n char in = second.charAt(j);\n // a->b , so in adj list. we need to insert the valiue if not present\n // if the graph does not contains dependecny, which is in set, u add it else u dont add// since hashset, we can check usinhg contains i guess\n if(! adjList.get(out).contains(in)){\n adjList.get(out).add(in);\n \n indegree[in -'a']++;\n }\n // once it is found , u can break out th e loop\n break;\n \n }// if eqaual we mmove to next char and do the process\n }\n }\n }", "private HashSet<List<String>> overlapPath(LinkedList<String> _path1, LinkedList<String> _path2) {\n LinkedList<String> shortpath = new LinkedList<String>();\n LinkedList<String> longpath = new LinkedList<String>();\n if (_path1.size() >= _path2.size()) {\n shortpath.addAll(_path2);\n longpath.addAll(_path1);\n } else {\n shortpath.addAll(_path1);\n longpath.addAll(_path2);\n }\n HashSet<List<String>> results = new HashSet<List<String>>();\n List<String> overlap = new LinkedList<String>();\n int length = 1, pointer = 0;\n // complexity: looping only once by increasing / decreasing i and j\n for (int i = 0, j = 0; i < shortpath.size() && j < longpath.size(); ) {\n String node = shortpath.get(i);\n if (node.equals(longpath.get(j))) {\n overlap.add(node);\n i++;\n j++;\n } else {\n if (!overlap.isEmpty()) {\n List<String> newoverlap = new LinkedList<String>();\n newoverlap.addAll(overlap);\n if (newoverlap.size() > length) length = newoverlap.size();\n results.add(newoverlap);\n overlap.clear();\n i = pointer;\n } else {\n if (i != (shortpath.size() - 1) && j == (longpath.size() - 1)) {\n i = i + length;\n pointer = i;\n j = 0;\n length = 1;\n } else j++;\n }\n }\n }\n if (!overlap.isEmpty()) results.add(overlap);\n PathSimilarity.log.info(\"Results: \" + results);\n return results;\n }", "public Set<String> hyponyms(String word) {\n HashSet<String> allhyponyms = new HashSet<String>();\n int maxV = synset.size();\n // int maxV = 0;\n // for (Integer i : synset.keySet()) {\n // if (maxV < i) {\n // maxV = i;\n // }\n // }\n // maxV += 1;\n Digraph digraph = new Digraph(maxV);\n\n // ArrayList<Integer> hypoKeys = new ArrayList<Integer>();\n // for (int i = 0; i < hyponym.size(); i++) {\n // hypoKeys.add(hyponym.get(0).get(i));\n // }\n \n for (ArrayList<Integer> a : hyponym) {\n int key = a.get(0);\n for (int j = 1; j < a.size(); j++) {\n digraph.addEdge(key, a.get(j));\n }\n }\n\n // get synonyms (in same synset), ex. given \"jump\", will get \"parachuting\" as well as \"leap\"\n ArrayList<String> strArray = new ArrayList<String>();\n for (Integer k : getSynsetKeys(word)) {\n strArray.addAll(synset.get(k));\n }\n for (String str : strArray) {\n allhyponyms.add(str);\n }\n\n // for each int from set<int> with all synset IDS\n for (Integer s : GraphHelper.descendants(digraph, getSynsetKeys(word))) {\n for (String t : synset.get(s)) {\n allhyponyms.add(t);\n }\n }\n return allhyponyms;\n }", "public Set<String> hyponyms(String word) {\n hypernymSet = new TreeSet<String>();\n firstsIDset = new HashSet<Integer>();\n for (String[] synStrings : sFile.values()) {\n for (String synset : synStrings) {\n if (synset.equals(word)) {\n for (String synset2 : synStrings) {\n hypernymSet.add(synset2);\n }\n for (Integer key : sFile.keySet()) {\n if (sFile.get(key).equals(synStrings)) {\n firstsIDset.add(key);\n }\n }\n }\n }\n }\n\n sIDset = GraphHelper.descendants(theDigraph, firstsIDset);\n for (Integer id : sIDset) {\n synsetWordStrings = sFile.get(id);\n for (String word2 : synsetWordStrings) {\n hypernymSet.add(word2);\n }\n }\n return hypernymSet;\n }", "private List<GPairRecord<S,S>> getCrossingPairs(final Predicate<Pair<S, S>> predicate) {\n\n // get first and last terminal for each non-terminal\n Pair<S, S>[] pairs = getFirstLastMappingArray();\n\n // list of records of crossing pairs\n List<GPairRecord<S,S>> recordList = new ArrayList<>();\n\n // scan for crossing pairs in the right order\n slp.getOrderedProductions().stream().map(p -> p.getLeft()).forEach(nonTerminal -> consumeCrossingPairs(nonTerminal, recordList::add, pairs, predicate));\n return recordList;\n }", "Map<String, Set<String>> mapSecondaryTablesToPrimaryGroups();", "@Override\n public Iterator<Set<E>> iterator() {\n return new DisjointSetIterator(theSet);\n }" ]
[ "0.62977594", "0.60578394", "0.6004731", "0.54747313", "0.54528105", "0.5409494", "0.54027164", "0.5390736", "0.5390158", "0.53620166", "0.5357006", "0.53506434", "0.5348596", "0.53136396", "0.53046894", "0.5301995", "0.5293953", "0.5290387", "0.5272205", "0.5272139", "0.5268258", "0.5252208", "0.52360564", "0.5228543", "0.5221341", "0.5212902", "0.52067065", "0.5205764", "0.5197347", "0.5189623", "0.5172188", "0.51645505", "0.5143503", "0.5134398", "0.5128916", "0.51147574", "0.51096123", "0.51052576", "0.510311", "0.51011014", "0.50690717", "0.5066042", "0.5059885", "0.5054081", "0.5053576", "0.5045206", "0.503923", "0.5036007", "0.5025668", "0.501801", "0.5015335", "0.50118583", "0.50118303", "0.5011364", "0.5006437", "0.49929103", "0.49886948", "0.49877274", "0.4985148", "0.49841294", "0.49834597", "0.49789882", "0.49522334", "0.4942755", "0.49416038", "0.49408293", "0.49406233", "0.4938961", "0.49327722", "0.49299932", "0.49273017", "0.49200547", "0.491402", "0.49132016", "0.4912818", "0.4909195", "0.4908041", "0.49069646", "0.49047393", "0.48951533", "0.4893676", "0.48829812", "0.4864076", "0.4851811", "0.48495647", "0.48475632", "0.4841627", "0.48383966", "0.4823237", "0.48222798", "0.48201644", "0.4811299", "0.4801366", "0.47943878", "0.4794305", "0.47908273", "0.4788181", "0.478523", "0.47801077", "0.47792912" ]
0.5876435
3
States whether the given graph contains the nodes in the given set and the node pair.
private boolean containsAll(Graph g, Set<Node> nodes, NodePair pair) { List<String> nodeNames = g.getNodeNames(); if (!nodeNames.contains(pair.getFirst().getName()) || !nodeNames.contains(pair.getSecond().getName())) { return false; } for (Node node : nodes) { if (!nodeNames.contains(node.getName())) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean hasANeighbour(Graph<V, E> g, Set<V> set, V v)\n {\n return set.stream().anyMatch(s -> g.containsEdge(s, v));\n }", "public boolean containsNode(Node n);", "public boolean isBipartite(List<GraphNode> graph) {\n Map<GraphNode, Integer> group = new HashMap<>();\n for (GraphNode node: graph) {\n if (!bfs(group, node)) {\n return false;\n }\n }\n return true;\n }", "public boolean contains(Node n) {\n\t\t\n\t\t//Validate n has a value\n\t\tif (n == null) { \n\t\t\treturn false; \n\t\t} \n\t\t\n\t\t//Node not present in hashmap\n\t\tif (!nodes.contains(n)) {\n\t\t\treturn false; \n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "public boolean nodeExists(String... nodeList){\r\n\t\tboolean val = true;\r\n\t\tfor (String n:nodeList){\r\n\t\t\tval &= nodes.containsKey(n.toLowerCase());\r\n\t\t}\r\n\t\treturn val;\r\n\t}", "boolean hasSharedSet();", "@Override\r\n public boolean isSatisfied(Configuration cfg) {\r\n Set<Node> firstNodes = new HashSet<Node>();\r\n Set<Node> secondNodes = new HashSet<Node>();\r\n if (getFirstSet().size() == 0 || getSecondSet().size() == 0) {\r\n //FIXME debug log VJob.logger.error(this.toString() + \": Some sets of virtual machines are empty\");\r\n return false;\r\n }\r\n\r\n for (VirtualMachine vm : getFirstSet()) {\r\n if (cfg.isRunning(vm)) {\r\n firstNodes.add(cfg.getLocation(vm));\r\n }\r\n }\r\n for (VirtualMachine vm : getSecondSet()) {\r\n if (cfg.isRunning(vm)) {\r\n secondNodes.add(cfg.getLocation(vm));\r\n }\r\n }\r\n\r\n for (Node n : firstNodes) {\r\n if (secondNodes.contains(n)) {\r\n \tManagedElementList<Node> ns = new SimpleManagedElementList<Node>();\r\n ns.addAll(firstNodes);\r\n ns.retainAll(secondNodes);\r\n //FIXME debug log VJob.logger.error(this.toString() + \": Nodes host VMs of the two groups: \" + ns);\r\n return false;\r\n }\r\n }\r\n for (Node n : secondNodes) {\r\n if (firstNodes.contains(n)) {\r\n \tManagedElementList<Node> ns = new SimpleManagedElementList<Node>();\r\n ns.addAll(secondNodes);\r\n ns.retainAll(firstNodes);\r\n //FIXME debug log VJob.logger.error(this.toString() + \": Nodes host VMs of the two groups: \" + ns);\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "public boolean containsAll(ISet<E> otherSet) {\n \tif(otherSet == null) {\n \t\tthrow new IllegalArgumentException(\"Invalid parameter!\");\n \t}\n \t\n \tIterator<E> otherIterateSet = otherSet.iterator();\n \t\n \twhile(otherIterateSet.hasNext()) {\n \t\tE item1 = otherIterateSet.next();\n \t\tboolean foundMatch = false;\n \t\t\n \t\t// searches this set for target element\n \t\tif(this.contains(item1)) {\n \t\t\tfoundMatch = true;\n \t\t}\n \t\t\n \t\t// if the current element was not found at all\n \t\tif(foundMatch == false)\n \t\t\treturn false;\n \t}\n \treturn true;\n }", "public boolean isConnected() {\n if (this.isEmpty()) return true;\n\n if (this.directed) {\n Deque<Node> toVisit = new LinkedList<>();\n for (Node s : this.nodes.values()) {\n Node current;\n toVisit.addLast(s);\n while (!toVisit.isEmpty()) {\n current = toVisit.removeLast();\n current.setFlag(\"_visited\");\n for (Edge edge : current.getNeighbours()) {\n Node n = edge.getEnd();\n if (!n.getFlag(\"_visited\")) toVisit.addLast(n);\n }\n }\n\n //Check if all nodes have been visited and remove flags\n boolean allVisited = true;\n for (Node n : nodes.values()) {\n allVisited = allVisited && n.getFlag(\"_visited\");\n n.unsetFlag(\"_visited\");\n }\n if (!allVisited) return false;\n }\n return true;\n }\n else {\n //Perform a DFS from a random start node marking nodes as visited\n Node current;\n Deque<Node> toVisit = new LinkedList<>();\n toVisit.addLast(this.nodes.values().iterator().next());\n while (!toVisit.isEmpty()) {\n current = toVisit.removeLast();\n current.setFlag(\"_visited\");\n for (Edge edge : current.getNeighbours()) {\n Node n = edge.getEnd();\n if (!n.getFlag(\"_visited\")) toVisit.addLast(n);\n }\n }\n\n //Check if all nodes have been visited and remove flags\n boolean allVisited = true;\n for (Node n : nodes.values()) {\n allVisited = allVisited && n.getFlag(\"_visited\");\n n.unsetFlag(\"_visited\");\n }\n\n return allVisited;\n }\n }", "@Override\r\n\tpublic boolean isConnected(GraphStructure graph) {\r\n\t\tgetDepthFirstSearchTraversal(graph);\r\n\t\tif(pathList.size()==graph.getNumberOfVertices()) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "static boolean isFeasible(Graph g, Set active, int k) {\r\n\t\tif (active==null) return true;\r\n\t\tif (k==1) {\r\n\t\t\tIterator it = active.iterator();\r\n\t\t\twhile (it.hasNext()) {\r\n\t\t\t\tInteger nid = (Integer) it.next();\r\n\t\t\t\tNode n = g.getNodeUnsynchronized(nid.intValue());\r\n\t\t\t\tSet nbors = n.getNborsUnsynchronized(); // used to be n.getNbors();\r\n\t\t\t\tIterator it2 = nbors.iterator();\r\n\t\t\t\twhile (it2.hasNext()) {\r\n\t\t\t\t\tNode n2 = (Node) it2.next();\r\n\t\t\t\t\tif (active.contains(new Integer(n2.getId()))) return false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tfinal int gsz = g.getNumNodes();\r\n for (int i=0; i<gsz; i++) {\r\n Node nn = g.getNode(i);\r\n\t\t\tSet nnbors = nn.getNbors(); // Set<Node>\r\n\t\t\tint count=0;\r\n\t\t\tif (active.contains(new Integer(i))) count=1;\r\n\t\t\tIterator it2 = active.iterator();\r\n\t\t\twhile (it2.hasNext()) {\r\n\t\t\t\tInteger nid2 = (Integer) it2.next();\r\n\t\t\t\tNode n2 = g.getNode(nid2.intValue());\r\n\t\t\t\tif (nnbors.contains(n2)) {\r\n\t\t\t\t\t++count;\r\n\t\t\t\t\tif (count>1) return false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n }\r\n return true;\r\n }", "public boolean isBipartite(List<GraphNode> graph){\n HashMap<GraphNode, Integer> visited = new HashMap<GraphNode, Integer>();\n // this for loop is in case of forest.\n for(GraphNode node : graph){\n if(!isBipartiteHelper(node,visited)) return false;\n }\n return true;\n }", "boolean contains(Edge edge);", "public boolean containsAll(ISet<E> otherSet) {\n\t\tif (otherSet == null)\n\t\t\tthrow new IllegalArgumentException(\"The given set it null.\");\n\t\tfor (E obj: otherSet) {\n\t\t\tif (!this.contains(obj))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean contains(N startNode, N endNode, E label)\r\n/* 62: */ {\r\n/* 63:121 */ assert (checkRep());\r\n/* 64:122 */ if ((this.map.containsKey(startNode)) && (this.map.containsKey(endNode))) {\r\n/* 65:123 */ return ((Map)this.map.get(startNode)).get(endNode).equals(label);\r\n/* 66: */ }\r\n/* 67:125 */ return false;\r\n/* 68: */ }", "public boolean contains(Node node) {\n\t\tk key = (k) node.getKey();\n\t\tv value = (v) node.getValue();\n\t\treturn contains(key, value);\n\t}", "public boolean isEqualTo (OrderedSet set) {\n if (set==null || size!=set.size)\n return false;\n for (DoubleLinkedList p=first; p!=null; p=p.getNext()) {\n if (set.dictionary.get(p.getInfo()) == null)\n\treturn false;\n }\n for (DoubleLinkedList p=set.first; p!=null; p=p.getNext()) {\n if (dictionary.get(p.getInfo()) == null)\n\treturn false;\n }\n return true;\n }", "public boolean isConnectedTo(Node<A> n) {\n\t\t\n\t\tif (g == null) return false;\n\t\t\n\t\tif (g.contains(n)){\n\t\t\t\n\t\t\tfor (Object o: g.getEdges()) {\n\t\t\t\t\n\t\t\t\tif (((Edge<?>)o).getFrom().equals(this) && ((Edge<?>)o).getTo().equals(n)) {\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\n\t\t}\n\t\treturn false;\n\t}", "@Override\n public boolean isConnected() {\n for (node_data n : G.getV()) {\n bfs(n.getKey());\n for (node_data node : G.getV()) {\n if (node.getTag() == 0)\n return false;\n }\n }\n return true;\n }", "public static boolean checkOpenSet(Vector<mapNode> openSet, mapNode tempNode){\n\t\tboolean check = false;\r\n\t\tfor(int i = 0; i < openSet.size(); i++){\r\n\t\t\tif(openSet.get(i).gridPosition[0] == tempNode.gridPosition[0] && openSet.get(i).gridPosition[1] == tempNode.gridPosition[1]){\r\n\t\t\t\tcheck = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn check;\r\n\t}", "public boolean hasEdge(Node k){\n for(int i = 0; i<edges.size(); i++){\n Edge edge = edges.get(i);\n if(edge.end() == k){\n return true;\n }\n }\n return false;\n }", "public abstract boolean isUsing(Long graphNode);", "@Override\n\tpublic boolean isConnected() {\n\t\tif(this.GA.nodeSize() ==1 || this.GA.nodeSize()==0) return true;\n\t\tgraph copied = this.copy();\n\t\ttagZero(copied);\n\t\tCollection<node_data> s = copied.getV();\n\t\tIterator it = s.iterator();\n\t\tnode_data temp = (node_data) it.next();\n\t\tDFSUtil(copied,temp);\n\t\tfor (node_data node : s) {\n\t\t\tif (node.getTag() == 0) return false;\n\t\t}\n\t\ttransPose(copied);\n\t\ttagZero(copied);\n\t Collection<node_data> s1 = copied.getV();\n\t\tIterator it1 = s1.iterator();\n\t\tnode_data temp1 = (node_data) it1.next();\n\t\tDFSUtil(copied,temp1);\n\t\tfor (node_data node1 : s1) {\n\t\t\tif (node1.getTag() == 0) return false;\n\t\t}\n\n\t\treturn true;\n\t}", "private static boolean putInHashMap(Node head) {\r\n\t\tboolean hasloop = false;\r\n\t\tHashSet<Node> nodeSet = new HashSet();\r\n\t\twhile (head != null) {\r\n\t\t\tif (nodeSet.contains(head)) {\r\n\t\t\t\thasloop = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tnodeSet.add(head);\r\n\t\t\thead = head.next;\r\n\t\t}\r\n\r\n\t\treturn hasloop;\r\n\t}", "public boolean equals (SetADT<T> set);", "public boolean isBipartite(List<GraphNode> graph) {\n if (graph == null || graph.isEmpty()) {\n return true;\n }\n\n Set<GraphNode> G1 = new HashSet<>();\n Set<GraphNode> G2 = new HashSet<>();\n\n G1.add(graph.get(0));\n\n for (GraphNode g : graph) {\n if (G1.contains(g)) {\n if (!dfsCheckAllNeighborsAndFlipFlop(g.neighbors, G2, G1)) {\n return false;\n }\n } else if (G2.contains(g)) {\n if (!dfsCheckAllNeighborsAndFlipFlop(g.neighbors, G1, G2)) {\n return false;\n }\n }\n }\n\n return true;\n }", "private static boolean isItVisted(Node node) {\n\t\t\n\t\tboolean areNodesEqual = false;\n\t\tfor (Node temp : nodesCovered) {\n\t\t\tif(choice==1){\n\t\t\t\tif (node.count == temp.count) \t\t\t\t{\n\t\t\t\t\tif (areTheyEqual(temp.stateSpace, node.stateSpace)) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t }\n\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\n\t\t\t\t\tif (node.manhattanDist == temp.manhattanDist) {\n\t\t\t\t\t\tif (areTheyEqual(temp.stateSpace, node.stateSpace)) {\n\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\treturn areNodesEqual;\n\t}", "public boolean contains(Node node) {\n if (edge.contains(node)) {\n return true;\n }\n Node pNode = edge.getEdgeVariable();\n if (pNode == null) {\n return false;\n }\n return pNode == node;\n }", "public boolean reachable(Vertex start, Vertex end){\n\t\tSet<Vertex> reach = this.post(start); \n\t\treturn reach.contains(end);\n\t}", "private static boolean isUnivalNode(Node x, Set<Node> set) {\n if (x == null) { return true; }\n boolean left = isUnivalNode(x.left, set);\n boolean right = isUnivalNode(x.right, set);\n\n if (left && right) {\n boolean leftSubTree = x.left == null || x.left.val == x.val;\n boolean rightSubTree = x.right == null || x.right.val == x.val;\n if (leftSubTree && rightSubTree) {\n set.add(x);\n return true;\n }\n }\n return false;\n }", "public boolean contains(N node)\r\n/* 56: */ {\r\n/* 57:105 */ assert (checkRep());\r\n/* 58:106 */ return this.map.containsKey(node);\r\n/* 59: */ }", "public boolean isMultiGraph();", "@Override\n public boolean hasEdge(V from, V to)\n {\n if (from.equals(null) || to.equals(null)){\n throw new IllegalArgumentException();\n }\n if (!contains(from)){\n return false;\n }\n else{\n Iterator graphIterator = graph.entrySet().iterator();\n Map.Entry graphElement = (Map.Entry) graphIterator.next();\n V vert = (V) graphElement.getKey();\n while (graphIterator.hasNext() && vert != from){\n graphElement = (Map.Entry) graphIterator.next();\n vert = (V)graphElement.getKey();\n }\n\t ArrayList <V> edges = graph.get(vert);\n\t return edges.contains(to);\n\t }\n }", "@Override\n\tpublic boolean equals(Object other)\n\t{\n\t\tif (!(other instanceof Graph))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tGraph<N, ET> otherGraph = (Graph<N, ET>) other;\n\t\tList<N> otherNodeList = otherGraph.getNodeList();\n\t\tint thisNodeSize = nodeList.size();\n\t\tif (thisNodeSize != otherNodeList.size())\n\t\t{\n\t\t\t//\t\t\tSystem.err.println(\"Not equal node count\");\n\t\t\treturn false;\n\t\t}\n\t\t// (potentially wasteful, but defensive copy)\n\t\totherNodeList = new ArrayList<N>(otherNodeList);\n\t\tif (otherNodeList.retainAll(nodeList))\n\t\t{\n\t\t\t// Some nodes are not identical\n\t\t\t//\t\t\tSystem.err.println(\"Not equal node list\");\n\t\t\t//\t\t\tSystem.err.println(nodeList);\n\t\t\t//\t\t\tSystem.err.println(otherNodeList);\n\t\t\treturn false;\n\t\t}\n\t\t// Here, the node lists are identical...\n\t\tList<ET> otherEdgeList = otherGraph.getEdgeList();\n\t\tint thisEdgeSize = edgeList.size();\n\t\tif (thisEdgeSize != otherEdgeList.size())\n\t\t{\n\t\t\t//\t\t\tSystem.err.println(\"Not equal edge count\");\n\t\t\treturn false;\n\t\t}\n\t\t// (potentially wasteful, but defensive copy)\n\t\totherEdgeList = new ArrayList<ET>(otherEdgeList);\n\t\tif (otherEdgeList.retainAll(edgeList))\n\t\t{\n\t\t\t// Other Graph contains extra edges\n\t\t\t//\t\t\tSystem.err.println(\"not equal edge retain\");\n\t\t\t//\t\t\tSystem.err.println(edgeList);\n\t\t\t//\t\t\tSystem.err.println(otherEdgeList);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "@Override\r\n public boolean equals(Object o) {\r\n GraphNode n = (GraphNode) o;\r\n if (n != null && n.getX() == getX() && n.getY() == getY())\r\n return true;\r\n return false;\r\n }", "public boolean containsRelations();", "public boolean connectsVertices(Collection<V> vs);", "public boolean contains(int key) {\n int i = index(key);\n if(nodes[i] == null) {\n \treturn false;\n }\n Node prev = find(nodes[i], key);\n if(prev.next == null) {\n \treturn false;\n }\n return true;\n }", "private boolean checksetunions(Set<String> set, HashMap<String, ArrayList<String>> c) {\n\t\tObject[] ckeys = c.keySet().toArray();\r\n\t\tfor (int i = 0; i < c.keySet().size(); i++) {\r\n\t\t\tif (c.get(ckeys[i]).containsAll(set)) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public static boolean isAllVertexConnected(ArrayList<Edge>[] graph)\n {\n int count = 0;\n int n = graph.length;\n boolean[] vis = new boolean[n];\n\n for(int v = 0; v < n; v++) {\n if(vis[v] == false) {\n count++;\n\n //if number of connected components is greater than 1 then graph is not connected\n if(count > 1) {\n return false;\n }\n gcc(graph, v, vis);\n }\n }\n return true;\n\n }", "private boolean satisfiesHavingClause(List set)\n {\n state.put(RESULTS_SET, set);\n\n Expression having = compilation.getExprHaving();\n if (having.evaluate(evaluator) == Boolean.TRUE)\n {\n return true;\n }\n return false;\n }", "public boolean isConnected(String node1, String node2) {\r\n\r\n Set<String> adjacent = map.get(node1);\r\n if (adjacent == null) {\r\n return false; // boolean method should return a value; if adjacent node is null then the method return false\r\n }\r\n return adjacent.contains(node2); // if there exist adjacent node then returns adjacency list contains node2 \r\n }", "@Override\n\tpublic boolean containsNode(Object node)\n\t{\n\t\t// This is presumably faster than searching through nodeList\n\t\treturn nodeEdgeMap.containsKey(node);\n\t}", "@Override\n\tpublic boolean contains(K key) {\n\t\tNode currentNode = firstNode;\n\t\t\n\t\tif(!isEmpty()){\n\t\t\twhile(currentNode.key != key){\n\t\t\t\tif(currentNode.getNextNode() == null){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "boolean contains(Vertex vertex);", "protected boolean hasConnection(int start, int end) {\n\t\tfor (Gene g : genes.values()) {\n\t\t\tif (g.start == start && g.end == end)\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public Boolean contains(T node) {\n\t\treturn nodes.contains(node);\n\t}", "public boolean inSameSet( T obj1, T obj2 )\n {\n // Find the root of each object; if either is not contained, the root\n // value will be null, and we throw an exception.\n Node root1 = getRoot(nodes.get(obj1));\n Node root2 = getRoot(nodes.get(obj2));\n if ( root1 == null && root2 == null )\n throw new NoSuchElementException( \"Sets do not contain either object: \" + obj1 + \", \" + obj2 );\n if ( root1 == null )\n throw new NoSuchElementException( \"Sets do not contain object: \" + obj1 );\n if ( root2 == null )\n throw new NoSuchElementException( \"Sets do not contain object: \" + obj2 );\n // If here, then have non-null root for each input; check if same Node.\n return root1 == root2;\n }", "public boolean containsEdge(Edge<V> edge);", "public boolean contains(int key) {\n \tfor(int k:set){\n \tif(k==key){\n \t\treturn true;\n \t}\n }\n\t\treturn false;\n }", "public boolean subsetGraphs(PlainGraph g1, PlainGraph g2) {\n for (PlainNode node : g1.nodeSet()) {\n // check if all nodes of g1 also exist in g2\n String nodeName = getVarName(g1, node);\n if (!graphNodeMap.get(g2).containsKey(nodeName)) {\n return false;\n }\n }\n\n for (PlainEdge edge: g1.edgeSet()) {\n // check if all edges of g1 also exist in g2\n // and check if the edge has the same negation\n if (!(g2.containsEdge(edge) && getNotEdge(g1, edge).size() == getNotEdge(g2, edge).size())) {\n return false;\n }\n }\n return true;\n }", "private boolean used(LirNode reg, LirNode ins) {\n if(reg.opCode!=Op.REG) return false;\n if(ins.opCode!=Op.PARALLEL) return false;\n boolean result=false;\n for(int i=0; i<ins.nKids(); i++) {\n if(ins.kid(i).opCode!=Op.SET) return false;\n result=(result | isContained(reg, ins.kid(i).kid(1)));\n }\n return result;\n }", "public boolean isConnected() {\r\n\r\n\t\tHashMap<String, Boolean> processed = new HashMap<>();\r\n\t\tLinkedList<Pair> queue = new LinkedList<>();\r\n\t\tArrayList<String> list = new ArrayList<>(vtces.keySet());\r\n\t\tint count = 0;\r\n\t\tfor (String key : list) {\r\n\t\t\tif (processed.containsKey(key))\r\n\t\t\t\tcontinue;\r\n\t\t\tcount++;\r\n\t\t\t// Create a new pair\r\n\t\t\tPair npr = new Pair();\r\n\t\t\tnpr.vname = key;\r\n\t\t\tnpr.psf = key;\r\n\r\n\t\t\t// put pair queue\r\n\t\t\tqueue.addLast(npr);\r\n\r\n\t\t\t// Work while queue is not empty\r\n\t\t\twhile (!queue.isEmpty()) {\r\n\r\n\t\t\t\t// Remove a pair from queue\r\n\t\t\t\tPair rp = queue.removeFirst();\r\n\r\n\t\t\t\tif (processed.containsKey(rp.vname))\r\n\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t// Put in processed hashmap\r\n\t\t\t\tprocessed.put(rp.vname, True);\r\n\r\n\t\t\t\t// nbrs\r\n\t\t\t\tVertex rpvertex = vtces.get(rp.vname);\r\n\t\t\t\tArrayList<String> nbrs = new ArrayList<>(rpvertex.nbrs.keySet());\r\n\r\n\t\t\t\tfor (String nbr : nbrs) {\r\n\t\t\t\t\t// Process only unprocessed vertex\r\n\t\t\t\t\tif (!processed.containsKey(nbr)) {\r\n\t\t\t\t\t\t// Create a new pair and put in queue\r\n\t\t\t\t\t\tPair np = new Pair();\r\n\t\t\t\t\t\tnp.vname = nbr;\r\n\t\t\t\t\t\tnp.psf = rp.psf + nbr;\r\n\r\n\t\t\t\t\t\tqueue.addLast(np);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tif (count > 1)\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "boolean contains(int vertex);", "@Override public boolean equals(Object o) {\n if (this == o) { return true; }\n if ( !(o instanceof Set) ) { return false; }\n Set that = (Set) o;\n return that.size() == inner.size() &&\n containsAll(that);\n }", "public boolean hasEular(Graph graph) {\n\t\tint vertices = graph.countVertices();\n\t\tint i = 0;\n\t\tint[] x = new int[]{1, 5};\n\t\tfor (i = 0; i < vertices; i++) {\n\t\t\tif (graph.getNeighbours(i).length != 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (i == vertices) {\n\t\t\treturn true;\n\t\t}\n\t\t// (2) All vertices with non-zero degree are connected.\n\t\tif (!isNonZeroDegreeVerticesConnected(graph)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// (3) All vertices have even degree.\n\t\t// int vertices = graph.countVertices();\n\t\tint odd = 0;\n\t\tfor (i = 0; i < vertices; i++) {\n\t\t\tif ((graph.getNeighbours(i).length & 1) == 1) {\n\t\t\t\todd++;\n\t\t\t}\n\t\t}\n\n\t\tif (odd > 0) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean contains(Point2D p) {\n return pointSet.contains(p);\n }", "public boolean contains(SeqItemset set)\n\t{\n\t\tif (m_size<set.m_size) return false;\n\t\tint ind = 0;\n\t\tint i = 0;\n\t\twhile ((i<set.m_size) && (-1!=ind))\n\t\t{\n\t\t\tind = indexOf(set.elementIdAt(i));\n\t\t\ti++;\n\t\t}\n\t\tif (-1==ind) return false;\n\t\telse return true;\n\t}", "boolean hasIsNodeOf();", "boolean hasIsVertexOf();", "boolean check(Long nodeID, int qID, GraphDatabaseService databaseService) {\n\n vertexClass vc = queryGraphNodes.get(qID);\n try(Transaction tx = databaseService.beginTx()) {\n for(int edge: vc.edges.keySet()) {\n\n boolean relExist = false;\n if(solution.containsKey(edge)) {\n // j<i condition confirmed\n Node edgeNode, otherNode;\n\n edgeNode = databaseService.getNodeById(solution.get(edge));\n otherNode = databaseService.getNodeById(nodeID);\n\n Iterable<Relationship> relationships = edgeNode.getRelationships(Direction.BOTH);\n\n Iterator <Relationship>iter = relationships.iterator();\n while (iter.hasNext()) {\n Relationship rel = iter.next();\n if(rel.getOtherNode(edgeNode).equals(otherNode))\n relExist = true;\n }\n if(!relExist)\n return false;\n }\n\n }\n tx.success();\n\n }\n\n\n return true;\n }", "@Override\n public boolean containsNode(Node testedNode) {\n for (int i = 0; i < this.nodes.size(); i++) {\n if (nodes.get(i).getName().equals(testedNode.getName())) {\n return true;\n }\n }\n\n return false;\n }", "public boolean contains(Solution solution)\r\n\t{\r\n\t\treturn set.contains(solution);\r\n\t}", "public boolean DEBUG_containsAtALL(int k) {\r\n Node curr = head.get();\r\n \r\n while (curr != null) {\r\n \r\n if (curr.key == k) {\r\n //s = curr.state;\r\n \r\n //if (s != 3 && s != 1) {\r\n return true;\r\n //}\r\n }\r\n curr = curr.next;\r\n }\r\n return false;\r\n }", "boolean hasMatchedElements();", "public static boolean verifyGraph(Graph<V, DefaultEdge> g)\n {\n V start = g.vertexSet().stream().filter(V -> V.getID().equals(\"0\")).findAny().orElse(null);\n Iterator<V> iterator = new DepthFirstIterator<>(g, start);\n while (iterator.hasNext()) {\n V v = iterator.next();\n if (v.color == -1)\n {\n System.out.println(\"Did not color vertex \" + v.getID());\n System.out.println(\"check neighbors of \" + v.getID());\n List<V> neighbors = Graphs.neighborListOf(g, v);\n System.out.println(\"Vertex \" + v.getID() + \" color: \" + v.color);\n for (V neighbor : neighbors)\n {\n System.out.println(\"neighbor \" + neighbor.getID() + \" color: \" + neighbor.color);\n }\n return false;\n }\n if (!verifyColor(g, v))\n {\n System.out.println(\"check neighbors of \" + v.getID());\n List<V> neighbors = Graphs.neighborListOf(g, v);\n for (V neighbor : neighbors)\n {\n if (v.color == neighbor.color)\n {\n System.out.println(\"Vertex \" + v.getID() + \" color: \" + v.color);\n System.out.println(\"neighbor \" + neighbor.getID() + \" color: \" + neighbor.color);\n }\n }\n return false;\n }\n }\n return true;\n }", "public boolean hasEdge(T beg, T end);", "public boolean containsSupersetOf(Itemset itemset) {\n\t\t// calculate hashcode of the given itemset\n\t\tint hashcode = hashCode(itemset);\n\t\tif(table[hashcode] == null){\n\t\t\treturn false;\n\t\t}\n\t\t// loop through all itemsets to check if there is a superset\n\t\tfor(Object object : table[hashcode]){\n\t\t\tItemset itemset2 = (Itemset)object;\n\t\t\t// if there is, return true\n\t\t\tif(itemset2.getItems().contains(itemset.getItems())){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t// otherwise return false\n\t\treturn false;\n\t}", "public boolean containsIncomingRelations();", "private boolean hasConfigurationType1(Graph<V, E> g)\n {\n for (V v1 : g.vertexSet()) {\n Set<V> temp = new ConnectivityInspector<>(g).connectedSetOf(v1);\n for (V v2 : temp) {\n if (v1 == v2 || !g.containsEdge(v1, v2))\n continue;\n for (V v3 : temp) {\n if (v3 == v1 || v3 == v2 || !g.containsEdge(v2, v3) || g.containsEdge(v1, v3))\n continue;\n for (V v4 : temp) {\n if (v4 == v1 || v4 == v2 || v4 == v3 || g.containsEdge(v1, v4)\n || g.containsEdge(v2, v4) || !g.containsEdge(v3, v4))\n continue;\n for (V v5 : temp) {\n if (v5 == v1 || v5 == v2 || v5 == v3 || v5 == v4\n || g.containsEdge(v2, v5) || g.containsEdge(v3, v5)\n || !g.containsEdge(v1, v5) || !g.containsEdge(v4, v5))\n continue;\n if (certify) {\n List<E> edgeList = new LinkedList<>();\n edgeList.add(g.getEdge(v1, v2));\n edgeList.add(g.getEdge(v2, v3));\n edgeList.add(g.getEdge(v3, v4));\n edgeList.add(g.getEdge(v4, v5));\n edgeList.add(g.getEdge(v5, v1));\n\n double weight =\n edgeList.stream().mapToDouble(g::getEdgeWeight).sum();\n certificate = new GraphWalk<>(g, v1, v1, edgeList, weight);\n }\n return true;\n }\n }\n }\n }\n }\n\n return false;\n }", "public static <T> Set<Set<T>> findStronglyConnectedComponents(Map<T, Set<T>> graph) {\n if (graph == null) {\n return null;\n }\n Set<T> visited = new HashSet<>();\n Stack<T> stack = new Stack<>();\n for (T vertex : graph.keySet()) {\n if (!visited.contains(vertex)) {\n fillStack(graph, vertex, visited, stack);\n }\n }\n\n Map<T, Set<T>> reversedGraph = reverse(graph);\n visited.clear();\n Set<Set<T>> result = new HashSet<>();\n while (!stack.isEmpty()) {\n T vertex = stack.pop();\n if (!visited.contains(vertex)) {\n Set<T> component = new HashSet<>();\n fillComponent(reversedGraph, vertex, visited, component);\n result.add(component);\n }\n }\n return result;\n }", "public boolean equals(SetSet second){\n\t\tif(subset(second) && second.subset(this)){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "@Override\n public boolean contains(T item) {\n Node n = first;\n //walk through the linked list untill you reach the end\n while(n != null) {\n //see if the item exists in the set, if it does return true\n if(n.value.equals(item))\n return true;\n //move to the next node\n n = n.next;\n }\n //if not found return false\n return false;\n }", "public boolean validTree(int n, int[][] edges) {\n HashMap<Integer,HashSet<Integer>> graph = new HashMap<>();\n for (int i=0;i<n;i++){\n graph.put(i,new HashSet<>());\n }\n for(int []edge:edges){\n // since undirected graph\n graph.get(edge[0]).add(edge[1]);\n graph.get(edge[1]).add(edge[0]);\n }\n Queue<Integer> queue = new LinkedList<Integer>();\n\n boolean [] visited = new boolean[n];\n queue.add(0);\n while (!queue.isEmpty()){\n Integer v = queue.poll();\n if(visited[v]){ // means cycle is present\n return false;\n }\n for(Integer w:graph.get(v)){\n graph.get(w).remove(v); // whatttta clasic approach\n queue.add(w);\n visited[w] = true;\n }\n }\n // all nodes should have visited ..\n for(int i=0;i<n;i++){\n if(visited[i] == false){\n return false;\n }\n }\n return true;\n }", "public boolean containsEdge(E edge);", "public static boolean connected(Graph grafo) {\r\n\t\tint numVertices = grafo.getVertexNumber();\r\n\t\tSet<Vertice> verticesVisitados = new HashSet<Vertice>(); // sem repeticoes\r\n\t\tfor (Aresta aresta : grafo.getArestas()) {\r\n\t\t\tverticesVisitados.add(aresta.getV1());\r\n\t\t\tverticesVisitados.add(aresta.getV2());\r\n\t\t}\r\n\r\n\t\treturn numVertices == verticesVisitados.size();\r\n\t}", "@Override\n public boolean containsNodeFor(E item) {\n if(item == null){\n throw new NullPointerException(\"Received null as value.\");\n }\n return graphNodes.containsKey(item);\n }", "@Override\r\n\tpublic boolean contains(GraphPattern gp) {\n\t\tif (this.operand == null) {\r\n\t\t\treturn (gp == null);\r\n\t\t}\r\n\t\telse if (this.operand.equals(gp)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn this.operand.contains(gp);\r\n\t\t}\r\n\t}", "boolean hasNode();", "boolean hasNode();", "public boolean IsConnected() {\r\n\t\tHashMap<String, Boolean> processed = new HashMap<>();\r\n\t\tLinkedList<Pair> queue = new LinkedList<>();\r\n\t\tint counter = 0;\r\n\r\n\t\tArrayList<String> vnames = new ArrayList<>(vces.keySet());\r\n\t\tfor (String vname : vnames) {\r\n\t\t\tif (processed.containsKey(vname)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tcounter++;\r\n\t\t\tPair rootpair = new Pair(vname, vname);\r\n\t\t\tqueue.addLast(rootpair);\r\n\t\t\twhile (queue.size() != 0) {\r\n\t\t\t\t// 1. removeFirst\r\n\t\t\t\tPair rp = queue.removeFirst();\r\n\r\n\t\t\t\t// 2. check if processed, mark if not\r\n\t\t\t\tif (processed.containsKey(rp.vname)) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tprocessed.put(rp.vname, true);\r\n\r\n\t\t\t\t// 3. Check, if an edge is found\r\n\t\t\t\tSystem.out.println(rp.vname + \" via \" + rp.psf);\r\n\r\n\t\t\t\t// 4. Add the unprocessed nbrs back\r\n\t\t\t\tArrayList<String> nbrnames = new ArrayList<>(rp.vtx.nbrs.keySet());\r\n\t\t\t\tfor (String nbrname : nbrnames) {\r\n\t\t\t\t\tif (!processed.containsKey(nbrname)) {\r\n\t\t\t\t\t\tPair np = new Pair(nbrname, rp.psf + nbrname);\r\n\t\t\t\t\t\tqueue.addLast(np);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn counter == 1;\r\n\t}", "public boolean containsVertex(String node) {\n\t\treturn adj_list.containsKey(node);\n\t}", "@Test\n\tvoid testIfAdjacentNodeExists() {\n\t\tMap<String, LinkedHashSet<String>> map = new HashMap<String, LinkedHashSet<String>>();\n\t\tLinkedHashSet<String> edges = new LinkedHashSet<String>();\n\t\tedges.add(\"New York\");\n\t\tmap.put(\"Boston\", edges);\n\t\tOptional<LinkedHashSet<String>> vertexOptional = Optional.of(map.get(\"Boston\"));\n\t\tif (vertexOptional.isPresent()) {\n\t\t\tAssertions.assertNotNull(map.get(\"Boston\"));\n\t\t\tAssertions.assertEquals(1, map.get(\"Boston\").size());\n\t\t\tString[] edgesArray = new String[edges.size()];\n\t\t\tedgesArray = edges.toArray(edgesArray);\n\t\t\tAssertions.assertTrue(map.get(\"Boston\").contains(\"New York\"));\n\t\t\tAssertions.assertEquals(\"New York\", edgesArray[0]);\n\t\t}\n\n\t}", "public boolean containsContextNodes();", "@Override\n public boolean isConnected() { //i got help from the site https://www.geeksforgeeks.org/shortest-path-unweighted-graph/\n if(this.ga.edgeSize()<this.ga.nodeSize()-1) return false;\n initializeInfo();//initialize all the info fields to be null for the algorithm to work\n if(this.ga.nodeSize()==0||this.ga.nodeSize()==1) return true;//if there is not node or one its connected\n WGraph_DS copy = (WGraph_DS) (copy());//create a copy graph that the algorithm will on it\n LinkedList<node_info> qValues = new LinkedList<>();//create linked list that will storage all nodes that we didn't visit yet\n int firstNodeKey = copy.getV().iterator().next().getKey();//first key for get the first node(its doesnt matter which node\n node_info first = copy.getNode(firstNodeKey);//get the node\n qValues.add(first);//without limiting generality taking the last node added to graph\n int counterVisitedNodes = 0;//counter the times we change info of node to \"visited\"\n while (qValues.size() != 0) {\n node_info current = qValues.removeFirst();\n if (current.getInfo() != null) continue;//if we visit we can skip to the next loop because we have already marked\n current.setInfo(\"visited\");//remark the info\n counterVisitedNodes++;\n\n Collection<node_info> listNeighbors = copy.getV(current.getKey());//create a collection for the neighbors list\n LinkedList<node_info> Neighbors = new LinkedList<>(listNeighbors);//create the neighbors list\n if (Neighbors == null) continue;\n for (node_info n : Neighbors) {\n if (n.getInfo() == null) {//if there is a node we didn't visited it yet, we will insert it to the linkedList\n qValues.add(n);\n }\n }\n }\n if (this.ga.nodeSize() != counterVisitedNodes) return false;//check that we visited all of the nodes\n\n return true;\n }", "public static boolean checkCloseSet(Vector<mapNode> closeSet, mapNode tempNode){\n\t\tboolean check = false;\r\n\t\tfor(int i = 0; i < closeSet.size(); i++){\r\n\t\t\tif(closeSet.get(i).gridPosition[0] == tempNode.gridPosition[0] && closeSet.get(i).gridPosition[1] == tempNode.gridPosition[1]){\r\n\t\t\t\tcheck = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn check;\r\n\t}", "public boolean validTree(int n, int[][] edges) {\n int[] nums = new int[n];\r\n Arrays.fill(nums, -1);\r\n\r\n // perform union find\r\n for (int i = 0; i < edges.length; i++) {\r\n int x = find(nums, edges[i][0]);\r\n int y = find(nums, edges[i][1]);\r\n\r\n // if two vertices happen to be in the same set\r\n // then there's a cycle\r\n if (x == y) return false;\r\n\r\n // union\r\n nums[x] = y;\r\n }\r\n\r\n return edges.length == n - 1;\r\n }", "private boolean containState(String state) {\r\n for (int i = 0; i < this.visitedList.size(); i++) {\r\n if (state.equals(this.visitedList.get(i))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }", "public boolean hasNextSet() {\n return (firstIndexOfCurrentSet + increment <= lastIndex);\n }", "public boolean containsNode(VisualNode node) {\r\n\r\n\t\tProbNode probNode = node.getProbNode();\r\n\r\n\t\treturn rectangleSelection.contains(probNode.getNode().getCoordinateX(), \r\n\t\t\t\tprobNode.getNode().getCoordinateY());\r\n\r\n\t}", "boolean intersect(BST<T> t) {\n for (Node x = minimum(t.root); x != null; x = successor(x)) {\n if (x.value.compareTo(search(x.value).value) == 0) return true;\n }\n return false;\n }", "public boolean hasEdge(T begin, T end);", "public static boolean addEdges(Set s, jq_Field f, Node n) {\n boolean b = false;\n for (Iterator i=s.iterator(); i.hasNext(); ) {\n Node a = (Node)i.next();\n if (a.addEdge(f, n))\n b = true;\n }\n return b;\n }", "@Override\n public boolean containsAll(LinkedList linkedlist) {\n Node currNode = linkedlist.head;\n while(currNode.getNextNode() != null){\n if(!this.contains(currNode.getItem())){\n return false;\n }\n currNode = currNode.getNextNode();\n }\n return true;\n }", "public static <N, E extends Edge<N>> boolean isKnot(final Graph<N, E> graph, final Set<N> knotedNodes)\n\t{\n\t\tif( graph instanceof KnotOptimizedGraph )\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn ((KnotOptimizedGraph)graph).isKnot(knotedNodes);\n\t\t\t}\n\t\t\tcatch(UnsupportedOperationException caught)\n\t\t\t{\n\t\t\t\t// if it is not supported, lets handle it as if it was not\n\t\t\t\t// optimized\n\t\t\t}\n\t\t}\n\n\t\t// TODO implement this\n\t\tthrow new UnsupportedOperationException();\n\t}", "public abstract boolean isUsing(Edge graphEdge);", "public boolean coloredRight(Graph graph){\r\n set.clear();\r\n ArrayList<Dot> list = graph.getList();\r\n //Set set = new HashSet();\r\n for(int i=0;i<list.size();i++){\r\n if(list.get(i).coloredAs==null){\r\n return false;\r\n }\r\n ArrayList<Dot> innerList = list.get(i).giveList();\r\n for(int x=0;x<innerList.size();x++){\r\n if(list.get(i).coloredAs.equals(innerList.get(x).coloredAs)){\r\n return false;\r\n }\r\n }\r\n set.add(list.get(i).coloredAs);\r\n }\r\n if(gamemode==1){\r\n return graph.getCNumber()==set.size();\r\n }\r\n return true;\r\n }", "public static boolean isEqualSet(Collection set1, Collection set2) {\n/* 99 */ if (set1 == set2) {\n/* 100 */ return true;\n/* */ }\n/* 102 */ if (set1 == null || set2 == null || set1.size() != set2.size()) {\n/* 103 */ return false;\n/* */ }\n/* */ \n/* 106 */ return set1.containsAll(set2);\n/* */ }", "public abstract boolean isConnected(N n1, N n2);", "public static boolean isVariant(Set<Variant.FromTo> genotypeSet) {\n for (Variant.FromTo ft : genotypeSet) {\n if (!ft.getFrom().equals(ft.getTo())) {\n // at least one of the to do not match the from, so this site has a variant.\n return true;\n }\n }\n return false;\n }" ]
[ "0.6229556", "0.6009475", "0.5976236", "0.5973974", "0.5966141", "0.59520996", "0.59329146", "0.5863353", "0.58109957", "0.5795994", "0.57807595", "0.57537496", "0.5706368", "0.5688438", "0.56625813", "0.56599677", "0.56592506", "0.56503606", "0.5649426", "0.5646024", "0.5632389", "0.5605014", "0.5601971", "0.558771", "0.5579701", "0.55707484", "0.55446595", "0.5521611", "0.5511871", "0.5509645", "0.5504422", "0.5487133", "0.5455785", "0.5452355", "0.542959", "0.54209316", "0.54147446", "0.5407538", "0.539412", "0.5391152", "0.53861487", "0.5374198", "0.5370248", "0.5359717", "0.5352486", "0.53487706", "0.5341842", "0.5341792", "0.5332304", "0.5321273", "0.53160983", "0.530558", "0.530195", "0.52972144", "0.5258524", "0.52564126", "0.52516556", "0.52494013", "0.5244188", "0.5242829", "0.52425885", "0.52358145", "0.52342653", "0.52298194", "0.5228701", "0.5227862", "0.522277", "0.52226055", "0.5222112", "0.5217122", "0.52119654", "0.5201017", "0.5199475", "0.51985365", "0.51833296", "0.5178277", "0.51770353", "0.51682895", "0.51640946", "0.51640946", "0.5158985", "0.5154062", "0.514984", "0.51487595", "0.51411134", "0.514017", "0.51358414", "0.51311314", "0.5130902", "0.5125303", "0.5122045", "0.51186806", "0.51170874", "0.5114224", "0.51104486", "0.5108305", "0.51069665", "0.51058453", "0.51049626", "0.51040226" ]
0.7583605
0
Checks given pag against a set of necessary associations to determine if the pag implies an indepedence where one is known to not exist.
private boolean predictsFalseIndependence(Set<IonIndependenceFacts> associations, Graph pag) { for (IonIndependenceFacts assocFact : associations) for (List<Node> conditioningSet : assocFact.getZ()) if (pag.isDSeparatedFrom( assocFact.getX(), assocFact.getY(), conditioningSet)) return true; return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean isObjectInPAG(Object objElement, InferenceProteinGroup pag) {\n if (objElement instanceof IntermediateProtein) {\n // check whether protein is in the PAG\n if (pag.getProteins().contains(objElement)) {\n return true;\n }\n } else if (objElement instanceof IntermediatePeptide) {\n // check whether peptide is in the PAG\n if (pag.getPeptides().contains(objElement)) {\n return true;\n }\n } else if (objElement instanceof IntermediatePeptideSpectrumMatch) {\n // check whether PSM is in the PAG\n for (IntermediatePeptide pep : pag.getPeptides()) {\n if (pep.getPeptideSpectrumMatches().contains(objElement)) {\n return true;\n }\n }\n } else if (objElement instanceof Collection<?>) {\n // return true, if at least one if the objects in the collection is in the PAG\n for (Object o : ((Collection<?>) objElement)) {\n if (isObjectInPAG(o, pag)) {\n return true;\n }\n }\n }\n \n return false;\n }", "private boolean estPlein() {\n return (nbAssoc == associations.length);\n }", "public boolean contient(Couple assoc) {\n for (int i = 0; i < nbAssoc; i++)\n if (associations[i].equals(assoc))\n return true;\n return false;\n }", "private boolean isAssociated(final KeyValuePair<K, V> association) {\n return indexMap.containsKey(association);\n }", "private boolean existeConceptoPagos(ConcursoPuestoAgr concursoPuestoAgr) {\r\n\t\tString query =\r\n\t\t\t\" SELECT * FROM seleccion.grupo_concepto_pago \" + \" where id_concurso_puesto_agr = \"\r\n\t\t\t\t+ concursoPuestoAgr.getIdConcursoPuestoAgr() + \" and tipo = 'GRUPO' \";\r\n\t\treturn seleccionUtilFormController.existeNative(query);\r\n\t}", "boolean containsAssociation(AssociationEnd association);", "boolean isSetFurtherRelations();", "public boolean isAssociatedToPages(String templateId) throws PSValidationException;", "boolean isOneToMany();", "boolean hasPageNo();", "boolean hasPageNo();", "boolean isInvoiceNotLinkedWithAnyGR(GoodsReceipt invoice) throws ServiceException {\n boolean isNotLinkedWithAnyGR = true;\n\n List invoiceList = accGoodsReceiptobj.isInvoiceNotLinkedWithAnyGR(invoice);//PI->GR\n isNotLinkedWithAnyGR = (boolean) invoiceList.get(0);\n if (isNotLinkedWithAnyGR) {\n if (accGoodsReceiptobj.isLinkingOfGRInPI(invoice)) {//i.e GR->PI linking is available?\n isNotLinkedWithAnyGR=false; \n }\n }\n return isNotLinkedWithAnyGR;\n }", "public boolean isAssocProperty();", "private boolean propriedadesIguais( Integer pro1, Integer pro2 ){\r\n\t if ( pro2 != null ){\r\n\t\t if ( !pro2.equals( pro1 ) ){\r\n\t\t\t return false;\r\n\t\t }\r\n\t } else if ( pro1 != null ){\r\n\t\t return false;\r\n\t }\r\n\t \r\n\t // Se chegou ate aqui quer dizer que as propriedades sao iguais\r\n\t return true;\r\n\t}", "boolean hasPagination();", "boolean hasPagination();", "boolean hasPagination();", "boolean hasPagination();", "boolean hasPagination();", "boolean hasPagination();", "boolean hasInvoice();", "boolean hasRelation();", "boolean hasFkocs();", "default boolean areRelated(Triple... elements) {\n return witnesses(elements).anyMatch(x -> true);\n }", "boolean isAssociative();", "abstract void takeResposibilityForConnectionOfAssociation(com.webobjects.eointerface.EOAssociation association);", "public boolean containsRelations();", "public ResultMap<Association> associations(QName associationTypeQName, Pagination pagination);", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Pagos)) {\n return false;\n }\n Pagos other = (Pagos) object;\n if ((this.idPago == null && other.idPago != null) || (this.idPago != null && !this.idPago.equals(other.idPago))) {\n return false;\n }\n return true;\n }", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Pagares)) {\n return false;\n }\n Pagares other = (Pagares) object;\n if ((this.pagaresPK == null && other.pagaresPK != null) || (this.pagaresPK != null && !this.pagaresPK.equals(other.pagaresPK))) {\n return false;\n }\n return true;\n }", "public ResultMap<Association> associations(Pagination pagination);", "private boolean isAlcoholic(ContentNodeModel m) {\n\t\tfinal ContentNodeModel dept = ContentNodeModelUtil.findDepartment(m);\n\t\tif (dept != null) {\n\t\t\tfinal ContentKey aKey = dept.getContentKey();\n\n\t\t\tif (aKey != null && WineUtil.getWineAssociateId().toLowerCase().equalsIgnoreCase(aKey.getId())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "public boolean containsIncomingRelations();", "public boolean isAssocId();", "private boolean hasLinkToProvincia(Ciudad ciudad) {\n\t\tif(ciudad.getProvinciaid() != null) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean hasPage(String page);", "public static Boolean getAppositivePrs(PairInstance inst) {\n if (inst.getAnaphor().getSentId()!=inst.getAntecedent().getSentId()) \n return false;\n\n// exclude pairs where anaphor is an NE -- this might be a bad idea though..\n if (inst.getAnaphor().isEnamex()) \n return false;\n\n\n if (inst.getAntecedent().isEnamex() &&\n inst.getAnaphor().isEnamex()) {\n\n// exclude pairs of NE that have different type\n\n if (!(inst.getAntecedent().getEnamexType().equals(\n inst.getAnaphor().getEnamexType())))\n return false;\n\n// exclude pairs of LOC-ne\n if (inst.getAntecedent().getEnamexType().toLowerCase().startsWith(\"gpe\"))\n return false;\n if (inst.getAntecedent().getEnamexType().toLowerCase().startsWith(\"loc\"))\n return false;\n }\n\n// should have not-null maxnp-trees (otherwise -- problematic mentions)\n\nTree sentenceTree=inst.getAnaphor().getSentenceTree();\nTree AnaTree=inst.getAnaphor().getMaxNPParseTree();\nTree AnteTree=inst.getAntecedent().getMaxNPParseTree();\nif (sentenceTree==null) return false;\nif (AnaTree==null) return false;\nif (AnteTree==null) return false;\n\n\n// the structure should be ( * (,) (ANA)) or ( * (,) (ANTE)) -- depends on the ordering, annotation, mention extraction etc\n\n if (AnteTree.parent(sentenceTree)==AnaTree) {\n Tree[] chlds=AnaTree.children();\n Boolean lastcomma=false;\n for (int i=0; i<chlds.length && chlds[i]!=AnteTree; i++) {\n lastcomma=false;\n if (chlds[i].value().equalsIgnoreCase(\",\")) lastcomma=true;\n }\n return lastcomma;\n }\n if (AnaTree.parent(sentenceTree)==AnteTree) {\n\n Tree[] chlds=AnteTree.children();\n Boolean lastcomma=false;\n for (int i=0; i<chlds.length && chlds[i]!=AnaTree; i++) {\n lastcomma=false;\n if (chlds[i].value().equalsIgnoreCase(\",\")) lastcomma=true;\n }\n return lastcomma;\n\n }\n\n return false;\n\n }", "public boolean hasPagination() {\n return paginationBuilder_ != null || pagination_ != null;\n }", "public boolean hasPagination() {\n return paginationBuilder_ != null || pagination_ != null;\n }", "public boolean hasPagination() {\n return paginationBuilder_ != null || pagination_ != null;\n }", "public boolean hasPagination() {\n return paginationBuilder_ != null || pagination_ != null;\n }", "public boolean hasPagination() {\n return paginationBuilder_ != null || pagination_ != null;\n }", "public boolean hasPagination() {\n return paginationBuilder_ != null || pagination_ != null;\n }", "boolean isInvoicePartiallyLinkedWithGR(GoodsReceipt invoice) throws ServiceException {\n boolean isNotLinkedWithAnyGR = false;\n boolean isPartiallyLinkedWithGR = false;\n\n List invoiceList = accGoodsReceiptobj.isInvoiceNotLinkedWithAnyGR(invoice);\n isNotLinkedWithAnyGR = (boolean) invoiceList.get(0);\n isPartiallyLinkedWithGR = (boolean) invoiceList.get(1);\n /*--------- Check PI->GR linked Partially-------*/\n if (!isNotLinkedWithAnyGR && invoice.isIsOpenInGR()) {\n isPartiallyLinkedWithGR = true;\n\n } \n /**\n * Commenting below code because of no need check GR-->PI flow in\n * partially case.\n */\n// else {\n// /*------------ Check If GR->PI then in this case PI is linked wih Partial GRN or not?---------*/\n// if (accGoodsReceiptobj.isLinkingOfGRInPI(invoice)) {//i.e GR->PI linking is available?\n// isPartiallyLinkedWithGR = checkGRNtoInvoiceLinkingIsFullOrPartial(invoice, false);//isPartiallyLinkedWithGR->false means linking not like GR->PI but this will like PI->GR \n// }\n// }\n return isPartiallyLinkedWithGR;\n\n }", "boolean hasPage();", "boolean hasPage();", "private void checkMappedByOneToMany(DeployBeanInfo<?> info, DeployBeanPropertyAssocMany<?> prop) {\n if (prop.isElementCollection()) {\n // skip mapping check\n return;\n }\n DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);\n if (targetDesc.isDraftableElement()) {\n // automatically turning on orphan removal and CascadeType.ALL\n prop.setModifyListenMode(BeanCollection.ModifyListenMode.REMOVALS);\n prop.getCascadeInfo().setSaveDelete(true, true);\n }\n\n if (prop.hasOrderColumn()) {\n makeOrderColumn(prop);\n }\n\n if (prop.getMappedBy() == null) {\n // if we are doc store only we are done\n // this allows the use of @OneToMany in @DocStore - Entities\n if (info.getDescriptor().isDocStoreOnly()) {\n prop.setUnidirectional();\n return;\n }\n\n if (!findMappedBy(prop)) {\n if (!prop.isO2mJoinTable()) {\n makeUnidirectional(prop);\n }\n return;\n }\n }\n\n // check that the mappedBy property is valid and read\n // its associated join information if it is available\n String mappedBy = prop.getMappedBy();\n\n // get the mappedBy property\n DeployBeanPropertyAssocOne<?> mappedAssocOne = mappedManyToOne(prop, targetDesc, mappedBy);\n DeployTableJoin tableJoin = prop.getTableJoin();\n if (!tableJoin.hasJoinColumns()) {\n // define Join as the inverse of the mappedBy property\n DeployTableJoin otherTableJoin = mappedAssocOne.getTableJoin();\n otherTableJoin.copyTo(tableJoin, true, tableJoin.getTable());\n }\n\n PropertyForeignKey foreignKey = mappedAssocOne.getForeignKey();\n if (foreignKey != null) {\n ConstraintMode onDelete = foreignKey.getOnDelete();\n switch (onDelete) {\n case SET_DEFAULT:\n case SET_NULL:\n case CASCADE: {\n // turn off cascade delete when we are using the foreign\n // key constraint to cascade the delete or set null\n prop.getCascadeInfo().setDelete(false);\n }\n }\n }\n }", "private boolean canHaveAsDoctor(Doctor doc) {\n\t\treturn !(doc == null || (this.secopDoc != null && this.secopDoc.equals(doc)));\n\t}", "private void checkMappedByManyToMany(DeployBeanPropertyAssocMany<?> prop) {\n // get the bean descriptor that holds the mappedBy property\n String mappedBy = prop.getMappedBy();\n if (mappedBy == null) {\n if (targetDescriptor(prop).isDraftable()) {\n prop.setIntersectionDraftTable();\n }\n return;\n }\n\n // get the mappedBy property\n DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);\n DeployBeanPropertyAssocMany<?> mappedAssocMany = mappedManyToMany(prop, mappedBy, targetDesc);\n\n // define the relationships/joins on this side as the\n // reverse of the other mappedBy side ...\n DeployTableJoin mappedIntJoin = mappedAssocMany.getIntersectionJoin();\n DeployTableJoin mappendInverseJoin = mappedAssocMany.getInverseJoin();\n\n String intTableName = mappedIntJoin.getTable();\n\n DeployTableJoin tableJoin = prop.getTableJoin();\n mappedIntJoin.copyTo(tableJoin, true, targetDesc.getBaseTable());\n\n DeployTableJoin intJoin = new DeployTableJoin();\n mappendInverseJoin.copyTo(intJoin, false, intTableName);\n prop.setIntersectionJoin(intJoin);\n\n DeployTableJoin inverseJoin = new DeployTableJoin();\n mappedIntJoin.copyTo(inverseJoin, false, intTableName);\n prop.setInverseJoin(inverseJoin);\n\n if (targetDesc.isDraftable()) {\n prop.setIntersectionDraftTable();\n }\n }", "boolean hasAccountBudgetProposal();", "private boolean isExistDependentDocumentTrans(String tracingID, Long processInstanceUID, DocTransDAO docTransDAO)\n {\n DocumentTransaction docTrans = docTransDAO.getDocTransByTracingID(tracingID, processInstanceUID);\n _logger.logMessage(\"isExistDependentDocumentTran\", null, \"Dependent doc trans is \"+docTrans);\n return docTrans != null;\n }", "private boolean isAssociationExist(Connection connection, String handle) {\n\n PreparedStatement prepStmt = null;\n ResultSet results = null;\n boolean result = false;\n\n try {\n prepStmt = connection.prepareStatement(OpenIDSQLQueries.CHECK_ASSOCIATION_ENTRY_EXIST);\n prepStmt.setString(1, handle);\n results = prepStmt.executeQuery();\n\n if (results.next()) {\n result = true;\n log.debug(\"Association \" + handle + \" found\");\n }\n\n } catch (SQLException e) {\n log.error(\"Failed to load the association \" + handle + \". Error while accessing the database. \", e);\n } finally {\n IdentityDatabaseUtil.closeResultSet(results);\n IdentityDatabaseUtil.closeStatement(prepStmt);\n }\n log.debug(\"Association \" + handle + \" not found\");\n return result;\n }", "boolean isNilAppointmentsToIgnore();", "private Map<VertexObject, VertexRelation> createProteinsRelationsMap(VertexObject proteinVertex) {\n // first get the PAG of the proteinVertex\n IntermediateProtein protein;\n Object vObject = proteinVertex.getObject();\n if (vObject instanceof Collection) {\n vObject = ((Collection<?>)vObject).iterator().next();\n }\n if (vObject instanceof IntermediateProtein) {\n protein = (IntermediateProtein)vObject;\n } else {\n return null;\n }\n \n InferenceProteinGroup pag = getProteinsPAG(protein);\n Map<VertexObject, VertexRelation> relations = new HashMap<>();\n if (pag != null) {\n for (VertexObject relatedVertex : graph.getVertices()) {\n Object objElement = relatedVertex.getObject();\n boolean done = false;\n \n if (objElement instanceof IntermediateGroup) {\n // groups have no relation\n continue;\n }\n \n // check for same PAG\n if (isObjectInPAG(objElement, pag)) {\n relations.put(relatedVertex, VertexRelation.IN_SAME_PAG);\n continue;\n }\n \n // check for sub-PAG\n for (InferenceProteinGroup subPAG : pag.getSubGroups()) {\n if (isObjectInPAG(objElement, subPAG)) {\n relations.put(relatedVertex, VertexRelation.IN_SUB_PAG);\n done = true;\n }\n \n if (done) {\n break;\n }\n }\n if (!done) {\n VertexRelation highestRelation = VertexRelation.IN_NO_PAG;\n \n // check for super- and parallel-PAG\n for (InferenceProteinGroup mainPAG : piaModeller.getProteinModeller().getInferredProteins()) {\n if (mainPAG.getSubGroups().contains(pag)) {\n // check for super-PAG\n if (isObjectInPAG(objElement, mainPAG)) {\n relations.put(relatedVertex, VertexRelation.IN_SUPER_PAG);\n done = true;\n }\n \n // check for parallel-PAG\n for (InferenceProteinGroup parallelPAG : mainPAG.getSubGroups()) {\n if (isObjectInPAG(objElement, parallelPAG)) {\n highestRelation = VertexRelation.IN_PARALLEL_PAG;\n }\n }\n }\n \n if (done) {\n break;\n }\n \n // record, if it is in any PAG at all\n if (highestRelation.equals(VertexRelation.IN_NO_PAG)) {\n if (isObjectInPAG(objElement, mainPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n for (InferenceProteinGroup subPAG : mainPAG.getSubGroups()) {\n if (isObjectInPAG(objElement, subPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n }\n }\n }\n \n if (!done) {\n relations.put(relatedVertex, highestRelation);\n }\n }\n }\n } else {\n // no PAG for this vertex -> all vertices are either unrelated or in no PAG\n \n for (VertexObject relatedVertex : graph.getVertices()) {\n Object objElement = relatedVertex.getObject();\n VertexRelation highestRelation = VertexRelation.IN_NO_PAG;\n \n for (InferenceProteinGroup mainPAG : piaModeller.getProteinModeller().getInferredProteins()) {\n // check, if it is in any PAG at all\n if (highestRelation.equals(VertexRelation.IN_NO_PAG)) {\n if (isObjectInPAG(objElement, mainPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n for (InferenceProteinGroup subPAG : mainPAG.getSubGroups()) {\n if (isObjectInPAG(objElement, subPAG)) {\n highestRelation = VertexRelation.IN_UNRELATED_PAG;\n }\n }\n } else {\n break;\n }\n }\n \n relations.put(relatedVertex, highestRelation);\n }\n }\n \n return relations;\n }", "private void validarObligaciones(TituloPropiedad pTitulo, Persona pPersonaAnterior, Persona pPersonaNueva) {\n\t\tList<ObligacionRfr> locListaObligacionesParcela = Criterio.getInstance(entityManager, DocHabEspecializadoRfr.class)\n\t\t\t\t.add(Restriccion.IGUAL(\"parcela\", ((TituloPropiedadParcelario) pTitulo).getParcela())).setProyeccion(Proyeccion.PROP(\"obligacion\")).list();\n\t\tif(!locListaObligacionesParcela.isEmpty()) {\n\t\t\t// ID = 0 significa que es una persona temporal, usada en la\n\t\t\t// migración, y no debería generar actualización de deudas,\n\t\t\t// solo cambiar el titular.\n\t\t\t// if (pPersonaAnterior.getIdPersona() == 0) {\n\t\t\tfor(ObligacionRfr cadaObligacion : locListaObligacionesParcela) {\n\t\t\t\tcadaObligacion.setPersona(pPersonaNueva);\n\t\t\t}\n\t\t\t// }\n\t\t}\n\t}", "private void checkForAssociationConstraint()\n {\n try\n {\n String methodName = String.format(\"%sOptions\", name());\n _associationConstraint = _parent.getJavaClass().getMethod(methodName);\n }\n catch (NoSuchMethodException e)\n {\n // ignore\n }\n }", "@Override\n\tpublic boolean okToTraverse(Level3Element ele)\n\t{\n\t\treturn !ubiqueIDs.contains(ele.getUri());\n\t}", "private boolean isExistDependentDocumentTrans(String tracingID, DocTransDAO docTransDAO)\n {\n int docTransCount = docTransDAO.getDocumentTransCount(tracingID);\n _logger.logMessage(\"isExistDependentDocumentTrans\", null, \"Document Trans Count is \"+docTransCount);\n return docTransCount > 0;\n }", "boolean isOrderCertain();", "public boolean hasPendencias() {\n\n for (Atividade atividade : associacao.getAtividades()) {\n if (atividade != null) {\n if (atividade.contaItensPendentes() > 0) {\n return true;\n }\n }\n }\n return false;\n }", "public boolean hasPageNo() {\n return pageNoBuilder_ != null || pageNo_ != null;\n }", "public ResultMap<Association> associations(QName associationTypeQName, Direction direction, Pagination pagination);", "private static <V> boolean profPrimeroCiclos(Graph<V> pGraph, V pInicio, V vertAnterior, Set<V> pConjunto) {\n pConjunto.put(pInicio);\n List<V> adyacencias = pGraph.getAdjacentNodes(pInicio);\n for (int x = 1; x <= adyacencias.size(); x++) {\n V adyacencia = adyacencias.get(x);\n if (!adyacencia.equals(vertAnterior)) {\n if (!pConjunto.isMember(adyacencia)) {\n return profPrimeroCiclos(pGraph, adyacencia, pInicio, pConjunto);\n } else {\n return false;\n }\n }\n }\n return true;\n }", "private InferenceProteinGroup getProteinsPAG(IntermediateProtein protein) {\n List<InferenceProteinGroup> pags = piaModeller.getProteinModeller().getInferredProteins();\n if (pags == null) {\n return null;\n }\n \n for (InferenceProteinGroup pag : piaModeller.getProteinModeller().getInferredProteins()) {\n if (pag.getProteins().contains(protein)) {\n return pag;\n }\n \n for (InferenceProteinGroup subPAG : pag.getSubGroups()) {\n if (subPAG.getProteins().contains(protein)) {\n return subPAG;\n }\n }\n }\n \n return null;\n }", "public boolean isTaxIncluded();", "private boolean pagarMedico(PersMedico medico) throws Exception {\n CuenBancaria cuenta = obtenerCuentaMedico(medico);\n //Obtener atenciones de este mes\n ArrayList<AtencionAgen> atencionesDelMes = obtenerAtencionesDelMes(medico);\n //Obtener pagos de atenciones no devueltas\n ArrayList<Pago> pagos = obtenerPagosNoDevueltos(atencionesDelMes);\n int honorarios = calcularHonorarios(medico, pagos);\n if(honorarios == 0){\n throw new Exception(\"Los honorarios no pueden ser 0\");\n }\n try {\n //aqui deberia ir la llamada a la api del banco\n registrarPagoHonorarios(cuenta, honorarios);\n return true;\n } catch (Exception e) {\n return false;\n }\n }", "boolean hasHadithReferenceNo();", "private boolean isIPTAssociated(List<GroupDetail> groupList,\r\n\t\t\tGroupOwnerModel group) {\r\n\t\tboolean associated = false;\r\n\t\tif(ObjectUtil.isListNotEmpty(groupList)){\r\n\t\t\tfor(GroupDetail gd : groupList){\r\n\t\t\t\tif(gd.getIptID()!=null && gd.getIptID().getIptID().equals(group.getIptID())){\r\n\t\t\t\t\tassociated = wsrdAdminService.wsrdIPTAssociation(gd);\r\n\t\t\t\t\tif(associated){\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn associated;\r\n\t}", "private boolean checkForbiddenObjs(\r\n\t\t\tfinal OrdinaryMorphism nac,\r\n\t\t\tfinal Graph g,\r\n\t\t\tfinal Iterator<?> iter,\r\n\t\t\tfinal List<GraphObject> toCreate) {\r\n\t\t\r\n\t\tboolean found = false;\r\n\t\t\r\n\t\twhile (iter.hasNext()) {\r\n\t\t\tGraphObject elem = (GraphObject) iter.next();\r\n\t\t\tif (!nac.getInverseImage(elem).hasMoreElements()) {\r\n\t\t\t\tType t = elem.getType();\r\n\t\t\t\t// check RHS of rule\r\n\t\t\t\tfor (int i=0; i<toCreate.size(); i++) {\r\n\t\t\t\t\tGraphObject newgo = toCreate.get(i);\r\n\t\t\t\t\tif (elem.isNode()) {\r\n\t\t\t\t\t\tif (t.isParentOf(newgo.getType())) {\r\n\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (t == newgo.getType()\r\n\t\t\t\t\t\t\t\t&& ((Arc)elem).getSource().getType().isParentOf(((Arc)newgo).getSource().getType())\r\n\t\t\t\t\t\t\t\t&& ((Arc)elem).getTarget().getType().isParentOf(((Arc)newgo).getTarget().getType())) {\r\n\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (!found) {\r\n\t\t\t\t\t// check graph\r\n\t\t\t\t\tHashtable<String, HashSet<GraphObject>> \r\n\t\t\t\t\ttype2objects = g.getTypeObjectsMap();\r\n\t\t\t\t\tif (elem.isNode()) {\r\n\t\t\t\t\t\tString key = elem.convertToKey();\r\n\t\t\t\t\t\tif (type2objects.get(key) != null\r\n\t\t\t\t\t\t\t\t&& !type2objects.get(key).isEmpty()) {\r\n\t\t\t\t\t\t\tfound = true;\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tString key = ((Arc) elem).convertToKey();\r\n\t\t\t\t\t\tif (type2objects.get(key) != null\r\n\t\t\t\t\t\t\t\t&& !type2objects.get(key).isEmpty()) {\r\n\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t}\t\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t}\r\n\t\t}\t\t\r\n\t\treturn found;\r\n\t}", "private boolean polysegIntPoly( Coordinate[] seg, Coordinate[] poly ) {\n\t\t\n\t\tboolean qualify = true;\n\t\t\n\t\t//Disqualify if the segment's two end points are adjacent on the polygon.\n\t\tList<Coordinate> polyList = Arrays.asList( poly );\n\t\tint index1 = polyList.indexOf( seg[0] );\n\t\tint index2 = polyList.indexOf( seg[1] );\n\t\tint igap = Math.abs(index2 - index1 );\n\t\t\n\t\tif ( igap == 1 || igap == ( (poly.length) - 1 ) ) {\n\t\t\tqualify = false;\n\t\t}\n\t\telse {\t\t\t\t\t\t\t\n\t\t\tqualify = segIntPoly( seg, poly );\n\t\t}\n\t\t\n\t\treturn qualify;\n\t}", "boolean hasAdvertisingPartner();", "private boolean check_only_call_relatives(Element element){\n\t\tArrayList<Element> relatives = new ArrayList<Element>();\n\t\tfor(Element elem_called : element.getRefFromThis()){\n\t\t\t//if they are brothers\n\t\t\tif(element.getParentName() != null && elem_called.getParentName() != null && element.getParentName().equals(elem_called.getParentName())){\n\t\t\t\trelatives.add(elem_called);\n\t\t\t}\n\t\t\t//if they are son - father\n\t\t\tif(element.getParentName() != null && element.getParentName().equals(elem_called.getIdentifier())){\n\t\t\t\trelatives.add(elem_called);\n\t\t\t}\t\t\t\n\t\t}\n\t\tif (relatives.size() == element.getRefFromThis().size()){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean isExcluded(Individual ind);", "boolean hasHasInstitutionHomePage();", "private boolean isPaginationAndSortNotUsed( HttpServletRequest request )\n {\n return request.getParameter( PARAMETER_PAGE_INDEX ) == null && request.getParameter( FormsConstants.PARAMETER_SORT_COLUMN_POSITION ) == null;\n }", "public boolean hasExam(int period, ExExam exclude) {\n return (iTable[period]!=null && !iTable[period].variable().equals(exclude));\n }", "private boolean iguales(Pares f){\n\t\t\tboolean devolucion = false;\n\t\t\t\n\t\t\tif(f!=null){\n\t\t\t\tif(primero.iguales(f.getSegundo())){\n\t\t\t\t\tif(segundo.iguales(f.getPrimero())){\n\t\t\t\t\t\tif(distancia==f.getDistancia()){\n\t\t\t\t\t\t\tdevolucion=true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\treturn devolucion;\n\t\t}", "public boolean isExplicitForeignCheckRequired();", "public boolean hasExam(int period) {\n return (iTable[period]!=null);\n }", "private void printAssocations(List<AssetAssociationDef> associations) {\n\n }", "public boolean hasPagination() {\n return pagination_ != null;\n }", "public boolean hasPagination() {\n return pagination_ != null;\n }", "public boolean hasPagination() {\n return pagination_ != null;\n }", "public boolean hasPagination() {\n return pagination_ != null;\n }", "public boolean hasPagination() {\n return pagination_ != null;\n }", "public boolean hasPagination() {\n return pagination_ != null;\n }", "private boolean hasConfigurationType1(Graph<V, E> g)\n {\n for (V v1 : g.vertexSet()) {\n Set<V> temp = new ConnectivityInspector<>(g).connectedSetOf(v1);\n for (V v2 : temp) {\n if (v1 == v2 || !g.containsEdge(v1, v2))\n continue;\n for (V v3 : temp) {\n if (v3 == v1 || v3 == v2 || !g.containsEdge(v2, v3) || g.containsEdge(v1, v3))\n continue;\n for (V v4 : temp) {\n if (v4 == v1 || v4 == v2 || v4 == v3 || g.containsEdge(v1, v4)\n || g.containsEdge(v2, v4) || !g.containsEdge(v3, v4))\n continue;\n for (V v5 : temp) {\n if (v5 == v1 || v5 == v2 || v5 == v3 || v5 == v4\n || g.containsEdge(v2, v5) || g.containsEdge(v3, v5)\n || !g.containsEdge(v1, v5) || !g.containsEdge(v4, v5))\n continue;\n if (certify) {\n List<E> edgeList = new LinkedList<>();\n edgeList.add(g.getEdge(v1, v2));\n edgeList.add(g.getEdge(v2, v3));\n edgeList.add(g.getEdge(v3, v4));\n edgeList.add(g.getEdge(v4, v5));\n edgeList.add(g.getEdge(v5, v1));\n\n double weight =\n edgeList.stream().mapToDouble(g::getEdgeWeight).sum();\n certificate = new GraphWalk<>(g, v1, v1, edgeList, weight);\n }\n return true;\n }\n }\n }\n }\n }\n\n return false;\n }", "void findWithPagination(Pagination<Activity, Assignment> pagination);", "public void disabledtestAssociation2Fragments() {\n\t\tString ID1 = \"iu.1\";\n\t\tString IDF1 = \"iu.fragment.1\";\n\t\tString IDF2 = \"iu.fragment.2\";\n\t\tIInstallableUnit iu1 = createEclipseIU(ID1);\n\t\tIInstallableUnit iuf1 = createBundleFragment(IDF1);\n\t\tIInstallableUnit iuf2 = createBundleFragment(IDF2);\n\t\tProfileChangeRequest req = new ProfileChangeRequest(createProfile(getName()));\n\t\treq.addInstallableUnits(iu1, iuf1, iuf2);\n\t\tcreateTestMetdataRepository(new IInstallableUnit[] {iu1, iuf1});\n\t\tIQueryable<IInstallableUnit> additions = createPlanner().getProvisioningPlan(req, null, null).getAdditions();\n\t\t{\n\t\t\tIterator<IInstallableUnit> iterator = additions.query(QueryUtil.createIUQuery(ID1), null).iterator();\n\t\t\tassertTrue(\"Solution contains IU \" + ID1, iterator.hasNext());\n\t\t\tIInstallableUnit iu = iterator.next();\n\t\t\tassertEquals(\"Number of attached fragments to IU \" + ID1, 2, iu.getFragments().size());\n\t\t}\n\t}", "public boolean isSetIntersectRoadwayPI()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n return get_store().find_attribute_user(INTERSECTROADWAYPI$22) != null;\r\n }\r\n }", "private void markDuplicateRelationships(EntityInstanceImpl ei)\n {\n EntityInstanceImpl parent = ei.getParent();\n EntityDef entityDef = ei.getEntityDef();\n\n // Duplicate relationship searching phase I, see if a linked instance to\n // the target instance in the same object instance represents the\n // same relationship type AND has the same parent.\n for ( EntityInstanceImpl linked : ei.getLinkedInstances() )\n {\n // Check to make sure linked EI has a parent--it is possible for a root\n // to be flagged as included and we don't care about roots.\n if ( linked.isDeleted() || linked.getParent() == null )\n continue;\n\n if ( ei.isExcluded() )\n {\n if ( ! linked.isExcluded() )\n continue;\n }\n else\n {\n if ( ! linked.isIncluded() )\n continue;\n }\n\n EntityDef linkedEntityDef = linked.getEntityDef();\n\n // Linked EI must have the same relationship and it can't be derived.\n if ( linkedEntityDef.getErRelToken() == entityDef.getErRelToken() ||\n linkedEntityDef.isDerivedPath() )\n {\n continue;\n }\n\n // Now check to see if the parents are linked.\n EntityInstanceImpl linkParent = linked.getParent();\n for ( EntityInstanceImpl parentLinked : linkParent.getLinkedInstances() )\n {\n if ( parentLinked == parent )\n {\n if ( ei.isExcluded() )\n linked.dbhExcluded = true;\n else\n linked.dbhIncluded = true;\n\n break;\n }\n }\n } // for each linked instance...\n\n // Duplicate relationship searching, phase II, see if the parent of\n // the instance has a linked instance representing the same relationship\n // type which is also a child of one of the targets linked instances.\n\n // If the parent isn't linked then there are no duplicate relationships.\n if ( parent.getLinkedInstances().size() == 0 )\n return;\n\n for ( EntityInstanceImpl linked : parent.getLinkedInstances() )\n {\n // Check for appropriate include/exclude flag.\n if ( ei.isExcluded() )\n {\n if ( ! linked.isExcluded() )\n continue;\n }\n else\n {\n if ( ! linked.isIncluded() )\n continue;\n }\n\n EntityDef linkedEntityDef = linked.getEntityDef();\n\n // Check to see if the relationship for the EI linked to the parent is\n // the same as the relationship of the original EI.\n if ( linkedEntityDef.getErRelToken() != entityDef.getErRelToken() )\n continue; // Nope.\n\n // OK, we have an EI ('linked') that has the same relationship as\n // ei. Check to see if the parent of 'linked' (grandParent)\n // is linked with ei. If they are linked then 'linked'\n // has the same physical relationship as ei.\n EntityInstanceImpl grandParent = linked.getParent();\n for ( EntityInstanceImpl gp : ei.getLinkedInstances() )\n {\n if ( gp == grandParent )\n {\n if ( ei.isExcluded() )\n linked.dbhExcluded = true;\n else\n linked.dbhIncluded = true;\n\n break;\n }\n }\n } // for each linked instance of parent...\n }", "private int isPrivacyModelFulfilled(Transformation<?> transformation, HashGroupifyEntry entry) {\n \n // Check minimal group size\n if (minimalClassSize != Integer.MAX_VALUE && entry.count < minimalClassSize) {\n return 0;\n }\n \n // Check other criteria\n // Note: The d-presence criterion must be checked first to ensure correct handling of d-presence with tuple suppression.\n // This is currently ensured by convention. See ARXConfiguration.getCriteriaAsArray();\n for (int i = 0; i < classBasedCriteria.length; i++) {\n if (!classBasedCriteria[i].isAnonymous(transformation, entry)) {\n return i + 1;\n }\n }\n return -1;\n }", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Pages)) {\n return false;\n }\n Pages other = (Pages) object;\n if ((this.pageId == null && other.pageId != null) || (this.pageId != null && !this.pageId.equals(other.pageId))) {\n return false;\n }\n return true;\n }", "static boolean allInAreaHuh ( AddressBookEntry ae, int someArea ) {\n\t/*\n\treturn ... ae.home ... ae.office ... ae.cell ... someArea ;\n\treturn ... inAreaHuh( ... ae.home ...) ... inAreaHuh( ... ae.office ...) ... inAreaHuh( ... ae.cell ...) ... someArea ;\n\treturn ... inAreaHuh( ae.home, someArea ) ... inAreaHuh( ae.office, someArea ) ... inAreaHuh( ae.cell, someArea ) ... someArea ;\n\t*/\n\treturn inAreaHuh( ae.home, someArea ) \n\t && inAreaHuh( ae.office, someArea ) \n\t && inAreaHuh( ae.cell, someArea );\t\n }", "@Test\n public void getViajerosTest() {\n List<ViajeroEntity> list = vp.findAll();\n Assert.assertEquals(data.size(), list.size());\n for (ViajeroEntity ent : list) {\n boolean found = false;\n for (ViajeroEntity entity : data) {\n if (ent.getId().equals(entity.getId())) {\n found = true;\n }\n }\n Assert.assertTrue(found);\n }\n }", "private boolean isPageLoaded(List<By> vps) {\n\t\ttry {\n\t\t\tfor (By point : vps) {\n\t\t\t\tif(!webDriver.findElement(point).isDisplayed()) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If all verification points are found, we are on the correct page.\n\t\t\treturn true;\n\t\t} catch (NoSuchElementException noSuchElementException) {\n\t\t\tlog.debug(NO_SUCH_ELEMENT, noSuchElementException);\n\t\t\treturn false;\n\t\t} catch (NullPointerException noPointerException) {\n\t\t\tlog.debug(NULL_WEB_ELEMENT, noPointerException);\n\t\t\treturn false;\n\t\t} catch (ElementNotVisibleException notVisibleException) {\n\t\t\tlog.debug(NOT_VISIBLE, notVisibleException);\n\t\t\treturn false;\n\t\t}\n\t}", "public boolean checkDiary() {\n if (this.activities.size() % 2 == 0) return false; //we have to end with an stay! so the number must be odd!\n for (int i = 0; i < this.activities.size(); i++) {\n if (((i % 2) == 0 && !this.activities.get(i).stay) || //even and not a stay: bad!\n ((i % 2) == 1 && this.activities.get(i).stay) // odd and not a trip: bad!\n ) {\n return false;\n }\n if (this.activities.get(i).getDurtation() <= 0) {\n if (this.activities.get(i).start_min == 0 && this.activities.get(i).end_min == 0)\n continue;//starts at midnight are ok!\n System.out.println(\"Error in diary!\");\n this.activities.get(i).printElement();\n return false;\n }\n }\n //now check if the first and last stays are home\n return this.activities.size() > 0 && this.activities.get(0).home && this.activities.get(\n this.activities.size() - 1).home;\n }", "boolean condition(PetriP[] pp) { //Нумерація позицій тут відносна!!! inP.get(i) - номер позиції у списку позицій, який побудований при конструюванні мережі Петрі,\n\n boolean a = true;\n boolean b = true; // Саме тому при з\"єднанні спільних позицій зміна номера не призводить до трагічних наслідків (руйнування зв\"язків)!!!\n for (int i = 0; i < inP.size(); i++) {\n if (pp[inP.get(i)].getMark() < quantIn.get(i)) {\n a = false;\n break;\n }\n }\n for (int i = 0; i < inPwithInf.size(); i++) {\n if (pp[inPwithInf.get(i)].getMark() < quantInwithInf.get(i)) {\n b = false;\n break;\n }\n }\n return a && b;\n }", "@Override\n public boolean equals(Object ap){\n if(!(ap instanceof AssistantProfessor)){\n return false;\n }\n AssistantProfessor c = (AssistantProfessor)ap;\n if(m_yearsUntilTenure != c.m_yearsUntilTenure){\n return false;\n }\n return true;\n }", "boolean hasRoutingAppID();" ]
[ "0.6254162", "0.57818377", "0.5611908", "0.55128855", "0.5490838", "0.5271116", "0.52526104", "0.523539", "0.52246565", "0.5132399", "0.5132399", "0.50977343", "0.50625396", "0.50326025", "0.49253184", "0.49253184", "0.49253184", "0.49253184", "0.49253184", "0.49253184", "0.49131393", "0.49119538", "0.48865524", "0.48812383", "0.48728636", "0.48650262", "0.4829911", "0.4757599", "0.47287095", "0.47210726", "0.4719297", "0.47176534", "0.4673754", "0.46713048", "0.46696043", "0.46676227", "0.4660361", "0.4644616", "0.4644616", "0.4644616", "0.4644616", "0.4644616", "0.4644616", "0.4639119", "0.4631333", "0.4631333", "0.46232975", "0.4620819", "0.46062255", "0.4599458", "0.45964792", "0.45951065", "0.45892382", "0.45857427", "0.45718968", "0.45697784", "0.45668012", "0.45633003", "0.4562893", "0.45622692", "0.45456213", "0.45334825", "0.45305443", "0.45301893", "0.44934", "0.44920307", "0.44852525", "0.44850522", "0.4482245", "0.4479915", "0.4479118", "0.447847", "0.44718343", "0.44702733", "0.4470041", "0.44660342", "0.44610962", "0.44562948", "0.44461614", "0.44437385", "0.44353512", "0.44353512", "0.44353512", "0.44353512", "0.44353512", "0.44353512", "0.44247013", "0.44225618", "0.44193688", "0.44172704", "0.44042143", "0.4396936", "0.43717012", "0.4368251", "0.43654376", "0.4360445", "0.4351876", "0.43510905", "0.43505278", "0.4348786" ]
0.6606197
0
Given a map between sets of conditioned on variables and lists of PossibleDConnectingPaths, finds all the possible GraphChanges which could be used to block said undirectedPaths
private List<Set<GraphChange>> findChanges(Map<Collection<Node>, List<PossibleDConnectingPath>> paths) { List<Set<GraphChange>> pagChanges = new ArrayList<>(); Set<Map.Entry<Collection<Node>, List<PossibleDConnectingPath>>> entries = paths.entrySet(); /* Loop through each entry, ie each conditioned set of variables. */ for (Map.Entry<Collection<Node>, List<PossibleDConnectingPath>> entry : entries) { Collection<Node> conditions = entry.getKey(); List<PossibleDConnectingPath> dConnecting = entry.getValue(); /* loop through each path */ for (PossibleDConnectingPath possible : dConnecting) { List<Node> possPath = possible.getPath(); /* Created with 2*# of undirectedPaths as appoximation. might have to increase size once */ Set<GraphChange> pathChanges = new HashSet<>(2 * possPath.size()); /* find those conditions which are not along the path (used in colider) */ List<Node> outsidePath = new ArrayList<>(conditions.size()); for (Node condition : conditions) { if (!possPath.contains(condition)) outsidePath.add(condition); } /* Walk through path, node by node */ for (int i = 0; i < possPath.size() - 1; i++) { Node current = possPath.get(i); Node next = possPath.get(i + 1); GraphChange gc; /* for each pair of nodes, add the operation to remove their edge */ gc = new GraphChange(); gc.addRemove(possible.getPag().getEdge(current, next)); pathChanges.add(gc); /* for each triple centered on a node which is an element of the conditioning * set, add the operation to orient as a nonColider around that node */ if (conditions.contains(current) && i > 0) { gc = new GraphChange(); Triple nonColider = new Triple(possPath.get(i - 1), current, next); gc.addNonCollider(nonColider); pathChanges.add(gc); } /* for each node on the path not in the conditioning set, make a colider. It * is necessary though to ensure that there are no undirectedPaths implying that a * conditioned variable (even outside the path) is a decendant of a colider */ if ((!conditions.contains(current)) && i > 0) { Triple colider = new Triple(possPath.get(i - 1), current, next); if (possible.getPag().isUnderlineTriple(possPath.get(i - 1), current, next)) continue; Edge edge1 = possible.getPag().getEdge(colider.getX(), colider.getY()); Edge edge2 = possible.getPag().getEdge(colider.getZ(), colider.getY()); if (edge1.getNode1().equals(colider.getY())) { if (edge1.getEndpoint1().equals(Endpoint.TAIL)) { continue; } } else if (edge1.getNode2().equals(colider.getY())) { if (edge1.getEndpoint2().equals(Endpoint.TAIL)) { continue; } } if (edge2.getNode1().equals(colider.getY())) { if (edge2.getEndpoint1().equals(Endpoint.TAIL)) { continue; } } else if (edge2.getNode2().equals(colider.getY())) { if (edge2.getEndpoint2().equals(Endpoint.TAIL)) { continue; } } /* Simple case, no conditions outside the path, so just add colider */ if (outsidePath.size() == 0) { gc = new GraphChange(); gc.addCollider(colider); pathChanges.add(gc); continue; } /* ensure nondecendency in possible path between getModel and each conditioned * variable outside the path */ for (Node outside : outsidePath) { /* list of possible decendant undirectedPaths */ List<PossibleDConnectingPath> decendantPaths = new ArrayList<>(); decendantPaths = PossibleDConnectingPath.findDConnectingPaths (possible.getPag(), current, outside, new ArrayList<Node>()); if (decendantPaths.isEmpty()) { gc = new GraphChange(); gc.addCollider(colider); pathChanges.add(gc); continue; } /* loop over each possible path which might indicate decendency */ for (PossibleDConnectingPath decendantPDCPath : decendantPaths) { List<Node> decendantPath = decendantPDCPath.getPath(); /* walk down path checking orientation (path may already * imply non-decendency) and creating changes if need be*/ boolean impliesDecendant = true; Set<GraphChange> colideChanges = new HashSet<>(); for (int j = 0; j < decendantPath.size() - 1; j++) { Node from = decendantPath.get(j); // chaneges from +1 Node to = decendantPath.get(j + 1); Edge currentEdge = possible.getPag().getEdge(from, to); if (currentEdge.getEndpoint1().equals(Endpoint.ARROW)) { impliesDecendant = false; break; } gc = new GraphChange(); gc.addCollider(colider); gc.addRemove(currentEdge); colideChanges.add(gc); gc = new GraphChange(); gc.addCollider(colider); gc.addOrient(to, from); colideChanges.add(gc); } if (impliesDecendant) pathChanges.addAll(colideChanges); } } } } pagChanges.add(pathChanges); } } return pagChanges; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n public Set<List<String>> findAllPaths(int sourceId, int targetId, int reachability) {\r\n //all paths found\r\n Set<List<String>> allPaths = new HashSet<List<String>>();\r\n //collects path in one iteration\r\n Set<List<String>> newPathsCollector = new HashSet<List<String>>();\r\n //same as the solution but with inverted edges\r\n Set<List<String>> tmpPathsToTarget = new HashSet<List<String>>();\r\n //final solution\r\n Set<List<String>> pathsToTarget = new HashSet<List<String>>();\r\n \r\n String[] statementTokens = null; \r\n Set<Integer> allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n List<String> statementsFound = new ArrayList<String>();\r\n \r\n for (int i = 0; i < reachability; i++) {\r\n if (i == 0) { \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(sourceId);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n //allProcessedNodes.add(inNodeId); \r\n //Incoming nodes are reversed\r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n allPaths.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(sourceId);\r\n \r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n statementsFound.add(outEdge);\r\n allPaths.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n } else {\r\n newPathsCollector = new HashSet<List<String>>();\r\n\r\n for (List<String> statements: allPaths) {\r\n allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n int lastNodeInPath = 0;\r\n \r\n for (String predicate: statements) {\r\n if (predicate.contains(\">-\")) {\r\n statementTokens = predicate.split(\">-\");\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[0]).reverse().toString()));\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString()));\r\n lastNodeInPath = Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString());\r\n } else {\r\n statementTokens = predicate.split(\"->\"); \r\n allProcessedNodes.add(Integer.parseInt(statementTokens[0]));\r\n allProcessedNodes.add(Integer.parseInt(statementTokens[2]));\r\n lastNodeInPath = Integer.parseInt(statementTokens[2]);\r\n }\r\n }\r\n \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(lastNodeInPath);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n if (allProcessedNodes.contains(inNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n newPathsCollector.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(lastNodeInPath);\r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n if (allProcessedNodes.contains(outNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(outEdge);\r\n newPathsCollector.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n }\r\n allPaths.addAll(newPathsCollector);\r\n }\r\n \r\n //System.out.println(\"*****End of iteration \" + i);\r\n //System.out.println(\"#SIZE OF allPaths: \" + allPaths.size());\r\n int numItems = 0;\r\n for (List<String> currList: allPaths) {\r\n numItems = numItems + currList.size();\r\n }\r\n //System.out.println(\"#NUMBER OF ELEMS OF ALL LISTS: \" + numItems);\r\n //System.out.println(\"#SIZE OF tmpPathsToTarget : \" + tmpPathsToTarget.size());\r\n }\r\n \r\n //We need to reverse back all the predicates\r\n for (List<String> statements: tmpPathsToTarget) { \r\n List<String> fixedStatements = new ArrayList<String>(); \r\n for (int i = 0; i < statements.size(); i++) { \r\n String statement = statements.get(i); \r\n if (statement.contains(\">-\")) {\r\n fixedStatements.add(new StringBuilder(statement).reverse().toString());\r\n } else {\r\n fixedStatements.add(statement);\r\n } \r\n }\r\n pathsToTarget.add(fixedStatements);\r\n }\r\n return pathsToTarget;\r\n }", "private void adjustPathConditions() {\n List<ProgramCondition> pcList;\n for (ProgramPath pp : progPath){\n pcList = pp.getConditions();\n final List<ProgramCondition> pcList2 = pcList;\n List<ProgramCondition> collect = pcList2.stream().filter(p -> (pcList2.stream().anyMatch(q -> q.condition.equals(p.condition) \n && q.pred == ProgramConditionTruthValue.False && p.pred == ProgramConditionTruthValue.True))).collect(Collectors.toList());\n \n collect.forEach(p -> p.z3Allowable = false);\n }\n }", "@Test\n void findCycle() {\n Map<String, Set<String>> nonCyclicGraph = Map.of(\n \"0\", Set.of(\"a\", \"b\", \"c\"),\n \"a\", Set.of(\"0\", \"a2\", \"a3\"),\n \"a2\", Set.of(\"a\"),\n \"a3\", Set.of(\"a\"),\n \"b\", Set.of(\"0\", \"b2\"),\n \"b2\", Set.of(\"b\"),\n \"c\", Set.of(\"0\")\n );\n assertThat(solution.findCycle(nonCyclicGraph)).isFalse();\n\n // 0\n // / | \\\n // a b c\n // /\\ | /\n // a2 a3 b2\n Map<String, Set<String>> cyclicGraph = Map.of(\n \"0\", Set.of(\"a\", \"b\", \"c\"),\n \"a\", Set.of(\"0\", \"a2\", \"a3\"),\n \"a2\", Set.of(\"a\"),\n \"a3\", Set.of(\"a\"),\n \"b\", Set.of(\"0\", \"b2\"),\n \"b2\", Set.of(\"b\"),\n \"c\", Set.of(\"0\", \"b2\")\n );\n assertThat(solution.findCycle(cyclicGraph)).isTrue();\n }", "public static <T> Set<List<T>> findSimpleCycles(Map<T, Set<T>> graph) {\n if (graph == null) {\n return null;\n }\n Set<List<T>> result = new HashSet<>();\n Set<T> vertices = new HashSet<>(graph.keySet());\n while (!graph.isEmpty()) {\n Set<Set<T>> components = findStronglyConnectedComponents(graph);\n Set<T> maxComponent = null;\n for (Set<T> component : components) {\n if (component.size() < 2) {\n if (isSelfCycle(graph, component)) {\n result.add(new ArrayList<>(component));\n }\n vertices.removeAll(component);\n } else if ((maxComponent == null) || (component.size() > maxComponent.size())) {\n maxComponent = component;\n }\n }\n if (maxComponent != null) {\n Map<T, Set<T>> subgraph = project(graph, maxComponent);\n T startVertex = maxComponent.iterator().next();\n result.addAll(findSimpleCycles(subgraph, startVertex));\n vertices.remove(startVertex);\n }\n graph = project(graph, vertices);\n }\n return result;\n }", "List<List<Node>> findUndirectedPaths(Node s, Node d) {\n\t\tList<List<Node>> paths = new ArrayList<>();\n\t\tpath(s, d, new HashSet<>(), new ArrayList<>(), paths);\n System.out.println(\"Computed paths: \" + paths);\n return paths;\n\t}", "@Test\n public void notConnectedDueToRestrictions() {\n int sourceNorth = graph.edge(0, 1).setDistance(1).set(speedEnc, 10, 10).getEdge();\n int sourceSouth = graph.edge(0, 3).setDistance(2).set(speedEnc, 10, 10).getEdge();\n int targetNorth = graph.edge(1, 2).setDistance(3).set(speedEnc, 10, 10).getEdge();\n int targetSouth = graph.edge(3, 2).setDistance(4).set(speedEnc, 10, 10).getEdge();\n\n assertPath(calcPath(0, 2, sourceNorth, targetNorth), 0.4, 4, 400, nodes(0, 1, 2));\n assertNotFound(calcPath(0, 2, sourceNorth, targetSouth));\n assertNotFound(calcPath(0, 2, sourceSouth, targetNorth));\n assertPath(calcPath(0, 2, sourceSouth, targetSouth), 0.6, 6, 600, nodes(0, 3, 2));\n }", "public void refineDTPmatchVars(HashMap<String, List<String>> mapCandVarToMatchedVals,\n HashMap<String, List<String>> mapCandVarToAllAnsMaps, int indxCTP, int srcGraph) {\n\n List<String> valueskeyOuter = null;\n List<String> valuesCandAnswMapOuter = null;\n List<String> newDedTP = null;\n List<String> cloneTP = null;\n List<String> originalTP = myDedUtils.getCleanTP(DTPCandidates.get(indxCTP));\n List<String> allCTPVals = myDedUtils.getValuesFromCTP(indxCTP);\n HashMap<List<String>, Integer> mapMatchedConstant = new HashMap<>();\n String originalVar = myDedUtils.getOriginalVar(DTPCandidates.get(indxCTP));\n\n //Init each CTP value as \"non-mathced\"\n for (int i = 0; i < allCTPVals.size(); i++) {\n\n List<String> srcTPofCTP = myDedUtils.getNewRawTP(DTPCandidates.get(indxCTP), allCTPVals.get(i));\n mapMatchedConstant.put(srcTPofCTP, -1);\n }\n\n //For all confirmed variables, \n for (String keyOuter : mapCandVarToMatchedVals.keySet()) {\n\n String cleanVariable = \"?\" + keyOuter.substring(0, keyOuter.indexOf(\"_\"));\n newDedTP = myDedUtils.getNewRawTP(DTPCandidates.get(indxCTP), cleanVariable);\n valueskeyOuter = mapCandVarToMatchedVals.get(keyOuter);\n valuesCandAnswMapOuter = mapCandVarToAllAnsMaps.get(keyOuter);\n List<String> tmpTP = myDedUtils.getCleanTP(newDedTP);\n\n //match each source TP to its corresponding DTPs, matching vars and marked as \"matched\"\n for (int i = 0; i < valuesCandAnswMapOuter.size(); i++) {\n\n List<String> rawTP = myDedUtils.getNewRawTP(originalTP, valuesCandAnswMapOuter.get(i));\n setEGasNLEG(rawTP, newDedTP);\n\n if (mapMatchedConstant.get(rawTP) != null) {\n mapMatchedConstant.put(rawTP, 1);\n }\n }\n\n //Finally, match a confirmed DTP to source values and answers\n for (int i = 0; i < valueskeyOuter.size(); i++) {\n\n List<String> rawTP = myDedUtils.getNewRawTP(originalTP, valueskeyOuter.get(i));\n\n if (mapMatchedConstant.get(rawTP) != null) {\n mapMatchedConstant.put(rawTP, 1);\n }\n\n if (newDedTP.size() == 3) {\n\n cloneTP = new LinkedList<>(newDedTP.subList(0, newDedTP.size()));\n cloneTP.add(originalVar);\n\n if (mapCTPtoAnswTotal.get(rawTP) != null) {\n\n myBasUtils.insertToMap3(mapCTPtoAnswTotal, mapCTPtoAnswTotal.get(rawTP), cloneTP);\n }\n }\n\n }\n\n myDedUtils.setDTPHashInfo(newDedTP, indxCTP);\n\n if (mapCTPtoQuerySrc.get(DTPCandidates.get(indxCTP)) != null) {\n // System.out.println(mapDTPToDeducedID.get(newDedTP));\n myBasUtils.insertToMap2(mapDTPtoInnerQuery, mapCTPtoQuerySrc.get(DTPCandidates.get(indxCTP)), mapDTPToDeducedID.get(newDedTP));\n }\n\n tmpTP.add(cleanVariable);\n myBasUtils.insertToMap4(mapDTPtoAnsInverseMap, tmpTP, valuesCandAnswMapOuter);\n myBasUtils.insertToMap4(mapDTPtoAnswTotal, tmpTP, valuesCandAnswMapOuter);\n flagSTOPNONPROJECTEDvars = myDedUtils.setDTPtoSrcAns(indxCTP, valueskeyOuter, newDedTP, flagSTOPNONPROJECTEDvars);\n }\n\n //For confirmed vars, identify all alternative DTPs\n //which do not count as deduced joins\n myDedUtils.setDTPtoAlternatives(mapCandVarToMatchedVals, indxCTP);\n\n //For CTP values that are not matched them finally to a variable\n for (List<String> raw : mapMatchedConstant.keySet()) {\n\n int val = mapMatchedConstant.get(raw);\n\n if (val == -1) {\n\n for (String keyOuter : mapCandVarToMatchedVals.keySet()) {\n\n String cleanVariable = \"?\" + keyOuter.substring(0, keyOuter.indexOf(\"_\"));\n newDedTP = myDedUtils.getNewRawTP(DTPCandidates.get(indxCTP), cleanVariable);\n mapMatchedConstant.put(raw, 1);\n }\n\n }\n }\n\n }", "public List<List<Integer>> allPathsSourceTarget(int[][] graph) {\n \n boolean[] visited = new boolean[graph.length];\n \n List<Integer> paths = new ArrayList();\n paths.add(0);\n \n List<List<Integer>> allPaths = new ArrayList();\n \n dfs(0,graph.length-1, paths,allPaths,visited,graph);\n \n return allPaths;\n }", "private List<ActionCallConfig> getInTopologicalOrder(IdentityHashMap<ActionCallConfig, Set<ActionCallConfig>> dependencyGraph) throws CyclicDataDependencyException {\n\n //make the order deterministic to get deterministic error messages, e.g. in case of multiple dependency cycles\n List<Pair<ActionCallConfig, List<ActionCallConfig>>> sortedDependencyGraph = sortDependencyGraph(dependencyGraph);\n IdentityHashMap<ActionCallConfig, List<ActionCallConfig>> sortedLookup = new IdentityHashMap<>();\n sortedDependencyGraph.forEach(p -> sortedLookup.put(p.getLeft(), p.getRight()));\n\n LinkedHashSet<Equivalence.Wrapper<ActionCallConfig>> result = new LinkedHashSet<>();\n\n for (Pair<ActionCallConfig, List<ActionCallConfig>> callWithDependencies : sortedDependencyGraph) {\n putInTopologicalOrder(result, callWithDependencies.getLeft(), sortedLookup, new LinkedHashSet<>());\n }\n return result.stream()\n .map(Equivalence.Wrapper::get)\n .collect(Collectors.toList());\n }", "private void computeSat(){\n addVertexVisitConstraint();\n //add clause for each vertex must be visited only once/ all vertices must be on path\n addVertexPositionConstraint();\n //add clause for every edge in graph to satisfy constraint of vertices not belonging to edge not part of successive positions\n addVertexNonEdgeConstraint();\n }", "private List<Graph> possRemove(Graph pag, Map<Edge, Boolean> necEdges) {\n // list of edges that can be removed\n List<Edge> remEdges = new ArrayList<>();\n for (Edge remEdge : necEdges.keySet()) {\n if (!necEdges.get(remEdge))\n remEdges.add(remEdge);\n }\n // powerset of edges that can be removed\n PowerSet<Edge> pset = new PowerSet<>(remEdges);\n List<Graph> possRemove = new ArrayList<>();\n // for each set of edges in the powerset remove edges from graph and add to PossRemove\n for (Set<Edge> set : pset) {\n Graph newPag = new EdgeListGraph(pag);\n for (Edge edge : set) {\n newPag.removeEdge(edge);\n }\n possRemove.add(newPag);\n }\n return possRemove;\n }", "private static <N> ImmutableMap<N, GraphConnections<N, GraphConstants.Presence>> getNodeConnections(Graph<N> paramGraph) {\n }", "public void processMatchVars(HashMap<String, List<String>> mapCandVarToMatchedVals,\n HashMap<String, List<String>> mapCandVarToAllAnsMaps,\n boolean flagSkipCTP, int indxCTP, int srcGraph, List<String> allCTPvals) {\n\n if (indxCTP == 18) {\n\n int araz = 0;\n }\n\n List<String> removeKeys = null;\n List<String> tmpPattern = null;\n List<String> newCandVals = new LinkedList<>();\n List<String> cleanCANDTP = myDedUtils.getCleanTP(DTPCandidates.get(indxCTP));\n\n //Confirm or reject variables based on matching threshold OR/AND best matching choice\n removeKeys = confirmMatchVars(mapCandVarToMatchedVals, mapCandVarToAllAnsMaps, indxCTP);\n\n for (int k = 0; k < removeKeys.size(); k++) {\n\n mapCandVarToMatchedVals.remove(removeKeys.get(k));\n }\n\n //Identify EG as NLEG and combine alternative variables and match variables to corresponding hash maps\n refineDTPmatchVars(mapCandVarToMatchedVals, mapCandVarToAllAnsMaps, indxCTP, srcGraph);\n\n //Match a CTP directly to a DTP, when no vars matched during inverse mapping\n if (mapCandVarToMatchedVals.isEmpty()) {\n\n //If values to match correspond to CTP part of a BoundJoin, that we\n //could not match because of a small Tjoin\n if (allCTPvals == null || (allCTPvals != null && allCTPvals.size() > 3)) {\n\n tmpPattern = myDedUtils.getCleanTP(allCTPs.get(indxCTP));\n if (mapCTPtoQuerySrc.get(tmpPattern) != null) {\n\n if (mapDTPToDeducedID.get(tmpPattern) == null) {\n\n mapDTPToDeducedID.put(tmpPattern, mapDTPToDeducedID.size() + 1);\n }\n\n // System.out.println(mapDTPToDeducedID.get(newDedTP));\n myBasUtils.insertToMap2(mapDTPtoInnerQuery, mapCTPtoQuerySrc.get(tmpPattern), mapDTPToDeducedID.get(tmpPattern));\n }\n\n //If CTP's subject and object are variables, we have already match\n //this as a DTP\n if (!flagSkipCTP) {\n\n myDedUtils.setDTPHashInfo(tmpPattern, indxCTP);\n allCTPvals = myDedUtils.getValuesFromCTP(indxCTP);\n flagSTOPNONPROJECTEDvars = myDedUtils.setDTPtoSrcAns(indxCTP, allCTPvals, tmpPattern, flagSTOPNONPROJECTEDvars);\n }\n\n } //If values to match correspond to singleTPs that surely are not part\n //of a BoundJoin, then match them directly as DTPs\n else if (allCTPvals.size() <= 3) {\n\n for (int i = 0; i < allCTPvals.size(); i++) {\n\n tmpPattern = myDedUtils.getNewRawTP(allCTPs.get(indxCTP), allCTPvals.get(i));\n\n if (mapCTPtoQuerySrc.get(tmpPattern) != null) {\n\n if (mapDTPToDeducedID.get(tmpPattern) == null) {\n\n mapDTPToDeducedID.put(tmpPattern, mapDTPToDeducedID.size() + 1);\n }\n\n // System.out.println(mapDTPToDeducedID.get(newDedTP));\n myBasUtils.insertToMap2(mapDTPtoInnerQuery, mapCTPtoQuerySrc.get(tmpPattern), mapDTPToDeducedID.get(tmpPattern));\n }\n\n if (!flagSkipCTP) {\n\n myDedUtils.setDTPHashInfo(tmpPattern, indxCTP);\n allCTPvals = myDedUtils.getValuesFromCTP(indxCTP);\n newCandVals = new LinkedList<>();\n newCandVals.add(allCTPvals.get(i));\n flagSTOPNONPROJECTEDvars = myDedUtils.setDTPtoSrcAns(indxCTP, allCTPvals, tmpPattern, flagSTOPNONPROJECTEDvars);\n }\n }\n }\n\n }\n\n //In any case, we must capture source endpoints of each source TP of a CTP\n //and if there is no matching variable, save each source TPs as a DTP\n for (int i = 0; i < allCTPvals.size(); i++) {\n\n tmpPattern = myDedUtils.getNewRawTP(allCTPs.get(indxCTP), allCTPvals.get(i));\n myBasUtils.insertToMap3(mapDTPToEndpsSrc, mapCTPToEndpsSrc.get(cleanCANDTP), tmpPattern);\n }\n\n }", "private void computeAllPaths()\n {\n for (Station src : this.graph.stations)\n {\n List<Station> visited = new ArrayList<Station>();\n computePathsForNode(src, null, null, visited);\n }\n Print.printTripList(this.tripList);\n }", "@Override\n public List<GraphModification> debugRules (HashMap<String, String> graphs, TransformationContext context, TableVersion tableVersion)\n\t\t\tthrows TransformerException {\n\t\ttry {\n\t\t\tCollection<String> originalGraphs = graphs.keySet();\n\n\t\t\t/**\n\t\t\t * Start collecting modifications of the individual graphs\n\t\t\t */\n\t\t\tList<GraphModification> result = new ArrayList<GraphModification>();\n\n\t\t\tIterator<String> it = originalGraphs.iterator();\n\n\t\t\t/**\n\t\t\t * In case we need to know what changed we need to create copies of the graph to compare them after\n\t\t\t * the rule was applied\n\t\t\t */\n\t\t\tUniqueURIGenerator generator = new UUIDUniqueURIGenerator(ODCSInternal.DEBUG_TEMP_GRAPH_URI_PREFIX + this.getClass().getSimpleName() + \"/diff/\");\n\n\t\t\toriginal = generator.nextURI();\n\t\t\tmodified = generator.nextURI();\n\n\t\t\twhile (it.hasNext()) {\n\t\t\t\tString originalName = it.next();\n\t\t\t\tString temporaryName = graphs.get(originalName);\n\n\t\t\t\tGraphModification subResult = getGraphModifications(temporaryName,\n\t\t\t\t\t\tcontext.getCleanDatabaseCredentials(),\n\t\t\t\t\t\tcontext.getDirtyDatabaseCredentials(),\n\t\t\t\t\t\ttableVersion);\n\t\t\t\tsubResult.setGraphName(originalName);\n\n\t\t\t\tresult.add(subResult);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t} catch (Exception e) {\n\t\t\tLOG.error(\"Debugging of Data Normalization rules failed.\");\n\n\t\t\tthrow new TransformerException(e);\n\t\t}\n\t}", "private void buildGraph() {\n\t\tfor (Map<String, Channel> map: this.channels.values()) {\n\t\t\t// Add all channels\n\t\t\t\n\t\t\t// TODO: deal with channels spread over multiple redis instances (replicated)\n\t\t\t\n\t\t\t// Add all but ignore if some channels should be ignored\n\t\t\tfor (Map.Entry<String, Channel> entry: map.entrySet()) {\n\t\t\t\tif (IGNORE_UNICAST_AND_SUBSCRIBE) {\n\t\t\t\t\tif (entry.getKey().startsWith(\"unicast\") == false && entry.getKey().startsWith(\"sub\") == false) {\n\t\t\t\t\t\tif (entry.getKey().startsWith(\"tile\")) {\n\t\t\t\t\t\t\tchannelList.add(entry.getValue());\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tchannelList.add(entry.getValue());\n\t\t\t\t}\n\t\t\t}\n\t\t\t//channelList.addAll(map.values());\n\t\t}\n\t\t\n\t\t// Double-iteration to build pairs\n\t\tfor (Channel channel1: channelList) {\n\t\t\tfor (Channel channel2: channelList) {\n\t\t\t\tif (channel1 != channel2) {\n\t\t\t\t\t// Put channels as nodes in the set\n\t\t\t\t\tthis.nodes.add(channel1.getChannelName());\n\t\t\t\t\tthis.nodes.add(channel2.getChannelName());\n\t\t\t\t\t\n\t\t\t\t\t// Build pair\n\t\t\t\t\tChannelPair pair = new ChannelPair(channel1.getChannelName(), channel2.getChannelName());\n\t\t\t\t\t\n\t\t\t\t\t// Check if it is contained in the map\n\t\t\t\t\tif (this.pairMultiplicity.containsKey(pair) == false) {\n\t\t\t\t\t\t// Count common subscribers\n\t\t\t\t\t\tint commonSubscribers = countCommonSubscribers(channel1, channel2);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (commonSubscribers > 0) {\n\t\t\t\t\t\t\t// Perform computation and add it\n\t\t\t\t\t\t\tthis.pairMultiplicity.put(pair, commonSubscribers);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t}", "public SeparateChainingHashTable<Character, Boolean> solve2SAT(String formula) {\n HashSet<Character> variables = new HashSet<>();\n char[] charsInFormula = formula.toCharArray();\n for (int i = 0; i < charsInFormula.length; i++) {\n if (charsInFormula[i] != '('\n && charsInFormula[i] != ')'\n && charsInFormula[i] != 'V'\n && charsInFormula[i] != '^'\n && charsInFormula[i] != ' '\n && charsInFormula[i] != '!') {\n variables.add(charsInFormula[i]);\n }\n }\n\n Digraph digraph = new Digraph(variables.size() * 2);\n\n String[] values = formula.split(\" \");\n\n SeparateChainingHashTable<String, Integer> variableToIdMap = new SeparateChainingHashTable<>();\n SeparateChainingHashTable<Integer, String> idToVariableMap = new SeparateChainingHashTable<>();\n\n // Second pass to get vertices\n for (int i = 0; i < values.length; i += 2) {\n boolean isVariable1Negation;\n boolean isVariable2Negation;\n\n // Read variables\n String variable1;\n String variable2;\n\n String variable1Negation;\n String variable2Negation;\n\n if (values[i].charAt(1) == '!') {\n variable1 = values[i].substring(2, 3);\n isVariable1Negation = true;\n } else {\n variable1 = String.valueOf(values[i].charAt(1));\n isVariable1Negation = false;\n }\n variable1Negation = \"!\" + variable1;\n\n i += 2;\n\n if (values[i].charAt(0) == '!') {\n variable2 = values[i].substring(1, 2);\n isVariable2Negation = true;\n } else {\n variable2 = String.valueOf(values[i].charAt(0));\n isVariable2Negation = false;\n }\n variable2Negation = \"!\" + variable2;\n\n // Add variables to mappings if they do not exist yet\n if (!variableToIdMap.contains(variable1)) {\n addVariableToMappings(variable1, variableToIdMap, idToVariableMap);\n addVariableToMappings(variable1Negation, variableToIdMap, idToVariableMap);\n }\n if (!variableToIdMap.contains(variable2)) {\n addVariableToMappings(variable2, variableToIdMap, idToVariableMap);\n addVariableToMappings(variable2Negation, variableToIdMap, idToVariableMap);\n }\n\n // Add edges to implication digraph\n // Map (A V B) to (A -> !B) and (B -> !A)\n // based on http://www.geeksforgeeks.org/2-satisfiability-2-sat-problem/\n int variable1Id = variableToIdMap.get(variable1);\n int variable1NegationId = variableToIdMap.get(variable1Negation);\n int variable2Id = variableToIdMap.get(variable2);\n int variable2NegationId = variableToIdMap.get(variable2Negation);\n\n if (!isVariable1Negation) {\n if (!isVariable2Negation) {\n digraph.addEdge(variable1Id, variable2NegationId);\n digraph.addEdge(variable2Id, variable1NegationId);\n } else {\n digraph.addEdge(variable1Id, variable2Id);\n digraph.addEdge(variable2NegationId, variable1NegationId);\n }\n } else {\n if (!isVariable2Negation) {\n digraph.addEdge(variable1NegationId, variable2NegationId);\n digraph.addEdge(variable2Id, variable1Id);\n } else {\n digraph.addEdge(variable1NegationId, variable2Id);\n digraph.addEdge(variable2NegationId, variable1Id);\n }\n }\n }\n\n // Compute strongly connected components\n KosarajuSharirSCC kosarajuSharirSCC = new KosarajuSharirSCC(digraph);\n\n // Check if formula is satisfiable\n if (!isFormulaSatisfiable(digraph, kosarajuSharirSCC)) {\n return null;\n }\n\n // Solve 2-SAT by assigning variables to true using the strongly connected components topological order\n List<Integer>[] stronglyConnectedComponents = (List<Integer>[]) new ArrayList[kosarajuSharirSCC.count()];\n\n for (int scc = 0; scc < stronglyConnectedComponents.length; scc++) {\n stronglyConnectedComponents[scc] = new ArrayList<>();\n }\n\n for (int vertex = 0; vertex < digraph.vertices(); vertex++) {\n int stronglyConnectedComponentId = kosarajuSharirSCC.id(vertex);\n stronglyConnectedComponents[stronglyConnectedComponentId].add(vertex);\n }\n\n SeparateChainingHashTable<Character, Boolean> solution = new SeparateChainingHashTable<>();\n\n // Iterate through strongly connected components in topological order to assign the variables.\n // There is a lot of conflicting literature as how the variables should be assigned and in which order.\n // The only correct literature that I found was in the Competitive Programmers Handbook, by Antti Laaksonen\n // This implementation uses a reverse approach of the approach described in the book, because it seems\n // more logical to iterate in topological order and assign a value of TRUE to variables X\n // and FALSE to variables !X found along the way.\n for (int scc = stronglyConnectedComponents.length - 1; scc >= 0; scc--) {\n for (int vertexId : stronglyConnectedComponents[scc]) {\n String vertexVariable = idToVariableMap.get(vertexId);\n\n char variable;\n\n boolean isNegation = vertexVariable.charAt(0) == '!';\n if (!isNegation) {\n variable = vertexVariable.charAt(0);\n } else {\n variable = vertexVariable.charAt(1);\n }\n\n if (!solution.contains(variable)) {\n if (!isNegation) {\n solution.put(variable, true);\n } else {\n solution.put(variable, false);\n }\n }\n }\n }\n\n return solution;\n }", "private static Set<Character> findDeepDependencies(Map<Character, Set<Character>> map, Set<Character> values) {\n\t\tif (values.isEmpty())\n\t\t\treturn Collections.emptySet();\n\n\t\tSet<Character> valuesCollected = new HashSet<>();\n\t\tfor (Character character : values) {\n\t\t\tif (map.containsKey(character))\n\t\t\t\tvaluesCollected.addAll(map.get(character));\n\t\t}\n\t\tSet<Character> newValues = findDeepDependencies(map, valuesCollected);\n\t\tvaluesCollected.addAll(newValues);\n\t\treturn valuesCollected;\n\t}", "private SchedulePaths calculateAllPaths(final SchedulePaths schedulePaths, final Set<Edge> path,\n final Operation operation) {\n\n final Set<Edge> parentEdges;\n if (operation instanceof EndVertex) {\n parentEdges = ((EndVertex) operation).getEndParentEdges();\n } else {\n parentEdges = operation.getParentEdges();\n }\n\n LOG.trace(\"Checking operation J: {}, M: {}\", operation.getJob(), operation.getMachine());\n LOG.trace(\"Number of parent edges: {}\", parentEdges.size());\n\n //Runs while not root operation\n if (!parentEdges.isEmpty()) {\n\n //Gets maximum edge size\n Integer maxEdge = 0;\n for (final Edge edge : parentEdges) {\n\n if (path.contains(edge)) {\n LOG.trace(\"Detected loop\");\n LOG.trace(\"Loop parent: {}\\n From path: {}\", edge.toString(), path.toString());\n schedulePaths.setIsFeasible(false);\n schedulePaths.setNodeCausingCycle(edge);\n\n return schedulePaths;\n }\n\n LOG.trace(\"Parent of operation: J:{} M:{}\", edge.getOperationFrom().getJob(), edge.getOperationFrom()\n .getMachine());\n if (edge.getMaxDistanceToMe() > maxEdge) {\n maxEdge = edge.getMaxDistanceToMe();\n }\n }\n\n LOG.trace(\"Maximum edge is {}\", maxEdge);\n\n Set<Edge> pathCopy = null;\n boolean firstEdge = true;\n for (final Edge edge : parentEdges) {\n\n if (Objects.equals(edge.getMaxDistanceToMe(), maxEdge)) {\n\n LOG.trace(\"Edge: {} maxd: {}\", edge, edge.getMaxDistanceToMe());\n\n if (firstEdge) {\n\n pathCopy = new LinkedHashSet<>(path);\n\n path.add(edge);\n LOG.trace(\"Adding edge: {}\", edge);\n firstEdge = false;\n calculateAllPaths(schedulePaths, path, edge.getOperationFrom());\n } else {\n\n final Set<Edge> newPath = new LinkedHashSet<>(pathCopy);\n LOG.trace(\"Creating new path, copying: {}\", pathCopy);\n\n newPath.add(edge);\n LOG.trace(\"New Path copy, adding edge: {}\", edge);\n calculateAllPaths(schedulePaths, newPath, edge.getOperationFrom());\n }\n }\n }\n } else {\n\n LOG.trace(\"Added new path to path set.\");\n schedulePaths.addPath(path);\n }\n\n return schedulePaths;\n }", "public static <T> Set<Set<T>> findStronglyConnectedComponents(Map<T, Set<T>> graph) {\n if (graph == null) {\n return null;\n }\n Set<T> visited = new HashSet<>();\n Stack<T> stack = new Stack<>();\n for (T vertex : graph.keySet()) {\n if (!visited.contains(vertex)) {\n fillStack(graph, vertex, visited, stack);\n }\n }\n\n Map<T, Set<T>> reversedGraph = reverse(graph);\n visited.clear();\n Set<Set<T>> result = new HashSet<>();\n while (!stack.isEmpty()) {\n T vertex = stack.pop();\n if (!visited.contains(vertex)) {\n Set<T> component = new HashSet<>();\n fillComponent(reversedGraph, vertex, visited, component);\n result.add(component);\n }\n }\n return result;\n }", "private void reachable() {\r\n\r\n\t\tSortedSet<String> keys = new TreeSet<String>(vertexMap.keySet());\r\n\t\tIterator it = keys.iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tVertex v = vertexMap.get(it.next());\r\n\t\t\tif (v.isStatus()) {\r\n\t\t\t\tSystem.out.println(v.getName());\r\n\t\t\t\tbfs(v);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void getAllPaths(Graph<Integer> graph) {\n\t\tTopologicalSort obj = new TopologicalSort();\r\n\t\tStack<Vertex<Integer>> result = obj.sort(graph);\r\n\t\t\r\n\t\t// source (one or multiple) must lie at the top\r\n\t\twhile(!result.isEmpty()) {\r\n\t\t\tVertex<Integer> currentVertex = result.pop();\r\n\t\t\t\r\n\t\t\tif(visited.contains(currentVertex.getId())) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tstack = new Stack<Vertex<Integer>>();\r\n\t\t\tSystem.out.println(\"Paths: \");\r\n\t\t\tvisited = new ArrayList<Long>();\r\n\t\t\tdfs(currentVertex);\r\n\t\t\t//System.out.println(stack);\r\n\t\t\t//GraphUtil.print(stack);\t\t\t\r\n\t\t}\r\n\r\n\t}", "private void markUnreachableConnections(Map<String, AirportNode> airportGraph, List<AirportNode> unreachableAirportNodes) {\n // for each unreachable airport, find all unreachable connections\n for (AirportNode airportNode : unreachableAirportNodes) {\n String airport = airportNode.airport;\n List<String> unreachableConnections = new ArrayList<>();\n Set<String> visitedAirports = new HashSet<>();\n depthFirstAddUnreachableConnections(airportGraph, airport, unreachableConnections, visitedAirports);\n airportNode.unreachableConnections = unreachableConnections;\n }\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic void dumpRemoteKeggPathways() throws IOException {\n\t\tList<Short> pathwayIDs = new ArrayList<Short>();\n\t\t\n\t\t// get pathway tree structure\n\t\tTreeNode pathwayRoot = Constants.KEGG_ORTHOLOGY_MAP.getRoot();\n\t\tEnumeration<TreeNode> dfEnum = ((DefaultMutableTreeNode) pathwayRoot).depthFirstEnumeration();\n\t\t// iterate nodes of pathway\n\t\twhile (dfEnum.hasMoreElements()) {\n\t\t\tTreeNode treeNode = (TreeNode) dfEnum.nextElement();\n\t\t\t// extract data from leaf nodes only\n\t\t\tif (treeNode.isLeaf()) {\n\t\t\t\tString leafName = (String) ((DefaultMutableTreeNode) treeNode).getUserObject();\n\t\t\t\t// extract numeric identifier and store in list\n\t\t\t\tpathwayIDs.add(Short.parseShort(leafName.substring(0, 5)));\n\t\t\t}\n\t\t}\n\n\t\tko2pathway = new HashMap<Short, List<Short>>();\n\t\tpathway2ko = new HashMap<Short, List<Short>>();\n\t\tec2pathway = new HashMap<short[], List<Short>>();\n\t\tpathway2ec = new HashMap<Short, List<short[]>>();\n\t\tint i = 1;\n\t\t// iterate list of pathway IDs\n\t\tfor (Short pathwayID : pathwayIDs) {\n\t\t\tSystem.out.println(\"\" + (i++) + \"/\" + pathwayIDs.size());\n\t\t\tString pathway = \"path:map\" + String.format(\"%05d\", pathwayID);\n\t\t\t\n\t\t\tString[] koStrings = serv.get_kos_by_pathway(pathway);\n\t\t\tList<Short> koList = new ArrayList<Short>();\n\t\t\tfor (String koString : koStrings) {\n\t\t\t\tShort ko = Short.parseShort(koString.substring(4));\n\t\t\t\tList<Short> pathwayList = ko2pathway.get(ko);\n\t\t\t\tif (pathwayList == null) {\n\t\t\t\t\tpathwayList = new ArrayList<Short>();\n\t\t\t\t}\n\t\t\t\tif (!pathwayList.contains(pathwayID)) {\n\t\t\t\t\tpathwayList.add(pathwayID);\n\t\t\t\t}\n\t\t\t\tko2pathway.put(ko, pathwayList);\n\t\t\t\t\n\t\t\t\tkoList.add(ko);\n\t\t\t}\n\t\t\tif (!koList.isEmpty()) {\n\t\t\t\tpathway2ko.put(pathwayID, koList);\n\t\t\t}\n\n\t\t\tString[] ecStrings = serv.get_enzymes_by_pathway(pathway);\n\t\t\tList<short[]> ecList = new ArrayList<short[]>();\n\t\t\tfor (String ecString : ecStrings) {\n\t\t\t\tshort[] ec = ECReader.toArray(ecString.substring(3));\n\t\t\t\tList<Short> pathwayList = ec2pathway.get(ec);\n\t\t\t\tif (pathwayList == null) {\n\t\t\t\t\tpathwayList = new ArrayList<Short>();\n\t\t\t\t}\n\t\t\t\tif (!pathwayList.contains(pathwayID)) {\n\t\t\t\t\tpathwayList.add(pathwayID);\n\t\t\t\t}\n\t\t\t\tec2pathway.put(ec, pathwayList);\n\t\t\t\t\n\t\t\t\tecList.add(ec);\n\t\t\t}\n\t\t\tpathway2ec.put(pathwayID, ecList);\n\t\t\t\n\t\t}\n\t\t\n\t\t// dump objects to file\n\t\tFile output = new File(\"conf/keggKO2PW.map\");\n\t\tFileOutputStream fos = new FileOutputStream(output);\n\t\tObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(fos)));\n\n\t\toos.writeObject(ko2pathway);\n\t\toos.writeObject(pathway2ko);\n\t\toos.writeObject(ec2pathway);\n\t\toos.writeObject(pathway2ec);\n\t\toos.flush();\n\t\toos.close();\n\t}", "@Test\n public void testComplexGraph() {\n CFGCreator<Character> cfgCreator = new CFGCreator<>();\n CharGrammarParser parser = new CharGrammarParser(cfgCreator);\n SLPOp<Character> slpOp = new SLPOp();\n CFGOp<Character> cfgOp = new CFGOp<>();\n\n // L(G) = {(ab)^1 : i >= 1}\n String text =\n \"S -> bAs \\n\" +\n \"A -> iBa \\n\" +\n \"B -> aCi \\n\" +\n \"C -> sd \\n\" +\n \"D -> SSESS \\n\" +\n \"E -> zSSESSr \\n\" +\n \"E -> uu \\n\";\n\n Map<IJezSymbol<Character>, List<IJezSymbol<Character>>> f = new HashMap<>();\n Map<IJezSymbol<Character>, List<IJezSymbol<Character>>> g = new HashMap<>();\n\n IJezSymbol<Character> a = cfgCreator.lookupSymbol('a', true);\n IJezSymbol<Character> b = cfgCreator.lookupSymbol('b', true);\n IJezSymbol<Character> d = cfgCreator.lookupSymbol('d', true);\n IJezSymbol<Character> i = cfgCreator.lookupSymbol('i', true);\n IJezSymbol<Character> s = cfgCreator.lookupSymbol('s', true);\n IJezSymbol<Character> r = cfgCreator.lookupSymbol('r', true);\n IJezSymbol<Character> u = cfgCreator.lookupSymbol('u', true);\n IJezSymbol<Character> z = cfgCreator.lookupSymbol('z', true);\n\n IJezSymbol<Character> one = cfgCreator.lookupSymbol('1', true);\n IJezSymbol<Character> two = cfgCreator.lookupSymbol('2', true);\n IJezSymbol<Character> three = cfgCreator.lookupSymbol('3', true);\n\n f.put(a, Arrays.asList(one, two));\n f.put(b, Arrays.asList(three, two));\n f.put(d, Arrays.asList(one, one, one, two));\n f.put(i, Arrays.asList(two));\n f.put(s, Arrays.asList(one, one, two));\n f.put(r, Arrays.asList(r));\n f.put(u, Arrays.asList(u));\n f.put(z, Arrays.asList(z));\n\n\n g.put(a, Arrays.asList(one, two, one));\n g.put(b, Arrays.asList(three));\n g.put(d, Arrays.asList(one, one, one));\n g.put(i, Arrays.asList(two, two));\n g.put(s, Arrays.asList(one, two));\n g.put(r, Arrays.asList(r));\n g.put(u, Arrays.asList(u));\n g.put(z, Arrays.asList(z));\n\n\n Set<Production<Character>> productions = parser.createProductions(text);\n Set<IJezSymbol<Character>> axiom = new HashSet<>();\n axiom.add(cfgCreator.lookupSymbol('D', false));\n\n\n Set<Production<Character>> wCNFProductions = cfgOp.toWeakCNF(productions, axiom, cfgCreator);\n MorphismEQSolver<Character, Character> morphismEQSolver = new MorphismEQSolver<>(cfgCreator.createCFG(wCNFProductions, axiom), cfgCreator, new CFGCreatorFactory<>(), new CFGCreatorFactory<>());\n\n GenDefaultMorphism<Character> morphism1 = new GenDefaultMorphism<>(f::get);\n GenDefaultMorphism<Character> morphism2 = new GenDefaultMorphism<>(g::get);\n long ms = System.currentTimeMillis();\n assertTrue(morphismEQSolver.equivalentOnMorphisms(morphism1, morphism2));\n logger.info(\"Running time: \" + (System.currentTimeMillis() - ms) + \"[ms]\");\n }", "@Test\n public void cyclicalGraphs3Test() throws Exception {\n // Test graphs with multiple loops. g1 has two different loops, which\n // have to be correctly matched to g2 -- which is build in a different\n // order but is topologically identical to g1.\n\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"b\", \"c\" });\n\n // Create loop1 in g1, with the first 4 nodes.\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(3), Event.defTimeRelationStr);\n g1Nodes.get(3).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n\n // Create loop2 in g1, with the last 2 nodes, plus the initial node.\n g1Nodes.get(0).addTransition(g1Nodes.get(4), Event.defTimeRelationStr);\n g1Nodes.get(4).addTransition(g1Nodes.get(5), Event.defTimeRelationStr);\n g1Nodes.get(5).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n\n exportTestGraph(g1, 0);\n\n // //////////////////\n // Now create g2, by generating the two identical loops in the reverse\n // order.\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"b\", \"c\" });\n\n // Create loop2 in g2, with the last 2 nodes, plus the initial node.\n g2Nodes.get(0).addTransition(g2Nodes.get(4), Event.defTimeRelationStr);\n g2Nodes.get(4).addTransition(g2Nodes.get(5), Event.defTimeRelationStr);\n g2Nodes.get(5).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n\n // Create loop1 in g2, with the first 4 nodes.\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(2), Event.defTimeRelationStr);\n g2Nodes.get(2).addTransition(g2Nodes.get(3), Event.defTimeRelationStr);\n g2Nodes.get(3).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n\n exportTestGraph(g2, 1);\n\n // //////////////////\n // Now test that the two graphs are identical for all k starting at the\n // initial node.\n\n for (int k = 1; k < 7; k++) {\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), k);\n }\n }", "private void calcPossibleMappingImpl(\n Collection<Vertex> currentSourceVertices,\n Collection<Vertex> currentTargetVertices,\n List<String> contextId,\n int contextIx,\n List<VertexContextSegment> contexts,\n Set<Vertex> usedSourceVertices,\n Set<Vertex> usedTargetVertices,\n String typeNameForDebug) {\n runningCheck.check();\n\n VertexContextSegment finalCurrentContext = contexts.get(contextIx);\n Map<String, ImmutableList<Vertex>> sourceGroups = FpKit.filterAndGroupingBy(currentSourceVertices,\n v -> finalCurrentContext.filter(v, sourceGraph),\n v -> finalCurrentContext.idForVertex(v, sourceGraph));\n Map<String, ImmutableList<Vertex>> targetGroups = FpKit.filterAndGroupingBy(currentTargetVertices,\n v -> finalCurrentContext.filter(v, targetGraph),\n v -> finalCurrentContext.idForVertex(v, targetGraph));\n\n\n List<String> deletedContexts = new ArrayList<>();\n List<String> insertedContexts = new ArrayList<>();\n List<String> sameContexts = new ArrayList<>();\n Util.diffNamedList(sourceGroups.keySet(), targetGroups.keySet(), deletedContexts, insertedContexts, sameContexts);\n\n // for each unchanged context we descend recursively into\n for (String sameContext : sameContexts) {\n ImmutableList<Vertex> sourceVerticesInContext = sourceGroups.get(sameContext);\n ImmutableList<Vertex> targetVerticesInContext = targetGroups.get(sameContext);\n\n List<String> currentContextId = concat(contextId, sameContext);\n if (contexts.size() > contextIx + 1) {\n calcPossibleMappingImpl(sourceVerticesInContext, targetVerticesInContext, currentContextId, contextIx + 1, contexts, usedSourceVertices, usedTargetVertices, typeNameForDebug);\n }\n /**\n * Either there was no context segment left or not all vertices were relevant for\n * Either way: fill up with isolated vertices and record as possible mapping\n */\n Set<Vertex> notUsedSource = new LinkedHashSet<>(sourceVerticesInContext);\n notUsedSource.removeAll(usedSourceVertices);\n Set<Vertex> notUsedTarget = new LinkedHashSet<>(targetVerticesInContext);\n notUsedTarget.removeAll(usedTargetVertices);\n\n possibleMappings.putPossibleMappings(currentContextId, notUsedSource, notUsedTarget, typeNameForDebug);\n usedSourceVertices.addAll(notUsedSource);\n usedTargetVertices.addAll(notUsedTarget);\n }\n\n /**\n * update the used vertices with the deleted and inserted contexts\n */\n Set<Vertex> possibleSourceVertices = new LinkedHashSet<>();\n for (String deletedContext : deletedContexts) {\n ImmutableList<Vertex> vertices = sourceGroups.get(deletedContext);\n for (Vertex sourceVertex : vertices) {\n if (!usedSourceVertices.contains(sourceVertex)) {\n possibleSourceVertices.add(sourceVertex);\n }\n }\n usedSourceVertices.addAll(vertices);\n }\n\n Set<Vertex> possibleTargetVertices = new LinkedHashSet<>();\n for (String insertedContext : insertedContexts) {\n ImmutableList<Vertex> vertices = targetGroups.get(insertedContext);\n for (Vertex targetVertex : vertices) {\n if (!usedTargetVertices.contains(targetVertex)) {\n possibleTargetVertices.add(targetVertex);\n }\n }\n usedTargetVertices.addAll(vertices);\n }\n if (contextId.size() == 0) {\n contextId = singletonList(typeNameForDebug);\n }\n possibleMappings.putPossibleMappings(contextId, possibleSourceVertices, possibleTargetVertices, typeNameForDebug);\n }", "public static ArrayList<Set<String>> getConnectedComponentsInDistrict(\n District district,\n HashMap<String, PrecinctNeighborRelation> precinctNeighborRelationMap) {\n // ( precinctGeoId : PrecinctNeighborRelation } pair in precinctNeighborRelationMap\n\n // first, build from -> to_list hash map\n HashMap<String, ArrayList<String>> fromToList = new HashMap<>();\n for(PrecinctNeighborRelation pnr : precinctNeighborRelationMap.values()) {\n ArrayList<NeighborData> ndList = pnr.getNeighborDataList();\n ArrayList<String> toGeoidList = new ArrayList<>();\n for(NeighborData nd : ndList)\n toGeoidList.add(nd.getToGeoId());\n fromToList.put(pnr.getFromGeoId(), toGeoidList);\n }\n\n Set<Precinct> precinctsOfDistrict = district.getPrecincts();\n\n ArrayList<String> pgeoidsOfDistrict = new ArrayList<>();\n ArrayList<Set<String>> connectedComponentList = new ArrayList<>();\n HashMap<String, Set<String>> referenceToItsSet = new HashMap<>();\n\n for(Precinct p : precinctsOfDistrict) {\n Set<String> connectedComponent = new HashSet<>();\n connectedComponent.add(p.getGeoId());\n connectedComponentList.add(connectedComponent);\n referenceToItsSet.put(p.getGeoId(), connectedComponent);\n pgeoidsOfDistrict.add(p.getGeoId());\n }\n\n for(Precinct p : precinctsOfDistrict) {\n ArrayList<String> toGeoidList = fromToList.get(p.getGeoId());\n Set<String> itsSet = referenceToItsSet.get(p.getGeoId());\n for(String neighborGeoid : toGeoidList) {\n // if the neighbor is in same district\n // if itsSet not yet contains the neighbor\n if(pgeoidsOfDistrict.contains(neighborGeoid)\n && !itsSet.contains(neighborGeoid)) {\n // neighbors set will be removed from the memory\n Set<String> neighborsSet = referenceToItsSet.get(neighborGeoid);\n for(String elementFromNeighborSet : neighborsSet) {\n referenceToItsSet.put(elementFromNeighborSet, itsSet);\n itsSet.add(elementFromNeighborSet);\n }\n connectedComponentList.remove(neighborsSet);\n }\n }\n }\n\n // stubbed\n// Set<Precinct> oneset = new HashSet<>();\n// ArrayList<Set<Precinct>> listSizeOne = new ArrayList<>();\n// listSizeOne.add(oneset);\n if(connectedComponentList.size() > 1) {\n //System.out.println(\"District: \" + district.getGeoId() + \" has \" + connectedComponentList.size() + \" components\");\n }\n return connectedComponentList;\n }", "@Test\n public void restrictedEdges() {\n int costlySource = graph.edge(0, 1).setDistance(5).set(speedEnc, 10, 10).getEdge();\n graph.edge(1, 2).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(2, 3).setDistance(1).set(speedEnc, 10, 10);\n int costlyTarget = graph.edge(3, 4).setDistance(5).set(speedEnc, 10, 10).getEdge();\n int cheapSource = graph.edge(0, 5).setDistance(1).set(speedEnc, 10, 10).getEdge();\n graph.edge(5, 6).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(6, 7).setDistance(1).set(speedEnc, 10, 10);\n int cheapTarget = graph.edge(7, 4).setDistance(1).set(speedEnc, 10, 10).getEdge();\n graph.edge(2, 6).setDistance(1).set(speedEnc, 10, 10);\n\n assertPath(calcPath(0, 4, cheapSource, cheapTarget), 0.4, 4, 400, nodes(0, 5, 6, 7, 4));\n assertPath(calcPath(0, 4, cheapSource, costlyTarget), 0.9, 9, 900, nodes(0, 5, 6, 2, 3, 4));\n assertPath(calcPath(0, 4, costlySource, cheapTarget), 0.9, 9, 900, nodes(0, 1, 2, 6, 7, 4));\n assertPath(calcPath(0, 4, costlySource, costlyTarget), 1.2, 12, 1200, nodes(0, 1, 2, 3, 4));\n }", "public static ArrayList<String> connectors2(Graph g) {\n boolean[] visits = new boolean[g.members.length]; \n for (int i=0;i<=g.members.length-1;i++) {\n \tvisits[i]=false;\n }\n int[] dfsnum = new int[g.members.length];\n int[] back = new int[g.members.length];\n ArrayList<String> answer = new ArrayList<String>();\n\n //driver portion\n for (Person person : g.members) {\n //if it hasn't been visited\n if (visits[g.map.get(person.name)]==false){\n //for different islands\n dfsnum = new int[g.members.length];\n dfs(g.map.get(person.name), g.map.get(person.name), g, visits, dfsnum, back, answer);\n }\n }\n \n //check if vertex has one neighbor\n for (int i = 0; i < answer.size(); i++) {\n Friend ptr = g.members[g.map.get(answer.get(i))].first;\n //counts number of neighbors\n int count = 0;\n while (ptr != null) {\n ptr = ptr.next;\n count++;\n }\n if (count == 1) answer.remove(i);\n if (count == 0) answer.remove(i);\n } \n for (Person member : g.members) {\n if (member.first!=null&& member.first.next == null) {\n if (answer.contains(g.members[member.first.fnum].name)==false)\n \t\t answer.add(g.members[member.first.fnum].name);\n }\n }\n answer=modify(answer,g);\n if (answer==null||answer.size()==0) return null;\n return answer;\n }", "private List<V> intersectGraphPaths(GraphPath<V, E> p1, GraphPath<V, E> p2)\n {\n List<V> res = new LinkedList<>();\n res.addAll(p1.getVertexList());\n res.retainAll(p2.getVertexList());\n return res;\n }", "private List<List<Edge>> walker(String sourceNode, String destNode, List<Edge> currentPath, List<List<Edge>> paths) {\n if (currentPath == null) {\n currentPath = new ArrayList<>();\n }\n if (paths == null) {\n paths = new ArrayList<>();\n }\n\n if (sourceNode.equals(destNode)) {\n return paths;\n }\n\n\n// List<Edge> edges = findByNodeA(sourceNode);\n List<Edge> edges = allEdges.stream().filter(edge -> edge.nodeA.equals(sourceNode)).collect(Collectors.toList());\n\n\n for (Edge edge : edges) {\n if (!currentPath.contains(edge)&&!containsBidirectionalRef(currentPath,edge)) {\n List<Edge> forkPath = (List<Edge>) ((ArrayList<Edge>) currentPath).clone();\n\n forkPath.add(edge);\n\n if (edge.getNodeB().equals(destNode)) {\n paths.add(forkPath);\n } else {\n walker(edge.getNodeB(), destNode,forkPath,paths);\n }\n }\n }\n\n return paths;\n }", "private Map<Long, Boolean> searchPaths(Context context, Long initialStateId,\n Long destinationStateId, Map<Long, Boolean> visitedStateIds,\n Map<Long, String> stateOutputEvents) {\n\n Queue<LinkedList<Long>> queueOfPaths = new LinkedList<>();\n LinkedList<Long> currentPath = new LinkedList<>();\n\n currentPath.add(initialStateId);\n queueOfPaths.add(currentPath);\n\n Set<Long> nextDependentStateIds;\n\n while (queueOfPaths.size() != 0) {\n currentPath = queueOfPaths.poll();\n Long lastStateId = currentPath.getLast();\n\n if(lastStateId.equals(destinationStateId)) {\n for (Long stateId : currentPath) {\n visitedStateIds.put(stateId, Boolean.TRUE);\n }\n continue;\n }\n\n nextDependentStateIds = context.getDependentStateIds(stateOutputEvents.get(lastStateId));\n for (Long dependentStateId : nextDependentStateIds) {\n if(!currentPath.contains(dependentStateId)) {\n LinkedList<Long> newPath = new LinkedList<>();\n newPath.addAll(currentPath);\n newPath.add(dependentStateId);\n queueOfPaths.add(newPath);\n }\n }\n }\n return visitedStateIds;\n }", "private static void simplify (GraphDirected<NodeCppOSMDirected, EdgeCppOSMDirected> osmGraph) {\n \t\tfinal Iterator<NodeCppOSMDirected> iteratorNodes = osmGraph.getNodes().iterator();\n \t\twhile (iteratorNodes.hasNext()) {\n \t\t\tfinal NodeCppOSMDirected node = iteratorNodes.next();\n \t\t\t// one in one out\n \t\t\tif (node.getInDegree() == 1 && node.getOutDegree() == 1) {\n \t\t\t\t// get the ids of the two connected nodes\n \t\t\t\tfinal Long currentNodeId = node.getId();\n \t\t\t\tfinal List<EdgeCppOSMDirected> edges = node.getEdges();\n \t\t\t\tfinal EdgeCppOSMDirected edge1 = edges.get(0);\n \t\t\t\tfinal EdgeCppOSMDirected edge2 = edges.get(1);\n \t\t\t\tfinal Long node1id = edge1.getNode1().getId() == (currentNodeId) ? edge2.getNode1().getId() : edge1.getNode1().getId();\n \t\t\t\tfinal Long node2id = edge1.getNode1().getId() == (currentNodeId) ? edge1.getNode2().getId() : edge2.getNode2().getId();\n \t\t\t\tif (node2id == node1id){\n \t\t\t\t\t// we are in a deadend and do not erase ourself\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t\t// concat the list in the right way\n \t\t\t\tList<WayNodeOSM> newMetaNodes = concatMetanodes(edge1.getMetadata().getNodes(), edge2.getMetadata().getNodes(), currentNodeId);\n \t\t\t\t// add a new edge\n \t\t\t\t// TODO: Handle way properly - what would name be in this context?\n \t\t\t\tosmGraph.getNode(node1id).connectWithNodeWeigthAndMeta(osmGraph.getNode(node2id), edge1.getWeight() + edge2.getWeight(),\n \t\t\t\t\t\tnew WayOSM(0, WayOSM.WayType.UNSPECIFIED, \"unknown\", newMetaNodes));\n \t\t\t\t// remove the old node\n \t\t\t\t// do this manually because we otherwise corrupt the iterator\n \t\t\t\tnode.removeAllEdges();\n \t\t\t\titeratorNodes.remove();\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\t// two in two out\n \t\t\tif (node.getInDegree() == 2 && node.getOutDegree() == 2) {\n \t\t\t\tfinal long currentNodeId = node.getId();\n \t\t\t\t//check the connections\n \t\t\t\tArrayList<EdgeCppOSMDirected> incomingEdges = new ArrayList<>();\n \t\t\t\tArrayList<EdgeCppOSMDirected> outgoingEdges = new ArrayList<>();\n \t\t\t\tfor(EdgeCppOSMDirected edge : node.getEdges()) {\n \t\t\t\t\tif(edge.getNode1().getId() == currentNodeId){\n \t\t\t\t\t\toutgoingEdges.add(edge);\n \t\t\t\t\t}\n \t\t\t\t\telse {\n \t\t\t\t\t\tincomingEdges.add(edge);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\t//TODO make this condition better\n \t\t\t\tif(outgoingEdges.get(0).getNode2().equals(incomingEdges.get(0).getNode1())){\n \t\t\t\t\t//out0 = in0\n \t\t\t\t\tif(!outgoingEdges.get(1).getNode2().equals(incomingEdges.get(1).getNode1())){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(0).getWeight() != incomingEdges.get(0).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(1).getWeight() != incomingEdges.get(1).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\telse {\n \t\t\t\t\t//out0 should be in1\n \t\t\t\t\t//therefore out1 = in0\n \t\t\t\t\tif(!outgoingEdges.get(0).getNode2().equals(incomingEdges.get(1).getNode1())){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(!outgoingEdges.get(1).getNode2().equals(incomingEdges.get(0).getNode1())){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(0).getWeight() != incomingEdges.get(1).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(1).getWeight() != incomingEdges.get(0).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t}\n \n \t\t\t\t// get the ids of the two connected nodes\n \t\t\t\tfinal NodeCppOSMDirected node1 = incomingEdges.get(0).getNode1();\n \t\t\t\tfinal NodeCppOSMDirected node2 = incomingEdges.get(1).getNode1();\n \t\t\t\t// \t\t\tif (node1.equals(node2)){\n \t\t\t\t// \t\t\t\t// we are in a loop and do not erase ourself\n \t\t\t\t// \t\t\t\tcontinue;\n \t\t\t\t// \t\t\t}\n \t\t\t\t// concat the list in the right way\n \t\t\t\tList<WayNodeOSM> metaNodes1 = incomingEdges.get(0).getMetadata().getNodes();\n \t\t\t\tList<WayNodeOSM> metaNodes2 = incomingEdges.get(1).getMetadata().getNodes();\n \t\t\t\tdouble weight = incomingEdges.get(0).getWeight() +incomingEdges.get(1).getWeight();\n \t\t\t\tList<WayNodeOSM> newMetaNodes = concatMetanodes(metaNodes1, metaNodes2, currentNodeId);\n \t\t\t\t// add a new edge\n \t\t\t\t// TODO: Handle way properly - what would name be in this context?\n \t\t\t\tnode1.connectWithNodeWeigthAndMeta(node2, weight,\n \t\t\t\t\t\tnew WayOSM(0, WayOSM.WayType.UNSPECIFIED, \"unknown\", newMetaNodes));\n \t\t\t\tnode2.connectWithNodeWeigthAndMeta(node1, weight,\n \t\t\t\t\t\tnew WayOSM(0, WayOSM.WayType.UNSPECIFIED, \"unknown\", newMetaNodes));\n \t\t\t\t// remove the old node\n \t\t\t\t// do this manually because we otherwise corrupt the iterator\n \t\t\t\tnode.removeAllEdges();\n \t\t\t\titeratorNodes.remove();\n \t\t\t}\n \t\t}\n \t}", "public static strictfp void main(String... args) {\n\t\tArrayList<Vertex> graph = new ArrayList<>();\r\n\t\tHashMap<Character, Vertex> map = new HashMap<>();\r\n\t\t// add vertices\r\n\t\tfor (char c = 'a'; c <= 'i'; c++) {\r\n\t\t\tVertex v = new Vertex(c);\r\n\t\t\tgraph.add(v);\r\n\t\t\tmap.put(c, v);\r\n\t\t}\r\n\t\t// add edges\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tif (v.getNodeId() == 'a') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'b') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'c') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'd') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'e') {\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'f') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t} else if (v.getNodeId() == 'g') {\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'h') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'i') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t// graph created\r\n\t\t// create disjoint sets\r\n\t\tDisjointSet S = null, V_S = null;\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tchar c = v.getNodeId();\r\n\t\t\tif (c == 'a' || c == 'b' || c == 'd' || c == 'e') {\r\n\t\t\t\tif (S == null) {\r\n\t\t\t\t\tS = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (V_S == null) {\r\n\t\t\t\t\tV_S = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(V_S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Disjoint sets created\r\n\t\tfor (Vertex u: graph) {\r\n\t\t\tfor (Vertex v: u.getAdjacents()) {\r\n\t\t\t\tif (DisjointSet.findSet((DisjointSet) u.getDisjointSet()) == \r\n\t\t\t\t DisjointSet.findSet((DisjointSet) v.getDisjointSet())) {\r\n\t\t\t\t\tSystem.out.println(\"The cut respects (\" + u.getNodeId() + \", \" + v.getNodeId() + \").\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void matchOnlyCurrentGraphState(TaskMonitor monitor) {\r\n\t\t// make a new list of the matched nodes, to avoid concurrent\r\n\t\t// modification problems\r\n\t\tList matchedNodes = getMatchedNodesOrdered();\r\n\r\n\t\tint total = matchedNodes.size();\r\n\t\tint count = 0;\r\n\r\n\t\tfor (Iterator nodeIt = matchedNodes.iterator(); nodeIt.hasNext();) {\r\n\t\t\tcount++;\r\n\t\t\tmonitor.report(count, total, \"Paths tested\");\r\n\t\t\tif (monitor.isCancelRequested())\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tRoadNode subNode = (RoadNode) nodeIt.next();\r\n\t\t\tif (subNode.isMatched()) {\r\n\t\t\t\tRoadNode matchNode = subNode.getMatch();\r\n\t\t\t\tNodeMatching matching = subNode.getMatching();\r\n\t\t\t\tmatchPathsFromNodes(matching);\r\n\t\t\t}\r\n\t\t}\r\n\t\tDebugFeature.saveFeatures(MATCH,\r\n\t\t\t\t\"Y:\\\\jcs\\\\testUnit\\\\roads\\\\pathMatches.jml\");\r\n\t\tDebugFeature.saveFeatures(SPLIT,\r\n\t\t\t\t\"Y:\\\\jcs\\\\testUnit\\\\roads\\\\pathSplits.jml\");\r\n\t\tDebug.println(\"paths matched = \" + pathMatchCount);\r\n\t\tDebug.println(\"splits matched = \" + splitMatchCount);\r\n\t}", "String getSourcesfromUniqueEndpoit(String graph);", "public static void main(String args[]) {\n int V = 4;\n Graph g = new Graph(V);\n g.addEdge(0, 1);\n g.addEdge(0, 2);\n g.addEdge(1, 2);\n g.addEdge(2, 0);\n g.addEdge(2, 3);\n g.addEdge(3, 3);\n\n int src = 1;\n int dest = 3;\n boolean[] visited = new boolean[V];\n\n // To store the complete path between source and destination\n Stack<Integer> path1 = new Stack<>();\n\n if (hasPathDFS(g, src, dest, visited, path1)) {\n System.out.println(\"There is a path from \" + src + \" to \" + dest);\n System.out.println(\"The complete path is \" + path1);\n } else System.out.println(\"There is no path from \" + src + \" to \" + dest);\n\n src = 3;\n dest = 1;\n // To store the complete path between source and destination\n Stack<Integer> path2 = new Stack<>();\n\n if (hasPathDFS(g, src, dest, visited, path2)) System.out.println(\"There is a path from \" + src + \" to \" + dest);\n else System.out.println(\"There is no path from \" + src + \" to \" + dest);\n\n // total number of nodes in the graph (labeled from 0 to 7)\n int n = 8;\n\n // List of graph edges as per the above diagram\n Graph g2 = new Graph(n);\n /**\n * There is a path from 1 to 3\n * The complete path is [1, 2, 3]\n * There is no path from 3 to 1\n * There is a path from 0 to 7\n * The complete path is [0, 3, 4, 6, 7]\n */\n\n g2.addEdge(0, 3);\n g2.addEdge(1, 0);\n g2.addEdge(1, 2);\n g2.addEdge(1, 4);\n g2.addEdge(2, 7);\n g2.addEdge(3, 4);\n g2.addEdge(3, 5);\n g2.addEdge(4, 3);\n g2.addEdge(4, 6);\n g2.addEdge(5, 6);\n g2.addEdge(6, 7);\n\n // source and destination vertex\n src = 0;\n dest = 7;\n\n // To store the complete path between source and destination\n Stack<Integer> path = new Stack<>();\n boolean[] visited2 = new boolean[n];\n\n if (hasPathDFS(g2, src, dest, visited2, path)) {\n System.out.println(\"There is a path from \" + src + \" to \" + dest);\n System.out.println(\"The complete path is \" + path);\n } else System.out.println(\"There is no path from \" + src + \" to \" + dest);\n\n\n }", "public static void main(String[] args) {\n Graph graph = new Graph();\n graph.addEdge(0, 1);\n graph.addEdge(0, 4);\n\n graph.addEdge(1,0);\n graph.addEdge(1,5);\n graph.addEdge(1,2);\n graph.addEdge(2,1);\n graph.addEdge(2,6);\n graph.addEdge(2,3);\n\n graph.addEdge(3,2);\n graph.addEdge(3,7);\n\n graph.addEdge(7,3);\n graph.addEdge(7,6);\n graph.addEdge(7,11);\n\n graph.addEdge(5,1);\n graph.addEdge(5,9);\n graph.addEdge(5,6);\n graph.addEdge(5,4);\n\n graph.addEdge(9,8);\n graph.addEdge(9,5);\n graph.addEdge(9,13);\n graph.addEdge(9,10);\n\n graph.addEdge(13,17);\n graph.addEdge(13,14);\n graph.addEdge(13,9);\n graph.addEdge(13,12);\n\n graph.addEdge(4,0);\n graph.addEdge(4,5);\n graph.addEdge(4,8);\n graph.addEdge(8,4);\n graph.addEdge(8,12);\n graph.addEdge(8,9);\n graph.addEdge(12,8);\n graph.addEdge(12,16);\n graph.addEdge(12,13);\n graph.addEdge(16,12);\n graph.addEdge(16,17);\n graph.addEdge(17,13);\n graph.addEdge(17,16);\n graph.addEdge(17,18);\n\n graph.addEdge(18,17);\n graph.addEdge(18,14);\n graph.addEdge(18,19);\n\n graph.addEdge(19,18);\n graph.addEdge(19,15);\n LinkedList<Integer> visited = new LinkedList();\n List<ArrayList<Integer>> paths = new ArrayList<ArrayList<Integer>>();\n int currentNode = START;\n visited.add(START);\n new searchEasy().findAllPaths(graph, visited, paths, currentNode);\n for(ArrayList<Integer> path : paths){\n for (Integer node : path) {\n System.out.print(node);\n System.out.print(\" \");\n }\n System.out.println();\n }\n }", "private GraphPath<V, E> P(\n Graph<V, E> g, GraphPath<V, E> S, GraphPath<V, E> T, V m, V b1, V b2, V b3, V s1, V s2,\n V s3)\n {\n if (s1 == b1) {\n if (b1 == m) {\n List<E> edgeList = new LinkedList<>();\n return new GraphWalk<>(g, s1, b1, edgeList, 0);\n } else\n return null;\n } else {\n if (b1 == m)\n return null;\n if (g.containsEdge(m, b2) || g.containsEdge(m, b3) || g.containsEdge(m, s2)\n || g.containsEdge(m, s3) || S == null || T == null)\n return null;\n if (S.getVertexList().stream().anyMatch(\n t -> g.containsEdge(t, b2) || g.containsEdge(t, b3) || g.containsEdge(t, s2)\n || g.containsEdge(t, s3))\n || T.getVertexList().stream().anyMatch(\n t -> t != b1 && (g.containsEdge(t, b2) || g.containsEdge(t, b3)\n || g.containsEdge(t, s2) || g.containsEdge(t, s3))))\n return null;\n List<V> intersection = intersectGraphPaths(S, T);\n if (intersection.size() != 1 || !intersection.contains(m))\n return null;\n if (S.getVertexList().stream().anyMatch(\n s -> s != m\n && T.getVertexList().stream().anyMatch(t -> t != m && g.containsEdge(s, t))))\n return null;\n List<E> edgeList = new LinkedList<>();\n edgeList.addAll(T.getEdgeList());\n edgeList.addAll(S.getEdgeList());\n double weight = edgeList.stream().mapToDouble(g::getEdgeWeight).sum();\n return new GraphWalk<>(g, b1, s1, edgeList, weight);\n\n }\n }", "private Set<Integer>[] getKernelDAG(List<Integer>[] adjacent) {\n Set<Integer>[] adjacentComponents = (HashSet<Integer>[]) new HashSet[sccCount];\n for (int i = 0; i < adjacentComponents.length; i++) {\n adjacentComponents[i] = new HashSet<>();\n }\n\n for (int vertexId = 0; vertexId < adjacent.length; vertexId++) {\n int currentComponent = sccIds[vertexId];\n\n for (int neighbor : adjacent[vertexId]) {\n if (currentComponent != sccIds[neighbor]) {\n adjacentComponents[currentComponent].add(sccIds[neighbor]);\n }\n }\n }\n return adjacentComponents;\n }", "private void buildProgramConditionListToPathList(List<ProgramCondition> progCondition, List<ProgramPath> progPath) {\n for(ProgramPath pp : progPath){\n \n //Collections.sort(pp.getConditions(),order);\n List<ProgramCondition> pcList = pp.getConditions();\n ProgramConditionToPath pcp = new ProgramConditionToPath(pcList);\n if(!progCondToPathContains(pcp))\n progCondToPath.add(pcp);\n else{\n //final ProgramConditionToPath pcp2 = pcp;\n //pcp = progCondToPath.stream().filter(p -> p.equals(pcp2)).findFirst().get();\n pcp = progCondToPathFind(pcp);\n }\n \n //pcp\n \n List<ProgramPath> temp = pcp.getPaths();\n if(!temp.contains(pp))\n temp.add(pp);\n }\n }", "private boolean discrimPaths(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node b : nodes) {\n\n //potential A and C candidate pairs are only those\n // that look like this: A<-oBo->C or A<->Bo->C\n List<Node> possAandC = graph.getNodesOutTo(b, Endpoint.ARROW);\n\n //keep arrows and circles\n List<Node> possA = new LinkedList<>(possAandC);\n possA.removeAll(graph.getNodesInTo(b, Endpoint.TAIL));\n\n //keep only circles\n List<Node> possC = new LinkedList<>(possAandC);\n possC.retainAll(graph.getNodesInTo(b, Endpoint.CIRCLE));\n\n for (Node a : possA) {\n for (Node c : possC) {\n if (!graph.isParentOf(a, c)) {\n continue;\n }\n\n LinkedList<Node> reachable = new LinkedList<>();\n reachable.add(a);\n if (reachablePathFindOrient(graph, a, b, c, reachable)) {\n return true;\n }\n }\n }\n }\n return false;\n }", "@SuppressWarnings(\"unchecked\")\n\tprivate void findSimplePaths(Integer currentVertex, Integer destinationVertex, double totalWeight, LinkedList<Integer> path, Set<Integer> allVertices, Set<Integer> visitedNodes, HashMap<LinkedList<Integer>, Double> allSimplePaths) {\n\t\tSet<DefaultEdge> connectedEdges = layout.edgesOf(currentVertex);\n\t\t// remove all of the edges that have been visited\n\t\tif (destinationVertex.equals(currentVertex)){\n\t\t\t// Completed the loop\n\t\t\tallSimplePaths.put(path, totalWeight);\n\t\t\treturn;\n\t\t}\n\t\tfor (DefaultEdge e : connectedEdges) {\n\t\t\tInteger v = layout.getEdgeTarget(e);\n\t\t\tif (!currentVertex.equals(layout.getEdgeSource(e))) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (visitedNodes.contains(v)){\n\t\t\t\tcontinue; //already visited the edge, so skip it\n\t\t\t}\n\t\t\tDefaultBlock b = (DefaultBlock)blockData.get((int)currentVertex);\n\t\t\t// if it is a switch make sure the next block is a valid move\n\t\t\t/*\n\t\t\tif (b.getClass().equals(SwitchBlock.class)){\n\t\t\t\tint [] possibleNextBlocks = ((SwitchBlock) b).getPossibleNextBlocks();\n\t\t\t\tfor (Integer i : allVertices) {\n\t\t\t\t\tif (i.equals(possibleNextBlocks[0])) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (i.equals(possibleNextBlocks[1])) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n\t\t\t// If the block is closed, it is not a path\n\t\t\tif (b.broken) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// it is part of a path\n\t\t\ttotalWeight += b.blockLength;\n\t\t\tLinkedList<Integer> pathCopy = (LinkedList<Integer>)path.clone();\n\t\t\tSet<Integer> visitedNodesCopy = new HashSet<Integer>(visitedNodes.size());\n\t\t\tvisitedNodesCopy.addAll(visitedNodes);\n\t\t\tvisitedNodesCopy.add(v);\n\t\t\tpathCopy.add(pathCopy.size(), v);\n\t\t\tfindSimplePaths(v, destinationVertex, totalWeight, pathCopy, allVertices, visitedNodesCopy, allSimplePaths);\n\t\t}\n\t}", "Dijk(){\n grp = new HashMap<>();\n seen = new HashSet<>();\n dlist = new HashMap<>();\n id = new HashMap<>();\n lowlink = new HashMap<>();\n orid = 0;\n }", "public void computeAllPaths(String source)\r\n {\r\n Vertex sourceVertex = network_topology.get(source);\r\n Vertex u,v;\r\n double distuv;\r\n\r\n Queue<Vertex> vertexQueue = new PriorityQueue<Vertex>();\r\n \r\n \r\n // Switch between methods and decide what to do\r\n if(routing_method.equals(\"SHP\"))\r\n {\r\n // SHP, weight of each edge is 1\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = u.minDistance + 1;\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n }\r\n \r\n }\r\n \r\n }\r\n \r\n else if (routing_method.equals(\"SDP\"))\r\n {\r\n // SDP, weight of each edge is it's propagation delay\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = u.minDistance + u.adjacentVertices.get(key).propDelay;\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n } \r\n }\r\n }\r\n else if (routing_method.equals(\"LLP\"))\r\n {\r\n // LLP, weight each edge is activeCircuits/AvailableCircuits\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = Math.max(u.minDistance,u.adjacentGet(key).load());\r\n //System.out.println(u.adjacentGet(key).load());\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n }\r\n }\r\n }\r\n }", "@Test\n void shortestPath() {\n directed_weighted_graph g0 = new DW_GraphDS();\n dw_graph_algorithms ag0 = new DWGraph_Algo();\n node_data n0 = new NodeData(0);\n node_data n1 = new NodeData(1);\n node_data n2 = new NodeData(2);\n node_data n3 = new NodeData(3);\n g0.addNode(n1);\n g0.addNode(n2);\n g0.addNode(n3);\n g0.connect(1, 2, 5);\n g0.connect(2, 3, 3);\n g0.connect(1, 3, 15);\n g0.connect(3, 2, 1);\n ag0.init(g0);\n\n List<node_data> list0 = ag0.shortestPath(1, 1); //should go from 1 -> 1\n int[] list0Test = {1, 1};\n int i = 0;\n for (node_data n : list0) {\n\n assertEquals(n.getKey(), list0Test[i]);\n i++;\n }\n\n List<node_data> list1 = ag0.shortestPath(1, 2); //should go 1 -> 2\n int[] list1Test = {1, 2};\n i = 0;\n for (node_data n : list1) {\n\n assertEquals(n.getKey(), list1Test[i]);\n i++;\n }\n g0.connect(1, 3, 2);\n List<node_data> list2 = ag0.shortestPath(1, 2); //should go 1 -> 3 -> 2\n int[] list2Test = {1, 3, 2};\n i = 0;\n for (node_data n : list2) {\n\n assertEquals(n.getKey(), list2Test[i]);\n i++;\n }\n\n g0.connect(1, 3, 10);\n List<node_data> list3 = ag0.shortestPath(1,3);\n int[] list3Test = {1, 2, 3};\n i = 0;\n for(node_data n: list3) {\n\n assertEquals(n.getKey(), list3Test[i]);\n i++;\n }\n/*\n\n List<node_data> list4 = ag0.shortestPath(1,4);\n int[] list4Test = {1, 4};\n i = 0;\n for(node_data n: list4) {\n\n assertEquals(n.getKey(), list4Test[i]);\n i++;\n }\n\n List<node_data> list5 = ag0.shortestPath(4,1);\n int[] list5Test = {4, 1};\n i = 0;\n for(node_data n: list5) {\n\n assertEquals(n.getKey(), list5Test[i]);\n i++;\n }\n*/\n }", "private List<List<Integer>> dfs(int[][] graph, int start, Map<Integer, List<List<Integer>>> memo) {\n if (start == graph.length - 1) {\n return Collections.singletonList(Collections.singletonList(start));\n } else {\n List<List<Integer>> cur = new ArrayList<>();\n for (int dep : graph[start]) {\n List<List<Integer>> next = dfs(graph, dep, memo);\n for (List<Integer> path : next) {\n List<Integer> temp = new ArrayList<>();\n temp.add(start);\n temp.addAll(path);\n cur.add(temp);\n }\n }\n return memo.put(start, cur);\n }\n }", "private static BigInteger connectedGraphs(\n final int v, final int e) {\n if (v == 0) {\n return ZERO;\n }\n if (v == 1) {\n // Fast exit #1: single-vertex\n return e == 0 ? ONE : ZERO;\n }\n final int allE = v * (v - 1) >> 1;\n if (e == allE) {\n // Fast exit #2: complete graph (the only result)\n return ONE;\n }\n final int key = v << 16 | e;\n if (CONN_GRAPHS_CACHE.containsKey(key)) {\n return CONN_GRAPHS_CACHE.get(key);\n }\n BigInteger result;\n if (e == v - 1) {\n // Fast exit #3: trees -> apply Cayley's formula\n result = BigInteger.valueOf(v).pow(v - 2);\n } else if (e > allE - (v - 1)) {\n // Fast exit #4: e > edges required to build a (v-1)-vertex\n // complete graph -> will definitely form connected graphs\n // in all cases, so just calculate allGraphs()\n result = allGraphs(v, e);\n } else {\n /*\n * In all other cases, we'll have to remove\n * partially-connected graphs from all graphs.\n *\n * We can define a partially-connected graph as a graph\n * with 2 sub-graphs A and B with no edges between them.\n * In addition, we require one of the sub-graphs (say, A)\n * to hold the following properties:\n * 1. A must be connected: this implies that the number\n * of possible patterns for A could be counted\n * by calling connectedGraphs().\n * 2. A must contain at least one fixed vertex:\n * this property - combined with 1. -\n * implies that A would not be over-counted.\n *\n * Under the definitions above, the number of\n * partially-connected graphs to be removed will be:\n *\n * (Combinations of vertices to be added from B to A) *\n * (number of possible A's, by connectedGraphs()) *\n * (number of possible B's, by allGraphs())\n * added up iteratively through v - 1 vertices\n * (one must be fixed in A) and all possible distributions\n * of the e edges through A and B\n */\n result = allGraphs(v, e);\n for (int vA = 1; vA < v; vA++) {\n // Combinations of vertices to be added from B to A\n final BigInteger aComb = nChooseR(v - 1, vA - 1);\n final int allEA = vA * (vA - 1) >> 1;\n // Maximum number of edges which could be added to A\n final int maxEA = allEA < e ? allEA : e;\n for (int eA = vA - 1; eA < maxEA + 1; eA++) {\n result = result.subtract(aComb\n // Number of possible A's\n .multiply(connectedGraphs(vA, eA))\n // Number of possible B's\n .multiply(allGraphs(v - vA, e - eA)));\n }\n }\n }\n CONN_GRAPHS_CACHE.put(key, result);\n return result;\n }", "private void printAllPathsUtil(Integer u, Integer d,\n boolean[] isVisited,\n ArrayList<Integer> localPathList) {\n isVisited[u] = true;\n\n if (u.equals(d))\n {\n //System.out.println(localPathList);\n FlightPath p=new FlightPath();\n\n int prev=-1;\n for(int i=0;i<localPathList.size();i++)\n {\n int no=localPathList.get(i);\n\n p.list+=\" \"+getKeyByValue(citiesMap,no);\n\n if(prev!=-1)\n for(int j=0;j<edges.size();j++)\n {\n EdgeFl g=edges.get(j);\n if(g.toString().equals(prev+\"->\"+no))\n {\n p.price+=g.price;\n break;\n }\n }\n prev=no;\n }\n\n listedPath.add(p);\n }\n\n // Recur for all the vertices\n // adjacent to current vertex\n for (Integer i : adjList[u])\n {\n if (!isVisited[i])\n {\n // store current node\n // in path[]\n localPathList.add(i);\n printAllPathsUtil(i, d, isVisited, localPathList);\n\n // remove current node\n // in path[]\n localPathList.remove(i);\n }\n }\n\n // Mark the current node\n isVisited[u] = false;\n }", "public void removeGraphCycles() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tint[] cycleCount = new int[map.size()];\r\n\t\tforComplexMotion = new boolean[map.size()];\r\n\t\t//count cycles\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tfor(int j = 0; j < map.size(); j++) {\r\n\t\t\t\tif(i != j) {\r\n\t\t\t\t\tif(graph[i][j] && graph[j][i]) {\r\n\t\t\t\t\t\tcycleCount[i]++;\r\n\t\t\t\t\t\tcycleCount[j]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//remove fobjects from linear motion planning\r\n\t\tboolean hasCycles = true;\r\n\t\twhile(hasCycles) {\r\n\t\t\tint max = 0;\r\n\t\t\tint maxIndex = -1;\r\n\t\t\tfor(int i = 0; i < cycleCount.length; i++) {\r\n\t\t\t\tif(cycleCount[i] > max) {\r\n\t\t\t\t\tmax = cycleCount[i];\r\n\t\t\t\t\tmaxIndex = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(maxIndex == -1) {\r\n\t\t\t\thasCycles = false;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcycleCount[maxIndex] = 0;\r\n\t\t\t\tforComplexMotion[maxIndex] = true;\r\n\t\t\t\tfor(int i = 0; i < cycleCount.length; i++) {\r\n\t\t\t\t\tgraph[maxIndex][i] = false;\r\n\t\t\t\t\tgraph[i][maxIndex] = false;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t}", "protected void setPerDomainPaths(Graph graph,\r\n\t\t\tLinkedHashMap<String, Graph> perDomainGraphSet) {\r\n\r\n\t\t// for each node from the global graph\r\n\t\tfor (String id : graph.nodes()) {\r\n\t\t\tString domain = getDomain(id);\r\n\t\t\tif (!perDomainGraphSet.containsKey(domain)) {\r\n\t\t\t\tperDomainGraphSet.put(domain, new Graph());\r\n\t\t\t}\r\n\t\t\t// Here we get the graph of this domain\r\n\t\t\tGraph graphDomain = perDomainGraphSet.get(domain);\r\n\t\t\ttry {\r\n\t\t\t\t// try do add the node in the graph, if it does not exist yet\r\n\t\t\t\tif (!graphDomain.nodes().contains(id)) {\r\n\t\t\t\t\tgraphDomain.addNode(id);\r\n\t\t\t\t}\r\n\t\t\t\t// try do add all the nodes that are in the same domain and\r\n\t\t\t\t// have edge with the node (id)\r\n\t\t\t\tVector<Edge> edges = graph.adjacentEdges(id);\r\n\t\t\t\t// discover all neighbors\r\n\t\t\t\tVector<String> neighbors = graph.adjacentNodes(id);\r\n\r\n\t\t\t\tfor (int i = 0; i < neighbors.size(); i++) {\r\n\t\t\t\t\t// if the neighbors is in the same domain\r\n\t\t\t\t\tif (getDomain(neighbors.get(i)).equals(domain)) {\r\n\t\t\t\t\t\t// try do add the neighbor node to domain graph\r\n\t\t\t\t\t\tif (!graphDomain.nodes().contains(neighbors.get(i))) {\r\n\t\t\t\t\t\t\tgraphDomain.addNode(neighbors.get(i));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// now, try do add the edges from node (id) and to the\r\n\t\t\t\t\t\t// neighbor\r\n\t\t\t\t\t\tfor (int j = 0; j < edges.size(); j++) {\r\n\t\t\t\t\t\t\tif (edges.get(j).getSource().equals(id)\r\n\t\t\t\t\t\t\t\t\t&& edges.get(j).getDestination()\r\n\t\t\t\t\t\t\t\t\t\t\t.equals(neighbors.get(i))) {\r\n\t\t\t\t\t\t\t\tgraphDomain.addEdge(id, neighbors.get(i), edges\r\n\t\t\t\t\t\t\t\t\t\t.get(j).getValue());\r\n\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "void findCriticalPaths()\n {\n\t\tint criticalnodes = 0;\n\t\t \t\n\t\tinputgraph.calculateEC();\n\t\tinputgraph.calculateLC();\n \t\n \tfor(Vertex v:inputgraph)\n \t{\n \t\tv.seen = false;\n \t\tv.cno = 0;\n \t\tv.parent = null;\n \t}\n \t\n \t//find critical path length\n \tSystem.out.println(inputgraph.t.ec);\n \t\n \t//find a critical path from s to t\n \tinputgraph.dfs();\n \tSystem.out.println();\n \t\n \t\n \t//get the number of vertices in critical paths\n \tfor(Vertex v:inputgraph)\n \t{\n \t\tif(v.lc == v.ec && v!=inputgraph.s && v!=inputgraph.t)\n \t\t{\n \t\t\tcriticalnodes++;\n \t\t}\n \t}\n \t\n \t//array of critical paths\n \tinputgraph.pathArray = new Vertex[criticalnodes+2];\n \t\n \t\n \tSystem.out.println();\n \tSystem.out.println(\"Task\" + \"\t\" + \"EC\" + \"\t\" + \"LC\" + \"\t\" + \"Slack\");\n \t\n \t//print the task its EC, LC and Slack values\n \tfor(Vertex v:inputgraph)\n \t{\n \t\tif(v!=inputgraph.s && v!=inputgraph.t)\n \t\t\tSystem.out.println(v + \"\t\" + v.ec + \"\t\" + v.lc + \"\t\" + v.slack);\n \t}\n \t\n \t//print the number of nodes in a critical path\n \tSystem.out.println();\n \tSystem.out.println(criticalnodes);\n \t\n \t//calculate number of critical paths\n \tinputgraph.calculateCriticalPaths();\n \tSystem.out.println(inputgraph.t.criticalpaths);\n \t\n \t//print all critical paths\n \tinputgraph.enumeratePaths(inputgraph.s,0);\n \tSystem.out.println();\n \t\n }", "private static int findConnectedComponents(Map<Integer, Set<Integer>> graph, boolean[] visited) {\n int count = 0;\n for (int u : graph.keySet()) {\n if (!visited[u]) {\n dfs(u, graph, visited);\n count++;\n }\n }\n return count;\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic Map<V, Point2D> execute(Path<V,E> S){\n\n\t\tMap<V, Point2D> ret = new HashMap<V, Point2D>();\n\n\t\t//determine position of S* vertices\n\t\t//TODO center as algorithm parameter\n\t\tPoint2D center = new Point(0,0);\n\n\t\t//convex testing returns S which is equal to S* (there are no vertices \n\t\t//in S which are not in S\n\n\t\tList<V> Svertices = S.pathVertices();\n\t\tSvertices.remove(Svertices.size() - 1);\n\t\tlog.info(\"Face vertices \" + Svertices);\n\t\tCircleLayoutCalc<V> circleCalc = new CircleLayoutCalc<V>();\n\t\tdouble radius = circleCalc.calculateRadius(Svertices, treshold);\n\t\tMap<V,Point2D> positions = circleCalc.calculatePosition(Svertices, radius, center);\n\t\tlog.info(\"Calculating positions of the outer cycle\");\n\t\tlog.info(positions);\n\t\tret.putAll(positions);\n\n\n\t\t//step one - for each vertex v of degree two not on S\n\t\t//replace v together with two edges incident to v with a \n\t\t//single edge joining the vertices adjacent to v\n\n\t\t//leave the original graph intact - make a copy to start with\n\t\tGraph<V,E> gPrim = Util.copyGraph(graph);\n\t\t//store deleted vertices in order to position them later\n\t\tMap<V, E> deletedAdjacentMap = new HashMap<V,E>();\n\n\n\t\t//once a vertex is deleted and its two edges are deleted\n\t\t//and a new one is created\n\t\t//there might be a vertex with degree 2 connected to the deleted vertex\n\t\t//we don't want to create an edge containing the deleted vertex\n\t\t//the newly created edge should be taken into account\n\n\t\tIterator<V> iter = gPrim.getVertices().iterator();\n\t\twhile (iter.hasNext()){\n\t\t\tV v = iter.next();\n\t\t\tif (!Svertices.contains(v) && gPrim.vertexDegree(v) == 2){\n\t\t\t\tlog.info(\"Deleting \" + v);\n\t\t\t\tList<E> edges = gPrim.adjacentEdges(v);\n\t\t\t\tE e1 = edges.get(0);\n\t\t\t\tE e2 = edges.get(1);\n\t\t\t\tlog.info(\"removing \" + e1);\n\t\t\t\tlog.info(\"removing \" + e2);\n\t\t\t\tgPrim.removeEdge(e1);\n\t\t\t\tgPrim.removeEdge(e2);\n\t\t\t\tV adjV1 = e1.getOrigin() == v ? e1.getDestination() : e1.getOrigin();\n\t\t\t\tV adjV2 = e2.getOrigin() == v ? e2.getDestination() : e2.getOrigin();\n\t\t\t\tE newEdge = Util.createEdge(adjV1, adjV2, edgeClass);\n\t\t\t\tlog.info(\"Creating \" + newEdge);\n\t\t\t\tgPrim.addEdge(newEdge);\n\t\t\t\tdeletedAdjacentMap.put(v,newEdge);\n\t\t\t}\n\t\t}\n\n\t\tfor (V v : deletedAdjacentMap.keySet()){\n\t\t\tgPrim.removeVertex(v);\n\t\t}\n\n\n\t\tlog.info(\"G': \" + gPrim);\n\t\t//step 2 - call Draw on (G', S, S*) to extend S* into a convex drawing of G'\n\t\tdraw(gPrim, S.getPath(), Svertices, ret);\n\n\t\t//step 3 For each deleted vertex of degree 2 determine its position on the straight \n\t\t//line segment joining the two vertices adjacent to the vertex\n\n\t\tSet<V> deletedVertices = deletedAdjacentMap.keySet();\n\t\tList<V> coveredVertices = new ArrayList<V>();\n\n\t\tlog.info(\"deleted vertices: \" + deletedVertices);\n\n\t\tfor (V v : deletedVertices){\n\n\t\t\tif (coveredVertices.contains(v))\n\t\t\t\tcontinue;\n\n\t\t\tE addedEdge = deletedAdjacentMap.get(v);\n\t\t\tV firstAdjacent = addedEdge.getOrigin();\n\t\t\tV secondAdjacent = addedEdge.getDestination();\n\t\t\tPoint2D pos1 = ret.get(firstAdjacent);\n\t\t\tPoint2D pos2 = ret.get(secondAdjacent);\n\t\t\tif (pos1 != null && pos2 != null){\n\t\t\t\t//find deleted vertices on this line\n\n\t\t\t\tList<E> adjacentEdges = graph.adjacentEdges(v);\n\t\t\t\tE e1 = adjacentEdges.get(0);\n\t\t\t\tE e2 = adjacentEdges.get(1);\n\t\t\t\tV e1Next = e1.getOrigin() == v ? e1.getDestination() : e1.getOrigin();\n\t\t\t\tV e2Next = e2.getOrigin() == v ? e2.getDestination() : e2.getOrigin();\n\n\t\t\t\tif ((e1Next == firstAdjacent && e2Next == secondAdjacent) ||\n\t\t\t\t\t\t(e2Next == firstAdjacent && e1Next == secondAdjacent)){\n\n\t\t\t\t\t//just one vertex between two known\n\n\t\t\t\t\tdouble xPos = ret.get(e1Next).getX() + ((ret.get(e2Next).getX() - ret.get(e1Next).getX()) / 2);\n\t\t\t\t\tdouble yPos = ret.get(e1Next).getY() + ((ret.get(e2Next).getY() - ret.get(e1Next).getY()) / 2);\n\t\t\t\t\tret.put(v, new Point2D.Double(xPos, yPos));\n\t\t\t\t}\n\t\t\t\telse{\n\n\t\t\t\t\tList<V> verticesOnLine = new ArrayList<V>();\n\t\t\t\t\tverticesOnLine.add(v);\n\n\t\t\t\t\t//in all probability, traversing e1 is enough as the\n\t\t\t\t\t//vertex won't be somewhere in the middle, but directly \n\t\t\t\t\t//connected to one of the vertices whose positions are known\n\t\t\t\t\t//keep both for now\n\t\t\t\t\t//traverse e1\n\t\t\t\t\tE currentE = e1;\n\t\t\t\t\tint numberThroughE1 = 0;\n\t\t\t\t\twhile (e1Next != firstAdjacent && e1Next != secondAdjacent){\n\t\t\t\t\t\tif (!verticesOnLine.contains(e1Next)){\n\t\t\t\t\t\t\tverticesOnLine.add(e1Next);\n\t\t\t\t\t\t\tnumberThroughE1++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tList<E> currentAdjacent = graph.adjacentEdges(e1Next);\n\t\t\t\t\t\tif (currentAdjacent.get(0) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(1);\n\t\t\t\t\t\telse if (currentAdjacent.get(1) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(0);\n\n\t\t\t\t\t\te1Next = currentE.getOrigin() == e1Next ? currentE.getDestination() : currentE.getOrigin();\n\t\t\t\t\t}\n\n\n\t\t\t\t\t//traverse e2\n\t\t\t\t\tcurrentE = e2;\n\t\t\t\t\twhile (e2Next != firstAdjacent && e2Next != secondAdjacent){\n\t\t\t\t\t\tif (!verticesOnLine.contains(e2Next))\n\t\t\t\t\t\t\tverticesOnLine.add(e2Next);\n\n\t\t\t\t\t\tList<E> currentAdjacent = graph.adjacentEdges(e2Next);\n\t\t\t\t\t\tif (currentAdjacent.get(0) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(1);\n\t\t\t\t\t\telse if (currentAdjacent.get(1) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(0);\n\n\t\t\t\t\t\te2Next = currentE.getOrigin() == e2Next ? currentE.getDestination() : currentE.getOrigin();\n\t\t\t\t\t}\n\n\t\t\t\t\tlog.info(\"vertices on line: \" + verticesOnLine);\n\t\t\t\t\tcoveredVertices.addAll(verticesOnLine);\n\n\t\t\t\t\tint numberOfVerticesOnLine = verticesOnLine.size();\n\t\t\t\t\tdouble incrementX = (ret.get(e2Next).getX() - ret.get(e1Next).getX()) / (numberOfVerticesOnLine + 1);\n\t\t\t\t\tdouble incrementY = (ret.get(e2Next).getY() - ret.get(e1Next).getY()) / (numberOfVerticesOnLine + 1);\n\n\t\t\t\t\tPoint2D currentPosition = ret.get(e1Next); //e1Next holds a vertex whose position is known\n\n\t\t\t\t\tfor (int i = numberThroughE1; i >= 0; i--){\n\t\t\t\t\t\tV currentV = verticesOnLine.get(i);\n\t\t\t\t\t\tPoint2D position = new Point2D.Double(currentPosition.getX() + incrementX, currentPosition.getY() + incrementY);\n\t\t\t\t\t\tret.put(currentV, position);\n\t\t\t\t\t\tcurrentPosition = position;\n\t\t\t\t\t}\n\n\n\t\t\t\t\tfor (int i = numberThroughE1 + 1; i< numberOfVerticesOnLine; i++){\n\t\t\t\t\t\tV currentV = verticesOnLine.get(i);\n\t\t\t\t\t\tPoint2D position = new Point2D.Double(currentPosition.getX() + incrementX, currentPosition.getY() + incrementY);\n\t\t\t\t\t\tret.put(currentV, position);\n\t\t\t\t\t\tcurrentPosition = position;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn ret;\n\t}", "protected void addEdges(IWeightedGraph<GraphNode, WeightedEdge> graph) {\r\n\t\tQueue<GraphNode> nodesToWorkOn = new LinkedList<GraphNode>();\r\n\r\n\t\taddDefaultEdges(graph, nodesToWorkOn);\r\n\r\n\t\t// Check each already connected once node against all other nodes to\r\n\t\t// find a possible match between the combined effects of the path + the\r\n\t\t// worldState and the preconditions of the current node.\r\n\t\twhile (!nodesToWorkOn.isEmpty()) {\r\n\t\t\tGraphNode node = nodesToWorkOn.poll();\r\n\r\n\t\t\t// Select only node to which a path can be created (-> targets!)\r\n\t\t\tif (!node.equals(this.startNode) && !this.endNodes.contains(node)) {\r\n\t\t\t\ttryToConnectNode(graph, node, nodesToWorkOn);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private Iterable<V> reconstructPath(V last, V from, HashMap<V, V> previous){\n LinkedList<V> ret = new LinkedList<>();\n ret.addFirst(last);\n while (!last.equals(from)){\n V prev = previous.get(last);\n ret.addFirst(prev);\n last = prev;\n }\n return ret;\n }", "public void dfs(LinkedList<Node>[] adjList){\n Set<Integer> visited = new HashSet<>();\n\n for(LinkedList<Node> node: adjList){\n Node curr = node.getFirst();\n if(!visited.contains(curr)){\n ArrayList<Integer> components = new ArrayList<>();\n components = getConnectedComponets(curr, visited, components);\n System.out.printf(\"do something %s\", components.toString());\n }\n }\n }", "public interface PathExistsInGraph {\n\n boolean validPath(int n, int[][] edges, int start, int end);\n\n default Map<Integer, Set<Integer>> prepareGraph(final int n, final int[][] edges) {\n Map<Integer, Set<Integer>> graph = new HashMap<>();\n for (int i = 0; i < n; i++) {\n graph.put(i, new HashSet<>());\n }\n for (int[] edge : edges) {\n graph.get(edge[0]).add(edge[1]);\n graph.get(edge[1]).add(edge[0]);\n }\n return graph;\n }\n}", "private String topologicalSortDfs(int indegree[], HashMap<Character, Set<Character>> adjList){\n \n // we ll use stringbuilder to update the characters instead of string\n // we ll insert all elements into queue who has indegree==0 initially, which means they dont have any dependency so they can come at any time//\n // so insert all indgree==0 into queu and do a stanmdard queue template\n StringBuilder sb = new StringBuilder();\n Queue<Character> q = new LinkedList();\n int totalChars = adjList.size(); // to check at end if all are present\n \n \n // loop thru all keys in graph and check the indegree of that character in indegree if its has zero , if so then add to queue initially\n // initial push to queue\n for(char c: adjList.keySet()){\n if(indegree[c-'a'] == 0){\n \n sb.append(c);\n q.offer(c);// so u need to add all orphan nodes to sb , since it contains results\n }\n \n } \n // now we need to find nodes which has dependency, take it out and reduce the indegree and check if indegreeis zero then add tio queue\n \n // stand ard queue template\n while(!q.isEmpty()){\n // take the elemnt \n char curr = q.poll();\n \n if(adjList.get(curr) == null || adjList.get(curr).size()==0 ){\n // we shud not do antthing, and pick the next nodes in the queue\n continue;\n }\n // if we have some elements in the adj list which means we have a dependency\n // So what do we do here:??\n // i think we can take it and reduce the indgree ??\n // Since we are. removing this particular current element, so we need to reduce all its neighbour indegree becios we removed aos we need to update the indegree of all its neiughbours\n for(char neighbour : adjList.get(curr)){\n indegree[neighbour-'a']--;\n //also check if it becomes zero after update we need to push to queu and sb\n if(indegree[neighbour-'a'] == 0){\n //add to q and sb\n q.offer(neighbour);\n sb.append(neighbour);\n \n }\n }\n \n }\n \n // once we are out of queue, which means we processed all nodes\n // if total chars is sb length, which means we got all chars /nodes so we can return else \"\"\n return sb.length() == totalChars ? sb.toString() : \"\";\n }", "@Test\n public void cyclicalGraphs2Test() throws Exception {\n // Test history tracking -- the \"last a\" in g1 and g2 below and\n // different kinds of nodes topologically. At k=4 this becomes apparent\n // with kTails, if we start at the first 'a'.\n\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"b\",\n \"c\", \"d\" });\n // Create a loop in g1, with 4 nodes\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(3), Event.defTimeRelationStr);\n g1Nodes.get(3).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g1, 0);\n\n // g1.a is k-equivalent to g1.a for all k\n for (int k = 1; k < 6; k++) {\n testKEqual(g1Nodes.get(0), g1Nodes.get(0), k);\n }\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"a\" });\n // Create a chain from a to a'.\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(2), Event.defTimeRelationStr);\n g2Nodes.get(2).addTransition(g2Nodes.get(3), Event.defTimeRelationStr);\n g2Nodes.get(3).addTransition(g2Nodes.get(4), Event.defTimeRelationStr);\n exportTestGraph(g2, 1);\n\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 1);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 2);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 3);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 4);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 5);\n\n testNotKEqual(g1Nodes.get(0), g2Nodes.get(0), 6);\n testNotKEqual(g1Nodes.get(0), g2Nodes.get(0), 7);\n }", "void leastCostPaths() {\t\n\t\tfor( int k = 0; k < N; k++ )\n\t\t\tfor( int i = 0; i < N; i++ )\n\t\t\t\tif( defined[i][k] )\n\t\t\t\t\tfor( int j = 0; j < N; j++ )\n\t\t\t\t\t\tif( defined[k][j]\n\t\t\t\t\t\t\t\t&& (!defined[i][j] || c[i][j] > c[i][k]+c[k][j]) ) {\t\n\t\t\t\t\t\t\tpath[i][j] = path[i][k];\n\t\t\t\t\t\t\tc[i][j] = c[i][k]+c[k][j];\n\t\t\t\t\t\t\tdefined[i][j] = true;\n\t\t\t\t\t\t\tif( i == j && c[i][j] < 0 ) return; // stop on negative cycle\n\t\t\t\t\t\t}\n\t}", "public void generateGraph() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tgraph = new boolean[map.size()][map.size()];\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tMovingFObject cloned = map.get(i).duplicate();\r\n\t\t\tArrayList<Location> locs = sc.traceLinearMotion(i,sc.getMaxVelocity(),cloned.getGoal());\r\n\t\t\tfor(int j = 0; j < map.size(); j++) {\r\n\t\t\t\tif(j != i) {\r\n\t\t\t\t\tfor(int k = 0; k < locs.size(); k++) {\r\n\t\t\t\t\t\tcloned.setLocation(locs.get(k));\r\n\t\t\t\t\t\tif(cloned.locationTouchingLocation(1, map.get(j), 2)) {\r\n\t\t\t\t\t\t\tgraph[i][j] = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(cloned.locationTouchingLocation(1, map.get(j), 0)) {\r\n\t\t\t\t\t\t\tgraph[j][i] = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void dfs(int[][] graph, int u) {\n int degree = 0;\n int v = -1;\n int anyv = -1;\n for (int col=0; col<n; col++){\n if (graph[u][col]!=1){\n continue;\n }\n if (isBridge(graph, u, col)){\n anyv=col;\n continue;\n }\n v=col;\n break;\n }\n //no edge anymore\n if (v==-1){\n //last edge.\n v = anyv;\n }\n if (v==-1){\n return;\n }\n\n //remove edge u->v\n graph[u][v]=0;\n graph[v][u]=0;\n path.add(String.format(\"%d->%d\", u, v));\n dfs(graph, v);\n }", "Set<Set<V>> routine3(Graph<V, E> g)\n {\n Set<Set<V>> NuvList = new HashSet<>();\n for (V u : g.vertexSet()) {\n for (V v : g.vertexSet()) {\n if (u == v || !g.containsEdge(u, v))\n continue;\n NuvList.add(N(g, u, v));\n }\n }\n\n Set<Set<V>> tripleList = new HashSet<>();\n for (V a : g.vertexSet()) {\n for (V b : g.vertexSet()) {\n if (a == b || g.containsEdge(a, b))\n continue;\n Set<V> Nab = N(g, a, b);\n for (V c : g.vertexSet()) {\n if (isTripleRelevant(g, a, b, c)) {\n tripleList.add(X(g, Nab, c));\n }\n }\n }\n }\n Set<Set<V>> res = new HashSet<>();\n for (Set<V> Nuv : NuvList) {\n for (Set<V> triple : tripleList) {\n Set<V> temp = new HashSet<>();\n temp.addAll(Nuv);\n temp.addAll(triple);\n res.add(temp);\n }\n }\n return res;\n }", "public Map<String, List<Pair<String, String>>> getControlAndDataFlowPairs(GraphNode root, List<String> graphNodeIdList){\n\n this.getControlFlow(root);\n\n List<Pair<String, String>> controlFlowAndDataFlowPairs = new ArrayList<>(this.controlFlowPairs);\n controlFlowAndDataFlowPairs.retainAll(this.dataFlowPairs);\n\n this.controlFlowPairs.removeAll(controlFlowAndDataFlowPairs);\n\n this.dataFlowPairs.removeAll(controlFlowAndDataFlowPairs);\n\n // 删除不存在的数据流边(这种情况出现在:变量被定义的结点存在,但是使用变量的结点因为无法解析等原因而不存在)\n this.dataFlowPairs.removeIf(pair -> !graphNodeIdList.contains(pair.a) || !graphNodeIdList.contains(pair.b));\n\n Map<String, List<Pair<String, String>>> result = new HashMap<>();\n result.put(\"d\", this.dataFlowPairs);\n result.put(\"c\", this.controlFlowPairs);\n result.put(\"cd\", controlFlowAndDataFlowPairs);\n\n return result;\n }", "public void minimize() {\n D = new boolean[states.length][states.length];\r\n S = new ArrayList<ArrayList<HashSet<Point>>>(); // lol\r\n\r\n //noinspection ForLoopReplaceableByForEach\r\n for (int i = 0; i < states.length; i++) {\r\n ArrayList<HashSet<Point>> innerList = new ArrayList<HashSet<Point>>();\r\n\r\n //noinspection ForLoopReplaceableByForEach\r\n for (int j = 0; j < states.length; j++) {\r\n Arrays.fill(D[i], false);\r\n innerList.add(new HashSet<Point>());\r\n }\r\n S.add(innerList);\r\n }\r\n\r\n // 2. states with different acceptances are distinguishable\r\n for (int i = 0; i < states.length; i++) {\r\n for (int j = i + 1; j < states.length; j++) {\r\n if (acceptStates.contains(i) != acceptStates.contains(j)) {\r\n D[i][j] = true;\r\n }\r\n }\r\n }\r\n\r\n // 3. mark as possibly indistinguishable, enforce distinguishability\r\n for (int i = 0; i < states.length; i++) {\r\n for (int j = i + 1; j < states.length; j++) {\r\n // only pairs that are as of yet indistinguishable\r\n if (D[i][j]) {\r\n continue;\r\n }\r\n\r\n DFAState qi = states[i];\r\n DFAState qj = states[j];\r\n\r\n // one of the things being compared is unreachable\r\n if (qi == null || qj == null) {\r\n continue;\r\n }\r\n\r\n // helps emulate \"for any\"\r\n boolean distinguished = false;\r\n for (int k = 0; k < qi.transitions.size(); k++) {\r\n int m = qi.transitions.get(k);\r\n int n = qj.transitions.get(k);\r\n\r\n // if on the same letter, qm and qn move to distinguishable states\r\n if (D[m][n] || D[n][m]) {\r\n dist(i, j);\r\n distinguished = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!distinguished) {\r\n // qm and qn are indistinguishable\r\n for (int k = 0; k < qi.transitions.size(); k++) {\r\n int m = qi.transitions.get(k);\r\n int n = qj.transitions.get(k);\r\n\r\n if (m < n && !(i == m && j == n)) {\r\n S.get(m).get(n).add(new Point(i, j));\r\n } else if (m > n && !(i == n && j == m)) {\r\n S.get(n).get(m).add(new Point(i, j));\r\n }\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n mergeStates();\r\n }", "private Set<Edge> reachableDAG(Vertex start, Vertex obstacle) {\n \tHashSet<Edge> result = new HashSet<Edge>();\n \tVector<Vertex> currentVertexes = new Vector<Vertex>();\n \tint lastResultNumber = 0;\n \tcurrentVertexes.add(start);\n \t\n \tdo {\n \t\t//System.out.println(\"size of currentVertexes:\" + currentVertexes.size());\n \t\t\n \t\tVector<Vertex> newVertexes = new Vector<Vertex>();\n \t\tlastResultNumber = result.size();\n \t\t\n \t\tfor (Vertex v : currentVertexes) {\n \t\t\t//System.out.println(\"layerID:\" + v.layerID + \"\\tlabel:\" + v.label);\n \t\t\taddIncomingEdges(v, obstacle, result, newVertexes);\n \t\t\taddOutgoingEdges(v, obstacle, result, newVertexes);\n \t\t}\n \t\t\n \t\t//System.out.println(\"size of newVertexes:\" + newVertexes.size());\n \t\t\n \t\tcurrentVertexes = newVertexes;\t\n \t\t//System.out.println(\"lastResultNumber:\" + lastResultNumber);\n \t\t//System.out.println(\"result.size():\" + result.size());\n \t} while (lastResultNumber != result.size());\n \t\n\t\treturn result;\n }", "public static ArrayList<PathEdge> kruskals(Graph g) {\n Set<Vertex> setVertexes = new HashSet<Vertex>(g.getVertexes());\n\t\tDisjointSets<Vertex> ds = new DisjointSets<Vertex>(setVertexes);\n\n PriorityQueue<PathEdge> pq = new PriorityQueue<PathEdge>();\n ArrayList<PathEdge> mst = new ArrayList<PathEdge>();\n for (PathEdge e : g.getEdges()) {\n pq.add(e);\n }\n\t\tSystem.out.println(\"value of pq\"+pq);\n\n while (!pq.isEmpty() && mst.size() < g.getVertexes().size() - 1) {\n PathEdge e = pq.poll();\n Vertex v = e.getSource();\n Vertex u = e.getDestination();\n if (!ds.sameSet(u, v)) {\n ds.merge(v, u);\n mst.add(e);\n }\n if(g.getVertexes().size()-1 == mst.size()){\n return mst;\n }\n }\n return null;\n }", "NBLK(int[][] origMap) {\r\n\r\n\t\t\r\n\t\t// suppose it's a matrix for numberlink\r\n\t\tn_row = origMap.length;\r\n\t\tn_col = origMap[0].length;\r\n\t\tlength = n_row * n_col;\r\n\t\tadjaMatrix=new int[length][length];\r\n\t\tStartPoint=new HashMap<Integer, Node>();\r\n\t\tEndPoint=new HashMap<Integer, Node>();\r\n\t\tnowMap= new HashMap<Integer,LinkedList<Integer>>();\r\n\t\t\r\n\t\tpaths=new HashMap<Integer, Stack<Node>>();\r\n\t\tallNodes= new HashMap<Integer,Node>();\r\n\t\t\r\n\t\t\r\n\t\tlastPath=0;\r\n\t\t\r\n\t\tcount=0;\r\n\t\tfor (int i = 0; i < n_row; i++) {\r\n\t\t\tfor (int j = 0; j < n_col; j++) {\r\n\t\t\t\tif (origMap[i][j] > -1) {\r\n\t\t\t\t\t//we can use that point to represent a blocked point (i,j) as matrix[i][j]=-1\r\n\t\t\t\t\tint index = i * n_col + j;\r\n\t\t\t\t\tNode n = new Node(i, j, index, origMap[i][j]);\r\n\t\t\t\t\tallNodes.put(index, n);\r\n\t\t\t\t\tLinkedList<Integer> neibors = new LinkedList<Integer>();\r\n\r\n\t\t\t\t\tif (i > 0 && origMap[i-1][j] > -1) {\r\n\t\t\t\t\t\t//left\r\n\t\t\t\t\t\tadjaMatrix[index][(i - 1) * n_col + j] = 1;\r\n\t\t\t\t\t\tadjaMatrix[(i - 1) * n_col + j][index] = 1;\r\n\t\t\t\t\t\tneibors.addLast((i - 1) * n_col + j);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (i < n_row - 1 && origMap[i+1][j] > -1) {\r\n\t\t\t\t\t\t//right\r\n\t\t\t\t\t\tadjaMatrix[index][(i + 1) * n_col + j] = 1;\r\n\t\t\t\t\t\tadjaMatrix[(i + 1) * n_col + j][index] = 1;\r\n\t\t\t\t\t\tneibors.addLast((i + 1) * n_col + j);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (j > 0 && origMap[i][j-1] > -1) {\r\n\t\t\t\t\t\t//top\r\n\t\t\t\t\t\tadjaMatrix[index][i * n_col + j - 1] = 1;\r\n\t\t\t\t\t\tadjaMatrix[i * n_col + j - 1][index] = 1;\r\n\t\t\t\t\t\tneibors.addLast(i * n_col + j - 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (j < n_col - 1 && origMap[i][j+1] > -1) {\r\n\t\t\t\t\t\t//bottom\r\n\t\t\t\t\t\tadjaMatrix[index][i * n_col + j + 1] = 1;\r\n\t\t\t\t\t\tadjaMatrix[i * n_col + j + 1][index] = 1;\r\n\t\t\t\t\t\tneibors.addLast(i * n_col + j + 1);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tnowMap.put(index, neibors);\r\n\t\t\t\t\tif (origMap[i][j] > 0) {\r\n\r\n\t\t\t\t\t\tif (!StartPoint.containsKey(origMap[i][j])) {\r\n\t\t\t\t\t\t\tStartPoint.put(origMap[i][j], n);\r\n\t\t\t\t\t\t\tStack<Node> tp = new Stack<Node>();\r\n\t\t\t\t\t\t\ttp.push(n);\r\n\t\t\t\t\t\t\tpaths.put(origMap[i][j], tp);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tEndPoint.put(origMap[i][j], n);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "public static Map<Connector, AssignmentAction> getAssignmentActions(Component c, Variable v) {\n\t\tMap<Connector, AssignmentAction> mapConnAction = new HashMap<Connector, AssignmentAction>();\n\t\tfor(Connector connector: c.getCompoundType().getConnector()) {\n\t\t\tif(connector.getType().getInteractionSpecification().size() == 0) continue;\n\t\t\t\n\t\t\tInteractionSpecification interactionSpec = connector.getType().getInteractionSpecification().get(0);\n\t\t\tMap<DataReference, AssignmentAction> mapDataRefAction = getAssignedDataReferences(interactionSpec.getDownAction());\n\t\t\tfor(DataReference dr : mapDataRefAction.keySet()) {\n\t\t\t\tRequiredDataParameterReference rdpr = (RequiredDataParameterReference) dr;\n\t\t\t\tMap<Variable,Component> mapVarComp = getVariable(connector, rdpr);\n\t\t\t\tif(mapVarComp.containsKey(v) && mapVarComp.get(v).equals(c)) {\n\t\t\t\t\tmapConnAction.put(connector, mapDataRefAction.get(dr));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn mapConnAction; \n\t}", "public ShortestPathMatrix<V,E> allPairsShortestPaths();", "public static Integer[] findP4SObs (Graph<Integer,String> g){\n\t\tfor (Integer a : g.getVertices()) {\r\n\t\t\tfor (Integer b: g.getNeighbors(a)) {\r\n\t\t\t\tfor (Integer c: g.getNeighbors(b)) {\r\n\t\t\t\t\tif (c == a || g.isNeighbor(a, c)) continue;\r\n\t\t\t\t\tfor (Integer d : g.getNeighbors(c)) {\r\n\t\t\t\t\t\tif (d == b || g.isNeighbor(b, d) || g.isNeighbor(a, d)) continue;\r\n\t\t\t\t\t\t// now a-b-c-d induce a P4. Find a 5th vertex\r\n\t\t\t\t\t\tfor (Integer x : g.getNeighbors(d)) {\r\n\t\t\t\t\t\t\tif (x == c) continue;\r\n\t\t\t\t\t\t\tif (g.isNeighbor(x,a)) {\r\n\t\t\t\t\t\t\t\tif (!g.isNeighbor(x, b) && !g.isNeighbor(x,c)) {\r\n\t\t\t\t\t\t\t\t\t// have a C5 = abcdx\r\n\t\t\t\t\t\t\t\t\tInteger[] cycle = {a,b,c,d,x};\r\n\t\t\t\t\t\t\t\t\treturn cycle;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t// here, abcd = P4 and x is adj to d and non-adj to a\r\n\t\t\t\t\t\t\t\t// and combination of adjacencies of x to b,c gives obstruction\r\n\t\t\t\t\t\t\t\tInteger[] obstruction = {a,b,c,d,x};\r\n\t\t\t\t\t\t\t\treturn obstruction;\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn null;\r\n\t}", "public static void pseudoTrueTuples(LogicProblem logicProblem, boolean applyChanges)\r\n throws RelationshipConflictException {\n \r\n HashMap<ItemPair,Relationship> relationshipTable = logicProblem.getRelationshipTable();\r\n HashSet<CategoryPair> categoryPairs = logicProblem.getCategoryPairs();\r\n \r\n// System.out.println(\"searching...\");\r\n //within a subgrid\r\n for (CategoryPair categoryPair : categoryPairs) {\r\n// System.out.println(\"Category pair:\" + categoryPair);\r\n //vertical and horizontal search\r\n for (final boolean verticalOrientation : new boolean[] { false, true } ) {\r\n\r\n Category subrowCategory = verticalOrientation?categoryPair.first():categoryPair.last();\r\n Category subcolumnCategory = verticalOrientation?categoryPair.last():categoryPair.first();\r\n\r\n //commenting \"vertical search\" \r\n //(subrows match first category's items\r\n // subcolumns match second category's items)\r\n\r\n //i (2 to floor(n/2)) is the number of elements in the combination tuple\r\n // i=2 in pseudoTrue pairs\r\n //(for subgrids of 5x5 items, looking for both pairs and triplets becomes redundant\r\n for (int i=2; i<=floor(logicProblem.getNumCategories()/2);i++) {\r\n\r\n //https://github.com/dpaukov/combinatoricslib3/wiki/v3.3.0#1-simple-combinations\r\n List<List<Item>> columnCombinations = Generator.combination(subcolumnCategory.getItems())\r\n .simple(i) //for pseudo true pairs, i=2\r\n .stream()\r\n .collect(Collectors.<List<Item>>toList());\r\n //for i=2, this would contain \r\n //Bethany, Donovan\r\n //Bethany, Elizabeth\r\n //...\r\n //Frederick, Peyton\r\n// columnCombinations.stream().forEach(l -> System.out.println(\r\n// (verticalOrientation?\"vertical\":\"horizontal\")+ \" combo: \"+l.toString()));\r\n\r\n //create the sets\r\n //for each combination, start over\r\n \r\n //columnTuple contains i items with which we will compute set intersections\r\n for (List<Item> columnItemTuple : columnCombinations) {\r\n //Bethany, Donovan\r\n \r\n //similarly, valueNoSets contains i sets of VALUE_NO relationships\r\n List<Set<Item>> valueNoSets = new ArrayList<>(); //size=i\r\n //build a set for each i item of columnTuple\r\n for (Item columnItem : columnItemTuple) {\r\n //Bethany\r\n Set<Item> valueNoSet = new HashSet<>(); //size = n\r\n for (Item rowItem : subrowCategory.getItems()) {\r\n //Haley's Comet ....\r\n if (relationshipTable.get(new ItemPair(rowItem, columnItem)).getValue() == Relationship.ValueType.VALUE_NO)\r\n //stacking all VALUE_NO relationship into vertical set\r\n valueNoSet.add(rowItem); //store into single subcolumn set \r\n }\r\n //adding each vertical set into list of sets\r\n if (valueNoSet.size() >= logicProblem.getNumItems() - i //for pairs, we need three VALUE_NO in the set\r\n && valueNoSet.size() < logicProblem.getNumItems()-1) //uniqueness will take or n-1 cases\r\n valueNoSets.add(valueNoSet); //store single subcolumn into multi-set\r\n }\r\n //magic!\r\n Set<Item> intersectionSet = new HashSet<>(); //avoid NPE when the next call is made\r\n if (valueNoSets.size()>=2) //don't compute intersections otherwise\r\n intersectionSet = Processor.multiSetIntersection(valueNoSets);\r\n\r\n if (intersectionSet.size()==logicProblem.getNumItems()-i) {\r\n \r\n// System.out.println(\"----> found candidates for pseudo true pairs!\");\r\n// intersectionSet.stream().forEach(l -> System.out.println(\"\\t\" + l.toString()));\r\n// System.out.println(\"\\t\\tvs.\");\r\n// columnItemTuple.stream().forEach(l -> System.out.println(\"\\t\" + l.toString()));\r\n \r\n //create predecessor list\r\n //we can only add the intersection output as predecessors\r\n ArrayList<Dependable> predecessors = new ArrayList<Dependable>();\r\n for (Item intersectionColumn : intersectionSet) {\r\n for (Item rowItem : columnItemTuple) {\r\n predecessors.add(relationshipTable.get(new ItemPair(rowItem, intersectionColumn)));\r\n }\r\n }\r\n\r\n\r\n //we have a bunch of work to do\r\n for (Item everyRowItem : subrowCategory.getItems()) {\r\n //for every row item not in the intersectionSet\r\n if (!intersectionSet.contains(everyRowItem)) {\r\n for (Item everyColumnItem : subcolumnCategory.getItems()) {\r\n //for every column item not in any of the columnTuple list\r\n if (!columnItemTuple.contains(everyColumnItem)) {\r\n Relationship rel = relationshipTable.get(new ItemPair(everyRowItem,everyColumnItem));\r\n if (rel.getValue()!=Relationship.ValueType.VALUE_NO)\r\n Processor.setRelationship(logicProblem, applyChanges, rel, \r\n Relationship.ValueType.VALUE_NO, Relationship.LogicType.PSEUDOTRUE,\r\n predecessors.toArray(new Relationship[predecessors.size()])); \r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "public void setPathsCombine(Map<Integer, ArrayList<ASNode>> paths) {\n\t\tfor (int currASnum : paths.keySet()) {\n\t\t\tif (this.paths.containsKey(currASnum)) {\n\t\t\t\tif (paths.get(currASnum).size() < this.paths.get(currASnum)\n\t\t\t\t\t\t.size()) {\n\n\t\t\t\t\tif (!paths.get(currASnum).contains(currASnum)) {\n\t\t\t\t\t\tthis.paths.put(currASnum, paths.get(currASnum));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (currASnum != ASNum) {\n\t\t\t\t\tthis.paths.put(currASnum, paths.get(currASnum));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void setGraphParameters()\r\n\t{\r\n\r\n\t\tlogger.info(\"Setting graph parameters.\");\r\n\t\tlogger.info(\"Treating the graph as undirected.\");\r\n\r\n\t\t// Diameter is the maximum of all shortest path lengths\r\n\t\t// Average shortest path length is (as the name says) the average of the\r\n\t\t// shortest path length between all node pairs\r\n\r\n\t\tdouble maxPathLength = 0.0;\r\n\t\tdouble shortestPathLengthSum = 0.0;\r\n\t\tdouble degreeSum = 0.0;\r\n\t\tdouble clusterCoefficientSum = 0.0;\r\n\r\n\t\t// iterate over all node pairs\r\n\t\tCollection<Entity> nodes = undirectedGraph.getVertices();\r\n\r\n\t\t// a hashset of the nodes which have been the start node of the\r\n\t\t// computation process\r\n\t\t// for such nodes all path lengths have been already computed\r\n\t\tSet<Entity> wasSource = new HashSet<Entity>();\r\n\r\n\t\tint progress = 0;\r\n\t\tfor (Entity node : nodes) {\r\n\r\n\t\t\tprogress++;\r\n\t\t\tLoggingUtils.printProgressInfo(progress, nodes.size(), 100,\r\n\t\t\t\t\tLoggingUtils.ProgressInfoMode.TEXT,\r\n\t\t\t\t\t\"Getting graph parameters\");\r\n\r\n\t\t\tint nodeDegree = getDegree(node);\r\n\t\t\t// degreeSum += nodeDegree;\r\n\r\n\t\t\t// logger.info(\"Updating degree distribution.\");\r\n\t\t\t// updateDegreeDistribution(nodeDegree);\r\n\r\n\t\t\t// cluster coefficient C_v of a node v is the fraction of the\r\n\t\t\t// connections that exist between the\r\n\t\t\t// neighbor nodes (k_v) of this node and all allowable connections\r\n\t\t\t// between the neighbors (k_v(k_v -1)/2)\r\n\t\t\t// for degrees 0 or 1 there is no cluster coefficient, as there can\r\n\t\t\t// be no connections between neighbors\r\n\t\t\tif (nodeDegree > 1) {\r\n\t\t\t\tdouble numberOfNeighborConnections = getNumberOfNeighborConnections(node);\r\n\t\t\t\tclusterCoefficientSum += (numberOfNeighborConnections / (nodeDegree * (nodeDegree - 1)));\r\n\t\t\t}\r\n\r\n\t\t\t// Returns the new shortestPathLengthSum and the new maxPathLength.\r\n\t\t\t// They are returned as an double array for performance reasons.\r\n\t\t\t// I do not want to create an object, as this function is called\r\n\t\t\t// *very* often\r\n\t\t\t// logger.info(\"Computing shortest path lengths.\");\r\n\t\t\tdouble[] returnValues = computeShortestPathLengths(node,\r\n\t\t\t\t\tshortestPathLengthSum, maxPathLength, wasSource);\r\n\t\t\tshortestPathLengthSum = returnValues[0];\r\n\t\t\tmaxPathLength = returnValues[1];\r\n\r\n\t\t\t// save the info that the node was already used as the source of\r\n\t\t\t// path computation\r\n\t\t\twasSource.add(node);\r\n\t\t}\r\n\r\n\t\tif (nodes.size() > 1) {\r\n\t\t\tthis.averageShortestPathLength = shortestPathLengthSum\r\n\t\t\t\t\t/ (nodes.size() * (nodes.size() - 1) / 2);\r\n\t\t\t// sum of path lengths / (number of node pairs)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis.averageShortestPathLength = 0; // there is only one node\r\n\t\t}\r\n\t\tthis.diameter = maxPathLength;\r\n\t\tthis.averageDegree = degreeSum / nodes.size();\r\n\t\tthis.clusterCoefficient = clusterCoefficientSum / nodes.size();\r\n\t}", "private Set<String> validateNodeNames(Condition c, Set<String> vars) {\n if (c instanceof LaxCondition) {\n vars.addAll(graphNodeMap.get(((LaxCondition) c).getGraph()).keySet());\n if (((LaxCondition) c).getCondition() != null) {\n Set<String> val = validateNodeNames(((LaxCondition) c).getCondition(), new HashSet<>(vars));\n vars.addAll(val);\n }\n return vars;\n } else if (c instanceof OperatorCondition){\n Set<String> val1 = validateNodeNames(((OperatorCondition) c).getExpr1(), new HashSet<>(vars));\n Set<String> val2 = validateNodeNames(((OperatorCondition) c).getExpr2(), new HashSet<>(vars));\n Set<String> intersection = intersection(val1, val2);\n intersection.removeAll(vars);\n if (!intersection.isEmpty()) {\n // there are nodes that exist in both expr1 and expr2 but not in its parents;\n // so rename those nodes in expr2 such that the laxCondition can be transformed to one graph\n for (String i : intersection) {\n renameVar(((OperatorCondition) c).getExpr2(), i, getUniqueNodeName());\n }\n // reset val2 since node names are renamed\n val2 = validateNodeNames(((OperatorCondition) c).getExpr2(), new HashSet<>(vars));\n }\n vars.addAll(val1);\n vars.addAll(val2);\n return vars;\n } else {\n assert false; //shouldn't happen\n }\n return vars;\n }", "public void getCTPfromQuery(List<String> queryTriplets, int dedGraphId, int indxLogCleanQuery) {\n\n int indxValue = -1;\n int indxLogQueryDedGraph = mapLogClQueryToDedGraph.get(indxLogCleanQuery);\n int indxNewTPDedGraph = -1;\n List<String> tmpTripletClean = null;\n List<Integer> allIdPats = null;\n List<Integer> deducedTPnotCoveredTimestamp = new LinkedList<>();\n String strDedQueryId = Integer.toString(dedGraphId);\n boolean flagTriplePatternOutOfTimeRange = false;\n\n //For all triple patterns\n for (int f = 0; f < queryTriplets.size(); f += 3) {\n\n tmpTripletClean = myDedUtils.getCleanTP(new LinkedList<>(queryTriplets.subList(f, f + 3)));\n\n //Check if query is an Exclusive Group\n checkTPinEG(queryTriplets, tmpTripletClean, indxLogCleanQuery);\n\n //Check if query is a Bound Join implementation or it's a single TP query\n checkSingleTPorBoundJ(queryTriplets, tmpTripletClean, indxLogCleanQuery);\n\n //[CASE A] When both subjects and objects are variables, or inverseMapping is disabled\n if (tmpTripletClean.get(0).contains(\"?\") && tmpTripletClean.get(2).contains(\"?\") || !inverseMapping) {\n\n //A_(i) It's the frist time we see this CTP\n allIdPats = myDedUtils.getIdemCTPs(DTPCandidates, tmpTripletClean.get(0), tmpTripletClean.get(1), tmpTripletClean.get(2));\n\n if (allIdPats.isEmpty()) {\n\n myDedUtils.setNewCTPInfo(tmpTripletClean, \"\", indxLogCleanQuery, indxLogQueryDedGraph, strDedQueryId, \"\");\n myDedUtils.setTPtoSrcAns(tmpTripletClean, indxLogCleanQuery, \"\", DTPCandidates.size() - 1);\n } //A_(ii) It's not the first time we identify it\n else {\n\n //Then, we must be sure that it's not an existing CTP\n for (int l = allIdPats.size() - 1; l >= 0; l--) {\n\n indxNewTPDedGraph = mapCTPtoDedGraph.get(allIdPats.get(l));\n\n //First we check it belongs to the same graph with previous identified CTP\n if (indxNewTPDedGraph != indxLogQueryDedGraph) {\n\n flagTriplePatternOutOfTimeRange = true;\n myDedUtils.setNewCTPInfo(tmpTripletClean, tmpTripletClean.get(0), indxLogCleanQuery, indxLogQueryDedGraph, strDedQueryId, \"_\" + allIdPats.size());\n myDedUtils.setTPtoSrcAns(tmpTripletClean, indxLogCleanQuery, \"\", DTPCandidates.size() - 1);\n deducedTPnotCoveredTimestamp.add(DTPCandidates.size() - 1);\n break;\n } //if not, it's a new CTP (we distinguish them with \"_#number\")\n //This happens when Tjoin is not big enough to merge some subqueries\n //with same characteristics\n else {\n\n myDedUtils.updateCTPInfo(tmpTripletClean, \"\", indxLogCleanQuery, indxLogQueryDedGraph, allIdPats.get(l));\n myDedUtils.setTPtoSrcAns(tmpTripletClean, indxLogCleanQuery, \"\", allIdPats.get(l));\n\n if ((DTPCandidates.get(allIdPats.get(l)).get(0).contains(\"?\") && DTPCandidates.get(allIdPats.get(l)).get(0).contains(\"_\"))\n || (DTPCandidates.get(allIdPats.get(l)).get(2).contains(\"?\") && DTPCandidates.get(allIdPats.get(l)).get(2).contains(\"_\"))) {\n\n deducedTPnotCoveredTimestamp.add(allIdPats.get(l));\n }\n\n break;\n }\n\n }\n\n }\n\n } //If subject or object is a constant, we repeat the procedure depending \n //on if it is a Single TP or part of BoundJoin\n else {\n\n if (inverseMapping) {\n\n indxValue = myDedUtils.getIndxConstant(tmpTripletClean);\n }\n\n setOrUpdateCTPList(tmpTripletClean, indxValue, strDedQueryId, indxLogCleanQuery);\n }\n\n }\n\n //check for an exclusive group relation between CTP\n //It could be a EG or NLEG\n if (queryTriplets.size() >= 6 && !flagTriplePatternOutOfTimeRange && !queries.get(indxLogCleanQuery).contains(\"UNION\")) {\n\n if (checkEGJoin(queryTriplets)) {\n for (int i = 0; i < deducedTPnotCoveredTimestamp.size(); i++) {\n if (mapDTPToAnyJoin.get(deducedTPnotCoveredTimestamp.get(i)) == null) {\n\n mapDTPToDeducedID.put(DTPCandidates.get(deducedTPnotCoveredTimestamp.get(i)), deducedTPnotCoveredTimestamp.get(i));\n mapDTPToAnyJoin.put(deducedTPnotCoveredTimestamp.get(i), -1);\n }\n }\n }\n }\n\n }", "private HashMap<ComparableExpression, HashSet<ComparableExpression>> transitiveClosure(\n HashMap<ComparableExpression, HashSet<ComparableExpression>> rel) {\n\n HashMap<ComparableExpression, HashSet<ComparableExpression>> newRel = rel;\n boolean changed = true;\n // apply transitivity until closure is complete: (a,b) in rel, (b,c) in rel => (a,c) in rel\n while (changed) {\n HashMap<ComparableExpression, HashSet<ComparableExpression>> oldRel =\n (HashMap<ComparableExpression, HashSet<ComparableExpression>>) SerializationUtils.clone(newRel);\n changed = false;\n for (Map.Entry<ComparableExpression, HashSet<ComparableExpression>> r : oldRel.entrySet()) {\n ComparableExpression key = r.getKey();\n for (ComparableExpression value : r.getValue()) {\n newRel.putIfAbsent(key, new HashSet<>());\n changed = newRel.get(key).add(value) || changed;\n if (oldRel.containsKey(value)) {\n changed = newRel.get(key).addAll(oldRel.get(value)) || changed;\n }\n }\n }\n }\n return newRel;\n }", "private void runLoopCheck(HashMap<IconMain, Set<IconMain>> connections, IconMain iconFrom) {\n visited.add(iconFrom);\n if (connections.containsKey(iconFrom)) {\n Set<IconMain> set = connections.get(iconFrom);\n\n for (IconMain iconTo : set) {\n while (!iconTo.iconType.equals(\")\")) {\n if (visited.contains(iconTo)) {\n break;\n }\n runLoopCheck(connections, iconTo);\n }\n visited.add(iconTo);\n }\n }\n }", "private void initPossibleSignalMoves() {\n possibleSignalMoves.put(Id.createLinkId(\"3_2\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"2_1\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"7_2\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"2_1\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"1_2\"),\r\n new ArrayList<>(Arrays.asList(Id.createLinkId(\"2_3\"), Id.createLinkId(\"2_7\"))));\r\n\r\n //signals at node 5\r\n possibleSignalMoves.put(Id.createLinkId(\"8_5\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"5_6\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"4_5\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"5_6\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"6_5\"),\r\n new ArrayList<>(Arrays.asList(Id.createLinkId(\"5_4\"), Id.createLinkId(\"5_8\"))));\r\n\r\n //signals at node 10\r\n possibleSignalMoves.put(Id.createLinkId(\"3_10\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"10_9\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"4_10\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"10_9\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"9_10\"),\r\n new ArrayList<>(Arrays.asList(Id.createLinkId(\"10_3\"), Id.createLinkId(\"10_4\"))));\r\n\r\n //signals at node 11\r\n possibleSignalMoves.put(Id.createLinkId(\"7_11\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"11_12\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"8_11\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"11_12\"))));\r\n // TODO\r\n possibleSignalMoves.put(Id.createLinkId(\"12_11\"),\r\n new ArrayList<>(Arrays.asList(Id.createLinkId(\"11_7\"), Id.createLinkId(\"11_8\"))));\r\n\r\n //signals at node 3\r\n possibleSignalMoves.put(Id.createLinkId(\"2_3\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"3_4\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"10_3\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"3_7\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"4_3\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"3_2\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"7_3\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"3_10\"))));\r\n\r\n //signals at node 4\r\n possibleSignalMoves.put(Id.createLinkId(\"3_4\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"4_5\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"10_4\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"4_8\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"5_4\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"4_3\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"8_4\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"4_10\"))));\r\n\r\n //signals at node 7\r\n possibleSignalMoves.put(Id.createLinkId(\"2_7\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"7_8\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"3_7\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"7_11\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"11_7\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"7_3\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"8_7\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"7_2\"))));\r\n\r\n //signals at node 8\r\n possibleSignalMoves.put(Id.createLinkId(\"4_8\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"8_11\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"5_8\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"8_7\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"11_8\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"8_4\"))));\r\n possibleSignalMoves.put(Id.createLinkId(\"7_8\"),\r\n new ArrayList<>(Collections.singletonList(Id.createLinkId(\"8_5\"))));\r\n }", "public static void main(String[] args) {\n generateAndSaveExampleGraph();\n\n\n /*\n * select graph for prepairing and handling by algorhytm\n * determine graph source from config.xml:\n * config case = ?\n * 1 - from matrix\n * 2 - from edges list\n * 3 - from xml\n * */\n //read configCase\n Integer configCase = 0;\n try {\n configCase = (Integer) XMLSerializer.read( \"config.xml\");\n } catch (Exception e) {\n e.printStackTrace();\n }\n //determine case\n EuclidDirectedGraph graph = null;\n switch (configCase){\n case 1:\n graph = getGraphFromMatrix();\n break;\n case 2:\n graph = getGraphFromEdgesList();\n break;\n case 3:\n graph = getGraphFromXML();\n break;\n default:\n return;\n\n }\n //find all sources and sinks\n ArrayList<BoundsGraphVertex> sources = new ArrayList<>();\n ArrayList<BoundsGraphVertex> sinks = new ArrayList<>();\n //get all sources and sinks\n for (Map.Entry<BoundsGraphVertex, Map<BoundsGraphVertex, Double>> vertexEntry : graph.getMap().entrySet()) {\n //if there are no edges from vertex then its sink\n if (vertexEntry.getValue().isEmpty()) {\n sinks.add(vertexEntry.getKey());\n } else {\n //mark all vertexes which have incoming edges\n for (BoundsGraphVertex dest : vertexEntry.getValue().keySet()) {\n dest.setMarked(true);\n }\n }\n }\n //all unmarked vertexes are sources\n for (BoundsGraphVertex vertex : graph) {\n if (!vertex.isMarked()) sources.add(vertex);\n }\n\n /*\n * First algorithm: for each source-sink pair get path using euclid heuristics\n * */\n List<BoundsGraphVertex> minPath = null;\n Double minLength = Double.MAX_VALUE;\n for (BoundsGraphVertex source :\n sources) {\n for (BoundsGraphVertex sink :\n sinks) {\n //need use path storage list because algorhytm returns only double val of length.\n //path will be saved in this storage.\n List<BoundsGraphVertex> pathStorage = new ArrayList<>();\n //do algo\n Double length = Algorithms.shortestEuclidDijkstraFibonacciPathWithHeuristics(graph, source, sink, pathStorage, minLength);\n //check min\n if (minLength > length) {\n minLength = length;\n minPath = pathStorage;\n }\n\n }\n }\n\n /*\n * Second algorithm: for each source get better sink\n * */\n minPath = null;\n minLength = Double.MAX_VALUE;\n for (BoundsGraphVertex source :\n sources) {\n //need use path storage list because algorhytm returns only double val of length.\n //path will be saved in this storage.\n List<BoundsGraphVertex> pathStorage = new ArrayList<>();\n //do algo\n Double length = Algorithms.shortestEuclidDijkstraFibonacciPathToManySinks(graph, source, sinks, pathStorage, minLength);\n //check min\n if (minLength > length) {\n minLength = length;\n minPath = pathStorage;\n }\n }\n try {\n XMLSerializer.write(minPath, \"output.xml\", false);\n XMLSerializer.write(minLength, \"output.xml\", true);\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n\n }", "Iterable<Vertex> computePathToGraph(Loc start, Vertex end) throws GraphException;", "private TIntSet removeUnconnectedMentionEntityPairs(Graph g, Map<ResultMention, List<ResultEntity>> solution) {\n TIntSet mentionsToRemove = new TIntHashSet();\n for (int mentionId : g.getMentionNodesIds().values()) {\n GraphNode mentionNode = g.getNode(mentionId);\n Mention mention = (Mention) mentionNode.getNodeData();\n TIntDoubleHashMap entityCandidates = mentionNode.getSuccessors();\n if (entityCandidates.size() == 0) {\n continue;\n }\n // Remove all mentions without any entities that have coherence edges.\n if (g.isLocalMention(mentionId)) {\n logger.debug(\"local mention removed: \" + mentionId + \" \" + mention);\n mentionsToRemove.add(mentionId);\n GraphTracer.gTracer.addMentionToDangling(g.getName(), mention.getMention(), mention.getCharOffset());\n // Set solution to best local candidate.\n Pair<Integer, Double> bestEntityScore = getBestLocalCandidateAndScore(entityCandidates);\n int bestEntity = bestEntityScore.getKey();\n double score = bestEntityScore.getValue();\n updateSolution(solution, g, mention, bestEntity, score);\n }\n\n }\n TIntSet entitiesToRemove = new TIntHashSet();\n // Remove entities that are only connected to removed mentions.\n for (int entityId : g.getEntityNodesIds().values()) {\n GraphNode entityNode = g.getNode(entityId);\n TIntDoubleHashMap successors = entityNode.getSuccessors();\n int removedCount = 0;\n for (TIntDoubleIterator itr = successors.iterator(); itr.hasNext(); ) {\n itr.advance();\n int neighborId = itr.key();\n if (mentionsToRemove.contains(neighborId)) {\n ++removedCount;\n }\n }\n if (removedCount == successors.size()) {\n entitiesToRemove.add(entityId);\n }\n }\n // Remove mentions + entity candidates from graph, trace.\n TIntSet nodesToRemove = new TIntHashSet(mentionsToRemove.size() + entitiesToRemove.size());\n nodesToRemove.addAll(mentionsToRemove);\n nodesToRemove.addAll(entitiesToRemove);\n return nodesToRemove;\n }", "Graph<Integer, DefaultEdge> buildMap();", "private void awayFromAncestorCycle(Graph graph) {\n while (changeFlag) {\n changeFlag = false;\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n List<Node> adj = graph.getAdjacentNodes(B);\n\n if (adj.size() < 2) {\n continue;\n }\n\n ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2);\n int[] combination;\n\n while ((combination = cg.next()) != null) {\n Node A = adj.get(combination[0]);\n Node C = adj.get(combination[1]);\n\n //choice gen doesnt do diff orders, so must switch A & C around.\n awayFromAncestor(graph, A, B, C);\n awayFromAncestor(graph, C, B, A);\n awayFromCycle(graph, A, B, C);\n awayFromCycle(graph, C, B, A);\n }\n }\n }\n changeFlag = true;\n }", "private void computePaths(Vertex source, Vertex target, ArrayList<Vertex> vs)\n {\n \tfor (Vertex v : vs)\n \t{\n \t\tv.minDistance = Double.POSITIVE_INFINITY;\n \t\tv.previous = null;\n \t}\n source.minDistance = 0.;\t\t// distance to self is zero\n IndexMinPQ<Vertex> vertexQueue = new IndexMinPQ<Vertex>(vs.size());\n \n for (Vertex v : vs) vertexQueue.insert(Integer.parseInt(v.id), v);\n\n\t\twhile (!vertexQueue.isEmpty()) \n\t\t{\n\t \t// retrieve vertex with shortest distance to source\n\t \tVertex u = vertexQueue.minKey();\n\t \tvertexQueue.delMin();\n\t\t\tif (u == target)\n\t\t\t{\n\t\t\t\t// trace back\n\t\t\t\twhile (u.previous != null)\n\t\t\t\t{;\n\t\t\t\t\tu = u.previous;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n \t// Visit each edge exiting u\n \tfor (Edge e : u.adjacencies)\n \t\t{\n \t\tVertex v = e.target;\n\t\t\t\tdouble weight = e.weight;\n \tdouble distanceThroughU = u.minDistance + weight;\n\t\t\t\tif (distanceThroughU < v.minDistance) \n\t\t\t\t{\n\t\t\t\t\tint vid = Integer.parseInt(v.id);\n\t\t \t\tvertexQueue.delete(vid);\n\t\t \t\tv.minDistance = distanceThroughU;\n\t\t \t\tv.previous = u;\n\t\t \t\tvertexQueue.insert(vid,v);\n\t\t\t\t}\n\t\t\t}\n }\n }", "public static void main(String[] args) throws IOException {\n\n // read in graph\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt(), m = scanner.nextInt();\n ArrayList<Integer>[] graph = new ArrayList[n];\n for (int i = 0; i < n; i++)\n graph[i] = new ArrayList<>();\n\n for (int i = 0; i < m; i++) {\n scanner.nextLine();\n int u = scanner.nextInt() - 1, v = scanner.nextInt() - 1; // convert to 0 based index\n graph[u].add(v);\n graph[v].add(u);\n }\n\n int[] dist = new int[n];\n Arrays.fill(dist, -1);\n // partition the vertices in each of the components of the graph\n for (int u = 0; u < n; u++) {\n if (dist[u] == -1) {\n // bfs\n Queue<Integer> queue = new LinkedList<>();\n queue.add(u);\n dist[u] = 0;\n while (!queue.isEmpty()) {\n int w = queue.poll();\n for (int v : graph[w]) {\n if (dist[v] == -1) { // unvisited\n dist[v] = (dist[w] + 1) % 2;\n queue.add(v);\n } else if (dist[w] == dist[v]) { // visited and form a odd cycle\n System.out.println(-1);\n return;\n } // otherwise the dist will not change\n }\n }\n }\n\n }\n\n BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));\n // vertices with the same dist are in the same group\n List<Integer>[] groups = new ArrayList[2];\n groups[0] = new ArrayList<>();\n groups[1] = new ArrayList<>();\n for (int u = 0; u < n; u++) {\n groups[dist[u]].add(u + 1);\n }\n for (List<Integer> g: groups) {\n writer.write(String.valueOf(g.size()));\n writer.newLine();\n for (int u: g) {\n writer.write(String.valueOf(u));\n writer.write(' ');\n }\n writer.newLine();\n }\n\n writer.close();\n\n\n }", "protected abstract Graph filterGraph();", "private ScheduleGrph initializeIdenticalTaskEdges(ScheduleGrph input) {\n\n\t\tScheduleGrph correctedInput = (ScheduleGrph) SerializationUtils.clone(input);\n\t\t// FORKS AND TODO JOINS\n\t\t/*\n\t\t * for (int vert : input.getVertices()) { TreeMap<Integer, List<Integer>> sorted\n\t\t * = new TreeMap<Integer, List<Integer>>(); for (int depend :\n\t\t * input.getOutNeighbors(vert)) { int edge = input.getSomeEdgeConnecting(vert,\n\t\t * depend); int weight = input.getEdgeWeightProperty().getValueAsInt(edge); if\n\t\t * (sorted.get(weight) != null) { sorted.get(weight).add(depend); } else {\n\t\t * ArrayList<Integer> a = new ArrayList(); a.add(depend); sorted.put(weight, a);\n\t\t * }\n\t\t * \n\t\t * } int curr = -1; for (List<Integer> l : sorted.values()) { for (int head : l)\n\t\t * {\n\t\t * \n\t\t * if (curr != -1) { correctedInput.addDirectedSimpleEdge(curr, head); } curr =\n\t\t * head; }\n\t\t * \n\t\t * } }\n\t\t */\n\n\t\tfor (int vert : input.getVertices()) {\n\t\t\tfor (int vert2 : input.getVertices()) {\n\t\t\t\tint vertWeight = input.getVertexWeightProperty().getValueAsInt(vert);\n\t\t\t\tint vert2Weight = input.getVertexWeightProperty().getValueAsInt(vert2);\n\n\t\t\t\tIntSet vertParents = input.getInNeighbors(vert);\n\t\t\t\tIntSet vert2Parents = input.getInNeighbors(vert2);\n\n\t\t\t\tIntSet vertChildren = input.getOutNeighbors(vert);\n\t\t\t\tIntSet vert2Children = input.getOutNeighbors(vert2);\n\n\t\t\t\tboolean childrenEqual = vertChildren.containsAll(vert2Children)\n\t\t\t\t\t\t&& vert2Children.containsAll(vertChildren);\n\n\t\t\t\tboolean parentEqual = vertParents.containsAll(vert2Parents) && vert2Parents.containsAll(vertParents);\n\n\t\t\t\tboolean inWeightsSame = true;\n\t\t\t\tfor (int parent : vertParents) {\n\t\t\t\t\tfor (int parent2 : vert2Parents) {\n\t\t\t\t\t\tif (parent == parent2 && input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(parent, vert)) == input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(parent2, vert2))) {\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tinWeightsSame = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!inWeightsSame) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tboolean outWeightsSame = true;\n\t\t\t\tfor (int child : vertChildren) {\n\t\t\t\t\tfor (int child2 : vert2Children) {\n\t\t\t\t\t\tif (child == child2 && input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(vert, child)) == input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(vert2, child2))) {\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toutWeightsSame = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!outWeightsSame) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tboolean alreadyEdge = correctedInput.areVerticesAdjacent(vert, vert2)\n\t\t\t\t\t\t|| correctedInput.areVerticesAdjacent(vert2, vert);\n\n\t\t\t\tif (vert != vert2 && vertWeight == vert2Weight && parentEqual && childrenEqual && inWeightsSame\n\t\t\t\t\t\t&& outWeightsSame && !alreadyEdge) {\n\t\t\t\t\tint edge = correctedInput.addDirectedSimpleEdge(vert, vert2);\n\t\t\t\t\tcorrectedInput.getEdgeWeightProperty().setValue(edge, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn correctedInput;\n\t}", "Iterable<Vertex> computePath(Vertex start, Vertex end) throws GraphException;", "public boolean correctCheckConnectGraph(ArrayList<MECountry> countryArr){\n Queue<String> queue = new LinkedList<String>();\n\n //If it is a empty map.\n if(countryArr.isEmpty()){\n return true;\n }\n\n HashMap<String,Boolean> visited = new HashMap<String,Boolean>();\n for(int i=0 ; i<countryArr.size(); i++ ){\n String countryTemp = countryArr.get(i).getCountryName();\n visited.put(countryTemp,false);\n }\n String firstCountry = countryArr.get(0).getCountryName();\n queue.offer(firstCountry);\n //bfs\n while(!queue.isEmpty()){\n String queueHead = queue.poll();\n visited.put(queueHead, Boolean.TRUE);\n for(int j=0 ;j<countryArr.size();j++){\n if(countryArr.get(j).getCountryName().equals(queueHead)){\n String countryNeighbor = countryArr.get(j).getNeighbor();\n countryNeighbor = countryNeighbor.replaceAll(\"\\\\[\",\"\");\n countryNeighbor = countryNeighbor.replaceAll(\"\\\\]\",\"\");\n countryNeighbor = countryNeighbor.replaceAll(\", \",\",\");\n String[] countryNeighbors = countryNeighbor.split(\",\");\n for(int k = 1;k<countryNeighbors.length;k++){\n String readyToAddInQueue = countryNeighbors[k];\n if(visited.get(readyToAddInQueue)==false){\n queue.offer(readyToAddInQueue);\n }\n }\n }\n }\n }\n for (String key: visited.keySet()) {\n if(visited.get(key)==false){\n checkFlagCG = false;\n break;\n }\n }\n return checkFlagCG;\n }", "public List<Graph> search() {\n\n long start = System.currentTimeMillis();\n TetradLogger.getInstance().log(\"info\", \"Starting ION Search.\");\n logGraphs(\"\\nInitial Pags: \", this.input);\n TetradLogger.getInstance().log(\"info\", \"Transfering local information.\");\n long steps = System.currentTimeMillis();\n\n /*\n * Step 1 - Create the empty graph\n */\n List<Node> varNodes = new ArrayList<>();\n for (String varName : variables) {\n varNodes.add(new GraphNode(varName));\n }\n Graph graph = new EdgeListGraph(varNodes);\n\n /*\n * Step 2 - Transfer local information from the PAGs (adjacencies\n * and edge orientations)\n */\n // transfers edges from each graph and finds definite noncolliders\n transferLocal(graph);\n // adds edges for variables never jointly measured\n for (NodePair pair : nonIntersection(graph)) {\n graph.addEdge(new Edge(pair.getFirst(), pair.getSecond(), Endpoint.CIRCLE, Endpoint.CIRCLE));\n }\n TetradLogger.getInstance().log(\"info\", \"Steps 1-2: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n System.out.println(\"step2\");\n System.out.println(graph);\n\n /*\n * Step 3\n *\n * Branch and prune step that blocks problematic undirectedPaths, possibly d-connecting undirectedPaths\n */\n steps = System.currentTimeMillis();\n Queue<Graph> searchPags = new LinkedList<>();\n // place graph constructed in step 2 into the queue\n searchPags.offer(graph);\n // get d-separations and d-connections\n List<Set<IonIndependenceFacts>> sepAndAssoc = findSepAndAssoc(graph);\n this.separations = sepAndAssoc.get(0);\n this.associations = sepAndAssoc.get(1);\n Map<Collection<Node>, List<PossibleDConnectingPath>> paths;\n// Queue<Graph> step3PagsSet = new LinkedList<Graph>();\n HashSet<Graph> step3PagsSet = new HashSet<>();\n Set<Graph> reject = new HashSet<>();\n // if no d-separations, nothing left to search\n if (separations.isEmpty()) {\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(graph);\n step3PagsSet.add(graph);\n }\n // sets length to iterate once if search over path lengths not enabled, otherwise set to 2\n int numNodes = graph.getNumNodes();\n int pl = numNodes - 1;\n if (pathLengthSearch) {\n pl = 2;\n }\n // iterates over path length, then adjacencies\n for (int l = pl; l < numNodes; l++) {\n if (pathLengthSearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path lengths: \" + l + \" of \" + (numNodes - 1));\n }\n int seps = separations.size();\n int currentSep = 1;\n int numAdjacencies = separations.size();\n for (IonIndependenceFacts fact : separations) {\n if (adjacencySearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path nonadjacencies: \" + currentSep + \" of \" + numAdjacencies);\n }\n seps--;\n // uses two queues to keep up with which PAGs are being iterated and which have been\n // accepted to be iterated over in the next iteration of the above for loop\n searchPags.addAll(step3PagsSet);\n recGraphs.add(searchPags.size());\n step3PagsSet.clear();\n while (!searchPags.isEmpty()) {\n System.out.println(\"ION Step 3 size: \" + searchPags.size());\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n // deques first PAG from searchPags\n Graph pag = searchPags.poll();\n // Part 3.a - finds possibly d-connecting undirectedPaths between each pair of nodes\n // known to be d-separated\n List<PossibleDConnectingPath> dConnections = new ArrayList<>();\n // checks to see if looping over adjacencies\n if (adjacencySearch) {\n for (Collection<Node> conditions : fact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, fact.getX(), fact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, fact.getX(), fact.getY(), conditions));\n }\n }\n } else {\n for (IonIndependenceFacts allfact : separations) {\n for (Collection<Node> conditions : allfact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, allfact.getX(), allfact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, allfact.getX(), allfact.getY(), conditions));\n }\n }\n }\n }\n // accept PAG go to next PAG if no possibly d-connecting undirectedPaths\n if (dConnections.isEmpty()) {\n// doFinalOrientation(pag);\n// Graph p = screenForKnowledge(pag);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(pag);\n continue;\n }\n // maps conditioning sets to list of possibly d-connecting undirectedPaths\n paths = new HashMap<>();\n for (PossibleDConnectingPath path : dConnections) {\n List<PossibleDConnectingPath> p = paths.get(path.getConditions());\n if (p == null) {\n p = new LinkedList<>();\n }\n p.add(path);\n paths.put(path.getConditions(), p);\n }\n // Part 3.b - finds minimal graphical changes to block possibly d-connecting undirectedPaths\n List<Set<GraphChange>> possibleChanges = new ArrayList<>();\n for (Set<GraphChange> changes : findChanges(paths)) {\n Set<GraphChange> newChanges = new HashSet<>();\n for (GraphChange gc : changes) {\n boolean okay = true;\n for (Triple collider : gc.getColliders()) {\n\n if (pag.isUnderlineTriple(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n\n }\n if (!okay) {\n continue;\n }\n for (Triple collider : gc.getNoncolliders()) {\n if (pag.isDefCollider(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n }\n if (okay) {\n newChanges.add(gc);\n }\n }\n if (!newChanges.isEmpty()) {\n possibleChanges.add(newChanges);\n } else {\n possibleChanges.clear();\n break;\n }\n }\n float starthitset = System.currentTimeMillis();\n Collection<GraphChange> hittingSets = IonHittingSet.findHittingSet(possibleChanges);\n recHitTimes.add((System.currentTimeMillis() - starthitset) / 1000.);\n // Part 3.c - checks the newly constructed graphs from 3.b and rejects those that\n // cycles or produce independencies known not to occur from the input PAGs or\n // include undirectedPaths from definite nonancestors\n for (GraphChange gc : hittingSets) {\n boolean badhittingset = false;\n for (Edge edge : gc.getRemoves()) {\n Node node1 = edge.getNode1();\n Node node2 = edge.getNode2();\n Set<Triple> triples = new HashSet<>();\n triples.addAll(gc.getColliders());\n triples.addAll(gc.getNoncolliders());\n if (triples.size() != (gc.getColliders().size() + gc.getNoncolliders().size())) {\n badhittingset = true;\n break;\n }\n for (Triple triple : triples) {\n if (node1.equals(triple.getY())) {\n if (node2.equals(triple.getX()) ||\n node2.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n if (node2.equals(triple.getY())) {\n if (node1.equals(triple.getX()) ||\n node1.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n }\n if (badhittingset) {\n break;\n }\n for (NodePair pair : gc.getOrients()) {\n if ((node1.equals(pair.getFirst()) && node2.equals(pair.getSecond())) ||\n (node2.equals(pair.getFirst()) && node1.equals(pair.getSecond()))) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (!badhittingset) {\n for (NodePair pair : gc.getOrients()) {\n for (Triple triple : gc.getNoncolliders()) {\n if (pair.getSecond().equals(triple.getY())) {\n if (pair.getFirst().equals(triple.getX()) &&\n pag.getEndpoint(triple.getZ(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n\n }\n if (pair.getFirst().equals(triple.getZ()) &&\n pag.getEndpoint(triple.getX(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n }\n if (badhittingset) {\n continue;\n }\n Graph changed = gc.applyTo(pag);\n // if graph change has already been rejected move on to next graph\n if (reject.contains(changed)) {\n continue;\n }\n // if graph change has already been accepted move on to next graph\n if (step3PagsSet.contains(changed)) {\n continue;\n }\n // reject if null, predicts false independencies or has cycle\n if (predictsFalseIndependence(associations, changed)\n || changed.existsDirectedCycle()) {\n reject.add(changed);\n }\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(changed);\n // now add graph to queue\n\n// Graph p = screenForKnowledge(changed);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(changed);\n }\n }\n // exits loop if not looping over adjacencies\n if (!adjacencySearch) {\n break;\n }\n }\n }\n TetradLogger.getInstance().log(\"info\", \"Step 3: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n Queue<Graph> step3Pags = new LinkedList<>(step3PagsSet);\n\n /*\n * Step 4\n *\n * Finds redundant undirectedPaths and uses this information to expand the list\n * of possible graphs\n */\n steps = System.currentTimeMillis();\n Map<Edge, Boolean> necEdges;\n Set<Graph> outputPags = new HashSet<>();\n\n while (!step3Pags.isEmpty()) {\n Graph pag = step3Pags.poll();\n necEdges = new HashMap<>();\n // Step 4.a - if x and y are known to be unconditionally associated and there is\n // exactly one trek between them, mark each edge on that trek as necessary and\n // make the tiples on the trek definite noncolliders\n // initially mark each edge as not necessary\n for (Edge edge : pag.getEdges()) {\n necEdges.put(edge, false);\n }\n // look for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n List<List<Node>> treks = treks(pag, fact.x, fact.y);\n if (treks.size() == 1) {\n List<Node> trek = treks.get(0);\n List<Triple> triples = new ArrayList<>();\n for (int i = 1; i < trek.size(); i++) {\n // marks each edge in trek as necessary\n necEdges.put(pag.getEdge(trek.get(i - 1), trek.get(i)), true);\n if (i == 1) {\n continue;\n }\n // makes each triple a noncollider\n pag.addUnderlineTriple(trek.get(i - 2), trek.get(i - 1), trek.get(i));\n }\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // Part 4.b - branches by generating graphs for every combination of removing\n // redundant undirectedPaths\n boolean elimTreks;\n // checks to see if removing redundant undirectedPaths eliminates every trek between\n // two variables known to be nconditionally assoicated\n List<Graph> possRemovePags = possRemove(pag, necEdges);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n for (Graph newPag : possRemovePags) {\n elimTreks = false;\n // looks for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n if (treks(newPag, fact.x, fact.y).isEmpty()) {\n elimTreks = true;\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // add new PAG to output unless a necessary trek has been eliminated\n if (!elimTreks) {\n outputPags.add(newPag);\n }\n }\n }\n outputPags = removeMoreSpecific(outputPags);\n// outputPags = applyKnowledge(outputPags);\n\n TetradLogger.getInstance().log(\"info\", \"Step 4: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n\n /*\n * Step 5\n *\n * Generate the Markov equivalence classes for graphs and accept only\n * those that do not predict false d-separations\n */\n steps = System.currentTimeMillis();\n Set<Graph> outputSet = new HashSet<>();\n for (Graph pag : outputPags) {\n Set<Triple> unshieldedPossibleColliders = new HashSet<>();\n for (Triple triple : getPossibleTriples(pag)) {\n if (!pag.isAdjacentTo(triple.getX(), triple.getZ())) {\n unshieldedPossibleColliders.add(triple);\n }\n }\n\n PowerSet<Triple> pset = new PowerSet<>(unshieldedPossibleColliders);\n for (Set<Triple> set : pset) {\n Graph newGraph = new EdgeListGraph(pag);\n for (Triple triple : set) {\n newGraph.setEndpoint(triple.getX(), triple.getY(), Endpoint.ARROW);\n newGraph.setEndpoint(triple.getZ(), triple.getY(), Endpoint.ARROW);\n }\n doFinalOrientation(newGraph);\n }\n for (Graph outputPag : finalResult) {\n if (!predictsFalseIndependence(associations, outputPag)) {\n Set<Triple> underlineTriples = new HashSet<>(outputPag.getUnderLines());\n for (Triple triple : underlineTriples) {\n outputPag.removeUnderlineTriple(triple.getX(), triple.getY(), triple.getZ());\n }\n outputSet.add(outputPag);\n }\n }\n }\n\n// outputSet = applyKnowledge(outputSet);\n outputSet = checkPaths(outputSet);\n\n output.addAll(outputSet);\n TetradLogger.getInstance().log(\"info\", \"Step 5: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n runtime = ((System.currentTimeMillis() - start) / 1000.);\n logGraphs(\"\\nReturning output (\" + output.size() + \" Graphs):\", output);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n return output;\n }", "private void initGraph() {\n nodeMap = Maps.newIdentityHashMap();\n stream.forEach(t -> {\n Object sourceKey = sourceId.extractValue(t.get(sourceId.getTableId()));\n Object targetKey = targetId.extractValue(t.get(targetId.getTableId()));\n ClosureNode sourceNode = nodeMap.get(sourceKey);\n ClosureNode targetNode = nodeMap.get(targetKey);\n if (sourceNode == null) {\n sourceNode = new ClosureNode(sourceKey);\n nodeMap.put(sourceKey, sourceNode);\n }\n if (targetNode == null) {\n targetNode = new ClosureNode(targetKey);\n nodeMap.put(targetKey, targetNode);\n }\n sourceNode.next.add(targetNode);\n });\n\n }", "@Override\n public boolean isConnected() { //i got help from the site https://www.geeksforgeeks.org/shortest-path-unweighted-graph/\n if(this.ga.edgeSize()<this.ga.nodeSize()-1) return false;\n initializeInfo();//initialize all the info fields to be null for the algorithm to work\n if(this.ga.nodeSize()==0||this.ga.nodeSize()==1) return true;//if there is not node or one its connected\n WGraph_DS copy = (WGraph_DS) (copy());//create a copy graph that the algorithm will on it\n LinkedList<node_info> qValues = new LinkedList<>();//create linked list that will storage all nodes that we didn't visit yet\n int firstNodeKey = copy.getV().iterator().next().getKey();//first key for get the first node(its doesnt matter which node\n node_info first = copy.getNode(firstNodeKey);//get the node\n qValues.add(first);//without limiting generality taking the last node added to graph\n int counterVisitedNodes = 0;//counter the times we change info of node to \"visited\"\n while (qValues.size() != 0) {\n node_info current = qValues.removeFirst();\n if (current.getInfo() != null) continue;//if we visit we can skip to the next loop because we have already marked\n current.setInfo(\"visited\");//remark the info\n counterVisitedNodes++;\n\n Collection<node_info> listNeighbors = copy.getV(current.getKey());//create a collection for the neighbors list\n LinkedList<node_info> Neighbors = new LinkedList<>(listNeighbors);//create the neighbors list\n if (Neighbors == null) continue;\n for (node_info n : Neighbors) {\n if (n.getInfo() == null) {//if there is a node we didn't visited it yet, we will insert it to the linkedList\n qValues.add(n);\n }\n }\n }\n if (this.ga.nodeSize() != counterVisitedNodes) return false;//check that we visited all of the nodes\n\n return true;\n }", "@Test\n\tpublic void testDAG() {\n\t\tDirectedGraph<Integer, DirectedEdge<Integer>> directedGraph = new DirectedGraph<Integer, DirectedEdge<Integer>>();\n\t\tdirectedGraph.addNode(1);\n\t\tdirectedGraph.addNode(2);\n\t\tdirectedGraph.addNode(3);\n\t\tdirectedGraph.addNode(4);\n\t\tdirectedGraph.addNode(5);\n\t\tdirectedGraph.addDirectedEdge(new DirectedEdge<Integer>(1, 2));\n\t\tdirectedGraph.addDirectedEdge(new DirectedEdge<Integer>(1, 3));\n\t\tdirectedGraph.addDirectedEdge(new DirectedEdge<Integer>(2, 3));\n\t\tdirectedGraph.addDirectedEdge(new DirectedEdge<Integer>(4, 5));\n\t\t\n\t\t// tested method calls\n\t\tSet<Integer> reachableNodesFrom1 = service.getReachableNodes(directedGraph, 1);\n\t\tSet<Integer> reachableNodesFrom2 = service.getReachableNodes(directedGraph, 2);\n\t\tSet<Integer> reachableNodesFrom3 = service.getReachableNodes(directedGraph, 3);\n\t\tSet<Integer> reachableNodesFrom4 = service.getReachableNodes(directedGraph, 4);\n\t\tSet<Integer> reachableNodesFrom5 = service.getReachableNodes(directedGraph, 5);\n\t\t\n\t\t// assertions\n\t\tassertEquals(ImmutableSet.of(2, 3), reachableNodesFrom1);\n\t\tassertEquals(ImmutableSet.of(3), reachableNodesFrom2);\n\t\tassertEquals(ImmutableSet.of(), reachableNodesFrom3);\n\t\tassertEquals(ImmutableSet.of(5), reachableNodesFrom4);\n\t\tassertEquals(ImmutableSet.of(), reachableNodesFrom5);\n\t}", "public Iterator<Node> findPath() throws GraphException{\n\t\t\n\t\t// create a start and end node\n\t\tNode begin = this.graph.getNode(this.start);\n\t\tNode finish = this.graph.getNode(this.end);\n\t\t// check to make sure a path exits between these nodes\n\t\tboolean test = findPath(begin, finish);\n\t\tif(test){\n\t\t\t// reset the variables of the map that were changed by invoking the findPath helper method\n\t\t\tthis.testLine = \"Luka<3<3\";\n\t\t\tthis.changeCount = -1;\n\t\t\t//return the iterator over the Stack of the Map that was modified by the findPath helper method\n\t\t\treturn this.S.iterator();\n\t\t}\n\t\t// return null if a path does not exist\n\t\treturn null;\n\t}", "private void checkTargetsReachable(){\n\t\tPathfinder pathfinder = new Pathfinder(collisionMatrix);\n\t\tLinkedList<Node> removeList = new LinkedList<Node>();\n\t\tboolean pathWasFound = false;\n\t\tLinkedList<Node> currentPath;\n\t\tLinkedList<Node> reversePath;\n\t\t\n\t\t//Go through all starting positions\n\t\tfor(LinkedList<Node> startList : targets){\n\t\t\tprogress += 8;\n\t\t\tsetProgress(progress);\n\t\t\tfor(Node startNode : startList){\n\t\t\t\t\n\t\t\t\tboolean outsideMap = (startNode.getCollisionXPos(scaleCollision) < 0 || startNode.getCollisionXPos(scaleCollision) >= (collisionMatrix.length-1) || startNode.getCollisionYPos(scaleCollision) < 0 || startNode.getCollisionYPos(scaleCollision) >= (collisionMatrix.length-1));\n\t\t\t\t\n\t\t\t\tpathWasFound = false;\n\t\t\t\t//Make sure that target is inside of map\n\t\t\t\tif(!outsideMap){\n\t\t\t\t\t//Check against all target positions\n\t\t\t\t\tfor(LinkedList<Node> targetList : targets){\n\t\t\t\t\t\tfor(Node targetNode : targetList){\n\t\t\t\t\t\t\t//Only check against targets that have not already been marked as unreachable\n\t\t\t\t\t\t\tboolean selfCheck = (targetNode.getXPos() != startNode.getXPos() || targetNode.getYPos() != startNode.getYPos());\n\t\t\t\t\t\t\tif(!removeList.contains(targetNode) && selfCheck){\n\t\t\t\t\t\t\t\t//Check if this path has already been checked\n\t\t\t\t\t\t\t\tif(!preCalculatedPaths.containsKey(startNode.toStringCollision(scaleCollision) + \"-\" + targetNode.toStringCollision(scaleCollision))){\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tcurrentPath = new LinkedList<Node>();\n\t\t\t\t\t\t\t\t\t//Check if a path can be found for this start and target node\n\t\t\t\t\t\t\t\t\tif(pathfinder.findPath(startNode.getCollisionXPos(scaleCollision), startNode.getCollisionYPos(scaleCollision), targetNode.getCollisionXPos(scaleCollision), targetNode.getCollisionYPos(scaleCollision), currentPath)){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif(Frame.USE_PRECALCULATED_PATHS)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpreCalculatedPaths.put(startNode.toStringCollision(scaleCollision) + \"-\" + targetNode.toStringCollision(scaleCollision), currentPath);\n\t\t\t\t\t\t\t\t\t\t\treversePath = new LinkedList<Node>();\n\t\t\t\t\t\t\t\t\t\t\treversePath.addAll(currentPath);\n\t\t\t\t\t\t\t\t\t\t\tCollections.reverse(reversePath);\n\t\t\t\t\t\t\t\t\t\t\treversePath.removeFirst();\n\t\t\t\t\t\t\t\t\t\t\treversePath.add(startNode);\n\t\t\t\t\t\t\t\t\t\t\tpreCalculatedPaths.put(targetNode.toStringCollision(scaleCollision) + \"-\" + startNode.toStringCollision(scaleCollision) ,reversePath);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tpathWasFound = true;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\tpathWasFound = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//Remove nodes which we cannot find a path from\n\t\t\t\tif(!pathWasFound){\n\t\t\t\t\tremoveList.add(startNode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Go through the remove list and remove unreachable nodes\n\t\tfor(Node node : removeList){\n\t\t\tfor(LinkedList<Node> startList : targets){\n\t\t\t\tstartList.remove(node);\n\t\t\t}\n\t\t}\n\t}", "@Test\n public void solveTest5() throws ContradictionException {\n\n Set<ConstraintInfo> constraints = new HashSet<>();\n Set<Position> vars = new HashSet<>();\n Position[] varArr = new Position[]{\n this.grid.getVariable(0, 6),\n this.grid.getVariable(1, 6),\n this.grid.getVariable(2, 6),\n this.grid.getVariable(3, 6),\n this.grid.getVariable(4, 6),\n this.grid.getVariable(5, 6),\n this.grid.getVariable(6, 6),\n this.grid.getVariable(7, 6),\n this.grid.getVariable(7, 5),\n this.grid.getVariable(7, 4),\n this.grid.getVariable(7, 3),\n this.grid.getVariable(7, 2),\n this.grid.getVariable(6, 2),\n this.grid.getVariable(5, 2),\n this.grid.getVariable(5, 1),\n this.grid.getVariable(5, 0)\n };\n vars.addAll(Arrays.asList(varArr));\n ArrayList<Set<Position>> cArr = new ArrayList<>();\n for (int i = 0; i < 14; i++) cArr.add(new HashSet<>());\n add(cArr.get(0), varArr[0], varArr[1]);\n add(cArr.get(1), varArr[0], varArr[1], varArr[2]);\n add(cArr.get(2), varArr[3], varArr[1], varArr[2]);\n add(cArr.get(3), varArr[3], varArr[4], varArr[2]);\n add(cArr.get(4), varArr[3], varArr[4], varArr[5]);\n add(cArr.get(5), varArr[6], varArr[4], varArr[5]);\n add(cArr.get(6), varArr[6], varArr[7], varArr[5], varArr[8], varArr[9]);\n add(cArr.get(7), varArr[8], varArr[9], varArr[10]);\n add(cArr.get(8), varArr[9], varArr[10], varArr[11], varArr[12], varArr[13]);\n add(cArr.get(9), varArr[12], varArr[13]);\n add(cArr.get(10), varArr[13]);\n add(cArr.get(11), varArr[13], varArr[14]);\n add(cArr.get(12), varArr[13], varArr[14], varArr[15]);\n add(cArr.get(13), varArr[14], varArr[15]);\n\n int[] cVal = new int[] { 1,2,2,1,1,1,2,1,2,1,1,2,3,2 };\n for (int i = 0; i < 14; i++) {\n constraints.add(new ConstraintInfo(cArr.get(i), cVal[i]));\n }\n\n MSModel model = new MSModel(constraints, vars);\n\n Set<Position> expectedBombs = new HashSet<>();\n expectedBombs.addAll(Arrays.asList(\n this.grid.getVariable(1, 6),\n this.grid.getVariable(2, 6),\n this.grid.getVariable(5, 6),\n this.grid.getVariable(5, 0),\n this.grid.getVariable(5, 1),\n this.grid.getVariable(5, 2)\n ));\n Set<Position> expectedNoBombs = new HashSet<>();\n expectedNoBombs.addAll(Arrays.asList(\n this.grid.getVariable(6,2),\n this.grid.getVariable(0,6),\n this.grid.getVariable(3,6),\n this.grid.getVariable(4,6),\n this.grid.getVariable(6,6)\n ));\n\n for (Position pos : vars) {\n if (expectedBombs.contains(pos)) {\n assertTrue(model.hasBomb(pos));\n } else {\n assertFalse(model.hasBomb(pos));\n }\n\n if (expectedNoBombs.contains(pos)) {\n assertTrue(model.hasNoBombs(pos));\n } else {\n assertFalse(model.hasNoBombs(pos));\n }\n }\n\n /*\n 00002x???\n 00003x???\n 00002xxx?\n 0000112x?\n 0000001x?\n 1221112x?\n xxxxxxxx?\n ?????????\n */\n }", "private void dfs(Map<Integer, List<Node>> map, int start, int end, int k, int stops, int price, boolean[] visited) {\n // base-case\n if (start == end) {\n min = Math.min(min, price);\n return;\n }\n if (stops >= k) {\n return;\n }\n if (visited[start]) {\n return;\n }\n // recursive rule\n visited[start] = true;\n List<Node> nodes = map.get(start);\n if (nodes != null) {\n for (Node node : nodes) {\n dfs(map, node.next, end, k, stops + 1, price + node.price, visited);\n }\n }\n // backing tracking\n visited[start] = false;\n }" ]
[ "0.6220816", "0.602565", "0.5773332", "0.57074034", "0.5680132", "0.56379604", "0.5578151", "0.5537675", "0.5487885", "0.54609555", "0.5436478", "0.5414925", "0.5389629", "0.5345772", "0.5342937", "0.5339807", "0.52966654", "0.52961814", "0.52785087", "0.5266348", "0.5248162", "0.51991075", "0.51883787", "0.5161161", "0.51454675", "0.51403743", "0.5138665", "0.5134949", "0.51228607", "0.51186275", "0.50898737", "0.50856835", "0.5081837", "0.50614756", "0.5059922", "0.5039253", "0.5027915", "0.5026969", "0.5024989", "0.50201607", "0.5008814", "0.49912274", "0.49774268", "0.49767345", "0.49733874", "0.4967505", "0.4963238", "0.49619547", "0.49569702", "0.4951038", "0.49470285", "0.49422246", "0.49331105", "0.4918299", "0.491719", "0.4903452", "0.49029607", "0.49021235", "0.49016634", "0.4896176", "0.4890157", "0.48890147", "0.48875594", "0.48825938", "0.48795575", "0.4879284", "0.48781002", "0.48588762", "0.48523986", "0.48504353", "0.48491535", "0.48448613", "0.48439917", "0.4837041", "0.48353246", "0.48296046", "0.48266643", "0.48163295", "0.4812413", "0.4809424", "0.48076916", "0.48015365", "0.48015174", "0.47982168", "0.47960162", "0.47933573", "0.47897357", "0.47886297", "0.47865877", "0.47780752", "0.4749623", "0.47486505", "0.47464326", "0.47339293", "0.47285968", "0.4728312", "0.4727206", "0.47220677", "0.4721485", "0.47197726" ]
0.84290475
0
Constructs PossRemove, every combination of removing of not removing redudant undirectedPaths
private List<Graph> possRemove(Graph pag, Map<Edge, Boolean> necEdges) { // list of edges that can be removed List<Edge> remEdges = new ArrayList<>(); for (Edge remEdge : necEdges.keySet()) { if (!necEdges.get(remEdge)) remEdges.add(remEdge); } // powerset of edges that can be removed PowerSet<Edge> pset = new PowerSet<>(remEdges); List<Graph> possRemove = new ArrayList<>(); // for each set of edges in the powerset remove edges from graph and add to PossRemove for (Set<Edge> set : pset) { Graph newPag = new EdgeListGraph(pag); for (Edge edge : set) { newPag.removeEdge(edge); } possRemove.add(newPag); } return possRemove; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected boolean removeChanceNode() {\n\n Node candidateToReduce;\n Node candidateToRemove;\n Node nodeToRemove;\n String operation;\n int i;\n NodeList children;\n Node valueNodeToReduce;\n\n NodeList chancesID;\n boolean removed = false;\n Node nodeUtil = null;\n\n\n\n\n // Obtain the value node \n\n //sv = ((IDWithSVNodes) diag).getTerminalValueNode();\n\n //diag.save(\"debug-mediastinet.elv\");\n\n //List of chance nodes in the diagram\n chancesID = diag.getNodesOfKind(Node.CHANCE);\n\n for (i = 0; (i < chancesID.size()) && removed == false; i++) {\n\n candidateToRemove = chancesID.elementAt(i);\n\n //Check if the candidaToRemove can be removed\n if (isRemovableChance(candidateToRemove)) {\n\n nodeToRemove = candidateToRemove;\n children = nodeToRemove.getChildrenNodes();\n //Reduce value nodes if it's necessary\n\n if (children.size() > 1) {\n //We have to reduce\n candidateToReduce = getCandidateValueNodeToReduceForChanceNode(nodeToRemove);\n\n //valueNodeToReduce =\tobtainValueNodeToReduce(reachableParents);\n valueNodeToReduce = obtainValueNodeToReduce(nodeToRemove, candidateToReduce);\n ReductionAndEvalID.reduceNode(\n (IDWithSVNodes) diag,\n valueNodeToReduce);\n nodeUtil = valueNodeToReduce;\n operation = \"Reduce: \" + nodeUtil.getName() + \" to eliminate: \" + nodeToRemove.getName();\n System.out.println(operation);\n statistics.addOperation(operation);\n\n indexOperation++;\n try {\n diag.save(\"debug-operation-\" + indexOperation + \".elv\");\n } catch (IOException ex) {\n Logger.getLogger(ArcReversalSV.class.getName()).log(Level.SEVERE, null, ex);\n }\n } else {\n //The chance has only one child (utility)\n nodeUtil = children.elementAt(0);\n\n }\n\n\n String auxName = candidateToRemove.getName();\n operation = \"Chance node removal: \" + auxName;\n System.out.println(operation);\n statistics.addOperation(operation);\n\n //Add the name of the node to 'orderOfElimination'\n ((PropagationStatisticsID) statistics).addNameToOrderOfElimination(auxName);\n\n // The relation of the utility node is modified. In this \n // case the parents of the node to remove will be parents \n // of the utility node \n\n modifyUtilityRelation(nodeUtil, nodeToRemove, true);\n\n // Calculate the new expected utility \n getExpectedUtility(nodeUtil, nodeToRemove);\n\n // The node is deleted \n\n diag.removeNodeOnly(nodeToRemove);\n\n//\t\t\t\tStore the size of the diagram\n\n statistics.addSize(diag.calculateSizeOfPotentials());\n\n statistics.addTime(crono.getTime());\n\n indexOperation++;\n try {\n diag.save(\"debug-operation-\" + indexOperation + \".elv\");\n } catch (IOException ex) {\n Logger.getLogger(ArcReversalSV.class.getName()).log(Level.SEVERE, null, ex);\n }\n // Set removed \n removed = true;\n\n }\n }//for\n return removed;\n }", "@Override\r\n public Set<List<String>> findAllPaths(int sourceId, int targetId, int reachability) {\r\n //all paths found\r\n Set<List<String>> allPaths = new HashSet<List<String>>();\r\n //collects path in one iteration\r\n Set<List<String>> newPathsCollector = new HashSet<List<String>>();\r\n //same as the solution but with inverted edges\r\n Set<List<String>> tmpPathsToTarget = new HashSet<List<String>>();\r\n //final solution\r\n Set<List<String>> pathsToTarget = new HashSet<List<String>>();\r\n \r\n String[] statementTokens = null; \r\n Set<Integer> allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n List<String> statementsFound = new ArrayList<String>();\r\n \r\n for (int i = 0; i < reachability; i++) {\r\n if (i == 0) { \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(sourceId);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n //allProcessedNodes.add(inNodeId); \r\n //Incoming nodes are reversed\r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n allPaths.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(sourceId);\r\n \r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n statementsFound.add(outEdge);\r\n allPaths.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n } else {\r\n newPathsCollector = new HashSet<List<String>>();\r\n\r\n for (List<String> statements: allPaths) {\r\n allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n int lastNodeInPath = 0;\r\n \r\n for (String predicate: statements) {\r\n if (predicate.contains(\">-\")) {\r\n statementTokens = predicate.split(\">-\");\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[0]).reverse().toString()));\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString()));\r\n lastNodeInPath = Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString());\r\n } else {\r\n statementTokens = predicate.split(\"->\"); \r\n allProcessedNodes.add(Integer.parseInt(statementTokens[0]));\r\n allProcessedNodes.add(Integer.parseInt(statementTokens[2]));\r\n lastNodeInPath = Integer.parseInt(statementTokens[2]);\r\n }\r\n }\r\n \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(lastNodeInPath);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n if (allProcessedNodes.contains(inNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n newPathsCollector.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(lastNodeInPath);\r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n if (allProcessedNodes.contains(outNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(outEdge);\r\n newPathsCollector.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n }\r\n allPaths.addAll(newPathsCollector);\r\n }\r\n \r\n //System.out.println(\"*****End of iteration \" + i);\r\n //System.out.println(\"#SIZE OF allPaths: \" + allPaths.size());\r\n int numItems = 0;\r\n for (List<String> currList: allPaths) {\r\n numItems = numItems + currList.size();\r\n }\r\n //System.out.println(\"#NUMBER OF ELEMS OF ALL LISTS: \" + numItems);\r\n //System.out.println(\"#SIZE OF tmpPathsToTarget : \" + tmpPathsToTarget.size());\r\n }\r\n \r\n //We need to reverse back all the predicates\r\n for (List<String> statements: tmpPathsToTarget) { \r\n List<String> fixedStatements = new ArrayList<String>(); \r\n for (int i = 0; i < statements.size(); i++) { \r\n String statement = statements.get(i); \r\n if (statement.contains(\">-\")) {\r\n fixedStatements.add(new StringBuilder(statement).reverse().toString());\r\n } else {\r\n fixedStatements.add(statement);\r\n } \r\n }\r\n pathsToTarget.add(fixedStatements);\r\n }\r\n return pathsToTarget;\r\n }", "private List<Set<GraphChange>> findChanges(Map<Collection<Node>, List<PossibleDConnectingPath>> paths) {\n List<Set<GraphChange>> pagChanges = new ArrayList<>();\n\n Set<Map.Entry<Collection<Node>, List<PossibleDConnectingPath>>> entries = paths.entrySet();\n /* Loop through each entry, ie each conditioned set of variables. */\n for (Map.Entry<Collection<Node>, List<PossibleDConnectingPath>> entry : entries) {\n Collection<Node> conditions = entry.getKey();\n List<PossibleDConnectingPath> dConnecting = entry.getValue();\n\n /* loop through each path */\n for (PossibleDConnectingPath possible : dConnecting) {\n List<Node> possPath = possible.getPath();\n /* Created with 2*# of undirectedPaths as appoximation. might have to increase size once */\n Set<GraphChange> pathChanges = new HashSet<>(2 * possPath.size());\n\n /* find those conditions which are not along the path (used in colider) */\n List<Node> outsidePath = new ArrayList<>(conditions.size());\n for (Node condition : conditions) {\n if (!possPath.contains(condition))\n outsidePath.add(condition);\n }\n\n /* Walk through path, node by node */\n for (int i = 0; i < possPath.size() - 1; i++) {\n Node current = possPath.get(i);\n Node next = possPath.get(i + 1);\n GraphChange gc;\n\n /* for each pair of nodes, add the operation to remove their edge */\n gc = new GraphChange();\n gc.addRemove(possible.getPag().getEdge(current, next));\n pathChanges.add(gc);\n\n /* for each triple centered on a node which is an element of the conditioning\n * set, add the operation to orient as a nonColider around that node */\n if (conditions.contains(current) && i > 0) {\n gc = new GraphChange();\n Triple nonColider = new Triple(possPath.get(i - 1), current, next);\n gc.addNonCollider(nonColider);\n pathChanges.add(gc);\n }\n\n /* for each node on the path not in the conditioning set, make a colider. It\n * is necessary though to ensure that there are no undirectedPaths implying that a\n * conditioned variable (even outside the path) is a decendant of a colider */\n if ((!conditions.contains(current)) && i > 0) {\n Triple colider = new Triple(possPath.get(i - 1), current, next);\n\n if (possible.getPag().isUnderlineTriple(possPath.get(i - 1), current, next))\n continue;\n\n Edge edge1 = possible.getPag().getEdge(colider.getX(), colider.getY());\n Edge edge2 = possible.getPag().getEdge(colider.getZ(), colider.getY());\n\n if (edge1.getNode1().equals(colider.getY())) {\n if (edge1.getEndpoint1().equals(Endpoint.TAIL)) {\n continue;\n }\n } else if (edge1.getNode2().equals(colider.getY())) {\n if (edge1.getEndpoint2().equals(Endpoint.TAIL)) {\n continue;\n }\n }\n\n if (edge2.getNode1().equals(colider.getY())) {\n if (edge2.getEndpoint1().equals(Endpoint.TAIL)) {\n continue;\n }\n } else if (edge2.getNode2().equals(colider.getY())) {\n if (edge2.getEndpoint2().equals(Endpoint.TAIL)) {\n continue;\n }\n }\n\n /* Simple case, no conditions outside the path, so just add colider */\n if (outsidePath.size() == 0) {\n gc = new GraphChange();\n gc.addCollider(colider);\n pathChanges.add(gc);\n continue;\n }\n\n /* ensure nondecendency in possible path between getModel and each conditioned\n * variable outside the path */\n for (Node outside : outsidePath) {\n\n /* list of possible decendant undirectedPaths */\n\n List<PossibleDConnectingPath> decendantPaths = new ArrayList<>();\n decendantPaths\n = PossibleDConnectingPath.findDConnectingPaths\n (possible.getPag(), current, outside, new ArrayList<Node>());\n\n if (decendantPaths.isEmpty()) {\n gc = new GraphChange();\n gc.addCollider(colider);\n pathChanges.add(gc);\n continue;\n }\n\n /* loop over each possible path which might indicate decendency */\n for (PossibleDConnectingPath decendantPDCPath : decendantPaths) {\n List<Node> decendantPath = decendantPDCPath.getPath();\n\n /* walk down path checking orientation (path may already\n * imply non-decendency) and creating changes if need be*/\n boolean impliesDecendant = true;\n Set<GraphChange> colideChanges = new HashSet<>();\n for (int j = 0; j < decendantPath.size() - 1; j++) {\n Node from = decendantPath.get(j);\n // chaneges from +1\n Node to = decendantPath.get(j + 1);\n Edge currentEdge = possible.getPag().getEdge(from, to);\n\n if (currentEdge.getEndpoint1().equals(Endpoint.ARROW)) {\n impliesDecendant = false;\n break;\n }\n\n gc = new GraphChange();\n gc.addCollider(colider);\n gc.addRemove(currentEdge);\n colideChanges.add(gc);\n\n gc = new GraphChange();\n gc.addCollider(colider);\n gc.addOrient(to, from);\n colideChanges.add(gc);\n }\n if (impliesDecendant)\n pathChanges.addAll(colideChanges);\n }\n }\n }\n }\n\n pagChanges.add(pathChanges);\n }\n }\n return pagChanges;\n }", "public void removeEdge() {\n Graph GO = new Graph(nbOfVertex + 1);\n Value.clear();\n for (int i = 0; i < x.length; i++) {\n for (int j : x[i].getDomain()) {\n Value.add(j);\n if (MaxMatch[i] == Map.get(j)) {\n GO.addEdge(Map.get(j), i);\n } else {\n GO.addEdge(i, Map.get(j));\n }\n }\n }\n\n for (int i : V2) {\n for (int j : Value) {\n if (!V2.contains(j)) {\n GO.addEdge(i, j);\n }\n }\n }\n //System.out.println(\"GO : \");\n //System.out.println(GO);\n int[] map2Node = GO.findStrongConnectedComponent();\n //GO.printSCC();\n\n ArrayList<Integer>[] toRemove = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n toRemove[i] = new ArrayList<Integer>();\n }\n for (int i = 0; i < n; i++) {\n for (int j : x[i].getDomain()) {\n ////System.out.println(i + \" \" + j);\n if (map2Node[i] != map2Node[Map.get(j)] && MaxMatch[i] != Map.get(j)) {\n toRemove[i].add(j);\n if (debug == 1) System.out.println(\"Remove arc : \" + i + \" => \" + j);\n }\n }\n }\n for (int i = 0; i < n; i++) {\n for (int j : toRemove[i]) {\n x[i].removeValue(j);\n }\n }\n }", "private void removeEdgeJointPointDest(Vector<Edge> edges) {\n\t\tfor (Edge e: edges) {\n\t\t\t\tEdge currentEdge = e;\n\t\t\t\tremoveEdge(e);\n\t\t\t\twhile (shapes.contains(currentEdge.getDest()) && currentEdge.getDest() instanceof JoinPoint) {\n\t\t\t\t\tJoinPoint join = (JoinPoint) currentEdge.getDest();\n\t\t\t\t\tshapes.remove(join);\n\t\t\t\t\tcurrentEdge = (Edge) join.getDest();\n\t\t\t\t\tremoveEdge(currentEdge);\n\t\t\t\t}\n\t\t}\n\t}", "List<List<Node>> findUndirectedPaths(Node s, Node d) {\n\t\tList<List<Node>> paths = new ArrayList<>();\n\t\tpath(s, d, new HashSet<>(), new ArrayList<>(), paths);\n System.out.println(\"Computed paths: \" + paths);\n return paths;\n\t}", "private static void remove(State state) {\n String rp, sp, u, tp, rn, sn, tn, spn;\n List<State> prevS;\n List<State> nextS;\n for (State previous : previousStates.get(state)) {\n\n if (previous == state)\n continue;\n rp = getLabel(previous, previous);\n sp = getLabel(previous, state);\n u = getLabel(state, state);\n tp = getLabel(state, previous);\n\n if (sp.equals(\"\"))\n continue;\n\n boolean empty = true;\n for (State next : nextStates.get(state)) {\n\n if (next == state)\n continue;\n empty = false;\n rn = getLabel(next, next);\n sn = getLabel(state, next);\n tn = getLabel(next, state);\n spn = getLabel(previous, next);\n\n if (spn.length() > 0)\n spn = \"(\" + spn + \")\" + \"|\" + \"(\" + sp + \")\" + \"(\" + u + \")*\" + \"(\" + sn + \")\";\n else\n spn = \"(\" + sp + \")\" + \"(\" + u + \")*\" + \"(\" + sn + \")\";\n if (tp.length() > 0) {\n if (rp.length() > 0)\n rp = \"(\" + rp + \")\" + \"|\" + \"(\" + sp + \")\" + \"(\" + u + \")*\"\n + \"(\" + tp + \")\";\n else\n rp = \"(\" + sp + \")\" + \"(\" + u + \")*\" + \"(\" + tp + \")\";\n }\n if (tn.length() > 0) {\n if (rn.length() > 0)\n rn = \"(\" + rn + \")\" + \"|\" + \"(\" + tn + \")\" + \"(\" + u + \")*\"\n + \"(\" + sn + \")\";\n else\n rn = \"(\" + tn + \")\" + \"(\" + u + \")*\" + \"(\" + sn + \")\";\n }\n\n nextS = nextStates.get(previous);\n nextS.add(next);\n nextStates.put(previous, nextS);\n\n prevS = previousStates.get(next);\n prevS.add(previous);\n previousStates.put(next, prevS);\n\n nextS = nextStates.get(next);\n if (nextS.contains(state)) {\n nextS.remove(state);\n nextStates.put(next, nextS);\n prevS = previousStates.get(next);\n prevS.remove(state);\n previousStates.put(next, prevS);\n transitionLabels.remove(hashOf(next, state));\n }\n\n transitionLabels.put(hashOf(previous, next), spn);\n transitionLabels.put(hashOf(previous, previous), rp);\n transitionLabels.put(hashOf(next, next), rn);\n }\n\n if (empty)\n continue;\n nextS = nextStates.get(previous);\n nextS.remove(state);\n nextStates.put(previous, nextS);\n transitionLabels.remove(hashOf(previous, state));\n }\n nextStates.remove(state);\n previousStates.remove(state);\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic Map<V, Point2D> execute(Path<V,E> S){\n\n\t\tMap<V, Point2D> ret = new HashMap<V, Point2D>();\n\n\t\t//determine position of S* vertices\n\t\t//TODO center as algorithm parameter\n\t\tPoint2D center = new Point(0,0);\n\n\t\t//convex testing returns S which is equal to S* (there are no vertices \n\t\t//in S which are not in S\n\n\t\tList<V> Svertices = S.pathVertices();\n\t\tSvertices.remove(Svertices.size() - 1);\n\t\tlog.info(\"Face vertices \" + Svertices);\n\t\tCircleLayoutCalc<V> circleCalc = new CircleLayoutCalc<V>();\n\t\tdouble radius = circleCalc.calculateRadius(Svertices, treshold);\n\t\tMap<V,Point2D> positions = circleCalc.calculatePosition(Svertices, radius, center);\n\t\tlog.info(\"Calculating positions of the outer cycle\");\n\t\tlog.info(positions);\n\t\tret.putAll(positions);\n\n\n\t\t//step one - for each vertex v of degree two not on S\n\t\t//replace v together with two edges incident to v with a \n\t\t//single edge joining the vertices adjacent to v\n\n\t\t//leave the original graph intact - make a copy to start with\n\t\tGraph<V,E> gPrim = Util.copyGraph(graph);\n\t\t//store deleted vertices in order to position them later\n\t\tMap<V, E> deletedAdjacentMap = new HashMap<V,E>();\n\n\n\t\t//once a vertex is deleted and its two edges are deleted\n\t\t//and a new one is created\n\t\t//there might be a vertex with degree 2 connected to the deleted vertex\n\t\t//we don't want to create an edge containing the deleted vertex\n\t\t//the newly created edge should be taken into account\n\n\t\tIterator<V> iter = gPrim.getVertices().iterator();\n\t\twhile (iter.hasNext()){\n\t\t\tV v = iter.next();\n\t\t\tif (!Svertices.contains(v) && gPrim.vertexDegree(v) == 2){\n\t\t\t\tlog.info(\"Deleting \" + v);\n\t\t\t\tList<E> edges = gPrim.adjacentEdges(v);\n\t\t\t\tE e1 = edges.get(0);\n\t\t\t\tE e2 = edges.get(1);\n\t\t\t\tlog.info(\"removing \" + e1);\n\t\t\t\tlog.info(\"removing \" + e2);\n\t\t\t\tgPrim.removeEdge(e1);\n\t\t\t\tgPrim.removeEdge(e2);\n\t\t\t\tV adjV1 = e1.getOrigin() == v ? e1.getDestination() : e1.getOrigin();\n\t\t\t\tV adjV2 = e2.getOrigin() == v ? e2.getDestination() : e2.getOrigin();\n\t\t\t\tE newEdge = Util.createEdge(adjV1, adjV2, edgeClass);\n\t\t\t\tlog.info(\"Creating \" + newEdge);\n\t\t\t\tgPrim.addEdge(newEdge);\n\t\t\t\tdeletedAdjacentMap.put(v,newEdge);\n\t\t\t}\n\t\t}\n\n\t\tfor (V v : deletedAdjacentMap.keySet()){\n\t\t\tgPrim.removeVertex(v);\n\t\t}\n\n\n\t\tlog.info(\"G': \" + gPrim);\n\t\t//step 2 - call Draw on (G', S, S*) to extend S* into a convex drawing of G'\n\t\tdraw(gPrim, S.getPath(), Svertices, ret);\n\n\t\t//step 3 For each deleted vertex of degree 2 determine its position on the straight \n\t\t//line segment joining the two vertices adjacent to the vertex\n\n\t\tSet<V> deletedVertices = deletedAdjacentMap.keySet();\n\t\tList<V> coveredVertices = new ArrayList<V>();\n\n\t\tlog.info(\"deleted vertices: \" + deletedVertices);\n\n\t\tfor (V v : deletedVertices){\n\n\t\t\tif (coveredVertices.contains(v))\n\t\t\t\tcontinue;\n\n\t\t\tE addedEdge = deletedAdjacentMap.get(v);\n\t\t\tV firstAdjacent = addedEdge.getOrigin();\n\t\t\tV secondAdjacent = addedEdge.getDestination();\n\t\t\tPoint2D pos1 = ret.get(firstAdjacent);\n\t\t\tPoint2D pos2 = ret.get(secondAdjacent);\n\t\t\tif (pos1 != null && pos2 != null){\n\t\t\t\t//find deleted vertices on this line\n\n\t\t\t\tList<E> adjacentEdges = graph.adjacentEdges(v);\n\t\t\t\tE e1 = adjacentEdges.get(0);\n\t\t\t\tE e2 = adjacentEdges.get(1);\n\t\t\t\tV e1Next = e1.getOrigin() == v ? e1.getDestination() : e1.getOrigin();\n\t\t\t\tV e2Next = e2.getOrigin() == v ? e2.getDestination() : e2.getOrigin();\n\n\t\t\t\tif ((e1Next == firstAdjacent && e2Next == secondAdjacent) ||\n\t\t\t\t\t\t(e2Next == firstAdjacent && e1Next == secondAdjacent)){\n\n\t\t\t\t\t//just one vertex between two known\n\n\t\t\t\t\tdouble xPos = ret.get(e1Next).getX() + ((ret.get(e2Next).getX() - ret.get(e1Next).getX()) / 2);\n\t\t\t\t\tdouble yPos = ret.get(e1Next).getY() + ((ret.get(e2Next).getY() - ret.get(e1Next).getY()) / 2);\n\t\t\t\t\tret.put(v, new Point2D.Double(xPos, yPos));\n\t\t\t\t}\n\t\t\t\telse{\n\n\t\t\t\t\tList<V> verticesOnLine = new ArrayList<V>();\n\t\t\t\t\tverticesOnLine.add(v);\n\n\t\t\t\t\t//in all probability, traversing e1 is enough as the\n\t\t\t\t\t//vertex won't be somewhere in the middle, but directly \n\t\t\t\t\t//connected to one of the vertices whose positions are known\n\t\t\t\t\t//keep both for now\n\t\t\t\t\t//traverse e1\n\t\t\t\t\tE currentE = e1;\n\t\t\t\t\tint numberThroughE1 = 0;\n\t\t\t\t\twhile (e1Next != firstAdjacent && e1Next != secondAdjacent){\n\t\t\t\t\t\tif (!verticesOnLine.contains(e1Next)){\n\t\t\t\t\t\t\tverticesOnLine.add(e1Next);\n\t\t\t\t\t\t\tnumberThroughE1++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tList<E> currentAdjacent = graph.adjacentEdges(e1Next);\n\t\t\t\t\t\tif (currentAdjacent.get(0) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(1);\n\t\t\t\t\t\telse if (currentAdjacent.get(1) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(0);\n\n\t\t\t\t\t\te1Next = currentE.getOrigin() == e1Next ? currentE.getDestination() : currentE.getOrigin();\n\t\t\t\t\t}\n\n\n\t\t\t\t\t//traverse e2\n\t\t\t\t\tcurrentE = e2;\n\t\t\t\t\twhile (e2Next != firstAdjacent && e2Next != secondAdjacent){\n\t\t\t\t\t\tif (!verticesOnLine.contains(e2Next))\n\t\t\t\t\t\t\tverticesOnLine.add(e2Next);\n\n\t\t\t\t\t\tList<E> currentAdjacent = graph.adjacentEdges(e2Next);\n\t\t\t\t\t\tif (currentAdjacent.get(0) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(1);\n\t\t\t\t\t\telse if (currentAdjacent.get(1) == currentE)\n\t\t\t\t\t\t\tcurrentE = currentAdjacent.get(0);\n\n\t\t\t\t\t\te2Next = currentE.getOrigin() == e2Next ? currentE.getDestination() : currentE.getOrigin();\n\t\t\t\t\t}\n\n\t\t\t\t\tlog.info(\"vertices on line: \" + verticesOnLine);\n\t\t\t\t\tcoveredVertices.addAll(verticesOnLine);\n\n\t\t\t\t\tint numberOfVerticesOnLine = verticesOnLine.size();\n\t\t\t\t\tdouble incrementX = (ret.get(e2Next).getX() - ret.get(e1Next).getX()) / (numberOfVerticesOnLine + 1);\n\t\t\t\t\tdouble incrementY = (ret.get(e2Next).getY() - ret.get(e1Next).getY()) / (numberOfVerticesOnLine + 1);\n\n\t\t\t\t\tPoint2D currentPosition = ret.get(e1Next); //e1Next holds a vertex whose position is known\n\n\t\t\t\t\tfor (int i = numberThroughE1; i >= 0; i--){\n\t\t\t\t\t\tV currentV = verticesOnLine.get(i);\n\t\t\t\t\t\tPoint2D position = new Point2D.Double(currentPosition.getX() + incrementX, currentPosition.getY() + incrementY);\n\t\t\t\t\t\tret.put(currentV, position);\n\t\t\t\t\t\tcurrentPosition = position;\n\t\t\t\t\t}\n\n\n\t\t\t\t\tfor (int i = numberThroughE1 + 1; i< numberOfVerticesOnLine; i++){\n\t\t\t\t\t\tV currentV = verticesOnLine.get(i);\n\t\t\t\t\t\tPoint2D position = new Point2D.Double(currentPosition.getX() + incrementX, currentPosition.getY() + incrementY);\n\t\t\t\t\t\tret.put(currentV, position);\n\t\t\t\t\t\tcurrentPosition = position;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn ret;\n\t}", "@Test public void testPublic9() {\n Graph<Character> graph= TestGraphs.testGraph3();\n char[] toRemove= {'I', 'H', 'B', 'J', 'C', 'G', 'E', 'F'};\n int i;\n\n for (i= 0; i < toRemove.length; i++) {\n graph.removeVertex(toRemove[i]);\n assertFalse(graph.hasVertex(toRemove[i]));\n }\n }", "public void test_ck_03() {\n // part A - surprising reification\n OntModel model1 = ModelFactory.createOntologyModel(OntModelSpec.DAML_MEM, null);\n OntModel model2 = ModelFactory.createOntologyModel(OntModelSpec.DAML_MEM_RULE_INF, null);\n \n Individual sub = model1.createIndividual(\"http://mytest#i1\", model1.getProfile().CLASS());\n OntProperty pred = model1.createOntProperty(\"http://mytest#\");\n Individual obj = model1.createIndividual(\"http://mytest#i2\", model1.getProfile().CLASS());\n OntProperty probabilityP = model1.createOntProperty(\"http://mytest#prob\");\n \n Statement st = model1.createStatement(sub, pred, obj);\n model1.add(st);\n st.createReifiedStatement().addProperty(probabilityP, 0.9);\n assertTrue(\"st should be reified\", st.isReified());\n \n Statement st2 = model2.createStatement(sub, pred, obj);\n model2.add(st2);\n st2.createReifiedStatement().addProperty(probabilityP, 0.3);\n assertTrue(\"st2 should be reified\", st2.isReified());\n \n sub.addProperty(probabilityP, 0.3);\n sub.removeAll(probabilityP).addProperty(probabilityP, 0.3); //!!!\n // exception\n \n // Part B - exception in remove All\n Individual sub2 = model2.createIndividual(\"http://mytest#i1\", model1.getProfile().CLASS());\n \n sub.addProperty(probabilityP, 0.3);\n sub.removeAll(probabilityP); //!!! exception\n \n sub2.addProperty(probabilityP, 0.3);\n sub2.removeAll(probabilityP); //!!! exception\n \n }", "public void removeEdge(int s,int d) throws Exception\r\n\t{\r\n\t\tif(s>=0&&s<n&&d>=0&&d<n)\r\n\t\t{\r\n\t\t\tLinkedList l=g.get(s);\r\n\t\t\tl.deleteMatched(g.get(d).getHead());\r\n\t\t\t\r\n\t\t\t//undirected graph\r\n\t\t\tLinkedList l1=g.get(d);\r\n\t\t\tl1.deleteMatched(g.get(s).getHead());\r\n\t\t}\r\n\t}", "public void removeCutVertices() {\n boolean found;\n LinkedList<Integer> isolated = new LinkedList<>();\n do {\n found = false;\n for (Map.Entry<Integer, Set<Integer>> entry : adjacencyMap.entrySet()) {\n// System.out.println(\"adjacency print key: \" + entry.getKey() + \"value: \" +\n// entry.getValue() + \"set size: \" + entry.getValue().size());\n if (entry.getValue().size() == 1) {\n// System.out.println(\"found cut vertex\");\n found = true; // loop yielded a cut vertex\n // get the only vertex in the set\n for (Integer integer : entry.getValue()) {\n// System.out.println(\"started set iterator\" + integer);\n int removalSet = integer; // take the value of the set element\n // create a temp set\n Set<Integer> tempSet = adjacencyMap.get(removalSet);\n tempSet.remove(entry.getKey()); // remove the cut vertex from this set\n adjacencyMap.replace(removalSet, tempSet); // put the smaller set in place\n }\n isolated.add(entry.getKey());\n\n\n }\n\n }\n // remove isolated vertices\n for (Integer vert : isolated) {\n adjacencyMap.remove(vert);\n }\n isolated.clear();\n } while (found);\n }", "void removeEdges(List<CyEdge> edges);", "protected void removeAndUpdateEntities(Graph graph, List<Integer> toRemove, Map<Integer, Integer> checkMentionDegree,\n Map<Integer, Integer> mentionMaxEntity, Map<Integer, Double> mentionMaxWeightedDegree) {\n for (int mention : checkMentionDegree.keySet()) {\n\n if (checkMentionDegree.get(mention).intValue() == mentionDegrees.get(mention).intValue()) {\n int maxEntity = mentionMaxEntity.get(mention);\n double maxWeightedDegree = mentionMaxWeightedDegree.get(mention);\n toRemove.remove(new Integer(maxEntity));\n entityWeightedDegrees.remove(maxEntity);\n entitySortedDegrees.remove(maxEntity + \":::\" + maxWeightedDegree);\n\n notRemovableEntityWeightedDegrees.put(maxEntity, maxWeightedDegree);\n notRemovableEntitySortedDegrees.add(maxEntity + \":::\" + maxWeightedDegree);\n }\n }\n\n for (int en : toRemove) {\n GraphNode node = graph.getNode(en);\n TIntDoubleHashMap successorsMap = node.getSuccessors();\n TIntDoubleIterator successorsIterator = successorsMap.iterator();\n for (int i = successorsMap.size(); i-- > 0; ) {\n successorsIterator.advance();\n\n int successorId = successorsIterator.key();\n double edgeWeight = successorsIterator.value();\n if (graph.isMentionNode(successorId)) {\n // Mention successor\n int oldDegree = mentionDegrees.get(successorId);\n mentionDegrees.put(successorId, --oldDegree);\n } else {\n if (entityWeightedDegrees.get(successorId) != null) {\n double oldWeightedDegree = entityWeightedDegrees.get(successorId);\n\n double newWeightedDegree = oldWeightedDegree - edgeWeight;\n entityWeightedDegrees.put(successorId, newWeightedDegree);\n entitySortedDegrees.remove(successorId + \":::\" + oldWeightedDegree);\n entitySortedDegrees.add(successorId + \":::\" + newWeightedDegree);\n } else if (notRemovableEntityWeightedDegrees.get(successorId) != null) {\n double oldWeightedDegree = notRemovableEntityWeightedDegrees.get(successorId);\n double newWeightedDegree = oldWeightedDegree - edgeWeight;\n notRemovableEntityWeightedDegrees.put(successorId, newWeightedDegree);\n notRemovableEntitySortedDegrees.remove(successorId + \":::\" + oldWeightedDegree);\n notRemovableEntitySortedDegrees.add(successorId + \":::\" + newWeightedDegree);\n }\n }\n\n } // end updating all the neighbor nodes\n\n double oldDegree = entityWeightedDegrees.get(en);\n entitySortedDegrees.remove(en + \":::\" + oldDegree);\n entityWeightedDegrees.remove(en);\n graph.setRemoved(en);\n\n // removed++;\n } // end remove loop\n logger.debug(\"Iteration 1 Nodes removed: \" + toRemove.size());\n\n GraphTracer.gTracer.addStat(graph.getName(), \"Entities removed by distance constraint\", Integer.toString(toRemove.size()));\n }", "@Test\r\n void insert_multiple_vertexes_and_edges_remove_vertex() {\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"B\", \"C\");\r\n graph.addEdge(\"A\", \"C\");\r\n graph.addEdge(\"B\", \"D\");\r\n \r\n List<String> adjacent;\r\n vertices = graph.getAllVertices(); \r\n int numberOfEdges = graph.size();\r\n int numberOfVertices = graph.order();\r\n if(numberOfEdges != 4) {\r\n fail();\r\n }\r\n if(numberOfVertices != 4) {\r\n fail();\r\n }\r\n \r\n // Check that graph has all added vertexes\r\n if(!vertices.contains(\"A\")| !vertices.contains(\"B\")|\r\n !vertices.contains(\"C\")|!vertices.contains(\"D\")) {\r\n fail();\r\n }\r\n \r\n // Check that A's outgoing edges are correct\r\n adjacent = graph.getAdjacentVerticesOf(\"A\");\r\n if (!adjacent.contains(\"B\") || !adjacent.contains(\"C\"))\r\n fail();\r\n // Check that B's outgoing edges are correct\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if (!adjacent.contains(\"C\") | !adjacent.contains(\"D\"))\r\n fail(); \r\n // C and D have no out going edges \r\n adjacent = graph.getAdjacentVerticesOf(\"C\");\r\n if (!adjacent.isEmpty())\r\n fail(); \r\n adjacent = graph.getAdjacentVerticesOf(\"D\");\r\n if (!adjacent.isEmpty())\r\n fail(); \r\n // Remove B from the graph \r\n graph.removeVertex(\"B\");\r\n // Check that A's outgoing edges are correct\r\n // An edge to B should no exist any more \r\n adjacent = graph.getAdjacentVerticesOf(\"A\");\r\n if (adjacent.contains(\"B\") || !adjacent.contains(\"C\"))\r\n fail();\r\n // There should be no elements in the list of successors\r\n // of B since its deleted form the graph\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if (!adjacent.isEmpty())\r\n fail(); \r\n // Check that graph has still has all vertexes not removed\r\n if(!vertices.contains(\"A\")| !vertices.contains(\"C\")|\r\n !vertices.contains(\"D\")) {\r\n fail();\r\n }\r\n //Check that vertex B was removed from graph \r\n if(vertices.contains(\"B\")) {\r\n fail();\r\n }\r\n numberOfEdges = graph.size();\r\n numberOfVertices = graph.order();\r\n if(numberOfEdges != 1) {\r\n fail();\r\n }\r\n if(numberOfVertices != 3) {\r\n fail();\r\n }\r\n }", "private final void pruneParallelSkipEdges() {\n // TODO: IF THERE ARE MULTIPLE EDGES WITH THE SAME EDGE WEIGHT, WE ARBITRARILY PICK THE FIRST EDGE TO KEEP\n // THE ORDERING MAY BE DIFFERENT FROM BOTH SIDES OF THE EDGE, WHICH CAN LEAD TO A NONSYMMETRIC GRAPH\n // However, no issues have cropped up yet. Perhaps the ordering happens to be the same for both sides,\n // due to how the graph is constructed. This is not good to rely upon, however.\n Memory.initialise(maxSize, Float.POSITIVE_INFINITY, -1, false);\n \n int maxDegree = 0;\n for (int i=0;i<nNodes;++i) {\n maxDegree = Math.max(maxDegree, nSkipEdgess[i]);\n }\n \n int[] neighbourIndexes = new int[maxDegree];\n int[] lowestCostEdgeIndex = new int[maxDegree];\n float[] lowestCost = new float[maxDegree];\n int nUsed = 0;\n \n for (int i=0;i<nNodes;++i) {\n nUsed = 0;\n int degree = nSkipEdgess[i];\n int[] sEdges = outgoingSkipEdgess[i];\n float[] sWeights = outgoingSkipEdgeWeightss[i];\n \n for (int j=0;j<degree;++j) {\n int dest = sEdges[j];\n float weight = sWeights[j];\n \n int p = Memory.parent(dest);\n int index = -1;\n \n if (p == -1) {\n index = nUsed;\n ++nUsed;\n \n Memory.setParent(dest, index);\n neighbourIndexes[index] = dest;\n \n lowestCostEdgeIndex[index] = j;\n lowestCost[index] = weight;\n } else {\n index = p;\n if (weight < lowestCost[index]) {\n // Remove existing\n \n /* ________________________________\n * |______E__________C____________L_|\n * ________________________________\n * |______C__________L____________E_|\n * ^\n * |\n * nSkipEdges--\n */\n swapSkipEdges(i, lowestCostEdgeIndex[index], j);\n swapSkipEdges(i, j, degree-1);\n --j; --degree;\n \n // lowestCostEdgeIndex[index] happens to be the same as before.\n lowestCost[index] = weight;\n } else {\n // Remove this.\n \n /* ________________________________\n * |______E__________C____________L_|\n * ________________________________\n * |______E__________L____________C_|\n * ^\n * |\n * nSkipEdges--\n */\n swapSkipEdges(i, j, degree-1);\n --j; --degree;\n }\n }\n \n }\n nSkipEdgess[i] = degree;\n \n // Cleanup\n for (int j=0;j<nUsed;++j) {\n Memory.setParent(neighbourIndexes[j], -1); \n }\n }\n }", "private TIntSet removeUnconnectedMentionEntityPairs(Graph g, Map<ResultMention, List<ResultEntity>> solution) {\n TIntSet mentionsToRemove = new TIntHashSet();\n for (int mentionId : g.getMentionNodesIds().values()) {\n GraphNode mentionNode = g.getNode(mentionId);\n Mention mention = (Mention) mentionNode.getNodeData();\n TIntDoubleHashMap entityCandidates = mentionNode.getSuccessors();\n if (entityCandidates.size() == 0) {\n continue;\n }\n // Remove all mentions without any entities that have coherence edges.\n if (g.isLocalMention(mentionId)) {\n logger.debug(\"local mention removed: \" + mentionId + \" \" + mention);\n mentionsToRemove.add(mentionId);\n GraphTracer.gTracer.addMentionToDangling(g.getName(), mention.getMention(), mention.getCharOffset());\n // Set solution to best local candidate.\n Pair<Integer, Double> bestEntityScore = getBestLocalCandidateAndScore(entityCandidates);\n int bestEntity = bestEntityScore.getKey();\n double score = bestEntityScore.getValue();\n updateSolution(solution, g, mention, bestEntity, score);\n }\n\n }\n TIntSet entitiesToRemove = new TIntHashSet();\n // Remove entities that are only connected to removed mentions.\n for (int entityId : g.getEntityNodesIds().values()) {\n GraphNode entityNode = g.getNode(entityId);\n TIntDoubleHashMap successors = entityNode.getSuccessors();\n int removedCount = 0;\n for (TIntDoubleIterator itr = successors.iterator(); itr.hasNext(); ) {\n itr.advance();\n int neighborId = itr.key();\n if (mentionsToRemove.contains(neighborId)) {\n ++removedCount;\n }\n }\n if (removedCount == successors.size()) {\n entitiesToRemove.add(entityId);\n }\n }\n // Remove mentions + entity candidates from graph, trace.\n TIntSet nodesToRemove = new TIntHashSet(mentionsToRemove.size() + entitiesToRemove.size());\n nodesToRemove.addAll(mentionsToRemove);\n nodesToRemove.addAll(entitiesToRemove);\n return nodesToRemove;\n }", "private void removeEffects(PlanGraphStep stepToRemove, int currentLevel, boolean propagate) {\n\t\t\n\t\tSet<PlanGraphStep> currentSteps = steps.get(currentLevel);\n\t\tSet<PlanGraphLiteral> currentFacts = facts.get(currentLevel);\n\t\t/* propagate removal until steps no longer exists*/\n\t\tif (currentSteps.contains(stepToRemove)){\n\t\t\t\n\t\t\tcurrentSteps.remove(stepToRemove);\n\t\t\tfor (PlanGraphLiteral pgLiteral : stepToRemove.getChildNodes()) {\n\t\t\t\t/* check to see if another step at this level has the effect pgLiteral */\n\t\t\t\tif (Collections.disjoint(currentSteps, pgLiteral.getParentNodes())) {\n\t\t\t\t\tcurrentFacts.remove(pgLiteral);\n\t\t\t\t\tif (propagate == true && currentLevel + 1 < maxLevel) {\n\t\t\t\t\t\tif (stepToRemove.isPersistent()) {\n\t\t\t\t\t\t\tremoveStep(stepToRemove, currentLevel + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tPlanGraphStep persistentStep = persistentSteps.get(pgLiteral);\n\t\t\t\t\t\t\tremoveStep(persistentStep, currentLevel + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private LPGActionGraph getDeleteNeighbor(List<PlanGraphStep> removeChoices,\n\t\t\tUnsupportedPrecondition inconsistency, int currentLevel) {\n\t\t\n\t\tLPGActionGraph neighbor = this.copyActionGraph();\n\t\t\n\t\tfor (PlanGraphStep stepToRemove : removeChoices) {\n\t\t\tneighbor.removeEffects(stepToRemove, currentLevel + 1);\n\t\t\tneighbor.removeInvalidMutex(stepToRemove, currentLevel + 1);\n\t\t}\n\t\tneighbor.removeInconsistency(inconsistency);\n\t\tneighbor.updateUnsupportedPreconditionInconsistencies(currentLevel + 1);\n\t\tneighbor.graphQuality = neighbor.calculateQuality();\n\t\treturn neighbor;\n\t}", "private static Set<ARGState> removeSet(Set<ARGState> elements) {\n Set<ARGState> toWaitlist = new LinkedHashSet<ARGState>();\n int i=0;\n for (ARGState ae : elements) {\n if(ae.getParents()!=null){\n for (ARGState parent : ae.getParents()) {\n if (!elements.contains(parent)) {\n toWaitlist.add(parent);\n }\n }\n if(ae.getChildren()!=null)\n ae.removeFromARG();\n else\n ae.setDestroyed(true);\n }\n\n // ae.setNull();\n }\n return toWaitlist;\n }", "private void removeNoMoreExistingOriginalEdges() {\n for (MirrorEdge mirrorEdge : directEdgeMap.values()) {\n if (!originalGraph.has(mirrorEdge.original)) {\n for (Edge segment : mirrorEdge.segments) {\n mirrorGraph.forcedRemove(segment);\n reverseEdgeMap.remove(segment);\n }\n for (Node bend : mirrorEdge.bends) {\n mirrorGraph.forcedRemove(bend);\n reverseEdgeMap.remove(bend);\n }\n directEdgeMap.remove(mirrorEdge.original);\n }\n }\n }", "private void removeRedundantPatterns() {\n HashSet<String> patternsToRemove = new HashSet<>();\n for (Map.Entry<String, Pattern> entry : patterns.entrySet()) {\n\n Pattern pattern = entry.getValue();\n\n if (!parameters.keepAllPatterns) {\n String suffixStr = getSuffix(pattern);\n PatternsUtils.addSubPatternToRemoveList(patterns, suffixStr, pattern, patternsToRemove);\n }\n\n if (crossStrand) {\n PatternsUtils.removeReverseCompliments(patterns, pattern, patternsToRemove);\n }\n }\n patterns.keySet().removeAll(patternsToRemove);\n }", "private static void stripTrivialCycles(CFG cfg) {\n\t\tCollection<SDGEdge> toRemove = new LinkedList<SDGEdge>();\n\t\tfor (SDGEdge e : cfg.edgeSet()) {\n\t\t\tif (e.getSource().equals(e.getTarget())) {\n\t\t\t\ttoRemove.add(e);\n\t\t\t}\n\t\t}\n\t\t\n\t\tcfg.removeAllEdges(toRemove);\n\t}", "private static void simplify (GraphUndirected<NodeCppOSM, EdgeCppOSM> osmGraph) {\n \t\tfinal Iterator<NodeCppOSM> iteratorNodes = osmGraph.getNodes().iterator();\n \t\twhile (iteratorNodes.hasNext()) {\n \t\t\tfinal NodeCppOSM node = iteratorNodes.next();\n \t\t\tif (node.getDegree() == 2) {\n \t\t\t\t// get the ids of the two connected nodes\n \t\t\t\tfinal Long currentNodeId = node.getId();\n \t\t\t\tfinal List<EdgeCppOSM> edges = node.getEdges();\n \t\t\t\tfinal EdgeCppOSM edge1 = edges.get(0);\n \t\t\t\tfinal EdgeCppOSM edge2 = edges.get(1);\n \t\t\t\tfinal Long node1id = edge1.getNode1().getId() == (currentNodeId) ? edge1.getNode2().getId() : edge1.getNode1().getId();\n \t\t\t\tfinal Long node2id = edge2.getNode1().getId() == (currentNodeId) ? edge2.getNode2().getId() : edge2.getNode1().getId();\n \t\t\t\tif (currentNodeId == node1id){\n \t\t\t\t\t// we are in a loop and do not erase ourself\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t\t// concat the list in the right way\n \t\t\t\tList<WayNodeOSM> newMetaNodes = concatMetanodes(edge1.getMetadata().getNodes(), edge2.getMetadata().getNodes(), currentNodeId);\n \t\t\t\t// add a new edge\n \t\t\t\t// TODO: Handle way properly - what would name be in this context?\n \t\t\t\t// TODO: names\n \t\t\t\tosmGraph.getNode(node1id).connectWithNodeWeigthAndMeta(osmGraph.getNode(node2id), edge1.getWeight() + edge2.getWeight(),\n\t\t\t\t\t\tnew WayOSM(0, WayOSM.WayType.UNSPECIFIED, edge1.getMetadata().getName()+edge2.getMetadata().getName(), newMetaNodes));\n \t\t\t\t// remove the old node\n \t\t\t\t// do this manually because we otherwise corrupt the iterator\n \t\t\t\tnode.removeAllEdges();\n \t\t\t\titeratorNodes.remove();\n \t\t\t}\n \t\t}\n \t}", "private void adjustPathConditions() {\n List<ProgramCondition> pcList;\n for (ProgramPath pp : progPath){\n pcList = pp.getConditions();\n final List<ProgramCondition> pcList2 = pcList;\n List<ProgramCondition> collect = pcList2.stream().filter(p -> (pcList2.stream().anyMatch(q -> q.condition.equals(p.condition) \n && q.pred == ProgramConditionTruthValue.False && p.pred == ProgramConditionTruthValue.True))).collect(Collectors.toList());\n \n collect.forEach(p -> p.z3Allowable = false);\n }\n }", "void tryRemoveNodes(Collection<Node> nodesToRemove) throws Exception;", "private void removeEdgeJointPointSource(Vector<Edge> edges) {\n\t\tfor (Edge e: edges) {\n\t\t\tEdge currentEdge = e;\n\t\t\tremoveEdge(e);\n\t\t\twhile (shapes.contains(currentEdge.getSource()) && currentEdge.getSource() instanceof JoinPoint) {\n\t\t\t\tJoinPoint join = (JoinPoint) currentEdge.getSource();\n\t\t\t\tshapes.remove(join);\n\t\t\t\tcurrentEdge = (Edge) join.getSource();\n\t\t\t\tremoveEdge(currentEdge);\n\t\t\t}\n\t\t}\n\t}", "public void removeAllSuccessors() {\n\t\tfor (int idx=0; idx < this.successorNodes.length; idx++) {\n\t\t\tBaseNode bn = (BaseNode) this.successorNodes[idx];\n\t\t\tbn.removeAllSuccessors();\n\t\t}\n\t\tthis.successorNodes = new BaseNode[0];\n this.useCount = 0;\n\t}", "public void removeAllSuccessors() {\n\t\tfor (int idx=0; idx < this.successorNodes.length; idx++) {\n\t\t\tBaseNode bn = (BaseNode) this.successorNodes[idx];\n\t\t\tbn.removeAllSuccessors();\n\t\t}\n\t\tthis.successorNodes = new BaseNode[0];\n this.useCount = 0;\n\t}", "@Override\n\tprotected void computeWithoutTime() {\n\t\tinitShortestPaths();\n\n\t\t// Then we sort for each node v the list of terminals by the distance from v\n\t\tsortedRequiredVertices = new HashMap<Integer, TreeSet<Integer>>();\n\t\tsortRequiredVertices();\n\t\t\n\t\t// Copy of the terminals\n\t\tHashSet<Integer> req = new HashSet<Integer>(\n\t\t\t\tinstance.getRequiredVertices());\n\n\t\t// Union of all the solutions returned by the subalgorithm CH2\n\t\tHashSet<Arc> currentSol = new HashSet<Arc>();\n\n\t\t// Until all terminals are reached\n\t\twhile (req.size() > 0) {\n\n\t\t\t// We apply CH2 to reach some of the non reached terminals\n\t\t\tCouple<HashSet<Arc>, HashSet<Integer>> tree = applyCH2(req);\n\n\t\t\t// tree.first the tree returned by CH2\n\t\t\t// tree.second is the terminals of that tree\n\n\t\t\tcurrentSol.addAll(tree.first);\n\t\t\tfor (Arc a : tree.first)\n\t\t\t\tcosts.put(a, 0); // Set the cost of the arc to 0, as this arc is already used in the solution, it does not cost anything to use it again.\n\t\t\treq.removeAll(tree.second);\n\t\t}\n\n\t\t// Compute the returned solution and its cost.\n\t\tarborescence = new HashSet<Arc>();\n\t\tint c = 0;\n\t\tfor (Arc a : currentSol) {\n\t\t\tList<Arc> l = shortestPaths.get(a);\n\t\t\tif (a.getInput().equals(a.getOutput()))\n\t\t\t\tl = new ArrayList<Arc>();\n\t\t\tfor (Arc b : l) {\n\t\t\t\tarborescence.add(b);\n\t\t\t\tc += instance.getCost(b);\n\t\t\t}\n\t\t}\n\t\tcost = c;\n\t}", "public void cancelJoinsNLEGJoin() {\n\n List<String> currEG = null;\n List<String> currOuterTP = null;\n\n for (int keyOuter : mapTmpEGtoAllTPs.keySet()) {\n\n if (mapEGtoCancel.get(keyOuter) != null) {\n\n currEG = mapTmpEGtoAllTPs.get(keyOuter);\n\n for (int i = 0; i < currEG.size(); i += 3) {\n\n currOuterTP = new LinkedList<>(currEG.subList(i, i + 3));\n //BUUUUUUUUUUUUG check if it is a ontology\n if (!currOuterTP.get(0).contains(\"?\") && !currOuterTP.get(0).contains(\"#\")\n || !currOuterTP.get(2).contains(\"?\") && !currOuterTP.get(2).contains(\"#\")) {\n\n myDedUtils.cancelDTP(currOuterTP);\n for (int j = i + 3; j < currEG.size(); j += 3) {\n\n totalPairs--;\n }\n }\n\n }\n }\n\n }\n\n }", "private void clean() {\n // TODO: Your code here.\n for (Long id : vertices()) {\n if (adj.get(id).size() == 1) {\n adj.remove(id);\n }\n }\n }", "protected void removeFromChain(\n LogicalOperator nodeToRemove,\n Map<Integer, Integer> projectionMapping)\n throws VisitorException, FrontendException {\n \t\n \tList<LogicalOperator> afterNodes = mPlan.getPredecessors(nodeToRemove);\n \tif (afterNodes.size()!=1)\n \t\tthrow new RuntimeException(\"removeFromChain only valid to remove \" + \n \t\"node has one predecessor.\");\n \tList<LogicalOperator> beforeNodes = mPlan.getSuccessors(nodeToRemove);\n \tif (beforeNodes!=null && beforeNodes.size()!=1)\n \t\tthrow new RuntimeException(\"removeFromChain only valid to remove \" + \n \t\t\"node has one successor.\");\n \t\n \t// Get after and before node\n \tLogicalOperator after = mPlan.getPredecessors(nodeToRemove).get(0);\n \tLogicalOperator before = null;\n \tif (beforeNodes!=null)\n \t\tbefore = mPlan.getSuccessors(nodeToRemove).get(0);\n \t\n // Remove nodeToRemove from plan\n \tmPlan.remove(nodeToRemove);\n \tif (before!=null)\n \t{\n\t \t// Shortcut nodeToRemove.\n\t mPlan.connect(after, before);\n\t\n\t // Visit all the inner plans of before and change their projects to\n\t // connect to after instead of nodeToRemove.\n\t // Find right inner plan(s) to visit\n\t List<LogicalPlan> plans = new ArrayList<LogicalPlan>();\n\t if (before instanceof LOCogroup) {\n\t plans.addAll((((LOCogroup)before).getGroupByPlans()).values());\n\t } else if (before instanceof LOSort) {\n\t plans.addAll(((LOSort)before).getSortColPlans());\n\t } else if (before instanceof LOFilter) {\n\t plans.add(((LOFilter)before).getComparisonPlan());\n\t } else if (before instanceof LOSplitOutput) {\n\t plans.add(((LOSplitOutput)before).getConditionPlan());\n\t } else if (before instanceof LOForEach) {\n\t plans.addAll(((LOForEach)before).getForEachPlans());\n\t }\n\t \n\t for (LogicalPlan lp : plans) {\n\t ProjectFixerUpper pfu =\n\t new ProjectFixerUpper(lp, nodeToRemove, after, projectionMapping);\n\t pfu.visit();\n\t }\n\t\n \t}\n\n \t// Now rebuild the schemas\n // rebuildSchemas();\n }", "@Test public void testPublic10() {\n Graph<Character> graph= TestGraphs.testGraph3();\n char[] toRemove= {'I', 'H', 'B', 'J', 'C', 'G', 'E', 'F'};\n String[] results= {\"O\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"K\",\n \"A L N\", \"P\", \"K\", \"D\"};\n int i;\n\n for (i= 0; i < toRemove.length; i++)\n graph.removeVertex(toRemove[i]);\n\n for (Character ch : graph.getVertices())\n assertEquals(results[ch - 'A'],\n TestGraphs.collToString(graph.getNeighbors(ch)));\n }", "private void removeNoMoreExistingOriginalNodes() {\n for (Node mirrorNode : mirrorGraph.nodes()) {\n if (!isPartOfMirrorEdge(mirrorNode) && !originalGraph.has(mirrorNode)) {\n mirrorGraph.remove(mirrorNode);\n }\n }\n }", "public UniquePathsII() {\n\t\t// Initialization here. \n\t\t//\t\tcount = 0;\n\t}", "private static void simplify (GraphDirected<NodeCppOSMDirected, EdgeCppOSMDirected> osmGraph) {\n \t\tfinal Iterator<NodeCppOSMDirected> iteratorNodes = osmGraph.getNodes().iterator();\n \t\twhile (iteratorNodes.hasNext()) {\n \t\t\tfinal NodeCppOSMDirected node = iteratorNodes.next();\n \t\t\t// one in one out\n \t\t\tif (node.getInDegree() == 1 && node.getOutDegree() == 1) {\n \t\t\t\t// get the ids of the two connected nodes\n \t\t\t\tfinal Long currentNodeId = node.getId();\n \t\t\t\tfinal List<EdgeCppOSMDirected> edges = node.getEdges();\n \t\t\t\tfinal EdgeCppOSMDirected edge1 = edges.get(0);\n \t\t\t\tfinal EdgeCppOSMDirected edge2 = edges.get(1);\n \t\t\t\tfinal Long node1id = edge1.getNode1().getId() == (currentNodeId) ? edge2.getNode1().getId() : edge1.getNode1().getId();\n \t\t\t\tfinal Long node2id = edge1.getNode1().getId() == (currentNodeId) ? edge1.getNode2().getId() : edge2.getNode2().getId();\n \t\t\t\tif (node2id == node1id){\n \t\t\t\t\t// we are in a deadend and do not erase ourself\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t\t// concat the list in the right way\n \t\t\t\tList<WayNodeOSM> newMetaNodes = concatMetanodes(edge1.getMetadata().getNodes(), edge2.getMetadata().getNodes(), currentNodeId);\n \t\t\t\t// add a new edge\n \t\t\t\t// TODO: Handle way properly - what would name be in this context?\n \t\t\t\tosmGraph.getNode(node1id).connectWithNodeWeigthAndMeta(osmGraph.getNode(node2id), edge1.getWeight() + edge2.getWeight(),\n \t\t\t\t\t\tnew WayOSM(0, WayOSM.WayType.UNSPECIFIED, \"unknown\", newMetaNodes));\n \t\t\t\t// remove the old node\n \t\t\t\t// do this manually because we otherwise corrupt the iterator\n \t\t\t\tnode.removeAllEdges();\n \t\t\t\titeratorNodes.remove();\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\t// two in two out\n \t\t\tif (node.getInDegree() == 2 && node.getOutDegree() == 2) {\n \t\t\t\tfinal long currentNodeId = node.getId();\n \t\t\t\t//check the connections\n \t\t\t\tArrayList<EdgeCppOSMDirected> incomingEdges = new ArrayList<>();\n \t\t\t\tArrayList<EdgeCppOSMDirected> outgoingEdges = new ArrayList<>();\n \t\t\t\tfor(EdgeCppOSMDirected edge : node.getEdges()) {\n \t\t\t\t\tif(edge.getNode1().getId() == currentNodeId){\n \t\t\t\t\t\toutgoingEdges.add(edge);\n \t\t\t\t\t}\n \t\t\t\t\telse {\n \t\t\t\t\t\tincomingEdges.add(edge);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\t//TODO make this condition better\n \t\t\t\tif(outgoingEdges.get(0).getNode2().equals(incomingEdges.get(0).getNode1())){\n \t\t\t\t\t//out0 = in0\n \t\t\t\t\tif(!outgoingEdges.get(1).getNode2().equals(incomingEdges.get(1).getNode1())){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(0).getWeight() != incomingEdges.get(0).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(1).getWeight() != incomingEdges.get(1).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\telse {\n \t\t\t\t\t//out0 should be in1\n \t\t\t\t\t//therefore out1 = in0\n \t\t\t\t\tif(!outgoingEdges.get(0).getNode2().equals(incomingEdges.get(1).getNode1())){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(!outgoingEdges.get(1).getNode2().equals(incomingEdges.get(0).getNode1())){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(0).getWeight() != incomingEdges.get(1).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t\tif(outgoingEdges.get(1).getWeight() != incomingEdges.get(0).getWeight()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}\n \t\t\t\t}\n \n \t\t\t\t// get the ids of the two connected nodes\n \t\t\t\tfinal NodeCppOSMDirected node1 = incomingEdges.get(0).getNode1();\n \t\t\t\tfinal NodeCppOSMDirected node2 = incomingEdges.get(1).getNode1();\n \t\t\t\t// \t\t\tif (node1.equals(node2)){\n \t\t\t\t// \t\t\t\t// we are in a loop and do not erase ourself\n \t\t\t\t// \t\t\t\tcontinue;\n \t\t\t\t// \t\t\t}\n \t\t\t\t// concat the list in the right way\n \t\t\t\tList<WayNodeOSM> metaNodes1 = incomingEdges.get(0).getMetadata().getNodes();\n \t\t\t\tList<WayNodeOSM> metaNodes2 = incomingEdges.get(1).getMetadata().getNodes();\n \t\t\t\tdouble weight = incomingEdges.get(0).getWeight() +incomingEdges.get(1).getWeight();\n \t\t\t\tList<WayNodeOSM> newMetaNodes = concatMetanodes(metaNodes1, metaNodes2, currentNodeId);\n \t\t\t\t// add a new edge\n \t\t\t\t// TODO: Handle way properly - what would name be in this context?\n \t\t\t\tnode1.connectWithNodeWeigthAndMeta(node2, weight,\n \t\t\t\t\t\tnew WayOSM(0, WayOSM.WayType.UNSPECIFIED, \"unknown\", newMetaNodes));\n \t\t\t\tnode2.connectWithNodeWeigthAndMeta(node1, weight,\n \t\t\t\t\t\tnew WayOSM(0, WayOSM.WayType.UNSPECIFIED, \"unknown\", newMetaNodes));\n \t\t\t\t// remove the old node\n \t\t\t\t// do this manually because we otherwise corrupt the iterator\n \t\t\t\tnode.removeAllEdges();\n \t\t\t\titeratorNodes.remove();\n \t\t\t}\n \t\t}\n \t}", "public static void PaladinPruning(GatorDot2C myGator, ADAI2Dot myADAI) {\n\t\tHashMap<String, GatorDot2C.vertex> GatorBoxes = myGator.Boxes;\n\t\tHashSet<String> GatorActivity = new HashSet<String>();\n\t\tfor (Map.Entry<String, GatorDot2C.vertex> entry: GatorBoxes.entrySet()){\n\t\t\tString currentActivity = entry.getValue().act;\n\t\t\tif (!GatorActivity.contains(currentActivity)) {\n\t\t\t\tGatorActivity.add(currentActivity);\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"=============\");\n\t\t\n\t\tLinkedList<ADAI2Dot.PathTree> PaladinPaths = myADAI.graphPaths;\n\t\tSystem.out.println(PaladinPaths.size());\n\t\t\n\t\tIterator<ADAI2Dot.PathTree> iter = PaladinPaths.iterator();\n\t\twhile (iter.hasNext()){\n\t\t\tADAI2Dot.PathTree currentPath = iter.next();\n\t\t\tString srcAct = currentPath.src;\n\t\t\tString tgtAct = currentPath.tgt;\n\t\t\tif (!GatorActivity.contains(srcAct) || !GatorActivity.contains(tgtAct)) {\n\t\t\t\titer.remove();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"After Cleaning\");\n\t\tSystem.out.println(PaladinPaths.size());\n\t\tSystem.out.println(\"=============\");\n\t\t\n\t\t// Find edges only between different activities\n\t\tint number = 0;\n\t\titer = PaladinPaths.iterator();\n\t\twhile (iter.hasNext()){\n\t\t\tADAI2Dot.PathTree currentPath = iter.next();\n\t\t\tString srcAct = currentPath.src;\n\t\t\tString tgtAct = currentPath.tgt;\n\t\t\tif (!srcAct.equals(tgtAct)) {\n\t\t\t\tnumber ++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"current connected edges \" + number);\n\t\tSystem.out.println(\"=============\");\n\t\t\n\t\tHashMap<String, Integer> PaladinActivity = myADAI.Activities;\n\t\tIterator<Map.Entry<String, Integer>> iter2 = PaladinActivity.entrySet().iterator();\n\t\twhile (iter2.hasNext()){\n\t\t\tMap.Entry<String, Integer> entry = iter2.next();\n\t\t\tif (!GatorActivity.contains(entry.getKey())) {\n\t\t\t\titer2.remove();\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public ArrayList<String> cleanUpPath(ArrayList<String> path) {\n if (path.size() > 1) {\n for (int i = 0; i < path.size() - 2; i++) {\n if ((path.get(i).equals(\"L\") && path.get(i + 1).equals(\"R\")) || (path.get(i).equals(\"R\") && path.get(i + 1).equals(\"L\"))) {\n path.remove(i + 1);\n path.remove(i);\n } else if ((path.get(i).equals(\"U\") && path.get(i + 1).equals(\"D\")) || (path.get(i).equals(\"D\") && path.get(i + 1).equals(\"U\"))) {\n path.remove(i + 1);\n path.remove(i);\n }\n }\n }\n return path;\n }", "void removeNeighbors();", "public abstract void removeEdge(Point p, Direction dir);", "private static List<Polyomino> generic_aux(int P, Polyomino parent, LinkedList<Square> untried, Set<Square> vus, List<Polyomino> l, String s) {\n while (!untried.isEmpty()) {\n Square point = untried.pop();\n parent.squares.add(point);\n List<Square> anti_points = point.images(s);\n for (Square anti_point : anti_points) {\n parent.squares.add(anti_point);\n }\n\n if (parent.squares.size() <= P)\n l.add(parent.clone());\n if (parent.squares.size() < P) {\n List<Square> voisins = getNeighbours(point, s);\n LinkedList<Square> copy_untried = (LinkedList<Square>) untried.clone();\n Set<Square> copy_vus = new HashSet<Square>(vus);\n for (Square v : voisins) {\n if (!copy_vus.contains(v.canonicalForm(s)) && v.isAllowed(s)) {\n copy_untried.add(v);\n copy_vus.add(v.canonicalForm(s));\n }\n }\n\n generic_aux(P, parent, copy_untried, copy_vus, l, s);\n }\n parent.squares.remove(point);\n for (Square anti_point : anti_points) {\n parent.squares.remove(anti_point);\n }\n }\n return l;\n }", "public static void removeSample() {\n Node ll1 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n Node ll2 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n Node ll3 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n Node ll4 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n Node ll5 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n Node ll6 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n\n System.out.println(\"remove 1==\");\n Node r1 = ll1.remove(0);\n r1.printList();\n System.out.println(\"remove 2==\");\n Node r2 = ll2.remove(1);\n r2.printList();\n System.out.println(\"remove 3==\");\n Node r3 = ll3.remove(2);\n r3.printList();\n System.out.println(\"remove 4==\");\n Node r4 = ll4.remove(3);\n r4.printList();\n System.out.println(\"remove 5==\");\n Node r5 = ll5.remove(4);\n r5.printList();\n System.out.println(\"remove 6==\");\n Node r6 = ll6.remove(5);\n r6.printList();\n\n }", "public static void QTdeletionMinimization (Graph<Integer,String> g, int currentSize) {\n\t\t\r\n\t\tboolean existsP4orC4 = false;\r\n\t\t\r\n\t\t//int temp = QTDelHeuristic1(Copy(g));\r\n\t\t//System.out.print(\"n = \"+g.getVertexCount()+\" m=\"+g.getEdgeCount()+\" hVal = \"+temp +\"\\n\");\r\n\t\tif (currentSize >= minSoFar) return; \r\n\t\tIterator<Integer> a = g.getVertices().iterator();\r\n\t\tIterator<Integer> b;\r\n\t\tIterator<Integer> c;\r\n\t\tIterator<Integer> d;\r\n\t\twhile(a.hasNext()){\r\n\t\t\tInteger A = a.next();\r\n\t\t\t//System.out.print(\"\"+A+\" \");\r\n\t\t\tb = g.getNeighbors(A).iterator();\r\n\t\t\twhile(b.hasNext()){\r\n\t\t\t\tInteger B = b.next();\r\n\t\t\t\tc = g.getNeighbors(B).iterator();\r\n\t\t\t\twhile (c.hasNext()){\r\n\t\t\t\t\tInteger C = c.next();\r\n\t\t\t\t\tif (g.isNeighbor(C, A) || C==A) continue;\r\n\t\t\t\t\td = g.getNeighbors(C).iterator();\r\n\t\t\t\t\twhile (d.hasNext()){\r\n\t\t\t\t\t\tInteger D = d.next();\r\n\t\t\t\t\t\tif (D==B) continue; \r\n\t\t\t\t\t\tif (g.isNeighbor(D,B)) continue;\r\n\t\t\t\t\t\t//otherwise, we have a P4 or a C4\r\n\r\n\t\t\t\t\t\texistsP4orC4 = true;\r\n\t\t\t\t\t\tif (currentSize + 1 >= minSoFar) return;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//System.out.print(\"Found P4: \"+A+\"-\"+B+\"-\"+C+\"-\"+D+\"... not a cograph\\n\");\r\n\t\t\t\t\t\tif (g.isNeighbor(D,A)) {\r\n\t\t\t\t\t\t\t// we have a C4 = a-b-c-d-a\r\n\t\t\t\t\t\t\t// delete any two edges\r\n\t\t\t\t\t\t\tif (currentSize + 2 >= minSoFar) return;\r\n\r\n\t\t\t\t\t\t\tg.removeEdge(g.findEdge(A, B));\r\n\r\n\t\t\t\t\t\t\tg.removeEdge(g.findEdge(B, C));\r\n\t\t\t\t\t\t\tQTdeletionMinimization(g,2+currentSize);\r\n\t\t\t\t\t\t\tg.addEdge(\"mar-\"+B+\"-\"+C, B,C);\r\n\r\n\t\t\t\t\t\t\tg.removeEdge(g.findEdge(C, D));\r\n\t\t\t\t\t\t\tQTdeletionMinimization(g,2+currentSize);\r\n\t\t\t\t\t\t\tg.addEdge(\"mar-\"+C+\"-\"+D, C,D);\r\n\r\n\r\n\t\t\t\t\t\t\tg.removeEdge(g.findEdge(D, A));\r\n\t\t\t\t\t\t\tQTdeletionMinimization(g,2+currentSize);\r\n\t\t\t\t\t\t\t//g.addEdge(\"mar-\"+A+\"-\"+D, A,D);\r\n\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tg.addEdge(\"mar-\"+A+\"-\"+B, A,B);\r\n\t\t\t\t\t\t\t// all cases with AB deleted are done. AD is STILL deleted\r\n\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tg.removeEdge(g.findEdge(B, C));\r\n\t\t\t\t\t\t\tQTdeletionMinimization(g,2+currentSize);\r\n\t\t\t\t\t\t\tg.addEdge(\"mar-\"+B+\"-\"+C, B,C);\r\n\r\n\t\t\t\t\t\t\tg.removeEdge(g.findEdge(C, D));\r\n\t\t\t\t\t\t\tQTdeletionMinimization(g,2+currentSize);\r\n\r\n\t\t\t\t\t\t\t// all cases with AB deleted or AD deleted are done\r\n\t\t\t\t\t\t\t// at this point, CD and AD are still deleted\r\n\t\t\t\t\t\t\t// only need to try BC and CD together deleted.\r\n\t\t\t\t\t\t\tg.addEdge(\"mar-\"+A+\"-\"+D, A,D);\r\n\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tg.removeEdge(g.findEdge(B, C));\r\n\t\t\t\t\t\t\tQTdeletionMinimization(g,2+currentSize);\r\n\r\n\t\t\t\t\t\t\tg.addEdge(\"mar-\"+B+\"-\"+C, B,C);\r\n\t\t\t\t\t\t\tg.addEdge(\"mar-\"+C+\"-\"+D, C,D);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t// this case says:\r\n\t\t\t\t\t\t\t// else D is NOT adjacent to A. Then we have P4=abcd\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tint choice = randomInt(1,4);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (choice == 1) {\r\n\t\t\t\t\t\t\t\tg.removeEdge(g.findEdge(A, B));\r\n\t\t\t\t\t\t\t\tQTdeletionMinimization(g,1+currentSize);\r\n\t\t\t\t\t\t\t\tg.addEdge(\"mar-\"+A+\"-\"+B, A,B);\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\telse if (choice == 2) {\r\n\t\t\t\t\t\t\t\tg.removeEdge(g.findEdge(C, D));\r\n\t\t\t\t\t\t\t\tQTdeletionMinimization(g,1+currentSize);\r\n\t\t\t\t\t\t\t\tg.addEdge(\"mar-\"+C+\"-\"+D, C,D);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tg.removeEdge(g.findEdge(B, C));\r\n\t\t\t\t\t\t\t\tQTdeletionMinimization(g,1+currentSize);\r\n\t\t\t\t\t\t\t\tg.addEdge(\"mar-\"+B+\"-\"+C, B,C);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (existsP4orC4==true) {\r\n\t\t\t\t\t\t\t// it found an obstruction and branched on all its ways.\r\n\t\t\t\t\t\t\t// No need to deal with this graph further.\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} // end d.hasNext()\r\n\t\t\t\t} // end c.hasNext()\r\n\t\t\t} // end b.hasNext() \r\n\t\t} // end a.hasNext()\r\n\r\n\t\t// if we reached here, no P4 was found\r\n\t\tif (existsP4orC4 == false) {\r\n\t\t\t// arrived at a quasi-threshold graph since no P4 or C4 was found\r\n\t\t\tSystem.out.print(\"\\n currentSize = \"+currentSize+\" and minSoFar = \"+minSoFar+\"\\n\");\r\n\t\t\tSystem.out.print(\"Modified graph has \"+g.getEdgeCount()+\" edges and is:\\n\");\r\n\t\t\tminSoFar = currentSize;\r\n\t\t\tSystem.out.print(\"\"+g+\"\\n\");\r\n\t\t\tNewTools.printToFile(currentSize,g,null,\"QTDel.txt\");\r\n\t\t\t//NewTools.DrawIt(g);\r\n\t\t\t//PleaseWait(60000); // one minute\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t// ...\r\n\t\tSystem.out.print(\"Critical Error. No P_4 or C_4 found in a non-quasi-threshold graph.\\n\");\r\n\t\treturn;\r\n\r\n\t\t\r\n\t}", "void unsetFurtherRelations();", "public static boolean checkPath(int[][] bs, int i) {\n ArrayList<Integer> temp_cP = new ArrayList<Integer>();\r\n Set<Integer> temp_setcP = new HashSet<Integer>();\r\n boolean denoter = true;\r\n while (i == 3) {\r\n for (int k = 0; k < i; k++) {\r\n for (int e = 0; e < 3; e++) {\r\n temp_cP.add(e, bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n temp_cP.clear();\r\n temp_setcP.clear();\r\n\r\n for (int k = 0; k < i; k++) {\r\n for (int e = 3; e < 6; e++) {\r\n temp_cP.add(bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n while (i == 6) {\r\n\r\n for (int k = 3; k < i; k++) {\r\n for (int e = 0; e < 3; e++) {\r\n temp_cP.add(e, bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n temp_cP.clear();\r\n temp_setcP.clear();\r\n\r\n for (int k = 3; k < i; k++) {\r\n for (int e = 3; e < 6; e++) {\r\n temp_cP.add(bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n }\r\n return denoter;\r\n }", "private static void removeNode(CFG cfg, SDGNode toRemove) {\n\t\tfinal List<SDGEdge> edgesToAdd = new LinkedList<SDGEdge>();\n\t\tfinal List<SDGEdge> edgesToRemove = new LinkedList<SDGEdge>();\n\t\tfor (SDGEdge eIncoming : cfg.getIncomingEdgesOfKind(toRemove, SDGEdge.Kind.CONTROL_FLOW)) {\n\t\t\tfor (SDGEdge eOutgoing : cfg\n\t\t\t\t\t.getOutgoingEdgesOfKind(toRemove, SDGEdge.Kind.CONTROL_FLOW)) {\n\t\t\t\tedgesToAdd.add(new SDGEdge(eIncoming.getSource(), eOutgoing.getTarget(),\n\t\t\t\t\t\tSDGEdge.Kind.CONTROL_FLOW));\n\t\t\t\tedgesToRemove.add(eIncoming);\n\t\t\t\tedgesToRemove.add(eOutgoing);\n\t\t\t}\n\t\t}\n\n\t\tcfg.addAllEdges(edgesToAdd);\n\t\tcfg.removeAllEdges(edgesToRemove);\n\t\tcfg.removeVertex(toRemove);\n\t}", "void removeNeighbor(IsisNeighbor isisNeighbor);", "public void removeVertex();", "void removeVert(Pixel toRemove) {\n\n // is the given below this\n if (this.down == toRemove) {\n if (toRemove.right != null) {\n toRemove.right.left = toRemove.left;\n }\n if (toRemove.left != null) {\n toRemove.left.right = toRemove.right;\n }\n }\n\n // is the given downright to this\n else if (this.downRight() == toRemove) {\n if (toRemove.right != null) {\n toRemove.right.left = toRemove.left;\n }\n if (toRemove.left != null) {\n toRemove.left.right = toRemove.right;\n toRemove.left.up = toRemove.up;\n }\n if (toRemove.up != null) {\n toRemove.up.down = toRemove.left;\n }\n }\n\n //is the given downleft to this\n else if (this.downLeft() == toRemove) {\n if (toRemove.right != null) {\n toRemove.right.left = toRemove.left;\n }\n if (toRemove.left != null) {\n toRemove.left.right = toRemove.right;\n }\n if (toRemove.right != null) {\n toRemove.right.up = toRemove.up;\n }\n if (toRemove.up != null) {\n toRemove.up.down = toRemove.right;\n }\n }\n // if the connections were incorrect\n else {\n throw new RuntimeException(\"Illegal vertical seam\");\n }\n }", "private void removeEdge() {\n boolean go = true;\n int lastNode;\n int proxNode;\n int atualNode;\n if ((parentMatrix[randomChild][0] != 1) &&\n (childMatrix[randomParent][0] != 1)) {\n lastNode =\n parentMatrix[randomChild][parentMatrix[randomChild][0] - 1];\n for (int i = (parentMatrix[randomChild][0] - 1); (i > 0 && go); i--)\n { // remove element from parentMatrix\n atualNode = parentMatrix[randomChild][i];\n if (atualNode != randomParent) {\n proxNode = atualNode;\n parentMatrix[randomChild][i] = lastNode;\n lastNode = proxNode;\n }\n else {\n parentMatrix[randomChild][i] = lastNode;\n go = false;\n }\n }\n if ((childMatrix[randomParent][0] != 1) &&\n (childMatrix[randomParent][0] != 1)) {\n lastNode = childMatrix[randomParent][\n childMatrix[randomParent][0] - 1];\n go = true;\n for (int i = (childMatrix[randomParent][0] - 1); (i > 0 &&\n go); i--) { // remove element from childMatrix\n atualNode = childMatrix[randomParent][i];\n if (atualNode != randomChild) {\n proxNode = atualNode;\n childMatrix[randomParent][i] = lastNode;\n lastNode = proxNode;\n }\n else {\n childMatrix[randomParent][i] = lastNode;\n go = false;\n }\n } // end of for\n }\n childMatrix[randomParent][(childMatrix[randomParent][0] - 1)] = -4;\n childMatrix[randomParent][0]--;\n parentMatrix[randomChild][(parentMatrix[randomChild][0] - 1)] = -4;\n parentMatrix[randomChild][0]--;\n }\n }", "public abstract void removeEdge(int from, int to);", "public TreeStructure<String> optimiseTree() throws IllegalAccessException {\n\n canonicalTree.createStack(canonicalTree.getRootNode());\n TreeStructure.Node<String> popNode;\n TreeStructure.Node<String> whereNodeToDelete = null;\n Stack<TreeStructure.Node<String>> stack = canonicalTree.getStack();\n Stack<TreeStructure.Node<String>> optimizationStack = new Stack<>();\n\n boolean conditionAlready;\n while (!stack.empty()) {\n popNode = stack.pop();\n switch (popNode.getNodeStatus()) {\n case RELATION_NODE_STATUS:{\n conditionAlready = false;\n /*if there is a condition associated with that relation then call the method. and set set conditionAlready to TRue so that\n if a node is associated with more than one conditions all the associated conditions will be added to it's parent node.\n after every iteration of the loop the popNode is becoming the node that holds the condition if any so need to make pop node to hold the\n relation node again (if node has a child node-> avoid exception)!!!*/\n while(optimizedWhere.containsValue(new LinkedList<>(Collections.singleton(popNode.getData())))) {\n conditionAlready = relationNodeAction(popNode, conditionAlready);\n if(popNode.getChildren().size() == 1) popNode = popNode.getChildren().get(0);\n }\n associatedRelations = new LinkedList<>();\n break;\n }\n case CARTESIAN_NODE_STATUS: {\n\n cartesianNodeAction(popNode,(Stack<TreeStructure.Node<String>>) optimizationStack.clone());\n cartesianNodesIncludeCond(popNode);\n associatedRelations = new LinkedList<>();\n }\n case WHERE_NODE_STATUS:{\n whereNodeToDelete = popNode;\n break;\n }\n }\n optimizationStack.push(popNode);\n }\n //Delete node that holds the condition if any from the initial tree\n if(whereNodeToDelete!=null){\n /*The condition node will be removed so the root node level must become the condition node's level\n *Make the root node the parent of its child node so the whole tree won't be deleted when the node is deleted*/\n canonicalTree.getRootNode().setNodeLevel(whereNodeToDelete.getNodeLevel());\n whereNodeToDelete.getChildren().get(0).setParentNode(whereNodeToDelete.getParentNode());\n canonicalTree.deleteNode(whereNodeToDelete);\n }\n convertCartesianToJoin();\n\n\n return canonicalTree;\n }", "private List<AxiomTreeNode> reduceNodeList(List<AxiomTreeNode> list, int remove) {\n\n List<AxiomTreeNode> reduced = new ArrayList<AxiomTreeNode>(list);\n\n reduced.remove(remove);\n\n return reduced;\n }", "void pairDown() {\n\n Set<String> ingredientsToRemove = new HashSet<String>();\n Set<String> allergensToRemove = new HashSet<String>();\n\n do {\n\n ingredientsToRemove.clear();\n allergensToRemove.clear();\n\n // Iterate the dishes.\n for (Dish dish : dishes) {\n \n // Iterate the allergens.\n for (String allergen : dish.allergenNames) {\n\n Set<String> ingredientsInAll = new HashSet<String>();\n\n // Iterate the ingredients.\n for (String ingredient : dish.ingredientNames) {\n\n boolean inAll = true;\n\n // Iterate the dishes.\n for (Dish iDish : dishes) {\n\n // Check if this dish has the allergen.\n if (!iDish.allergenNames.contains(allergen))\n continue;\n\n // Check if this dish has the ingredient.\n if (!iDish.ingredientNames.contains(ingredient)) {\n inAll = false;\n break;\n }\n }\n\n if (inAll) {\n \n // This ingredient is in all.\n // It's a candidate for removal. But are there others?\n ingredientsInAll.add(ingredient);\n }\n }\n\n // If there's only one ingredient in all of the dishes with this allergen\n // then the ingredient and allergen can be removed from the entire menu and we can start over.\n if (ingredientsInAll.size() == 1) {\n ingredientsToRemove.add((String)ingredientsInAll.toArray()[0]);\n allergensToRemove.add(allergen);\n\n // For part 2, store the allergen and the food that contains it.\n allergensToIngredients.put(allergen, (String)ingredientsInAll.toArray()[0]);\n \n if (!allAllergens.contains(allergen))\n allAllergens.add(allergen);\n }\n }\n }\n\n // Remove identified ingredients and allergens from the menu.\n for (Dish dish : dishes) {\n\n for (String ingredient : ingredientsToRemove)\n dish.ingredientNames.remove(ingredient);\n \n for (String allergen : allergensToRemove)\n dish.allergenNames.remove(allergen); \n }\n\n } while (ingredientsToRemove.size() > 0);\n }", "@Override public boolean remove(L vertex) {\r\n if(!vertices.contains(vertex)) return false;\r\n vertices.remove(vertex);\r\n Iterator<Edge<L>> iter=edges.iterator();\r\n while(iter.hasNext()) {\r\n \t Edge<L> tmp=iter.next();\r\n \t //改了\r\n \t if(tmp.getSource().equals(vertex) || tmp.getTarget().equals(vertex))\r\n \t // if(tmp.getSource()==vertex|| tmp.getTarget()==vertex) \r\n \t\t iter.remove();\r\n \t}\r\n checkRep();\r\n return true;\r\n \r\n \r\n }", "protected Vector combinePaths (Component [] activePaths)\n {\n HashSet set = new HashSet();\n for (int i=0; i < activePaths.length; i++) {\n set.addAll(activePaths[i].getNodes());\n } // for i\n return new Vector(set);\n\n }", "MapComp<K, V> removeAllPairs(BiPredicate<K, V> p);", "public void removeGraphCycles() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tint[] cycleCount = new int[map.size()];\r\n\t\tforComplexMotion = new boolean[map.size()];\r\n\t\t//count cycles\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tfor(int j = 0; j < map.size(); j++) {\r\n\t\t\t\tif(i != j) {\r\n\t\t\t\t\tif(graph[i][j] && graph[j][i]) {\r\n\t\t\t\t\t\tcycleCount[i]++;\r\n\t\t\t\t\t\tcycleCount[j]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//remove fobjects from linear motion planning\r\n\t\tboolean hasCycles = true;\r\n\t\twhile(hasCycles) {\r\n\t\t\tint max = 0;\r\n\t\t\tint maxIndex = -1;\r\n\t\t\tfor(int i = 0; i < cycleCount.length; i++) {\r\n\t\t\t\tif(cycleCount[i] > max) {\r\n\t\t\t\t\tmax = cycleCount[i];\r\n\t\t\t\t\tmaxIndex = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(maxIndex == -1) {\r\n\t\t\t\thasCycles = false;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcycleCount[maxIndex] = 0;\r\n\t\t\t\tforComplexMotion[maxIndex] = true;\r\n\t\t\t\tfor(int i = 0; i < cycleCount.length; i++) {\r\n\t\t\t\t\tgraph[maxIndex][i] = false;\r\n\t\t\t\t\tgraph[i][maxIndex] = false;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t}", "@Test\n public void testGraphElements(){\n Vertex v1 = new Vertex(1, \"A\");\n Vertex v2 = new Vertex(2, \"B\");\n Vertex v3 = new Vertex(3, \"C\");\n Vertex v4 = new Vertex(4, \"D\");\n Vertex v5 = new Vertex(5, \"E\");\n Vertex v6 = new Vertex(6, \"F\");\n Vertex v7 = new Vertex(7, \"G\");\n Vertex v8 = new Vertex(8, \"H\");\n\n Vertex fakeVertex = new Vertex(100, \"fake vertex\");\n\n Edge<Vertex> e1 = new Edge<>(v1, v2, 1);\n Edge<Vertex> e2 = new Edge<>(v2, v3, 1);\n Edge<Vertex> e3 = new Edge<>(v3, v4, 1);\n Edge<Vertex> e4 = new Edge<>(v2, v4, 1);\n Edge<Vertex> e5 = new Edge<>(v2, v6, 1);\n Edge<Vertex> e6 = new Edge<>(v2, v5, 10);\n Edge<Vertex> e7 = new Edge<>(v5, v6, 10);\n Edge<Vertex> e8 = new Edge<>(v4, v6, 10);\n Edge<Vertex> e9 = new Edge<>(v6, v7, 10);\n Edge<Vertex> e10 = new Edge<>(v7, v8, 10);\n\n Edge<Vertex> fakeEdge = new Edge<>(fakeVertex, v1);\n Edge<Vertex> edgeToRemove = new Edge<>(v2, v7, 200);\n\n Graph<Vertex, Edge<Vertex>> g = new Graph<>();\n g.addVertex(v1);\n g.addVertex(v2);\n g.addVertex(v3);\n g.addVertex(v4);\n g.addVertex(v5);\n g.addVertex(v6);\n g.addVertex(v7);\n g.addVertex(v8);\n g.addEdge(e1);\n g.addEdge(e2);\n g.addEdge(e3);\n g.addEdge(e4);\n g.addEdge(e5);\n g.addEdge(e6);\n g.addEdge(e7);\n g.addEdge(e8);\n g.addEdge(e9);\n g.addEdge(edgeToRemove);\n\n Assert.assertTrue(g.addEdge(e10));\n\n //adding null edge or vertex to graph returns false\n Assert.assertFalse(g.addEdge(null));\n Assert.assertFalse(g.addVertex(null));\n\n //adding edge with a vertex that does not exist in graph g returns false\n Assert.assertFalse(g.addEdge(fakeEdge));\n\n //get an edge that does not exit in graph returns false\n Assert.assertFalse(g.edge(v1, fakeVertex));\n\n //getting length of edge from vertex not in graph g returns false\n Assert.assertEquals(0, g.edgeLength(fakeVertex, v2));\n\n //Remove an edge in graph g returns true\n Assert.assertTrue(g.remove(edgeToRemove));\n\n //Removing edge not in graph g returns false\n Assert.assertFalse(g.remove(fakeEdge));\n\n //Removing vertex not in graph g returns false\n Assert.assertFalse(g.remove(fakeVertex));\n\n //Finding an edge with an endpoint not in graph g returns null\n assertNull(g.getEdge(v1, fakeVertex));\n }", "@Test public void testPublic6() {\n Graph<Character> graph= TestGraphs.testGraph3();\n String[] results= {\"O\", \"\", \"\", \"E F\", \"\", \"\", \"\", \"\", \"\", \"\", \"\",\n \"B K\", \"A N\", \"C G\", \"H K\", \"D\"};\n Character ch;\n int i;\n\n graph.removeEdge('A', 'I');\n graph.removeEdge('K', 'J');\n graph.removeEdge('M', 'L');\n graph.removeEdge('N', 'P');\n\n for (ch= 'A', i= 0; ch <= 'P'; ch++, i++)\n assertEquals(results[i],\n TestGraphs.collToString(graph.getNeighbors(ch)));\n }", "protected boolean removeDecisionNode(boolean computeUtilitiesTable) throws IOException {\n\n Node terminalValueNode;\n Node candidateToReduce;\n Node candidateToRemove;\n Node decisionToRemove;\n String operation;\n int i;\n NodeList children;\n Node valueNodeToReduce = null;\n NodeList decisionsID;\n boolean removed = false;\n Node nodeUtil = null;\n PotentialTable utilitiesTable;\n PotentialTable policyTable;\n ArrayList<String> barrens;\n\n // Obtain the value node \n\n terminalValueNode = ((IDWithSVNodes) diag).getTerminalValueNode();\n\n //List of chance nodes in the diagram\n decisionsID = diag.getNodesOfKind(Node.DECISION);\n\n for (i = 0; (i < decisionsID.size()) && removed == false; i++) {\n\n candidateToRemove = decisionsID.elementAt(i);\n\n if (isRemovableDecision(candidateToRemove)) {\n decisionToRemove = candidateToRemove;\n\n\n children = decisionToRemove.getChildrenNodes();\n //Reduce value nodes if it's necessary\n\n if (children.size() > 1) {\n //We have to reduce\n candidateToReduce = getCandidateValueNodeToReduceForDecisionNode(decisionToRemove);\n //reachableParents = getReachableParents(nodeToRemove,candidateToReduce);\n valueNodeToReduce = obtainValueNodeToReduce(decisionToRemove, candidateToReduce);\n ReductionAndEvalID.reduceNode(\n (IDWithSVNodes) diag,\n valueNodeToReduce);\n nodeUtil = valueNodeToReduce;\n operation = \"Reduce: \" + nodeUtil.getName() + \" to eliminate: \" + decisionToRemove.getName();\n statistics.addOperation(operation);\n System.out.println(operation);\n } else {\n //The chance has only one child (utility)\n nodeUtil = children.elementAt(0);\n }\n\n String auxName = candidateToRemove.getName();\n operation = \"Decision node removal: \" + auxName;\n statistics.addOperation(operation);\n System.out.println(operation);\n\n//\t\t\t\tAdd the name of the node to 'orderOfElimination'\n ((PropagationStatisticsID) statistics).addNameToOrderOfElimination(auxName);\n\n\n if (computeUtilitiesTable) {\n //Save the potential with the decision function\n //Table with the utilities\n utilitiesTable = (PotentialTable) ((IDWithSVNodes) diag).getTotalUtility(terminalValueNode).sendVarToEnd(decisionToRemove);\n results.add(utilitiesTable);\n // Store the explanation with the importance of each variable\n // of the decision table\n //statistics.setExplanation(decisionToRemove.getName(),utilitiesTable);\n }\n\n\n\n //Table with the utilities to obtain the policy\n policyTable = (PotentialTable) (diag.getRelation(nodeUtil).getValues().sendVarToEnd(decisionToRemove));\n resultsForPolicies.add(policyTable);\n\n\n\n // The relation of the utility node is modified. In this \n // case the parents of the node to remove wont be parents \n // of the utility node \n modifyUtilityRelation(nodeUtil, decisionToRemove, false);\n\n\n // Maximize the utility \n maximizeUtility(nodeUtil, decisionToRemove, null);\n\n // The node is deleted \n diag.removeNodeOnly(decisionToRemove);\n\n //Remove barren nodes\n barrens = ((IDWithSVNodes) diag).removeBarrenNodesAndReturnThem();\n\n for (String auxBarren : barrens) {\n //Add the name of the node to 'orderOfElimination'\n ((PropagationStatisticsID) statistics).addNameToOrderOfElimination(auxBarren);\n }\n//\t\t\t\t\t\n\n//\t\t\t\t\t To store the size\n\n statistics.addSize(diag.calculateSizeOfPotentials());\n\n\n statistics.addTime(crono.getTime());\n\n indexOperation++;\n diag.save(\"debug-operation-\" + indexOperation + \".elv\");\n\n // Set removed \n removed = true;\n\n //}//if\n }//if\n }//for\n return removed;\n\n }", "@Override\n protected void updateEliminations() {\n\n }", "private static <N, E extends Edge<N>> ImmutableAdjacencyGraph<N, Edge<N>> deleteFromGraph(final Graph<N, E> graph, final Set<N> deleteNodes, final Set<E> deleteEdges)\n\t{\n\t\t// remove the deleteNodes\n\t\tfinal Set<N> cutNodes = graph.getNodes();\n\t\tcutNodes.removeAll(deleteNodes);\n\t\t// remove the deleteEdges\n\t\tfinal Set<Edge<N>> cutEdges = new HashSet<Edge<N>>(deleteEdges);\n\t\tfor (final E edge : deleteEdges)\n\t\t\tcutEdges.remove(edge);\n\t\t// remove any remaining deleteEdges which connect to removed deleteNodes\n\t\t// also replace deleteEdges that have one removed node but still have\n\t\t// 2 or more remaining deleteNodes with a new edge.\n\t\tfinal Set<Edge<N>> removeEdges = new HashSet<Edge<N>>();\n\t\tfinal Set<Edge<N>> addEdges = new HashSet<Edge<N>>();\n\t\tfor(final Edge<N> cutEdge : cutEdges)\n\t\t{\n\t\t\tfinal List<N> cutEdgeNeighbors = cutEdge.getNodes();\n\t\t\tcutEdgeNeighbors.removeAll(cutNodes);\n\t\t\tif( cutEdgeNeighbors.size() != cutEdge.getNodes().size() )\n\t\t\t\tremoveEdges.add(cutEdge);\n\t\t\tif( cutEdgeNeighbors.size() > 1 )\n\t\t\t\t// TODO instead of ImmutableHyperEdge implement clone or something\n\t\t\t\taddEdges.add(new ImmutableHyperEdge<N>(cutEdgeNeighbors));\n\t\t}\n\t\tfor(final Edge<N> removeEdge : removeEdges)\n\t\t\tcutEdges.remove(removeEdge);\n\t\tcutEdges.addAll(addEdges);\n\t\t// check if a graph from the new set of deleteEdges and deleteNodes is\n\t\t// still connected\n\t\treturn new ImmutableAdjacencyGraph<N, Edge<N>>(cutNodes, cutEdges);\n\t}", "protected void removeFixup(Node<T> u) {\n\t\twhile (u.colour > black) {\n\t\t\tif (u == r) {\n\t\t\t\tu.colour = black;\n\t\t\t} else if (u.parent.left.colour == red) {\n\t\t\t\tu = removeFixupCase1(u);\n\t\t\t} else if (u == u.parent.left) {\n\t\t\t\tu = removeFixupCase2(u);\n\t\t\t} else {\n\t\t\t\tu = removeFixupCase3(u);\n\t\t\t}\n\t\t}\n\t\tif (u != r) { // restore left-leaning property if needed\n\t\t\tNode<T> w = u.parent;\n\t\t\tif (w.right.colour == red && w.left.colour == black) {\n\t\t\t\tflipLeft(w);\n\t\t\t}\n\t\t}\n\t}", "private GraphRemovalUndo removeAxiomEdgesOf(Graph<String, DefaultEdge> g,\n\t\t\tMap<DefaultEdge, Set<OWLAxiom>> createdByAxioms, Map<DefaultEdge, Set<OWLAxiom>> labels, DefaultEdge edge) {\n\n\t\tMap<OWLAxiom, Set<DefaultEdge>> axiomToEdges = getAxiomToEdges(createdByAxioms);\n\n\t\t// Instantiate a graphremoval class (which allows to undo the removal9\n\t\tGraphRemovalUndo remover = new GraphRemovalUndo(g);\n\n\t\t// For each axiom of the edge\n\t\tfor (OWLAxiom ax : createdByAxioms.get(edge)) {\n\t\t\t// For each edge that was created by this axiom\n\t\t\tfor (DefaultEdge e : axiomToEdges.get(ax)) {\n\t\t\t\t// remove the axiom from the label\n\t\t\t\tif (labels.containsKey(e)) {\n\t\t\t\t\tlabels.get(e).remove(ax);\n\t\t\t\t}\n\t\t\t\t// If this was the last axiom of the edge, remove it\n\t\t\t\tif (createdByAxioms.get(e).size() < 1) {\n\t\t\t\t\tcreatedByAxioms.remove(e);\n\t\t\t\t\tremover.removeEdge(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Remove all nested class expressions of the axiom\n\t\t\tax.nestedClassExpressions().forEach(nested -> {\n\t\t\t\tremover.removeVertex(OntologyDescriptor.getCleanNameOWLObj(nested));\n\t\t\t});\n\n\t\t\t// Remember which axioms where removed\n\t\t\tremover.saveAxiom(ax);\n\t\t}\n\n\t\treturn remover;\n\n\t}", "private void processAllPaths( final IndyStoreEvent event, Predicate<? super String> pathFilter, boolean deleteOriginPath )\n {\n DrainingExecutorCompletionService<Integer> clearService =\n new DrainingExecutorCompletionService<>( cleanupExecutor );\n\n Set<StoreKey> keys = event.getStores().stream().map( store -> store.getKey() ).collect( Collectors.toSet() );\n keys.forEach(key->{\n final Set<Group> groups = new HashSet<>();\n try\n {\n groups.addAll(\n storeDataManager.query().packageType( key.getPackageType() ).getGroupsAffectedBy( key ) );\n\n listPathsAnd( key, pathFilter, p->clearService.submit(clearPathProcessor( p, key, groups )) );\n }\n catch ( IndyDataException e )\n {\n logger.error( \"Failed to retrieve groups affected by: \" + key, e );\n }\n } );\n\n drainAndCount( clearService, \"stores: \" + keys );\n }", "public ArrayList<Integer> path2Dest(int s, int t, int k, int method){\n double INFINITY = Double.MAX_VALUE;\n boolean[] SPT = new boolean[intersection];\n double[] d = new double[intersection];\n int[] parent = new int[intersection];\n\n for (int i = 0; i <intersection ; i++) {\n d[i] = INFINITY;\n parent[i] = -1;\n }\n d[s] = 0;\n\n MinHeap minHeap = new MinHeap(k);\n for (int i = 0; i <intersection ; i++) {\n minHeap.add(i,d[i]);\n }\n while(!minHeap.isEmpty()){\n int extractedVertex = minHeap.extractMin();\n\n if(extractedVertex==t) {\n break;\n }\n SPT[extractedVertex] = true;\n\n LinkedList<Edge> list = g.adjacencylist[extractedVertex];\n for (int i = 0; i <list.size() ; i++) {\n Edge edge = list.get(i);\n int destination = edge.destination;\n if(SPT[destination]==false ) {\n double newKey =0;\n double currentKey=0;\n if(method==1) { //method 1\n newKey = d[extractedVertex] + edge.weight;\n currentKey = d[destination];\n }\n else{ //method 2\n newKey = d[extractedVertex] + edge.weight + coor[destination].distTo(coor[t])-coor[extractedVertex].distTo(coor[t]);\n currentKey = d[destination];\n }\n if(currentKey>=newKey){\n if(currentKey==newKey){ //if equal need to compare the value of key\n if(extractedVertex<parent[destination]){\n minHeap.updateKey(newKey, destination, d[destination]);\n parent[destination] = extractedVertex;\n d[destination] = newKey;\n }\n }\n else {\n minHeap.updateKey(newKey, destination, d[destination]);\n parent[destination] = extractedVertex;\n d[destination] = newKey;\n }\n }\n }\n }\n }\n //trace back the path using parent properties\n ArrayList<Integer> path = new ArrayList<>();\n if(parent[t]!=-1){\n path.add(t);\n while(parent[t]!= s) {\n path.add(0,parent[t]);\n t = parent[t];\n }\n path.add(0,s);\n }\n else\n path = null;\n return path;\n }", "private void checkTargetsReachable(){\n\t\tPathfinder pathfinder = new Pathfinder(collisionMatrix);\n\t\tLinkedList<Node> removeList = new LinkedList<Node>();\n\t\tboolean pathWasFound = false;\n\t\tLinkedList<Node> currentPath;\n\t\tLinkedList<Node> reversePath;\n\t\t\n\t\t//Go through all starting positions\n\t\tfor(LinkedList<Node> startList : targets){\n\t\t\tprogress += 8;\n\t\t\tsetProgress(progress);\n\t\t\tfor(Node startNode : startList){\n\t\t\t\t\n\t\t\t\tboolean outsideMap = (startNode.getCollisionXPos(scaleCollision) < 0 || startNode.getCollisionXPos(scaleCollision) >= (collisionMatrix.length-1) || startNode.getCollisionYPos(scaleCollision) < 0 || startNode.getCollisionYPos(scaleCollision) >= (collisionMatrix.length-1));\n\t\t\t\t\n\t\t\t\tpathWasFound = false;\n\t\t\t\t//Make sure that target is inside of map\n\t\t\t\tif(!outsideMap){\n\t\t\t\t\t//Check against all target positions\n\t\t\t\t\tfor(LinkedList<Node> targetList : targets){\n\t\t\t\t\t\tfor(Node targetNode : targetList){\n\t\t\t\t\t\t\t//Only check against targets that have not already been marked as unreachable\n\t\t\t\t\t\t\tboolean selfCheck = (targetNode.getXPos() != startNode.getXPos() || targetNode.getYPos() != startNode.getYPos());\n\t\t\t\t\t\t\tif(!removeList.contains(targetNode) && selfCheck){\n\t\t\t\t\t\t\t\t//Check if this path has already been checked\n\t\t\t\t\t\t\t\tif(!preCalculatedPaths.containsKey(startNode.toStringCollision(scaleCollision) + \"-\" + targetNode.toStringCollision(scaleCollision))){\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tcurrentPath = new LinkedList<Node>();\n\t\t\t\t\t\t\t\t\t//Check if a path can be found for this start and target node\n\t\t\t\t\t\t\t\t\tif(pathfinder.findPath(startNode.getCollisionXPos(scaleCollision), startNode.getCollisionYPos(scaleCollision), targetNode.getCollisionXPos(scaleCollision), targetNode.getCollisionYPos(scaleCollision), currentPath)){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif(Frame.USE_PRECALCULATED_PATHS)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpreCalculatedPaths.put(startNode.toStringCollision(scaleCollision) + \"-\" + targetNode.toStringCollision(scaleCollision), currentPath);\n\t\t\t\t\t\t\t\t\t\t\treversePath = new LinkedList<Node>();\n\t\t\t\t\t\t\t\t\t\t\treversePath.addAll(currentPath);\n\t\t\t\t\t\t\t\t\t\t\tCollections.reverse(reversePath);\n\t\t\t\t\t\t\t\t\t\t\treversePath.removeFirst();\n\t\t\t\t\t\t\t\t\t\t\treversePath.add(startNode);\n\t\t\t\t\t\t\t\t\t\t\tpreCalculatedPaths.put(targetNode.toStringCollision(scaleCollision) + \"-\" + startNode.toStringCollision(scaleCollision) ,reversePath);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tpathWasFound = true;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\tpathWasFound = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//Remove nodes which we cannot find a path from\n\t\t\t\tif(!pathWasFound){\n\t\t\t\t\tremoveList.add(startNode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Go through the remove list and remove unreachable nodes\n\t\tfor(Node node : removeList){\n\t\t\tfor(LinkedList<Node> startList : targets){\n\t\t\t\tstartList.remove(node);\n\t\t\t}\n\t\t}\n\t}", "void removeOperators(Object rgID, List<Object> operIDs);", "public String removePaths(List<String> networkPathIds, SdnControllerConsumerInterface consumer) throws NotExistingEntityException, FailedOperationException, MethodNotImplementedException;", "public static void MakeDirectedNoCycle(graphUndir G) {\r\n\r\n\t\tfor (int i = 0; i < G.Adj.size(); i++) {\r\n\t\t\tG.Adj.elementAt(i).color = \"grey\";\r\n\t\t\tSystem.out.println(G.Adj.elementAt(i).name + \" is \"\r\n\t\t\t\t\t+ G.Adj.elementAt(i).color);\r\n\t\t\tfor (int j = 0; j < G.Adj.elementAt(i).next.size(); j++) {\r\n\t\t\t\tif (G.Adj.elementAt(i).next.elementAt(j).color == \"white\") {\r\n\t\t\t\t\tG.Adj.elementAt(i).next.elementAt(j).color = \"grey\";\r\n\t\t\t\t\tSystem.out\r\n\t\t\t\t\t\t\t.println(G.Adj.elementAt(i).next.elementAt(j).name\r\n\t\t\t\t\t\t\t\t\t+ \" is \"\r\n\t\t\t\t\t\t\t\t\t+ G.Adj.elementAt(i).next.elementAt(j).color);\r\n\t\t\t\t} else if (G.Adj.elementAt(i).next.elementAt(j).color == \"black\") {\r\n\t\t\t\t\tSystem.out\r\n\t\t\t\t\t\t\t.println(G.Adj.elementAt(i).next.elementAt(j).name\r\n\t\t\t\t\t\t\t\t\t+ \" is rempved from \"\r\n\t\t\t\t\t\t\t\t\t+ G.Adj.elementAt(i).name);\r\n\t\t\t\t\tG.Adj.elementAt(i).next.remove(j);\r\n\t\t\t\t\tj--;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tG.Adj.elementAt(i).color = \"black\";\r\n\t\t\tSystem.out.println(G.Adj.elementAt(i).name + \" is \"\r\n\t\t\t\t\t+ G.Adj.elementAt(i).color);\r\n\r\n\t\t}\r\n\r\n\t}", "public void optimize(){\n\n NfaState currState;\n HashMap<Integer, State> statesCloned = (HashMap)states.clone();\n\n\n boolean removed;\n\n for(Map.Entry<Integer, State> entry : statesCloned.entrySet()) {//for each state of the nfa\n\n do {\n removed=false;\n Integer id = entry.getKey();\n\n if (states.get(id) == null)//state already been removed\n continue;\n else\n currState = (NfaState) entry.getValue();\n\n HashMap<String, ArrayList<Integer>> startEdges = currState.getOut_edges();\n\n for (Map.Entry<String, ArrayList<Integer>> startEdge : startEdges.entrySet()) {//for each edge of the current state being optimezed\n\n ArrayList<Integer> transactions = new ArrayList(startEdge.getValue());\n\n\n for (Integer state2DegID : transactions) {// for each transaction the 2nd degree state\n NfaState stateDeg2 = (NfaState) states.get(state2DegID);\n\n if (stateDeg2.getOut_edges() == null)\n continue;\n\n\n\n ArrayList<Integer> edgesDeg2 = stateDeg2.getOut_edges().get(EPSILON);\n\n if (edgesDeg2 != null && edgesDeg2.size() == 1 && stateDeg2.getOut_edges().size() == 1) {//if the next state has only a epsilon transaction, we can remove this state\n NfaState successor = (NfaState) states.get(edgesDeg2.get(0));\n\n\n for (Map.Entry<String, ArrayList<Integer>> inEdgesDeg2 : stateDeg2.getIn_edges().entrySet()) {//for every in_edge of the state being removed, update the elements accordingly\n String key = inEdgesDeg2.getKey();\n\n if (inEdgesDeg2.getValue().size() > 0)\n removed = true;\n\n for (Integer stateBeingUpdatedId : inEdgesDeg2.getValue()) {//state to be updated\n NfaState stateBeingUpdated = (NfaState) states.get(stateBeingUpdatedId);\n //add new edge\n stateBeingUpdated.addEdge(key, successor);\n\n //remove out and in edge to intermediate\n stateBeingUpdated.getOut_edges().get(key).remove((Integer) stateDeg2.getId());\n }\n }\n\n //remove out_edges\n for (Map.Entry<String, ArrayList<Integer>> outEdgesDeg2 : stateDeg2.getOut_edges().entrySet()) {\n for (Integer sucId : outEdgesDeg2.getValue()){\n ((NfaState)states.get(sucId)).getIn_edges().get(outEdgesDeg2.getKey()).remove((Integer) stateDeg2.getId());\n }\n }\n //remove state\n states.remove(stateDeg2.getId());\n }\n }\n\n }\n\n }while (removed);\n }\n }", "@Test\r\n void add_remove_add() {\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"A\", \"C\");\r\n graph.addEdge(\"B\",\"D\");\r\n graph.addEdge(\"C\",\"D\");\r\n graph.addEdge(\"D\", \"E\"); \r\n // Check that E is in graph with correct edges\r\n List<String> adjacent = graph.getAdjacentVerticesOf(\"D\");\r\n vertices = graph.getAllVertices(); \r\n if(!vertices.contains(\"E\") | !adjacent.contains(\"E\")) {\r\n fail();\r\n }\r\n //Remove E\r\n graph.removeVertex(\"E\");\r\n if(vertices.contains(\"E\") | adjacent.contains(\"E\")) {\r\n fail();\r\n }\r\n \r\n //Add E back into graph with different edge\r\n graph.addEdge(\"B\", \"E\");\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if(!vertices.contains(\"E\") | !adjacent.contains(\"E\")) {\r\n fail();\r\n }\r\n }", "private static void removeNonIntersections(int PegsCount){\n\t\tint correctColor = 0;\n\t\tIterator<ArrayList<Peg>> itr = possibleCombinations.iterator();\n\t\twhile(itr.hasNext()){\n\t\t\tcorrectColor = 0;\n\t\t\tArrayList <Peg> victim=itr.next();\n\t\t\tArrayList <Peg> victimTemp = new ArrayList<Peg>(victim);\n\t\t\tfor(int i=0; i<aiGuess.size(); i++){\n\t\t\t\tif(victimTemp.contains(aiGuess.get(i))){\n\t\t\t\t\tvictimTemp.remove(aiGuess.get(i));\n\t\t\t\t\tcorrectColor+=1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(correctColor<PegsCount){\n\t\t\t\titr.remove();\n\t\t\t}\n\t\t}\n\t}", "@Override\n protected void rebalanceDelete(Position<Entry<K, V>> p) {\n if (isRed(p)) {\n makeBlack(p);\n } else if (!isRoot(p)) {\n Position<Entry<K, V>> sib = sibling(p);\n if (isInternal(sib) & (isBlack(sib) || isInternal(left(sib)))) {\n remedyDoubleBlack(p);\n }\n }\n }", "void removeLine(PNode c){\n\t\tLinkSet ls = null;\n\t\tLink l = null;\n\t\tLinkSet ls1 = new LinkSet();\n\t\tfor(int i=0;i<linksets.size();i++){\n\t\t\tfor(int j=0;j<linksets.get(i).getLinks().size();j++){\n\t\t\t\tif(c==linksets.get(i).getLinks().get(j).getNode1()||c==linksets.get(i).getLinks().get(j).getNode2()){\n\t\t\t\t\tls = linksets.get(i);\n\t\t\t\t\tl = ls.getLinks().get(j);\n\t\t\t\t\tls.removeLink(l);\n\t\t\t\t\tif(ls.getLinks().size()==0){\n\t\t\t\t\t\tlinksets.remove(ls);//remove linkset if it is empty\n\t\t\t\t\t\tls = null;\n\t\t\t\t\t\tl = null;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(ls!=null){\n\t\t\tLink tlink = null;\n\t\t\tfor(Link lnk: ls.getLinks()){\n\t\t\t\tif(lnk.getNode1().getOwner()==l.getNode1().getOwner() && lnk.getNode1().getSignal()==l.getNode1().getSignal()\n\t\t\t\t\t\t|| lnk.getNode2().getOwner()==l.getNode1().getOwner() && lnk.getNode2().getSignal()==l.getNode1().getSignal()){\n\t\t\t\t\ttlink = lnk;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t\tif(tlink!=null){\n\t\t\t\tls1.addLink(tlink);\n\t\t\t\tls.removeLink(tlink);\n\t\t\t\tcheckForNextLink(ls1, ls, tlink);\n\t\t\t}\n\t\t\tif(ls.getLinks().size()==0){\n\t\t\t\tlinksets.remove(ls);\n\t\t\t}\n\t\t\tlinksets.add(ls1);\n\t\t}\n\t\tfor(int i=0; i<links.size();i++){\n\t\t\tLink lnk = links.get(i);\n\t\t\tif (c == lnk.getNode1() || c == lnk.getNode2()){\n\t\t\t\tlayer.removeChild(links.get(i).getPPath());\n\t\t\t\tlinks.remove(i);\n\t\t\t\tremoveLine(c);\n\t\t\t}\n\t\t}\n\t}", "private void Clean(){\n \t NodeIterable nodeit = graphModel.getGraph().getNodes();\n \t\n \t for (Node node : nodeit) {\n\t\t\t\n \t\t \n \t\t \n\t\t}\n \t\n }", "protected RemoveLinkAction(PointNode remove) {\n this(remove, remove);\n }", "void removeEdge(int x, int y);", "void removePiece(int c, int r) {\n _forwardDiag[forward(c, r)] += -1;\n _backwardDiag[backward(c, r)] += -1;\n _col[c - 1] += -1;\n _row[r - 1] += -1;\n }", "void unsetProbables();", "public int removeStones(int[][] stones) {\n int len = stones.length;\n int[] parent = new int[len];\n Arrays.fill(parent, -1);\n Map<Integer, Integer> xmap = new HashMap<>();\n Map<Integer, Integer> ymap = new HashMap<>();\n for(int i = 0; i < len; i++) {\n int[] stone = stones[i];\n int x = stone[0];\n if(!xmap.containsKey(x)){\n xmap.put(x, i);\n } else {\n parent[x] = xmap.get(x);\n }\n int y = stone[1];\n if(!ymap.containsKey(y)){\n ymap.put(y, i);\n } else {\n parent[y] = ymap.get(y);\n }\n\n union(x, y, xmap, ymap, parent);\n }\n int count = 0;\n for(int i : parent){\n if(i == -1) count++;\n }\n return len - count;\n }", "private static BigInteger connectedGraphs(\n final int v, final int e) {\n if (v == 0) {\n return ZERO;\n }\n if (v == 1) {\n // Fast exit #1: single-vertex\n return e == 0 ? ONE : ZERO;\n }\n final int allE = v * (v - 1) >> 1;\n if (e == allE) {\n // Fast exit #2: complete graph (the only result)\n return ONE;\n }\n final int key = v << 16 | e;\n if (CONN_GRAPHS_CACHE.containsKey(key)) {\n return CONN_GRAPHS_CACHE.get(key);\n }\n BigInteger result;\n if (e == v - 1) {\n // Fast exit #3: trees -> apply Cayley's formula\n result = BigInteger.valueOf(v).pow(v - 2);\n } else if (e > allE - (v - 1)) {\n // Fast exit #4: e > edges required to build a (v-1)-vertex\n // complete graph -> will definitely form connected graphs\n // in all cases, so just calculate allGraphs()\n result = allGraphs(v, e);\n } else {\n /*\n * In all other cases, we'll have to remove\n * partially-connected graphs from all graphs.\n *\n * We can define a partially-connected graph as a graph\n * with 2 sub-graphs A and B with no edges between them.\n * In addition, we require one of the sub-graphs (say, A)\n * to hold the following properties:\n * 1. A must be connected: this implies that the number\n * of possible patterns for A could be counted\n * by calling connectedGraphs().\n * 2. A must contain at least one fixed vertex:\n * this property - combined with 1. -\n * implies that A would not be over-counted.\n *\n * Under the definitions above, the number of\n * partially-connected graphs to be removed will be:\n *\n * (Combinations of vertices to be added from B to A) *\n * (number of possible A's, by connectedGraphs()) *\n * (number of possible B's, by allGraphs())\n * added up iteratively through v - 1 vertices\n * (one must be fixed in A) and all possible distributions\n * of the e edges through A and B\n */\n result = allGraphs(v, e);\n for (int vA = 1; vA < v; vA++) {\n // Combinations of vertices to be added from B to A\n final BigInteger aComb = nChooseR(v - 1, vA - 1);\n final int allEA = vA * (vA - 1) >> 1;\n // Maximum number of edges which could be added to A\n final int maxEA = allEA < e ? allEA : e;\n for (int eA = vA - 1; eA < maxEA + 1; eA++) {\n result = result.subtract(aComb\n // Number of possible A's\n .multiply(connectedGraphs(vA, eA))\n // Number of possible B's\n .multiply(allGraphs(v - vA, e - eA)));\n }\n }\n }\n CONN_GRAPHS_CACHE.put(key, result);\n return result;\n }", "public int[] findRedundantConnection(int[][] edges) {\n int[] parent = new int[2*edges.length];\n int[] sz = new int[parent.length];\n // initialize parent array, every element points to itself\n for (int i = 0; i < parent.length; i++) parent[i] = i;\n Arrays.fill(sz, 1);\n\n for (int[] edge : edges) {\n int p = find(parent, edge[0]);\n int q = find(parent, edge[1]);\n if (p==q) return edge;\n union(parent, sz, p, q);\n }\n return new int[2]; // default return, if no such edge found\n }", "private void step4(Node node) {\n\t\tHashMap<String, ArrayList<String>> svn = node.svN;\r\n\t\tHashMap<String, ArrayList<String>> cn = node.cN;\r\n\t\tArrayList<String> keys = node.keysN;\r\n\t\tString c = checksubset(cn);\r\n\r\n\t\tif (c != null) {\r\n\t\t\tfor (int i = 0; i < keys.size(); i++) {\r\n\t\t\t\tif (svn.get(keys.get(i)).contains(c)) {\r\n\t\t\t\t\tsvn.get(keys.get(i)).remove(c);\r\n\t\t\t\t\tif (svn.get(keys.get(i)).size() <= 1) {\r\n\t\t\t\t\t\tsvn.remove(keys.get(i));\r\n\t\t\t\t\t\tkeys.remove(i);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcn.remove(c);\r\n\t\t}\r\n\t}", "public void removeAllPathIds() {\n synchronized (pathsToBeTraversed) {\n pathsToBeTraversed.clear();\n }\n }", "@Test\r\n void remove_nonexistent_vertex() {\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"B\", \"C\");\r\n graph.removeVertex(\"D\");\r\n List<String> adjacent;\r\n vertices = graph.getAllVertices(); \r\n // Check that graph has all added vertexes\r\n if(!vertices.contains(\"A\")| !vertices.contains(\"B\")|\r\n !vertices.contains(\"C\")) {\r\n fail();\r\n }\r\n adjacent = graph.getAdjacentVerticesOf(\"A\");\r\n if (!adjacent.contains(\"B\"))\r\n fail();\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if (!adjacent.contains(\"C\"))\r\n fail();\r\n \r\n }", "@Test\n void test02_removeVertex() {\n graph.addVertex(\"a\");\n graph.addVertex(\"b\"); // adds two\n graph.removeVertex(\"a\"); // remove\n\n Set<String> vertices = new LinkedHashSet<>();\n vertices.add(\"a\");\n vertices.add(\"b\");\n vertices.remove(\"a\"); // creates a mock up vertex list\n\n if (!graph.getAllVertices().equals(vertices)) {\n fail(\"Graph didn't remove the vertices correctly\");\n }\n }", "private void clean() {\n Iterable<Long> v = vertices();\n Iterator<Long> iter = v.iterator();\n while (iter.hasNext()) {\n Long n = iter.next();\n if (world.get(n).adj.size() == 0) {\n iter.remove();\n }\n }\n }", "public void removeTransNotInTree(){\n // Get the list of transparents which take part into the tree\n Vector transparents=values.getListTransparents();\n Vector<FiniteStates> varsToRemove = new Vector<FiniteStates>();\n\n // Now remove the transparent in the PotentialTree if they do not\n // appear in the tree\n // Go on the set of variables, one by one\n for(int i=0; i < variables.size(); i++){\n FiniteStates var=(FiniteStates)variables.elementAt(i);\n\n // If transparent, consider if it must be removed\n if (var.getTransparency() == FiniteStates.TRANSPARENT){\n // Check if it is present in transparents\n for(int j=0; j < transparents.size(); j++){\n if (transparents.contains(var) == false)\n varsToRemove.addElement(var);\n \n }\n }\n }\n for(int i=0;i<varsToRemove.size();i++){\n variables.remove(varsToRemove.elementAt(i)); \n }\n }", "@Test public void testPublic7() {\n Graph<Character> graph= TestGraphs.testGraph3();\n String[] results= {\"O\", \"\", \"\", \"E F\", \"\", \"\", \"\", \"\", \"\", \"\", \"\",\n \"B K\", \"A N\", \"C G\", \"H K\", \"D\"};\n\n graph.removeEdge('A', 'I');\n graph.removeEdge('K', 'J');\n graph.removeEdge('M', 'L');\n graph.removeEdge('N', 'P');\n\n for (Character ch : graph.getVertices())\n assertEquals(results[ch - 'A'],\n TestGraphs.collToString(graph.getNeighbors(ch)));\n }", "@Test\n public void notConnectedDueToRestrictions() {\n int sourceNorth = graph.edge(0, 1).setDistance(1).set(speedEnc, 10, 10).getEdge();\n int sourceSouth = graph.edge(0, 3).setDistance(2).set(speedEnc, 10, 10).getEdge();\n int targetNorth = graph.edge(1, 2).setDistance(3).set(speedEnc, 10, 10).getEdge();\n int targetSouth = graph.edge(3, 2).setDistance(4).set(speedEnc, 10, 10).getEdge();\n\n assertPath(calcPath(0, 2, sourceNorth, targetNorth), 0.4, 4, 400, nodes(0, 1, 2));\n assertNotFound(calcPath(0, 2, sourceNorth, targetSouth));\n assertNotFound(calcPath(0, 2, sourceSouth, targetNorth));\n assertPath(calcPath(0, 2, sourceSouth, targetSouth), 0.6, 6, 600, nodes(0, 3, 2));\n }", "public void testRemoveVertex() {\n System.out.println(\"removeVertex\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n for (int i = 24; i >= 0; i--) {\n Assert.assertTrue(graph.removeVertex(new Integer(i)));\n Assert.assertFalse(graph.containsVertex(new Integer(i)));\n Assert.assertEquals(graph.verticesSet().size(), i);\n }\n }", "private void removeEdges()\r\n\t{\r\n\t final String edgeTypeName = edgeType.getName();\r\n\t for (final Edge e : eSet)\r\n\t\te.getSource().removeEdge(edgeTypeName, e.getDest());\r\n\t eSet.clear();\r\n\t}", "public static int distinctPaths4(int n) {\n\t\tint[][] mem = new int[n+1][n+1];\n\t\tfor(int j = 1; j <= n; ++j) {\n\t\t\tmem[1][j] = 1;\n\t\t\tmem[j][1] = 1;\n\t\t}\n\t\tfor(int i = 2; i <= n; ++i) {\n\t\t\tfor(int j = 2; j <= n; ++j) {\n\t\t\t\tmem[i][j] = mem[i-1][j] + mem[i][j-1];\n\t\t\t}\n\t\t}\n\t\treturn mem[n][n];\n\t}", "@Test\r\n void test_remove_same_edge_twice() {\r\n // Add two vertices with one edge\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"A\", \"C\");\r\n graph.removeEdge(\"A\", \"B\");\r\n graph.removeEdge(\"A\", \"B\");\r\n if (graph.size() != 1) {\r\n fail();\r\n }\r\n if (graph.getAdjacentVerticesOf(\"A\").contains(\"B\")) {\r\n fail();\r\n } \r\n }", "@Test(groups = { \"Interactive\" })\n public void testRemove() {\n String defaultBlocks = \"[[1,1,1,\\\"Green\\\",[]],[1,1,2,\\\"Green\\\",[\\\"S\\\"]],[1,1,3,\\\"Red\\\",[\\\"S\\\"]],[1,1,4,\\\"Green\\\",[]]]\";\n ContextValue context = getContext(defaultBlocks);\n LogInfo.begin_track(\"testMoreActions\");\n runFormula(executor, \"(: remove)\", context, x -> real(x.allItems).size() == 2 && x.selected.size() == 2);\n runFormula(executor, \"(:for * (: remove))\", context, x -> x.selected.size() == 2 && real(x.allItems).size() == 0);\n runFormula(executor, \"(:for (color green) (: remove))\", context,\n x -> x.selected.size() == 2 && real(x.allItems).size() == 1);\n\n LogInfo.end_track();\n }", "public void computeAllPaths(String source)\r\n {\r\n Vertex sourceVertex = network_topology.get(source);\r\n Vertex u,v;\r\n double distuv;\r\n\r\n Queue<Vertex> vertexQueue = new PriorityQueue<Vertex>();\r\n \r\n \r\n // Switch between methods and decide what to do\r\n if(routing_method.equals(\"SHP\"))\r\n {\r\n // SHP, weight of each edge is 1\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = u.minDistance + 1;\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n }\r\n \r\n }\r\n \r\n }\r\n \r\n else if (routing_method.equals(\"SDP\"))\r\n {\r\n // SDP, weight of each edge is it's propagation delay\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = u.minDistance + u.adjacentVertices.get(key).propDelay;\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n } \r\n }\r\n }\r\n else if (routing_method.equals(\"LLP\"))\r\n {\r\n // LLP, weight each edge is activeCircuits/AvailableCircuits\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = Math.max(u.minDistance,u.adjacentGet(key).load());\r\n //System.out.println(u.adjacentGet(key).load());\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n }\r\n }\r\n }\r\n }", "private void removeElement(PathwayElement affectedData)\n \t{\n \n \t}" ]
[ "0.56442577", "0.5556615", "0.548942", "0.5488811", "0.532095", "0.52739924", "0.52602667", "0.52564126", "0.5231639", "0.5160155", "0.5146022", "0.5139036", "0.51264375", "0.5107984", "0.50789475", "0.50743103", "0.5072155", "0.5060305", "0.5036233", "0.5023168", "0.50207156", "0.5004819", "0.5004485", "0.4996217", "0.4990619", "0.49777707", "0.49702224", "0.4969149", "0.4969149", "0.49671167", "0.49485186", "0.49464357", "0.49383745", "0.49377945", "0.49270305", "0.49254805", "0.4912505", "0.49048516", "0.4886107", "0.48841462", "0.487086", "0.48644504", "0.48553067", "0.48370552", "0.4834109", "0.48276892", "0.4826824", "0.48260504", "0.48222095", "0.4820109", "0.48109037", "0.48089027", "0.48071182", "0.48058662", "0.48048857", "0.4801359", "0.4799403", "0.4794395", "0.47938797", "0.47903427", "0.47829255", "0.47822163", "0.47805068", "0.47677335", "0.47672373", "0.4766302", "0.47619846", "0.47549525", "0.4748217", "0.47421062", "0.4738924", "0.47375575", "0.47358438", "0.47356063", "0.47355738", "0.47334057", "0.47283494", "0.47010344", "0.4691971", "0.46910727", "0.468243", "0.4680594", "0.467459", "0.4673169", "0.4672612", "0.46715182", "0.4665299", "0.4664433", "0.46642238", "0.46621764", "0.4656457", "0.46517202", "0.46510005", "0.4650667", "0.4646681", "0.46466008", "0.46452424", "0.46445107", "0.46312624", "0.46272323" ]
0.59327275
0
/ Does the final set of orientations after colliders have been oriented
private void doFinalOrientation(Graph graph) { discrimGraphs.clear(); Set<Graph> currentDiscrimGraphs = new HashSet<>(); currentDiscrimGraphs.add(graph); while (changeFlag) { changeFlag = false; currentDiscrimGraphs.addAll(discrimGraphs); discrimGraphs.clear(); for (Graph newGraph : currentDiscrimGraphs) { doubleTriangle(newGraph); awayFromColliderAncestorCycle(newGraph); if (!discrimPaths(newGraph)) { if (changeFlag) { discrimGraphs.add(newGraph); } else { finalResult.add(newGraph); } } } currentDiscrimGraphs.clear(); } changeFlag = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean colisionPalas() {\r\n\t\treturn game.racketIzq.getBounds().intersects(getBounds())\r\n\t\t\t\t|| game.racketDer.getBounds().intersects(getBounds());\r\n\t}", "public boolean doesCollide()\n {\n return doesCollide;\n }", "public abstract boolean isCollided();", "private boolean rightCollision(InteractiveObject obj){\n\t\treturn rightUpCollision(obj) || rightDownCollision(obj);\n\t}", "private boolean colisionEstorbos(){\r\n\t\tif(game.estorbo1.getBounds().intersects(getBounds())){\r\n\t\t\tasignarVelocidad(game.estorbo1, rebotes1);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tif(game.estorbo2.getBounds().intersects(getBounds())){\r\n\t\t\tasignarVelocidad(game.estorbo2, rebotes2);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tif(game.estorbo3.getBounds().intersects(getBounds())){\r\n\t\t\tasignarVelocidad(game.estorbo3, rebotes3);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public boolean solved() {\n if (orient != 1) {\n return false;\n }\n return onSide(colors[0]) && onSide(colors[1]);\n }", "@Override\n public boolean isCollided(gameObject obj){\n return Rect.intersects(obj.getastRect(), getRectplayer1())||\n Rect.intersects(obj.getastRect(), getRectplayer2()) ||\n Rect.intersects(obj.getastRect(), getRectplayer3()) ||\n Rect.intersects(obj.getastRect(), getRectplayer4());\n }", "private boolean leftCollision(InteractiveObject obj){\n\t\treturn leftUpCollision(obj) || leftDownCollision(obj);\n\t}", "private boolean rightUpCollision(InteractiveObject obj){\n\t\treturn (((obj.getX() - this.getX()) < this.getWidth()) && (obj.getX() > this.getX()) &&\n\t\t\t\t((this.getY() - obj.getY()) < obj.getHeight()) && (this.getY() > obj.getY()));\n\t}", "private boolean leftUpCollision(InteractiveObject obj){\n\t\treturn (((this.getX() - obj.getX()) < obj.getWidth()) && (this.getX() > obj.getX()) &&\n\t\t\t\t((this.getY() - obj.getY()) < obj.getHeight()) && (this.getY() > obj.getY()));\n\t}", "@Override\n public boolean isFinished() {\n// return false;\n return LightningMath.epsilonEqual(shooter.getFlywheelMotor1Velocity(), shooter.motor1setpoint, Constants.FLYWHEEL_EPSILON) &&\n LightningMath.epsilonEqual(shooter.getFlywheelMotor2Velocity(), shooter.motor2setpoint, Constants.FLYWHEEL_EPSILON) &&\n LightningMath.epsilonEqual(shooter.getFlywheelMotor3Velocity(), shooter.motor3setpoint, Constants.FLYWHEEL_EPSILON);\n }", "public static void waltz() {\n //test code written by bokun: self rotation\n leftMotor.setSpeed(ROTATE_SPEED);\n rightMotor.setSpeed(ROTATE_SPEED);\n leftMotor.forward();\n rightMotor.backward();\n }", "public boolean canCollide() {\n\t\treturn false;\r\n\t}", "public boolean hasRotate() { return hasRotate; }", "@Override\n protected boolean isFinished() {\n return timeSinceInitialized() > 0.5 && Robot.toteLifterSubsystem.isEjectorExtended();\n }", "@Test\n public void testCondition5()\n {\n Double[] coordinates = null;\n Double before[] = _renderable.orientation();\n _renderable.orientation(coordinates);\n Double after[] = _renderable.orientation();\n assertEquals(\"orientation array changed\", before[0], after[0], 0.01);\n assertEquals(\"orientation array changed\", before[1], after[1], 0.01);\n assertEquals(\"orientation array changed\", before[2], after[2], 0.01);\n }", "public boolean canRotate ()\n {\n return ((ActiveAdvancer)_advancer).canRotate();\n }", "private void circleCollison() {\n\t\t\n\t}", "public void updateRotations() {\n try {\n switch (this.mode) {\n case Packet:\n mc.player.renderYawOffset = this.yaw;\n mc.player.rotationYawHead = this.yaw;\n break;\n case Legit:\n mc.player.rotationYaw = this.yaw;\n mc.player.rotationPitch = this.pitch;\n break;\n case None:\n break;\n }\n } catch (Exception ignored) {\n\n }\n }", "public void collisionDetection(){\r\n\t\tif( this.isActiv() ){\r\n\t\t\tif( this.isCollided() ){\r\n\t\t\t\tthis.onCollision();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public abstract boolean facingRight();", "public boolean isOrthogonal() {\n\t\treturn isHorizontal() || isVertical();\n\t}", "public boolean hasCollidedWith(InteractiveObject obj){\n\t\tif (obj == null) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn (leftCollision(obj) || rightCollision(obj));\n\t\t}\n\t}", "private boolean orientationChange(HashMap<String, Float> orientation) {\n int variance = 10;\n\n if(!FunUtils.numberTollerance(orientation.get(\"azimuth\"), this.orientation.get(\"azimuth\"), variance)){\n return true;\n }\n\n if(!FunUtils.numberTollerance(orientation.get(\"pitch\"), this.orientation.get(\"pitch\"), variance)){\n return true;\n }\n // This used to be an 'if', But this is the asme as what i had, but with a few lines less code.\n if(!FunUtils.numberTollerance(orientation.get(\"roll\"), this.orientation.get(\"roll\"), variance)){\n return true;\n }\n return false;\n\n }", "public void update() {\n if (acceleration.x < 0) facing = Direction.LEFT;\n if (acceleration.x > 0) facing = Direction.RIGHT;\n// body.setPosition(location.getX(), location.getY(), layer);\n// body.setRotation(Conversions.mat4fToOdeMat3f(MatrixUtil.rotate(rotation.x, rotation.y, -rotation.z)));\n handleAnimations();\n\n// if (interactingWithX != null || interactingWithY != null) {\n// onInteract(interactingWithX, interactingWithY);\n// if (interactingWithX != null && interactingWithX.equals(interactingWithY)) {\n// interactingWithX.onInteract(this, this);\n// } else {\n// if (interactingWithX != null) interactingWithX.onInteract(this, null);\n// if (interactingWithY != null) interactingWithY.onInteract(null, this);\n// }\n// }\n }", "@Override\n\tpublic void setOrientation(Vector3 orient) {\n\n\t}", "private boolean checkStatesByOrientations(Puzzle puzzle) {\n for (int top = 0; top < ORIENTATIONS.size(); top++)\n for (int bottom = 0; bottom < ORIENTATIONS.size(); bottom++)\n for (int left = 0; left < ORIENTATIONS.size(); left++)\n for (int right = 0; right < ORIENTATIONS.size(); right++)\n for (int back = 0; back < ORIENTATIONS.size(); back++)\n for (int front = 0; front < ORIENTATIONS.size(); front++) {\n Puzzle orientationPuzzle = new Puzzle(new PuzzlePiece(puzzle.getTopPuzzlePiece(), ORIENTATIONS.get(top)),\n new PuzzlePiece(puzzle.getBottomPuzzlePiece(), ORIENTATIONS.get(bottom)),\n new PuzzlePiece(puzzle.getLeftPuzzlePiece(), ORIENTATIONS.get(left)),\n new PuzzlePiece(puzzle.getRightPuzzlePiece(), ORIENTATIONS.get(right)),\n new PuzzlePiece(puzzle.getBackPuzzlePiece(), ORIENTATIONS.get(back)),\n new PuzzlePiece(puzzle.getFrontPuzzlePiece(), ORIENTATIONS.get(front)));\n if (canMatchConditions(orientationPuzzle)) {\n solutions.put(solutions.size(), orientationPuzzle);\n logger.debug(\"Solution : \" + orientationPuzzle);\n return true;\n }\n }\n return false;\n }", "private void updateRotated() {\r\n\r\n\tfor (int n = 0; n < npoints * 3; n += 3) {\r\n\r\n\t // take the linear sum of local co-ords with local\r\n\t // unit vectors and then translate by adding the local\r\n\t // origin's co-ords\r\n\t ps[n] = locals[n] * i[0] + locals[n + 1] * j[0] + locals[n + 2] * k[0];\r\n\t ps[n + 1] = locals[n] * i[1] + locals[n + 1] * j[1] + locals[n + 2] * k[1];\r\n\t ps[n + 2] = locals[n] * i[2] + locals[n + 1] * j[2] + locals[n + 2] * k[2];\r\n\r\n\t ps[n] += p[0];\r\n\t ps[n + 1] += p[1];\r\n\t ps[n + 2] += p[2];\r\n\t}\r\n\r\n\t// reset bounding box and clear dirty flags\r\n\tbox.setBB();\r\n\tdirtyR = false;\r\n\tdirtyT = false;\r\n\r\n\t// normals must be reset\r\n\tthis.setNormals();\r\n\r\n\t// finally\r\n\t_p[0] = p[0];\r\n\t_p[1] = p[1];\r\n\t_p[2] = p[2];\r\n\t_roll = roll;\r\n }", "@SuppressWarnings(\"incomplete-switch\")\n\tprivate void rotatingBehavior() {\n\t\tif (remainingSteps > 0) {\n\t\t\tremainingSteps--;\n\t\t} else {\n\t\t\tswitch (facing) {\n\t\t\t\tcase LEFT:\n\t\t\t\t\tchangeFacing(ACTION.UP);\n\t\t\t\t\tbreak;\n\t\t\t\tcase UP:\n\t\t\t\t\tchangeFacing(ACTION.RIGHT);\n\t\t\t\t\tbreak;\n\t\t\t\tcase RIGHT:\n\t\t\t\t\tchangeFacing(ACTION.DOWN);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DOWN:\n\t\t\t\t\tchangeFacing(ACTION.LEFT);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tremainingSteps = STEP_SIZE;\n\t\t}\n\t}", "public void collided() {\n this.collided = true;\n }", "public boolean isCollidable() {\n return collidable;\n }", "@Override\n protected boolean isFinished() {\n //stop once the left side is high enough\n return Robot.myLifter.getLeftEncoder() < pos;\n }", "public boolean isFinished() {\n return !rightMotor.isMoving() && !leftMotor.isMoving();\n }", "void check_alien_direction() {\n // Aliens are moving right, check if aliens will move off screen\n if (Alien.direction == Alien.Directions.RIGHT) {\n double max_x = rightmost_alien_x();\n // Alien1 has largest width, so we use that one to calculate if all aliens will fit\n if (max_x + Dimensions.ALIEN1_WIDTH + Dimensions.X_PADDING > scene_width){\n Alien.changeDirections();\n }\n }\n\n // Aliens are moving left, check if aliens will move off screen\n else if (Alien.direction == Alien.Directions.LEFT) {\n double min_x = leftmost_alien_x();\n if (min_x < Dimensions.X_PADDING){\n Alien.changeDirections();\n }\n }\n\n // Aliens are moving down, check if they finished moving down\n else if (Alien.direction == Alien.Directions.DOWN &&\n Alien.down_distance_travelled >= Dimensions.ALIEN_VERTICAL_SPACE){\n random_alien_fires(); // After aliens all descend one row, one of the ships fires at the player\n Alien.changeDirections();\n }\n }", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn Math.abs(elevator.getWristPosition() - elevator.getWristStages()[elevator.getWristStage()]) < Math.PI/18 && !elevator.isRunning(ElevatorSubsystem.Follower.ELEVATOR);\r\n\t}", "protected boolean isFinished() {\n //\tif(OI.joystickOne.getPOV() == 180){\n \t\t//return true;\n \t//\n \t\t\t\n return false;\n }", "private boolean isReady() {\n for (Rotor rotor : rotors)\n if (rotor == null)\n return false;\n return (stator != null && reflector != null && plugboard != null);\n }", "protected boolean isFinished() {\n \n \tif(Math.abs(RobotMap.navx.getAngle() - this.desiredAngle) <=2) {\n \n \t\treturn true;\n \t}\n return false;\n }", "@Override\n public boolean isFinished() {\n /* Need to convert distance travelled to degrees. The Standard\n Romi Chassis found here, https://www.pololu.com/category/203/romi-chassis-kits,\n has a wheel placement diameter (149 mm) - width of the wheel (8 mm) = 141 mm\n or 5.551 inches. We then take into consideration the width of the tires.\n */\n //double inchPerDegree = Math.PI * 5.551 / 360;\n // Compare distance travelled from start to distance based on degree turn\n\n if(counter == 4) {\n if(m_degrees != 0) {\n return m_drive.getGyroAngleZ() >= m_degrees - 7 && m_drive.getGyroAngleZ() <= m_degrees + 7;\n } else {\n return true;\n }\n } else {\n return false;\n }\n }", "private boolean isObjectABrick(GObject collider) {\n return collider != null;\n }", "public boolean isRotatable() {\n return rotatable;\n }", "@SideOnly(Side.CLIENT)\r\n\t public boolean shouldRotateAroundWhenRendering() {\r\n\t return true;\r\n\t }", "int getOrientationsCount();", "public boolean rotationNeedsUpdate() {\n int lastOrientation = getLastOrientation();\n int oldRotation = getRotation();\n return oldRotation != this.mDisplayRotation.rotationForOrientation(lastOrientation, oldRotation);\n }", "public void updateOrientationAngles() {\n // Update rotation matrix, which is needed to update orientation angles.\n //mSensorManager.getRotationMatrix(mRotationMatrix, null,\n // mAccelerometerReading, mMagnetometerReading);\n\n // \"mRotationMatrix\" now has up-to-date information.\n\n mSensorManager.getOrientation(mRotationMatrix, mOrientationAngles);\n\n // \"mOrientationAngles\" now has up-to-date information.\n\n mGLView.updateScene(mOrientationAngles[0],mOrientationAngles[1],mOrientationAngles[2]);\n }", "public void sideCheck() {\n /*Be careful when creating tiles, especially ones that allow Sonic's bottom and middle sensors to intersect \n the same tile*/\n mLCollide = false;\n mRCollide = false;\n if(grounded) {\n if(groundSpeed > 0) {\n sideCollision(middleRight);\n }\n else if(groundSpeed < 0) {\n sideCollision(middleLeft);\n } \n }\n else if(!grounded) {\n if(xSpeed < 0) {\n sideCollision(middleLeft);\n }\n else if(xSpeed > 0) {\n sideCollision(middleRight);\n }\n }\n }", "public abstract void collide(InteractiveObject obj);", "@Override\n\tprotected boolean isFinished() {\n\t\treturn Math.abs(Robot.lidar.getRange() - range) < 2.0f;\n\t}", "@Override\n\tpublic boolean takeControl() {\n\t\treturn (Math.abs(Motor.A.getTachoCount() - Settings.motorAAngle) > 5 || (Motor.A.getTachoCount() == 0 && Settings.motorAAngle == -90));\n\t}", "private boolean rightDownCollision(InteractiveObject obj){\n\t\treturn ((obj.getX() - this.getX() < this.getWidth()) && (obj.getX() > this.getX()) &&\n\t\t\t\t(obj.getY() - this.getY() < this.getHeight()) && (obj.getY() > this.getY()));\n\t}", "@Override\n protected boolean isFinished() {\n SmartDashboard.putNumber(\"TurnCommand Current Heading\", Robot.m_drivetrain.getAngle());\n SmartDashboard.putNumber(\"TurnCommand Target\", Start + TurnGoal);\n if (IsLeft) {\n return Robot.m_drivetrain.getAngle() <= Start + TurnGoal;\n } else {\n return Robot.m_drivetrain.getAngle() >= Start + TurnGoal;\n }\n }", "private void conformCorridors() {\n for (int rowView = 0; rowView < rowViewMax; rowView++) {\r\n for (int colView = 0; colView < colViewMax; colView++) {\r\n if (getCell(rowView, colView) != Cell.wall)\r\n setCell(rowView, colView, Cell.corridor);\r\n }\r\n }\r\n }", "static int orientation(Point p, Point q, Point r)\n {\n int val = (q.getY() - p.getY()) * (r.getX() - q.getX())\n - (q.getX() - p.getX()) * (r.getY() - q.getY());\n\n if (val == 0)\n {\n return 0; // colinear\n }\n return (val > 0) ? 1 : 2; // clock or counterclock wise\n }", "public boolean collided(Rectangle r){\n\t\t\tif (this.intersects(r)) { return true;} \n\t\t\telse return false;\n\t\t}", "public abstract void collided(CircleCollider col);", "private void handleMazeCollisions() {\n final ArrayList<Rectangle> segs = maze.getCollisionCandidates(getCenter());\n\n for (int i = 0; i < segs.size(); i++) {\n if (!checkCollision(segs.get(i).getPolygon())) {\n // The tank does not intersect the seg.\n segs.remove(i);\n i--;\n }\n }\n\n if (segs.size() == 0) {\n // The tank does not intersect any of the segs.\n return;\n }\n\n Runnable reverseOp = null;\n // Backtrack.\n final Tank tank = this;\n // Need to declare this up here instead of in each case because java's switch cases share scope. So java would think\n // we are redeclaring a variable.\n final Point2D decomposedVelocity;\n switch (lastMovementOp) {\n case FORWARD:\n decomposedVelocity = Physics.decomposeVector(-1, theta);\n reverseOp = () -> tank.moveBy(decomposedVelocity);\n break;\n case REVERSE:\n decomposedVelocity = Physics.decomposeVector(1, theta);\n reverseOp = () -> tank.moveBy(decomposedVelocity);\n break;\n case RIGHT:\n reverseOp = () -> tank.rotate(-TURNING_ANGLE / 12);\n break;\n case LEFT:\n reverseOp = () -> tank.rotate(TURNING_ANGLE / 12);\n break;\n }\n do {\n assert reverseOp != null;\n reverseOp.run();\n\n for (int i = 0; i < segs.size(); i++) {\n if (!checkCollision(segs.get(i).getPolygon())) {\n segs.remove(i);\n i--;\n }\n }\n } while (segs.size() > 0);\n }", "protected boolean isColliding() {\n\t\treturn phxService.isColliding(this);\n\t}", "protected void check_turn(List<CollisionObject> collidables) {\n //Firing rays\n\n //select an area of 180 degrees (pi radians)\n boolean turn = true;\n Vector2 start_point = get_ray_fire_point();\n for (int ray = 0; ray <= number_of_rays; ray++) {\n\n if (turn) {\n ray--;\n float ray_angle = sprite.getRotation() + ((ray_angle_range / (number_of_rays / 2)) * ray);\n turn = false;\n } else {\n float ray_angle = sprite.getRotation() - ((ray_angle_range / (number_of_rays / 2)) * ray);\n turn = true;\n }\n\n float ray_angle = ((ray_angle_range / number_of_rays) * ray) + sprite.getRotation();\n\n for (float dist = 0; dist <= ray_range; dist += ray_step_size) {\n\n double tempx = (Math.cos(Math.toRadians(ray_angle)) * dist) + (start_point.x);\n double tempy = (Math.sin(Math.toRadians(ray_angle)) * dist) + (start_point.y);\n //check if there is a collision hull (other than self) at (tempx, tempy)\n for (CollisionObject collideable : collidables) {\n if (collideable.isShown() &&\n ((Obstacle) collideable).getSprite().getY() > sprite.getY() - 200 &&\n ((Obstacle) collideable).getSprite().getY() < sprite.getY() + 200 &&\n ((Obstacle) collideable).getSprite().getX() > sprite.getX() - 200 &&\n ((Obstacle) collideable).getSprite().getX() < sprite.getX() + 200)\n for (Shape2D bound : collideable.getBounds().getShapes()) {\n if (bound.contains((float) tempx, (float) tempy)) {\n // Determines which side the ai should turn to\n if (turn) {\n turn(-1);\n return;\n } else {\n turn(1);\n return;\n }\n\n }\n }\n\n }\n }\n }\n }", "protected boolean rotate(){\n\t\tif(this.target == null)\n\t\t\treturn false;\n\t\tif(this.target.equals(this.modelPos))\n\t\t\treturn false;\n\t\tfloat tx = modelPos.x - target.x;\n\t\tfloat ty = modelPos.y - target.y;\n\t\tfloat angle = (float) Math.toDegrees(Math.atan(Math.abs(ty / tx)));\n\t\tangle = 180 + Math.signum(tx) * 90 + Math.signum(tx) * Math.signum(ty)\n\t\t\t\t* angle;\n\t\tangle = (float) Math.round(angle * 10) / 10;\n\t\tif(this.modelAngle.z == angle)\n\t\t\treturn false;\n\t\tfloat tmp = this.modelAngle.z - angle;\n\t\tif(Math.abs(tmp) < rotDelta){\n\t\t\tthis.modelAngle.z = angle;\n\t\t\treturn false;\n\t\t}else\n\t\t\tthis.modelAngle.z += (Math.abs(tmp) > 180 ? 1.0f : -1.0f)\n\t\t\t\t\t* Math.signum(tmp) * rotDelta;\n\t\tif(this.modelAngle.z > 360.0f)\n\t\t\tthis.modelAngle.z %= 360.0f;\n\t\telse if(this.modelAngle.z < 0.0f)\n\t\t\tthis.modelAngle.z = 360.0f - this.modelAngle.z;\n\t\treturn true;\n\t}", "private boolean leftDownCollision(InteractiveObject obj){\n\t\treturn (((this.getX() - obj.getX()) < obj.getWidth()) && (this.getX() > obj.getX()) &&\n\t\t\t\t((obj.getY() - this.getY()) < this.getHeight()) && (obj.getY() > this.getY()));\n\t}", "private boolean checkCollisions()\n {\n for (int i = 1; i < numFigs; i++)\n if (figures[0].collidedWith(figures[i]))\n return true;\n return false;\n }", "@Override\n\tpublic boolean isCollided(SpaceShip invader, Rocket rocket) {\n\t\t//(posX + width) /2 , (posY + height) /2\n\t\tint spaceshipCenterX = (int)(invader.getPosition().getX() + invader.getSize().getWidth()) / 2;\n\t\tint spaceshipCenterY = (int)(invader.getPosition().getY() + invader.getSize().getHeight()) / 2;\n\t\tPoint spaceshipCenter = new Point(spaceshipCenterX, spaceshipCenterY);\n\t\tif (spaceshipCenter == rocket.getPosition())\n\t\t\treturn true;\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean onValidSurface()\n\t{\n\t\tif (!this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint i = Math.max(1, this.blocksToTakeUp());\n\t\t\tint j = Math.max(1, this.blocksToTakeUp());\n\t\t\tBlockPos blockpos = this.hangingPosition.offset(this.facingDirection.getOpposite());\n\t\t\tEnumFacing enumfacing = this.facingDirection.rotateYCCW();\n\n\t\t\tfor (int k = -i / 2 + 1; k < i / 2 + 1; ++k)\n\t\t\t{\n\t\t\t\tfor (int l = -j / 2 + 1; l < j / 2 + 1; ++l)\n\t\t\t\t{\n\t\t\t\t\tBlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l);\n\t\t\t\t\tBlock block = this.worldObj.getBlockState(blockpos1).getBlock();\n\n\t\t\t\t\tif (block.isSideSolid(this.worldObj, blockpos1, this.facingDirection))\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()))\n\t\t\t{\n\t\t\t\tif (entity instanceof EntityHanging)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t}", "public abstract void collided(Collision c);", "protected boolean isFinished() {\n \tif (Robot.clawElevator.getContainerHeight() == 0) {\n \t\treturn Robot.clawElevator.getLowerSwitch();\n \t} else {\n \t\treturn Robot.clawElevator.getLowerSwitch() || Robot.clawElevator.isAtIntemediateStop(Math.abs(Robot.clawElevator.getContainerHeight() - 3), false);\n \t}\n }", "private boolean needToTurn() {\n\t\tdouble curDir = sens.getDirection();\n\t\tdouble desDirPlusAmount = desiredDirection + TURNSPEED;\n\t\tdouble desDirMinusAmount = desiredDirection - TURNSPEED;\n\n\t\t// if desired direction is <||> +_ x degrees\n\t\tif (curDir < desDirMinusAmount || curDir > desDirPlusAmount) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean isOrientationCorrected() {\n\t\treturn orientationCorrection;\n\t}", "private void turnClockwise() {\n\t\torientation = TurnAlgorithmExecutor.getAlgorithmFromCondition(orientation).execute(orientation);\n\t}", "public boolean isFinished() {\n return (Math.abs(RobotContainer.drive.getAngle() - this.angle) <= 1);\n }", "public void gameUpdate()\n {\n\t\tcheckCollisions();\n\t\t\n\t\tif(up)\t\tcraft.accelerat();\t\t\n\t\tif(left)\tcraft.rotateLeft();\n\t\tif(right) \tcraft.rotateRight();\n\t\t\n\t\tcraft.move();\n\t\tmoveAstroids();\n }", "void take_angles() {\n\n rolls+=String.valueOf((Math.toDegrees(orientation[2]))%360+90)+\"\\n\";\n if(!touch_ground_switch.isChecked()&&angle_with_ground==0)\n angle_with_ground=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n else if (down_angle == 0)\n down_angle=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n else if(up_angle==0)\n {\n up_angle=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n touch_ground_switch.setVisibility(View.INVISIBLE);\n if(!touch_ground_switch.isChecked())\n object_calculations_doesnt_touch_ground();\n else\n object_calculations_touch_ground();\n }\n}", "@Override\n\tpublic boolean checkCollision() {\n\t\treturn true;\n\t}", "boolean isEquilateral() {\r\n\t\treturn (side1 == side2 && side2 == side3 && side3 == side1);\r\n\t}", "public boolean collisionCheck() {\n for (Alien al : aliens) {\n if (you.collide(al)) {\n al.collide(you);\n return true;\n }\n }\n boolean tf = false;\n int index = 0, size = lazers.size();\n while (index < size) {\n if (you.collide(lazers.get(index))) {\n lazers.remove(index);\n size--;\n index--;\n tf = true;\n }\n index++;\n }\n return tf;\n }", "public void updateSensors() {\n if(bLCollide && bRCollide) {\n grounded = true;\n }\n else if(bLCollide || bRCollide) {\n grounded = true;\n }\n else if(!bLCollide && !bRCollide) {\n grounded = false;\n }\n if(!collideWithSlopeL && !collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,80); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,80); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer+28,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer+28,40,4); \n }\n else if(collideWithSlopeL && !collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,144); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,80); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4);\n }\n else if(!collideWithSlopeL && collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,80); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,144);\n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4); \n }\n else if(collideWithSlopeL && collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,144); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,144); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4);\n }\n if(!grounded) {/*Added this to reset the height of the player sensors if he jumps off a slope (ground == true wouldn't trigger \n early) making the player stop earlier then he should*/\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,80); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,80); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4); \n }\n topLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer-84,4,80);\n topRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer-84,4,80); \n //Gets the correct size of interactBox\n if(jumpState != JumpState.STATE_NOJUMP || duckState != DuckState.STATE_NODUCK) {\n intersectBox = new Rectangle(xDrawCenterPlayer-30, ySpriteCenterPlayer-20, 60, 80);\n }\n else {\n intersectBox = new Rectangle(xDrawCenterPlayer-29, ySpriteCenterPlayer-70, 60, 140);\n }\n }", "public void switchOr() {\n if (orientation == 1) {\n orientation = 0;\n }\n else {\n orientation = 1;\n }\n }", "private void checkCastleCollisions() {\n\t\t\n\t}", "protected void reachedTargetRotation ()\n {\n // clear turn direction\n ((Agent)_actor).setTurnDirection(0);\n\n // notify the behavior\n _behavior.reachedTargetRotation();\n }", "public boolean isColliding(){\n for(int i = 0; i < eng.getIDManager().getObjectsWithID(\"GameObject\").size(); i++){\n GameObject temp = eng.getIDManager().getObjectsWithID(\"GameObject\").get(i);\n \n if(temp.getHitBox().getBounds().intersects(rect.getBounds()) &&\n temp.getHitBox() != this){\n currentCollidingObject = temp;\n return true;\n }\n }\n \n return false;\n }", "public boolean isEquilateral () {\r\n\t\tif ((startSide1 == startSide2 && startSide1 == startSide3) && isTriangle () == true && isRight () == false) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse return false;\r\n\t}", "@Test\n public final void testIsOrientation() {\n boolean result = ship.isOrientation();\n assertTrue(result);\n this.ship.setOrientation(false);\n result = ship.isOrientation();\n assertFalse(result);\n }", "boolean complete() {\n return start2D != null && stop2D != null;// && start3D!=null && stop3D!=null;\n }", "@Override\n\t\tprotected boolean condition() {\n\t\t\tWhichSide whichSide = VisionUtil.getPositionOfGearTarget();\n\t\t\tSystem.err.println(\"Position of gear target: \"+whichSide);\n\t\t\tif (whichSide == WhichSide.RIGHT)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "protected boolean isFinished() {\n \tif (moving) return Robot.armPiston.getMajor() != PistonPositions.Moving; /* && Robot.armPiston.getMinor() != PistonPositions.Moving; */\n \treturn true;\n }", "@Override\n public void act(float delta)\n {\n SCALE = PlayScreen.scale;\n\n if(actCount < 4)actCount++;\n\n dt=delta;\n if(!initialized)\n {\n mirror.setRotation(initRotation);\n\n dt = delta;\n positionChanged();\n\n if (hittime > (1.0 / 5.0))\n {\n if (hit >= 0) hit--;\n hittime = 0;\n\n //Set rotation to the nearest multiple of 90\n mirror.setRotation(90 * (Math.round(mirror.getRotation() / 90)));\n\n if (mirror.getRotation() >= 360)\n {\n mirror.setRotation(((mirror.getRotation() - 360 * (int) (mirror.getRotation() / 360)) / 90) * 90);\n }\n\n //setRotation(mirror.getRotation());\n }\n //setOrigin(mirror.getOriginX(), mirror.getOriginY());\n }\n\n if(initialized && hit>0)\n {\n positionChanged();\n\n if(hittime>=(1.0/5.0))\n {\n if(hit>0)hit--;\n hittime = 0;\n if (hit == 0)\n {\n\n //Set rotation to the nearest multiple of 90\n mirror.setRotation(90 * (Math.round(mirror.getRotation() / 90)));\n\n if (mirror.getRotation() >= 360)\n {\n mirror.setRotation(((mirror.getRotation() - 360 * (int) (mirror.getRotation() / 360)) / 90) * 90);\n }\n\n //setRotation(mirror.getRotation());\n }\n }\n\n }\n\n //Handles fading in/out of obstacle when triggered by a Toggle object\n if(fadeIn || fadeOut)\n {\n if(fadeIn)\n {\n if(mirror.getColor().a <0.95f)\n {\n mirror.setColor(mirror.getColor().r, mirror.getColor().g, mirror.getColor().b, mirror.getColor().a + 1 * delta * 8 / 4.0f);\n }\n else\n {\n mirror.setColor(mirror.getColor().r, mirror.getColor().g, mirror.getColor().b, 1f);\n fadeIn = false;\n fadeOut = false;\n }\n }\n else\n {\n if(mirror.getColor().a >= 0.39f)\n {\n mirror.setColor(mirror.getColor().r, mirror.getColor().g, mirror.getColor().b, mirror.getColor().a - 1 * delta * 15 / 4.0f);\n }\n else\n {\n mirror.setColor(mirror.getColor().r, mirror.getColor().g, mirror.getColor().b, Toggle.fadealpha);\n fadeIn = false;\n fadeOut = false;\n }\n }\n }\n\n\n\n\n if(!initialized)\n {\n initialized = true;\n }\n\n if(actCount<4){defineBody(); calculateTriangle(mirror.getX(), mirror.getY(), mirror.getRotation());}\n\n if(poly.getRotation() != mirror.getRotation()){calculateTriangle(mirror.getX(), mirror.getY(), mirror.getRotation());}\n\n super.act(delta);\n }", "@Override\n\tpublic void update(){\n\t\tif(!isPositionValid())\n\t\t\tescape();\n\t\tdouble dx = velocity.x * speed;\n\t\tdouble dy = velocity.y * speed;\n\t\tprojectedCenter.setLocation(center.x + dx, center.y + dy);\n\t\t//check other ball collisions\n\t\tboolean aloneFlag = true;\n\t\tfor(Ball other : Game.gameField.getBalls()){\n\t\t\tif(other == this)\n\t\t\t\tcontinue;\n\t\t\tcheckCollision(other);\n\t\t\tif(quadrant.equals(other.getQuadrant())){\n\t\t\t\taloneFlag = false;\n\t\t\t}\n\t\t}\n\t\tisAlone = aloneFlag;\n\t\t//check wall collisions\n\t\tfor(Wall wall : Game.gameField.getWalls()){\n\t\t\twall.checkCollision(this, projectedCenter);\n\t\t}\n\t\t//check boundary collisions\n\t\tGame.gameField.checkBoundaryCollision(this, projectedCenter);\n\t\t//collisions may have changed the velocity vector\n\t\tdx = velocity.x * speed;\n\t\tdy = velocity.y * speed;\n\t\tmove(dx, dy);\n\t\t//check if the move is valid, if not move back\n\t\tif(!isPositionValid()){\n\t\t\tmove(-dx, -dy);\n\t\t}\n\t\tquadrant = Calculations.getQuadrant(center, Game.gameField.getWalls());\n\t}", "public boolean hasCollided() {\r\n\t\treturn hasCollided;\r\n\t}", "private static int orientation(Coord p, Coord r, Coord q) \n { \n // See https://www.geeksforgeeks.org/orientation-3-ordered-points/ \n // for details of below formula. \n int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); \n \n if (val == 0) return 0; // colinear \n \n return (val > 0)? 1: 2; // clock or counterclock wise \n }", "protected boolean isFinished ()\n\t{\n\n\t\tif (Subsystems.goalVision.getProportionalGoalX() >= X_OFFSET\n\t\t - DEADBAND\n\t\t && Subsystems.goalVision\n\t\t .getProportionalGoalX() <= X_OFFSET + DEADBAND)\n\t\t//The goal is centered.\n\t\t{\n\t\t\t//We are aligned.\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public void laserUpdate3() {\n\n\t\t// makes laser & ship stay coupled (maybe a better way to do this?)\n\t\tif (StartingClass.downEnemies.get(StartingClass.currentIndex).isMovingY()) {\n\t\t\tcenterY = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterY();\n\t\t\tcenterX = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterX();\n\t\t}\n\t\tif (StartingClass.MIDDLE_Y > StartingClass.downLasers.get(StartingClass.currentIndex).getCenterY()) {\n\t\t\tcenterY += 3;\n\t\t} else {\n\t\t\tcenterX = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterX() + 1;\n\t\t\tcenterY = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterY();\n\t\t}\n\t}", "public boolean isCanRot() {\n\t\treturn canRot;\n\t}", "void detectWallCollisions() {\n\t\tif (getCenterX() < getRadius()) {\n\t\t\tsetCenterX(getRadius());\n\t\t\tvx = -vx;\n\t\t} else if (getCenterX() > (getScene().getWidth() - getRadius())) {\n\t\t\tsetCenterX((getScene().getWidth() - getRadius()));\n\t\t\tvx = -vx;\n\t\t}\n\t\tif (getCenterY() < getRadius()) {\n\t\t\tsetCenterY(getRadius());\n\t\t\tvy = -vy;\n\t\t} else if (getCenterY() > (getScene().getHeight() - getRadius())) {\n\t\t\tsetCenterY(getScene().getHeight() - getRadius());\n\t\t\tvy = -vy;\n\t\t}\n\t}", "@Override\n protected boolean isFinished() {\n if(direction){\n if(leftTarget <= Robot.driveTrain.getLeftEncoderDistanceInches() || rightTarget <= Robot.driveTrain.getRightEncoderDistanceInches()){\n turnPID.resetPID();\n return true;\n } else{\n return false;\n }\n \n } else{\n if(leftTarget >= Robot.driveTrain.getLeftEncoderDistanceInches() || rightTarget >= Robot.driveTrain.getRightEncoderDistanceInches()){\n turnPID.resetPID();\n return true;\n } else{\n return false;\n }\n }\n \n \n }", "protected boolean isFinished() {\n \tif (Math.abs(_finalTickTargetLeft - Robot.driveTrain.getEncoderLeft()) <= 0 &&\n \t\t\tMath.abs(_finalTickTargetRight - Robot.driveTrain.getEncoderRight()) <= 0)\n \t{\n \t\treturn true;\n \t}\n return false;\n }", "private boolean hitSides() {\n if (b.numY + 60 >= BOX_HEIGHT || (b.numY - 60 <= 0)) {\n return true;\n } else {\n return false;\n }\n }", "@Override\n public void handleCollision(Pellet pellet)\n {\n if(!isMovingToPoint())\n {\n if (mirror.getColor().a > Toggle.fadealpha)\n {\n\n float mirOX = getPosX() + getWidth() / 2;\n float mirOY = getPosY() + getHeight() / 2;\n\n if (acceptedDirs.equals(\"dl\"))\n {\n\n if (pellet.direction == 'u')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'r';\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'l';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"dr\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'l';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2) + 1 / PlayScreen.PPM);\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2) - 1 / PlayScreen.PPM);\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'r';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"ur\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'l';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'r';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"ul\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'r';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'l';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n //Draw the pellet at the origin of the mirror\n pellet.collided = false;\n }\n }\n }", "public boolean isScalene() {\n\t\t\tif (this.sideOne != this.sideTwo && this.sideOne != this.sideThree && this.sideTwo != this.sideThree) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "private void compruebaColisiones()\n {\n // Comprobamos las colisiones con los Ufo\n for (Ufo ufo : ufos) {\n // Las naves Ufo chocan con la nave Guardian\n if (ufo.colisionaCon(guardian) && ufo.getVisible()) {\n mensajeDialogo(0);\n juego = false;\n }\n // Las naves Ufo llegan abajo de la pantalla\n if ((ufo.getPosicionY() - ufo.getAlto() > altoVentana)) {\n mensajeDialogo(0);\n juego = false;\n }\n // El disparo de la nave Guardian mata a una nave Ufo\n if (ufo.colisionaCon(disparoGuardian) && ufo.getVisible()) {\n ufo.setVisible(false);\n disparoGuardian.setVisible(false);\n disparoGuardian.setPosicion(0, 0);\n ufosMuertos++;\n }\n }\n\n // El disparo de las naves Ufo mata a la nave Guardian\n if (guardian.colisionaCon(disparoUfo)) {\n disparoUfo.setVisible(false);\n mensajeDialogo(0);\n juego = false;\n }\n\n // Si el disparo Guardian colisiona con el disparo de los Ufo, se\n // eliminan ambos\n if (disparoGuardian.colisionaCon(disparoUfo)) {\n disparoGuardian.setVisible(false);\n disparoGuardian.setPosicion(0, 0);\n disparoUfo.setVisible(false);\n }\n }", "@Test\n public void testCondition4()\n {\n Double[] angles = {75.0, 75.0, 71.0};\n _renderable.orientation(angles);\n Double testVal[] = _renderable.orientation();\n assertEquals(\"x angle did not get set,\", angles[0], testVal[0], 2);\n assertEquals(\"y angle did not get set,\", angles[1], testVal[1], 2);\n assertEquals(\"z angle did not get set,\", angles[2], testVal[2], 2);\n }", "public boolean willBoxesCollide(Unit player, float deltaX, float deltaY) {\n\tScene currentScene = WorldMap.getInstance().getCurrentScene();\n\tfor (Obstacle obstacle : currentScene.getObstacleList()) {\n\t if (player.collisionBetweenBoxes(deltaX, deltaY, obstacle) && player.getPosZ() < obstacle.getProtrusionHeight())\n\t\treturn true;\n\t}\n\t \n\treturn false;\n }" ]
[ "0.61680263", "0.60314876", "0.59730625", "0.5910881", "0.5857102", "0.5801611", "0.570871", "0.5696123", "0.5671425", "0.5655996", "0.56477016", "0.56017184", "0.5593909", "0.5579227", "0.55352646", "0.5531321", "0.55265266", "0.5496452", "0.5481549", "0.5477303", "0.54745775", "0.54301614", "0.54283756", "0.54236025", "0.540219", "0.53945863", "0.5392297", "0.53888804", "0.5383309", "0.5379238", "0.53779465", "0.5377519", "0.53745633", "0.53594923", "0.5355837", "0.5349615", "0.534493", "0.53422993", "0.53375775", "0.53161055", "0.5308081", "0.53049815", "0.53045493", "0.52926594", "0.5289433", "0.5261998", "0.5252357", "0.5244302", "0.52417964", "0.5237298", "0.52313185", "0.5228179", "0.52273697", "0.52194995", "0.52040225", "0.51974034", "0.5197098", "0.5191923", "0.51834124", "0.5182489", "0.5177144", "0.51762515", "0.5172617", "0.51708966", "0.5160594", "0.51568973", "0.5154691", "0.5145437", "0.5140949", "0.5140129", "0.51331574", "0.51270366", "0.51230407", "0.51211166", "0.51140773", "0.5109865", "0.51075816", "0.51043475", "0.510267", "0.5102659", "0.5102298", "0.5100148", "0.5097633", "0.5089174", "0.5084306", "0.5082767", "0.5082679", "0.50787485", "0.5077427", "0.5076408", "0.5071404", "0.50708735", "0.5068424", "0.506568", "0.50575054", "0.50574", "0.505719", "0.5054372", "0.5042233", "0.5039189" ]
0.5106276
77
Implements the doubletriangle orientation rule, which states that if DoB, A>BB.
private void doubleTriangle(Graph graph) { List<Node> nodes = graph.getNodes(); for (Node B : nodes) { List<Node> intoBArrows = graph.getNodesInTo(B, Endpoint.ARROW); List<Node> intoBCircles = graph.getNodesInTo(B, Endpoint.CIRCLE); //possible A's and C's are those with arrows into B List<Node> possA = new LinkedList<>(intoBArrows); List<Node> possC = new LinkedList<>(intoBArrows); //possible D's are those with circles into B for (Node D : intoBCircles) { for (Node A : possA) { for (Node C : possC) { if (C == A) { continue; } //skip anything not a double triangle if (!graph.isAdjacentTo(A, D) || !graph.isAdjacentTo(C, D)) { continue; } //skip if A,D,C is a collider if (graph.isDefCollider(A, D, C)) { continue; } //if all of the previous tests pass, orient D*-oB as D*->B if (!isArrowpointAllowed(graph, D, B)) { continue; } graph.setEndpoint(D, B, Endpoint.ARROW); changeFlag = true; } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static void determineOrientation(Triangulator triRef, int ind) {\n\tdouble area;\n\n\t// compute the polygon's signed area, i.e., its orientation.\n\tarea = polygonArea(triRef, ind);\n\n\t// adjust the orientation (i.e., make it CCW)\n\tif (area < 0.0) {\n\t triRef.swapLinks(ind);\n\t triRef.ccwLoop = false;\n\t}\n\n }", "static void adjustOrientation(Triangulator triRef, int i1, int i2) {\n\n\tdouble area;\n\tint i, outer;\n\tint ind;\n\n\tif(i1 >= i2)\n\t System.out.println(\"Orientation:adjustOrientation Problem i1>=i2 !!!\");\n\n\tif (triRef.numLoops >= triRef.maxNumPolyArea) {\n\t // System.out.println(\"Orientation:adjustOrientation Expanding polyArea array .\");\n\t triRef.maxNumPolyArea = triRef.numLoops;\n\t double old[] = triRef.polyArea;\n\t triRef.polyArea = new double[triRef.maxNumPolyArea];\n\t if(old != null)\n\t\tSystem.arraycopy(old, 0, triRef.polyArea, 0, old.length);\n\t}\n\n\t// for each contour, compute its signed area, i.e., its orientation. the\n\t// contour with largest area is assumed to be the outer-most contour.\n\tfor (i = i1; i < i2; ++i) {\n\t ind = triRef.loops[i];\n\t triRef.polyArea[i] = polygonArea(triRef, ind);\n\t}\n\n\t// determine the outer-most contour\n\tarea = Math.abs(triRef.polyArea[i1]);\n\touter = i1;\n\tfor (i = i1 + 1; i < i2; ++i) {\n\t if (area < Math.abs(triRef.polyArea[i])) {\n\t\tarea = Math.abs(triRef.polyArea[i]);\n\t\touter = i;\n\t }\n\t}\n\n\t// default: the outer contour is referenced by loops[i1]\n\tif (outer != i1) {\n\t ind = triRef.loops[i1];\n\t triRef.loops[i1] = triRef.loops[outer];\n\t triRef.loops[outer] = ind;\n\n\t area = triRef.polyArea[i1];\n\t triRef.polyArea[i1] = triRef.polyArea[outer];\n\t triRef.polyArea[outer] = area;\n\t}\n\n\t// adjust the orientation\n\tif (triRef.polyArea[i1] < 0.0) triRef.swapLinks(triRef.loops[i1]);\n\tfor (i = i1 + 1; i < i2; ++i) {\n\t if (triRef.polyArea[i] > 0.0) triRef.swapLinks(triRef.loops[i]);\n\t}\n }", "boolean canFormTriangle(double a, double b, double c) {\n return (a + b > c) && (a + c > b) && (b + c > a);\n }", "public static boolean check_right_angled_tri(int [] side) {\n\t\tint a_sqr = side[0]*side[0];\n\t\tint b_sqr = side[1]*side[1];\n\t\tint c_sqr = side[2]*side[2];\n\t\t\n\t\t// boolean isIsosceles = check_isosceles_tri(a_side, b_side, c_side);\n\t\treturn ((a_sqr == b_sqr + c_sqr) || (b_sqr == a_sqr + c_sqr) || (c_sqr == a_sqr+b_sqr)) && isTri(side) ;\n\t}", "public boolean canReorderDoubled3(int[] A) {\n SortedMap<Integer, Integer> count = new TreeMap<>();\n for (int a : A) {\n count.put(a, count.getOrDefault(a, 0) + 1);\n }\n for (int num : count.keySet()) {\n int cnt = count.get(num);\n if (cnt == 0) { continue; }\n\n if (num < 0 && num % 2 != 0) { return false; }\n\n int pair = (num < 0) ? num / 2 : num * 2;\n if (cnt > count.getOrDefault(pair, 0)) { return false; }\n\n count.put(pair, count.get(pair) - cnt);\n }\n return true;\n }", "public double area()\n\t{\n\t\t// To recognize points, their angles must be compared - middle one always represents the opposing point.\n\t\tdouble angleXAB = pointA.calculateLineAngle(pointB);\n\t\tdouble angleXAC = pointA.calculateLineAngle(pointC);\n\t\tdouble angleXAD = pointA.calculateLineAngle(pointD);\n\t\t\n\t\tTriangle first;\n\t\tTriangle second;\n\n\t\t// Creates triangles based on angles comparison.\n\t\t// opposite is XAD\n\t\tif(angleXAB > angleXAC)\n\t\t\t// opposite is XAC\n\t\t\tif(angleXAC > angleXAD)\n\t\t\t{\n\t\t\t\tfirst = new Triangle (pointA, pointB, pointD);\n\t\t\t\tsecond = new Triangle (pointB, pointD, pointC);\n\t\t\t} // if\n\t\t\t// opposite is XAB\n\t\t\telse if (angleXAD > angleXAB)\n\t\t\t{\n\t\t\t\tfirst = new Triangle (pointA, pointC, pointD);\n\t\t\t\tsecond = new Triangle (pointB, pointD, pointC);\n\t\t\t} // else if\t\n\t\t\t// opposite is XAD\t\n\t\t\telse\n\t\t\t{\n\t\t\t\tfirst = new Triangle (pointA, pointB, pointC);\n\t\t\t\tsecond = new Triangle (pointD, pointB, pointC);\n\t\t\t} // else\n\n\t\telse\t\n\t\t\t// opposite is XAC\n\t\t\tif(angleXAD > angleXAC)\t\t\t\n\t\t\t{\n\t\t\t\tfirst = new Triangle (pointA, pointB, pointD);\n\t\t\t\tsecond = new Triangle (pointB, pointD, pointC);\n\t\t\t} // if \n\t\t\t// opposite is XAD\n\t\t\telse if (angleXAD > angleXAB)\n\t\t\t{\n\t\t\t\tfirst = new Triangle (pointA, pointC, pointD);\n\t\t\t\tsecond = new Triangle (pointB, pointD, pointC);\n\t\t\t} // else if \n\t\t\t// opposite is XAB\n\t\t\telse \t\n\t\t\t{\n\t\t\t\tfirst = new Triangle (pointA, pointC, pointD);\n\t\t\t\tsecond = new Triangle (pointB, pointD, pointC);\n\t\t\t} // else\t\n\t\t\t\t\t\n\t\treturn \tfirst.area() + second.area();\n\t}", "private int orientation(Waypoint w1, Waypoint w3, Waypoint w2){\n\t\tdouble w1x = w1.getX();\n\t\tdouble w1y = w1.getY();\n\t\tdouble w2x = w2.getX();\n\t\tdouble w2y = w2.getY();\n\t\tdouble w3x = w3.getX();\n\t\tdouble w3y = w3.getY();\n\t\tdouble val = (w3y - w1y) * (w2x - w3x) - (w3x - w1x) * (w2y - w3y);\n\t\t\n\tif ( val == 0) //colinear\n\t\treturn 0;\n\t\n\treturn (val > 0) ? 1: 2; //clock or counterclock wise\n\t\n\t}", "public boolean isTriangle () {\r\n\t\tif (startSide1 > 0 && startSide2 > 0 && startSide3 > 0){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse return false;\r\n\t}", "public Orientation trouver_orientation(float x_A, float y_A, float x_B, float y_B) {\n if (x_A - x_B > 0 && x_A - x_B > y_A - y_B)\n return Orientation.SUD;\n else if (x_A - x_B < 0 && x_A - x_B < y_A - y_B)\n return Orientation.NORD;\n else if (y_A - y_B > 0 && x_A - x_B < y_A - y_B)\n return Orientation.OUEST;\n else\n return Orientation.EST;\n }", "public Quaternion orientationAlongSegment(Point beg, Point end) {\n\n // Use Apache vectors and matrices to do the math.\n\n Vector3D b = new Vector3D(beg.getX(), beg.getY(), beg.getZ());\n Vector3D e = new Vector3D(end.getX(), end.getY(), end.getZ());\n\n Vector3D vfwd = e.subtract(b);\n\n double len = vfwd.getNorm();\n if (len > 0)\n vfwd = vfwd.normalize();\n else\n vfwd = new Vector3D(1.0, 0.0, 0.0);\n\n Vector3D vdown = new Vector3D(0.0, 0.0, 1.0);\n Vector3D vright = new Vector3D(0.0, 1.0, 0.0);\n\n // Check that the direction of motion is not along the Z axis. In this\n // case the approach of taking the cross product with the world Z will\n // fail and we need to choose a different axis.\n double epsilon = 1.0e-3;\n if (Math.abs(vdown.dotProduct(vfwd)) < 1.0 - epsilon) {\n vright = vdown.crossProduct(vfwd);\n vdown = vfwd.crossProduct(vright);\n if (vdown.getZ() < 0) {\n vright = vright.negate();\n vdown = vfwd.crossProduct(vright);\n }\n }\n else {\n vdown = vfwd.crossProduct(vright);\n vright = vdown.crossProduct(vfwd);\n if (vright.getY() < 0) {\n vdown = vdown.negate();\n vright = vdown.crossProduct(vfwd);\n }\n }\n\n // Make sure all vectors are normalized\n vfwd = vfwd.normalize();\n vright = vright.normalize();\n vdown = vdown.normalize();\n\n // Construct a rotation matrix\n double dcm[][] = new double[3][3];\n dcm[0][0] = vfwd.getX(); dcm[0][1] = vright.getX(); dcm[0][2] = vdown.getX();\n dcm[1][0] = vfwd.getY(); dcm[1][1] = vright.getY(); dcm[1][2] = vdown.getY();\n dcm[2][0] = vfwd.getZ(); dcm[2][1] = vright.getZ(); dcm[2][2] = vdown.getZ();\n Rotation R = new Rotation(dcm, 1e-8);\n\n //Print the rotation matrix\n //double d[][] = R.getMatrix();\n //for (int row = 0; row < 3; row++) {\n // logger.info(\"\\nMatrix is \" +\n //\t\tFloat.toString((float)d[row][0]) + \" \" +\n //\t\tFloat.toString((float)d[row][1]) + \" \" +\n //\t\tFloat.toString((float)d[row][2]));\n //}\n\n return new Quaternion(-(float)R.getQ1(), -(float)R.getQ2(),\n -(float)R.getQ3(), (float)R.getQ0());\n }", "private void doDdpOrientation(Graph graph, Node l, Node a, Node b, Node c) {\n changeFlag = true;\n for (IonIndependenceFacts iif : separations) {\n if ((iif.getX().equals(l) && iif.getY().equals(c)) ||\n iif.getY().equals(l) && iif.getX().equals(c)) {\n for (List<Node> condSet : iif.getZ()) {\n if (condSet.contains(b)) {\n graph.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(graph);\n return;\n }\n }\n break;\n }\n }\n Graph newGraph1 = new EdgeListGraph(graph);\n newGraph1.setEndpoint(a, b, Endpoint.ARROW);\n newGraph1.setEndpoint(c, b, Endpoint.ARROW);\n discrimGraphs.add(newGraph1);\n Graph newGraph2 = new EdgeListGraph(graph);\n newGraph2.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(newGraph2);\n }", "@Test\n\t\tpublic void orderTest () {\n\t\t\tassertTrue (Demo.isTriangle(2, 1, 4));\t\n\t\t}", "public boolean canReorderDoubled2(int[] A) {\n Map<Integer, Integer> count = new HashMap<>();\n for (int a : A) {\n count.put(a, count.getOrDefault(a, 0) + 1);\n }\n Integer[] B = new Integer[A.length];\n for (int i = 0; i < A.length; i++) {\n B[i] = A[i];\n }\n Arrays.sort(B, Comparator.comparingInt(Math::abs));\n for (int b : B) {\n if (count.get(b) == 0) { continue; }\n if (count.getOrDefault(2 * b, 0) <= 0) { return false; }\n\n count.put(b, count.get(b) - 1);\n count.put(2 * b, count.get(2 * b) - 1);\n }\n return true;\n }", "private boolean _clockwise(PVector A, PVector B, PVector C) {\n return (C.y-A.y) * (B.x-A.x) > (B.y-A.y) * (C.x-A.x);\n }", "public Boolean estTriangleEquilateral() {\n\t\t// initialisation du retour\n\t\tBoolean retour = false;\n\n\t\t// calcul de AB la distance entre le premier et le troisieme point\n\t\tdouble AB = this.premier.calculerDistance(this.troisieme);\n\n\t\t// calcul de AC la distance entre le premier et le deuxieme point\n\t\tdouble AC = this.premier.calculerDistance(this.deuxieme);\n\n\t\t// calcul de BC la distance entre le deuxieme et le troisieme point\n\t\tdouble BC = this.deuxieme.calculerDistance(this.troisieme);\n\n\t\t//test\n\t\tif (AB == AC && AB == BC)\n\t\t\tretour = true;\n\n\t\t// retour\n\t\treturn retour;\n\t}", "protected boolean checkTriangleArrow() {\n\t\tboolean passed = true;\n\t\tStroke last = m_subStrokes.get(m_subStrokes.size() - 1);\n\t\tStroke secondLast = m_subStrokes.get(m_subStrokes.size() - 2);\n\t\tStroke thirdLast = m_subStrokes.get(m_subStrokes.size() - 3);\n\t\tStroke fourthLast = m_subStrokes.get(m_subStrokes.size() - 4);\n\t\tdouble lastLength = StrokeFeatures.getStrokeLength(last);\n\t\tdouble secondLastLength = StrokeFeatures.getStrokeLength(secondLast);\n\t\tdouble thirdLastLength = StrokeFeatures.getStrokeLength(thirdLast);\n\t\tdouble fourthLastLength = StrokeFeatures.getStrokeLength(fourthLast);\n\n\t\t// test 1: last stroke and third to last stroke should be same size\n\t\tdouble diff = Math.abs(lastLength - thirdLastLength)\n\t\t\t\t/ (lastLength + thirdLastLength);\n\t\tif (diff > 0.5)\n\t\t\tpassed = false;\n\n\t\t// test 2: two points at the \"head\" of the arrow should be close\n\t\tdouble dis = last.getLastPoint().distance(thirdLast.getFirstPoint())\n\t\t\t\t/ m_features.getStrokeLength();\n\t\tif (dis > 0.25)\n\t\t\tpassed = false;\n\n\t\t// test 3: triangle arrow should be better fit than standard arrow\n\t\tif (m_standardPassed && dis > m_standardSum)\n\t\t\tpassed = false;\n\n\t\t// test 4: second to last line of arrow head should intersect shaft of\n\t\t// arrow\n\t\tLine2D.Double line1 = new Line2D.Double(secondLast.getFirstPoint()\n\t\t\t\t.getX(), secondLast.getFirstPoint().getY(), secondLast\n\t\t\t\t.getLastPoint().getX(), secondLast.getLastPoint().getY());\n\t\tArrayList<Point2D> intersect = StrokeFeatures.getIntersection(\n\t\t\t\tm_subStrokes.get(m_subStrokes.size() - 4), line1);\n\t\tif (intersect.size() <= 0)\n\t\t\tpassed = false;\n\t\tLine2D.Double line2 = new Line2D.Double(fourthLast.getPoints()\n\t\t\t\t.get(fourthLast.getNumPoints() / 2).getX(), fourthLast\n\t\t\t\t.getPoints().get(fourthLast.getNumPoints() / 2).getY(),\n\t\t\t\tfourthLast.getLastPoint().getX(), fourthLast.getLastPoint()\n\t\t\t\t\t\t.getY());\n\t\tdouble perpDiff = Math.abs(getSlope(line1) - (1.0 / getSlope(line2)));\n\t\tif (perpDiff > 5)\n\t\t\tpassed = false;\n\n\t\t// sometimes the last line of the arrow is broken incorrectly;\n\t\t// try combining last two strokes and repeat test\n\t\tif (!passed && m_subStrokes.size() >= 5) {\n\t\t\tpassed = true;\n\n\t\t\t// test 1: last stroke and third to last stroke should be same size\n\t\t\tdiff = Math.abs(lastLength + secondLastLength - fourthLastLength)\n\t\t\t\t\t/ (lastLength + secondLastLength + thirdLastLength);\n\t\t\tif (diff > 0.5)\n\t\t\t\tpassed = false;\n\n\t\t\t// test 2: two points at the \"head\" of the arrow should be close\n\t\t\tdis = last.getLastPoint().distance(fourthLast.getFirstPoint())\n\t\t\t\t\t/ m_features.getStrokeLength();\n\t\t\tif (dis > 0.25)\n\t\t\t\tpassed = false;\n\n\t\t\t// test 3: triangle arrow should be better fit than standard arrow\n\t\t\tif (m_standardPassed && dis > m_standardSum)\n\t\t\t\tpassed = false;\n\n\t\t\t// test 4: line connecting tips of arrow head should be close to\n\t\t\t// perpendicular to the line it would intersect\n\t\t\tline1 = new Line2D.Double(thirdLast.getFirstPoint().getX(),\n\t\t\t\t\tthirdLast.getFirstPoint().getY(), thirdLast.getLastPoint()\n\t\t\t\t\t\t\t.getX(), thirdLast.getLastPoint().getY());\n\t\t\tStroke fifthLast = m_subStrokes.get(m_subStrokes.size() - 5);\n\t\t\tintersect = StrokeFeatures.getIntersection(fifthLast, line1);\n\t\t\tif (intersect.size() <= 0)\n\t\t\t\tpassed = false;\n\t\t\tline2 = new Line2D.Double(fifthLast.getPoints()\n\t\t\t\t\t.get(fifthLast.getNumPoints() / 2).getX(), fifthLast\n\t\t\t\t\t.getPoints().get(fifthLast.getNumPoints() / 2).getY(),\n\t\t\t\t\tfifthLast.getLastPoint().getX(), fifthLast.getLastPoint()\n\t\t\t\t\t\t\t.getY());\n\t\t\tperpDiff = Math.abs(getSlope(line1) - (1.0 / getSlope(line2)));\n\t\t\tif (perpDiff > 5)\n\t\t\t\tpassed = false;\n\n\t\t}\n\n\t\t// if passed make a beautified standard arrow\n\t\tif (passed) {\n\n\t\t\tm_arrowType = Type.TRIANGLE;\n\n\t\t\t// TODO\n\t\t\t// create shape/beautified object\n\t\t\t/*\n\t\t\t * m_shape = new GeneralPath(); try { computeBeautified(); } catch\n\t\t\t * (Exception e) { log.error(\"Could not create shape object: \" +\n\t\t\t * e.getMessage()); }\n\t\t\t */\n\t\t}\n\n\t\tSystem.out.println(\"TriangleArrow: passed = \" + passed + \" diff = \"\n\t\t\t\t+ diff + \" dis = \" + dis + \" intersect = \" + intersect.size()\n\t\t\t\t+ \" num substrokes = \" + m_subStrokes.size() + \" perp diff = \"\n\t\t\t\t+ perpDiff);\n\t\tSystem.out.print(\"sizes: \");\n\t\tfor (int i = 0; i < m_subStrokes.size(); i++)\n\t\t\tSystem.out.print(m_subStrokes.get(i).getNumPoints() + \" \");\n\t\tSystem.out.println(\"\");\n\n\t\treturn passed;\n\t}", "public void isItATriangle(){\n Scanner firstSide = new Scanner(System.in);\n System.out.println(\"Please put in your first side length: \");\n int side1 = firstSide.nextInt();\n\n Scanner secondSide = new Scanner(System.in);\n System.out.println(\"Please put in your second side length: \");\n int side2 = secondSide.nextInt();\n\n Scanner thirdSide = new Scanner(System.in);\n System.out.println(\"Please put in your third side length: \");\n int side3 = thirdSide.nextInt();\n\n System.out.println(\"\\nNow calculating to see if you have a Triangle...\");\n System.out.println(\"Your first side value: \" + side1 + \"\\nYour second side value: \" + side2 + \"\\nYour third side value: \" + side3 + \"\\n\");\n\n //*****************************************************************\n /*\n *This is seeing is the sides are going to be enough for a Triangle\n *using Triangle Inequality Theorem\n */\n if(side1 + side2 > side3){\n if(side1 + side3 > side2){\n if(side2 + side3 > side1){\n System.out.println(\"Yes! This is a Triangle!\");\n\n if ((side1 == side2) && (side2 == side3) && (side3 == side1)){\n System.out.println(\"Oh hey! Your Triangle is an Equilaterall Triangle!\");\n }else{\n System.out.print(\"\");\n }\n\n if (((side1 == side2) && (side2 != side3)) || ((side2 == side3) && (side3 != side1)) || ((side3 == side1) && (side3 != side2))){\n System.out.println(\"Wow! Your triangle is Isosoleces!\");\n }else{\n System.out.print(\"\");\n }\n\n }else{\n System.out.println(\"No, Not a Triangle\");\n }\n }else{\n System.out.println(\"No, Not a Triangle\");\n }\n }else{\n System.out.println(\"No, Not a Triangle.\");\n return;\n }\n\n //checking to see if equilaterall\n\n }", "public int doubleRotation(AVLNode node, char side) {\n\t\tif (side == 'L') {\n\t\t\tthis.singleRotation(node, 'R');\n\t\t\tthis.singleRotation(node, 'L');\n\t\t} else {// side=='R'\n\t\t\tthis.singleRotation(node, 'L');\n\t\t\tthis.singleRotation(node, 'R');\n\t\t}\n\t\tnode.setHeight(node.getHeight() + 1);\n\t\tif (node.checkRoot()) {// we need to update root pointer\n\t\t\tthis.root = node;\n\t\t}\n\t\treturn 5;\n\t}", "public static void main(String[] args) {\n\n short angle1 = 0;\n short angle2 = 180;\n short angle3 = 0;\n\n int sumOfAngles = angle1 + angle2 + angle3;\n\n boolean validTriangle = sumOfAngles == 180;\n\n if (validTriangle){\n System.out.println(\"the shape is a triangle\");\n }\n if(!validTriangle){\n System.out.println(\"the shape is not valid\");\n }\n\n\n\n\n\n }", "public boolean isValiddiagonal(Square curB, Square preB) {\n boolean value = true;\n int xdistance = curB.getRow1() - preB.getRow1();\n int ydistance = curB.getCol1() - preB.getCol1();\n int i1;\n int j1 = 0;\n \n if ((ydistance != 0) && (xdistance != 0)) {\n if ((xdistance > 0) && (ydistance > 0)) { //move right down\n for (i1 = preB.getCol1(); i1 < curB.getCol1(); i1 += 1) {\n j1++;\n if (Board.squares[preB.getRow1() + j1][preB.getCol1() + j1].isOccupied()) {\n value = false;\n }\n }\n } else if ((xdistance > 0) && (ydistance < 0)) { //move left down\n for (i1 = curB.getCol1(); i1 < preB.getCol1(); i1 += 1) {\n j1++;\n if (Board.squares[preB.getRow1() + j1][preB.getCol1() - j1].isOccupied()) {\n value = false;\n System.out.println(value);\n }\n }\n } else if ((xdistance < 0) && (ydistance > 0)) { //move right up\n for (i1 = preB.getCol1(); i1 < curB.getCol1(); i1 += 1) {\n j1++;\n if (Board.squares[preB.getRow1() - j1][preB.getCol1() + j1].isOccupied()) {\n value = false;\n }\n }\n } else if ((xdistance < 0) && (ydistance < 0)) {\n for (i1 = curB.getCol1(); i1 < preB.getCol1(); i1 += 1) {\n j1++;\n if (Board.squares[preB.getRow1() - j1][preB.getCol1() - j1].isOccupied()) {\n value = false;\n }\n }\n } \n }\n return value;\n }", "Triangle(){\n side1 = 1.0;\n side2 = 1.0;\n side3 = 1.0;\n }", "public int delRecTriOne(AVLNode node, char side) {\n\t\tif (side == 'L') {\n\t\t\tint rightEdge = node.right.getHeight() - node.right.getRight().getHeight();\n\t\t\tint leftEdge = node.right.getHeight() - node.right.getLeft().getHeight();\n\t\t\tif (rightEdge == leftEdge && rightEdge == 1) {// case 2\\\n\t\t\t\tAVLNode rightChild = (AVLNode) node.right;\n\t\t\t\tint numOp = this.singleRotation(rightChild, 'R');\n\t\t\t\tnode.parent.setHeight(node.parent.getHeight() + 1);\n\t\t\t\tnode.setSize();\n\t\t\t\tnode.updateSize();\n\t\t\t\treturn numOp + 1;\n\t\t\t}\n\t\t\tif (leftEdge == 2) {// case 3\n\t\t\t\tAVLNode rightChild = (AVLNode) node.right;\n\t\t\t\tint numOp = this.singleRotation(rightChild, 'R');\n\t\t\t\tnode.setHeight(node.getHeight() - 1); // demote 'z'\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tparent.setSize();\n\t\t\t\treturn numOp + this.delRecTwos(parent);\n\t\t\t} else {// leftEdge==1, case 4\n\t\t\t\tAVLNode rightsLeftChild = (AVLNode) node.getRight().getLeft();\n\t\t\t\tint numOp = this.doubleRotation(rightsLeftChild, 'R');\n\t\t\t\tnode.setHeight(node.getHeight() - 1); // demote 'z'\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tnode.setSize();\n\t\t\t\tparent.getRight().setSize();\n\t\t\t\tparent.setSize();\n\t\t\t\treturn numOp + this.delRecTwos(parent);\n\t\t\t}\n\n\t\t}\n\n\t\telse { // side='R'\n\t\t\tint leftEdge = node.left.getHeight() - node.left.getLeft().getHeight();\n\t\t\tint rightEdge = node.left.getHeight() - node.left.getRight().getHeight();\n\t\t\tif (rightEdge == leftEdge && rightEdge == 1) {// case 2\\\n\t\t\t\tAVLNode leftChild = (AVLNode) node.left;\n\t\t\t\tint numOp = this.singleRotation(leftChild, 'L');\n\t\t\t\tnode.parent.setHeight(node.parent.getHeight() + 1);\n\t\t\t\tnode.setSize();\n\t\t\t\tnode.updateSize();\n\t\t\t\treturn numOp + 1;\n\t\t\t}\n\t\t\tif (rightEdge == 2) {// case 3\n\t\t\t\tAVLNode leftChild = (AVLNode) node.left;\n\t\t\t\tint numOp = this.singleRotation(leftChild, 'L');\n\t\t\t\tnode.setHeight(node.getHeight() - 1); // demote 'z'\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tparent.setSize();\n\t\t\t\treturn numOp + this.delRecTwos(parent);\n\t\t\t} else {// rightEdge==1, leftEdge==2, case 4\n\t\t\t\tAVLNode leftsRightChild = (AVLNode) node.getLeft().getRight();\n\t\t\t\tint numOp = this.doubleRotation(leftsRightChild, 'L');\n\t\t\t\tnode.setHeight(node.getHeight() - 1); // demote 'z'\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tnode.setSize();\n\t\t\t\tparent.getLeft().setSize();\n\t\t\t\tparent.setSize();\n\t\t\t\treturn numOp + this.delRecTwos(parent);\n\t\t\t}\n\t\t}\n\t}", "public void triangulo() {\n fill(0);\n stroke(255);\n strokeWeight(5);\n triangle(width/2, 50, height+100, 650, 350, 650);\n //(width/2, height-100, 350, 150, 900, 150);\n }", "public int case1(AVLNode node, int bottomLeftEdge) {\n\t\tchar sideOfNode = node.parentSide();\n\t\tif (sideOfNode == 'N') {\n\t\t\tnode.setSize();\n\t\t\treturn 0;\n\t\t}\n\t\tif (node.getParent().getHeight() - node.getHeight() == 1) {\n\t\t\tnode.setSize();\n\t\t\tnode.updateSize();\n\t\t\treturn 0;\n\t\t}\n\t\tif (sideOfNode == 'L') {\n\t\t\tint rightEdge = node.parent.getHeight() - node.parent.getRight().getHeight();\n\t\t\tif (rightEdge == 1) {\n\t\t\t\tnode.parent.setHeight(node.parent.getHeight() + 1);\n\t\t\t\tnode.parent.setSize();\n\t\t\t\tbottomLeftEdge = 1;\n\t\t\t\treturn 1 + this.case1((AVLNode) node.parent, bottomLeftEdge);\n\t\t\t} else { // rightEdge == 2\n\t\t\t\tif (bottomLeftEdge == 1) { // case 2 - single rotation\n\t\t\t\t\tint opNum = this.singleRotation(node, sideOfNode);\n\t\t\t\t\tnode.updateSize();\n\t\t\t\t\treturn opNum;\n\t\t\t\t} else { // B.L.Edge == 2, case 3, double rotation\n\t\t\t\t\tint opNum = this.doubleRotation((AVLNode) node.getRight(), sideOfNode);\n\t\t\t\t\tnode.updateSize();\n\t\t\t\t\treturn opNum;\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // sideOfNode == 'R'\n\t\t\tint leftEdge = node.parent.getHeight() - node.parent.getLeft().getHeight();\n\t\t\tif (leftEdge == 1) {\n\t\t\t\tnode.parent.setHeight(node.parent.getHeight() + 1);\n\t\t\t\tnode.parent.setSize();\n\t\t\t\tbottomLeftEdge = 2;\n\t\t\t\treturn 1 + this.case1((AVLNode) node.parent, bottomLeftEdge);\n\t\t\t} else { // leftEdge == 2\n\t\t\t\tif (bottomLeftEdge == 2) { // case 2 - single rotation\n\t\t\t\t\tint opNum = this.singleRotation(node, sideOfNode);\n\t\t\t\t\tnode.updateSize();\n\t\t\t\t\treturn opNum;\n\t\t\t\t} else { // B.L.Edge == 1, case 3, double rotation\n\t\t\t\t\tint opNum = this.doubleRotation((AVLNode) node.getLeft(), sideOfNode);\n\t\t\t\t\tnode.updateSize();\n\t\t\t\t\treturn opNum;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "void orientation(double xOrientation, double yOrientation, double zOrientation);", "public boolean canReorderDoubled(int[] A) {\n Arrays.sort(A);\n\n HashMap<Integer, Integer> map = new HashMap();\n for (Integer num : A) map.put(num, map.getOrDefault(num, 0) + 1);\n\n for (int i = 0; i < A.length; i++) {\n if (!map.containsKey(A[i])) continue;\n Integer counter1 = map.get(A[i]);\n Integer lookup = A[i] > 0 ? 2 * A[i] : A[i] / 2;\n Integer counter2 = map.get(lookup);\n if (counter1 != null && counter2 != null && counter1 > 0 && counter2 > 0) {\n if (counter1 == 1) {\n map.remove(A[i]);\n } else {\n map.put(A[i], counter1 - 1);\n }\n\n if (counter2 == 1) {\n map.remove(lookup);\n } else {\n map.put(lookup, counter2 - 1);\n }\n\n } else {\n return false;\n }\n }\n return map.size() == 0;\n }", "public static boolean check_scalene_triangle(int [] side) {\n\t\treturn !check_isosceles_tri(side) && !check_equ_tri(side) && isTri(side);\n\t}", "public TriangleBumper(Double x,Double y,Double orientation,List<Gadget>triggeredGadgets){\n this.x = x;\n this.y = y;\n this.collideCirc = new ArrayList<Circle>(); //corner that ball will collide with\n this.collideLine = new ArrayList<LineSegment>(); //side that ball will collide with\n this.orientation = orientation;\n this.triggeredGadgets = new ArrayList<>();\n for (Gadget gadget : triggeredGadgets){\n this.triggeredGadgets.add(gadget);\n }\n //circle at each corner\n //line segment at each side\n if(this.orientation == 0.0){\n this.circles = Arrays.asList(new Circle(x,y,0.0), new Circle(x, y+1, 0.0), new Circle(x+1, y, 0.0));\n this.lines = Arrays.asList(new LineSegment(x+1, y, x, y+1), new LineSegment(x, y, x, y+1), new LineSegment(x,y, x+1, y));\n }else if (this.orientation == 90.0){\n this.circles = Arrays.asList(new Circle(x,y,0.0), new Circle(x+1, y, 0.0), new Circle(x+1, y+1,0.0));\n this.lines = Arrays.asList(new LineSegment(x, y, x+1, y), new LineSegment(x+1, y, x+1, y+1), new LineSegment(x,y, x+1, y+1));\n }else if (this.orientation == 180.0){\n this.circles = Arrays.asList(new Circle(x,y+1, 0.0), new Circle(x+1, y, 0.0), new Circle(x+1, y+1, 0.0));\n this.lines = Arrays.asList(new LineSegment(x, y+1, x+1, y), new LineSegment(x+1, y, x+1, y+1), new LineSegment(x+1, y+1, x, y+1));\n }else{\n this.circles = Arrays.asList(new Circle(x,y,0.0), new Circle(x, y+1, 0.0), new Circle(x+1, y+1, 0.0));\n this.lines = Arrays.asList(new LineSegment(x,y,x, y+1), new LineSegment(x,y+1, x+1, y+1), new LineSegment(x+1, y+1, x, y));\n }\n checkRep();\n\n }", "private static boolean isAngleOK(double[] v, double[] w, double bend) {\n\t\t// |v| * |w| * sin(alpha) = |det(v, w)|\n\t\t// cos(alpha) = v . w / (|v| * |w|)\n\t\t// tan(alpha) = sin(alpha) / cos(alpha)\n\t\t// tan(alpha) = |det(v, w)| / v . w\n\n\t\t// small angle: tan(alpha) < MAX_BEND\n\t\t// |det(v, w)| / v . w < MAX_BEND\n\t\t// |det(v, w)| < MAX_BEND * (v . w)\n\n\t\tdouble innerProduct = 0;\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tinnerProduct += v[i] * w[i];\n\t\t}\n\t\tif (CurveSegmentPlotter.isUndefined(innerProduct)) {\n\t\t\treturn true;\n\t\t} else if (innerProduct <= 0) {\n\t\t\t// angle >= 90 degrees\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// angle < 90 degrees\n\t\t\t// small angle: |det(v, w)| < MAX_BEND * (v . w)\n\t\t\tdouble det;\n\t\t\tif (v.length < 3) {\n\t\t\t\tdet = Math.abs(v[0] * w[1] - v[1] * w[0]);\n\t\t\t} else {\n\t\t\t\tdouble d1 = v[0] * w[1] - v[1] * w[0];\n\t\t\t\tdouble d2 = v[1] * w[2] - v[2] * w[1];\n\t\t\t\tdouble d3 = v[2] * w[0] - v[0] * w[2];\n\t\t\t\tdet = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);\n\t\t\t}\n\t\t\treturn det < bend * innerProduct;\n\t\t}\n\t}", "public double\nangleInXYPlane()\n{\n\tBVector2d transPt = new BVector2d(\n\t\tthis.getP2().getX() - this.getP1().getX(),\n\t\tthis.getP2().getY() - this.getP1().getY());\n\t\n\t// debug(\"transPt: \" + transPt);\n\n\tdouble angle = MathDefines.RadToDeg * new Vector2d(1.0, 0.0).angle(transPt);\n\tif (transPt.getY() < 0.0)\n\t{\n\t\t// debug(\"ang0: \" + (360.0 - angle));\n\t\treturn(360.0 - angle);\n\t}\n\t// debug(\"ang1: \" + angle);\n\treturn(angle);\n}", "private void ruleR2(Node a, Node b, Node c, Graph graph) {\n if (!graph.isAdjacentTo(a, c)) {\n return;\n }\n\n if (graph.getEndpoint(b, a) == Endpoint.TAIL && graph.getEndpoint(a, b) == Endpoint.ARROW\n && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, a, c)) {\n return;\n }\n\n graph.setEndpoint(a, c, Endpoint.ARROW);\n } else if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.TAIL\n && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE\n ) {\n if (!isArrowpointAllowed(graph, a, c)) {\n return;\n }\n\n graph.setEndpoint(a, c, Endpoint.ARROW);\n }\n }", "Triangle (double side1, double side2, double side3){\n this.side1 = side1;\n this.side2 = side2;\n this.side3 = side3;\n }", "public void invertOrientation() {\n\t\tPoint3D temp = getPoint(2);\n\t\tsetPoint(2, getPoint(1));\n\t\tsetPoint(1, temp);\n\n\t\tTriangleElt3D temp2 = getNeighbour(2);\n\t\tsetNeighbour(2, getNeighbour(1));\n\t\tsetNeighbour(1, temp2);\n\t\tif (this.getNetComponent() != null)\n\t\t\tthis.getNetComponent().setOriented(false);\n\t}", "public boolean isRight () {\r\n\t\tif (((Math.pow(startSide1, 2) + Math.pow(startSide2, 2) == Math.pow(startSide3, 2)) || \r\n\t\t\t(Math.pow(startSide2, 2) + Math.pow(startSide3, 2) == Math.pow(startSide1, 2)) ||\r\n\t\t\t(Math.pow(startSide3, 2) + Math.pow(startSide1, 2) == Math.pow(startSide2, 2)))\r\n\t\t\t&& isTriangle () == true && isEquilateral () == false) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse return false;\r\n\t}", "private void doubleRotateRightDel (WAVLNode z) {\n\t WAVLNode a = z.left.right;\r\n\t WAVLNode y = z.left;\r\n\t WAVLNode c = z.left.right.right;\r\n\t WAVLNode d = z.left.right.left;\r\n\t if(z.parent!=null) {\r\n\t\t if(parentside(z.parent, z).equals(\"left\")) {\r\n\t\t\t z.parent.left=a;\r\n\r\n\t }\r\n\t else {\r\n\t\t\t z.parent.right=a;\r\n\r\n\t }\r\n\t\t \r\n\t }\r\n\t else {\r\n\t\t this.root=a;\r\n\t }\r\n\t a.right=z;\r\n\t a.left=y;\r\n\t a.rank=a.rank+2;\r\n\t a.parent=z.parent;\r\n\t y.parent=a;\r\n\t y.right=d;\r\n\t y.rank--;\r\n\t z.parent=a;\r\n\t z.left=c;\r\n\t z.rank=z.rank-2;\r\n\r\n\t c.parent=z;\r\n\t d.parent=y;\r\n\t z.sizen=z.right.sizen+z.left.sizen+1;\r\n\t y.sizen=y.right.sizen+y.left.sizen+1;\r\n\t a.sizen=a.right.sizen+a.left.sizen+1;\r\n }", "protected abstract Triangle makeTriangle(final Vector3d edge1, final Vector3d edge2,\n\t\t\tfinal Vector3d edge3);", "AngleGreater createAngleGreater();", "private DirectionTestResult getDirection() throws SimplexException {\r\n switch(pointCount) {\r\n case 1:\r\n return new DirectionTestResult(a.negate(new Vector2f()));\r\n case 2:\r\n Vector2f ab = b.sub(a);\r\n Vector2f perpAB = new Vector2f(-ab.y,ab.x);\r\n \r\n // check the perpendicular points opposite to vector A\r\n // i.e. towards the origin\r\n // if not, return the negated perpendicular and swap\r\n // points A and B to maintain clockwise rotation.\r\n if (perpAB.dot(a) < 0) {\r\n return new DirectionTestResult(perpAB);\r\n } else {\r\n Vector2f t = a;\r\n a = b;\r\n b = t;\r\n return new DirectionTestResult(perpAB.negate());\r\n }\r\n case 3:\r\n // first check line AC just like case 2\r\n Vector2f ac = c.sub(a);\r\n Vector2f perpAC = new Vector2f(-ac.y,ac.x);\r\n \r\n if (perpAC.dot(a) < 0) {\r\n b = c;\r\n c = null;\r\n pointCount = 2;\r\n return new DirectionTestResult(perpAC);\r\n }\r\n \r\n // now check line CB just like case 2\r\n Vector2f cb = b.sub(c);\r\n Vector2f perpCB = new Vector2f(-cb.y, cb.x);\r\n \r\n if (perpCB.dot(c) < 0) {\r\n a = c;\r\n c = null;\r\n pointCount = 2;\r\n return new DirectionTestResult(perpCB);\r\n }\r\n \r\n // if both checks failed the origin must be inside the\r\n // simplex which means there is a collision so return\r\n // a true directionTestResult\r\n \r\n return new DirectionTestResult();\r\n default:\r\n throw new SimplexException(\"pointCount outside acceptable range\");\r\n }\r\n }", "public void calculateTriangle(float posX, float posY, float rotation)\n {\n\n rotation = (int)rotation;\n\n float nearRotation = rotation;\n nearRotation = (float)(90 * (Math.round(nearRotation / 90)));\n\n points[0]=posX+10/ PlayScreen.PPM/SCALE; points[1]=posY+10/ PlayScreen.PPM/SCALE;\n points[2]=posX+118/ PlayScreen.PPM/SCALE; points[3]=posY+10/ PlayScreen.PPM/SCALE;\n points[4]=posX+10/ PlayScreen.PPM/SCALE; points[5]=posY+118/ PlayScreen.PPM/SCALE;\n\n if(nearRotation > 270f || nearRotation == 0f)\n {\n acceptedDirs = \"dl\";\n }\n else if(nearRotation > 0f && nearRotation <= 90f)\n {\n acceptedDirs = \"dr\";\n\n }\n else if(nearRotation > 90f && nearRotation <=180f)\n {\n acceptedDirs = \"ur\";\n }\n else if(nearRotation > 180f && nearRotation <= 270f)\n {\n acceptedDirs = \"ul\";\n }\n\n\n poly.setVertices(points);\n poly.setOrigin(mirror.getX() + mirror.getWidth()/2, mirror.getY() + mirror.getHeight()/2);\n poly.setRotation(mirror.getRotation());\n shape.set(poly.getTransformedVertices());\n fdef.shape = shape;\n fdef.density =1f;\n\n int fixtureCount = B2body.getFixtureList().size;\n for(int i=0;i<fixtureCount;i++)\n {\n B2body.destroyFixture(B2body.getFixtureList().get(i));\n }\n B2body.createFixture(fdef).setUserData(getUserData());\n }", "static int surfaceArea(int[][] A) {\n int rowLength = A.length;\n int colLength = A[0].length;\n int left = 0;\n int right = 0;\n int front = 0;\n int back = 0;\n int up = colLength * rowLength;\n int down = colLength * rowLength;\n int result = 0;\n\n for(int i = 0; i < rowLength; i++) {\n for(int j = 0; j < colLength; j ++) {\n if(j == 0){\n left += A[i][j];\n }\n else {\n if(A[i][j] > A[i][j - 1]) left += A[i][j] - A[i][j - 1];\n }\n }\n }\n\n for(int i = 0; i < colLength; i++) {\n for(int j = 0; j < rowLength; j ++) {\n if(j == 0){\n back += A[j][i];\n }\n else {\n if(A[j][i] > A[j - 1][i]) back += A[j][i] - A[j - 1][i];\n }\n }\n }\n\n for(int i = rowLength - 1; i >= 0; i--) {\n for(int j = colLength - 1; j >= 0; j--) {\n if(j == colLength - 1) {\n right += A[i][j];\n }\n else {\n if(A[i][j] > A[i][j + 1]) left += A[i][j] - A[i][j + 1];\n }\n\n }\n }\n\n for(int i = colLength - 1; i >= 0; i--) {\n for(int j = rowLength - 1; j >= 0; j--) {\n if(j == rowLength - 1) {\n up += A[j][i];\n }\n else {\n if(A[j][i] > A[j + 1][i]) up += A[j][i] - A[j + 1][i];\n }\n\n }\n }\n\n result = right + left + up + down + front + back;\n\n return result;\n\n }", "void checkTriangleType() {\n\n int x = triangle.x;\n int y = triangle.y;\n int z = triangle.z;\n\n if (x <= 0 || y <= 0 || z <= 0) triangle.triangleType = TriangleType.INVALID; // INVALID\n else if (x >= y + z || z >= x + y || y >= x + z) triangle.triangleType = TriangleType.INVALID; // INVALID\n else if (x == y && y == z) triangle.triangleType = TriangleType.EQUILATERAL; // EQUILATERAL Case\n else if (x == y || y == z || x == z) triangle.triangleType = TriangleType.ISOSCELES; // ISOSCELES Case\n else triangle.triangleType = TriangleType.SCALENE; // SCALENE Case\n }", "public double getSideB()\r\n\t{\r\n\t\treturn this.sideB;\r\n\t}", "private boolean check3Vertical(int i, int j) {\n if(stateArray[i][j] == stateArray[i+1][j] && stateArray[i][j] == stateArray[i+2][j]) {\n return true;\n }\n return false;\n }", "@Override\n public int test(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) {\n // For A to contain B (where each loop interior is defined to be its left\n // side), the CCW edge order around ab1 must be a2 b2 b0 a0. We split\n // this test into two parts that test three vertices each.\n return orderedCCW(a2, b2, b0, ab1) && orderedCCW(b0, a0, a2, ab1) ? 1 : 0;\n }", "private int bresA(int a, int b, int d) { //A as in Axis\n int add = 0;\n err += b;\n if(2*err >= a) {\n add = d;\n err -= a;\n }\n return add;\n }", "private static int orientation(Coord p, Coord r, Coord q) \n { \n // See https://www.geeksforgeeks.org/orientation-3-ordered-points/ \n // for details of below formula. \n int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); \n \n if (val == 0) return 0; // colinear \n \n return (val > 0)? 1: 2; // clock or counterclock wise \n }", "public boolean canReorderDoubled4(int[] A) {\n PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.comparingInt(Math::abs));\n for (int a : A) {\n pq.offer(a);\n }\n while (!pq.isEmpty()) {\n int num = pq.poll();\n if (!pq.remove(num * 2)) { return false; }\n }\n return true;\n }", "@Test\n public void testCondition5()\n {\n Double[] coordinates = null;\n Double before[] = _renderable.orientation();\n _renderable.orientation(coordinates);\n Double after[] = _renderable.orientation();\n assertEquals(\"orientation array changed\", before[0], after[0], 0.01);\n assertEquals(\"orientation array changed\", before[1], after[1], 0.01);\n assertEquals(\"orientation array changed\", before[2], after[2], 0.01);\n }", "public int singleRotation(AVLNode node, char side) {\n\t\tif (side == 'L') {\n\t\t\tchar pSide = ((AVLNode) node.getParent()).parentSide();\n\t\t\tnode.parent.setLeft(node.right);\n\t\t\tnode.right.setParent(node.parent);\n\t\t\tnode.setRight(node.parent);\n\t\t\tnode.setParent(node.getRight().getParent());\n\t\t\tnode.right.setParent(node);\n\t\t\tif (pSide == 'L') {\n\t\t\t\tnode.getParent().setLeft(node);\n\t\t\t} else if (pSide == 'R') {\n\t\t\t\tnode.getParent().setRight(node);\n\t\t\t}\n\t\t\tnode.right.setHeight(node.right.getHeight() - 1);\n\t\t\tif (node.checkRoot()) {// we need to update root pointer\n\t\t\t\tthis.root = node;\n\t\t\t}\n\t\t\tnode.right.setSize();\n\t\t\tnode.setSize();\n\t\t\treturn 2;\n\t\t}\n\n\t\telse {// side == 'R'\n\t\t\tchar pSide = ((AVLNode) node.getParent()).parentSide();\n\t\t\tnode.parent.setRight(node.left);\n\t\t\tnode.left.setParent(node.parent);\n\t\t\tnode.setLeft(node.parent);\n\t\t\tnode.setParent(node.getLeft().getParent());\n\t\t\tnode.left.setParent(node);\n\t\t\tif (pSide == 'L') {\n\t\t\t\tnode.getParent().setLeft(node);\n\t\t\t} else if (pSide == 'R') {\n\t\t\t\tnode.getParent().setRight(node);\n\t\t\t}\n\t\t\tnode.left.setHeight(node.left.getHeight() - 1);\n\t\t\tif (node.checkRoot()) {// we need to update root pointer\n\t\t\t\tthis.root = node;\n\t\t\t}\n\t\t\tnode.left.setSize();\n\t\t\tnode.setSize();\n\t\t\treturn 2;\n\t\t}\n\t}", "public boolean validate() {\n double ab = lengthSide(a, b);\n double ac = lengthSide(a, c);\n double bc = lengthSide(b, c);\n\n return ((ab < ac + bc)\n && (ac < ab + bc)\n && (bc < ab + ac));\n }", "private void rotate() {\n byte tmp = topEdge;\n topEdge = leftEdge;\n leftEdge = botEdge;\n botEdge = rightEdge;\n rightEdge = tmp;\n tmp = reversedTopEdge;\n reversedTopEdge = reversedLeftEdge;\n reversedLeftEdge = reversedBotEdge;\n reversedBotEdge = reversedRightEdge;\n reversedRightEdge = tmp;\n tmp = ltCorner;\n ltCorner = lbCorner;\n lbCorner = rbCorner;\n rbCorner = rtCorner;\n rtCorner = tmp;\n\n }", "public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int side1 = scanner.nextInt();\n int side2 = scanner.nextInt();\n int side3 = scanner.nextInt();\n boolean isTriangle = (side1 + side2 > side3) && (side1 + side3 > side2) && (side2 + side3 > side1);\n if (isTriangle) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n }", "private boolean checkSecondaryDiagonal() {\n int diagonalSum = 0;\n for (int i = 0; i < dimensions; i++) {\n diagonalSum += square[(dimensions - 1) * i + dimensions - 1];\n }\n\n return diagonalSum == magicConst;\n }", "@Test\n public void testCondition4()\n {\n Double[] angles = {75.0, 75.0, 71.0};\n _renderable.orientation(angles);\n Double testVal[] = _renderable.orientation();\n assertEquals(\"x angle did not get set,\", angles[0], testVal[0], 2);\n assertEquals(\"y angle did not get set,\", angles[1], testVal[1], 2);\n assertEquals(\"z angle did not get set,\", angles[2], testVal[2], 2);\n }", "public abstract double getDiagonal();", "private double triangleBase() {\n return cellWidth() / BASE_WIDTH;\n }", "private Node<T> doubleWithRight(Node<T> a) {\n a.setRight(rotateWithLeft(a.getRight()));\n hAndBF(a.getRight());\n return rotateWithRight(a);\n }", "@Test\n\tpublic void testGetInnerAngle() {\n\t\tdouble ang1 = 168.7810;\n\t\tdouble ang2 = 64.0945;\n\t\tdouble ang3 = 268.5473;\n\t\t\n\t\t// Set the angles for testing\n\t\tTriangulate test = new Triangulate();\n\t\ttest.setAngles(ang1, ang2, ang3);\n\t\tdouble err = 1e-4; \n\t\t\n\t\tdouble[] innerAng = test.getInnerAngle();\n\t\tdouble actual1 = Math.toRadians(104.6865);\n\t\tdouble actual2 = Math.toRadians(155.5472);\n\t\tdouble actual3 = Math.toRadians(99.7663);\n\t\t\n\t\tdouble sum = 0;\n\t\tfor(int i = 0; i < innerAng.length; i++) sum += innerAng[i];\n\t\t\n\t\tassertEquals(actual1, innerAng[0], err);\n\t\tassertEquals(actual2, innerAng[1], err);\n\t\tassertEquals(actual3, innerAng[2], err);\n\t\tassertEquals(2*Math.PI, sum, err);\n\t\t\n\t}", "private void normalizeOrientation() {\n\t\twhile (this.orientation >= 2 * Math.PI) {\n\t\t\torientation -= 2 * Math.PI;\n\t\t}\n\t\twhile (this.orientation < 0) {\n\t\t\torientation += 2 * Math.PI;\n\t\t}\n\t}", "public boolean istrianglevalid() {\n //if all of the sides are valid, then return true, else return false\n if (sideA > 0 && sideB > 0 && sideC > 0) {\n return true;\n } else {\n return false;\n }\n }", "public static void main(String[] args) {\n\t\t\n\t\tint edgeA = 60;\n\t\tint edgeB = 50;\n\t\tint edgeC = 45;\n\n\t\tboolean triangle = ((edgeA + edgeB) > edgeC && (edgeA + edgeC) > edgeB && (edgeB + edgeC) > edgeA);\n\t\t/*\n\t\t * To create a triangle, main condition is that sum of every two edges is\n\t\t * greater than third edge\n\t\t */\n\n\t\tSystem.out.println(\"Triangle? \" + triangle);\n\t}", "public abstract double getOrientation();", "boolean isRight() {\r\n\t\tint maxlength;\r\n\t\tmaxlength = Math.max(Math.max(side1, side2), side3);\r\n\t\treturn (maxlength * maxlength == (side1 * side1) + (side2 * side2) + (side3 * side3) - (maxlength * maxlength));\r\n\t}", "private boolean isFlipped(){\n switch(this.orientation){\n case \"0\": case\"1\": case\"2\": case\"3\": return false;\n case \"4\": case\"5\": case\"6\": case\"7\": return true;\n default: return false;\n }\n }", "private boolean twoHalfOpt(int i, int j) {\n\t\tint li = (i == 0) ? 0 : this.route.get(i - 1);\n\t\tint ri = (i == this.length() - 1) ? 0 : this.route.get(i + 1);\n\t\tint rj = (j == this.length() - 1) ? 0 : this.route.get(j + 1);\n\n\t\tint curtime = dist(li, route.get(i)) + dist(route.get(i), ri) + dist(route.get(j), rj);\n\t\tint nxttime = dist(li, ri) + dist(route.get(j), route.get(i)) + dist(route.get(i), rj);\n\n\t\tif (nxttime >= curtime)\n\t\t\treturn false;\n\n\t\tif (i < j) {\n\t\t\t// cyclicLeftRotate(i, ..., j)\n\t\t\tint t = route.get(i);\n\t\t\tdo {\n\t\t\t\troute.set(i, route.get(i + 1));\n\t\t\t} while (++i < j);\n\t\t\troute.set(j, t);\n\t\t} else {\n\t\t\t// cyclicRightRotate(j+1, ..., i)\n\t\t\tint t = route.get(i);\n\t\t\tdo {\n\t\t\t\troute.set(i, route.get(i - 1));\n\t\t\t} while (--i > j);\n\t\t\troute.set(j + 1, t);\n\t\t}\n\t\tthis.time += nxttime - curtime; // < 0.\n\t\treturn true;\n\t}", "private boolean calculateMaximumLengthBitonicSubarray() {\n\n boolean found = false; // does any BSA found\n\n boolean directionChange = false; //does direction numberOfWays increase to decrease\n\n int countOfChange = 0;\n\n int i = 0;\n directionChange = false;\n int start = i;\n i++;\n for (; i < input.length; i++) {\n if (countOfChange != 0 && countOfChange % 2 == 0) {\n if (this.length < (i - 2 - start + 1)) {\n this.i = start;\n this.j = i - 2;\n this.length = this.j - this.i + 1;\n }\n start = i - 2;\n countOfChange = 0;\n }\n\n if (input[i] > input[i - 1]) {\n if (directionChange == true) {\n countOfChange++;\n }\n directionChange = false;\n }\n if (input[i] < input[i - 1]) {\n if (directionChange == false) {\n countOfChange++;\n }\n directionChange = true;\n }\n\n\n }\n\n if (directionChange == true) {\n if (this.length < (i - 1 - start + 1)) {\n this.i = start;\n this.j = i - 1;\n this.length = this.j - this.i + 1;\n }\n }\n return directionChange;\n }", "private void doubleRotationRL(BinaryNode node) {\n BinaryNode temp = min(node.right);\n if (node == root) {\n root = temp;\n if (temp.parent.right == temp) { //temp could have a child on the right\n temp.parent.right = temp.right;\n if (temp.right != null) temp.right.parent = temp.parent;\n }\n else {\n temp.parent.left = temp.right;\n if (temp.right != null) temp.right.parent = temp.parent;\n }\n root.parent = null;\n root.left = node;\n root.right = node.right;\n if(node.right != null) node.right.parent = root;\n node.parent = root;\n node.right = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = temp;\n } else {\n node.parent.left = temp;\n }\n temp.parent = node.parent;\n temp.right = node.right;\n if(node.right != null) node.right.parent = temp;\n temp.left = node;\n node.parent = temp;\n node.right = null;\n }\n }", "public static boolean convertToBary(\n double[] bary,\n double[] x0,\n double[] x1,\n double[] x2,\n double[] x) {\n //TODO: use exception handling for degenerate situations\n //TODO: the return type should be void or double which should give\n // distance from plane\n\n int i0 = 0, i1 = 1, i2 = 2;\n\n double det;\n\n /* find two linear independent rows */\n for (;;) {\n det =\n x1[i0] * x2[i1]\n - x1[i1] * x2[i0]\n - (x0[i0] * x2[i1] - x0[i1] * x2[i0])\n + x0[i0] * x1[i1]\n - x0[i1] * x1[i0];\n\n if (Math.abs(det) > EPS)\n break;\n\n if (i1 == 1) {\n i1 = 2;\n i2 = 1;\n } else if (i0 == 0) {\n i0 = 1;\n i2 = 0;\n } else {\n \n LoggingSystem.getLogger(Hit.class).fine(\"mBaryInElementConvertFromVec3: triangle degenerated?\");\n // \n // fprintf(stderr, \"gmBaryInElementConvertFromVec3: triangle\n // degenerated?\\n\");\n // fprintf(stderr, \"\\tcan't compute barycentric\n // coordinates.\\n\");\n // fprintf(stderr, \"vertex0: (%f, %f, %f)\\n\", x0[0], x0[1],\n // x0[2]);\n // fprintf(stderr, \"vertex1: (%f, %f, %f)\\n\", x1[0], x1[1],\n // x1[2]);\n // fprintf(stderr, \"vertex2: (%f, %f, %f)\\n\", x2[0], x2[1],\n // x2[2]);\n // fprintf(stderr, \"point : (%f, %f, %f)\\n\", x[0], x[1], x[2]);\n // fflush(stderr);\n\n return false;\n }\n }\n\n /* calculate barycentric coordinates */\n bary[0] =\n (x1[i0] * x2[i1]- x1[i1] * x2[i0]\n - (x[i0] * x2[i1] - x[i1] * x2[i0])\n + x[i0] * x1[i1]- x[i1] * x1[i0])\n / det;\n bary[1] =\n (x[i0] * x2[i1]\n - x[i1] * x2[i0]\n - (x0[i0] * x2[i1] - x0[i1] * x2[i0])\n + x0[i0] * x[i1]\n - x0[i1] * x[i0])\n / det;\n bary[2] = 1.0 - bary[0] - bary[1];\n\n /* test third row */\n if (Math\n .abs(x0[i2] * bary[0] + x1[i2] * bary[1] + x2[i2] * bary[2] - x[i2])\n > 1.e-3) {\n \t // this is not an error and should not in my opinion be set to info level -gunn 18.5.6\n LoggingSystem.getLogger(Hit.class).fine(\"gmBaryInElementConvertFromVec3: test for third row failed.\"\n +Math.abs(x0[i2] * bary[0] + x1[i2] * bary[1] + x2[i2] * bary[2] - x[i2])\n );\n\n return false;\n }\n\n correct(bary);\n\n return true;\n }", "@Override\n public int test(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) {\n // For A not to intersect B (where each loop interior is defined to be\n // its left side), the CCW edge order around ab1 must be a0 b2 b0 a2.\n // Note that it's important to write these conditions as negatives\n // (!OrderedCCW(a,b,c,o) rather than Ordered(c,b,a,o)) to get correct\n // results when two vertices are the same.\n return (orderedCCW(a0, b2, b0, ab1) && orderedCCW(b0, a2, a0, ab1) ? 0 : -1);\n }", "public double getAngle(int[][] tab) {\n\t\tdouble[] res= new double[4];int resi=0;\n\t\tint cmpt=0;\n\t\tint angle=0;\n\t\tfor (int i=0;i<tab.length;i++) {\n\t\t\tif (!(tab[i][0]==0) || !(tab[i][1]==0))\n\t\t\t\tcmpt++;\n\t\t}\n\t\t\n\t\tif (cmpt<=1) {\n\t\t\t return 0; //RIP CODE\n\t\t}\n\t\t\n\t\tfor (int i=1;i<tab.length && (!(tab[i][0]==0) || !(tab[i][1]==0));i++) {\n\t\t\tfor(int c=1;i<tab.length && (tab[c][0]!=0 || tab[c][1]!=0);i++)\n\t\t\t{\n\t\t\t\tint diffx=tab[i-1][0]-tab[i][0];\n\t\t\t\tint diffy=tab[i-1][1]-tab[i][1];\n\t\t\t\t\n\t\t\t\tdouble yb=tab[i][1];\n\t\t\t\tdouble xb=tab[i][0];\n\t\t\t\tdouble ya=tab[i-1][1];\n\t\t\t\tdouble xa=tab[i-1][0];\n\t\t\t\t\n\t\t\t\tdouble pointy,pointx;\n\t\t\t\tpointy=yb; \t\t\t\t\t\t\t//pointy/x = coord du 3e point de triangle rectangle\n\t\t\t\tpointx=xa;\t\t\t\t\n\t\t\t\t\n\t\t\t\tdouble dhypo=Math.sqrt(Math.pow(xb-xa,2)+Math.pow(yb-ya,2));\t//(yb-ya)/(xb-xa)\n\t\t\t\tdouble dadj=Math.sqrt(Math.pow(xb-pointx, 2)+Math.pow(yb-pointy, 2));\t//adjacent / rapport a xb,yb\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (dhypo<img.getWidth() && dhypo!=0) {\t\t//deux points selectionnees sont des diagonales\n\t\t\t\t\tdouble retour=Math.acos(dadj/dhypo)*(180/Math.PI);\n\t\t\t\t\tif (retour>90/2)\n\t\t\t\t\t\tretour=180-90-retour;\n\t\t\t\t\t\n\t\t\t\t\tif((xa<xb && ya<yb )||( xb<xa && yb<ya))\t\t\t\t//point de droite plus haut que celui de gauche\n\t\t\t\t\t\treturn -retour;\n\t\t\t\t\telse\n\t\t\t\t\t\treturn retour;\n\t\t\t\t}\n\t\t\t\t/*else {\t\t\t//deux points sont en diagonnale\n\t\t\t\t\tdouble retour=Math.acos(dadj/dhypo)*(180/Math.PI);\t\t// ne marche pas \n\t\t\t\t\treturn (Math.abs(45-retour)/2);\n\t\t\t\t\t\n\t\t\t\t}*/\n\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\t\t\n\t\treturn 0;\n\t}", "public void triangulate() {\n // Save the outline and calculate normals\n outline = new Vector<PlanarEdge>();\n for (PlanarEdge e : subdivision.getEdges()) {\n if (e.isRealEdge()) {\n outline.add(e);\n }\n }\n // Calculate outline normals\n outline_normals = new Vector3f[outline.size()];\n for (PlanarEdge e : outline) {\n TriangulationVertex vert = (TriangulationVertex) e.getDestination();\n // Normal 1\n Vector3f normal1 = new Vector3f(vert.getOutGoingEdge()\n .getDestination().getPoint())\n .subtractLocal(vert.getPoint()).normalizeLocal();\n // Vector3f normal1 = new\n // Vector3f(vert.getOutGoingEdge().getDestination().getPoint()).subtractLocal(vert.getPoint());\n normal1.z = -normal1.x;\n normal1.x = normal1.y;\n normal1.y = normal1.z;\n normal1.z = 0;\n // Normal 2\n Vector3f normal2 = new Vector3f(vert.getPoint()).subtractLocal(\n vert.getInGoingEdge().getOrigin().getPoint())\n .normalizeLocal();\n // Vector3f normal2 = new\n // Vector3f(vert.getPoint()).subtractLocal(vert.getInGoingEdge().getOrigin().getPoint());\n normal2.z = -normal2.x;\n normal2.x = normal2.y;\n normal2.y = normal2.z;\n normal2.z = 0;\n normal1.addLocal(normal2).normalizeLocal();\n\n outline_normals[vert.getIndex()] = normal1;\n }\n\n // Calculate the triangulation of the surface.\n surface = subdivision.triangulate();\n }", "@Test\n\tpublic void deleteA_useAwithB_danglingEdgeTest() {\n\t\tHenshinResourceSet resourceSet = new HenshinResourceSet(PATH);\n\n\t\t// Load the module:\n\t\tModule module = resourceSet.getModule(\"simpleTgRules.henshin\", false);\n\n\t\tUnit deleteAUnit = module.getUnit(\"deleteA\");\n\t\tRule deleteARule = (Rule) deleteAUnit;\n\n\t\tUnit useAwithBUnit = module.getUnit(\"useAwithB\");\n\t\tRule useAwithBRule = (Rule) useAwithBUnit;\n\n\t\tConflictAnalysis atomicCoreCPA = new ConflictAnalysis(deleteARule, useAwithBRule);\n\t\tList<ConflictAtom> computedConflictAtoms = atomicCoreCPA.computeConflictAtoms();\n\t\t// should be 0 due to dangling edge condition. First rule deletes a node\n\t\t// and second rule requires to have an edge on that node!\n\t\tAssert.assertEquals(0, computedConflictAtoms.size());\n\t\t// System.out.println(\"number of conflict atoms:\n\t\t// \"+computedConflictAtoms.size());\n\t\t// for(ConflictAtom conflictAtom : computedConflictAtoms){\n\t\t// System.out.println(conflictAtom);\n\t\t// }\n\n\t\tAtomCandidateComputation candComp = new AtomCandidateComputation(deleteARule, useAwithBRule);\n\t\tList<Span> conflictAtomCandidates = candComp.computeAtomCandidates();\n\n\t\tSet<MinimalConflictReason> reasons = new HashSet<>();//\n\t\tfor (Span candidate : conflictAtomCandidates) {\n\t\t\tnew MinimalReasonComputation(deleteARule, useAwithBRule).computeMinimalConflictReasons(candidate, reasons);\n\t\t}\n\t\t// should be 0 due to dangling edge condition. First rule deletes a node\n\t\t// and second rule requires to have an edge on that node!\n\t\tAssert.assertEquals(0, reasons.size());\n\n\t\t// Set<Span> minimalConflictReasons = reasons;\n\t\t// System.out.println(\"number of minimal conflict reasons:\n\t\t// \"+minimalConflictReasons.size());\n\t\t// for(Span minimalConflictReason : minimalConflictReasons){\n\t\t// System.out.println(minimalConflictReason);\n\t\t// }\n\t}", "private void defineVertexes(String orientation){\n if(\"down\".equals(orientation)){\n y2 = y1-height;\n y3 = y1-height;\n \n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"up\")){\n y2 = y1+height;\n y3 = y1+height;\n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"left\")){\n x2 = x1-height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }else if(orientation.equals(\"right\")){\n x2 = x1+height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }\n }", "private boolean isLegalState(int[] state){\n int[] stateOtherSide = new int[3];\n stateOtherSide[0] = totalMissionaries - state[0];\n stateOtherSide[1] = totalCannibals - state[1];\n stateOtherSide[2] = state[2]==0 ? 1 : 0;\n\n if((state[0] < state[1]) && state[0] >0 || (stateOtherSide[0] < stateOtherSide[1]) && stateOtherSide[0] > 0) {\n return false;\n }else{\n return true;\n }\n }", "private double angleBP(int cx, int cy, int ex, int ey){\n\t return Math.atan2(((float)ey-cy),((float)ex-cx));\r\n\t }", "public int solution(int[] A) {\n Arrays.sort(A);\n int hasTriangular = 0;\n // System.out.print(Arrays.toString(A));\n \n if (A.length < 3) {\n hasTriangular = 0;\n }\n else {\n int P = 0;\n int Q = 1;\n int R = 2;\n \n for(int i= 2; i<A.length; i++) {\n if((long) A[P]+ (long) A[Q]> (long)A[R]) {\n hasTriangular = 1;\n break;\n }\n else {\n P++;\n Q++;\n R++;\n } \n }\n }\n \n return hasTriangular;\n }", "public static void bottomHalf() {\n\n for(int i = 1; i <= SIZE; i++) {\n for(int j = 1; j <= i - 1; j++) {\n System.out.print(\" \");\n }\n \n\t System.out.print(\"\\\\_\");\n\t for(int j = 3*SIZE-i; j >= i; j--) {\n\t System.out.print(\"/\\\\\");\n\t }\n\t System.out.println(\"_/\");\n }\n }", "private void doubleRotateright(WAVLNode x) {\n\t WAVLNode z=x.left;\r\n\t rightRotate(z);\r\n\t z.rank+=1;\r\n\t leftRotate(z);\r\n }", "public double perimeter()\n\t{\n\t\t// To recognize points, their angles must be compared - middle one always represents the opposing point.\n\t\tdouble angleXAB = pointA.calculateLineAngle(pointB);\n\t\tdouble angleXAC = pointA.calculateLineAngle(pointC);\n\t\tdouble angleXAD = pointA.calculateLineAngle(pointD);\n\t\t\n\t\tdouble side1;\n\t\tdouble side2;\n\t\tdouble side3;\n\t\tdouble side4;\n\n\t\t// Creates sides based on angles comparison.\n\n\t\t// Excluding double 0 cases (vertical and horizontal)\n\t\t// opposite is XAB\n\t\tif(angleXAC == angleXAD)\n\t\t{\n\t\t\tside1 = pointA.getDistance(pointC);\n\t\t\tside2 = pointA.getDistance(pointD);\n\t\t\tside3 = pointB.getDistance(pointC);\n\t\t\tside4 = pointB.getDistance(pointD);\n\t\t\treturn \tside1 + side2 + side3 + side4;\n\t\t} // if \n\t\t// opposite is XAC\n\t\telse if(angleXAB == angleXAD)\n\t\t{\n\t\t\tside1 = pointA.getDistance(pointB);\n\t\t\tside2 = pointA.getDistance(pointD);\n\t\t\tside3 = pointC.getDistance(pointB);\n\t\t\tside4 = pointC.getDistance(pointD);\n\t\t\treturn \tside1 + side2 + side3 + side4;\n\t\t} // else if \n\t\t// opposite is XAD\n\t\telse if(angleXAB == angleXAC)\n\t\t{\n\t\t\tside1 = pointA.getDistance(pointB);\n\t\t\tside2 = pointA.getDistance(pointC);\n\t\t\tside3 = pointD.getDistance(pointB);\n\t\t\tside4 = pointD.getDistance(pointC);\n\t\t\treturn \tside1 + side2 + side3 + side4;\n\t\t} // else if \n\t\tif(angleXAB > angleXAC)\n\t\t{\n\t\t\t// opposite is XAC\n\t\t\tif(angleXAC > angleXAD)\n\t\t\t{\n\t\t\t\tside1 = pointA.getDistance(pointB);\n\t\t\t\tside2 = pointA.getDistance(pointD);\n\t\t\t\tside3 = pointC.getDistance(pointB);\n\t\t\t\tside4 = pointC.getDistance(pointD);\n\n\t\t\t} // if\n\t\t\t// opposite is XAB\n\t\t\telse if (angleXAD > angleXAB)\n\t\t\t{\n\t\t\t\tside1 = pointA.getDistance(pointC);\n\t\t\t\tside2 = pointA.getDistance(pointD);\n\t\t\t\tside3 = pointB.getDistance(pointC);\n\t\t\t\tside4 = pointB.getDistance(pointD);\n\t\t\t} // else if\t\n\t\t\t// opposite is XAD\t\n\t\t\telse\n\t\t\t{\n\t\t\t\tside1 = pointA.getDistance(pointB);\n\t\t\t\tside2 = pointA.getDistance(pointC);\n\t\t\t\tside3 = pointD.getDistance(pointB);\n\t\t\t\tside4 = pointD.getDistance(pointC);\n\t\t\t} // else\n\t\t} // if\n\t\telse\t\n\t\t{\n\t\t\t// opposite is XAC\n\t\t\tif(angleXAD > angleXAC)\t\t\t\n\t\t\t{\n\t\t\t\tside1 = pointA.getDistance(pointB);\n\t\t\t\tside2 = pointA.getDistance(pointD);\n\t\t\t\tside3 = pointC.getDistance(pointB);\n\t\t\t\tside4 = pointC.getDistance(pointD);\n\t\t\t} // if \n\t\t\t// opposite is XAD\n\t\t\telse if (angleXAD > angleXAB)\n\t\t\t{\n\t\t\t\tside1 = pointA.getDistance(pointB);\n\t\t\t\tside2 = pointA.getDistance(pointC);\n\t\t\t\tside3 = pointD.getDistance(pointB);\n\t\t\t\tside4 = pointD.getDistance(pointC);\n\t\t\t} // else if \n\t\t\t// opposite is XAB\n\t\t\telse \t\n\t\t\t{\n\t\t\t\tside1 = pointA.getDistance(pointC);\n\t\t\t\tside2 = pointA.getDistance(pointD);\n\t\t\t\tside3 = pointB.getDistance(pointC);\n\t\t\t\tside4 = pointB.getDistance(pointD);\n\t\t\t} // else\n\t\t} // else\t\t\n\t\treturn \tside1 + side2 + side3 + side4;\n\t\t\n\t}", "public double getOrientation()\r\n\t{\r\n\t\treturn Math.atan2(-end.getY()+start.getY(), end.getX()-start.getX());\r\n\t}", "protected void doDeduction() {\n\n boolean narrowed= false;\n\n unit=false;\n isInconclusive=false;\n\n int newXL;\n int newYU;\n\n Variable x = null;\n Variable y = null;\n\n for(Variable var : csp.getVars()){\n if(var.getPosition() == unitSB.getX().getPosition()){\n x = var;\n } else if(var.getPosition() == unitSB.getY().getPosition()){\n y = var;\n }\n }\n\n int xU = x.getUpperDomainBound();\n int yL = y.getLowerDomainBound();\n\n newXL = yL + unitSB.getCright();\n newYU = xU - unitSB.getCright();\n\n if(newXL>x.getLowerDomainBound()){\n Variable newX = new Variable(newXL, xU);\n newX.setPosition(x.getPosition());\n changeVariable(newX);\n narrowed= true;\n }\n if (newYU< y.getUpperDomainBound()){\n Variable newY = new Variable(yL, newYU);\n newY.setPosition(y.getPosition());\n changeVariable(newY);\n narrowed =true;\n }\n\n if(narrowed){\n doAlgorithmA1();\n }else {\n doAlgorithmA3();\n }\n\n }", "public int a(bzl ☃, bzg bzg1, int i, int j) {\r\n/* 13 */ if (i == -bzg1.a() && j == -bzg1.b() && bzg1.a() > -bzg1.c() && bzg1.a() <= 0 && bzg1.b() > -bzg1.d() && bzg1.b() <= 0) {\r\n/* 14 */ return 1;\r\n/* */ }\r\n/* */ \r\n/* 17 */ return (☃.a(10) == 0) ? 1 : bzy.c;\r\n/* */ }", "private void ruleR1(Node a, Node b, Node c, Graph graph) {\n if (graph.isAdjacentTo(a, c)) {\n return;\n }\n\n if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, b, c)) {\n return;\n }\n\n graph.setEndpoint(c, b, Endpoint.TAIL);\n graph.setEndpoint(b, c, Endpoint.ARROW);\n }\n }", "public ZeroSides calculateShouldZeroSides() {\r\n if (!(getContext() instanceof Activity)) {\r\n return ZeroSides.NONE;\r\n }\r\n Activity activity = (Activity) getContext();\r\n int i = activity.getResources().getConfiguration().orientation;\r\n int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();\r\n if (i != 2) {\r\n return ZeroSides.NONE;\r\n }\r\n if (rotation == 1) {\r\n return ZeroSides.RIGHT;\r\n }\r\n if (rotation == 3) {\r\n return Build.VERSION.SDK_INT >= 23 ? ZeroSides.LEFT : ZeroSides.RIGHT;\r\n }\r\n if (rotation == 0 || rotation == 2) {\r\n return ZeroSides.BOTH;\r\n }\r\n return ZeroSides.NONE;\r\n }", "public AVLNode rotateDoubleRight(AVLNode pt) {\n\t\t\n\t\tAVLNode node = rotateLeft(pt.getLeft());\n\t\t\n\t\tpt.setLeft(node);\n\t\tpt = rotateRight(pt);\n\t\t\n\t\treturn pt;\n\t}", "public void setSideB(double sideB)\r\n\t{\r\n\t\tthis.sideB=sideB;\r\n\t\t\r\n\t}", "@Override\n protected void doAlgorithmA1() {\n int xP = 0;\n int yP = 0;\n\n\n //Taking the variable out of the list that are in the bounds\n //Testing that the bound has variables\n if (csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getX() != null) {\n xP = csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getX().getPosition();\n }\n int xU = 0;\n int xL = 0;\n if (csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getY() != null) {\n yP = csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getY().getPosition();\n }\n int yU = 0;\n int yL = 0;\n int cright = csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getCright();\n int cleft = csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getCleft();\n\n\n\n for (Variable variable : csp.getVars()) {\n if (csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getX() != null) {\n if (variable.getPosition() == xP) {\n xU = variable.getUpperDomainBound();\n xL = variable.getLowerDomainBound();\n }\n }\n if (csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex).getY() != null) {\n if (variable.getPosition() == yP) {\n yU = variable.getUpperDomainBound();\n yL = variable.getLowerDomainBound();\n }\n }\n }\n\n boolean first = false;\n boolean second = false;\n\n //Testing if the bound is true, false or inconclusive\n\n if (xL + cleft >= yU + cright) {\n first = true;\n }\n if (xU + cleft < yL + cright) {\n second = true;\n }\n\n //are first and second not equal is the bound not inconclusive\n if (first != second) {\n if (first) { //a true Simple Bound was found\n //checks if it was the last constraint in a csp\n //If so the csp is true\n //else check the next constraint and do this method again\n if (csp.getSimpleConstraints().size() - 1 == cIndex) {\n System.out.println(\"P is satisfiable\");\n System.out.println(System.nanoTime()-startTime);\n return;\n } else {\n bIndex = 0;\n cIndex++;\n unit=false;\n doAlgorithmA1();\n }\n } else if (csp.getSimpleConstraints().get(cIndex).getSimpleBounds().size() - 1 == bIndex) { //a false Simple Bound was found\n //\n bIndex = 0;\n cIndex = 0;\n if (isInconclusive) {\n if(unit){\n doDeduction();\n }else {\n doAlgorithmA3();\n }\n } else {\n doAlgorithmA2();\n }\n } else {\n bIndex++;\n doAlgorithmA1();\n }\n } else {//an inconclusive Simple Bound was found\n //checks if the bound wasn't already inconclusive\n if(!isInconclusive){\n unit=true;\n unitSB = csp.getSimpleConstraints().get(cIndex).getSimpleBounds().get(bIndex);\n }else {\n unit=false;\n }\n isInconclusive = true;\n\n if (csp.getSimpleConstraints().get(cIndex).getSimpleBounds().size() - 1 == bIndex) {\n cIndex = 0;\n bIndex = 0;\n if(unit){\n doDeduction();\n }else {\n doAlgorithmA3();\n }\n } else {\n bIndex++;\n doAlgorithmA1();\n }\n }\n }", "public boolean isEquilateral () {\r\n\t\tif ((startSide1 == startSide2 && startSide1 == startSide3) && isTriangle () == true && isRight () == false) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse return false;\r\n\t}", "@Test\n public void heightInTri() {\n Vector3f a = new Vector3f(0, 1, 1);\n Vector3f b = new Vector3f(0, 1, 0);\n Vector3f c = new Vector3f(2, 3, 0.5f);\n assertEquals(2, Trig.heightInTri(a, b, c, new Vector3f(1, 999, 0.5f)));\n assertEquals(Float.NaN, Trig.heightInTri(a, b, c, new Vector3f(1, 999, 1)));\n assertEquals(Float.NaN, Trig.heightInTri(a, b, c, new Vector2f(1, 1)));\n assertEquals(1, Trig.heightInTri(a, b, c, new Vector3f(0, 1, 1)));\n assertEquals(1, Trig.heightInTri(a, b, c, new Vector2f(0, 1)));\n assertEquals(1, Trig.heightInTri(a, b, c, new Vector3f(0, 1, 0.2f)));\n }", "@Override\n\tpublic void rotate() {\n\t\tSystem.out.println(\"Triangle is Rotateing in \"+ Rotatable.DIRECTION + \"Direction\");\n\t}", "public static void main(String[] args) {\n double angel1 = 30;\n double angel2 = 50;\n double angel3= 60;\n\n short sumOfAngels = (short)(angel1 + angel2 + angel3);\n\n boolean validTriangle = sumOfAngels == 180;\n if (sumOfAngels==180){\n System.out.println(\"The shape is a triangle.\");\n }\n if (sumOfAngels!=180){\n System.out.println(\"The shape is not a valid triangle.\");\n }\n\n\n\n\n\n\n\n\n\n\n }", "public double calcAngle(double[] AB, Solution A, Solution B, double[][] extreme){\n\t\tint size = AB.length;\n\t\tdouble lena = 0.0, lenb = 0.0, lenc = 0.0;\n\t\tdouble theta = 0.0;\n\t\t\n\t\tfor(int i=0;i<size;i++) {\n\t\t\tlena += AB[i]*AB[i]; \n\t\t\tlenb += (A.getObjective(i)-extreme[0][i])*(A.getObjective(i)-extreme[0][i]);\n\t\t\tlenc += (B.getObjective(i)-extreme[0][i])*(B.getObjective(i)-extreme[0][i]);\n\t\t}\n\t\tlena = Math.sqrt(lena); //AB\n\t\tlenb = Math.sqrt(lenb); //idea-A\n\t\tlenc = Math.sqrt(lenc); //idea-B\n\t\t\n\t\t\n\t\ttheta =Math.PI-Math.acos((lena*lena+lenb*lenb-lenc*lenc)/(2*lenb*lena));\n\t\t\n\t\treturn theta;\t\n\t}", "public int angleOX() {\n if (B.getY() == A.getY()) {\r\n return 0;\r\n } else if (A.getX() == B.getX()) {\r\n return 90;\r\n }\r\n else {\r\n float fi = ((float) (B.getY() - A.getY()) / (B.getX() - A.getX()));\r\n if (fi<0){\r\n return (int)(fi*(-1));\r\n }\r\n else return (int)(fi);\r\n }\r\n }", "private boolean inOneQuadrant(double x, double y,\n double llx, double lly,\n double urx, double ury) {\n boolean horCond = llx < x == urx < x;\n boolean verCond = lly < y == ury < y;\n return horCond && verCond;\n }", "public abstract boolean facingRight();", "private DoubleMatrix solve33(DoubleMatrix A, DoubleMatrix rhs) {\n \n DoubleMatrix result = DoubleMatrix.zeros(3, 1);\n \n // if (A.lines() != 3 || A.pixels() != 3){\n // throw \"solve33: input: size of A not 33.\")\n // }\n // if (rhs.lines() != 3 || rhs.pixels() != 1) {\n // throw \"solve33: input: size rhs not 3x1.\")\n // }\n \n // ______ real8 L10, L20, L21: used lower matrix elements\n // ______ real8 U11, U12, U22: used upper matrix elements\n // ______ real8 b0, b1, b2: used Ux=b\n final double L10 = A.get(1, 0) / A.get(0, 0);\n final double L20 = A.get(2, 0) / A.get(0, 0);\n final double U11 = A.get(1, 1) - L10 * A.get(0, 1);\n final double L21 = (A.get(2, 1) - (A.get(0, 1) * L20)) / U11;\n final double U12 = A.get(1, 2) - L10 * A.get(0, 2);\n final double U22 = A.get(2, 2) - L20 * A.get(0, 2) - L21 * U12;\n \n // ______ Solution: forward substitution ______\n final double b0 = rhs.get(0, 0);\n final double b1 = rhs.get(1, 0) - b0 * L10;\n final double b2 = rhs.get(2, 0) - b0 * L20 - b1 * L21;\n \n // ______ Solution: backwards substitution ______\n result.put(2, 0, b2 / U22);\n result.put(1, 0, (b1 - U12 * result.get(2, 0)) / U11);\n result.put(0, 0, (b0 - A.get(0, 1) * result.get(1, 0) - A.get(0, 2) * result.get(2, 0)) / A.get(0, 0));\n \n return result;\n \n }", "public static void main(String[] args){\n \n Scanner in = new Scanner(System.in );\n \n int a;\n a = in.nextInt();\n \n int b;\n b = in.nextInt();\n \n int c;\n c = in.nextInt();\n \n int d;\n d = in.nextInt();\n \n /* 24 Combinations of ABCD in total (combination is reversed when printed so it is in increasing order) */\n \n // 1: ABCD \n if (a > b & b > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + b + \",\" + a);\n }\n \n // 2 ABDC \n else if (a > b & b > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + b + \",\" + a);\n }\n \n // 3 ACBD \n else if (a > c & c > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + c + \",\" + a);\n }\n \n // 4 ACDB \n else if (a > c & c > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + c + \",\" + a);\n }\n \n // 5 ADBC\n else if (a > d & d > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + d + \",\" + a);\n }\n \n // 6 ADCB\n else if (a > d & d > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + d + \",\" + a);\n }\n \n // 7 BACD \n else if (b > a & a > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + a + \",\" + b);\n }\n \n // 8 BADC\n else if (b > a & a > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + a + \",\" + b);\n }\n \n // 9 BDAC\n else if (b > d & d > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + d + \",\" + b);\n }\n \n // 10 BDCA\n else if (b > d & d > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + d + \",\" + b);\n }\n \n // 11 BCAD\n else if (b > c & c > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + c + \",\" + b);\n }\n \n // 12 BCDA\n else if (b > c & c > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + c + \",\" + b);\n }\n \n // 13 CABD\n else if (c > a & a > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + a + \",\" + c);\n }\n \n // 14 CADB\n else if (c > a & a > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + a + \",\" + c);\n }\n \n // 15 CBAD \n else if (c > b & b > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + b + \",\" + c);\n }\n \n // 16 CBDA\n else if (c > b & b > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + b + \",\" + c);\n }\n \n // 17 CDAB\n else if (c > d & d > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + d + \",\" + c);\n }\n \n // 18 CDBA\n else if (c > d & d > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + d + \",\" + c);\n }\n \n // 19 DABC\n else if (d > a & a > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + a + \",\" + d);\n }\n \n // 20 DACB\n else if (d > a & a > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + a + \",\" + d);\n }\n \n // 21 DBAC\n else if (d > b & b > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + b + \",\" + d);\n }\n \n // 22 DBCA\n else if (d > b & b > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + b + \",\" + d);\n }\n \n // 23 DCAB\n else if (d > c & c > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + c + \",\" + d);\n }\n \n // 24 DCBA\n else if (d > c & c > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + c + \",\" + d);\n }\n\n\n\n\n \n \n }", "public boolean isValidVertical(Square curB, Square preB) {\n int xdistance = curB.getRow1() - preB.getRow1();\n int ydistance = curB.getCol1() - preB.getCol1();\n int i1;\n \n if ((ydistance == 0) && (xdistance < 0)) {\n for (i1 = curB.getRow1(); i1 < preB.getRow1(); i1 += 1) {\n if (Board.squares[i1][preB.getCol1()].isOccupied()) {\n value = false;\n }\n }\n } else if ((ydistance == 0) && (xdistance > 0)) {\n for (i1 = preB.getRow1(); i1 < curB.getRow1(); i1 += 1) {\n if (Board.squares[i1 + 1][preB.getCol1()].isOccupied()) {\n value = false;\n }\n }\n }\n return value;\n }", "private int robustCrossingInternal2(S2Point d) {\n if (!hasTangents) {\n S2Point norm = S2Point.normalize(S2.robustCrossProd(a, b));\n aTangent = S2Point.crossProd(a, norm);\n bTangent = S2Point.crossProd(norm, b);\n hasTangents = true;\n }\n\n // The error in robustCrossProd() is insignificant. The maximum error in the call to\n // crossProd() (i.e., the maximum norm of the error vector) is\n // (0.5 + 1/sqrt(3)) * S2.DBL_EPSILON. The maximum error in each call to dotProd() below is\n // S2.DBL_EPSILON. (There is also a small relative error term that is insignificant because\n // we are comparing the result against a constant that is very close to zero.)\n final double kError = (1.5 + 1 / Math.sqrt(3)) * S2.DBL_EPSILON;\n if ((c.dotProd(aTangent) > kError && d.dotProd(aTangent) > kError)\n || (c.dotProd(bTangent) > kError && d.dotProd(bTangent) > kError)) {\n return -1;\n }\n\n // Otherwise, eliminate the cases where any two vertices are equal. (These cases could be\n // handled in the code below, but since expensiveSign lives up to its name we would rather\n // avoid calling it if possible.)\n //\n // These are the cases where two vertices from different edges are equal.\n if (a.equalsPoint(c) || a.equalsPoint(d) || b.equalsPoint(c) || b.equalsPoint(d)) {\n return 0;\n }\n\n // These are the cases where an input edge is degenerate. Note that in most cases, if CD is\n // degenerate then this method is not even called because acb and bda have different signs.\n // That's why this method is documented to return either 0 or -1 when an input edge is\n // degenerate.\n if (a.equalsPoint(b) || c.equalsPoint(d)) {\n return 0;\n }\n\n // Otherwise it's time to break out the big guns.\n if (acb == 0) {\n acb = -S2Predicates.Sign.expensive(a, b, c, true);\n assert acb != 0;\n }\n if (bdaReturn == 0) {\n bdaReturn = S2Predicates.Sign.expensive(a, b, d, true);\n assert bdaReturn != 0;\n }\n if (bdaReturn != acb) {\n return -1;\n }\n\n S2Point cCrossD = S2Point.crossProd(c, d);\n int cbd = -sign(c, d, b, cCrossD);\n assert cbd != 0;\n if (cbd != acb) {\n return -1;\n }\n\n int dac = sign(c, d, a, cCrossD);\n assert dac != 0;\n return (dac == acb) ? 1 : -1;\n }", "private void doubleRotateLeftDel (WAVLNode z) {\n\t WAVLNode a = z.right.left;\r\n\t WAVLNode y = z.right;\r\n\t WAVLNode c = z.right.left.left;\r\n\t WAVLNode d = z.right.left.right;\r\n\t if(z.parent!=null) {\r\n\t\t if(parentside(z.parent, z).equals(\"left\")) {\r\n\t\t\t z.parent.left=a;\r\n\r\n\t }\r\n\t else {\r\n\t\t\t z.parent.right=a;\r\n\r\n\t }\r\n\t\t \r\n\t }\r\n\t else {\r\n\t\t this.root=a;\r\n\t }\r\n\t a.left=z;\r\n\t a.right=y;\r\n\t a.rank=a.rank+2;\r\n\t a.parent=z.parent;\r\n\t y.parent=a;\r\n\t y.left=d;\r\n\t y.rank--;\r\n\t z.parent=a;\r\n\t z.right=c;\r\n\t z.rank=z.rank-2;\r\n\t c.parent=z;\r\n\t d.parent=y;\r\n\t z.sizen=z.right.sizen+z.left.sizen+1;\r\n\t y.sizen=y.right.sizen+y.left.sizen+1;\r\n\t a.sizen=a.right.sizen+a.left.sizen+1;\r\n }" ]
[ "0.5636842", "0.5503011", "0.52086127", "0.5094613", "0.50666445", "0.50379276", "0.50299716", "0.5016858", "0.500738", "0.4986856", "0.49686214", "0.49554402", "0.49167687", "0.48544285", "0.48485374", "0.47952783", "0.47159117", "0.47147655", "0.47082308", "0.4687949", "0.46746907", "0.46679592", "0.4626606", "0.46135163", "0.4602203", "0.4581595", "0.45782402", "0.4559563", "0.45524165", "0.4547498", "0.4545862", "0.45364338", "0.45325547", "0.45294607", "0.45275584", "0.45232528", "0.45202857", "0.45078543", "0.4506862", "0.45068467", "0.44923586", "0.44898528", "0.4487869", "0.4485335", "0.44803068", "0.4476127", "0.44755378", "0.4457305", "0.4456503", "0.44480243", "0.4447892", "0.44461966", "0.44444108", "0.44442207", "0.44436383", "0.44369555", "0.4436587", "0.44132316", "0.44046262", "0.44020274", "0.43925118", "0.43860525", "0.4385501", "0.43834984", "0.43825316", "0.4373412", "0.43661138", "0.4364471", "0.43637505", "0.43635958", "0.43554035", "0.43420058", "0.43406084", "0.43370384", "0.43303573", "0.43302816", "0.43300706", "0.43287927", "0.4322277", "0.43208155", "0.4313085", "0.4295412", "0.42943394", "0.42905346", "0.42872483", "0.42849004", "0.4280788", "0.42775452", "0.42765197", "0.42684987", "0.42670912", "0.42666644", "0.42664295", "0.42585483", "0.42531294", "0.4250216", "0.4249877", "0.4248677", "0.4240406", "0.42334104" ]
0.57256687
0
Does only the ancestor and cycle rules of these repeatedly until no changes
private void awayFromAncestorCycle(Graph graph) { while (changeFlag) { changeFlag = false; List<Node> nodes = graph.getNodes(); for (Node B : nodes) { List<Node> adj = graph.getAdjacentNodes(B); if (adj.size() < 2) { continue; } ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2); int[] combination; while ((combination = cg.next()) != null) { Node A = adj.get(combination[0]); Node C = adj.get(combination[1]); //choice gen doesnt do diff orders, so must switch A & C around. awayFromAncestor(graph, A, B, C); awayFromAncestor(graph, C, B, A); awayFromCycle(graph, A, B, C); awayFromCycle(graph, C, B, A); } } } changeFlag = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void awayFromColliderAncestorCycle(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n List<Node> adj = graph.getAdjacentNodes(B);\n\n if (adj.size() < 2) {\n continue;\n }\n\n ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2);\n int[] combination;\n\n while ((combination = cg.next()) != null) {\n Node A = adj.get(combination[0]);\n Node C = adj.get(combination[1]);\n\n //choice gen doesnt do diff orders, so must switch A & C around.\n// awayFromCollider(graph, A, B, C);\n// awayFromCollider(graph, C, B, A);\n// awayFromAncestor(graph, A, B, C);\n// awayFromAncestor(graph, C, B, A);\n// awayFromCycle(graph, A, B, C);\n// awayFromCycle(graph, C, B, A);\n ruleR1(A, B, C, graph);\n ruleR1(C, B, A, graph);\n ruleR2(A, B, C, graph);\n ruleR2(C, B, A, graph);\n\n }\n }\n }", "void updateAllParentsBelow();", "@Test\n public void shouldDetectCycleWhenUpstreamLeavesAreAtDifferentLevels() {\n\n String g1 = \"g1\";\n String g2 = \"g2\";\n String p1 = \"p1\";\n String p2 = \"p2\";\n String p3 = \"p3\";\n String p4 = \"p4\";\n String p5 = \"p5\";\n String p6 = \"p6\";\n String current = \"current\";\n\n ValueStreamMap valueStreamMap = new ValueStreamMap(current, null);\n\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(p4, p4), null, current);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(p3, p3), null, p4);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(p2, p2), null, p3);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(p1, p1), null, p2);\n valueStreamMap.addUpstreamMaterialNode(new SCMDependencyNode(g1, g1, \"git\"), null, p1, new MaterialRevision(null));\n\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(p5, p5), new PipelineRevision(p5,2,\"2\"), current);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(p6, p6), new PipelineRevision(p6,1,\"1\"), p5);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(p5, p5), new PipelineRevision(p5,1,\"1\"), p6);\n valueStreamMap.addUpstreamMaterialNode(new SCMDependencyNode(g2,g2,\"git\"), null, p5, new MaterialRevision(null));\n\n assertThat(valueStreamMap.hasCycle(), is(true));\n }", "public void makePreferredOTTOLRelationshipsNOConflicts() {\n \n // TraversalDescription CHILDOF_TRAVERSAL = Traversal.description()\n // .relationships(RelType.TAXCHILDOF, Direction.INCOMING);\n \n // get the start point\n Node life = getLifeNode();\n System.out.println(life.getProperty(\"name\"));\n \n Transaction tx = beginTx();\n addToPreferredIndexes(life, ALLTAXA);\n HashSet<Long> traveled = new HashSet<Long>();\n int nNewRels = 0;\n try {\n // walk out to the tips from the base of the tree\n for (Node n : TAXCHILDOF_TRAVERSAL.traverse(life).nodes()) {\n if (n.hasRelationship(Direction.INCOMING, RelType.TAXCHILDOF) == false) {\n \n // when we hit a tip, start walking back\n Node curNode = n;\n while (curNode.hasRelationship(Direction.OUTGOING, RelType.TAXCHILDOF)) {\n Node startNode = curNode;\n if (traveled.contains((Long)startNode.getId())){\n \tbreak;\n }else{\n \ttraveled.add((Long)startNode.getId());\n }\n Node endNode = null;\n \n // if the current node already has a preferred relationship, we will just follow it\n if (startNode.hasRelationship(Direction.OUTGOING, RelType.PREFTAXCHILDOF)) {\n Relationship prefRel = startNode.getSingleRelationship(RelType.PREFTAXCHILDOF, Direction.OUTGOING);\n \n // make sure we don't get stuck in an infinite loop (should not happen, could do weird things to the graph)\n if (prefRel.getStartNode().getId() == prefRel.getEndNode().getId()) {\n System.out.println(\"pointing to itself \" + prefRel + \" \" + prefRel.getStartNode().getId() + \" \" + prefRel.getEndNode().getId());\n break;\n }\n \n // prepare to move on\n endNode = prefRel.getEndNode();\n \n } else {\n \n // if there is no preferred rel then they all point to the same end node; just follow the first non-looping relationship\n for (Relationship rel : curNode.getRelationships(RelType.TAXCHILDOF, Direction.OUTGOING)) {\n if (rel.getStartNode().getId() == rel.getEndNode().getId()) {\n System.out.println(\"pointing to itself \" + rel + \" \" + rel.getStartNode().getId() + \" \" + rel.getEndNode().getId());\n break;\n } else {\n endNode = rel.getEndNode();\n break;\n }\n }\n \n // if we found a dead-end, die\n if (endNode == null) {\n System.out.println(curNode.getProperty(\"name\"));\n System.out.println(\"Strange, this relationship seems to be pointing at a nonexistent node. Quitting.\");\n System.exit(0);\n }\n \n // create preferred relationships\n curNode.createRelationshipTo(endNode, RelType.PREFTAXCHILDOF);\n curNode.createRelationshipTo(endNode, RelType.TAXCHILDOF).setProperty(\"source\", \"ottol\");\n nNewRels += 1;\n }\n \n if (startNode == endNode) {\n System.out.println(startNode);\n System.out.println(\"The node seems to be pointing at itself. This is a problem. Quitting.\");\n System.exit(0);\n \n // prepare for next iteration\n } else {\n curNode = endNode;\n addToPreferredIndexes(startNode, ALLTAXA);\n }\n }\n }\n \n if (nNewRels % transaction_iter == 0) {\n System.out.println(nNewRels);\n // tx.success();\n // tx.finish();\n // tx = beginTx();\n }\n }\n tx.success();\n } finally {\n tx.finish();\n }\n }", "private void computeSat(){\n addVertexVisitConstraint();\n //add clause for each vertex must be visited only once/ all vertices must be on path\n addVertexPositionConstraint();\n //add clause for every edge in graph to satisfy constraint of vertices not belonging to edge not part of successive positions\n addVertexNonEdgeConstraint();\n }", "private void markDuplicateRelationships(EntityInstanceImpl ei)\n {\n EntityInstanceImpl parent = ei.getParent();\n EntityDef entityDef = ei.getEntityDef();\n\n // Duplicate relationship searching phase I, see if a linked instance to\n // the target instance in the same object instance represents the\n // same relationship type AND has the same parent.\n for ( EntityInstanceImpl linked : ei.getLinkedInstances() )\n {\n // Check to make sure linked EI has a parent--it is possible for a root\n // to be flagged as included and we don't care about roots.\n if ( linked.isDeleted() || linked.getParent() == null )\n continue;\n\n if ( ei.isExcluded() )\n {\n if ( ! linked.isExcluded() )\n continue;\n }\n else\n {\n if ( ! linked.isIncluded() )\n continue;\n }\n\n EntityDef linkedEntityDef = linked.getEntityDef();\n\n // Linked EI must have the same relationship and it can't be derived.\n if ( linkedEntityDef.getErRelToken() == entityDef.getErRelToken() ||\n linkedEntityDef.isDerivedPath() )\n {\n continue;\n }\n\n // Now check to see if the parents are linked.\n EntityInstanceImpl linkParent = linked.getParent();\n for ( EntityInstanceImpl parentLinked : linkParent.getLinkedInstances() )\n {\n if ( parentLinked == parent )\n {\n if ( ei.isExcluded() )\n linked.dbhExcluded = true;\n else\n linked.dbhIncluded = true;\n\n break;\n }\n }\n } // for each linked instance...\n\n // Duplicate relationship searching, phase II, see if the parent of\n // the instance has a linked instance representing the same relationship\n // type which is also a child of one of the targets linked instances.\n\n // If the parent isn't linked then there are no duplicate relationships.\n if ( parent.getLinkedInstances().size() == 0 )\n return;\n\n for ( EntityInstanceImpl linked : parent.getLinkedInstances() )\n {\n // Check for appropriate include/exclude flag.\n if ( ei.isExcluded() )\n {\n if ( ! linked.isExcluded() )\n continue;\n }\n else\n {\n if ( ! linked.isIncluded() )\n continue;\n }\n\n EntityDef linkedEntityDef = linked.getEntityDef();\n\n // Check to see if the relationship for the EI linked to the parent is\n // the same as the relationship of the original EI.\n if ( linkedEntityDef.getErRelToken() != entityDef.getErRelToken() )\n continue; // Nope.\n\n // OK, we have an EI ('linked') that has the same relationship as\n // ei. Check to see if the parent of 'linked' (grandParent)\n // is linked with ei. If they are linked then 'linked'\n // has the same physical relationship as ei.\n EntityInstanceImpl grandParent = linked.getParent();\n for ( EntityInstanceImpl gp : ei.getLinkedInstances() )\n {\n if ( gp == grandParent )\n {\n if ( ei.isExcluded() )\n linked.dbhExcluded = true;\n else\n linked.dbhIncluded = true;\n\n break;\n }\n }\n } // for each linked instance of parent...\n }", "@Test\n public void cyclicalGraphs3Test() throws Exception {\n // Test graphs with multiple loops. g1 has two different loops, which\n // have to be correctly matched to g2 -- which is build in a different\n // order but is topologically identical to g1.\n\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"b\", \"c\" });\n\n // Create loop1 in g1, with the first 4 nodes.\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(3), Event.defTimeRelationStr);\n g1Nodes.get(3).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n\n // Create loop2 in g1, with the last 2 nodes, plus the initial node.\n g1Nodes.get(0).addTransition(g1Nodes.get(4), Event.defTimeRelationStr);\n g1Nodes.get(4).addTransition(g1Nodes.get(5), Event.defTimeRelationStr);\n g1Nodes.get(5).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n\n exportTestGraph(g1, 0);\n\n // //////////////////\n // Now create g2, by generating the two identical loops in the reverse\n // order.\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"b\", \"c\" });\n\n // Create loop2 in g2, with the last 2 nodes, plus the initial node.\n g2Nodes.get(0).addTransition(g2Nodes.get(4), Event.defTimeRelationStr);\n g2Nodes.get(4).addTransition(g2Nodes.get(5), Event.defTimeRelationStr);\n g2Nodes.get(5).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n\n // Create loop1 in g2, with the first 4 nodes.\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(2), Event.defTimeRelationStr);\n g2Nodes.get(2).addTransition(g2Nodes.get(3), Event.defTimeRelationStr);\n g2Nodes.get(3).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n\n exportTestGraph(g2, 1);\n\n // //////////////////\n // Now test that the two graphs are identical for all k starting at the\n // initial node.\n\n for (int k = 1; k < 7; k++) {\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), k);\n }\n }", "public void applyToAncestors( Operation operation ) {\n PlanNode ancestor = getParent();\n while (ancestor != null) {\n operation.apply(ancestor);\n ancestor = ancestor.getParent();\n }\n }", "public void logicCycles()throws Exception\r\n\t{\r\n\t\t\r\n\t\twhile(isSolved() == false)\r\n\t\t{\r\n\t\t\tint changesMade = 0;\r\n\t\t\tdo\r\n\t\t\t{\r\n\t\t\t\tchangesMade = 0;\r\n\t\t\t\tchangesMade += logic1();\r\n\t\t\t\tchangesMade += logic2();\r\n\t\t\t\tchangesMade += logic3();\r\n\t\t\t\tchangesMade += logic4();\r\n\t\t\t\tif(errorFound())\r\n\t\t\t\t\tbreak;\r\n\t\t\t}while(changesMade != 0);\r\n\t\r\n\t\t}\t\t\t\r\n\t\t\r\n\t}", "public void deduceRules()\n{\n List<RuleInstance> allrules = loadRules();\n\n List<UpodRule> rules = new ArrayList<UpodRule>();\n for (UpodRule ur : for_program.getRules()) {\n if (ur.isExplicit()) {\n\t rules.add(ur);\n\t RuleInstance ri = new RuleInstance(ur,from_world.getUniverse());\n\t allrules.add(ri);\n }\n }\n\n Set<Condition> allconds = getConditions(allrules);\n\n tree_root = new TreeNode(allrules,null);\n\n expandTree(tree_root,allconds);\n\n generateRules(tree_root);\n}", "public boolean reducible() {\n if (dfsTree.back.isEmpty()) {\n return true;\n }\n int size = controlFlow.transitions.length;\n boolean[] loopEnters = dfsTree.loopEnters;\n TIntHashSet[] cycleIncomings = new TIntHashSet[size];\n // really this may be array, since dfs already ensures no duplicates\n TIntArrayList[] nonCycleIncomings = new TIntArrayList[size];\n int[] collapsedTo = new int[size];\n int[] queue = new int[size];\n int top;\n for (int i = 0; i < size; i++) {\n if (loopEnters[i]) {\n cycleIncomings[i] = new TIntHashSet();\n }\n nonCycleIncomings[i] = new TIntArrayList();\n collapsedTo[i] = i;\n }\n\n // from whom back connections\n for (Edge edge : dfsTree.back) {\n cycleIncomings[edge.to].add(edge.from);\n }\n // from whom ordinary connections\n for (Edge edge : dfsTree.nonBack) {\n nonCycleIncomings[edge.to].add(edge.from);\n }\n\n for (int w = size - 1; w >= 0 ; w--) {\n top = 0;\n // NB - it is modified later!\n TIntHashSet p = cycleIncomings[w];\n if (p == null) {\n continue;\n }\n TIntIterator iter = p.iterator();\n while (iter.hasNext()) {\n queue[top++] = iter.next();\n }\n\n while (top > 0) {\n int x = queue[--top];\n TIntArrayList incoming = nonCycleIncomings[x];\n for (int i = 0; i < incoming.size(); i++) {\n int y1 = collapsedTo[incoming.getQuick(i)];\n if (!dfsTree.isDescendant(y1, w)) {\n return false;\n }\n if (y1 != w && p.add(y1)) {\n queue[top++] = y1;\n }\n }\n }\n\n iter = p.iterator();\n while (iter.hasNext()) {\n collapsedTo[iter.next()] = w;\n }\n }\n\n return true;\n }", "private List<Set<GraphChange>> findChanges(Map<Collection<Node>, List<PossibleDConnectingPath>> paths) {\n List<Set<GraphChange>> pagChanges = new ArrayList<>();\n\n Set<Map.Entry<Collection<Node>, List<PossibleDConnectingPath>>> entries = paths.entrySet();\n /* Loop through each entry, ie each conditioned set of variables. */\n for (Map.Entry<Collection<Node>, List<PossibleDConnectingPath>> entry : entries) {\n Collection<Node> conditions = entry.getKey();\n List<PossibleDConnectingPath> dConnecting = entry.getValue();\n\n /* loop through each path */\n for (PossibleDConnectingPath possible : dConnecting) {\n List<Node> possPath = possible.getPath();\n /* Created with 2*# of undirectedPaths as appoximation. might have to increase size once */\n Set<GraphChange> pathChanges = new HashSet<>(2 * possPath.size());\n\n /* find those conditions which are not along the path (used in colider) */\n List<Node> outsidePath = new ArrayList<>(conditions.size());\n for (Node condition : conditions) {\n if (!possPath.contains(condition))\n outsidePath.add(condition);\n }\n\n /* Walk through path, node by node */\n for (int i = 0; i < possPath.size() - 1; i++) {\n Node current = possPath.get(i);\n Node next = possPath.get(i + 1);\n GraphChange gc;\n\n /* for each pair of nodes, add the operation to remove their edge */\n gc = new GraphChange();\n gc.addRemove(possible.getPag().getEdge(current, next));\n pathChanges.add(gc);\n\n /* for each triple centered on a node which is an element of the conditioning\n * set, add the operation to orient as a nonColider around that node */\n if (conditions.contains(current) && i > 0) {\n gc = new GraphChange();\n Triple nonColider = new Triple(possPath.get(i - 1), current, next);\n gc.addNonCollider(nonColider);\n pathChanges.add(gc);\n }\n\n /* for each node on the path not in the conditioning set, make a colider. It\n * is necessary though to ensure that there are no undirectedPaths implying that a\n * conditioned variable (even outside the path) is a decendant of a colider */\n if ((!conditions.contains(current)) && i > 0) {\n Triple colider = new Triple(possPath.get(i - 1), current, next);\n\n if (possible.getPag().isUnderlineTriple(possPath.get(i - 1), current, next))\n continue;\n\n Edge edge1 = possible.getPag().getEdge(colider.getX(), colider.getY());\n Edge edge2 = possible.getPag().getEdge(colider.getZ(), colider.getY());\n\n if (edge1.getNode1().equals(colider.getY())) {\n if (edge1.getEndpoint1().equals(Endpoint.TAIL)) {\n continue;\n }\n } else if (edge1.getNode2().equals(colider.getY())) {\n if (edge1.getEndpoint2().equals(Endpoint.TAIL)) {\n continue;\n }\n }\n\n if (edge2.getNode1().equals(colider.getY())) {\n if (edge2.getEndpoint1().equals(Endpoint.TAIL)) {\n continue;\n }\n } else if (edge2.getNode2().equals(colider.getY())) {\n if (edge2.getEndpoint2().equals(Endpoint.TAIL)) {\n continue;\n }\n }\n\n /* Simple case, no conditions outside the path, so just add colider */\n if (outsidePath.size() == 0) {\n gc = new GraphChange();\n gc.addCollider(colider);\n pathChanges.add(gc);\n continue;\n }\n\n /* ensure nondecendency in possible path between getModel and each conditioned\n * variable outside the path */\n for (Node outside : outsidePath) {\n\n /* list of possible decendant undirectedPaths */\n\n List<PossibleDConnectingPath> decendantPaths = new ArrayList<>();\n decendantPaths\n = PossibleDConnectingPath.findDConnectingPaths\n (possible.getPag(), current, outside, new ArrayList<Node>());\n\n if (decendantPaths.isEmpty()) {\n gc = new GraphChange();\n gc.addCollider(colider);\n pathChanges.add(gc);\n continue;\n }\n\n /* loop over each possible path which might indicate decendency */\n for (PossibleDConnectingPath decendantPDCPath : decendantPaths) {\n List<Node> decendantPath = decendantPDCPath.getPath();\n\n /* walk down path checking orientation (path may already\n * imply non-decendency) and creating changes if need be*/\n boolean impliesDecendant = true;\n Set<GraphChange> colideChanges = new HashSet<>();\n for (int j = 0; j < decendantPath.size() - 1; j++) {\n Node from = decendantPath.get(j);\n // chaneges from +1\n Node to = decendantPath.get(j + 1);\n Edge currentEdge = possible.getPag().getEdge(from, to);\n\n if (currentEdge.getEndpoint1().equals(Endpoint.ARROW)) {\n impliesDecendant = false;\n break;\n }\n\n gc = new GraphChange();\n gc.addCollider(colider);\n gc.addRemove(currentEdge);\n colideChanges.add(gc);\n\n gc = new GraphChange();\n gc.addCollider(colider);\n gc.addOrient(to, from);\n colideChanges.add(gc);\n }\n if (impliesDecendant)\n pathChanges.addAll(colideChanges);\n }\n }\n }\n }\n\n pagChanges.add(pathChanges);\n }\n }\n return pagChanges;\n }", "@Test\n public void cyclicalGraphs1Test() throws Exception {\n // NOTE: we can't use the parser to create a circular graph because\n // vector clocks are partially ordered and do not admit cycles. So we\n // have to create circular graphs manually.\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"a\",\n \"a\" });\n // Create a loop in g1, with 3 nodes\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g1, 0);\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"a\" });\n // Create a loop in g2, with 2 nodes\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g2, 1);\n\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 1);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 2);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 3);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 4);\n\n ChainsTraceGraph g3 = new ChainsTraceGraph();\n List<EventNode> g3Nodes = addNodesToGraph(g2, new String[] { \"a\" });\n // Create a loop in g3, from a to itself\n g3Nodes.get(0).addTransition(g3Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g3, 2);\n\n testKEqual(g3Nodes.get(0), g2Nodes.get(0), 1);\n testKEqual(g3Nodes.get(0), g2Nodes.get(0), 2);\n testKEqual(g3Nodes.get(0), g2Nodes.get(0), 3);\n\n ChainsTraceGraph g4 = new ChainsTraceGraph();\n List<EventNode> g4Nodes = addNodesToGraph(g2, new String[] { \"a\" });\n exportTestGraph(g4, 2);\n\n testKEqual(g4Nodes.get(0), g2Nodes.get(0), 1);\n testNotKEqual(g4Nodes.get(0), g2Nodes.get(0), 2);\n testNotKEqual(g4Nodes.get(0), g2Nodes.get(0), 3);\n testNotKEqual(g4Nodes.get(0), g2Nodes.get(0), 4);\n }", "@Test\n\t\tpublic void applyRecursivelyGoal() {\n\t\t\tassertSuccess(\" ;H; ;S; s ⊆ ℤ |- r∈s ↔ s\",\n\t\t\t\t\trm(\"\", ri(\"\", rm(\"2.1\", empty))));\n\t\t}", "private SchedulePaths calculateAllPaths(final SchedulePaths schedulePaths, final Set<Edge> path,\n final Operation operation) {\n\n final Set<Edge> parentEdges;\n if (operation instanceof EndVertex) {\n parentEdges = ((EndVertex) operation).getEndParentEdges();\n } else {\n parentEdges = operation.getParentEdges();\n }\n\n LOG.trace(\"Checking operation J: {}, M: {}\", operation.getJob(), operation.getMachine());\n LOG.trace(\"Number of parent edges: {}\", parentEdges.size());\n\n //Runs while not root operation\n if (!parentEdges.isEmpty()) {\n\n //Gets maximum edge size\n Integer maxEdge = 0;\n for (final Edge edge : parentEdges) {\n\n if (path.contains(edge)) {\n LOG.trace(\"Detected loop\");\n LOG.trace(\"Loop parent: {}\\n From path: {}\", edge.toString(), path.toString());\n schedulePaths.setIsFeasible(false);\n schedulePaths.setNodeCausingCycle(edge);\n\n return schedulePaths;\n }\n\n LOG.trace(\"Parent of operation: J:{} M:{}\", edge.getOperationFrom().getJob(), edge.getOperationFrom()\n .getMachine());\n if (edge.getMaxDistanceToMe() > maxEdge) {\n maxEdge = edge.getMaxDistanceToMe();\n }\n }\n\n LOG.trace(\"Maximum edge is {}\", maxEdge);\n\n Set<Edge> pathCopy = null;\n boolean firstEdge = true;\n for (final Edge edge : parentEdges) {\n\n if (Objects.equals(edge.getMaxDistanceToMe(), maxEdge)) {\n\n LOG.trace(\"Edge: {} maxd: {}\", edge, edge.getMaxDistanceToMe());\n\n if (firstEdge) {\n\n pathCopy = new LinkedHashSet<>(path);\n\n path.add(edge);\n LOG.trace(\"Adding edge: {}\", edge);\n firstEdge = false;\n calculateAllPaths(schedulePaths, path, edge.getOperationFrom());\n } else {\n\n final Set<Edge> newPath = new LinkedHashSet<>(pathCopy);\n LOG.trace(\"Creating new path, copying: {}\", pathCopy);\n\n newPath.add(edge);\n LOG.trace(\"New Path copy, adding edge: {}\", edge);\n calculateAllPaths(schedulePaths, newPath, edge.getOperationFrom());\n }\n }\n }\n } else {\n\n LOG.trace(\"Added new path to path set.\");\n schedulePaths.addPath(path);\n }\n\n return schedulePaths;\n }", "@Test\n public void shouldThrowCyclicDependencyExceptionIfACycleIsDetected_DownstreamOfCurrentWasUpstreamOfCurrentAtSomePoint() {\n String grandParent = \"grandParent\";\n String parent = \"parent\";\n String child = \"child\";\n String currentPipeline = \"current\";\n ValueStreamMap graph = new ValueStreamMap(currentPipeline, null);\n graph.addDownstreamNode(new PipelineDependencyNode(child, child), currentPipeline);\n graph.addDownstreamNode(new PipelineDependencyNode(grandParent, grandParent), child);\n graph.addUpstreamNode(new PipelineDependencyNode(parent, parent), null, currentPipeline);\n graph.addUpstreamNode(new PipelineDependencyNode(grandParent, grandParent), null, parent);\n graph.addUpstreamMaterialNode(new SCMDependencyNode(\"g\",\"g\",\"git\") , null, grandParent, new MaterialRevision(null));\n graph.addUpstreamMaterialNode(new SCMDependencyNode(\"g\",\"g\",\"git\") , null, parent, new MaterialRevision(null));\n\n assertThat(graph.hasCycle(), is(true));\n }", "private void doOneUpdateStep(){\r\n SparseFractalSubTree target = null; //stores the tree which will receive the update\r\n for (int i = 0; i < subTrees.length - 1; i++) { //top tree never receives an update (reason for -1)\r\n SparseFractalSubTree subTree = subTrees[i];\r\n if (!subTree.hasStopped()) { //not permanently or temporary finished\r\n if (target != null) { //are we the first tree who can receive an update\r\n if ((subTree.getTailHeight() < target.getTailHeight())) { //are we a better candidate then the last one?\r\n target = subTree;\r\n }\r\n } else { //we are the first not finished subtree, so we receive the update if no better candidate is found\r\n target = subTree;\r\n }\r\n\r\n }\r\n }\r\n assert (target != null);\r\n assert (check(target)); //check all the assumptions\r\n\r\n measureDynamicSpace(); //measure\r\n\r\n target.updateTreeHashLow(); //apply a update to the target\r\n }", "public static void checkCycleSample() {\n Node ll1_5 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n\n Node ll1_2 = new Node(1, new Node(2, null));\n Node ll3_4 = new Node(3, new Node(4, null));\n Node ll5_6 = new Node(5, new Node(6, null));\n ll1_2.nextNode.nextNode = ll3_4;\n ll3_4.nextNode.nextNode = ll5_6;\n ll5_6.nextNode.nextNode = ll1_2;\n\n ll1_2.checkCycle();\n ll1_5.checkCycle();\n }", "private void doBasicUpdate(){\n for (int i = 0; i < subTrees.length - 1; i++) { //top tree never receives an update (reason for -1)\r\n if(!subTrees[i].hasStopped()) {\r\n doOneUpdateStep() ;\r\n }\r\n }\r\n }", "private void generateRules(TreeNode tn)\n{\n if (!tn.isLeaf()) {\n generateRules(tn.getPassTree());\n generateRules(tn.getFailTree());\n return;\n }\n RuleInstance ri = tn.getRules().get(0);\n if (ri.getBaseRule() != null) return;\t// rule already in set\n\n Condition c = tn.getCondition();\n List<UpodCondition> cset = new ArrayList<UpodCondition>();\n if (c != null) {\n UpodCondition cond = c.getConditionTest(for_program);\n if (cond != null) cset.add(cond);\n }\n for (TreeNode pn = tn.getParent(); pn != null; pn = pn.getParent()) {\n Condition pc = pn.getCondition();\n if (pc == null) continue;\n UpodCondition pcond = pc.getConditionTest(for_program);\n if (pcond != null) cset.add(pcond);\n }\n\n UpodCondition rcond = null;\n if (cset.isEmpty()) return;\n if (cset.size() == 1) rcond = cset.get(0);\n else {\n UpodCondition [] conds = new UpodCondition[cset.size()];\n conds = cset.toArray(conds);\n rcond = new BasisConditionLogical.And(conds);\n }\n List<UpodAction> racts = ri.getActions();\n if (rcond == null || racts == null) return;\n\n BasisRule rule = new BasisRule(rcond,racts,null,100);\n for_program.addRule(rule);\n}", "@Test\n public void cyclicalGraphs2Test() throws Exception {\n // Test history tracking -- the \"last a\" in g1 and g2 below and\n // different kinds of nodes topologically. At k=4 this becomes apparent\n // with kTails, if we start at the first 'a'.\n\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"b\",\n \"c\", \"d\" });\n // Create a loop in g1, with 4 nodes\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(3), Event.defTimeRelationStr);\n g1Nodes.get(3).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g1, 0);\n\n // g1.a is k-equivalent to g1.a for all k\n for (int k = 1; k < 6; k++) {\n testKEqual(g1Nodes.get(0), g1Nodes.get(0), k);\n }\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"a\" });\n // Create a chain from a to a'.\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(2), Event.defTimeRelationStr);\n g2Nodes.get(2).addTransition(g2Nodes.get(3), Event.defTimeRelationStr);\n g2Nodes.get(3).addTransition(g2Nodes.get(4), Event.defTimeRelationStr);\n exportTestGraph(g2, 1);\n\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 1);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 2);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 3);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 4);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 5);\n\n testNotKEqual(g1Nodes.get(0), g2Nodes.get(0), 6);\n testNotKEqual(g1Nodes.get(0), g2Nodes.get(0), 7);\n }", "public void calculateForces()\n {\n Stack<CelestialBody> stack = new Stack<>();\n stack = this.root.iterate(stack);\n\n OctreeIterator iterator = new OctreeIterator(stack);\n root.calculateForces(root, iterator);\n }", "@SuppressWarnings(\"unchecked\")\n\t@Override\n\tprotected final void processWhenNotUpdated(Node node) {\n\t\tboolean propagateFurther = false;\n\t\tNodeInfo nodeInfo = node.getInfo();\n\t\tCollection<Node> predecessors = nodeInfo.getCFGInfo().getInterProceduralLeafPredecessors();\n\t\tF newIN = (F) nodeInfo.getIN(analysisName);\n\t\tif (newIN == null) {\n\t\t\t/*\n\t\t\t * In this scenario, we must set the propagation flag, so that\n\t\t\t * all successors are processed at least once.\n\t\t\t */\n\t\t\tpropagateFurther = true;\n\t\t\tif (predecessors.isEmpty()) {\n\t\t\t\tnewIN = this.getEntryFact();\n\t\t\t} else {\n\t\t\t\tnewIN = this.getTop();\n\t\t\t}\n\t\t}\n\n\t\tboolean inChanged = false;\n\t\tif (this.analysisName == AnalysisName.CROSSCALL_PREDICATE_ANALYSIS && node instanceof PostCallNode) {\n\t\t\t// A small hack here.\n\t\t\tPostCallNode postNode = (PostCallNode) node;\n\t\t\tList<FunctionDefinition> funcDef = postNode.getParent().getInfo().getCalledDefinitions();\n\t\t\tif (funcDef.isEmpty() || funcDef.stream().noneMatch(f -> this.functionWithBarrier.contains(f))) {\n\t\t\t\tpredecessors = new HashSet<>();\n\t\t\t\tpredecessors.add(postNode.getParent().getPreCallNode());\n\t\t\t}\n\t\t}\n\t\tfor (Node predNode : predecessors) {\n\t\t\tF predOUT = (F) predNode.getInfo().getOUT(analysisName);\n\t\t\tif (predOUT == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tF edgeOUT = this.edgeTransferFunction(predOUT, predNode, node);\n\t\t\tinChanged |= newIN.merge(edgeOUT, null);\n\t\t}\n\n\t\tif (node instanceof PostCallNode) {\n\t\t\tinChanged |= processPostCallNodesIN((PostCallNode) node, newIN);\n\t\t}\n\n\t\tnodeInfo.setIN(analysisName, newIN);\n\n\t\t// Step 2: Apply the flow-function on IN, to obtain the OUT.\n\t\tF newOUT = node.accept(this, newIN);\n\t\tnodeInfo.setOUT(analysisName, newOUT);\n\n\t\t// Step 3: Process the successors, if needed.\n\t\tpropagateFurther |= inChanged;\n\t\tif (propagateFurther) {\n\t\t\tglobalWorkList.addAll(nodeInfo.getCFGInfo().getInterProceduralLeafSuccessors());\n\t\t\tif (node instanceof PreCallNode) {\n\t\t\t\tPreCallNode pre = (PreCallNode) node;\n\t\t\t\tthis.globalWorkList.add(pre.getParent().getPostCallNode());\n\t\t\t}\n\t\t\t// If we are adding successors of a BeginNode of a FunctionDefinition, we should\n\t\t\t// add all the ParameterDeclarations.\n\t\t\tif (node instanceof BeginNode && node.getParent() instanceof FunctionDefinition) {\n\t\t\t\tFunctionDefinition func = (FunctionDefinition) node.getParent();\n\t\t\t\tfor (ParameterDeclaration paramDecl : func.getInfo().getCFGInfo().getParameterDeclarationList()) {\n\t\t\t\t\tthis.globalWorkList.add(paramDecl);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void pruneRules_cbaLike() {\n LOGGER.info(\"STARTED Postpruning\");\n //HashMap<ExtendRule,Integer> ruleErrors = new HashMap();\n //HashMap<ExtendRule,AttributeValue> ruleDefClass = new HashMap();\n ArrayList<ExtendRule> rulesToRemove = new ArrayList(); \n int totalErrorsWithoutDefault = 0; \n AttributeValue defClassForLowestTotalErrorsRule = getDefaultRuleClass();\n int lowestTotalErrors = getDefaultRuleError(defClassForLowestTotalErrorsRule);;\n ExtendRule lowestTotalErrorsRule = null;\n // DETERMINE TOTAL ERROR AND DEFAULT CLASS ASSOCIATED WITH EACH RULE \n // REMOVE RULES MATCHING ZERO TRANSACTIONS AND OF ZERO LENGTH\n for (Iterator<ExtendRule> it = extendedRules.iterator(); it.hasNext();) {\n\n ExtendRule rule = it.next();\n rule.updateQuality();\n rule.setQualityInRuleList(rule.getRuleQuality());\n if (LOGGER.isLoggable(Level.FINE)) {\n LOGGER.log(Level.FINE, \"Processing rule {0}\", rule.toString());\n }\n\n if (rule.getAntecedentLength() == 0) {\n LOGGER.fine(\"Rule of length 0, MARKED FOR REMOVAL\");\n rulesToRemove.add(rule); //covered transactions should not be removed\n } \n else if (rule.getRuleQuality().getA() == 0)\n {\n LOGGER.fine(\"Rule classifying 0 instances correctly, MARKED FOR REMOVAL\");\n rulesToRemove.add(rule); //covered transactions should not be removed \n }\n else\n {\n rule.removeTransactionsCoveredByAntecedent(true); \n totalErrorsWithoutDefault = totalErrorsWithoutDefault + rule.getRuleQuality().getB();\n // since transactions matching the current rule have been removed, the default class and error can change\n AttributeValue newDefClass = getDefaultRuleClass();\n int newDefError = getDefaultRuleError(newDefClass);\n int totalErrorWithDefault = newDefError + totalErrorsWithoutDefault;\n if (totalErrorWithDefault < lowestTotalErrors)\n {\n lowestTotalErrors = totalErrorWithDefault;\n lowestTotalErrorsRule = rule;\n defClassForLowestTotalErrorsRule= newDefClass;\n } \n //ruleErrors.put(rule,totalErrorWithDefault );\n //ruleDefClass.put(rule, newDefClass); \n }\n \n }\n boolean removeTail;\n // now we know the errors associated with each rule not marked for removal, we can perform pruning\n if (lowestTotalErrorsRule == null)\n {\n // no rule improves error over a classifier composed of only default rule\n // remove all rules\n removeTail = true;\n }\n else \n {\n removeTail = false;\n }\n \n data.getDataTable().unhideAllTransactions();\n for (Iterator<ExtendRule> it = extendedRules.iterator(); it.hasNext();) {\n ExtendRule rule = it.next();\n if (rulesToRemove.contains(rule) || removeTail)\n {\n it.remove();\n continue;\n }\n if (rule.equals(lowestTotalErrorsRule))\n {\n removeTail = true;\n }\n rule.updateQuality(); \n }\n \n \n if (LOGGER.isLoggable(Level.FINE)) {\n LOGGER.fine(\"Creating new default rule within narrow rule procedure\");\n }\n \n \n extendedRules.add(createNewDefaultRule(defClassForLowestTotalErrorsRule));\n \n \n LOGGER.info(\"FINISHED Postpruning\");\n }", "public void pruneRules_greedy() {\n LOGGER.info(\"STARTED Postpruning\");\n AttributeValue defClass = getDefaultRuleClass();\n int defError = getDefaultRuleError(defClass);\n boolean removeTail=false;\n for (Iterator<ExtendRule> it = extendedRules.iterator(); it.hasNext();) {\n\n ExtendRule rule = it.next();\n rule.updateQuality();\n if (LOGGER.isLoggable(Level.FINE)) {\n LOGGER.log(Level.FINE, \"#Rule {0}\", rule.toString());\n }\n \n if (removeTail)\n {\n it.remove();\n }\n else if (rule.getAntecedentLength() == 0) {\n it.remove();\n } \n else if (rule.getRuleQuality().getA() == 0)\n {\n it.remove();\n }\n else\n {\n int supportingTransactions = rule.removeTransactionsCoveredByAntecedent(true);\n AttributeValue newDefClass = getDefaultRuleClass();\n int newDefError = getDefaultRuleError(newDefClass);\n if (defError<=newDefError)\n {\n //adding the current rule did not decrease the errors compared to a default rule\n it.remove();\n removeTail=true;\n }\n else{\n LOGGER.log(Level.FINE, \"{0} transactions, RULE {1} KEPT\", new Object[]{supportingTransactions, rule.getRID()});\n defClass = newDefClass;\n defError = newDefError;\n } \n }\n \n \n\n\n }\n LOGGER.fine(\"Creating new Extend rule within narrow rule procedure\");\n extendedRules.add(createNewDefaultRule(defClass));\n LOGGER.info(\"FINISHED Postpruning\");\n }", "public Set<OWLLogicalAxiom> canWeDoBetter(){\n\t\tSet<Set<OWLClass>> largeSCCs =\n\t\t\t\ttarj.getStronglyConnectComponents().\n\t\t\t\t\t\tstream().\n\t\t\t\t\t\tfilter(x -> x.size() > 1).\n\t\t\t\t\t\tcollect(Collectors.toSet());\n\n\t\t//Add all those axioms which use their own definition on the RHS\n\t\tSet<OWLLogicalAxiom> cycleCausing = new HashSet<>();\n\t\tcycleCausing.addAll(builder.getSelfDefinedAxioms());\n\n\t\tfor(OWLLogicalAxiom axiom : axioms){\n\t\t\tOWLClass name = (OWLClass) AxiomSplitter.getNameofAxiom(axiom);\n\t\t\t\tfor(Set<OWLClass> component : largeSCCs){\n\t\t\t\t\tif(component.contains(name)){\n\t\t\t\t\t\tOWLClassExpression def = AxiomSplitter.getDefinitionofAxiom(axiom);\n\t\t\t\t\t\tSet<OWLClass> defCls = ModuleUtils.getNamedClassesInSignature(def);\n\t\t\t\t\t\tSet<OWLClass> inter = Sets.intersection(component, defCls);\n\t\t\t\t\t\tif(!inter.isEmpty()){\n\t\t\t\t\t\t\tcycleCausing.add(axiom);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\treturn cycleCausing;\n\t}", "protected void setMeAndMyParentsAsDirty() {\n dirtyS = true;\n modelRoot.incrementNumberOfDirtySNodes();\n dirtyD = true;\n modelRoot.incrementNumberOfDirtyDNodes();\n if (parent != null) {\n parent.setMeAndMyParentsAsDirty();\n }\n }", "int isCycle( Graph graph){\n int parent[] = new int[graph.V]; \n \n // Initialize all subsets as single element sets \n for (int i=0; i<graph.V; ++i) \n parent[i]=-1; \n \n // Iterate through all edges of graph, find subset of both vertices of every edge, if both subsets are same, then there is cycle in graph. \n for (int i = 0; i < graph.E; ++i){ \n int x = graph.find(parent, graph.edge[i].src); \n int y = graph.find(parent, graph.edge[i].dest); \n \n if (x == y) \n return 1; \n \n graph.Union(parent, x, y); \n } \n return 0; \n }", "@Override\n\t@SuppressWarnings(\"unchecked\")\n\tprotected final void processWhenUpdated(Node node) {\n\t\tboolean first = false;\n\t\tif (!this.safeCurrentSCCNodes.contains(node)) {\n\t\t\tfirst = true;\n\t\t\t// Don't add the node to this set unless its OUT has been populated.\n\t\t}\n\t\tNodeInfo nodeInfo = node.getInfo();\n\t\tCollection<Node> predecessors;\n\t\tpredecessors = nodeInfo.getCFGInfo().getInterProceduralLeafPredecessors();\n\t\tF oldIN = (F) nodeInfo.getIN(analysisName);\n\t\tboolean propagateFurther = false;\n\t\tF newIN;\n\t\tif (oldIN == null) {\n\t\t\t// First processing ever of this node!\n\t\t\tpropagateFurther = true;\n\t\t\tnewIN = (predecessors.isEmpty()) ? newIN = this.getEntryFact() : this.getTop();\n\t\t} else if (first) {\n\t\t\t// First processing in the first round of update.\n\t\t\tnewIN = (predecessors.isEmpty()) ? newIN = this.getEntryFact() : this.getTop();\n\t\t} else {\n\t\t\tnewIN = oldIN; // Use the same object.\n\t\t}\n\n\t\tboolean inChanged = false;\n\t\tif (this.analysisName == AnalysisName.CROSSCALL_PREDICATE_ANALYSIS && node instanceof PostCallNode) {\n\t\t\t// A small hack here.\n\t\t\tPostCallNode postNode = (PostCallNode) node;\n\t\t\tList<FunctionDefinition> funcDef = postNode.getParent().getInfo().getCalledDefinitions();\n\t\t\tif (funcDef.isEmpty() || funcDef.stream().noneMatch(f -> this.functionWithBarrier.contains(f))) {\n\t\t\t\tpredecessors = new HashSet<>();\n\t\t\t\tpredecessors.add(postNode.getParent().getPreCallNode());\n\t\t\t}\n\t\t}\n\t\tboolean anyPredMissed = false;\n\t\tfor (Node predNode : predecessors) {\n\t\t\t/*\n\t\t\t * Ignore a predecessor if:\n\t\t\t * (i) it lies within the SCC, AND\n\t\t\t * (ii) it has not been processed yet.\n\t\t\t */\n\t\t\tSCC predSCC = predNode.getInfo().getCFGInfo().getSCC();\n\t\t\tif (predSCC != null) {\n\t\t\t\t// If null, then pred clearly belongs to some other SCC.\n\t\t\t\tif (node.getInfo().getCFGInfo().getSCC() == predSCC) {\n\t\t\t\t\t// Predecessor lies within the SCC.\n\t\t\t\t\tif (!this.safeCurrentSCCNodes.contains(predNode)) {\n\t\t\t\t\t\tanyPredMissed = true;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tF predOUT = (F) predNode.getInfo().getOUT(analysisName);\n\t\t\tif (predOUT == null) {\n\t\t\t\t/*\n\t\t\t\t * Here, we do not mark anyPredMissed, as this node would be\n\t\t\t\t * marked for processing whenever the predecessor has been\n\t\t\t\t * processed for the first time. Check the setting of\n\t\t\t\t * propagateFurther above.\n\t\t\t\t */\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tF edgeOUT = this.edgeTransferFunction(predOUT, predNode, node);\n\t\t\tinChanged |= newIN.merge(edgeOUT, null);\n\t\t}\n\n\t\tif (node instanceof PostCallNode) {\n\t\t\tPreCallNode preNode = ((CallStatement) node.getParent()).getPreCallNode();\n\t\t\tSCC preSCC = preNode.getInfo().getCFGInfo().getSCC();\n\t\t\tboolean doNotProcess = false;\n\t\t\tif (preSCC != null) {\n\t\t\t\t// If null, then pred clearly belongs to some other SCC.\n\t\t\t\tif (node.getInfo().getCFGInfo().getSCC() == preSCC) {\n\t\t\t\t\t// Predecessor lies within the SCC.\n\t\t\t\t\tif (!this.safeCurrentSCCNodes.contains(preNode)) {\n\t\t\t\t\t\tanyPredMissed = true;\n\t\t\t\t\t\tdoNotProcess = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!doNotProcess) {\n\t\t\t\tinChanged |= processPostCallNodesIN((PostCallNode) node, newIN);\n\t\t\t}\n\n\t\t}\n\t\tif (anyPredMissed) {\n\t\t\tthis.underApproximated.add(node);\n\t\t} else {\n\t\t\tthis.underApproximated.remove(node);\n\t\t}\n\t\tnodeInfo.setIN(analysisName, newIN);\n\n\t\t// Step 2: Apply the flow-function on IN, to obtain the OUT.\n\t\tF newOUT;\n\t\tnewOUT = node.accept(this, newIN);\n\t\tnodeInfo.setOUT(analysisName, newOUT);\n\t\tthis.safeCurrentSCCNodes.add(node); // Mark a node as processed only after its OUT has been \"purified\".\n\n\t\t// Step 3: Process the successors.\n\t\tpropagateFurther |= inChanged;\n\t\tif (propagateFurther) {\n\t\t\tthis.globalWorkList.addAll(nodeInfo.getCFGInfo().getInterProceduralLeafSuccessors());\n\t\t\tif (node instanceof PreCallNode) {\n\t\t\t\tPreCallNode pre = (PreCallNode) node;\n\t\t\t\tthis.globalWorkList.add(pre.getParent().getPostCallNode());\n\t\t\t}\n\t\t\t// If we are adding successors of a BeginNode of a FunctionDefinition, we should\n\t\t\t// add all the ParameterDeclarations.\n\t\t\tif (node instanceof BeginNode && node.getParent() instanceof FunctionDefinition) {\n\t\t\t\tFunctionDefinition func = (FunctionDefinition) node.getParent();\n\t\t\t\tfor (ParameterDeclaration paramDecl : func.getInfo().getCFGInfo().getParameterDeclarationList()) {\n\t\t\t\t\tthis.globalWorkList.add(paramDecl);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void updateSingles(Hierarchy con, ViolatedCandidate lCandidate, ViolatedCandidate tCandidate,\n double delta) {\n Multiset<Constraint> targetPreferringView = UpdateUtils.getViolatedByLearner(lCandidate, tCandidate);\n Multiset<Constraint> learnerPreferringView = UpdateUtils.getViolatedByTarget(lCandidate, tCandidate);\n Multiset<Constraint> learnerPreferringHigh = HashMultiset.create(learnerPreferringView.size());\n double promoteWeightedDelta = delta / targetPreferringView.size();\n double maxTPreferringRanking = Double.MIN_VALUE;\n for (Constraint constraint : targetPreferringView.elementSet()) {\n maxTPreferringRanking = Math.max(maxTPreferringRanking, con.getRanking(constraint));\n double multipliedDelta = (targetPreferringView.count(constraint) * promoteWeightedDelta);\n con.changeConstraintRanking(constraint, multipliedDelta);\n }\n\n for (Constraint constraint : learnerPreferringView.elementSet()) {\n double thisRanking = con.getRanking(constraint);\n if (thisRanking > maxTPreferringRanking) {\n int count = learnerPreferringView.count(constraint);\n learnerPreferringHigh.add(constraint, count);\n }\n }\n // If 'higher' set is empty, just add argMax to it\n if (learnerPreferringHigh.isEmpty()) {\n Constraint argMax = UpdateUtils.getMax(learnerPreferringView, con);\n learnerPreferringHigh.add(argMax);\n }\n\n Multiset<Constraint> toIterateOver = learnerPreferringHigh;\n\n double demoteWeightedDelta = -(delta / toIterateOver.size());\n for (Constraint constraint : toIterateOver.elementSet()) {\n double multipliedDelta = toIterateOver.count(constraint) * demoteWeightedDelta;\n con.changeConstraintRanking(constraint, multipliedDelta);\n // System.out.println(\"↓ Updating \" + constraint +\" by \" +\n // multipliedDelta);\n }\n }", "public void resetParents() {\r\n }", "private void adjustPathConditions() {\n List<ProgramCondition> pcList;\n for (ProgramPath pp : progPath){\n pcList = pp.getConditions();\n final List<ProgramCondition> pcList2 = pcList;\n List<ProgramCondition> collect = pcList2.stream().filter(p -> (pcList2.stream().anyMatch(q -> q.condition.equals(p.condition) \n && q.pred == ProgramConditionTruthValue.False && p.pred == ProgramConditionTruthValue.True))).collect(Collectors.toList());\n \n collect.forEach(p -> p.z3Allowable = false);\n }\n }", "private void phaseOne(){\r\n\r\n\t\twhile (allNodes.size() < endSize){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//Pick a random node from allNodes\r\n\t\t\t\tint idx = random.nextInt(allNodes.size());\r\n\t\t\t\tNode node = allNodes.get(idx);\r\n\r\n\t\t\t\t//Get all relationships of node\t\t\t\t\r\n\t\t\t\tIterable<Relationship> ite = node.getRelationships(Direction.BOTH);\r\n\t\t\t\tList<Relationship> tempRels = new ArrayList<Relationship>();\r\n\r\n\t\t\t\t//Pick one of the relationships uniformly at random.\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\ttempRels.add(rel);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tidx = random.nextInt(tempRels.size());\r\n\t\t\t\tRelationship rel = tempRels.get(idx);\r\n\t\t\t\tNode neighbour = rel.getOtherNode(node);\r\n\r\n\t\t\t\t//Add the neighbour to allNodes\r\n\t\t\t\tif (!allNodes.contains(neighbour)){\r\n\t\t\t\t\tallNodes.add(neighbour);\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttx.success();\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t\t//If reached here, then phase one completed successfully.\r\n\t\treturn;\r\n\t}", "private static void traversals(Node root) {\n\t\tSystem.out.println(\"Node Pre \" + root.data);\n\t\tfor(Node child : root.children) {\n\t\t\tSystem.out.println(\"Edge Pre \" + root.data + \"--\" + child.data);\n\t\t\ttraversals(child);\n\t\t\tSystem.out.println(\"Edge Post \" + root.data + \"--\" + child.data);\n\t\t}\n\t\tSystem.out.println(\"Node Post \" + root.data);\n\t}", "private void reachable(Set s) {\n for (Iterator i = this.succ.iterator(); i.hasNext(); ) {\n IdentityHashCodeWrapper ap = (IdentityHashCodeWrapper)i.next();\n if (!s.contains(ap)) {\n s.add(ap);\n ((AccessPath)ap.getObject()).reachable(s);\n }\n }\n }", "@Test\n public void shouldUpdateDependentWhileAddingDownstreamIfNodeAlreadyPresent(){\n String p1 = \"p1\";\n String p2 = \"p2\";\n String p3 = \"p3\";\n ValueStreamMap graph = new ValueStreamMap(p1, null);\n graph.addDownstreamNode(new PipelineDependencyNode(p2, p2), p1);\n graph.addDownstreamNode(new PipelineDependencyNode(p3, p3), p2);\n graph.addDownstreamNode(new PipelineDependencyNode(p3, p3), p1);\n\n VSMTestHelper.assertNodeHasChildren(graph, p1, p2, p3);\n VSMTestHelper.assertNodeHasChildren(graph, p2, p3);\n assertThat(graph.findNode(p3).getChildren().isEmpty(), is(true));\n assertThat(graph.findNode(p1).getParents().isEmpty(), is(true));\n VSMTestHelper.assertNodeHasParents(graph, p2, p1);\n VSMTestHelper.assertNodeHasParents(graph, p3, p1, p2);\n\n List<List<Node>> nodesAtEachLevel = graph.presentationModel().getNodesAtEachLevel();\n assertThat(nodesAtEachLevel.size(), is(3));\n VSMTestHelper.assertThatLevelHasNodes(nodesAtEachLevel.get(0), 0, p1);\n VSMTestHelper.assertThatLevelHasNodes(nodesAtEachLevel.get(1), 1, p2);\n VSMTestHelper.assertThatLevelHasNodes(nodesAtEachLevel.get(2), 0, p3);\n }", "private void indirectAssociations_DeriveIndirectInheritance() {\n try{\n \tList<FamixAssociation> indirectInheritanceAssociations = new ArrayList<FamixAssociation>();\n\t for (FamixAssociation directAssociation : theModel.associations) {\n if (directAssociation.to == null || directAssociation.from == null || directAssociation.to.equals(\"\") || directAssociation.from.equals(\"\")){ \n \tnumberOfNotConnectedWaitingAssociations ++;\n }\n else if (directAssociation instanceof FamixInheritanceDefinition){ \n \t\t\t\tindirectInheritanceAssociations.addAll(indirectAssociations_AddIndirectInheritanceAssociation(directAssociation.from, directAssociation.to, directAssociation.lineNumber));\n\t\t\t\t}\n\t\t\t}\n\t for (FamixAssociation indirectInheritanceAssociation : indirectInheritanceAssociations) {\n\t \taddToModel(indirectInheritanceAssociation);\n\t }\n } catch (Exception e) {\n\t this.logger.debug(new Date().toString() + \" \" + e);\n\t e.printStackTrace();\n }\n }", "public static List<ExtendRule> removeRedundantExtendedRules_transactionBased(List<ExtendRule> rules) {\n LOGGER.info(\"STARTED removeRedundantExtendedRules - transaction based\");\n LOGGER.info(\"Rules on start:\" + rules.size());\n ExtendRule defRule = rules.get(rules.size()-1);\n if (defRule.getAntecedent().getItems().size()>0)\n {\n LOGGER.warning(\"Default rule is not last rule. Returning null. Last rule:\" + defRule.toString() );\n \n return null;\n }\n Consequent defClass = defRule.getConsequent(); \n for (Iterator<ExtendRule> it = rules.iterator(); it.hasNext();) { \n ExtendRule PRCandidate = it.next();\n // PRCandidate = go through all rules with default class in the consequent\n if (!PRCandidate.getConsequent().toString().equals(defClass.toString()))\n {\n\n }\n // skip default rule\n else if (PRCandidate.equals(defRule))\n {\n \n } \n else{\n Set<Transaction> suppTran = PRCandidate.getAntecedent().getSupportingTransactions();\n // get transactions only CORRECTLY classified by the candidate rule\n Set<Transaction> consTran = PRCandidate.getConsequent().getSupportingTransactions();\n suppTran.retainAll(consTran);\n\n // Check if transactions correctly classified by pruning candidate intersect with transactions covered by those rules below prunCand in the rule list that assign to different than default class. If there are no such transactions PRCandidate can be removed\n boolean nonEmptyIntersection=false;\n boolean positionBelowPRCand = false;\n for (Iterator<ExtendRule> innerIt = rules.iterator(); innerIt.hasNext();) {\n ExtendRule candidateClash = innerIt.next();\n // candidateClash is PRCandidate, which would always evaluate to overlap!\n if (candidateClash.equals(PRCandidate))\n {\n positionBelowPRCand = true;\n continue;\n }\n if (!positionBelowPRCand) continue;\n // candidateClash = go through all rules with OTHER than default class in consequent \n if (candidateClash.getConsequent().toString().equals(defClass.toString()))\n {\n continue;\n }\n\n // check if transactions covered by PRCandidate intersect with transactions covered by candidateClash \n\n for (Transaction t : candidateClash.getAntecedent().getSupportingTransactions())\n {\n\n if (suppTran.contains(t))\n {\n nonEmptyIntersection=true;\n }\n break;\n } \n if (nonEmptyIntersection)\n {\n //go to next PRCandidate \n break;\n } \n }\n if (nonEmptyIntersection == false)\n {\n //no other rule with different consequent covering at least one shared transaction was found\n //this rule can be removed\n LOGGER.fine(\"Removing rule:\" + PRCandidate.toString());\n it.remove();\n } \n }\n \n }\n LOGGER.info(\"Rules on finish:\" + rules.size());\n LOGGER.info(\"FINISHED removeRedundantExtendedRules - transaction based\");\n return rules;\n }", "private ConflictCause propagateWeakly(final Assignment.Entry entry) {\n\t\t// If assignment is for TRUE, previous MBT exists, and this is no reassignment, nothing changes for weak propagation.\n\t\tif (entry.getPrevious() != null && !entry.isReassignAtLowerDecisionLevel()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tWatches<BinaryWatch, WatchedNoGood> watchesOfAssignedAtom = watches(entry.getAtom());\n\n\t\t// Process binary watches.\n\t\tfor (BinaryWatch binaryWatch : watchesOfAssignedAtom.binary.getOrdinary(entry.getTruth().toBoolean())) {\n\t\t\tConflictCause conflictCause = assignWeakComplement(binaryWatch.getOtherLiteralIndex(), binaryWatch.getNoGood(), entry.getDecisionLevel());\n\t\t\tif (conflictCause != null) {\n\t\t\t\treturn conflictCause;\n\t\t\t}\n\t\t}\n\n\t\tint assignedDecisionLevel = entry.getWeakDecisionLevel();\n\n\t\t// Check all watched multi-ary NoGoods.\n\t\tIterator<WatchedNoGood> watchIterator = watchesOfAssignedAtom.multary.getOrdinary(entry.getTruth().toBoolean()).iterator();\n\t\twhile (watchIterator.hasNext()) {\n\t\t\tfinal WatchedNoGood watchedNoGood = watchIterator.next();\n\n\t\t\tfinal int assignedPointer = watchedNoGood.getLiteralAtPointer(0) == entry.getLiteral() ? 0 : 1;\n\t\t\tfinal int otherPointer = 1 - assignedPointer;\n\n\t\t\tfinal int assignedIndex = watchedNoGood.getPointer(assignedPointer);\n\t\t\tfinal int otherIndex = watchedNoGood.getPointer(otherPointer);\n\n\t\t\tboolean isNoGoodSatisfiedByOtherWatch = false;\n\t\t\tAssignment.Entry otherEntry = assignment.get(atomOf(watchedNoGood.getLiteral(otherIndex)));\n\t\t\t// Check if the other watch already satisfies the noGood.\n\t\t\tif (otherEntry != null && otherEntry.getTruth().toBoolean() != isPositive(watchedNoGood.getLiteral(otherIndex))) {\n\t\t\t\tisNoGoodSatisfiedByOtherWatch = true;\n\t\t\t}\n\n\t\t\tint highestDecisionLevel = assignedDecisionLevel;\n\t\t\tint pointerCandidateIndex = assignedIndex;\n\t\t\tboolean foundPointerCandidate = false;\n\n\t\t\t// Find new literal to watch.\n\t\t\tfor (int i = 0; i < watchedNoGood.size(); i++) {\n\t\t\t\tif (i == assignedIndex || i == otherIndex) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint currentLiteral = watchedNoGood.getLiteral(i);\n\t\t\t\tAssignment.Entry currentEntry = assignment.get(atomOf(currentLiteral));\n\n\t\t\t\t// Break if: 1) current literal is unassigned, 2) satisfies the nogood, or\n\t\t\t\t// 3) the nogood is satisfied by the other watch and the current literal has decision level greater than the satisfying literal.\n\t\t\t\tif (currentEntry == null\n\t\t\t\t\t|| currentEntry.getTruth().toBoolean() != isPositive(currentLiteral)\n\t\t\t\t\t|| (isNoGoodSatisfiedByOtherWatch && currentEntry.getWeakDecisionLevel() >= otherEntry.getWeakDecisionLevel())\n\t\t\t\t\t) {\n\t\t\t\t\tfoundPointerCandidate = true;\n\t\t\t\t\tpointerCandidateIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Record literal if it has highest decision level so far.\n\t\t\t\tint currentDecisionLevel = currentEntry.getWeakDecisionLevel();\n\t\t\t\tif (currentDecisionLevel > highestDecisionLevel) {\n\t\t\t\t\thighestDecisionLevel = currentDecisionLevel;\n\t\t\t\t\tpointerCandidateIndex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (foundPointerCandidate) {\n\t\t\t\t// Move pointer to new literal.\n\t\t\t\twatchedNoGood.setPointer(assignedPointer, pointerCandidateIndex);\n\t\t\t\twatchIterator.remove();\n\t\t\t\taddOrdinaryWatch(watchedNoGood, assignedPointer);\n\t\t\t} else {\n\t\t\t\t// NoGood is unit, propagate (on potentially lower decision level).\n\t\t\t\t// Note: Violation is detected by Assignment.\n\t\t\t\tConflictCause conflictCause = assignWeakComplement(otherIndex, watchedNoGood, highestDecisionLevel);\n\n\t\t\t\tif (conflictCause != null) {\n\t\t\t\t\treturn conflictCause;\n\t\t\t\t}\n\n\t\t\t\t// Move assigned watch to now-highest position (if it changed).\n\t\t\t\tif (pointerCandidateIndex != assignedIndex) {\n\t\t\t\t\twatchedNoGood.setPointer(assignedPointer, pointerCandidateIndex);\n\t\t\t\t\twatchIterator.remove();\n\t\t\t\t\taddOrdinaryWatch(watchedNoGood, assignedPointer);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "@Override \n public boolean shouldTraverse(Traversal traversal, Exp e, Exp parent) {\n return true; \n }", "@Override\n\tpublic void preBacktrack() {\n\t\t\n\t}", "public void refineTR(){\n ArrayList<Node> prevLevelNodes = new ArrayList<>();\n ArrayList<Node> currentLevelNodes;\n services.clear();\n prevLevelNodes.add(endNode);\n while (true){\n currentLevelNodes = new ArrayList<>();\n for (Node n: prevLevelNodes){\n //System.out.println(n.isDummy());\n if (!n.isDummy()){\n //System.out.println(n.getService().getSubServices().size());\n for (AbstractService as: n.getService().getSubServices())\n services.add(as.getAbstractServices().get(0));\n }\n for (Node n1: n.getTraceTR()){\n currentLevelNodes.add(n1);\n }\n }\n if (currentLevelNodes.isEmpty())break;\n prevLevelNodes = currentLevelNodes;\n }\n this.generateDependencyGraph();\n //this.findOptimalResponseTime();\n this.findOptimalThroughput();\n }", "private static void checkRecurseUnordered(Vector<XSParticleDecl> dChildren, int min1, int max1, SubstitutionGroupHandler dSGHandler, Vector<XSParticleDecl> bChildren, int min2, int max2, SubstitutionGroupHandler bSGHandler) throws XMLSchemaException {\n/* 1306 */ if (!checkOccurrenceRange(min1, max1, min2, max2)) {\n/* 1307 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.1\", new Object[] {\n/* 1308 */ Integer.toString(min1), (max1 == -1) ? \"unbounded\" : \n/* 1309 */ Integer.toString(max1), \n/* 1310 */ Integer.toString(min2), (max2 == -1) ? \"unbounded\" : \n/* 1311 */ Integer.toString(max2)\n/* */ });\n/* */ }\n/* 1314 */ int count1 = dChildren.size();\n/* 1315 */ int count2 = bChildren.size();\n/* */ \n/* 1317 */ boolean[] foundIt = new boolean[count2];\n/* */ \n/* 1319 */ for (int i = 0; i < count1; i++) {\n/* 1320 */ XSParticleDecl particle1 = dChildren.elementAt(i);\n/* */ \n/* 1322 */ int k = 0; while (true) { if (k < count2) {\n/* 1323 */ XSParticleDecl particle2 = bChildren.elementAt(k);\n/* */ try {\n/* 1325 */ particleValidRestriction(particle1, dSGHandler, particle2, bSGHandler);\n/* 1326 */ if (foundIt[k]) {\n/* 1327 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.2\", null);\n/* */ }\n/* 1329 */ foundIt[k] = true;\n/* */ \n/* */ \n/* */ break;\n/* 1333 */ } catch (XMLSchemaException xMLSchemaException) {}\n/* */ k++;\n/* */ continue;\n/* */ } \n/* 1337 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.2\", null); }\n/* */ \n/* */ } \n/* */ \n/* 1341 */ for (int j = 0; j < count2; j++) {\n/* 1342 */ XSParticleDecl particle2 = bChildren.elementAt(j);\n/* 1343 */ if (!foundIt[j] && !particle2.emptiable()) {\n/* 1344 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.2\", null);\n/* */ }\n/* */ } \n/* */ }", "@SuppressWarnings(\"unchecked\")\r\n private static void cycleTests() throws CALExecutorException {\r\n \r\n final ImmutableDirectedGraph<Integer> noCycles = ImmutableDirectedGraph\r\n .makeGraph(\r\n Collections.<Integer>emptyList(),\r\n Arrays.asList(Pair.make(1, 2), Pair.make(2, 3), Pair.make(1, 3)),\r\n executionContext);\r\n \r\n final ImmutableDirectedGraph<Integer> lengthOneCycle = ImmutableDirectedGraph\r\n .makeGraph(\r\n Collections.<Integer>emptyList(),\r\n Arrays.asList(Pair.make(1, 1)),\r\n executionContext);\r\n \r\n final ImmutableDirectedGraph<Integer> lengthTwoCycle = ImmutableDirectedGraph\r\n .makeGraph(\r\n Collections.<Integer>emptyList(),\r\n Arrays.asList(Pair.make(1, 2), Pair.make(2, 1)),\r\n executionContext);\r\n \r\n System.out.println(\"noCycle.findCycle(): \" + noCycles.findCycle());\r\n System.out.println(\"oneCycle.findCycle(): \" + lengthOneCycle.findCycle());\r\n System.out.println(\"twoCycle.findCycle(): \" + lengthTwoCycle.findCycle());\r\n }", "protected void processTemporalRule(){\n RuleThread currntThrd;\n Thread currntThrdParent; // the parent of the current thread;\n int currntOperatingMode;\n int currntThrdPriority ;\n\n if( temporalRuleQueue.getHead()!= null){\n\n //If the rule thread is the top level, trigger the rule.\n currntThrd=temporalRuleQueue.getHead();\n while(currntThrd!= null){\n currntThrdPriority = currntThrd.getPriority ();\n currntThrdParent = currntThrd.getParent();\n\n if (currntThrd.getOperatingMode() == RuleOperatingMode.READY\n && !(currntThrd.getParent() == applThrd ||\n currntThrd.getParent().getClass().getName().equals(\"EventDispatchThread\")||\n currntThrd.getParent().getName ().equals (Constant.LEDReceiverThreadName)\n )){\n if(ruleSchedulerDebug)\n\t\t \t\t System.out.println(\"Changing mode of \"+currntThrd.getName()+\"from READY to EXE\");\n\n currntThrd.setOperatingMode(RuleOperatingMode.EXE);\n\t\t\t\t currntThrd.setScheduler(this);\n currntThrd.start();\n int rulePriority = 0;\n currntThrdParent = currntThrd;\n if(currntThrdParent instanceof RuleThread){\n rulePriority = currntThrd.getRulePriority();\n }\n currntThrd = currntThrd.next;\n while(currntThrd != null && currntThrd instanceof RuleThread &&\n currntThrd.getRulePriority() == rulePriority\n \t\t\t\t\t\t\t && currntThrd.getParent() == currntThrdParent ){\n if(ruleSchedulerDebug)\n \t\t\t System.out.print(\" start child thread =>\");\n\n currntThrd.print();\n currntThrd.setScheduler(this);\n if(\tcurrntThrd.getOperatingMode()== RuleOperatingMode.READY ){\n currntThrd.setOperatingMode(RuleOperatingMode.EXE);\n currntThrd.start();\n }\n \t\t\t\t\tcurrntThrd = currntThrd.next;\n }\n }\n // case 1.2:\n else if (currntThrd != null &&\tcurrntThrd.getOperatingMode() == RuleOperatingMode.EXE){\n \t\t\t\tcurrntThrd = currntThrd.next;\n\n }\n // case 1.3:\n\t\t\t\telse if (currntThrd != null && currntThrd.getOperatingMode() == RuleOperatingMode.WAIT){\n\t\t\t\t if(currntThrd.next == null){\n currntThrd.setOperatingMode(RuleOperatingMode.EXE);\n\n// ;\n // All its childs has been completed.\n // This currntThread's operating mode will be changed to FINISHED.\n }\n\t\t\t\t\telse{\n // check whether its neighbor is its child\n\t\t\t\t\t\tif(currntThrd.next.getParent() == currntThrdParent){\n if(ruleSchedulerDebug){\n\t \t\t\t\t\t System.out.println(\"\\n\"+currntThrd.getName()+\" call childRecurse \"+currntThrd.next.getName());\n\t\t \t\t\t\t\tcurrntThrd.print();\n }\n\n childRecurse(currntThrd, temporalRuleQueue);\n }\n }\n currntThrd = currntThrd.next;\n }\n // case 1.4:\n\t\t\t\telse if (currntThrd != null && currntThrd.getOperatingMode() == RuleOperatingMode.FINISHED){\n if(ruleSchedulerDebug){\n\t\t\t\t\t System.out.println(\"delete \"+currntThrd.getName() +\" rule thread from rule queue.\");\n\t\t\t\t\t\tcurrntThrd.print();\n }\n processRuleList.deleteRuleThread(currntThrd,temporalRuleQueue);\n \tcurrntThrd = currntThrd.next;\n }\n else{\n \t\t\t\tcurrntThrd = currntThrd.next;\n }\n }\n }\n }", "@Test\n public void shouldNotAddDuplicateDependents() {\n String currentPipeline = \"p5\";\n ValueStreamMap graph = new ValueStreamMap(currentPipeline, null);\n Node p4 = graph.addUpstreamNode(new PipelineDependencyNode(\"p4\", \"p4\"), null, currentPipeline);\n graph.addUpstreamNode(new PipelineDependencyNode(\"p4\", \"p4\"), null, currentPipeline);\n\n assertThat(p4.getChildren().size(), is(1));\n VSMTestHelper.assertThatNodeHasChildren(graph, \"p4\", 0, \"p5\");\n }", "private static void checkRecurse(Vector<XSParticleDecl> dChildren, int min1, int max1, SubstitutionGroupHandler dSGHandler, Vector<XSParticleDecl> bChildren, int min2, int max2, SubstitutionGroupHandler bSGHandler) throws XMLSchemaException {\n/* 1258 */ if (!checkOccurrenceRange(min1, max1, min2, max2)) {\n/* 1259 */ throw new XMLSchemaException(\"rcase-Recurse.1\", new Object[] {\n/* 1260 */ Integer.toString(min1), (max1 == -1) ? \"unbounded\" : \n/* 1261 */ Integer.toString(max1), \n/* 1262 */ Integer.toString(min2), (max2 == -1) ? \"unbounded\" : \n/* 1263 */ Integer.toString(max2)\n/* */ });\n/* */ }\n/* 1266 */ int count1 = dChildren.size();\n/* 1267 */ int count2 = bChildren.size();\n/* */ \n/* 1269 */ int current = 0;\n/* 1270 */ for (int i = 0; i < count1; i++) {\n/* */ \n/* 1272 */ XSParticleDecl particle1 = dChildren.elementAt(i);\n/* 1273 */ int k = current; while (true) { if (k < count2) {\n/* 1274 */ XSParticleDecl particle2 = bChildren.elementAt(k);\n/* 1275 */ current++;\n/* */ try {\n/* 1277 */ particleValidRestriction(particle1, dSGHandler, particle2, bSGHandler);\n/* */ \n/* */ break;\n/* 1280 */ } catch (XMLSchemaException e) {\n/* 1281 */ if (!particle2.emptiable())\n/* 1282 */ throw new XMLSchemaException(\"rcase-Recurse.2\", null); \n/* */ } k++; continue;\n/* */ } \n/* 1285 */ throw new XMLSchemaException(\"rcase-Recurse.2\", null); }\n/* */ \n/* */ } \n/* */ \n/* 1289 */ for (int j = current; j < count2; j++) {\n/* 1290 */ XSParticleDecl particle2 = bChildren.elementAt(j);\n/* 1291 */ if (!particle2.emptiable()) {\n/* 1292 */ throw new XMLSchemaException(\"rcase-Recurse.2\", null);\n/* */ }\n/* */ } \n/* */ }", "private Collection<? extends AbstractState> getFollowStates(AutomatonState state, List<AbstractState> otherElements, CFAEdge edge, boolean failOnUnknownMatch) throws CPATransferException {\n Preconditions.checkArgument(!(state instanceof AutomatonUnknownState));\n if (state == cpa.getBottomState()) {\n //return Collections.singleton(state);\n return Collections.emptySet();\n }\n\n if (state.getInternalState().getTransitions().isEmpty()) {\n // shortcut\n return Collections.singleton(state);\n }\n\n Collection<AbstractState> lSuccessors = new HashSet<AbstractState>(2);\n AutomatonExpressionArguments exprArgs = new AutomatonExpressionArguments(state.getVars(), otherElements, edge, logger);\n boolean edgeMatched = false;\n boolean nonDetState = state.getInternalState().isNonDetState();\n\n // these transitions cannot be evaluated until last, because they might have sideeffects on other CPAs (dont want to execute them twice)\n // the transitionVariables have to be cached (produced during the match operation)\n // the list holds a Transition and the TransitionVariables generated during its match\n List<Pair<AutomatonTransition, Map<Integer, String>>> transitionsToBeTaken = new ArrayList<Pair<AutomatonTransition, Map<Integer, String>>>(2);\n\n for (AutomatonTransition t : state.getInternalState().getTransitions()) {\n exprArgs.clearTransitionVariables();\n\n matchTime.start();\n ResultValue<Boolean> match = t.match(exprArgs);\n matchTime.stop();\n if (match.canNotEvaluate()) {\n if (failOnUnknownMatch) {\n throw new CPATransferException(\"Automaton transition condition could not be evaluated: \" + match.getFailureMessage());\n }\n // if one transition cannot be evaluated the evaluation must be postponed until enough information is available\n return Collections.singleton(new AutomatonUnknownState(state));\n } else {\n if (match.getValue()) {\n edgeMatched = true;\n assertionsTime.start();\n ResultValue<Boolean> assertionsHold = t.assertionsHold(exprArgs);\n assertionsTime.stop();\n\n if (assertionsHold.canNotEvaluate()) {\n if (failOnUnknownMatch) {\n throw new CPATransferException(\"Automaton transition assertions could not be evaluated: \" + assertionsHold.getFailureMessage());\n }\n // cannot yet be evaluated\n return Collections.singleton(new AutomatonUnknownState(state));\n\n } else if (assertionsHold.getValue()) {\n if (!t.canExecuteActionsOn(exprArgs)) {\n if (failOnUnknownMatch) {\n throw new CPATransferException(\"Automaton transition action could not be executed\");\n }\n // cannot yet execute, goto UnknownState\n return Collections.singleton(new AutomatonUnknownState(state));\n }\n\n // delay execution as described above\n Map<Integer, String> transitionVariables = ImmutableMap.copyOf(exprArgs.getTransitionVariables());\n transitionsToBeTaken.add(Pair.of(t, transitionVariables));\n\n } else {\n // matching transitions, but unfulfilled assertions: goto error state\n AutomatonState errorState = AutomatonState.automatonStateFactory(Collections.<String, AutomatonVariable>emptyMap(), AutomatonInternalState.ERROR, cpa);\n logger.log(Level.INFO, \"Automaton going to ErrorState on edge \\\"\" + edge.getDescription() + \"\\\"\");\n lSuccessors.add(errorState);\n }\n\n if (!nonDetState) {\n // not a nondet State, break on the first matching edge\n break;\n }\n }\n // do nothing if the edge did not match\n }\n }\n\n if (edgeMatched) {\n // execute Transitions\n for (Pair<AutomatonTransition, Map<Integer, String>> pair : transitionsToBeTaken) {\n // this transition will be taken. copy the variables\n AutomatonTransition t = pair.getFirst();\n Map<Integer, String> transitionVariables = pair.getSecond();\n actionTime.start();\n Map<String, AutomatonVariable> newVars = deepCloneVars(state.getVars());\n exprArgs.setAutomatonVariables(newVars);\n exprArgs.putTransitionVariables(transitionVariables);\n t.executeActions(exprArgs);\n actionTime.stop();\n AutomatonState lSuccessor = AutomatonState.automatonStateFactory(newVars, t.getFollowState(), cpa);\n //if (!(lSuccessor instanceof AutomatonState.BOTTOM)) {\n lSuccessors.add(lSuccessor);\n //} // else add nothing\n }\n return lSuccessors;\n } else {\n // stay in same state, no transitions to be executed here (no transition matched)\n return Collections.singleton(state);\n }\n }", "public void updateChildNodes() {\n\t\tList<FTNonLeafNode> nodesToRemove = new ArrayList<FTNonLeafNode>();\n\t\tfor (FTNonLeafNode intermediateNode : intermediateNodes.values()) {\n\t\t\tList<FTNode> childNodesToRemove = new ArrayList<FTNode>();\n\t\t\tfor (String childName : intermediateNode.childNodes.keySet()) {\n\t\t\t\tif (intermediateNodes.containsKey(childName)) {\n\t\t\t\t\t// update child node if it has child node\n\t\t\t\t\tFTNonLeafNode childNode = intermediateNodes.get(childName);\n\t\t\t\t\tif ((childNode instanceof FTOrNode) || (childNode instanceof FTAndNode)) {\n\t\t\t\t\t\tintermediateNode.addChildNode(childName, intermediateNodes.get(childName));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// if parent node is an OR node\n\t\t\t\t\t\t// remove this child\n\t\t\t\t\t\tif (intermediateNode instanceof FTOrNode) {\n\t\t\t\t\t\t\tchildNodesToRemove.add(childNode);\n\t\t\t\t\t\t\tnodesToRemove.add(childNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if parent node is an AND node\n\t\t\t\t\t\t// remove the parent node and child node\n\t\t\t\t\t\t// and set their values to false in case they are referenced by other nodes\n\t\t\t\t\t\telse if (intermediateNode instanceof FTAndNode) {\n\t\t\t\t\t\t\tnodesToRemove.add(intermediateNode);\n\t\t\t\t\t\t\tnodesToRemove.add(childNode);\n\t\t\t\t\t\t\t// mark the nodes as they are not getting removed till after the loop\n\t\t\t\t\t\t\tintermediateNode.resolved = true;\n\t\t\t\t\t\t\tintermediateNode.nodeValue = false;\n\t\t\t\t\t\t\tchildNode.resolved = true;\n\t\t\t\t\t\t\tchildNode.nodeValue = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tintermediateNode.removeChildNodes(childNodesToRemove);\n\t\t\t// if no child node left for this intermediate node,\n\t\t\t// then its parent node should remove this intermediate node as well\n\t\t}\n\t\t// remove the no child nodes\n\t\tfor (FTNonLeafNode node : nodesToRemove) {\n\t\t\tintermediateNodes.remove(node.nodeName);\n\t\t}\n\t}", "void propagate_childs_of_fprivate_that_only_call_relatives(Element element, Feature feature_to_assign, Fact factInf, Feature parent_feature){\n\t\tfor(Element child : element.getRefToThis()){\n\t\t\tif(child != element && check_only_call_relatives(child) && child.getFeature() == parent_feature){\n\t\t\t\tfactInf.addInference(child.getIdentifier() + \", BttF says it's a child of \" + element.getIdentifier() + \n\t\t\t\t\t\t\" that only calls relatives THEN it also belongs to \" + feature_to_assign.getFeature_name(), child, feature_to_assign);\n\t\t\t\tadd_element_to_feature(factInf, feature_to_assign, child, false, false, parent_feature, true);\n\t\t\t\tpropagate_childs_of_fprivate_that_only_call_relatives(child, feature_to_assign, factInf, parent_feature);\n\t\t\t}\n\t\t}\n\t}", "public boolean checkChangeDetection() throws Exception{\n\t\t\tint length = -1 ;\n\t\t\tFuzzyRule ruleRemove = null ;\n\t\t\tfor (FuzzyRule rule: rs){\n\t\t\t\tif (rule.getChangeStatus()){\n\t\t\t\t\tif (rule.getHistory().size()>length){\n\t\t\t\t\t\tlength = rule.getHistory().size() ;\n\t\t\t\t\t\tif (rule!=defaultRule)\n\t\t\t\t\t\t\truleRemove = rule ;\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tboolean drift = false ;\n\t\t\tif (ruleRemove!=null && rs.size()>1){\n\t\t\t\tif (chooseSingleRuleOption.isSet()) {\n\t\t\t\t\trs.remove(ruleRemove) ;\t\t\t\t\t\n\t\t\t\t}else {\n\t\t\t\t\tfor (FuzzyRule rule: rs){ \n\t\t\t\t\t\tif (rule!=ruleRemove){\n\t\t\t\t\t\t\tboolean tempDrift = rule.mergeWithSibling(ruleRemove) ;\n\t\t\t\t\t\t\tif (tempDrift){\n\t\t\t\t\t\t\t\trule.clearExtendedCandidates();\n\t\t\t\t\t\t\t\trule.clearStats();\n\t\t\t\t\t\t\t\trule.buildExtendedCandidates();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t drift = drift || tempDrift ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\trs.remove(ruleRemove) ;\n\t\t\t\t}\n\t\t\t}\t\t\t\n\t\t\treturn drift ;\n\t\t}", "private void computeConflicts() {\n\t\tthis.conflictGraph = new HashMap<Class, List<Class>>();\n\n\t\tfor (Class c : this.core) {\n\t\t\tif (c.getSuperClasses().size() >= 2) {\n\n\t\t\t\tList<List<Class>> linExts = new ArrayList<List<Class>>();\n\t\t\t\tfor (int i = 0; i < c.getSuperClasses().size(); i++) {\n\t\t\t\t\tlinExts.add(this.linearExts.get(c.getSuperClasses().get(i)));\n\t\t\t\t\tlinExts.get(i).add(c.getSuperClasses().get(i));\n\t\t\t\t}\n\n\t\t\t\tList<HashSet<Class>> diffs = new ArrayList<HashSet<Class>>();\n\n\t\t\t\t// Compute lini - linj for all i != j\n\t\t\t\tfor (List<Class> linExt : linExts) {\n\t\t\t\t\tfor (List<Class> linExt2 : linExts) {\n\t\t\t\t\t\tif (linExt != linExt2) {\n\t\t\t\t\t\t\tHashSet<Class> diff = new HashSet<Class>();\n\t\t\t\t\t\t\tfor (Class p : linExt2) {\n\t\t\t\t\t\t\t\tif (!linExt.contains(p))\n\t\t\t\t\t\t\t\t\tdiff.add(p);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdiffs.add(diff);\n\n\t\t\t\t\t\t\tdiff = new HashSet<Class>();\n\t\t\t\t\t\t\tfor (Class p : linExt) {\n\t\t\t\t\t\t\t\tif (!linExt2.contains(p))\n\t\t\t\t\t\t\t\t\tdiff.add(p);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdiffs.add(diff);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Compute conflicts di * dj for all j != i\n\t\t\t\tfor (HashSet<Class> diff : diffs) {\n\t\t\t\t\tfor (HashSet<Class> diff2 : diffs) {\n\t\t\t\t\t\tif (diff != diff2) {\n\t\t\t\t\t\t\tfor (Class c1 : diff) {\n\t\t\t\t\t\t\t\tList<Class> conflicts = new ArrayList<Class>();\n\t\t\t\t\t\t\t\tif (this.conflictGraph.containsKey(c1))\n\t\t\t\t\t\t\t\t\tconflicts = this.conflictGraph.get(c1);\n\n\t\t\t\t\t\t\t\tfor (Class c2 : diff2) {\n\t\t\t\t\t\t\t\t\tconflicts.add(c2);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.conflictGraph.put(c1, conflicts);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private boolean concurrentRuleAsymParallelIndependentByCPA(\r\n\t\t\tfinal int i,\r\n\t\t\tfinal Rule ri,\r\n\t\t\tfinal ConcurrentRule cr,\r\n\t\t\tfinal List<Rule> sequence,\r\n\t\t\tfinal int concurdepth,\r\n\t\t\tString criterion) {\n\t\t\r\n\t\tboolean result = true; \r\n\t\tVector<Rule> tmp = new Vector<Rule>();\r\n\t\ttmp.addAll(sequence);\r\n\t\tint n = 0;\r\n\t\twhile (concurdepth-n >= 0) {\t\t\t\r\n\t\t\ttmp.remove(i-n);\r\n\t\t\tn++;\r\n\t\t}\r\n\t\tif ((i-n) < 0) {\r\n\t\t\ttmp.add(0, cr.getRule());\r\n\t\t} else {\r\n\t\t\ttmp.add(i-n, cr.getRule());\r\n\t\t}\r\n\t\tint c = tmp.indexOf(cr.getRule());\r\n\t\t\r\n\t\t// find conflicts of concurrent rule with rules before\r\n\t\tfor (int j=0; j<c; j++) {\r\n\t\t\tfinal Rule rj = tmp.get(j);\t\r\n\t\t\tfinal SimpleExcludePair excludePair = this.makeExcludePair();\t\t\t\t\r\n\t\t\tif(!asymParallelIndependentByCPA(excludePair, rj, -1, cr.getRule(), -1)) {\r\n\t\t\t\tresult = false;\t\t\r\n//\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\" has conflict with \" +rj.getName());\r\n\t\t\t\tbreak;\r\n\t\t\t} \r\n\t\t\texcludePair.dispose();\r\n\t\t}\r\n\t\tif (result) {\r\n\t\t\t// find conflicts of concurrent rule with successor rules\r\n\t\t\tfor (int l=c+1; l<tmp.size(); l++) {\r\n\t\t\t\tfinal Rule rj = tmp.get(l);\t\r\n\t\t\t\tfinal SimpleExcludePair excludePair = this.makeExcludePair();\r\n\t\t\t\tif (!asymParallelIndependentByCPA(excludePair, cr.getRule(), -1, rj, -1)) {\r\n\t\t\t\t\tresult = false;\t\r\n//\t\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\" has conflict with \" +rj.getName());\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t} \r\n\t\t\t\texcludePair.dispose();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.info = this.getConcurrentRuleNameInfo(cr.getRule(), ri);\r\n\t\tsetRuleResult(i, ri.getName(), result, criterion, this.info);\r\n//\t\tSystem.out.println(\"=== >>> Concurrent rule: \"+cr.getRule().getName()+\" is applicable without conflicts!\");\r\n\t\t\t\t\r\n\t\ttmp.clear();\r\n\t\t\r\n\t\treturn result;\r\n\t}", "private void phaseTwo(){\r\n\r\n\t\tCollections.shuffle(allNodes, random);\r\n\t\tList<Pair<Node, Node>> pairs = new ArrayList<Pair<Node, Node>>();\r\n\t\t\r\n\t\t//For each node in allNode, get all relationshpis and iterate through each relationship.\r\n\t\tfor (Node n1 : allNodes){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//If a node n1 is related to any other node in allNodes, add those relationships to rels.\r\n\t\t\t\t//Avoid duplication, and self loops.\r\n\t\t\t\tIterable<Relationship> ite = n1.getRelationships(Direction.BOTH);\t\t\t\t\r\n\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\tNode n2 = rel.getOtherNode(n1);\t//Get the other node\r\n\t\t\t\t\tif (allNodes.contains(n2) && !n1.equals(n2)){\t\t\t\t\t//If n2 is part of allNodes and n1 != n2\r\n\t\t\t\t\t\tif (!rels.contains(rel)){\t\t\t\t\t\t\t\t\t//If the relationship is not already part of rels\r\n\t\t\t\t\t\t\tPair<Node, Node> pA = new Pair<Node, Node>(n1, n2);\r\n\t\t\t\t\t\t\tPair<Node, Node> pB = new Pair<Node, Node>(n2, n1);\r\n\r\n\t\t\t\t\t\t\tif (!pairs.contains(pA)){\r\n\t\t\t\t\t\t\t\trels.add(rel);\t\t\t\t\t\t\t\t\t\t\t//Add the relationship to the lists.\r\n\t\t\t\t\t\t\t\tpairs.add(pA);\r\n\t\t\t\t\t\t\t\tpairs.add(pB);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}", "private static boolean isCycle(Graph graph) {\n for (int i = 0; i < graph.edges.length; ++i) {\n int x = graph.find(graph.edges[i][0]);\n int y = graph.find(graph.edges[i][1]);\n\n // if both subsets are same, then there is cycle in graph.\n if (x == y) {\n // for edge 2-0 : parent of 0 is 2 == 2 and so we detected a cycle\n return true;\n }\n // keep doing union/merge of sets\n graph.union(x, y);\n }\n return false;\n }", "void runC() {\n\t\tArrayList<Link> links_s2 = new ArrayList<Link>(links_s);\n\t\tArrayList<Link> links_p2 = new ArrayList<Link>(links_p);\n\t\talgorithmC = new HashSet<Link>(algorithmC(links_p2, links_s2));\n\t}", "@Override\n @SuppressWarnings(\"try\")\n protected void run(StructuredGraph graph, C context) {\n EconomicSetNodeEventListener listener = new EconomicSetNodeEventListener().exclude(NodeEvent.NODE_ADDED);\n StructuredGraph graphCopy = (StructuredGraph) graph.copy(graph.getDebug());\n DebugContext debug = graph.getDebug();\n try (NodeEventScope s = graphCopy.trackNodeEvents(listener)) {\n try (DebugContext.Scope s2 = debug.sandbox(\"WithoutMonitoring\", null)) {\n super.run(graphCopy, context);\n } catch (Throwable t) {\n debug.handle(t);\n }\n }\n\n EconomicSet<Node> filteredNodes = EconomicSet.create(Equivalence.IDENTITY);\n for (Node n : listener.getNodes()) {\n if (n instanceof LogicConstantNode) {\n // Ignore LogicConstantNode since those are sometimes created and deleted as part of\n // running a phase.\n } else {\n filteredNodes.add(n);\n }\n }\n if (!filteredNodes.isEmpty()) {\n /* rerun it on the real graph in a new Debug scope so Dump and Log can find it. */\n listener = new EconomicSetNodeEventListener();\n try (NodeEventScope s = graph.trackNodeEvents(listener)) {\n try (DebugContext.Scope s2 = debug.scope(\"WithGraphChangeMonitoring\")) {\n if (debug.isDumpEnabled(DebugContext.DETAILED_LEVEL)) {\n debug.dump(DebugContext.DETAILED_LEVEL, graph, \"*** Before phase %s\", getName());\n }\n super.run(graph, context);\n if (debug.isDumpEnabled(DebugContext.DETAILED_LEVEL)) {\n debug.dump(DebugContext.DETAILED_LEVEL, graph, \"*** After phase %s %s\", getName(), filteredNodes);\n }\n debug.log(\"*** %s %s %s\\n\", message, graph, filteredNodes);\n }\n }\n } else {\n // Go ahead and run it normally even though it should have no effect\n super.run(graph, context);\n }\n }", "private void getTimeConditions(List<RuleInstance> rules,Set<Condition> conds)\n{\n for (RuleInstance ri : rules) {\n getTimeConditions(ri,rules,conds);\n }\n}", "private void analyseSelf(final Result result) {\r\n\t\tfor (final AbstractChangeSetModule module : ModuleManager.getInstance().getChangeSetModules()) {\r\n\t\t\ttry {\r\n\t\t\t\tmodule.execute(changeSetDAO, result);\r\n\t\t\t} catch (Exception exception) { //NOPMD\r\n\t\t\t\tmodule.publishError(result, exception);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "ISChangePropagationDueToDataDependencies createISChangePropagationDueToDataDependencies();", "public void deepChange(PropertyChangeListener aListener, PropertyChangeEvent anEvent)\n{\n for(int i=0, iMax=getListenerCount(DeepChangeListener.class); i<iMax; i++)\n getListener(DeepChangeListener.class, i).deepChange(aListener, anEvent);\n}", "private boolean concurrentRuleAsymParallelIndependent(\r\n\t\t\tfinal int i,\r\n\t\t\tfinal Rule ri,\r\n\t\t\tfinal ConcurrentRule cr,\r\n\t\t\tfinal List<Rule> sequence,\r\n\t\t\tfinal int concurdepth,\r\n\t\t\tString criterion) {\n\r\n\t\tboolean result = true; \t\t\r\n\t\tint concurrrentRuleDepth = cr.getDepth();\r\n\t\t\t\r\n\t\tVector<Rule> remainList = new Vector<Rule>();\r\n\t\tfor (int l=i+1; l<sequence.size(); l++) {\r\n\t\t\tremainList.add(sequence.get(l));\r\n\t\t}\r\n\t\t\r\n\t\tVector<Rule> crSourceList = new Vector<Rule>();\r\n\t\tint start = i-concurrrentRuleDepth;\r\n\t\tfor (int l=start; l<=i; l++) {\r\n\t\t\tcrSourceList.add(sequence.get(l));\r\n\t\t}\r\n\t\t\r\n\t\t// find conflicts of concurrent rule with rules before\r\n\t\tfor (int l = 0; l<crSourceList.size(); l++) {\r\n\t\t\tRule r = crSourceList.get(l);\r\n\t\t\tint indx = start + l;\r\n\t\t\tPair<Boolean, List<String>> \r\n\t\t\truleRes = this.ruleSequence.getRuleResult(indx, r.getName(), ApplicabilityConstants.NO_IMPEDING_PREDECESSORS);\r\n\t\t\tif (ruleRes != null && !ruleRes.first.booleanValue()) {\r\n\t\t\t\tresult = false;\t\r\n//\t\t\t\tString otherRule = ruleRes.second.isEmpty()? \"\": ruleRes.second.get(0);\r\n//\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\": its base rule: \"+r.getName()+\" has conflict with \" +otherRule);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (result) {\r\n\t\t\t// find conflicts of concurrent rule with successor rules \r\n\t\t\tfor (int l = 0; l<crSourceList.size(); l++) {\r\n\t\t\t\tRule r1 = crSourceList.get(l);\r\n\t\t\t\tfor (int k=0; k<remainList.size(); k++) {\r\n\t\t\t\t\tRule r2 = remainList.get(k);\r\n\t\t\t\t\tSimpleExcludePair excludePair = this.makeExcludePair();\r\n\t\t\t\t\tif (!asymParallelIndependentByCPA(excludePair, r1, -1, r2, -1)) {\r\n\t\t\t\t\t\tresult = false;\t\r\n//\t\t\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\": its base rule: \"+r1.getName()+\" has conflict with \" +r2.getName());\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t} \r\n\t\t\t\t\texcludePair.dispose();\r\n\t\t\t\t}\r\n\t\t\t\tif (!result) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.info = this.getConcurrentRuleNameInfo(cr.getRule(), ri);\t\t\t\r\n\t\tsetRuleResult(i, ri.getName(), result, criterion, this.info);\t\t\t\r\n\r\n\t\tremainList.clear();\r\n\t\tcrSourceList.clear();\r\n\t\t\r\n\t\treturn result;\r\n\t}", "public void resetVisited() {\r\n\t\tvisited = false;\r\n\t\tfor (ASTNode child : getChildren()) {\r\n\t\t\tif (!visited)\r\n\t\t\t\tcontinue;\r\n\t\t\tchild.resetVisited();\r\n\t\t}\r\n\t}", "@Override\npublic void setIncrementalChildAddition(boolean newVal) {\n\t\n}", "@Override\n\tpublic void solve() {\n\t\tlong startTime = System.nanoTime();\n\n\t\twhile(!unvisitedPM.isEmpty()){\n\t\t\tProblemModel current = findCheapestNode();\n\t\n\t\t\tfor(ProblemModel pm : current.getSubNodes()){\n\t\t\n\t\t\t\tif(!visited.contains(pm) && !unvisitedPM.contains(pm)){\n\t\t\t\t\t\n\t\t\t\t\tunvisitedPM.add(pm);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(current.getSideStart().isEmpty()){\n\t\t\t\tSystem.out.print( \"\\n\"+ \"StartSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideStart()){\n\t\t\t\t\tSystem.out.print( \" \" +r) ;\n\t\t\t\t}\n\t\t\t\tSystem.out.print( \"\\n\" + \"EndSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideEnd()){\n\t\t\t\t\tSystem.out.print( \" \" + r);\n\t\t\t\t}\n\n\t\t\t\tprintPathTaken(current);\n\t\t\t\tSystem.out.print( \"\\n\" + \"------------done--------------\");\n\t\t\t\tlong endTime = System.nanoTime();\n\t\t\t\tlong duration = ((endTime - startTime)/1000000);\n\t\t\t\tSystem.out.print( \"\\n\" + \"-AS1 Time taken: \" + duration + \"ms\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tvisited.add(current);\n\t\t\n\t\t}\n\t\t\n\n\t}", "@Override\n public boolean shouldContinueSwitchedRootFound() {\n return false;\n }", "private ScheduleGrph initializeIdenticalTaskEdges(ScheduleGrph input) {\n\n\t\tScheduleGrph correctedInput = (ScheduleGrph) SerializationUtils.clone(input);\n\t\t// FORKS AND TODO JOINS\n\t\t/*\n\t\t * for (int vert : input.getVertices()) { TreeMap<Integer, List<Integer>> sorted\n\t\t * = new TreeMap<Integer, List<Integer>>(); for (int depend :\n\t\t * input.getOutNeighbors(vert)) { int edge = input.getSomeEdgeConnecting(vert,\n\t\t * depend); int weight = input.getEdgeWeightProperty().getValueAsInt(edge); if\n\t\t * (sorted.get(weight) != null) { sorted.get(weight).add(depend); } else {\n\t\t * ArrayList<Integer> a = new ArrayList(); a.add(depend); sorted.put(weight, a);\n\t\t * }\n\t\t * \n\t\t * } int curr = -1; for (List<Integer> l : sorted.values()) { for (int head : l)\n\t\t * {\n\t\t * \n\t\t * if (curr != -1) { correctedInput.addDirectedSimpleEdge(curr, head); } curr =\n\t\t * head; }\n\t\t * \n\t\t * } }\n\t\t */\n\n\t\tfor (int vert : input.getVertices()) {\n\t\t\tfor (int vert2 : input.getVertices()) {\n\t\t\t\tint vertWeight = input.getVertexWeightProperty().getValueAsInt(vert);\n\t\t\t\tint vert2Weight = input.getVertexWeightProperty().getValueAsInt(vert2);\n\n\t\t\t\tIntSet vertParents = input.getInNeighbors(vert);\n\t\t\t\tIntSet vert2Parents = input.getInNeighbors(vert2);\n\n\t\t\t\tIntSet vertChildren = input.getOutNeighbors(vert);\n\t\t\t\tIntSet vert2Children = input.getOutNeighbors(vert2);\n\n\t\t\t\tboolean childrenEqual = vertChildren.containsAll(vert2Children)\n\t\t\t\t\t\t&& vert2Children.containsAll(vertChildren);\n\n\t\t\t\tboolean parentEqual = vertParents.containsAll(vert2Parents) && vert2Parents.containsAll(vertParents);\n\n\t\t\t\tboolean inWeightsSame = true;\n\t\t\t\tfor (int parent : vertParents) {\n\t\t\t\t\tfor (int parent2 : vert2Parents) {\n\t\t\t\t\t\tif (parent == parent2 && input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(parent, vert)) == input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(parent2, vert2))) {\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tinWeightsSame = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!inWeightsSame) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tboolean outWeightsSame = true;\n\t\t\t\tfor (int child : vertChildren) {\n\t\t\t\t\tfor (int child2 : vert2Children) {\n\t\t\t\t\t\tif (child == child2 && input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(vert, child)) == input.getEdgeWeightProperty()\n\t\t\t\t\t\t\t\t.getValue(input.getSomeEdgeConnecting(vert2, child2))) {\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toutWeightsSame = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!outWeightsSame) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tboolean alreadyEdge = correctedInput.areVerticesAdjacent(vert, vert2)\n\t\t\t\t\t\t|| correctedInput.areVerticesAdjacent(vert2, vert);\n\n\t\t\t\tif (vert != vert2 && vertWeight == vert2Weight && parentEqual && childrenEqual && inWeightsSame\n\t\t\t\t\t\t&& outWeightsSame && !alreadyEdge) {\n\t\t\t\t\tint edge = correctedInput.addDirectedSimpleEdge(vert, vert2);\n\t\t\t\t\tcorrectedInput.getEdgeWeightProperty().setValue(edge, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn correctedInput;\n\t}", "private static void postProcess() {\n Set<Transition> ts = petrinet.getTransitions();\n for(Transition t : ts) {\n List<Flow> outEdges = new ArrayList<Flow>(t.getPostsetEdges());\n List<Flow> inEdges = new ArrayList<Flow>(t.getPresetEdges());\n try {\n Flow f = petrinet.getFlow(t.getId(), \"void\");\n System.out.println(\"contain void!\");\n assert(f.getWeight() == 1);\n //if (outEdges.size() == 1) { // Delete the transition.\n f.setWeight(0);\n //}\n } catch (NoSuchEdgeException e) {}\n }\n }", "@BeforeAll\n\tstatic void setNodes() {\n\t\tLCA = new LowestCommonAncestor();\n\t\tnine = new Node(9,null);\n\t\tten = new Node(10, null);\n\t\teight = new Node(8, null);\n\t\tseven = new Node(7, new Node[] {ten});\n\t\tfour = new Node(4, new Node[] {ten});\n\t\tthree = new Node(3, new Node[] {four});\n\t\tfive = new Node(5, new Node[] {nine, eight, seven});\n\t\ttwo = new Node(2, new Node[] {three, five});\n\t\tone = new Node(1, new Node[] {two});\n\t}", "public void inOrderTraverseRecursive();", "public void selectParents1() {\n // Create a new parent list for this reproductive cycle. Let the garbage\n // handler dispose of the old list, if there was one.\n switch (Defines.parentAlgo) {\n case Defines.PA_RANDOM:\n this.parents = this.selectParentsRandom();\n break;\n\n case Defines.PA_ROULETTE:\n this.parents = this.selectParentsRoulette();\n break;\n\n case Defines.PA_TOURNAMENT:\n this.parents = this.selectParentsTournament();\n break;\n }\n// this.howGoodAreParents();\n }", "public void checkConnections() {\n Boolean updateCanvas = false;\n\n // Find new connections set within a node and creates them\n for (DrawableNode node : nodes) {\n if (node instanceof LogicNode) {\n String src = ((LogicNode) node).getLogic().getLogic();\n\n for (DrawableNode endNode : getNodes()) {\n int nodeConnectionType = NodeConnection.NO_CONNECTION;\n\n // Here we are checked to see if any connections are linked from this LogicNode\n if (src.contains(\"run(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndWait(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndJoin(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.DYNAMIC_CONNECTION;\n } else if (src.contains(\"getNode(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.GET_NODE_CONNECTION;\n }\n\n // If we find a possible connection and it doesn't already exist, we create that connection with the correct type\n if (!connectionExists(node, endNode) && nodeConnectionType != -1) {\n NodeConnection newConnection = new NodeConnection(node, endNode, nodeConnectionType);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n } else if (node instanceof TestCaseNode) {\n String src = ((TestCaseNode) node).getLogic().getLogic();\n\n for (DrawableNode endNode : getNodes()) {\n int nodeConnectionType = NodeConnection.NO_CONNECTION;\n\n // Here we are checked to see if any connections are linked from this TestCaseNode\n if (src.contains(\"run(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndWait(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndJoin(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.DYNAMIC_CONNECTION;\n } else if (src.contains(\"getNode(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.GET_NODE_CONNECTION;\n }\n\n // If we find a possible connection and it doesn't already exist, we create that connection with the correct type\n if (!connectionExists(node, endNode) && nodeConnectionType != -1) {\n NodeConnection newConnection = new NodeConnection(node, endNode, nodeConnectionType);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n } else if (node instanceof SwitchNode) {\n List<Switch> aSwitches = ((SwitchNode) node).getSwitches();\n\n for (DrawableNode endNode : getNodes()) {\n Boolean createConnection = false;\n Boolean enabledConnection = false;\n\n for (Switch aSwitch : aSwitches) {\n if ((aSwitch.getTarget().equals(endNode.getContainedText()))) {\n enabledConnection = aSwitch.isEnabled();\n createConnection = true;\n }\n }\n\n if (createConnection && !connectionExists(node, endNode)) {\n Integer connectionType = NodeConnection.DYNAMIC_CONNECTION;\n if (!enabledConnection) {\n connectionType = NodeConnection.DISABLED_CONNECTION;\n }\n\n NodeConnection newConnection = new NodeConnection(node, endNode, connectionType);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n } else if (node instanceof TriggerNode) {\n List<Trigger> triggers = ((TriggerNode) node).getTriggers();\n\n for (Trigger trigger : triggers) {\n String watchName = trigger.getWatch();\n\n for (DrawableNode endNode : getNodes()) {\n Boolean createConnection = false;\n\n if (watchName.equals(endNode.getContainedText())) {\n createConnection = true;\n }\n\n // This connection has the start and end the other way around, the target is specified in the trigger but\n // we want it to look like the watched node is connecting to the trigger as that is the order that they are run\n if (createConnection && !connectionExists(endNode, node)) {\n NodeConnection newConnection = new NodeConnection(endNode, node, NodeConnection.TRIGGER_CONNECTION);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n }\n }\n\n // Find connection that are set using the Next node input box\n if (node != null && !node.getNextNodeToRun().isEmpty()) {\n for (DrawableNode endNode : getNodes()) {\n if (node.getNextNodeToRun().equals(endNode.getContainedText())) {\n if (!connectionExists(node, endNode)) {\n NodeConnection newConnection = new NodeConnection(node, endNode, NodeConnection.MAIN_CONNECTION);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n }\n }\n }\n\n // Checks old connections and removes ones that don't exist\n List<NodeConnection> listToRemove = new ArrayList<>();\n List<NodeConnection> connectionsLoopTemp = new ArrayList<>(); // We make a copy the list here so that we can the original while iterating over this one\n connectionsLoopTemp.addAll(connections);\n for (NodeConnection nodeConnection : connectionsLoopTemp) {\n if (nodeConnection.getConnectionType().equals(NodeConnection.DYNAMIC_CONNECTION)) {\n if (nodeConnection.getConnectionStart() instanceof LogicNode) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"run(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndWait(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndJoin(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n }\n } else if (nodeConnection.getConnectionStart() instanceof TestCaseNode) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"run(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndWait(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndJoin(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n }\n } else if (nodeConnection.getConnectionStart() instanceof SwitchNode) {\n List<Switch> aSwitches = ((SwitchNode) nodeConnection.getConnectionStart()).getSwitches();\n String endContainedText = nodeConnection.getConnectionEnd().getContainedText();\n Integer removeCount = 0;\n for (Switch aSwitch : aSwitches) {\n if ((!aSwitch.getTarget().equals(endContainedText) || !aSwitch.isEnabled())) {\n removeCount++;\n }\n }\n\n if (removeCount.equals(aSwitches.size())) {\n // Create a disabled connection between these two nodes to give appearance of toggling\n NodeConnection newConnection = new NodeConnection(nodeConnection.getConnectionStart(), nodeConnection.getConnectionEnd(), NodeConnection.DISABLED_CONNECTION);\n connections.add(newConnection);\n\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n } else if (nodeConnection.getConnectionType().equals(NodeConnection.TRIGGER_CONNECTION)) {\n if (nodeConnection.getConnectionEnd() instanceof TriggerNode) { // Here the start and end connections are reversed\n List<Trigger> triggers = ((TriggerNode) nodeConnection.getConnectionEnd()).getTriggers();\n String endContainedText = nodeConnection.getConnectionStart().getContainedText();\n Integer removeCount = 0;\n for (Trigger trigger : triggers) {\n if ((!trigger.getWatch().equals(endContainedText))) {\n removeCount++;\n }\n }\n\n if (removeCount.equals(triggers.size())) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n } else if (nodeConnection.getConnectionType().equals(NodeConnection.GET_NODE_CONNECTION)) {\n if (nodeConnection.getConnectionStart() instanceof LogicNode) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n } else if (nodeConnection.getConnectionStart() instanceof TestCaseNode) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n } else if (nodeConnection.getConnectionType().equals(NodeConnection.DISABLED_CONNECTION)) {\n if (nodeConnection.getConnectionStart() instanceof SwitchNode) {\n List<Switch> aSwitches = ((SwitchNode) nodeConnection.getConnectionStart()).getSwitches();\n String endContainedText = nodeConnection.getConnectionEnd().getContainedText();\n Integer removeCount = 0;\n for (Switch aSwitch : aSwitches) {\n if ((!aSwitch.getTarget().equals(endContainedText) || aSwitch.isEnabled())) {\n removeCount++;\n }\n }\n\n if (removeCount.equals(aSwitches.size())) {\n // Create an enabled connection between these two nodes to give appearance of toggling\n NodeConnection newConnection = new NodeConnection(nodeConnection.getConnectionStart(), nodeConnection.getConnectionEnd(), NodeConnection.DYNAMIC_CONNECTION);\n connections.add(newConnection);\n\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n\n if (nodeConnection.getConnectionType().equals(NodeConnection.MAIN_CONNECTION)) {\n if (!nodeConnection.getConnectionStart().getNextNodeToRun().equals(nodeConnection.getConnectionEnd().getContainedText())) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n\n connections.removeAll(listToRemove);\n if (updateCanvas) {\n Controller.getInstance().updateCanvasControllerLater();\n }\n }", "private void applyRules(GraphModification modifications) throws DataNormalizationException {\n\t\ttry {\n\t\t\tgetDirtyConnection();\n\n\t\t\tIterator<DataNormalizationRule> i = rules.iterator();\n\n\t\t\t/**\n\t\t\t * Ensure that the graph is either transformed completely or not at all\n\t\t\t */\n\t\t\t//getDirtyConnection().adjustTransactionLevel(EnumLogLevel.TRANSACTION_LEVEL);\n\n\t\t\twhile (i.hasNext()) {\n\t\t\t\tDataNormalizationRule rule = i.next();\n\n\t\t\t\ttry {\n\t\t\t\t\tperformRule(rule, modifications);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tLOG.error(String.format(Locale.ROOT, \"Debugging of rule %d failed: %s\", rule.getId(), e.getMessage()));\n\t\t\t\t\tthrow new DataNormalizationException(e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//getDirtyConnection().commit();\n\t\t} catch (DatabaseException e) {\n\t\t\tthrow new DataNormalizationException(e);\n\t\t//} catch (SQLException e) {\n\t\t//\tthrow new DataNormalizationException(e);\n\t\t}\n\t}", "private void optimizeEdgePropFlag() {\n TreeNode currentTreeNode = treeLeaf;\n while (!(currentTreeNode instanceof SourceTreeNode)) {\n if (currentTreeNode instanceof EdgeTreeNode) {\n EdgeTreeNode edgeTreeNode = EdgeTreeNode.class.cast(currentTreeNode);\n TreeNode nextTreeNode = edgeTreeNode.getOutputNode();\n if (null != nextTreeNode &&\n edgeTreeNode.beforeRequirementList.isEmpty() &&\n edgeTreeNode.afterRequirementList.isEmpty()) {\n if (nextTreeNode instanceof EdgeVertexTreeNode ||\n (nextTreeNode.getNodeType() == NodeType.AGGREGATE &&\n !(nextTreeNode instanceof GroupTreeNode))) {\n edgeTreeNode.setFetchPropFlag(true);\n }\n\n }\n }\n currentTreeNode = UnaryTreeNode.class.cast(currentTreeNode).getInputNode();\n }\n }", "public void cycle() {\r\n processTask(); // tune relative frequency?\r\n processConcept(); // use this order to check the new result\r\n }", "public static List<ExtendRule> removeRedundantExtendedRules_rangeBased(List<ExtendRule> rules) {\n LOGGER.info(\"STARTED removeRedundantExtendedRules - range based\");\n LOGGER.info(\"Rules on start:\" + rules.size());\n ExtendRule defRule = rules.get(rules.size()-1);\n Consequent defClass = defRule.getConsequent(); \n for (Iterator<ExtendRule> it = rules.iterator(); it.hasNext();) { \n ExtendRule PRCandidate = it.next();\n // PRCandidate = go through all rules with default class in the consequent\n if (!PRCandidate.getConsequent().toString().equals(defClass.toString()))\n {\n continue;\n }\n // skip default rule\n if (PRCandidate.equals(defRule))\n {\n continue;\n } \n ArrayList<RuleMultiItem> PR_items = PRCandidate.getAntecedent().getItems();\n //create hashmap for fast access\n HashMap<Attribute,RuleMultiItem> PR_itemsMap = new HashMap();\n for (RuleMultiItem rmi : PR_items)\n {\n PR_itemsMap.put(rmi.getAttribute(), rmi);\n }\n \n // check if there is no other rule classifying to different class that shares part of the region\n // matched by the antecedent of PRCandidate \n boolean clashingRuleFound=false;\n boolean positionBelowPRCand = false;\n for (Iterator<ExtendRule> innerIt = rules.iterator(); innerIt.hasNext();) {\n ExtendRule candidateClash = innerIt.next();\n // candidateClash is PRCandidate, which would always evaluate to overlap!\n\n if (candidateClash.equals(PRCandidate))\n {\n positionBelowPRCand=true;\n continue;\n }\n // candidateClash = go through all rules with OTHER than default class in consequent \n if (candidateClash.getConsequent().toString().equals(defClass.toString()))\n {\n continue;\n }\n if (!positionBelowPRCand) continue;\n \n // check if at leat one literal in PRCandidate has empty intersection with Clash on shared attribute\n \n //in case there is no shared attribute, the intersection is non empty\n ArrayList<RuleMultiItem> literalsInClashOnSharedAtt = new ArrayList();\n for (RuleMultiItem clash_rmi : candidateClash.getAntecedent().getItems())\n {\n if (PR_itemsMap.containsKey(clash_rmi.getAttribute()))\n {\n literalsInClashOnSharedAtt.add(clash_rmi);\n }\n } \n if (literalsInClashOnSharedAtt.isEmpty())\n {\n clashingRuleFound =true;\n break;\n }\n // if there is NO intersection on at leat one of the shared attributes => no CLASH\n // ELSE => CLASH\n boolean attLeastOneAttDisjunct=true;\n for (RuleMultiItem clash_rmi : literalsInClashOnSharedAtt)\n {\n //PRCandidate has a literal created over the same attribute\n RuleMultiItem machingPR_RMI = PR_itemsMap.get(clash_rmi.getAttribute());\n\n //do values in the candidate clash intersect with values in PRCandidate?\n \n for (AttributeValue v : machingPR_RMI.getAttributeValues())\n {\n if (clash_rmi.getAttributeValues().contains(v))\n {\n attLeastOneAttDisjunct=false;\n }\n }\n if (attLeastOneAttDisjunct) // if we have non-empty intersection on one att we do not have to test the other ones, rule matches different part of the data space\n {\n //go to next PRCandidate \n break;\n } \n } \n if (!attLeastOneAttDisjunct)\n {\n //go to next PRCandidate \n clashingRuleFound=true;\n break;\n } \n }\n if (clashingRuleFound == false)\n {\n //no other rule with different consequent covering at least one shared value was found\n //this rule can be removed\n LOGGER.fine(\"Removing rule:\" + PRCandidate.toString());\n it.remove();\n } \n }\n LOGGER.info(\"Rules on finish:\" + rules.size());\n LOGGER.info(\"FINISHED removeRedundantExtendedRules - range based\");\n return rules;\n }", "@Test\n public void shouldThrowCyclicDependencyExceptionIfACycleIsDetected_CycleDetectedInUpstreamNodes() {\n\n String a = \"A\";\n String b = \"B\";\n String c = \"C\";\n ValueStreamMap graph = new ValueStreamMap(b, null);\n graph.addUpstreamNode(new PipelineDependencyNode(a, a), null, b);\n graph.addUpstreamMaterialNode(new SCMDependencyNode(\"g\",\"g\",\"git\"), null, a, new MaterialRevision(null));\n graph.addDownstreamNode(new PipelineDependencyNode(a, a), b);\n graph.addDownstreamNode(new PipelineDependencyNode(c, c), a);\n\n assertThat(graph.hasCycle(), is(true));\n }", "public BGStem rule(BGStem stem) {\n\t\t\n\t\t// Get node coordinates\n\t\tArrayList <Double> node = new ArrayList<Double>();\n\t\tnode = branch(stem);\n\t\t\n\t\t// add different child stems according to the rule\n\t\tswitch(rule) {\n\t\t\n\t\tcase 1:\n\t\t\t\n\t\t\t// Create child stem instances\n\t\t\tBGStem stm1 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() - radians, stem.getDepth() + 1);\n\t\t\tBGStem stm2 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() + radians, stem.getDepth() + 1);\n\t\t\t\n\t\t\t// Set corresponding rule\n\t\t\tstm1.setRule(1);\n\t\t\tstm2.setRule(1);\n\t\t\t\n\t\t\t// Add child stems to parent stem's childList\n\t\t\tstem.getChildlist().add(stm1);\n\t\t\tstem.getChildlist().add(stm2);\n//\t\t\tSystem.out.println(\"growing 2 child stems\");\n\t\t\tbreak;\n\t\t\n\t\tcase 2:\n\t\t\t\n\t\t\tBGStem stm3 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() - radians, stem.getDepth() + 1);\n\t\t\tBGStem stm4= new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection(), stem.getDepth() + 1);\n\t\t\tBGStem stm5 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() + radians, stem.getDepth() + 1);\n\t\t\t\n\t\t\tstm3.setRule(2);\n\t\t\tstm4.setRule(2);\n\t\t\tstm4.setRule(2);\n\t\t\t\n\t\t\tstem.getChildlist().add(stm3);\n\t\t\tstem.getChildlist().add(stm4);\n\t\t\tstem.getChildlist().add(stm5);\n//\t\t\tSystem.out.println(\"growing 3 child stems\");\n\t\t\tbreak;\n\t\t\n\t\tcase 3:\n\t\t\t\n\t\t\tBGStem stm6 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() - radians, stem.getDepth() + 1);\n\t\t\tBGStem stm7 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() - radians*2, stem.getDepth() + 1);\n\t\t\tBGStem stm8 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() + radians, stem.getDepth() + 1);\n\t\t\tBGStem stm9 = new BGStem(node.get(0), node.get(1), stem.getLength()*0.66, stem.getDirection() + radians*2, stem.getDepth() + 1);\n\t\t\t\n\t\t\tstm6.setRule(3);\n\t\t\tstm7.setRule(3);\n\t\t\tstm8.setRule(3);\n\t\t\tstm9.setRule(3);\n\t\t\t\n\t\t\tstem.getChildlist().add(stm6);\n\t\t\tstem.getChildlist().add(stm7);\n\t\t\tstem.getChildlist().add(stm8);\n\t\t\tstem.getChildlist().add(stm9);\n//\t\t\tSystem.out.println(\"growing 4 child stems\");\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\treturn stem;\n\t}", "@Test\n public void testNoCyclesInAcesssHistoryGraph() throws ClassNotFoundException {\n\n List<ObjectDefinition> objectDefinitions = new ArrayList<ObjectDefinition>();\n ObjectDefinition parentDefinition = new ObjectDefinition(\"parent\", \"CyclicAccess\", 13);\n ObjectDefinition childDefinition = new ObjectDefinition(\"child\", \"CyclicAccess\", 14);\n objectDefinitions.add(parentDefinition);\n objectDefinitions.add(childDefinition);\n\n Map<ObjectDefinition, List<AccessHistory>> accesses = analysis.run(\n \"CyclicAccess\", \"tests/analysis_examples\", objectDefinitions);\n\n // For this example, the access history should show a link from a parent to a child\n // and back to a parent. But this is where the links should stop: there should not\n // be another link from the parent back to the child (a loop in the access history tree).\n AccessHistory parentAccesses = accesses.get(parentDefinition).get(0);\n AccessHistory childAccesses = (AccessHistory) parentAccesses.getFieldAccesses(\"child\").get(0);\n parentAccesses = (AccessHistory) childAccesses.getFieldAccesses(\"parent\").get(0);\n assertEquals(0, parentAccesses.getFieldAccesses(\"child\").size());\n\n }", "private ConflictCause propagateStrongly(final Assignment.Entry entry) {\n\t\tif (entry.getTruth().isMBT()) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Process binary watches.\n\t\tWatches<BinaryWatch, WatchedNoGood> watchesOfAssignedAtom = watches(entry.getAtom());\n\t\tfor (BinaryWatch binaryWatch : watchesOfAssignedAtom.binary.getAlpha(entry.getTruth().toBoolean())) {\n\t\t\tif (binaryWatch.getOtherLiteralIndex() != HEAD) {\n\t\t\t\tthrow oops(\"Binary watch for nogood with head does not point at head\");\n\t\t\t}\n\n\t\t\tConflictCause conflictCause = assignStrongComplement(binaryWatch.getNoGood(), entry.getDecisionLevel());\n\t\t\tif (conflictCause != null) {\n\t\t\t\treturn conflictCause;\n\t\t\t}\n\t\t}\n\n\t\tint assignedDecisionLevel = entry.getStrongDecisionLevel();\n\n\t\tIterator<WatchedNoGood> watchIterator = watchesOfAssignedAtom.multary.getAlpha(entry.getTruth().toBoolean()).iterator();\n\t\twhile (watchIterator.hasNext()) {\n\t\t\tfinal WatchedNoGood watchedNoGood = watchIterator.next();\n\n\t\t\tif (!watchedNoGood.hasHead()) {\n\t\t\t\tthrow oops(\"Strong propagation encountered NoGood without head\");\n\t\t\t}\n\n\t\t\tfinal int assignedIndex = watchedNoGood.getAlphaPointer();\n\n\t\t\tboolean isNoGoodSatisfiedByHead = false;\n\t\t\tAssignment.Entry headEntry = assignment.get(watchedNoGood.getAtom(HEAD));\n\t\t\t// Check if the other watch already satisfies the noGood.\n\t\t\tif (headEntry != null && TRUE.equals(headEntry.getTruth()) && !isPositive(watchedNoGood.getLiteral(HEAD))) {\n\t\t\t\tisNoGoodSatisfiedByHead = true;\n\t\t\t}\n\n\t\t\tint highestDecisionLevel = assignedDecisionLevel;\n\t\t\tint pointerCandidateIndex = assignedIndex;\n\t\t\tboolean foundPointerCandidate = false;\n\n\t\t\t// Find new literal to watch.\n\t\t\tfor (int i = 1; i < watchedNoGood.size(); i++) {\n\t\t\t\tif (i == assignedIndex) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint currentLiteral = watchedNoGood.getLiteral(i);\n\t\t\t\tAssignment.Entry currentEntry = assignment.get(atomOf(currentLiteral));\n\n\t\t\t\t// Break if: 1) current literal is unassigned (or MBT), 2) satisfies the nogood, or\n\t\t\t\t// 3) the nogood is satisfied by the head and the current literal has decision level greater than the head literal.\n\t\t\t\tif (currentEntry == null || currentEntry.getTruth().isMBT()\n\t\t\t\t\t|| currentEntry.getTruth().toBoolean() != isPositive(currentLiteral)\n\t\t\t\t\t|| (isNoGoodSatisfiedByHead && currentEntry.getStrongDecisionLevel() >= headEntry.getStrongDecisionLevel())\n\t\t\t\t\t) {\n\t\t\t\t\tfoundPointerCandidate = true;\n\t\t\t\t\tpointerCandidateIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Record literal if it has highest decision level so far.\n\t\t\t\tint currentDecisionLevel = currentEntry.getStrongDecisionLevel();\n\t\t\t\tif (currentDecisionLevel > highestDecisionLevel) {\n\t\t\t\t\thighestDecisionLevel = currentDecisionLevel;\n\t\t\t\t\tpointerCandidateIndex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (foundPointerCandidate) {\n\t\t\t\t// Move pointer to new literal.\n\t\t\t\twatchedNoGood.setAlphaPointer(pointerCandidateIndex);\n\t\t\t\twatchIterator.remove();\n\t\t\t\taddAlphaWatch(watchedNoGood);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// NoGood is unit, propagate (on potentially lower decision level).\n\t\t\tConflictCause conflictCause = assignStrongComplement(watchedNoGood, highestDecisionLevel);\n\t\t\tif (conflictCause != null) {\n\t\t\t\treturn conflictCause;\n\t\t\t}\n\n\t\t\t// Move assigned watch to now-highest position (if it changed).\n\t\t\tif (pointerCandidateIndex != assignedIndex) {\n\t\t\t\twatchedNoGood.setAlphaPointer(pointerCandidateIndex);\n\t\t\t\twatchIterator.remove();\n\t\t\t\taddAlphaWatch(watchedNoGood);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "private static void checkRecurseLax(Vector<XSParticleDecl> dChildren, int min1, int max1, SubstitutionGroupHandler dSGHandler, Vector<XSParticleDecl> bChildren, int min2, int max2, SubstitutionGroupHandler bSGHandler) throws XMLSchemaException {\n/* 1357 */ if (!checkOccurrenceRange(min1, max1, min2, max2)) {\n/* 1358 */ throw new XMLSchemaException(\"rcase-RecurseLax.1\", new Object[] {\n/* 1359 */ Integer.toString(min1), (max1 == -1) ? \"unbounded\" : \n/* 1360 */ Integer.toString(max1), \n/* 1361 */ Integer.toString(min2), (max2 == -1) ? \"unbounded\" : \n/* 1362 */ Integer.toString(max2)\n/* */ });\n/* */ }\n/* 1365 */ int count1 = dChildren.size();\n/* 1366 */ int count2 = bChildren.size();\n/* */ \n/* 1368 */ int current = 0;\n/* 1369 */ for (int i = 0; i < count1; i++) {\n/* */ \n/* 1371 */ XSParticleDecl particle1 = dChildren.elementAt(i);\n/* 1372 */ int j = current; while (true) { if (j < count2) {\n/* 1373 */ XSParticleDecl particle2 = bChildren.elementAt(j);\n/* 1374 */ current++;\n/* */ \n/* */ \n/* */ try {\n/* 1378 */ if (particleValidRestriction(particle1, dSGHandler, particle2, bSGHandler)) {\n/* 1379 */ current--;\n/* */ }\n/* */ break;\n/* 1382 */ } catch (XMLSchemaException xMLSchemaException) {}\n/* */ j++;\n/* */ continue;\n/* */ } \n/* 1386 */ throw new XMLSchemaException(\"rcase-RecurseLax.2\", null); }\n/* */ \n/* */ } \n/* */ }", "@Test\n public void verifyAllRules() throws EdgeRuleNotFoundException {\n for (SchemaVersion v : schemaVersions.getVersions()) {\n Multimap<String, EdgeRule> all = edgeIngestor.getAllRules(schemaVersions.getDefaultVersion());\n\n // this part verifies the default properties\n // 1) can have only at most 1 containment edge between same node type pair\n // 2) if there is at least 1 cousin edge, there must be exactly 1 cousin edge with default=true\n for (String key : all.keySet()) {\n\n Collection<EdgeRule> edgeRuleCollection = all.get(key);\n\n boolean foundContainment = false; // can have at most 1 containment rel btwn same pair of node types\n boolean foundCousin = false;\n boolean cousinDefault = false; // if there is a cousin edge there must be at least 1 default cousin\n // defined\n Set<String> labels = new HashSet<>(); // all edges between the same pair must have different labels\n int cousinCount = 0;\n\n for (EdgeRule rule : edgeRuleCollection) {\n EdgeRule match = rule;\n // check containment\n if (!(\"NONE\".equals(match.getContains()))) {\n if (foundContainment) {\n fail(\"more than one containment edge defined for \" + v.toString() + \" \" + key);\n } else {\n foundContainment = true;\n }\n } else { // check cousin stuff\n foundCousin = true;\n cousinCount++;\n if (match.isDefault()) {\n if (!cousinDefault) {\n cousinDefault = true;\n } else {\n fail(\"more than one cousin edge defined as default for \" + v.toString() + \" \" + key);\n }\n }\n }\n\n // check labels\n String label = match.getLabel();\n if (labels.contains(label)) {\n fail(\"same label found for multiple edges for \" + v.toString() + \" \" + key);\n } else {\n labels.add(label);\n }\n }\n if (foundCousin && !cousinDefault && cousinCount > 1) {\n fail(\"there is at least one cousin edge but none are designated the default for \" + v.toString()\n + \" \" + key);\n }\n }\n }\n }", "@Override\r\n public Set<List<String>> findAllPaths(int sourceId, int targetId, int reachability) {\r\n //all paths found\r\n Set<List<String>> allPaths = new HashSet<List<String>>();\r\n //collects path in one iteration\r\n Set<List<String>> newPathsCollector = new HashSet<List<String>>();\r\n //same as the solution but with inverted edges\r\n Set<List<String>> tmpPathsToTarget = new HashSet<List<String>>();\r\n //final solution\r\n Set<List<String>> pathsToTarget = new HashSet<List<String>>();\r\n \r\n String[] statementTokens = null; \r\n Set<Integer> allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n List<String> statementsFound = new ArrayList<String>();\r\n \r\n for (int i = 0; i < reachability; i++) {\r\n if (i == 0) { \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(sourceId);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n //allProcessedNodes.add(inNodeId); \r\n //Incoming nodes are reversed\r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n allPaths.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(sourceId);\r\n \r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n statementsFound.add(outEdge);\r\n allPaths.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n } else {\r\n newPathsCollector = new HashSet<List<String>>();\r\n\r\n for (List<String> statements: allPaths) {\r\n allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n int lastNodeInPath = 0;\r\n \r\n for (String predicate: statements) {\r\n if (predicate.contains(\">-\")) {\r\n statementTokens = predicate.split(\">-\");\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[0]).reverse().toString()));\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString()));\r\n lastNodeInPath = Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString());\r\n } else {\r\n statementTokens = predicate.split(\"->\"); \r\n allProcessedNodes.add(Integer.parseInt(statementTokens[0]));\r\n allProcessedNodes.add(Integer.parseInt(statementTokens[2]));\r\n lastNodeInPath = Integer.parseInt(statementTokens[2]);\r\n }\r\n }\r\n \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(lastNodeInPath);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n if (allProcessedNodes.contains(inNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n newPathsCollector.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(lastNodeInPath);\r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n if (allProcessedNodes.contains(outNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(outEdge);\r\n newPathsCollector.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n }\r\n allPaths.addAll(newPathsCollector);\r\n }\r\n \r\n //System.out.println(\"*****End of iteration \" + i);\r\n //System.out.println(\"#SIZE OF allPaths: \" + allPaths.size());\r\n int numItems = 0;\r\n for (List<String> currList: allPaths) {\r\n numItems = numItems + currList.size();\r\n }\r\n //System.out.println(\"#NUMBER OF ELEMS OF ALL LISTS: \" + numItems);\r\n //System.out.println(\"#SIZE OF tmpPathsToTarget : \" + tmpPathsToTarget.size());\r\n }\r\n \r\n //We need to reverse back all the predicates\r\n for (List<String> statements: tmpPathsToTarget) { \r\n List<String> fixedStatements = new ArrayList<String>(); \r\n for (int i = 0; i < statements.size(); i++) { \r\n String statement = statements.get(i); \r\n if (statement.contains(\">-\")) {\r\n fixedStatements.add(new StringBuilder(statement).reverse().toString());\r\n } else {\r\n fixedStatements.add(statement);\r\n } \r\n }\r\n pathsToTarget.add(fixedStatements);\r\n }\r\n return pathsToTarget;\r\n }", "private List<ConcurrentRule> makeConcurrentRulesDuetoDependency(\r\n\t\t\tfinal ConcurrentRule cr1, \r\n\t\t\tfinal Rule r2,\r\n\t\t\tfinal Hashtable<?, ?> matchmap) {\n\t\tfinal DependencyPairContainer \r\n\t\tdependencyContainer = this.makeDependencyPairContainer();\r\n\t\tdependencyContainer.enableProduceConcurrentRule(true);\r\n\t\t// if this.completeConcurrency Is false, only max overlapping above nodes will be considered\r\n\t\t// otherwise use all overlappings to create concurrent rules\r\n\t\tdependencyContainer.setCompleteConcurrency(this.completeConcurrency);\r\n\t\t\r\n\t\tList<ConcurrentRule> list = null; \r\n\t\ttry {\r\n\t\t\tVector<Pair<Pair<OrdinaryMorphism, OrdinaryMorphism>, Pair<OrdinaryMorphism, OrdinaryMorphism>>>\r\n\t\t\tcriticalPairs = dependencyContainer.getCriticalPair(cr1.getRule(), r2, CriticalPair.EXCLUDE, true);\r\n\t\t\tif (criticalPairs != null) {\r\n\t\t\t\tlist = dependencyContainer.getConcurrentRules();\r\n\t\t\t}\r\n\t\t} catch (Exception ex) {}\r\n\t\t\r\n\t\tif (list == null) \r\n\t\t\tlist = new Vector<ConcurrentRule>(1);\t\t\r\n\t\r\n\t\tif (this.completeConcurrency) {\r\n\t\t\t// make concurrent rule with disjoint (RHS1+LHS2) of (r1, r2)\t\r\n\t\t\tfinal ConcurrentRule cr = new ConcurrentRule(cr1, r2);\r\n\t\t\tif (cr.getRule() != null) {\r\n\t\t\t\tlist.add(cr);\r\n\t\t\t}\r\n\t\t} \r\n\t\t\r\n\t\tfor (int c=0; c<list.size(); c++) {\r\n\t\t\tif (this.completeConcurRuleBackward)\r\n\t\t\t\tlist.get(c).setSecondSourceConcurrentRule(cr1);\r\n\t\t\telse\r\n\t\t\t\tlist.get(c).setFirstSourceConcurrentRule(cr1);\r\n\t\t}\r\n\t\r\n\t\textendRuleNameByIndex(list);\r\n//\t\tSystem.out.println(\"---> ApplicabilityChecker.makeConcurrentRulessDuetoDependency: count: \"+list.size());\r\n\t\treturn list;\r\n\t}", "public void makePreferredOTTOLRelationshipsConflicts(){\n \t\tTransaction tx;\n \t\tString name = \"life\";\n \t\tIndexHits<Node> foundNodes = findTaxNodeByName(name);\n Node firstNode = null;\n if (foundNodes.size() < 1){\n System.out.println(\"name '\" + name + \"' not found. quitting.\");\n return;\n } else if (foundNodes.size() > 1) {\n System.out.println(\"more than one node found for name '\" + name + \"'not sure how to deal with this. quitting\");\n } else {\n for (Node n : foundNodes)\n firstNode = n;\n }\n \t\tTraversalDescription CHILDOF_TRAVERSAL = Traversal.description()\n \t\t\t\t.relationships( RelTypes.TAXCHILDOF,Direction.INCOMING );\n \t\tSystem.out.println(firstNode.getProperty(\"name\"));\n \t\tint count = 0;\n \t\ttx = graphDb.beginTx();\n \t\ttry{\n \t\t\tfor(Node friendnode : CHILDOF_TRAVERSAL.traverse(firstNode).nodes()){\n \t\t\t\tboolean conflict = false;\n \t\t\t\tString endNode = \"\";\n \t\t\t\tRelationship ncbirel = null;\n \t\t\t\tRelationship ottolrel = null;\n \t\t\t\tfor(Relationship rel : friendnode.getRelationships(Direction.OUTGOING)){\n \t\t\t\t\tif (rel.getEndNode() == rel.getStartNode()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}else{\n \t\t\t\t\t\tif (endNode == \"\")\n \t\t\t\t\t\t\tendNode = (String) rel.getEndNode().getProperty(\"name\");\n \t\t\t\t\t\tif ((String)rel.getEndNode().getProperty(\"name\") != endNode){\n \t\t\t\t\t\t\tconflict = true;\n \t\t\t\t\t\t}\n \t\t\t\t\t\tif(((String)rel.getProperty(\"source\")).compareTo(\"ncbi\")==0)\n \t\t\t\t\t\t\tncbirel = rel;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\tif (conflict && ncbirel != null){\n \t\t\t\t\tcount += 1;\n //\t\t\t\t\tSystem.out.println(\"would make one from \"+ncbirel.getStartNode().getProperty(\"name\")+\" \"+ncbirel.getEndNode().getProperty(\"name\"));\n \t\t\t\t\tif(ncbirel.getStartNode()!=ncbirel.getEndNode()){\n \t\t\t\t\t\tncbirel.getStartNode().createRelationshipTo(ncbirel.getEndNode(), RelTypes.PREFTAXCHILDOF);\n \t\t\t\t\t\tRelationship newrel2 = ncbirel.getStartNode().createRelationshipTo(ncbirel.getEndNode(), RelTypes.TAXCHILDOF);\n \t\t\t\t\t\tnewrel2.setProperty(\"source\", \"ottol\");\n \t\t\t\t\t}else{\n \t\t\t\t\t\tSystem.out.println(\"would make cycle from \"+ncbirel.getEndNode().getProperty(\"name\"));\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t}\n \t\t\t\tif(count % transaction_iter == 0)\n \t\t\t\t\tSystem.out.println(count);\n \t\t\t}\n \t\t\ttx.success();\n \t\t}finally{\n \t\t\ttx.finish();\n \t\t}\n \t}", "@Test\n void findCycle() {\n Map<String, Set<String>> nonCyclicGraph = Map.of(\n \"0\", Set.of(\"a\", \"b\", \"c\"),\n \"a\", Set.of(\"0\", \"a2\", \"a3\"),\n \"a2\", Set.of(\"a\"),\n \"a3\", Set.of(\"a\"),\n \"b\", Set.of(\"0\", \"b2\"),\n \"b2\", Set.of(\"b\"),\n \"c\", Set.of(\"0\")\n );\n assertThat(solution.findCycle(nonCyclicGraph)).isFalse();\n\n // 0\n // / | \\\n // a b c\n // /\\ | /\n // a2 a3 b2\n Map<String, Set<String>> cyclicGraph = Map.of(\n \"0\", Set.of(\"a\", \"b\", \"c\"),\n \"a\", Set.of(\"0\", \"a2\", \"a3\"),\n \"a2\", Set.of(\"a\"),\n \"a3\", Set.of(\"a\"),\n \"b\", Set.of(\"0\", \"b2\"),\n \"b2\", Set.of(\"b\"),\n \"c\", Set.of(\"0\", \"b2\")\n );\n assertThat(solution.findCycle(cyclicGraph)).isTrue();\n }", "private synchronized void updateFolds(final FoldHierarchyTransaction tran) {\r\n final FoldHierarchy fh = getOperation().getHierarchy();\r\n final BaseDocument doc = (BaseDocument)getOperation().getHierarchy().getComponent().getDocument();\r\n try {\r\n //parse document and create an array of folds\r\n List/*<FoldInfo>*/ generated = generateFolds2(doc);\r\n logger.fine(\"generated \" + generated.size());\r\n \r\n //get existing folds\r\n List existingFolds = FoldUtilities.findRecursive(fh.getRootFold());\r\n Iterator itr = existingFolds.iterator();\r\n \r\n final ArrayList newborns = new ArrayList(generated.size() / 2);\r\n final ArrayList/*<Fold>*/ zombies = new ArrayList(generated.size() / 2);\r\n \r\n //delete unexisting\r\n while(itr.hasNext()) {\r\n Fold f = (Fold)itr.next();\r\n if(!generated.contains(new FoldInfo(f.getStartOffset(), f.getEndOffset(), -1, \"\"))) {\r\n //delete this one\r\n logger.fine(\"adding \" + f + \" to zombies\");\r\n zombies.add(f);\r\n }\r\n }\r\n \r\n //and create new ones\r\n itr = generated.iterator();\r\n while(itr.hasNext()) {\r\n FoldInfo fi = (FoldInfo)itr.next();\r\n Iterator existingItr = existingFolds.iterator();\r\n boolean add = true;\r\n while(existingItr.hasNext()) {\r\n Fold f = (Fold)existingItr.next();\r\n if(f.getStartOffset() == fi.startOffset && f.getEndOffset() == fi.endOffset) {\r\n add = false;\r\n }\r\n }\r\n if(add) {\r\n newborns.add(fi);\r\n logger.fine(\"adding \" + fi + \" to newborns\");\r\n }\r\n }\r\n \r\n //run folds update in event dispatching thread\r\n Runnable updateTask = new Runnable() {\r\n public void run() {\r\n //lock the document for changes\r\n doc.readLock();\r\n try {\r\n //lock the hierarchy\r\n fh.lock();\r\n try {\r\n try {\r\n //remove outdated folds\r\n Iterator i = zombies.iterator();\r\n while(i.hasNext()) {\r\n Fold f = (Fold)i.next();\r\n getOperation().removeFromHierarchy(f, tran);\r\n }\r\n \r\n //add new folds\r\n Iterator newFolds = newborns.iterator();\r\n while(newFolds.hasNext()) {\r\n FoldInfo f = (FoldInfo)newFolds.next();\r\n getOperation().addToHierarchy(GROUP, f.label, false, f.startOffset , f.endOffset , 0, 0, null, tran);\r\n }\r\n }catch(BadLocationException ble) {\r\n //when the document is closing the hierarchy returns different empty document, grrrr\r\n ErrorManager.getDefault().notify(ble);\r\n }\r\n// }finally {\r\n// tran.commit();\r\n// }\r\n } finally {\r\n fh.unlock();\r\n }\r\n } finally {\r\n doc.readUnlock();\r\n }\r\n }\r\n };\r\n \r\n if(SwingUtilities.isEventDispatchThread()) {\r\n updateTask.run();\r\n } else {\r\n SwingUtilities.invokeAndWait(updateTask);\r\n }\r\n \r\n \r\n }catch(BadLocationException e) {\r\n ErrorManager.getDefault().notify(e);\r\n }catch(InterruptedException ie) {\r\n ;\r\n }catch(InvocationTargetException ite) {\r\n ErrorManager.getDefault().notify(ite);\r\n }\r\n }", "private boolean cyclicUpdate() {\n if (cyclicUpdate_EM()) {\n mUpdate = 0;\n return true;\n }\n return false;\n }", "@Test\n public void shouldNotConsiderTriangleDependencyAsCyclic(){\n\n String a = \"A\";\n String b = \"B\";\n String c = \"C\";\n String d = \"D\";\n ValueStreamMap valueStreamMap = new ValueStreamMap(c, null);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(a, a), null, c);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(b, b), null, c);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(d, d), null, b);\n valueStreamMap.addUpstreamNode(new PipelineDependencyNode(a, a), null, d);\n valueStreamMap.addUpstreamMaterialNode(new SCMDependencyNode(\"g\", \"g\", \"git\"), null, a, new MaterialRevision(null));\n\n assertThat(valueStreamMap.hasCycle(), is(false));\n }", "public void traversePreOrder() {\n\t\tpreOrder(this);\n\t}", "private static void iddfs(State curr, int depth) {\n for(int i = 0; i <= depth; i++) {\r\n\r\n if(curr.isGoalState()) \r\n System.out.println(i+\":\"+curr.getOrderedPair()+\" Goal\");//initial is goal state\r\n else\r\n System.out.println(i+\":\"+curr.getOrderedPair());//initial\r\n\r\n curr.close.add(curr);\r\n State currState = curr;\r\n while(!currState.isGoalState()) {\r\n if(currState.depth < i)\r\n curr.buildStack(currState.getSuccessors(currState));\r\n System.out.print(i+\":\");\r\n curr.printHelp(currState, 5);\r\n if(!curr.open.isEmpty()) {\r\n currState = curr.open.get(curr.open.size()-1);\r\n curr.close.add(curr.open.remove(curr.open.size()-1));\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n if(currState.isGoalState()) {\r\n System.out.println(i+\":\"+currState.getOrderedPair() + \" Goal\");\r\n curr.printPath(currState);\r\n return;\r\n }\r\n curr.open.clear(); curr.close.clear();\r\n }\r\n }", "public void solveGame4() {\n\t\tlosingStates = new HashSet<S>();\n\t\t\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tList<Set<S>> uncontrollableSuccessors = new ArrayList<Set<S>>();\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> currentUncontrollableSuccesors;\n\t\tSet<S> currentSet; \n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\tcurrentUncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\t\t\tcurrentSet = new HashSet<S>();\n\t\t\tfor(S s: currentUncontrollableSuccesors){\n\t\t\t\tif((!relaxOnAssumptions || (!assumptionsStates.contains(s) || assumptionsStates.contains(state))\n\t\t\t\t\t\t&& (!relaxSelfLoops || (!s.equals(state)))))\n\t\t\t\t\tcurrentSet.add(s);\n\t\t\t}\n\t\t\t uncontrollableSuccessors.add(currentSet);\n\t\t\t isUncontrollable[indexCount] = currentSet.size() > 0;\n\t\t\t indexCount+=1;\n\t\t}\n\t\t\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t}\n\n\t\t// Handle the pending states\n\t\twhile (!losing.isEmpty()) {\n\t\t\tS state = losing.poll();\n\n\t\t\t\n\t\t\tlosingStates.add(state);\n\n\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\tfor (S pred : predecessors) {\n\t\t\t\tif(losing.contains(pred) || losingStates.contains(pred))\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t//if(i == -1)\n\t\t\t\t\t//continue;\n\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}else{\n\t\t\t\t\tuncontrollableSuccessors.get(i).remove(state);\n\t\t\t\t\tif(uncontrollableSuccessors.get(i).isEmpty())\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "private void performRule(DataNormalizationRule rule, GraphModification modifications) throws DataNormalizationException, DatabaseException, SQLException {\n\t\tif (inputGraph.getGraphName().length() == 0) {\n\t\t\tthrow new DataNormalizationException(\"Empty Graph Name is not allowed.\");\n\t\t}\n\n\t\tif (modifications == null) {\n\t\t\t/**\n\t\t\t * In case there is no interest in what was changed just perform all the components in the correct order\n\t\t\t */\n\t\t\tperformComponents(rule, inputGraph.getGraphName());\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tgetDirtyConnection().execute(markTemporaryGraph, original);\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, backupQueryFormat, original, inputGraph.getGraphName()));\n\n\t\t\t\tperformComponents(rule, inputGraph.getGraphName());\n\n\t\t\t\tgetDirtyConnection().execute(markTemporaryGraph, modified);\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, backupQueryFormat, modified, inputGraph.getGraphName()));\n\n\t\t\t\t/**\n\t\t\t\t * Unfortunatelly \"SELECT ?s ?p ?o WHERE {{GRAPH <%s> {?s ?p ?o}} MINUS {GRAPH <%s> {?s ?p ?o}}}\"\n\t\t\t\t * throws \"Internal error: 'output:valmode' declaration conflicts with 'output:format'\"\n\t\t\t\t *\n\t\t\t\t * Therefore it is necessary to first create graphs with differences.\n\t\t\t\t */\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, diffQueryFormat, modified, original));\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, diffQueryFormat, original, inputGraph.getGraphName()));\n\n\t\t\t\tWrappedResultSet inserted = getDirtyConnection().executeSelect(String.format(Locale.ROOT, selectQueryFormat, modified));\n\n\t\t\t\t/**\n\t\t\t\t * All that is new to the transformed graph are insertions done by this rule (one of its components)\n\t\t\t\t */\n\t\t\t\twhile (inserted.next()) {\n\t\t\t\t\tmodifications.addInsertion(rule,\n\t\t\t\t\t\t\tinserted.getString(\"s\"),\n\t\t\t\t\t\t\tinserted.getString(\"p\"),\n\t\t\t\t\t\t\tinserted.getString(\"o\"));\n\t\t\t\t}\n\n\t\t\t\tWrappedResultSet deleted = getDirtyConnection().executeSelect(String.format(Locale.ROOT, selectQueryFormat, original));\n\n\t\t\t\t/**\n\t\t\t\t * All that is missing from the transformed graph are deletions done by this rule (one of its components)\n\t\t\t\t */\n\t\t\t\twhile (deleted.next()) {\n\t\t\t\t\tmodifications.addDeletion(rule,\n\t\t\t\t\t\t\tdeleted.getString(\"s\"),\n\t\t\t\t\t\t\tdeleted.getString(\"p\"),\n\t\t\t\t\t\t\tdeleted.getString(\"o\"));\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, dropBackupQueryFormat, original));\n\t\t\t\t} finally {}\n\t\t\t\ttry {\n\t\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, dropBackupQueryFormat, modified));\n\t\t\t\t} finally {}\n\t\t\t\tgetDirtyConnection().execute(unmarkTemporaryGraph, original);\n\t\t\t\tgetDirtyConnection().execute(unmarkTemporaryGraph, modified);\n\t\t\t}\n\t\t}\n\t\tLOG.info(String.format(Locale.ROOT, \"Data Normalization rule %d applied: %s\", rule.getId(), rule.getLabel() != null ? rule.getLabel() : \"\"));\n\t}", "private Boolean checkCycle() {\n Node slow = this;\n Node fast = this;\n while (fast.nextNode != null && fast.nextNode.nextNode != null) {\n fast = fast.nextNode.nextNode;\n slow = slow.nextNode;\n if (fast == slow) {\n System.out.println(\"contains cycle\");\n return true;\n }\n }\n System.out.println(\"non-cycle\");\n return false;\n }", "private void actOnRules() {\r\n\r\n\t\tfor(String key: myRuleBook.keySet())\r\n\t\t{\r\n\r\n\t\t\tRule rule = myRuleBook.get(key);\r\n\t\t\tSpriteGroup[] obedients = myRuleMap.get(rule);\r\n\r\n\t\t\tif(rule.isSatisfied(obedients))\r\n\t\t\t{\r\n\t\t\t\trule.enforce(obedients);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void findCycles(ClassDecl decl, String className, int numClasses){\n\t //base case: our decl is null, return and break out of this method\n if (decl == null) {\n return;\n }\n //base case: if numClasses is 0 and we see the name, its a cycle, throw error\n else if(numClasses == 0 || decl.name.equals(className)) {\n errorMsg.error(decl.pos, \"Circular reference found: \" + decl.name);\n }\n else { //recursive case, call findCycles on the remaining links\n findCycles(decl.superLink, className, numClasses - 1);\n }\n }", "private void awayFromCycle(Graph graph, Node a, Node b, Node c) {\n if ((graph.isAdjacentTo(a, c)) &&\n (graph.getEndpoint(a, c) == Endpoint.ARROW) &&\n (graph.getEndpoint(c, a) == Endpoint.CIRCLE)) {\n if (graph.isDirectedFromTo(a, b) && graph.isDirectedFromTo(b, c)) {\n graph.setEndpoint(c, a, Endpoint.TAIL);\n changeFlag = true;\n }\n }\n }", "public void solveGame() {\n\t\tlosingStates = new HashSet<S>();\n\t\t\n\t\tQueue<S> losing = new LinkedList<S>();\n\t\tList<Set<S>> uncontrollableSuccessors = new ArrayList<Set<S>>();\n\t\tboolean[] isUncontrollable = new boolean[game.getStates().size()+1];\n\t\tHashMap<S, Integer> stateToIndex = new HashMap<S, Integer>();\n\t\t\n\t\tSet<S> currentUncontrollableSuccesors;\n\t\tSet<S> currentSet; \n\t\tint i;\n\t\tint indexCount = 0;\n\t\tfor(S state:game.getStates()){\n\t\t\tstateToIndex.put(state, indexCount);\n\t\t\t //if(i == -1)\n\t\t\t\t//continue;\n\t\t\tcurrentUncontrollableSuccesors = ((Set<S>)this.game.getUncontrollableSuccessors(state));\n\t\t\tcurrentSet = new HashSet<S>();\n\t\n\t\t\tif(!relaxAllControllables){\n\t\t\t\tfor(S s: currentUncontrollableSuccesors){\n\t\t\t\t\tif((!relaxOnAssumptions || (!assumptionsStates.contains(s) || assumptionsStates.contains(state))\n\t\t\t\t\t\t\t&& (!relaxSelfLoops || (!s.equals(state)))))\n\t\n\t\t\t\t\t\tcurrentSet.add(s);\n\t\t\t\t}\n\t\t\t}\n\t\t\t uncontrollableSuccessors.add(currentSet);\n\t\t\t isUncontrollable[indexCount] = currentSet.size() > 0;\n\t\t\t indexCount+=1;\n\t\t}\n\n\t\tlosingStates.addAll(game.getStates());\n\t\t\n\t\tSet<S> currentLosingStates;\n\t\tfor (Set<S> actualGoalSet : this.goalStates) {\n\t\t\tlosing.addAll(actualGoalSet);\n\t\t\tcurrentLosingStates\t= new HashSet<S>();\n\t\t\t\n\t\t\t// Handle the pending states\n\t\t\twhile (!losing.isEmpty()) {\n\t\t\t\tS state = losing.poll();\n\n\t\t\t\t\n\t\t\t\tcurrentLosingStates.add(state);\n\n\t\t\t\tSet<S> predecessors = this.game.getPredecessors(state);\n\t\t\t\tfor (S pred : predecessors) {\n\t\t\t\t\tif(losing.contains(pred) || currentLosingStates.contains(pred))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\n\t\t\t\t\ti = stateToIndex.get(pred);\n\t\t\t\t\t//if(i == -1)\n\t\t\t\t\t\t//continue;\n\t\t\t\t\tif (!isUncontrollable[i]) {\n\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tuncontrollableSuccessors.get(i).remove(state);\n\t\t\t\t\t\tif(uncontrollableSuccessors.get(i).isEmpty())\n\t\t\t\t\t\t\tlosing.add(pred);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tlosingStates.retainAll(currentLosingStates);\n\t\t\t\n\t\t}\n\n\n\t\tSystem.out.println(\"LOSING STATES SIZe : \" + losingStates.size());\n\t\t\n\t\tthis.gameSolved = true;\n\t}", "public SemanticError checkCyclicInheritance() {\n\t\tMap<String, VSOPClass> map = new HashMap<>();\n\n\t\tfor (VSOPClass c = superClass; c != null; c = c.superClass) {\n\t\t\tif (c == this) {\n\t\t\t\treturn new SemanticError(ln, col, String.format(\"Cyclic inheritance of class %s\", id));\n\t\t\t}\n\n\t\t\tif (map.containsKey(c.id))\n\t\t\t\treturn null;\n\n\t\t\tmap.put(c.id, c);\n\t\t}\n\n\t\treturn null;\n\t}", "private void installRulesOnFlow()\n\t{\t\t\t\n\t\tVertex sourceVertex = m_graph.getSourceVertex();\n\t\tshort vlanNum = 1;\n\t\tfor(Edge sourceOutEdge :sourceVertex.getOutgoingEdges())\n\t\t{\n\t\t\tif(sourceOutEdge.getFlow()>0)\n\t\t\t{\n\t\t\t\tattachIpAddressToVlan(vlanNum);\n\t\t\t\tinstallRule(sourceVertex.getName(), sourceOutEdge.getSourcePort(), vlanNum,RULE_TYPE.SOURCE_ADD_VLAN);\n\t\t\t\tinstallRule(sourceOutEdge.getTo().getName(), sourceOutEdge.getDestPort(), vlanNum,RULE_TYPE.DEST_IPV4);\n\t\t\t\tinstallRule(sourceVertex.getName(), sourceOutEdge.getSourcePort(), vlanNum,RULE_TYPE.SOURCE_ARP_ADD_VLAN);\n\t\t\t\tinstallRule(sourceOutEdge.getTo().getName(), sourceOutEdge.getDestPort(), vlanNum,RULE_TYPE.DEST_ARP);\n\t\t\t\tinstallRuleToHostSrc(sourceVertex.getName(),vlanNum, sourceOutEdge.getSourcePort());\n\t\t\t\tsourceOutEdge.setIsRuleInstalled();\n\t\t\t\tinstallRulesOnFlowDFS(sourceOutEdge.getTo(),vlanNum);\n\t\t\t\tvlanNum++;\n\t\t\t}\n\t\t}\t\n\t}" ]
[ "0.671652", "0.6148483", "0.5838766", "0.57453984", "0.5698783", "0.56802666", "0.5650435", "0.56335753", "0.5617865", "0.5592831", "0.5565909", "0.5565874", "0.554377", "0.55356765", "0.5518426", "0.5484975", "0.5478976", "0.5460071", "0.5433312", "0.5423964", "0.54106224", "0.5404966", "0.53804564", "0.53790885", "0.5355245", "0.5352841", "0.53138334", "0.53085846", "0.5275368", "0.527056", "0.52539593", "0.52524734", "0.52405787", "0.5234895", "0.52314913", "0.52310246", "0.52242476", "0.5202779", "0.52025497", "0.5191192", "0.51904416", "0.5175342", "0.5166765", "0.5162462", "0.5152072", "0.5151627", "0.5143881", "0.5140581", "0.5131558", "0.5120348", "0.5114585", "0.51084596", "0.5098555", "0.5091778", "0.508286", "0.5081624", "0.5081291", "0.50786245", "0.5077138", "0.50731355", "0.5072258", "0.5069586", "0.50693667", "0.5068947", "0.506585", "0.5060859", "0.50501543", "0.5048361", "0.50477916", "0.5043735", "0.5040385", "0.50387865", "0.5035271", "0.50318825", "0.5028163", "0.5027588", "0.50228053", "0.5021131", "0.5013249", "0.50091213", "0.50061053", "0.49991855", "0.4997495", "0.49960893", "0.4994735", "0.49930185", "0.4992379", "0.49902293", "0.49882135", "0.49849638", "0.4983185", "0.4975335", "0.49752682", "0.49616647", "0.495855", "0.49551067", "0.49549136", "0.49537423", "0.49529102", "0.4948359" ]
0.66550225
1
Does all 3 of these rules at once instead of going through all triples multiple times per iteration of doFinalOrientation.
private void awayFromColliderAncestorCycle(Graph graph) { List<Node> nodes = graph.getNodes(); for (Node B : nodes) { List<Node> adj = graph.getAdjacentNodes(B); if (adj.size() < 2) { continue; } ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2); int[] combination; while ((combination = cg.next()) != null) { Node A = adj.get(combination[0]); Node C = adj.get(combination[1]); //choice gen doesnt do diff orders, so must switch A & C around. // awayFromCollider(graph, A, B, C); // awayFromCollider(graph, C, B, A); // awayFromAncestor(graph, A, B, C); // awayFromAncestor(graph, C, B, A); // awayFromCycle(graph, A, B, C); // awayFromCycle(graph, C, B, A); ruleR1(A, B, C, graph); ruleR1(C, B, A, graph); ruleR2(A, B, C, graph); ruleR2(C, B, A, graph); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void doFinalOrientation(Graph graph) {\n discrimGraphs.clear();\n Set<Graph> currentDiscrimGraphs = new HashSet<>();\n currentDiscrimGraphs.add(graph);\n while (changeFlag) {\n changeFlag = false;\n currentDiscrimGraphs.addAll(discrimGraphs);\n discrimGraphs.clear();\n for (Graph newGraph : currentDiscrimGraphs) {\n doubleTriangle(newGraph);\n awayFromColliderAncestorCycle(newGraph);\n if (!discrimPaths(newGraph)) {\n if (changeFlag) {\n discrimGraphs.add(newGraph);\n } else {\n finalResult.add(newGraph);\n }\n }\n }\n currentDiscrimGraphs.clear();\n }\n changeFlag = true;\n }", "static void adjustOrientation(Triangulator triRef, int i1, int i2) {\n\n\tdouble area;\n\tint i, outer;\n\tint ind;\n\n\tif(i1 >= i2)\n\t System.out.println(\"Orientation:adjustOrientation Problem i1>=i2 !!!\");\n\n\tif (triRef.numLoops >= triRef.maxNumPolyArea) {\n\t // System.out.println(\"Orientation:adjustOrientation Expanding polyArea array .\");\n\t triRef.maxNumPolyArea = triRef.numLoops;\n\t double old[] = triRef.polyArea;\n\t triRef.polyArea = new double[triRef.maxNumPolyArea];\n\t if(old != null)\n\t\tSystem.arraycopy(old, 0, triRef.polyArea, 0, old.length);\n\t}\n\n\t// for each contour, compute its signed area, i.e., its orientation. the\n\t// contour with largest area is assumed to be the outer-most contour.\n\tfor (i = i1; i < i2; ++i) {\n\t ind = triRef.loops[i];\n\t triRef.polyArea[i] = polygonArea(triRef, ind);\n\t}\n\n\t// determine the outer-most contour\n\tarea = Math.abs(triRef.polyArea[i1]);\n\touter = i1;\n\tfor (i = i1 + 1; i < i2; ++i) {\n\t if (area < Math.abs(triRef.polyArea[i])) {\n\t\tarea = Math.abs(triRef.polyArea[i]);\n\t\touter = i;\n\t }\n\t}\n\n\t// default: the outer contour is referenced by loops[i1]\n\tif (outer != i1) {\n\t ind = triRef.loops[i1];\n\t triRef.loops[i1] = triRef.loops[outer];\n\t triRef.loops[outer] = ind;\n\n\t area = triRef.polyArea[i1];\n\t triRef.polyArea[i1] = triRef.polyArea[outer];\n\t triRef.polyArea[outer] = area;\n\t}\n\n\t// adjust the orientation\n\tif (triRef.polyArea[i1] < 0.0) triRef.swapLinks(triRef.loops[i1]);\n\tfor (i = i1 + 1; i < i2; ++i) {\n\t if (triRef.polyArea[i] > 0.0) triRef.swapLinks(triRef.loops[i]);\n\t}\n }", "@Test\n\tpublic void checkMultipleSolutions() {\n\n\t\tOrientationHistogramSift alg = new OrientationHistogramSift(36,2.5,1.5);\n\n\t\tdouble theta0 = 1.2;\n\t\tdouble c0 = Math.cos(theta0);\n\t\tdouble s0 = Math.sin(theta0);\n\t\tdouble theta1 = 2.1;\n\t\tdouble c1 = Math.cos(theta1);\n\t\tdouble s1 = Math.sin(theta1);\n\n\t\tint N = ss.getNumOctaves()*ss.getNumScales();\n\n\t\tfor( int i = 0; i < N; i++ ) {\n\t\t\tImageFloat32 img = ss.getPyramidLayer(i);\n\n\t\t\tint x = img.width/2;\n\t\t\tint y = img.height/2;\n\n\t\t\tss.getDerivativeX(i).set(x, y, (float) c0);\n\t\t\tss.getDerivativeY(i).set(x, y, (float) s0);\n\t\t\tss.getDerivativeX(i).set(x, y + 1, (float) c1);\n\t\t\tss.getDerivativeY(i).set(x, y + 1, (float) s1);\n\t\t}\n\n\t\talg.setScaleSpace(ss);\n\t\talg.process(width/2,height/2,3);\n\n\t\tGrowQueue_F64 found = alg.getOrientations();\n\t\tassertEquals(2,found.size);\n\n\t\t// assume the order for now\n\t\tassertTrue(Math.abs(UtilAngle.distHalf(1.2, found.get(0))) <= tol);\n\t\tassertTrue(Math.abs(UtilAngle.distHalf(2.1, found.get(1))) <= tol);\n\t}", "protected void initTransforms() {\n for (int i = 0; i < cornerCount; i++) {\n int index = cornerOffset + i;\n identityVertexMatrix[index] = new idx3d_Matrix();\n }\n\n // 0:urf\n identityVertexMatrix[cornerOffset + 0].rotate(0, -HALF_PI, 0);\n // 1:dfr\n identityVertexMatrix[cornerOffset + 1].rotate(0, 0, PI);\n // 2:ubr\n identityVertexMatrix[cornerOffset + 2].rotate(0, PI, 0);\n // 3:drb\n identityVertexMatrix[cornerOffset + 3].rotate(0, 0, PI);\n identityVertexMatrix[cornerOffset + 3].rotate(0, -HALF_PI, 0);\n // 4:ulb\n identityVertexMatrix[cornerOffset + 4].rotate(0, HALF_PI, 0);\n // 5:dbl\n identityVertexMatrix[cornerOffset + 5].rotate(PI, 0, 0);\n // 6:ufl\n //--no transformation---\n // 7:dlf\n identityVertexMatrix[cornerOffset + 7].rotate(0, HALF_PI, 0);\n identityVertexMatrix[cornerOffset + 7].rotate(PI, 0, 0);\n //\n // We can clone the normalmatrix here form the vertex matrix, because\n // the vertex matrix consists of rotations only.\n for (int i = 0; i < cornerCount; i++) {\n identityNormalMatrix[i] = identityVertexMatrix[i].getClone();\n }\n\n /**\n * Edges\n */\n // Move all edge parts to front up (fu) and then rotate them in place\n for (int i = 0; i < edgeCount; i++) {\n int index = edgeOffset + i;\n idx3d_Matrix vt = new idx3d_Matrix();\n idx3d_Matrix nt = new idx3d_Matrix();\n identityVertexMatrix[index] = vt;\n identityNormalMatrix[index] = nt;\n // The vertex matrix is the same as the normal matrix, but with\n // an additional shift, which is made before the rotation.\n if (i >= 12) {\n switch ((i - 12) % 24) {\n case 12:\n case 13:\n case 2:\n case 3:\n case 4:\n case 17:\n case 6:\n case 19:\n case 20:\n case 21:\n case 10:\n case 11:\n vt.shift(PART_LENGTH*((i+12)/24), 0f, 0f);\n break;\n default:\n vt.shift(-PART_LENGTH*((i+12)/24), 0f, 0f);\n break;\n }\n }\n // Now we do the rotation with the normal matrix only\n switch (i % 12) {\n case 0: // ur\n nt.rotate(0, HALF_PI, 0f);\n nt.rotate(0, 0, HALF_PI);\n break;\n case 1: // rf\n nt.rotate(0, -HALF_PI, 0);\n nt.rotate(HALF_PI, 0, 0);\n break;\n case 2: // dr\n nt.rotate(0, -HALF_PI, HALF_PI);\n break;\n case 3: // bu\n nt.rotate(0, PI, 0);\n break;\n case 4: // rb\n nt.rotate(0, 0, HALF_PI);\n nt.rotate(0, -HALF_PI, 0);\n break;\n case 5: // bd\n nt.rotate(PI, 0, 0);\n break;\n case 6: // ul\n nt.rotate(-HALF_PI, -HALF_PI, 0);\n break;\n case 7: // lb\n nt.rotate(0, 0, -HALF_PI);\n nt.rotate(0, HALF_PI, 0);\n break;\n case 8: // dl\n nt.rotate(HALF_PI, HALF_PI, 0);\n break;\n case 9: // fu\n //--no transformation--\n break;\n case 10: // lf\n nt.rotate(0, 0, HALF_PI);\n nt.rotate(0, HALF_PI, 0);\n break;\n case 11: // fd\n nt.rotate(0, 0, PI);\n break;\n }\n // Finally, we concatenate the rotation to the vertex matrix\n vt.transform(nt);\n }\n /* Sides\n */\n // Move all side parts to the front side and rotate them into place\n for (int i = 0; i < sideCount; i++) {\n int index = sideOffset + i;\n idx3d_Matrix vt = new idx3d_Matrix();\n idx3d_Matrix nt = new idx3d_Matrix();\n identityVertexMatrix[index] = vt;\n identityNormalMatrix[index] = nt;\n // The vertex matrix is the same as the normal matrix, but with\n // an additional shift, which is made before the rotation.\n switch (i / 6) {\n // central part\n case 0 :\n // vt.shift(0, 0, 0);\n break;\n // inner ring\n case 1:\n vt.shift(-PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 2:\n vt.shift(-PART_LENGTH, PART_LENGTH, 0);\n break;\n case 3:\n vt.shift(PART_LENGTH, PART_LENGTH, 0);\n break;\n case 4:\n vt.shift(PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 5:\n vt.shift(0, -PART_LENGTH, 0);\n break;\n case 6:\n vt.shift(-PART_LENGTH, 0, 0);\n break;\n case 7:\n vt.shift(0, PART_LENGTH, 0);\n break;\n case 8:\n vt.shift(PART_LENGTH, 0, 0);\n break;\n // outer ring corners\n /*\n * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n * | .0 | .2 | .3 | .1 |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |75 |129|81 |105|57 | | |62 |140|92 |116|68 | | |66 |144|96 |120|72 | | |59 |137|89 |113|65 | |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |123|27 |33 | 9 |135| | |110|14 |44 |20 |146| | |114|18 |48 |24 |126| | |107|11 |41 |17 |143| |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | .3|99 |51 | 3 |39 |87 |.1 | .1|86 |38 | 2 |50 |98 |.3 | .2|90 |42 | 0 |30 |78 |.0 | .0|83 |35 | 5 |47 |95 |.2 |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |147|21 |45 |15 |111| | |134| 8 |32 |26 |122| | |138|12 |36 | 6 |102| | |131|29 |53 |23 |119| |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |69 |117|93 |141|63 | | |56 |104|80 |128|74 | | |60 |108|84 |132|54 | | |77 |125|101|149|71 | |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | .2 | .0 | .1 | .3 |\n * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n */\n case 9:\n vt.shift(-2f*PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 10:\n vt.shift(-2f*PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 11:\n vt.shift(2f*PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 12:\n vt.shift(2f*PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n // outer ring central edges\n case 13:\n vt.shift(0, -2f*PART_LENGTH, 0);\n break;\n case 14:\n vt.shift(-2f*PART_LENGTH, 0, 0);\n break;\n case 15:\n vt.shift(0, 2f*PART_LENGTH, 0);\n break;\n case 16:\n vt.shift(2f*PART_LENGTH, 0, 0);\n break;\n // outer ring clockwise shifted edges\n case 17:\n vt.shift(-PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 18:\n vt.shift(-2f*PART_LENGTH, PART_LENGTH, 0);\n break;\n case 19:\n vt.shift(PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 20:\n vt.shift(2f*PART_LENGTH, -PART_LENGTH, 0);\n break;\n // outer ring counter-clockwise shifted edges\n case 21:\n vt.shift(PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 22:\n vt.shift(-2f*PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 23:\n vt.shift(-PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 24:\n vt.shift(2f*PART_LENGTH, PART_LENGTH, 0);\n break;\n\n }\n\n switch (i % 6) {\n case 0 : // r\n nt.rotate(0f, 0f, -HALF_PI);\n nt.rotate(0f, -HALF_PI, 0f);\n break;\n case 1 : // u\n nt.rotate(0f, 0f, HALF_PI);\n nt.rotate(-HALF_PI, 0f, 0f);\n break;\n case 2 : // f\n //--no transformation--\n break;\n case 3 : // l\n nt.rotate(0f, 0f, PI);\n nt.rotate(0f, HALF_PI, 0f);\n break;\n case 4 : // d\n nt.rotate(0f, 0f, PI);\n nt.rotate(HALF_PI, 0f, 0f);\n break;\n case 5 : // b\n nt.rotate(0f, 0f, HALF_PI);\n nt.rotate(0f, PI, 0f);\n break;\n }\n // Finally, we concatenate the rotation to the vertex matrix\n vt.transform(nt);\n }\n\n\n // Center part\n identityVertexMatrix[centerOffset] = new idx3d_Matrix();\n identityNormalMatrix[centerOffset] = new idx3d_Matrix();\n\n // copy all vertex locationTransforms into the normal locationTransforms.\n // create the locationTransforms\n for (int i = 0; i < partCount; i++) {\n\n locationTransforms[i] = new idx3d_Group();\n locationTransforms[i].matrix.set(identityVertexMatrix[i]);\n locationTransforms[i].normalmatrix.set(identityNormalMatrix[i]);\n\n explosionTransforms[i] = new idx3d_Group();\n explosionTransforms[i].addChild(parts[i]);\n locationTransforms[i].addChild(explosionTransforms[i]);\n }\n }", "private void normalizeOrientation() {\n\t\twhile (this.orientation >= 2 * Math.PI) {\n\t\t\torientation -= 2 * Math.PI;\n\t\t}\n\t\twhile (this.orientation < 0) {\n\t\t\torientation += 2 * Math.PI;\n\t\t}\n\t}", "static void determineOrientation(Triangulator triRef, int ind) {\n\tdouble area;\n\n\t// compute the polygon's signed area, i.e., its orientation.\n\tarea = polygonArea(triRef, ind);\n\n\t// adjust the orientation (i.e., make it CCW)\n\tif (area < 0.0) {\n\t triRef.swapLinks(ind);\n\t triRef.ccwLoop = false;\n\t}\n\n }", "@Override\n\tprotected void createInitialPermutations()\n\t{\n mOrientations[0] = new Permutation( this, null );\n\n // first, define the 7-fold rotation\n int[] map = new int[]{ 1, 2, 3, 4, 5, 6, 0, 8, 9, 10, 11, 12, 13, 7 };\n mOrientations[1] = new Permutation( this, map );\n\n // then, then 2-fold rotation\n map = new int[]{ 7, 13, 12, 11, 10, 9, 8, 0, 6, 5, 4, 3, 2, 1 };\n mOrientations[7] = new Permutation( this, map );\n }", "private boolean checkStatesByOrientations(Puzzle puzzle) {\n for (int top = 0; top < ORIENTATIONS.size(); top++)\n for (int bottom = 0; bottom < ORIENTATIONS.size(); bottom++)\n for (int left = 0; left < ORIENTATIONS.size(); left++)\n for (int right = 0; right < ORIENTATIONS.size(); right++)\n for (int back = 0; back < ORIENTATIONS.size(); back++)\n for (int front = 0; front < ORIENTATIONS.size(); front++) {\n Puzzle orientationPuzzle = new Puzzle(new PuzzlePiece(puzzle.getTopPuzzlePiece(), ORIENTATIONS.get(top)),\n new PuzzlePiece(puzzle.getBottomPuzzlePiece(), ORIENTATIONS.get(bottom)),\n new PuzzlePiece(puzzle.getLeftPuzzlePiece(), ORIENTATIONS.get(left)),\n new PuzzlePiece(puzzle.getRightPuzzlePiece(), ORIENTATIONS.get(right)),\n new PuzzlePiece(puzzle.getBackPuzzlePiece(), ORIENTATIONS.get(back)),\n new PuzzlePiece(puzzle.getFrontPuzzlePiece(), ORIENTATIONS.get(front)));\n if (canMatchConditions(orientationPuzzle)) {\n solutions.put(solutions.size(), orientationPuzzle);\n logger.debug(\"Solution : \" + orientationPuzzle);\n return true;\n }\n }\n return false;\n }", "@Test\n public void testCondition5()\n {\n Double[] coordinates = null;\n Double before[] = _renderable.orientation();\n _renderable.orientation(coordinates);\n Double after[] = _renderable.orientation();\n assertEquals(\"orientation array changed\", before[0], after[0], 0.01);\n assertEquals(\"orientation array changed\", before[1], after[1], 0.01);\n assertEquals(\"orientation array changed\", before[2], after[2], 0.01);\n }", "private void processOrientation(Quaternion raw) {\r\n\t\tfloat t = 1.0f - (raw.x * raw.x) - (raw.y * raw.y) - (raw.z * raw.z);\r\n\t\tif (t < 0.0f) raw.w = 0.0f;\r\n\t\telse raw.w = -(FastMath.sqrt(t));\r\n\t}", "void orientation(double xOrientation, double yOrientation, double zOrientation);", "private void rotate() {\n byte tmp = topEdge;\n topEdge = leftEdge;\n leftEdge = botEdge;\n botEdge = rightEdge;\n rightEdge = tmp;\n tmp = reversedTopEdge;\n reversedTopEdge = reversedLeftEdge;\n reversedLeftEdge = reversedBotEdge;\n reversedBotEdge = reversedRightEdge;\n reversedRightEdge = tmp;\n tmp = ltCorner;\n ltCorner = lbCorner;\n lbCorner = rbCorner;\n rbCorner = rtCorner;\n rtCorner = tmp;\n\n }", "@Test\n public void testCondition4()\n {\n Double[] angles = {75.0, 75.0, 71.0};\n _renderable.orientation(angles);\n Double testVal[] = _renderable.orientation();\n assertEquals(\"x angle did not get set,\", angles[0], testVal[0], 2);\n assertEquals(\"y angle did not get set,\", angles[1], testVal[1], 2);\n assertEquals(\"z angle did not get set,\", angles[2], testVal[2], 2);\n }", "private void doDdpOrientation(Graph graph, Node l, Node a, Node b, Node c) {\n changeFlag = true;\n for (IonIndependenceFacts iif : separations) {\n if ((iif.getX().equals(l) && iif.getY().equals(c)) ||\n iif.getY().equals(l) && iif.getX().equals(c)) {\n for (List<Node> condSet : iif.getZ()) {\n if (condSet.contains(b)) {\n graph.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(graph);\n return;\n }\n }\n break;\n }\n }\n Graph newGraph1 = new EdgeListGraph(graph);\n newGraph1.setEndpoint(a, b, Endpoint.ARROW);\n newGraph1.setEndpoint(c, b, Endpoint.ARROW);\n discrimGraphs.add(newGraph1);\n Graph newGraph2 = new EdgeListGraph(graph);\n newGraph2.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(newGraph2);\n }", "void applyRotationMatrix() {\n for (int i = 0; i < coors.length; i++) {\n for (int j = 0; j < coors[i].length; j++) {\n newCoors[i][j] = coors[i][0] * R[j][0] + coors[i][1] * R[j][1] + coors[i][2] * R[j][2];\n }\n // add perspective\n float scale = map(Math.abs(newCoors[i][2]), 0, (float) (halfSize * Math.sqrt(3)), 1, 1.5f);\n if (newCoors[i][2] < 0) {\n scale = 2f - scale;\n }\n for (int j = 0; j < 2; j++) {\n newCoors[i][j] *= scale;\n }\n }\n // to R2\n // just dont use Z\n setPathAndAlpha();\n }", "public void RandomOrientation(){\n\n\t\tfor (int i=0;i<population.length;i++){\n\t\t\tpopulation[i].RandomOrientation();\n\t\t}\n\n\t}", "private void updateRotated() {\r\n\r\n\tfor (int n = 0; n < npoints * 3; n += 3) {\r\n\r\n\t // take the linear sum of local co-ords with local\r\n\t // unit vectors and then translate by adding the local\r\n\t // origin's co-ords\r\n\t ps[n] = locals[n] * i[0] + locals[n + 1] * j[0] + locals[n + 2] * k[0];\r\n\t ps[n + 1] = locals[n] * i[1] + locals[n + 1] * j[1] + locals[n + 2] * k[1];\r\n\t ps[n + 2] = locals[n] * i[2] + locals[n + 1] * j[2] + locals[n + 2] * k[2];\r\n\r\n\t ps[n] += p[0];\r\n\t ps[n + 1] += p[1];\r\n\t ps[n + 2] += p[2];\r\n\t}\r\n\r\n\t// reset bounding box and clear dirty flags\r\n\tbox.setBB();\r\n\tdirtyR = false;\r\n\tdirtyT = false;\r\n\r\n\t// normals must be reset\r\n\tthis.setNormals();\r\n\r\n\t// finally\r\n\t_p[0] = p[0];\r\n\t_p[1] = p[1];\r\n\t_p[2] = p[2];\r\n\t_roll = roll;\r\n }", "private void turnClockwise() {\n\t\torientation = TurnAlgorithmExecutor.getAlgorithmFromCondition(orientation).execute(orientation);\n\t}", "private void resetAngles() {\n \ttorso_front.rotateAngleX = 0;\n \tleg_front_left.rotateAngleX = leg_front_right.rotateAngleX = 0;\n \tleg_front_left.rotateAngleY = leg_front_right.rotateAngleY = 0;\n \tleg_front_left.rotateAngleZ = leg_front_right.rotateAngleZ = 0;\n \tleg_back_left.rotateAngleX = leg_front_left.rotateAngleX;\n \tleg_back_right.rotateAngleX = leg_front_right.rotateAngleX;\n \tleg_back_right.rotateAngleY = leg_back_left.rotateAngleY = 0;\n \tleg_back_right.rotateAngleZ = leg_back_left.rotateAngleZ = 0;\n\t\tknee_front_left.rotateAngleX = knee_front_right.rotateAngleX = 0;\n\t\tknee_back_left.rotateAngleX = knee_back_right.rotateAngleX = 0;\n\t\ttail_stub.rotateAngleX = -1.05f;\n\t\ttail_segment_1.rotateAngleX = 1.1f;\n\t\ttail_segment_2.rotateAngleX = tail_segment_3.rotateAngleX = 0;\n\t\tneck.rotateAngleX = 0.17453292519943295f;\n }", "private void aretes_aR(){\n\t\tthis.cube[13] = this.cube[52]; \n\t\tthis.cube[52] = this.cube[19];\n\t\tthis.cube[19] = this.cube[1];\n\t\tthis.cube[1] = this.cube[28];\n\t\tthis.cube[28] = this.cube[13];\n\t}", "public void rotation(){\n\n double x=Double.parseDouble(rotationx.getText());\n double y=Double.parseDouble(rotationy.getText());\n double z=Double.parseDouble(rotationz.getText());\n if (checkbox.isSelected()){\n cls_zahnrad.rotieren(x,y,z);\n return;\n }\n Triangle[] dreiecke = t1.getFlaechen();\n x=2*Math.PI/360*x;\n y=2*Math.PI/360*y;\n z=2*Math.PI/360*z;\n double[] A,B,C;\n\n double pktx=0,pkty=0,pktz=0;\n\n if (radio12.isSelected()){\n pktx = Double.parseDouble(rotationpktx.getText());\n pkty = Double.parseDouble(rotationpkty.getText());\n pktz = Double.parseDouble(rotationpktz.getText());\n }\n\n for (Triangle i :dreiecke){\n for (int j=0; j<3;j++){\n double xtemp,ytemp,ztemp;\n xtemp=i.getTriangle()[j].getPoint()[0]-pktx;\n ytemp=i.getTriangle()[j].getPoint()[1]-pkty;\n ztemp=i.getTriangle()[j].getPoint()[2]-pktz;\n i.getTriangle()[j].setPoint(xtemp,ytemp,ztemp);\n }\n }\n\n for (Triangle t1 : dreiecke){\n A=t1.getTriangle()[0].getPoint();\n B=t1.getTriangle()[1].getPoint();\n C=t1.getTriangle()[2].getPoint();\n double[][]punkte={A,B,C};\n\n for (int i=0; i<punkte.length; i++){\n double temp0,temp1,temp2;\n\n //Rotation um Parallele der X-Achse durch das Rotationszentrum\n if (x!=0){\n temp1=punkte[i][1]*Math.cos(x)-punkte[i][2]*Math.sin(x);\n temp2=punkte[i][1]*Math.sin(x)+punkte[i][2]*Math.cos(x);\n punkte[i][1]=temp1;\n punkte[i][2]=temp2;\n }\n\n //Rotation um Parallele der Y-Achse durch das Rotationszentrum\n if (y!=0){\n temp0=punkte[i][0]*Math.cos(y)+punkte[i][2]*Math.sin(y);\n temp2=-punkte[i][0]*Math.sin(y)+punkte[i][2]*Math.cos(y);\n punkte[i][0]=temp0;\n punkte[i][2]=temp2;\n }\n\n //Rotation um Parallele der Z-Achse durch das Rotationszentrum\n if (z!=0){\n temp0=punkte[i][0]*Math.cos(z)-punkte[i][1]*Math.sin(z);\n temp1=punkte[i][0]*Math.sin(z)+punkte[i][1]*Math.cos(z);\n punkte[i][0]=temp0;\n punkte[i][1]=temp1;\n }\n }\n A=punkte[0];\n B=punkte[1];\n C=punkte[2];\n t1.getTriangle()[0].setPoint(A[0],A[1],A[2]);\n t1.getTriangle()[1].setPoint(B[0],B[1],B[2]);\n t1.getTriangle()[2].setPoint(C[0],C[1],C[2]);\n }\n for (Triangle i :dreiecke){\n for (int j=0; j<3;j++){\n double xtemp,ytemp,ztemp;\n xtemp=i.getTriangle()[j].getPoint()[0]+pktx;\n ytemp=i.getTriangle()[j].getPoint()[1]+pkty;\n ztemp=i.getTriangle()[j].getPoint()[2]+pktz;\n i.getTriangle()[j].setPoint(xtemp,ytemp,ztemp);\n }\n }\n redraw();\n /*\n System.out.println(\"A \"+Arrays.toString(t1.getTetraeder()[0].getPoint()));\n System.out.println(\"B \"+Arrays.toString(t1.getTetraeder()[1].getPoint()));\n System.out.println(\"C \"+Arrays.toString(t1.getTetraeder()[2].getPoint()));\n System.out.println(\"D \"+Arrays.toString(t1.getTetraeder()[3].getPoint()));\n System.out.println(Arrays.toString(Mittelpunkt));\n */\n }", "public static void waltz() {\n //test code written by bokun: self rotation\n leftMotor.setSpeed(ROTATE_SPEED);\n rightMotor.setSpeed(ROTATE_SPEED);\n leftMotor.forward();\n rightMotor.backward();\n }", "private void arretes_fR(){\n\t\tthis.cube[13] = this.cube[10]; \n\t\tthis.cube[10] = this.cube[12];\n\t\tthis.cube[12] = this.cube[16];\n\t\tthis.cube[16] = this.cube[14];\n\t\tthis.cube[14] = this.cube[13];\n\t}", "public void switchOr() {\n if (orientation == 1) {\n orientation = 0;\n }\n else {\n orientation = 1;\n }\n }", "protected boolean reverseArc() {\n\n Node terminalValue;\n Node candidate;\n Node dest;\n NodeList functionalPredTV;\n NodeList candidateChildren;\n String operation;\n int i, j;\n\n // we obtain the utility node \n\n terminalValue = ((IDWithSVNodes) diag).getTerminalValueNode();\n\n functionalPredTV = ((IDWithSVNodes) diag).getChanceAndDecisionPredecessors(terminalValue);\n\n for (i = 0; i < functionalPredTV.size(); i++) {\n\n candidate = functionalPredTV.elementAt(i);\n\n if (candidate.getKindOfNode() == Node.CHANCE) {\n // We look for a node: \n // - parent of the utility node \n // - is not parent of a decision nodo\n // - parent of another chance node \n // - only one path between these two nodes \n\n candidateChildren = diag.children(candidate);\n if (candidate.hasDirectDecisionChild() == false\n && candidate.isUtilityParent() == true && candidateChildren.size() > 1) {\n\n // Consider the childrens of the candidate. \n // Revert the arc if there is only one \n // path between them \n\n for (j = 0; j < candidateChildren.size(); j++) {\n dest = candidateChildren.elementAt(j);\n\n // Act if is a chance node\n\n if (dest.getKindOfNode() == Node.CHANCE) {\n\n // Now we see if there is another link between them \n\n if (candidate.moreThanAPath(dest) == false) {\n // The arc can be reversed : save operation and size\n\n operation = \"Arc reversal: \" + candidate.getName() + \"-> \" + dest.getName();\n statistics.addOperation(operation);\n\n System.out.println(operation);\n\n\n indexOperation++;\n try {\n diag.save(\"debug-operation-\" + indexOperation + \".elv\");\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n // We modify the relations of the nodes \n\n modifyRelations(candidate, dest);\n\n // We get the posterior distributions \n\n getPosteriorDistributions(candidate, dest);\n\n // Once the operation is done, notes down the size\n\n\n statistics.addSize(diag.calculateSizeOfPotentials());\n\n statistics.addTime(crono.getTime());\n\n /*\n * try { diag.save(\"kk2.elv\"); } catch\n * (IOException e) { // TODO Auto-generated\n * catch block e.printStackTrace();\n\t\t\t\t\t}\n */\n\n // Return true \n\n return (true);\n }\n }\n }\n }\n }\n }\n return (false);\n }", "public static Set<Set<Polyomino>> tilings(ArrayList<Polyomino> polyominos_list,Polyomino P, boolean use_all_once, boolean rotations, boolean reflections) {\r\n\t\t\r\n\t\tHashMap<Integer, Square> hmap_P = new HashMap<Integer, Square>();\r\n\t\tSet<Integer> X= new HashSet<Integer>();\r\n\t\tSet<Set<Integer>> C= new HashSet<Set<Integer>>();\t\r\n\t\tSet<Set<Polyomino>> tilings = new HashSet<Set<Polyomino>>();\r\n\t\t\r\n\t\tif (use_all_once) {//quick check to see if there is a tiling of P using each tile exactly once: ( sum of area(tile) ) == area(P)\r\n\t\t\tint total_area=0;\r\n\t\t\tfor (Polyomino q: polyominos_list) total_area+=q.area;\r\n\t\t\tif (!(total_area==P.area)) return tilings;\r\n\t\t}\r\n\t\t\t\t\t\r\n\t\t//index squares of P\r\n\t\tfor (int i=0; i<P.vertices.size();i++) {\r\n\t\t\thmap_P.put(i+1,P.vertices.get(i));\r\n\t\t\tX.add(i+1);\r\n\t\t}\r\n\t\tif (use_all_once) {//we add extra elements to the ground set to ensure each polyomino is used exactly once\r\n\t\t\tfor (int j=0;j<polyominos_list.size();j++) {\r\n\t\t\t\tX.add(P.vertices.size()+j+1);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\t//we now define C\r\n\t\t//if A= set of (fixed/one-sided/free) polyominos of area n\r\n\t\t//C= union over Q in A of union of S subset of X corresponding to indices of squares of P covered by some translate of Q\r\n\t\t//to generate C, we iterate over the polyominos Q in A and we see, for each possible translation of Q,\r\n\t\t//if Q fits in P, in which case we record the indices of the squares of P it covers\r\n\t\t\r\n\t\tfor (int k=0; k<polyominos_list.size();k++) {\r\n\t\t\tPolyomino tile=polyominos_list.get(k);\r\n\t\t\t\r\n\t\t\tArrayList<Polyomino> orientations_of_tile=new ArrayList<Polyomino>();\r\n\t\t\tif (rotations && reflections) orientations_of_tile=tile.distinct_symmetries();\r\n\t\t\telse if (rotations) orientations_of_tile=tile.rotations();\r\n\t\t\telse if (reflections) orientations_of_tile=tile.reflections();\r\n\t\t\telse orientations_of_tile.add(tile);//if no rotations, the only possible orientation is the tile as it was given\r\n\t\t\r\n\t\t\tfor (Polyomino Q: orientations_of_tile) {\r\n\t\t\t\t//for each VALID translation of Q, we calculate the indices of squares of P which Q occupies, and add this to C\r\n\t\t\t\t//we choose some square of Q, which we will \"nail\" to the squares of P and see if Q fits in in P in that position\r\n\t\t\t\tSquare nail = Q.vertices.get(0);\r\n\t\t\t\tfor (Square s: P.vertices) {\r\n\t\t\t\t Set<Integer> indices_Q_translated= new HashSet<Integer>();\r\n\t\t\t\t boolean Q_fits_inP=true;\r\n\t\t\t\t\tfor (Square q: Q.vertices) {//lets check if this translation of Q fits in P\r\n\t\t\t\t\t\tSquare translated_q=new Square (q.x+s\r\n\t\t\t\t\t\t\t\t.x-nail.x,q.y+s.y-nail.y);\r\n\t\t\t\t\t\tif (!P.contains(translated_q)) {//check if square translated_q fits is in P\r\n\t\t\t\t\t\t\tQ_fits_inP=false;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\thmap_P.forEach((key, value) -> {//get index of square translated_q\r\n\t\t\t\t\t\t if (value.equals(translated_q)) {\r\n\t\t\t\t\t\t \tindices_Q_translated.add(key);\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (Q_fits_inP) {\r\n\t\t\t\t\t\t//we add an element which corresponds to putting a one in a dummy column in the exact cover matrix\r\n\t\t\t\t\t\tif (use_all_once) indices_Q_translated.add(k+P.vertices.size()+1); \r\n\t\t\t\t\t\tC.add(indices_Q_translated);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Initialization step complete, with complexity at least |polyominos_list|*4*area(P)*area(Q)*area(P)\r\n\t\t\r\n\t\tif(!(C.size()==0)) {\r\n\t\t\t\r\n\t\t\tint[][] M=Exact_cover.sets_to_matrix(X,C);\r\n\t\t\r\n\t\t\t//we add n columns (initialized to all zeros) to M where n=polyominos_list.size().\r\n\t\t\t//Each row of M corresponds to some translation of a polyomino Pk in polyominos_list-{P1,...,Pn}\r\n\t\t\t//in a such a row we place a 1 in the column k\r\n\t\t\t//any exact cover of M must then use each Pk exactly once \r\n\r\n\t\t\tDancingLinks dl = new DancingLinks(M);\r\n\t\t\tSet<Set<data_object>> exact_covers_data_objects=dl.exactCover(dl.master_header);\r\n\t\t\t\r\n\t\t\tfor (Set<data_object> cover_data_objects: exact_covers_data_objects) {\r\n\t\t\t\t\r\n\t\t\t\tSet<Set<Integer>> cover_sets=new HashSet<Set<Integer>>();\r\n\t\t\t\tfor (data_object t: cover_data_objects) cover_sets.add(dl.set_of_row.get(t.row_id));\r\n\t\t\t\t\r\n\t\t\t\tSet<Polyomino> T = new HashSet<Polyomino>();//a tiling, i.e a set of polyominos\r\n\t\t\t\t\r\n\t\t\t\tfor (Set<Integer> indices: cover_sets) {\r\n\t\t\t\t\tArrayList<Square> vertices= new ArrayList<Square>();\r\n\t\t\t\t\t//convert indices to corresponding squares of P, \r\n\t\t\t\t\t//and add the corresponding Polyomino R to T\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (int index: indices) {\r\n\t\t\t\t\t\tif (index<P.vertices.size()+1) {//if not a dummy index (in the case of use_all_once polyominos)\r\n\t\t\t\t\t\t\tvertices.add(hmap_P.get(index));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tT.add(new Polyomino(vertices,\"R\"));\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\ttilings.add(T);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn tilings;\r\n\t}", "public void updateRotations() {\n try {\n switch (this.mode) {\n case Packet:\n mc.player.renderYawOffset = this.yaw;\n mc.player.rotationYawHead = this.yaw;\n break;\n case Legit:\n mc.player.rotationYaw = this.yaw;\n mc.player.rotationPitch = this.pitch;\n break;\n case None:\n break;\n }\n } catch (Exception ignored) {\n\n }\n }", "private void rearrangeSolution() {\r\n List<Integer> trinity = new ArrayList<Integer>();\r\n trinity.add(0); trinity.add(1); trinity.add(2);\r\n permutateDigits();\r\n for (int i = 0; i<9; i+=3) {\r\n Collections.shuffle(trinity);\r\n swapRow(trinity.get(0)+i, trinity.get(1)+i);\r\n }\r\n for (int i = 0; i<9; i+=3) {\r\n Collections.shuffle(trinity);\r\n swapCol(trinity.get(0)+i, trinity.get(1)+i);\r\n }\r\n }", "private void lastFaceCrossAlign() {\n int[] offsets = new int[]{0, 0, 0, 0};\n int[] edges = new int[]{\n LAST_ROW_MIDDLE, MID_ROW_RIGHT, FIRST_ROW_CENTER, MID_ROW_LEFT\n };\n String dbg = \"offsets:\";\n for (int i = 0; i < edges.length; i++) {\n Piece piece = mYaxisLayers.get(OUTER).get(edges[i]);\n Square sideSquare = null;\n for (Square sq: piece.mSquares) {\n if (sq.getFace() == FACE_TOP) {\n continue;\n }\n sideSquare = sq;\n break;\n }\n if (sideSquare == null) {\n throw new AssertionError(\"side square null at \" + i + \" for piece: \" + piece);\n }\n int face = getColorFace(sideSquare.getColor());\n if (face == FACE_TOP || face == FACE_BOTTOM) {\n throw new AssertionError(\"color and face mismatch: \" +\n sideSquare.getColor() + \", face: \" + face);\n }\n offsets[i] = face - i;\n offsets[i] = (offsets[i] + CUBE_SIDES) % CUBE_SIDES;\n dbg += \" \" + offsets[i];\n }\n Log.w(tag, dbg);\n\n /**\n * If all offsets are equal, we just need to rotate the top layer to align the centers.\n * If at least one of them is different, we should align it and apply algorithms\n * */\n for (int i = 0; i < offsets.length - 1; i++) {\n if (offsets[i] != offsets[i + 1]) {\n fixLastFaceCrossAlignment(offsets);\n return;\n }\n }\n\n if (offsets[0] != 0) {\n Algorithm algo = new Algorithm();\n algo.addStep(Axis.Y_AXIS, (offsets[0] == 3) ?\n Direction.CLOCKWISE : Direction.COUNTER_CLOCKWISE, OUTER);\n if (Math.abs(offsets[0]) == 2) {\n algo.repeatLastStep();\n }\n setAlgo(algo);\n } else {\n // Offsets are all zero; this is the best case scenario\n sendMessage(\"top cross is now aligned\");\n proceedToNextState();\n }\n }", "private void normalVarimaxRotationInHouse(double[][] loadingFactorMatrix, double[] communalityWeights){\n if(!this.pcaDone)this.pca();\n int nRows = loadingFactorMatrix.length;\n int nColumns = loadingFactorMatrix[0].length;\n this.usRotatedLoadingFactorsAsRows = new double[nRows][nColumns];\n this.rotatedLoadingFactorsAsRows = new double[nRows][nColumns];\n this.usRotatedEigenValues = new double[nRows];\n this.rotatedEigenValues = new double[nRows];\n this.rotatedProportionPercentage= new double[nRows];\n this.rotatedCumulativePercentage= new double[nRows];\n\n // Calculate weights and normalize the loading factors\n for(int j = 0; j<nColumns; j++)communalityWeights[j] = Math.sqrt(communalityWeights[j]);\n for(int i = 0; i<nRows; i++){\n for(int j = 0; j<nColumns; j++){\n if(loadingFactorMatrix[i][j]==0.0 && communalityWeights[j]==0){\n loadingFactorMatrix[i][j] = 1.0;\n }\n else{\n loadingFactorMatrix[i][j] /= communalityWeights[j];\n }\n this.usRotatedLoadingFactorsAsRows[i][j] = loadingFactorMatrix[i][j];\n }\n }\n\n // Loop through pairwise rotations until varimax function maximised\n double va = PCA.varimaxCriterion(this.usRotatedLoadingFactorsAsRows);\n double vaLast = 0;\n double angle = 0;\n boolean test = true;\n this.nVarimax = 0;\n while(test){\n for(int i=0; i<nRows-1; i++){\n for(int j=i+1; j<nRows; j++){\n angle = PCA.varimaxAngle(this.usRotatedLoadingFactorsAsRows, i, j);\n this.usRotatedLoadingFactorsAsRows = PCA.singleRotation(this.usRotatedLoadingFactorsAsRows, i, j, angle);\n va = PCA.varimaxCriterion(this.usRotatedLoadingFactorsAsRows);\n }\n }\n if(Math.abs(va - vaLast)<this.varimaxTolerance){\n test=false;\n }\n else{\n vaLast = va;\n this.nVarimax++;\n if(this.nVarimax>nVarimaxMax){\n test=false;\n System.out.println(\"Method varimaxRotation: maximum iterations \" + nVarimaxMax + \" exceeded\");\n System.out.println(\"Tolerance = \" + this.varimaxTolerance + \", Comparison value = \" + Math.abs(va - vaLast));\n System.out.println(\"Current values returned\");\n if(super.sameCheck>0){\n System.out.println(\"Presence of identical element row/s and/or column/s in the data probably impeding convergence\");\n System.out.println(\"Returned values are likely to be correct\");\n }\n }\n }\n }\n\n // undo normalization of rotated loading factors\n this.usRotatedLoadingFactorsAsColumns = new double[nColumns][nRows];\n for(int i=0; i<nRows; i++){\n for(int j=0; j<nColumns; j++){\n this.usRotatedLoadingFactorsAsRows[i][j] *= communalityWeights[j];\n this.usRotatedLoadingFactorsAsColumns[j][i] = this.usRotatedLoadingFactorsAsRows[i][j];\n loadingFactorMatrix[i][j] *= communalityWeights[j];\n }\n }\n\n // Rotated eigenvalues\n double usRotatedEigenValueTotal = 0.0;\n double unRotatedEigenValueTotal = 0.0;\n for(int i=0; i<nRows; i++){\n this.usRotatedEigenValues[i] = 0.0;\n for(int j=0; j<nColumns; j++){\n this.usRotatedEigenValues[i] += this.usRotatedLoadingFactorsAsRows[i][j]*this.usRotatedLoadingFactorsAsRows[i][j];\n }\n usRotatedEigenValueTotal += this.usRotatedEigenValues[i];\n unRotatedEigenValueTotal += this.orderedEigenValues[i];\n }\n\n // Order unscaled rotated eigenvalues\n ArrayMaths amrot = new ArrayMaths(this.usRotatedEigenValues);\n amrot = amrot.sort();\n this.usRotatedEigenValues = amrot.array();\n int[] sortedRotIndices = amrot.originalIndices();\n\n // reverse order\n int nh = nRows/2;\n double holdD = 0.0;\n int holdI = 0;\n for(int i=0; i<nh; i++){\n holdD = this.usRotatedEigenValues[i];\n this.usRotatedEigenValues[i] = this.usRotatedEigenValues[nRows - 1 - i];\n this.usRotatedEigenValues[nRows - 1 - i] = holdD;\n holdI = sortedRotIndices[i];\n sortedRotIndices[i] = sortedRotIndices[nRows - 1 - i];\n sortedRotIndices[nRows - 1 - i] = holdI;\n }\n\n // order rotated power factors to match ordered rotated eigenvalues\n int nn = this.usRotatedLoadingFactorsAsRows.length;\n int mm = this.usRotatedLoadingFactorsAsRows[0].length;\n double[][] holdDA = new double[nn][mm];\n for(int i=0; i<nn; i++){\n for(int j=0; j<mm; j++){\n holdDA[i][j] = this.usRotatedLoadingFactorsAsRows[sortedRotIndices[i]][j];\n }\n }\n this.usRotatedLoadingFactorsAsRows = Conv.copy((double[][])holdDA);\n\n nn = sortedRotIndices.length;\n this.rotatedIndices = new int[nn];\n int[]holdIA = new int[nn];\n for(int i=0; i<nn; i++){\n holdIA[i] = this.eigenValueIndices[sortedRotIndices[i]];\n }\n this.rotatedIndices = Conv.copy((int[])this.eigenValueIndices);\n for(int i=0; i<nn; i++){\n this.rotatedIndices[i] = holdIA[i];\n }\n\n // Scale rotated loading factors and eigenvalues to the unrotated variance percentage for the sum of the extracted eigenvalues\n double scale0 = Math.abs(unRotatedEigenValueTotal/usRotatedEigenValueTotal);\n double scale1 = Math.sqrt(scale0);\n for(int i=0; i<nRows; i++){\n this.rotatedEigenValues[i] = scale0*this.usRotatedEigenValues[i];\n this.rotatedProportionPercentage[i] = this.rotatedEigenValues[i]*100.0/this.eigenValueTotal;\n for(int j=0; j<nColumns; j++){\n this.rotatedLoadingFactorsAsRows[i][j] = scale1*this.usRotatedLoadingFactorsAsRows[i][j];\n }\n }\n this.rotatedCumulativePercentage[0] = this.rotatedProportionPercentage[0];\n for(int i=1; i<nRows; i++)this.rotatedCumulativePercentage[i] = this.rotatedCumulativePercentage[i-1] + this.rotatedProportionPercentage[i];\n\n this.rotationDone = true;\n\n }", "private void arretes_fO(){\n\t\tthis.cube[40] = this.cube[37]; \n\t\tthis.cube[37] = this.cube[39];\n\t\tthis.cube[39] = this.cube[43];\n\t\tthis.cube[43] = this.cube[41];\n\t\tthis.cube[41] = this.cube[40];\n\t}", "public void findValidMoveDirections(){\n\t\t\n\t\tif(currentTile == 2 && (tileRotation == 0 || tileRotation == 180)){ // in vertical I configuration\n\t\t\tcanMoveNorth = true; canMoveSouth = true;\n\t\t\tcanMoveEast = false; canMoveWest = false;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,S: T E,W: F\");\n\t\t}\n\t\telse if(currentTile == 2 && (tileRotation == 90 || tileRotation == 270)){ // in horizontal I configuration\n\t\t\tcanMoveNorth = false; canMoveSouth = false;\n\t\t\tcanMoveEast = true; canMoveWest = true;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,S: F E,W: T\");\n\t\t}\n\t\t\n\t\t\n\t\telse if(currentTile == 3 && tileRotation == 0){ // L rotated 0 degrees\n\t\t\tcanMoveNorth = true; canMoveSouth = false;\n\t\t\tcanMoveEast = true; canMoveWest = false;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,E: T S,W: F\");\n\t\t}\n\t\telse if(currentTile == 3 && tileRotation == 90){ // L rotated 90 degrees\n\t\t\tcanMoveNorth = true; canMoveSouth = false;\n\t\t\tcanMoveEast = false; canMoveWest = true;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,W: T S,E: F\");\n\t\t}\n\t\telse if(currentTile == 3 && tileRotation == 180){ // L rotated 180 degrees\n\t\t\tcanMoveNorth = false; canMoveSouth = true;\n\t\t\tcanMoveEast = false; canMoveWest = true;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" S,W: T N,E: F\");\n\t\t}\n\t\telse if(currentTile == 3 && tileRotation == 270){ // L rotated 270 degrees\n\t\t\tcanMoveNorth = false; canMoveSouth = true;\n\t\t\tcanMoveEast = true; canMoveWest = false;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" S,E: T N,W: F\");\n\t\t}\n\t\t\n\t\t\n\t\telse if(currentTile == 4 && tileRotation == 0){ // T rotated 0 degrees\n\t\t\tcanMoveNorth = false; canMoveSouth = true;\n\t\t\tcanMoveEast = true; canMoveWest = true;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" S,W,E: T N: F\");\n\t\t}\n\t\telse if(currentTile == 4 && tileRotation == 90){ // T rotated 90 degrees\n\t\t\tcanMoveNorth = true; canMoveSouth = true;\n\t\t\tcanMoveEast = true; canMoveWest = false;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,S,E: T W: F\");\n\t\t}\n\t\telse if(currentTile == 4 && tileRotation == 180){ // T rotated 180 degrees\n\t\t\tcanMoveNorth = true; canMoveSouth = false;\n\t\t\tcanMoveEast = true; canMoveWest = true;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,W,E: T S: F\");\n\t\t}\n\t\telse if(currentTile == 4 && tileRotation == 270){ // T rotated 270 degrees\n\t\t\tcanMoveNorth = true; canMoveSouth = true;\n\t\t\tcanMoveEast = false; canMoveWest = true;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,S,W: T E: F\");\n\t\t}\n\t\telse if(currentTile == 5){ //in plus tile\n\t\t\tcanMoveNorth = true; canMoveSouth = true;\n\t\t\tcanMoveEast = true; canMoveWest = true;\n//\t\t\tSystem.out.println(\"Current Tile: \" + currentTile + \" Rotatation: \" + tileRotation +\n//\t\t\t\t\t\" N,S,W,E: T\");\n\t\t}\n\t\t\n\t}", "private void doStep() {\n // Add some variables to increase readability.\n int left = RotorPosition.LEFT.ordinal();\n int middle = RotorPosition.MIDDLE.ordinal();\n int right = RotorPosition.RIGHT.ordinal();\n\n //TODO see if this method can be optimized at all\n if (rotors[right].isAtTurnoverPosition()) {\n // Normal stepping.\n if (rotors[middle].isAtTurnoverPosition()) {\n if (rotors[left].isAtTurnoverPosition()) {\n reflector.doStep();\n }\n rotors[left].doStep();\n }\n rotors[middle].doStep();\n } else {\n // Handle the double stepping anomaly.\n if (rotors[middle].isAtTurnoverPosition() && rotors[middle].justStepped()) {\n rotors[left].doStep();\n rotors[middle].doStep();\n }\n }\n rotors[right].doStep();\n }", "public void invertOrientation() {\n\t\tPoint3D temp = getPoint(2);\n\t\tsetPoint(2, getPoint(1));\n\t\tsetPoint(1, temp);\n\n\t\tTriangleElt3D temp2 = getNeighbour(2);\n\t\tsetNeighbour(2, getNeighbour(1));\n\t\tsetNeighbour(1, temp2);\n\t\tif (this.getNetComponent() != null)\n\t\t\tthis.getNetComponent().setOriented(false);\n\t}", "private void arretes_fW(){\n\t\tthis.cube[4] = this.cube[1]; \n\t\tthis.cube[1] = this.cube[3];\n\t\tthis.cube[3] = this.cube[7];\n\t\tthis.cube[7] = this.cube[5];\n\t\tthis.cube[5] = this.cube[4];\n\t}", "public void calculateAlbedoAndSurfaceNormals() {\n\t\tRealMatrix STranspose = this.S.transpose();\n\t\tdouble[][] p = new double[I1.getColumnDimension()][I1.getRowDimension()];\n\t\tdouble[][] nx = new double[I1.getColumnDimension()][I1.getRowDimension()];\n\t\tdouble[][] ny = new double[I1.getColumnDimension()][I1.getRowDimension()];\n\t\tdouble[][] nz = new double[I1.getColumnDimension()][I1.getRowDimension()];\n\t\t\n\t\tRealMatrix gMatrix = null;\n\t\tfor(int i=0; i < I1.getColumnDimension(); i++) {\n\t\t\tfor (int j=0; j < I1.getRowDimension(); j++) {\n\t\t\t\t\n\t\t\t\t// Stacking our 'I's.\n\t\t\t\tdouble[][] intensityMatrixData = { {I1.getEntry(i, j)},\n\t\t\t\t\t\t \t\t\t \t\t{I2.getEntry(i, j)},\n\t\t\t\t\t\t \t\t\t \t\t{I3.getEntry(i, j)},\n\t\t\t\t\t\t \t\t\t \t\t{I4.getEntry(i, j)}\n\t\t\t\t\t\t \t\t\t \t };\n\t\t\t\tRealMatrix intensityMatrix = MatrixUtils.createRealMatrix(intensityMatrixData);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t// Pseudo-Inverse step multiplied by 'I'.\n\t\t\t\tgMatrix = new LUDecomposition(STranspose.multiply(scalarMultiplication(intensityMatrix, this.S)))\n\t\t\t\t\t.getSolver()\n\t\t\t\t\t.getInverse()\n\t\t\t\t\t.multiply(STranspose)\n\t\t\t\t\t.multiply(scalarMultiplication(intensityMatrix, intensityMatrix));\n\t\t\t\t\n\t\t\t\t// Calculating the albedo.\n\t\t\t\tp[i][j] = (Math.sqrt(Math.pow(gMatrix.getEntry(0, 0), 2)+\n\t\t\t\t\t\t Math.pow(gMatrix.getEntry(1, 0), 2)+\n\t\t\t\t\t\t Math.pow(gMatrix.getEntry(2, 0), 2)));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (p[i][j] > 1) {\n\t\t\t\t\tSystem.out.println(\"wrong!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Calculating the surface normals.\n\t\t\t\tnx[i][j] = gMatrix.getEntry(0, 0) / p[i][j];\n\t\t\t\tny[i][j] = gMatrix.getEntry(1, 0) / p[i][j];\n\t\t\t\tnz[i][j] = gMatrix.getEntry(2, 0) / p[i][j];\n\t\t\t}\n\n\t\t}\n\t\tthis.P = MatrixUtils.createRealMatrix(p);\n\t\tthis.Nx = MatrixUtils.createRealMatrix(nx).transpose();\n\t\tthis.Ny = MatrixUtils.createRealMatrix(ny).transpose();\n\t\tthis.Nz = MatrixUtils.createRealMatrix(nz).transpose();\t\n\t}", "public void rotateCW() {\n for (Vector2D vec : template) {\n CW.matrixVectorProductInPlace(vec);\n }\n }", "private void fillRots() {\n for (int joint=0;joint<numObjects;joint++){\n // 1) Find first non-null rotation of joint <code>joint</code>\n int start;\n for (start=0;start<keyframes.size();start++){\n if (((PointInTime)keyframes.get(start)).usedRot.get(joint)) break;\n }\n if (start==keyframes.size()){ // if they are all null then fill with identity\n for (int i=0;i<keyframes.size();i++)\n ((PointInTime)keyframes.get(i)).look[joint].setRotationQuaternion(new Quaternion());\n continue; // we're done so lets break\n }\n if (start!=0){ // if there -are- null elements at the begining, then fill with first non-null\n \n ((PointInTime)keyframes.get(start)).look[joint].getRotation(unSyncbeginRot);\n for (int i=0;i<start;i++)\n ((PointInTime)keyframes.get(i)).look[joint].setRotationQuaternion(unSyncbeginRot);\n }\n int lastgood=start;\n for (int i=start+1;i<keyframes.size();i++){\n if (((PointInTime)keyframes.get(i)).usedRot.get(joint)){\n fillQuats(joint,lastgood,i); // fills gaps\n lastgood=i;\n }\n }\n // fillQuats(joint,lastgood,keyframes.size()-1); // fills tail\n ((PointInTime)keyframes.get(lastgood)).look[joint].getRotation(unSyncbeginRot);\n \n for (int i=lastgood+1;i<keyframes.size();i++){\n ((PointInTime)keyframes.get(i)).look[joint].setRotationQuaternion(unSyncbeginRot);\n }\n }\n }", "private boolean finalizeWallpaperForRotatingComponent(List<String> attributions,\n String actionUrl,\n int actionLabelRes,\n int actionIconRes,\n String collectionId,\n int wallpaperId) {\n mWallpaperPreferences.clearHomeWallpaperMetadata();\n\n boolean isLockWallpaperSet = isSeparateLockScreenWallpaperSet();\n\n // Persist wallpaper IDs if the rotating wallpaper component\n mWallpaperPreferences.setHomeWallpaperManagerId(wallpaperId);\n\n // Only copy over wallpaper ID to lock wallpaper if no explicit lock wallpaper is set\n // (so metadata isn't lost if a user explicitly sets a home-only wallpaper).\n if (!isLockWallpaperSet) {\n mWallpaperPreferences.setLockWallpaperId(wallpaperId);\n }\n\n\n mWallpaperPreferences.setHomeWallpaperAttributions(attributions);\n mWallpaperPreferences.setHomeWallpaperActionUrl(actionUrl);\n mWallpaperPreferences.setHomeWallpaperActionLabelRes(actionLabelRes);\n mWallpaperPreferences.setHomeWallpaperActionIconRes(actionIconRes);\n // Only set base image URL for static Backdrop images, not for rotation.\n mWallpaperPreferences.setHomeWallpaperBaseImageUrl(null);\n mWallpaperPreferences.setHomeWallpaperCollectionId(collectionId);\n\n // Set metadata to lock screen also when the rotating wallpaper so if user sets a home\n // screen-only wallpaper later, these attributions will still be available.\n if (!isLockWallpaperSet) {\n mWallpaperPreferences.setLockWallpaperAttributions(attributions);\n mWallpaperPreferences.setLockWallpaperActionUrl(actionUrl);\n mWallpaperPreferences.setLockWallpaperActionLabelRes(actionLabelRes);\n mWallpaperPreferences.setLockWallpaperActionIconRes(actionIconRes);\n mWallpaperPreferences.setLockWallpaperCollectionId(collectionId);\n }\n\n return true;\n }", "public void rotateCCW() {\n for (Vector2D vec : template) {\n CCW.matrixVectorProductInPlace(vec);\n }\n }", "public void transpose(int steps) {\n\t\tfor ( Note n : this.alMelodie )\n\t\t\tn.transpose(steps);\n\t}", "@Test\n\tpublic void testDoRotaion() {\n\t\tresultlist = DoRotation.doRotaion(initialList, 0);\n\t\texpectedList = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6));\n\t\tassertNotNull(resultlist);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion of array 0\", resultlist.toArray(), expectedList.toArray());\n\t\t//Do rotaion of the arraylist using step value =1\n\t\t\n\t\t//Use same result of previous rotation and apply other rotation by step = 1\n\t\tresultlist = DoRotation.doRotaion(expectedList, 1);\n\t\texpectedList = new ArrayList<>(Arrays.asList(6, 1, 2, 3, 4, 5));\n\t\tassertNotNull(resultlist);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion of array 0\", resultlist.toArray(), expectedList.toArray());\n\t\t\n\t\t//Use same result of previous rotation and apply other rotation by step = 1\n\t\tresultlist = DoRotation.doRotaion(expectedList, 1);\n\t\texpectedList = new ArrayList<>(Arrays.asList(5, 6, 1, 2, 3, 4));\n\t\tassertNotNull(resultlist);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion of array 0\", resultlist.toArray(), expectedList.toArray());\n\t\t\n\t\t//this test must be the same if we use step = 2\n\t\tArrayList<Integer> resultlist_Step2 = DoRotation.doRotaion(initialList, 2);\n\t\texpectedList = new ArrayList<>(Arrays.asList(5, 6, 1, 2, 3, 4));\n\t\tassertNotNull(resultlist_Step2);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion with step = 2\", resultlist_Step2.toArray(), expectedList.toArray());\n\t}", "private static void norm3JS() {\n\n // Drive\n axLeftX.setAxis(leftJoystick, 0); //Mecanum (Arcade) Left/Right turn\n axLeftY.setAxis(leftJoystick, 1); //Mecanum (Arcade) Fwd/Bkwd\n axRightX.setAxis(rightJoystick, 0); //Mecanum Rotate orientation\n axRightY.setAxis(rightJoystick, 1); //unassigned\n\n btnGyroReset.setButton(rightJoystick, 6); // reset gyro to 0\n\n btnHoldLeft.setButton(rightJoystick, 4); //??\n btnHoldCenter.setButton(rightJoystick,3); //??\n btnHoldRight.setButton(rightJoystick, 5); //??\n \n // Gear\n btnPickupGear.setButton(coJoystick, 2); // Pickup gear off floor\n btnPlaceGear.setButton(coJoystick, 5); // Place gear on ship peg\n \n // Shooter\n btnShooter.setButton(coJoystick, 1); // Start shooter then feeder(s)\n btnAgitator.setButton(coJoystick, 3); // Agitate the ball bin\n \n // Climb\n btnClimber.setButton(coJoystick, 8); // Climber rotating\n \n }", "private void pickLayoutForSequenceFlow() {\n if (sourceAbsoluteCenterX == targetAbsoluteCenterX) {\n setEdgeDirectCenter();\n return;\n } else if (sourceAbsoluteCenterY == targetAbsoluteCenterY) {\n if (areCellsHorizontalFree()) {\n setEdgeDirectCenter();\n } else {\n setEdgeAroundTheCorner(true);\n }\n return;\n }\n\n if (sourceAbsoluteCenterX <= targetAbsoluteCenterX && sourceAbsoluteCenterY <= targetAbsoluteCenterY) {\n if (sourceJoin && sourceSplit) {\n setEdgeStepRight();\n return;\n } else if (sourceSplit) {\n setEdge90DegreeRightUnderClockwise();\n return;\n } else if (targetJoin) {\n setEdge90DegreeRightUnderAntiClockwise();\n return;\n }\n } else if (sourceAbsoluteCenterX > targetAbsoluteCenterX && sourceAbsoluteCenterY <= targetAbsoluteCenterY) {\n // target is left under\n if (sourceJoin && sourceSplit) {\n setEdgeStepRight();\n return;\n } else if (sourceSplit) {\n setEdge90DegreeRightAboveAntiClockwise();\n return;\n } else if (targetJoin) {\n setEdge90DegreeRightAboveClockwise();\n return;\n }\n }\n\n if (sourceJoin && sourceSplit && (!backwards)) {\n setEdgeStepRight();\n return;\n }\n\n if (sourceSplit && targetJoin) {\n setEdgeAroundTheCorner(true);\n return;\n }\n\n setEdgeDirectCenter();\n }", "private int orientation(Waypoint w1, Waypoint w3, Waypoint w2){\n\t\tdouble w1x = w1.getX();\n\t\tdouble w1y = w1.getY();\n\t\tdouble w2x = w2.getX();\n\t\tdouble w2y = w2.getY();\n\t\tdouble w3x = w3.getX();\n\t\tdouble w3y = w3.getY();\n\t\tdouble val = (w3y - w1y) * (w2x - w3x) - (w3x - w1x) * (w2y - w3y);\n\t\t\n\tif ( val == 0) //colinear\n\t\treturn 0;\n\t\n\treturn (val > 0) ? 1: 2; //clock or counterclock wise\n\t\n\t}", "private static void writeFinalRuleBase (boolean printStdOut) throws IllegalArgumentException, IOException{\n \t\n \tFileSystem fs = FileSystem.get(Mediator.getConfiguration());\n \tPath textPath = new Path(Mediator.getHDFSLocation()+Mediator.getLearnerRuleBasePath()+\"_text.txt\");\n BufferedWriter bwText = new BufferedWriter(new OutputStreamWriter(fs.create(textPath,true)));\n FileStatus[] status = fs.listStatus(new Path(Mediator.getHDFSLocation()+Mediator.getLearnerRuleBasePath()+\"_TMP\"));\n \tWriter writer = SequenceFile.createWriter(Mediator.getConfiguration(), \n \t\t\tWriter.file(new Path(Mediator.getHDFSLocation()+Mediator.getLearnerRuleBasePath())), \n \t\t\tWriter.keyClass(ByteArrayWritable.class), Writer.valueClass(FloatWritable.class));\n Reader reader;\n\t\tByteArrayWritable rule = new ByteArrayWritable();\n\t\tFloatWritable ruleWeight = new FloatWritable();\n\t\tint id = 0;\n \n bwText.write(\"\\nRULE BASE:\\n\\n\");\n if (printStdOut)\n \tSystem.out.println(\"\\nRULE BASE:\\n\");\n \t\n \t// Read all sequence files from stage 2\n \tfor (FileStatus fileStatus:status){\n \t\t\n \t\tif (!fileStatus.getPath().getName().contains(\"_SUCCESS\")){\n \t\t\n\t \t\t// Open sequence file\n\t \t\treader = new Reader(Mediator.getConfiguration(), Reader.file(fileStatus.getPath()));\n\t \n\t // Read all rules\n\t while (reader.next(rule, ruleWeight)) {\n\t \t\n\t \t// Write rule in the output sequence file\n\t \twriter.append(rule, ruleWeight);\n\t \t\n\t \tbwText.write(\"Rule (\"+id+\"): IF \");\n\t \tif (printStdOut)\n\t \t\tSystem.out.print(\"Rule (\"+id+\"): IF \");\n\t \t\n\t \t// Write antecedents\n\t \tfor (int i = 0; i < rule.getBytes().length - 2; i++){\n\t \t\t\n\t \t\tbwText.write(Mediator.getVariables()[i].getName()+\" IS \");\n\t \t\tif (printStdOut)\n\t \t\tSystem.out.print(Mediator.getVariables()[i].getName()+\" IS \");\n\t \t\tif (Mediator.getVariables()[i] instanceof NominalVariable){\n\t \t\t\tbwText.write(((NominalVariable)Mediator.getVariables()[i]).getNominalValue(rule.getBytes()[i])+\" AND \");\n\t \t\t\tif (printStdOut)\n\t \t\tSystem.out.print(((NominalVariable)Mediator.getVariables()[i]).getNominalValue(rule.getBytes()[i])+\" AND \");\n\t \t\t}\n\t \t\t\telse {\n\t \t\t\t\tbwText.write(\"L_\"+rule.getBytes()[i]+\" AND \");\n\t \t\t\t\tif (printStdOut)\n\t \t\tSystem.out.print(\"L_\"+rule.getBytes()[i]+\" AND \");\n\t \t\t\t}\n\t \t\t\n\t \t}\n\t \t\n\t \t// Write the last antecedent\n\t \tbwText.write(Mediator.getVariables()[rule.getBytes().length-2].getName()+\" IS \");\n\t \tif (printStdOut)\n\t \t\tSystem.out.print(Mediator.getVariables()[rule.getBytes().length-2].getName()+\" IS \");\n\t \tif (Mediator.getVariables()[rule.getBytes().length-2] instanceof NominalVariable){\n\t \t\tbwText.write(((NominalVariable)Mediator.getVariables()[rule.getBytes().length-2]).getNominalValue(rule.getBytes()[rule.getBytes().length-2]));\n\t \t\tif (printStdOut)\n\t \t\tSystem.out.print(((NominalVariable)Mediator.getVariables()[rule.getBytes().length-2]).getNominalValue(rule.getBytes()[rule.getBytes().length-2]));\n\t \t}\n\t \t\telse {\n\t \t\t\tbwText.write(\"L_\"+rule.getBytes()[rule.getBytes().length-2]);\n\t \t\t\tif (printStdOut)\n\t \t\tSystem.out.print(\"L_\"+rule.getBytes()[rule.getBytes().length-2]);\n\t \t\t}\n\t \t\n\t \t// Write the class and rule weight\n\t \tbwText.write(\" THEN CLASS = \"+Mediator.getClassLabel(rule.getBytes()[rule.getBytes().length-1]));\n\t \tbwText.write(\" WITH RW = \"+ruleWeight.get()+\"\\n\\n\");\n\t \tif (printStdOut){\n\t \t\tSystem.out.print(\" THEN CLASS = \"+Mediator.getClassLabel(rule.getBytes()[rule.getBytes().length-1]));\n\t \t\tSystem.out.print(\" WITH RW = \"+ruleWeight.get()+\"\\n\\n\");\n\t \t}\n\t\n\t \tid++;\n\t \t\n\t }\n\t \n\t reader.close();\n \n \t\t}\n \t\t\n \t}\n \t\n \tbwText.close();\n writer.close();\n \t\n \t// Remove temporary rule base\n \tfs.delete(new Path(Mediator.getHDFSLocation()+Mediator.getLearnerRuleBasePath()+\"_TMP\"),true);\n \t\n }", "private void aretes_aY(){\n\t\tthis.cube[49] = this.cube[43]; \n\t\tthis.cube[43] = this.cube[21];\n\t\tthis.cube[21] = this.cube[10];\n\t\tthis.cube[10] = this.cube[32];\n\t\tthis.cube[32] = this.cube[49];\n\t}", "private void applyTheRule() throws Exception {\n System.out.println();\n System.out.println();\n System.out.println();\n System.out.println(\"IM APPLYING RULE \" + this.parameter.rule + \" ON MODEL: \" + this.resultingModel.path);\n System.out.println();\n if (parameter.rule.equals(\"1\")) {\n Rule1.apply(resultingModel);\n System.out.println();\n }\n\n if (parameter.rule.equals(\"2\")) {\n Rule2.apply(resultingModel);\n System.out.println();\n }\n\n if (parameter.rule.equals(\"3\")) {\n Rule3.all(resultingModel);\n System.out.println();\n }\n\n if (parameter.rule.equals(\"3a\")) {\n Rule3.a(resultingModel);\n\n }\n\n if (parameter.rule.equals(\"3b\")) {\n Rule3.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"3c\")) {\n Rule3.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"4\")) {\n Rule4.all(resultingModel);\n }\n\n if (parameter.rule.equals(\"4a\")) {\n Rule4.a(resultingModel);\n }\n\n if (parameter.rule.equals(\"4b\")) {\n Rule4.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"4c\")) {\n Rule4.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"r1\")) {\n Reverse1.apply(resultingModel, parameter.aggregateBy);\n }\n\n if (parameter.rule.equals(\"r2\")) {\n Reverse2.apply(resultingModel, parameter.aggregateBy);\n }\n\n if (parameter.rule.equals(\"r3\")) {\n Reverse3.apply(resultingModel, parameter.aggregateBy);\n }\n\n if (parameter.rule.equals(\"r3a\")) {\n Reverse3.a(resultingModel);\n }\n\n if (parameter.rule.equals(\"r3b\")) {\n Reverse3.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"r3c\")) {\n Reverse3.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4\")) {\n Reverse4.all(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4a\")) {\n Reverse4.a(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4b\")) {\n Reverse4.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4c\")) {\n Reverse4.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"5\")){\n Rule5.apply(resultingModel);\n }\n\n System.out.println(\"IM DONE APPLYING RULE \" + this.parameter.rule + \" ON MODEL: \" + this.resultingModel.path);\n\n this.resultingModel.addRule(parameter);\n //System.out.println(this.resultingModel.name);\n this.resultingModel.addOutputInPath();\n }", "private void processPoints() {\n\t\t// We don't want multiple of the same normals, so we calculate them on the fly\n\t\tArrayList<Vector2f> normals = new ArrayList<Vector2f>();\n\t\tVector2f edge = new Vector2f();\n\n\t\tif (points.length < 3) {\n\t\t\tthrow new IllegalStateException(\"There must be more than two points in a polygon... Shame on you!\");\n\t\t}\n\t\t\n\t\t// Calculate the center\n\t\tcenter = new Vector2f();\n\t\tfor (Vector2f p : points) {\n\t\t\tcenter.add(p);\t\t\n\t\t}\n\t\tcenter.scale(1.0f / (float) points.length);\n\t\t\n\t\t// Subtract the center from each point so it's centerd\n\t\tfor (Vector2f p : points) {\n\t\t\tp.sub(center);\n\t\t}\n\t\t\n\t\t// Calculate the direction to loop through them\n\t\tVector2f edgeA = points[points.length - 1].clone().sub(points[0]);\n\t\tVector2f edgeB = points[1].clone().sub(points[0]);\n\t\t\n\t\tboolean rightHand = edgeA.x * edgeB.y - edgeB.x * edgeA.y < 0;\n\t\t\n\t\tfor (int i = 0; i < points.length; i++) {\n\t\t\tVector2f.sub(points[(i + 1) % points.length], points[i], edge);\n\t\t\t\n\t\t\t// Check if the current point is further away then the current\n\t\t\tfloat length = points[i].length();\n\t\t\tbroadPhaseLength = Math.max(length, broadPhaseLength);\n\t\t\t\n\t\t\t// Calculated of 90 degree rotation matrix\n\t\t\t\n\t\t\tVector2f normal;\n\t\t\tif (rightHand) {\n\t\t\t\tnormal = new Vector2f( edge.y,-edge.x);\n\t\t\t} else {\n\t\t\t\tnormal = new Vector2f(-edge.y, edge.x);\n\t\t\t}\n\t\t\tnormal.normalise();\n\t\t\tint j = 0;\n\t\t\tfor (; j < normals.size(); j++) {\n\t\t\t\tif (Math.abs(normals.get(j).dot(normal)) == 1.0f) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (j == normals.size()) {\n\t\t\t\tnormals.add(normal);\n\t\t\t}\n\t\t}\n\t\t\n\t\tthis.normals = new Vector2f[normals.size()];\n\t\tnormals.toArray(this.normals);\n\t}", "void take_angles() {\n\n rolls+=String.valueOf((Math.toDegrees(orientation[2]))%360+90)+\"\\n\";\n if(!touch_ground_switch.isChecked()&&angle_with_ground==0)\n angle_with_ground=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n else if (down_angle == 0)\n down_angle=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n else if(up_angle==0)\n {\n up_angle=adjust_angle_rotation(Math.toDegrees(orientation[2]) % 360 + 90);\n touch_ground_switch.setVisibility(View.INVISIBLE);\n if(!touch_ground_switch.isChecked())\n object_calculations_doesnt_touch_ground();\n else\n object_calculations_touch_ground();\n }\n}", "private void determineOrientation(float[] rotationMatrix) {\n\t\t\t float[] orientationValues = new float[3];\n\t\t SensorManager.getOrientation(rotationMatrix, orientationValues);\n\t\t double azimuth = Math.toDegrees(orientationValues[0]);\n\t\t double pitch = Math.toDegrees(orientationValues[1]);\n\t\t double roll = Math.toDegrees(orientationValues[2]);\n\t\t if (pitch <= 10)\n\t\t { \n\t\t if (Math.abs(roll) >= 170)\n\t\t {\n\t\t onFaceDown();\n\t\t }\n\t\t else if (Math.abs(roll) <= 10)\n\t\t {\n\t\t onFaceUp();\n\t\t }\n\t\t }\n\t\t\t\n\t\t}", "private void aretes_aW(){\n\t\tthis.cube[4] = this.cube[16]; \n\t\tthis.cube[16] = this.cube[23];\n\t\tthis.cube[23] = this.cube[37];\n\t\tthis.cube[37] = this.cube[30];\n\t\tthis.cube[30] = this.cube[4];\n\t}", "@SuppressWarnings(\"incomplete-switch\")\n\tprivate void rotatingBehavior() {\n\t\tif (remainingSteps > 0) {\n\t\t\tremainingSteps--;\n\t\t} else {\n\t\t\tswitch (facing) {\n\t\t\t\tcase LEFT:\n\t\t\t\t\tchangeFacing(ACTION.UP);\n\t\t\t\t\tbreak;\n\t\t\t\tcase UP:\n\t\t\t\t\tchangeFacing(ACTION.RIGHT);\n\t\t\t\t\tbreak;\n\t\t\t\tcase RIGHT:\n\t\t\t\t\tchangeFacing(ACTION.DOWN);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DOWN:\n\t\t\t\t\tchangeFacing(ACTION.LEFT);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tremainingSteps = STEP_SIZE;\n\t\t}\n\t}", "@Override\n\tpublic void rotation(double rx, double ry, double rz) {\n\t\tint i;\n\t\t\n\t\tfor (i = 0; i<6; i++) {\n\t\t\tthis.plans.get(i).rotation(rx, ry, rz);\n\t\t}\n\t\t//Ca me parait un peu foireux comme methode faudra voir apres ave l'interface graphique si\n\t\t//�a marche comme �a.\n\t}", "private boolean orientationChange(HashMap<String, Float> orientation) {\n int variance = 10;\n\n if(!FunUtils.numberTollerance(orientation.get(\"azimuth\"), this.orientation.get(\"azimuth\"), variance)){\n return true;\n }\n\n if(!FunUtils.numberTollerance(orientation.get(\"pitch\"), this.orientation.get(\"pitch\"), variance)){\n return true;\n }\n // This used to be an 'if', But this is the asme as what i had, but with a few lines less code.\n if(!FunUtils.numberTollerance(orientation.get(\"roll\"), this.orientation.get(\"roll\"), variance)){\n return true;\n }\n return false;\n\n }", "default void process_justification_and_finalization(MutableBeaconState state) {\n if (get_current_epoch(state).lessEqual(getConstants().getGenesisEpoch().increment())) {\n return;\n }\n\n EpochNumber previous_epoch = get_previous_epoch(state);\n EpochNumber current_epoch = get_current_epoch(state);\n EpochNumber old_previous_justified_epoch = state.getPreviousJustifiedEpoch();\n EpochNumber old_current_justified_epoch = state.getCurrentJustifiedEpoch();\n\n /* Process justifications\n state.previous_justified_epoch = state.current_justified_epoch\n state.previous_justified_root = state.current_justified_root\n state.justification_bitfield = (state.justification_bitfield << 1) % 2**64 */\n state.setPreviousJustifiedEpoch(state.getCurrentJustifiedEpoch());\n state.setPreviousJustifiedRoot(state.getCurrentJustifiedRoot());\n state.setJustificationBitfield(state.getJustificationBitfield().shl(1));\n\n /* previous_epoch_matching_target_balance = get_attesting_balance(state, get_matching_target_attestations(state, previous_epoch))\n if previous_epoch_matching_target_balance * 3 >= get_total_active_balance(state) * 2:\n state.current_justified_epoch = previous_epoch\n state.current_justified_root = get_block_root(state, state.current_justified_epoch)\n state.justification_bitfield |= (1 << 1) */\n Gwei previous_epoch_matching_target_balance =\n get_attesting_balance(state, get_matching_target_attestations(state, previous_epoch));\n if (previous_epoch_matching_target_balance.times(3)\n .greater(get_total_active_balance(state).times(2))) {\n state.setCurrentJustifiedEpoch(previous_epoch);\n state.setCurrentJustifiedRoot(get_block_root(state, state.getCurrentJustifiedEpoch()));\n state.setJustificationBitfield(state.getJustificationBitfield().or(2));\n }\n\n /* current_epoch_matching_target_balance = get_attesting_balance(state, get_matching_target_attestations(state, current_epoch))\n if current_epoch_matching_target_balance * 3 >= get_total_active_balance(state) * 2:\n state.current_justified_epoch = current_epoch\n state.current_justified_root = get_block_root(state, state.current_justified_epoch)\n state.justification_bitfield |= (1 << 0) */\n Gwei current_epoch_matching_target_balance =\n get_attesting_balance(state, get_matching_target_attestations(state, current_epoch));\n if (current_epoch_matching_target_balance.times(3)\n .greater(get_total_active_balance(state).times(2))) {\n state.setCurrentJustifiedEpoch(current_epoch);\n state.setCurrentJustifiedRoot(get_block_root(state, state.getCurrentJustifiedEpoch()));\n state.setJustificationBitfield(state.getJustificationBitfield().or(1));\n }\n\n /* Process finalizations\n bitfield = state.justification_bitfield */\n Bitfield64 bitfield = state.getJustificationBitfield();\n\n /* The 2nd/3rd/4th most recent epochs are justified, the 2nd using the 4th as source\n if (bitfield >> 1) % 8 == 0b111 and old_previous_justified_epoch == current_epoch - 3:\n state.finalized_epoch = old_previous_justified_epoch\n state.finalized_root = get_block_root(state, state.finalized_epoch) */\n if ((bitfield.getValue() >>> 1) % 8 == 0b111 && old_previous_justified_epoch.equals(current_epoch.minus(3))) {\n state.setFinalizedEpoch(old_current_justified_epoch);\n state.setFinalizedRoot(get_block_root(state, state.getFinalizedEpoch()));\n }\n\n /* The 2nd/3rd most recent epochs are justified, the 2nd using the 3rd as source\n if (bitfield >> 1) % 4 == 0b11 and old_previous_justified_epoch == current_epoch - 2:\n state.finalized_epoch = old_previous_justified_epoch\n state.finalized_root = get_block_root(state, state.finalized_epoch) */\n if ((bitfield.getValue() >>> 1) % 4 == 0b11 && old_previous_justified_epoch.equals(current_epoch.minus(2))) {\n state.setFinalizedEpoch(old_current_justified_epoch);\n state.setFinalizedRoot(get_block_root(state, state.getFinalizedEpoch()));\n }\n\n /* The 1st/2nd/3rd most recent epochs are justified, the 1st using the 3rd as source\n if (bitfield >> 0) % 8 == 0b111 and old_current_justified_epoch == current_epoch - 2:\n state.finalized_epoch = old_current_justified_epoch\n state.finalized_root = get_block_root(state, state.finalized_epoch) */\n if (bitfield.getValue() % 8 == 0b111 && old_previous_justified_epoch.equals(current_epoch.minus(2))) {\n state.setFinalizedEpoch(old_current_justified_epoch);\n state.setFinalizedRoot(get_block_root(state, state.getFinalizedEpoch()));\n }\n\n /* The 1st/2nd most recent epochs are justified, the 1st using the 2nd as source\n if (bitfield >> 0) % 4 == 0b11 and old_current_justified_epoch == current_epoch - 1:\n state.finalized_epoch = old_current_justified_epoch\n state.finalized_root = get_block_root(state, state.finalized_epoch) */\n if (bitfield.getValue() % 4 == 0b11 && old_previous_justified_epoch.equals(current_epoch.minus(1))) {\n state.setFinalizedEpoch(old_current_justified_epoch);\n state.setFinalizedRoot(get_block_root(state, state.getFinalizedEpoch()));\n }\n }", "public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)\n {\n float f = par3 * (float)Math.PI * -0.1F;\n\n for (int i = 0; i < 4; i++)\n {\n field_78106_a[i].rotationPointY = -2F + MathHelper.cos(((float)(i * 2) + par3) * 0.25F);\n field_78106_a[i].rotationPointX = MathHelper.cos(f) * 9F;\n field_78106_a[i].rotationPointZ = MathHelper.sin(f) * 9F;\n f += ((float)Math.PI / 2F);\n }\n\n f = ((float)Math.PI / 4F) + par3 * (float)Math.PI * 0.03F;\n\n for (int j = 4; j < 8; j++)\n {\n field_78106_a[j].rotationPointY = 2.0F + MathHelper.cos(((float)(j * 2) + par3) * 0.25F);\n field_78106_a[j].rotationPointX = MathHelper.cos(f) * 7F;\n field_78106_a[j].rotationPointZ = MathHelper.sin(f) * 7F;\n f += ((float)Math.PI / 2F);\n }\n\n f = 0.4712389F + par3 * (float)Math.PI * -0.05F;\n\n for (int k = 8; k < 12; k++)\n {\n field_78106_a[k].rotationPointY = 11F + MathHelper.cos(((float)k * 1.5F + par3) * 0.5F);\n field_78106_a[k].rotationPointX = MathHelper.cos(f) * 5F;\n field_78106_a[k].rotationPointZ = MathHelper.sin(f) * 5F;\n f += ((float)Math.PI / 2F);\n }\n\n field_78105_b.rotateAngleY = par4 / (180F / (float)Math.PI);\n field_78105_b.rotateAngleX = par5 / (180F / (float)Math.PI);\n }", "public void triangulate() {\n // Save the outline and calculate normals\n outline = new Vector<PlanarEdge>();\n for (PlanarEdge e : subdivision.getEdges()) {\n if (e.isRealEdge()) {\n outline.add(e);\n }\n }\n // Calculate outline normals\n outline_normals = new Vector3f[outline.size()];\n for (PlanarEdge e : outline) {\n TriangulationVertex vert = (TriangulationVertex) e.getDestination();\n // Normal 1\n Vector3f normal1 = new Vector3f(vert.getOutGoingEdge()\n .getDestination().getPoint())\n .subtractLocal(vert.getPoint()).normalizeLocal();\n // Vector3f normal1 = new\n // Vector3f(vert.getOutGoingEdge().getDestination().getPoint()).subtractLocal(vert.getPoint());\n normal1.z = -normal1.x;\n normal1.x = normal1.y;\n normal1.y = normal1.z;\n normal1.z = 0;\n // Normal 2\n Vector3f normal2 = new Vector3f(vert.getPoint()).subtractLocal(\n vert.getInGoingEdge().getOrigin().getPoint())\n .normalizeLocal();\n // Vector3f normal2 = new\n // Vector3f(vert.getPoint()).subtractLocal(vert.getInGoingEdge().getOrigin().getPoint());\n normal2.z = -normal2.x;\n normal2.x = normal2.y;\n normal2.y = normal2.z;\n normal2.z = 0;\n normal1.addLocal(normal2).normalizeLocal();\n\n outline_normals[vert.getIndex()] = normal1;\n }\n\n // Calculate the triangulation of the surface.\n surface = subdivision.triangulate();\n }", "public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)\n {\n ModelRenderer[] var8 = this.squidTentacles;\n int var9 = var8.length;\n\n for (int var10 = 0; var10 < var9; ++var10)\n {\n ModelRenderer var11 = var8[var10];\n var11.rotateAngleX = par3;\n }\n }", "public void postRotateQuat(float x, float y, float z, float w) {\n \n float len = (float) Math.sqrt(x*x+y*y+z*z+w*w);\n if(len != 1){\n x /= len;\n y /= len;\n z /= len;\n w /= len;\n }\n \n float[] r = { \n 1 - (2*y*y + 2*z*z), 2*x*y - 2*z*w, 2*x*z+2*y*w, 0,\n 2*x*y + 2*z*w, 1 - (2*x*x + 2*z*z), 2*y*z-2*x*w, 0,\n 2*x*z - 2*y*w, 2*y*z + 2*x*w, 1 - (2*x*x+2*y*y), 0,\n 0, 0, 0, 1.0f};\n matrix = mulMM(matrix, r);\n }", "public void makeNeighboursOrientationConsistent(ScalarOperator sop,\n\t\t\tFlagMap flags) {\n\t\tStack<Object[]> upcoming = new Stack<Object[]>();\n\t\tTriangleElt3D current = this;\n\t\tdo {\n\t\t\t// set visited status\n\t\t\tflags.add(current);\n\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tTriangleElt3D nb = current.getNeighbour(i);\n\t\t\t\tif (nb != null && (!flags.check(nb))) {\n\t\t\t\t\tupcoming.push(new Object[] { i, nb, current });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tObject[] nbObj = null;\n\t\t\ttry {\n\t\t\t\tnbObj = upcoming.pop();\n\t\t\t} catch (EmptyStackException ese) {\n\t\t\t\t// do nothing\n\t\t\t}\n\t\t\tint index = -1;\n\t\t\tTriangleElt3D nb = null;\n\t\t\tTriangleElt3D current2 = null;\n\t\t\tif (nbObj != null) {\n\t\t\t\tindex = (Integer) nbObj[0];\n\t\t\t\tnb = (TriangleElt3D) nbObj[1];\n\t\t\t\tcurrent2 = (TriangleElt3D) nbObj[2];\n\t\t\t}\n\n\t\t\tif ((nb != null) && (!flags.check(nb))) {\n\t\t\t\t// if not already visited\n\n\t\t\t\t// point indices of common edge (common edge has (in this)\n\t\t\t\t// direction p1->p2)\n\t\t\t\tint p1 = (index + 1) % 3;\n\t\t\t\tint p2 = (index + 2) % 3;\n\n\t\t\t\tint j = 0;\n\n\t\t\t\t// find nb's index j for opposite point of common edge\n\t\t\t\tfor (j = 0; j < 3; j++)\n\t\t\t\t\tif (!(current2.getPoint(p1).isEqual(nb.getPoint(j), sop) || current2\n\t\t\t\t\t\t\t.getPoint(p2).isEqual(nb.getPoint(j), sop)))\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t// nb's index for first point of common edge\n\t\t\t\tj = (j + 1) % 3;\n\n\t\t\t\tif (current2.getPoint(p1).isEqual(nb.getPoint(j), sop))\n\t\t\t\t\tnb.invertOrientation();\n\n\t\t\t\t// orientNeighbours for nb\n\t\t\t}\n\t\t\tcurrent = nb;\n\n\t\t} while (upcoming.size() != 0 || current != null);\n\n\t}", "public TalonControllerGroup finishCalibration() {\n\t\tTalonSettings frontLeftSettings = TalonSettingsBuilder.copy(leftTalonSettings);\n\t\tTalonSettings frontRightSettings = TalonSettingsBuilder.copy(rightTalonSettings);\n\t\tTalonSettings rearLeftSettings = TalonSettingsBuilder.copy(leftTalonSettings);\n\t\tTalonSettings rearRightSettings = TalonSettingsBuilder.copy(rightTalonSettings);\n\n\t\tEncoderCheck checker = tester.finishTest();\n\t\tlog.log(\"Calibration Finished\", true);\n\t\tlog.log(\"LeftFrontMotorGood\",checker.isLeftFrontOk());\n\t\tlog.log(\"LeftRearMotorGood\",checker.isLeftRearOk());\n\t\tlog.log(\"RightFrontMotorGood\",checker.isRightFrontOk());\n\t\tlog.log(\"RightRearMotorGood\",checker.isRightRearOk());\n\t\t\n\t\tif ( checker.shouldDisableAll()) {\n\t\t\tfrontLeftSettings = TalonSettingsBuilder.disabledCopy(rearLeftSettings);\n\t\t\tfrontRightSettings = TalonSettingsBuilder.disabledCopy(rearLeftSettings);\n\t\t\trearLeftSettings = TalonSettingsBuilder.disabledCopy(rearLeftSettings);\n\t\t\trearRightSettings = TalonSettingsBuilder.disabledCopy(rearLeftSettings);\t\t\t\n\t\t}\n\t\telse {\n\t\t\tif ( checker.shouldLeftFrontFollowLeftRear()) {\n\t\t\t\tfrontLeftSettings = TalonSettingsBuilder.follow(rearLeftSettings,\n\t\t\t\t\t\tRobotMap.CAN.FRONT_RIGHT_MOTOR);\t\t\t\n\t\t\t}\n\t\t\tif ( checker.shouldLeftRearFollowLeftFront()) {\n\t\t\t\trearLeftSettings = TalonSettingsBuilder.follow(frontLeftSettings,\n\t\t\t\t\t\tRobotMap.CAN.FRONT_LEFT_MOTOR);\t\t\t\n\t\t\t}\n\t\t\tif ( checker.shouldRightFrontFollowRightRear()) {\n\t\t\t\tfrontRightSettings = TalonSettingsBuilder.follow(rearRightSettings,\n\t\t\t\t\t\tRobotMap.CAN.FRONT_RIGHT_MOTOR);\t\t\t\n\t\t\t}\n\t\t\tif ( checker.shouldRightRearFollowRightFront()) {\n\t\t\t\trearRightSettings = TalonSettingsBuilder.follow(frontRightSettings,\n\t\t\t\t\t\tRobotMap.CAN.FRONT_RIGHT_MOTOR);\t\t\t\n\t\t\t}\t\t\t\n\t\t}\n\t\tthis.calibrated = true;\n\t\treturn new TalonControllerGroup(\t\t\t\t\n\t\t\t\tnew TalonPositionController(frontLeftMotor, frontLeftSettings),\n\t\t\t\tnew TalonPositionController(frontRightMotor, rearLeftSettings),\n\t\t\t\tnew TalonPositionController(rearLeftMotor, frontRightSettings), \n\t\t\t\tnew TalonPositionController(rearRightMotor, rearRightSettings));\t\t\n\t\t\n\t}", "private void managePolygonsCollisions() {\n for ( int m = 0; m < polygons.size(); m++ ) {\n for ( int n = m + 1; n < polygons.size(); n++ ) {\n managePolygonCollision(polygons.get(m), polygons.get(n));\n }\n }\n }", "public void rotate(){\n\t\t\n\t\tfor(Vertex v : vertices){\n\n\t\t\tMatrix m = ViewSettings.getRotationMatrix4().multiply(v);\n\n\t\t\tv.setX(m.getValue(0, 0));\n\t\t\tv.setY(m.getValue(1, 0));\n\t\t\tv.setZ(m.getValue(2, 0));\n\t\t\tv.setW(m.getValue(3, 0));\n\t\t}\n\t}", "private void defineVertexes(String orientation){\n if(\"down\".equals(orientation)){\n y2 = y1-height;\n y3 = y1-height;\n \n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"up\")){\n y2 = y1+height;\n y3 = y1+height;\n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"left\")){\n x2 = x1-height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }else if(orientation.equals(\"right\")){\n x2 = x1+height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }\n }", "@SuppressWarnings(\"unused\")\n private void transformLateralShift() {\n if (steps.size() < 3) {\n return;\n }\n final int index = steps.size() - 3;\n final MoveStep step1 = getStep(index);\n final MoveStep step2 = getStep(index + 1);\n final MoveStep step3 = getStep(index + 2);\n\n if (step1.oppositeTurn(step3)\n && ((step2.getType() == MovePath.MoveStepType.BACKWARDS) || (step2.getType() == MovePath.MoveStepType.FORWARDS))) {\n final MoveStepType stepType = step1.getType();\n final MoveStepType direction = step2.getType();\n // remove all old steps\n steps.removeElementAt(index);\n steps.removeElementAt(index);\n steps.removeElementAt(index);\n // add new step\n final MoveStep shift = new MoveStep(this, lateralShiftForTurn(stepType, direction));\n addStep(shift);\n }\n }", "public void finalizeMovement() {\n for (Iterator<TransformLayer> itr = tLayerPool.values().iterator(); itr.hasNext(); ) {\n itr.next().finalizeMovement();\n }\n }", "private void arretes_fY(){\n\t\tthis.cube[49] = this.cube[46]; \n\t\tthis.cube[46] = this.cube[48];\n\t\tthis.cube[48] = this.cube[52];\n\t\tthis.cube[52] = this.cube[50];\n\t\tthis.cube[50] = this.cube[49];\n\t}", "private int fourOfaKind() {\n\t\tif (hand[1].getValueIndex() == hand[2].getValueIndex() && hand[2].getValueIndex() == hand[3].getValueIndex()) {\n\t\t\tif (hand[0].getValueIndex() == hand[1].getValueIndex()\n\t\t\t\t\t|| hand[4].getValueIndex() == hand[3].getValueIndex()) {\n\t\t\t\tresult.setPrimaryValuePos(hand[3].getValueIndex());\n\t\t\t\t\n\t\t\t\tif( result.getPrimaryValuePos() == hand[4].getValueIndex()) {\n\t\t\t\t\tresult.setSecondaryValuePos(hand[0].getValueIndex());\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresult.setSecondaryValuePos(hand[4].getValueIndex());\n\t\t\t\t}\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t}", "void calculateRotationMatrix() {\n R[0][0] = (float) (Math.cos(angle[0]) * Math.cos(angle[1]));\n R[1][0] = (float) (Math.sin(angle[0]) * Math.cos(angle[1]));\n R[0][1] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) - Math.sin(angle[0]) * Math.cos(angle[2]));\n R[1][1] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) + Math.cos(angle[0]) * Math.cos(angle[2]));\n R[0][2] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) + Math.sin(angle[0]) * Math.sin(angle[2]));\n R[1][2] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) - Math.cos(angle[0]) * Math.sin(angle[2]));\n R[2][0] = (float) - Math.sin(angle[1]);\n R[2][1] = (float) (Math.cos(angle[1]) * Math.sin(angle[2]));\n R[2][2] = (float) (Math.cos(angle[1]) * Math.cos(angle[2]));\n }", "private void RLRotation(IAVLNode node)\r\n\t{\r\n\t\tLLRotation(node.getRight());\r\n\t\tRRRotation(node);\r\n\t}", "private final void step3() { if (k == 0) return; /* For Bug 1 */ switch (b[k-1])\n\t {\n\t case 'a': if (ends(\"ational\")) { r(\"ate\"); break; }\n\t if (ends(\"tional\")) { r(\"tion\"); break; }\n\t break;\n\t case 'c': if (ends(\"enci\")) { r(\"ence\"); break; }\n\t if (ends(\"anci\")) { r(\"ance\"); break; }\n\t break;\n\t case 'e': if (ends(\"izer\")) { r(\"ize\"); break; }\n\t break;\n\t case 'l': if (ends(\"bli\")) { r(\"ble\"); break; }\n\t if (ends(\"alli\")) { r(\"al\"); break; }\n\t if (ends(\"entli\")) { r(\"ent\"); break; }\n\t if (ends(\"eli\")) { r(\"e\"); break; }\n\t if (ends(\"ousli\")) { r(\"ous\"); break; }\n\t break;\n\t case 'o': if (ends(\"ization\")) { r(\"ize\"); break; }\n\t if (ends(\"ation\")) { r(\"ate\"); break; }\n\t if (ends(\"ator\")) { r(\"ate\"); break; }\n\t break;\n\t case 's': if (ends(\"alism\")) { r(\"al\"); break; }\n\t if (ends(\"iveness\")) { r(\"ive\"); break; }\n\t if (ends(\"fulness\")) { r(\"ful\"); break; }\n\t if (ends(\"ousness\")) { r(\"ous\"); break; }\n\t break;\n\t case 't': if (ends(\"aliti\")) { r(\"al\"); break; }\n\t if (ends(\"iviti\")) { r(\"ive\"); break; }\n\t if (ends(\"biliti\")) { r(\"ble\"); break; }\n\t break;\n\t case 'g': if (ends(\"logi\")) { r(\"log\"); break; }\n\t } }", "protected void setOrientation(int n) {\n if (this.mStateMachine.isRecording()) {\n super.setOrientation(n, this.mRecordingOrientation);\n } else {\n super.setOrientation(n);\n }\n if (this.isHeadUpDesplayReady()) {\n if (this.mSettingDialogStack != null) {\n this.mSettingDialogStack.setUiOrientation(n);\n }\n this.mSceneIndicatorIcon.setRotation(RotationUtil.getAngle(this.getOrientationForUiNotRotateInRecording()));\n this.mConditionIndicatorIcon.setRotation(RotationUtil.getAngle(this.getOrientationForUiNotRotateInRecording()));\n this.mSceneIndicatorText.setAnimation(null);\n this.mSceneIndicatorText.setVisibility(4);\n if (this.mAutoReview != null) {\n this.mAutoReview.setOrientation(n);\n }\n if (this.mFocusRectangles != null) {\n this.mFocusRectangles.setOrientation(n);\n }\n if (this.mSelfTimerCountDownView != null) {\n this.mSelfTimerCountDownView.setSensorOrientation(n);\n }\n }\n }", "public void setRotationAngles(float parTime, float parSwingSuppress, float par3, float parHeadAngleY, float parHeadAngleX, float par6, EntityElephant parEntity)\n {\n \t// return rotation point in case there was previous rearing animation\n \thead.setRotationPoint(headRotPointXDefault, headRotPointYDefault, headRotPointZDefault);\n body.setRotationPoint(bodyRotPointXDefault, bodyRotPointYDefault, bodyRotPointZDefault);\n legFrontRight.setRotationPoint(legFrontRightRotPointXDefault, legFrontRightRotPointYDefault, legFrontRightRotPointZDefault);\n legFrontLeft.setRotationPoint(legFrontLeftRotPointXDefault, legFrontLeftRotPointYDefault, legFrontLeftRotPointZDefault);\n childHead.setRotationPoint(childHeadRotPointXDefault, childHeadRotPointYDefault, childHeadRotPointZDefault);\n\n head.rotateAngleX = degToRad(parHeadAngleX);\n head.rotateAngleY = degToRad(parHeadAngleY);\n childHead.rotateAngleX = degToRad(parHeadAngleX);\n childHead.rotateAngleY = degToRad(parHeadAngleY);\n body.rotateAngleX = ((float)Math.PI / 2F);\n // swingSuppress goes to 0 when still so gates the movement\n legRearRight.rotateAngleX = MathHelper.cos(parTime * 0.6662F) * 1.4F * parSwingSuppress;\n legRearLeft.rotateAngleX = MathHelper.cos(parTime * 0.6662F + (float)Math.PI) * 1.4F * parSwingSuppress;\n legFrontRight.rotateAngleX = MathHelper.cos(parTime * 0.6662F + (float)Math.PI) * 1.4F * parSwingSuppress;\n legFrontLeft.rotateAngleX = MathHelper.cos(parTime * 0.6662F) * 1.4F * parSwingSuppress;\n trunk1.rotateAngleX = MathHelper.cos(degToRad(parEntity.ticksExisted*7)) * degToRad(15);\n childTrunk1.rotateAngleX = MathHelper.cos(degToRad(parEntity.ticksExisted*7)) * degToRad(15);\n trunk2.rotateAngleX = trunk1.rotateAngleX * 3;\n\n // flick ears\n ear1.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(15);\n ear2.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(-15);\n childEar1.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(15);\n childEar2.rotateAngleY = (float) Math.pow(MathHelper.cos(degToRad(parEntity.ticksExisted*3)), 6) * degToRad(-15);\n\n // raise trunk if in water \n if (parEntity.isInWater())\n {\n \ttrunk1.rotateAngleX = degToRad(-150);\n \ttrunk2.rotateAngleX = degToRad(-20);\n \tchildTrunk1.rotateAngleX = degToRad(-150);\n }\n \n // perform rearing animation if appropriate\n if (parEntity.isRearing())\n {\n \tint rearingCounter = parEntity.getRearingCounter();\n// \t// DEBUG\n// \tSystem.out.println(\"ModelElephant entity is rearing with rearing counter = \"+rearingCounter);\n \t\n \t// move retain connection between body parts, hind legs stay where they were\n \thead.setRotationPoint(headRotPointXDefault, headRotPointYDefault+rearingOffsetCycle[rearingCounter][0], headRotPointZDefault+rearingOffsetCycle[rearingCounter][1]);\n body.setRotationPoint(bodyRotPointXDefault, bodyRotPointYDefault+rearingOffsetCycle[rearingCounter][2], bodyRotPointZDefault+rearingOffsetCycle[rearingCounter][3]);\n legFrontRight.setRotationPoint(legFrontRightRotPointXDefault, legFrontRightRotPointYDefault+rearingOffsetCycle[rearingCounter][4], legFrontRightRotPointZDefault+rearingOffsetCycle[rearingCounter][5]);\n legFrontLeft.setRotationPoint(legFrontLeftRotPointXDefault, legFrontLeftRotPointYDefault+rearingOffsetCycle[rearingCounter][6], legFrontLeftRotPointZDefault+rearingOffsetCycle[rearingCounter][7]);\n childHead.setRotationPoint(childHeadRotPointXDefault, childHeadRotPointYDefault+rearingOffsetCycle[rearingCounter][8], childHeadRotPointZDefault+rearingOffsetCycle[rearingCounter][9]);\n \n // rotate for rearing\n \tbody.rotateAngleX += degToRad(rearingAngleCycle[rearingCounter][0]);\n head.rotateAngleX += degToRad(rearingAngleCycle[rearingCounter][0]);\n \tchildHead.rotateAngleX += degToRad(rearingAngleCycle[rearingCounter][0]);\n \ttrunk1.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][1]);\n \ttrunk2.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][2]);\n \tchildTrunk1.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][1]);\n \tlegFrontRight.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][0]);\n \tlegFrontLeft.rotateAngleX = degToRad(rearingAngleCycle[rearingCounter][0]);\n }\n }", "public void testStableRotations() {\n\n // Get a random point (x, y, z) and axis through (a, b, c).\n double x = getRandom();\n double y = getRandom();\n double z = getRandom();\n a = getRandom();\n b = getRandom();\n c = getRandom();\n u = getRandom();\n v = getRandom();\n w = getRandom();\n\n RotationMatrix rM = new RotationMatrix(a, b, c, u, v, w, theta);\n double distAxis = rM.distanceFromAxis(x, y, z);\n double distPt2 = (a-x)*(a-x) + (b-y)*(b-y) + (c-z)*(c-z);\n\n double[] result = null;\n double resultDistAxis;\n double resultDistPt2;\n for(int i=0; i<200; i++) {\n theta = getRandom()*pi;\n rM = new RotationMatrix(a, b, c, u, v, w, theta);\n result = rM.timesXYZ(x, y, z);\n resultDistAxis\n = rM.distanceFromAxis(result[0], result[1], result[2]);\n // Rotations shouldn't change the distance from the axis.\n assertEquals(distAxis, resultDistAxis, TOLERANCE);\n\n // Rotations shouldn't change the distance from a fixed\n // point (a, b, c) on the axis.\n resultDistPt2 = (a-result[0])*(a-result[0])\n + (b-result[1])*(b-result[1]) + (c-result[2])*(c-result[2]);\n assertEquals(distPt2, resultDistPt2, TOLERANCE);\n }\n }", "private void fixDirections() {\n\t\tdouble sensDir = sens.getDirection();\n\t\tif (sensDir > 360) {\n\t\t\tsensDir -= 360;\n\t\t} // Rotate back around to keep it tidy\n\t\telse if (sensDir < 1) {\n\t\t\tsensDir += 360;\n\t\t}\n\t\tsens.setDirection(sensDir);\n\n\t\tif (desiredDirection > 360) {\n\t\t\tdesiredDirection -= 360;\n\t\t} // Rotate back around to keep it tidy\n\t\telse if (desiredDirection < 1) {\n\t\t\tdesiredDirection += 360;\n\t\t}\n\t}", "private void arretes_fG(){\n\t\tthis.cube[31] = this.cube[28]; \n\t\tthis.cube[28] = this.cube[30];\n\t\tthis.cube[30] = this.cube[34];\n\t\tthis.cube[34] = this.cube[32];\n\t\tthis.cube[32] = this.cube[31];\n\t}", "@Override\n\t\tpublic void onOrientationData(Myo myo, long timestamp,\n\t\t\t\tQuaternion rotation) {\n\t\t\t// Calculate Euler angles (roll, pitch, and yaw) from the\n\t\t\t// quaternion.\n\n\t\t\tMyMyo selected = myos.get(myos.indexOf(new MyMyo(myo)));\n\n\t\t\trotationZ = (float) Math.toDegrees(Quaternion.roll(rotation));\n\t\t\trotationX = (float) Math.toDegrees(Quaternion.pitch(rotation));\n\t\t\trotationY = (float) Math.toDegrees(Quaternion.yaw(rotation));\n\n\t\t\tselected.setRotationX(rotationX);\n\t\t\tselected.setRotationY(rotationY);\n\t\t\tselected.setRotationZ(rotationZ);\n\n\t\t\tif (playingGame) {\n\t\t\t\tselected.addSum();\n\t\t\t}\n\n\t\t\tif (myos.size() > 1)\n\t\t\t\treturn;\n\n\t\t\tfloat heading1 = 0;\n\t\t\tfloat speed1 = 0;\n\t\t\tif (ride) {\n\t\t\t\t// if (ref_rotationZ < rotationZ) {\n\t\t\t\t// float zero = ref_rotationZ;\n\t\t\t\t// float max = left_rotationZ - zero;\n\t\t\t\t// heading1 = rotationZ - zero;\n\t\t\t\t// heading1 /= max;\n\t\t\t\t// heading += 1;\n\t\t\t\t// heading *= -heading1;\n\t\t\t\t// } else {\n\t\t\t\t// float zero = ref_rotationZ;\n\t\t\t\t// float max = right_rotationZ - zero;\n\t\t\t\t//\n\t\t\t\t//\n\t\t\t\t// }\n\t\t\t\tspeed1 = (ref_rotationX - rotationX) / 100;\n\t\t\t\tif (speed1 != Float.NaN) {\n\t\t\t\t\tref_rotationX = rotationX;\n\t\t\t\t\trotx -= speed1;\n\t\t\t\t}\n\t\t\t\t// speed += rotx;\n\t\t\t\t// heading = heading % 360;\n\n\t\t\t\theading1 = (ref_rotationZ - rotationZ) / 50;\n\t\t\t\tref_rotationZ = rotationZ;\n\t\t\t\trotz += heading1;\n\t\t\t\theading += rotz;\n\t\t\t\theading = heading % 360;\n\t\t\t\tif (heading < 0)\n\t\t\t\t\theading = 360 + heading;\n\t\t\t\tif (rotx < 0)\n\t\t\t\t\trotx = 0;\n\t\t\t\tif (rotx > 1)\n\t\t\t\t\trotx = 1;\n\t\t\t\tif (mRobot != null && ride)\n\t\t\t\t\tmRobot.drive(heading, rotx);\n\t\t\t\telse if (mRobot != null)\n\t\t\t\t\tmRobot.drive(0.0f, 0.0f);\n\t\t\t}\n\n\t\t\t// X.setText(String.format(\"x: %.3f / %.3f\", rotationX, rotx));\n\t\t\t// Y.setText(String.format(\"y: %.3f\", rotationY));\n\t\t\t// Z.setText(String.format(\"z: %.3f / %.3f / %.3f\", rotationZ, rotz,\n\t\t\t// heading));\n\t\t\t// Next, we apply a rotation to the text view using the roll, pitch,\n\t\t\t// and yaw.\n\t\t\t// mTextView.setRotation(-rotationZ);\n\t\t\t// mTextView.setRotationX(-rotationX);\n\t\t\t// mTextView.setRotationY(rotationY);\n\t\t}", "public void calculate() {\n\t\t\n\t\tHashMap<Integer, Vertex> vertices = triangulation.getVertices();\n\t\tHashMap<Integer, Face> faces = triangulation.getFaces();\n\n\t\tHashMap<Integer, Integer> chords = new HashMap<Integer, Integer>();\n\t\tList<Vertex> onOuterCircle = new LinkedList<Vertex>();\n\t\tList<Edge> outerCircle = new LinkedList<Edge>();\n\n\t\tfor (Vertex v : vertices.values()) {\n\t\t\tchords.put(v.getId(), 0);\n\t\t\tchildren.put(v.getId(), new LinkedList<Integer>());\n\t\t}\n\n\t\t// determine outer face (randomly, use the first face)\n\t\tFace outerFace = null;\n\t\tfor (Face f : faces.values()) {\n\t\t\touterFace = f;\n\t\t\tbreak;\n\t\t}\n\t\tif (outerFace == null) {\n\t\t\t// there are no faces at all in the embedding\n\t\t\treturn;\n\t\t}\n\n\t\tEdge e = outerFace.getIncidentEdge();\n\t\tvertexOrder[1] = e.getSource();\n\t\tvertexOrder[0] = e.getTarget();\n\t\tonOuterCircle.add(e.getTarget());\n\t\tonOuterCircle.add(e.getNext().getTarget());\n\t\tonOuterCircle.add(e.getSource());\n\t\touterCircle.add(e.getNext().getNext().getTwin());\n\t\touterCircle.add(e.getNext().getTwin());\n\t\t\n\t\t//System.out.println(\"outerCircle 0 \" + outerCircle.get(0).getId() + \" - source: \" + outerCircle.get(0).getSource().getId() + \" - target: \" + outerCircle.get(0).getTarget().getId());\n\t\t//System.out.println(\"outerCircle 1 \" + outerCircle.get(1).getId() + \" - source: \" + outerCircle.get(1).getSource().getId() + \" - target: \" + outerCircle.get(1).getTarget().getId());\n\t\t\n\n\t\tfor (int k=vertexOrder.length-1; k>1; k--) {\n\t\t\t//System.out.println(\"k: \" + k + \" - outerCircle size: \" + outerCircle.size());\n\t\t\t// chose v != v_0,v_1 such that v on outer face, not considered yet and chords(v)=0\n\t\t\tVertex nextVertex = null;\n\t\t\tint nextVertexId = -1;\n\t\t\tfor (int i=0; i<onOuterCircle.size(); i++) {\n\t\t\t\tnextVertex = onOuterCircle.get(i);\n\t\t\t\tnextVertexId = nextVertex.getId();\n\t\t\t\tif (nextVertexId != vertexOrder[0].getId() && nextVertexId != vertexOrder[1].getId()\n\t\t\t\t\t\t&& chords.get(nextVertexId) == 0) {\n\t\t\t\t\t// remove from list\n\t\t\t\t\tonOuterCircle.remove(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//System.out.println(\"nextVertexId: \" + nextVertexId);\n\n\t\t\t// found the next vertex; add it to the considered vertices\n\t\t\tvertexOrder[k] = nextVertex;\n\t\t\t\n\t\t\t// determine children\n\t\t\tList<Integer> childrenNextVertex = children.get(nextVertexId);\n\t\t\t\n\t\t\t// update edges of outer circle\n\t\t\tint index = 0;\n\t\t\t\n\t\t\twhile (outerCircle.get(index).getTarget().getId() != nextVertexId) {\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tEdge outofNextVertex = outerCircle.remove(index+1);\n\t\t\t\n\t\t\t\n\t\t\t//System.out.println(\"outOfNextVertex \" + outofNextVertex.getId() + \" - source: \" + outofNextVertex.getSource().getId() + \" - target: \" + outofNextVertex.getTarget().getId());\n\t\t\tEdge intoNextVertex = outerCircle.remove(index);\n\t\t\t//System.out.println(\"intoNextVertex \" + intoNextVertex.getId() + \" - source: \" + intoNextVertex.getSource().getId() + \" - target: \" + intoNextVertex.getTarget().getId());\n\t\t\tEdge current = intoNextVertex.getNext();\n\t\t\t//System.out.println(\"current \" + current.getId() + \" - source: \" + current.getSource().getId() + \" - target: \" + current.getTarget().getId());\n\t\t\t\n\t\t\tint endIndex = index;\n\t\t\t\n\t\t\twhile (current.getId() != outofNextVertex.getId()) {\n\t\t\t\tEdge onCircle = current.getNext().getTwin();\n\t\t\t\touterCircle.add(endIndex, onCircle);\n\t\t\t\t\n\t\t\t\tchildrenNextVertex.add(0, onCircle.getSource().getId());\n\t\t\t\t\n\t\t\t\tendIndex++;\n\t\t\t\tcurrent = current.getTwin().getNext();\n\t\t\t\tonOuterCircle.add(onCircle.getTarget());\n\t\t\t}\n\t\t\t\n\t\t\tEdge lastEdge = outofNextVertex.getNext().getTwin();\n\t\t\touterCircle.add(endIndex, lastEdge);\n\t\t\t\n\t\t\tchildrenNextVertex.add(0, lastEdge.getSource().getId());\n\t\t\tchildrenNextVertex.add(0, lastEdge.getTarget().getId());\n\n\t\t\t// update chords\n\t\t\tfor (Vertex v : onOuterCircle) {\n\t\t\t\tEdge incidentEdge = v.getOutEdge();\n\t\t\t\tint firstEdgeId = incidentEdge.getId();\n\t\t\t\tint chordCounter = -2; // the 2 neighbours are on the outer circle, but no chords\n\t\t\t\tdo {\n\t\t\t\t\tif (onOuterCircle.contains(incidentEdge.getTarget())) {\n\t\t\t\t\t\tchordCounter++;\n\t\t\t\t\t}\n\t\t\t\t\tincidentEdge = incidentEdge.getTwin().getNext();\n\t\t\t\t} while (incidentEdge.getId() != firstEdgeId);\n\t\t\t\tchords.put(v.getId(), chordCounter);\n\t\t\t}\n\t\t}\n\t}", "protected void optimizeChains() {\r\n\t\tfor (int i = 0; i < execChains.size(); i++) {\r\n\t\t\tLog.info(String.format(\r\n\t\t\t\t\t\"Performing Causal Analysis on Chain Sequence %d of %d\",\r\n\t\t\t\t\ti + 1, execChains.size()));\r\n\r\n\t\t\t// optimization only works for sequence lengths >= 3\r\n\t\t\tList<EventType> sequence = execChains.get(i);\r\n\t\t\tif (sequence.size() < 3)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tboolean isCausal = true;\r\n\t\t\tfor (int j = 0; j < sequence.size() - 2; j++) {\r\n\t\t\t\t// drop sequence if a sub-sequence (a triple) is not causal\r\n\t\t\t\tList<EventType> subSequence = sequence.subList(j, j + 3);\r\n\t\t\t\tif (!isCausal(subSequence)) {\r\n\t\t\t\t\tisCausal = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (isCausal) {\r\n\t\t\t\tcausalExecChains.add(sequence);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void rotate(){\n\t\tint oneLoop = 0;\r\n\t\tmotherLoop: while(oneLoop == 0){\r\n\t\t\toneLoop = 1;\r\n\t\t// tworze i zeruje macierz 4x4\r\n\t\tint d = type == 1 ? 4 : 3;\t// dla podłużnego będzie klatka 4x4, dla reszty: 3x3\r\n\t\tif(type != 2 ){\t// a dla kwadratowego nic nie trzeba obracac\r\n\t\t\t// tworze macierz i przerzucam do niej klocka:\r\n\t\t\t// tworze i zeruje macierz dxd\r\n\t\t\tint[][] matrix = new int[d][d];\r\n\t\t\tfor(int i = 0 ; i < d ; i++)\r\n\t\t\t\tfor(int j = 0 ; j < d ; j++)\r\n\t\t\t\t\tmatrix[i][j] = 0;\r\n\t\t\t// wyznaczam najmniejsze X i Y z tablic X[] i Y[]\r\n\t\t\tint minX = X[0], minY = Y[0];\r\n\t\t\tfor(int i = 1 ; i < d ; i++){\r\n\t\t\t\tif(X[i] < minX)\tminX = X[i];\r\n\t\t\t\tif(Y[i] < minY)\tminY = Y[i];\r\n\t\t\t}\r\n\t\t\t// przepisuje do czystej macierzy klocka, odejmujac najmniejsze X i Y\r\n\t\t\t// dzieki temu przystaje on do lewej i gornej krawedzi macierzy.\r\n\t\t\tfor(int i = 0 ; i < 4 ; i++)\r\n\t\t\t\tmatrix[Y[i]-minY][X[i]-minX] = 1;\r\n\t\t\t\r\n\t\t\t// dla przypadkow przy scianie przerywam calosc:\r\n\t\t\tif(minX + d > Board.getWidth()){\r\n\t\t\t\tSystem.out.println(\"Protestuje, bo: minX+d=\" +(minX+d)+ \", a Board.getWidth()=\" + Board.getWidth());\r\n\t\t\t\tbreak motherLoop;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(d==4){\t// dla dlugiego przycinam jeszcze raz\r\n\t\t\t\tif(matrix[3][0] == 1){\t// jest pionowo\r\n\t\t\t\t\tfor(int i = 0 ; i < 4 ; i++){\r\n\t\t\t\t\t\tmatrix[i][0] = 0;\r\n\t\t\t\t\t\tmatrix[i][1] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\t// jest poziomo\r\n\t\t\t\t\tfor(int i = 0 ; i < 4 ; i++){\r\n\t\t\t\t\t\tmatrix[0][i] = 0;\r\n\t\t\t\t\t\tmatrix[1][i] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// nowa macierz to macierz z klockiem obrocona o 90 stopni\r\n\t\t\tint[][] newMatrix = new int[d][d];\r\n\t\t\tfor(int i = 0 ; i < d ; i++){\r\n\t\t\t\tfor(int j = 0 ; j < d ; j++){\r\n\t\t\t\t\tnewMatrix[i][j] = matrix[j][d-i-1];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tboolean isFree = true;\t// sprawdzam czy nowy klocek nie naruszy statycznych klockow\r\n\t\t\tint index = 0;\r\n\t\t\tfor(int i = 0 ; i < d ; i++){\r\n\t\t\t\tfor(int j = 0 ; j < d ; j++){\r\n\t\t\t\t\tif(i+minY < Board.getHeight() && j+minX < Board.getWidth()){\r\n\t\t\t\t\t\tif(motherBoard.getField(j+minX, i+minY).getContent() == 2){\r\n\t\t\t\t\t\t\tisFree = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(isFree){\r\n\t\t\t\tindex = 0;\r\n\t\t\t\tfor(int i = 0 ; i < d ; i++){\r\n\t\t\t\t\tfor(int j = 0 ; j < d ; j++){\r\n\t\t\t\t\t\tif( minY >= 0 && j+minX < Board.getWidth() && i+minY < Board.getHeight()){\t// wymiary sie beda zgadzac z plansza.\r\n\t\t\t\t\t\t\tif(newMatrix[i][j] == 1){\r\n\t\t\t\t\t\t\t\tX[index] = j+minX;\r\n\t\t\t\t\t\t\t\tY[index] = i+minY;\r\n\t\t\t\t\t\t\t\tindex++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t}", "public void normalize() {\n\t\tVector initPos = palmData.get(0)[0];\n\n\t\tfor (int i=1; i<length; i++) { //skip first frame\n\t\t\t//normalize palm\n\t\t\tVector framePos = palmData.get(i)[0];\n\n\t\t\tframePos.setX(framePos.getX() - initPos.getX());\n\t\t\tframePos.setY(framePos.getY() - initPos.getY());\n\t\t\tframePos.setZ(framePos.getZ() - initPos.getZ());\n\n\t\t\t//normalize fingers\n\t\t\tfor (int j=0; j<5; j++) {\n\t\t\t\tVector fingerPos = fingerData.get(i)[j][0];\n\n\t\t\t\tif (fingerPos != null) {\n\t\t\t\t\tif (rightHanded) {\n\t\t\t\t\t\tfingerPos.setX(fingerPos.getX() - initPos.getX());\n\t\t\t\t\t\tfingerPos.setY(fingerPos.getY() - initPos.getY());\n\t\t\t\t\t\tfingerPos.setZ(fingerPos.getZ() - initPos.getZ());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfingerPos.setX(-(fingerPos.getX() - initPos.getX()));\n\t\t\t\t\t\tfingerPos.setY(-(fingerPos.getY() - initPos.getY()));\n\t\t\t\t\t\tfingerPos.setZ(-(fingerPos.getZ() - initPos.getZ()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tVector framePos = palmData.get(0)[0];\n\n\t\t//set first frame\n\t\tpalmData.get(0)[0].setX(framePos.getX() - initPos.getX());\n\t\tpalmData.get(0)[0].setY(framePos.getY() - initPos.getY());\n\t\tpalmData.get(0)[0].setZ(framePos.getZ() - initPos.getZ());\n\n\t\t//normalize fingers\n\t\tfor (int i=0; i<5; i++) {\n\t\t\tVector fingerPos = fingerData.get(0)[i][0];\n\n\t\t\tif (fingerPos != null) {\n\t\t\t\tfingerPos.setX(fingerPos.getX() - initPos.getX());\n\t\t\t\tfingerPos.setY(fingerPos.getY() - initPos.getY());\n\t\t\t\tfingerPos.setZ(fingerPos.getZ() - initPos.getZ());\n\t\t\t}\n\t\t}\n\t}", "@Override\r\n\tpublic void rotateRight() {\n\t\tsetDirection((this.getDirection() + 1) % 4);\r\n\t}", "public void onUpdate() {\n/* 89 */ this.lastTickPosX = this.posX;\n/* 90 */ this.lastTickPosY = this.posY;\n/* 91 */ this.lastTickPosZ = this.posZ;\n/* 92 */ super.onUpdate();\n/* 93 */ this.motionX *= 1.15D;\n/* 94 */ this.motionZ *= 1.15D;\n/* 95 */ this.motionY += 0.04D;\n/* 96 */ moveEntity(this.motionX, this.motionY, this.motionZ);\n/* 97 */ float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);\n/* 98 */ this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);\n/* */ \n/* 100 */ for (this.rotationPitch = (float)(Math.atan2(this.motionY, var1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F);\n/* */ \n/* */ \n/* */ \n/* */ \n/* 105 */ while (this.rotationPitch - this.prevRotationPitch >= 180.0F)\n/* */ {\n/* 107 */ this.prevRotationPitch += 360.0F;\n/* */ }\n/* */ \n/* 110 */ while (this.rotationYaw - this.prevRotationYaw < -180.0F)\n/* */ {\n/* 112 */ this.prevRotationYaw -= 360.0F;\n/* */ }\n/* */ \n/* 115 */ while (this.rotationYaw - this.prevRotationYaw >= 180.0F)\n/* */ {\n/* 117 */ this.prevRotationYaw += 360.0F;\n/* */ }\n/* */ \n/* 120 */ this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;\n/* 121 */ this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;\n/* */ \n/* 123 */ if (this.fireworkAge == 0 && !isSlient())\n/* */ {\n/* 125 */ this.worldObj.playSoundAtEntity(this, \"fireworks.launch\", 3.0F, 1.0F);\n/* */ }\n/* */ \n/* 128 */ this.fireworkAge++;\n/* */ \n/* 130 */ if (this.worldObj.isRemote && this.fireworkAge % 2 < 2)\n/* */ {\n/* 132 */ this.worldObj.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D, new int[0]);\n/* */ }\n/* */ \n/* 135 */ if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime) {\n/* */ \n/* 137 */ this.worldObj.setEntityState(this, (byte)17);\n/* 138 */ setDead();\n/* */ } \n/* */ }", "public ZeroSides calculateShouldZeroSides() {\r\n if (!(getContext() instanceof Activity)) {\r\n return ZeroSides.NONE;\r\n }\r\n Activity activity = (Activity) getContext();\r\n int i = activity.getResources().getConfiguration().orientation;\r\n int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();\r\n if (i != 2) {\r\n return ZeroSides.NONE;\r\n }\r\n if (rotation == 1) {\r\n return ZeroSides.RIGHT;\r\n }\r\n if (rotation == 3) {\r\n return Build.VERSION.SDK_INT >= 23 ? ZeroSides.LEFT : ZeroSides.RIGHT;\r\n }\r\n if (rotation == 0 || rotation == 2) {\r\n return ZeroSides.BOTH;\r\n }\r\n return ZeroSides.NONE;\r\n }", "protected void applyMatrices () {\n combinedMatrix.set(projectionMatrix).mul(transformMatrix);\n getShader().setUniformMatrix(\"u_projTrans\", combinedMatrix);\n }", "public void doAll() {\n for (int i = 0; i < Integer.MAX_VALUE; i++) {\n sum += sumLoop(sumLoopArray);\n sum += sumIfEvenLoop(sumLoopArray);\n sum += sumIfPredicate(sumLoopArray);\n sum += sumShifted(3, 0x7f, sumLoopArray);\n addXtoArray(i, addXArray);\n sum += sumLoop(addXArray);\n addArraysIfEven(addArraysIfEvenArrayA, addArraysIfEvenArrayB);\n addArraysIfPredicate(addArraysIfEvenArrayA, addArraysIfEvenArrayB);\n sum += sumLoop(addArraysIfEvenArrayA);\n }\n }", "private static void option3(List<Runway> runways, Queue<Plane> unclearedPlanes) {\n \n }", "protected void reduce4( T mrt ) {\n // Reduce any AppendableVecs\n if( _noutputs > 0 )\n for( int i=0; i<_appendables.length; i++ )\n _appendables[i].reduce(mrt._appendables[i]);\n // User's reduction\n reduce(mrt);\n }", "public void rotateRight() {\n// tileLogic = getRotateRight();\n tileLogic = getRotateLeft();\n// rotateRightTex();\n rotateLeftTex();\n }", "void rotatePiece() {\n boolean temp = this.left;\n boolean temp2 = this.up;\n boolean temp3 = this.right;\n boolean temp4 = this.down;\n this.left = temp4;\n this.up = temp;\n this.right = temp2;\n this.down = temp3;\n }", "public void varimaxRotation(int nFactors){\n if(!this.pcaDone)this.pca();\n if(this.varimaxOption){\n this.normalVarimaxRotation(nFactors);\n }\n else{\n this.rawVarimaxRotation(nFactors);\n }\n }", "public void rotateCCW(){\n rotState = (rotState + 3) % 4;\n for (int i = 0; i < tiles.length; ++i){\n tiles[i] = new Point(tiles[i].y , -tiles[i].x);\n }\n }", "private void conformCorridors() {\n for (int rowView = 0; rowView < rowViewMax; rowView++) {\r\n for (int colView = 0; colView < colViewMax; colView++) {\r\n if (getCell(rowView, colView) != Cell.wall)\r\n setCell(rowView, colView, Cell.corridor);\r\n }\r\n }\r\n }", "void reorganizeTriples(ProgressListener listener);", "@Override\n\tprotected final int getNumSpiralTransforms() { return 2;}", "private void changeCalculatePreviewOrientation() {\n\n if (mHolder.getSurface() == null) {\n // preview surface does not exist\n Log.d(TAG, \"Preview surface does not exist\");\n return;\n }\n\n // stop preview before making changes\n stopCamera();\n\n int orientation = calculatePreviewOrientation(mCameraInfo, mDisplayOrientation);\n mCamera.setDisplayOrientation(orientation);\n\n startCamera();\n }", "void rotatePolygon() {\n\t\tfor (int i = 0; i < amount; i++)\n\t\t\tpoint[i].rotate();\n\t}", "@Override\n protected void runAlgorithm() {\n for (int i = 0; i < getArray().length; i++) {\n for (int j = i + 1; j < getArray().length; j++) {\n if (applySortingOperator(getValue(j), getValue(i))) {\n swap(i, j);\n }\n }\n }\n }", "void resDiagonale(){ \r\n for (int i = 0; i<N; i=i+nCarre) \r\n \tresCarre(i, i); \r\n }", "public static void checkUpdateProbabilityOnALLRelations()\r\n\t{\r\n\t\tint[] base_relations = {1,2,4,8,16,32,64,128};\r\n\t\tint r1,r2,r3;\r\n\t\tint total = 0;\r\n\t\tint update = 0;\r\n\t\tfor (int i = 0; i < 8; i++)\r\n\t\t{\r\n\t\t\t r1 = base_relations[i];\r\n\t\t\tfor(int j = 1; j < 255; j++)\r\n\t\t\t{\r\n\t\t\t\tr2 = j;\r\n\t\t\t\t/*if(r2 == 1 || r2 == 2 || r2 == 4 || r2 == 8 || r2 == 16 || r2 == 32 || r2 == 64 || r2 == 128)\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\telse*/\r\n\t\t\t\tfor(int k = 1; k < 255; k++)\r\n\t\t\t\t{ \r\n\t\t\t\t\tr3 = k;\r\n\t\t\t\t\t/*if(r3 == 1 || r3 == 2 || r3 == 4 || r3 == 8 || r3 == 16 || r3 == 32 || r3 == 64 || r3 == 128)\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\telse*/\r\n\t\t\t\t\t{\t\r\n\t\t\t\t\t\ttotal++;\r\n\t\t\t\t\t\tint new_r3 = SetOperators.intersection(r3, \r\n\t\t\t\t\t\t\t\tCompositionTable.LookUpTable(r1, r2));\r\n\t\t\t\t\t\tif(new_r3 != r3 && new_r3 != 0)\r\n\t\t\t\t\t\t\tupdate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\tSystem.out.println((double)update/total);\r\n\t\t\t\t\r\n\t}" ]
[ "0.59555364", "0.5513941", "0.54198545", "0.5408177", "0.5297965", "0.5277192", "0.5276315", "0.5246262", "0.51896906", "0.51855826", "0.5125092", "0.511761", "0.5075904", "0.50628996", "0.5062671", "0.5042094", "0.49932477", "0.49441013", "0.49436066", "0.48866144", "0.48039517", "0.47998863", "0.47912484", "0.4788719", "0.47815198", "0.47809803", "0.47769794", "0.4771288", "0.47700462", "0.47692782", "0.47431675", "0.4739282", "0.4734322", "0.47333714", "0.47319877", "0.47239998", "0.47186768", "0.4717017", "0.47150442", "0.4710149", "0.47093895", "0.47079653", "0.47033253", "0.46933752", "0.46825182", "0.46799386", "0.46744516", "0.46703398", "0.46697304", "0.46663815", "0.4660283", "0.46546525", "0.4651001", "0.46417195", "0.46361184", "0.46176752", "0.46142715", "0.46015757", "0.45974007", "0.4579052", "0.456933", "0.4565187", "0.45458427", "0.45344043", "0.4529413", "0.45276263", "0.45258364", "0.4522104", "0.45147485", "0.45085087", "0.45043245", "0.44969174", "0.4496632", "0.44809276", "0.44805485", "0.44740936", "0.44738278", "0.44706118", "0.44583887", "0.44490772", "0.444787", "0.44478104", "0.44476736", "0.44412452", "0.44365722", "0.4428387", "0.44268274", "0.44220468", "0.44169572", "0.4416723", "0.44086882", "0.44054657", "0.4404476", "0.44016713", "0.43992922", "0.43987817", "0.4394646", "0.43930277", "0.43930227", "0.43864366", "0.43801996" ]
0.0
-1
/ R1, away from collider
private void ruleR1(Node a, Node b, Node c, Graph graph) { if (graph.isAdjacentTo(a, c)) { return; } if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.CIRCLE) { if (!isArrowpointAllowed(graph, b, c)) { return; } graph.setEndpoint(c, b, Endpoint.TAIL); graph.setEndpoint(b, c, Endpoint.ARROW); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void circleCollison() {\n\t\t\n\t}", "public abstract void collided(CircleCollider col);", "public void laserMoveUp()\r\n\t{\r\n\r\n\t\tif (y > 0)\r\n\t\t\ty -= 20;\r\n\r\n\t\telse\r\n\t\t\tdestroyed = true;\r\n\r\n\t}", "private void subtractPlayerMissile() {\n this.playerMissile -= 1;\n }", "private void subtractEnemyMissile() {\n this.enemyMissile -= 1;\n }", "public void boingg(Player player) {\n if (player.getCircle().getBoundsInParent().intersects(right.getBoundsInParent())) {\n\n if ((int) player.normalVelocityX == 0) {\n player.normalVelocityX = 4;\n } else {\n player.normalVelocityX = Math.abs(player.normalVelocityX) * springiness;\n }\n\n } else if (player.getCircle().getBoundsInParent().intersects(left.getBoundsInParent())) {\n if ((int) player.normalVelocityX == 0) {\n player.normalVelocityX = -4;\n } else {\n player.normalVelocityX = Math.abs(player.normalVelocityX) * -springiness;\n }\n } else {\n player.normalVelocityX *= springiness;\n }\n\n player.normalVelocityY *= -springiness;\n player.angularVelocity *= -springiness;\n \n rectangle.setFill(AssetManager.springSkin(false));\n\n }", "public abstract void collided(Collision c);", "public void gerak() \n {\n setLocation(getX(),getY()-5);\n if(getY()<20){\n getWorld().removeObject(this);\n }else\n cek_kena();\n \n }", "private void bounceOffVerticalWall() {\n vx = -vx;\n }", "public void collide(){\n hp -= 10;\n resetPos();\n //canMove = false;\n }", "private boolean isObjectABrick(GObject collider) {\n return collider != null;\n }", "public void onPlayerRoca(Player p, Roca r, PhysicsCollisionEvent event){\n colisionPlayerEstatico(p, r, event);\n }", "public void liftArm(){armLifty.set(-drivePad.getThrottle());}", "@Override\r\n public boolean onEliminar(Vector3f vel) {\n return false;\r\n }", "public void strafeLeft(){\r\n\t\t//Following the camera:\r\n\t\tif(loc[1] > 1)\r\n\t\t{\r\n\t\t\tthis.loc[0] -= Math.sin(Math.toRadians(heading))*distance; \r\n\t\t\tthis.loc[2] -= Math.cos(Math.toRadians(heading))*distance;\r\n\t\t}\r\n\t}", "public void act() \n {\n move(-2);\n\n if(getX() <= 0)\n {\n getWorld().removeObject(this);\n } \n\n }", "@Override\n void onCollide(Actor other, Contact contact) {\n }", "public void onUpdate()\n {\n super.onUpdate();\n this.jumpMovementFactor = 0.0F;\n this.renderYawOffset = this.rotationPitch = this.rotationYaw = 0.0F;\n\n if (this.target != null && this.target instanceof EntityLiving)\n {\n EntityLiving var1 = (EntityLiving) this.target;\n\n if (var1.getHealth() <= 0 || !this.canEntityBeSeen(var1))\n {\n this.target = null;\n this.stop();\n this.moveTimer = 0;\n return;\n }\n } else\n {\n if (this.target != null && this.target.isDead)\n {\n this.target = null;\n this.stop();\n this.moveTimer = 0;\n return;\n }\n\n if (this.target == null)\n {\n this.target = this.worldObj.getClosestPlayerToEntity(this, -1.0D);\n\n if (this.target == null)\n {\n this.target = null;\n this.stop();\n this.moveTimer = 0;\n\n if (!this.worldObj.isRemote)\n {\n this.setDead();\n }\n\n return;\n }\n }\n }\n\n if (this.posX == (double) this.getOrgX() && this.posY == (double) this.getOrgY() && this.posZ == (double) this.getOrgZ())\n {\n if (!this.isReformed())\n {\n this.setReformed(true);\n }\n\n this.stop();\n this.moveTimer = 0;\n }\n\n if (this.slider == null)\n {\n Vec3 var16 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);\n Vec3 var2 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);\n MovingObjectPosition var18 = this.worldObj.rayTraceBlocks(var16, var2);\n var16 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);\n var2 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);\n\n if (var18 != null)\n {\n var2 = Vec3.createVectorHelper(var18.hitVec.xCoord, var18.hitVec.yCoord, var18.hitVec.zCoord);\n }\n\n if (!this.worldObj.isRemote)\n {\n Object var4 = null;\n List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(4.0D, 4.0D, 4.0D));\n double var6 = 0.0D;\n\n for (int var8 = 0; var8 < var15.size(); ++var8)\n {\n Entity var9 = (Entity) var15.get(var8);\n\n if (var9.canBeCollidedWith() && var9 != this)\n {\n float var10 = 0.3F;\n\n if (var9 instanceof EntitySlider)\n {\n this.slider = (EntitySlider) var9;\n var18 = null;\n }\n\n AxisAlignedBB var11 = var9.boundingBox.expand((double) var10, (double) var10, (double) var10);\n MovingObjectPosition var12 = var11.calculateIntercept(var16, var2);\n\n if (var12 != null)\n {\n double var13 = var16.distanceTo(var12.hitVec);\n\n if (var13 < var6 || var6 == 0.0D)\n {\n var6 = var13;\n }\n }\n }\n }\n }\n\n if (this.slider == null || this.slider.isDead)\n {\n this.target = null;\n this.stop();\n this.moveTimer = 0;\n\n if (!this.worldObj.isRemote)\n {\n this.setDead();\n }\n }\n } else if (this.slider.target != this.target)\n {\n this.target = null;\n this.stop();\n this.moveTimer = 0;\n\n if (!this.worldObj.isRemote)\n {\n this.setDead();\n }\n } else\n {\n this.fallDistance = 0.0F;\n double var17;\n double var5;\n double var3;\n\n if (this.gotMovement)\n {\n if (this.isCollided)\n {\n var17 = this.posX - 0.5D;\n var3 = this.boundingBox.minY + 0.75D;\n var5 = this.posZ - 0.5D;\n\n if (this.crushed)\n {\n this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, \"random.explode\", 3.0F, (0.625F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);\n this.worldObj.playSoundAtEntity(this, \"aeboss.slider.collide\", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F));\n }\n\n this.stop();\n } else\n {\n if (this.speedy < 2.0F)\n {\n this.speedy += 0.035F;\n }\n\n this.motionX = 0.0D;\n this.motionY = 0.0D;\n this.motionZ = 0.0D;\n\n if (this.direction == 0)\n {\n this.motionY = (double) this.speedy;\n\n if (this.boundingBox.minY > (this.reform ? (double) this.getOrgY() : this.target.boundingBox.minY + 0.35D))\n {\n this.stop();\n this.moveTimer = 8;\n }\n } else if (this.direction == 1)\n {\n this.motionY = (double) (-this.speedy);\n\n if (this.boundingBox.minY < (this.reform ? (double) this.getOrgY() : this.target.boundingBox.minY - 0.25D))\n {\n this.stop();\n this.moveTimer = 8;\n }\n } else if (this.direction == 2)\n {\n this.motionX = (double) this.speedy;\n\n if (this.posX > (this.reform ? (double) this.getOrgX() - 1.0D : this.target.posX + 0.125D))\n {\n this.stop();\n this.moveTimer = 8;\n }\n } else if (this.direction == 3)\n {\n this.motionX = (double) (-this.speedy);\n\n if (this.posX < (this.reform ? (double) this.getOrgX() - 1.0D : this.target.posX - 0.125D))\n {\n this.stop();\n this.moveTimer = 8;\n }\n } else if (this.direction == 4)\n {\n this.motionZ = (double) this.speedy;\n\n if (this.posZ > (this.reform ? (double) this.getOrgZ() - 1.0D : this.target.posZ + 0.125D))\n {\n this.stop();\n this.moveTimer = 8;\n }\n } else if (this.direction == 5)\n {\n this.motionZ = (double) (-this.speedy);\n\n if (this.posZ < (this.reform ? (double) this.getOrgZ() - 1.0D : this.target.posZ - 0.125D))\n {\n this.stop();\n this.moveTimer = 8;\n }\n }\n }\n } else\n {\n this.motionY = 0.0D;\n\n if (this.moveTimer > 0)\n {\n --this.moveTimer;\n this.motionX = 0.0D;\n this.motionY = 0.0D;\n this.motionZ = 0.0D;\n } else\n {\n var17 = Math.abs(this.posX - (this.reform ? (double) this.getOrgX() : this.target.posX));\n var3 = Math.abs(this.boundingBox.minY - (this.reform ? (double) this.getOrgY() : this.target.boundingBox.minY));\n var5 = Math.abs(this.posZ - (this.reform ? (double) this.getOrgZ() : this.target.posZ));\n\n if (var17 > var5)\n {\n this.direction = 2;\n\n if (this.posX > (this.reform ? (double) this.getOrgX() - 1.0D : this.target.posX))\n {\n this.direction = 3;\n }\n } else\n {\n this.direction = 4;\n\n if (this.posZ > (this.reform ? (double) this.getOrgZ() - 1.0D : this.target.posZ))\n {\n this.direction = 5;\n }\n }\n\n if (var3 > var17 && var3 > var5 || var3 > 0.25D && this.rand.nextInt(5) == 0)\n {\n this.direction = 0;\n\n if (this.posY > (this.reform ? (double) this.getOrgY() : this.target.posY))\n {\n this.direction = 1;\n }\n }\n\n this.gotMovement = true;\n }\n }\n\n if (this.harvey > 0.01F)\n {\n this.harvey *= 0.8F;\n }\n }\n }", "void loopy() {\n if (position.y < -50) {\n position.y = Constants.height + 50;\n } else\n if (position.y > Constants.height + 50) {\n position.y = -50;\n }\n if (position.x< -50) {\n position.x = Constants.width +50;\n } else if (position.x > Constants.width + 50) {\n position.x = -50;\n }\n }", "private void bounceOffHorizontalWall() {\n vy = -vy;\n }", "private void laserCollisions() {\r\n\t\tGObject topLeft = getElementAt(laser.getX() - 1, laser.getY());\r\n\t\tGObject topRight = getElementAt(laser.getX() + laser.getWidth() + 1, laser.getY());\r\n\t\tGObject bottomLeft = getElementAt(laser.getX() - 1, laser.getY() + laser.getHeight());\r\n\t\tGObject bottomRight = getElementAt(laser.getX() + laser.getWidth() + 1, laser.getY() + laser.getHeight());\r\n\t\tif(topLeft == player || topRight == player || bottomLeft == player || bottomRight == player) {\r\n\t\t\tremove(laser);\r\n\t\t\tlaser = null;\r\n\t\t\thits++;\r\n\t\t\tloseLife();\r\n\t\t}\r\n\t}", "public Rectangle getCollider() {\n return collider;\n }", "public void leftPressNotGround() {\n if(!grounded) {\n if(animation.getDirection() == 1) {\n animation.setDirection(-1);\n } \n if(xSpeed > -5) { \n xSpeed -= AIR; \n }\n else {\n xSpeed = -5;\n }\n }\n }", "public void Colision(Rect rect1, Rect rect2, Rect rect3){\r\n\r\n if (Rect.intersects(rect1, rect2)) {\r\n xPos =0;\r\n yPos = 0;\r\n vidas--;\r\n Puntos = Puntos-50;\r\n }\r\n else if(Rect.intersects(rect2,rect3)){\r\n yPos = 0;\r\n xPos = 0;\r\n Puntos += 100;\r\n }\r\n }", "public void up() {dy = -SPEED;}", "private boolean leftUpCollision(InteractiveObject obj){\n\t\treturn (((this.getX() - obj.getX()) < obj.getWidth()) && (this.getX() > obj.getX()) &&\n\t\t\t\t((this.getY() - obj.getY()) < obj.getHeight()) && (this.getY() > obj.getY()));\n\t}", "public void bounceOffEdge()\n {\n int margin = 2;\n\n if (getX() <= margin || getX() >= getWorld().getWidth() - margin) //left or right side\n {\n turn(180);\n }\n if (getY() <= margin || getY() >= getWorld().getHeight() - margin) //top or bottom side\n {\n turn(180);\n }\n }", "private void devolver100() {\n cambio = cambio - 100;\n de100--;\n cambio100++;\n }", "@Override\r\n\tpublic void onDestroy()\r\n\t{\n\t\tsuper.onDestroy();\r\n\t\tcollider.destroy();\r\n\t}", "public void collideBoundary() {\n\t\tif (getWorld() == null) return;\n\t\tif (getXCoordinate() < 1.01*getRadius())\n\t\t\tsetXVelocity(-getXVelocity());\n\t\tif (getXCoordinate() > getWorld().getWidth()-1.01*getRadius())\n\t\t\tsetXVelocity(-getXVelocity());\n\t\tif (getYCoordinate() < 1.01 * getRadius())\n\t\t\tsetYVelocity(-getYVelocity());\n\t\tif (getYCoordinate() > getWorld().getHeight()-1.01*getRadius())\n\t\t\tsetYVelocity(-getYVelocity());\n\t}", "public void Colision2(Rect rect1, Rect rect2, Rect rect3){\r\n\r\n if (Rect.intersects(rect1, rect2)) {\r\n xPos =0;\r\n yPos = 0;\r\n Puntos += 100;\r\n }\r\n else if(Rect.intersects(rect2,rect3)){\r\n yPos = 0;\r\n xPos = 0;\r\n vidas--;\r\n Puntos = Puntos-50;\r\n\r\n }\r\n }", "public void disperse() {\t\t\n\t\tfor (int r = 0; r < rows; r++){\n\t\t\tfor (int c = 1; c < cols; c++){\n\t\t\t\tint sum = values[r+1][c-1] + values[r+1][c] + values[r+1][c+1];\n\t\t\t\tif(r < rows - fireLevel + 14){\n\t\t\t\t\tvalues[r][c] = (sum / 3) - 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvalues[r][c] = (int)((sum / 3.0) - 0.0); \n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (values[r][c] < 0) values[r][c] = 0;\n\t\t\t\tg2.setColor(colors[values[r][c]]);\n\t\t\t\tif(values[r][c] > 5){\n\t\t\t\t\tg2.fillRect(c*res,r*res,res,res);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private boolean rightUpCollision(InteractiveObject obj){\n\t\treturn (((obj.getX() - this.getX()) < this.getWidth()) && (obj.getX() > this.getX()) &&\n\t\t\t\t((this.getY() - obj.getY()) < obj.getHeight()) && (this.getY() > obj.getY()));\n\t}", "public void movbolitas1() {\n x += vx1;\n y += vy1;\n if (x > width || x < 0) {\n vx1 *= -1;\n }\n if (y > height || y < 0) {\n vy1 *= -1;\n }\n }", "public void collision(Collidable collider);", "void onNoCollision();", "@Override\r\n\tpublic void destroy(Sprite collider) {\n\t}", "public void controlUpDownRegionEntry(Region r,Player player){\n\t\t\n\t\tint x = player.getPlayerCurXPos();\n\t\tint y = player.getPlayerCurYPos();\t\t\n\t\t\n\t\t//Extreme top region and hence cannot go further up\n\t\tif(isTopUpRegion(r.getRegionID()) && y<0){\n\t\t\t\n\t\t\tplayer.setPlayerCurYPos(0);\t\t\t\n\t\t}\n\t\t\n\t\telse if(isUpRegion(r.getRegionID()))\n\t\t{\n\t\t\t//moving towards down region\n\t\t\tif((y+playerBoundaryCheck) >= r.rY2){\n\t\t\n\t\t\tplayer.rBYDownFlag = true;\n\t\t\tplayer.rBYUpFlag = false;\n\t\t\t\n\t\t\t\n\t\t\tplayer.rBXLeftFlag = player.rBXRightFlag = false;\n\t\t\t\n\t\t\ty = 0;\n\t\t\t//x = 0;\n\t\t\t\n\t\t\tplayer.setPlayerCurXPos(x);\n\t\t\tplayer.setPlayerCurYPos(0);\n\t\t }\t\t\t\t\n\t\t\t\n\t\t\telse if(y<0){\t//i.e moving towards up region\n\t\t\t\t\n\t\t\t\tplayer.rBYUpFlag = true;\n\t\t\t\tplayer.rBYDownFlag = false;\t\t\t\t\n\t\t\t\t\n\t\t\t\tplayer.rBXLeftFlag = player.rBXRightFlag = false;\t\t\t\t\n\t\t\t\t\n\t\t\t\ty = r.rY2 - Constants.getImagesize();\n\t\t\t\t\n\t\t\t\tplayer.setPlayerCurYPos(y);\n\t\t\t\tplayer.setPlayerCurXPos(x);\n\t\t\t}\t\t\t\t\t\t\n\t\t\n\t\t}\n\t\t\n\t\t\n\t\telse if(isDownRegion(r.getRegionID()))\n\t\t{\n\t\t\t\n\t\t\t//moving towqrds up region\n\t\t\tif(y < 0){\n\t\t\t\tplayer.rBYUpFlag = true;\n\t\t\t\tplayer.rBYDownFlag = false;\t\t\t\t\n\t\t\t\t\n\t\t\t\tplayer.rBXLeftFlag = player.rBXRightFlag = false;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\ty = r.rY2 - Constants.getImagesize();\n\t\t\t\t\n\t\t\t\tplayer.setPlayerCurYPos(y);\n\t\t\t}\n\t\t\t\n\t\t\t//no further regions below. so restrict to last row\n\t\t\telse if(y+playerBoundaryCheck>=r.rY2){\n\t\t\t\ty = r.rY2 - Constants.getImagesize();\n\t\t\t\tplayer.setPlayerCurYPos(y);\n\t\t\t}\n\t\t}\t\t\n\t\n }", "public void destroy()\n {\n GeneticRobots.rmCollider(this.collider);\n GeneticRobots.rmObject(this);\n }", "@Override\n \tpublic void roiDragged(ROIEvent evt) {\n \t\t\n \t}", "public void moveBlueCrab() {\n\t\tloseLife();\n\t\tif (wallOverlapX()) {\n\t\t\tif (hitRight) {\n\t\t\t\tif (xVel > 0) {\n\t\t\t\t\tyPos += yVel;\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\txPos += xVel;\n\t\t\t\t\tyPos += yVel;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else if (hitLeft) {\n\t\t\t\tif (xVel < 0) {\n\t\t\t\t\tyPos += yVel;\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\txPos += xVel;\n\t\t\t\t\tyPos += yVel;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (wallOverlapY()) {\n\t\t\tif (hitUp) {\n\t\t\t\tif (yVel < 0) {\n\t\t\t\t\txPos += xVel;\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\txPos += xVel;\n\t\t\t\t\tyPos += yVel;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else if (hitDown) {\n\t\t\t\tif (yVel > 0) {\n\t\t\t\t\txPos += xVel;\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\txPos += xVel;\n\t\t\t\t\tyPos += yVel;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint xLow = xPos;\n\t\tint xHigh =xPos + width;\n\t\tint yTop = yPos;\n\t\tint yBot = yPos + height;\n\t\tfor (int i = 0; i < game.m.walls.size(); i++) {\n\t\t\tif (game.m.walls.get(i).wallHit(this) > 0) {\n//\t\t\t\twhile (game.m.walls.get(i).wallHit(this)) {\n\t\t\t\tif (game.m.walls.get(i).wallHit(this) == 4) {\n\t\t\t\t\tif (yVel < 0) {\n\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} \n\t\t\t\t\telse {\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 1) {\n\t\t\t\t\t\t\t\tif (xVel > 0) {\n\t\t\t\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 2) {\n\t\t\t\t\t\t\t\tif (xVel < 0) {\n\t\t\t\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (game.m.walls.get(i).wallHit(this) == 3) {\n\t\t\t\t\tif (yVel > 0) {\n\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} \n\t\t\t\t\telse {\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 1) {\n\t\t\t\t\t\t\t\tif (xVel > 0) {\n\t\t\t\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 2) {\n\t\t\t\t\t\t\t\tif (xVel < 0) {\n\t\t\t\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (game.m.walls.get(i).wallHit(this) == 2) {\n\t\t\t\t\tif (xVel < 0) {\n\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} \n\t\t\t\t\telse {\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 3) {\n\t\t\t\t\t\t\t\tif (yVel > 0) {\n\t\t\t\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 4) {\n\t\t\t\t\t\t\t\tif (yVel < 0) {\n\t\t\t\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (game.m.walls.get(i).wallHit(this) == 1) {\n\t\t\t\t\tif (xVel > 0) {\n\t\t\t\t\t\txPos += xVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} \n\t\t\t\t\telse {\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 3) {\n\t\t\t\t\t\t\t\tif (yVel > 0) {\n\t\t\t\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (int j = 0; j < game.m.walls.size(); j++) {\n\t\t\t\t\t\t\tif (game.m.walls.get(j).wallHit(this) == 4) {\n\t\t\t\t\t\t\t\tif (yVel < 0) {\n\t\t\t\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyPos += yVel;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n//\t\t\t\tif (xVel > 0) {\n//\t\t\t\t\txPos -= 20;\n//\t\t\t\t\treturn;\n//\t\t\t\t} \n//\t\t\t\telse if (xVel < 0) {\n//\t\t\t\t\txPos += 20;\n//\t\t\t\t\treturn;\n//\t\t\t\t}\n//\t\t\t\tif (yVel > 0) {\n//\t\t\t\t\tyPos -= 20;\n//\t\t\t\t\treturn;\n//\t\t\t\t}\n//\t\t\t\telse if (yVel < 0) {\n//\t\t\t\t\tyPos += 20;\n//\t\t\t\t\treturn;\n//\t\t\t\t}\n//\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (xPos <= 0) {\n\t\t\tif (xVel > 0) {\n\t\t\t\txPos += xVel;\n\t\t\t} else if (yPos + height <= game.mapHeight && yPos >= 0){\n\t\t\t\tyPos += yVel;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (xPos + width >= game.mapWidth) {\n\t\t\tif (xVel < 0) {\n\t\t\t\txPos += xVel;\n\t\t\t} else if (yPos + height <= game.mapHeight && yPos >= 0){\n\t\t\t\tyPos += yVel;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (yPos <= 0) {\n\t\t\tif (yVel > 0) {\n\t\t\t\tyPos += yVel;\n\t\t\t} else if (xPos + width <= game.mapWidth && xPos >= 0){ \n\t\t\t\txPos += xVel;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (yPos + height >= game.mapHeight) { \n\t\t\tif (yVel < 0) {\n\t\t\t\tyPos += yVel;\n\t\t\t} else if (xPos + width <= game.mapWidth && xPos >= 0){\n\t\t\t\txPos += xVel;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\txPos += xVel;\n\t\t\tyPos += yVel;\n\t\t}\n\n\t}", "public void controlLeftRightRgionEntry(Region r,Player player){\n\t\t\n\t\tint x = player.getPlayerCurXPos();\t\t\n\t\t\n\t\tif(isExtremeLeftRegion(r.getRegionID()) && x<0){\n\t\t\t//logger.info(\"BMK4---RegionController.java--Extreme left region. X =\" + x);\n\t\t\t//logger.info(\"Extreme left region. X =\" + x);\n\t\t\tplayer.setPlayerCurXPos(0);\n\t\t}\n\t\t\n\t\telse if(isLeftRegion(r.getRegionID()))\n\t\t//if(r.regionID==1 || r.regionID==3)\n\t\t{\n\t\t\t\n\t\t\t//entering to region2 from region1 or region4 from region3\n\t\t\tif((x+ playerBoundaryCheck)>=r.rX2){\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tplayer.rBYUpFlag = player.rBYDownFlag = false;\n\t\t\t\tplayer.rBXRightFlag = true;\n\t\t\t\tplayer.rBXLeftFlag = false;\n\t\t\t\t\n\t\t\t\tlogger.info(\"RXRight flag is true\");\n\t\t\t\tx = 0;\n\t\t\t\tplayer.setPlayerCurXPos(0);\n\t\t\t}\n\t\t\t\n\t\t\t//no regions to the left of region1 or region3\n\t\t\telse if(x<0){\n\t\t\t\t//logger.info(\"RXLeft flag is true\");\n\t\t\t\t//player.setPlayerCurXPos(0);\n\t\t\t\tplayer.rBYUpFlag = player.rBYDownFlag = false;\n\t\t\t\tplayer.rBXRightFlag = false;\n\t\t\t\tplayer.rBXLeftFlag = true;\n\t\t\t\tx=r.rX2 - Constants.getImagesize();\n\t\t\t\tplayer.setPlayerCurXPos(x);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\telse if(isRightRegion(r.getRegionID()))\n\t\t//else if(r.regionID==2 || r.regionID==4)\t\t\n\t\t{\n\t\t\t\n\t\t\t//entering to region1 from region2 or region3 from region4\n\t\t\tif(x<0){\n\t\t\t\t//logger.info(\"BMK4---RegionController.java--entering to region 1 from region 2\");\n\t\t\t\tplayer.rBYDownFlag = player.rBYUpFlag = false;\n\t\t\t\t\n\t\t\t\tplayer.rBXRightFlag = false;\n\t\t\t\tplayer.rBXLeftFlag = true;\n\t\t\t\t\n\t\t\t\tx=r.rX2 - Constants.getImagesize();\n\t\t\t\tplayer.setPlayerCurXPos(x);\n\t\t\t}\n\t\t\t\n\t\t\t//no further regions from region2 or region4\n\t\t\telse if((x+ playerBoundaryCheck)>=r.rX2)\n\t\t\t{\t\n\t\t\t\tx = r.rX2 -Constants.getImagesize();\n\t\t\t\tplayer.setPlayerCurXPos(x);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}", "public void rightPressNotGround() {\n if(!grounded) {\n if(animation.getDirection() == -1) {\n animation.setDirection(1);\n }\n if(xSpeed < 5) { \n xSpeed += AIR; \n } \n else {\n xSpeed = 5;\n }\n }\n }", "public void unFollowing() {\n\t\tdouble newTargetX, newTargetY, xValue, yValue;\n\t\tdouble slope = (kin.target.y - kin.position.y) / (kin.target.x - kin.position.x);\n\t\t\n\t\t// off to the left of the screen\n\t\tif (kin.position.x < kin.target.x) {\n\t\t\tnewTargetY = (MainPanel.PWIDTH + img.getWidth() - kin.target.x) * slope + kin.target.y;\n\t\t\txValue = MainPanel.PWIDTH + img.getWidth();\n\t\t} else { // off the right of the screen\n\t\t\tnewTargetY = (-kin.target.x - img.getWidth()) * slope + kin.target.y;;\n\t\t\txValue = -img.getWidth();\n\t\t}\n\t\t\n\t\t// off to the top of the screen\n\t\tif (kin.position.y < kin.target.y) {\n\t\t\tnewTargetX = (MainPanel.PHEIGHT + img.getHeight() - kin.target.y) / slope + kin.target.x;\n\t\t\tyValue = MainPanel.PHEIGHT + img.getHeight();\n\t\t} else { // off the bottom of the screen\n\t\t\tnewTargetX = (-kin.target.y - img.getHeight()) / slope + kin.target.x;\n\t\t\tyValue = -img.getHeight();\n\t\t}\n\t\t\n\t\t// compare distances and use the minimum as target\n\t\tif (getDistance(kin.position.x, kin.position.y, xValue, newTargetY) < getDistance(kin.position.x, kin.position.y, newTargetX, yValue)) {\n\t\t\tkin.target = new Vector2d(xValue, newTargetY);\n\t\t} else {\n\t\t\tkin.target = new Vector2d(newTargetX, yValue);\n\t\t} // end else\n\t}", "private boolean stop() {\n\t\tboolean collide = false;\n\n\t\tdist = (int) MathMachine.distance((xOrigin - this.x), (yOrigin - this.y)); // distance traveled\n\t\tif (dist >= move_range) collide = true;\n\n\t\tif (Math.abs(x - xD) <= 2 && Math.abs(y - yD) <= 2) { // adding 8 shifts the collision box from the top left corner to the bottom right.\n\t\t\tcollide = true; // this is the important statement for collision detection. It works by looking at the tile you want to go to and seeing if it is solid.\n\t\t}\n\n\t\treturn collide;\n\t}", "public boolean detectBound(){\n // super.detectBound();\n if(posY > height || posY < 0){\n Main.enemies.remove(this);\n return true;\n }\n return false;\n\n }", "@Override\n public void handleCollision(Pellet pellet)\n {\n if(!isMovingToPoint())\n {\n if (mirror.getColor().a > Toggle.fadealpha)\n {\n\n float mirOX = getPosX() + getWidth() / 2;\n float mirOY = getPosY() + getHeight() / 2;\n\n if (acceptedDirs.equals(\"dl\"))\n {\n\n if (pellet.direction == 'u')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'r';\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'l';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"dr\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'l';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2) + 1 / PlayScreen.PPM);\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2) - 1 / PlayScreen.PPM);\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'r';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"ur\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'l';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'r';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"ul\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'r';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'l';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n //Draw the pellet at the origin of the mirror\n pellet.collided = false;\n }\n }\n }", "private void resetRayo() {\n rayo.setX(getWidth() / 2 - 10);\n rayo.setY(getHeight() - player.getHeight() - 50);\n }", "public void strafeRight()\r\n\t{\r\n\t\t//Following the camera:\r\n\t\tif(loc[1] > 1)\r\n\t\t{\r\n\t\t\tthis.loc[0] += Math.sin(Math.toRadians(heading))*distance; \r\n\t\t\tthis.loc[2] += Math.cos(Math.toRadians(heading))*distance;\r\n\t\t}\r\n\t}", "private void penguinStormReaction(){\n if(obstacle.getUserData().getAssetId().equals(OBSTACLE_CLOUD_ASSETS_ID)){\n if(penguin.isFrightStopped()){\n obstacle.setStormRaining(false);\n }else{\n obstacle.setStormRaining(true);\n }\n }\n }", "public void reverseXVelocity() {\n if(xVelocity > 0) //collision on right wall\n xVelocity = -xVelocity - 50;\n else //collision on left wall\n xVelocity = -xVelocity + 50;\n this.normalizeVelocity(this.xVelocity, this.yVelocity);\n }", "private void awayFromCollider(Graph graph, Node a, Node b, Node c) {\n Endpoint BC = graph.getEndpoint(b, c);\n Endpoint CB = graph.getEndpoint(c, b);\n\n if (!(graph.isAdjacentTo(a, c)) &&\n (graph.getEndpoint(a, b) == Endpoint.ARROW)) {\n if (CB == Endpoint.CIRCLE || CB == Endpoint.TAIL) {\n if (BC == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, b, c)) {\n return;\n }\n\n graph.setEndpoint(b, c, Endpoint.ARROW);\n changeFlag = true;\n }\n }\n\n if (BC == Endpoint.CIRCLE || BC == Endpoint.ARROW) {\n if (CB == Endpoint.CIRCLE) {\n graph.setEndpoint(c, b, Endpoint.TAIL);\n changeFlag = true;\n }\n }\n }\n }", "public void respawn() {\n\t\t\t\n\t\t\tslider.resize(100, 20);//resize and position image\n\t\t\tslider.setX(GamePlay.getMiddleX() - slider.getWidth()/2);//reset the x to the orignal position\n\t\t\tslider.setY(GamePlay.getScreenHeight() - 100);\n\t\t\t\n\t\t\tball.setX(slider.getX() + slider.getWidth()/2 - ball.getWidth()/2);//set the ball to the center of the slider\n\t\t\tball.setY(slider.getY()-ball.getHeight()-5);\n\t\t\t\n\t\t\tballVX=1;\n\t\t\tballVY=-1;//reset the velocity to a 45 degree angle up to the right\n\t\t\t\n\t\t\tdied=false;//no longer died.\n\t\t}", "public void onImpact() {\n die();\r\n this.getArrow().remove();\r\n }", "public void swim() {\r\n\t\tif(super.getPosition()[0] == Ocean.getInstance().getWidth()-71){\r\n\t\t\tinvX = true;\r\n\t\t} else if(super.getPosition()[0] == 0){\r\n\t\t\tinvX = false;\r\n\t\t}\r\n\t\tif(super.getPosition()[1] == Ocean.getInstance().getDepth()-71){\r\n\t\t\tinvY = true;\r\n\t\t} else if(super.getPosition()[1] == 0){\r\n\t\t\tinvY = false;\r\n\t\t}\r\n\t\tif(invX){\r\n\t\t\tsuper.getPosition()[0]-=1;\r\n\t\t} else {\r\n\t\t\tsuper.getPosition()[0]+=1;\r\n\t\t}\r\n\t\tif(invY){\r\n\t\t\tsuper.getPosition()[1]-=1;\r\n\t\t} else {\r\n\t\t\tsuper.getPosition()[1]+=1;\r\n\t\t}\r\n\t}", "public void setBoulderLockOff(){\r\n\t\tservoTarget = Constants.BALL_HOLDER_RETRACTED;\r\n\t}", "public void stop()\n\t{\n\t\tfrogVelocityX = 0;\n\t}", "public void setCollider(Rectangle collider) {\n this.collider = collider;\n }", "@Override\n public void onCollide (GameElement element) {\n\n }", "public Image getCrotchetDown();", "public void flap(){\n bird.setY(bird.getY() - 6);\n }", "@Override\n public void update() {\n y += velY;\n setRectHitBox();\n }", "public int move () {\n intMoveState = 0;\r\n int pixel1;\r\n int pixel2;\r\n \r\n if (blnUp) {\r\n pixel1 = getPixelRGB (X - 25, Y + 10, \"r\");\r\n pixel2 = getPixelRGB (X + 25, Y + 10, \"r\");\r\n \r\n if (pixel1 != 0 && pixel2 != 0) { \r\n Y -= intSpeed;\r\n intMoveState -= 1;\r\n }\r\n }\r\n if (blnDown) {\r\n pixel1 = getPixelRGB (X - 25, Y + 46, \"r\");\r\n pixel2 = getPixelRGB (X + 25, Y + 46, \"r\");\r\n \r\n if (pixel1 != 0 && pixel2 != 0) { \r\n Y += intSpeed;\r\n intMoveState += 1;\r\n }\r\n }\r\n if (blnLeft) {\r\n pixel1 = getPixelRGB (X - 30, Y + 15, \"r\");\r\n pixel2 = getPixelRGB (X - 30, Y + 30, \"r\");\r\n \r\n if (pixel1 != 0 && pixel2 != 0) { \r\n X -= intSpeed;\r\n intMoveState -= 2;\r\n }\r\n }\r\n if (blnRight) {\r\n pixel1 = getPixelRGB (X + 30, Y + 15, \"r\");\r\n pixel2 = getPixelRGB (X + 30, Y + 30, \"r\");\r\n \r\n if (pixel1 != 0 && pixel2 != 0) { \r\n X += intSpeed;\r\n intMoveState += 2;\r\n }\r\n }\r\n \r\n try {\r\n dblAngle = Math.atan2((MouseY - Y),(MouseX - X));\r\n if (dblAngle < - Math.PI/4) {\r\n dblAngle = 2 * Math.PI + dblAngle;\r\n }\r\n }catch (ArithmeticException e) {\r\n if (MouseY < Y) {\r\n dblAngle = 3 * Math.PI/2;\r\n }else {\r\n dblAngle = Math.PI/2;\r\n }\r\n }\r\n degreesAngle = (int) (Math.toDegrees(dblAngle)); \r\n \r\n if(intHealth < 0 && !UserInterface.deathScreenVisible){\r\n UserInterface.deathScreenVisible = true;\r\n deathTime = System.nanoTime();\r\n ClientMain.ssm.sendText(\"player,\" + ClientMain.intPlayerNumber + \",iamdeadlol\");\r\n }\r\n \r\n return getPixelRGB (X, Y + 46, \"g\");\r\n }", "@Override\n\tpublic void action() {\n\t if (firingBall.getY() + firingBall.getRadius() < this.y) { \n\t //deactivate absorber locally and in GameBoard\n\t firingBall = null;\n\t gb.removeFromActiveList(this);\n\t }\n\t}", "public void dropRamp() {\n if (currentSpeed == 0) {\n storage.dropRamp();\n }\n }", "public GameObject getOther(){\n \n return currentCollidingObject;\n \n }", "public void grip(){\n\t\tthis.motor.backward();\n\t}", "public void updateSensors() {\n if(bLCollide && bRCollide) {\n grounded = true;\n }\n else if(bLCollide || bRCollide) {\n grounded = true;\n }\n else if(!bLCollide && !bRCollide) {\n grounded = false;\n }\n if(!collideWithSlopeL && !collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,80); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,80); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer+28,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer+28,40,4); \n }\n else if(collideWithSlopeL && !collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,144); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,80); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4);\n }\n else if(!collideWithSlopeL && collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,80); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,144);\n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4); \n }\n else if(collideWithSlopeL && collideWithSlopeR) {\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,144); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,144); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4);\n }\n if(!grounded) {/*Added this to reset the height of the player sensors if he jumps off a slope (ground == true wouldn't trigger \n early) making the player stop earlier then he should*/\n bottomLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer,4,80); \n bottomRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer,4,80); \n middleLeft = new Rectangle(xDrawCenterPlayer-40,ySpriteCenterPlayer-4,40,4);\n middleRight = new Rectangle(xDrawCenterPlayer+4,ySpriteCenterPlayer-4,40,4); \n }\n topLeft = new Rectangle(xDrawCenterPlayer-36,ySpriteCenterPlayer-84,4,80);\n topRight = new Rectangle(xDrawCenterPlayer+36,ySpriteCenterPlayer-84,4,80); \n //Gets the correct size of interactBox\n if(jumpState != JumpState.STATE_NOJUMP || duckState != DuckState.STATE_NODUCK) {\n intersectBox = new Rectangle(xDrawCenterPlayer-30, ySpriteCenterPlayer-20, 60, 80);\n }\n else {\n intersectBox = new Rectangle(xDrawCenterPlayer-29, ySpriteCenterPlayer-70, 60, 140);\n }\n }", "private int collideObject(GOval ball, int bricksOnStage) {\n GObject collider = getCollidingObject(ball);\n if (isObjectAPaddle(collider) && vy > 0){\n vy = - vy;\n }\n else if (isObjectABrick(collider)){\n remove(collider);\n vy = - vy;\n bricksOnStage -= 1;\n }\n return bricksOnStage;\n }", "public void collided() {\n this.collided = true;\n }", "@Override\r\n public void touchUp(InputEvent event, float x, float y, int pointer, int button) {\r\n if(screen.player2.totalRockets>0 && !screen.player2.hasRocket) {\r\n screen.player2.totalRockets--;\r\n screen.player2.hasRocket = true;\r\n GameUtility.playSound(GameConstants.TADAA_SOUND);\r\n }\r\n }", "public abstract void collide(InteractiveObject obj);", "@Override\r\n\tpublic void update(GameContainer gc, float dt) {\n\t\tclip.setVolume(gc.getWindow().getSettings().getSfxVol());\r\n\t\thover = (gc.getInput().getMouseX() >= posX && gc.getInput().getMouseX() <= posX + width)\r\n\t\t\t\t&& (gc.getInput().getMouseY() >= posY && gc.getInput().getMouseY() <= posY + height);\r\n\t\tif ((hover && gc.getInput().isButtonUp(MouseEvent.BUTTON1))) {\r\n\t\t\tsetClicked(true);\r\n\t\t\tclip.play();\r\n\t\t}\r\n\t\tif (hover) {\r\n\t\t\tthis.color1=color2;\r\n\t\t} else\r\n\t\t\tcolor1 = temp;\r\n\t}", "public void joystickDeadZone() {\n\t\tif (joystickLXAxis <= 0.075 && joystickLXAxis >= -0.075) {\n\t\t\tjoystickLXAxis = 0;\n\t\t} if (joystickLYAxis <= 0.075 && joystickLYAxis >= -0.075) {\n\t\t\tjoystickLYAxis = 0;\n\t\t}\n\t\tif (joystickRXAxis <= 0.075 && joystickRXAxis >= -0.075) {\n\t\t\tjoystickRXAxis = 0;\n\t\t} if (joystickRYAxis <= 0.075 && joystickRYAxis >= -0.075) {\n\t\t\tjoystickRYAxis = 0;\n\t\t}\n\t}", "public void grab() {\n\t\tif (climbMode == false) {\n\t\t\tif (bumperL) {\n\t\t\t\tmotorGL.set(-1);\n\t\t\t\tmotorGR.set(1);\n\t\t\t} \n\t\t\telse if (bumperR) {\n\t\t\t\tmotorGL.set(1);\n\t\t\t\tmotorGR.set(-1);\n\t\t\t}\t\n\t\t\telse {\n\t\t\t\tmotorGL.set(0);\n\t\t\t\tmotorGR.set(0);\n\t\t\t}\n\t\t}\n\t}", "private boolean collision1() {\n return game.racket1.getBounds1().intersects(getBounds()); // returns true if the two rectangles intersect\r\n }", "private void fireball1Collisions() {\r\n\t\tGObject topLeft = getElementAt(fireball1.getX() - 1, fireball1.getY());\r\n\t\tGObject bottomLeft = getElementAt(fireball1.getX() - 1, fireball1.getY() + fireball1.getHeight());\r\n\t\tGObject topRight = getElementAt(fireball1.getX() + fireball1.getWidth() + 1, fireball1.getY());\r\n\t\tGObject bottomRight = getElementAt(fireball1.getX() + fireball1.getWidth() + 1, fireball1.getY() + fireball1.getHeight());\r\n\t\tif(topLeft == player || bottomLeft == player || topRight == player || bottomRight == player) {\r\n\t\t\tremove(fireball1);\r\n\t\t\tfireball1 = null;\r\n\t\t\thits++;\r\n\t\t\tloseLife();\r\n\t\t}\r\n\t}", "private void collideWithBall() {\n die();\n }", "public void checkScreenCollisionLeftRight() {\n if (x <= radius || x >= GameView.width - radius) {\n speedX *= -1;\n if (x < radius) {\n x = (int) radius;\n }\n if (x > GameView.width - radius) {\n x = (int) (GameView.width - radius);\n }\n }\n }", "public void noCollision(){\r\n this.collidingEntity2=null;\r\n this.collidingEntity=null;\r\n collidedTop=false;\r\n collide=false;\r\n }", "private void checkPlayerCollisions() {\r\n\t\tGObject left = getElementAt(player.getX() - 1, player.getY() + player.getHeight() / 2.0);\r\n\t\tGObject right = getElementAt(player.getX() + player.getWidth() + 1, player.getY() + player.getHeight() / 2.0);\r\n\t\tif(dragon1 != null && (left == dragon1 || right == dragon1)) {\r\n\t\t\tremove(lifeBar);\r\n\t\t\tlifeBar = null;\r\n\t\t}\r\n\t\tif(dragon2 != null && (left == dragon2 || right == dragon2)) {\r\n\t\t\tremove(lifeBar);\r\n\t\t\tlifeBar = null;\r\n\t\t}\r\n\t}", "@Override\n\tpublic void exitBoundary(final Boundary boundary1) {\n\t\tboundary1.setLogicalDragPosition(grid().gridW);\n\t}", "public Image getCrotchetUp();", "public void cancelRoadLength() {\n \t\troadLength = 0;\n \t}", "public void act() \n {\n String worldname = getWorld().getClass().getName();\n if (worldname == \"Level0\")\n setImage(new GreenfootImage(\"vibranium.png\"));\n else if (worldname == \"Level1\")\n setImage(rocket.getCurrentImage());\n setLocation(getX()-8, getY()); \n if (getX() == 0) \n {\n getWorld().removeObject(this);\n }\n \n }", "public boolean detectBound(){\n if(posX < 10){\n posX = 10;\n velX = 0;\n accX = 0;\n return true;\n }\n else if(posX > width - 10){\n posX = width - 10;\n velX = 0;\n accX = 0;\n return true;\n }\n if(posY < 10){\n posY = 10;\n velY = 0;\n accY = 0;\n return true;\n }\n else if(posY > height - 10){\n posY = height - 10;\n velY = 0;\n accY = 0;\n return true;\n }\n return false;\n }", "public void down() {\n\t\tswitch (facing){\n\t\tcase \"RIGHT\" :\n\t\t\tvely = 0;\n\t\t\tvelx = -1.5;\n\t\t\tbreak;\n\t\tcase \"LEFT\" :\n\t\t\tvely = 0;\n\t\t\tvelx = 1.5;\n\t\t\tbreak;\n\t\tcase \"UP\" :\n\t\t\tvely = 1.5;\n\t\t\tvelx = 0;\n\t\t\tbreak;\n\t\tcase \"DOWN\" :\n\t\t\tvely = -1.5;\n\t\t\tvelx = 0;\n\t\t\tbreak;\n\t\t}\n\t}", "void retract()\n\t\t{\n\t\t\tsides = sides-1;\n\t\t\t\n\t\t\tDimension[] dime2 = new Dimension[d.length - 1];\n\t\t\t\n\t\t\tfor (int i=0; i< d.length-1; i++)\n\t\t\t{\n\t\t\t\tdime2[i]= d[i];\n\t\t\t}\n\t\t\t\n\t\t\td = new Dimension[d.length - 1];\n\t\t\tfor(int i = 0; i< dime2.length; i++)\n\t\t\t{\n\t\t\t\td[i] = dime2[i];\n\t\t\t}\n\t\t\t\t\n\t\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tmotion.displace();\r\n\t\tmotion.circleIntersects();\r\n\t\t//check collision\r\n\t\tmotion.intersectBound();\r\n\t\trepaint(); // repaints this component\r\n\t}", "public Vector3f getOccluderPosition();", "void lostBall()\n {\n currentBall = null;\n }", "void playerHit() {\n if (lives == 0) {//if no lives left\n isDead = true;\n } else {//remove a life and reset positions\n lives -=1;\n immortalityTimer = 100;\n resetPositions();\n }\n }", "private boolean rightDownCollision(InteractiveObject obj){\n\t\treturn ((obj.getX() - this.getX() < this.getWidth()) && (obj.getX() > this.getX()) &&\n\t\t\t\t(obj.getY() - this.getY() < this.getHeight()) && (obj.getY() > this.getY()));\n\t}", "public void processCamera() {\n\t\tif (Mario.getX() > 300) {\n\t\t\tlevelCompound.move(-Mario.xVel, 0);\n\t\t\tPhysics.moveHitboxes(-Mario.xVel, 0);\n\t\t\tPhysics.moveEnemies(-Mario.xVel, 0);\n\t\t\tMario.setLocation(299, Mario.getY());\n\n\t\t\tlevelCompound.move(-3, 0);\n\t\t\tPhysics.moveHitboxes(-3, 0);\n\t\t\tPhysics.moveEnemies(-3, 0);\n\t\t}\n\t}", "private boolean leftDownCollision(InteractiveObject obj){\n\t\treturn (((this.getX() - obj.getX()) < obj.getWidth()) && (this.getX() > obj.getX()) &&\n\t\t\t\t((obj.getY() - this.getY()) < this.getHeight()) && (obj.getY() > this.getY()));\n\t}", "private void RightRightLeft() {\n \tRobot.cubebase.stopall();\n \twhile (true) \n \t{\n \t\t//first.take cube down and lift to high\n \t\tif (Robot.autotime.get()<.5) {\n\t\t\t\tRobot.cubebase.clickdown();//pay attention: maybe this is clickup()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t\t\t}\n \t\tif (Robot.autotime.get()>=.5&&Robot.autotime.get()<2.5) {\n \t\t\tRobot.cubebase.clickstop();\n\t\t\t\tRobot.cubebase.liftdown();//pay attention: maybe this is liftdown()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t\t\t}\n \t\t //about 300cm note: 0.08*2->90*2=180cm 0.08*3->90*3=270cm 270+45=315cm->0.08*3+0.08/2=0.28s\n \t\tif (Robot.autotime.get()>=2.5&&Robot.autotime.get()<3.9) {\n\t\t\t\tRobot.cubebase.stoplift();\n\t\t\t\tRobot.drivebase.run(.53, -.53 );\n\t\t\t}\n \t\tif (Robot.autotime.get()>=3.9&&Robot.autotime.get()<5.9) {\n\t\t\t\tRobot.cubebase.stopall();\n\t\t\t\tRobot.drivebase.Stop();\n\t\t\t}\n \t\tif (Robot.autotime.get()>5.9&&Robot.autotime.get()<6.2) {\n\t\t\t\tRobot.pneumatics_drive.close1();\n\t\t\t}\n \t\tif (Robot.autotime.get()>6.2) {\n \t\t\tRobot.cubebase.stopall();\n\t\t\t\tRobot.drivebase.Stop();\n\t\t\t\tbreak;\n\t\t\t}\n \t}\n\t}", "private static void turnAwayFromWall() {\n while (true) {\n if (readUsDistance() > OPEN_SPACE) {\n leftMotor.stop();\n rightMotor.stop();\n // re-calibrate theta, offset will be added to this angle\n odometer.setTheta(0);\n System.out.println(\"starting localization...\");\n prevDist = 255;\n dist = prevDist;\n break;\n }\n }\n }", "public void playerMissedBall(){ active = false;}", "public void laserUpdate3() {\n\n\t\t// makes laser & ship stay coupled (maybe a better way to do this?)\n\t\tif (StartingClass.downEnemies.get(StartingClass.currentIndex).isMovingY()) {\n\t\t\tcenterY = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterY();\n\t\t\tcenterX = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterX();\n\t\t}\n\t\tif (StartingClass.MIDDLE_Y > StartingClass.downLasers.get(StartingClass.currentIndex).getCenterY()) {\n\t\t\tcenterY += 3;\n\t\t} else {\n\t\t\tcenterX = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterX() + 1;\n\t\t\tcenterY = StartingClass.downEnemies.get(StartingClass.currentIndex).getCenterY();\n\t\t}\n\t}", "public void returnDefualt() {\r\n this.x = (float)getWidth()/2;\r\n this.y = (float)getHeight()/2;\r\n notifyObservers(normelizeAilron(this.x), normelizeElevator(this.y));\r\n }", "private void changer() {\n\n\t\ttry {\n\t\t\twhile (true) {\n\n\n\t\t\t\tThread.sleep(1000);\n\t\t\t\tvfeu1.lock();\n\t\t\t\tvfeu2.lock();\n\t\t\t\tif(r.feu==1)\n\t\t\t\t{\n\t\t\t\t\t//if(r.x>=100 && r.x<400)\n\t\t\t\t\tif(r.x>=100 && r.x<200)\n\t\t\t\t\t{\n\t\t\t\t\t\tcf1.await();\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\tr.img= ImageIO.read(new File(\"C:/Users/Anonyme/Tutorials/DAC_Controle_Carrefour/src/Carrefour/route.png\"));\n\n\t\t\t\t\tr.img1=ImageIO.read(new File(\"C:/Users/Anonyme/Tutorials/DAC_Controle_Carrefour/src/Carrefour/pietonvert.png\"));\n\t\t\t\t\tr.img2= ImageIO.read(new File(\"C:/Users/Anonyme/Tutorials/DAC_Controle_Carrefour/src/Carrefour/pietonrouge.png\"));\n\t\t\t\t\tr.feu=2;\n\t\t\t\t}else\n\t\t\t\t{\n\t\t\t\t\t//if(r.y>=120 && r.y<300)\n\t\t\t\t\tif(r.y>=200 && r.y<300)\n\t\t\t\t\t{ \n\t\t\t\t\t\tcf2.await();\n\t\t\t\t\t}\n\n\t\t\t\t\tr.img= ImageIO.read(new File(\"C:/Users/Anonyme/Tutorials/DAC_Controle_Carrefour/src/Carrefour/route.png\"));\n\n\t\t\t\t\tr.img1=ImageIO.read(new File(\"C:/Users/Anonyme/Tutorials/DAC_Controle_Carrefour/src/Carrefour/pietonrouge.png\"));\n\t\t\t\t\tr.img2= ImageIO.read(new File(\"C:/Users/Anonyme/Tutorials/DAC_Controle_Carrefour/src/Carrefour/pietonvert.png\"));\n\n\n\t\t\t\t\tr.feu=1;\n\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tr.repaint();\n\t\t\t\tvfeu1.unlock();\n\t\t\t\tvfeu2.unlock();\n\t\t\t}\n\t\t} catch (InterruptedException | IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}finally {\n\n\t\t}\n\n\t}" ]
[ "0.665518", "0.6143172", "0.59924114", "0.59655917", "0.5780594", "0.5731717", "0.5721696", "0.5720563", "0.57079023", "0.5686413", "0.56735617", "0.56684816", "0.563305", "0.56213266", "0.5615798", "0.56151754", "0.5606837", "0.55925345", "0.55876684", "0.5572155", "0.5566505", "0.5563292", "0.5546682", "0.5544315", "0.553821", "0.5526455", "0.5525724", "0.55181134", "0.5508549", "0.550847", "0.5501718", "0.55003154", "0.549421", "0.5492667", "0.548761", "0.5480533", "0.54664075", "0.54655033", "0.54543966", "0.5449427", "0.54433036", "0.5442638", "0.5439917", "0.5433253", "0.54324514", "0.5424247", "0.53957677", "0.5395354", "0.5390248", "0.53849953", "0.5381521", "0.53810924", "0.5380214", "0.537707", "0.5342126", "0.53412676", "0.5340771", "0.5336303", "0.53299785", "0.5327369", "0.5317156", "0.5307019", "0.5305688", "0.53044087", "0.5302718", "0.52988595", "0.52976006", "0.528658", "0.5281129", "0.5278923", "0.5266474", "0.52643824", "0.52641755", "0.52638596", "0.5261638", "0.5259108", "0.5258825", "0.5254096", "0.52505726", "0.5248947", "0.5248454", "0.52476907", "0.52445954", "0.52409273", "0.5240852", "0.5240439", "0.523833", "0.5236335", "0.52313036", "0.52290606", "0.52241737", "0.5222298", "0.5219752", "0.5213541", "0.52035075", "0.52027273", "0.52017623", "0.51944286", "0.51918685", "0.518625", "0.51770234" ]
0.0
-1
if Ao>c and a>b>c, then a>c Zhang's rule R2, awy from ancestor.
private void ruleR2(Node a, Node b, Node c, Graph graph) { if (!graph.isAdjacentTo(a, c)) { return; } if (graph.getEndpoint(b, a) == Endpoint.TAIL && graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE) { if (!isArrowpointAllowed(graph, a, c)) { return; } graph.setEndpoint(a, c, Endpoint.ARROW); } else if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.TAIL && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE ) { if (!isArrowpointAllowed(graph, a, c)) { return; } graph.setEndpoint(a, c, Endpoint.ARROW); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int CmpAscendancy( TaxoNode node1, TaxoNode node2 ) {\r\n\t\tif( node1 == null || node2 == null )\r\n\t\t\tthrow new RuntimeException( \"Bad node passed to CmpAscendancy\" );\r\n\t\tTaxoNode par = node1.parent;\r\n\t\twhile( par != null ) {\r\n\t\t\tif( par == node2 )\r\n\t\t\t\treturn 1; // Tag 2 is ascendant of tag1\r\n\t\t\tpar = par.parent;\r\n\t\t}\r\n\t\t// Okay, so tag2 is not above tag1. Look the other way\r\n\t\tpar = node2.parent;\r\n\t\twhile( par != null ) {\r\n\t\t\tif( par == node1 )\r\n\t\t\t\treturn -1; // Tag1 is ascendant of tag2\r\n\t\t\tpar = par.parent;\r\n\t\t}\r\n\t\t// If we got here, the nodes are not related\r\n\t\treturn 0;\r\n\t}", "public static KittyNode commAns(KittyNode a, KittyNode b){\n KittyNode trava,travb;\n trava = a;\n travb = b;\n if(trava == null)\n return travb;\n else if(travb == null)\n return trava;\n while(trava.prev != null || travb.prev != null){\n if(trava.lvl == travb.lvl){\n if(trava.prev == travb.prev)\n return trava.prev;\n trava = trava.prev;\n travb = travb.prev;\n }\n else if(trava.lvl > travb.lvl){\n if(trava.prev == travb)\n return travb;\n trava = trava.prev;\n }else if(trava.lvl < travb.lvl){\n if(trava == travb.prev)\n return trava;\n travb = travb.prev;\n }\n }\n if(trava != null)\n return trava;\n else\n return travb;\n }", "public TreeNode lowestCommonAncestor_selfAC(TreeNode root, TreeNode one, TreeNode two) {\n\t\tif (root == null) { \n\t\t\treturn null;\n\t\t}\n\t\tif (one == null) {\n\t\t\treturn two;\n\t\t}\n\t\tif (two == null) {\n\t\t\treturn one;\n\t\t}\n\t\treturn helper(root, one, two);\n\t}", "static void a(bu bu2, y.c.y y2) {\n Object object;\n Object object2;\n A a2;\n block8 : {\n boolean bl2;\n block7 : {\n bl2 = fj.z;\n a2 = bu2.t();\n y.c.x x2 = y2.a();\n while (x2.f()) {\n object2 = x2.e();\n a2.a(object2, true);\n x2.g();\n if (!bl2) {\n if (!bl2) continue;\n }\n break block7;\n }\n bu2.a(d.a, a2);\n }\n boolean bl3 = bu2.c(d) != null;\n object2 = new d();\n object2.b(3);\n object2.a(2);\n if (bl3) {\n object = new v();\n object.b(2);\n object.a(e);\n object.f(true);\n object.d(4);\n object.e(false);\n object.c(5);\n object.c(true);\n object.a(1);\n object.b(true);\n object.c(1);\n object.a(\"routingPreferMiddleOfNode\", (Object)Boolean.TRUE);\n i i2 = new i(new n(new ab(new y.f.i.X((ah)object))));\n object2.b(new hX(i2));\n if (!bl2) break block8;\n }\n object2.c(2);\n }\n object2.d(5);\n object2.a(true);\n object2.b(false);\n try {\n object = new bI(1);\n object.a(false);\n object.b(true);\n object.d().a(true);\n object.a(bu2, (ah)object2);\n return;\n }\n finally {\n bu2.d_(d.a);\n bu2.a(a2);\n }\n }", "private boolean cond2(Data C) {\n return (C.getLeft() > this.xR);\n }", "@Test\n\tpublic void lowestCommonAncestorTest1()\n\t{\n\t\tNodeList n1=xmlDocument.getElementsByTagName(\"b\");\n\t\tNodeList n2=xmlDocument.getElementsByTagName(\"i\");\n\t\tassertEquals(\"p\",Manipulator.lowestCommonAncesstor(n1.item(0),n2.item(0)).getNodeName());\n\t}", "public int a(bzl ☃, bzg bzg1, int i, int j) {\r\n/* 13 */ if (i == -bzg1.a() && j == -bzg1.b() && bzg1.a() > -bzg1.c() && bzg1.a() <= 0 && bzg1.b() > -bzg1.d() && bzg1.b() <= 0) {\r\n/* 14 */ return 1;\r\n/* */ }\r\n/* */ \r\n/* 17 */ return (☃.a(10) == 0) ? 1 : bzy.c;\r\n/* */ }", "TreeNode LCA(TreeNode root, TreeNode a, TreeNode b) {\n\t\t// teacher tang class ref\n\t\tif (root == null || root == a || root == b) {\n\t\t\treturn root;\n\t\t}\n\t\tTreeNode lc = LCA(root.left, a, b);\n\t\tTreeNode rc = LCA(root.right, a, b);\n\t\tif (lc != null && rc != null) {\n\t\t\treturn root;\n\t\t}\n\t\treturn lc == null ? rc : lc;\n\t}", "public TreeNode LCA(TreeNode root, TreeNode one, TreeNode two) {\r\n\t\t// base case\r\n\t\tif (root == null || root == one || root == two) {\r\n\t\t\treturn root;\r\n\t\t}\r\n\t\t\r\n\t\t// recursion rules\r\n\t\tTreeNode lchild = LCA(root.left, one, two);\r\n\t\tTreeNode rchild = LCA(root.right, one, two);\r\n\t\t\r\n\t\tif(lchild == null && rchild == null) { // case 1.1 and 2.1\r\n\t\t\treturn null;\r\n\t\t} else if (lchild != null && rchild != null) { // case 2.3\r\n\t\t\treturn root;\r\n\t\t}\r\n\t\t\r\n\t\treturn lchild == null ? rchild : lchild; // case 1.2 and 2.2\r\n\t}", "private void ruleR1(Node a, Node b, Node c, Graph graph) {\n if (graph.isAdjacentTo(a, c)) {\n return;\n }\n\n if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, b, c)) {\n return;\n }\n\n graph.setEndpoint(c, b, Endpoint.TAIL);\n graph.setEndpoint(b, c, Endpoint.ARROW);\n }\n }", "@Test\n\tpublic void lowestCommonAncestorTest3()\n\t{\n\t\tNodeList n1=xmlDocument.getElementsByTagName(\"b\");\n\t\tNodeList n2=xmlDocument.getElementsByTagName(\"p\");\n\t\tassertEquals(\"#document\",Manipulator.lowestCommonAncesstor(n1.item(0),n2.item(0)).getNodeName());\n\t}", "@Test(expected=NullPointerException.class)\n\tpublic void lowestCommonAncestorTest2()\n\t{\n\t\tNodeList n1=xmlDocument.getElementsByTagName(\"c\");\n\t\tNodeList n2=xmlDocument.getElementsByTagName(\"i\");\n\t\tManipulator.lowestCommonAncesstor(n1.item(0),n2.item(0));\n\t}", "private Node findLCA(Node n1, Node n2) {\n\t\tif (n1 == n2) {\n\t\t\treturn n1;\n\t\t}\n\t\treturn findLCA(n1.parent, n2.parent);\n\t}", "private void awayFromColliderAncestorCycle(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n List<Node> adj = graph.getAdjacentNodes(B);\n\n if (adj.size() < 2) {\n continue;\n }\n\n ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2);\n int[] combination;\n\n while ((combination = cg.next()) != null) {\n Node A = adj.get(combination[0]);\n Node C = adj.get(combination[1]);\n\n //choice gen doesnt do diff orders, so must switch A & C around.\n// awayFromCollider(graph, A, B, C);\n// awayFromCollider(graph, C, B, A);\n// awayFromAncestor(graph, A, B, C);\n// awayFromAncestor(graph, C, B, A);\n// awayFromCycle(graph, A, B, C);\n// awayFromCycle(graph, C, B, A);\n ruleR1(A, B, C, graph);\n ruleR1(C, B, A, graph);\n ruleR2(A, B, C, graph);\n ruleR2(C, B, A, graph);\n\n }\n }\n }", "public static void main(String[] args) {\n LowestCommonAncestor obj = new LowestCommonAncestor();\n obj.insert(4);\n obj.insert(2);\n obj.insert(1);\n obj.insert(3);\n obj.insert(6);\n obj.insert(5);\n obj.insert(7);\n System.out.println(\"LCA of 2 numbers is \" + obj.lcaRecursive(obj.root, 1,3).data);\n obj.inorder(obj.root);\n }", "public Pair<Integer, Boolean> findPath(BabelSynset bs1, BabelSynset bs2) throws Exception {\n\t\tif(bs1.equals(bs2) && !bs1.equals(\"bn:00031027n\")) return new Pair<Integer, Boolean>(0, false);\n\t\tif(bs1.equals(bs2) && bs1.equals(\"bn:00031027n\")) return new Pair<Integer, Boolean>(0, true);\n\t\t\n\t\tA_parentsHigh = new ArrayList<String>();\n\t\t\n\t\tPair<Integer, Boolean> default_result = new Pair<Integer, Boolean>(0, true);\n\t\t\n\t\tint A_path = 0;\n\t\tString A_parent = bs1.getId().toString();\n\t\tB_recoverAncestors(bs2, 25);\n\t\t\n\t\tSystem.out.println(B_Ancestors+\"\\n\\n\");\n\t\t\n\t\tif(A_parent == null) return new Pair<Integer, Boolean>(B_Ancestors.size(), true);\n\t\tif(A_parent.equals(\"bn:00031027n\")) return new Pair<Integer, Boolean>(B_Ancestors.size()+1, true);\n\t\tfor(int i=0; i<50; i++) {\n\t\t\tSystem.out.println(A_parent);\n\t\t\tint B_path = 0;\n\t\t\tfor(String id : B_Ancestors) {\n\t\t\t\tif(A_parent.equals(id)) {\n\t\t\t\t\tSystem.out.println(\"Path di A: \" + A_path + \"\\nPath di B: \" + B_path);\n\t\t\t\t\tif(id.equals(\"bn:00031027n\")) return new Pair<Integer, Boolean>(A_path+B_path, true);\n\t\t\t\t\telse return new Pair<Integer, Boolean>(A_path+B_path, false);\n\t\t\t\t}\n\t\t\t\tB_path++;\n\t\t\t}\n\t\t\tif(A_parent.equals(\"bn:00031027n\")) break;\n\t\t\tA_parent = recoverParent(bn.getSynset(new BabelSynsetID(A_parent)));\n\t\t\tA_path++;\n\t\t}\n\t\treturn default_result;\n\t}", "@Override\n public int test(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) {\n // For A not to intersect B (where each loop interior is defined to be\n // its left side), the CCW edge order around ab1 must be a0 b2 b0 a2.\n // Note that it's important to write these conditions as negatives\n // (!OrderedCCW(a,b,c,o) rather than Ordered(c,b,a,o)) to get correct\n // results when two vertices are the same.\n return (orderedCCW(a0, b2, b0, ab1) && orderedCCW(b0, a2, a0, ab1) ? 0 : -1);\n }", "@Override\n public int test(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) {\n // For A to contain B (where each loop interior is defined to be its left\n // side), the CCW edge order around ab1 must be a2 b2 b0 a0. We split\n // this test into two parts that test three vertices each.\n return orderedCCW(a2, b2, b0, ab1) && orderedCCW(b0, a0, a2, ab1) ? 1 : 0;\n }", "public String lca(E a, E b) {\n\n // one of the items is not in the tree, so the other is its own ancestor\n if (!exists(root, a) || !exists(root, b)) {\n if (exists(root, a)) return a.toString();\n else return b.toString();\n }\n BinaryNode<E> ancestor = null;\n if (a.compareTo(b) < 0) {\n ancestor = lca(root, a, b);\n } else {\n ancestor = lca(root, b, a);\n }\n if (ancestor == null) return \"none\";\n else return ancestor.toString();\n }", "private boolean cond1(Data C) {\n return (C.getRight() < this.xL);\n }", "public boolean checkCases(RBNode<T, E> node) {\r\n\t\t// case 1\r\n\t\tif (node.uniqueKey.compareTo(this.root.uniqueKey) == 0) {\r\n\t\t\tnode.color = 'b';\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t// case 2\r\n\t\tif (grandPNode(node).color == 'b') {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t// case 3\r\n\t\tif ((node.parent.color == 'r') && (uncleNode(node).color == 'r')) {\r\n\t\t\tnode.parent.color = 'b';\r\n\t\t\tuncleNode(node).color = 'b';\r\n\t\t\tgrandPNode(node).color = 'r';\r\n\t\t\tcheckCases(grandPNode(node));\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t// case 4\r\n\t\tif ((node.parent.color == 'r') && (uncleNode(node).color == 'b')) {\r\n\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) > 0)\r\n\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) < 0)) {\r\n\t\t\t\t// must be to the right of parent\r\n\t\t\t\tleftRotate(node.parent);\r\n\t\t\t\tnode = node.parent;\r\n\t\t\t}\r\n\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) < 0)\r\n\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) > 0)) {\r\n\t\t\t\trightRotate(node.parent);\r\n\t\t\t\tnode = node.parent;\r\n\t\t\t}\r\n\t\t\t// check case 5\r\n\t\t\tif ((node.parent.color == 'r') && (uncleNode(node).color == 'b')) {\r\n\t\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) < 0)\r\n\t\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) < 0)) {\r\n\t\t\t\t\tnode.parent.color = 'r';\r\n\t\t\t\t\trightRotate(grandPNode(node));\r\n\t\t\t\t}\r\n\t\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) > 0)\r\n\t\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) > 0)) {\r\n\t\t\t\t\tnode.parent.color = 'b';\r\n\t\t\t\t\tleftRotate(grandPNode(node));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public static WedgeRelation getWedgeRelation(\n S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) {\n // There are 6 possible edge orderings at a shared vertex (all\n // of these orderings are circular, i.e. abcd == bcda):\n //\n // (1) a2 b2 b0 a0: A contains B\n // (2) a2 a0 b0 b2: B contains A\n // (3) a2 a0 b2 b0: A and B are disjoint\n // (4) a2 b0 a0 b2: A and B intersect in one wedge\n // (5) a2 b2 a0 b0: A and B intersect in one wedge\n // (6) a2 b0 b2 a0: A and B intersect in two wedges\n //\n // We do not distinguish between 4, 5, and 6.\n // We pay extra attention when some of the edges overlap. When edges\n // overlap, several of these orderings can be satisfied, and we take\n // the most specific.\n if (a0.equalsPoint(b0) && a2.equalsPoint(b2)) {\n return WedgeRelation.WEDGE_EQUALS;\n }\n\n if (orderedCCW(a0, a2, b2, ab1)) {\n // The cases with this vertex ordering are 1, 5, and 6,\n // although case 2 is also possible if a2 == b2.\n if (orderedCCW(b2, b0, a0, ab1)) {\n return WedgeRelation.WEDGE_PROPERLY_CONTAINS;\n }\n\n // We are in case 5 or 6, or case 2 if a2 == b2.\n if (a2.equalsPoint(b2)) {\n return WedgeRelation.WEDGE_IS_PROPERLY_CONTAINED;\n } else {\n return WedgeRelation.WEDGE_PROPERLY_OVERLAPS;\n }\n }\n\n // We are in case 2, 3, or 4.\n if (orderedCCW(a0, b0, b2, ab1)) {\n return WedgeRelation.WEDGE_IS_PROPERLY_CONTAINED;\n }\n if (orderedCCW(a0, b0, a2, ab1)) {\n return WedgeRelation.WEDGE_IS_DISJOINT;\n } else {\n return WedgeRelation.WEDGE_PROPERLY_OVERLAPS;\n }\n }", "@Override\n public int test(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) {\n // There are 6 possible edge orderings at a shared vertex (all\n // of these orderings are circular, i.e. abcd == bcda):\n //\n // (1) a2 b2 b0 a0: A contains B\n // (2) a2 a0 b0 b2: B contains A\n // (3) a2 a0 b2 b0: A and B are disjoint\n // (4) a2 b0 a0 b2: A and B intersect in one wedge\n // (5) a2 b2 a0 b0: A and B intersect in one wedge\n // (6) a2 b0 b2 a0: A and B intersect in two wedges\n //\n // In cases (4-6), the boundaries of A and B cross (i.e. the boundary\n // of A intersects the interior and exterior of B and vice versa).\n // Thus we want to distinguish cases (1), (2-3), and (4-6).\n //\n // Note that the vertices may satisfy more than one of the edge\n // orderings above if two or more vertices are the same. The tests\n // below are written so that we take the most favorable\n // interpretation, i.e. preferring (1) over (2-3) over (4-6). In\n // particular note that if orderedCCW(a,b,c,o) returns true, it may be\n // possible that orderedCCW(c,b,a,o) is also true (if a == b or b == c).\n\n if (orderedCCW(a0, a2, b2, ab1)) {\n // The cases with this vertex ordering are 1, 5, and 6,\n // although case 2 is also possible if a2 == b2.\n if (orderedCCW(b2, b0, a0, ab1)) {\n return 1; // Case 1 (A contains B)\n }\n\n // We are in case 5 or 6, or case 2 if a2 == b2.\n return (a2.equalsPoint(b2)) ? 0 : -1; // Case 2 vs. 5,6.\n }\n // We are in case 2, 3, or 4.\n return orderedCCW(a0, b0, a2, ab1) ? 0 : -1; // Case 2,3 vs. 4.\n }", "private static void checkAncestor(Node root, int i, String ance, String desc) {\n\t\tList<String> lst = new ArrayList<>();\n\t\tlst.clear();\n\t\tFlist.clear();\n\t\tgetPath(root, desc, lst);\n\t\tfor (String j : Flist) {\n\t\t\tif (j.trim().equalsIgnoreCase(ance.trim()))\n\t\t\t\tans[i] = true;\n\t\t}\n\t}", "Tree findLCA(Tree tree, int n1, int n2){\n\n if(tree == null){\n return null;\n }\n\n\n // If either n1 or n2 matches with root's key, report\n // the presence by returning root (Note that if a key is\n // ancestor of other, then the ancestor key becomes LCA\n if(tree.data==n1 || tree.data==n2){\n return tree;\n }\n\n Tree leftLCA = findLCA(tree.left, n1, n2);\n Tree rightLCA = findLCA(tree.right, n1, n2);\n\n // If both of the above calls return Non-NULL, then one key\n // is present in once subtree and other is present in other,\n // So this node is the LCA\n if(leftLCA!=null && rightLCA!=null) {\n return tree;\n }\n\n return leftLCA!=null?leftLCA:rightLCA;\n\n}", "@Test\n\tpublic void parenthesses_should_notbalanced_expr()\n\t{\n\t\tString result=\"\";String expr=\"\";\n\t\t\n\t\texpr=\"(a+b(a+c)\";\n\t\t result=com.bridgelabz.util.DataStructure.BalanaceParenthes(expr);\n\t\tassertTrue(\"not balanced\", result!=\"balaced\");\n\t}", "private BinaryNode lca(BinaryNode node, E a, E b){\n if (exists(node.left, a) && exists(node.left, b)) return lca(node.left, a, b);\n else if (exists(node.right, a) && exists(node.right, b))return lca(node.right, a, b);\n else return node;\n }", "public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {\n\n int BOTH_DONE = 0;\n int LEFT_DONE = 1;\n int BOTH_PENDING = 2;\n\n Stack<Pair<TreeNode, Integer>> stack = new Stack<>();\n TreeNode LCA = null;\n stack.push(new Pair<>(root, BOTH_PENDING));\n\n while (!stack.isEmpty()) {\n Pair<TreeNode, Integer> topPair = stack.peek();\n if (topPair.second != BOTH_DONE) {\n //mark LCA on first entry, on back track , if reprocess then we'd send LCA incorrectly because\n //same p or q will be repeated when back tracking for example from left path\n if ((topPair.second == BOTH_PENDING) && (topPair.first == p || topPair.first == q)) {\n //node matched\n if (LCA != null) {\n return LCA;\n } else {\n LCA = topPair.first;\n }\n }\n\n //move left or right based on the state of the node\n TreeNode child;\n if (topPair.second == LEFT_DONE) {\n child = topPair.first.right;\n } else {\n child = topPair.first.left;\n }\n stack.pop();\n stack.push(new Pair<>(topPair.first, topPair.second - 1));\n if (child != null)\n stack.push(new Pair<>(child, BOTH_PENDING));\n\n } else {\n //if both childs visited, pop the element and move the LCA to the prior node which\n //was parent of the current node with LCA\n if (LCA == topPair.first) {\n stack.pop();\n LCA = stack.peek().first;\n } else {\n stack.pop();\n }\n }\n }\n return null;\n }", "public static void main(String[] args) {\n addNode(3);\n Node ans = lowestCommonAncestorFast(root.left, root.left.right.right);\n System.out.print(ans.val);\n }", "private boolean isCaseTwo() {\n if (current.getParent().getKey() < current.getParent().getParent().getKey()) {//dedo je vacsi ako otec:is LeftLeft branch\n // je to lava vetva\n\n if (current.getParent().getParent().getRight().isRed()) {\n System.out.println(\"Case two LEFT LEFT RED\");\n return true;\n }\n }\n if (current.getParent().getKey() > current.getParent().getParent().getKey()) {//dedo je mensi ako otec:is RightRight branch\n // je to lava vetva\n if (current.getParent().getParent().getLeft().isRed()) {\n System.out.println(\"Case one RIGHT RIGHT RED\");\n return true;\n }\n }\n return false;\n }", "static // Returns LCA if node n1, n2 are present in the given binary tree,\r\n// otherwise return -1\r\nint findLCA(BTNode root, int n1, int n2)\r\n{\n int[] path1 = null, path2 = null;\r\n \r\n // Find paths from root to n1 and root to n1. If either n1 or n2\r\n // is not present, return -1\r\n if ( !findPath(root, path1, n1) || !findPath(root, path2, n2))\r\n return -1;\r\n \r\n /* Compare the paths to get the first different value */\r\n int i;\r\n for (i = 0; i < path1.length && i < path2.length ; i++)\r\n if (path1[i] != path2[i])\r\n break;\r\n return path1[i-1];\r\n}", "public Complexity fromParent(Complexity c) {\n if (c.betterOrEqual(Complexity.P))\n return c.betterThan(complexity) ? complexity : c;\n // Cliquewidth unbounded distributes DOWNWARD!\n /*if (c.equals(Complexity.NPC) &&\n \"Cliquewidth\".equals(parent.getName()) &&\n \"Cliquewidth expression\".equals(child.getName()))\n return c;*/\n return Complexity.UNKNOWN;\n }", "private boolean concurrentRuleAsymParallelIndependentByCPA(\r\n\t\t\tfinal int i,\r\n\t\t\tfinal Rule ri,\r\n\t\t\tfinal ConcurrentRule cr,\r\n\t\t\tfinal List<Rule> sequence,\r\n\t\t\tfinal int concurdepth,\r\n\t\t\tString criterion) {\n\t\t\r\n\t\tboolean result = true; \r\n\t\tVector<Rule> tmp = new Vector<Rule>();\r\n\t\ttmp.addAll(sequence);\r\n\t\tint n = 0;\r\n\t\twhile (concurdepth-n >= 0) {\t\t\t\r\n\t\t\ttmp.remove(i-n);\r\n\t\t\tn++;\r\n\t\t}\r\n\t\tif ((i-n) < 0) {\r\n\t\t\ttmp.add(0, cr.getRule());\r\n\t\t} else {\r\n\t\t\ttmp.add(i-n, cr.getRule());\r\n\t\t}\r\n\t\tint c = tmp.indexOf(cr.getRule());\r\n\t\t\r\n\t\t// find conflicts of concurrent rule with rules before\r\n\t\tfor (int j=0; j<c; j++) {\r\n\t\t\tfinal Rule rj = tmp.get(j);\t\r\n\t\t\tfinal SimpleExcludePair excludePair = this.makeExcludePair();\t\t\t\t\r\n\t\t\tif(!asymParallelIndependentByCPA(excludePair, rj, -1, cr.getRule(), -1)) {\r\n\t\t\t\tresult = false;\t\t\r\n//\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\" has conflict with \" +rj.getName());\r\n\t\t\t\tbreak;\r\n\t\t\t} \r\n\t\t\texcludePair.dispose();\r\n\t\t}\r\n\t\tif (result) {\r\n\t\t\t// find conflicts of concurrent rule with successor rules\r\n\t\t\tfor (int l=c+1; l<tmp.size(); l++) {\r\n\t\t\t\tfinal Rule rj = tmp.get(l);\t\r\n\t\t\t\tfinal SimpleExcludePair excludePair = this.makeExcludePair();\r\n\t\t\t\tif (!asymParallelIndependentByCPA(excludePair, cr.getRule(), -1, rj, -1)) {\r\n\t\t\t\t\tresult = false;\t\r\n//\t\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\" has conflict with \" +rj.getName());\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t} \r\n\t\t\t\texcludePair.dispose();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.info = this.getConcurrentRuleNameInfo(cr.getRule(), ri);\r\n\t\tsetRuleResult(i, ri.getName(), result, criterion, this.info);\r\n//\t\tSystem.out.println(\"=== >>> Concurrent rule: \"+cr.getRule().getName()+\" is applicable without conflicts!\");\r\n\t\t\t\t\r\n\t\ttmp.clear();\r\n\t\t\r\n\t\treturn result;\r\n\t}", "private boolean inAnonymusFunc(Node node, Node upper_bound) {\n Optional<Node> parentNode = node.getParentNode();\n if(!parentNode.isPresent()){\n return false;\n }\n Node parent = parentNode.get();\n //If upper bound reached\n if(parent.equals(upper_bound)){\n return false;\n }\n\n Class parentClazz = parent.getClass();\n if(parentClazz != ObjectCreationExpr.class){\n //Maybe the grandparent is an anonymous class expression\n return inAnonymusFunc(parent, upper_bound);\n }\n\n ObjectCreationExpr anonymousClassExpr = (ObjectCreationExpr) parent;\n if(anonymousClassExpr.getAnonymousClassBody().isPresent()){\n return true;\n }else{\n return inAnonymusFunc(parent,upper_bound);\n }\n }", "Node commonAncestor(Node one, Node two);", "private static void checkRecurseUnordered(Vector<XSParticleDecl> dChildren, int min1, int max1, SubstitutionGroupHandler dSGHandler, Vector<XSParticleDecl> bChildren, int min2, int max2, SubstitutionGroupHandler bSGHandler) throws XMLSchemaException {\n/* 1306 */ if (!checkOccurrenceRange(min1, max1, min2, max2)) {\n/* 1307 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.1\", new Object[] {\n/* 1308 */ Integer.toString(min1), (max1 == -1) ? \"unbounded\" : \n/* 1309 */ Integer.toString(max1), \n/* 1310 */ Integer.toString(min2), (max2 == -1) ? \"unbounded\" : \n/* 1311 */ Integer.toString(max2)\n/* */ });\n/* */ }\n/* 1314 */ int count1 = dChildren.size();\n/* 1315 */ int count2 = bChildren.size();\n/* */ \n/* 1317 */ boolean[] foundIt = new boolean[count2];\n/* */ \n/* 1319 */ for (int i = 0; i < count1; i++) {\n/* 1320 */ XSParticleDecl particle1 = dChildren.elementAt(i);\n/* */ \n/* 1322 */ int k = 0; while (true) { if (k < count2) {\n/* 1323 */ XSParticleDecl particle2 = bChildren.elementAt(k);\n/* */ try {\n/* 1325 */ particleValidRestriction(particle1, dSGHandler, particle2, bSGHandler);\n/* 1326 */ if (foundIt[k]) {\n/* 1327 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.2\", null);\n/* */ }\n/* 1329 */ foundIt[k] = true;\n/* */ \n/* */ \n/* */ break;\n/* 1333 */ } catch (XMLSchemaException xMLSchemaException) {}\n/* */ k++;\n/* */ continue;\n/* */ } \n/* 1337 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.2\", null); }\n/* */ \n/* */ } \n/* */ \n/* 1341 */ for (int j = 0; j < count2; j++) {\n/* 1342 */ XSParticleDecl particle2 = bChildren.elementAt(j);\n/* 1343 */ if (!foundIt[j] && !particle2.emptiable()) {\n/* 1344 */ throw new XMLSchemaException(\"rcase-RecurseUnordered.2\", null);\n/* */ }\n/* */ } \n/* */ }", "public static Node LCA2(Node root, int n1, int n2) {\n if(root != null){\n if(root.data == n1 || root.data == n2)\n return root;\n\n Node l = LCA2(root.left, n1, n2);\n Node r = LCA2(root.right, n1, n2);\n if(l != null && r != null)\n return root;\n else if( l != null)\n return l;\n else if( r != null)\n return r;\n }\n return null;\n }", "public static Node rightAncestor(Node node) {\n\n\n if(node.parent!=null){\n if(node.key>node.parent.key){ // หา parent ตัวแรกี่มีคค่ามากกว่า\n return rightAncestor(node.parent);\n }\n else {return node.parent;}\n }else{return null;}//////\n }", "int moverseY(int a,int b){ \n if(b<a){\n return 0;\n }else{\n return 1;\n }//fin else2\n //fin else\n }", "@Override\n\t\tpublic int compareTo(node a) {\n\t\t\tif(a.skill<this.skill){\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif(a.skill>this.skill)\n\t\t\t\treturn 1;\n\t\t\tif(a.pos<this.pos)\n\t\t\t\treturn 1;\n\t\t\tif(a.pos>this.pos)\n\t\t\t\treturn -1;\n\t\t\treturn 0;\n\t\t}", "@Test\n\t\tpublic void applyRecursivelyGoal() {\n\t\t\tassertSuccess(\" ;H; ;S; s ⊆ ℤ |- r∈s ↔ s\",\n\t\t\t\t\trm(\"\", ri(\"\", rm(\"2.1\", empty))));\n\t\t}", "private void awayFromAncestor(Graph graph, Node a, Node b, Node c) {\n if ((graph.isAdjacentTo(a, c)) &&\n (graph.getEndpoint(a, c) == Endpoint.CIRCLE)) {\n\n if ((graph.getEndpoint(a, b) == Endpoint.ARROW) &&\n (graph.getEndpoint(b, c) == Endpoint.ARROW) && (\n (graph.getEndpoint(b, a) == Endpoint.TAIL) ||\n (graph.getEndpoint(c, b) == Endpoint.TAIL))) {\n\n if (!isArrowpointAllowed(graph, a, c)) {\n return;\n }\n\n graph.setEndpoint(a, c, Endpoint.ARROW);\n changeFlag = true;\n }\n }\n }", "public boolean b(atr paramatr)\r\n/* 468: */ {\r\n/* 469:481 */ if (paramatr.r().l()) {\r\n/* 470:482 */ return true;\r\n/* 471: */ }\r\n/* 472:485 */ amj localamj = a(this.c);\r\n/* 473:486 */ if (localamj != null) {\r\n/* 474:487 */ return localamj.b(paramatr);\r\n/* 475: */ }\r\n/* 476:489 */ return false;\r\n/* 477: */ }", "private static String findHighParent_A(BabelSynset bs) throws IOException {\n\t\tdouble weight = 0.0;\n\t\tString id = null;\n\t\tList<BabelSynsetIDRelation> edges = bs.getEdges(BabelPointer.ANY_HYPERNYM);\n\t\tfor(BabelSynsetIDRelation b : edges) {\n\t\t\tdouble temp_weight = b.getWeight();\n\t\t\tif(temp_weight > weight && !A_parentsHigh.contains(b.getTarget())) {\n\t\t\t\tweight = temp_weight;\n\t\t\t\tid = b.getTarget();\n\t\t\t\tA_parentsHigh.add(id);\n\t\t\t}\n\t\t}\n\t\tif(id == null) id = \"bn:00031027n\";\n\t\treturn id;\n\t}", "public boolean greaterthan(Inatnum a) throws Exception{\n if((this.isZero() &&a.isZero())==true) {return false;}//if both this and a are both zero, it returns false because it is not greater than. \n if((this.isZero())==false&&a.isZero()==true) {return true;}//conditional returns if a is greater than this.\n if((this.isZero())==true&&a.isZero()==false) {return false;}//conditional returns if this is greater than a.\n else {return this.pred().greaterthan(a.pred()); }//recursive call to subtract one from this and a.\n }", "public static boolean compare_face(int a, int b, String c){\n if (c.equals(\"g\")){ // The less than is never actually used in this scope. But who knows what the future holds?\n if (a > b){\n return true;\n }\n return false;\n }\n if (c.equals(\"l\")){\n if (a < b){\n return true;\n }\n return false;\n }\n return false; // Something went wrong here. But logically it'll never happen, so don't worry boys and girls.\n }", "protected void case3R(AbsTree t) {\n\t\t\tAbsTree min_right_t = t.right.min();\r\n\t\t\tif (min_right_t.left == null && min_right_t.right == null)\r\n\t\t\t\tcase1(min_right_t, this); // min_right_t is a leaf node\r\n\t\t\telse\r\n\t\t\t\tcase2(min_right_t, this); // min_right_t is a non-leaf node\r\n\t\t\tt.value = min_right_t.value;\r\n\t\t\tt.set_count(min_right_t.get_count());\r\n\t}", "int main()\n{\n int r, c, t, x = 0;\n cin>>r>>c>>t;\n for(int i = 1; i <= r; i++)\n {\n if (t == 2 * i)\n {\n cout<<\"It is a mango tree\";\n x = 1;\n break;\n }\n }\n for(int i = 1; i <= r; i++)\n {\n if (t == (c - 1) * i && x == 0)\n {\n cout<<\"It is a mango tree\";\n break;\n }\n else if(i == r && x == 0)\n cout<<\"It is not a mango tree\";\n }\n}", "public TreeNode lowestCommonAncestor2(TreeNode root, TreeNode p, TreeNode q) {\r\n\t\t if(root == null || p == root || q == root)\r\n\t return root;\r\n\t \r\n\t TreeNode left = lowestCommonAncestor(root.left, p, q);\r\n\t TreeNode right = lowestCommonAncestor(root.right, p, q);\r\n\t \r\n\t if(left == null && right != null) { // both on right\r\n\t return right;\r\n\t }\r\n\t if(right == null && left != null) { // both on left\r\n\t return left;\r\n\t }\r\n\t if(right == null && left == null) { // not in left and right\r\n\t return null;\r\n\t }\r\n\t return root; // right != null && left != null, one in left, one in right\r\n\t }", "public static void main(String[] args) {\n\t\tString str[] = { \"Motilal Jawahar\", \"Jawahar Indira\", \"Motilal Kamala\", \"Indira Sanjay\", \"Sanjay Varun\",\n\t\t\t\t\"Indira Rajiv\", \"Rajiv Priyanka\", \"Rajiv Rahul\" };\n\t\tNode root = null;\n\t\tfor (int i = 0; i < str.length; i++) {\n\t\t\tString arr[] = str[i].trim().split(\" \");\n\t\t\tif (i == 0) {\n\t\t\t\tFamilyTree f = new FamilyTree();\n\t\t\t\troot = f.new Node(arr[0]);\n\t\t\t}\n\t\t\troot = insertNode(root, arr);\n\t\t}\n\t\tpreOrder(root);\n\t\tString str2[] = { \"Motilal parent Indira\", \"Varun Descendant Indira\", \"Priyanka sibling varun\",\n\t\t\t\t\"sanjay child indira\", \"sanjay ancestor varun\", \"kamala ancestor rahul\", \"priyanka sibling rahul\",\n\t\t\t\t\"rahul descendant motilal\" };\n\t\tans = new boolean[str2.length];\n\t\tfor (int i = 0; i < str2.length; i++) {\n\t\t\tString arr2[] = str2[i].trim().split(\" \");\n\t\t\tif (arr2[1].trim().equalsIgnoreCase(\"CHILD\")) {\n\t\t\t\tcheckChild(root, i, arr2[0], arr2[2]);\n\t\t\t} else if (arr2[1].trim().equalsIgnoreCase(\"parent\")) {\n\t\t\t\tcheckChild(root, i, arr2[2], arr2[0]);\n\t\t\t} else if (arr2[1].trim().equalsIgnoreCase(\"ancestor\")) {\n\t\t\t\tcheckAncestor(root, i, arr2[0], arr2[2]);\n\t\t\t} else if (arr2[1].trim().equalsIgnoreCase(\"descendant\")) {\n\t\t\t\tcheckAncestor(root, i, arr2[2], arr2[0]);\n\t\t\t} else if (arr2[1].trim().equalsIgnoreCase(\"sibling\")) {\n\t\t\t\tcheckSibling(root, i, arr2[0], arr2[2]);\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < ans.length; i++) {\n\t\t\tif (ans[i])\n\t\t\t\tSystem.out.print(\"T \");\n\t\t\telse\n\t\t\t\tSystem.out.print(\"F \");\n\t\t}\n\t}", "private static void commonNodesInOrdSuc(Node r1, Node r2)\n {\n Node n1 = r1, n2 = r2;\n \n if(n1==null || n2==null)\n return;\n \n while(n1.left != null)\n n1 = n1.left;\n \n while(n2.left!= null)\n n2 = n2.left;\n \n while(n1!=null && n2!=null)\n {\n if(n1.data < n2.data)\n n1 = inOrdSuc(n1);\n \n else if(n1.data > n2.data)\n n2 = inOrdSuc(n2);\n \n else\n {\n System.out.print(n1.data+\" \"); n1 = inOrdSuc(n1); n2 = inOrdSuc(n2);\n }\n }\n \n System.out.println();\n }", "public TreeNode LCA(TreeNode root, int num1, int num2){\n if(root == null) return null;\n if(root.data < num1 && root.data < num2) {\n return LCA(root.right, num1, num2);\n }\n if(root.data > num1 && root.data > num2) {\n return LCA(root.left, num1, num2);\n }\n return root;\n }", "private static Node1 lca(Node1 root, int v1, int v2) {\n\t\tif (root.data < v1 && root.data < v2) return lca(root.right, v1, v2); //if root is smaller than vertexes\n\t\tif (root.data > v1 && root.data > v2) return lca(root.left, v1, v2); //if root is bigger than vertexes\n\t\treturn root; //else if is between vertexes the root is the lowest common divisor\n\t}", "public static void main(String[] args) {\n \t\tTreeNode root = new TreeNode(3);\n \t\tTreeNode n5 = new TreeNode(5);\n \t\tTreeNode n1 = new TreeNode(1);\n \t\tTreeNode n6 = new TreeNode(6);\n \t\tTreeNode n2 = new TreeNode(2);\n \t\tTreeNode n7 = new TreeNode(7);\n \t\tTreeNode n4 = new TreeNode(4);\n \t\tTreeNode n0 = new TreeNode(0);\n \t\tTreeNode n8 = new TreeNode(8);\n \t\t\n \t\troot.left = n5;\n \t\troot.right = n1;\n \t\tn5.left = n6;\n \t\tn5.right =n2;\n \t\tn2.left = n7;\n \t\tn2.right = n4;\n \t\tn1.left = n0;\n \t\tn1.right = n8;\n \n \t\tint i = 6;\n \t\tint j = 0;\n \t\t\n \t\tSystem.out.println(\"Least common ancestor of \" + i + \" and \" + j + \" is \" + lca(root, i, j));\n }", "@Override\r\n public int compare(Node o1, Node o2) {\r\n\r\n ArrayList<Litteral> solution1 = o1.getValeur();\r\n ArrayList<Litteral> solution2 = o2.getValeur();\r\n int satisfaitClauseNumberS1 = satInstance.satisfaitClauseNumber(solution1);\r\n int satisfaitClauseNumberS2 = satInstance.satisfaitClauseNumber(solution2);\r\n return satisfaitClauseNumberS2 - satisfaitClauseNumberS1;\r\n\r\n }", "public VariableCoefficientTuple suggestBranchingVariable (TwoIntegerTuple childRectCounts ) {\r\n \r\n VariableCoefficientTuple result= new VariableCoefficientTuple(null, ZERO) ;\r\n \r\n //first get the best lp rects\r\n List<Rectangle> rectanglesToConsiderForBranchingVarCalculation = this.getRectanglesToConsiderForBranchingVarCalculation( );\r\n \r\n //collect 0 direction refcounts into this map\r\n Map<String, Integer> zeroVar_RefCountMap = new HashMap<String, Integer> () ;\r\n //and one diirection refconts into this map\r\n Map<String, Integer> oneVar_RefCountMap = new HashMap<String, Integer> () ;\r\n \r\n List<VariableCoefficientTuple> variablesUsedForBranchingInThisRectangle =null;\r\n for (Rectangle rect: rectanglesToConsiderForBranchingVarCalculation){\r\n variablesUsedForBranchingInThisRectangle = getVariablesUsedForBranchingInThisRectangle (rect);\r\n if (variablesUsedForBranchingInThisRectangle.size()>ZERO) {\r\n this.updateVariableRefCounts(zeroVar_RefCountMap, oneVar_RefCountMap, variablesUsedForBranchingInThisRectangle) ;\r\n }else {\r\n System.err.print(\"trying to branch a node which should have been marked infeasible\" );\r\n exit(ONE);\r\n }\r\n }\r\n \r\n \r\n //now find the highest refcount var, no matter its direction\r\n int highZeroFreq = zeroVar_RefCountMap.isEmpty()?ZERO:Collections.max( zeroVar_RefCountMap.values());\r\n int highOneFreq = oneVar_RefCountMap.isEmpty()? ZERO: Collections.max(oneVar_RefCountMap.values()) ;\r\n \r\n //we need to find the selected var's refcount on the other side\r\n int selectedVarRefCountOnOtherSide = ZERO;\r\n \r\n int totalRects = getNumberOfRects(this.myInfeasibleRectanglesList) ;\r\n \r\n if (highZeroFreq>highOneFreq) {\r\n result.varName=getHighestFreqVar (zeroVar_RefCountMap,highZeroFreq ) ;\r\n result.coeff=highZeroFreq;\r\n selectedVarRefCountOnOtherSide= oneVar_RefCountMap.get( result.varName)==null? ZERO : oneVar_RefCountMap.get( result.varName);\r\n //this is how many rects will survive on either side\r\n childRectCounts.zeroSideCount = totalRects - selectedVarRefCountOnOtherSide;\r\n childRectCounts.oneSideCount=totalRects -highZeroFreq ;\r\n \r\n } else {\r\n result.varName=getHighestFreqVar (oneVar_RefCountMap,highOneFreq ) ;\r\n result.coeff=highOneFreq;\r\n selectedVarRefCountOnOtherSide= zeroVar_RefCountMap.get( result.varName)==null? ZERO : zeroVar_RefCountMap.get( result.varName);\r\n \r\n childRectCounts.zeroSideCount = totalRects - highOneFreq;\r\n childRectCounts.oneSideCount=totalRects - selectedVarRefCountOnOtherSide;\r\n }\r\n \r\n return result;\r\n }", "private void fixInnerParent(BaleElement be)\n{\n BaleAstNode sn = getAstChild(be);\n while (cur_parent != cur_line && sn == null) {\n cur_parent = cur_parent.getBaleParent();\n cur_ast = cur_parent.getAstNode();\n sn = getAstChild(be);\n }\n\n // now see if there are any internal elements that should be used\n while (sn != null && sn != cur_ast && sn.getLineLength() == 0) {\n BaleElement.Branch nbe = createInnerBranch(sn);\n if (nbe == null) break;\n addElementNode(nbe,0);\n nbe.setAstNode(sn);\n cur_parent = nbe;\n cur_ast = sn;\n sn = getAstChild(be);\n }\n}", "private boolean hasTwoChildren(int i) {\n\t\tint left=left(i);\n\t\tint right=right(i);\n\t\tint sizee=heap.size();\n\t\tif(left<sizee-1 && right<sizee-1){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean can_replace( Individual child, Individual parent ){\n// return (child.getFitness() > parent.getFitness());\n return (child.evalFitness( environment ) > parent.evalFitness( environment ));\n }", "private void awayFromAncestorCycle(Graph graph) {\n while (changeFlag) {\n changeFlag = false;\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n List<Node> adj = graph.getAdjacentNodes(B);\n\n if (adj.size() < 2) {\n continue;\n }\n\n ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2);\n int[] combination;\n\n while ((combination = cg.next()) != null) {\n Node A = adj.get(combination[0]);\n Node C = adj.get(combination[1]);\n\n //choice gen doesnt do diff orders, so must switch A & C around.\n awayFromAncestor(graph, A, B, C);\n awayFromAncestor(graph, C, B, A);\n awayFromCycle(graph, A, B, C);\n awayFromCycle(graph, C, B, A);\n }\n }\n }\n changeFlag = true;\n }", "public void a(alq paramalq, int paramInt, boolean paramBoolean1, boolean paramBoolean2)\r\n/* 70: */ {\r\n/* 71: 88 */ amj localamj = h();\r\n/* 72: 89 */ int i = paramBoolean1 ? a(paramalq, paramInt) : c(paramalq);\r\n/* 73: 90 */ if ((i >= 0) && (i < 9))\r\n/* 74: */ {\r\n/* 75: 91 */ this.c = i;\r\n/* 76: 92 */ return;\r\n/* 77: */ }\r\n/* 78: 95 */ if ((!paramBoolean2) || (paramalq == null)) {\r\n/* 79: 96 */ return;\r\n/* 80: */ }\r\n/* 81: 99 */ int j = j();\r\n/* 82:100 */ if ((j >= 0) && (j < 9)) {\r\n/* 83:101 */ this.c = j;\r\n/* 84: */ }\r\n/* 85:105 */ if ((localamj == null) || (!localamj.v()) || (a(localamj.b(), localamj.h()) != this.c))\r\n/* 86: */ {\r\n/* 87:106 */ int k = a(paramalq, paramInt);\r\n/* 88: */ int m;\r\n/* 89:108 */ if (k >= 0)\r\n/* 90: */ {\r\n/* 91:109 */ m = this.a[k].b;\r\n/* 92:110 */ this.a[k] = this.a[this.c];\r\n/* 93: */ }\r\n/* 94: */ else\r\n/* 95: */ {\r\n/* 96:112 */ m = 1;\r\n/* 97: */ }\r\n/* 98:114 */ this.a[this.c] = new amj(paramalq, m, paramInt);\r\n/* 99: */ }\r\n/* 100: */ }", "public int caseA(AVLNode node, AVLNode parent) {\n\t\tif (node.getKey() > parent.getKey()) {\n\t\t\tparent.setRight(node);\n\t\t\tnode.setParent(parent);\n\t\t} else {\n\t\t\tparent.setLeft(node);\n\t\t\tnode.setParent(parent);\n\t\t}\n\t\tparent.setSize();\n\t\tparent.setHeight(parent.getHeight() + 1);\n\t\tif (parent.parentSide() == 'N') {\n\t\t\treturn 1;\n\t\t}\n\t\tchar sideOfNode = node.parentSide();\n\t\tint bottomLeftEdge;\n\t\tif (sideOfNode == 'L') {\n\t\t\tbottomLeftEdge = 1;\n\t\t} else { // side of node is 'R'\n\t\t\tbottomLeftEdge = 2;\n\t\t}\n\t\treturn 1 + this.case1((AVLNode) parent, bottomLeftEdge);\n\t}", "public static int maxCutsRecursive(int n, int a, int b, int c){\n if (n < 0 ) return -1;\n if (n ==0 ) return 0;\n\n int res = Math.max(maxCutsRecursive(n-a,a,b,c),\n Math.max(maxCutsRecursive(n-b,a,b,c), maxCutsRecursive(n-c,a,b,c)));\n\n if (res == -1)\n return -1;\n\n return res;\n }", "int LCA(int level[], int parent[], int x, int y) {\n while (rootOfSubtree[x] != rootOfSubtree[y]) {\n if (level[x] > level[y]) {\n x = rootOfSubtree[x];\n } else {\n y = rootOfSubtree[y];\n }\n }\n //now they are in the same section, so we trivially compute the LCA\n while (x != y) {\n if (level[x] > level[y]) {\n x = parent[x];\n } else {\n y = parent[y];\n }\n }\n return x;\n }", "private boolean calculateMaximumLengthBitonicSubarray() {\n\n boolean found = false; // does any BSA found\n\n boolean directionChange = false; //does direction numberOfWays increase to decrease\n\n int countOfChange = 0;\n\n int i = 0;\n directionChange = false;\n int start = i;\n i++;\n for (; i < input.length; i++) {\n if (countOfChange != 0 && countOfChange % 2 == 0) {\n if (this.length < (i - 2 - start + 1)) {\n this.i = start;\n this.j = i - 2;\n this.length = this.j - this.i + 1;\n }\n start = i - 2;\n countOfChange = 0;\n }\n\n if (input[i] > input[i - 1]) {\n if (directionChange == true) {\n countOfChange++;\n }\n directionChange = false;\n }\n if (input[i] < input[i - 1]) {\n if (directionChange == false) {\n countOfChange++;\n }\n directionChange = true;\n }\n\n\n }\n\n if (directionChange == true) {\n if (this.length < (i - 1 - start + 1)) {\n this.i = start;\n this.j = i - 1;\n this.length = this.j - this.i + 1;\n }\n }\n return directionChange;\n }", "public void hitunganRule2(){\n penebaranBibitSedikit = 1200;\r\n hariPanenLama = 110;\r\n \r\n //menentukan niu Penebaran Bibit\r\n nBibit = (1500 - penebaranBibitSedikit) / (1500 - 500);\r\n \r\n //menentukan niu hari panen Lama\r\n if ((hariPanenLama >=100) && (hariPanenLama <=180)) {\r\n nPanen = (hariPanenLama - 100) / (180 - 100);\r\n }\r\n \r\n //tentukan alpha predikat (karena grafik segitiga)\r\n if (nBibit < nPanen) {\r\n a2 = nBibit;\r\n }else if (nBibit > nPanen) {\r\n a2 = nPanen;\r\n }\r\n \r\n //tentukan Z2\r\n z2 = (penebaranBibitSedikit + hariPanenLama) * 700;\r\n System.out.println(\"a2 = \" + String.valueOf(a2));\r\n System.out.println(\"z2 = \" + String.valueOf(z2));\r\n }", "public static int distanceBetween2Nodes2ndApproach(Node root,int p,int q) {\n\t\tif(root == null)\n\t\t\treturn -1;\n\t\tboolean lca = lowestCommonAncestorUsingBacktracking(root, p, q);\n\t\tint dist = distanceOfNodeFromRoot(ans, p) + distanceOfNodeFromRoot(ans, q); // LCA is stored in ans node.\n\t\t\n\t\treturn dist;\n\t\t\n\t}", "private static String findHighParent_B(BabelSynset bs) throws IOException {\n\t\tdouble weight = 0.0;\n\t\tString id = null;\n\t\tArrayList<String> B_parentsDouble = new ArrayList<String>();\n\t\tList<BabelSynsetIDRelation> edges = bs.getEdges(BabelPointer.ANY_HYPERNYM);\n\t\t\n\t\tfor(BabelSynsetIDRelation b : edges) {\n\t\t\tweight += b.getWeight();\n\t\t}\n\t\tif(weight == 0.0) return edges.get(0).getTarget();\n\t\t\n\t\tweight = 0.0;\n\t\tfor(BabelSynsetIDRelation b : edges) {\n\t\t\tString b_id = b.getTarget();\n\t\t\tif(!B_parentsDouble.contains(b_id) || (B_parentsDouble.contains(b_id) && b.getWeight() != 0.0)) {\n\t\t\t\tdouble temp_weight = b.getWeight();\n\t\t\t\tif(temp_weight > weight && !B_Ancestors.contains(b_id)) {\n\t\t\t\t\tweight = temp_weight;\n\t\t\t\t\tid = b_id;\n\t\t\t\t}\n\t\t\t\tB_parentsDouble.add(b_id);\n\t\t\t}\n\t\t}\n\t\tif(id == null) id = \"bn:00031027n\";\n\t\treturn id;\n\t}", "private int joinSecnodCase(AVLTree t1, IAVLNode x, AVLTree t2) {\r\n\t\t\t\t int returnValue = 0;\r\n\t\t\t\t IAVLNode curr = t1.getRoot(), parent;\r\n\t\t\t\t \r\n\t\t\t\t while(true) {\r\n\t\t\t\t\t if(curr.getHeight() <= t2.getRoot().getHeight())\r\n\t\t\t\t\t\t break;\r\n\t\t\t\t\t if(curr.getRight().getHeight() == -1)\r\n\t\t\t\t\t\t break;\r\n\t\t\t\t\t curr = curr.getRight();\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t\t\t\t parent = curr.getParent();\r\n\t\t\t\t \r\n\t\t\t\t if(t1.getRoot() == curr) {\r\n\t\t\t\t\t curr.setRight(x);\r\n\t\t\t\t\t x.setParent(curr);\r\n\t\t\t\t\t curr.setHeight(curr.getHeight() + 1 );\r\n\t\t\t\t\t return 0;\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t\t\t\t returnValue = Math.abs(t2.getRoot().getHeight() - curr.getHeight());\r\n\t\t\t\t \r\n\t\t\t\t //replacing pointers\r\n\t\t\t\t \r\n\t\t\t\t x.setLeft(curr);\r\n\t\t\t\t x.setParent(parent);\r\n\t\t\t\t parent.setRight(x);\r\n\t\t\t\t curr.setParent(x);\r\n\t\t\t\t x.setRight(t2.getRoot());\r\n\t\t\t\t t2.getRoot().setParent(x);\r\n\t\t\t\t t2.setRoot(null);\r\n\t\t\t\t t2.setRoot(t1.getRoot());\r\n\t\t\t\t x.setHeight(Math.max(x.getRight().getHeight(), x.getLeft().getHeight()) + 1);\r\n\t\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t\t \r\n\t\t\t\t //t2.minimum = t1.minimum;\r\n\t\t\t\t t2.maximum = t1.maximum;\r\n\t\t\t\t \r\n\t\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t\t HieghtsUpdating(x);\r\n\t\t\t\t SizesUpdate(x);\r\n\t\t\r\n\t\t\t\t return returnValue;\r\n\t\t\t\t}", "@Test\n public void test1Question04_6_2()\n {\n assertEquals(nodes[6], Question04_6_2.commonAncestor(unbalancedRoot,\n nodes[8],\n nodes[5]));\n // Common ancestor a few levels up\n assertEquals(nodes[7], Question04_6_2.commonAncestor(unbalancedRoot,\n nodes[8],\n nodes[2]));\n // Common ancestor is root\n assertEquals(unbalancedRoot, Question04_6_2.commonAncestor(unbalancedRoot,\n nodes[8],\n nodes[4]));\n // One node is the parent of another\n assertEquals(nodes[6], Question04_6_2.commonAncestor(unbalancedRoot,\n nodes[8],\n nodes[6]));\n // Same nodes\n assertEquals(nodes[8], Question04_6_2.commonAncestor(unbalancedRoot,\n nodes[8],\n nodes[8]));\n }", "private boolean overlappingGateways(BpmnShape s1, BpmnShape s2) {\n\t\tdouble firstHeight = s1.getBounds().getHeight() / 2;\n\t\tdouble firstWidth = s1.getBounds().getWidth() / 2;\n\t\tdouble firstX = s1.getBounds().getX() + firstWidth;\n\t\tdouble firstY = s1.getBounds().getY() + firstHeight;\n\t\tdouble firstApothem = (s1.getBounds().getHeight() * Math.sqrt(2)) / 2;\n\n\t\tdouble secondWidth = s2.getBounds().getWidth() / 2;\n\t\tdouble secondHeight = s2.getBounds().getHeight() / 2;\n\t\tdouble secondX = s2.getBounds().getX();\n\t\tdouble secondY = s2.getBounds().getY() + secondHeight;\n\t\tdouble secondApothem = (s2.getBounds().getHeight() * Math.sqrt(2)) / 2;\n\t\t\n\t\tif (firstX > secondX && firstY > secondY){\n\t\t\tif ((firstX - firstWidth < secondX + secondWidth && firstY - firstHeight < secondY + secondHeight) &&\n\t\t\t\t(firstX - firstApothem < secondX + secondApothem || firstY - firstApothem < secondY + secondApothem))\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX > secondX && firstY < secondY){\n\t\t\tif ((firstX - firstWidth < secondX + secondWidth && firstY + firstHeight > secondY - secondHeight) &&\n\t\t\t\t(firstX - firstApothem < secondX + secondApothem || firstY + firstApothem > secondY - secondApothem))\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX < secondX && firstY > secondY){\n\t\t\tif ((firstX + firstWidth > secondX - secondWidth && firstY - firstHeight < secondY + secondHeight) &&\n\t\t\t\t(firstX + firstApothem > secondX - secondApothem || firstY - firstApothem < secondY + secondApothem))\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX < secondX && firstY < secondY){\n\t\t\tif ((firstX - firstWidth < secondX + secondWidth && firstY + firstHeight > secondY - secondHeight) &&\n\t\t\t\t(firstX - firstApothem < secondX + secondApothem || firstY + firstApothem > secondY - secondApothem))\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX == secondX && firstY == secondY)\n\t\t\t\treturn true;\n\t\t\n\t\tif (firstX == secondX && firstY > secondY){\n\t\t\tif (firstY - firstHeight < secondY + secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX > secondX && firstY == secondY){\n\t\t\tif (firstX - firstWidth < secondX + secondWidth)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX == secondX && firstY < secondY){\n\t\t\tif (firstY + firstHeight > secondY - secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX < secondX && firstY == secondY){\n\t\t\tif (firstX + firstWidth > secondX - secondWidth)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}", "private static void checkRecurseLax(Vector<XSParticleDecl> dChildren, int min1, int max1, SubstitutionGroupHandler dSGHandler, Vector<XSParticleDecl> bChildren, int min2, int max2, SubstitutionGroupHandler bSGHandler) throws XMLSchemaException {\n/* 1357 */ if (!checkOccurrenceRange(min1, max1, min2, max2)) {\n/* 1358 */ throw new XMLSchemaException(\"rcase-RecurseLax.1\", new Object[] {\n/* 1359 */ Integer.toString(min1), (max1 == -1) ? \"unbounded\" : \n/* 1360 */ Integer.toString(max1), \n/* 1361 */ Integer.toString(min2), (max2 == -1) ? \"unbounded\" : \n/* 1362 */ Integer.toString(max2)\n/* */ });\n/* */ }\n/* 1365 */ int count1 = dChildren.size();\n/* 1366 */ int count2 = bChildren.size();\n/* */ \n/* 1368 */ int current = 0;\n/* 1369 */ for (int i = 0; i < count1; i++) {\n/* */ \n/* 1371 */ XSParticleDecl particle1 = dChildren.elementAt(i);\n/* 1372 */ int j = current; while (true) { if (j < count2) {\n/* 1373 */ XSParticleDecl particle2 = bChildren.elementAt(j);\n/* 1374 */ current++;\n/* */ \n/* */ \n/* */ try {\n/* 1378 */ if (particleValidRestriction(particle1, dSGHandler, particle2, bSGHandler)) {\n/* 1379 */ current--;\n/* */ }\n/* */ break;\n/* 1382 */ } catch (XMLSchemaException xMLSchemaException) {}\n/* */ j++;\n/* */ continue;\n/* */ } \n/* 1386 */ throw new XMLSchemaException(\"rcase-RecurseLax.2\", null); }\n/* */ \n/* */ } \n/* */ }", "public boolean isBelow( PlanNode possibleAncestor ) {\n PlanNode node = this;\n while (node != null) {\n if (node == possibleAncestor) return true;\n node = node.getParent();\n }\n return false;\n }", "protected boolean connects(R r1, R r2) {\n\t\t\treturn getPreviousOrSame(getLower(r1)).compareTo(getUpper(r2)) <= 0 ||\n\t\t\t\tgetPreviousOrSame(getLower(r2)).compareTo(getUpper(r1)) <= 0;\n\t\t}", "private void solveViolation(NodeRB<K, V> x) {\n\t\tNodeRB<K, V> uncle = x.getUncle();\n\t\tif (uncle != null && uncle.color == true) {\n\n\t\t\t// Step 1.1 Change color of parent and uncle as BLACK.\n\t\t\tx.parent.color = false;\n\t\t\tuncle.color = false;\n\n\t\t\t// Step 1.2 color of grand parent as RED.\n\t\t\tx.getGrandParent().color = true;\n\n\t\t\t// Step 1.3 Change x = x's grandparent, repeat steps 2 and 3 for new x.\n\t\t\tbalanceRBTree(x.getGrandParent());\n\n\t\t\t// Case 2: If x's uncle is BLACK, then there can be four configurations for x,\n\t\t\t// x's parent (p) and x's grandparent (g)\n\t\t} else {\n\n\t\t\t// i) Left Left Case (p is left child of g and x is left child of p)\n\t\t\tif (x.parent.isLeftChild() && x.isLeftChild()) {\n\t\t\t\tleftLeftCase(x);\n\t\t\t}\n\n\t\t\t// ii) Left Right Case (p is left child of g and x is right child of p)\n\t\t\telse if (x.parent.isLeftChild() && x.isRightChild()) {\n\t\t\t\tif (x.parent == root) {\n\t\t\t\t\troot = rotateLeft(x.parent);\n\t\t\t\t} else {\n\t\t\t\t\trotateLeft(x.parent);\n\t\t\t\t}\n\t\t\t\tleftLeftCase(x.left);\n\t\t\t}\n\n\t\t\t// iii) Right Right Case (Mirror of case i)\n\t\t\telse if (x.parent.isRightChild() && x.isRightChild()) {\n\t\t\t\trightRightCase(x);\n\t\t\t}\n\n\t\t\t// iv) Right Left Case (Mirror of case ii)\n\t\t\telse if (x.parent.isRightChild() && x.isLeftChild()) {\n\t\t\t\tif (x.parent == root) {\n\t\t\t\t\troot = rotateRight(x.parent);\n\t\t\t\t} else {\n\t\t\t\t\trotateRight(x.parent);\n\t\t\t\t}\n\t\t\t\trightRightCase(x.right);\n\t\t\t}\n\t\t}\n\t}", "private int rightChild(int i){return 2*i+2;}", "private boolean concurrentRuleAsymParallelIndependent(\r\n\t\t\tfinal int i,\r\n\t\t\tfinal Rule ri,\r\n\t\t\tfinal ConcurrentRule cr,\r\n\t\t\tfinal List<Rule> sequence,\r\n\t\t\tfinal int concurdepth,\r\n\t\t\tString criterion) {\n\r\n\t\tboolean result = true; \t\t\r\n\t\tint concurrrentRuleDepth = cr.getDepth();\r\n\t\t\t\r\n\t\tVector<Rule> remainList = new Vector<Rule>();\r\n\t\tfor (int l=i+1; l<sequence.size(); l++) {\r\n\t\t\tremainList.add(sequence.get(l));\r\n\t\t}\r\n\t\t\r\n\t\tVector<Rule> crSourceList = new Vector<Rule>();\r\n\t\tint start = i-concurrrentRuleDepth;\r\n\t\tfor (int l=start; l<=i; l++) {\r\n\t\t\tcrSourceList.add(sequence.get(l));\r\n\t\t}\r\n\t\t\r\n\t\t// find conflicts of concurrent rule with rules before\r\n\t\tfor (int l = 0; l<crSourceList.size(); l++) {\r\n\t\t\tRule r = crSourceList.get(l);\r\n\t\t\tint indx = start + l;\r\n\t\t\tPair<Boolean, List<String>> \r\n\t\t\truleRes = this.ruleSequence.getRuleResult(indx, r.getName(), ApplicabilityConstants.NO_IMPEDING_PREDECESSORS);\r\n\t\t\tif (ruleRes != null && !ruleRes.first.booleanValue()) {\r\n\t\t\t\tresult = false;\t\r\n//\t\t\t\tString otherRule = ruleRes.second.isEmpty()? \"\": ruleRes.second.get(0);\r\n//\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\": its base rule: \"+r.getName()+\" has conflict with \" +otherRule);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (result) {\r\n\t\t\t// find conflicts of concurrent rule with successor rules \r\n\t\t\tfor (int l = 0; l<crSourceList.size(); l++) {\r\n\t\t\t\tRule r1 = crSourceList.get(l);\r\n\t\t\t\tfor (int k=0; k<remainList.size(); k++) {\r\n\t\t\t\t\tRule r2 = remainList.get(k);\r\n\t\t\t\t\tSimpleExcludePair excludePair = this.makeExcludePair();\r\n\t\t\t\t\tif (!asymParallelIndependentByCPA(excludePair, r1, -1, r2, -1)) {\r\n\t\t\t\t\t\tresult = false;\t\r\n//\t\t\t\t\t\tSystem.out.println(\"---> Concurrent rule: \"+cr.getRule().getName()+\": its base rule: \"+r1.getName()+\" has conflict with \" +r2.getName());\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t} \r\n\t\t\t\t\texcludePair.dispose();\r\n\t\t\t\t}\r\n\t\t\t\tif (!result) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.info = this.getConcurrentRuleNameInfo(cr.getRule(), ri);\t\t\t\r\n\t\tsetRuleResult(i, ri.getName(), result, criterion, this.info);\t\t\t\r\n\r\n\t\tremainList.clear();\r\n\t\tcrSourceList.clear();\r\n\t\t\r\n\t\treturn result;\r\n\t}", "static Node findNode(Node root, int a, int b, int c) {\n Node x = getLCA(root, a, b);\n\n // lca of b, c\n Node y = getLCA(root, b, c);\n\n // lca of c, a\n Node z = getLCA(root, c, a);\n\n if (x.data == y.data)\n return z;\n else if (x.data == z.data)\n return y;\n else\n return x;\n }", "public com.google.cr a(com.google.ca r5) {\n /*\n r4 = this;\n r0 = 0;\n r1 = com.google.bA.b;\n r2 = com.google.ca.d();\n if (r5 != r2) goto L_0x000a;\n L_0x0009:\n return r4;\n L_0x000a:\n r2 = r4.f;\n if (r2 != 0) goto L_0x003f;\n L_0x000e:\n r2 = com.google.ca.b(r5);\n r2 = r2.isEmpty();\n if (r2 != 0) goto L_0x0079;\n L_0x0018:\n r2 = r4.g;\n r2 = r2.isEmpty();\n if (r2 == 0) goto L_0x002e;\n L_0x0020:\n r2 = com.google.ca.b(r5);\n r4.g = r2;\n r2 = r4.h;\n r2 = r2 & -2;\n r4.h = r2;\n if (r1 == 0) goto L_0x003a;\n L_0x002e:\n r4.d();\n r2 = r4.g;\n r3 = com.google.ca.b(r5);\n r2.addAll(r3);\n L_0x003a:\n r4.g();\n if (r1 == 0) goto L_0x0079;\n L_0x003f:\n r2 = com.google.ca.b(r5);\n r2 = r2.isEmpty();\n if (r2 != 0) goto L_0x0079;\n L_0x0049:\n r2 = r4.f;\n r2 = r2.i();\n if (r2 == 0) goto L_0x0070;\n L_0x0051:\n r2 = r4.f;\n r2.b();\n r4.f = r0;\n r2 = com.google.ca.b(r5);\n r4.g = r2;\n r2 = r4.h;\n r2 = r2 & -2;\n r4.h = r2;\n r2 = com.google.bL.d;\n if (r2 == 0) goto L_0x006c;\n L_0x0068:\n r0 = r4.k();\n L_0x006c:\n r4.f = r0;\n if (r1 == 0) goto L_0x0079;\n L_0x0070:\n r0 = r4.f;\n r1 = com.google.ca.b(r5);\n r0.a(r1);\n L_0x0079:\n r4.a(r5);\n r0 = r5.getUnknownFields();\n r4.a(r0);\n goto L_0x0009;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.google.cr.a(com.google.ca):com.google.cr\");\n }", "@Override\n\tpublic int compare(Column column1, Column column2) {\n\t\tboolean condition1 = column1.getRootId() > column2.getRootId();\n\t\tboolean condition2 = column1.getRootId() == column2.getRootId() && column1.getLevel() > column2.getLevel();\n\t\tboolean condition3 = column1.getRootId() == column2.getRootId() && column1.getLevel() == column2.getLevel() && column1.getSeq() > column2.getSeq();\n\t\t\n\t\tif(condition1 || condition2 || condition3){\n\t\t\t return 1;\n\t\t}else{\n\t\t\t return 0;\n\t\t} \n\t}", "public Node findLCA(Node root, int n1, int n2){\n\t\tif(root == null)\n\t\t\treturn null;\n\t\telse if(root.data > n1 && root.data > n2)\n\t\t\treturn findLCA(root.left, n1, n2);\n\t\telse if(root.data < n1 && root.data < n2)\n\t\t\treturn findLCA(root.right, n1, n2);\n\t\treturn root;\n\t}", "private void branch01(Node parent) {\n final GeneralLP lp0 = parent.lp;\n final int v = intVars[parent.level];\n Maths.CnF cf = new Maths.CnF(lp0.x[v - 1]);\n\n double[][] a2 = Arrays.copyOf(lp0.a, lp0.m);\n double[] bLeft = lp0.b; // left branch\n double[] bRight = Arrays.copyOf(lp0.b, lp0.m); // right branch\n double[] c2 = Arrays.copyOf(lp0.c, lp0.n);\n double c0Right = lp0.c0 + lp0.c[v - 1]; // c0Left unchanged\n branch01Arguments(c2, a2, bRight, lp0, v);\n\n // LP1: left branch (=0)\n LOG.debug(parent, \"left branch x(\", v, \") =\", 0);\n GeneralLP lp1 = new GeneralLP(lp0.objectiveType, lp0.c0, c2, a2, lp0.signs, bLeft, lp0.freeVars);\n Node child1 = new Node(lp1, parent, Node.LEFT).binary(v);\n nodes.addLast(child1);\n\n // LP2: right branch (=1)\n LOG.debug(parent, \"right branch x(\", v, \") =\", 1);\n GeneralLP lp2 = new GeneralLP(lp0.objectiveType, c0Right, c2, a2, lp0.signs, bRight, lp0.freeVars);\n Node child2 = new Node(lp2, parent, Node.RIGHT).binary(v);\n nodes.addLast(child2);\n\n parent.lp = null; // release memory\n }", "private void rightRightCase(NodeRB<K, V> x) {\n\t\t// Swap colors of g and p\n\t\tboolean aux = x.parent.color;\n\t\tx.parent.color = x.getGrandParent().color;\n\t\tx.getGrandParent().color = aux;\n\n\t\t// Left Rotate g\n\t\tNodeRB<K, V> g = x.getGrandParent();\n\t\tif (g.parent == null) {\n\t\t\troot = rotateLeft(g);\n\t\t} else {\n\t\t\trotateLeft(g);\n\t\t}\n\t}", "public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {\n TreeNode cur = root;\n while (true) {\n if (cur.val > p.val && cur.val > q.val) cur = cur.left;\n else if (cur.val < p.val && cur.val < q.val) cur = cur.right;\n else return cur;\n }\n}", "private int joinFirstCase(AVLTree t1, IAVLNode x, AVLTree t2) {\r\n\t\t\t int returnValue = 0;\r\n\t\t\t IAVLNode curr = t2.getRoot();\r\n\t\t\t \r\n\t\t\t while(true) {\r\n\t\t\t\t if(curr.getHeight() <= t1.getRoot().getHeight())\r\n\t\t\t\t\t break;\r\n\t\t\t\t if(curr.getLeft().getHeight() == -1)\r\n\t\t\t\t\t break;\r\n\t\t\t\t curr = curr.getLeft();\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t if(t2.getRoot() == curr) {\r\n\t\t\t\t curr.setLeft(x);\r\n\t\t\t\t x.setParent(curr);\r\n\t\t\t\t curr.setHeight(curr.getHeight() + 1 );\r\n\t\t\t\t return 0;\r\n\t\t\t\t\t\t \r\n\t\t\t }\r\n\t\t\t returnValue = t2.getRoot().getHeight() - curr.getHeight();\r\n\t\t\r\n\t\t\t //replacing pointers\r\n\t\t\t x.setRight(curr);\r\n\t\t\t x.setParent(curr.getParent());\r\n\t\t\t curr.getParent().setLeft(x);\r\n\t\t\t curr.setParent(x);\r\n\t\t\t x.setLeft(t1.getRoot());\r\n\t\t\t t1.getRoot().setParent(x);\r\n\t\t\t t1.setRoot(t2.getRoot());\r\n\t\t\t x.setHeight(Math.max(x.getRight().getHeight(),x.getLeft().getHeight()) + 1);\r\n\t\t\t \r\n\t\t\t t2.minimum = t1.minimum;\r\n\t\t\t \r\n\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t HieghtsUpdating(x);\r\n\t\t\t SizesUpdate(x);\r\n\t\r\n\t\t\t return returnValue;\r\n\t\t\t \r\n\t\t}", "private boolean cond3(Data C) {\n return (C.getBottom() > this.yT);\n }", "private void keepRangeRecur(BinaryNode node, E a, E b) {\n\n if (node == null) return;\n\n //node is within a-b bounds so keep it\n if (a.compareTo((E)node.element) <= 0 && b.compareTo((E)node.element) >= 0) {\n keepRangeRecur(node.left, a, b);\n keepRangeRecur(node.right, a, b);\n\n //node is to the left of boundaries\n } else if (a.compareTo((E)node.element) > 0) {\n if (node == root) {\n root = node.right;\n node.right.parent = null;\n } else if (node.parent.right == node) { //node and its parent are out\n root = node;\n node.parent = null;\n keepRangeRecur(node.left, a, b);\n } else { //node is out but its parent is in\n node.parent.left = node.right;\n if (node.right != null) node.right.parent = node.parent; // checking if child exists\n }\n keepRangeRecur(node.right, a, b);\n\n // node is to the right of boundaries\n } else if (b.compareTo((E)node.element) < 0) {\n if (node == root) {\n root = node.left;\n node.left.parent = null;\n } else if (node.parent.left == node) { //node and its parent are out\n root = node;\n node.parent = null;\n keepRangeRecur(node.right, a, b);\n } else { //node is out but its parent is in\n node.parent.right = node.left;\n if (node.left != null) node.left.parent = node.parent; // checking if child exists\n }\n keepRangeRecur(node.left, a, b);\n }\n }", "private String parentside(WAVLNode d,WAVLNode y) {\n\t if(d.right==y) {\r\n\t\t return \"right\";\r\n\t }\r\n\t else {\r\n\t\t return \"left\";\r\n\t }\r\n }", "public static void main(String[] args) {\n\t\t\n\t\tint a,b,c,d;\n\t a = 50; b =20; c= 30; d=40;\n\t \n\t if (a>d) //true\n\t\t \n\t {\n\t if (d>b) //true\n\t {\n\t if (a>c) //true\n\t {\n\t\t if (c>b) //true\n\t\t {\n\t\t\t System.out.println(\"nested if condition true\");\n\t {\n\t System.out.println(\"nested if condition false\");\n\t} \n\t\t }\n\t }\n\t }\n }\n\n//eg 2\n\nint nu , nu1, nu2;\nnu = 100; nu1 = 200; nu2=300;\n if (nu<nu1 )\n System.out.println(\"nu is lesser\");\n { \n if(nu2>nu1)\n System.out.println(\"nu2 is grater\");\n {\n if (nu1>nu)\n System.out.println(\"nu1 is grater\");\n {\n System.out.println(\"netsred if got executed\");\t\n }\n }\n }\n {\n \tSystem.out.println(\"netsted if not got executed\");\t\n }\n \n \t}", "int findLCA(int a, int b) {\n int n1 = (depth[a] > depth[b]) ? a : b;\n int n2 = (depth[a] > depth[b]) ? b : a;\n\n int toMove = depth[n1] - depth[n2];\n for (int i = 17; i >= 0; i--) {\n if (lcaSteps[i] <= toMove) {\n n1 = lcaArr[i][n1];\n toMove -= lcaSteps[i];\n }\n }\n\n // Find LCA\n if (n1 == n2) return n1;\n else {\n for (int i = 17; i >= 0; i--) {\n if (lcaArr[i][n1] != lcaArr[i][n2]) {\n n1 = lcaArr[i][n1];\n n2 = lcaArr[i][n2];\n }\n }\n }\n\n return lcaArr[0][n1];\n }", "@Override\n public final int compareTo(final Rule r) throws NullPointerException {\n // type cast\n if (r == null)\n throw new ClassCastException(\"Null CandidateRule to compareTo.\");\n\n // now compare the values\n final double val1 = this.getRuleValue();\n final double val2 = r.getRuleValue();\n if (val1 > val2)\n return 1;\n else if (val2 > val1)\n return -1;\n else if (this.getStats().getNumberOfTruePositives() > r.getStats().getNumberOfTruePositives())\n return 1;\n else if (this.getStats().getNumberOfTruePositives() < r.getStats().getNumberOfTruePositives())\n return -1;\n // now tie break on length\n else if (this.length() < r.length())\n return 1;\n else if (r.length() < this.length())\n return -1;\n // else\n // return this.toString().compareTo(r.toString()); // TODO by m.zopf: this version of compareTo is slower than the previous one, but also better. so find a fast and good solution.\n\n if (this.getTieBreaker() > r.getTieBreaker())\n return -1; // we are better\n else if (this.getTieBreaker() < r.getTieBreaker())\n return 1;\n else\n // we should only end up here if r and this are the same object\n return 0;\n }", "Result commonAncestorHelper(TreeNode root, TreeNode p, TreeNode q) {\n\tif (root == null) return new Result(null, false);\n\n\n\t// they are the same node, and is the root\n\tif (root == p && root == q) {\n\t\treturn new Result(root, true);\n\t}\n\t// searching left subtree\n\tResult rx = commonAncestorHelper(root.left, p, q);\n\t// found a common ancestor \n\tif (rx.isAncestor) { \n\t\treturn rx; \n\t}\n\n\t// searching right subtree\n\tResult ry = commonAncestorHelper(root.right, p, q);\n\tif (ry.isAncestor) {\n\t\treturn ry; \n\t}\n\n\tif (rx.node != null && ry.node != null) {\n\t\treturn new Result(root, true); // common ancestor \n\t} else if (root == p || root == q) {\n\t\t// we're currently at p or q\n\t\t// found one of those nodes in subtree, then ancestor\n\t\t// flag TRUE\n\t\tboolean isAncestor = rx.node != null || ry.node != null; \n\t\treturn new Result(root, isAncestor)\n\t} else {\n\t\treturn new Result(rx.node != null ? rx.node : ry.node, false);\n\t}\n\n\n}", "@Test(timeout = 4000)\n public void test37() throws Throwable {\n SimpleNode simpleNode0 = new SimpleNode(2836);\n JavaParser javaParser0 = new JavaParser(\"ConditionalAndExpression\");\n SimpleNode simpleNode1 = new SimpleNode(javaParser0, 2836);\n simpleNode0.jjtSetParent(simpleNode1);\n Node node0 = simpleNode0.jjtGetParent();\n simpleNode1.jjtSetParent(node0);\n assertSame(node0, simpleNode1);\n }", "public static Rule getBetterRule(final Rule r1, final Rule r2) {\n\n // check that both are not null\n if (r1 == null)\n return r2;\n if (r2 == null)\n return r1;\n\n if (r1.compareTo(r2) > 0)\n return r1;\n else\n // we shouldn't have equal rules\n return r2;\n }", "@Override\n public lj<ow> a(lj<ow> ox2, int n2, int n3) {\n lj<Bitmap> lj2 = ((ow)ox2.b()).b();\n lj<on> lj3 = ((ow)ox2.b()).c();\n if (lj2 != null && this.a != null) {\n lj<Bitmap> lj4 = this.a.a(lj2, n2, n3);\n if (lj2.equals(lj4)) return ox2;\n return new ox(new ow(lj4, ((ow)ox2.b()).c()));\n }\n if (lj3 == null) return ox2;\n if (this.b == null) return ox2;\n lj<on> lj5 = this.b.a(lj3, n2, n3);\n if (lj3.equals(lj5)) return ox2;\n return new ox(new ow(((ow)ox2.b()).b(), lj5));\n }", "private boolean hasTwo()\r\n\t\t{\r\n\t\t\treturn getLeftChild() != null && getRightChild() != null;\r\n\t\t}", "public static Node LCABinTree(Node r, int value1, int value2) {\n if( r != null) {\n if( r.data == value1 || r.data == value2)\n return r;\n Node nl = LCABinTree(r.left, value1, value2);\n Node nr = LCABinTree(r.right, value1, value2);\n if( nl != null && nr != null)\n return r;\n else if( nl != null)\n return nl;\n else if( nr != null)\n return nr;\n\n }\n return null;\n }", "public static void main(String args[]) {\n\t\tBNode root = new BNode(4);\n\t\troot.left = new BNode(2);\n\t\troot.right = new BNode(6);\n\t\troot.left.left = new BNode(1);\n\t\troot.left.right = new BNode(3);\n\t\troot.right.left = new BNode(5);\n\t\troot.right.right = new BNode(7);\n\t\tSystem.out.println(\"LCA(4, 5) = \" + findLCA(root, 4, 5).data);\n\t\tSystem.out.println(\"itr LCA(4, 5) = \" + lcaIterative(root, 4, 5).data);\n\t\tSystem.out.println(\"LCA(4, 6) = \" + findLCA(root, 4, 6).data);\n\t\tSystem.out.println(\"itr LCA(4, 6) = \" + lcaIterative(root, 4, 6).data);\n\t\tSystem.out.println(\"LCA(3, 4) = \" + findLCA(root, 3, 4).data);\n\t\tSystem.out.println(\"itr LCA(3, 4) = \" + lcaIterative(root, 3, 4).data);\n\t\tSystem.out.println(\"LCA(2, 4) = \" + findLCA(root, 2, 4).data);\n\t\tSystem.out.println(\"itr LCA(2, 4) = \" + lcaIterative(root, 2, 4).data);\n\t\t\n\t\tSystem.out.println(\"itr LCA(2, 9) = \" + lcaIterative(root, 2, 9).data);\n\n\t\tBNode root2 = new BNode(4);\n\t\troot2.left = new BNode(2);\n\t\troot2.right = new BNode(6);\n\t\troot2.left.left = new BNode(1);\n\t\troot2.left.right = new BNode(3);\n\t\troot2.right.left = new BNode(5);\n\t\troot2.right.right = new BNode(7);\n\t\troot2.right.right.right = new BNode(8);\n\t\tSystem.out.println(\"-----------------------------------------------\");\n\t\tSystem.out.println(\"Dist (4, 5) = \" + findDistance(root2, 4, 5));\n\t\tSystem.out.println(\"Dist itr (4, 5) = \" + findDistance2(root2, 4, 5));\n\n\t\tSystem.out.println(\"Dist(4, 6) = \" + findDistance(root2, 4, 6));\n\t\tSystem.out.println(\"Dist itr (4, 6) = \" + findDistance2(root2, 4, 6));\n\n\t\tSystem.out.println(\"Dist(3, 4) = \" + findDistance(root2, 3, 4));\n\t\tSystem.out.println(\"Dist itr(3, 4) = \" + findDistance2(root2, 3, 4));\n\n\t\tSystem.out.println(\"Dist(2, 4) = \" + findDistance(root2, 2, 4));\n\t\tSystem.out.println(\"Dist itr(2, 4) = \" + findDistance2(root2, 2, 4));\n\n\t\tSystem.out.println(\"Dist(8, 5) = \" + findDistance(root2, 8, 5));\n\t\tSystem.out.println(\"Dist itr(8, 5) = \" + findDistance2(root2, 8, 5));\n\n\t}", "public boolean b(alq paramalq)\r\n/* 259: */ {\r\n/* 260:278 */ int i = c(paramalq);\r\n/* 261:279 */ if (i < 0) {\r\n/* 262:280 */ return false;\r\n/* 263: */ }\r\n/* 264:283 */ return true;\r\n/* 265: */ }", "public static Node LCA_BasedOnFindNode(Node r, int n1, int n2){\n if(r != null){\n if(r.data == n1 || r.data == n2)\n return r;\n\n Node left = LCA_BasedOnFindNode(r.left, n1, n2); \n Node right = LCA_BasedOnFindNode(r.right, n1, n2);\n\n if(left != null && right != null)\n return r;\n else if(left != null)\n return left;\n else if(right != null)\n return right;\n \n }\n return null;\n }" ]
[ "0.5496813", "0.5490459", "0.5406583", "0.5382602", "0.5374466", "0.5302459", "0.5299449", "0.5288243", "0.52541256", "0.5246501", "0.52326965", "0.5227964", "0.5171448", "0.5170703", "0.51456195", "0.5120788", "0.50946796", "0.50831187", "0.5063157", "0.5059717", "0.5041201", "0.5025928", "0.49997917", "0.4997906", "0.49949896", "0.49866268", "0.49790263", "0.496462", "0.49323997", "0.49210575", "0.49144477", "0.49112797", "0.49061424", "0.4904277", "0.48843476", "0.48812154", "0.48693043", "0.48691583", "0.4861782", "0.48507175", "0.48435822", "0.48416448", "0.48247367", "0.48243526", "0.48243475", "0.47930568", "0.47914973", "0.4788347", "0.47722587", "0.47619364", "0.47587457", "0.47403878", "0.47376573", "0.47361788", "0.4722162", "0.4715837", "0.4715286", "0.47130984", "0.4709606", "0.47089288", "0.47073147", "0.47040853", "0.47023585", "0.4700401", "0.4695564", "0.4693569", "0.4682476", "0.46749714", "0.46722516", "0.46695057", "0.4657044", "0.46555352", "0.46405524", "0.46372935", "0.46109313", "0.46092048", "0.46069655", "0.46064648", "0.4605746", "0.4603949", "0.45994207", "0.45975778", "0.4597119", "0.45833662", "0.45831037", "0.45806497", "0.4580571", "0.4579104", "0.45789146", "0.45788363", "0.4576311", "0.45729697", "0.45727032", "0.45715457", "0.4570035", "0.45582247", "0.45564455", "0.45550942", "0.45472062", "0.454179" ]
0.5592574
0
if a>BooC and not ac, then a>b>c (orient either circle if present, don't need both)
private void awayFromCollider(Graph graph, Node a, Node b, Node c) { Endpoint BC = graph.getEndpoint(b, c); Endpoint CB = graph.getEndpoint(c, b); if (!(graph.isAdjacentTo(a, c)) && (graph.getEndpoint(a, b) == Endpoint.ARROW)) { if (CB == Endpoint.CIRCLE || CB == Endpoint.TAIL) { if (BC == Endpoint.CIRCLE) { if (!isArrowpointAllowed(graph, b, c)) { return; } graph.setEndpoint(b, c, Endpoint.ARROW); changeFlag = true; } } if (BC == Endpoint.CIRCLE || BC == Endpoint.ARROW) { if (CB == Endpoint.CIRCLE) { graph.setEndpoint(c, b, Endpoint.TAIL); changeFlag = true; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "AngleGreater createAngleGreater();", "boolean canFormTriangle(double a, double b, double c) {\n return (a + b > c) && (a + c > b) && (b + c > a);\n }", "static String catAndMouse(int x, int y, int z) {\nint PosCatA ;\nint PosCatB ;\nString wins = null;\nPosCatA = Math.abs(z-x);\nPosCatB = Math.abs(z-y);\nif(PosCatA > PosCatB)\n{\n wins = \"Cat B\";\n}\nif(PosCatB > PosCatA)\n{\n wins = \"Cat A\";\n}\nif ( PosCatA == PosCatB)\n{\n wins= \"Mouse C\";\n}\n return wins;\n }", "private boolean isBetween(float a, float b, float c) {\n return b >= a ? c >= a && c <= b : c >= b && c <= a;\n }", "private boolean _clockwise(PVector A, PVector B, PVector C) {\n return (C.y-A.y) * (B.x-A.x) > (B.y-A.y) * (C.x-A.x);\n }", "private boolean cond3(Data C) {\n return (C.getBottom() > this.yT);\n }", "public static boolean compare_face(int a, int b, String c){\n if (c.equals(\"g\")){ // The less than is never actually used in this scope. But who knows what the future holds?\n if (a > b){\n return true;\n }\n return false;\n }\n if (c.equals(\"l\")){\n if (a < b){\n return true;\n }\n return false;\n }\n return false; // Something went wrong here. But logically it'll never happen, so don't worry boys and girls.\n }", "public static double mid(double a, double b, double c) {\n if (a >= b) {\n if (b >= c) {\n return b; // a >= b >= c\n } else if (a >= c) {\n return c; // a >= c > b\n } else {\n return a; // c > a >= b\n }\n } else if (a >= c) {\n return a; // b > a >= c\n } else if (b >= c) {\n return c; // b >= c > a\n } else {\n return b; // c > b > a\n }\n }", "public static float mid(float a, float b, float c) {\n if (a >= b) {\n if (b >= c) {\n return b; // a >= b >= c\n } else if (a >= c) {\n return c; // a >= c > b\n } else {\n return a; // c > a >= b\n }\n } else if (a >= c) {\n return a; // b > a >= c\n } else if (b >= c) {\n return c; // b >= c > a\n } else {\n return b; // c > b > a\n }\n }", "private boolean colisionPalas() {\r\n\t\treturn game.racketIzq.getBounds().intersects(getBounds())\r\n\t\t\t\t|| game.racketDer.getBounds().intersects(getBounds());\r\n\t}", "private boolean ptoStaDentroCuadra(float posx, float posy, int x, int y, int ancho,\n\t\t\tint alto) {\n\t\treturn (x < posx && posx < x + ancho && y < posy && posy < y + alto);\n\t}", "public static KittyNode commAns(KittyNode a, KittyNode b){\n KittyNode trava,travb;\n trava = a;\n travb = b;\n if(trava == null)\n return travb;\n else if(travb == null)\n return trava;\n while(trava.prev != null || travb.prev != null){\n if(trava.lvl == travb.lvl){\n if(trava.prev == travb.prev)\n return trava.prev;\n trava = trava.prev;\n travb = travb.prev;\n }\n else if(trava.lvl > travb.lvl){\n if(trava.prev == travb)\n return travb;\n trava = trava.prev;\n }else if(trava.lvl < travb.lvl){\n if(trava == travb.prev)\n return trava;\n travb = travb.prev;\n }\n }\n if(trava != null)\n return trava;\n else\n return travb;\n }", "public static Boolean InsideBoundary(Double a, Double b, Double c)\n {\n if (a <= b && a > c)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "private boolean cond2(Data C) {\n return (C.getLeft() > this.xR);\n }", "public int a(bzl ☃, bzg bzg1, int i, int j) {\r\n/* 13 */ if (i == -bzg1.a() && j == -bzg1.b() && bzg1.a() > -bzg1.c() && bzg1.a() <= 0 && bzg1.b() > -bzg1.d() && bzg1.b() <= 0) {\r\n/* 14 */ return 1;\r\n/* */ }\r\n/* */ \r\n/* 17 */ return (☃.a(10) == 0) ? 1 : bzy.c;\r\n/* */ }", "private boolean cond1(Data C) {\n return (C.getRight() < this.xL);\n }", "boolean inBetween(float a, float b, float c){\n\t\tif (a<b && b<c)\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public void checaColision() {\n //Si el proyectil colisiona con la barra entonces..\n if (objBarra.colisiona(objProyectil)) {\n //Guardo el centro x del proyectil para no facilitar su comparacion\n int iCentroProyectil = objProyectil.getX()\n + objProyectil.getAncho() / 2;\n //Si el nivel de Y del lado inferior del proyectil es el mismo que\n //el nivel de Y del lado superior de la barra...\n if (objProyectil.getY() + objProyectil.getAlto()\n >= objBarra.getY()) {\n //Dividimos el ancho de la barra en 2 secciones que otorgan \n //diferente velocidad dependiendo que seccion toque el proyectil\n //Si el centro del proyectil toca la primera parte de la \n //barra o el lado izquierdo del proyectil esta mas a la \n //izquierda que el lado izquierdo de la barra...\n if ((iCentroProyectil > objBarra.getX() && iCentroProyectil\n < objBarra.getX() + objBarra.getAncho() / 2)\n || (objProyectil.getX() < objBarra.getX())) {\n bDireccionX = false; // arriba\n bDireccionY = false; // izquierda\n } //Si el centro del proyectil toca la ultima parte de la barra o\n //el lado derecho del proyectil esta mas a la derecha que el \n //lado derecho de la barra\n else if ((iCentroProyectil > objBarra.getX()\n + (objBarra.getAncho() / 2) && iCentroProyectil\n < objBarra.getX() + (objBarra.getAncho()\n - objBarra.getAncho() / 18)) || (objProyectil.getX()\n + objProyectil.getAncho() > objBarra.getX()\n + objBarra.getAncho())) {\n bDireccionX = true; // arriba\n bDireccionY = false; // derecha\n }\n }\n\n }\n for (Object objeBloque : lnkBloques) {\n Objeto objBloque = (Objeto) objeBloque;\n //Checa si la barra choca con los bloques (Choca con el poder)\n if(objBarra.colisiona(objBloque)) {\n bPoderes[objBloque.getPoder()] = true;\n }\n // Checa si el proyectil choca contra los bloques\n if (objBloque.colisiona(objProyectil)) {\n iScore++; // Se aumenta en 1 el score\n iNumBloques--; //Se resta el numero de bloques\n //Se activa el bloque con el poder para que se mueva para abajo\n if (objBloque.getPoder() != 0) {\n URL urlImagenPoder\n = this.getClass().getResource(\"metanfeta.png\");\n objBloque.setImagen(Toolkit.getDefaultToolkit()\n .getImage(urlImagenPoder));\n objBloque.setVelocidad(2);\n bAvanzaBloque = true;\n }\n if(objProyectil.colisiona(objBloque.getX(), \n objBloque.getY()) ||\n objProyectil.colisiona(objBloque.getX(), \n objBloque.getY()+objBloque.getAlto())) {\n objBloque.setX(getWidth() + 50);\n bDireccionX = false; //va hacia arriba\n }\n if(objProyectil.colisiona(objBloque.getX()+objBloque.getAncho(), \n objBloque.getY()) ||\n objProyectil.colisiona(objBloque.getX()+objBloque.getAncho(), \n objBloque.getY()+objBloque.getAlto())) {\n objBloque.setX(getWidth() + 50);\n bDireccionX = true; //va hacia arriba\n }\n //Si la parte superior de proyectil es mayor o igual a la parte\n //inferior del bloque(esta golpeando por abajo del bloque...\n if((objProyectil.getY() <= objBloque.getY() \n + objBloque.getAlto()) && (objProyectil.getY() \n + objProyectil.getAlto() > objBloque.getY() \n + objBloque.getAlto())) {\n objBloque.setX(getWidth() + 50);\n bDireccionY = true; //va hacia abajo\n \n \n }\n //parte inferior del proyectil es menor o igual a la de la parte\n //superior del bloque(esta golpeando por arriba)...\n else if(( objProyectil.getY() + objProyectil.getAlto()\n >= objBloque.getY())&&( objProyectil.getY() \n < objBloque.getY())) {\n objBloque.setX(getWidth() + 50);\n bDireccionY = false; //va hacia arriba\n }\n //Si esta golpeando por algun otro lugar (los lados)...\n else {\n objBloque.setX(getWidth()+50);\n bDireccionX = !bDireccionX;\n }\n }\n }\n //Si la barra choca con el lado izquierdo...\n if (objBarra.getX() < 0) {\n objBarra.setX(0); //Se posiciona al principio antes de salir\n } //Si toca el lado derecho del Jframe...\n else if (objBarra.getX() + objBarra.getAncho() - objBarra.getAncho() / 18\n > getWidth()) {\n objBarra.setX(getWidth() - objBarra.getAncho() + objBarra.getAncho()\n / 18);// Se posiciciona al final antes de salir\n }\n //Si el Proyectil choca con cualquier limite de los lados...\n if (objProyectil.getX() < 0 || objProyectil.getX()\n + objProyectil.getAncho() > getWidth()) {\n //Cambias su direccion al contrario\n bDireccionX = !bDireccionX;\n } //Si el Proyectil choca con la parte superior del Jframe...\n else if (objProyectil.getY() < 0) {\n //Cambias su direccion al contrario\n bDireccionY = !bDireccionY;\n } //Si el proyectil toca el fondo del Jframe...\n else if (objProyectil.getY() + objProyectil.getAlto() > getHeight()) {\n iVidas--; //Se resta una vida.\n // se posiciona el proyectil en el centro arriba de barra\n objProyectil.reposiciona((objBarra.getX() + objBarra.getAncho() / 2\n - (objProyectil.getAncho() / 2)), (objBarra.getY()\n - objProyectil.getAlto()));\n }\n }", "boolean ordered() {\n\t\treturn (this.left == null || (this.value > this.left.max().value && this.left.ordered()))\n\t\t\t\t&& (this.right == null || (this.value < this.right.min().value && this.right.ordered()));\n\t}", "int main()\n{\n int r, c, t, x = 0;\n cin>>r>>c>>t;\n for(int i = 1; i <= r; i++)\n {\n if (t == 2 * i)\n {\n cout<<\"It is a mango tree\";\n x = 1;\n break;\n }\n }\n for(int i = 1; i <= r; i++)\n {\n if (t == (c - 1) * i && x == 0)\n {\n cout<<\"It is a mango tree\";\n break;\n }\n else if(i == r && x == 0)\n cout<<\"It is not a mango tree\";\n }\n}", "public static boolean isContained(double a, double b, double c){\n\t\treturn ((a >= b && a <= c) || (a >= c && a <= b));\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint a,b,c,d;\n\t a = 50; b =20; c= 30; d=40;\n\t \n\t if (a>d) //true\n\t\t \n\t {\n\t if (d>b) //true\n\t {\n\t if (a>c) //true\n\t {\n\t\t if (c>b) //true\n\t\t {\n\t\t\t System.out.println(\"nested if condition true\");\n\t {\n\t System.out.println(\"nested if condition false\");\n\t} \n\t\t }\n\t }\n\t }\n }\n\n//eg 2\n\nint nu , nu1, nu2;\nnu = 100; nu1 = 200; nu2=300;\n if (nu<nu1 )\n System.out.println(\"nu is lesser\");\n { \n if(nu2>nu1)\n System.out.println(\"nu2 is grater\");\n {\n if (nu1>nu)\n System.out.println(\"nu1 is grater\");\n {\n System.out.println(\"netsred if got executed\");\t\n }\n }\n }\n {\n \tSystem.out.println(\"netsted if not got executed\");\t\n }\n \n \t}", "public static void main(String[] args) {\n \n Scanner T = new Scanner(System.in); \n int a,b,c;\n \n System.out.println(\"Ingresa el valor de A\");\n a = T.nextInt();\n System.out.println(\"Ingresa el valor de B\");\n b = T.nextInt();\n System.out.println(\"Ingresa el valor de C\");\n c = T.nextInt();\n \n /*Comparacion mayor*/\n if(a > b && a > c){\n System.out.println(\"El mayor es A con \"+a);\n }else if(b > a && b > c){\n System.out.println(\"El mayor es B con \"+b);\n }else{\n System.out.println(\"El mayor es C con \"+c);\n }\n \n /*Comparacion intermedio*/\n if(a> b && a<c || a<b && a>c){\n System.out.println(\"El intermedio es A \"+a);\n }else if(b > a && b<c || b<a && b>c){\n System.out.println(\"El intermedio es B \"+b);\n }else{\n System.out.println(\"El intermedio es C \"+c);\n\n }\n \n /*Comparacion menor*/\n if(a < b && a < c){\n System.out.println(\"El menor es A con\"+a);\n }else if(b < a && b < c){\n System.out.println(\"El menor es B con\"+b);\n }else{\n System.out.println(\"El menor es C con\"+c);\n }\n \n }", "public static void main(String[] args) {\n\n int a = 34;\n int b = 45;\n int c = 78;\n\n if (a >= b && a >= c)\n System.out.println(a + \" is a largest number\");\n else if (b >= a && b >= c)\n System.out.println(b + \" is a largest number\");\n else\n System.out.println(c + \" is a largest number\");\n}", "public boolean istrianglevalid(double semiPer) {\n //declare variables\n boolean checkA = true;\n boolean checkB = true;\n boolean checkC = true;\n \n if (semiPer >= sideA && semiPer >= sideB && semiPer >= sideC) {\n return true;\n } else {\n return false;\n }\n }", "boolean isPossible() {\n return (sideOne + sideTwo > sideThree) && (sideTwo + sideThree > sideOne) && (sideThree + sideOne > sideTwo);\n }", "public static void main(String[] args) {\n\t\t\n\t\tint x=300;\n\t\tint y=500;\n\t\tint z=500;\n\t\t\n\t\t//((x<y) && (x<z)) // logical expression in Java\n\t\t\n\t\t// (true && true) // the output is going to be true\n\t\t\n\t\t//((x==y) && (x>z))\n\t\t \n\t\t//( false && False) // the final output is going to be False\n\t\t//((x>y) && (x<z))\n\t\t \n\t\t//( false && true) // the final output is going to be False\t \n\t\t\n\t\t\n\t\tif((x==y)&&(x>z)) // compound condition\n{\n\tSystem.out.println(\"execute the block of code\");\n}\n\t\t\n\t\t\n\t\t\n\t\tboolean results= ((x<y)&&(x<z)); // true\n\t\tSystem.out.println(results);\n\t\t\n\t\t\n\t\t//OR operator ||\n\t\t\n\t\t// In case of OR operator, \n\t\t//if anyone of the relational expression is true, the final output is going to be true\n\t\t\n\t\t\n\t\t// x=400;\n\t\t// y=500;\n\t\t// z=400;\n\t\t \n\t\t\t//((x<y) || (x==z))\n\t\t\n\t\t// ( true || true) ----> true\n\t\t\n\t\t// false || true ----> TRUE\n\t\t\n\t\t// false || false----> false\n\t\t\n\t\t// True || False --->true\n\t\t\n\t\tint age= 30;\n\t\t\n\t\t if((age==30)||(age>18))\n\t\t {\n\t\t\t System.out.println(\"give the licence to customer\");\n\t\t }\n\t\t\n\t\t\n\t\t \n\t\t \n\t\t\n\t\t// Not operator ! - if the original value of the expression is true, and if we use ! operator on it, \n\t\t//the output will be changed to False\n\t\t\n\tint x1=100;\n\tint y1=50;\n\t\n\tif(!(x1==y1)) // x1 not equal to y1 ---true\n\t\t\n\t\t\n\t\t// !(x==y)\n\t\t\n\t{\n\t\tSystem.out.println(\"the output is true\");\n\t}\n\t\t// x>y --> 100>50 --->true\n\t\t \n\t\t//!(x>y) ---!(100>50) ---> False\n\t\t// 100 is not greater than 50 ---> false\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public boolean isDrooping() {\n return ((((this.leftTheta % 360) + 360) % 360) > 180)\n || ((((this.rightTheta % 360) + 360) % 360) > 180) \n || this.left.isDrooping()\n || this.right.isDrooping(); \n }", "private boolean cond4(Data C) {\n return (C.getTop() < this.yD);\n }", "private boolean canArcherHarrasing(Creature a) {\n return heroC.getX() == a.getX() || heroC.getY() == a.getY();\n }", "boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, Vector fbtVector)\n\t{\n\t\t/* RESOLVE - DistinctNodes are ordered on their RCLs.\n\t\t * Walk RCL to see if cr is 1st non-constant column in the\n\t\t * ordered result.\n\t\t */\n\t\treturn false;\n\t}", "public boolean inside(circle a, circle b)\r\n {\r\n \tdouble centDist = dist(a.x,a.y,b.x,b.y);\r\n \treturn centDist + a.r < b.r;\r\n }", "public int orientaceGrafu(){\n\t\tint poc = 0;\n\t\tfor(int i = 0 ; i < hrana.length ; i++){\n\t\t\tif(!oriNeboNeoriHrana(hrana[i].zacatek,hrana[i].konec))\n\t\t\t poc++;\n\t\t}\n\t\tif(poc == 0 )\n\t\t\treturn 0;\n\t\t\n\t\tif(poc == pocetHr)\n\t\t\treturn 1;\n\t\t\n\t\t\n\t\t\treturn 2;\n\t\t \n\t\t\n\t\t\t\t\t\n\t}", "boolean isCircular();", "private final Point tangent1G1(Point a, Point b, Point c) {\n\t\t// horizontale volgorde: a ... b ... c\n\t\tif (a.X() < b.X() && c.X() > b.X()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble rico = temp.Y() / temp.X(); // kan nooit nul zijn\n\t\t\tdouble d1 = b.X() - a.X();\n\t\t\ttemp = new Point((int) Math.floor(-d1), (int) Math.floor(-rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// horizontale volgorde: c ... b ... a\n\t\telse if (a.X() > b.X() && c.X() < b.X()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble rico = temp.Y() / temp.X(); // kan nooit nul zijn\n\t\t\tdouble d1 = a.X() - b.X();\n\t\t\ttemp = new Point((int) Math.floor(d1), (int) Math.floor(rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: a ... b ... c\n\t\telse if (a.Y() > b.Y() && c.Y() < b.Y()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble ricoInv = temp.X() / temp.Y(); // kan nooit nul zijn\n\t\t\tdouble d1 = a.Y() - b.Y();\n\t\t\ttemp = new Point((int) Math.floor(ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: c ... b ... a\n\t\telse if (a.Y() < b.Y() && c.Y() > b.Y()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble ricoInv = temp.X() / temp.Y(); // kan nooit nul zijn\n\t\t\tdouble d1 = b.Y() - a.Y();\n\t\t\ttemp = new Point((int) Math.floor(-ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(-d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// Beide tangentpunten liggen in eenzelfde kwadrant van het vlak t.o.v.\n\t\t// het punt b --> nu worden de eindpunten van de vector ac verplaatst,\n\t\t// overeenkomstig met de oorspronkelijke afstand tot b.\n\t\t//\n\t\t// Bvb.: a en c liggen onder b, a ligt verder van b dan c\n\t\t// --> het eerste eindpunt van de vector ac zal ook onder b\n\t\t// komen te liggen, het andere eindpunt zal boven b liggen.\n\t\telse {\n\t\t\t// verticale volgorde: b ... a ... c\n\t\t\tif (a.Y() > c.Y() && a.Y() <= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = (b.Y() - a.Y()) / (b.Y() - c.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: a ... c ... b\n\t\t\telse if (a.Y() > c.Y() && c.Y() >= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = 1.0 - (c.Y() - b.Y()) / (a.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: c ... a ... b\n\t\t\telse if (c.Y() > a.Y() && a.Y() >= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = (a.Y() - b.Y()) / (c.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: b ... c ... a\n\t\t\telse if (c.Y() > a.Y() && c.Y() <= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = 1.0 - (b.Y() - c.Y()) / (b.Y() - a.Y());\n\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}", "@Test\n\tpublic void parenthesses_should_notbalanced_expr()\n\t{\n\t\tString result=\"\";String expr=\"\";\n\t\t\n\t\texpr=\"(a+b(a+c)\";\n\t\t result=com.bridgelabz.util.DataStructure.BalanaceParenthes(expr);\n\t\tassertTrue(\"not balanced\", result!=\"balaced\");\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint x = 13;\n\t\tint y = 15;\n\t\tint z = 12;\n\t\t\n/*\t\tif(x>y && x>z) {\n\t\t}\n\t\t\n\t\tif (y>x && y>z) {\n\t\t}\n\t\t\n\t\tif(z>x && z>y) {\n\t\t}*/\n\t\t\n\t\t\n\t\tif(x>y && x>z) {\n\t\t\tSystem.out.println(\"X is greater\");\n\t\t}\n\t\telse if(y>z) {\n\t\t\tSystem.out.println(\"Y is greater\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"Z is greater\");\n\t\t}\n\t\t\n\t\t\n\t\t\n\n\t}", "private boolean hasCollided(Circle a, Polygon p) {\r\n //calculate the distance between the centers\r\n return p.getBoundsInParent().intersects(a.getBoundsInParent());\r\n\r\n }", "boolean foil_is_cylinder_or_ball (Foil foil) {\n return foil == FOIL_CYLINDER || foil == FOIL_BALL;\n }", "private int med3(double x[], int a, int b, int c) {\r\n return (x[a] < x[b]\r\n ? (x[b] < x[c] ? b : x[a] < x[c] ? c : a)\r\n : (x[b] > x[c] ? b : x[a] > x[c] ? c : a));\r\n }", "static boolean pointInCircumcircle2(PointDouble a, PointDouble b, PointDouble c, PointDouble p) {\n return ((a.x - p.x) * (b.y - p.y) * ((c.x - p.x) * (c.x - p.x) + (c.y - p.y) * (c.y - p.y)) +\n (a.y - p.y) * ((b.x - p.x) * (b.x - p.x) + (b.y - p.y) * (b.y - p.y)) * (c.x - p.x) +\n ((a.x - p.x) * (a.x - p.x) + (a.y - p.y) * (a.y - p.y)) * (b.x - p.x) * (c.y - p.y) -\n ((a.x - p.x) * (a.x - p.x) + (a.y - p.y) * (a.y - p.y)) * (b.y - p.y) * (c.x - p.x) -\n (a.y - p.y) * (b.x - p.x) * ((c.x - p.x) * (c.x - p.x) + (c.y - p.y) * (c.y - p.y)) -\n (a.x - p.x) * ((b.x - p.x) * (b.x - p.x) + (b.y - p.y) * (b.y - p.y)) * (c.y - p.y)) > 0.0;\n }", "public boolean checkCases(RBNode<T, E> node) {\r\n\t\t// case 1\r\n\t\tif (node.uniqueKey.compareTo(this.root.uniqueKey) == 0) {\r\n\t\t\tnode.color = 'b';\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t// case 2\r\n\t\tif (grandPNode(node).color == 'b') {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t// case 3\r\n\t\tif ((node.parent.color == 'r') && (uncleNode(node).color == 'r')) {\r\n\t\t\tnode.parent.color = 'b';\r\n\t\t\tuncleNode(node).color = 'b';\r\n\t\t\tgrandPNode(node).color = 'r';\r\n\t\t\tcheckCases(grandPNode(node));\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t// case 4\r\n\t\tif ((node.parent.color == 'r') && (uncleNode(node).color == 'b')) {\r\n\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) > 0)\r\n\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) < 0)) {\r\n\t\t\t\t// must be to the right of parent\r\n\t\t\t\tleftRotate(node.parent);\r\n\t\t\t\tnode = node.parent;\r\n\t\t\t}\r\n\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) < 0)\r\n\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) > 0)) {\r\n\t\t\t\trightRotate(node.parent);\r\n\t\t\t\tnode = node.parent;\r\n\t\t\t}\r\n\t\t\t// check case 5\r\n\t\t\tif ((node.parent.color == 'r') && (uncleNode(node).color == 'b')) {\r\n\t\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) < 0)\r\n\t\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) < 0)) {\r\n\t\t\t\t\tnode.parent.color = 'r';\r\n\t\t\t\t\trightRotate(grandPNode(node));\r\n\t\t\t\t}\r\n\t\t\t\tif ((node.uniqueKey.compareTo(node.parent.uniqueKey) > 0)\r\n\t\t\t\t\t\t&& (node.parent.uniqueKey.compareTo(grandPNode(node).uniqueKey) > 0)) {\r\n\t\t\t\t\tnode.parent.color = 'b';\r\n\t\t\t\t\tleftRotate(grandPNode(node));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public boolean isCircle();", "private static <T> int med3(T x[], Comparator<T> comp, int a, int b, int c) {\n\t\treturn (comp.compare(x[a],x[b])<0 ?\n\t\t\t\t(comp.compare(x[b],x[c])<0 ? b : comp.compare(x[a],x[c])<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x[b],x[c])>0 ? b : comp.compare(x[a],x[c])>0 ? c : a));\n\t}", "private static int med3(float x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private void ruleR1(Node a, Node b, Node c, Graph graph) {\n if (graph.isAdjacentTo(a, c)) {\n return;\n }\n\n if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, b, c)) {\n return;\n }\n\n graph.setEndpoint(c, b, Endpoint.TAIL);\n graph.setEndpoint(b, c, Endpoint.ARROW);\n }\n }", "public static void main(String[] args){\n \n Scanner in = new Scanner(System.in );\n \n int a;\n a = in.nextInt();\n \n int b;\n b = in.nextInt();\n \n int c;\n c = in.nextInt();\n \n int d;\n d = in.nextInt();\n \n /* 24 Combinations of ABCD in total (combination is reversed when printed so it is in increasing order) */\n \n // 1: ABCD \n if (a > b & b > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + b + \",\" + a);\n }\n \n // 2 ABDC \n else if (a > b & b > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + b + \",\" + a);\n }\n \n // 3 ACBD \n else if (a > c & c > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + c + \",\" + a);\n }\n \n // 4 ACDB \n else if (a > c & c > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + c + \",\" + a);\n }\n \n // 5 ADBC\n else if (a > d & d > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + d + \",\" + a);\n }\n \n // 6 ADCB\n else if (a > d & d > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + d + \",\" + a);\n }\n \n // 7 BACD \n else if (b > a & a > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + a + \",\" + b);\n }\n \n // 8 BADC\n else if (b > a & a > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + a + \",\" + b);\n }\n \n // 9 BDAC\n else if (b > d & d > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + d + \",\" + b);\n }\n \n // 10 BDCA\n else if (b > d & d > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + d + \",\" + b);\n }\n \n // 11 BCAD\n else if (b > c & c > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + c + \",\" + b);\n }\n \n // 12 BCDA\n else if (b > c & c > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + c + \",\" + b);\n }\n \n // 13 CABD\n else if (c > a & a > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + a + \",\" + c);\n }\n \n // 14 CADB\n else if (c > a & a > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + a + \",\" + c);\n }\n \n // 15 CBAD \n else if (c > b & b > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + b + \",\" + c);\n }\n \n // 16 CBDA\n else if (c > b & b > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + b + \",\" + c);\n }\n \n // 17 CDAB\n else if (c > d & d > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + d + \",\" + c);\n }\n \n // 18 CDBA\n else if (c > d & d > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + d + \",\" + c);\n }\n \n // 19 DABC\n else if (d > a & a > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + a + \",\" + d);\n }\n \n // 20 DACB\n else if (d > a & a > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + a + \",\" + d);\n }\n \n // 21 DBAC\n else if (d > b & b > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + b + \",\" + d);\n }\n \n // 22 DBCA\n else if (d > b & b > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + b + \",\" + d);\n }\n \n // 23 DCAB\n else if (d > c & c > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + c + \",\" + d);\n }\n \n // 24 DCBA\n else if (d > c & c > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + c + \",\" + d);\n }\n\n\n\n\n \n \n }", "public boolean atacar(Pokemon alvo) {\n\t\tif (tipo == FOGO) {\n\t\t\tswitch (alvo.getTipo()) {\n\t\t\tcase PLANTA:\n\t\t\t\treturn ataque * 2 >= alvo.getAtaque();\n\t\t\tcase AGUA:\n\t\t\t\treturn ataque >= alvo.getAtaque() * 2;\n\t\t\tcase ELETRICO:\n\t\t\t\treturn ataque >= alvo.getAtaque();\n\t\t\tdefault:\n\t\t\t\treturn ataque >= alvo.getAtaque();\n\t\t\t}\n\t\t} else if(tipo == PLANTA) {\n\t\t\tswitch (alvo.getTipo()) {\n\t\t\tcase PLANTA:\n\t\t\t\treturn ataque >= alvo.getAtaque();\n\t\t\tcase AGUA:\n\t\t\t\treturn ataque >= alvo.getAtaque();\n\t\t\tcase ELETRICO:\n\t\t\t\treturn ataque * 2 >= alvo.getAtaque();\n\t\t\tdefault:\n\t\t\t\treturn ataque >= alvo.getAtaque() * 2;\n\t\t\t}\n\t\t} else if(tipo == ELETRICO) {\n\t\t\tswitch (alvo.getTipo()) {\n\t\t\tcase PLANTA:\n\t\t\t\treturn ataque >= alvo.getAtaque();\n\t\t\tcase AGUA:\n\t\t\t\treturn ataque * 2 >= alvo.getAtaque();\n\t\t\tcase ELETRICO:\n\t\t\t\treturn ataque >= alvo.getAtaque();\n\t\t\tdefault:\n\t\t\t\treturn ataque >= alvo.getAtaque() * 2;\n\t\t\t}\n\t\t} else {\n\t\t\tswitch (alvo.getTipo()) {\n\t\t\tcase PLANTA:\n\t\t\t\treturn ataque >= alvo.getAtaque() ;\n\t\t\tcase AGUA:\n\t\t\t\treturn ataque >= alvo.getAtaque();\n\t\t\tcase ELETRICO:\n\t\t\t\treturn ataque >= alvo.getAtaque() * 2;\n\t\t\tdefault:\n\t\t\t\treturn ataque * 2 >= alvo.getAtaque();\n\t\t\t}\n\t\t}\n\t}", "private void ruleR2(Node a, Node b, Node c, Graph graph) {\n if (!graph.isAdjacentTo(a, c)) {\n return;\n }\n\n if (graph.getEndpoint(b, a) == Endpoint.TAIL && graph.getEndpoint(a, b) == Endpoint.ARROW\n && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, a, c)) {\n return;\n }\n\n graph.setEndpoint(a, c, Endpoint.ARROW);\n } else if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.TAIL\n && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE\n ) {\n if (!isArrowpointAllowed(graph, a, c)) {\n return;\n }\n\n graph.setEndpoint(a, c, Endpoint.ARROW);\n }\n }", "static boolean isStraight(ArrayList<Card> c)\n {\n if(c.size() < 5)\n {\n return false;\n }\n for(int x = 0 ; x < c.size()-1 ; x++)\n {\n int rank1 = c.get(x).getRank();\n int rank2 = c.get(x+1).getRank();\n \n if(rank1 != rank2 - 1)\n {\n return false;\n }\n }\n \n return true;\n }", "private void doDdpOrientation(Graph graph, Node l, Node a, Node b, Node c) {\n changeFlag = true;\n for (IonIndependenceFacts iif : separations) {\n if ((iif.getX().equals(l) && iif.getY().equals(c)) ||\n iif.getY().equals(l) && iif.getX().equals(c)) {\n for (List<Node> condSet : iif.getZ()) {\n if (condSet.contains(b)) {\n graph.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(graph);\n return;\n }\n }\n break;\n }\n }\n Graph newGraph1 = new EdgeListGraph(graph);\n newGraph1.setEndpoint(a, b, Endpoint.ARROW);\n newGraph1.setEndpoint(c, b, Endpoint.ARROW);\n discrimGraphs.add(newGraph1);\n Graph newGraph2 = new EdgeListGraph(graph);\n newGraph2.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(newGraph2);\n }", "private static boolean isAngleOK(double[] v, double[] w, double bend) {\n\t\t// |v| * |w| * sin(alpha) = |det(v, w)|\n\t\t// cos(alpha) = v . w / (|v| * |w|)\n\t\t// tan(alpha) = sin(alpha) / cos(alpha)\n\t\t// tan(alpha) = |det(v, w)| / v . w\n\n\t\t// small angle: tan(alpha) < MAX_BEND\n\t\t// |det(v, w)| / v . w < MAX_BEND\n\t\t// |det(v, w)| < MAX_BEND * (v . w)\n\n\t\tdouble innerProduct = 0;\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tinnerProduct += v[i] * w[i];\n\t\t}\n\t\tif (CurveSegmentPlotter.isUndefined(innerProduct)) {\n\t\t\treturn true;\n\t\t} else if (innerProduct <= 0) {\n\t\t\t// angle >= 90 degrees\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// angle < 90 degrees\n\t\t\t// small angle: |det(v, w)| < MAX_BEND * (v . w)\n\t\t\tdouble det;\n\t\t\tif (v.length < 3) {\n\t\t\t\tdet = Math.abs(v[0] * w[1] - v[1] * w[0]);\n\t\t\t} else {\n\t\t\t\tdouble d1 = v[0] * w[1] - v[1] * w[0];\n\t\t\t\tdouble d2 = v[1] * w[2] - v[2] * w[1];\n\t\t\t\tdouble d3 = v[2] * w[0] - v[0] * w[2];\n\t\t\t\tdet = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);\n\t\t\t}\n\t\t\treturn det < bend * innerProduct;\n\t\t}\n\t}", "private static int med3(double x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private final Point tangent2G1(Point a, Point b, Point c) {\n\t\t// horizontale volgorde: a ... b ... c\n\t\tif (a.X() < b.X() && c.X() > b.X()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble rico = temp.Y() / temp.X();\n\t\t\tdouble d1 = c.X() - b.X();\n\t\t\ttemp = new Point((int) Math.floor(d1), (int) Math.floor(rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// horizontale volgorde: c ... b ... a\n\t\telse if (a.X() > b.X() && c.X() < b.X()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble rico = temp.Y() / temp.X();\n\t\t\tdouble d1 = b.X() - c.X();\n\t\t\ttemp = new Point((int) Math.floor(-d1), (int) Math.floor(-rico * d1\n\t\t\t\t\t+ 0.5)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: a ... b ... c\n\t\telse if (a.Y() > b.Y() && c.Y() < b.Y()) {\n\t\t\tPoint temp = a.minus(c);\n\t\t\tdouble ricoInv = temp.X() / temp.Y();\n\t\t\tdouble d1 = b.Y() - c.Y();\n\t\t\ttemp = new Point((int) Math.floor(-ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(-d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// verticale volgorde: c ... b ... a\n\t\telse if (a.Y() < b.Y() && c.Y() > b.Y()) {\n\t\t\tPoint temp = c.minus(a);\n\t\t\tdouble ricoInv = temp.X() / temp.Y();\n\t\t\tdouble d1 = c.Y() - b.Y();\n\t\t\ttemp = new Point((int) Math.floor(ricoInv * d1 + 0.5), (int) Math\n\t\t\t\t\t.floor(d1)).plus(b);\n\t\t\treturn temp;\n\t\t}\n\t\t// Beide tangentpunten liggen in eenzelfde kwadrant van het vlak t.o.v.\n\t\t// het punt b --> nu worden de eindpunten van de vector ac verplaatst,\n\t\t// overeenkomstig met de oorspronkelijke afstand tot b.\n\t\t//\n\t\t// Bvb.: a en c liggen onder b, a ligt verder van b dan c\n\t\t// --> het eerste eindpunt van de vector ac zal ook onder b\n\t\t// komen te liggen, het andere eindpunt zal boven b liggen.\n\t\telse {\n\t\t\t// verticale volgorde: b ... a ... c\n\t\t\tif (a.Y() > c.Y() && a.Y() <= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = 1.0 - (b.Y() - a.Y()) / (b.Y() - c.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: a ... c ... b\n\t\t\telse if (a.Y() > c.Y() && c.Y() >= b.Y()) {\n\t\t\t\tPoint temp = a.minus(c);\n\t\t\t\tdouble factor = (c.Y() - b.Y()) / (a.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(-temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(-temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: c ... a ... b\n\t\t\telse if (c.Y() > a.Y() && a.Y() >= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = 1.0 - (a.Y() - b.Y()) / (c.Y() - b.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\t// verticale volgorde: b ... c ... a\n\t\t\telse if (c.Y() > a.Y() && c.Y() <= b.Y()) {\n\t\t\t\tPoint temp = c.minus(a);\n\t\t\t\tdouble factor = (b.Y() - c.Y()) / (b.Y() - a.Y());\n\t\t\t\ttemp = new Point((int) Math.floor(temp.X() * factor + 0.5),\n\t\t\t\t\t\t(int) Math.floor(temp.Y() * factor + 0.5)).plus(b);\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}", "protected String comprobarConsumoEnergetico(Letra letra){\r\n if(getConsumoEnergetico() == Letra.A | getConsumoEnergetico() == Letra.B | getConsumoEnergetico() == Letra.C \r\n | getConsumoEnergetico() == Letra.D | getConsumoEnergetico() == Letra.E | getConsumoEnergetico() == Letra.F){\r\n return \"Consumo energetico correcto; letra correcta\";\r\n }\r\n else{\r\n return \"Consumo energetico incorrecto; letra erronea\";\r\n }\r\n}", "private static int med3(char x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "public static void main(String[] args) {\n int i = 140;\n int j = 150;\n int k = 200;\n\n if (i>j){\n System.out.println(\"I is greater then J\");\n }\n else {\n System.out.println(\"I is Less then J \");\n }\n\n System.out.println(\"------------------------//Example of multiple conditions...---------------------------------------\");\n if (k>j){\n System.out.println(\"K is greater then J\");\n }\n else if (j==k){\n System.out.println(\"I is Equal to K\");\n }\n else {\n System.out.println(\"I is Less then to K \");\n }\n }", "void object_calculations_touch_ground(){\n\n if (down_angle < 0 && up_angle > 0)//base case\n {\n double temp = up_angle;\n up_angle = down_angle;\n down_angle = temp;\n base_case();\n } else if ((down_angle > 0 && up_angle > 0) && (down_angle < up_angle))//smaller object\n {\n double temp = up_angle;\n up_angle = down_angle;\n down_angle = temp;\n measure_small_object();\n } else if (up_angle < 0 && down_angle > 0)//base case\n base_case();\n else //smaller object\n measure_small_object();\n }", "boolean isComposite();", "boolean isComposite();", "private static String findLargest(ComparableCircle S3, ComparableCircle S4) {\n String S = \" \";\n if (S3.compareTo(S4) > 0) {\n S = \"The first circle area is large.\";\n } else if (S3.compareTo(S4) < 0) {\n S = \"The second circle area is large.\";\n } else {\n S = \"Both the areas are equal\";\n }\n\n return S;\n }", "public boolean isDrooping() {\n return (((this.theta % 360) + 360) % 360) > 180\n || tree.isDrooping();\n }", "public static void main(String[] args) {\nint x=100;\r\nint y = 60;\r\nint z= 20;\r\nint w= 50;\r\nif (x>y && x>z&& x>w) {\r\n\tSystem.out.println(\"x is the largest\");\r\n}\r\nelse if (y>z && y>w) {\r\n\tSystem.out.println(\"y is the largest\");\r\n}\r\nelse if (z>w) {\r\n\tSystem.out.println(\"z is the largest\");\r\n}\r\nelse\r\n{\r\nSystem.out.println(\"w is the largest\");\t\r\n}\r\n}", "private boolean colisionEstorbos(){\r\n\t\tif(game.estorbo1.getBounds().intersects(getBounds())){\r\n\t\t\tasignarVelocidad(game.estorbo1, rebotes1);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tif(game.estorbo2.getBounds().intersects(getBounds())){\r\n\t\t\tasignarVelocidad(game.estorbo2, rebotes2);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tif(game.estorbo3.getBounds().intersects(getBounds())){\r\n\t\t\tasignarVelocidad(game.estorbo3, rebotes3);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "boolean isCommutative();", "@Override\r\n\tpublic double area() {\n\r\n\t\tif (cube1.area()>cube2.area()) {\r\n\t\r\nc double volume() {\r\n\t\t\t\treturn super.area() * iDepth;\r\n\t\t\t}\r\n\t\t\t@Override\r\n\t\t\tpublic double perimeter() throws UnsupportedOperationException{\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\t\tpublic class SortByArea implements Comparator<Cuboid>{\r\n\r\n\t\t\t\tSortByArea() {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic int compare(Cuboid cub1, Cuboid cub2) {\r\n\t\t\t\t\tif (cub1.area() > cub2.area()) {\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t} else if(cub1.area() < cub2.area()) {\r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\t\tpublic class SortByVolume implements Comparator<Cuboid>{\r\n\r\n\t\t\t\tSortByVolume() {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic int compare(Cuboid cub1, Cuboid cub2) {\r\n\t\t\t\t\tif (cub1.volume() > cub2.volume()) {\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t} else if(cub1.volume() < cub2.volume()) {\r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\treturn 0;\r\n\t\r\n}\r\n}", "Boolean isCollinearTo(IVec3 v);", "private GridPiece getOppositeActive() {\n\n\t\t/*System.out.println(\"GS| origin row: \" + origin.row);\n\t\tSystem.out.println(\"GS| origin col: \" + origin.column);\n\t\tSystem.out.println(\"GS| origin center x,y: \" + origin.getCenter());*/\n\n\n if (game.gridPieces[game.getGridPiece(touchPos)] == origin) {\n return origin;\n }\n float degrees;\n\n // Get degrees\n degrees = MathUtils.atan2(touchPos.y - origin.getCenter().y, touchPos.x - origin.getCenter().x);\n\n float quarterPi = 0.78539816339f;\n\n if (!originOpposite.contains(falsePiece)) {\n for (GridPiece gridPiece : originOpposite) {\n\n //System.out.println(\"GS| degrees: \" + degrees);\n\t\t\t/*System.out.println(\"GS| gridpiece row: \" + gridPiece.row);\n\t\t\tSystem.out.println(\"GS| gridpiece col: \" + gridPiece.column);\n\t\t\tSystem.out.println(\"GS| gridpiece center x,y: \" + gridPiece.getCenter());*/\n\n // Right\n if (degrees >= 0 && degrees < quarterPi || degrees < 0 && degrees >= -quarterPi) {\n if (gridPiece.row == origin.row && gridPiece.getCenter().x > origin.getCenter().x) {\n return gridPiece;\n }\n }\n\n // Down\n else if (degrees <= -quarterPi && degrees > -quarterPi * 3) {\n if (gridPiece.column == origin.column && gridPiece.getCenter().y < origin.getCenter().y) {\n return gridPiece;\n }\n }\n\n // Left\n else if (degrees > quarterPi * 3 && degrees <= quarterPi * 4\n || degrees < -quarterPi * 3 && degrees >= -quarterPi * 4) {\n if (gridPiece.row == origin.row && gridPiece.getCenter().x < origin.getCenter().x) {\n return gridPiece;\n }\n }\n\n // Up\n else if (degrees >= quarterPi && degrees < quarterPi * 3) {\n if (gridPiece.column == origin.column && gridPiece.getCenter().y > origin.getCenter().y) {\n return gridPiece;\n }\n }\n\n }\n }\n return origin;\n }", "public void testEquals() {\r\n\t\t// direct circle\r\n\t\tCircleArc2D arc0 = new CircleArc2D();\r\n\t\tCircle2D circle = new Circle2D(0, 0, 1, true);\r\n\t\tCircleArc2D arc1 = new CircleArc2D(circle, 0, PI/2);\r\n\t\tCircleArc2D arc2 = new CircleArc2D(circle, 0, PI/2, true);\r\n\t\tCircleArc2D arc3 = new CircleArc2D(0, 0, 1, 0, PI/2);\r\n\t\tCircleArc2D arc4 = new CircleArc2D(0, 0, 1, 0, PI/2, true);\r\n\t\tassertTrue(arc1.equals(arc0));\r\n\t\tassertTrue(arc1.equals(arc2));\r\n\t\tassertTrue(arc1.equals(arc3));\r\n\t\tassertTrue(arc1.equals(arc4));\r\n\r\n\t\t// direct circle, with different angles\r\n\t\tcircle = new Circle2D(0, 0, 1, true);\r\n\t\tarc1 = new CircleArc2D(circle, PI/2, PI/2);\r\n\t\tarc2 = new CircleArc2D(circle, PI/2, PI, true);\r\n\t\tarc3 = new CircleArc2D(0, 0, 1, PI/2, PI/2);\r\n\t\tarc4 = new CircleArc2D(0, 0, 1, PI/2, PI, true);\r\n\t\tassertTrue(arc1.equals(arc2));\r\n\t\tassertTrue(arc1.equals(arc3));\r\n\t\tassertTrue(arc1.equals(arc4));\r\n\t\t\r\n\t\t// indirect circle, with different angles\r\n\t\tcircle = new Circle2D(0, 0, 1, true);\r\n\t\tarc1 = new CircleArc2D(circle, PI/2, -PI/2);\r\n\t\tarc2 = new CircleArc2D(circle, PI/2, 2*PI, false);\r\n\t\tarc3 = new CircleArc2D(0, 0, 1, PI/2, -PI/2);\r\n\t\tarc4 = new CircleArc2D(0, 0, 1, PI/2, 2*PI, false);\r\n\t\tassertTrue(arc1.equals(arc2));\r\n\t\tassertTrue(arc1.equals(arc3));\r\n\t\tassertTrue(arc1.equals(arc4));\r\n\t}", "private boolean procesoComer(int a, int b)\n {\n ArrayList<Integer> muertes;\n muertes = animales.get(a).get(b).come();\n if (muertes.get(0) > krill) {\n krill = 0;\n return false;\n } else {\n krill -= muertes.get(0);\n }\n for (int i = 1; i < muertes.size(); i++) {\n for (int j = 0; j < muertes.get(i); j++) {\n if (animales.get(i).size() > 0) {\n animales.get(i).get(0).destruir(); //Reduce en 1 la cantidad\n animales.get(i).remove(0);\n } else {\n return false;\n }\n }\n }\n return true;\n }", "AngleSmaller createAngleSmaller();", "public static boolean isCompound(String a, String b) {\n\t\t\n\t\tboolean test = false;\n\n\t\tString[] acompounds = a.split(\"(?<=.)(?=\\\\p{Lu})\");\n\t\tString[] bcompounds = b.split(\"(?<=.)(?=\\\\p{Lu})\");\n\t\t\n\t\tSystem.out.println(\"length-1: \" + bcompounds[bcompounds.length-1]);\n\t\tSystem.out.println(\"length-2: \" + bcompounds[bcompounds.length-2]);\n\t\tSystem.out.println(\"length-3: \" + bcompounds[bcompounds.length-3]);\n\n\t\tif (acompounds.length > 2 && bcompounds.length > 2) {\n\t\t\t\n\t\t\tSystem.err.println(\"true\");\n\n\t\t\t//if (RadioNavigationAid.equals(Aid) || (RadioNavigationAid.equals(X|X|Aid)\n\t\t\tif (b.equals(acompounds[acompounds.length-1]) || b.equals(acompounds[acompounds.length-1]+acompounds[acompounds.length-2] + acompounds[acompounds.length-3])) {\n\n\t\t\t\ttest = true;\t\t\t\t\n\t\t\t} \n\t\t\t\n\t\t\t//if (NavigationAid.equals(Aid) || (NavigationAid.equals(Radio|Navigation|Aid)\n\t\t\tSystem.out.println(\"Trying: \" + a + \" = \" + bcompounds[bcompounds.length-1]);\n\t\t\tif (a.equals(bcompounds[bcompounds.length-1]) || a.equals(bcompounds[bcompounds.length-1]+bcompounds[acompounds.length-2] + bcompounds[bcompounds.length-3])) {\n\t\t\t\t\n\t\t\t\ttest = true;\n\t\t\t}\n\t\t\t\n\t\t\t//if (NavigationAid.equals(NavigationAid) || (NavigationAid.equals(Radio|Navigation|Aid)\n\t\t\tSystem.out.println(\"Trying: \" + a + \" = \" + bcompounds[bcompounds.length-1]);\n\t\t\tif (a.equals(bcompounds[bcompounds.length-1]) || a.equals(bcompounds[bcompounds.length-3]+bcompounds[acompounds.length-2] + bcompounds[bcompounds.length-1])) {\n\t\t\t\t\n\t\t\t\ttest = true;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t else if (acompounds.length > 1) {\n\n\t\t\tif (b.equals(acompounds[acompounds.length-1]) || b.equals(acompounds[acompounds.length-1]+acompounds[acompounds.length-2])) {\n\n\t\t\t\ttest = true;\n\t\t\t}\n\t\t}\n\t\treturn test;\n\n\t}", "public static CommonAxiom commutativity(Relation r){\n\t\t//build nodes\n\t\tFormulaTree allX = new FormulaTree(new UniversalQuantifier('x'));\n\t\tFormulaTree allY = new FormulaTree(new UniversalQuantifier('y'));\n\t\tFormulaTree allZ = new FormulaTree(new UniversalQuantifier('z'));\n\t\tFormulaTree iff = new FormulaTree (new Iff());\n\t\tFormulaTree left = new FormulaTree(new Predicate(r, new char[]{'x','y','z'}));\n\t\tFormulaTree right = new FormulaTree(new Predicate(r, new char[]{'y','x','z'}));\n\t\t\n\t\t//construct tree\n\t\tallX.setRight(null);\n\t\tallX.setLeft(allY);\n\t\tallY.setRight(null);\n\t\tallY.setLeft(allZ);\n\t\tallZ.setRight(null);\n\t\tallZ.setLeft(iff);\n\t\tiff.setLeft(left);\n\t\tiff.setRight(right);\n\t\t//predicate nodes already set null by constructor\n\t\t\n\t\t//return top node\n\t\treturn new CommonAxiom(allX, \"commutativity (\" + r.name() + \")\");\n\t}", "@Test\n public void compareTo_right() throws Exception {\n\n Full b5p7 = new Full(cardsB7p5);\n Full b8p5 = new Full(cardsB8P5);\n Full b8p5mixed = new Full(cardsB8P5mixed);\n Paire pair = new Paire(cardsPair);\n QuinteFlush quinteFlush = new QuinteFlush(cardsQuinteFlush);\n\n //b5p7 < b8p5\n assertEquals(-1, b5p7.compareTo(b8p5));\n //b8p5 = b8p5\n assertEquals(0, b8p5mixed.compareTo(b8p5));\n //b8p5 > b5p7\n assertEquals(1, b8p5.compareTo(b5p7));\n // full > paire\n assertEquals(1, b5p7.compareTo(pair));\n //full< QuiteFlush\n assertEquals(-1, b5p7.compareTo(quinteFlush));\n\n }", "public boolean isCompatible(Complexity c) {\n return this == UNKNOWN || c == UNKNOWN ||\n (betterOrEqual(P) && c.betterOrEqual(P)) ||\n equals(c);\n }", "private boolean reachablePathFindOrient(Graph graph, Node a, Node b, Node c,\n LinkedList<Node> reachable) {\n Set<Node> cParents = new HashSet<>(graph.getParents(c));\n\n // Needed to avoid cycles in failure case.\n Set<Node> visited = new HashSet<>();\n visited.add(b);\n visited.add(c);\n\n // We don't want to include a,b,or c on the path, so they are added to\n // the \"visited\" set. b and c are added explicitly here; a will be\n // added in the first while iteration.\n while (reachable.size() > 0) {\n Node x = reachable.removeFirst();\n visited.add(x);\n\n // Possible DDP path endpoints.\n List<Node> pathExtensions = graph.getNodesInTo(x, Endpoint.ARROW);\n pathExtensions.removeAll(visited);\n\n for (Node l : pathExtensions) {\n\n // If l is reachable and not adjacent to c, its a DDP\n // endpoint, so do DDP orientation. Otherwise, if l <-> c,\n // add l to the list of reachable nodes.\n if (!graph.isAdjacentTo(l, c)) {\n\n // Check whether <a, b, c> should be reoriented given\n // that l is not adjacent to c; if so, orient and stop.\n doDdpOrientation(graph, l, a, b, c);\n return true;\n } else if (cParents.contains(l)) {\n if (graph.getEndpoint(x, l) == Endpoint.ARROW) {\n reachable.add(l);\n }\n }\n }\n }\n return false;\n }", "private float findRotation()\r\n\t{\r\n\t\t//conditionals for all quadrants and axis\r\n\t\tif(tarX > 0 && tarY > 0)\r\n\t\t{\r\n\t\t\trotation = (float) Math.atan((tarY/tarX));\r\n\t\t\trotation = (float) ((rotation*180)/Math.PI);\r\n\t\t}\r\n\t\telse if(tarX < 0 && tarY > 0)\r\n\t\t{\r\n\t\t\trotation = (float) Math.atan((tarY/tarX));\r\n\t\t\trotation = (float) ((rotation*180)/Math.PI);\r\n\t\t\trotation = 180 - Math.abs(rotation);\r\n\t\t}\r\n\t\telse if(tarX < 0 && tarY < 0)\r\n\t\t{\r\n\t\t\trotation = (float) Math.atan((tarY/tarX));\r\n\t\t\trotation = (float) ((rotation*180)/Math.PI);\r\n\t\t\trotation = 180 + Math.abs(rotation);\r\n\t\t}\r\n\t\telse if(tarX > 0 && tarY < 0)\r\n\t\t{\r\n\t\t\trotation = (float) Math.atan((tarY/tarX));\r\n\t\t\trotation = (float) ((rotation*180)/Math.PI);\r\n\t\t\trotation = 90 - Math.abs(rotation);\r\n\t\t\trotation = 270 + rotation;\r\n\t\t}\r\n\t\telse if(tarX > 0 && tarY == 0)\r\n\t\t\trotation = 0;\r\n\t\telse if(tarX == 0 && tarY > 0)\r\n\t\t\trotation = 90;\r\n\t\telse if(tarX < 0 && tarY == 0)\r\n\t\t\trotation = 180;\r\n\t\telse if(tarX == 0 && tarY < 0)\r\n\t\t\trotation = 270;\r\n\t\t\r\n\t\treturn (rotation - 90);\r\n\t}", "public static void main(String [] args){\n double a= 5+(4*5)/5;\n double b= (6*4%2)+15;\n System.out.println(\"a = \"+a);\n System.out.println(\"b = \"+b); \n \n //Ejemplo de operadores relacionales.\n boolean resultado1= a > b;\n boolean resultado2= a !=b; \n System.out.println(\"R1= \"+resultado1);\n System.out.println(\"R2= \"+resultado2); \n }", "public boolean isHigher(Operator o){\n if(indent > o.indent){\n return true;\n }else{\n return prec > o.prec;\n }\n }", "public int angleOX() {\n if (B.getY() == A.getY()) {\r\n return 0;\r\n } else if (A.getX() == B.getX()) {\r\n return 90;\r\n }\r\n else {\r\n float fi = ((float) (B.getY() - A.getY()) / (B.getX() - A.getX()));\r\n if (fi<0){\r\n return (int)(fi*(-1));\r\n }\r\n else return (int)(fi);\r\n }\r\n }", "public boolean bordoOpposto(Casella c, int col)\n {\n switch (col)\n {\n case NERO: return ( c.riga==(DIM_LATO-1) );\n case BIANCO: return ( c.riga==0 );\n }\n return false;\n }", "public static void main(String[] args) {\n int a = 1;\n int b = 2;\n if (a < b){\n System.out.println(\"a is less than b\");\n }\n\n // write your code below\n int red = 10;\n int blue = 20;\n\n if (red > blue) {\n System.out.println(\"red is greater than blue\");\n }\n else {\n System.out.println(\"false\");\n }\n\n if (blue >= red) {\n System.out.println(\"blue is greater than or equal to red\");\n }\n\n if (red < blue) {\n System.out.println(\"red is less than blue\");\n }\n\n if (red <= blue) {\n System.out.println(\"red is less than or equal to blue\");\n }\n\n if (red == blue) {\n System.out.println(\"red equals blue\");\n }\n else {\n System.out.println(\"false\");\n }\n\n\n }", "@Test\n public void complex_isBalanced() {\n BinaryTree.Node n4 = new BinaryTree.Node(4);\n BinaryTree.Node n3 = new BinaryTree.Node(3);\n n3.setLeft(n4);\n\n BinaryTree.Node n6 = new BinaryTree.Node(6);\n BinaryTree.Node n7 = new BinaryTree.Node(7);\n BinaryTree.Node n5 = new BinaryTree.Node(5);\n n5.setLeft(n6);\n n5.setRight(n7);\n\n BinaryTree.Node n2 = new BinaryTree.Node(2);\n n2.setLeft(n3);\n n2.setRight(n5);\n\n BinaryTree.Node n9 = new BinaryTree.Node(9);\n BinaryTree.Node n8 = new BinaryTree.Node(8);\n n8.setRight(n9);\n\n BinaryTree.Node n1 = new BinaryTree.Node(1);\n n1.setLeft(n2);\n n1.setRight(n8);\n\n assertTrue(BinaryTreeIsBalanced.isBalanced(new BinaryTree(n1)));\n assertTrue(BinaryTreeIsBalancedNonOO.isBalanced(n1));\n }", "private boolean noangles() {\r\n return OPT(GO() && NOT(GO() && CHAR('>')) && literal() && noangles());\r\n }", "private static int sign(S2Point a, S2Point b, S2Point c, S2Point aCrossB) {\n // assert (isUnitLength(a) && isUnitLength(b) && isUnitLength(c));\n int ccw = triage(aCrossB, c);\n if (ccw == 0) {\n ccw = S2Predicates.Sign.expensive(a, b, c, true);\n }\n return ccw;\n }", "private int compareToFronteras(Pares f){\n\t\t\tint devolucion=0;\n\t\t\t\n\t\t\tif(this.distancia<f.getDistancia()){\n\t\t\t\tdevolucion=1;\n\t\t\t}else if(this.distancia==f.getDistancia()){\n\t\t\t\tdevolucion=0;\n\t\t\t}else if(this.distancia>f.getDistancia()){\n\t\t\t\tdevolucion=-1;\n\t\t\t}\n\t\t\t\n\t\t\treturn devolucion;\n\t\t}", "public boolean estaoDentroDoRaio(double raio,GPS a2,GPS a3){\n return this.distancia(a2)<raio && this.distancia(a3)<raio;\n }", "private static int med3(int x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private static boolean needsConsolidation(final Cigar c) {\n if ( c.numCigarElements() <= 1 )\n return false; // fast path for empty or single cigar\n\n CigarOperator lastOp = null;\n for( final CigarElement cur : c.getCigarElements() ) {\n if ( cur.getLength() == 0 || lastOp == cur.getOperator() )\n return true;\n lastOp = cur.getOperator();\n }\n\n return false;\n }", "boolean isFacingOut(float[] a, float[] b, float[] c, float[] d) {\n // the vector to center of face! genius!\n return a[2] + b[2] + c[2] + d[2] > 0;\n }", "public static void main(String[] args) {\n Circle[] circles = new Circle[3];\n circles[0] = new Circle(3.6);\n circles[1] = new Circle();\n circles[2] = new Circle(3.5, \"indigo\", false);\n System.out.println(\"Pre-sorted: \");\n for (Circle circle:circles){\n System.out.println(circle);\n }\n\n Comparator circleComparator = new CircleComparator();\n Arrays.sort(circles,circleComparator);\n\n System.out.println(\"After-sorted: \");\n for (Circle circle:circles){\n System.out.println(circle);\n }\n /*ComparableCircle[] circles= new ComparableCircle[3];\n circles[0]= new ComparableCircle(3.6);\n circles[1]=new ComparableCircle();\n circles[2]=new ComparableCircle(\"blue\",true,3.4);\n System.out.println(\"Pre-sorted:\");\n for(ComparableCircle circle:circles) {\n System.out.println(circle);\n }\n System.out.println(circles[0].compareTo(circles[1]));\n System.out.println(circles[1].compareTo(circles[2]));\n System.out.println(circles[0].compareTo(circles[2]));\n\n Arrays.sort(circles);\n\n System.out.println(\"After-sorted: \");\n for(ComparableCircle circle:circles){\n System.out.println(circle);\n }*/\n }", "public boolean magtacTest(double ma, double ac) {\r\n\t boolean magtac2 = true;\r\n\t if (ac > ma) magtac2 = false;\r\n\t\t \r\n\t if (magtac2 != magtac) {\r\n\t\t // System.out.println(ma + \" \" + ac + \" true\");\r\n\t\t \r\n\t\t if (magtac == true) {\r\n\t\t\t magtac = false;\r\n\t\t\t return true;\r\n\t\t }\r\n\t\t magtac = true;\r\n\t\t return true;\r\n\t }\r\n\t // System.out.println(ma + \" \" + ac + \" false\");\r\n\t return false;\r\n }", "@Test\n\tpublic void testCollideC(){\n\t\tPosture po = new Posture (1, 0, 0);\n\t\tCercle c = new Cercle(new Point(0,0), 20);\n\t\tCapteur_sal Cap= new Capteur_sal(po);\n\t\tassertTrue(Cap.collideC(c));\n\t\tPosture po1 = new Posture (12.5, 0, 0);\n\t\tCap.setPos(po1);\n\t\tassertTrue(Cap.collideC(c));\n\t\tpo1 = new Posture (12.6, 0, 0);\n\t\tCap.setPos(po1);\n\t\tassertFalse(Cap.collideC(c));\n\t\tpo1 = new Posture (-12.5, 0, 0);\n\t\tCap.setPos(po1);\n\t\tassertTrue(Cap.collideC(c));\n\t\tpo1 = new Posture (-12.6, 0, 0);\n\t\tCap.setPos(po1);\n\t\tassertFalse(Cap.collideC(c));\n\t\tpo1 = new Posture (0, 12.5, 0);\n\t\tCap.setPos(po1);\n\t\tassertTrue(Cap.collideC(c));\n\t\tpo1 = new Posture (0, 12.6, 0);\n\t\tCap.setPos(po1);\n\t\tassertFalse(Cap.collideC(c));\n\t\tpo1 = new Posture (0, -12.5, 0);\n\t\tCap.setPos(po1);\n\t\tassertTrue(Cap.collideC(c));\n\t\tpo1 = new Posture (0, -12.6, 0);\n\t\tCap.setPos(po1);\n\t\tassertFalse(Cap.collideC(c));\n\t\t\n\t\tpo.setX(0);\n\t\tpo.setY(2);\n\t\tpo1.setX(0);\n\t\tpo1.setY(0);\n\t\tassertTrue(Cap.collideC(c));\n\t\tpo1.setY(-5);\n\t\tassertTrue(Cap.collideC(c));\n\t}", "private static <T> int med3(List<T> x, Comparator<T> comp, int a, int b, int c) {\n\t\treturn (comp.compare(x.get(a),x.get(b))<0 ?\n\t\t\t\t(comp.compare(x.get(b),x.get(c))<0 ? b : comp.compare(x.get(a),x.get(c))<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x.get(b),x.get(c))>0 ? b : comp.compare(x.get(a),x.get(c))>0 ? c : a));\n\t}", "private boolean hasCollided(Circle a, Circle b) {\r\n //calculate the distance between the centers\r\n double dist = Math.sqrt(Math.pow(a.getCenterX() - b.getCenterX(), 2) + Math.pow(a.getCenterY() - b.getCenterY(), 2));\r\n double rads = a.getRadius() + b.getRadius();\r\n\r\n //if the distance between the centers is less than the 2 radius\r\n //they have collided. \r\n return dist < rads;\r\n }", "public int compareTo(Rectangulo r)\n\t{\n\t\treturn ((Integer)alto).compareTo(r.getAlto());\n\t}", "public boolean intercepta(Circulo circle) {\n\t\treturn centro.distancia(circle.centro()) <= raio + circle.raio();\r\n\t}", "public void CheckCollision(Ball b){\n\n if( b.getDirX() < 0f ){\n if( (b.getPosX() - b.getSizeX() ) < px + sx){\n //if we're in the upper \n if( b.getPosY() > py+sy/2 && b.getPosY() < py+sy){\n b.setDirX(-b.getDirX());\n b.setDirY(b.getDirY() + .25f);\n }\n //if we are in the lower\n else if( b.getPosY() < py-sy/2 && b.getPosY() > py-sy){\n b.setDirX(-b.getDirX());\n b.setDirY(b.getDirY() - .25f); \n }\n else if( b.getPosY() > py-sy && b.getPosY() < py+sy)\n b.setDirX(-b.getDirX());\n b.setVelocity(b.getVelocity() * 1.10f);\n } \n }else{\n if( (b.getPosX() + b.getSizeX() ) > px - sx){\n //if we're in the upper \n if( b.getPosY() > py+sy/2 && b.getPosY() < py+sy){\n b.setDirX(-b.getDirX());\n b.setDirY(b.getDirY() + .25f);\n }\n //if we are in the lower\n else if( b.getPosY() < py-sy/2 && b.getPosY() > py-sy){\n b.setDirX(-b.getDirX());\n b.setDirY(b.getDirY() - .25f); \n }\n else if( b.getPosY() > py-sy && b.getPosY() < py+sy)\n b.setDirX(-b.getDirX());\n b.setVelocity(b.getVelocity() * 1.10f);\n }\n }\n }", "public void collissions(int x, int y, int z, \n int xWidth, int yWidth, int zWidth) {\n LinkedNode first = tail;\n LinkedNode second = first.previous();\n while (first.previous() != null) {\n while (second != null) {\n int xCoordinate;\n int yCoordinate;\n int zCoordinate;\n if (first.value().getXorig() > second.value().getXorig()) {\n xCoordinate = first.value().getXorig();\n } \n else {\n xCoordinate = second.value().getXorig();\n }\n if (first.value().getYorig() > second.value().getYorig()) {\n yCoordinate = first.value().getYorig();\n } \n else {\n yCoordinate = second.value().getYorig();\n }\n if (first.value().getZorig() > second.value().getZorig()) {\n zCoordinate = first.value().getZorig();\n } \n else {\n zCoordinate = second.value().getZorig();\n }\n if ((x <= xCoordinate && xCoordinate <= (x + xWidth))\n && (y <= yCoordinate && yCoordinate <= (y + yWidth))\n && (z <= zCoordinate && zCoordinate <= (z + zWidth))) {\n System.out.print(first.value().toString() + \" and \");\n System.out.println(second.value().toString());\n }\n second = second.previous();\n }\n first = first.previous();\n second = first.previous();\n }\n }", "public static void main (String[] args) {\n\n Integer a=7,b=4,c=10,d=18;\n\n if (a > b) {\n if(a > c){\n if (a >d){\n System.out.println(a+ \" is biggest\");\n }\n }\n }\n\n if (b > c) {\n if(b > d){\n if (b >a){\n System.out.println(b+ \" is biggest\");\n }\n }\n }\n\n if (c > b) {\n if(c > a){\n if (c >d){\n System.out.println(c+\" is biggest\");\n }\n }\n }\n\n if (d > b) {\n if(d > c){\n if (d >a){\n System.out.println(d+\" is biggest\");\n }\n }\n }\n }" ]
[ "0.5738367", "0.563813", "0.5464553", "0.54461217", "0.5369082", "0.5368818", "0.5368192", "0.5358545", "0.5351269", "0.53036946", "0.52188593", "0.51997876", "0.51858735", "0.51578873", "0.50948757", "0.5037303", "0.50127745", "0.49901175", "0.4986831", "0.4972258", "0.4965471", "0.49510333", "0.49464396", "0.49366078", "0.49150974", "0.4909982", "0.49071592", "0.49031517", "0.48972952", "0.48962295", "0.48882282", "0.48864076", "0.48862565", "0.48855856", "0.48808762", "0.48667973", "0.4858316", "0.484676", "0.48437324", "0.4831737", "0.48251164", "0.47865918", "0.47761962", "0.47757486", "0.47678447", "0.47674084", "0.47661564", "0.47636878", "0.47622496", "0.47616696", "0.47541633", "0.47515017", "0.47425327", "0.47331172", "0.47275624", "0.47207564", "0.47206524", "0.4716018", "0.47069636", "0.47069636", "0.4699403", "0.46966118", "0.46889558", "0.46832654", "0.46829504", "0.46757007", "0.46732256", "0.4671759", "0.4671578", "0.46715346", "0.4669358", "0.46657827", "0.46650293", "0.46638513", "0.4663342", "0.46619278", "0.46599898", "0.46596864", "0.46559793", "0.46520475", "0.46469647", "0.46414953", "0.4634898", "0.46340513", "0.46336815", "0.46314913", "0.46304953", "0.46279413", "0.4627131", "0.46241325", "0.46149617", "0.46105355", "0.46096626", "0.4609646", "0.46078414", "0.46057054", "0.46027032", "0.46005854", "0.45999515", "0.4597458" ]
0.46782517
65
if aoC and either a>b>c or a>b>c, then a>c
private void awayFromAncestor(Graph graph, Node a, Node b, Node c) { if ((graph.isAdjacentTo(a, c)) && (graph.getEndpoint(a, c) == Endpoint.CIRCLE)) { if ((graph.getEndpoint(a, b) == Endpoint.ARROW) && (graph.getEndpoint(b, c) == Endpoint.ARROW) && ( (graph.getEndpoint(b, a) == Endpoint.TAIL) || (graph.getEndpoint(c, b) == Endpoint.TAIL))) { if (!isArrowpointAllowed(graph, a, c)) { return; } graph.setEndpoint(a, c, Endpoint.ARROW); changeFlag = true; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean cond1(Data C) {\n return (C.getRight() < this.xL);\n }", "public static void main(String[] args) {\n\n int a = 34;\n int b = 45;\n int c = 78;\n\n if (a >= b && a >= c)\n System.out.println(a + \" is a largest number\");\n else if (b >= a && b >= c)\n System.out.println(b + \" is a largest number\");\n else\n System.out.println(c + \" is a largest number\");\n}", "boolean canFormTriangle(double a, double b, double c) {\n return (a + b > c) && (a + c > b) && (b + c > a);\n }", "private boolean cond2(Data C) {\n return (C.getLeft() > this.xR);\n }", "private boolean isBetween(float a, float b, float c) {\n return b >= a ? c >= a && c <= b : c >= b && c <= a;\n }", "public static boolean compare_face(int a, int b, String c){\n if (c.equals(\"g\")){ // The less than is never actually used in this scope. But who knows what the future holds?\n if (a > b){\n return true;\n }\n return false;\n }\n if (c.equals(\"l\")){\n if (a < b){\n return true;\n }\n return false;\n }\n return false; // Something went wrong here. But logically it'll never happen, so don't worry boys and girls.\n }", "private boolean cond3(Data C) {\n return (C.getBottom() > this.yT);\n }", "public static boolean isContained(double a, double b, double c){\n\t\treturn ((a >= b && a <= c) || (a >= c && a <= b));\n\t}", "private static <T> int med3(T x[], Comparator<T> comp, int a, int b, int c) {\n\t\treturn (comp.compare(x[a],x[b])<0 ?\n\t\t\t\t(comp.compare(x[b],x[c])<0 ? b : comp.compare(x[a],x[c])<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x[b],x[c])>0 ? b : comp.compare(x[a],x[c])>0 ? c : a));\n\t}", "public boolean greaterthan(Inatnum a) throws Exception{\n if((this.isZero() &&a.isZero())==true) {return false;}//if both this and a are both zero, it returns false because it is not greater than. \n if((this.isZero())==false&&a.isZero()==true) {return true;}//conditional returns if a is greater than this.\n if((this.isZero())==true&&a.isZero()==false) {return false;}//conditional returns if this is greater than a.\n else {return this.pred().greaterthan(a.pred()); }//recursive call to subtract one from this and a.\n }", "public static double mid(double a, double b, double c) {\n if (a >= b) {\n if (b >= c) {\n return b; // a >= b >= c\n } else if (a >= c) {\n return c; // a >= c > b\n } else {\n return a; // c > a >= b\n }\n } else if (a >= c) {\n return a; // b > a >= c\n } else if (b >= c) {\n return c; // b >= c > a\n } else {\n return b; // c > b > a\n }\n }", "public static float mid(float a, float b, float c) {\n if (a >= b) {\n if (b >= c) {\n return b; // a >= b >= c\n } else if (a >= c) {\n return c; // a >= c > b\n } else {\n return a; // c > a >= b\n }\n } else if (a >= c) {\n return a; // b > a >= c\n } else if (b >= c) {\n return c; // b >= c > a\n } else {\n return b; // c > b > a\n }\n }", "private static <T> int med3(List<T> x, Comparator<T> comp, int a, int b, int c) {\n\t\treturn (comp.compare(x.get(a),x.get(b))<0 ?\n\t\t\t\t(comp.compare(x.get(b),x.get(c))<0 ? b : comp.compare(x.get(a),x.get(c))<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x.get(b),x.get(c))>0 ? b : comp.compare(x.get(a),x.get(c))>0 ? c : a));\n\t}", "private static int med3(byte x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private static int med3(char x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private static <T> int med3(@Nonnull List<T> x, Comparator<? super T> comparator, int a, int b, int c) {\n return comparator.compare(x.get(a), x.get(b)) < 0\n ? comparator.compare(x.get(b), x.get(c)) < 0 ? b : comparator.compare(x.get(a), x.get(c)) < 0 ? c : a\n : comparator.compare(x.get(c), x.get(b)) < 0 ? b : comparator.compare(x.get(c), x.get(a)) < 0 ? c : a;\n }", "private int med3(double x[], int a, int b, int c) {\r\n return (x[a] < x[b]\r\n ? (x[b] < x[c] ? b : x[a] < x[c] ? c : a)\r\n : (x[b] > x[c] ? b : x[a] > x[c] ? c : a));\r\n }", "boolean inBetween(float a, float b, float c){\n\t\tif (a<b && b<c)\n\t\t\treturn true;\n\t\treturn false;\n\t}", "private static int med3(int x[], IntComparator comp, int a, int b, int c) {\n\t\treturn (comp.compare(x[a],x[b])<0 ?\n\t\t\t\t(comp.compare(x[b],x[c])<0 ? b : comp.compare(x[a],x[c])<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x[b],x[c])>0 ? b : comp.compare(x[a],x[c])>0 ? c : a));\n\t}", "private static int med3(int x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "public boolean icyHot(int temp1, int temp2) {\n return ((temp1 < 0 && temp2 > 100) || (temp1 > 100 && temp2 < 0));\n}", "private static int med3(double x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private static int med3(long x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private static int med3(float x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "public static Boolean InsideBoundary(Double a, Double b, Double c)\n {\n if (a <= b && a > c)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "private static int med3(short x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "public static void main (String[] args) {\n\n Integer a=7,b=4,c=10,d=18;\n\n if (a > b) {\n if(a > c){\n if (a >d){\n System.out.println(a+ \" is biggest\");\n }\n }\n }\n\n if (b > c) {\n if(b > d){\n if (b >a){\n System.out.println(b+ \" is biggest\");\n }\n }\n }\n\n if (c > b) {\n if(c > a){\n if (c >d){\n System.out.println(c+\" is biggest\");\n }\n }\n }\n\n if (d > b) {\n if(d > c){\n if (d >a){\n System.out.println(d+\" is biggest\");\n }\n }\n }\n }", "BooleanExpression gt(ComparableExpression<? extends T> expr);", "private static final int min(int a, int b, int c) {\n int t = (a < b) ? a : b;\n return (t < c) ? t : c;\n }", "static boolean bigint_gt(bigint a, bigint b)\n {\n if (a.bigint_sign && !b.bigint_sign)\n return true;\n else if (!a.bigint_sign && b.bigint_sign)\n return false;\n else\n {\n if (a.bigint_len > b.bigint_len)\n return a.bigint_sign;\n else if (a.bigint_len < b.bigint_len)\n return !a.bigint_sign;\n else\n for (int i = 0; i < a.bigint_len; i++)\n {\n int j = a.bigint_len - 1 - i;\n if (a.bigint_chiffres[j] > b.bigint_chiffres[j])\n return a.bigint_sign;\n else if (a.bigint_chiffres[j] < b.bigint_chiffres[j])\n return !a.bigint_sign;\n }\n return true;\n }\n }", "private boolean isInRange(int a, int b, int c) {\n return c >= a ;\n }", "private boolean isGreater(BigInt rhs) {\n if (isPositive && !rhs.isPositive) {\n // rhs is negative and this is positive\n return true;\n } else if (!isPositive && rhs.isPositive) {\n // rhs is positive and this is negative\n return false;\n }\n // The numbers have the same sign\n\n if (number.size() > rhs.number.size()) {\n // This is longer than the other, so this is bigger if it positive\n return isPositive;\n } else if (number.size() < rhs.number.size()) {\n // This is shorter than the other, so the other is bigger if this positive\n return !isPositive;\n }\n\n for (int i = number.size() - 1; i >= 0; --i) {\n if (number.get(i) > rhs.number.get(i)) {\n return isPositive;\n } else if (number.get(i) < rhs.number.get(i)) {\n return !isPositive;\n }\n }\n\n return false;\n }", "public int min(int a, int b, int c) {\n\t\tif (a<=b && a<=c) {\n\t\t\treturn a; \n\t\t}\n\t\telse if (b<=a && b<=c) {\n\t\t\treturn b;\n\t\t}\n\t\telse {\n\t\t\treturn c;\n\t\t}\n\t}", "public static boolean greaterThan(String a, String b) {\n if (a==\"\" && b==\"\") {return false;}\n if (a==\"\") {return false;}\n if (b==\"\") {return true;}\n String[] as = a.split(\" \");\n String[] bs = b.split(\" \");\n int alen = as.length;\n int blen = bs.length; \n int[] als = new int[alen];\n int[] bls = new int[blen];\n for (int i=0; i<alen; i++) {als[i]=as[i].length();}\n for (int i=0; i<blen; i++) {bls[i]=bs[i].length();}\n Arrays.sort(als);\n Arrays.sort(bls);\n reverse(als);\n reverse(bls);\n boolean is=false;\n boolean done=false;\n for (int i=0; i<alen && i<blen && !done; i++) {\n //System.out.println(als[i]+\" \"+bls[i]+\" || \"+a+\" : \"+b);\n if (als[i]>bls[i]) {is=true; done=true;}\n if (als[i]<bls[i]) {is=false; done=true;}\n }\n return is;\n }", "public static void main(String[] args) {\n\t\t\n\t\tint x = 13;\n\t\tint y = 15;\n\t\tint z = 12;\n\t\t\n/*\t\tif(x>y && x>z) {\n\t\t}\n\t\t\n\t\tif (y>x && y>z) {\n\t\t}\n\t\t\n\t\tif(z>x && z>y) {\n\t\t}*/\n\t\t\n\t\t\n\t\tif(x>y && x>z) {\n\t\t\tSystem.out.println(\"X is greater\");\n\t\t}\n\t\telse if(y>z) {\n\t\t\tSystem.out.println(\"Y is greater\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"Z is greater\");\n\t\t}\n\t\t\n\t\t\n\t\t\n\n\t}", "public static void main(String[] args) {\n\t\tSystem.out.println(20>10&&20<30);\n\t\tint a=10;\n\t\tint b=20;\n\t\tint max=a>b?a:b;\n\t\tSystem.out.println(max);\n\n\n\n\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint x=300;\n\t\tint y=500;\n\t\tint z=500;\n\t\t\n\t\t//((x<y) && (x<z)) // logical expression in Java\n\t\t\n\t\t// (true && true) // the output is going to be true\n\t\t\n\t\t//((x==y) && (x>z))\n\t\t \n\t\t//( false && False) // the final output is going to be False\n\t\t//((x>y) && (x<z))\n\t\t \n\t\t//( false && true) // the final output is going to be False\t \n\t\t\n\t\t\n\t\tif((x==y)&&(x>z)) // compound condition\n{\n\tSystem.out.println(\"execute the block of code\");\n}\n\t\t\n\t\t\n\t\t\n\t\tboolean results= ((x<y)&&(x<z)); // true\n\t\tSystem.out.println(results);\n\t\t\n\t\t\n\t\t//OR operator ||\n\t\t\n\t\t// In case of OR operator, \n\t\t//if anyone of the relational expression is true, the final output is going to be true\n\t\t\n\t\t\n\t\t// x=400;\n\t\t// y=500;\n\t\t// z=400;\n\t\t \n\t\t\t//((x<y) || (x==z))\n\t\t\n\t\t// ( true || true) ----> true\n\t\t\n\t\t// false || true ----> TRUE\n\t\t\n\t\t// false || false----> false\n\t\t\n\t\t// True || False --->true\n\t\t\n\t\tint age= 30;\n\t\t\n\t\t if((age==30)||(age>18))\n\t\t {\n\t\t\t System.out.println(\"give the licence to customer\");\n\t\t }\n\t\t\n\t\t\n\t\t \n\t\t \n\t\t\n\t\t// Not operator ! - if the original value of the expression is true, and if we use ! operator on it, \n\t\t//the output will be changed to False\n\t\t\n\tint x1=100;\n\tint y1=50;\n\t\n\tif(!(x1==y1)) // x1 not equal to y1 ---true\n\t\t\n\t\t\n\t\t// !(x==y)\n\t\t\n\t{\n\t\tSystem.out.println(\"the output is true\");\n\t}\n\t\t// x>y --> 100>50 --->true\n\t\t \n\t\t//!(x>y) ---!(100>50) ---> False\n\t\t// 100 is not greater than 50 ---> false\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public static final boolean betweenFlightLevel(Integer fA, Integer fB, Integer fC) {\n boolean result = (fB.compareTo(fA) > 0)&&(fB.compareTo(fC) < 0); \n return result |= (fB.compareTo(fA) < 0)&&(fB.compareTo(fC) > 0);\n }", "public static boolean a_gt_b(BigDecimal a, BigDecimal b) {\n\t\tif (a == null || b == null) {\n\t\t\tthrow new RuntimeException(\"a_gt_b参数错误,a:[\" + a + \"],b:[\" + b + \"]\");\n\t\t}\n\t\tint result = a.compareTo(b);\n\t\tboolean c = result == 1;\n\t\tif (LOG.isDebugEnabled()) {\n\t\t\tLOG.debug(\"[\" + a + \" > \" + b + \" is \" + c + \"]\");\n\t\t}\n\t\treturn c;\n\t}", "public static void main(String[] args) {\n double a=100;\n double b=200;\n double c=400.5;\n boolean aMin=a<b && a<c; //if a is less than both b and c,then is the minimum\n boolean bMin=b<a && b<c;//if b is less then booth a and c, then b is the minimum\n boolean cMin=c<a && c<b;//if\n if(aMin){\n System.out.println(a+\"is the minimum number\");}\n if(bMin){\n System.out.println(b+\"is the minimum number\");}\n if(cMin){\n System.out.println(c+\"is the minimum number\");}\n\n }", "public boolean a(C c) {\n return Range.a(this.a, (Comparable) c) < 0;\n }", "public void testComparisons() {\n\tfinal double small = Math.pow(2.0, -42);\n\n\t// Input: a, b\n\tdouble[][] input = new double[][] { new double[] { 1, 1 },\n\t\tnew double[] { 1, 2 }, new double[] { 1, 1 - small / 10 },\n\t\tnew double[] { 1, 1 + small / 10 },\n\n\t\tnew double[] { 0, 1 }, new double[] { 0, 0 },\n\t\tnew double[] { 0, -1 }, new double[] { 0, small / 100 },\n\t\tnew double[] { 2100000001.0001, 2100000001.0003 }, };\n\n\t// Output: less, equals\n\tboolean[][] output = new boolean[][] { new boolean[] { false, true },\n\t\tnew boolean[] { true, false }, new boolean[] { false, true },\n\t\tnew boolean[] { false, true },\n\n\t\tnew boolean[] { true, false }, new boolean[] { false, true },\n\t\tnew boolean[] { false, false }, new boolean[] { false, true },\n\t\tnew boolean[] { false, true }, };\n\n\tfor (int i = 0; i < input.length; ++i) {\n\t boolean l = StandardFloatingPointComparator.getDouble().less(\n\t\t input[i][0], input[i][1]);\n\t boolean e = StandardFloatingPointComparator.getDouble().equals(\n\t\t input[i][0], input[i][1]);\n\n\t boolean ne = StandardFloatingPointComparator.getDouble().notEquals(\n\t\t input[i][0], input[i][1]);\n\t boolean le = StandardFloatingPointComparator.getDouble()\n\t\t .lessOrEquals(input[i][0], input[i][1]);\n\t boolean g = StandardFloatingPointComparator.getDouble().greater(\n\t\t input[i][0], input[i][1]);\n\t boolean ge = StandardFloatingPointComparator.getDouble()\n\t\t .greaterOrEquals(input[i][0], input[i][1]);\n\n\t boolean less = output[i][0];\n\t boolean equals = output[i][1];\n\n\t boolean notEquals = !equals;\n\t boolean lessOrEquals = less || equals;\n\t boolean greater = !lessOrEquals;\n\t boolean greaterOrEquals = !less;\n\n\t assertFalse(l != less);\n\t assertFalse(g != greater);\n\t assertFalse(e != equals);\n\t assertFalse(ne != notEquals);\n\t assertFalse(le != lessOrEquals);\n\t assertFalse(ge != greaterOrEquals);\n\t}\n }", "private static boolean judge(int[] a) {\n\t\tint st = 1;\r\n\t\tint ed = a.length-2;\r\n\t\tint sa = 0;\r\n\t\tint sb = 0;\r\n\t\twhile (st<=ed) {\r\n\t\t\tif(a[st]>a[ed]){\r\n\t\t\t\tsa+=a[st];\r\n\t\t\t\tst++;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tsa+=a[ed];\r\n\t\t\t\ted--;\r\n\t\t\t}\r\n\t\t\tif(st>ed)break;\r\n\t\t\tif(a[st]>a[ed]){\r\n\t\t\t\tsb+=a[st];\r\n\t\t\t\tst++;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tsb+=a[ed];\r\n\t\t\t\ted--;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\tif(sa>=sb)return true;\r\n\t\treturn false;\r\n\t}", "static void compare()\n {\n \tif(a < c)\n\t\t {\n\t\t\t comp_one = 1; //store this value , else zero default \n\t\t }\n\t\t if(c < b)\n\t\t {\n\t\t\t comp_two = 2; //store this value , else zero default\n\t\t }\n\t\t if(b < a)\n\t\t {\n\t\t\t comp_thr = 5; //store this value , else zero default\n\t\t }\n\t\t \n\t\t comp_val = comp_one + comp_two + comp_thr; //create a unique value by addition\n }", "static boolean Comparison(PsiBuilder b, int l) {\n if (!recursion_guard_(b, l, \"Comparison\")) return false;\n boolean r;\n Marker m = enter_section_(b);\n r = ValueComp(b, l + 1);\n if (!r) r = GeneralComp(b, l + 1);\n if (!r) r = NodeComp(b, l + 1);\n exit_section_(b, m, null, r);\n return r;\n }", "public static boolean isBetween(int a, int b, int c) {\n if (a > c) {\n return a >= b && b >= c;\n } else if (a < c) {\n return a <= b && b <= c;\n } else {\n assert a == c;\n return a == b;\n }\n }", "public static void main(String[] args){\n \n Scanner in = new Scanner(System.in );\n \n int a;\n a = in.nextInt();\n \n int b;\n b = in.nextInt();\n \n int c;\n c = in.nextInt();\n \n int d;\n d = in.nextInt();\n \n /* 24 Combinations of ABCD in total (combination is reversed when printed so it is in increasing order) */\n \n // 1: ABCD \n if (a > b & b > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + b + \",\" + a);\n }\n \n // 2 ABDC \n else if (a > b & b > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + b + \",\" + a);\n }\n \n // 3 ACBD \n else if (a > c & c > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + c + \",\" + a);\n }\n \n // 4 ACDB \n else if (a > c & c > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + c + \",\" + a);\n }\n \n // 5 ADBC\n else if (a > d & d > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + d + \",\" + a);\n }\n \n // 6 ADCB\n else if (a > d & d > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + d + \",\" + a);\n }\n \n // 7 BACD \n else if (b > a & a > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + a + \",\" + b);\n }\n \n // 8 BADC\n else if (b > a & a > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + a + \",\" + b);\n }\n \n // 9 BDAC\n else if (b > d & d > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + d + \",\" + b);\n }\n \n // 10 BDCA\n else if (b > d & d > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + d + \",\" + b);\n }\n \n // 11 BCAD\n else if (b > c & c > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + c + \",\" + b);\n }\n \n // 12 BCDA\n else if (b > c & c > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + c + \",\" + b);\n }\n \n // 13 CABD\n else if (c > a & a > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + a + \",\" + c);\n }\n \n // 14 CADB\n else if (c > a & a > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + a + \",\" + c);\n }\n \n // 15 CBAD \n else if (c > b & b > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + b + \",\" + c);\n }\n \n // 16 CBDA\n else if (c > b & b > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + b + \",\" + c);\n }\n \n // 17 CDAB\n else if (c > d & d > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + d + \",\" + c);\n }\n \n // 18 CDBA\n else if (c > d & d > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + d + \",\" + c);\n }\n \n // 19 DABC\n else if (d > a & a > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + a + \",\" + d);\n }\n \n // 20 DACB\n else if (d > a & a > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + a + \",\" + d);\n }\n \n // 21 DBAC\n else if (d > b & b > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + b + \",\" + d);\n }\n \n // 22 DBCA\n else if (d > b & b > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + b + \",\" + d);\n }\n \n // 23 DCAB\n else if (d > c & c > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + c + \",\" + d);\n }\n \n // 24 DCBA\n else if (d > c & c > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + c + \",\" + d);\n }\n\n\n\n\n \n \n }", "public int a(bzl ☃, bzg bzg1, int i, int j) {\r\n/* 13 */ if (i == -bzg1.a() && j == -bzg1.b() && bzg1.a() > -bzg1.c() && bzg1.a() <= 0 && bzg1.b() > -bzg1.d() && bzg1.b() <= 0) {\r\n/* 14 */ return 1;\r\n/* */ }\r\n/* */ \r\n/* 17 */ return (☃.a(10) == 0) ? 1 : bzy.c;\r\n/* */ }", "public boolean a(C c) {\n return Range.a(this.a, (Comparable) c) <= 0;\n }", "static int minVal(int a, int b, int c, int d){ //minVal function evaluates the lowest value takes 4 ints and returns an int\n \n //logic: (logic table)\n //\n int[] val = new int[]{a, b, c, d}; //loads it into a array to make it easier to cycle through\n if(a == minVal(val[0], val[1])){//if a is smaller than b\n if (a == minVal(val[0], val[2])){// if a is smaller than c\n if(a == minVal(val[0], val[3])) //if a is smaller than d, return a\n return a;\n return val[3]; // if d is not smaller than a but a is smaller than the rest return d\n }//end if\n else if(c == minVal(val[2], val[3])) //if a is smaller than b but not smaller than c, check if c is smaller than d\n return val[2];//return c\n return val[3];// if a is smaller than b but not smaller than c, and c is not smaller than d, return d \n }//end if \n else{ //if(b == minVal(val[0], val[1])){ //if b is smaller than a\n if (b == minVal(val[1], val[2])){ //if b is smaller than c\n if(b == minVal(val[1], val[3])) //if b is smaller than d, return b\n return b;\n return val[3];// if d is not smaller than a but a is smaller than the rest return d\n }//end if\n else if(c == minVal(val[2], val[3]))//if a is smaller than b but not smaller than c, check if c is smaller than d\n return val[2];//return c\n return val[3];// if a is smaller than b but not smaller than c, and c is not smaller than d, return d \n }//end else\n \n }", "public boolean isHigher(Operator o){\n if(indent > o.indent){\n return true;\n }else{\n return prec > o.prec;\n }\n }", "public static BinaryExpression greaterThan(Expression expression0, Expression expression1) { throw Extensions.todo(); }", "public static boolean passed(double a, double t, double b) {\n return ((a <= t && t <= b) || (b <= t && t <= a));\n }", "public static boolean isBetween(double a, double b, double c) {\n if (a > c) {\n return a >= b && b >= c;\n } else if (a < c) {\n return a <= b && b <= c;\n } else if (a == c) {\n return a == b;\n } else {\n throw new IllegalArgumentException();\n }\n }", "static int compar(int d1,int m1, int y1,int d2,int m2, int y2 )\n{\n if(y1>y2)\n return 1;\n if(y1<y2)\n return -1;\n \n if(m1>m2)\n return 1;\n if(m1<m2)\n return -1;\n \n if(d1>d2)\n return 1;\n if(d1<d2)\n return -1;\n \n \n \n return 0;\n \n \n}", "private Expr comparison() {\n Expr expr = addition();\n\n while(match(GREATER, GREATER_EQUAL, LESS, LESS_EQUAL)) { // These variable length arguments are real convenient\n Token operator = previous();\n Expr right = addition();\n expr = new Expr.Binary(expr, operator, right);\n }\n\n return expr;\n }", "public static boolean a_lteq_b(BigDecimal a, BigDecimal b) {\n\t\tif (a == null || b == null) {\n\t\t\tthrow new RuntimeException(\"a_lteq_b参数错误,a:[\" + a + \"],b:[\" + b + \"]\");\n\t\t}\n\t\tint result = a.compareTo(b);\n\t\tboolean c = result == -1 || result == 0;\n\t\tif (LOG.isDebugEnabled()) {\n\t\t\tLOG.debug(\"[\" + a + \" <= \" + b + \" is \" + c + \"]\");\n\t\t}\n\t\treturn c;\n\t}", "public static void main(String[] args) {\n \n Scanner T = new Scanner(System.in); \n int a,b,c;\n \n System.out.println(\"Ingresa el valor de A\");\n a = T.nextInt();\n System.out.println(\"Ingresa el valor de B\");\n b = T.nextInt();\n System.out.println(\"Ingresa el valor de C\");\n c = T.nextInt();\n \n /*Comparacion mayor*/\n if(a > b && a > c){\n System.out.println(\"El mayor es A con \"+a);\n }else if(b > a && b > c){\n System.out.println(\"El mayor es B con \"+b);\n }else{\n System.out.println(\"El mayor es C con \"+c);\n }\n \n /*Comparacion intermedio*/\n if(a> b && a<c || a<b && a>c){\n System.out.println(\"El intermedio es A \"+a);\n }else if(b > a && b<c || b<a && b>c){\n System.out.println(\"El intermedio es B \"+b);\n }else{\n System.out.println(\"El intermedio es C \"+c);\n\n }\n \n /*Comparacion menor*/\n if(a < b && a < c){\n System.out.println(\"El menor es A con\"+a);\n }else if(b < a && b < c){\n System.out.println(\"El menor es B con\"+b);\n }else{\n System.out.println(\"El menor es C con\"+c);\n }\n \n }", "private boolean less(Comparable a, Comparable b) {\n return a.compareTo(b) < 0;\n }", "public static void main(String[] args) {\nint x=100;\r\nint y = 60;\r\nint z= 20;\r\nint w= 50;\r\nif (x>y && x>z&& x>w) {\r\n\tSystem.out.println(\"x is the largest\");\r\n}\r\nelse if (y>z && y>w) {\r\n\tSystem.out.println(\"y is the largest\");\r\n}\r\nelse if (z>w) {\r\n\tSystem.out.println(\"z is the largest\");\r\n}\r\nelse\r\n{\r\nSystem.out.println(\"w is the largest\");\t\r\n}\r\n}", "List<Object> greaterThanOrEqualsTo(Object value);", "int main()\n{\n int a,b,c;\n string d;\n cin >>a>>b>>c>>d;\n if (d == \"L1\"){\n (b<c)? cout << \"L2\" : cout << \"L3\";\n }\n else if (d == \"L2\"){\n (a<c)? cout << \"L1\" : cout << \"L3\";\n }\n else{\n (a<b)? cout << \"L1\" : cout << \"L2\";\n }\n \n return 0;\n}", "public boolean Mayor(Object obj1, Object obj2){\n return (Double.parseDouble(obj1.toString()) > Double.parseDouble(obj2.toString()));\n }", "public static void main(String [] args){\n double a= 5+(4*5)/5;\n double b= (6*4%2)+15;\n System.out.println(\"a = \"+a);\n System.out.println(\"b = \"+b); \n \n //Ejemplo de operadores relacionales.\n boolean resultado1= a > b;\n boolean resultado2= a !=b; \n System.out.println(\"R1= \"+resultado1);\n System.out.println(\"R2= \"+resultado2); \n }", "public static boolean isBetween(final double a, final double b, final double c) {\r\n\t\tfinal double min = Math.min(a, c);\r\n\t\tfinal double max = Math.max(a, c);\r\n\t\treturn (min < b) && (b < max);\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint a,b,c,d;\n\t a = 50; b =20; c= 30; d=40;\n\t \n\t if (a>d) //true\n\t\t \n\t {\n\t if (d>b) //true\n\t {\n\t if (a>c) //true\n\t {\n\t\t if (c>b) //true\n\t\t {\n\t\t\t System.out.println(\"nested if condition true\");\n\t {\n\t System.out.println(\"nested if condition false\");\n\t} \n\t\t }\n\t }\n\t }\n }\n\n//eg 2\n\nint nu , nu1, nu2;\nnu = 100; nu1 = 200; nu2=300;\n if (nu<nu1 )\n System.out.println(\"nu is lesser\");\n { \n if(nu2>nu1)\n System.out.println(\"nu2 is grater\");\n {\n if (nu1>nu)\n System.out.println(\"nu1 is grater\");\n {\n System.out.println(\"netsred if got executed\");\t\n }\n }\n }\n {\n \tSystem.out.println(\"netsted if not got executed\");\t\n }\n \n \t}", "private boolean cond4(Data C) {\n return (C.getTop() < this.yD);\n }", "private boolean comps(int a, int b){\n\t\tthis.comparisons.add(new Integer[]{a, b});\n\t\treturn true;\n\t}", "public boolean check() {\n BigInteger t1 = y.modPow(int2, c.p);\n BigInteger t2 = x.modPow(int3, c.p);\n BigInteger t3 = ((t2.add(c.a.multiply(x))).add(c.b)).mod(c.p);\n return t1.compareTo(t3) == 0;\n }", "public static boolean isBetween(float a, float b, float c) {\n if (a > c) {\n return a >= b && b >= c;\n } else if (a < c) {\n return a <= b && b <= c;\n } else if (a == c) {\n return a == b;\n } else {\n throw new IllegalArgumentException();\n }\n }", "public boolean hasTeen(int a, int b, int c) {\n return (a>=13 && a<=19) ||\n (b>=13 && b<=19) ||\n (c>=13 && c<=19);\n}", "public boolean makes10(int a, int b) {\n return (a == 10 || b == 10 || a + b == 10);\n}", "default boolean gt(int lhs, int rhs) {\r\n return lt(rhs,lhs);\r\n }", "public static int bccomp (String _left_operand , String _right_operand, int _scale) {\n//\t\treturn _left_operand.compareTo(_right_operand);\n\t\treturn ZendUtils.natsort(_left_operand, _right_operand);\n\t}", "private static int minimum(int a, int b, int c)\n {\n return Math.min(a, Math.min(b,c));\n }", "public static void main(String[] args) {\n int i = 140;\n int j = 150;\n int k = 200;\n\n if (i>j){\n System.out.println(\"I is greater then J\");\n }\n else {\n System.out.println(\"I is Less then J \");\n }\n\n System.out.println(\"------------------------//Example of multiple conditions...---------------------------------------\");\n if (k>j){\n System.out.println(\"K is greater then J\");\n }\n else if (j==k){\n System.out.println(\"I is Equal to K\");\n }\n else {\n System.out.println(\"I is Less then to K \");\n }\n }", "private static boolean less(Comparable[] pq, int i, int j) {\n return pq[i-1].compareTo(pq[j-1]) < 0;\n }", "public void testGreaterThanElement() {\n\t // fail(\"testGreaterThanElement\");\n \tCircuit circuit = new Circuit();\n \tDouble x1 = 0.5;\n \tAnd and = (And) circuit.getFactory().getGate(Gate.AND);\n\t\tNot not = (Not) circuit.getFactory().getGate(Gate.NOT);\n\t\tGte gte1 = (Gte) circuit.getFactory().getGate(Gate.GTE);\n \tand.setLeftInput(x1);\n \tnot.setInput(x1);\n \tnot.eval();\n \tand.setRightInput(not.getOutput());\n\t\tand.eval();\n \tgte1.setLeftInput(and.getOutput());\n\t\tgte1.setRightInput(x1);\n \tassertEquals( new Double(0.0), gte1.eval());\n }", "private boolean between(int x1, int x2, int x3) {\n return (x1 >= x3 && x1 <= x2) || (x1 <= x3 && x1 >= x2);\n }", "public int compareTo(PrioPair<T,V> c)\n {\n return v.compareTo(c.getV()) * -1;\n }", "public boolean in1020(int a, int b) {\n return ((a >= 10 && a <= 20) || (b >= 10 && b <= 20));\n}", "private boolean _clockwise(PVector A, PVector B, PVector C) {\n return (C.y-A.y) * (B.x-A.x) > (B.y-A.y) * (C.x-A.x);\n }", "public static void main(String[] args) {\n int a;\n int b;\n int c;\n a = doDai(\"Nhap canh a\");\n b = doDai(\"Nhap canh b\");\n c = doDai(\"Nhap canh c\");\n if (((a + b) < c) || ((a + c) < b) || ((c + b) < a)) {\n System.out.println(\"khong the la 3 canh cua 1 tam giac \");\n } else {\n System.out.println(\"Canh tam giac hop le\");\n }\n }", "public static int conditionalOp(int n1,int n2, double n3)\n\t{\n\t\tdouble x=n1; //implicit data type conversion\n\t\tSystem.out.println(\"value after implicit type casting: \"+x);\n\t\treturn (int)((((n1>n2)?n1:n2)>n3)?((n1>n2)?n1:n2):n3); //one line conditional operator and explicit data type conversion;\n\t}", "int llegue(int a,int b,int c,int d){\n if(a==c && b==d){\n return 1;\n }else{return 0;}\n }", "private int majority(int x, int y, int z){\n return (x & y) | (x & z) | (y & z);\n }", "public void testComparatorChainOnMinvaluedCompatator() {\n ComparatorChain chain = new ComparatorChain();\r\n chain.addComparator(\r\n new Comparator() {\r\n public int compare(Object a, Object b) {\r\n int result = ((Comparable)a).compareTo(b);\r\n if(result < 0) {\r\n return Integer.MIN_VALUE;\r\n } else if(result > 0) {\r\n return Integer.MAX_VALUE;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n }, true);\r\n\r\n assertTrue(chain.compare(new Integer(4), new Integer(5)) > 0); \r\n assertTrue(chain.compare(new Integer(5), new Integer(4)) < 0); \r\n assertTrue(chain.compare(new Integer(4), new Integer(4)) == 0); \r\n }", "BooleanExpression gteq(ComparableExpression<? extends T> expr);", "public static void main(String[] args) \r\n\t{\n\t\tint a=3,b=5,c=2;\r\n\t\tif((a>b)&&(a>c))\r\n\t\t{\r\n\t\t\tSystem.out.println(\"A is big\");\r\n\t\t}\r\n\t\telse if(b>c)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"B is big\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"C is big\");\r\n\t\t}\r\n\t\t\r\n\t\tint d=3,e=5,f=8;\r\n\t\tif(d>e||d>f)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"D is big\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"E or F is Big\");\r\n\t\t}\r\n\t\t\r\n\t\tint g=0;\r\n\t\tif(g!=0)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"True\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"False\");\r\n\t\t}\r\n\t}", "public boolean preceeds(char a, char b) {\n int first = 0;\n int second = 0;\n \n switch (a) {\n case('+'):\n first = 1;\n break;\n case('-'):\n first = 1;\n break;\n case('*'):\n first = 2;\n break;\n case('/'):\n first = 2;\n break;\n case('%'):\n first = 2;\n break;\n case('('):\n first = 3;\n break;\n case(')'):\n first = 3;\n break;\n default:\n System.out.println(\"Problem with char a in class Operator\");\n }\n switch (b) {\n case('+'):\n second = 1;\n break;\n case('-'):\n second = 1;\n break;\n case('*'):\n second = 2;\n break;\n case('/'):\n second = 2;\n break;\n case('%'):\n second = 2;\n break;\n case('('):\n second = 3;\n break;\n case(')'):\n second = 3;\n break;\n default:\n System.out.println(\"Problem with char b in class Operator\");\n }\n \n return first <= second;\n }", "private boolean greater(int i, int j) {\r\n\r\n return compare(pq[i], pq[j]) > 0;\r\n\r\n }", "public static KittyNode commAns(KittyNode a, KittyNode b){\n KittyNode trava,travb;\n trava = a;\n travb = b;\n if(trava == null)\n return travb;\n else if(travb == null)\n return trava;\n while(trava.prev != null || travb.prev != null){\n if(trava.lvl == travb.lvl){\n if(trava.prev == travb.prev)\n return trava.prev;\n trava = trava.prev;\n travb = travb.prev;\n }\n else if(trava.lvl > travb.lvl){\n if(trava.prev == travb)\n return travb;\n trava = trava.prev;\n }else if(trava.lvl < travb.lvl){\n if(trava == travb.prev)\n return trava;\n travb = travb.prev;\n }\n }\n if(trava != null)\n return trava;\n else\n return travb;\n }", "public static boolean a_gteq_b(BigDecimal a, BigDecimal b) {\n\t\tif (a == null || b == null) {\n\t\t\tthrow new RuntimeException(\"a_gteq_b参数错误,a:[\" + a + \"],b:[\" + b + \"]\");\n\t\t}\n\t\tint result = a.compareTo(b);\n\t\tboolean c = result == 1 || result == 0;\n\t\tif (LOG.isDebugEnabled()) {\n\t\t\tLOG.debug(\"[\" + a + \" >= \" + b + \" is \" + c + \"]\");\n\t\t}\n\t\treturn c;\n\t}", "public boolean in3050(int a, int b) {\n return ((a >= 30 && a <= 40) && (b >= 30 && b <= 40)) ||\n ((a >= 40 && a <= 50) && (b >= 40 && b <= 50));\n}", "public int compareTo(Cut<C> cut) {\n if (cut == d()) {\n return 1;\n }\n if (cut == e()) {\n return -1;\n }\n int a2 = Range.a((Comparable) this.a, (Comparable) cut.a);\n if (a2 != 0) {\n return a2;\n }\n return Booleans.compare(this instanceof AboveValue, cut instanceof AboveValue);\n }", "private int comparator(int u, int synapSum){\n\t\treturn synapSum >= u ? 1 : 0;\n\t}", "private static int sign(S2Point a, S2Point b, S2Point c, S2Point aCrossB) {\n // assert (isUnitLength(a) && isUnitLength(b) && isUnitLength(c));\n int ccw = triage(aCrossB, c);\n if (ccw == 0) {\n ccw = S2Predicates.Sign.expensive(a, b, c, true);\n }\n return ccw;\n }", "public boolean rankIsGreaterThan(Card c) {\n\t\tboolean rankIsGreater = false;\r\n\t\t\r\n\t\tif(rank > c.getRank()) {\r\n\t\t\trankIsGreater = true;\r\n\t\t}//if\r\n\t\treturn rankIsGreater;\r\n\t\t\r\n\t}", "public boolean makePair(int [] a, int [] b, int k) {\n\t\t\n\t\tif(a==null||b==null||a.length==0||b.length==0) return true;\n\t\t\n\t\tfor(int i=0; i<a.length; i++) {\n\t\t\ta[i] = k-a[i];\t\n\t\t}\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tboolean res = true;\n\t\t\n\t\t//add optimization\n\t\tif(a[a.length-1]<=b[0]) return res;\n\t\t\n\t\tfor(int j=0; j<a.length; j++) {\n\t\t\tif(a[j]>b[j]) {\n\t\t\t\tres = false;\n\t\t\t\tbreak; \n\t\t\t}\n\t\t}\n\t\treturn(res);\n\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint a = 5;\n\t\tint b = 6;\n//\t\tboolean c = a > b;\n//\t\tSystem.out.println(!c);\n\t\tSystem.out.println(!(boolean)(a > b));\n//\t\tint c = a & b;\n//\t\tint a = 10;\n//\t\tint b = 13;\n//\t\tint c = a | b;\n\t\t\n//\t\t1101 -> 0110 -> 0011 -> 0001 -> 0000 -> 0000; in right shift operation--everytime(>>1) divided by 2.\n//\t\t1101 -> 1010 -> 0100 -> 1000 -> 0000 -> 0000; in left shift operation--everytime(<<1) multiplied by 2.\n//\t\tint b = 13;\n//\t\tint c = b >> 2;\n//\t\tint d = b << 1;\n//\t\tSystem.out.println(c);\n//\t\tSystem.out.println(d);\n\n\t}", "public boolean greaterThan(NumberP other)\n {\n \treturn OperationsCompareTo.CompareDouble(this, other) == 1;\n }" ]
[ "0.6286512", "0.62792146", "0.6200532", "0.6178659", "0.6175262", "0.60792345", "0.60719633", "0.6036331", "0.60332656", "0.59748304", "0.5970809", "0.59571993", "0.5899514", "0.58956915", "0.5890563", "0.58307695", "0.5809145", "0.5799478", "0.57850844", "0.5780352", "0.5754992", "0.57141936", "0.57133156", "0.57113796", "0.5693072", "0.5656952", "0.5633628", "0.5616672", "0.56071645", "0.56067467", "0.5606629", "0.55866975", "0.5573996", "0.5562536", "0.55533206", "0.55434954", "0.55401677", "0.55325764", "0.5523691", "0.5519898", "0.5518012", "0.551078", "0.5496137", "0.5478594", "0.5470954", "0.5459968", "0.5459675", "0.5452924", "0.543475", "0.54284114", "0.54077816", "0.5372185", "0.53699785", "0.5361391", "0.53463084", "0.53443545", "0.53422874", "0.5324066", "0.53213954", "0.53171194", "0.5297689", "0.52840126", "0.5269794", "0.5257477", "0.5257422", "0.52467316", "0.524591", "0.5235669", "0.52282053", "0.5220832", "0.52010614", "0.5185906", "0.51819515", "0.5178213", "0.51737016", "0.5169997", "0.5158947", "0.51570874", "0.5138735", "0.5137495", "0.51333225", "0.5124543", "0.5119313", "0.51138747", "0.5113648", "0.5109769", "0.50987804", "0.50867826", "0.5083069", "0.5074709", "0.5068051", "0.5067162", "0.5059792", "0.50555414", "0.50509226", "0.50482124", "0.5046166", "0.5031756", "0.5020855", "0.5019743", "0.501897" ]
0.0
-1
if Ao>c and a>b>c, then a>c
private void awayFromCycle(Graph graph, Node a, Node b, Node c) { if ((graph.isAdjacentTo(a, c)) && (graph.getEndpoint(a, c) == Endpoint.ARROW) && (graph.getEndpoint(c, a) == Endpoint.CIRCLE)) { if (graph.isDirectedFromTo(a, b) && graph.isDirectedFromTo(b, c)) { graph.setEndpoint(c, a, Endpoint.TAIL); changeFlag = true; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) {\n\n int a = 34;\n int b = 45;\n int c = 78;\n\n if (a >= b && a >= c)\n System.out.println(a + \" is a largest number\");\n else if (b >= a && b >= c)\n System.out.println(b + \" is a largest number\");\n else\n System.out.println(c + \" is a largest number\");\n}", "boolean canFormTriangle(double a, double b, double c) {\n return (a + b > c) && (a + c > b) && (b + c > a);\n }", "public static boolean compare_face(int a, int b, String c){\n if (c.equals(\"g\")){ // The less than is never actually used in this scope. But who knows what the future holds?\n if (a > b){\n return true;\n }\n return false;\n }\n if (c.equals(\"l\")){\n if (a < b){\n return true;\n }\n return false;\n }\n return false; // Something went wrong here. But logically it'll never happen, so don't worry boys and girls.\n }", "private boolean cond1(Data C) {\n return (C.getRight() < this.xL);\n }", "public boolean greaterthan(Inatnum a) throws Exception{\n if((this.isZero() &&a.isZero())==true) {return false;}//if both this and a are both zero, it returns false because it is not greater than. \n if((this.isZero())==false&&a.isZero()==true) {return true;}//conditional returns if a is greater than this.\n if((this.isZero())==true&&a.isZero()==false) {return false;}//conditional returns if this is greater than a.\n else {return this.pred().greaterthan(a.pred()); }//recursive call to subtract one from this and a.\n }", "private boolean cond2(Data C) {\n return (C.getLeft() > this.xR);\n }", "private boolean isBetween(float a, float b, float c) {\n return b >= a ? c >= a && c <= b : c >= b && c <= a;\n }", "private boolean cond3(Data C) {\n return (C.getBottom() > this.yT);\n }", "public static boolean isContained(double a, double b, double c){\n\t\treturn ((a >= b && a <= c) || (a >= c && a <= b));\n\t}", "boolean inBetween(float a, float b, float c){\n\t\tif (a<b && b<c)\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint x=300;\n\t\tint y=500;\n\t\tint z=500;\n\t\t\n\t\t//((x<y) && (x<z)) // logical expression in Java\n\t\t\n\t\t// (true && true) // the output is going to be true\n\t\t\n\t\t//((x==y) && (x>z))\n\t\t \n\t\t//( false && False) // the final output is going to be False\n\t\t//((x>y) && (x<z))\n\t\t \n\t\t//( false && true) // the final output is going to be False\t \n\t\t\n\t\t\n\t\tif((x==y)&&(x>z)) // compound condition\n{\n\tSystem.out.println(\"execute the block of code\");\n}\n\t\t\n\t\t\n\t\t\n\t\tboolean results= ((x<y)&&(x<z)); // true\n\t\tSystem.out.println(results);\n\t\t\n\t\t\n\t\t//OR operator ||\n\t\t\n\t\t// In case of OR operator, \n\t\t//if anyone of the relational expression is true, the final output is going to be true\n\t\t\n\t\t\n\t\t// x=400;\n\t\t// y=500;\n\t\t// z=400;\n\t\t \n\t\t\t//((x<y) || (x==z))\n\t\t\n\t\t// ( true || true) ----> true\n\t\t\n\t\t// false || true ----> TRUE\n\t\t\n\t\t// false || false----> false\n\t\t\n\t\t// True || False --->true\n\t\t\n\t\tint age= 30;\n\t\t\n\t\t if((age==30)||(age>18))\n\t\t {\n\t\t\t System.out.println(\"give the licence to customer\");\n\t\t }\n\t\t\n\t\t\n\t\t \n\t\t \n\t\t\n\t\t// Not operator ! - if the original value of the expression is true, and if we use ! operator on it, \n\t\t//the output will be changed to False\n\t\t\n\tint x1=100;\n\tint y1=50;\n\t\n\tif(!(x1==y1)) // x1 not equal to y1 ---true\n\t\t\n\t\t\n\t\t// !(x==y)\n\t\t\n\t{\n\t\tSystem.out.println(\"the output is true\");\n\t}\n\t\t// x>y --> 100>50 --->true\n\t\t \n\t\t//!(x>y) ---!(100>50) ---> False\n\t\t// 100 is not greater than 50 ---> false\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public static boolean greaterThan(String a, String b) {\n if (a==\"\" && b==\"\") {return false;}\n if (a==\"\") {return false;}\n if (b==\"\") {return true;}\n String[] as = a.split(\" \");\n String[] bs = b.split(\" \");\n int alen = as.length;\n int blen = bs.length; \n int[] als = new int[alen];\n int[] bls = new int[blen];\n for (int i=0; i<alen; i++) {als[i]=as[i].length();}\n for (int i=0; i<blen; i++) {bls[i]=bs[i].length();}\n Arrays.sort(als);\n Arrays.sort(bls);\n reverse(als);\n reverse(bls);\n boolean is=false;\n boolean done=false;\n for (int i=0; i<alen && i<blen && !done; i++) {\n //System.out.println(als[i]+\" \"+bls[i]+\" || \"+a+\" : \"+b);\n if (als[i]>bls[i]) {is=true; done=true;}\n if (als[i]<bls[i]) {is=false; done=true;}\n }\n return is;\n }", "public boolean isHigher(Operator o){\n if(indent > o.indent){\n return true;\n }else{\n return prec > o.prec;\n }\n }", "public static boolean passed(double a, double t, double b) {\n return ((a <= t && t <= b) || (b <= t && t <= a));\n }", "public static void main(String[] args) {\n\t\t\n\t\tint x = 13;\n\t\tint y = 15;\n\t\tint z = 12;\n\t\t\n/*\t\tif(x>y && x>z) {\n\t\t}\n\t\t\n\t\tif (y>x && y>z) {\n\t\t}\n\t\t\n\t\tif(z>x && z>y) {\n\t\t}*/\n\t\t\n\t\t\n\t\tif(x>y && x>z) {\n\t\t\tSystem.out.println(\"X is greater\");\n\t\t}\n\t\telse if(y>z) {\n\t\t\tSystem.out.println(\"Y is greater\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"Z is greater\");\n\t\t}\n\t\t\n\t\t\n\t\t\n\n\t}", "public static float mid(float a, float b, float c) {\n if (a >= b) {\n if (b >= c) {\n return b; // a >= b >= c\n } else if (a >= c) {\n return c; // a >= c > b\n } else {\n return a; // c > a >= b\n }\n } else if (a >= c) {\n return a; // b > a >= c\n } else if (b >= c) {\n return c; // b >= c > a\n } else {\n return b; // c > b > a\n }\n }", "public static double mid(double a, double b, double c) {\n if (a >= b) {\n if (b >= c) {\n return b; // a >= b >= c\n } else if (a >= c) {\n return c; // a >= c > b\n } else {\n return a; // c > a >= b\n }\n } else if (a >= c) {\n return a; // b > a >= c\n } else if (b >= c) {\n return c; // b >= c > a\n } else {\n return b; // c > b > a\n }\n }", "public static void main(String[] args) {\n\t\tSystem.out.println(20>10&&20<30);\n\t\tint a=10;\n\t\tint b=20;\n\t\tint max=a>b?a:b;\n\t\tSystem.out.println(max);\n\n\n\n\n\t}", "public static void main (String[] args) {\n\n Integer a=7,b=4,c=10,d=18;\n\n if (a > b) {\n if(a > c){\n if (a >d){\n System.out.println(a+ \" is biggest\");\n }\n }\n }\n\n if (b > c) {\n if(b > d){\n if (b >a){\n System.out.println(b+ \" is biggest\");\n }\n }\n }\n\n if (c > b) {\n if(c > a){\n if (c >d){\n System.out.println(c+\" is biggest\");\n }\n }\n }\n\n if (d > b) {\n if(d > c){\n if (d >a){\n System.out.println(d+\" is biggest\");\n }\n }\n }\n }", "public boolean icyHot(int temp1, int temp2) {\n return ((temp1 < 0 && temp2 > 100) || (temp1 > 100 && temp2 < 0));\n}", "public static void main(String[] args) {\n double a=100;\n double b=200;\n double c=400.5;\n boolean aMin=a<b && a<c; //if a is less than both b and c,then is the minimum\n boolean bMin=b<a && b<c;//if b is less then booth a and c, then b is the minimum\n boolean cMin=c<a && c<b;//if\n if(aMin){\n System.out.println(a+\"is the minimum number\");}\n if(bMin){\n System.out.println(b+\"is the minimum number\");}\n if(cMin){\n System.out.println(c+\"is the minimum number\");}\n\n }", "BooleanExpression gt(ComparableExpression<? extends T> expr);", "public static Boolean InsideBoundary(Double a, Double b, Double c)\n {\n if (a <= b && a > c)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public static void main(String[] args) {\n\t\t\n\t\tint a,b,c,d;\n\t a = 50; b =20; c= 30; d=40;\n\t \n\t if (a>d) //true\n\t\t \n\t {\n\t if (d>b) //true\n\t {\n\t if (a>c) //true\n\t {\n\t\t if (c>b) //true\n\t\t {\n\t\t\t System.out.println(\"nested if condition true\");\n\t {\n\t System.out.println(\"nested if condition false\");\n\t} \n\t\t }\n\t }\n\t }\n }\n\n//eg 2\n\nint nu , nu1, nu2;\nnu = 100; nu1 = 200; nu2=300;\n if (nu<nu1 )\n System.out.println(\"nu is lesser\");\n { \n if(nu2>nu1)\n System.out.println(\"nu2 is grater\");\n {\n if (nu1>nu)\n System.out.println(\"nu1 is grater\");\n {\n System.out.println(\"netsred if got executed\");\t\n }\n }\n }\n {\n \tSystem.out.println(\"netsted if not got executed\");\t\n }\n \n \t}", "public static void main(String[] args) {\nint x=100;\r\nint y = 60;\r\nint z= 20;\r\nint w= 50;\r\nif (x>y && x>z&& x>w) {\r\n\tSystem.out.println(\"x is the largest\");\r\n}\r\nelse if (y>z && y>w) {\r\n\tSystem.out.println(\"y is the largest\");\r\n}\r\nelse if (z>w) {\r\n\tSystem.out.println(\"z is the largest\");\r\n}\r\nelse\r\n{\r\nSystem.out.println(\"w is the largest\");\t\r\n}\r\n}", "private static int med3(char x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "public static final boolean betweenFlightLevel(Integer fA, Integer fB, Integer fC) {\n boolean result = (fB.compareTo(fA) > 0)&&(fB.compareTo(fC) < 0); \n return result |= (fB.compareTo(fA) < 0)&&(fB.compareTo(fC) > 0);\n }", "public static void main(String [] args){\n double a= 5+(4*5)/5;\n double b= (6*4%2)+15;\n System.out.println(\"a = \"+a);\n System.out.println(\"b = \"+b); \n \n //Ejemplo de operadores relacionales.\n boolean resultado1= a > b;\n boolean resultado2= a !=b; \n System.out.println(\"R1= \"+resultado1);\n System.out.println(\"R2= \"+resultado2); \n }", "private boolean isInRange(int a, int b, int c) {\n return c >= a ;\n }", "private static <T> int med3(T x[], Comparator<T> comp, int a, int b, int c) {\n\t\treturn (comp.compare(x[a],x[b])<0 ?\n\t\t\t\t(comp.compare(x[b],x[c])<0 ? b : comp.compare(x[a],x[c])<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x[b],x[c])>0 ? b : comp.compare(x[a],x[c])>0 ? c : a));\n\t}", "public static boolean isBetween(int a, int b, int c) {\n if (a > c) {\n return a >= b && b >= c;\n } else if (a < c) {\n return a <= b && b <= c;\n } else {\n assert a == c;\n return a == b;\n }\n }", "private static boolean judge(int[] a) {\n\t\tint st = 1;\r\n\t\tint ed = a.length-2;\r\n\t\tint sa = 0;\r\n\t\tint sb = 0;\r\n\t\twhile (st<=ed) {\r\n\t\t\tif(a[st]>a[ed]){\r\n\t\t\t\tsa+=a[st];\r\n\t\t\t\tst++;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tsa+=a[ed];\r\n\t\t\t\ted--;\r\n\t\t\t}\r\n\t\t\tif(st>ed)break;\r\n\t\t\tif(a[st]>a[ed]){\r\n\t\t\t\tsb+=a[st];\r\n\t\t\t\tst++;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tsb+=a[ed];\r\n\t\t\t\ted--;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\tif(sa>=sb)return true;\r\n\t\treturn false;\r\n\t}", "private Expr comparison() {\n Expr expr = addition();\n\n while(match(GREATER, GREATER_EQUAL, LESS, LESS_EQUAL)) { // These variable length arguments are real convenient\n Token operator = previous();\n Expr right = addition();\n expr = new Expr.Binary(expr, operator, right);\n }\n\n return expr;\n }", "private static <T> int med3(List<T> x, Comparator<T> comp, int a, int b, int c) {\n\t\treturn (comp.compare(x.get(a),x.get(b))<0 ?\n\t\t\t\t(comp.compare(x.get(b),x.get(c))<0 ? b : comp.compare(x.get(a),x.get(c))<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x.get(b),x.get(c))>0 ? b : comp.compare(x.get(a),x.get(c))>0 ? c : a));\n\t}", "int main()\n{\n int a,b,c;\n string d;\n cin >>a>>b>>c>>d;\n if (d == \"L1\"){\n (b<c)? cout << \"L2\" : cout << \"L3\";\n }\n else if (d == \"L2\"){\n (a<c)? cout << \"L1\" : cout << \"L3\";\n }\n else{\n (a<b)? cout << \"L1\" : cout << \"L2\";\n }\n \n return 0;\n}", "public int min(int a, int b, int c) {\n\t\tif (a<=b && a<=c) {\n\t\t\treturn a; \n\t\t}\n\t\telse if (b<=a && b<=c) {\n\t\t\treturn b;\n\t\t}\n\t\telse {\n\t\t\treturn c;\n\t\t}\n\t}", "public int a(bzl ☃, bzg bzg1, int i, int j) {\r\n/* 13 */ if (i == -bzg1.a() && j == -bzg1.b() && bzg1.a() > -bzg1.c() && bzg1.a() <= 0 && bzg1.b() > -bzg1.d() && bzg1.b() <= 0) {\r\n/* 14 */ return 1;\r\n/* */ }\r\n/* */ \r\n/* 17 */ return (☃.a(10) == 0) ? 1 : bzy.c;\r\n/* */ }", "public static void main(String[] args){\n \n Scanner in = new Scanner(System.in );\n \n int a;\n a = in.nextInt();\n \n int b;\n b = in.nextInt();\n \n int c;\n c = in.nextInt();\n \n int d;\n d = in.nextInt();\n \n /* 24 Combinations of ABCD in total (combination is reversed when printed so it is in increasing order) */\n \n // 1: ABCD \n if (a > b & b > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + b + \",\" + a);\n }\n \n // 2 ABDC \n else if (a > b & b > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + b + \",\" + a);\n }\n \n // 3 ACBD \n else if (a > c & c > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + c + \",\" + a);\n }\n \n // 4 ACDB \n else if (a > c & c > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + c + \",\" + a);\n }\n \n // 5 ADBC\n else if (a > d & d > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + d + \",\" + a);\n }\n \n // 6 ADCB\n else if (a > d & d > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + d + \",\" + a);\n }\n \n // 7 BACD \n else if (b > a & a > c & c > d) {\n System.out.println(d + \",\" + c + \",\" + a + \",\" + b);\n }\n \n // 8 BADC\n else if (b > a & a > d & d > c) {\n System.out.println(c + \",\" + d + \",\" + a + \",\" + b);\n }\n \n // 9 BDAC\n else if (b > d & d > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + d + \",\" + b);\n }\n \n // 10 BDCA\n else if (b > d & d > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + d + \",\" + b);\n }\n \n // 11 BCAD\n else if (b > c & c > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + c + \",\" + b);\n }\n \n // 12 BCDA\n else if (b > c & c > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + c + \",\" + b);\n }\n \n // 13 CABD\n else if (c > a & a > b & b > d) {\n System.out.println(d + \",\" + b + \",\" + a + \",\" + c);\n }\n \n // 14 CADB\n else if (c > a & a > d & d > b) {\n System.out.println(b + \",\" + d + \",\" + a + \",\" + c);\n }\n \n // 15 CBAD \n else if (c > b & b > a & a > d) {\n System.out.println(d + \",\" + a + \",\" + b + \",\" + c);\n }\n \n // 16 CBDA\n else if (c > b & b > d & d > a) {\n System.out.println(a + \",\" + d + \",\" + b + \",\" + c);\n }\n \n // 17 CDAB\n else if (c > d & d > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + d + \",\" + c);\n }\n \n // 18 CDBA\n else if (c > d & d > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + d + \",\" + c);\n }\n \n // 19 DABC\n else if (d > a & a > b & b > c) {\n System.out.println(c + \",\" + b + \",\" + a + \",\" + d);\n }\n \n // 20 DACB\n else if (d > a & a > c & c > b) {\n System.out.println(b + \",\" + c + \",\" + a + \",\" + d);\n }\n \n // 21 DBAC\n else if (d > b & b > a & a > c) {\n System.out.println(c + \",\" + a + \",\" + b + \",\" + d);\n }\n \n // 22 DBCA\n else if (d > b & b > c & c > a) {\n System.out.println(a + \",\" + c + \",\" + b + \",\" + d);\n }\n \n // 23 DCAB\n else if (d > c & c > a & a > b) {\n System.out.println(b + \",\" + a + \",\" + c + \",\" + d);\n }\n \n // 24 DCBA\n else if (d > c & c > b & b > a) {\n System.out.println(a + \",\" + b + \",\" + c + \",\" + d);\n }\n\n\n\n\n \n \n }", "private static int med3(byte x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private boolean isGreater(BigInt rhs) {\n if (isPositive && !rhs.isPositive) {\n // rhs is negative and this is positive\n return true;\n } else if (!isPositive && rhs.isPositive) {\n // rhs is positive and this is negative\n return false;\n }\n // The numbers have the same sign\n\n if (number.size() > rhs.number.size()) {\n // This is longer than the other, so this is bigger if it positive\n return isPositive;\n } else if (number.size() < rhs.number.size()) {\n // This is shorter than the other, so the other is bigger if this positive\n return !isPositive;\n }\n\n for (int i = number.size() - 1; i >= 0; --i) {\n if (number.get(i) > rhs.number.get(i)) {\n return isPositive;\n } else if (number.get(i) < rhs.number.get(i)) {\n return !isPositive;\n }\n }\n\n return false;\n }", "static boolean Comparison(PsiBuilder b, int l) {\n if (!recursion_guard_(b, l, \"Comparison\")) return false;\n boolean r;\n Marker m = enter_section_(b);\n r = ValueComp(b, l + 1);\n if (!r) r = GeneralComp(b, l + 1);\n if (!r) r = NodeComp(b, l + 1);\n exit_section_(b, m, null, r);\n return r;\n }", "private int med3(double x[], int a, int b, int c) {\r\n return (x[a] < x[b]\r\n ? (x[b] < x[c] ? b : x[a] < x[c] ? c : a)\r\n : (x[b] > x[c] ? b : x[a] > x[c] ? c : a));\r\n }", "public boolean hasTeen(int a, int b, int c) {\n return (a>=13 && a<=19) ||\n (b>=13 && b<=19) ||\n (c>=13 && c<=19);\n}", "public boolean preceeds(char a, char b) {\n int first = 0;\n int second = 0;\n \n switch (a) {\n case('+'):\n first = 1;\n break;\n case('-'):\n first = 1;\n break;\n case('*'):\n first = 2;\n break;\n case('/'):\n first = 2;\n break;\n case('%'):\n first = 2;\n break;\n case('('):\n first = 3;\n break;\n case(')'):\n first = 3;\n break;\n default:\n System.out.println(\"Problem with char a in class Operator\");\n }\n switch (b) {\n case('+'):\n second = 1;\n break;\n case('-'):\n second = 1;\n break;\n case('*'):\n second = 2;\n break;\n case('/'):\n second = 2;\n break;\n case('%'):\n second = 2;\n break;\n case('('):\n second = 3;\n break;\n case(')'):\n second = 3;\n break;\n default:\n System.out.println(\"Problem with char b in class Operator\");\n }\n \n return first <= second;\n }", "public boolean a(C c) {\n return Range.a(this.a, (Comparable) c) < 0;\n }", "int llegue(int a,int b,int c,int d){\n if(a==c && b==d){\n return 1;\n }else{return 0;}\n }", "private static <T> int med3(@Nonnull List<T> x, Comparator<? super T> comparator, int a, int b, int c) {\n return comparator.compare(x.get(a), x.get(b)) < 0\n ? comparator.compare(x.get(b), x.get(c)) < 0 ? b : comparator.compare(x.get(a), x.get(c)) < 0 ? c : a\n : comparator.compare(x.get(c), x.get(b)) < 0 ? b : comparator.compare(x.get(c), x.get(a)) < 0 ? c : a;\n }", "public static boolean a_gt_b(BigDecimal a, BigDecimal b) {\n\t\tif (a == null || b == null) {\n\t\t\tthrow new RuntimeException(\"a_gt_b参数错误,a:[\" + a + \"],b:[\" + b + \"]\");\n\t\t}\n\t\tint result = a.compareTo(b);\n\t\tboolean c = result == 1;\n\t\tif (LOG.isDebugEnabled()) {\n\t\t\tLOG.debug(\"[\" + a + \" > \" + b + \" is \" + c + \"]\");\n\t\t}\n\t\treturn c;\n\t}", "private static int med3(int x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "static boolean bigint_gt(bigint a, bigint b)\n {\n if (a.bigint_sign && !b.bigint_sign)\n return true;\n else if (!a.bigint_sign && b.bigint_sign)\n return false;\n else\n {\n if (a.bigint_len > b.bigint_len)\n return a.bigint_sign;\n else if (a.bigint_len < b.bigint_len)\n return !a.bigint_sign;\n else\n for (int i = 0; i < a.bigint_len; i++)\n {\n int j = a.bigint_len - 1 - i;\n if (a.bigint_chiffres[j] > b.bigint_chiffres[j])\n return a.bigint_sign;\n else if (a.bigint_chiffres[j] < b.bigint_chiffres[j])\n return !a.bigint_sign;\n }\n return true;\n }\n }", "private boolean less(Comparable a, Comparable b) {\n return a.compareTo(b) < 0;\n }", "static void compare()\n {\n \tif(a < c)\n\t\t {\n\t\t\t comp_one = 1; //store this value , else zero default \n\t\t }\n\t\t if(c < b)\n\t\t {\n\t\t\t comp_two = 2; //store this value , else zero default\n\t\t }\n\t\t if(b < a)\n\t\t {\n\t\t\t comp_thr = 5; //store this value , else zero default\n\t\t }\n\t\t \n\t\t comp_val = comp_one + comp_two + comp_thr; //create a unique value by addition\n }", "public boolean Mayor(Object obj1, Object obj2){\n return (Double.parseDouble(obj1.toString()) > Double.parseDouble(obj2.toString()));\n }", "public static BinaryExpression greaterThan(Expression expression0, Expression expression1) { throw Extensions.todo(); }", "public static boolean isBetween(double a, double b, double c) {\n if (a > c) {\n return a >= b && b >= c;\n } else if (a < c) {\n return a <= b && b <= c;\n } else if (a == c) {\n return a == b;\n } else {\n throw new IllegalArgumentException();\n }\n }", "public static void main(String[] args) {\n int a;\n int b;\n int c;\n a = doDai(\"Nhap canh a\");\n b = doDai(\"Nhap canh b\");\n c = doDai(\"Nhap canh c\");\n if (((a + b) < c) || ((a + c) < b) || ((c + b) < a)) {\n System.out.println(\"khong the la 3 canh cua 1 tam giac \");\n } else {\n System.out.println(\"Canh tam giac hop le\");\n }\n }", "public static void main(String[] args) {\n int i = 140;\n int j = 150;\n int k = 200;\n\n if (i>j){\n System.out.println(\"I is greater then J\");\n }\n else {\n System.out.println(\"I is Less then J \");\n }\n\n System.out.println(\"------------------------//Example of multiple conditions...---------------------------------------\");\n if (k>j){\n System.out.println(\"K is greater then J\");\n }\n else if (j==k){\n System.out.println(\"I is Equal to K\");\n }\n else {\n System.out.println(\"I is Less then to K \");\n }\n }", "private static final int min(int a, int b, int c) {\n int t = (a < b) ? a : b;\n return (t < c) ? t : c;\n }", "public boolean a(C c) {\n return Range.a(this.a, (Comparable) c) <= 0;\n }", "public static void main(String[] args) {\n \n Scanner T = new Scanner(System.in); \n int a,b,c;\n \n System.out.println(\"Ingresa el valor de A\");\n a = T.nextInt();\n System.out.println(\"Ingresa el valor de B\");\n b = T.nextInt();\n System.out.println(\"Ingresa el valor de C\");\n c = T.nextInt();\n \n /*Comparacion mayor*/\n if(a > b && a > c){\n System.out.println(\"El mayor es A con \"+a);\n }else if(b > a && b > c){\n System.out.println(\"El mayor es B con \"+b);\n }else{\n System.out.println(\"El mayor es C con \"+c);\n }\n \n /*Comparacion intermedio*/\n if(a> b && a<c || a<b && a>c){\n System.out.println(\"El intermedio es A \"+a);\n }else if(b > a && b<c || b<a && b>c){\n System.out.println(\"El intermedio es B \"+b);\n }else{\n System.out.println(\"El intermedio es C \"+c);\n\n }\n \n /*Comparacion menor*/\n if(a < b && a < c){\n System.out.println(\"El menor es A con\"+a);\n }else if(b < a && b < c){\n System.out.println(\"El menor es B con\"+b);\n }else{\n System.out.println(\"El menor es C con\"+c);\n }\n \n }", "private static int med3(float x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "private boolean between(int x1, int x2, int x3) {\n return (x1 >= x3 && x1 <= x2) || (x1 <= x3 && x1 >= x2);\n }", "public static boolean a_lteq_b(BigDecimal a, BigDecimal b) {\n\t\tif (a == null || b == null) {\n\t\t\tthrow new RuntimeException(\"a_lteq_b参数错误,a:[\" + a + \"],b:[\" + b + \"]\");\n\t\t}\n\t\tint result = a.compareTo(b);\n\t\tboolean c = result == -1 || result == 0;\n\t\tif (LOG.isDebugEnabled()) {\n\t\t\tLOG.debug(\"[\" + a + \" <= \" + b + \" is \" + c + \"]\");\n\t\t}\n\t\treturn c;\n\t}", "private static int med3(double x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tSystem.out.println(1+2 > 4-2 && 12 < 23);\n\t\tSystem.out.println(1+2 > 4-2 || 12 < 23);\n\t\tSystem.out.println(1+2 > 4-2 && 12 > 23);\n\t\tSystem.out.println(1+2 > 4-2 || 12 > 23);\n\t\t\n\t\t\n\n\t}", "public static void main(String[] args) \r\n\t{\n\t\tint a=3,b=5,c=2;\r\n\t\tif((a>b)&&(a>c))\r\n\t\t{\r\n\t\t\tSystem.out.println(\"A is big\");\r\n\t\t}\r\n\t\telse if(b>c)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"B is big\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"C is big\");\r\n\t\t}\r\n\t\t\r\n\t\tint d=3,e=5,f=8;\r\n\t\tif(d>e||d>f)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"D is big\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"E or F is Big\");\r\n\t\t}\r\n\t\t\r\n\t\tint g=0;\r\n\t\tif(g!=0)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"True\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"False\");\r\n\t\t}\r\n\t}", "public boolean makes10(int a, int b) {\n return (a == 10 || b == 10 || a + b == 10);\n}", "private static int med3(int x[], IntComparator comp, int a, int b, int c) {\n\t\treturn (comp.compare(x[a],x[b])<0 ?\n\t\t\t\t(comp.compare(x[b],x[c])<0 ? b : comp.compare(x[a],x[c])<0 ? c : a) :\n\t\t\t\t\t(comp.compare(x[b],x[c])>0 ? b : comp.compare(x[a],x[c])>0 ? c : a));\n\t}", "private static int med3(long x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "BooleanExpression gteq(ComparableExpression<? extends T> expr);", "public static boolean isBetween(float a, float b, float c) {\n if (a > c) {\n return a >= b && b >= c;\n } else if (a < c) {\n return a <= b && b <= c;\n } else if (a == c) {\n return a == b;\n } else {\n throw new IllegalArgumentException();\n }\n }", "static int compar(int d1,int m1, int y1,int d2,int m2, int y2 )\n{\n if(y1>y2)\n return 1;\n if(y1<y2)\n return -1;\n \n if(m1>m2)\n return 1;\n if(m1<m2)\n return -1;\n \n if(d1>d2)\n return 1;\n if(d1<d2)\n return -1;\n \n \n \n return 0;\n \n \n}", "private boolean cond4(Data C) {\n return (C.getTop() < this.yD);\n }", "default boolean gt(int lhs, int rhs) {\r\n return lt(rhs,lhs);\r\n }", "public boolean lessthan(Inatnum a) throws Exception{\n if((this.isZero() &&a.isZero())==true) {return false;}//if both this and a are both zero, it returns false because it is not less than.\n if((this.isZero())==false&&a.isZero()==true) {return false;}//conditional that check if a is less than this.\n if((this.isZero())==true&&a.isZero()==false) {return true;}//conditional that checks if this is less than a.\n else {return this.pred().lessthan(a.pred()); }}", "public static boolean isBetween(final double a, final double b, final double c) {\r\n\t\tfinal double min = Math.min(a, c);\r\n\t\tfinal double max = Math.max(a, c);\r\n\t\treturn (min < b) && (b < max);\r\n\t}", "public boolean estaoDentroDoRaio(double raio,GPS a2,GPS a3){\n return this.distancia(a2)<raio && this.distancia(a3)<raio;\n }", "public void testComparisons() {\n\tfinal double small = Math.pow(2.0, -42);\n\n\t// Input: a, b\n\tdouble[][] input = new double[][] { new double[] { 1, 1 },\n\t\tnew double[] { 1, 2 }, new double[] { 1, 1 - small / 10 },\n\t\tnew double[] { 1, 1 + small / 10 },\n\n\t\tnew double[] { 0, 1 }, new double[] { 0, 0 },\n\t\tnew double[] { 0, -1 }, new double[] { 0, small / 100 },\n\t\tnew double[] { 2100000001.0001, 2100000001.0003 }, };\n\n\t// Output: less, equals\n\tboolean[][] output = new boolean[][] { new boolean[] { false, true },\n\t\tnew boolean[] { true, false }, new boolean[] { false, true },\n\t\tnew boolean[] { false, true },\n\n\t\tnew boolean[] { true, false }, new boolean[] { false, true },\n\t\tnew boolean[] { false, false }, new boolean[] { false, true },\n\t\tnew boolean[] { false, true }, };\n\n\tfor (int i = 0; i < input.length; ++i) {\n\t boolean l = StandardFloatingPointComparator.getDouble().less(\n\t\t input[i][0], input[i][1]);\n\t boolean e = StandardFloatingPointComparator.getDouble().equals(\n\t\t input[i][0], input[i][1]);\n\n\t boolean ne = StandardFloatingPointComparator.getDouble().notEquals(\n\t\t input[i][0], input[i][1]);\n\t boolean le = StandardFloatingPointComparator.getDouble()\n\t\t .lessOrEquals(input[i][0], input[i][1]);\n\t boolean g = StandardFloatingPointComparator.getDouble().greater(\n\t\t input[i][0], input[i][1]);\n\t boolean ge = StandardFloatingPointComparator.getDouble()\n\t\t .greaterOrEquals(input[i][0], input[i][1]);\n\n\t boolean less = output[i][0];\n\t boolean equals = output[i][1];\n\n\t boolean notEquals = !equals;\n\t boolean lessOrEquals = less || equals;\n\t boolean greater = !lessOrEquals;\n\t boolean greaterOrEquals = !less;\n\n\t assertFalse(l != less);\n\t assertFalse(g != greater);\n\t assertFalse(e != equals);\n\t assertFalse(ne != notEquals);\n\t assertFalse(le != lessOrEquals);\n\t assertFalse(ge != greaterOrEquals);\n\t}\n }", "private static int med3(short x[], int a, int b, int c) {\n\t\treturn (x[a] < x[b] ?\n\t\t\t\t(x[b] < x[c] ? b : x[a] < x[c] ? c : a) :\n\t\t\t\t\t(x[b] > x[c] ? b : x[a] > x[c] ? c : a));\n\t}", "public Snippet visit(GreaterThanEqualExpression n, Snippet argu) {\n\t\t Snippet _ret= new Snippet(\"\",\"\",null,false);\n\t\t Snippet f0 = n.identifier.accept(this, argu);\n\t\t n.nodeToken.accept(this, argu);\n\t\t Snippet f2 = n.identifier1.accept(this, argu);\n\t\t _ret.returnTemp = f0.returnTemp+\" >= \"+f2.returnTemp;\n\t return _ret;\n\t }", "static int minVal(int a, int b, int c, int d){ //minVal function evaluates the lowest value takes 4 ints and returns an int\n \n //logic: (logic table)\n //\n int[] val = new int[]{a, b, c, d}; //loads it into a array to make it easier to cycle through\n if(a == minVal(val[0], val[1])){//if a is smaller than b\n if (a == minVal(val[0], val[2])){// if a is smaller than c\n if(a == minVal(val[0], val[3])) //if a is smaller than d, return a\n return a;\n return val[3]; // if d is not smaller than a but a is smaller than the rest return d\n }//end if\n else if(c == minVal(val[2], val[3])) //if a is smaller than b but not smaller than c, check if c is smaller than d\n return val[2];//return c\n return val[3];// if a is smaller than b but not smaller than c, and c is not smaller than d, return d \n }//end if \n else{ //if(b == minVal(val[0], val[1])){ //if b is smaller than a\n if (b == minVal(val[1], val[2])){ //if b is smaller than c\n if(b == minVal(val[1], val[3])) //if b is smaller than d, return b\n return b;\n return val[3];// if d is not smaller than a but a is smaller than the rest return d\n }//end if\n else if(c == minVal(val[2], val[3]))//if a is smaller than b but not smaller than c, check if c is smaller than d\n return val[2];//return c\n return val[3];// if a is smaller than b but not smaller than c, and c is not smaller than d, return d \n }//end else\n \n }", "public static boolean within(int a, int b, int c, int d) {\n\t return c <= a && b <= d;\n\t}", "public static void main(String ... aa)\n {\n \n boolean a1 = 3 == 4; // false ;because 3 is different than 4\n boolean a2 = 4 != 5 ; // true ; because 4 is different than 5\n boolean a3 = 4 < 3.2 ; // false ;because 4 is greater than 3.2\n \n\n /* Logical operators have as results boolean values , however the operands\n are boolean values as well */\n \n boolean a4 = !(4<3.2); // true ; (4<3.2) is false and !false is true\n boolean a5 = true & (3==4); // false; (3==4) is false and true & false is false\n boolean a6 = false | true ; // true \n boolean a7 = false ^ false ; // false\n \n /**************EXTRA CONCEPTS************/\n \n /* & is the and operator , | is the or operator , ^ is the xor operator\n ! is the negation operator , so these operators fulfill the rules of\n logic */\n \n /* Short-circuit logical operators are || and && , they act as the normal\n | and & ,however , if the first operand is enough to know the final result,\n the second operand will not be evaluated */\n \n boolean a8 = false && (3<4); // this is false , however (3<4) was not evaluated\n \n /* a compile error will appar if we try to use relational and logical operators with\n different types of operators */\n \n // boolean a9 = 3 < true; this will not compile \n \n }", "bool myfunction(Job s1, Job s2)\n {\n return (s1.finish < s2.finish);\n }", "bool myfunction(Job s1, Job s2)\n {\n return (s1.finish < s2.finish);\n }", "public boolean in3050(int a, int b) {\n return ((a >= 30 && a <= 40) && (b >= 30 && b <= 40)) ||\n ((a >= 40 && a <= 50) && (b >= 40 && b <= 50));\n}", "public void testGreaterThanElement() {\n\t // fail(\"testGreaterThanElement\");\n \tCircuit circuit = new Circuit();\n \tDouble x1 = 0.5;\n \tAnd and = (And) circuit.getFactory().getGate(Gate.AND);\n\t\tNot not = (Not) circuit.getFactory().getGate(Gate.NOT);\n\t\tGte gte1 = (Gte) circuit.getFactory().getGate(Gate.GTE);\n \tand.setLeftInput(x1);\n \tnot.setInput(x1);\n \tnot.eval();\n \tand.setRightInput(not.getOutput());\n\t\tand.eval();\n \tgte1.setLeftInput(and.getOutput());\n\t\tgte1.setRightInput(x1);\n \tassertEquals( new Double(0.0), gte1.eval());\n }", "public boolean check() {\n BigInteger t1 = y.modPow(int2, c.p);\n BigInteger t2 = x.modPow(int3, c.p);\n BigInteger t3 = ((t2.add(c.a.multiply(x))).add(c.b)).mod(c.p);\n return t1.compareTo(t3) == 0;\n }", "public boolean validate() {\n double ab = lengthSide(a, b);\n double ac = lengthSide(a, c);\n double bc = lengthSide(b, c);\n\n return ((ab < ac + bc)\n && (ac < ab + bc)\n && (bc < ab + ac));\n }", "public boolean leq(Inatnum a) throws Exception {//purpose: to find if an innatum is less than our equal to another inatnum\n\t\tif((this.isZero() &&a.isZero())==true) {return true;}//if our this value is zero and our a value is zero then return true\n\t\tif((this.isZero())==false&&a.isZero()==true) {return false;}// if our this value isnt zero and our a value is then return false\n\t\tif((this.isZero())==true&&a.isZero()==false) {return true;}// if our this value is zero and our a value isnt then return true\n\t\telse {return this.pred().leq(a.pred());\t}}", "public boolean preceeds(String a, String b) {\n int first = 0;\n int second = 0;\n \n switch (a.charAt(0)) {\n case('+'):\n first = 1;\n break;\n case('-'):\n first = 1;\n break;\n case('*'):\n first = 2;\n break;\n case('/'):\n first = 2;\n break;\n case('%'):\n first = 2;\n break;\n case('('):\n first = 3;\n break;\n case(')'):\n first = 3;\n break;\n default:\n System.out.println(\"Problem with char a in class Operator\");\n }\n switch (b.charAt(0)) {\n case('+'):\n second = 1;\n break;\n case('-'):\n second = 1;\n break;\n case('*'):\n second = 2;\n break;\n case('/'):\n second = 2;\n break;\n case('%'):\n second = 2;\n break;\n case('('):\n second = 3;\n break;\n case(')'):\n second = 3;\n break;\n default:\n System.out.println(\"Problem with char b in class Operator\");\n }\n \n return first <= second;\n }", "List<Object> greaterThanOrEqualsTo(Object value);", "public boolean in1020(int a, int b) {\n return ((a >= 10 && a <= 20) || (b >= 10 && b <= 20));\n}", "public static void main(String[] args) {\n\t\tint a, b, c;\n\t\tScanner S1 = new Scanner(System.in);\n\t\tSystem.out.println(\"Enter the value of A:\");\n\t\ta = S1.nextInt();\n\t\tSystem.out.println(\"Enter the value of B:\");\n\t\tb = S1.nextInt();\n\t\tSystem.out.println(\"Enter the value of c:\");\n\t\tc = S1.nextInt();\n\t\tif (a > b && a > c) {\n\t\t\tSystem.out.println(\"A is greater.\");\n\t\t} else if (b > a && b > c) {\n\t\t\tSystem.out.println(\"B is greater:\");\n\t\t} else {\n\t\t\tSystem.out.println(\"C is greater.\");\n\t\t}\n\n\t}", "public boolean magtacTest(double ma, double ac) {\r\n\t boolean magtac2 = true;\r\n\t if (ac > ma) magtac2 = false;\r\n\t\t \r\n\t if (magtac2 != magtac) {\r\n\t\t // System.out.println(ma + \" \" + ac + \" true\");\r\n\t\t \r\n\t\t if (magtac == true) {\r\n\t\t\t magtac = false;\r\n\t\t\t return true;\r\n\t\t }\r\n\t\t magtac = true;\r\n\t\t return true;\r\n\t }\r\n\t // System.out.println(ma + \" \" + ac + \" false\");\r\n\t return false;\r\n }", "BooleanExpression lteq(ComparableExpression<? extends T> expr);", "private static boolean less(Comparable[] pq, int i, int j) {\n return pq[i-1].compareTo(pq[j-1]) < 0;\n }", "int moverseY(int a,int b){ \n if(b<a){\n return 0;\n }else{\n return 1;\n }//fin else2\n //fin else\n }", "private boolean greater(int i, int j) {\r\n\r\n return compare(pq[i], pq[j]) > 0;\r\n\r\n }", "public boolean isSatisfied(CPO cpo) throws IllegalActionException {\n\t\tint result = cpo.compare(_lesserTerm.getValue(),\n\t\t\t\t_greaterTerm.getValue());\n\t\treturn ((result == CPO.LOWER) || (result == CPO.SAME));\n\t}", "static int ifEquals(int x, int y, int a, int b) { \n //return x==y?a:b; \n return onEqu1(x, y, a, b, ((x-y)-1)>>31);\n }" ]
[ "0.6546493", "0.6437621", "0.6297933", "0.6288665", "0.6288629", "0.6282517", "0.6244928", "0.6167188", "0.6138189", "0.60069835", "0.5951933", "0.5922606", "0.58875084", "0.58797073", "0.5873491", "0.5843565", "0.5839509", "0.58384705", "0.58317024", "0.57985264", "0.5788427", "0.5787825", "0.57867074", "0.5758567", "0.5742796", "0.57037777", "0.5676429", "0.566229", "0.5638186", "0.563673", "0.56277686", "0.55987525", "0.55905974", "0.55871946", "0.5583616", "0.5579475", "0.55721134", "0.55514544", "0.55416614", "0.55398923", "0.55382156", "0.55325764", "0.5529316", "0.5510828", "0.55101526", "0.55000407", "0.5491354", "0.548585", "0.5482654", "0.54817057", "0.5472238", "0.54682016", "0.5464308", "0.54634714", "0.5460336", "0.54523396", "0.54497755", "0.5445852", "0.54403245", "0.5436069", "0.542026", "0.5413496", "0.5411354", "0.5406578", "0.5392742", "0.5387358", "0.5374254", "0.5373289", "0.53731394", "0.5365319", "0.53646374", "0.5353517", "0.53535146", "0.5353143", "0.53473246", "0.5331369", "0.5316296", "0.530738", "0.53044546", "0.5297915", "0.52962744", "0.5290246", "0.52635735", "0.5259849", "0.5259849", "0.52593476", "0.5252089", "0.5229924", "0.52245235", "0.522231", "0.52196676", "0.52044827", "0.52017397", "0.5201102", "0.51994485", "0.5197969", "0.5191169", "0.51892877", "0.5187578", "0.5181733", "0.51796937" ]
0.0
-1
The triangles that must be oriented this way (won't be done by another rule) all look like the ones below, where the dots are a collider path from L to A with each node on the path (except L) a parent of C. B xo x is either an arrowhead or a circle / \ v v L....A > C
private boolean discrimPaths(Graph graph) { List<Node> nodes = graph.getNodes(); for (Node b : nodes) { //potential A and C candidate pairs are only those // that look like this: A<-oBo->C or A<->Bo->C List<Node> possAandC = graph.getNodesOutTo(b, Endpoint.ARROW); //keep arrows and circles List<Node> possA = new LinkedList<>(possAandC); possA.removeAll(graph.getNodesInTo(b, Endpoint.TAIL)); //keep only circles List<Node> possC = new LinkedList<>(possAandC); possC.retainAll(graph.getNodesInTo(b, Endpoint.CIRCLE)); for (Node a : possA) { for (Node c : possC) { if (!graph.isParentOf(a, c)) { continue; } LinkedList<Node> reachable = new LinkedList<>(); reachable.add(a); if (reachablePathFindOrient(graph, a, b, c, reachable)) { return true; } } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public TriangleBumper(Double x,Double y,Double orientation,List<Gadget>triggeredGadgets){\n this.x = x;\n this.y = y;\n this.collideCirc = new ArrayList<Circle>(); //corner that ball will collide with\n this.collideLine = new ArrayList<LineSegment>(); //side that ball will collide with\n this.orientation = orientation;\n this.triggeredGadgets = new ArrayList<>();\n for (Gadget gadget : triggeredGadgets){\n this.triggeredGadgets.add(gadget);\n }\n //circle at each corner\n //line segment at each side\n if(this.orientation == 0.0){\n this.circles = Arrays.asList(new Circle(x,y,0.0), new Circle(x, y+1, 0.0), new Circle(x+1, y, 0.0));\n this.lines = Arrays.asList(new LineSegment(x+1, y, x, y+1), new LineSegment(x, y, x, y+1), new LineSegment(x,y, x+1, y));\n }else if (this.orientation == 90.0){\n this.circles = Arrays.asList(new Circle(x,y,0.0), new Circle(x+1, y, 0.0), new Circle(x+1, y+1,0.0));\n this.lines = Arrays.asList(new LineSegment(x, y, x+1, y), new LineSegment(x+1, y, x+1, y+1), new LineSegment(x,y, x+1, y+1));\n }else if (this.orientation == 180.0){\n this.circles = Arrays.asList(new Circle(x,y+1, 0.0), new Circle(x+1, y, 0.0), new Circle(x+1, y+1, 0.0));\n this.lines = Arrays.asList(new LineSegment(x, y+1, x+1, y), new LineSegment(x+1, y, x+1, y+1), new LineSegment(x+1, y+1, x, y+1));\n }else{\n this.circles = Arrays.asList(new Circle(x,y,0.0), new Circle(x, y+1, 0.0), new Circle(x+1, y+1, 0.0));\n this.lines = Arrays.asList(new LineSegment(x,y,x, y+1), new LineSegment(x,y+1, x+1, y+1), new LineSegment(x+1, y+1, x, y));\n }\n checkRep();\n\n }", "private void generatePrism() {\n\t\tdouble halfAltitude = Math.sin(Math.PI / 3); // The cross-section is an equilateral triangle with sides of length 2 units. The altitude is the height of the triangle with one edge horizontal\n\t\tverts = new Vector[] {new Vector(3), new Vector(3), new Vector(3), new Vector(3), new Vector(3), new Vector(3)};\n\t\tverts[0].setElements(new double[] {-1, -halfAltitude, -1});\n\t\tverts[1].setElements(new double[] {0, halfAltitude, -1});\n\t\tverts[2].setElements(new double[] {1, -halfAltitude, -1});\n\t\t// Use the same triangle of vertices but offset by 2 units along the z-axis\n\t\tverts[3].setElements(verts[0]);\n\t\tverts[4].setElements(verts[1]);\n\t\tverts[5].setElements(verts[2]);\n\t\tverts[3].setElement(2, 1);\n\t\tverts[4].setElement(2, 1);\n\t\tverts[5].setElement(2, 1);\n\t\t\n\t\tfaces = new int[][] {{0, 1, 2}, {0, 5, 3}, {0, 2, 5}, {0, 3, 4}, {0, 4, 1}, {1, 4, 5}, {1, 5, 2}, {3, 5, 4}};\n\t}", "private void defineVertexes(String orientation){\n if(\"down\".equals(orientation)){\n y2 = y1-height;\n y3 = y1-height;\n \n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"up\")){\n y2 = y1+height;\n y3 = y1+height;\n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"left\")){\n x2 = x1-height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }else if(orientation.equals(\"right\")){\n x2 = x1+height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }\n }", "public static ArrayList<Triangle> Triangulation(ArrayList<Point> points){\n\t\t\n\t\t\n\t\t\n\t\tpoints.sort(new PointComperator());\n\t\tpoints.add(MainFrame.buutomLeft);\n\t\tStack<Point> CH= new Stack<Point>();\n\t\tArrayList<Triangle> T=new ArrayList<Triangle>();\n\t\tCH.push(MainFrame.buutomLeft);\n\t\tCH.push(points.get(0));\n\t\tCH.push(points.get(1));\n\t\t\n\t\tfor (int i = 0; i < points.size(); i++) {\n\t\t\tPoint curr=points.get(i);\n\t\t\tif(Orient(CH.get(CH.size()-2),CH.peek(), curr))\n\t\t\t{\n\t\t\t\tT.add(new Triangle(curr, CH.peek(), MainFrame.buutomLeft));\n\t\t\t\tCH.push(curr);\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tT.add(new Triangle(CH.peek(), curr, MainFrame.buutomLeft));\n\n\t\t\t\twhile(!Orient(CH.get(CH.size()-2),CH.peek(),curr)) {\n\t\t\t\t\tPoint temp = CH.pop();\n\t\t\t\t\tT.add(new Triangle(temp, CH.peek(), curr));\n\t\t\t\t}\n\t\t\t\tCH.push(curr);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn T;\n\t}", "public void triangulo() {\n fill(0);\n stroke(255);\n strokeWeight(5);\n triangle(width/2, 50, height+100, 650, 350, 650);\n //(width/2, height-100, 350, 150, 900, 150);\n }", "public Triangle (int tipX, int tipY, int height, String orientation){\n super.points = new ArrayList();\n x1 = tipX;\n y1 = tipY;\n this.height = height;\n defineVertexes(orientation);\n definePoints();\n }", "private void doubleTriangle(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n\n List<Node> intoBArrows = graph.getNodesInTo(B, Endpoint.ARROW);\n List<Node> intoBCircles = graph.getNodesInTo(B, Endpoint.CIRCLE);\n\n //possible A's and C's are those with arrows into B\n List<Node> possA = new LinkedList<>(intoBArrows);\n List<Node> possC = new LinkedList<>(intoBArrows);\n\n //possible D's are those with circles into B\n for (Node D : intoBCircles) {\n for (Node A : possA) {\n for (Node C : possC) {\n if (C == A) {\n continue;\n }\n\n //skip anything not a double triangle\n if (!graph.isAdjacentTo(A, D) ||\n !graph.isAdjacentTo(C, D)) {\n continue;\n }\n\n //skip if A,D,C is a collider\n if (graph.isDefCollider(A, D, C)) {\n continue;\n }\n\n //if all of the previous tests pass, orient D*-oB as D*->B\n if (!isArrowpointAllowed(graph, D, B)) {\n continue;\n }\n\n graph.setEndpoint(D, B, Endpoint.ARROW);\n changeFlag = true;\n }\n }\n }\n }\n }", "public void setupTriangles(VrState state);", "protected void building(double xCoord, double yCoord, double len, double width, double height)\n {\n double x1 = (xCoord - (width/2)); // Low x\n double x2 = (xCoord + (width/2)); // High x\n double y1 = (yCoord - (len/2)); // Low y\n double y2 = (yCoord + (len/2)); // High y\n\n Vertex vertex1, vertex2, vertex3;\n\n Triple pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, col1, col2, col3, col4;\n Vertex vert1, vert2, vert3;\n\n pos1 = new Triple(x1, y1, 0); \n pos2 = new Triple(x2, y1, 0); \n pos3 = new Triple(x2, y1, height);\n pos4 = new Triple(x1, y1, height);\n pos5 = new Triple(x1, y2, 0); \n pos6 = new Triple(x2, y2, 0); \n pos7 = new Triple(x2, y2, height);\n pos8 = new Triple(x1, y2, height);\n\n col1 = new Triple(1, 0, 0); \n col2 = new Triple(0, 1, 0); \n col3 = new Triple(0, 0, 1); \n col4 = new Triple(1, 0, 1); \n \n // Front Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos1, 0, 0), \n new Vertex(pos2, 0, 1), \n new Vertex(pos3, 1, 1), \n\t\t\t\t 25 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos3, 1, 1), \n new Vertex(pos4, 1, 0), \n new Vertex(pos1, 0, 0),\n 25 ) );\n \n // Left Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos1, 0, 0), \n new Vertex(pos5, 0, 1), \n new Vertex(pos8, 1, 1),\n 26 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos8, 1, 1), \n new Vertex(pos4, 1, 0), \n new Vertex(pos1, 0, 0),\n 26 ) );\n\n // Right Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos2, 0, 0), \n new Vertex(pos6, 0, 1), \n new Vertex(pos7, 1, 1),\n 24 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos7, 1, 1), \n new Vertex(pos3, 1, 0), \n new Vertex(pos2, 0, 0),\n 24 ) );\n\n // Back Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos5, 0, 0), \n new Vertex(pos6, 0, 1), \n new Vertex(pos7, 1, 1),\n 27 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos7, 1, 1), \n new Vertex(pos8, 1, 0), \n new Vertex(pos5, 0, 0),\n 27 ) );\n\n // Top Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos4, 0, 0), \n new Vertex(pos3, 0, 1), \n new Vertex(pos7, 1, 1),\n 28 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos7, 1, 1), \n new Vertex(pos8, 1, 0), \n new Vertex(pos4, 0, 0),\n 28 ) );\n }", "@Override\n protected Double[] getCorners(){\n return new Double[]{\n //leftmost point\n getXPos(), getYPos(),\n //rightmost point\n getXPos() + getWidth(), getYPos(),\n //middle point\n getXPos() + getWidth() / 2, getYPos() + getHeight() * getThirdTriangleYPoint(pointUp)\n };\n }", "protected void boxOfMortys() {\n Triple pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, col1, col2, col3, col4;\n\n pos1 = new Triple(-10, -10, 0);\n pos2 = new Triple(110, -10, 0);\n pos3 = new Triple(110, -10, 120);\n pos4 = new Triple(-10, -10, 120);\n pos5 = new Triple(-10, 110, 0);\n pos6 = new Triple(110, 110, 0);\n pos7 = new Triple(110, 110, 120);\n pos8 = new Triple(-10, 110, 120);\n\n // Front Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos1, 0, 0),\n new Vertex(pos2, 1, 0),\n new Vertex(pos3, 1, 1),\n 22 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos3, 1, 1),\n new Vertex(pos4, 0, 1),\n new Vertex(pos1, 0, 0),\n 22 ) );\n\n // Left Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos1, 0, 0),\n new Vertex(pos5, 1, 0),\n new Vertex(pos8, 1, 1),\n 22 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos8, 1, 1),\n new Vertex(pos4, 0, 1),\n new Vertex(pos1, 0, 0),\n 22 ) );\n\n // Right Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos2, 0, 0),\n new Vertex(pos6, 1, 0),\n new Vertex(pos7, 1, 1),\n 22 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos7, 1, 1),\n new Vertex(pos3, 0, 1),\n new Vertex(pos2, 0, 0),\n 22 ) );\n\n // Back Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos5, 0, 0),\n new Vertex(pos6, 1, 0),\n new Vertex(pos7, 1, 1),\n 22 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos7, 1, 1),\n new Vertex(pos8, 0, 1),\n new Vertex(pos5, 0, 0),\n 22 ) );\n\n // Top Triangles\n// frozenSoups.addTri( new Triangle(new Vertex(pos4, 0, 0),\n// new Vertex(pos3, 0, 1),\n// new Vertex(pos7, 1, 1),\n// 20 ) );\n\n// frozenSoups.addTri( new Triangle(new Vertex(pos7, 0, 0),\n// new Vertex(pos8, 1, 0),\n// new Vertex(pos4, 1, 1),\n// 20 ) );\n }", "Triangle(){\n side1 = 1.0;\n side2 = 1.0;\n side3 = 1.0;\n }", "public Triangle(\n IPoint firstPoint,\n IPoint secondPoint,\n IPoint thirdPoint,\n IPrimitive parent)\n {\n super(parent);\n this.addVertex(firstPoint);\n this.addVertex(secondPoint);\n this.addVertex(thirdPoint);\n\n }", "private static void breadcrumbArrow(int width, int height, int indent, int c1, int c2) {\n\n\t\tdouble x0 = 0, y0 = height / 2d;\n\t\tdouble x1 = indent, y1 = 0;\n\t\tdouble x2 = indent, y2 = height / 2d;\n\t\tdouble x3 = indent, y3 = height;\n\t\tdouble x4 = width, y4 = 0;\n\t\tdouble x5 = width, y5 = height / 2d;\n\t\tdouble x6 = width, y6 = height;\n\t\tdouble x7 = indent + width, y7 = 0;\n\t\tdouble x8 = indent + width, y8 = height;\n\n\t\tint fc1 = ColorHelper.mixAlphaColors(c1, c2, 0);\n\t\tint fc2 = ColorHelper.mixAlphaColors(c1, c2, (indent)/(width + 2f * indent));\n\t\tint fc3 = ColorHelper.mixAlphaColors(c1, c2, (indent + width)/(width + 2f * indent));\n\t\tint fc4 = ColorHelper.mixAlphaColors(c1, c2, 1);\n\n\t\tRenderSystem.disableTexture();\n\t\tRenderSystem.enableBlend();\n\t\tRenderSystem.disableAlphaTest();\n\t\tRenderSystem.defaultBlendFunc();\n\t\tRenderSystem.shadeModel(GL11.GL_SMOOTH);\n\n\t\tTessellator tessellator = Tessellator.getInstance();\n\t\tBufferBuilder bufferbuilder = tessellator.getBuffer();\n\t\tbufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);\n\n\t\tbufferbuilder.vertex(x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x7, y7, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x8, y8, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();\n\n\t\ttessellator.draw();\n\t\tRenderSystem.shadeModel(GL11.GL_FLAT);\n\t\tRenderSystem.disableBlend();\n\t\tRenderSystem.enableAlphaTest();\n\t\tRenderSystem.enableTexture();\n\t}", "private void createVertices(int iX, int iY, int iXO, int iYO, int num, int increment) {\n int y = iY;\n if (num == 0 && increment == 0) {\n BracketNode last = new BracketNode(\"\", iX, y - 20, iXO, 20);\n nodes.add(last);\n getChildren().addAll(new Line(iX, iY, iX + iXO, iY), last);\n last.setName(currentBracket.getBracket().get(location));\n bracketMap.put(last, location);\n nodeMap.put(location, last);\n } else {\n ArrayList<BracketNode> aNodeList = new ArrayList<>();\n for (int i = 0; i < num; i++) {\n Point2D tl = new Point2D(iX, y);\n Point2D tr = new Point2D(iX + iXO, y);\n Point2D bl = new Point2D(iX, y + iYO);\n Point2D br = new Point2D(iX + iXO, y + iYO);\n BracketNode nTop = new BracketNode(\"\", iX, y - 20, iXO, 20);\n aNodeList.add(nTop);\n nodes.add(nTop);\n BracketNode nBottom = new BracketNode(\"\", iX, y + (iYO - 20), iXO, 20);\n aNodeList.add(nBottom);\n nodes.add(nBottom);\n Line top = new Line(tl.getX(), tl.getY(), tr.getX(), tr.getY());\n Line bottom = new Line(bl.getX(), bl.getY(), br.getX(), br.getY());\n Line right = new Line(tr.getX(), tr.getY(), br.getX(), br.getY());\n getChildren().addAll(top, bottom, right, nTop, nBottom);\n isTop = !isTop;\n y += increment;\n }\n ArrayList<Integer> tmpHelp = helper(location, num);\n for (int j = 0; j < aNodeList.size(); j++) {\n //System.out.println(currentBracket.getBracket().get(tmpHelp.get(j)));\n aNodeList.get(j).setName(currentBracket.getBracket().get(tmpHelp.get(j)));\n bracketMap.put(aNodeList.get(j), tmpHelp.get(j));\n nodeMap.put(tmpHelp.get(j), aNodeList.get(j));\n //System.out.println(bracketMap.get(aNodeList.get(j)));\n }\n }\n\n }", "void checkTriangleType() {\n\n int x = triangle.x;\n int y = triangle.y;\n int z = triangle.z;\n\n if (x <= 0 || y <= 0 || z <= 0) triangle.triangleType = TriangleType.INVALID; // INVALID\n else if (x >= y + z || z >= x + y || y >= x + z) triangle.triangleType = TriangleType.INVALID; // INVALID\n else if (x == y && y == z) triangle.triangleType = TriangleType.EQUILATERAL; // EQUILATERAL Case\n else if (x == y || y == z || x == z) triangle.triangleType = TriangleType.ISOSCELES; // ISOSCELES Case\n else triangle.triangleType = TriangleType.SCALENE; // SCALENE Case\n }", "public boolean isTriangle () {\r\n\t\tif (startSide1 > 0 && startSide2 > 0 && startSide3 > 0){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse return false;\r\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn \"(Triangle \"+verts+\")\" ;\n\t}", "protected void skybox() {\n Triple pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8, col1, col2, col3, col4;\n\n pos1 = new Triple(0, 0, 0);\n pos2 = new Triple(100, 0, 0);\n pos3 = new Triple(100, 0, 100);\n pos4 = new Triple(0, 0, 100);\n pos5 = new Triple(0, 100, 0);\n pos6 = new Triple(100, 100, 0);\n pos7 = new Triple(100, 100, 100);\n pos8 = new Triple(0, 100, 100);\n\n // Front Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos1, 0, 0),\n new Vertex(pos2, .25, 0),\n new Vertex(pos3, .25, 1),\n 21 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos3, .25, 1),\n new Vertex(pos4, 0, 1),\n new Vertex(pos1, 0, 0),\n 21 ) );\n\n // Left Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos1, 1, 0),\n new Vertex(pos5, .75, 0),\n new Vertex(pos8, .75, 1),\n 21 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos8, .75, 1),\n new Vertex(pos4, 1, 1),\n new Vertex(pos1, 1, 0),\n 21 ) );\n\n // Right Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos2, .25, 0),\n new Vertex(pos6, .5, 0),\n new Vertex(pos7, .5, 1),\n 21 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos7, .5, 1),\n new Vertex(pos3, .25, 1),\n new Vertex(pos2, .25, 0),\n 21 ) );\n\n // Back Triangles\n frozenSoups.addTri( new Triangle(new Vertex(pos5, .75, 0),\n new Vertex(pos6, .5, 0),\n new Vertex(pos7, .5, 1),\n 21 ) );\n\n frozenSoups.addTri( new Triangle(new Vertex(pos7, .5, 1),\n new Vertex(pos8, .75, 1),\n new Vertex(pos5, .75, 0),\n 21 ) );\n\n // Top Triangles\n// frozenSoups.addTri( new Triangle(new Vertex(pos4, 0, 0),\n// new Vertex(pos3, 0, 1),\n// new Vertex(pos7, 1, 1),\n// 20 ) );\n\n// frozenSoups.addTri( new Triangle(new Vertex(pos7, 0, 0),\n// new Vertex(pos8, 1, 0),\n// new Vertex(pos4, 1, 1),\n// 20 ) );\n }", "public void calculateTriangle(float posX, float posY, float rotation)\n {\n\n rotation = (int)rotation;\n\n float nearRotation = rotation;\n nearRotation = (float)(90 * (Math.round(nearRotation / 90)));\n\n points[0]=posX+10/ PlayScreen.PPM/SCALE; points[1]=posY+10/ PlayScreen.PPM/SCALE;\n points[2]=posX+118/ PlayScreen.PPM/SCALE; points[3]=posY+10/ PlayScreen.PPM/SCALE;\n points[4]=posX+10/ PlayScreen.PPM/SCALE; points[5]=posY+118/ PlayScreen.PPM/SCALE;\n\n if(nearRotation > 270f || nearRotation == 0f)\n {\n acceptedDirs = \"dl\";\n }\n else if(nearRotation > 0f && nearRotation <= 90f)\n {\n acceptedDirs = \"dr\";\n\n }\n else if(nearRotation > 90f && nearRotation <=180f)\n {\n acceptedDirs = \"ur\";\n }\n else if(nearRotation > 180f && nearRotation <= 270f)\n {\n acceptedDirs = \"ul\";\n }\n\n\n poly.setVertices(points);\n poly.setOrigin(mirror.getX() + mirror.getWidth()/2, mirror.getY() + mirror.getHeight()/2);\n poly.setRotation(mirror.getRotation());\n shape.set(poly.getTransformedVertices());\n fdef.shape = shape;\n fdef.density =1f;\n\n int fixtureCount = B2body.getFixtureList().size;\n for(int i=0;i<fixtureCount;i++)\n {\n B2body.destroyFixture(B2body.getFixtureList().get(i));\n }\n B2body.createFixture(fdef).setUserData(getUserData());\n }", "private void doDdpOrientation(Graph graph, Node l, Node a, Node b, Node c) {\n changeFlag = true;\n for (IonIndependenceFacts iif : separations) {\n if ((iif.getX().equals(l) && iif.getY().equals(c)) ||\n iif.getY().equals(l) && iif.getX().equals(c)) {\n for (List<Node> condSet : iif.getZ()) {\n if (condSet.contains(b)) {\n graph.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(graph);\n return;\n }\n }\n break;\n }\n }\n Graph newGraph1 = new EdgeListGraph(graph);\n newGraph1.setEndpoint(a, b, Endpoint.ARROW);\n newGraph1.setEndpoint(c, b, Endpoint.ARROW);\n discrimGraphs.add(newGraph1);\n Graph newGraph2 = new EdgeListGraph(graph);\n newGraph2.setEndpoint(c, b, Endpoint.TAIL);\n discrimGraphs.add(newGraph2);\n }", "public void makeTriangleBox(int offsetX, int offsetY, int myWidth, int myHeight, int numTriHorizontal, int numTriVertical, int collRect, float[][] verts) {\n //Top Triangles\n for (int i = 0; i < numTriHorizontal; i++) {\n verts[i][0] = (i*myWidth/numTriHorizontal) + offsetX;\n verts[i][1] = offsetY;\n verts[i][2] = ((i+1)*(myWidth/numTriHorizontal)) + offsetX;\n verts[i][3] = offsetY;\n verts[i][4] = (myWidth/(2*numTriHorizontal)) + (i*myWidth/numTriHorizontal) + offsetX;\n if(i%2==0) {\n verts[i][5] = (float) ((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal)) + offsetY;\n } else {\n verts[i][5] = (float)((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal)) + offsetY;\n }\n\n }\n\n //Left Triangles\n\n for (int i = numTriHorizontal; i < (numTriVertical + numTriHorizontal); i++) {\n verts[i][0] = offsetX;\n verts[i][1] = offsetY + ((i-numTriHorizontal) * (myWidth/numTriHorizontal));\n verts[i][2] = offsetX;\n verts[i][3] = offsetY + ((i-(numTriHorizontal-1)) * (myWidth/numTriHorizontal));\n if(i%2==0) {\n verts[i][4] = offsetX + (float) ((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal));\n } else {\n verts[i][4] = offsetX + (float) ((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal));\n }\n verts[i][5] = offsetY + ((i-numTriHorizontal) * (myWidth/numTriHorizontal)) + myWidth/(2*numTriHorizontal);\n\n }\n\n\n //Right Triangles\n for(int i=numTriVertical+numTriHorizontal; i<(2*numTriVertical)+numTriHorizontal; i++) {\n verts[i][0] = width-offsetX;\n verts[i][1] = offsetY + ((i-(numTriVertical+numTriHorizontal)) * (myWidth/numTriHorizontal));\n verts[i][2] = width-offsetX;\n verts[i][3] = offsetY + ((i-(numTriVertical+(numTriHorizontal-1))) * (myWidth/numTriHorizontal));\n if(i%2==0) {\n verts[i][4] = width-(offsetX + (float) ((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal)));\n } else {\n verts[i][4] = width-(offsetX + (float) ((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal)));\n }\n verts[i][5] = offsetY + ((i-(numTriVertical+numTriHorizontal)) * (myWidth/numTriHorizontal)) + myWidth/(2*numTriHorizontal);\n\n }\n\n //Bottom Triangles\n for(int i=(2*numTriVertical)+numTriHorizontal; i<(2*numTriVertical)+(2*numTriHorizontal); i++) {\n verts[i][0] = ((i-((2*numTriVertical)+numTriHorizontal))*myWidth/numTriHorizontal) + offsetX;\n verts[i][1] = (height-100) - offsetY;\n verts[i][2] = ((i-((2*numTriVertical)+numTriHorizontal) +1)*(myWidth/numTriHorizontal)) + offsetX;\n verts[i][3] = (height-100) - offsetY;\n verts[i][4] = (myWidth/(2*numTriHorizontal)) + ((i-((2*numTriVertical)+numTriHorizontal))*myWidth/numTriHorizontal) + offsetX;\n if(i%2==0) {\n verts[i][5] = (float)((height-100) - ( ((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal)) + offsetY));\n } else {\n verts[i][5] = (float)((height-100) - ( ((Math.sqrt(3) / 2) * (myWidth / numTriHorizontal)) + offsetY));\n }\n\n }\n\n }", "public void isItATriangle(){\n Scanner firstSide = new Scanner(System.in);\n System.out.println(\"Please put in your first side length: \");\n int side1 = firstSide.nextInt();\n\n Scanner secondSide = new Scanner(System.in);\n System.out.println(\"Please put in your second side length: \");\n int side2 = secondSide.nextInt();\n\n Scanner thirdSide = new Scanner(System.in);\n System.out.println(\"Please put in your third side length: \");\n int side3 = thirdSide.nextInt();\n\n System.out.println(\"\\nNow calculating to see if you have a Triangle...\");\n System.out.println(\"Your first side value: \" + side1 + \"\\nYour second side value: \" + side2 + \"\\nYour third side value: \" + side3 + \"\\n\");\n\n //*****************************************************************\n /*\n *This is seeing is the sides are going to be enough for a Triangle\n *using Triangle Inequality Theorem\n */\n if(side1 + side2 > side3){\n if(side1 + side3 > side2){\n if(side2 + side3 > side1){\n System.out.println(\"Yes! This is a Triangle!\");\n\n if ((side1 == side2) && (side2 == side3) && (side3 == side1)){\n System.out.println(\"Oh hey! Your Triangle is an Equilaterall Triangle!\");\n }else{\n System.out.print(\"\");\n }\n\n if (((side1 == side2) && (side2 != side3)) || ((side2 == side3) && (side3 != side1)) || ((side3 == side1) && (side3 != side2))){\n System.out.println(\"Wow! Your triangle is Isosoleces!\");\n }else{\n System.out.print(\"\");\n }\n\n }else{\n System.out.println(\"No, Not a Triangle\");\n }\n }else{\n System.out.println(\"No, Not a Triangle\");\n }\n }else{\n System.out.println(\"No, Not a Triangle.\");\n return;\n }\n\n //checking to see if equilaterall\n\n }", "private void layoutArrow(Word words[]) {\n\t\tarrows = new Arrow[words.length];\n\t\tarrowNum = 0;\n\n\t\tfor (int i = 0; i < words.length; ++i) {\n\t\t\tif (words[i].getParent() == Constants.PARENT_EOS) {\n\t\t\t\tarrows[arrowNum] = new Arrow(this, tokens[words[i].getId()],\n\t\t\t\t\t\ttokens[words.length]);\n\t\t\t\tarrows[arrowNum].draw();\n\t\t\t\t++arrowNum;\n\t\t\t} else if (words[i].getParent() != Constants.PARENT_NULL) {\n\t\t\t\tarrows[arrowNum] = new Arrow(this, tokens[words[i].getId()],\n\t\t\t\t\t\ttokens[words[i].getParent()]);\n\t\t\t\tarrows[arrowNum].draw();\n\t\t\t\t++arrowNum;\n\t\t\t}\n\n\t\t}\n\n\t}", "private void positionVerticesAsApices(V vi, V vi_1, V v, Map<V,Point2D> positions, List<E> Si, List<V> vertices){\n\t\t//vertices should be apices of a polygon and should be placed inside the triangle whose\n\t\t//apices are vi, vi_1 and v\n\t\tPoint2D viPoint = positions.get(vi);\n\t\tPoint2D vi_1Point = positions.get(vi_1);\n\t\tPoint2D vPoint = positions.get(v);\n\n\n\t\tlog.info(\"positioning apices \" + vertices);\n\t\tlog.info(\"viPoint \" + vi +\" \"+ viPoint);\n\t\tlog.info(\"vi_1Point \" + vi_1 + \" \" + vi_1Point);\n\t\tlog.info(\"vPoint \" + v + \" \"+ vPoint);\n\n\t\t//this is done so that the vertex linked with vi would be next to it\n\t\t//prevent wrong order\n\t\tboolean reverse = false;\n\n\t\tfor (E e : Si){\n\t\t\tif ((e.getOrigin() == vi && e.getDestination() == vertices.get(0)) || \n\t\t\t\t\t(e.getDestination() == vi && e.getOrigin() == vertices.get(0))){\n\t\t\t\treverse = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\n\t\t//might not be the ideal solution, but it gets the job done\n\t\t//with solid results which are in accordance to the algorithms\n\t\t//requirements regarding this positioning\n\n\t\t//find centroid of the triangle\n\t\t////place one vertex there\n\t\t//draw a line parallel to vi,vi+1 through the controid\n\t\t//find the intersection with v,vi and v, vi+1\n\t\t//get two new triangles\n\t\t//vi, intersection, centroid\n\t\t//vi+1, other intersection centroid\n\t\t//then to the same for those two triangles\n\t\t//find their centroids\n\t\t//then form two new triangles\n\t\t//do so in a way that will guarantee that their centroid\n\t\t//is placed so that the line constantly rises or drops\n\t\t//and moves from left to right - no zig zags\n\t\t//that's the purpose of the parallel line - prevent\n\t\t//such oscillations\n\t\t//if one of the apices of a new triangle is the old centroid\n\t\t//the other apex should be on the parallel line drawn to contain it\n\t\t//intersection of the median containing the new centroid and that parallel line\n\n\t\tMap<Integer, List<Triangle>> trianglesLevelsMap = new HashMap<Integer, List<Triangle>>();\n\t\tint level = 1;\n\t\tTriangle firstTriangle = new Triangle(viPoint, vi_1Point, vPoint);\n\t\tif (vertices.size() == 1){\n\t\t\tpositions.put(vertices.get(0), Calc.triangleCentroid(firstTriangle));\n\t\t\treturn;\n\t\t}\n\n\n\t\tList<Triangle> levelOne = new ArrayList<Triangle>();\n\t\tlevelOne.add(firstTriangle);\n\t\ttrianglesLevelsMap.put(1, levelOne);\n\n\t\t//not going to position vertices as soon \n\t\t//as a centroid is calculated\n\t\t//the centroids closest to the vi and vi_1 and\n\t\t//those belonging to the lastly formed triangles\n\t\t//are where the first two vertices should be positioned\n\t\t//so, firstly just calculate all centroid\n\t\t//place these positions in a list so that\n\t\t//the first vertex should be positioned\n\t\t//on the point of the first centroid\n\t\t//last on the point of the last centroid\n\t\t//when placing the vertices later\n\t\t//pick one from the start, position it\n\t\t//pick one from the back, position it\n\t\t//not all centroid positions will be used\n\t\t//but this guarantees symmetry \n\n\t\tList<Point2D> centroidPositions = new ArrayList<Point2D>(); \n\n\t\twhile (centroidPositions.size() < vertices.size()){\n\n\t\t\tList<Triangle> triangles = trianglesLevelsMap.get(level);\n\n\t\t\t//divide the triangle,form new ones\n\t\t\t//if current triangle is at level one (vi, vi+1, v)\n\t\t\t//draw a line through centroid parallel to vi,vi+1\n\t\t\t//new triangles are vi, intersection 1, centroid\n\t\t\t//and vi+i, intersection 2, centroid\n\t\t\t//try to establish some convention regarding which point will be a,b and c\n\t\t\t//use that to generalize division and creation of new triangles\n\n\n\t\t\tfor(Triangle t : triangles){\n\n\t\t\t\tPoint2D centroid = Calc.triangleCentroid(t);\n\t\t\t\tt.setCentroid(centroid);\n\n\t\t\t\t//see where to put this centroid\n\t\t\t\tif (t.getParentTriangle() == null)\n\t\t\t\t\tcentroidPositions.add(centroid);\n\t\t\t\telse{\n\t\t\t\t\tPoint2D parentCentroid = t.getParentTriangle().getCentroid();\n\t\t\t\t\tint parentIndex = centroidPositions.indexOf(parentCentroid);\n\t\t\t\t\tif (t.isBeforeParent())\n\t\t\t\t\t\tcentroidPositions.add(parentIndex, centroid);\n\t\t\t\t\telse\n\t\t\t\t\t\tcentroidPositions.add(parentIndex + 1, centroid);\n\t\t\t\t}\n\n\n\t\t\t\tLine parallelTo = Calc.lineThroughTwoPoints(t.getA(), t.getB());\n\t\t\t\tLine parallelLine = Calc.parallelLineThroughPoint(parallelTo, centroid);\n\t\t\t\tList<Triangle> nextLevelTriangls = trianglesLevelsMap.get(level + 1);\n\t\t\t\tTriangle t1, t2;\n\n\t\t\t\tif (nextLevelTriangls == null){\n\t\t\t\t\tnextLevelTriangls = new ArrayList<Triangle>();\n\t\t\t\t\ttrianglesLevelsMap.put(level + 1, nextLevelTriangls);\n\t\t\t\t}\n\n\t\t\t\tif (level == 1){\n\t\t\t\t\tLine l1 = Calc.lineThroughTwoPoints(t.getA(), t.getC()); //vi and v\n\t\t\t\t\tPoint2D intersection1 = Calc.intersectionOfLines(l1, parallelLine);\n\t\t\t\t\tLine l2 = Calc.lineThroughTwoPoints(t.getB(), t.getC()); //vi+1 and v\n\t\t\t\t\tPoint2D intersection2 = Calc.intersectionOfLines(l2, parallelLine);\n\t\t\t\t\tt1 = new Triangle(t.getA(), intersection1, centroid);\n\t\t\t\t\tt2 = new Triangle(t.getB(), intersection2, centroid);\n\t\t\t\t\tt1.setParentTriangle(t);\n\t\t\t\t\tt2.setParentTriangle(t);\n\n\t\t\t\t\t//to get the right order\n\t\t\t\t\t//before parent states if this centroid should be used before the parent's one\n\t\t\t\t\t//out of the two newly formed triangles, one goes before the parent's centroid, one after \n\t\t\t\t\tif (!reverse){\n\t\t\t\t\t\tt1.setBeforeParent(false);\n\t\t\t\t\t\tt2.setBeforeParent(true);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tt1.setBeforeParent(true);\n\t\t\t\t\t\tt2.setBeforeParent(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\n\t\t\t\t\t//TODO \n\t\t\t\t\t//check if the apices of the triangles are correctly picked\n\t\t\t\t\t//and is set before parent OK\n\t\t\t\t\t//should anything else be checked?\n\t\t\t\t\t//a test case with more than 3 vertices to be positioned as apices\n\t\t\t\t\t//should be created \n\n\n\t\t\t\t\t//for the side which has two points on the parallel line\n\t\t\t\t\t//take the new point as the intersection with the median\n\t\t\t\t\t//with that line, new centroid, old centroid\n\t\t\t\t\t//for the other one, draw new parallel line\n\t\t\t\t\t//form the triangle taking intersection with the appropriate triangle side\n\t\t\t\t\t//one old vertex and new centroid\n\n\t\t\t\t\t//each triangle should be formed in the way such that\n\t\t\t\t\t//b and c are on the same parallel line\n\t\t\t\t\t//a is the remaining apex\n\t\t\t\t\tLine parallelSide = Calc.lineThroughTwoPoints(t.getB(), t.getC());\n\t\t\t\t\tLine median = Calc.lineThroughTwoPoints(t.getA(), centroid);\n\t\t\t\t\tPoint2D intersection1 = Calc.intersectionOfLines(parallelSide, median);\n\t\t\t\t\tt1 = new Triangle(centroid, intersection1, t.getC());\n\t\t\t\t\tt1.setParentTriangle(t);\n\n\t\t\t\t\t//the side that doesn't have C \n\t\t\t\t\tLine intersectionSide = Calc.lineThroughTwoPoints(t.getA(), t.getB());\n\t\t\t\t\tPoint2D intersection = Calc.intersectionOfLines(parallelLine, intersectionSide);\n\t\t\t\t\tt2 = new Triangle(t.getA(), intersection, centroid);\n\t\t\t\t\tt2.setParentTriangle(t);\n\n\t\t\t\t\tt1.setBeforeParent(true);\n\t\t\t\t\tt2.setBeforeParent(false);\n\t\t\t\t}\n\n\t\t\t\tlevel ++;\n\t\t\t\tnextLevelTriangls.add(t1);\n\t\t\t\tnextLevelTriangls.add(t2);\n\t\t\t}\n\t\t}\n\n\n\t\t//while loop over, now position vertices\n\t\tint verticesSize = vertices.size();\n\t\tint centroidPositionsSize = centroidPositions.size();\n\t\tfor (int i = 0; i < vertices.size()/2; i++){\n\t\t\tpositions.put(vertices.get(i), centroidPositions.get(i));\n\t\t\tpositions.put(vertices.get(verticesSize - i - 1), centroidPositions.get(centroidPositionsSize - i - 1));\n\t\t}\n\t}", "public Triangles()\n {\n this.triangles = new ArrayList<>();\n }", "private boolean reachablePathFindOrient(Graph graph, Node a, Node b, Node c,\n LinkedList<Node> reachable) {\n Set<Node> cParents = new HashSet<>(graph.getParents(c));\n\n // Needed to avoid cycles in failure case.\n Set<Node> visited = new HashSet<>();\n visited.add(b);\n visited.add(c);\n\n // We don't want to include a,b,or c on the path, so they are added to\n // the \"visited\" set. b and c are added explicitly here; a will be\n // added in the first while iteration.\n while (reachable.size() > 0) {\n Node x = reachable.removeFirst();\n visited.add(x);\n\n // Possible DDP path endpoints.\n List<Node> pathExtensions = graph.getNodesInTo(x, Endpoint.ARROW);\n pathExtensions.removeAll(visited);\n\n for (Node l : pathExtensions) {\n\n // If l is reachable and not adjacent to c, its a DDP\n // endpoint, so do DDP orientation. Otherwise, if l <-> c,\n // add l to the list of reachable nodes.\n if (!graph.isAdjacentTo(l, c)) {\n\n // Check whether <a, b, c> should be reoriented given\n // that l is not adjacent to c; if so, orient and stop.\n doDdpOrientation(graph, l, a, b, c);\n return true;\n } else if (cParents.contains(l)) {\n if (graph.getEndpoint(x, l) == Endpoint.ARROW) {\n reachable.add(l);\n }\n }\n }\n }\n return false;\n }", "void addTriangle(int vertexIndex1, int vertexIndex2, int vertexIndex3);", "public Triangle(Point p1, Point p2, Point p3) {\n this.p1 = p1;\n this.p2 = p2;\n this.p3 = p3;\n this.path = buildPath();\n }", "public Triangle (double x1,double y1,double x2, double y2,double x3,double y3)\r\n {\r\n v1 = new Point(x1,y1);\r\n v2 = new Point(x2,y2);\r\n v3 = new Point(x3,y3);\r\n }", "public void triangle(){\n Shape triangle = new Shape();\n triangle.addPoint(new Point(0,0));\n triangle.addPoint(new Point(6,0));\n triangle.addPoint(new Point(3,6));\n for (Point p : triangle.getPoints()){\n System.out.println(p);\n }\n double peri = getPerimeter(triangle);\n System.out.println(\"perimeter = \"+peri);\n }", "public void makeCube (int subdivisions)\r\n {\r\n \tfloat horz[] = new float[subdivisions + 1];\r\n \tfloat vert[] = new float[subdivisions + 1];\r\n \t\r\n \t\r\n \t// Front face\r\n \tPoint p1 = new Point(-0.5f, -0.5f, 0.5f);\r\n \tPoint p2 = new Point(0.5f, -0.5f, 0.5f);\r\n \tPoint p3 = new Point(0.5f, 0.5f, 0.5f);\r\n \tPoint p4 = new Point(-0.5f, 0.5f, 0.5f);\r\n \t\r\n \tfloat h = p1.x;\r\n \tfloat v = p1.y;\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++ )\r\n \t{\r\n \t\thorz[i] = h;\r\n \t\th = h + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++)\r\n \t{\r\n \t\tvert[i] = v;\r\n \t\tv = v + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int j = 0; j < vert.length - 1; j ++)\r\n \t\tfor( int k = 0; k < horz.length - 1; k ++)\r\n \t\t{\r\n \t\t\tPoint tempP1 = new Point(horz[k], vert[j], 0.5f);\r\n \t\t\tPoint tempP2 = new Point(horz[k + 1], vert[j], 0.5f);\r\n \t\t\tPoint tempP3 = new Point(horz[k + 1], vert[j + 1], 0.5f);\r\n \t\t\tPoint tempP4 = new Point(horz[k], vert[j + 1], 0.5f);\r\n \t\t\t\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP4.x, tempP4.y, tempP4.z);\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP2.x, tempP2.y, tempP2.z, tempP3.x, tempP3.y, tempP3.z);\r\n \t\t\t\r\n \t\t}\r\n \t\r\n \t// Back face\r\n \tp1.y = p1.z = -0.5f;\r\n \tp1.x = 0.5f;\r\n \tp2.x = p2.y = p2.z = -0.5f;\r\n \tp3.x = p3.z = -0.5f;\r\n \tp3.y = 0.5f;\r\n \tp4.x = p4.y = 0.5f;\r\n \tp4.z = -0.5f;\r\n \t\r\n \th = p1.x;\r\n \tv = p1.y;\r\n \t\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++ )\r\n \t{\r\n \t\thorz[i] = h;\r\n \t\th = h - (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++)\r\n \t{\r\n \t\tvert[i] = v;\r\n \t\tv = v + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int j = 0; j < vert.length - 1; j ++)\r\n \t\tfor( int k = 0; k < horz.length - 1; k ++)\r\n \t\t{\r\n \t\t\tPoint tempP1 = new Point(horz[k], vert[j], -0.5f);\r\n \t\t\tPoint tempP2 = new Point(horz[k + 1], vert[j], -0.5f);\r\n \t\t\tPoint tempP3 = new Point(horz[k + 1], vert[j + 1], -0.5f);\r\n \t\t\tPoint tempP4 = new Point(horz[k], vert[j + 1], -0.5f);\r\n \t\t\t\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP4.x, tempP4.y, tempP4.z);\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP2.x, tempP2.y, tempP2.z, tempP3.x, tempP3.y, tempP3.z);\r\n \t\t\t\r\n \t\t}\r\n \t\r\n \t// Left face\r\n \tp1.x = p1.y = p1.z = -0.5f;\r\n \tp2.x = p2.y = -0.5f;\r\n \tp2.z = 0.5f;\r\n \tp3.x = -0.5f;\r\n \tp3.y = p3.z = 0.5f;\r\n \tp4.y = 0.5f;\r\n \tp4.x = p4.z = -0.5f;\r\n \t\r\n \th = p1.z;\r\n \tv = p1.y;\r\n \t\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++ )\r\n \t{\r\n \t\thorz[i] = h;\r\n \t\th = h + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++)\r\n \t{\r\n \t\tvert[i] = v;\r\n \t\tv = v + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int j = 0; j < vert.length - 1; j ++)\r\n \t\tfor( int k = 0; k < horz.length - 1; k ++)\r\n \t\t{\r\n \t\t\tPoint tempP1 = new Point(-0.5f, vert[j], horz[k]);\r\n \t\t\tPoint tempP2 = new Point(-0.5f, vert[j], horz[k + 1]);\r\n \t\t\tPoint tempP3 = new Point(-0.5f, vert[j + 1], horz[k + 1]);\r\n \t\t\tPoint tempP4 = new Point(-0.5f, vert[j + 1], horz[k]);\r\n \t\t\t\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP4.x, tempP4.y, tempP4.z);\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP2.x, tempP2.y, tempP2.z, tempP3.x, tempP3.y, tempP3.z);\r\n \t\t\t\r\n \t\t}\r\n \t\r\n \t// Right face\r\n \tp1.x = p1.z = 0.5f;\r\n \tp1.y = -0.5f;\r\n \tp2.y = p2.z = -0.5f;\r\n \tp2.x = 0.5f;\r\n \tp3.x = p3.y = 0.5f;\r\n \tp3.z = -0.5f;\r\n \tp4.x = p4.y = p4.z = 0.5f;\r\n \t\r\n \t\r\n \th = p1.z;\r\n \tv = p1.y;\r\n \t\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++ )\r\n \t{\r\n \t\thorz[i] = h;\r\n \t\th = h - (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++)\r\n \t{\r\n \t\tvert[i] = v;\r\n \t\tv = v + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int j = 0; j < vert.length - 1; j ++)\r\n \t\tfor( int k = 0; k < horz.length - 1; k ++)\r\n \t\t{\r\n \t\t\tPoint tempP1 = new Point(0.5f, vert[j], horz[k]);\r\n \t\t\tPoint tempP2 = new Point(0.5f, vert[j], horz[k + 1]);\r\n \t\t\tPoint tempP3 = new Point(0.5f, vert[j + 1], horz[k + 1]);\r\n \t\t\tPoint tempP4 = new Point(0.5f, vert[j + 1], horz[k]);\r\n \t\t\t\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP4.x, tempP4.y, tempP4.z);\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP2.x, tempP2.y, tempP2.z, tempP3.x, tempP3.y, tempP3.z);\r\n \t\t\t\r\n \t\t}\r\n \t\r\n \t// Top face\r\n \tp1.x = -0.5f;\r\n \tp1.y = p1.z = 0.5f;\r\n \tp2.x = p2.y = p2.z = 0.5f;\r\n \tp3.x = p3.y = 0.5f;\r\n \tp3.z = -0.5f;\r\n \tp4.x = p4.z = -0.5f;\r\n \tp4.y = 0.5f;\r\n \t\r\n \t\r\n \th = p1.x;\r\n \tv = p1.z;\r\n \t\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++ )\r\n \t{\r\n \t\thorz[i] = h;\r\n \t\th = h + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++)\r\n \t{\r\n \t\tvert[i] = v;\r\n \t\tv = v - (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int j = 0; j < vert.length - 1; j ++)\r\n \t\tfor( int k = 0; k < horz.length - 1; k ++)\r\n \t\t{\r\n \t\t\tPoint tempP1 = new Point(horz[k], 0.5f, vert[j]);\r\n \t\t\tPoint tempP2 = new Point(horz[k + 1], 0.5f, vert[j]);\r\n \t\t\tPoint tempP3 = new Point(horz[k + 1], 0.5f, vert[j + 1]);\r\n \t\t\tPoint tempP4 = new Point(horz[k], 0.5f, vert[j + 1]);\r\n \t\t\t\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP4.x, tempP4.y, tempP4.z);\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP2.x, tempP2.y, tempP2.z, tempP3.x, tempP3.y, tempP3.z);\r\n \t\t\t\r\n \t\t}\r\n \t\r\n \t// Bottom face\r\n \tp1.x = p1.y = p1.z = -0.5f;\r\n \tp2.y = p2.z = 0.5f;\r\n \tp2.x = 0.5f;\r\n \tp3.x = p3.z = 0.5f;\r\n \tp3.y = -0.5f;\r\n \tp4.x = p4.y = -0.5f;\r\n \tp4.z = 0.5f;\r\n \t\r\n \t\r\n \th = p1.x;\r\n \tv = p1.z;\r\n \t\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++ )\r\n \t{\r\n \t\thorz[i] = h;\r\n \t\th = h + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int i = 0; i <= subdivisions; i++)\r\n \t{\r\n \t\tvert[i] = v;\r\n \t\tv = v + (float)(1/(float)subdivisions);\r\n \t}\r\n \t\r\n \tfor( int j = 0; j < vert.length - 1; j ++)\r\n \t\tfor( int k = 0; k < horz.length - 1; k ++)\r\n \t\t{\r\n \t\t\tPoint tempP1 = new Point(horz[k], -0.5f, vert[j]);\r\n \t\t\tPoint tempP2 = new Point(horz[k + 1], -0.5f, vert[j]);\r\n \t\t\tPoint tempP3 = new Point(horz[k + 1], -0.5f, vert[j + 1]);\r\n \t\t\tPoint tempP4 = new Point(horz[k], -0.5f, vert[j + 1]);\r\n \t\t\t\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP4.x, tempP4.y, tempP4.z);\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP2.x, tempP2.y, tempP2.z, tempP3.x, tempP3.y, tempP3.z);\r\n \t\t\t\r\n \t\t}\r\n \t\r\n }", "private void traversePath()\n\t{\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t}", "public void rotation(){\n\n double x=Double.parseDouble(rotationx.getText());\n double y=Double.parseDouble(rotationy.getText());\n double z=Double.parseDouble(rotationz.getText());\n if (checkbox.isSelected()){\n cls_zahnrad.rotieren(x,y,z);\n return;\n }\n Triangle[] dreiecke = t1.getFlaechen();\n x=2*Math.PI/360*x;\n y=2*Math.PI/360*y;\n z=2*Math.PI/360*z;\n double[] A,B,C;\n\n double pktx=0,pkty=0,pktz=0;\n\n if (radio12.isSelected()){\n pktx = Double.parseDouble(rotationpktx.getText());\n pkty = Double.parseDouble(rotationpkty.getText());\n pktz = Double.parseDouble(rotationpktz.getText());\n }\n\n for (Triangle i :dreiecke){\n for (int j=0; j<3;j++){\n double xtemp,ytemp,ztemp;\n xtemp=i.getTriangle()[j].getPoint()[0]-pktx;\n ytemp=i.getTriangle()[j].getPoint()[1]-pkty;\n ztemp=i.getTriangle()[j].getPoint()[2]-pktz;\n i.getTriangle()[j].setPoint(xtemp,ytemp,ztemp);\n }\n }\n\n for (Triangle t1 : dreiecke){\n A=t1.getTriangle()[0].getPoint();\n B=t1.getTriangle()[1].getPoint();\n C=t1.getTriangle()[2].getPoint();\n double[][]punkte={A,B,C};\n\n for (int i=0; i<punkte.length; i++){\n double temp0,temp1,temp2;\n\n //Rotation um Parallele der X-Achse durch das Rotationszentrum\n if (x!=0){\n temp1=punkte[i][1]*Math.cos(x)-punkte[i][2]*Math.sin(x);\n temp2=punkte[i][1]*Math.sin(x)+punkte[i][2]*Math.cos(x);\n punkte[i][1]=temp1;\n punkte[i][2]=temp2;\n }\n\n //Rotation um Parallele der Y-Achse durch das Rotationszentrum\n if (y!=0){\n temp0=punkte[i][0]*Math.cos(y)+punkte[i][2]*Math.sin(y);\n temp2=-punkte[i][0]*Math.sin(y)+punkte[i][2]*Math.cos(y);\n punkte[i][0]=temp0;\n punkte[i][2]=temp2;\n }\n\n //Rotation um Parallele der Z-Achse durch das Rotationszentrum\n if (z!=0){\n temp0=punkte[i][0]*Math.cos(z)-punkte[i][1]*Math.sin(z);\n temp1=punkte[i][0]*Math.sin(z)+punkte[i][1]*Math.cos(z);\n punkte[i][0]=temp0;\n punkte[i][1]=temp1;\n }\n }\n A=punkte[0];\n B=punkte[1];\n C=punkte[2];\n t1.getTriangle()[0].setPoint(A[0],A[1],A[2]);\n t1.getTriangle()[1].setPoint(B[0],B[1],B[2]);\n t1.getTriangle()[2].setPoint(C[0],C[1],C[2]);\n }\n for (Triangle i :dreiecke){\n for (int j=0; j<3;j++){\n double xtemp,ytemp,ztemp;\n xtemp=i.getTriangle()[j].getPoint()[0]+pktx;\n ytemp=i.getTriangle()[j].getPoint()[1]+pkty;\n ztemp=i.getTriangle()[j].getPoint()[2]+pktz;\n i.getTriangle()[j].setPoint(xtemp,ytemp,ztemp);\n }\n }\n redraw();\n /*\n System.out.println(\"A \"+Arrays.toString(t1.getTetraeder()[0].getPoint()));\n System.out.println(\"B \"+Arrays.toString(t1.getTetraeder()[1].getPoint()));\n System.out.println(\"C \"+Arrays.toString(t1.getTetraeder()[2].getPoint()));\n System.out.println(\"D \"+Arrays.toString(t1.getTetraeder()[3].getPoint()));\n System.out.println(Arrays.toString(Mittelpunkt));\n */\n }", "Point3D getLeftUpperBackCorner();", "public void drawPolygon (int xC, int yC, int xP, int yP,int ribs, Graphics g){\r\n \r\n \tint n = ribs; \r\n \t//delta keep the the original delta , this size of delta will increase in delta size each time.\r\n \tdouble delta = (2* Math.PI)/ n;\r\n \tdouble deltaTemp = delta;\r\n \t//List of Points that I keep during n rotation.\r\n \tList <Point> points; \r\n \tfloat x,y,newX,newY;\r\n \t//First Sliding\r\n \tx = xP - xC;\r\n \ty = yP - yC;\r\n \tnewX = x; \t\r\n \tnewY = y; \t\r\n \tList <Point> vertexs = new ArrayList();\r\n \t//Follow delta angle rotation n times and write a list of vertices to vertexs list.\r\n \tfor (int i = 0; i < n ; i++)\r\n \t{\r\n \t\tnewX = (int) ((x*Math.cos(delta) - y*Math.sin(delta)));\r\n \t\tnewY = (int) ((x*Math.sin(delta) + y*Math.cos(delta))); \r\n \t\tvertexs.add(new Point(Math.round(newX),Math.round(newY))); \t\r\n \t\tSystem.out.println(vertexs.get(i).x+\",\"+vertexs.get(i).y);\r\n \t\tdelta = delta + deltaTemp;\r\n \t}\r\n \t//Sliding back\r\n \tfor (int i = 0; i < vertexs.size(); i++ ){\r\n \t\tvertexs.get(i).x = (int) (vertexs.get(i).getX() + xC);\r\n \t\tvertexs.get(i).y = (int) (vertexs.get(i).getY() + yC);\r\n \t\tg.drawRect(vertexs.get(i).x, vertexs.get(i).y ,1,1);\r\n \t}\r\n \t//draw line between the list of the points we got.\r\n \tfor (int z = 0 ; z < vertexs.size(); z++){\r\n \t\tif (z == vertexs.size()-1)\r\n \t\t\tdrawLine((int) Math.round(vertexs.get(z).getX()), (int)(vertexs.get(z).getY()),(int)(vertexs.get(0).getX()), (int)(vertexs.get(0).getY()),g);\r\n \t\telse\r\n \t\t\tdrawLine((int)(vertexs.get(z).getX()), (int)(vertexs.get(z).getY()),(int)(vertexs.get(z+1).getX()), (int)(vertexs.get(z+1).getY()),g);\r\n\r\n \t\t}\r\n \t\r\n }", "public UnfilledArrowhead() {\n setupControlPoints(3);\n }", "public Triangle() {\n\t\tsuper.addPoint(new java.awt.Point(0,1));\n\t\tsuper.addPoint(new java.awt.Point(1,0));\n\t\tsuper.addPoint(new java.awt.Point(2,1));\n\t}", "private void createFloor2Connections(IndoorVertex stairs, IndoorVertex elevator)\n {\n armesConnectionNorth = new IndoorVertex(building, new XYPos(1000, 151.19), 2);\n armesConnectionSouth = new IndoorVertex(building, new XYPos(1000, 158.75), 2);\n IndoorVertex rm239_fac_science = new IndoorVertex(building, new XYPos(1030.24, 97.11), 2);\n IndoorVertex _30_151 = new IndoorVertex(building, new XYPos(1030.24, 151.19), 2);\n IndoorVertex _30_179 = new IndoorVertex(building, new XYPos(1030.24, 179.65), 2);\n exit = new IndoorVertex(building, new XYPos(1030.24, 188.41), 2);\n IndoorVertex rm211_library = new IndoorVertex(building, new XYPos(1080.25, 173.29), 2);\n IndoorVertex _44_160 = new IndoorVertex(building, new XYPos(1044.19, 160.49), 2);\n IndoorVertex _44_173 = new IndoorVertex(building, new XYPos(1044.19, 173.29), 2);\n IndoorVertex _30_173 = new IndoorVertex(building, new XYPos(1030.24, 173.29), 2);\n IndoorVertex _30_158 = new IndoorVertex(building, new XYPos(1030.24, 158.75), 2);\n IndoorVertex _44_154 = new IndoorVertex(building, new XYPos(1044.19, 154.1), 2);\n IndoorVertex _30_154 = new IndoorVertex(building, new XYPos(1030.24, 154.1), 2);\n\n //Rooms\n ArrayList<IndoorVertex> rm211 = new ArrayList<>();\n rm211.add(rm211_library);\n\n rooms.put(\"211\", rm211);\n\n ArrayList<IndoorVertex> rm239 = new ArrayList<>();\n rm239.add(rm239_fac_science);\n\n rooms.put(\"239\", rm239);\n\n //Connections to other points\n connectVertex(armesConnectionSouth, _30_158);\n connectVertex(armesConnectionNorth, _30_151);\n connectVertex(_30_151, rm239_fac_science);\n connectVertex(_30_151, _30_154);\n connectVertex(_30_154, _44_154);\n connectVertex(_30_154, _30_158);\n connectVertex(_30_158, _44_154);\n connectVertex(_30_158, _44_160);\n connectVertex(_30_158, _30_173);\n connectVertex(_30_173, _44_173);\n connectVertex(_30_173, _30_179);\n connectVertex(_30_179, exit);\n connectVertex(_44_154, elevator);\n connectVertex(_44_154, _44_160);\n connectVertex(_44_160, stairs);\n connectVertex(_44_160, _44_173);\n connectVertex(_44_173, rm211_library);\n\n }", "public String toString(){\n return \"Triangle: side1 = \" + side1 + \" side2 = \" + side2 + \" side3 = \" + side3;\n }", "public Triangle (double x1,double y1,double x2, double y2)\r\n {\r\n v1 = new Point(x1,y1);\r\n v2 = new Point(x2,y2);\r\n v3 = new Point(0,0);\r\n }", "public void setArrowHead(int baseX, int baseY, int tipX, int tipY);", "public List<Point2D> getConcentricTriangleTips(List <Voter> voters, int repPerDistrict)\n {\n numVoters = voters.size();\n\n int numTriangles;\n if (repPerDistrict == 1)\n numTriangles = 12;\n else if (repPerDistrict == 3)\n numTriangles = 5;\n else\n return null;\n\n List<Point2D> triTips = new ArrayList<Point2D>();\n List<Polygon2D> triangles = new ArrayList<Polygon2D>();\n final double centerX = 500;\n final double centerY = 500*Math.tan(Math.PI/6);\n final double cos30 = Math.cos(Math.PI/6);\n final double sin30 = Math.sin(Math.PI/6);\n\n // Distance between vertices of triangle to center\n // TODO: Use a binary search algorithm instead of step; too slow\n double distFromCenter = 0;\n double step = 0.5;\n\n // Find most inner triangle\n Polygon2D innerTriangle;\n int innerVoterCount;\n double topX, topY, leftX, rightX, botY;\n\n do {\n distFromCenter += step;\n\n topX = centerX;\n topY = centerY + distFromCenter;\n\n leftX = centerX - distFromCenter*cos30;\n rightX = centerX + distFromCenter*cos30;\n\n botY = centerY - distFromCenter*sin30;\n\n innerTriangle = new Polygon2D();\n innerTriangle.append(topX, topY);\n innerTriangle.append(leftX, botY);\n innerTriangle.append(rightX, botY);\n // System.out.println(topY);\n\n innerVoterCount = Run.countInclusion(voters, innerTriangle);\n } while (needsMoreVoters(innerVoterCount));\n System.out.println(\"found inner triangle\");\n System.out.println(innerVoterCount);\n\n triangles.add(innerTriangle);\n triTips.add(new Point2D.Double(topX, topY));\n\n // Draw numTriangles-1 more triangles around it, each with 20/22 districts\n Polygon2D triangle;\n int voterCount;\n\n for (int i = 0; i < numTriangles - 2; i++) {\n do {\n distFromCenter += step;\n\n topX = centerX;\n topY = centerY + distFromCenter;\n\n leftX = centerX - distFromCenter*cos30;\n rightX = centerX + distFromCenter*cos30;\n\n botY = centerY - distFromCenter*sin30;\n\n triangle = new Polygon2D();\n triangle.append(topX, topY);\n triangle.append(leftX, botY);\n triangle.append(rightX, botY);\n\n voterCount = Run.countInclusion(voters, triangle);\n System.out.println(topY);\n } while (needsMoreVoters(voterCount - innerVoterCount, repPerDistrict == 3 ? 20:22));\n System.out.println(\"found an outer triangle\");\n System.out.println(voterCount - innerVoterCount);\n\n innerVoterCount = voterCount;\n triangles.add(triangle);\n triTips.add(new Point2D.Double(topX, topY));\n }\n\n // Last outer triangle; not necessary but keeping the code for completeness\n Polygon2D outerTriangle = new Polygon2D();\n outerTriangle.append(topX, 500*Math.sqrt(3));\n outerTriangle.append(0, 0);\n outerTriangle.append(1000, 0);\n voterCount = Run.countInclusion(voters, outerTriangle);\n\n System.out.println(\"found an outer triangle\");\n System.out.println(voterCount - innerVoterCount);\n\n triangles.add(outerTriangle);\n triTips.add(new Point2D.Double(topX, 500*Math.sqrt(3)));\n\n return triTips;\n }", "public ArrayList<Triangle> getOccluderVertexData();", "public Triangle() { \n super(\"Triangle: \");\n this.setP1(new Point());\n this.setP2(new Point());\n this.setP3(new Point());\n }", "private void setVertices(){\n \tdouble[] xs = new double[numOfSides];\n \tdouble[] ys = new double[numOfSides];\n \tif (numOfSides%2==1){\n \t\tfor (int i=0; i<numOfSides; i++){\n \t\t\txs[i]=radius*Math.cos(2*i*Math.PI/numOfSides);\n \t\t\tys[i]=radius*Math.sin(2*i*Math.PI/numOfSides);\n \t\t\t}\n \t}\n \telse{\n \t\tdouble start=Math.PI/numOfSides;\n \t\tfor (int i=0; i<numOfSides; i++){\n \t\t\txs[i]=radius*Math.cos(start+2*i*(Math.PI)/numOfSides);\n \t\t\tys[i]=radius*Math.sin(start+2*i*(Math.PI)/numOfSides);\n \t\t\t}\n \t}\n \tsetXLocal(xs);\n \tsetYLocal(ys);\n }", "public Triangle(){\n\t\tside1=1.0;\n\t\tside2=1.0;\n\t\tside3=1.0;\n\t}", "public Triangle(int x1, int y1, int x2, int y2, int x3, int y3, String name){\n this.x1 = x1;\n this.y1 = y1;\n this.x2 = x2;\n this.y2 = y2;\n this.x3 = x3;\n this.y3 = y3;\n this.name = name;\n \n \n }", "Triangle (double side1, double side2, double side3){\n this.side1 = side1;\n this.side2 = side2;\n this.side3 = side3;\n }", "public String toString(){\n\t\treturn (\"this triangle has side 1 of length\"+side1+\"side 2 of length\"+side2+\"and side 3 of length\"+side3);\n\t}", "public static void main(String[] args) {\n\t\tScanner cin = new Scanner(System.in);\n\t\tint a = cin.nextInt();\n\t\tint b = cin.nextInt();\n\t\tint c = cin.nextInt();\n\t\tint isTrigle = 0;\n\t\tif(a+b<c||a+c<b||b+c<a)System.out.println(\"Not triangle\");\n\t\telse {\n\t\t\tif(Math.pow(a,2)==Math.pow(b,2)+Math.pow(c,2)||\n\t\t\t Math.pow(b,2)==Math.pow(a,2)+Math.pow(c,2)||\n\t\t\t Math.pow(c,2)==Math.pow(b,2)+Math.pow(a,2)){\n\t\t\t isTrigle = 1;\t\n\t\t\t System.out.println(\"Right triangle\");\n\t\t\t}\n\t\t\tif(Math.pow(a,2)>Math.pow(b,2)+Math.pow(c,2)||\n\t\t\t Math.pow(b,2)>Math.pow(a,2)+Math.pow(c,2)||\n\t\t\t Math.pow(c,2)>Math.pow(b,2)+Math.pow(a,2)){\n\t\t\t\tisTrigle = 1;\n\t\t\t\tSystem.out.println(\"Obtuse triangle\");\n\t\t\t}\n\t\t\tif(isTrigle==0)System.out.println(\"Acute triangle\");\n\t\t\tif(a==b||b==c||a==c)System.out.println(\"Isosceles triangle\");\n\t\t\tif(a==b&&b==c&&a==c)System.out.println(\"Equilateral triangle\");\n\t\t\t\n\t\t}\n\t\t \n\t\t\n\t}", "public Triangle() {}", "public void calculate() {\n\t\t\n\t\tHashMap<Integer, Vertex> vertices = triangulation.getVertices();\n\t\tHashMap<Integer, Face> faces = triangulation.getFaces();\n\n\t\tHashMap<Integer, Integer> chords = new HashMap<Integer, Integer>();\n\t\tList<Vertex> onOuterCircle = new LinkedList<Vertex>();\n\t\tList<Edge> outerCircle = new LinkedList<Edge>();\n\n\t\tfor (Vertex v : vertices.values()) {\n\t\t\tchords.put(v.getId(), 0);\n\t\t\tchildren.put(v.getId(), new LinkedList<Integer>());\n\t\t}\n\n\t\t// determine outer face (randomly, use the first face)\n\t\tFace outerFace = null;\n\t\tfor (Face f : faces.values()) {\n\t\t\touterFace = f;\n\t\t\tbreak;\n\t\t}\n\t\tif (outerFace == null) {\n\t\t\t// there are no faces at all in the embedding\n\t\t\treturn;\n\t\t}\n\n\t\tEdge e = outerFace.getIncidentEdge();\n\t\tvertexOrder[1] = e.getSource();\n\t\tvertexOrder[0] = e.getTarget();\n\t\tonOuterCircle.add(e.getTarget());\n\t\tonOuterCircle.add(e.getNext().getTarget());\n\t\tonOuterCircle.add(e.getSource());\n\t\touterCircle.add(e.getNext().getNext().getTwin());\n\t\touterCircle.add(e.getNext().getTwin());\n\t\t\n\t\t//System.out.println(\"outerCircle 0 \" + outerCircle.get(0).getId() + \" - source: \" + outerCircle.get(0).getSource().getId() + \" - target: \" + outerCircle.get(0).getTarget().getId());\n\t\t//System.out.println(\"outerCircle 1 \" + outerCircle.get(1).getId() + \" - source: \" + outerCircle.get(1).getSource().getId() + \" - target: \" + outerCircle.get(1).getTarget().getId());\n\t\t\n\n\t\tfor (int k=vertexOrder.length-1; k>1; k--) {\n\t\t\t//System.out.println(\"k: \" + k + \" - outerCircle size: \" + outerCircle.size());\n\t\t\t// chose v != v_0,v_1 such that v on outer face, not considered yet and chords(v)=0\n\t\t\tVertex nextVertex = null;\n\t\t\tint nextVertexId = -1;\n\t\t\tfor (int i=0; i<onOuterCircle.size(); i++) {\n\t\t\t\tnextVertex = onOuterCircle.get(i);\n\t\t\t\tnextVertexId = nextVertex.getId();\n\t\t\t\tif (nextVertexId != vertexOrder[0].getId() && nextVertexId != vertexOrder[1].getId()\n\t\t\t\t\t\t&& chords.get(nextVertexId) == 0) {\n\t\t\t\t\t// remove from list\n\t\t\t\t\tonOuterCircle.remove(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//System.out.println(\"nextVertexId: \" + nextVertexId);\n\n\t\t\t// found the next vertex; add it to the considered vertices\n\t\t\tvertexOrder[k] = nextVertex;\n\t\t\t\n\t\t\t// determine children\n\t\t\tList<Integer> childrenNextVertex = children.get(nextVertexId);\n\t\t\t\n\t\t\t// update edges of outer circle\n\t\t\tint index = 0;\n\t\t\t\n\t\t\twhile (outerCircle.get(index).getTarget().getId() != nextVertexId) {\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tEdge outofNextVertex = outerCircle.remove(index+1);\n\t\t\t\n\t\t\t\n\t\t\t//System.out.println(\"outOfNextVertex \" + outofNextVertex.getId() + \" - source: \" + outofNextVertex.getSource().getId() + \" - target: \" + outofNextVertex.getTarget().getId());\n\t\t\tEdge intoNextVertex = outerCircle.remove(index);\n\t\t\t//System.out.println(\"intoNextVertex \" + intoNextVertex.getId() + \" - source: \" + intoNextVertex.getSource().getId() + \" - target: \" + intoNextVertex.getTarget().getId());\n\t\t\tEdge current = intoNextVertex.getNext();\n\t\t\t//System.out.println(\"current \" + current.getId() + \" - source: \" + current.getSource().getId() + \" - target: \" + current.getTarget().getId());\n\t\t\t\n\t\t\tint endIndex = index;\n\t\t\t\n\t\t\twhile (current.getId() != outofNextVertex.getId()) {\n\t\t\t\tEdge onCircle = current.getNext().getTwin();\n\t\t\t\touterCircle.add(endIndex, onCircle);\n\t\t\t\t\n\t\t\t\tchildrenNextVertex.add(0, onCircle.getSource().getId());\n\t\t\t\t\n\t\t\t\tendIndex++;\n\t\t\t\tcurrent = current.getTwin().getNext();\n\t\t\t\tonOuterCircle.add(onCircle.getTarget());\n\t\t\t}\n\t\t\t\n\t\t\tEdge lastEdge = outofNextVertex.getNext().getTwin();\n\t\t\touterCircle.add(endIndex, lastEdge);\n\t\t\t\n\t\t\tchildrenNextVertex.add(0, lastEdge.getSource().getId());\n\t\t\tchildrenNextVertex.add(0, lastEdge.getTarget().getId());\n\n\t\t\t// update chords\n\t\t\tfor (Vertex v : onOuterCircle) {\n\t\t\t\tEdge incidentEdge = v.getOutEdge();\n\t\t\t\tint firstEdgeId = incidentEdge.getId();\n\t\t\t\tint chordCounter = -2; // the 2 neighbours are on the outer circle, but no chords\n\t\t\t\tdo {\n\t\t\t\t\tif (onOuterCircle.contains(incidentEdge.getTarget())) {\n\t\t\t\t\t\tchordCounter++;\n\t\t\t\t\t}\n\t\t\t\t\tincidentEdge = incidentEdge.getTwin().getNext();\n\t\t\t\t} while (incidentEdge.getId() != firstEdgeId);\n\t\t\t\tchords.put(v.getId(), chordCounter);\n\t\t\t}\n\t\t}\n\t}", "private void parseTriangle(String line) {\n String first_integer = line.substring(2);\n first_integer = first_integer.trim();\n int second_space_index = first_integer.indexOf(' ') + 1;\n String second_integer = first_integer.substring(second_space_index);\n second_integer = second_integer.trim();\n int third_space_index = second_integer.indexOf(' ') + 1;\n String third_integer = second_integer.substring(third_space_index);\n third_integer = third_integer.trim();\n\n parseTriplet(first_integer.substring(0, second_space_index - 1));\n parseTriplet(second_integer.substring(0, third_space_index - 1));\n parseTriplet(third_integer);\n }", "public Triangle() {\n setPointsAs0();\n S = 0;\n }", "public TriangleGizmo(String name, double x1, double y1) {\n\t\t\tdouble w = 20;\n\t\t\tdouble h = 20;\n\t\t\txpos1 = x1*20;\n\t\t\txpos2 = (x1*20) + w;\n\t\t\txpos3 = xpos2;\n\t\t\typos1 = y1*20;\n\t\t\typos2 = y1*20;\n\t\t\typos3 = ypos2 + h;\n\t\t\twidth = w;\n\t\t\theight = h;\n\t\t\tcolour = Color.WHITE;\n\t\t\tls1 = new LineSegment(x1*20, y1*20, xpos2, ypos2);\n\t\t\tls2 = new LineSegment(xpos2, ypos2, xpos3, ypos3);\n\t\t\tls3 = new LineSegment(x1*20, y1*20, xpos3, ypos3);\n\t\t\tsetName(name);\n\t\t}", "public void drawTreeOfPythagoras(Graphics g, Point2F A, Point2F B)\r\n {\r\n // Quit if distance is <= 2\r\n if(A.distanceSq(B) <= pSize)\r\n return;\r\n // Calculate C and D\r\n // Find vector AB\r\n Point2F AB = B.subtract(A);\r\n // Rotate by 90 degrees CCW\r\n Point2F ABrotated = new Point2F(-AB.y, AB.x);\r\n\r\n Point2F C = B.add(ABrotated);\r\n Point2F D = A.add(ABrotated);\r\n\r\n // Calculate E\r\n Point2F E = new Point2F((C.x + D.x) / 2, (C.y + D.y) / 2).add(ABrotated.scale(.5f));\r\n\r\n // Fill the square and triangle\r\n g.fillPolygon(new int[] {iX(A.x), iX(B.x), iX(C.x), iX(D.x)}, new int[] {iY(A.y), iY(B.y), iY(C.y), iY(D.y)}, 4);\r\n g.fillPolygon(new int[] {iX(D.x), iX(C.x), iX(E.x)}, new int[] {iY(D.y), iY(C.y), iY(E.y)}, 3);\r\n\r\n // Draw the square and triangle\r\n g.drawLine(iX(A.x), iY(A.y), iX(B.x), iY(B.y));\r\n g.drawLine(iX(B.x), iY(B.y), iX(C.x), iY(C.y));\r\n g.drawLine(iX(C.x), iY(C.y), iX(D.x), iY(D.y));\r\n g.drawLine(iX(D.x), iY(D.y), iX(A.x), iY(A.y));\r\n g.drawLine(iX(D.x), iY(D.y), iX(C.x), iY(C.y));\r\n g.drawLine(iX(C.x), iY(C.y), iX(E.x), iY(E.y));\r\n g.drawLine(iX(E.x), iY(E.y), iX(D.x), iY(D.y));\r\n\r\n //And back to the top\r\n drawTreeOfPythagoras(g, D, E);\r\n drawTreeOfPythagoras(g, E, C);\r\n }", "private void Create_Path() {\n lines = new Line[getPoints().size()];\n for (int i = 1; i < getLines().length; i++) {\n lines[i] = new Line(getPoints().get(way[i]).getX(), getPoints().get(way[i]).getY(), getPoints().get(way[i - 1]).getX(), getPoints().get(way[i - 1]).getY());\n }\n lines[0] = new Line(getPoints().get(way[getLines().length - 1]).getX(), getPoints().get(way[getLines().length - 1]).getY(), getPoints().get(way[0]).getX(), getPoints().get(way[0]).getY());\n\n }", "@Override\r\n public Shape createShape(RenderContext ctx) {\n float v[] = { -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, // front face\r\n -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, // left face\r\n -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1 }; // bottom face\r\n\r\n // The vertex normals\r\n float n[] = { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, // front face\r\n -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, // left face\r\n 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0 }; // bottom face\r\n\r\n // The vertex colors\r\n float c[] = { 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, //\r\n 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, //\r\n 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 };\r\n\r\n // Texture coordinates\r\n float uv[] = { 0, 0, 1, 0, 1, 1, 0, 1, //\r\n 0, 0, 1, 0, 1, 1, 0, 1, //\r\n 0, 0, 1, 0, 1, 1, 0, 1 };\r\n\r\n // The triangles (three vertex indices for each triangle)\r\n int indices[] = { 0, 2, 3, 0, 1, 2, // front face\r\n 4, 6, 7, 4, 5, 6, // left face\r\n 8, 10, 11, 8, 9, 10 }; // bottom face\r\n\r\n // Construct a data structure that stores the vertices, their\r\n // attributes, and the triangle mesh connectivity\r\n VertexData vertexData = ctx.makeVertexData(12);\r\n vertexData.addElement(c, VertexData.Semantic.COLOR, 3);\r\n vertexData.addElement(v, VertexData.Semantic.POSITION, 3);\r\n vertexData.addElement(n, VertexData.Semantic.NORMAL, 3);\r\n vertexData.addElement(uv, VertexData.Semantic.TEXCOORD, 2);\r\n vertexData.addIndices(indices);\r\n\r\n return new jrtr.Shape(vertexData);\r\n }", "public FilledArrowhead() {\n setupControlPoints(3);\n }", "public Triangle (int x, int y, int z){ \r\n \r\n \r\n }", "protected boolean checkTriangleArrow() {\n\t\tboolean passed = true;\n\t\tStroke last = m_subStrokes.get(m_subStrokes.size() - 1);\n\t\tStroke secondLast = m_subStrokes.get(m_subStrokes.size() - 2);\n\t\tStroke thirdLast = m_subStrokes.get(m_subStrokes.size() - 3);\n\t\tStroke fourthLast = m_subStrokes.get(m_subStrokes.size() - 4);\n\t\tdouble lastLength = StrokeFeatures.getStrokeLength(last);\n\t\tdouble secondLastLength = StrokeFeatures.getStrokeLength(secondLast);\n\t\tdouble thirdLastLength = StrokeFeatures.getStrokeLength(thirdLast);\n\t\tdouble fourthLastLength = StrokeFeatures.getStrokeLength(fourthLast);\n\n\t\t// test 1: last stroke and third to last stroke should be same size\n\t\tdouble diff = Math.abs(lastLength - thirdLastLength)\n\t\t\t\t/ (lastLength + thirdLastLength);\n\t\tif (diff > 0.5)\n\t\t\tpassed = false;\n\n\t\t// test 2: two points at the \"head\" of the arrow should be close\n\t\tdouble dis = last.getLastPoint().distance(thirdLast.getFirstPoint())\n\t\t\t\t/ m_features.getStrokeLength();\n\t\tif (dis > 0.25)\n\t\t\tpassed = false;\n\n\t\t// test 3: triangle arrow should be better fit than standard arrow\n\t\tif (m_standardPassed && dis > m_standardSum)\n\t\t\tpassed = false;\n\n\t\t// test 4: second to last line of arrow head should intersect shaft of\n\t\t// arrow\n\t\tLine2D.Double line1 = new Line2D.Double(secondLast.getFirstPoint()\n\t\t\t\t.getX(), secondLast.getFirstPoint().getY(), secondLast\n\t\t\t\t.getLastPoint().getX(), secondLast.getLastPoint().getY());\n\t\tArrayList<Point2D> intersect = StrokeFeatures.getIntersection(\n\t\t\t\tm_subStrokes.get(m_subStrokes.size() - 4), line1);\n\t\tif (intersect.size() <= 0)\n\t\t\tpassed = false;\n\t\tLine2D.Double line2 = new Line2D.Double(fourthLast.getPoints()\n\t\t\t\t.get(fourthLast.getNumPoints() / 2).getX(), fourthLast\n\t\t\t\t.getPoints().get(fourthLast.getNumPoints() / 2).getY(),\n\t\t\t\tfourthLast.getLastPoint().getX(), fourthLast.getLastPoint()\n\t\t\t\t\t\t.getY());\n\t\tdouble perpDiff = Math.abs(getSlope(line1) - (1.0 / getSlope(line2)));\n\t\tif (perpDiff > 5)\n\t\t\tpassed = false;\n\n\t\t// sometimes the last line of the arrow is broken incorrectly;\n\t\t// try combining last two strokes and repeat test\n\t\tif (!passed && m_subStrokes.size() >= 5) {\n\t\t\tpassed = true;\n\n\t\t\t// test 1: last stroke and third to last stroke should be same size\n\t\t\tdiff = Math.abs(lastLength + secondLastLength - fourthLastLength)\n\t\t\t\t\t/ (lastLength + secondLastLength + thirdLastLength);\n\t\t\tif (diff > 0.5)\n\t\t\t\tpassed = false;\n\n\t\t\t// test 2: two points at the \"head\" of the arrow should be close\n\t\t\tdis = last.getLastPoint().distance(fourthLast.getFirstPoint())\n\t\t\t\t\t/ m_features.getStrokeLength();\n\t\t\tif (dis > 0.25)\n\t\t\t\tpassed = false;\n\n\t\t\t// test 3: triangle arrow should be better fit than standard arrow\n\t\t\tif (m_standardPassed && dis > m_standardSum)\n\t\t\t\tpassed = false;\n\n\t\t\t// test 4: line connecting tips of arrow head should be close to\n\t\t\t// perpendicular to the line it would intersect\n\t\t\tline1 = new Line2D.Double(thirdLast.getFirstPoint().getX(),\n\t\t\t\t\tthirdLast.getFirstPoint().getY(), thirdLast.getLastPoint()\n\t\t\t\t\t\t\t.getX(), thirdLast.getLastPoint().getY());\n\t\t\tStroke fifthLast = m_subStrokes.get(m_subStrokes.size() - 5);\n\t\t\tintersect = StrokeFeatures.getIntersection(fifthLast, line1);\n\t\t\tif (intersect.size() <= 0)\n\t\t\t\tpassed = false;\n\t\t\tline2 = new Line2D.Double(fifthLast.getPoints()\n\t\t\t\t\t.get(fifthLast.getNumPoints() / 2).getX(), fifthLast\n\t\t\t\t\t.getPoints().get(fifthLast.getNumPoints() / 2).getY(),\n\t\t\t\t\tfifthLast.getLastPoint().getX(), fifthLast.getLastPoint()\n\t\t\t\t\t\t\t.getY());\n\t\t\tperpDiff = Math.abs(getSlope(line1) - (1.0 / getSlope(line2)));\n\t\t\tif (perpDiff > 5)\n\t\t\t\tpassed = false;\n\n\t\t}\n\n\t\t// if passed make a beautified standard arrow\n\t\tif (passed) {\n\n\t\t\tm_arrowType = Type.TRIANGLE;\n\n\t\t\t// TODO\n\t\t\t// create shape/beautified object\n\t\t\t/*\n\t\t\t * m_shape = new GeneralPath(); try { computeBeautified(); } catch\n\t\t\t * (Exception e) { log.error(\"Could not create shape object: \" +\n\t\t\t * e.getMessage()); }\n\t\t\t */\n\t\t}\n\n\t\tSystem.out.println(\"TriangleArrow: passed = \" + passed + \" diff = \"\n\t\t\t\t+ diff + \" dis = \" + dis + \" intersect = \" + intersect.size()\n\t\t\t\t+ \" num substrokes = \" + m_subStrokes.size() + \" perp diff = \"\n\t\t\t\t+ perpDiff);\n\t\tSystem.out.print(\"sizes: \");\n\t\tfor (int i = 0; i < m_subStrokes.size(); i++)\n\t\t\tSystem.out.print(m_subStrokes.get(i).getNumPoints() + \" \");\n\t\tSystem.out.println(\"\");\n\n\t\treturn passed;\n\t}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble xa;\n\t\tdouble ya;\n\t\tSystem.out.println(\"Input x and y coordinates of vertex A\");\n\t\txa = sc.nextDouble();\n\t\tya = sc.nextDouble();\n\t\tdouble xb;\n\t\tdouble yb;\n\t\tSystem.out.println(\"Input x and y coordinates of vertex B\");\n\t\txb = sc.nextDouble();\n\t\tyb = sc.nextDouble();\n\t\tdouble xc;\n\t\tdouble yc;\n\t\tSystem.out.println(\"Input x and y coordinates of vertex C\");\n\t\txc = sc.nextDouble();\n\t\tyc = sc.nextDouble();\n\t\tdouble xd;\n\t\tdouble yd;\n\t\tSystem.out.println(\"Input x and y coordinates of point D\");\n\t\txd = sc.nextDouble();\n\t\tyd = sc.nextDouble();\n\t\tdouble s1 = (xa - xd) * (yb - ya) - (xb - xa) * (ya - yd);\n\t\tdouble s2 = (xb - xd) * (yc - yb) - (xc - xb) * (yb - yd);\n\t\tdouble s3 = (xc - xd) * (ya - yc) - (xa - xc) * (yc - yd);\n\t\tif ((s1 <= 0 && s2 <= 0 && s3 <= 0) || (s1 > 0 && s2 > 0 && s3 > 0)) {\n\t\t\tSystem.out.println(\"Point lies inside the triangle\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Point doesn`t lie inside the triangle\");\n\t\t}\n\t}", "@Override\n public boolean isVertex()\n {\n return getAngle() > Math.PI && getAngle() < 2 * Math.PI;\n }", "public Triangle(Point a, Point b, Point c){\n this.a=a;\n this.b=b;\n this.c=c;\n }", "public Triangle(int width, int height, int perpendicular, int x, int y){\n super(x,y);\n setWidth(width);\n setHeight(height);\n setPerpendicular(perpendicular);\n }", "public void lungs(Graphics bbg, int n, int length, int x, int y, double angle){\n double r1 = angle + Math.toRadians(-45);\n double r2 = angle + Math.toRadians(45);\n double r3 = angle + Math.toRadians(135);\n double r4 = angle + Math.toRadians(-135);\n\n //length modifications of the different branches\n double l1 = length/1.3 + (l1I*5);\n double l2 = length/1.3 + (l2I*5);\n double l3 = length/1.3 + (l3I*5);\n double l4 = length/1.3 + (l4I*5);\n\n //x and y points of the end of the different branches\n int ax = (int)(x - Math.sin(r1)*l1)+(int)(l1I);\n int ay = (int)(y - Math.cos(r1)*l1)+(int)(l1I);\n int bx = (int)(x - Math.sin(r2)*l2)+(int)(l2I);\n int by = (int)(y - Math.cos(r2)*l2)+(int)(l2I);\n int cx = (int)(x - Math.sin(r3)*l3)+(int)(l3I);\n int cy = (int)(y - Math.cos(r3)*l3)+(int)(l3I);\n int dx = (int)(x - Math.sin(r4)*l4)+(int)(l4I);\n int dy = (int)(y - Math.cos(r4)*l4)+(int)(l4I);\n\n if(n == 0){\n return;\n }\n\n\n increment();\n Color fluidC = new Color(colorR,colorG,colorB);\n //bbg.setColor(new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random()*255)));\n bbg.setColor(fluidC);\n\n\n //draw different branches\n bbg.drawLine(x,y,ax,ay);\n bbg.drawLine(x,y,bx,by);\n bbg.drawLine(x,y,cx,cy);\n bbg.drawLine(x,y,dx,dy);\n\n\n\n //call recursively to draw fractal\n lungs(bbg, n - 1, (int)l1, ax,ay,r1);\n lungs(bbg, n - 1, (int)l2, bx,by,r2);\n lungs(bbg, n - 1, (int)l3, cx,cy,r3);\n lungs(bbg, n - 1, (int)l4, dx,dy,r4);\n\n\n }", "public Triangle( Point p1, Point p2, Point p3 ) {\n super(\"Triangle: \");\n this.setP1(p1);\n this.setP2(p2);\n this.setP3(p3);\n }", "public TriangleComponent()\n {\n status=-1;\n }", "public Boolean estTriangleEquilateral() {\n\t\t// initialisation du retour\n\t\tBoolean retour = false;\n\n\t\t// calcul de AB la distance entre le premier et le troisieme point\n\t\tdouble AB = this.premier.calculerDistance(this.troisieme);\n\n\t\t// calcul de AC la distance entre le premier et le deuxieme point\n\t\tdouble AC = this.premier.calculerDistance(this.deuxieme);\n\n\t\t// calcul de BC la distance entre le deuxieme et le troisieme point\n\t\tdouble BC = this.deuxieme.calculerDistance(this.troisieme);\n\n\t\t//test\n\t\tif (AB == AC && AB == BC)\n\t\t\tretour = true;\n\n\t\t// retour\n\t\treturn retour;\n\t}", "Triangle(int x, int y, int z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }", "public static ArrayList<Integer[]> compactForwardAlgorithmTriangles(ArrayList<Integer>[] graph) {\n Set<Pair<Integer, ArrayList<Integer>>> pairs = Utils.getSortedArrays(graph);\n Map<Integer, Integer> etas = Utils.getEtasMap(pairs);\n\n // sort adjacency arrays according to eta\n pairs.forEach(p -> p.getSecond().sort(Comparator.comparing(etas::get)));\n\n\n\n int triangleCount = 0;\n ArrayList<Integer[]> triangles = new ArrayList();\n\n\n // main part, in which we actually count triangles\n Iterator<Pair<Integer, ArrayList<Integer>>> iterator = pairs.iterator();\n while (iterator.hasNext()) {\n Pair<Integer, ArrayList<Integer>> pair = iterator.next();\n Integer v = pair.getFirst();\n ArrayList<Integer> v_neighbors = graph[v];\n\n for (int u : v_neighbors) {\n if (etas.get(u) > etas.get(v)) {\n ArrayList<Integer> u_neighbors = graph[u];\n\n Iterator<Integer> uIterator = u_neighbors.iterator(), vIterator = v_neighbors.iterator();\n\n if (uIterator.hasNext() && vIterator.hasNext()) {\n Integer u_ = uIterator.next(), v_ = vIterator.next();\n while (uIterator.hasNext() && vIterator.hasNext() && etas.get(u_) < etas.get(v)\n && etas.get(v_) < etas.get(v)) {\n if (etas.get(u_) < etas.get(v_))\n u_ = uIterator.next();\n else if (etas.get(u_) > etas.get(v_))\n v_ = vIterator.next();\n else {\n Integer[] triangle = new Integer[3];\n\n triangle[0] = u;\n triangle[1] = v;\n triangle[2] = u_;\n triangles.add(triangle);\n\n\n triangleCount++;\n\n u_ = uIterator.next();\n v_ = vIterator.next();\n\n }\n }\n\n }\n }\n }\n }\n return triangles;\n }", "private void solveViolation(NodeRB<K, V> x) {\n\t\tNodeRB<K, V> uncle = x.getUncle();\n\t\tif (uncle != null && uncle.color == true) {\n\n\t\t\t// Step 1.1 Change color of parent and uncle as BLACK.\n\t\t\tx.parent.color = false;\n\t\t\tuncle.color = false;\n\n\t\t\t// Step 1.2 color of grand parent as RED.\n\t\t\tx.getGrandParent().color = true;\n\n\t\t\t// Step 1.3 Change x = x's grandparent, repeat steps 2 and 3 for new x.\n\t\t\tbalanceRBTree(x.getGrandParent());\n\n\t\t\t// Case 2: If x's uncle is BLACK, then there can be four configurations for x,\n\t\t\t// x's parent (p) and x's grandparent (g)\n\t\t} else {\n\n\t\t\t// i) Left Left Case (p is left child of g and x is left child of p)\n\t\t\tif (x.parent.isLeftChild() && x.isLeftChild()) {\n\t\t\t\tleftLeftCase(x);\n\t\t\t}\n\n\t\t\t// ii) Left Right Case (p is left child of g and x is right child of p)\n\t\t\telse if (x.parent.isLeftChild() && x.isRightChild()) {\n\t\t\t\tif (x.parent == root) {\n\t\t\t\t\troot = rotateLeft(x.parent);\n\t\t\t\t} else {\n\t\t\t\t\trotateLeft(x.parent);\n\t\t\t\t}\n\t\t\t\tleftLeftCase(x.left);\n\t\t\t}\n\n\t\t\t// iii) Right Right Case (Mirror of case i)\n\t\t\telse if (x.parent.isRightChild() && x.isRightChild()) {\n\t\t\t\trightRightCase(x);\n\t\t\t}\n\n\t\t\t// iv) Right Left Case (Mirror of case ii)\n\t\t\telse if (x.parent.isRightChild() && x.isLeftChild()) {\n\t\t\t\tif (x.parent == root) {\n\t\t\t\t\troot = rotateRight(x.parent);\n\t\t\t\t} else {\n\t\t\t\t\trotateRight(x.parent);\n\t\t\t\t}\n\t\t\t\trightRightCase(x.right);\n\t\t\t}\n\t\t}\n\t}", "public Triangle(IPrimitive parent)\n {\n this(new Point(-0.5f, (float)-Math.tan(Math.PI / 6), 0f), new Point(\n 0.5f,\n (float)-Math.tan(Math.PI / 6),\n 0f), new Point(0f, (float)Math.sqrt(0.75)\n + (float)-Math.tan(Math.PI / 6), 0f), parent);\n\n }", "public ArtisticArrowhead() {\n setupControlPoints(4);\n }", "private void connectVertex(IndoorVertex indoorV1, IndoorVertex indoorV2)\n {\n XYPos firstPos = indoorV1.getPosition();\n XYPos secondPos = indoorV2.getPosition();\n\n //Change in only X position means that the vertex's are East/West of eachother\n //Change in only Y position means that the vertex's are North/South of eachother\n if(firstPos.getX() > secondPos.getX() && Math.floor(firstPos.getY() - secondPos.getY()) == 0.0)\n {\n indoorV1.addWestConnection(indoorV2);\n indoorV2.addEastConnection(indoorV1);\n }\n else if(firstPos.getX() < secondPos.getX() && Math.floor(firstPos.getY() - secondPos.getY()) == 0.0)\n {\n indoorV1.addEastConnection(indoorV2);\n indoorV2.addWestConnection(indoorV1);\n }\n else if(firstPos.getY() > secondPos.getY() && Math.floor(firstPos.getX() - secondPos.getX()) == 0.0)\n {\n indoorV1.addSouthConnection(indoorV2);\n indoorV2.addNorthConnection(indoorV1);\n }\n else if(firstPos.getY() < secondPos.getY() && Math.floor(firstPos.getX() - secondPos.getX()) == 0.0)\n {\n indoorV1.addNorthConnection(indoorV2);\n indoorV2.addSouthConnection(indoorV1);\n }\n\n\n indoorV1.addConnection(indoorV2);\n indoorV2.addConnection(indoorV1);\n }", "public void circulos() {\n pushMatrix();\n translate(width/2, height/2);\n rotate(-h);\n noFill();\n strokeWeight(5);\n stroke(255);\n ellipse(10, 10, 20, 20);\n popMatrix();\n\n h = h + 0.3f;\n }", "@Override\n\tpublic boolean linear(InternalCoordinate c) {\n\t\tif (x == c.getX()) {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t// The two diagonals\n\t\tint tmpx = x;\n\t\tint tmpy = y;\n\t\tif (isDown(x, y)) {\n\t\t\t// Down right\n\t\t\tif (c.getY() > y) {\n\t\t\t\twhile (tmpx > c.getX() || tmpy < c.getY()) {\n\t\t\t\t\ttmpx += isDown(tmpx, tmpy) ? 0 : -1;\n\t\t\t\t\ttmpy += isDown(tmpx, tmpy) ? 1 : 0;\n\t\t\t\t\t\n\t\t\t\t\tif (tmpx == c.getX() && tmpy == c.getY()) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t//Down left\n\t\t\t} else if (c.getY() < y) {\n\t\t\t\twhile (tmpx > c.getX() || tmpy > c.getY()) {\n\t\t\t\t\ttmpx += isDown(tmpx, tmpy) ? 0 : -1;\n\t\t\t\t\ttmpy += isDown(tmpx, tmpy) ? -1 : 0;\n\t\t\t\t\t\n\t\t\t\t\tif (tmpx == c.getX() && tmpy == c.getY()) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t} else {\n\t\t\t// Up right\n\t\t\tif (c.getY() > y) {\n\t\t\t\twhile (tmpx < c.getX() || tmpy < c.getY()) {\n\t\t\t\t\ttmpx += isDown(tmpx, tmpy) ? 1 : 0;\n\t\t\t\t\ttmpy += isDown(tmpx, tmpy) ? 0 : 1;\n\t\t\t\t\t\n\t\t\t\t\tif (tmpx == c.getX() && tmpy == c.getY()) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t//Up left\n\t\t\t} else if (c.getY() < y) {\n\t\t\t\twhile (tmpx < c.getX() || tmpy > c.getY()) {\n\t\t\t\t\ttmpx += isDown(tmpx, tmpy) ? 1 : 0;\n\t\t\t\t\ttmpy += isDown(tmpx, tmpy) ? 0 : -1;\n\t\t\t\t\t\n\t\t\t\t\tif (tmpx == c.getX() && tmpy == c.getY()) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "static void preparePathNodesWithTeleportation(PathNode[][] nodes, boolean[][] navigationData) {\n for(int y = 0; y < nodes.length; y++) {\n for(int x = 0; x < nodes[0].length; x++) {\n if((x == nodes[0].length-1 && y == 0 || x == 0 && y == nodes.length-1) || ((x == 0 || y == 0) ^ (x == nodes[0].length-1 || y == nodes.length-1))) {\n nodes[y][x] = new PathNode(x, y, false);\n } else {\n nodes[y][x] = new PathNode(x, y, navigationData[y-1][x-1]);\n }\n }\n }\n //Create teleporation links\n for(int y = 1; y < nodes.length-1; y++) {\n for(int x = 1; x < nodes[0].length-1; x++) {\n if(!navigationData[y-1][x-1]) continue;\n if(y == 1 && navigationData[nodes.length-3][x-1]) {\n nodes[y-1][x] = new PathNode(x, nodes.length-1, true);\n nodes[nodes.length-1][x] = new PathNode(x, y-1, true);\n }\n if(x == 1 && navigationData[y-1][nodes[0].length-3]) {\n nodes[y][x-1] = new PathNode(nodes[0].length-1, y, true);\n nodes[y][nodes[0].length-1] = new PathNode(x-1, y, true);\n }\n }\n }\n }", "public void moveObjectsAlongPath(){\n for (int i=0; i<gameObjects.getMoveableObjectsList().size(); i++){\r\n \r\n MoveableObject movingOb = gameObjects.getMoveableObjectsList().get(i);\r\n \r\n if (movingOb.getPathDestination()!=null ){\r\n \r\n KPoint start = movingOb.getPathLocation();\r\n KPoint destination = movingOb.getPathDestination();\r\n \r\n ArrayList<KPoint> pathPoints = getPathPoints(start, destination, movingOb.getObjectRadius());\r\n movingOb.setCurrentPathTest(pathPoints);\r\n \r\n }\r\n \r\n if(movingOb.getCurrentPath().size()>0){\r\n // find the angle the moveable object needs to rotate to by comparing start with the next path point\r\n KPoint start = movingOb.getPathLocation();\r\n KPoint nextPoint=movingOb.getCurrentPath().get(1);\r\n double targetAngle = Math.atan2(nextPoint.y-start.y, nextPoint.x-start.x );\r\n double angleRemaining = movingOb.getTransform().getRotation() - targetAngle;\r\n \r\n // fix for beyond pi range\r\n if (angleRemaining>Math.PI)angleRemaining -=2*Math.PI;\r\n if (angleRemaining<-Math.PI)angleRemaining +=2*Math.PI;\r\n \r\n if (angleRemaining > 0.1){ \r\n //movingOb.rotateAboutCenter(-angleRemaining);\r\n movingOb.rotateAboutCenter(-ROTATION_SPEED*movingOb.getSpeed());\r\n } else if (angleRemaining <-0.1){\r\n //movingOb.rotateAboutCenter(-ROTATION_SPEED*movingOb.getSpeed());\r\n movingOb.rotateAboutCenter(ROTATION_SPEED*movingOb.getSpeed());\r\n\r\n } else {\r\n double angle = movingOb.getTransform().getRotation();\r\n int xAdjust = (int)Math.ceil(Math.cos(angle)*FORCE_AMOUNT*movingOb.getSpeed());\r\n int yAdjust = (int)Math.ceil(Math.sin(angle)*FORCE_AMOUNT*movingOb.getSpeed());\r\n movingOb.applyForce(new Vector2(xAdjust,yAdjust));\r\n }\r\n }\r\n \r\n }\r\n }", "public static DeformableMesh3D createRectangleMesh(double width, double height, double depth, double segment_size){\n ArrayList<double[]> pts = new ArrayList<double[]>();\n ArrayList<int[]> connections = new ArrayList<int[]>();\n ArrayList<int[]> triangles = new ArrayList<int[]>();\n //For the complete length there will be n+1 nodes\n int nx = (int)(width/segment_size + 0.5) + 1;\n int ny = (int)(height/segment_size+0.5) + 1;\n int nz = (int)(depth/segment_size+0.5) + 1;\n double actual_w = (nx-1)*segment_size;\n double actual_h = (ny-1)*segment_size;\n double actual_z = (nz-1)*segment_size;\n\n int dex;\n\n //top face x-y @ actual_z/2\n int top_starting_dex = pts.size();\n for(int i = 0; i<nx; i++){\n for(int j = 0; j<ny; j++){\n dex = top_starting_dex + i*ny + j;\n pts.add(new double[]{\n i*segment_size - actual_w/2,\n j*segment_size - actual_h/2,\n actual_z/2\n });\n\n //create a connection\n if(i>0){\n connections.add(new int[]{\n dex,\n dex - ny\n });\n }\n\n if(j>0){\n connections.add(new int[]{\n dex,\n dex-1\n });\n }\n }\n }\n\n for(int i = 1; i<nx; i++){\n for(int j = 1; j<ny; j++){\n dex = pts.size();\n //add center\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n (j-0.5)*segment_size - actual_h/2,\n actual_z/2\n });\n //first\n int a_dex = top_starting_dex + (i-1)*ny + (j-1);\n connections.add(new int[]{dex,a_dex});\n int b_dex = top_starting_dex + (i)*ny + (j-1);\n connections.add(new int[]{dex,b_dex});\n int c_dex = top_starting_dex + (i)*ny + (j);\n connections.add(new int[]{dex,c_dex});\n int d_dex = top_starting_dex + (i-1)*ny + (j);\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, a_dex, b_dex});\n triangles.add(new int[]{dex, b_dex, c_dex});\n triangles.add(new int[]{dex, c_dex, d_dex});\n triangles.add(new int[]{dex, d_dex, a_dex});\n\n }\n }\n\n\n //bottom face x-y @ -actual_z/2\n int bottom_starting_dex = pts.size();\n for(int i = 0; i<nx; i++){\n for(int j = 0; j<ny; j++){\n\n dex = bottom_starting_dex + i*ny + j;\n pts.add(new double[]{\n i*segment_size - actual_w/2,\n j*segment_size - actual_h/2,\n -actual_z/2\n });\n\n //create a connection\n if(i>0){\n connections.add(new int[]{\n dex,\n dex - ny\n });\n }\n\n if(j>0){\n connections.add(new int[]{\n dex,\n dex - 1\n });\n }\n\n\n }\n }\n //bottom face\n for(int i = 1; i<nx; i++){\n for(int j = 1; j<ny; j++){\n dex = pts.size();\n //add center\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n (j-0.5)*segment_size - actual_h/2,\n -actual_z/2\n });\n //first\n int a_dex = bottom_starting_dex + (i-1)*ny + (j-1);\n connections.add(new int[]{dex,a_dex});\n int b_dex = bottom_starting_dex + (i)*ny + (j-1);\n connections.add(new int[]{dex,b_dex});\n int c_dex = bottom_starting_dex + (i)*ny + (j);\n connections.add(new int[]{dex,c_dex});\n int d_dex = bottom_starting_dex + (i-1)*ny + (j);\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n }\n\n\n\n //left face y-z @ -actual_x/2\n int left_starting_dex = pts.size();\n for(int i = 0; i<ny; i++){\n for(int j = 1; j<nz-1; j++){\n dex = left_starting_dex + i*(nz-2) + (j-1);\n pts.add(new double[]{\n -actual_w/2,\n i*segment_size - actual_h/2,\n j*segment_size - actual_z/2\n });\n\n //creates a connection\n if(i>0){\n //previous row\n connections.add(new int[]{\n dex,\n dex - (nz-2)\n });\n }\n\n if(j>1){\n //previous column\n connections.add(new int[]{\n dex,\n dex - 1\n });\n }\n }\n }\n\n\n //left face connections\n for(int i = 0; i<ny; i++){\n connections.add(new int[]{\n top_starting_dex + i,\n left_starting_dex + i*(nz-2) + (nz-3)\n });\n\n connections.add(new int[]{\n bottom_starting_dex + i,\n left_starting_dex + i*(nz-2)\n });\n\n }\n\n //left face triangles\n for(int i = 1; i<ny; i++){\n for(int j = 2; j<nz-1; j++){\n dex = pts.size();\n //add center\n pts.add(new double[]{\n -actual_w/2,\n (i-0.5)*segment_size - actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n //first\n int a_dex = left_starting_dex + (i-1)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,a_dex});\n int b_dex = left_starting_dex + (i)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,b_dex});\n int c_dex = left_starting_dex + (i)*(nz-2) + (j-1);\n connections.add(new int[]{dex,c_dex});\n int d_dex = left_starting_dex + (i-1)*(nz-2) + (j-1);\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n }\n\n //left face merging triangles\n for(int i = 1; i<ny; i++){\n\n dex = pts.size();\n\n pts.add(new double[]{\n -actual_w/2,\n (i-0.5)*segment_size - actual_h/2,\n (0.5)*segment_size - actual_z/2\n });\n\n int a_dex = bottom_starting_dex + i-1;\n int b_dex = bottom_starting_dex + i;\n int c_dex = left_starting_dex + i*(nz-2);\n int d_dex = left_starting_dex + (i-1)*(nz-2);\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n dex = pts.size();\n\n pts.add(new double[]{\n -actual_w/2,\n (i-0.5)*segment_size - actual_h/2,\n -(0.5)*segment_size + actual_z/2\n });\n\n a_dex = top_starting_dex + i;\n b_dex = top_starting_dex + i-1;\n c_dex = left_starting_dex + (i-1)*(nz-2) + (nz-3);\n d_dex = left_starting_dex + (i)*(nz-2) + (nz-3);\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n\n //right face y-z @ actual_x/2\n int right_starting_dex = pts.size();\n for(int i = 0; i<ny; i++){\n for(int j = 1; j<nz-1; j++){\n dex = right_starting_dex + i*(nz-2) + (j-1);\n pts.add(new double[]{\n actual_w/2,\n i*segment_size - actual_h/2,\n j*segment_size - actual_z/2\n });\n\n //creates a connection\n if(i>0){\n //previous row\n connections.add(new int[]{\n dex,\n dex - (nz-2)\n });\n }\n\n if(j>1){\n //previous column\n connections.add(new int[]{\n dex,\n dex - 1\n });\n }\n }\n }\n\n for(int i = 0; i<ny; i++){\n connections.add(new int[]{\n top_starting_dex + i + ny*(nx-1),\n right_starting_dex + i*(nz-2) + (nz-3)\n });\n\n connections.add(new int[]{\n bottom_starting_dex + i + ny*(nx-1),\n right_starting_dex + i*(nz-2)\n });\n\n }\n\n //right face triangles\n for(int i = 1; i<ny; i++){\n for(int j = 2; j<nz-1; j++){\n dex = pts.size();\n //add center\n pts.add(new double[]{\n actual_w/2,\n (i-0.5)*segment_size - actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n //first\n int a_dex = right_starting_dex + (i)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,a_dex});\n int b_dex = right_starting_dex + (i-1)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,b_dex});\n int c_dex = right_starting_dex + (i-1)*(nz-2) + (j-1);\n connections.add(new int[]{dex,c_dex});\n int d_dex = right_starting_dex + (i)*(nz-2) + (j-1);\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n }\n\n\n //right face merging triangles\n for(int i = 1; i<ny; i++){\n /*\n connections.add(new int[]{\n top_starting_dex + i,\n left_starting_dex + i*(nz-2) + (nz-3)\n });\n */\n dex = pts.size();\n\n pts.add(new double[]{\n actual_w/2,\n (i-0.5)*segment_size - actual_h/2,\n (0.5)*segment_size - actual_z/2\n });\n\n int a_dex = bottom_starting_dex + i + ny*(nx-1);\n int b_dex = bottom_starting_dex + i-1 + ny*(nx-1);\n int c_dex = right_starting_dex + (i-1)*(nz-2);\n int d_dex = right_starting_dex + (i)*(nz-2);\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n dex = pts.size();\n\n pts.add(new double[]{\n actual_w/2,\n (i-0.5)*segment_size - actual_h/2,\n -(0.5)*segment_size + actual_z/2\n });\n\n a_dex = top_starting_dex + i-1 + ny*(nx-1);\n b_dex = top_starting_dex + i + ny*(nx-1);\n c_dex = right_starting_dex + (i)*(nz-2) + (nz-3);\n d_dex = right_starting_dex + (i-1)*(nz-2) + (nz-3);\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n\n\n //front face x-z @ -actual_y/2\n int front_starting_dex = pts.size();\n for(int i = 1; i<nx-1; i++){\n for(int j = 1; j<nz-1; j++){\n dex = front_starting_dex + (i-1)*(nz-2) + (j-1);\n pts.add(new double[]{\n i*segment_size - actual_w/2,\n -actual_h/2,\n j*segment_size - actual_z/2\n });\n\n if(i>1){\n connections.add(new int[]{\n dex,\n dex - (nz-2)\n });\n }\n\n if(j>1){\n connections.add(new int[]{\n dex,\n dex - 1\n });\n }\n\n\n }\n }\n\n //connect to top and bottom.\n for(int i = 1; i<nx-1; i++){\n connections.add(new int[]{\n front_starting_dex + (i-1)*(nz - 2),\n bottom_starting_dex + i*ny\n });\n\n connections.add(new int[]{\n front_starting_dex + (i-1)*(nz - 2) + (nz-3),\n top_starting_dex + i*ny\n });\n\n }\n\n //connect to left and right\n for(int j = 1; j<nz-1; j++){\n connections.add(new int[]{\n front_starting_dex + (j-1),\n left_starting_dex + j - 1\n });\n\n connections.add(new int[]{\n front_starting_dex + (j-1) + (nz-2)*(nx-3),\n right_starting_dex + j - 1\n });\n }\n\n //front face triangles\n for(int i = 2; i<nx-1; i++){\n for(int j = 2; j<nz-1; j++){\n dex = pts.size();\n //add center\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n -actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n //first\n int a_dex = front_starting_dex + (i-1)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,a_dex});\n int b_dex = front_starting_dex + (i-2)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,b_dex});\n int c_dex = front_starting_dex + (i-2)*(nz-2) + (j-1);\n connections.add(new int[]{dex,c_dex});\n int d_dex = front_starting_dex + (i-1)*(nz-2) + (j-1);\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n }\n\n //front face triangles merging to top/bottom sans corners.\n for(int i = 2; i<nx-1; i++){\n dex = pts.size();\n\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n -actual_h/2,\n (0.5)*segment_size - actual_z/2\n });\n\n int a_dex = front_starting_dex + (i-2)*(nz - 2);\n int b_dex = front_starting_dex + (i-1)*(nz - 2);\n int c_dex = bottom_starting_dex + i*ny;\n int d_dex = bottom_starting_dex + (i-1)*ny;\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n dex = pts.size();\n\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n -actual_h/2,\n -(0.5)*segment_size + actual_z/2\n });\n\n a_dex = front_starting_dex + (i-1)*(nz - 2) + (nz-3);\n b_dex = front_starting_dex + (i-2)*(nz - 2) + (nz-3);\n c_dex = top_starting_dex + (i-1)*ny;\n d_dex = top_starting_dex + i*ny;\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n\n //front face triangles merging to left and right sans corners.\n for(int j = 2; j<nz-1; j++){\n\n dex = pts.size();\n\n pts.add(new double[]{\n 0.5*segment_size - actual_w/2,\n -actual_h/2,\n (j - 0.5)*segment_size - actual_z/2\n });\n\n int a_dex = front_starting_dex + (j-1);\n int b_dex = front_starting_dex + (j-2);\n int c_dex = left_starting_dex + j - 2;\n int d_dex = left_starting_dex + j - 1;\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n dex = pts.size();\n\n pts.add(new double[]{\n (-0.5)*segment_size + actual_w/2,\n -actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n\n a_dex = front_starting_dex + (j-2) + (nz-2)*(nx-3);\n b_dex = front_starting_dex + (j-1) + (nz-2)*(nx-3);\n c_dex = right_starting_dex + j - 1;\n d_dex = right_starting_dex + j - 2;\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n }\n\n //front triangles four corners.\n for(int j = 1; j<nz; j+=nz-2){\n\n dex = pts.size();\n\n pts.add(new double[]{\n 0.5*segment_size - actual_w/2,\n -actual_h/2,\n (j - 0.5)*segment_size - actual_z/2\n });\n\n\n\n int a_dex, b_dex, c_dex, d_dex;\n\n if(j==1){\n a_dex = front_starting_dex;\n b_dex = bottom_starting_dex + ny;\n c_dex = bottom_starting_dex;\n d_dex = left_starting_dex;\n } else{\n a_dex = front_starting_dex + nz-3;\n b_dex = left_starting_dex + nz-3;\n c_dex = top_starting_dex;\n d_dex = top_starting_dex + ny;\n }\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n dex = pts.size();\n\n pts.add(new double[]{\n (-0.5)*segment_size + actual_w/2,\n -actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n\n\n if(j==1){\n a_dex = front_starting_dex + (nx-3)*(nz - 2);\n b_dex = right_starting_dex;\n c_dex = bottom_starting_dex + (nx-1)*(ny);\n d_dex = bottom_starting_dex + (nx-2)*(ny);\n } else{\n a_dex = front_starting_dex + (nx-2)*(nz - 2) -1;\n b_dex = top_starting_dex + (nx-2)*(ny);\n c_dex = top_starting_dex + (nx-1)*(ny);\n d_dex = right_starting_dex + nz-3;\n }\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n }\n\n\n //back plane\n int back_starting_dex = pts.size();\n for(int i = 1; i<nx-1; i++){\n for(int j = 1; j<nz-1; j++){\n dex = back_starting_dex + (i-1)*(nz-2) + (j-1);\n pts.add(new double[]{\n i*segment_size - actual_w/2,\n actual_h/2,\n j*segment_size - actual_z/2\n });\n\n if(i>1){\n connections.add(new int[]{\n dex,\n dex - (nz-2)\n });\n }\n\n if(j>1){\n connections.add(new int[]{\n dex,\n dex - 1\n });\n }\n\n\n }\n }\n\n\n //connect to top and bottom.\n for(int i = 1; i<nx-1; i++){\n connections.add(new int[]{\n back_starting_dex + (i-1)*(nz - 2),\n bottom_starting_dex + i*ny + ny-1\n });\n\n connections.add(new int[]{\n back_starting_dex + (i-1)*(nz - 2) + (nz-3),\n top_starting_dex + i*ny + ny-1\n });\n\n }\n\n\n //connect to left and right\n for(int j = 1; j<nz-1; j++){\n connections.add(new int[]{\n back_starting_dex + (j-1),\n left_starting_dex + j - 1 + (ny-1)*(nz-2)\n });\n\n connections.add(new int[]{\n back_starting_dex + (j-1) + (nz-2)*(nx-3),\n right_starting_dex + j - 1 + (ny-1)*(nz-2)\n });\n }\n\n //back face triangles\n for(int i = 2; i<nx-1; i++){\n for(int j = 2; j<nz-1; j++){\n dex = pts.size();\n //add center\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n //first\n int a_dex = back_starting_dex + (i-2)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,a_dex});\n int b_dex = back_starting_dex + (i-1)*(nz-2) + (j-2) ;\n connections.add(new int[]{dex,b_dex});\n int c_dex = back_starting_dex + (i-1)*(nz-2) + (j-1);\n connections.add(new int[]{dex,c_dex});\n int d_dex = back_starting_dex + (i-2)*(nz-2) + (j-1);\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n }\n\n\n //back face triangles merging to top/bottom sans corners.\n for(int i = 2; i<nx-1; i++){\n dex = pts.size();\n\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n actual_h/2,\n (0.5)*segment_size - actual_z/2\n });\n\n int a_dex = back_starting_dex + (i-1)*(nz - 2);\n int b_dex = back_starting_dex + (i-2)*(nz - 2);\n int c_dex = bottom_starting_dex + (i-1)*ny + ny - 1;\n int d_dex = bottom_starting_dex + (i)*ny + ny - 1;\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n dex = pts.size();\n\n pts.add(new double[]{\n (i-0.5)*segment_size - actual_w/2,\n actual_h/2,\n -(0.5)*segment_size + actual_z/2\n });\n\n a_dex = back_starting_dex + (i-2)*(nz - 2) + (nz-3);\n b_dex = back_starting_dex + (i-1)*(nz - 2) + (nz-3);\n c_dex = top_starting_dex + (i)*ny + ny - 1;\n d_dex = top_starting_dex + (i-1)*ny + ny - 1;\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n }\n\n //back face triangles merging to left and right sans corners.\n for(int j = 2; j<nz-1; j++){\n\n dex = pts.size();\n\n pts.add(new double[]{\n 0.5*segment_size - actual_w/2,\n actual_h/2,\n (j - 0.5)*segment_size - actual_z/2\n });\n\n int a_dex = back_starting_dex + (j-2);\n int b_dex = back_starting_dex + (j-1);\n int c_dex = left_starting_dex + j - 1 + (ny-1)*(nz-2);\n int d_dex = left_starting_dex + j - 2 + (ny-1)*(nz-2);\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n dex = pts.size();\n\n pts.add(new double[]{\n (-0.5)*segment_size + actual_w/2,\n actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n\n a_dex = back_starting_dex + (j-1) + (nz-2)*(nx-3);\n b_dex = back_starting_dex + (j-2) + (nz-2)*(nx-3);\n c_dex = right_starting_dex + j - 2+ (ny-1)*(nz-2);\n d_dex = right_starting_dex + j - 1+ (ny-1)*(nz-2);\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n }\n\n //back triangles four corners.\n for(int j = 1; j<nz; j+=nz-2){\n\n dex = pts.size();\n\n pts.add(new double[]{\n 0.5*segment_size - actual_w/2,\n actual_h/2,\n (j - 0.5)*segment_size - actual_z/2\n });\n\n\n\n int a_dex, b_dex, c_dex, d_dex;\n\n if(j==1){\n a_dex = back_starting_dex;\n b_dex = left_starting_dex + (ny-1)*(nz-2);\n c_dex = bottom_starting_dex + ny -1;\n d_dex = bottom_starting_dex + 2*ny - 1;\n } else{\n a_dex = back_starting_dex + nz-3;\n b_dex = top_starting_dex + 2*ny - 1;\n c_dex = top_starting_dex + ny - 1;\n d_dex = left_starting_dex + (ny)*(nz-2) - 1 ;\n }\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n dex = pts.size();\n\n pts.add(new double[]{\n (-0.5)*segment_size + actual_w/2,\n actual_h/2,\n (j-0.5)*segment_size - actual_z/2\n });\n\n\n if(j==1){\n a_dex = back_starting_dex + (nx-3)*(nz - 2);\n b_dex = bottom_starting_dex + (nx-1)*(ny) - 1;\n c_dex = bottom_starting_dex + (nx)*(ny) - 1;\n d_dex = right_starting_dex + (nz-2)*(ny-1);\n } else{\n a_dex = back_starting_dex + (nx-2)*(nz - 2) -1;\n b_dex = right_starting_dex + (nz-2)*(ny-1) + nz - 3;\n c_dex = top_starting_dex + (nx)*(ny) -1;\n d_dex = top_starting_dex + (nx-1)*(ny) -1;\n }\n\n connections.add(new int[]{dex,a_dex});\n connections.add(new int[]{dex,b_dex});\n connections.add(new int[]{dex,c_dex});\n connections.add(new int[]{dex,d_dex});\n\n triangles.add(new int[]{dex, b_dex, a_dex});\n triangles.add(new int[]{dex, c_dex, b_dex});\n triangles.add(new int[]{dex, d_dex, c_dex});\n triangles.add(new int[]{dex, a_dex, d_dex});\n\n\n }\n\n final DeformableMesh3D mesh = new DeformableMesh3D(pts, connections, triangles);\n\n return mesh;\n }", "private void createMiniTriangles(int[] xPoints, int[] yPoints, int[] color) {\n\t\tint[] xMidpoints = new int[NUM_TRIANGLE_SIDES];\n\t\tint[] yMidpoints = new int[NUM_TRIANGLE_SIDES];\n\n\t\tfor (int i = 0; i < NUM_TRIANGLE_SIDES; i++) {\n\t\t\txMidpoints[i] = avg(xPoints[i], xPoints[(i + 1) % NUM_TRIANGLE_SIDES]);\n\t\t\tyMidpoints[i] = avg(yPoints[i], yPoints[(i + 1) % NUM_TRIANGLE_SIDES]);\n\t\t}\n\n\t\t// midpoint i, midpoint i+1, point i\n\t\tfor (int i = 0; i < NUM_TRIANGLE_SIDES; i++) {\n\t\t\tint[] xMini = {xMidpoints[i], xMidpoints[(i + TRI_TYPE) % NUM_TRIANGLE_SIDES], xPoints[i]};\n\t\t\tint[] yMini = {yMidpoints[i], yMidpoints[(i + TRI_TYPE) % NUM_TRIANGLE_SIDES], yPoints[i]};\n\t\t\tint colorVal = (i + this.rotateOffset) % NUM_TRIANGLE_SIDES;\n\t\t\tthis.drawMiniTriangle(xMini, yMini, color[colorVal], colorVal);\n\t\t}\n\t\tif (IS_ROT_ON) {\n\t\t\tthis.rotateOffset += ROT_OFFSET_BY;\n\t\t}\n\t}", "protected abstract Triangle makeTriangle(final Vector3d edge1, final Vector3d edge2,\n\t\t\tfinal Vector3d edge3);", "public void setArrowTail(int baseX, int baseY, int tipX, int tipY);", "void fixViolation(Node node){\n\t\tNode parentPtr = nil;\n\t\tNode grParentPtr = nil;\n\t\t\n\t\twhile( node != root && node.colour != \"Black\" && node.parent.colour == \"Red\" && node.parent.parent != nil){\n\t\t\t\n\t\t\tparentPtr = node.parent;\n\t\t\tgrParentPtr = node.parent.parent;\n\t\t\t//case A\n\t\t\t//parent of node is the left child of grandparent\n\t\t\tif(parentPtr == grParentPtr.left){\n\t\t\t\tNode unclePtr = grParentPtr.right;\n\t\t\t\t\n\t\t\t\t//case 1 \n\t\t\t\t//Uncle is red in color\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//of node is the right child of its parent\n\t\t\t\t\tif(node == parentPtr.right){\n\t\t\t\t\t\trotateLeft(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the left child of its parent left rotation is required\n\t\t\t\t\trotateRight(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//case B\n\t\t\t//parent of the node is the right child of grand parent\n\t\t\tif(parentPtr == grParentPtr.right){\n\t\t\t\tNode unclePtr = grParentPtr.left;\n\t\t\t\t//case 1\n\t\t\t\t//uncle pointer is red\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//node is the left child of its parent right rotation is required\n\t\t\t\t\tif(node == parentPtr.left){\n\t\t\t\t\t\trotateRight(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the right child of its parent left rotation is required\n\t\t\t\t\trotateLeft(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\troot.colour = \"Black\";\n\t}", "private void updateUserInputTriangle(GameContainer gc, float elapsedTime) {\n if ( gc.getInput().isKeyHeld(KeyEvent.VK_A) ) {\n polygons.get(1).setAngle(polygons.get(1).getAngle() - 2.0f * elapsedTime);\n }\n if ( gc.getInput().isKeyHeld(KeyEvent.VK_D) ) {\n polygons.get(1).setAngle(polygons.get(1).getAngle() + 2.0f * elapsedTime);\n }\n if ( gc.getInput().isKeyHeld(KeyEvent.VK_W) ) {\n polygons.get(1).getPosition().addToX((float)Math.cos(polygons.get(1).getAngle()) * 60.0f * elapsedTime);\n polygons.get(1).getPosition().addToY((float)Math.sin(polygons.get(1).getAngle()) * 60.0f * elapsedTime);\n }\n if ( gc.getInput().isKeyHeld(KeyEvent.VK_S) ) {\n polygons.get(1).getPosition().addToX(-(float)Math.cos(polygons.get(1).getAngle()) * 60.0f * elapsedTime);\n polygons.get(1).getPosition().addToY(-(float)Math.sin(polygons.get(1).getAngle()) * 60.0f * elapsedTime);\n }\n }", "public void makeCylinder (float radius, int radialDivisions, int heightDivisions)\r\n {\r\n \t// Midpoint for top and bottom surfaces\r\n \tPoint midTop = new Point( 0f, 0.5f, 0f);\r\n \tPoint midBot = new Point( 0f, -0.5f, 0f );\r\n \t\r\n \tPoint upper[] = new Point[radialDivisions + 1];\r\n \tPoint lower[] = new Point[radialDivisions + 1];\r\n \t\r\n \t// Calculate x and z coordinates using parametric equations\r\n \t// Top circular surface\r\n \tfor(int i = 0; i <= radialDivisions; i ++)\r\n \t{\r\n \t\tupper[i] = new Point();\r\n \t\t\r\n \t\tupper[i].x = radius * (float)( Math.cos( Math.toRadians((360.0/radialDivisions ) * i ) ) );\r\n \t\tupper[i].z = radius * (float)( Math.sin( Math.toRadians((360.0/radialDivisions ) * i ) ) );\r\n \t\tupper[i].y = 0.5f;\r\n \t\t\r\n \t}\r\n \t\r\n \t// Bottom circle\r\n \tfor(int i = 0; i <= radialDivisions; i ++)\r\n \t{\r\n \t\tlower[i] = new Point();\r\n \t\t\r\n \t\tlower[i].x = radius * (float)( Math.cos( ( Math.toRadians(360.0/radialDivisions * ( i ) ) ) ) );\r\n \t\tlower[i].z = radius * (float)( Math.sin( ( Math.toRadians(360.0/radialDivisions * ( i ) ) ) ) );\r\n \t\tlower[i].y = -0.5f;\r\n \t\t\r\n \t}\r\n \t\r\n \t// Print both the top and bottom circular faces\r\n \tfor( int i = 0; i < radialDivisions; i ++ )\r\n \t{\r\n \t\tthis.addTriangle(midTop.x, midTop.y, midTop.z, upper[i + 1].x, upper[i + 1].y, upper[i + 1].z, upper[i].x, upper[i].y, upper[i].z);\r\n \t}\r\n \t\r\n \tfor( int i = 0; i < radialDivisions; i ++ )\r\n \t{\r\n \t\tthis.addTriangle(midBot.x, midBot.y, midBot.z, lower[i].x, lower[i].y, lower[i].z, lower[i + 1].x, lower[i + 1].y, lower[i + 1].z);\r\n \t}\r\n \t\r\n \t\r\n \t\r\n \t// Curved Surface\r\n \tfloat v = -0.5f;\r\n \t\r\n \tfloat vert[] = new float[heightDivisions + 1];\r\n \t\r\n \tfor( int i = 0; i <= heightDivisions; i++)\r\n \t{\r\n \t\tvert[i] = v;\r\n \t\tv = v + (float)(1/(float)heightDivisions);\r\n \t}\r\n \t\r\n \t// Display the curved surface faces\r\n \tfor( int j = 0; j < heightDivisions; j ++ )\r\n \t\tfor(int k = 0; k < radialDivisions; k ++ )\r\n \t\t{\r\n \t\t\tif( k == radialDivisions - 1 )\r\n \t\t\t{\r\n \t\t\t\tPoint tempP1 = new Point(lower[k].x, vert[j], lower[k].z);\r\n \t\t\t\tPoint tempP2 = new Point(lower[0].x, vert[j], lower[0].z);\r\n \t\t\t\tPoint tempP3 = new Point(lower[0].x, vert[j + 1], lower[0].z);\r\n \t\t\t\tPoint tempP4 = new Point(lower[k].x, vert[j + 1], lower[k].z);\r\n \t\t\t\t\r\n \t\t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP4.x, tempP4.y, tempP4.z, tempP3.x, tempP3.y, tempP3.z );\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP2.x, tempP2.y, tempP2.z);\r\n \t\t\t}\r\n \t\t\telse\r\n \t\t\t{\r\n \t\t\t\tPoint tempP1 = new Point(lower[k].x, vert[j], lower[k].z);\r\n \t\t\t\tPoint tempP2 = new Point(lower[k + 1].x, vert[j], lower[k + 1].z);\r\n \t\t\t\tPoint tempP3 = new Point(lower[k + 1].x, vert[j + 1], lower[k + 1].z);\r\n \t\t\t\tPoint tempP4 = new Point(lower[k].x, vert[j + 1], lower[k].z);\r\n \t\t\t\t\r\n \t\t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP4.x, tempP4.y, tempP4.z, tempP3.x, tempP3.y, tempP3.z );\r\n \t\t\taddTriangle(tempP1.x, tempP1.y, tempP1.z, tempP3.x, tempP3.y, tempP3.z, tempP2.x, tempP2.y, tempP2.z);\r\n \t\t\t}\r\n \t\t}\r\n }", "private void checkPaths(){\r\n\t\tif(noBeepersPresent()){\r\n\t\t\tif(leftIsClear()){\r\n\t\t\t\tif(frontIsBlocked()&&rightIsBlocked()&&cornerColorIs(RED)){\r\n\t\t\t\t\tturnLeft(); \r\n\t\t\t\t\tmakeMove();\r\n\t\t\t\t\tpaintCorner(RED);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tturnLeft(); \r\n\t\t\t\t\tcheckColors();\r\n\t\t\t\t}\r\n\t\t\t\tfollowPath();\r\n\t\t\t}\r\n\t\t\tif(frontIsClear()){\r\n\t\t\t\tcheckColors();\r\n\t\t\t\tfollowPath();\r\n\t\t\t}\r\n\t\t\tif(rightIsClear()){\r\n\t\t\t\tif(frontIsBlocked()&&leftIsBlocked()&&cornerColorIs(RED)){\r\n\t\t\t\t\tturnRight();\r\n\t\t\t\t\tmakeMove();\r\n\t\t\t\t\tpaintCorner(RED);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tturnRight();\r\n\t\t\t\t\tcheckColors();\r\n\t\t\t\t}\r\n\t\t\t\tfollowPath();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public Polytope(PolytopePoint a, PolytopePoint b, PolytopePoint c, PolytopePoint d){\n\t\tfaces = new ArrayList<PolytopeTriangle>();//construct array list to hold the faces of the polytope\n\t\t//construct the initial faces of the polytope using the given vertices that are from the simplex\n\t\t//GJK terminated with\n\t\tfaces.add(new PolytopeTriangle(a,b,c));\n\t\tfaces.add(new PolytopeTriangle(a,c,d));\n\t\tfaces.add(new PolytopeTriangle(a,d,b));\n\t\tfaces.add(new PolytopeTriangle(b,d,c));\n\t}", "private void rotate() {\n byte tmp = topEdge;\n topEdge = leftEdge;\n leftEdge = botEdge;\n botEdge = rightEdge;\n rightEdge = tmp;\n tmp = reversedTopEdge;\n reversedTopEdge = reversedLeftEdge;\n reversedLeftEdge = reversedBotEdge;\n reversedBotEdge = reversedRightEdge;\n reversedRightEdge = tmp;\n tmp = ltCorner;\n ltCorner = lbCorner;\n lbCorner = rbCorner;\n rbCorner = rtCorner;\n rtCorner = tmp;\n\n }", "public void paint( Graphics g )\n {\n\tint red;int green;int blue,p;\n\tred = 255; green = 255; blue = 255;\n\tg.setColor(new Color(red,green,blue));//change the bg color\n\tg.fillRect(0,0,720,520);\n\tred = 255; green = 255; blue = 255;\n\tg.setColor(new Color(0,0,255));\n\t//g.drawLine(0,0,200,200);\n\t\n\t//set up chaos\t\n\tTri ob = new Tri (g,20,20);\n\tint h1 = 220, k1 = 50;\n\tint h2 = 20, k2 = 320;\n\tint h3 = 420, k3 = 320;\n\t\n\t//g.setColor(new Color(0,0,255));\n\t\n\t//g.drawLine(h1,k1,h1,k1);\n\t//g.setColor(new Color(255,0,0));\n\t\n\t//g.drawLine(h2,k2,h2,k2);\n\t//g.setColor(new Color(0,0,255));\n\t\n\t//g.drawLine(h3,k3,h3,k3);\n\t\n\t//g.drawLine(sx,sy,sx,sy);\n\t\n\tg.setColor(new Color(255,0,0));\n\tint a,n,nx,ny;\n\t\n\n\t\tg.setColor(new Color(255,0,0));\n\t\tg.fillOval(h1-8,k1-15,5,5);\n\t\t\n\t\tg.setColor(new Color(0,255,0));\n\t\tg.fillOval(h2-7,k2+7,5,5);\n\t\t\n\t\tg.setColor(new Color(0,0,255));\n\t\tg.fillOval(h3-7,k3+7,5,5);\n\t\t\n\t\tg.setColor(new Color(0,255,255));\n\t\tint sx = 20, sy = 320;\n\t\t//int sx = 10, sy = 10;\n\t\t\n\t\t//g.fillOval(sx,sy,15,15);\n\tfor (a = 0;a <500000;a++){\n\t\tint z = 2;\n\t\tn = (int)( Math.random()*3);\n\tswitch(n) {\n\tcase 0:\n\t\tnx = (int) ((sx+h1)/z);\n\t\tny = (int) ((sy+k1)/z);\n\t\tg.setColor(new Color(255,0,0));\n\t\tg.drawLine(nx,ny,nx,ny);\n\t\tsx = nx;sy = ny;\n\t\tbreak;\n\tcase 1:\n\t\tnx = (int) ((sx + h2) / z);\n\t\tny = (int) ((sy+ k2)/z);\n\t\tg.setColor(new Color(0,150,10));\n\t\tg.drawLine(nx,ny,nx,ny);\n\t\tsx = nx;sy = ny;\n\t\tbreak;\n\tdefault:\n\t\tnx = (int) ((sx + h3) / z);\n\t\tny = (int) ((sy + k3)/z);\n\t\tg.setColor(new Color(0,0,255));\n\t\tg.drawLine(nx,ny,nx,ny);\n\t\tsx = nx;sy = ny;\n\t}\n\n\t//for (p = 0;p<100000;p++);\n\t}//for a\n\t\n}", "public static void main(String[] args) {\n // ***\n // *****\n // *******\n // *********\n // *******\n // *****\n // ***\n // *\n System.out.println(\"PROBLEM 1: \");\n int numOfLines = 9;\n int midLine = (numOfLines+1)/2;\n // upper part\n for (int i = 1; i <= midLine; i++){\n //space\n for (int s = 1; s<=(midLine-i); s++){\n System.out.print(\" \");\n }\n //star\n for (int j =1; j<=(i*2-1); j++){\n System.out.print(\"*\");\n }\n System.out.println();\n }\n //Lower part\n for(int i =1;i <=(midLine-1);i++) {\n\n\n //space\n for (int s = 1; s <= i; s++){\n System.out.print(\" \");\n }\n //star\n for (int j= 1; j<=(midLine-i)*2-1; j++){\n System.out.print(\"*\");\n }\n System.out.println();\n\n }\n\n\n// Problem 2\n// Given the number of rows, create a triangle with that many rows.\n// For example, if rows = 5 then\n// *\n// **\n// ***\n// ****\n// *****\n System.out.println(\"PROBLEM 2: \");\n\n System.out.println(\"Enter the number of line (odd numbers)\");\n Scanner input = new Scanner(System.in);\n int numberOfLines = input.nextInt();\n for (int i = 1; i <= numberOfLines; i++){\n //add stars\n for (int j =1; j<=i; j++){\n System.out.print(\"*\");\n }\n System.out.println();\n\n }\n\n // Problem 3\n // Using the celsius to fahrenheit conversion, product the following table\n // |Celsius|Fahrenheit|\n // | 0 | 32 |\n // | 1 | 33.8 |\n // | 2 | 35.6 |\n // | ... | ... |\n // | 30 | 86 |\n\n System.out.println(\"PROBLEM 3: \");\n\n int celsius = 0;\n double fahrenheit;\n System.out.println(\" | \"+\"celsius\"+\"|\"+\"fahrenheit\"+\"| \");\n\n while(celsius <=30 ) {\n fahrenheit = (9.0/5.0 * celsius) + 32;\n System.out.println(\" | \" + celsius + \" | \" + fahrenheit + \" | \");\n celsius++;\n }\n\n\n // Problem 4\n // Declare a variable x with any value. Determine if x is prime.\n //Dividing the number by 2 does gain us efficiency but how could we make it more efficient? Think about 25,\n // do you need to go up to 12.5? Could you stop at a lower number?\n System.out.println(\"PROBLEM 4: \");\n\n int remainder;\n boolean isPrime = true;\n int numberToCheck = 77;\n\n for (int i = 2; i <= numberToCheck /i; i++) {\n remainder = numberToCheck % i;\n\n\n if (remainder == 0) {\n\n isPrime = false;\n break;\n }\n }\n\n if (isPrime)\n System.out.println(numberToCheck + \" is a Prime numberToCheckber\");\n else\n System.out.println(numberToCheck + \" is not a Prime numberToCheckber\");\n\n\n // Problem 5\n // The Kalebnacci sequence begins with 2 and -1 as its first and second terms.\n // After these first two elements, each subsequent element is equal to twice the previous previous term minus\n // the previous term.\n // kaleb(0) = 2\n // kaleb(1) = -1\n // kaleb(n) = 2*kaleb(n-2) - kaleb(n-1)\n // Find the nth number in the sequence\n\n System.out.println(\"PROBLEM 5: \");\n\n int n = 8;\n int a = 2;\n int b = -1;\n int c;\n System.out.print(a + \" \" + b + \" \");\n for (int i =0; i<n;i++){\n c =2*a-b;\n System.out.print(c + \" \" );\n a=b;\n b=c;\n }\n\n }", "public static boolean check_right_angled_tri(int [] side) {\n\t\tint a_sqr = side[0]*side[0];\n\t\tint b_sqr = side[1]*side[1];\n\t\tint c_sqr = side[2]*side[2];\n\t\t\n\t\t// boolean isIsosceles = check_isosceles_tri(a_side, b_side, c_side);\n\t\treturn ((a_sqr == b_sqr + c_sqr) || (b_sqr == a_sqr + c_sqr) || (c_sqr == a_sqr+b_sqr)) && isTri(side) ;\n\t}", "private void populateConnections()\n {\n IndoorVertex elevatorFloor1 = new IndoorVertex(building, new XYPos(1050, 40), 1);\n IndoorVertex stairsFloor1 = new IndoorVertex(building, new XYPos(1056.25, 28.13), 1);\n\n firstFloorStairsElevator.add(stairsFloor1);\n firstFloorStairsElevator.add(elevatorFloor1);\n\n IndoorVertex stairsFloor2 = new IndoorVertex(building, new XYPos(1049.43, 160.49), 2);\n IndoorVertex elevatorFloor2 = new IndoorVertex(building, new XYPos(1044.19, 151.19), 2);\n\n secondFloorStairsElevator.add(stairsFloor2);\n secondFloorStairsElevator.add(elevatorFloor2);\n\n IndoorVertex stairsFloor3 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 3);\n IndoorVertex elevatorFloor3 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 3);\n\n thirdFloorStairsElevator.add(stairsFloor3);\n thirdFloorStairsElevator.add(elevatorFloor3);\n\n IndoorVertex stairsFloor4 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 4);\n IndoorVertex elevatorFloor4 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 4);\n\n fourthFloorStairsElevator.add(stairsFloor4);\n fourthFloorStairsElevator.add(elevatorFloor4);\n\n IndoorVertex stairsFloor5 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 5);\n IndoorVertex elevatorFloor5 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 5);\n\n firstFloorStairsElevator.add(stairsFloor5);\n fifthFloorStairsElevator.add(elevatorFloor5);\n\n //Stair connections to one another\n connectVertex(stairsFloor1, stairsFloor2);\n connectVertex(stairsFloor1, stairsFloor3);\n connectVertex(stairsFloor1, stairsFloor4);\n connectVertex(stairsFloor1, stairsFloor5);\n connectVertex(stairsFloor2, stairsFloor3);\n connectVertex(stairsFloor2, stairsFloor4);\n connectVertex(stairsFloor2, stairsFloor5);\n connectVertex(stairsFloor3, stairsFloor4);\n connectVertex(stairsFloor3, stairsFloor5);\n connectVertex(stairsFloor4, stairsFloor5);\n\n //Elevator connections to one another\n connectVertex(elevatorFloor1, elevatorFloor2);\n connectVertex(elevatorFloor1, elevatorFloor3);\n connectVertex(elevatorFloor1, elevatorFloor4);\n connectVertex(elevatorFloor1, elevatorFloor5);\n connectVertex(elevatorFloor2, elevatorFloor3);\n connectVertex(elevatorFloor2, elevatorFloor4);\n connectVertex(elevatorFloor2, elevatorFloor5);\n connectVertex(elevatorFloor3, elevatorFloor4);\n connectVertex(elevatorFloor3, elevatorFloor5);\n connectVertex(elevatorFloor4, elevatorFloor5);\n\n //Creation of each floors connections\n createFloor1Connections(stairsFloor1, elevatorFloor1);\n createFloor2Connections(stairsFloor2, elevatorFloor2);\n createFloor3Connections(stairsFloor3, elevatorFloor3);\n createFloor4Connections(stairsFloor4, elevatorFloor4);\n createFloor5Connections(stairsFloor5, elevatorFloor5);\n }", "public void fillTriangle(int px1, int py1, int px2, int py2, int px3, \n int py3, int color) {\n \n int[] ordered = new int[6];\n if (!orderByPointY(px1, py1, px2, py2, px3, py3, ordered)) {\n if (!orderByPointY(px2, py2, px1, py1, px3, py3, ordered)) {\n if (!orderByPointY(px3, py3, px2, py2, px1, py1, ordered)) {\n String errorMsg = \"could not order triangle points !\";\n throw new RuntimeException(errorMsg);\n }\n }\n }\n px1 = ordered[0]; py1 = ordered[1];\n px2 = ordered[2]; py2 = ordered[3];\n px3 = ordered[4]; py3 = ordered[5];\n fillHalfTriangle(px1, py1, px2, py2, px3, py3, color, 1); // top\n fillHalfTriangle(px3, py3, px2, py2, px1, py1, color, -1); // down\n }", "private void splitLevels() {\n\t\tint first = 0;\n\t\tfor(int i = 1; i<allCoords.size(); i++) {\n\t\t\tif (allCoords.get(i).z != allCoords.get(i-1).z) {\n\t\t\t\tfor(int j=first; j<i; j++) {\n\t\t\t\t\tcurrentLevel.add(allCoords.get(j));\n\t\t\t\t}\n\t\t\t\tsplitIntoRoots(); // automatically splits the cross section into roots\n\t\t\t\tcurrentLevel.clear();\n\t\t\t\tfirst = i;\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter w = new PrintWriter(System.out);\n\n String[] inputs = r.readLine().split(\" \");\n \n int start = Integer.parseInt(inputs[0]);\n int end = Integer.parseInt(inputs[1]); \n //today you learned that the distance between the eyes from years 10 to 15 expands from about 62 to 64mm.\n \n inputs = r.readLine().split(\" \");\n \n int n = Integer.parseInt(inputs[0]); //number of junktions\n int m = Integer.parseInt(inputs[1]); //number of rodes\n \n Vertex[] vertices = new Vertex[n + 1];\n for (int i = 0; i < n; i++) {\n inputs = r.readLine().split(\" \");\n boolean blue = inputs[0].equals(\"B\");\n vertices[i + 1] = new Vertex(i + 1, blue, Integer.parseInt(inputs[0]), Integer.parseInt(inputs[1]), Integer.parseInt(inputs[2]));\n }\n \n for (int i = 0; i < m; i++) {\n inputs = r.readLine().split(\" \");\n int a = Integer.parseInt(inputs[0]);\n int b = Integer.parseInt(inputs[1]);\n int c = Integer.parseInt(inputs[2]);\n vertices[a].addPath(b, c);\n vertices[b].addPath(a, c);\n }\n \n \n \n \n }", "public EquilateralTriangle(double length) {\n super(\"Equilateral Triangle\", 3, length);\n }", "private void buildPath() {\r\n int xNext = 1;\r\n int yNext = map.getStartPos() + 1;\r\n CellLayered before = cells[yNext][xNext];\r\n while(true)\r\n {\r\n Byte[] xy = map.getDirection(xNext-1, yNext-1);\r\n xNext = xNext + xy[0];\r\n yNext = yNext + xy[1];\r\n\r\n CellLayered next = cells[yNext][xNext];\r\n\r\n if(xy[0]==-1)\r\n before.setRight(false);\r\n else\r\n before.setRight(true);\r\n before.setPath(true);\r\n if(next==null)\r\n break;\r\n\r\n before.setNextInPath(next);\r\n before = next;\r\n }\r\n }", "public void dirigirHaciaPunto(int x, int y){ \r\n\r\n\tint coordenadaXObjetivo;\r\n\tint coordenadaYObjetivo;\r\n\tint distanciaEnX;\r\n\tint distanciaEnY;\r\n\tint incrementoDesplazamiento = 1;\t\t\r\n\t\t\t\t\t\t\r\n\tcoordenadaXObjetivo = x;\t\r\n\tdistanciaEnX = coordenadaXObjetivo - this.x;\r\n\t\t\t\t\t\r\n\tcoordenadaYObjetivo = y;\t\r\n\tdistanciaEnY = coordenadaYObjetivo - this.y;\r\n\t\r\n\tif(distanciaEnX <= 0){\r\n\t\tif (distanciaEnX == 0){\r\n\t\t\tif(distanciaEnY < 0){\r\n\t\t\t\tthis.y -= incrementoDesplazamiento; \r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t\r\n\t\t\t\tthis.y += incrementoDesplazamiento;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\telse{\r\n\t\t\tif(distanciaEnY <= 0){\r\n\t\t\t\tif(distanciaEnY == 0){\r\n\t\t\t\t\tthis.x -= incrementoDesplazamiento;\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tthis.x -= incrementoDesplazamiento;\r\n\t\t\t\t\tthis.y -= incrementoDesplazamiento;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tthis.x -= incrementoDesplazamiento;\r\n\t\t\t\tthis.y += incrementoDesplazamiento;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\telse{\r\n\t\tif(distanciaEnY <= 0){\r\n\t\t\tif(distanciaEnY == 0){\r\n\t\t\t\tthis.x +=incrementoDesplazamiento;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telse{\r\n\t\t\t\tthis.x +=incrementoDesplazamiento;\r\n\t\t\t\tthis.y -= incrementoDesplazamiento;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\telse{\r\n\t\t\tthis.x +=incrementoDesplazamiento;\r\n\t\t\tthis.y += incrementoDesplazamiento;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif((this.x >= x - incrementoDesplazamiento) && (this.x <= x + incrementoDesplazamiento) && \r\n\t\t\t(this.y >= y - incrementoDesplazamiento) && (this.y <= y + incrementoDesplazamiento)){\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.entroAlCirculo = true;\r\n\t\t\r\n\t\t}\t\t\t\t\t\t\t\t\t\r\n\t}", "public ArrowHead(Point2D tip, Point2D origin, double length, double flair) {\n\n _pts = new Point2D[4];\n\n // Calculate horizontal and vertical components of slope\n double edx = tip.getX() - origin.getX();\n double edy = tip.getY() - origin.getY();\n\n double len = Math.sqrt(edx * edx + edy * edy);\n\n edx /= len;\n edy /= len;\n\n Point2D arrowHeadLeftBasePt =\n new Point2D.Double(tip.getX() - (length * edx),\n tip.getY() - (length * edy));\n Point2D a1pt4 =\n new Point2D.Double(tip.getX() - ((length - 3) * edx),\n tip.getY() - ((length - 3) * edy));\n\n\n // Calculate the points of arrowhead 1\n Point2D a1pt1 =\n new Point2D.Double((arrowHeadLeftBasePt.getX() + (2 * edy * flair)),\n (arrowHeadLeftBasePt.getY() - (2 * edx * flair)));\n\n Point2D a1pt3 =\n new Point2D.Double((arrowHeadLeftBasePt.getX() - (2 * edy * flair)),\n (arrowHeadLeftBasePt.getY() + (2 * edx * flair)));\n\n _pts[0] = a1pt1;\n _pts[1] = new Point2D.Double(tip.getX(), tip.getY());\n _pts[2] = a1pt3;\n _pts[3] = a1pt4;\n }" ]
[ "0.63859373", "0.62521976", "0.62073416", "0.5793147", "0.5649469", "0.5623542", "0.5540402", "0.5493933", "0.5483143", "0.5479158", "0.54728955", "0.54348725", "0.54223454", "0.54151064", "0.54127806", "0.5405145", "0.5344873", "0.5303819", "0.5274163", "0.5264487", "0.52551395", "0.5244795", "0.52336866", "0.52172816", "0.52134293", "0.5202696", "0.5195267", "0.5193488", "0.5187674", "0.5182968", "0.5132166", "0.5085093", "0.5082642", "0.5071735", "0.50624293", "0.50555277", "0.50511414", "0.50476414", "0.5040827", "0.5039158", "0.5035344", "0.5031264", "0.50227815", "0.50222856", "0.4999269", "0.49833354", "0.49831638", "0.4981673", "0.49764788", "0.49733666", "0.4963749", "0.49628496", "0.4949788", "0.49484625", "0.49434718", "0.4943145", "0.49430892", "0.493936", "0.49378636", "0.4935875", "0.49315768", "0.49279597", "0.49222192", "0.4921091", "0.49168888", "0.49059227", "0.49035102", "0.4901247", "0.4901244", "0.48913726", "0.48859027", "0.48847067", "0.48742184", "0.48738974", "0.48712984", "0.4871046", "0.48683777", "0.48637077", "0.4851095", "0.48358893", "0.48285204", "0.48252255", "0.4820532", "0.48204708", "0.48164654", "0.48122653", "0.48107025", "0.4807794", "0.48069593", "0.48061198", "0.47956344", "0.47875765", "0.4780176", "0.47788057", "0.47675103", "0.4764754", "0.47616506", "0.4759896", "0.47575584", "0.47555202", "0.47550356" ]
0.0
-1
a method to search "back from a" to find a DDP. It is called with a reachability list (first consisting only of a). This is breadthfirst, utilizing "reachability" concept from Geiger, Verma, and Pearl 1990. The body of a DDP consists of colliders that are parents of c.
private boolean reachablePathFindOrient(Graph graph, Node a, Node b, Node c, LinkedList<Node> reachable) { Set<Node> cParents = new HashSet<>(graph.getParents(c)); // Needed to avoid cycles in failure case. Set<Node> visited = new HashSet<>(); visited.add(b); visited.add(c); // We don't want to include a,b,or c on the path, so they are added to // the "visited" set. b and c are added explicitly here; a will be // added in the first while iteration. while (reachable.size() > 0) { Node x = reachable.removeFirst(); visited.add(x); // Possible DDP path endpoints. List<Node> pathExtensions = graph.getNodesInTo(x, Endpoint.ARROW); pathExtensions.removeAll(visited); for (Node l : pathExtensions) { // If l is reachable and not adjacent to c, its a DDP // endpoint, so do DDP orientation. Otherwise, if l <-> c, // add l to the list of reachable nodes. if (!graph.isAdjacentTo(l, c)) { // Check whether <a, b, c> should be reoriented given // that l is not adjacent to c; if so, orient and stop. doDdpOrientation(graph, l, a, b, c); return true; } else if (cParents.contains(l)) { if (graph.getEndpoint(x, l) == Endpoint.ARROW) { reachable.add(l); } } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) {\n\n BDNode a = new BDNode(\"A\");\n BDNode b = new BDNode(\"B\");\n BDNode c = new BDNode(\"C\");\n BDNode d = new BDNode(\"D\");\n BDNode e = new BDNode(\"E\");\n\n a.link(b);\n a.link(d);\n b.link(a);\n b.link(c);\n b.link(e);\n c.link(b);\n c.link(d);\n d.link(a);\n d.link(c);\n d.link(e);\n e.link(b);\n e.link(d);\n\n BDNode target = e;\n\n/*\n // BFS\n Queue<BDNode> queue = new LinkedList<>();\n queue.offer(a);\n\n while(!queue.isEmpty()) {\n BDNode n = queue.poll();\n n.visit();\n System.out.println(n); // 찾는 여정 출력\n\n if(n.equals(target)) {\n System.out.println(\"BFS Found! \" + n);\n break;\n }\n\n for (BDNode l : n.links) {\n if(l.isVisited()) continue;\n if (queue.contains(l)) continue;\n queue.offer(l);\n }\n\n // 위랑 같은 표현\n// n.links.stream()\n// .filter(l -> !queue.contains(l))\n// .forEach(queue::offer);\n }\n*/\n\n // DFS\n Stack<BDNode> stack = new Stack<>();\n stack.push(a);\n\n while(!stack.isEmpty()) {\n BDNode n = stack.pop();\n n.visit();\n System.out.println(n); // 찾는 여정 출력\n\n if (n.equals(target)) {\n System.out.println(\"DFS Found! \" + n);\n break;\n }\n\n for (BDNode l : n.links) {\n if (l.isVisited()) continue;\n if (stack.contains(l)) continue;\n\n stack.push(l);\n }\n }\n\n\n }", "void breach();", "public DSAQueue depthFirstSearch(String start)\n\t{\n\t\tif(!vertices.isEmpty())\n\t\t{\n\t\t\tDSAQueue queue = new DSAQueue();\n\t\t\tDSAGraphVertex vx = getVertex(start); //vertex to start on (root)\n\t\t\tDSAStack visited = new DSAStack();\t//creates empty stack\n\n\t\t\tclear(); //sets all vertices as not visited\n\t\t\tvx.setVisited(); // Marks root as visited\n\t\t\tqueue.enqueue(vx); //start point\n\n\t\t\tdfs(vx, visited, queue); //begin recursion\n\n\t\t\treturn queue;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthrow new NoSuchElementException(\"List is empty\");\n\t\t}\n\t}", "int solve(int p, int current) {\n int id = getId(p, current);\n if (p >= 0 && memo.containsKey(id)) {\n return memo.get(id);\n }\n List<Integer> adjList = adj.get(current);\n int n = adjList.size();\n if (n == 0) {\n throw new RuntimeException();\n }\n if ((n == 2 && p >= 0) || (n == 1 && p < 0)) {\n // should cut the nodes under current\n int ans = getDepth(p, current) - 1;\n // System.out.println(\"ans(\" + p + \",\" + current + \")=\" + ans);\n memo.put(id, ans);\n return ans;\n }\n if (n == 1) {\n // System.out.println(\"ans(\" + p + \",\" + current + \")=nochild\");\n return 0;\n }\n int ans = Integer.MAX_VALUE;\n\n for (int i = 0; i < n; i++) {\n int a = adjList.get(i);\n if (a == p) {\n continue;\n }\n for (int j = i + 1; j < n; j++) {\n int b = adjList.get(j);\n if (b == p) {\n continue;\n }\n // try a & b combo\n int tmp = solve(current, a);\n tmp += solve(current, b);\n for (int k = 0; k < n; k++) {\n int c = adjList.get(k);\n if (c != a && c != b && c != p) {\n tmp += getDepth(current, c);\n }\n }\n ans = Math.min(ans, tmp);\n }\n }\n memo.put(id, ans);\n // System.out.println(\"ans(\" + p + \",\" + current + \")=\" + ans);\n return ans;\n }", "void BFS(int s, int d) \r\n { \r\n int source = s;\r\n int destination = d;\r\n boolean visited[] = new boolean[V];\r\n int parent[] = new int[V];\r\n \r\n // Create a queue for BFS \r\n LinkedList<Integer> queue = new LinkedList<Integer>(); \r\n \r\n // Mark the current node as visited and enqueue it \r\n \r\n visited[s]=true; \r\n queue.add(s); \r\n System.out.println(\"Search Nodes: \");\r\n while (queue.size() != 0) \r\n { \r\n int index = 0;\r\n \r\n // Dequeue a vertex from queue and print it \r\n \r\n s = queue.poll();\r\n \r\n System.out.print(convert2(s)); \r\n \r\n if(s == destination)\r\n {\r\n break;\r\n }\r\n \r\n System.out.print(\" -> \");\r\n while(index < adj[s].size()) \r\n { \r\n \r\n \r\n int n = adj[s].get(index); \r\n if (!visited[n]) \r\n { \r\n visited[n] = true;\r\n parent[n] = s;\r\n queue.add(n); \r\n }\r\n index = index+ 2;\r\n \r\n \r\n }\r\n \r\n \r\n \r\n }\r\n int check = destination;\r\n int cost = 0, first, second = 0;\r\n String string = \"\" + convert2(check);\r\n while(check!=source)\r\n {\r\n \r\n first = parent[check];\r\n string = convert2(first) + \" -> \" + string;\r\n while(adj[first].get(second) != check)\r\n {\r\n second++;\r\n }\r\n cost = cost + adj[first].get(second +1);\r\n check = first;\r\n second = 0;\r\n \r\n }\r\n \r\n System.out.println(\"\\n\\nPathway: \");\r\n \r\n System.out.println(string);\r\n \r\n \r\n System.out.println(\"\\nTotal cost: \" + cost);\r\n }", "@Override\n public ArrayList<GraphEdge> getRoute(GraphNode a, GraphNode b) {\n \tHashMap<GraphNode, Double> distances = new HashMap<GraphNode, Double>();\n \tHashMap<GraphNode, GraphEdge> predecessor = new HashMap<GraphNode, GraphEdge>();\n \tHashSet<GraphNode> visited = new HashSet<GraphNode>();\n \t\n \tArrayList<GraphEdge> result = new ArrayList<GraphEdge>();\n\t\n \t//Initialize distances, predecessor, and visited\n \tfor(GraphNode g : drivableNodes) {\n \t distances.put(g, Double.MAX_VALUE);\n \t predecessor.put(g, null);\n \t}\n \t\n \tint remaining = drivableNodes.size();\n \t\n \t//Put starting node\n \tdistances.put(a, 0.0);\n \t//predecessor.put(a, null);\n \t\n \t//Main loop\n \twhile(remaining > 0) {\n \t GraphNode closest = null;\n \t double minDist = Double.MAX_VALUE;\n\n \t for(GraphNode n : distances.keySet()) {\n \t\tdouble dist = distances.get(n);\n \t\tif(!visited.contains(n) &&\n \t\t\tdist != Double.MAX_VALUE &&\n \t\t\t(minDist == Double.MAX_VALUE || dist < minDist)) {\n \t\t closest = n;\n \t\t minDist = dist;\n \t\t}\n \t }\n \t \n \t if(closest == null)\n \t\treturn null;\n \t \n \t if(closest.equals(b))\n \t\tbreak;\n \t \n \t visited.add(closest);\n \t \n \t for(GraphEdge edge : closest.getEdges()) {\n \t\tGraphNode adjacent = edge.getOtherNode(closest);\n \t\tif(adjacent != null && !visited.contains(adjacent)) {\n \t\t //Map distance value for the other Node\n \t\t double otherDist = distances.get(adjacent);\n \t\t //Weight of edge from closest node to adjacent node\n \t\t double weight = edge.getWeight();\n \t\t String way = edge.getWay();\n \t\t \n \t\t if(otherDist == Double.MAX_VALUE ||\n \t\t\t weight + minDist < otherDist) {\n \t\t\tdistances.put(adjacent, weight + minDist);\n \t\t\t\n \t\t\t//Make new edge in correct order\n \t\t\tGraphEdge corrected = new GraphEdge(closest, adjacent, weight, way);\n \t\t\t\n \t\t\tpredecessor.put(adjacent, corrected);\n \t\t }\n \t\t}\n \t }\n\n \t remaining--;\n \t}\n \t\n \t//Backtrack to build route\n \tif(distances.get(b) == Double.MAX_VALUE) {\n \t return null;\n \t} else {\n \t //buildPath(predecessor, a, b, result);\n \t //Non recursive version\n \t Stack<GraphEdge> stack = new Stack<GraphEdge>(); \n \t while(!b.equals(a)) {\n \t\tGraphEdge edge = predecessor.get(b);\n \t\t\n \t\t//Make sure vertices are in correct order\n \t\tGraphNode start = edge.getOtherNode(b);\n \t\t//double weight = edge.getWeight();\n \t\t//GraphEdge corrected = new GraphEdge(start, b, weight);\n \t\t\n \t\tstack.push(edge);\n \t\tb = start;\n \t }\n \t \n \t while(!stack.isEmpty()) {\n \t\tGraphEdge edge = stack.pop();\n \t\tresult.add(edge);\n \t }\n \t}\n \t\n\treturn result;\n }", "private Board DLS(Board start, Board goal, int depth) {\n Board found = null;\n // Paso base: Si start es la solucion y esta en el ultimo nivel, regresa\n if((depth == 0) && start.equals(goal)) {\n return start;\n }\n // Si el nivel aun no es el ultimo, se obtienen los nodos hijos\n // y se vuelve a llamar la funcion en ellos\n else if(depth > 0) {\n // Obtiene los nodos hijos\n // Todas las posibles configuraciones del tablero que se pueden\n // hacer a partir de la actual\n ArrayList<Board> children = start.expand();\n\n expandedNodes++;\n\n // Para cada hijo vuelve a hacer lo mismo\n for(Board child : children) {\n found = DLS(child, goal, depth - 1);\n if(found != null)\n return found;\n }\n }\n return null;\n }", "private ProblemModel findCheapestNode(){\n\t\tProblemModel ret = unvisitedPM.peek();\n\t\t\n\t\tfor(ProblemModel p : unvisitedPM){ \n\t\t\t//f(s) = depth + cost to make this move\n\t\t\tif(p.getCost() + p.getDepth() <= ret.getCost() + ret.getDepth()) ret = p;\n\t\t}\n\t\tunvisitedPM.remove(ret);\n\t\treturn ret;\n\t}", "@Override\n List<NodeData> pathFind() throws NoPathException {\n System.out.println(\"Starting Scenic\");\n\n frontier.add(start);\n\n while(!frontier.isEmpty()) {\n StarNode current = frontier.getLast();\n frontier.removeLast(); // pop the priority queue\n if(current.getXCoord() == goal.getXCoord() && current.getYCoord() == goal.getYCoord()) {\n // If we are at the goal, we need to backtrack through the shortest path\n System.out.println(\"At target!\");\n finalList.add(current); // we have to add the goal to the path before we start backtracking\n while(!(current.getXCoord() == start.getXCoord() && current.getYCoord() == start.getYCoord())) {\n finalList.add(current.getPreviousNode());\n current = current.getPreviousNode();\n System.out.println(current.getNodeID());\n }\n return finalList;\n }\n else {\n // we need to get all the neighbor nodes, identify their costs, and put them into the queue\n LinkedList<StarNode> neighbors = current.getNeighbors();\n // we also need to remove the previous node from the list of neighbors because we do not want to backtrack\n neighbors.remove(current.getPreviousNode());\n\n for (StarNode newnode : neighbors) {\n int nodePlace = this.listContainsId(frontier, newnode);\n if(nodePlace > -1) {\n if (frontier.get(nodePlace).getF() > actionCost(newnode) + distanceToGo(newnode, goal)) {\n System.out.println(\"Here\");\n frontier.remove(frontier.get(nodePlace));\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n }\n else {\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n\n // This fixes the problem with infinitely looping elevators (I hope)\n if(current.getNodeType().equals(\"ELEV\") && newnode.getNodeType().equals(\"ELEV\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"ELEV\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n if(current.getNodeType().equals(\"STAI\") && newnode.getNodeType().equals(\"STAI\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"STAI\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n // this is where the node is put in the right place in the queue\n Collections.sort(frontier);\n }\n }\n }\n throw new NoPathException(start.getLongName(), goal.getLongName());\n }", "void DFSearch(BFSNode n){\n\t\tn.discovered=true;\r\n\t\tSystem.out.print(\" discovered\");\r\n\t\tn.preProcessNode();\r\n\t\tfor( Integer edg: n.edges){\r\n\t\t\tn.processEdge(edg);\r\n\t\t\tif(!nodes[edg].discovered){\r\n\t\t\t\tnodes[edg].parent = n; \r\n\t\t\t\tnodes[edg].depth = n.depth +1;\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.print(\"{new track with parent [\"+ nodes[edg].parent.value+\"] }\");\r\n\t\t\t\tDFSearch(nodes[edg]);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tif(nodes[edg] != n.parent){\r\n\t\t\t\t\tSystem.out.print(\"{LOOP}\");\r\n\t\t\t\t\tif(nodes[edg].depth < n.reachableLimit.depth){\r\n\t\t\t\t\t\tn.reachableLimit = nodes[edg];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tSystem.out.print(\"{second visit}\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"back from node [ \"+n.value +\" ]\");\r\n\t\tn.postProcessNode();\r\n\t\tn.processed = true;\r\n\t\t\r\n\t}", "void dfs(Graph.Vertex u, List<Graph.Edge> bridgeList) {\n\n\t\tDFSVertex du = getVertex(u);\n\t\tdu.seen = true;\n\t\tdu.dis = du.low = ++time;\n\t\tDFSVertex dv = null;\n\t\t\n\t\tfor (Graph.Edge e : u) {\n\t\t\tGraph.Vertex v = e.otherEnd(u);\n\t\t\tdv = getVertex(v);\n\t\t\tif (!seen(v)) {\n\t\t\t\tvisit(u, v);\n\t\t\t\tdu.childrenCount++;\n\t\t\t\tdfs(v, bridgeList);\n\t\t\t\t//Update the low time for the parent depending on each of its children\n\t\t\t\tdu.low = Math.min(du.low, dv.low);\n\t\t\t\t//Bridge Condition\n\t\t\t\tif (dv.low >= dv.dis)\n\t\t\t\t\tbridgeList.add(e);\n\t\t\t}\n\t\t\t// To detect the Back Edge\n\t\t\telse if (v != getParent(u)) { \n\t\t\t\tdu.low = Math.min(du.low, dv.dis);\n\t\t\t}\n\t\t}\n\t\t//Condition to find the cut Vertex\n\t\tif ((du.parent != null && dv.low >= du.dis) || (du.parent == null && du.childrenCount >= 2)) {\n\t\t\tdu.cutVertex = true;\n\t\t}\n\t}", "public DSAQueue breadthFirstSearch(String start, String target)\n\t{\n\t\tif(!vertices.isEmpty())\n\t\t{\n\t\t\tDSAQueue queue = new DSAQueue();\n\t\t\tDSAStack visited = new DSAStack();\t//creates empty stack\n\t\t\tDSAGraphVertex vx = getVertex(start); //vertex to start on (root)\n\t\t\tDSAGraphVertex dest = getVertex(target); //vertex to start on (dest)\n\n\t\t\tclear(); //sets all visited on all vertices == false\n\t\t\tvx.setVisited(); // Marks root as visited\n\t\t\tqueue.enqueue(vx); //adds start point to queue\n\n\t\t\tbfs(vx, visited, queue, dest); //begin recursion\n\n\t\t\tqueue.enqueue(dest); //if successful adds destination to queue\n\n\t\t\treturn queue;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthrow new NoSuchElementException(\"List is empty or start or end elements don't exist\");\n\t\t}\n\t}", "static int APUtil(ArrayList<Arista>[] adj, int u, boolean visited[], int disc[], int low[], int parent[], int ap[]){\n\n // Count of children in DFS Tree\n int children = 0;\n\n // Mark the current node as visited\n visited[u] = true;\n\n // Initialize discovery time and low value\n disc[u] = low[u] = ++time;\n\n // Go through all vertices aadjacent to this\n for (Arista arista : adj[u]) {\n int v = arista.to; // v is current adjacent of u\n\n // If v is not visited yet, then make it a child of u\n // in DFS tree and recur for it\n if (!visited[v]) {\n children++;\n parent[v] = u;\n sol = APUtil(adj, v, visited, disc, low, parent, ap);\n\n // Check if the subtree rooted with v has a connection to\n // one of the ancestors of u\n low[u] = Math.min(low[u], low[v]);\n\n // u is an articulation point in following cases\n\n // (1) u is root of DFS tree and has two or more chilren.\n if (parent[u] == -1 && children > 1){\n ap[u]++;\n if((ap[u] > ap[sol]) || (ap[u] == ap[sol] && u < sol))\n sol = u;\n }\n\n\n // (2) If u is not root and low value of one of its child\n // is more than discovery value of u.\n if (parent[u] != -1 && low[v] >= disc[u]){\n ap[u]++;\n if((ap[u] > ap[sol]) || (ap[u] == ap[sol] && u < sol))\n sol = u;\n }\n\n }\n\n // Update low value of u for parent function calls.\n else if (v != parent[u])\n low[u] = Math.min(low[u], disc[v]);\n }\n\n return sol;\n }", "public void breadthFirstTraverse() {\n\t\t// track whether vertex was visited\n\t\tHashMap<Integer, Boolean> visited = buildVisited();\n\t\t// store neighbors\n\t\tQueue<Integer> queue = new LinkedList<Integer>();\n\n\t\t// arbitrarily add first element\n\t\tInteger current = (Integer) edges.keySet().toArray()[0];\n\t\tqueue.add(current);\n\n\t\twhile (queue.peek() != null) {\n\n\t\t\tcurrent = queue.remove();\n\t\t\tSystem.out.println(\"current: \" + current);\n\t\t\tvisited.put(current, true);\n\n\t\t\tfor (Integer neighbor: edges.get(current)) {\n\t\t\t\tif (!visited.get(neighbor)) {\n\t\t\t\t\tqueue.add(neighbor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int depthFirstSearch(List<Integer>[] adj){\n int connected = 0;\n for(int i = 0; i < n; i++){\n if(visited[i] == false){\n connected ++;\n dfsRecursive(adj, i);\n }\n }\n return connected;\n }", "private static int breadthFirstSearch(Vertex start) throws Queue.UnderflowException, Queue.EmptyException {\n boolean visited[] = new boolean[48];\n //Keep a queue of vertecies and a queue of the depth of the verticies - they will be added to and poped from identically\n ListQueue<Vertex> queue = new ListQueue<Vertex>();\n ListQueue<Integer> numQueue = new ListQueue<Integer>();\n //Set the starting node as visited\n visited[start.index()] = true;\n queue.enqueue(start);\n numQueue.enqueue(new Integer(1));\n\n //Keep last\n int last = -1;\n //While the queue isnt empty\n while (!queue.isEmpty()) {\n //Pop off the top from both queues and mark as visited\n start = queue.dequeue();\n int current = numQueue.dequeue();\n visited[start.index] = true;\n //For all neigbors\n for (Vertex v : start.neighbors) {\n //If we havent visited it make sure to visit it\n if (visited[v.index()] == false) {\n //As we keep adding new nodes to visit keep track of the depth\n queue.enqueue(v);\n numQueue.enqueue(current + 1);\n }\n }\n //Keep track of the most recent depth before we pop it off (queue will be empty when we exit)\n last = current;\n }\n //Return the max of the depth\n return last;\n }", "void dfs(){\n // start from the index 0\n for (int vertex=0; vertex<v; vertex++){\n // check visited or not\n if (visited[vertex]==false){\n Explore(vertex);\n }\n }\n }", "public ArrayList<SearchNode> search(Problem p) {\n\tfrontier = new NodeQueue();\t// The frontier is a queue of expanded SearchNodes not processed yet\n\texplored = new HashSet<SearchNode>();\t/// The explored set is a set of nodes that have been processed \n\tGridPos startState = (GridPos) p.getInitialState();\t// The start state is given\n\tfrontier.addNodeToFront(new SearchNode(startState));\t// Initialize the frontier with the start state \n\n\t\n\tpath = new ArrayList<SearchNode>();\t// Path will be empty until we find the goal\n\t\t\n\n\n\twhile(!frontier.isEmpty()){\n\n\t SearchNode s = frontier.removeFirst(); \n\t GridPos g = s.getState(); \n\n\t if ( p.isGoalState(g) ) {\n\t\tpath = s.getPathFromRoot();\t\n\t\tbreak; \n\t }\n\t \n\t explored.add(s); \t \n\t ArrayList<GridPos> childStates = p.getReachableStatesFrom(g);\n\n\t while(!childStates.isEmpty()){\n\n\t\tSearchNode child = new SearchNode(childStates.get(0), s); \n\n\t\tif(!explored.contains(child) && !frontier.contains(child)){\n\n\t\t if ( p.isGoalState(child.getState()) ) {\n\t\t\n\t\t\tpath = child.getPathFromRoot();\t\n\t\t\treturn path; \n\t\t }\n\n\t\t if(insertFront) \n\t\t\tfrontier.addNodeToFront(child); \t\t \t\t\n\t\t else\t\n\t\t\tfrontier.addNodeToBack(child); \t \n\n\n\n\t\t}\n\n\t\tchildStates.remove(0);\n\t }\t \n\t}\n\n\n\treturn path;\n\n }", "void depthFirst(LinkedList<Edge> l[], boolean cv[], int cn){\n\t\t\n\t\tif(cv[cn]==true){\n\t\t\treturn;\n\t\t}\n\t\tcv[cn]=true;\n\t\tIterator <Edge> it = l[cn].iterator();\n\t\twhile(it.hasNext()){\n\t\t\tEdge e = (Edge)it.next();\n\t\t\tdepthFirst(l, cv,e.adjIndex);\n\n\t\t}\n\t}", "static long dijkstras(State start, State goal) {\n\t\tPriorityQueue<State> pq = new PriorityQueue<State>(\n\t\t\tnew Comparator<State>() {\n\t\t\t\t@Override\n\t\t\t\tpublic int compare(State a, State b) {\n\t\t\t\t\treturn Long.compare(a.dist, b.dist);\n\t\t\t\t}\n\t\t\t});\n\n\t\tHashMap<State, Long> dist = new HashMap<>(); \n\n\t\tpq.offer(start);\n\t\tdist.put(start, start.dist);\n\n\t\twhile (!pq.isEmpty()) {\n\t\t\tState cur = pq.poll();\n\n\t\t\tif (cur.isDestination(goal)) // abort if target is reached\n\t\t\t\treturn cur.dist;\n\n\t\t\t// avoid relaxation if a shorter path to 'cur' is pending in queue\n\t\t\tif (Long.compare(dist.get(cur), cur.dist) < 0)\n\t\t\t\tcontinue;\n\n\t\t\tfor (State adj : cur.adj()) {\n\t\t\t\tLong bestSoFar = dist.get(adj);\n\t\t\t\tif (bestSoFar == null || Long.compare(adj.dist, bestSoFar) < 0) {\n\t\t\t\t\tpq.offer(adj);\n\t\t\t\t\tdist.put(adj, adj.dist);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// no path to target\n\t\treturn -1;\n\t}", "public static int dijkstra(AdjList<String> adjList, String startNode, String endNode, LinkedList<String> pathList) {\n //Valid AdjList\n if (adjList == null || adjList.size() == 0 || adjList.hasNegativeEdges())\n return Integer.MAX_VALUE;\n\n //Checks if start and end nodes exist in adjList\n if (!adjList.contains(startNode) || !adjList.contains(endNode))\n return Integer.MAX_VALUE;\n\n //Checks if graph is suitable for BFS\n if (!adjList.isWeighted())\n return BFS(adjList, startNode, endNode, pathList);\n\n //Sets all node objects in adjList to defaults\n adjList.cleanNodeFields();\n\n //Fibonacci heap for storing current shortest path\n FibHeap<Integer, String> q = new FibHeap<>();\n\n //Set source node value to 0\n q.insert(adjList.getNode(startNode), 0);\n q.peek().d = 0;\n q.peek().visited = true;\n\n //Helper variables\n LinkedList<Pair<Node<Integer, String>, Integer>> neighbors;//Array of pairs <neighborKey, edgeWeight>\n Node<Integer, String> neighbor, u;//Current Node with shortest path / top of min-queue\n int edgeWeight;\n while (q.size() != 0) {\n u = q.extractMin();\n u.closed = true;\n\n //endNode found\n if (Objects.equals(u.value, endNode)) {\n //Build path of vertexes\n Node<Integer, String> current = adjList.getNode(endNode);\n pathList.add(current.value);\n while ((current = current.prev) != null)\n pathList.addFirst(current.value);\n return u.d;\n }\n\n neighbors = adjList.getNeighbors(u.value);\n for (Pair<Node<Integer, String>, Integer> neighborKeyValuePair : neighbors) {//Loops through every neighbor\n neighbor = neighborKeyValuePair.getKey();\n edgeWeight = neighborKeyValuePair.getValue();\n //Relaxation step\n //Checks if distance to neighbor node is less than the min distance already found\n if (!neighbor.visited || neighbor.d > u.d + edgeWeight) {\n //Assign shorter path found to neighbor in out array\n neighbor.d = u.d + edgeWeight;\n\n //Assigns previous shortest node to neighbor\n neighbor.prev = u;\n\n //Inserts or decrease key\n if (!neighbor.visited) {\n q.insert(neighbor, u.d + edgeWeight);\n neighbor.visited = true;\n } else {\n q.decreaseKey(neighbor, u.d + edgeWeight);\n }\n }\n }\n }\n return Integer.MAX_VALUE;\n }", "private ArrayList<Vertex> dfs(boolean[] visited, Vertex start, Vertex target) {\n \n //TEST VALUES: if start/end are out of bounds of array of vertices\n if (start.getID() < 0) {\n return null;\n }\n \n if (target.getID() > arrayOfVertices.length) {\n return null;\n }\n \n \n //base case: if start = target, return start vertex right there.\n if (start == target) {\n solution.add(0, start);\n return solution;\n }\n \n //has this vertex been visited before? yes? then just return. if no, \n if (visited[start.getID()]) {\n return null;\n }\n \n //since it hasn't been visited before, mark it as visited\n visited[start.getID()] = true;\n \n //does it have kids? no? return.\n if (start.getDegree() == 0) {\n return null;\n }\n \n //create ArrayList of adjacent vertices to the given start\n ArrayList<Vertex> adjacents = start.getAdjacent();\n \n //go through its edges, for loop. to go through edges\n for (int i = 0; i < start.getDegree(); i++) {\n \n //(from testing)\n NavigateMaze.advance(start.getID(), adjacents.get(i).getID());\n \n //do the dfs; if it's not equal to null \n //(i.e. we found the target, then add it to path\n if (dfs(visited, adjacents.get(i), target) != null) {\n //then add to path\n solution.add(0, start); \n return solution;\n }\n \n //(from testing)\n else {\n NavigateMaze.backtrack(adjacents.get(i).getID(), start.getID());\n }\n \n } \n \n //return null\n return null;\n }", "static\tListNode listCycle(ListNode a){\n if(a==null || a.next==null || a.next.next==null){\r\n return null;\r\n }\r\n boolean cycleExists = false;\r\n ListNode fast = a.next.next;\r\n ListNode slow = a;\r\n while(slow.next!=null && fast.next !=null && fast.next.next!=null){\r\n if(fast==slow){\r\n //return cycleSize;\r\n //cycleExists = true;\r\n //break;\r\n return fast;\r\n }else{\r\n \r\n fast = fast.next.next;\r\n slow = slow.next;\r\n }\r\n\r\n }\r\n \r\n return null;\r\n\t}", "@Override\n\tpublic direction[] Solve(nPuzzle aPuzzle) {\n\t\taddToFrontier(aPuzzle.StartState);\n\t\t\n\t\t// While the open list is not empty:\n\t\twhile(Frontier.size() > 0) {\n\t\t\t// Find the frontier with the lowest F value.\n\t\t\tPuzzleState q = popFrontier();\n\t\t\t\n\t\t\tArrayList<PuzzleState> newStates = q.explore();\n\t\t\t\n\t\t\tfor(PuzzleState n : newStates) {\n\t\t\t\t// If goal state return path to state.\n\t\t\t\tif(n.equals(aPuzzle.GoalState))\n\t\t\t\t\treturn n.GetPathToState();\n\t\t\t\t// Else add state to open list.\n\t\t\t\telse {\n\t\t\t\t\tn.HeuristicValue = HeuristicValue(n, aPuzzle.GoalState);\n\t\t\t\t\tn.setEvaluationFunction(n.HeuristicValue + n.Cost);\n\t\t\t\t\taddToFrontier(n);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn null;\n\t}", "private void GreedySearch(){\n\n Queue<Node> expanded = new LinkedList<>();\n ArrayList<Node> fringe = new ArrayList<>();\n ArrayList<Node> fringeTemp = new ArrayList<>();\n\n\n Node current = startNode;\n\n while(expanded.size() < 1000){\n\n if(current.getDigit().getDigitString().equals(goalNode.getDigit().getDigitString())){\n //goal is reached.\n solutionPath(current);\n expanded.add(current);\n printExpanded(expanded);\n System.exit(0);\n }\n\n\n boolean b = cycleCheck(current,expanded);\n\n if(!b) {\n expanded.add(current);\n }\n\n if(!b){\n\n if(current.getDigit().last_changed != 0){\n\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n\n //+1 child first digit\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n\n }\n }\n\n if(current.getDigit().last_changed != 1){\n\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n\n //+1 child\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n }\n\n if(current.getDigit().last_changed != 2){\n if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n //+1 child\n if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n }\n\n }\n\n\n\n for(Node n : fringe){\n heuristicSetter(n);\n\n }\n\n fringeTemp.addAll(fringe);\n //now all the nodes in fringe have the heuristic value.\n //We can get the last added minm\n Node minm;\n if(fringeTemp.size() != 0){\n minm = fringeTemp.get(0);\n }else{\n break;\n }\n for(int i = 1; i<fringeTemp.size(); i++){\n if(fringeTemp.get(i).getHeuristic() <= minm.getHeuristic()){\n minm = fringeTemp.get(i);\n }\n }\n\n //now we have the minm for the next stage.\n current = minm;\n fringeTemp.remove(minm);\n fringe.clear();\n }\n\n //While loop ends\n System.out.println(\"No solution found.\");\n printExpanded(expanded);\n\n\n\n }", "@Override\r\n public List<T> breadthFirstPath(T start, T end) {\r\n\r\n Vertex<T> startV = vertices.get(start);\r\n Vertex<T> endV = vertices.get(end);\r\n\r\n LinkedList<Vertex<T>> vertexList = new LinkedList<>();\r\n //Set<Vertex<T>> visited = new HashSet<>();\r\n ArrayList<Vertex<T>> visited = new ArrayList<>();\r\n\r\n LinkedList<Vertex<T>> pred = new LinkedList<>();\r\n int currIndex = 0;\r\n\r\n pred.add(null);\r\n\r\n vertexList.add(startV);\r\n visited.add(startV);\r\n\r\n LinkedList<T> path = new LinkedList<>();\r\n\r\n if (breadthFirstSearch(start, end) == false) {\r\n path = new LinkedList<>();\r\n return path;\r\n } else {\r\n while (vertexList.size() > 0) {\r\n Vertex<T> next = vertexList.poll();\r\n if(next == null){\r\n continue;\r\n }\r\n if (next == endV) {\r\n path.add(endV.getValue());\r\n break;\r\n }\r\n for (Vertex<T> neighbor : next.getNeighbors()) {\r\n if (!visited.contains(neighbor)) {\r\n pred.add(next);\r\n visited.add(neighbor);\r\n vertexList.add(neighbor);\r\n }\r\n }\r\n currIndex++;\r\n //path.add(next.getValue());\r\n\r\n }\r\n while (currIndex != 0) {\r\n Vertex<T> parent = pred.get(currIndex);\r\n path.add(parent.getValue());\r\n currIndex = visited.indexOf(parent);\r\n }\r\n }\r\n Collections.reverse(path);\r\n return path;\r\n }", "public static int nextNode(directed_weighted_graph g, CL_Agent agent, int src, List<CL_Pokemon> c) {\n int ans = -1;\n dw_graph_algorithms ga = new DWGraph_Algo();\n ga.init(g);\n for (int a = 0; a < c.size(); a++) {\n Arena.updateEdge(c.get(a), g);\n }\n int fdest = -1;\n double mint = Double.MAX_VALUE;\n CL_Pokemon ca = null;\n for (CL_Pokemon pokemon : c) {\n if (arna.can_he_go(agent.getID(), pokemon)) {\n int dest = pokemon.get_edge().getDest();\n if (pokemon.getType() > 0) {\n dest = pokemon.get_edge().getSrc();\n }\n double t = ga.shortestPathDist(src, dest) / agent.getSpeed() / pokemon.getValue();\n if (t >= 0 && t < mint) {\n ca = pokemon;\n mint = t;\n fdest = dest;\n if (t == 0) {\n fdest = pokemon.get_edge().getSrc();\n if (pokemon.getType() > 0) {\n fdest = pokemon.get_edge().getDest();\n }\n }\n }\n\n }\n }\n\n if (fdest != -1) {\n agent.set_curr_fruit(ca);\n arna.i_am_going(agent.getID(), ca.get_edge());\n List<node_data> p = ga.shortestPath(src, fdest);\n ans = p.get(1).getKey();\n agent.setNextNode(p.get(1).getKey());\n } else {\n double min = Double.MAX_VALUE;\n Iterator<edge_data> edge = g.getE(agent.getSrcNode()).iterator();\n while (edge.hasNext()) {\n edge_data t = edge.next();\n if (min > g.getNode(agent.getSrcNode()).getLocation().distance(g.getNode(t.getDest()).getLocation())) {\n min = g.getNode(agent.getSrcNode()).getLocation().distance(g.getNode(t.getDest()).getLocation());\n ans = t.getDest();\n\n }\n\n }\n }\n return ans;\n }", "public List<Node> find(Node start, Node finish){\n reachable.add(start);\n this.finish = finish;\n\n while(!reachable.isEmpty()){\n // Select a node from the reachable list\n // If we've reached the end, return the list of nodes in our path\n \n Node node = selectNode(reachable);\n if(node.isEqual(finish)){\n return getPath(node);\n }\n\n // Otherwise, remove the new node from the reachable list, and add it to the \n // visited list so we don't look at a node more than necessary. Build a list of the\n // nodes that are adjacent to our current node.\n \n reachable.remove(node);\n visited.add(node);\n List<Node> adjacent = getAdjacent(node);\n\n // If the current node has adjacent nodes, and if we haven't looked at those nodes before,\n // add those nodes to the reachable list. If the node's cost is lower than 1+the cost to reach it,\n // make the node's parent the previous node and set the cost\n if(!adjacent.isEmpty()) {\n for (Node n : adjacent) {\n if (!reachable.contains(n)&&!visited.contains(n)) {\n reachable.add(n);\n }\n if (node.getCostEstimated() + 1 <= n.getCostEstimated()) {\n n.setParent(node);\n n.setCostEstimated(node.getCostEstimated() + 1);\n }\n }\n }\n }\n return null;\n }", "private void breadthFirstSearch(Node sourceNode, Node destinationNode, String path, HashSet<Character> visited) {\n // Create a list of nodes to visit (children of nodes)\n LinkedList<Node> nextToVisit = new LinkedList<>();\n // Add the first node to the list\n nextToVisit.add(sourceNode);\n\n // Traverse level by level by traversing to all of its children first\n while(!nextToVisit.isEmpty()) {\n Node node = nextToVisit.remove();\n // If its visited already, continue to the next child\n if(visited.contains(node.charId)) {\n continue;\n }\n // Mark the node as visited\n path += \"->\" + node.charId;\n visited.add(node.charId);\n // If destination is reached\n if(node == destinationNode) {\n paths.add(path);\n return;\n }\n // Add all of its children to the next node to visit\n for(Node children : node.adjacent) {\n nextToVisit.add(children);\n }\n }\n\n }", "private void dfsVisit(Node node) {\n\t\tStack<Node>stack = new Stack<>();\r\n\t\tstack.push(node); //add source node to queue\r\n\t\twhile(!stack.isEmpty()) {\r\n\t\t\tNode presentNode = stack.pop();\r\n\t\t\tpresentNode.setVisited(true);\r\n\t\t\tSystem.out.print(presentNode.getName()+\" \");\r\n\t\t\tfor(Node neighbor: presentNode.getNeighbors()) { //for each neighbor of present node\r\n\t\t\t\tif(!neighbor.isVisited()) { //if neighbor is not visited then add it to queue\r\n\t\t\t\t\tstack.push(neighbor);\r\n\t\t\t\t\tneighbor.setVisited(true);\r\n\t\t\t\t}\r\n\t\t\t}//end of for loop\r\n\t\t}//end of while loop\r\n\t\t\r\n\t}", "public List<Edge> breadthFirstTraverse(String v) {\n int start = indexOf(v);\n if (start == -1) return new LinkedList<>();\n\n List<Edge> path = new LinkedList<>();\n Queue<Integer> queue = new Queue<>();\n boolean[] visited = new boolean[vertexes.length];\n\n queue.enQueue(start);\n while(!queue.isEmpty()) {\n start = queue.deQueue();\n visited[start] = true;\n\n for (int i: this.heads[start]) {\n if (!visited[i]) { // not visited yet\n visited[i] = true;\n path.add(new Edge(start, i));\n\n queue.enQueue(i); // add to the queue for the next loop\n }\n }\n }\n\n return path;\n }", "public void bfs(int s) {\n boolean[] visited = new boolean[v];\n int level = 0;\n parent[s] = 0;\n levels[s] = level;\n Queue<Integer> queue = new LinkedList<>();\n queue.add(s);\n visited[s] = true;\n while (!queue.isEmpty()){\n Integer next = queue.poll();\n System.out.print(next+\", \");\n Iterator<Integer> it = adj[next].listIterator();\n\n while (it.hasNext()){\n Integer i = it.next();\n if(!visited[i]){\n visited[i] = true;\n levels[i] = level;\n parent[i] = next;\n queue.add(i);\n }\n }\n\n level++;\n }\n }", "void connect() {\n\t\tint[] supposed_pit_num = new int[d];\n\t\tthis.stay = 0;\n\t\tint target_pit_id = 0;\n\t\tthis.connected = true;\n\t\tboolean[] moved = new boolean[d];\n\t\twhile(target_pit_id < this.d - this.couples_found){\n\t\t\t//find the closest dancer along the line to target pit id;\n\t\t\tint dancer_id = -1;\n\t\t\tint min_pit = d;\n\t\t\tfor(int j = 0; j < d; j++){\n\t\t\t\tif(dancers[j].soulmate != -1 || moved[j]) continue;\n\t\t\t\tif(dancers[j].pit_id < min_pit){\n\t\t\t\t\tmin_pit = dancers[j].pit_id;\n\t\t\t\t\tdancer_id = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmoved[dancer_id] = true;\n\t\t\t\n\t\t\tPit curr_pit = pits[dancers[dancer_id].pit_id];\n\t\t\tPit pointer = curr_pit;\n\t\t\tPit prev = null;\n\t\t\tPoint curr_pos = this.last_positions[dancer_id];\n\t\t\tboolean stop = false;\n\t\t\twhile(!stop){\n\t\t\t\tprev = pointer;\n\t\t\t\tif(pointer.pit_id < target_pit_id){\n\t\t\t\t\tpointer = getNext(pointer);\n\t\t\t\t}\n\t\t\t\telse if(pointer.pit_id > target_pit_id){\n\t\t\t\t\tpointer = getPrev(pointer);\n\t\t\t\t}\n\t\t\t\tstop = distance(pointer.pos,curr_pos) > 2 || pointer.pit_id == target_pit_id || findDancer(pointer.pit_id) != -1;\n\t\t\t}\n\t\t\tif(distance(pointer.pos,curr_pos) > 2 || findDancer(pointer.pit_id) != -1){\n\t\t\t\tpointer = prev;\n\t\t\t}\n\t\t\tdancers[dancer_id].pit_id = pointer.pit_id;\n\t\t\tdancers[dancer_id].next_pos = pointer.pos;\n\t\t\tthis.connected = this.connected && pointer.pit_id == target_pit_id;\n\t\t\tsupposed_pit_num[dancer_id] = pointer.pit_id;\n\t\t\ttarget_pit_id++;\n\t\t}\n\n\t\tboolean swap_and_dance = true;\n\t\t\n\t\t//after arranged pits, see if it is possible to swap all the dancers in this round\n\t\tif(this.connected){\n\t\t\tPoint[] next_pos = new Point[d];\n\t\t\tint[] next_pit_id = new int[d];\n\t\t\tfor (int i = 0; i < d; i++) {\n\t\t\t\tif(dancers[i].soulmate != -1) continue;\n\t\t\t\tint curr_pit = dancers[i].pit_id;\n\t\t\t\tint next_pit = getNextPit(curr_pit);\n\t\t\t\tif(next_pit != -1){\n\t\t\t\t\tnext_pos[i] = findNearestActualPoint(pits[next_pit].pos, pits[curr_pit].pos);\n\t\t\t\t\tnext_pit_id[i] = next_pit;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tnext_pos[i] = dancers[i].next_pos;\n\t\t\t\t\tnext_pit_id[i] = dancers[i].pit_id;\n\t\t\t\t}\n\t\t\t\tswap_and_dance = swap_and_dance && distance(next_pos[i],this.last_positions[i]) < 2;\n\t\t\t}\n\t\t\tif(swap_and_dance){\n\t\t\t\tfor(int i = 0; i < d; i++){\n\t\t\t\t\tif(dancers[i].soulmate != -1) continue;\n\t\t\t\t\tdancers[i].next_pos = next_pos[i];\n\t\t\t\t\tdancers[i].pit_id = next_pit_id[i];\n\t\t\t\t}\n\t\t\t\tthis.state = 3 - this.state;\n\t\t\t\tthis.stay = 0;\n\t\t\t}\n\t\t}\n\t}", "public LinkedList<Move> search1() {\r\n\r\n while (!paths.isEmpty()) {\r\n\r\n if (logger.isDebugEnabled())\r\n logger.debug(printPathCosts());\r\n\r\n LinkedList<Move> path = paths.first();\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"First path is \" + path);\r\n\r\n if (!paths.remove(path)) {\r\n throw new RuntimeException(\"Failed to remove path\");\r\n }\r\n\r\n Node currentNode = path.getLast().destination;\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"Last site on path is \" + currentNode);\r\n\r\n if (closed.contains(currentNode)) {\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"Site \" + currentNode + \" was closed.\");\r\n continue;\r\n }\r\n if (currentNode.isAtTarget(target)) {\r\n return path;\r\n }\r\n\r\n closed.add(currentNode);\r\n\r\n Move lastMove = path.getLast();\r\n if ( !(lastMove instanceof InitialMove) ) {\r\n currentNode = transformCurrentNode(lastMove);\r\n }\r\n\r\n Set<Move> successors = successors(currentNode);\r\n for (Move y : successors) {\r\n LinkedList<Move> successor = new LinkedList<Move>(path);\r\n y.pathCost = successor.getLast().pathCost + y.edgeCost;\r\n successor.add(y);\r\n paths.add(successor);\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"Added successor \" + y);\r\n nodeExpansionCounter ++;\r\n }\r\n }\r\n\r\n return null;\r\n }", "private Boolean isReachable(String C1, String C2) {\n \tif (adjacencyList.get(C2) == null) {\n \t\treturn false;\n \t}\n \tfor (String child : adjacencyList.get(C2)) {\n \t\tif (child.equals(C1)) {\n \t\t\treturn true;\n \t\t} else if ( isReachable(C1, child ) ) {\n \t\t\treturn true;\n \t\t}\n \t}\n \treturn false;\n }", "public void doDfsIterative(Graph g, int s) {\n boolean[] myVisited = new boolean[8];\n Stack<Integer> stack = new Stack<>();\n stack.push(s);\n myVisited[s] = true;\n while (!stack.isEmpty()) {\n int top = stack.pop();\n System.out.print(\"[\" + top + \"] \");\n for (int e : g.adj[top]) {\n if (!myVisited[e]) {\n stack.push(e);\n myVisited[e] = true;\n }\n }\n }\n\n }", "private void bfs(Dungeon d, Site s) {\n\t\t\n\t\t// use a queue to do BFS, and initialize instance variables\n\t\tQueue<Site> q = new LinkedList<Site>();\n\t\tfor (int x = 0; x < d.size(); x++)\n\t\t\tfor (int y = 0; y < d.size(); y++)\n\t\t\t\tdistTo[x][y] = INFINITY; \n\t\tdistTo[s.getX()][s.getY()] = 0;\n\t\tmarked[s.getX()][s.getY()] = true;\n\t\t\n\t\t// pop site from queue until it's empty\n\t\tq.offer(s);\n\t\twhile (!q.isEmpty()) {\n\t\t\t\n\t\t\t// pop the next site in the queue\n\t\t\tSite v = q.poll(); \t \n\t\t\tint x = v.getX();\n\t\t\tint y = v.getY();\n\n\t\t\t// 4 adjacent sites\n\t\t\tSite east = new Site(x + 1, y);\n\t\t\tSite west = new Site(x - 1, y);\n\t\t\tSite north = new Site(x, y - 1);\n\t\t\tSite south = new Site(x, y + 1);\n\n\t\t\t// BFS the rest of the dungeon\n\t\t\tif (d.isLegalMove(v, east) && !marked[east.getX()][east.getY()]) {\n\t\t\t\tedgeTo[east.getX()][east.getY()] = v;\n\t\t\t\tdistTo[east.getX()][east.getY()] = distTo[x][y] + 1;\n\t\t\t\tmarked[east.getX()][east.getY()] = true;\n\t\t\t\tq.offer(east);\n\t\t\t}\n\t\t\tif (d.isLegalMove(v, west) && !marked[west.getX()][west.getY()]) {\n\t\t\t\tedgeTo[west.getX()][west.getY()] = v;\n\t\t\t\tdistTo[west.getX()][west.getY()] = distTo[x][y] + 1;\n\t\t\t\tmarked[west.getX()][west.getY()] = true;\n\t\t\t\tq.offer(west);\n\t\t\t}\n\t\t\tif (d.isLegalMove(v, north) && !marked[north.getX()][north.getY()]) {\n\t\t\t\tedgeTo[north.getX()][north.getY()] = v;\n\t\t\t\tdistTo[north.getX()][north.getY()] = distTo[x][y] + 1;\n\t\t\t\tmarked[north.getX()][north.getY()] = true;\n\t\t\t\tq.offer(north);\n\t\t\t}\n\t\t\tif (d.isLegalMove(v, south) && !marked[south.getX()][south.getY()]) {\n\t\t\t\tedgeTo[south.getX()][south.getY()] = v;\n\t\t\t\tdistTo[south.getX()][south.getY()] = distTo[x][y] + 1;\n\t\t\t\tmarked[south.getX()][south.getY()] = true;\n\t\t\t\tq.offer(south);\n\t\t\t}\n\n\t\t}\n\n\t}", "public void dfs (int start) {\n vertexList[start].wasVisited = true; // mark it\n print(start); stack.push(start);\n while (!stack.isEmpty()) {\n int b = getNextUnvisitedNeighbor(stack.peek());\n if (b==-1) stack.pop(); // no unvisited neighbor;\n else {\n vertexList[b].wasVisited = true;\n print(b); stack.push(b);\n }\n }\n // clear wasVisited marks\n }", "private Queue<Position> pathToClosest(MyAgentState state, Position start, int goal) {\n\t\tQueue<Position> frontier = new LinkedList<Position>();\n\t\tSet<String> enqueued = new HashSet<String>();\n\t\tMap<Position, Position> preceedes = new HashMap<Position, Position>();\n\t\tfrontier.add(start);\n\t\tenqueued.add(start.toString());\n\n\t\twhile (!frontier.isEmpty()) {\n\t\t\tPosition pos = frontier.remove();\n\t\t\tif (state.getTileData(pos) == goal) {\n\t\t\t\treturn toQueue(preceedes, pos, start);\n\t\t\t}\n\t\t\t\n\t\t\tfor (Position neighbour : pos.neighbours()) {\n\t\t\t\tif (!enqueued.contains(neighbour.toString()) && state.getTileData(neighbour) != state.WALL) {\n\t\t\t\t\tpreceedes.put(neighbour, pos);\n\t\t\t\t\tfrontier.add(neighbour);\n\t\t\t\t\tenqueued.add(neighbour.toString());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "private void breadthFirstSearch (int start, int[] visited, int[] parent){\r\n Queue< Integer > theQueue = new LinkedList< Integer >();\r\n boolean[] identified = new boolean[getNumV()];\r\n identified[start] = true;\r\n theQueue.offer(start);\r\n while (!theQueue.isEmpty()) {\r\n int current = theQueue.remove();\r\n visited[current] = 1; //ziyaret edilmis vertexler queuedan cikarilan vertexlerdir\r\n Iterator < Edge > itr = edgeIterator(current);\r\n while (itr.hasNext()) {\r\n Edge edge = itr.next();\r\n int neighbor = edge.getDest();\r\n if (!identified[neighbor]) {\r\n identified[neighbor] = true;\r\n theQueue.offer(neighbor);\r\n parent[neighbor] = current;\r\n }\r\n }\r\n }\r\n }", "public void dfsPrint(Node start){\n Stack<Node> stack = new Stack<>();\n Set<Node> visited = new HashSet<>(); //we can use integer for better space\n\n stack.push(start);\n while (!stack.isEmpty()){\n Node curr = stack.pop();\n if(!visited.contains(curr)){\n visited.add(curr);\n //do something\n }\n for(Node n: curr.adj){\n if(!visited.contains(n)){\n stack.push(n);\n }\n }\n }\n }", "public static KittyNode commAns(KittyNode a, KittyNode b){\n KittyNode trava,travb;\n trava = a;\n travb = b;\n if(trava == null)\n return travb;\n else if(travb == null)\n return trava;\n while(trava.prev != null || travb.prev != null){\n if(trava.lvl == travb.lvl){\n if(trava.prev == travb.prev)\n return trava.prev;\n trava = trava.prev;\n travb = travb.prev;\n }\n else if(trava.lvl > travb.lvl){\n if(trava.prev == travb)\n return travb;\n trava = trava.prev;\n }else if(trava.lvl < travb.lvl){\n if(trava == travb.prev)\n return trava;\n travb = travb.prev;\n }\n }\n if(trava != null)\n return trava;\n else\n return travb;\n }", "void djcalc(LinkedList<Edge> l[],int cn, int visited[],Nodedj n[],int sn, LinkedList<Integer> path[]){\n\t\n\t\tLinkedList<Nodedj> neighbour = new LinkedList<Nodedj>();\n\t\tIterator<Edge> it1 = l[sn].iterator();\n\t\tn[sn].cost = 0;\n\t\twhile(it1.hasNext())\n\t\t{\n\t\t\tEdge e= (Edge)it1.next();\n\t\t\tn[e.adjIndex].cost = e.cost;\n\t\t\tneighbour.add(n[e.adjIndex]);\n\t\t\tvisited[sn] = 1;\n\t\t\tpath[e.adjIndex].add(e.adjIndex);\n\n\t\t}\n\t\n\t\t/*The sort function is implemented in the Nodedj class*/\n\t\n\t\tCollections.sort(neighbour);\n\t\twhile(!neighbour.isEmpty()){\n\n\t\t\t/*Used for adding nodes into the neghbor list depending on its distance*/\n\t\n\t\t\tNodedj tempn = neighbour.remove();\n\t\t\tIterator<Edge> it2 = l[tempn.index].iterator();\n\t\t\tvisited[tempn.index] = 1;\n\t\t\twhile(it2.hasNext())\n\t\t\t{\n\t\t\t\tEdge e= (Edge)it2.next();\n\t\t\t\tif(visited[e.adjIndex]!=1 && !neighbour.contains(n[e.adjIndex])){\n\t\t\t\t\tneighbour.add(n[e.adjIndex]);\n\n\t\t\t\t}\n\t\t\t\tdouble tempcost;\n\t\t\t\ttempcost= e.cost+n[tempn.index].cost;\n\t\t\t\tif(tempcost < n[e.adjIndex].cost){\n\t\t\t\t\tn[e.adjIndex].cost = tempcost;\n\t\t\t\t\tpath[e.adjIndex].clear();\n\t\t\t\t\tfor(int i=0; i < path[tempn.index].size(); i++){\n\t\t\t\t\t\tpath[e.adjIndex].add(path[tempn.index].get(i));\n\t\t\t\t\t}\n\t\t\t\t\tpath[e.adjIndex].add(e.adjIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t\tCollections.sort(neighbour);\n\t\t}\n\n\t}", "protected PrioritizedSearchNode FLimtedDFS(PrioritizedSearchNode lastNode,\n\t double minR, double cumulatedReward) {\n\n\tif (lastNode.priority < minR) {\n\t return lastNode; // fail condition (either way return the last point\n\t\t\t // to which you got)\n\t}\n\tif (this.planEndNode(lastNode)) {\n\t return lastNode; // succeed condition\n\t}\n\tif (this.tf.isTerminal(lastNode.s.s)) {\n\t return null; // treat like a dead end if we're at a terminal state\n\t}\n\n\tState s = lastNode.s.s;\n\n\t// get all actions\n\tList<GroundedAction> gas = new ArrayList<GroundedAction>();\n\tfor (Action a : actions) {\n\t gas.addAll(s.getAllGroundedActionsFor(a));\n\t}\n\n\t// generate successor nodes\n\tList<PrioritizedSearchNode> successors = new ArrayList<PrioritizedSearchNode>(\n\t\tgas.size());\n\tList<Double> successorGs = new ArrayList<Double>(gas.size());\n\tfor (GroundedAction ga : gas) {\n\n\t State ns = ga.executeIn(s);\n\t StateHashTuple nsh = this.stateHash(ns);\n\n\t double r = rf.reward(s, ga, ns);\n\t double g = cumulatedReward + r;\n\t double hr = heuristic.h(ns);\n\t double f = g + hr;\n\t PrioritizedSearchNode pnsn = new PrioritizedSearchNode(nsh, ga,\n\t\t lastNode, f);\n\n\t // only add if this does not exist on our path already\n\t if (this.lastStateOnPathIsNew(pnsn)) {\n\t\tsuccessors.add(pnsn);\n\t\tsuccessorGs.add(g);\n\t }\n\n\t}\n\n\t// sort the successors by f-score to travel the most promising ones\n\t// first\n\tCollections.sort(successors, nodeComparator);\n\n\tdouble maxCandR = Double.NEGATIVE_INFINITY;\n\tPrioritizedSearchNode bestCand = null;\n\t// note that since we want to expand largest expected rewards first, we\n\t// should go reverse order of the f-ordered successors\n\tfor (int i = successors.size() - 1; i >= 0; i--) {\n\t PrioritizedSearchNode snode = successors.get(i);\n\t PrioritizedSearchNode cand = this.FLimtedDFS(snode, minR,\n\t\t successorGs.get(i));\n\t if (cand != null) {\n\t\tif (cand.priority > maxCandR) {\n\t\t bestCand = cand;\n\t\t maxCandR = cand.priority;\n\t\t}\n\t }\n\n\t}\n\n\treturn bestCand;\n }", "public Node solve()\n\t{\n\t\t// Initial problem state\n\t\tint[] initial_state = {0, 0};\n\n\t\t// Current node under consideration\n\t\tNode curr_node = new Node(initial_state, null, null);\n\n\t\t// List of frontier nodes at each iteration\n\t\t// Manipulated as a queue\n\t\tthis.frontier = new ArrayList<Node>();\n\n\t\t// List of nodes already explored\n\t\t// They are excluded from expanded frontier nodes at each iteration\n\t\tthis.explored = new ArrayList<int[]>();\n\n\t\tfrontier.add(curr_node);\n\n\t\twhile (true) {\n\t\t\t// If we have exhausted our frontier \n\t\t\t// we have no solution\n\t\t\tif (frontier.size() == 0) {\n\t\t\t\treturn null;\n\t\t\t}\n \n // Pop new node from frontier to consider\n\t\t\tcurr_node = frontier.remove(0);\n \n\t\t // Add chosen node to explored list if not already there\n\t\t\tif(!this.inExplored(curr_node.state)) {\n\t\t\t\texplored.add(curr_node.state);\t\t\t\t\n\t\t\t}\n\n // List of actions that can be applied based on the state\n // and the description of the problem\n\t\t\tAction[] actions = this.getFeasibleActions(curr_node.state);\n\n // Apply our transition model to generate child nodes \n // from current node\n\t\t\tfor (Action action : actions) {\n\t\t\t\tNode child = this.getChildNode(curr_node, action);\t\t\n\t\t\t\t\n\t\t\t\tif (!this.inFrontier(child) && !this.inExplored(child.state)) {\n\t\t\t\t\tif (this.isGoal(child.state)) {\n\t\t\t\t\t\treturn child;\n\t\t\t\t\t}\n\t\t\t\t\tfrontier.add(child);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void depthFirstSearch(Node sourceNode, Node destinationNode, String path, HashSet<Character> visited) {\n // Base condition is that if the node is looping then return\n if(visited.contains(sourceNode.charId)) {\n return;\n }\n\n // Mark the sourceNode as visited\n visited.add(sourceNode.charId);\n String newPath = sourceNode.charId.toString();\n path += \"->\" + newPath;\n\n // If the source node reached destination or the node has no children\n if(sourceNode == destinationNode || sourceNode.adjacent.isEmpty()) {\n paths.add(path);\n return;\n }\n\n // Search all of it's children's children until reach destination\n for(Node children : sourceNode.adjacent) {\n depthFirstSearch(children, destinationNode, path, visited);\n }\n }", "int dfs(String wheel, Set<String> deadendSet, Set<String> visited, String target, int depth) {\n\t\t// System.out.printf(\"dfs visit: %2s (depth: %d)\\n\", wheel, depth);\n\t\t++numDFSCalls;\n\t\t// scanner.nextLine();\n\n\t\tif (deadendSet.contains(wheel)) return Integer.MAX_VALUE;\n\t\tif (wheel.equals(target)) return 0;\n\n\t\tvisited.add(wheel);\n\t\tint d = Integer.MAX_VALUE;\n\t\tfor (String next : nextState(wheel)) {\n\t\t\tif (!visited.contains(next)) {\n\t\t\t\tint d1 = dfs(next, deadendSet, visited, target, depth+1);\n\t\t\t\td = Math.min(d, d1);\n\t\t\t}\n\t\t}\n\t\tvisited.remove(wheel);\n\n\t\treturn d < Integer.MAX_VALUE ? ++d : d;\n\t}", "public void dfs (String input)\r\n\t {\r\n\t\t \tNode root_dfs = new Node (input);\r\n\t\t \tNode current = new Node(root_dfs.getState());\r\n\t\t \t\r\n\t\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\tStack<Node> stack_dfs = new Stack<Node>();\r\n\t\t\t\r\n\t\t\tint nodes_popped = 0;\r\n\t\t\tint stack_max_size = 0;\r\n\t\t\tint stack_size = 0;\r\n\t\t\tcurrent.cost = 0;\r\n\t\t\t\r\n\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\r\n\t\t\twhile(!goal_dfs)\r\n\t\t\t{\r\n\t\t\t\tvisited.add(current.getState());\r\n\t\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\t\r\n\t\t\t\tfor (String a : children)\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Repeated state check\r\n\t\t\t\t\t\tif (!stack_dfs.contains(nino))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstack_dfs.add(nino);\r\n\t\t\t\t\t\t\tstack_size++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Popping off the stack. LIFO architecture\r\n\t\t\t\tcurrent = stack_dfs.pop();\r\n\t\t\t\tnodes_popped++;\r\n\t\t\t\t\r\n\t\t\t\tif (stack_size > stack_max_size)\r\n\t\t\t\t{\r\n\t\t\t\t\tstack_max_size = stack_size;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tstack_size--;\r\n\t\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tgoal_dfs = false;\r\n\t\t\tSystem.out.println(\"DFS Solved!!\");\r\n\t\t\tSolution.performSolution(current, root_dfs, nodes_popped, stack_max_size);\r\n\t }", "private int bfs(int startNode, Map<Integer, List<Integer>> adjacencyList, int[] distanceToNode) {\n int furthestNode = 1;\n int furthestDistance = Integer.MIN_VALUE;\n\n Queue<Integer> queue = new LinkedList<>();\n Arrays.fill(distanceToNode, -1);\n\n // Put start node in queue\n queue.add(startNode);\n // Set distance of the first node to 0 (0 edge to itself)\n distanceToNode[startNode - 1] = 0;\n\n // While queue is not empty\n while (!queue.isEmpty()) {\n // Pop node\n int curNode = queue.remove();\n\n // Iterate through node's neighbours\n for (int neighbour : adjacencyList.get(curNode)) {\n // If neighbour is not visited (distance not -1)\n if (distanceToNode[neighbour - 1] == -1) {\n // Calculate distance by taking curNode distance and add 1\n // Update distance in array as a way of marking it as visited\n distanceToNode[neighbour - 1] = distanceToNode[curNode - 1] + 1;\n\n // Add to queue to process next\n queue.add(neighbour);\n\n // If the distance is bigger than current furthest one, update\n if (distanceToNode[neighbour - 1] > furthestDistance)\n furthestNode = neighbour;\n }\n }\n }\n return furthestNode;\n }", "static int circularWalk(int n, int s, int t, int r_0, int g, int seed, int p){\n\t\tPoint[] points=new Point[n];\n\t\tfor (int i = 0; i < points.length; i++) {\n\t\t\tPoint point=new Point(r_0, false, false);\n\t\t\tif(i!=0)\n\t\t\t{\n\t\t\t\tpoint.rValue=((long)(points[i-1].rValue*g+seed))%p;\n\t\t\t}\n\t\t\tif(i==s){\n\t\t\t\tpoint.isSource=true;\n\t\t\t}\n\t\t\tif(i==t)\n\t\t\t\tpoint.isTarget=true;\n\t\t\tpoints[i]=point;\n\t\t}\n\t\tif(s==t)\n\t\t\treturn 0;\n\t\t//maintain visited and calculate if we can reach t from s,if we can't reach from a certain point,return Max\n\t\t//find the min of all the dfs possibilities\n\t\tHashSet<Integer> set=new HashSet<>();\n\t\treturn dfs(points,s,t,0,set);\n\t}", "static void iterativeDfs(Node startingNode) {\n Set<Node> markedAsVisited = new HashSet<>();\n\n // creates a stack for piling up the nodes to visit\n ArrayDeque<Node> toBeVisited = new ArrayDeque<>();\n\n // sets the starting node as to be visited\n toBeVisited.push(startingNode);\n\n // adds the starting node to the set of marked as visited nodes\n markedAsVisited.add(startingNode);\n\n // while there nodes to visit\n while (!toBeVisited.isEmpty()) {\n\n // gets the current node\n Node current = toBeVisited.pop();\n\n // processes the node\n System.out.print(\"Node \" + current.val + \", \");\n\n // loops over the neighbours of the current node\n for (Node neighbour: current.neighbours) {\n\n // if the neighbour has not been already visited\n if (! markedAsVisited.contains(neighbour)) {\n\n // adds the neighbour to the ones to be visited\n toBeVisited.push(neighbour);\n\n // adds the neighbour to the set of marked as visited nodes\n markedAsVisited.add(neighbour);\n }\n }\n }\n }", "private List<List<Edge>> walker(String sourceNode, String destNode, List<Edge> currentPath, List<List<Edge>> paths) {\n if (currentPath == null) {\n currentPath = new ArrayList<>();\n }\n if (paths == null) {\n paths = new ArrayList<>();\n }\n\n if (sourceNode.equals(destNode)) {\n return paths;\n }\n\n\n// List<Edge> edges = findByNodeA(sourceNode);\n List<Edge> edges = allEdges.stream().filter(edge -> edge.nodeA.equals(sourceNode)).collect(Collectors.toList());\n\n\n for (Edge edge : edges) {\n if (!currentPath.contains(edge)&&!containsBidirectionalRef(currentPath,edge)) {\n List<Edge> forkPath = (List<Edge>) ((ArrayList<Edge>) currentPath).clone();\n\n forkPath.add(edge);\n\n if (edge.getNodeB().equals(destNode)) {\n paths.add(forkPath);\n } else {\n walker(edge.getNodeB(), destNode,forkPath,paths);\n }\n }\n }\n\n return paths;\n }", "private void depthFirstSearchIterative(int sourceVertex, List<Integer>[] adjacent, Stack<Integer> finishTimes,\n boolean[] visited, boolean getFinishTimes) {\n Stack<Integer> stack = new Stack<>();\n stack.push(sourceVertex);\n visited[sourceVertex] = true;\n\n if (!getFinishTimes) {\n sccIds[sourceVertex] = sccCount;\n }\n\n // Used to be able to iterate over each adjacency list, keeping track of which\n // vertex in each adjacency list needs to be explored next\n Iterator<Integer>[] adjacentIterators = (Iterator<Integer>[]) new Iterator[adjacent.length];\n for (int vertexId = 0; vertexId < adjacentIterators.length; vertexId++) {\n if (adjacent[vertexId] != null) {\n adjacentIterators[vertexId] = adjacent[vertexId].iterator();\n }\n }\n\n while (!stack.isEmpty()) {\n int currentVertex = stack.peek();\n\n if (adjacentIterators[currentVertex].hasNext()) {\n int neighbor = adjacentIterators[currentVertex].next();\n\n if (!visited[neighbor]) {\n stack.push(neighbor);\n visited[neighbor] = true;\n }\n } else {\n stack.pop();\n\n if (getFinishTimes) {\n finishTimes.push(currentVertex);\n }\n }\n }\n }", "public static void dfs(int a, Vertex [] v){\n assert !v[a].visited;\n\n v[a].visited = true;\n\n // traverse over all the outgoing edges\n\n for(int b : v[a].edges){\n v[b].d = Math.max(v[b].d , v[a].d + 1);\n v[b].in --;\n\n if(v[b].in == 0 && !v[b].visited){\n dfs(b,v);\n }\n }\n\n\n }", "private void DepthFirstSearch(Node current){\n helperDFS( current );\n }", "private static void breadthFirstSearch(int source, ArrayList<ArrayList<Integer>> nodes) {\n\t\tArrayList<ArrayList<Integer>> neighbours = nodes;\n\t\tQueue<Integer> queue= new LinkedList<Integer>();\n\t\t\n\t\tboolean[] visited = new boolean[nodes.size()];\n\t\t\n\t\tqueue.add(source);\n\t\tvisited[source]=true;\n\t\t\n\t\twhile(!queue.isEmpty()) {\n\t\t\tint k =queue.remove();\n\t\t\tSystem.out.println(k);\n\t\t\tfor(int p : nodes.get(k)) {\n\t\t\t\tif(!visited[p]) {\n\t\t\t\t\tqueue.add(p);\n\t\t\t\t\tvisited[p]=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t}", "private void recursiveTryItinerary(String destinationCode, int depth, Time arrivalTime, List<Flight> checkFlights, List<Itinerary> existingItineraries, List<String> visitedAirports, List<Flight> currentFlights, int cid) {\n\n\t\t// this method does nothing if there are no flights so\n\t\tif (checkFlights.size() == 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tString nextOrigin = \"\";\n\t\tString currentOrigin = checkFlights.get(0).getOrigin();\n\t\tboolean recurse;\n\t\tint layoverTime = -1;\n\t\tvisitedAirports.add(currentOrigin);\n\t\tfor (Flight f : checkFlights) {\n\n\t\t\t// get a reference to the current departure time\n\t\t\tTime depTime = f.getDepartureTime();\n\n\t\t\tif (arrivalTime != null) {\n\t\t\t\tlayoverTime = adb.getLayoverTime(f.getOrigin(), cid);\n\t\t\t}\n\n\t\t\t// determine if the thing needs to recurse\n\t\t\tif (currentFlights.size() == 0 || layoverTime == -1) {\n\t\t\t\trecurse = true;\n\t\t\t} else if (arrivalTime.stillBefore(depTime, layoverTime)) {\n\t\t\t\trecurse = true;\n\t\t\t} else {\n\t\t\t\trecurse = false;\n\t\t\t}\n\n\t\t\t// print debug, and add f to all the guacamole\n\t\t\tnextOrigin = f.getDestination();\n\t\t\tcurrentFlights.add(f);\n\n\t\t\t// determine whether to recurse or\n\t\t\tif (f.getDestination().equals(destinationCode)) {\n\t\t\t\t// add a newly created itinerary whose flights are a copy of the current set of flights.\n\t\t\t\tif (((arrivalTime != null) && arrivalTime.stillBefore(depTime, layoverTime)) || layoverTime == -1) {\n\t\t\t\t\texistingItineraries.add(createItinerary(copyFlights(currentFlights)));\n\t\t\t\t}\n\t\t\t} else if (depth > 0 && !(visitedAirports.contains(nextOrigin)) && recurse) {\n\t\t\t\trecursiveTryItinerary(destinationCode, depth - 1, f.getDepartureTime(), getFlightsFromOrigin(nextOrigin), existingItineraries, visitedAirports, currentFlights, cid);\n\t\t\t}\n\n\t\t\t// remove f from all the guacamole\n\t\t\tcurrentFlights.remove(f);\n\t\t}\n\t\tvisitedAirports.remove(currentOrigin);\n\t}", "private Point backtrack(Point p){\n\t\t// coordinates of the point\n\t\tint x = (int)p.getX();\n\t\tint y = (int)p.getY();\n\t\t// neigh hold the return value\n\t\tPoint neigh= p;\n\t\t// the lowest score\n\t\tint score=10000;\n\t\t// look at all the neighbor and compare them\n\t\tif(x>0\t && topology[x-1][y]>=0){\n\t\t\tscore = topology[x-1][y];\n\t\t\tneigh = new Point(x-1,y);\n\t\t}\n\t\tif(x<row-1 && topology[x+1][y]>=0 && score > topology[x+1][y]) {\n\t\t\tscore = topology[x+1][y];\n\t\t\tneigh = new Point(x+1,y);\n\t\t}\n\t\tif(y<col-1 && topology[x][y+1]>=0 && score > topology[x][y+1]) {\n\t\t\tscore = topology[x][y+1];\n\t\t\tneigh = new Point(x,y+1);\n\t\t}\n\t\tif(y>0 && topology[x][y-1]>=0 && score > topology[x][y-1]) {\n\t\t\tscore = topology[x][y-1];\n\t\t\tneigh = new Point(x,y-1);\n\t\t}\n\t\treturn neigh;\n\t}", "private BGPPath internalPathSelection(Collection<BGPPath> possList, boolean avoidDecoys) {\n BGPPath currentBest = null;\n int currentRel = -4;\n\n for (BGPPath tPath : possList) {\n\n /*\n * If we're doing avoidance based on ignoring local preference, then\n * for the first pass we're literally just going to throw out all\n * routes that are NOT clean, this is corrected in path selection if\n * this leaves us w/ no viable routes\n */\n if (avoidDecoys && (this.avoidMode == AS.AvoidMode.LOCALPREF || this.avoidMode == AS.AvoidMode.LEGACY)) {\n if (tPath.containsAnyOf(this.botSet)) {\n continue;\n }\n }\n\n /*\n * If we have no best path currently selected, the first one is best\n * by default\n */\n if (currentBest == null) {\n currentBest = tPath;\n currentRel = this.getRel(currentBest.getNextHop());\n continue;\n }\n\n /*\n * Local pref based on relationship step\n */\n int newRel = this.getRel(tPath.getNextHop());\n if (newRel > currentRel) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n }\n\n /*\n * If local pref is the same, move on to the next critera\n */\n if (newRel == currentRel) {\n /*\n * If we're inserting the decision to route around decoys after\n * local pref, but before path length, do so here\n */\n if (this.avoidMode == AS.AvoidMode.PATHLEN) {\n if (avoidDecoys && currentBest.containsAnyOf(this.botSet) && !tPath.containsAnyOf(this.botSet)) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n }\n if (avoidDecoys && !currentBest.containsAnyOf(this.botSet) && tPath.containsAnyOf(this.botSet)) {\n continue;\n }\n }\n\n if (currentBest.getPathLength() > tPath.getPathLength()) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n } else if (currentBest.getPathLength() == tPath.getPathLength()) {\n if (avoidDecoys && this.avoidMode == AS.AvoidMode.TIEBREAK\n && currentBest.containsAnyOf(this.botSet) && !tPath.containsAnyOf(this.botSet)) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n }\n if (avoidDecoys && this.avoidMode == AS.AvoidMode.TIEBREAK\n && !currentBest.containsAnyOf(this.botSet) && tPath.containsAnyOf(this.botSet)) {\n continue;\n }\n\n if (tPath.getNextHop() < currentBest.getNextHop()) {\n currentBest = tPath;\n currentRel = newRel;\n }\n }\n }\n }\n\n return currentBest;\n }", "static void bridgeUtil(int u, boolean visited[], int disc[],\n int low[], int parent[])\n {\n \n // Mark the current node as visited\n visited[u] = true;\n \n // Initialize discovery time and low value\n disc[u] = low[u] = ++time;\n \n // Go through all vertices aadjacent to this\n for (int data : adj.get(u)) \n {\n int v = data; // v is current adjacent of u\n \n // If v is not visited yet, then make it a child\n // of u in DFS tree and recur for it.\n // If v is not visited yet, then recur for it\n if (!visited[v])\n {\n parent[v] = u;\n bridgeUtil(v, visited, disc, low, parent);\n \n // Check if the subtree rooted with v has a\n // connection to one of the ancestors of u\n low[u] = Math.min(low[u], low[v]);\n \n // If the lowest vertex reachable from subtree\n // under v is below u in DFS tree, then u-v is\n // a bridge\n if (low[v] > disc[u])\n System.out.println(u+\" \"+v);\n }\n \n // Update low value of u for parent function calls.\n else if (v != parent[u])\n low[u] = Math.min(low[u], disc[v]);\n }\n }", "public int find(int a) {\n if (father[a] == a) {\n return a;\n }\n return father[a] = find(father[a]); // path compression for O(1)\n }", "private void dfs(int vertex, int parent, int currentE) {\n System.out.println(\"Going from \" + parent + \" to \" + vertex);\n currentE++;\n assert g.isDirected();\n if (!lowLink.containsKey(vertex)) {\n lowLink.put(vertex, currentE);\n } else {\n if (parent >= 0) {\n if (lowLink.get(vertex) < lowLink.get(parent)) { //We've been there\n lowLink.put(parent, lowLink.get(vertex));\n }\n }\n return;\n }\n\n //Remove backward edge\n g.removeEdge(vertex, parent);\n\n for (var head : g.getHeads(vertex)) {\n dfs(head, vertex, currentE);\n if (lowLink.get(head) < lowLink.get(vertex)) {\n lowLink.put(vertex, lowLink.get(head));\n }\n // Apply bridge criteria:\n // lowlink(head) > e(tail)\n if (lowLink.get(head) > currentE) {\n bridges.add(new Graph.Edge(vertex, head));\n }\n }\n }", "private void doDepthFirstTraverse(int start, boolean[] visited, List<Edge> path) {\n visited[start] = true;\n\n for (int i: this.heads[start]) {\n if (!visited[i]) {\n path.add(new Edge(start, i));\n doDepthFirstTraverse(i, visited, path);\n }\n }\n }", "public static UniformCostSearchNode searchBnB(UniformCostSearchNode root){\n PriorityQueue<UniformCostSearchNode> frontier = new PriorityQueue<UniformCostSearchNode>();\n\n // hash set for fast verification of closed nodes\n HashSet<UniformCostSearchNode> closed = new HashSet<UniformCostSearchNode>();\n\n int upperBoundCost = Integer.MAX_VALUE;\n\n frontier.add(root);\n\n while(frontier.size() != 0){\n UniformCostSearchNode current = frontier.remove();\n if(current.isGoalState()){\n System.out.println(\"UCS B&B Nodes explored: \" + closed.size());\n return current;\n }\n\n // implicitly pruning the frontier\n if(current.getCost() >= upperBoundCost){\n // skipping due to bounding\n continue;\n }\n\n closed.add(current);\n\n PriorityQueue<UniformCostSearchNode> toAdd = new PriorityQueue<UniformCostSearchNode>();\n for(UniformCostSearchNode neighbor : current.getNeighbors()){\n toAdd.add(neighbor);\n }\n\n while(toAdd.size() != 0) {\n UniformCostSearchNode neighbor = toAdd.remove();\n if (neighbor.getCost() < upperBoundCost) {\n if (neighbor.isGoalState()) {\n // bounding\n upperBoundCost = neighbor.getCost();\n }\n frontier.add(neighbor);\n }\n }\n }\n\n System.out.println(\"UCS B&B Search failed, nodes explored: \" + closed.size());\n // search failed\n return null;\n }", "public static Vertex breathFirstSearch(Graph g, Vertex root) {\n\n for (Vertex v : g) {\n v.seen = false;\n v.parent = null;\n v.distance = Integer.MAX_VALUE;\n }\n\n Queue<Vertex> queue = new LinkedList<Vertex>();\n root.seen = true;\n root.distance = 0;\n queue.add(root);\n Vertex maxDistNode = null;\n while (!queue.isEmpty()) {\n Vertex current = queue.remove();\n\n for (Edge e : current.Adj) {\n Vertex other = e.otherEnd(current);\n if (!other.seen) {\n other.seen = true;\n other.distance = current.distance + 1;\n other.parent = current;\n queue.add(other);\n }\n }\n maxDistNode = current;\n }\n return maxDistNode;\n }", "public List<Graph> search() {\n\n long start = System.currentTimeMillis();\n TetradLogger.getInstance().log(\"info\", \"Starting ION Search.\");\n logGraphs(\"\\nInitial Pags: \", this.input);\n TetradLogger.getInstance().log(\"info\", \"Transfering local information.\");\n long steps = System.currentTimeMillis();\n\n /*\n * Step 1 - Create the empty graph\n */\n List<Node> varNodes = new ArrayList<>();\n for (String varName : variables) {\n varNodes.add(new GraphNode(varName));\n }\n Graph graph = new EdgeListGraph(varNodes);\n\n /*\n * Step 2 - Transfer local information from the PAGs (adjacencies\n * and edge orientations)\n */\n // transfers edges from each graph and finds definite noncolliders\n transferLocal(graph);\n // adds edges for variables never jointly measured\n for (NodePair pair : nonIntersection(graph)) {\n graph.addEdge(new Edge(pair.getFirst(), pair.getSecond(), Endpoint.CIRCLE, Endpoint.CIRCLE));\n }\n TetradLogger.getInstance().log(\"info\", \"Steps 1-2: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n System.out.println(\"step2\");\n System.out.println(graph);\n\n /*\n * Step 3\n *\n * Branch and prune step that blocks problematic undirectedPaths, possibly d-connecting undirectedPaths\n */\n steps = System.currentTimeMillis();\n Queue<Graph> searchPags = new LinkedList<>();\n // place graph constructed in step 2 into the queue\n searchPags.offer(graph);\n // get d-separations and d-connections\n List<Set<IonIndependenceFacts>> sepAndAssoc = findSepAndAssoc(graph);\n this.separations = sepAndAssoc.get(0);\n this.associations = sepAndAssoc.get(1);\n Map<Collection<Node>, List<PossibleDConnectingPath>> paths;\n// Queue<Graph> step3PagsSet = new LinkedList<Graph>();\n HashSet<Graph> step3PagsSet = new HashSet<>();\n Set<Graph> reject = new HashSet<>();\n // if no d-separations, nothing left to search\n if (separations.isEmpty()) {\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(graph);\n step3PagsSet.add(graph);\n }\n // sets length to iterate once if search over path lengths not enabled, otherwise set to 2\n int numNodes = graph.getNumNodes();\n int pl = numNodes - 1;\n if (pathLengthSearch) {\n pl = 2;\n }\n // iterates over path length, then adjacencies\n for (int l = pl; l < numNodes; l++) {\n if (pathLengthSearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path lengths: \" + l + \" of \" + (numNodes - 1));\n }\n int seps = separations.size();\n int currentSep = 1;\n int numAdjacencies = separations.size();\n for (IonIndependenceFacts fact : separations) {\n if (adjacencySearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path nonadjacencies: \" + currentSep + \" of \" + numAdjacencies);\n }\n seps--;\n // uses two queues to keep up with which PAGs are being iterated and which have been\n // accepted to be iterated over in the next iteration of the above for loop\n searchPags.addAll(step3PagsSet);\n recGraphs.add(searchPags.size());\n step3PagsSet.clear();\n while (!searchPags.isEmpty()) {\n System.out.println(\"ION Step 3 size: \" + searchPags.size());\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n // deques first PAG from searchPags\n Graph pag = searchPags.poll();\n // Part 3.a - finds possibly d-connecting undirectedPaths between each pair of nodes\n // known to be d-separated\n List<PossibleDConnectingPath> dConnections = new ArrayList<>();\n // checks to see if looping over adjacencies\n if (adjacencySearch) {\n for (Collection<Node> conditions : fact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, fact.getX(), fact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, fact.getX(), fact.getY(), conditions));\n }\n }\n } else {\n for (IonIndependenceFacts allfact : separations) {\n for (Collection<Node> conditions : allfact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, allfact.getX(), allfact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, allfact.getX(), allfact.getY(), conditions));\n }\n }\n }\n }\n // accept PAG go to next PAG if no possibly d-connecting undirectedPaths\n if (dConnections.isEmpty()) {\n// doFinalOrientation(pag);\n// Graph p = screenForKnowledge(pag);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(pag);\n continue;\n }\n // maps conditioning sets to list of possibly d-connecting undirectedPaths\n paths = new HashMap<>();\n for (PossibleDConnectingPath path : dConnections) {\n List<PossibleDConnectingPath> p = paths.get(path.getConditions());\n if (p == null) {\n p = new LinkedList<>();\n }\n p.add(path);\n paths.put(path.getConditions(), p);\n }\n // Part 3.b - finds minimal graphical changes to block possibly d-connecting undirectedPaths\n List<Set<GraphChange>> possibleChanges = new ArrayList<>();\n for (Set<GraphChange> changes : findChanges(paths)) {\n Set<GraphChange> newChanges = new HashSet<>();\n for (GraphChange gc : changes) {\n boolean okay = true;\n for (Triple collider : gc.getColliders()) {\n\n if (pag.isUnderlineTriple(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n\n }\n if (!okay) {\n continue;\n }\n for (Triple collider : gc.getNoncolliders()) {\n if (pag.isDefCollider(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n }\n if (okay) {\n newChanges.add(gc);\n }\n }\n if (!newChanges.isEmpty()) {\n possibleChanges.add(newChanges);\n } else {\n possibleChanges.clear();\n break;\n }\n }\n float starthitset = System.currentTimeMillis();\n Collection<GraphChange> hittingSets = IonHittingSet.findHittingSet(possibleChanges);\n recHitTimes.add((System.currentTimeMillis() - starthitset) / 1000.);\n // Part 3.c - checks the newly constructed graphs from 3.b and rejects those that\n // cycles or produce independencies known not to occur from the input PAGs or\n // include undirectedPaths from definite nonancestors\n for (GraphChange gc : hittingSets) {\n boolean badhittingset = false;\n for (Edge edge : gc.getRemoves()) {\n Node node1 = edge.getNode1();\n Node node2 = edge.getNode2();\n Set<Triple> triples = new HashSet<>();\n triples.addAll(gc.getColliders());\n triples.addAll(gc.getNoncolliders());\n if (triples.size() != (gc.getColliders().size() + gc.getNoncolliders().size())) {\n badhittingset = true;\n break;\n }\n for (Triple triple : triples) {\n if (node1.equals(triple.getY())) {\n if (node2.equals(triple.getX()) ||\n node2.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n if (node2.equals(triple.getY())) {\n if (node1.equals(triple.getX()) ||\n node1.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n }\n if (badhittingset) {\n break;\n }\n for (NodePair pair : gc.getOrients()) {\n if ((node1.equals(pair.getFirst()) && node2.equals(pair.getSecond())) ||\n (node2.equals(pair.getFirst()) && node1.equals(pair.getSecond()))) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (!badhittingset) {\n for (NodePair pair : gc.getOrients()) {\n for (Triple triple : gc.getNoncolliders()) {\n if (pair.getSecond().equals(triple.getY())) {\n if (pair.getFirst().equals(triple.getX()) &&\n pag.getEndpoint(triple.getZ(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n\n }\n if (pair.getFirst().equals(triple.getZ()) &&\n pag.getEndpoint(triple.getX(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n }\n if (badhittingset) {\n continue;\n }\n Graph changed = gc.applyTo(pag);\n // if graph change has already been rejected move on to next graph\n if (reject.contains(changed)) {\n continue;\n }\n // if graph change has already been accepted move on to next graph\n if (step3PagsSet.contains(changed)) {\n continue;\n }\n // reject if null, predicts false independencies or has cycle\n if (predictsFalseIndependence(associations, changed)\n || changed.existsDirectedCycle()) {\n reject.add(changed);\n }\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(changed);\n // now add graph to queue\n\n// Graph p = screenForKnowledge(changed);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(changed);\n }\n }\n // exits loop if not looping over adjacencies\n if (!adjacencySearch) {\n break;\n }\n }\n }\n TetradLogger.getInstance().log(\"info\", \"Step 3: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n Queue<Graph> step3Pags = new LinkedList<>(step3PagsSet);\n\n /*\n * Step 4\n *\n * Finds redundant undirectedPaths and uses this information to expand the list\n * of possible graphs\n */\n steps = System.currentTimeMillis();\n Map<Edge, Boolean> necEdges;\n Set<Graph> outputPags = new HashSet<>();\n\n while (!step3Pags.isEmpty()) {\n Graph pag = step3Pags.poll();\n necEdges = new HashMap<>();\n // Step 4.a - if x and y are known to be unconditionally associated and there is\n // exactly one trek between them, mark each edge on that trek as necessary and\n // make the tiples on the trek definite noncolliders\n // initially mark each edge as not necessary\n for (Edge edge : pag.getEdges()) {\n necEdges.put(edge, false);\n }\n // look for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n List<List<Node>> treks = treks(pag, fact.x, fact.y);\n if (treks.size() == 1) {\n List<Node> trek = treks.get(0);\n List<Triple> triples = new ArrayList<>();\n for (int i = 1; i < trek.size(); i++) {\n // marks each edge in trek as necessary\n necEdges.put(pag.getEdge(trek.get(i - 1), trek.get(i)), true);\n if (i == 1) {\n continue;\n }\n // makes each triple a noncollider\n pag.addUnderlineTriple(trek.get(i - 2), trek.get(i - 1), trek.get(i));\n }\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // Part 4.b - branches by generating graphs for every combination of removing\n // redundant undirectedPaths\n boolean elimTreks;\n // checks to see if removing redundant undirectedPaths eliminates every trek between\n // two variables known to be nconditionally assoicated\n List<Graph> possRemovePags = possRemove(pag, necEdges);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n for (Graph newPag : possRemovePags) {\n elimTreks = false;\n // looks for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n if (treks(newPag, fact.x, fact.y).isEmpty()) {\n elimTreks = true;\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // add new PAG to output unless a necessary trek has been eliminated\n if (!elimTreks) {\n outputPags.add(newPag);\n }\n }\n }\n outputPags = removeMoreSpecific(outputPags);\n// outputPags = applyKnowledge(outputPags);\n\n TetradLogger.getInstance().log(\"info\", \"Step 4: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n\n /*\n * Step 5\n *\n * Generate the Markov equivalence classes for graphs and accept only\n * those that do not predict false d-separations\n */\n steps = System.currentTimeMillis();\n Set<Graph> outputSet = new HashSet<>();\n for (Graph pag : outputPags) {\n Set<Triple> unshieldedPossibleColliders = new HashSet<>();\n for (Triple triple : getPossibleTriples(pag)) {\n if (!pag.isAdjacentTo(triple.getX(), triple.getZ())) {\n unshieldedPossibleColliders.add(triple);\n }\n }\n\n PowerSet<Triple> pset = new PowerSet<>(unshieldedPossibleColliders);\n for (Set<Triple> set : pset) {\n Graph newGraph = new EdgeListGraph(pag);\n for (Triple triple : set) {\n newGraph.setEndpoint(triple.getX(), triple.getY(), Endpoint.ARROW);\n newGraph.setEndpoint(triple.getZ(), triple.getY(), Endpoint.ARROW);\n }\n doFinalOrientation(newGraph);\n }\n for (Graph outputPag : finalResult) {\n if (!predictsFalseIndependence(associations, outputPag)) {\n Set<Triple> underlineTriples = new HashSet<>(outputPag.getUnderLines());\n for (Triple triple : underlineTriples) {\n outputPag.removeUnderlineTriple(triple.getX(), triple.getY(), triple.getZ());\n }\n outputSet.add(outputPag);\n }\n }\n }\n\n// outputSet = applyKnowledge(outputSet);\n outputSet = checkPaths(outputSet);\n\n output.addAll(outputSet);\n TetradLogger.getInstance().log(\"info\", \"Step 5: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n runtime = ((System.currentTimeMillis() - start) / 1000.);\n logGraphs(\"\\nReturning output (\" + output.size() + \" Graphs):\", output);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n return output;\n }", "private LinkedList<Integer> _findShortestPath(int source, int destination)\n{\n LinkedList<Integer> output = new LinkedList<Integer>();\n if (this.bellmanParent[destination] == source) {\n output.addFirst(destination);\n output.addFirst(source);\n return output;\n }\n /*\n * Our source is only part of the subtree, and we requested a node beyond\n * its reach. Lets flag it so that the calling function knows to ignore this\n * result.\n */\n if (this.bellmanParent[destination] == destination) {\n output.addFirst(-1);\n return output;\n }\n output = this._findShortestPath(source, this.bellmanParent[destination]);\n output.addLast(destination);\n return output;\n}", "public Tile diveBomb() {\n List<Tile> targets = this.findTargets();\n Tile us_tile = this.gb.get(this.us_head_x, this.us_head_y);\n LinkedList<Tile> shortestPath = null;\n\n // Chose the shortest path\n //System.out.println(\"HeadX: \" + this.us_head_x + \" HeadY: \" + this.us_head_y);\n //System.out.println(\"EnemyX: \" + this.enemy_head_x + \" EnemyY: \" + this.enemy_head_y);\n // System.out.println(\"Targets - \" + targets);\n for (Tile target : targets) {\n LinkedList<Tile> path = this.dk.path(us_tile, target, this.gb);\n\n if (path != null) { // means we couldn't reach the desired target\n // System.out.println(\"Path - \" + path);\n if (shortestPath == null) {\n shortestPath = path;\n } else if (path.size() < shortestPath.size()) {\n shortestPath = path;\n }\n }\n }\n // System.out.println(\"Shortest Path - \" + shortestPath);\n if (shortestPath == null) return us_tile;\n return shortestPath.get(1);\n }", "public static List<CampusGraph.Edges<String, String>> findPath(CampusGraph<String, String> cg, String start, String destination) {\n if (cg == null || start == null || destination == null) {\n throw new IllegalArgumentException();\n }\n Queue<String> visitedNodes = new LinkedList<>();\n Map<String, List<CampusGraph.Edges<String, String>>> paths = new HashMap<>();\n visitedNodes.add(start); // Add start to Q\n paths.put(start, new LinkedList<>()); // Add start->[] to M (start mapped to an empty list)\n\n while (!visitedNodes.isEmpty()) {\n String currentNode = visitedNodes.remove();\n if (currentNode.equals(destination)) { // found the path\n return paths.get(currentNode);\n } else {\n List<CampusGraph.Edges<String, String>> neighbors = cg.getAllChildren(currentNode);\n neighbors.sort(new Comparator<CampusGraph.Edges<String, String>>() {\n @Override\n public int compare(CampusGraph.Edges<String, String> o1, CampusGraph.Edges<String, String> o2) {\n int cmpEndNode = o1.getEndTag().compareTo(o2.getEndTag());\n if (cmpEndNode == 0) {\n return o1.getEdgeLabel().compareTo(o2.getEdgeLabel());\n }\n return cmpEndNode;\n }\n }); // ascending list. Sort characters and books names all at once??\n\n for (CampusGraph.Edges<String, String> e: neighbors) {\n String neighbor = e.getEndTag();\n if (!paths.containsKey(neighbor)) { // i.e. if the neighbor is unvisited\n List<CampusGraph.Edges<String, String>> pathCopy = new LinkedList<>(paths.get(currentNode));\n pathCopy.add(e);\n paths.put(neighbor, pathCopy); // add the path exclusive to this neighbor\n visitedNodes.add(neighbor); // then, mark the neighbor as visited\n }\n }\n }\n }\n return null; // No destination found\n }", "private Cell breadthFirstSearch(WorldMap worldMap, Cell startCell, CELLTYPE goalType, Hashtable<Cell, Cell> prev) {\n\n\t\t// Using markedSet to avoid re-checking already visited nodes\n\t\tHashSet<Cell> markedSet = new HashSet<Cell>();\n\t\tLinkedList<Cell> queue = new LinkedList<Cell>();\n\n\t\tmarkedSet.add(startCell);\n\t\tqueue.add(startCell);\n\n\t\twhile (!queue.isEmpty()) {\n\t\t\tCell cell = queue.remove();\n\t\t\tif (cell.getCellType() == goalType)\n\t\t\t\treturn cell;\n\t\t\tLinkedList<Cell> neighbors = generateSuccessors(worldMap, cell, goalType);\n\n\t\t\t/*\n\t\t\t * If looking for unexplored, shuffle list. Since the neighbors are\n\t\t\t * always returned NESW, it's best to shuffle the list if ant wants\n\t\t\t * to explore a random portion of the map.\n\t\t\t */\n\t\t\tif (goalType == CELLTYPE.UNEXPLORED)\n\t\t\t\tCollections.shuffle(neighbors, new Random(System.currentTimeMillis()));\n\n\t\t\tfor (Cell neighbor : neighbors)\n\t\t\t\tif (!markedSet.contains(neighbor)) {\n\t\t\t\t\tmarkedSet.add(neighbor);\n\t\t\t\t\tqueue.add(neighbor);\n\t\t\t\t\tprev.put(neighbor, cell);\n\t\t\t\t}\n\t\t}\n\t\t// If reached here, goal type doesn't exist\n\t\treturn null;\n\t}", "public static void main(String[] args) {\n\t\tDeepFirstSearchGraph main = new DeepFirstSearchGraph();\n\t\tGraph g = main.new Graph(4);\n\t\tg.addEdge(0, 1);\n\t\tg.addEdge(0, 2);\n\t\tg.addEdge(1, 2);\n\t\tg.addEdge(2, 0);\n\t\tg.addEdge(2, 3);\n\t\tg.addEdge(3, 3);\n\t\t\n\t\tint vertexToBegin = 2;\n\t\tSystem.out.println(\"Doing DFS starting from vertex: \"+vertexToBegin);\n\t\tg.DFS(vertexToBegin);\n\t}", "public List<Node<E>> breadthFirst(Node<E> start){\n\n //set that will contain visited nodes\n HashSet<Node<E>> visited = new HashSet<>();\n\n // resulting nodes\n List<Node<E>> result = new ArrayList<>();\n\n //queue for traversal\n Queue<Node<E>> nodeList = new LinkedList<>();\n //check if the node exists in the graph\n\n if(start == null){\n throw new IllegalArgumentException(\"Node cannot be null\");\n }\n\n if(nodes.containsKey(start)){\n nodeList.add(start);\n visited.add(start);\n result.add(start);\n } else{\n throw new IllegalArgumentException(\"Node is not in the graph\");\n }\n\n //traverse through the queue\n while(!nodeList.isEmpty()){\n Node<E> curNode = nodeList.poll();\n\n //check if the node has been visited, if not add to the result\n if(!visited.contains(curNode)){\n result.add(curNode);\n }\n\n //add the node to visited\n visited.add(curNode);\n //get all the neighbors of the node and add to the queue\n nodes.get(curNode).forEach( neighbor -> {\n if(!visited.contains(neighbor)) {\n nodeList.add(neighbor);\n }\n });\n\n }\n\n return result;\n }", "private void awayFromCycle(Graph graph, Node a, Node b, Node c) {\n if ((graph.isAdjacentTo(a, c)) &&\n (graph.getEndpoint(a, c) == Endpoint.ARROW) &&\n (graph.getEndpoint(c, a) == Endpoint.CIRCLE)) {\n if (graph.isDirectedFromTo(a, b) && graph.isDirectedFromTo(b, c)) {\n graph.setEndpoint(c, a, Endpoint.TAIL);\n changeFlag = true;\n }\n }\n }", "private void awayFromColliderAncestorCycle(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n List<Node> adj = graph.getAdjacentNodes(B);\n\n if (adj.size() < 2) {\n continue;\n }\n\n ChoiceGenerator cg = new ChoiceGenerator(adj.size(), 2);\n int[] combination;\n\n while ((combination = cg.next()) != null) {\n Node A = adj.get(combination[0]);\n Node C = adj.get(combination[1]);\n\n //choice gen doesnt do diff orders, so must switch A & C around.\n// awayFromCollider(graph, A, B, C);\n// awayFromCollider(graph, C, B, A);\n// awayFromAncestor(graph, A, B, C);\n// awayFromAncestor(graph, C, B, A);\n// awayFromCycle(graph, A, B, C);\n// awayFromCycle(graph, C, B, A);\n ruleR1(A, B, C, graph);\n ruleR1(C, B, A, graph);\n ruleR2(A, B, C, graph);\n ruleR2(C, B, A, graph);\n\n }\n }\n }", "public List<List<Object>> getElementaryCycles()\n {\n this.cycles = new Vector<>();\n this.blocked = new boolean[this.adjList.length];\n this.B = new Vector[this.adjList.length];\n this.stack = new Vector<>();\n StrongConnectedComponents sccs = new StrongConnectedComponents(this.adjList);\n int s = 0;\n\n while (true) {\n SCCResult sccResult = sccs.getAdjacencyList(s);\n if (sccResult != null && sccResult.getAdjList() != null) {\n Vector[] scc = sccResult.getAdjList();\n s = sccResult.getLowestNodeId();\n for (int j = 0; j < scc.length; j++) {\n if ((scc[j] != null) && (scc[j].size() > 0)) {\n this.blocked[j] = false;\n this.B[j] = new Vector();\n }\n }\n\n this.findCycles(s, s, scc);\n s++;\n }\n else {\n break;\n }\n }\n\n return this.cycles;\n }", "private List<Pair<Integer, Integer>> getBestPath(Pair<Integer, Integer> curLocation, Pair<Integer, Integer> dest) {\n\t\tList<Pair<Integer, Integer>> path = new LinkedList<Pair<Integer, Integer>>();\n\t\t\n\t\t\n\t\tNode current = new Node(curLocation.getX(), curLocation.getY(), getHitProbability(curLocation.getX(), curLocation.getY()));\n\t\tNode target = new Node(dest.getX(), dest.getY(), getHitProbability(dest.getX(), dest.getY()));\n\t\tList<Node> openSet = new ArrayList<>();\n List<Node> closedSet = new ArrayList<>();\n \n \n while (true) {\n openSet.remove(current);\n List<Node> adjacent = getAdjacentNodes(current, closedSet, target);\n\n // Find the adjacent node with the lowest heuristic cost.\n for (Node neighbor : adjacent) {\n \tboolean inOpenset = false;\n \tList<Node> openSetCopy = new ArrayList<>(openSet);\n \tfor (Node node : openSetCopy) {\n \t\tif (neighbor.equals(node)) {\n \t\t\tinOpenset = true;\n \t\t\tif (neighbor.getAccumulatedCost() < node.getAccumulatedCost()) {\n \t\t\t\topenSet.remove(node);\n \t\t\t\topenSet.add(neighbor);\n \t\t\t}\n \t\t}\n \t}\n \t\n \tif (!inOpenset) {\n \t\topenSet.add(neighbor);\n \t}\n }\n\n // Exit search if done.\n if (openSet.isEmpty()) {\n System.out.printf(\"Target (%d, %d) is unreachable from position (%d, %d).\\n\",\n target.getX(), target.getY(), curLocation.getX(), curLocation.getY());\n return null;\n } else if (/*isAdjacent(current, target)*/ current.equals(target)) {\n break;\n }\n\n // This node has been explored now.\n closedSet.add(current);\n\n // Find the next open node with the lowest cost.\n Node next = openSet.get(0);\n for (Node node : openSet) {\n if (node.getCost(target) < next.getCost(target)) {\n next = node;\n }\n }\n// System.out.println(\"Moving to node: \" + current);\n current = next;\n }\n \n // Rebuild the path using the node parents\n path.add(new Pair<Integer, Integer>(curLocation.getX(), curLocation.getY()));\n while(current.getParent() != null) {\n \tcurrent = current.getParent();\n \tpath.add(0, new Pair<Integer, Integer>(current.getX(), current.getY()));\n }\n \n if (path.size() > 1) {\n \tpath.remove(0);\n }\n \n\t\treturn path;\n\t}", "public static void main(String[] args) {\nDGraph g=new DGraph();\r\nDirectedDFS d=new DirectedDFS(g);\r\nfor(Iterator<Integer> i=d.preorder.iterator();i.hasNext();)\r\n{\r\n\tSystem.out.print(i.next()+\" \");\r\n}\r\nSystem.out.println();\r\nfor(Iterator<Integer> i=d.postorder.iterator();i.hasNext();)\r\n{\r\n\tSystem.out.print(i.next()+\" \");\r\n}\r\nSystem.out.println();\r\n\r\n/*for(Iterator i=d.topologicalorder.iterator();i.hasNext();)\r\n{\r\n\tSystem.out.print(i.next()+\" \");\r\n}\r\nSystem.out.println();*/\r\n\r\n\r\n\tfor(int w:d.reversepost())\r\n\t\tSystem.out.print(w+\" \");\r\n\t//System.out.println(d.topologicalorder.pop());\r\n\t}", "public static void main(String args[]){\n NodeLoop A = new NodeLoop(\"A\");\n NodeLoop B = new NodeLoop(\"B\");\n NodeLoop C = new NodeLoop(\"C\");\n NodeLoop D = new NodeLoop(\"D\");\n NodeLoop E = new NodeLoop(\"E\");\n //A->B->C->D->E->C\n A.next = B;\n B.next = C;\n C.next = D;\n D.next = E;\n E.next = C;\n\n LoopDetection go = new LoopDetection();\n go.findLoop(A);\n\n }", "@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n public List<Edge<T>> viterbiPath() {\n final int numNodes = nodeList.size();\n double[] d_v = new double[numNodes];\n Arrays.fill(d_v, annihilator());\n d_v[ROOT_ID] = identity();\n Edge[] p_v = new Edge[numNodes]; \n \n // Forward pass\n for (int v = ROOT_ID+1; v < numNodes; ++v) {\n List<Edge<T>> edgeList = nodeList.get(v).backwardStar();\n for (Edge<T> edge : edgeList) {\n int u = edge.start().id();\n double bestCost = d_v[v];\n double transitionCost = score(d_v[u], edge.weight());\n if (compare(bestCost, transitionCost) == transitionCost) {\n // Do an update to the best cost\n d_v[v] = transitionCost;\n p_v[v] = edge;\n }\n }\n }\n \n // Backout the solution\n List<Edge<T>> bestPath = new LinkedList<Edge<T>>();\n Edge<T> bestEdge = p_v[numNodes-1];\n bestEdge = p_v[bestEdge.start().id()]; // Skip the goal node\n while(bestEdge.start().id() != ROOT_ID) {\n bestPath.add(0, bestEdge); // O(c) pre-pend\n bestEdge = p_v[bestEdge.start().id()];\n }\n\n return bestPath;\n }", "private void findDetectivePath() {\n Cell current, next;\n detectivePath = new ArrayDeque<>();\n clearVisitedMarks();\n current = detective;\n current.visited = true;\n\n while (true) {\n next = nextNotVisitedCell(current);\n if (next == killer) {\n detectivePath.addLast(current);\n detectivePath.addLast(next);\n break;\n } else if (next != null) {\n detectivePath.addLast(current);\n current = next;\n current.visited = true;\n } else {\n current = detectivePath.pollLast();\n }\n }\n detectivePath.pollFirst();\n }", "int main()\n{\n // Create a graph given in the above diagram\n Graph g(4);\n g.addEdge(0, 1);\n g.addEdge(0, 2);\n g.addEdge(1, 2);\n g.addEdge(2, 0);\n g.addEdge(2, 3);\n g.addEdge(3, 3);\n \n cout << \"Following is Breadth First Traversal \"\n << \"(starting from vertex 2) n\";\n g.BFS(2);\n \n return 0;\n}", "private int BFS() {\n adjList.cleanNodeFields();\n\n //Queue for storing current shortest path\n Queue<Node<Integer, Integer>> q = new LinkedList<>();\n\n //Set source node value to 0\n q.add(adjList.getNode(startNode));\n q.peek().key = 0;\n q.peek().d = 0;\n q.peek().visited = true;\n\n //Helper variables\n LinkedList<Pair<Node<Integer, Integer>, Integer>> neighbors;//Array of pairs <neighborKey, edgeWeight>\n Node<Integer, Integer> neighbor, u;\n long speed = (long) (cellSideLength * 1.20);\n\n while (!isCancelled() && q.size() != 0) {\n u = q.poll();\n\n //Marks node as checked\n checkedNodesGC.fillRect((u.value >> 16) * cellSideLength + 0.5f,\n (u.value & 0x0000FFFF) * cellSideLength + 0.5f,\n (int) cellSideLength - 1, (int) cellSideLength - 1);\n\n //endNode found\n if (u.value == endNode) {\n //Draws shortest path\n Node<Integer, Integer> current = u, prev = u;\n\n while ((current = current.prev) != null) {\n shortestPathGC.strokeLine((prev.value >> 16) * cellSideLength + cellSideLength / 2,\n (prev.value & 0x0000FFFF) * cellSideLength + cellSideLength / 2,\n (current.value >> 16) * cellSideLength + cellSideLength / 2,\n (current.value & 0x0000FFFF) * cellSideLength + cellSideLength / 2);\n prev = current;\n }\n return u.d;\n }\n\n //Wait after checking node\n try {\n Thread.sleep(speed);\n } catch (InterruptedException interrupted) {\n if (isCancelled())\n break;\n }\n\n //Checking Neighbors\n neighbors = adjList.getNeighbors(u.value);\n for (Pair<Node<Integer, Integer>, Integer> neighborKeyValuePair : neighbors) {\n neighbor = neighborKeyValuePair.getKey();\n //Relaxation step\n //Checks if neighbor hasn't been checked, if so the assign the shortest path\n if (!neighbor.visited) {\n //Adds checked neighbor to queue\n neighbor.key = u.d + 1;\n neighbor.d = u.d + 1; //Assign shorter path found to neighbor\n neighbor.prev = u;\n neighbor.visited = true;\n q.add(neighbor);\n }\n }\n }\n return Integer.MAX_VALUE;\n }", "public int breadthFirstSearch(T srcId, T destId)\n {\n if (nodeList.isEmpty())\n {\n System.out.println(\"Empty graph\");\n return -1;\n }\n \n // queue used during the traversal\n LinkedList<QueueNode> queue = new LinkedList();\n \n // keeps track of node which are visited and added into the queue\n HashMap<T, Integer> visited = new HashMap();\n \n // find srcNode with id = srcId in graph\n GraphNode srcNode = nodeList.get(srcId);\n \n // if srcNode is not there in graph, breadth first traversal which starts at srcNode cannot be done \n if (srcNode == null)\n {\n System.out.println(\"Source vertex not found\");\n return -1;\n }\n \n int minNumberTrials = -1;\n \n // add srcNode in queue, mark it as visited\n queue.add(new QueueNode(srcNode, 0));\n visited.put(srcNode.nodeId, 1);\n \n while (!queue.isEmpty())\n {\n QueueNode currentNode = queue.remove();\n \n // if destination node found\n if (currentNode.graphNode.nodeId == destId)\n {\n minNumberTrials = currentNode.level;\n break;\n }\n \n // first neighbor of current graph node\n GraphNode neighbor = currentNode.graphNode.next;\n \n // add all neighbors of current graph node into the queue\n while (neighbor != null)\n {\n // if this neighbor is not visited earlier, mark it as visited\n // add it to the queue at appropriate level\n if (visited.get(neighbor.nodeId) == null)\n {\n visited.put(neighbor.nodeId, 1);\n queue.add(new QueueNode(findGraphNode(neighbor.nodeId), currentNode.level + 1));\n }\n neighbor = neighbor.next; \n }\n }\n \n return minNumberTrials;\n }", "Cycle getOptimalCycle(Graph<L, T> graph);", "void BFS(int s)\n {\n /* List of visited vertices; all false in the beginning) */\n boolean visited[] = new boolean[V];\n\n /* Queue data structure is used for BFS */\n LinkedList<Integer> queue = new LinkedList<>();\n\n /* Mark starting node s as visited and enqueue it */\n visited[s]=true;\n queue.add(s);\n\n /* Until queue is empty, dequeue a single node in queue and look for it's neighboring vertices.\n * If an adjecent node hasn't been visited yet, set it as visited and enqueue this node. s*/\n while (queue.size() != 0)\n {\n /* Dequeue */\n s = queue.poll();\n System.out.print( s + \" \");\n\n /* Get all adjacent vertices */\n Iterator<Integer> i = adj[s].listIterator();\n while (i.hasNext())\n {\n int n = i.next();\n if (!visited[n])\n {\n visited[n] = true;\n queue.add(n);\n }\n }\n }\n }", "private PathCostFlow findCheapestPath(int start, int end, double max_flow) throws Exception {\n if (getNode(start) == null || getNode(end) == null\n || !getNode(start).isSource() || getNode(end).isSource()) {\n throw new IllegalArgumentException(\"start must be the index of a source and end must be the index of a sink\");\n }\n double amount = Math.min(Math.min(getNode(start).getResidualCapacity(),\n getNode(end).getResidualCapacity()), max_flow);\n\n boolean[] visited = new boolean[n];\n int[] parent = new int[n];\n for (int i = 0; i < n; i++) {\n parent[i] = -1;\n }\n double[] cost = new double[n];\n for (int i = 0; i < n; i++) {\n cost[i] = Integer.MAX_VALUE;\n }\n cost[start] = 0;\n\n PriorityQueue<IndexCostTuple> queue = new PriorityQueue<IndexCostTuple>();\n queue.add(new IndexCostTuple(start, 0));\n\n while (!queue.isEmpty()) {\n IndexCostTuple current = queue.poll();\n\n // we found the target node\n if (current.getIndex() == end) {\n ArrayList<Integer> path = new ArrayList<Integer>();\n path.add(new Integer(end));\n while (path.get(path.size() - 1) != start) {\n path.add(parent[path.get(path.size() - 1)]);\n }\n Collections.reverse(path);\n if ((path.get(0) != start) || (path.get(path.size() - 1) != end)) {\n throw new Exception(\"I fucked up coding Dijkstra's\");\n }\n return new PathCostFlow(path, cost[end], amount);\n }\n\n // iterate through all possible neighbors of the current node\n for (int i = 0; i < n; i++) {\n SingleEdge e = matrix[current.getIndex()][i];\n if ((!visited[i]) && (e != null)\n && (current.getCost() + e.getCost(amount) < cost[i])) {\n cost[i] = current.getCost() + e.getCost(amount);\n parent[i] = current.getIndex();\n\n // update the entry for this node in the queue\n IndexCostTuple newCost = new IndexCostTuple(i, cost[i]);\n queue.remove(newCost);\n queue.add(newCost);\n }\n }\n visited[current.getIndex()] = true;\n }\n\n return null; //the target node was unreachable\n }", "public String breadthFirstSearch( AnyType start_vertex ) throws VertexException {\n \n StringBuffer buffer = new StringBuffer();\n \n // ----------------------------\n // TODO: Add your code here\n // ----------------------------\n boolean exists = false;\n Vertex<AnyType> S = new Vertex<AnyType>(start_vertex);\n int counter = 1;\n //make new vertex to check if its in list\n //make queue to hold vertices\n SemiConstantTimeQueue<Vertex<AnyType>> queue = new SemiConstantTimeQueue<Vertex<AnyType>>();\n //loop through and set not visited\n for( int i = 0; i < vertex_adjacency_list.size(); i++){\n vertex_adjacency_list.get(i).setVisited(-1);\n //if it's in list then set exists to true\n //and set visited \n if(vertex_adjacency_list.get(i).compareTo(S) == 0){\n exists = true;\n vertex_adjacency_list.get(i).setVisited(counter);\n counter = i;\n }\n } \n //if doesn't exist then throw the exception\n if(exists == false){\n throw new VertexException(\"Start Vertex does not exist\");\n }\n //make new queue\n queue.add(vertex_adjacency_list.get(counter));\n vertex_adjacency_list.get(counter).setVisited(1);\n counter = 1;\n int k=0;\n Vertex<AnyType>e;\n //while the queue isn't empty\n while(queue.peek() !=null){\n //make e the top of the queue \n e = queue.peek(); \n //go through the list and if you reach the begining it exits loop\n for( k = 0; k < vertex_adjacency_list.size()-1; k++){\n if(vertex_adjacency_list.get(k).compareTo(e)==0){\n break;\n }\n } \n //go through loop and check if visited, if not then add it to queue, set visited\n for( int j = 0; j< vertex_adjacency_list.get(k).numberOfAdjacentVertices(); j++){\n if(vertex_adjacency_list.get(k).getAdjacentVertex(j).hasBeenVisited()==false){\n counter++;\n queue.add(vertex_adjacency_list.get(k).getAdjacentVertex(j));\n vertex_adjacency_list.get(k).getAdjacentVertex(j).setVisited(counter);\n }\n }\n //remove from queue when through loop once\n k++;\n queue.remove();\n }\n //loop through list and print vertex and when it was visited\n for(int o = 0; o< vertex_adjacency_list.size(); o++){\n buffer.append(vertex_adjacency_list.get(o) + \":\" + vertex_adjacency_list.get(o).getVisited()+ \"\\n\");\n }\n return buffer.toString();\n }", "public void dfs(Vertex<T> start) {\n\t\t\t// DFS uses Stack data structure\n\t\t\tStack<Vertex<T>> stack = new Stack<Vertex<T>>();\n\t\t\tstart.visited = true;\n\t\t\tstack.push(start);\n\t\t\tprintNode(start);\n\t\t\twhile (!stack.isEmpty()) {\n\t\t\t\tVertex<T> n = stack.peek();\n\t\t\t\tVertex<T> child = getUnvisitedChildren(n);\n\t\t\t\tif (child != null) {\n\t\t\t\t\tchild.visited = true;\n\t\t\t\t\tstack.push(child);\n\t\t\t\t\tprintNode(child);\n\t\t\t\t} else {\n\t\t\t\t\tstack.pop();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public static void depthFirstSearchIterative(ArrayList<Node> graph) {\n\t\tSystem.out.println(\"DFS Iterative:\");\n\t\tif(graph.size() == 0) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tGraphUtils.cleanGraph(graph);\n\n\t\tDeque<Node> stack = new ArrayDeque<Node>();\n\t\tfor(Node node : graph) {\n\t\t\tif(node.state != Node.State.UNDISCOVERED) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tnode.state = Node.State.DISCOVERED;\n\t\t\tstack.push(node);\n\t\t\twhile(!stack.isEmpty()) {\n\t\t\t\tnode = stack.pop();\n\t\t\t\t\n\t\t\t\t//process node\n\t\t\t\tSystem.out.print(node.name + \" -> \");\n\t\t\t\t\n\t\t\t\tfor(Edge e : node.edges) {\n\t\t\t\t\t//process edge\n\t\t\t\t\tNode neighbor = e.getNeighbor(node);\n\t\t\t\t\t\n\t\t\t\t\t//first time we see this node it gets added to the stack for later processing\n\t\t\t\t\tif(neighbor.state == Node.State.UNDISCOVERED) {\n\t\t\t\t\t\tneighbor.state = Node.State.DISCOVERED;\n\t\t\t\t\t\tstack.push(neighbor);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//finished with this node\n\t\t\t\tnode.state = Node.State.COMPLETE;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tGraphUtils.cleanGraph(graph);\n\t}", "static void dfs(int node) {\n for (int adj : adjList[node]) {\n if (adj != firstParents[node]) {\n firstParents[adj] = node;\n depth[adj] = depth[node] + 1;\n maxDepth = Math.max(maxDepth, depth[adj]);\n dfs(adj);\n }\n }\n }", "public void fordFulkerson() {\r\n\r\n\r\n\t\twhile(true) {\r\n\t\t\tResidualGraph resGraph = new ResidualGraph(net);\r\n\t\t\tLinkedList<Edge> augmentingPath = resGraph.findAugmentingPath();\r\n\t\t\tif(augmentingPath.isEmpty()) {\r\n\t\t\t\tbreak; // found the max flow\r\n\t\t\t} else {\r\n\t\t\t\t// Find the minimum capacity\r\n\t\t\t\tint minCap = Integer.MAX_VALUE;\r\n\t\t\t\tfor (Edge e : augmentingPath) {\r\n\t\t\t\t\tif (e.getCap() < minCap) minCap = e.getCap();\r\n\t\t\t\t}\r\n\t\t\t\t// Edit the path according to what we've found in the augmenting path\r\n\t\t\t\tfor (Edge e : augmentingPath) {\r\n\t\t\t\t\t// if e is a forward edge:\r\n\t\t\t\t\tVertex source = e.getSourceVertex();\r\n\t\t\t\t\tVertex target = e.getTargetVertex();\r\n\t\t\t\t\tEdge originalEdge = net.getAdjMatrixEntry(source, target);\r\n\t\t\t\t\tif (net.getAdjList(source).contains(target) && originalEdge.getFlow() + minCap <= originalEdge.getCap()) {\r\n\t\t\t\t\t\toriginalEdge.setFlow(originalEdge.getFlow() + minCap);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\toriginalEdge = net.getAdjMatrixEntry(target, source);\r\n\t\t\t\t\t\toriginalEdge.setFlow(net.getAdjMatrixEntry(target, source).getFlow() - minCap);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tnet.printFlow();\r\n\t\t}\r\n\t}", "private boolean findCycles(int v, int s, Vector<Integer>[] adjList)\n {\n boolean f = false;\n this.stack.add(v);\n this.blocked[v] = true;\n\n for (int i = 0; i < adjList[v].size(); i++) {\n int w = adjList[v].get(i);\n // found cycle\n if (w == s) {\n Vector cycle = new Vector();\n for (int j = 0; j < this.stack.size(); j++) {\n int index = this.stack.get(j).intValue();\n cycle.add(this.graphNodes[index]);\n }\n this.cycles.add(cycle);\n\n\n // we hard-limit the cycle number to 10k!!\n if (this.cycles.size() > 10000) {\n break;\n }\n\n f = true;\n }\n else if (!this.blocked[w]) {\n if (this.findCycles(w, s, adjList)) {\n f = true;\n }\n }\n }\n\n if (f) {\n this.unblock(v);\n }\n else {\n for (int i = 0; i < adjList[v].size(); i++) {\n int w = ((Integer) adjList[v].get(i)).intValue();\n if (!this.B[w].contains(new Integer(v))) {\n this.B[w].add(new Integer(v));\n }\n }\n }\n\n this.stack.remove(new Integer(v));\n return f;\n }", "public static int QTDelHeuristic1 (Graph<Integer,String> h) {\n\t\tint count = 0;\r\n\t\tboolean isQT = false;\r\n\t\t//h = Copy(g);\r\n\t\t//boolean moreToDo = true;\r\n\t\t\r\n\t\tIterator<Integer> a;\r\n\t\tIterator<Integer> b;\r\n\t\tIterator<Integer> c;\r\n\t\tIterator<Integer> d;\r\n\r\n\t\twhile (isQT == false) {\r\n\t\t\tisQT = true;\r\n\t\t\ta= h.getVertices().iterator();\r\n\t\t\twhile(a.hasNext()){\r\n\t\t\t\tInteger A = a.next();\r\n\t\t\t\t//System.out.print(\"\"+A+\" \");\r\n\t\t\t\tb = h.getNeighbors(A).iterator();\r\n\t\t\t\twhile(b.hasNext()){\r\n\t\t\t\t\tInteger B = b.next();\r\n\t\t\t\t\tc = h.getNeighbors(B).iterator();\r\n\t\t\t\t\twhile (c.hasNext()){\r\n\t\t\t\t\t\tInteger C = c.next();\r\n\t\t\t\t\t\tif (h.isNeighbor(C, A) || C==A) continue;\r\n\t\t\t\t\t\td = h.getNeighbors(C).iterator();\r\n\t\t\t\t\t\twhile (d.hasNext()){\r\n\t\t\t\t\t\t\tInteger D = d.next();\r\n\t\t\t\t\t\t\tif (D==B) continue; \r\n\t\t\t\t\t\t\tif (h.isNeighbor(D,B)) continue;\r\n\t\t\t\t\t\t\t//otherwise, we have a P4 or a C4\r\n\r\n\t\t\t\t\t\t\tisQT = false;\r\n\t\t\t\t\t\t\t//System.out.print(\"Found P4: \"+A+\"-\"+B+\"-\"+C+\"-\"+D+\"... not a cograph\\n\");\r\n\r\n\t\t\t\t\t\t\tif (h.isNeighbor(D,A)) {\r\n\t\t\t\t\t\t\t\t// we have a C4 = a-b-c-d-a\r\n\t\t\t\t\t\t\t\t// requires 2 deletions\r\n\t\t\t\t\t\t\t\tcount += 2;\r\n\t\t\t\t\t\t\t\th.removeVertex(A);\r\n\t\t\t\t\t\t\t\th.removeVertex(B);\r\n\t\t\t\t\t\t\t\th.removeVertex(C);\r\n\t\t\t\t\t\t\t\th.removeVertex(D);\r\n\t\t\t\t\t\t\t\treturn 2 + QTDelHeuristic1(h);\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t// this case says:\r\n\t\t\t\t\t\t\t\t// else D is NOT adjacent to A. Then we have P4=abcd\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tcount += 1;\r\n\t\t\t\t\t\t\t\th.removeVertex(A);\r\n\t\t\t\t\t\t\t\th.removeVertex(B);\r\n\t\t\t\t\t\t\t\th.removeVertex(C);\r\n\t\t\t\t\t\t\t\th.removeVertex(D);\r\n\t\t\t\t\t\t\t\treturn 1 + QTDelHeuristic1(h);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t} // end d.hasNext()\r\n\t\t\t\t} // end c.hasNext()\r\n\t\t\t} // end b.hasNext() \r\n\t\t} // end a.hasNext()\r\n\t\t\r\n\t\treturn count;\t\t\r\n\t}", "public State hillClimbing(){\r\n\t\tState currentState = start;\r\n\t\t\r\n\t\twhile(true){\r\n\t\t\tArrayList<State> successors = currentState.generateNeighbours(currentState);\r\n\t\t\tStatesGenerated= StatesGenerated + successors.size();\r\n\t\t\t\r\n\t\t\tState nextState = null;\r\n\t\t\t\r\n\t\t\tfor(int i=0; i<successors.size(); i++){\r\n\t\t\t\tif(successors.get(i).compareTo(currentState) < 0){\r\n\t\t\t\t\tnextState = successors.get(i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(nextState==null)\r\n\t\t\t\treturn currentState;\r\n\t\t\t\r\n\t\t\tcurrentState = nextState;\r\n\t\t}\r\n\t}", "public List<GeographicPoint> bfs(GeographicPoint start, \n\t\t\t \t\t\t\t\t GeographicPoint goal, Consumer<GeographicPoint> nodeSearched)\n\t{\n\t\t// TODO: Implement this method in WEEK 3\n\t\t\n\t\t// Hook for visualization. See writeup.\n\t\t//nodeSearched.accept(next.getLocation());\n\t\t\n\t\tSet<GeographicPoint> visited = new HashSet<GeographicPoint>();\n\t\tList<GeographicPoint> queue = new ArrayList<GeographicPoint>();\n\t\tHashMap<GeographicPoint, List<GeographicPoint>> prev = new HashMap<GeographicPoint, List<GeographicPoint>>();\n\t\t\n\t\tfor (GeographicPoint temp : map.keySet())\n\t\t\tprev.put(temp, new ArrayList<GeographicPoint>());\n\t\t\n\t\tif (!map.containsKey(start) || !map.containsKey(goal)) \n\t\t\treturn null;\n\t\t\n\t\tqueue.add(start);\n\t\twhile (!queue.isEmpty() && !visited.contains(goal)) {\n\t\t\t\n\t\t\tGeographicPoint currPoint = queue.get(0);\n\t\t\tMapNode currNode = map.get(currPoint);\n\t\t\tnodeSearched.accept(currPoint);\n\t\t\t\n\t\t\tqueue.remove(0);\n\t\t\tHashMap<MapEdge, GeographicPoint> neighbours = currNode.getNeighbours();\n\t\t\tfor (GeographicPoint n : neighbours.values()) {\n\t\t\t\tif (n.equals(start))\n\t\t\t\t\tcontinue;\n\t\t\t\tif (!visited.contains(n)) {\n\t\t\t\t\tqueue.add(n);\n\t\t\t\t\tvisited.add(n);\n\t\t\t\t\tprev.get(n).add(currPoint);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn backTrack(prev, goal);\n\t}", "private int d(amj paramamj)\r\n/* 50: */ {\r\n/* 51: 70 */ for (int i = 0; i < this.a.length; i++) {\r\n/* 52: 71 */ if ((this.a[i] != null) && (this.a[i].b() == paramamj.b()) && (this.a[i].d()) && (this.a[i].b < this.a[i].c()) && (this.a[i].b < p_()) && ((!this.a[i].f()) || (this.a[i].i() == paramamj.i())) && (amj.a(this.a[i], paramamj))) {\r\n/* 53: 72 */ return i;\r\n/* 54: */ }\r\n/* 55: */ }\r\n/* 56: 75 */ return -1;\r\n/* 57: */ }", "private void depthFirstSearch(Slot start, ArrayList<Pair<Slot, Slot>> moves, HashMap<Slot, Slot> parents) {\n boolean[][] visitedSlots = new boolean[Board.MAX_ROW][Board.MAX_COLUMN];\n\n setSlotsAsNotVisited(visitedSlots);\n\n Stack<Slot> dfsStack = new Stack<>();\n int color = start.getColor();\n\n dfsStack.push(start);\n Slot previous = start;\n\n boardObject.setSlotColor(boardObject.getSlot(start.getRow(), start.getColumn()), Slot.EMPTY);\n\n while (!dfsStack.empty()) {\n Pair<Slot, Slot> next;\n Slot current = dfsStack.pop();\n\n if (!visitedSlots[current.getRow()][current.getColumn()] && !current.equals(previous)) {\n if (!current.equals(start)) {\n visitedSlots[current.getRow()][current.getColumn()] = true;\n }\n\n next = new Pair<>(start, current);\n\n moves.add(next);\n }\n\n Slot up = getUp(current);\n Slot down = getDown(current);\n Slot left = getLeft(current);\n Slot right = getRight(current);\n\n if (left != null && !visitedSlots[left.getRow()][left.getColumn()]) {\n if (!isChild(current, left, parents)) {\n dfsStack.push(left);\n parents.put(left, current);\n }\n }\n\n if (down != null && !visitedSlots[down.getRow()][down.getColumn()]) {\n if (!isChild(current, down, parents)) {\n dfsStack.push(down);\n parents.put(down, current);\n }\n }\n\n if (right != null && !visitedSlots[right.getRow()][right.getColumn()]) {\n if (!isChild(current, right, parents)) {\n dfsStack.push(right);\n parents.put(right, current);\n }\n }\n\n if (up != null && !visitedSlots[up.getRow()][up.getColumn()]) {\n if (!isChild(current, up, parents)) {\n dfsStack.push(up);\n parents.put(up, current);\n }\n }\n\n previous = current;\n }\n\n boardObject.setSlotColor(boardObject.getSlot(start.getRow(), start.getColumn()), color);\n }", "private void depthFirstSearch(DirectedGraph graph, int vertex) {\r\n \r\n visited[vertex] = true;\r\n inRecursionStack[vertex] = true;\r\n \r\n for(int adjacentVertex: graph.adjacentVertices(vertex)) {\r\n if(inRecursionStack[adjacentVertex]) {\r\n throw new IllegalArgumentException(String.format(\"Graph contains a cycle: no topological sort possible: %s -> %s\", vertex, adjacentVertex));\r\n }\r\n \r\n if(!visited[adjacentVertex]) {\r\n depthFirstSearch(graph, adjacentVertex);\r\n }\r\n }\r\n\r\n reversePostOrder.push(vertex); \r\n inRecursionStack[vertex] = false;\r\n }", "public HashMap<Intersection,Segment> dijkstra(Intersection startIntersection){\n HashMap<Intersection,Double> d = new HashMap<>();\n HashMap<Intersection,Segment> pi = new HashMap<>();\n ArrayList<Intersection> blanc= new ArrayList<>(),noir = new ArrayList<>();\n PriorityQueue<Intersection> gris = new PriorityQueue<>(Comparator.comparingDouble(d::get));\n graphe.forEach((i, dest) -> {\n if(i.equals(startIntersection)){\n d.put(startIntersection,0.0);\n }else {\n d.put(i, Double.MAX_VALUE);\n }\n pi.put(i,null);\n blanc.add(i);\n });\n gris.add(startIntersection);\n while (!gris.isEmpty()){\n Intersection minimalSuccessor = gris.peek();\n LinkedList<Segment> destinations = graphe.get(minimalSuccessor);\n destinations.forEach((segment)->{\n Intersection successor = segment.getDestination();\n if((blanc.contains(successor)) || (gris.contains(successor))){\n if(d.get(successor) > d.get(minimalSuccessor) + segment.getLength()){\n d.put(successor, d.get(minimalSuccessor) + segment.getLength());\n pi.replace(successor, segment);\n }\n }\n if(blanc.contains(successor)){\n gris.add(successor);\n blanc.remove(successor);\n }\n });\n noir.add(minimalSuccessor);\n gris.remove(minimalSuccessor);\n }\n return pi;\n }", "public void bfs(GraphNode source)\n {\n Queue<GraphNode> q = new ArrayDeque<>();\n q.add(source);\n HashMap<GraphNode,Boolean> visit =\n new HashMap<GraphNode,Boolean>();\n visit.put(source,true);\n while (!q.isEmpty())\n {\n GraphNode u = q.poll();\n System.out.println(\"Value of Node \" + u.val);\n System.out.println(\"Address of Node \" + u);\n if (u.neighbours != null)\n {\n List<GraphNode> v = u.neighbours;\n for (GraphNode g : v)\n {\n if (visit.get(g) == null)\n {\n q.add(g);\n visit.put(g,true);\n }\n }\n }\n }\n System.out.println();\n }", "public static void botched_dfs3(Graph g, int s) {\n int cpt = 0;\n\n Stack<Integer> stack = new Stack<Integer>();\n boolean visited[] = new boolean[g.vertices()];\n stack.push(s);\n while (!stack.empty()) {\n System.out.println(\"Capacité : \" + stack.capacity());\n int u = stack.pop();\n if (!visited[u]) {\n visited[u] = true;\n System.out.println(u);\n for (Edge e : g.next(u))\n if (!visited[e.to]) {\n stack.push(e.to);\n cpt++;\n }\n }\n }\n }" ]
[ "0.5986866", "0.5586553", "0.5456336", "0.53782773", "0.5350011", "0.5285343", "0.52395946", "0.5228327", "0.5202633", "0.5190836", "0.5171084", "0.5158762", "0.5158067", "0.5136667", "0.5056458", "0.5042463", "0.5035146", "0.50312567", "0.5030197", "0.5026179", "0.50111246", "0.49996132", "0.49840367", "0.4964809", "0.4962302", "0.49594522", "0.49544895", "0.49526313", "0.4938428", "0.49263427", "0.49227262", "0.49209443", "0.49187917", "0.49124932", "0.49057388", "0.48990065", "0.48962182", "0.48917136", "0.48887092", "0.48755157", "0.4866196", "0.4865751", "0.48594183", "0.48583627", "0.4844506", "0.48436123", "0.4843195", "0.48380625", "0.48358205", "0.4829995", "0.48295304", "0.4811942", "0.48115364", "0.48098314", "0.4808043", "0.4807065", "0.48065326", "0.4776436", "0.4775621", "0.47749025", "0.47637025", "0.47617295", "0.4761444", "0.47609723", "0.47562343", "0.47538522", "0.47342524", "0.47267854", "0.47156158", "0.47149792", "0.47075698", "0.47061834", "0.4704638", "0.46984184", "0.46962357", "0.46819794", "0.46764287", "0.4672707", "0.46726403", "0.46718293", "0.46664175", "0.46644962", "0.46644846", "0.46585542", "0.46539372", "0.46445468", "0.46371382", "0.46327034", "0.4626079", "0.4619031", "0.4618472", "0.4612996", "0.46096683", "0.46061847", "0.4605507", "0.46043953", "0.46042833", "0.46041608", "0.45945448", "0.4591095", "0.45904988" ]
0.0
-1
Orients the edges inside the definte discriminating path triangle. Takes the left endpoint, and a,b,c as arguments.
private void doDdpOrientation(Graph graph, Node l, Node a, Node b, Node c) { changeFlag = true; for (IonIndependenceFacts iif : separations) { if ((iif.getX().equals(l) && iif.getY().equals(c)) || iif.getY().equals(l) && iif.getX().equals(c)) { for (List<Node> condSet : iif.getZ()) { if (condSet.contains(b)) { graph.setEndpoint(c, b, Endpoint.TAIL); discrimGraphs.add(graph); return; } } break; } } Graph newGraph1 = new EdgeListGraph(graph); newGraph1.setEndpoint(a, b, Endpoint.ARROW); newGraph1.setEndpoint(c, b, Endpoint.ARROW); discrimGraphs.add(newGraph1); Graph newGraph2 = new EdgeListGraph(graph); newGraph2.setEndpoint(c, b, Endpoint.TAIL); discrimGraphs.add(newGraph2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\r\n void create_edge_between_null_vertexes() {\r\n graph.addEdge(null, \"B\");\r\n graph.addEdge(\"A\", null);\r\n graph.addEdge(null, null);\r\n vertices = graph.getAllVertices();\r\n List<String> adjacentA = graph.getAdjacentVerticesOf(\"A\");\r\n List<String> adjacentB = graph.getAdjacentVerticesOf(\"B\");\r\n if(!vertices.isEmpty() | !adjacentA.isEmpty() | !adjacentB.isEmpty()) {\r\n fail();\r\n } \r\n }", "public void crossEdge(Edge e) {}", "private void ruleR1(Node a, Node b, Node c, Graph graph) {\n if (graph.isAdjacentTo(a, c)) {\n return;\n }\n\n if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, b, c)) {\n return;\n }\n\n graph.setEndpoint(c, b, Endpoint.TAIL);\n graph.setEndpoint(b, c, Endpoint.ARROW);\n }\n }", "private void createFloor2Connections(IndoorVertex stairs, IndoorVertex elevator)\n {\n armesConnectionNorth = new IndoorVertex(building, new XYPos(1000, 151.19), 2);\n armesConnectionSouth = new IndoorVertex(building, new XYPos(1000, 158.75), 2);\n IndoorVertex rm239_fac_science = new IndoorVertex(building, new XYPos(1030.24, 97.11), 2);\n IndoorVertex _30_151 = new IndoorVertex(building, new XYPos(1030.24, 151.19), 2);\n IndoorVertex _30_179 = new IndoorVertex(building, new XYPos(1030.24, 179.65), 2);\n exit = new IndoorVertex(building, new XYPos(1030.24, 188.41), 2);\n IndoorVertex rm211_library = new IndoorVertex(building, new XYPos(1080.25, 173.29), 2);\n IndoorVertex _44_160 = new IndoorVertex(building, new XYPos(1044.19, 160.49), 2);\n IndoorVertex _44_173 = new IndoorVertex(building, new XYPos(1044.19, 173.29), 2);\n IndoorVertex _30_173 = new IndoorVertex(building, new XYPos(1030.24, 173.29), 2);\n IndoorVertex _30_158 = new IndoorVertex(building, new XYPos(1030.24, 158.75), 2);\n IndoorVertex _44_154 = new IndoorVertex(building, new XYPos(1044.19, 154.1), 2);\n IndoorVertex _30_154 = new IndoorVertex(building, new XYPos(1030.24, 154.1), 2);\n\n //Rooms\n ArrayList<IndoorVertex> rm211 = new ArrayList<>();\n rm211.add(rm211_library);\n\n rooms.put(\"211\", rm211);\n\n ArrayList<IndoorVertex> rm239 = new ArrayList<>();\n rm239.add(rm239_fac_science);\n\n rooms.put(\"239\", rm239);\n\n //Connections to other points\n connectVertex(armesConnectionSouth, _30_158);\n connectVertex(armesConnectionNorth, _30_151);\n connectVertex(_30_151, rm239_fac_science);\n connectVertex(_30_151, _30_154);\n connectVertex(_30_154, _44_154);\n connectVertex(_30_154, _30_158);\n connectVertex(_30_158, _44_154);\n connectVertex(_30_158, _44_160);\n connectVertex(_30_158, _30_173);\n connectVertex(_30_173, _44_173);\n connectVertex(_30_173, _30_179);\n connectVertex(_30_179, exit);\n connectVertex(_44_154, elevator);\n connectVertex(_44_154, _44_160);\n connectVertex(_44_160, stairs);\n connectVertex(_44_160, _44_173);\n connectVertex(_44_173, rm211_library);\n\n }", "private void ruleR2(Node a, Node b, Node c, Graph graph) {\n if (!graph.isAdjacentTo(a, c)) {\n return;\n }\n\n if (graph.getEndpoint(b, a) == Endpoint.TAIL && graph.getEndpoint(a, b) == Endpoint.ARROW\n && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, a, c)) {\n return;\n }\n\n graph.setEndpoint(a, c, Endpoint.ARROW);\n } else if (graph.getEndpoint(a, b) == Endpoint.ARROW && graph.getEndpoint(c, b) == Endpoint.TAIL\n && graph.getEndpoint(b, c) == Endpoint.ARROW && graph.getEndpoint(a, c) == Endpoint.CIRCLE\n ) {\n if (!isArrowpointAllowed(graph, a, c)) {\n return;\n }\n\n graph.setEndpoint(a, c, Endpoint.ARROW);\n }\n }", "public static void main(String[] args) {\n\t\t\n\t\tint edgeA = 60;\n\t\tint edgeB = 50;\n\t\tint edgeC = 45;\n\n\t\tboolean triangle = ((edgeA + edgeB) > edgeC && (edgeA + edgeC) > edgeB && (edgeB + edgeC) > edgeA);\n\t\t/*\n\t\t * To create a triangle, main condition is that sum of every two edges is\n\t\t * greater than third edge\n\t\t */\n\n\t\tSystem.out.println(\"Triangle? \" + triangle);\n\t}", "private void doubleTriangle(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node B : nodes) {\n\n List<Node> intoBArrows = graph.getNodesInTo(B, Endpoint.ARROW);\n List<Node> intoBCircles = graph.getNodesInTo(B, Endpoint.CIRCLE);\n\n //possible A's and C's are those with arrows into B\n List<Node> possA = new LinkedList<>(intoBArrows);\n List<Node> possC = new LinkedList<>(intoBArrows);\n\n //possible D's are those with circles into B\n for (Node D : intoBCircles) {\n for (Node A : possA) {\n for (Node C : possC) {\n if (C == A) {\n continue;\n }\n\n //skip anything not a double triangle\n if (!graph.isAdjacentTo(A, D) ||\n !graph.isAdjacentTo(C, D)) {\n continue;\n }\n\n //skip if A,D,C is a collider\n if (graph.isDefCollider(A, D, C)) {\n continue;\n }\n\n //if all of the previous tests pass, orient D*-oB as D*->B\n if (!isArrowpointAllowed(graph, D, B)) {\n continue;\n }\n\n graph.setEndpoint(D, B, Endpoint.ARROW);\n changeFlag = true;\n }\n }\n }\n }\n }", "public abstract boolean getEdge(Point a, Point b);", "public HalfEdge(int q) { end = q; }", "private List<List<Edge>> dfs(List<Point> vertices, int start, int end) {\n\n /**\n * used for the answer returned\n */\n List<List<Edge>> allTessellations = new ArrayList<>();\n\n /**\n * Base Case: Return an empty list if current polygon is already a\n * triangle. If the difference between the end vertices and the start\n * vertices is less than 3, there can't be any possible tessellations\n * made\n */\n if (end - start < 3) {\n return allTessellations;\n }\n\n /**\n * iterate through the current polygon\n */\n for (int k = start + 1; k < end; k++) {\n\n /**\n * placeholder for storing possible tessellations\n */\n List<Edge> temp = new ArrayList<>();\n\n /**\n * Add the length of the internal edge to the list \n *\n * An internal edge can only be internal if the k vertices is either\n * not the adjacent vertices of the start or end point of the\n * current tessellation of the polygon.\n */\n if (start + 1 < k) {\n temp.add(new Edge(new Point(vertices.get(k).getxPos(), vertices.get(k).getyPos()),\n new Point(vertices.get(start).getxPos(), vertices.get(start).getyPos())));\n }\n\n if (end - 1 > k) {\n temp.add(new Edge(new Point(vertices.get(k).getxPos(), vertices.get(k).getyPos()),\n new Point(vertices.get(end).getxPos(), vertices.get(end).getyPos())));\n }\n\n /**\n * get the left and right tessellations\n */\n List<List<Edge>> left = dfs(vertices, start, k);\n List<List<Edge>> right = dfs(vertices, k, end);\n\n /**\n * if the left and right tessellations are empty then only add the\n * temp list\n * \n * if not, then get the cartesian product of each side to get every \n * possible tessellation with both lists\n */\n if (left.isEmpty() && right.isEmpty()) \n allTessellations.add(temp);\n else\n allTessellations.addAll(combine(left, right, temp));\n\n }\n\n return allTessellations;\n\n }", "public static void main(String[] args) {\n\t\tint high =5;\r\n\t\tint bottom = 3;\r\n\t\tdouble equiateraltriangle= (double)high * bottom /2;\r\n\t\t\r\n\t\tSystem.out.println(\"밑변이 3이고 높이가 5인 정삼각형의 넓이는\" + equiateraltriangle);\r\n\r\n\t}", "public static void main(String[] args) {\n\t\tScanner cin = new Scanner(System.in);\n\t\tint a = cin.nextInt();\n\t\tint b = cin.nextInt();\n\t\tint c = cin.nextInt();\n\t\tint isTrigle = 0;\n\t\tif(a+b<c||a+c<b||b+c<a)System.out.println(\"Not triangle\");\n\t\telse {\n\t\t\tif(Math.pow(a,2)==Math.pow(b,2)+Math.pow(c,2)||\n\t\t\t Math.pow(b,2)==Math.pow(a,2)+Math.pow(c,2)||\n\t\t\t Math.pow(c,2)==Math.pow(b,2)+Math.pow(a,2)){\n\t\t\t isTrigle = 1;\t\n\t\t\t System.out.println(\"Right triangle\");\n\t\t\t}\n\t\t\tif(Math.pow(a,2)>Math.pow(b,2)+Math.pow(c,2)||\n\t\t\t Math.pow(b,2)>Math.pow(a,2)+Math.pow(c,2)||\n\t\t\t Math.pow(c,2)>Math.pow(b,2)+Math.pow(a,2)){\n\t\t\t\tisTrigle = 1;\n\t\t\t\tSystem.out.println(\"Obtuse triangle\");\n\t\t\t}\n\t\t\tif(isTrigle==0)System.out.println(\"Acute triangle\");\n\t\t\tif(a==b||b==c||a==c)System.out.println(\"Isosceles triangle\");\n\t\t\tif(a==b&&b==c&&a==c)System.out.println(\"Equilateral triangle\");\n\t\t\t\n\t\t}\n\t\t \n\t\t\n\t}", "@Test \r\n void create_edge_between_to_nonexisted_vertexes() {\r\n graph.addEdge(\"A\", \"B\");\r\n List<String> adjacentA = graph.getAdjacentVerticesOf(\"A\");\r\n List<String> adjacentB = graph.getAdjacentVerticesOf(\"B\");\r\n if(!adjacentA.contains(\"B\")) { \r\n fail();\r\n }\r\n if(adjacentB.contains(\"A\")) { \r\n fail();\r\n }\r\n }", "private boolean reachablePathFindOrient(Graph graph, Node a, Node b, Node c,\n LinkedList<Node> reachable) {\n Set<Node> cParents = new HashSet<>(graph.getParents(c));\n\n // Needed to avoid cycles in failure case.\n Set<Node> visited = new HashSet<>();\n visited.add(b);\n visited.add(c);\n\n // We don't want to include a,b,or c on the path, so they are added to\n // the \"visited\" set. b and c are added explicitly here; a will be\n // added in the first while iteration.\n while (reachable.size() > 0) {\n Node x = reachable.removeFirst();\n visited.add(x);\n\n // Possible DDP path endpoints.\n List<Node> pathExtensions = graph.getNodesInTo(x, Endpoint.ARROW);\n pathExtensions.removeAll(visited);\n\n for (Node l : pathExtensions) {\n\n // If l is reachable and not adjacent to c, its a DDP\n // endpoint, so do DDP orientation. Otherwise, if l <-> c,\n // add l to the list of reachable nodes.\n if (!graph.isAdjacentTo(l, c)) {\n\n // Check whether <a, b, c> should be reoriented given\n // that l is not adjacent to c; if so, orient and stop.\n doDdpOrientation(graph, l, a, b, c);\n return true;\n } else if (cParents.contains(l)) {\n if (graph.getEndpoint(x, l) == Endpoint.ARROW) {\n reachable.add(l);\n }\n }\n }\n }\n return false;\n }", "public EdgeCrosser(S2Point a, S2Point b, S2Point c) {\n this(a, b);\n restartAt(c);\n }", "public void addEdge(int start, int end);", "Iterable<Vertex> computePath(Vertex start, Vertex end) throws GraphException;", "@Override\n\tpublic ArrayList<Edge<Object>> getPath(String startNode, String endNode) {\n\t\treturn null;\n\t}", "@Test\n\tpublic void connectTest_East_HorizontalStraight() throws Exception {\n\n\t\tfinal Factory<Node> railNodeFactory = new DefaultRailNodeFactory();\n\n\t\tfinal RailNode switchLeft0RailNode = (RailNode) railNodeFactory.create(1, 1, ShapeType.SWITCH_LEFT_0);\n\t\tfinal RailNode horizontalRailNode = (RailNode) railNodeFactory.create(0, 1, ShapeType.STRAIGHT_HORIZONTAL);\n\n\t\tfinal Model model = new DefaultModel();\n\t\tmodel.setNode(1, 1, switchLeft0RailNode);\n\t\tmodel.setNode(0, 1, horizontalRailNode);\n\n\t\tswitchLeft0RailNode.connect(model);\n\t\thorizontalRailNode.connect(model);\n\n\t\tSystem.out.println(switchLeft0RailNode.toString());\n\t\tSystem.out.println(horizontalRailNode.toString());\n\n\t\tassertEquals(0, switchLeft0RailNode.getGraphNodeOne().getChildren().size());\n\t\tassertEquals(1, switchLeft0RailNode.getGraphNodeTwo().getChildren().size());\n\t\tassertEquals(3, switchLeft0RailNode.getGraphNodeTwo().getChildren().get(0).getId());\n\n\t\tassertEquals(1, horizontalRailNode.getGraphNodeOne().getChildren().size());\n\t\tassertEquals(0, horizontalRailNode.getGraphNodeTwo().getChildren().size());\n\t\tassertEquals(0, horizontalRailNode.getGraphNodeOne().getChildren().get(0).getId());\n\t}", "public UndirectedEdge() {\n \tthis(null,null);\n\t}", "public HalfEdge(String s, int q) { label1 = s; end = q; }", "void addEdge(int s1,int c,int s2)\r\n\t{\r\n\t\tg[s1][c][s2]=true;\r\n\t}", "private void populateConnections()\n {\n IndoorVertex elevatorFloor1 = new IndoorVertex(building, new XYPos(1050, 40), 1);\n IndoorVertex stairsFloor1 = new IndoorVertex(building, new XYPos(1056.25, 28.13), 1);\n\n firstFloorStairsElevator.add(stairsFloor1);\n firstFloorStairsElevator.add(elevatorFloor1);\n\n IndoorVertex stairsFloor2 = new IndoorVertex(building, new XYPos(1049.43, 160.49), 2);\n IndoorVertex elevatorFloor2 = new IndoorVertex(building, new XYPos(1044.19, 151.19), 2);\n\n secondFloorStairsElevator.add(stairsFloor2);\n secondFloorStairsElevator.add(elevatorFloor2);\n\n IndoorVertex stairsFloor3 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 3);\n IndoorVertex elevatorFloor3 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 3);\n\n thirdFloorStairsElevator.add(stairsFloor3);\n thirdFloorStairsElevator.add(elevatorFloor3);\n\n IndoorVertex stairsFloor4 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 4);\n IndoorVertex elevatorFloor4 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 4);\n\n fourthFloorStairsElevator.add(stairsFloor4);\n fourthFloorStairsElevator.add(elevatorFloor4);\n\n IndoorVertex stairsFloor5 = new IndoorVertex(building, new XYPos(1033.75, 28.13), 5);\n IndoorVertex elevatorFloor5 = new IndoorVertex(building, new XYPos(1028.75, 37.5), 5);\n\n firstFloorStairsElevator.add(stairsFloor5);\n fifthFloorStairsElevator.add(elevatorFloor5);\n\n //Stair connections to one another\n connectVertex(stairsFloor1, stairsFloor2);\n connectVertex(stairsFloor1, stairsFloor3);\n connectVertex(stairsFloor1, stairsFloor4);\n connectVertex(stairsFloor1, stairsFloor5);\n connectVertex(stairsFloor2, stairsFloor3);\n connectVertex(stairsFloor2, stairsFloor4);\n connectVertex(stairsFloor2, stairsFloor5);\n connectVertex(stairsFloor3, stairsFloor4);\n connectVertex(stairsFloor3, stairsFloor5);\n connectVertex(stairsFloor4, stairsFloor5);\n\n //Elevator connections to one another\n connectVertex(elevatorFloor1, elevatorFloor2);\n connectVertex(elevatorFloor1, elevatorFloor3);\n connectVertex(elevatorFloor1, elevatorFloor4);\n connectVertex(elevatorFloor1, elevatorFloor5);\n connectVertex(elevatorFloor2, elevatorFloor3);\n connectVertex(elevatorFloor2, elevatorFloor4);\n connectVertex(elevatorFloor2, elevatorFloor5);\n connectVertex(elevatorFloor3, elevatorFloor4);\n connectVertex(elevatorFloor3, elevatorFloor5);\n connectVertex(elevatorFloor4, elevatorFloor5);\n\n //Creation of each floors connections\n createFloor1Connections(stairsFloor1, elevatorFloor1);\n createFloor2Connections(stairsFloor2, elevatorFloor2);\n createFloor3Connections(stairsFloor3, elevatorFloor3);\n createFloor4Connections(stairsFloor4, elevatorFloor4);\n createFloor5Connections(stairsFloor5, elevatorFloor5);\n }", "protected abstract Triangle makeTriangle(final Vector3d edge1, final Vector3d edge2,\n\t\t\tfinal Vector3d edge3);", "List<Edge> getPath() throws NoPathFoundException;", "public Triangular(double left, double center, double right) {\n\ta = left;\n\tb = center;\n\tc = right;\n\n\tif( !(left<=center && center <=right) )\n\t throw new RuntimeException(); \n }", "public Enumeration directedEdges();", "@Override\r\n\tpublic void drawArrow(Canvas cv) {\n\t\tPaint g = new Paint();\r\n\t\tg.setStyle(Paint.Style.STROKE);\r\n\t\tg.setColor(Color.BLACK);\r\n\t\tg.setAntiAlias(true);\r\n\t\tg.setDither(true);\r\n\t\tcv.drawLine(mEdgeFist.x, mEdgeFist.y, mEdgeEnd.x, mEdgeEnd.y, g);\r\n\t\tPath path = new Path();\r\n\t\tg.setStyle(Paint.Style.FILL_AND_STROKE);\r\n\t\tpath.setFillType(Path.FillType.EVEN_ODD);\r\n\t\tpath.moveTo(mEdgeEnd.x, mEdgeEnd.y);\r\n\t\tpath.lineTo(mTriangle1.x, mTriangle1.y);\r\n\t\tpath.lineTo(mTriangle2.x, mTriangle2.y);\r\n\t\tpath.close();\r\n\t\tcv.drawPath(path, g);\r\n\t}", "public Polytope(PolytopePoint a, PolytopePoint b, PolytopePoint c, PolytopePoint d){\n\t\tfaces = new ArrayList<PolytopeTriangle>();//construct array list to hold the faces of the polytope\n\t\t//construct the initial faces of the polytope using the given vertices that are from the simplex\n\t\t//GJK terminated with\n\t\tfaces.add(new PolytopeTriangle(a,b,c));\n\t\tfaces.add(new PolytopeTriangle(a,c,d));\n\t\tfaces.add(new PolytopeTriangle(a,d,b));\n\t\tfaces.add(new PolytopeTriangle(b,d,c));\n\t}", "public abstract boolean hasEdge(int from, int to);", "private void connectAll()\n {\n\t\tint i = 0;\n\t\tint j = 1;\n\t\twhile (i < getNodes().size()) {\n\t\t\twhile (j < getNodes().size()) {\n\t\t\t\tLineEdge l = new LineEdge(false);\n\t\t\t\tl.setStart(getNodes().get(i));\n\t\t\t\tl.setEnd(getNodes().get(j));\n\t\t\t\taddEdge(l);\n\t\t\t\tj++;\n\t\t\t}\n\t\t\ti++; j = i+1;\n\t\t}\n\n }", "public static void main(String[] args) {\n\t\tint[][] edges = {{0,1},{1,2},{1,3},{4,5}};\n\t\tGraph graph = createAdjacencyList(edges, true);\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency List) unDirected : \"+getNumberOfConnectedComponents(graph));\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency List) Directed: \"+getNumberOfConnectedComponents(createAdjacencyList(edges, false)));\n\t\t\n\t\t//Shortest Distance & path\n\t\tint[][] edgesW = {{0,1,1},{1,2,4},{2,3,1},{0,3,3},{0,4,1},{4,3,1}};\n\t\tgraph = createAdjacencyList(edgesW, true);\n\t\tSystem.out.println(\"Shortest distance : \"+ getShortestDistance(graph, 0, 3));\n\t\t\n\t\t//Graph represented in Adjacency Matrix\n\t\tint[][] adjacencyMatrix = {{0,1,0,0,1,0},{1,0,1,1,0,0},{0,1,0,1,0,0},{0,1,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0}};\n\t\t\n\t\t// Connected components or Friends circle\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency Matrix) unDirected Recursive: \"+getNumberOfConnectedComponents(adjacencyMatrix));\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency Matrix) unDirected Iterative: \"+getNumberOfConnectedComponents(adjacencyMatrix));\n\n\t\tSystem.out.println(\"Shortest distance : \"+ getShortestDistance(adjacencyMatrix, 0, 3));\n\t\t\n\t\t// Number of Islands\n\t\tint[][] islandGrid = {{1,1,0,1},{0,1,0,0},{0,0,1,1},{0,1,1,0}};\n\t\tSystem.out.println(\"Number of islands Recursive: \"+ getNumberOfIslands(islandGrid));\n\t\t// re-initialize\n\t\tint[][] islandGridIterative = {{1,1,0,0},{0,1,0,0},{0,0,1,1},{0,1,1,0}};\n\t\tSystem.out.println(\"Number of islands Iterative: \"+ getNumberOfIslandsIterative(islandGridIterative));\n\n\n\t}", "private List<Point> getPath(int index) {\n\t\t \n\t \n\t\t Node fromNode = oEdge.fromNode;\n\t\t Node toNode = oEdge.toNode;\n\t\t float x1 = fromNode.longitude;\n\t\t float x2 = toNode.longitude;\n\t\t float y1 = fromNode.latitude;\n\t\t float y2 = toNode.latitude;\n\t\t double slope, angle;\n\t\t if(x1!=x2) {\n\t\t\t slope = (y2-y1)/(x2-x1);\n\t\t\t \tangle = Math.atan(slope);\n\t\t\t \t} else {\n\t\t\t \t\tangle = Math.PI/2;\n\t\t\t \t}\n\t\t Double L = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));\n\t\t float offsetPixels=0;\n\t\t if(Math.toDegrees(angle)>Math.toDegrees(90)) {\n\t\t\t if (index==0){\n\t\t\t\t offsetPixels=roadWidth*6/10;\n\t\t\t }\n\t\t\t else if(index==1){\n\t\t\t\t offsetPixels=roadWidth*11/10;\n\t\t\t }\n\t\t\t else if(index==-1){\n\t\t\t\t offsetPixels=roadWidth*1/10;\n\t\t\t }\n\t\t\t \n\t\t } else {\n\t\t\t \n\t\t\t if (index==0){\n\t\t\t\t offsetPixels=-roadWidth*6/10;\n\t\t\t }\n\t\t\t else if(index==1){\n\t\t\t\t offsetPixels=-roadWidth*11/10;\n\t\t\t }\n\t\t\t else if(index==-1){\n\t\t\t\t offsetPixels=-roadWidth*1/10;\n\t\t\t }\n\t\t }\n\t\t \n\t\t // This is the first parallel line\n\t\t float x1p1 = x1 + offsetPixels * (y2-y1) / L.floatValue();\n\t\t float x2p1 = x2 + offsetPixels * (y2-y1) / L.floatValue();\n\t\t float y1p1 = y1 + offsetPixels * (x1-x2) / L.floatValue();\n\t\t float y2p1 = y2 + offsetPixels * (x1-x2) / L.floatValue();\n//\t\t if(oEdge.edgeID==16) {\n//\t\t\t System.out.println(\"testing\");\n//\t\t }\n\t\t \n\t\t Point P1 = new Point(x1p1,y1p1);\n\t\t Point P2 = new Point(x2p1,y2p1);\n\t\t List<Point> gP = GetPoints(P1, P2);\n\t\t return gP;\n\t \n\t}", "public Enumeration undirectedEdges();", "private void defineVertexes(String orientation){\n if(\"down\".equals(orientation)){\n y2 = y1-height;\n y3 = y1-height;\n \n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"up\")){\n y2 = y1+height;\n y3 = y1+height;\n x2 = x1 - height/2;\n x3 = x1 + height/2;\n }else if(orientation.equals(\"left\")){\n x2 = x1-height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }else if(orientation.equals(\"right\")){\n x2 = x1+height;\n y2 = y1+height/2;\n x3 = x1;\n y3 = y1+height;\n }\n }", "void addEdge(int x, int y);", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble xa;\n\t\tdouble ya;\n\t\tSystem.out.println(\"Input x and y coordinates of vertex A\");\n\t\txa = sc.nextDouble();\n\t\tya = sc.nextDouble();\n\t\tdouble xb;\n\t\tdouble yb;\n\t\tSystem.out.println(\"Input x and y coordinates of vertex B\");\n\t\txb = sc.nextDouble();\n\t\tyb = sc.nextDouble();\n\t\tdouble xc;\n\t\tdouble yc;\n\t\tSystem.out.println(\"Input x and y coordinates of vertex C\");\n\t\txc = sc.nextDouble();\n\t\tyc = sc.nextDouble();\n\t\tdouble xd;\n\t\tdouble yd;\n\t\tSystem.out.println(\"Input x and y coordinates of point D\");\n\t\txd = sc.nextDouble();\n\t\tyd = sc.nextDouble();\n\t\tdouble s1 = (xa - xd) * (yb - ya) - (xb - xa) * (ya - yd);\n\t\tdouble s2 = (xb - xd) * (yc - yb) - (xc - xb) * (yb - yd);\n\t\tdouble s3 = (xc - xd) * (ya - yc) - (xa - xc) * (yc - yd);\n\t\tif ((s1 <= 0 && s2 <= 0 && s3 <= 0) || (s1 > 0 && s2 > 0 && s3 > 0)) {\n\t\t\tSystem.out.println(\"Point lies inside the triangle\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Point doesn`t lie inside the triangle\");\n\t\t}\n\t}", "private void createTargetArrows(EdgeAppearanceCalculator eac) {\r\n\t \t\r\n\t DiscreteMapping discreteMapping = new DiscreteMapping\r\n (Arrow.NONE,\r\n EDGE_TYPE,\r\n ObjectMapping.EDGE_MAPPING);\r\n\r\n\t \tdiscreteMapping.putMapValue(ACTIVATION, Arrow.BLACK_DELTA);\r\n\t \tdiscreteMapping.putMapValue(CATALYSIS, Arrow.BLACK_CIRCLE);\r\n\t discreteMapping.putMapValue(INHIBITION, Arrow.BLACK_T);\r\n\r\n\t GenericEdgeArrowCalculator edgeTargetArrowCalculator =\r\n new GenericEdgeArrowCalculator(\"SimpleBioMoleculeEditor target arrows\",\r\n discreteMapping);\r\n eac.setEdgeTargetArrowCalculator(edgeTargetArrowCalculator);\r\n System.out.println (\"Set edge target arrow calculator to \" + edgeTargetArrowCalculator);\r\n\r\n\t }", "@Test\r\n void test_insert_two_vertice_with_one_edge_remove_non_existent_edge() {\r\n // Add three vertices with two edges\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"B\", \"C\");\r\n vertices = graph.getAllVertices();\r\n // B should be an adjacent vertex of A\r\n if(!graph.getAdjacentVerticesOf(\"A\").contains(\"B\")){\r\n fail();\r\n }\r\n // C should be an adjacent vertex of B\r\n if(!graph.getAdjacentVerticesOf(\"B\").contains(\"C\")){\r\n fail();\r\n }\r\n //Check that A,B and C are in the graph\r\n if(!vertices.contains(\"A\") |!vertices.contains(\"B\")\r\n | !vertices.contains(\"C\")) {\r\n fail();\r\n }\r\n // There are two edges in the graph\r\n if(graph.size() != 2) {\r\n fail();\r\n }\r\n // Try are remove edge from A to C\r\n graph.removeEdge(\"A\", \"C\");\r\n graph.removeEdge(\"A\", \"D\");\r\n graph.removeEdge(\"E\", \"F\");\r\n graph.removeEdge(null, \"A\");\r\n graph.removeEdge(\"A\", null);\r\n //Graph should maintain its original shape\r\n if(!graph.getAdjacentVerticesOf(\"A\").contains(\"B\")){\r\n fail();\r\n }\r\n // C should be an adjacent vertex of B\r\n if(!graph.getAdjacentVerticesOf(\"B\").contains(\"C\")){\r\n fail();\r\n }\r\n //Check that A,B and C are in the graph\r\n if(!vertices.contains(\"A\") |!vertices.contains(\"B\")\r\n | !vertices.contains(\"C\")) {\r\n fail();\r\n }\r\n // There are two edges in the graph\r\n if(graph.size() != 2) {\r\n fail();\r\n }\r\n }", "public interface Edge\n{\n\t/**\n\t * Returns the node that the <i>head</i> of the head\n\t * is connected to.\n\t * @return The head Node.\n\t */\n\tpublic Node getHeadNode();\n\n\t/**\n\t * Returns the node that the <i>tail</i> of the edge\n\t * is connected to.\n\t * @return The tail Node.\n\t */\n\tpublic Node getTailNode();\n\n\t/**\n\t * Allows an object to be associated with the <code>Edge</code>\n\t * @param o The object to be set as the userObject\n\t */\n\tpublic void setUserObject(Object o);\n\n\t/**\n\t * Gets the userObject, previously set with <code>setUserObject(Object o)</code>\n\t * @return The userObject, or <code>null</code> if no object has been set.\n\t */\n\tpublic Object getUserObject();\n\n\t/**\n\t * Causes any information in the path that represents the <code>Egde</code>\n\t * to be cleared, such as origin location and any control points.\n\t */\n\tpublic void resetPath();\n\n\t/**\n\t * Sets the location of the start of the path that represents\n\t * the <code>Edge</code>.\n\t * @param x The horizontal location.\n\t * @param y The vertical location.\n\t */\n\tpublic void setPathOrigin(int x, int y);\n\n\t/**\n\t * Extends the <code>Edge</code> using the following control points to\n\t * form a Bezier curve extension to the end point (x3, y3).\n\t * @param x1 Horizontal location of control point 1\n\t * @param y1 Vertical location of control point 1\n\t * @param x2 Horizontal location of control point 2\n\t * @param y2 Vertical location of control point 2\n\t * @param x3 Horizontal location of the end point.\n\t * @param y3 Vertical location of the end point.\n\t */\n\tpublic void pathTo(int x1, int y1, int x2, int y2, int x3, int y3);\n\n\t/**\n\t * Extends the <code>Edge</code> to the specified location using\n\t * a straight line.\n\t * @param x The horizontal location of the end point.\n\t * @param y The vertical location of the end point.\n\t */\n\tpublic void pathTo(int x, int y);\n\n\t/**\n\t * Sets the <code>Edge's</code> arrowhead.\n\t * @param baseX The x location of the centre of the arrowhead baseline.\n\t * @param baseY The y location of the centre of the arrowhead tip.\n\t * @param tipX The x location of the tip of the arrowhead.\n\t * @param tipY The y location of the tip of the arrowhead.\n\t */\n\tpublic void setArrowHead(int baseX, int baseY, int tipX, int tipY);\n\n\t/**\n\t * Sets the <code>Edge's</code> arrowtail\n\t * @param baseX The x location of the centre of the arrowhead baseline.\n\t * @param baseY The y location of the centre of the arrowhead tip.\n\t * @param tipX The x location of the tip of the arrowhead.\n\t * @param tipY The y location of the tip of the arrowhead.\n\t */\n\tpublic void setArrowTail(int baseX, int baseY, int tipX, int tipY);\n\n\t/**\n\t * Sets the <code>Edge</code>'s label position.\n\t * @param x The horizontal location (in pixels).\n\t * @param y The vertical location (in pixels).\n\t */\n\tpublic void setLabelPosition(int x, int y);\n\n\t/**\n\t * Retrieves the position of the <code>Edge's</code> label.\n\t * @return A <code>Point</code> containing the position of\n\t * the label.\n\t */\n\tpublic Point getLabelPosition();\n\n\t/**\n\t * Gets the <code>Shape</code> that represents the <code>Edge</code>.\n\t * @return The <code>Shape</code> of the <code>Edge</code>.\n\t */\n\tpublic Shape getShape();\n\n\t/**\n\t * Gets the direction of the <code>Edge</code>. This is one of the\n\t * predefined direction from the <code>GraphModel</code> interface.\n\t * @return The direction of the <code>Edge</code>.\n\t */\n\tpublic int getDirection();\n\n\n}", "public void removeEdge(int start, int end);", "@Test\n\tpublic void testAdjacencyDoorways()\n\t{\n\t\t// Test beside a door direction RIGHT\n\t\tSet<BoardCell> testList = board.getAdjList(18, 18);\n\t\tassertTrue(testList.contains(board.getCellAt(18, 17)));\n\t\tassertTrue(testList.contains(board.getCellAt(19, 18)));\n\t\tassertTrue(testList.contains(board.getCellAt(18, 19)));\n\t\tassertTrue(testList.contains(board.getCellAt(17, 18)));\n\t\tassertEquals(4, testList.size());\n\t\t// Test beside a door direction DOWN\n\t\ttestList = board.getAdjList(5, 17);\n\t\tassertTrue(testList.contains(board.getCellAt(6, 17)));\n\t\tassertTrue(testList.contains(board.getCellAt(4, 17)));\n\t\tassertTrue(testList.contains(board.getCellAt(5, 16)));\n\t\tassertTrue(testList.contains(board.getCellAt(5, 18)));\n\t\tassertEquals(4, testList.size());\n\t\t// Test beside a door direction LEFT\n\t\ttestList = board.getAdjList(11, 18);\n\t\tassertTrue(testList.contains(board.getCellAt(11, 19)));\n\t\tassertTrue(testList.contains(board.getCellAt(11, 17)));\n\t\tassertTrue(testList.contains(board.getCellAt(10, 18)));\n\t\tassertTrue(testList.contains(board.getCellAt(12, 18)));\n\t\tassertEquals(4, testList.size());\n\t\t// Test beside a door direction UP\n\t\ttestList = board.getAdjList(8, 4);\n\t\tassertTrue(testList.contains(board.getCellAt(8, 5)));\n\t\tassertTrue(testList.contains(board.getCellAt(8, 3)));\n\t\tassertTrue(testList.contains(board.getCellAt(7, 4)));\n\t\tassertTrue(testList.contains(board.getCellAt(9, 4)));\n\t\tassertEquals(4, testList.size());\n\t}", "public int getEdgeCount() \n {\n return 3;\n }", "public Triangle(Point a, Point b, Point c){\n this.a=a;\n this.b=b;\n this.c=c;\n }", "@Test\n public void notConnectedDueToRestrictions() {\n int sourceNorth = graph.edge(0, 1).setDistance(1).set(speedEnc, 10, 10).getEdge();\n int sourceSouth = graph.edge(0, 3).setDistance(2).set(speedEnc, 10, 10).getEdge();\n int targetNorth = graph.edge(1, 2).setDistance(3).set(speedEnc, 10, 10).getEdge();\n int targetSouth = graph.edge(3, 2).setDistance(4).set(speedEnc, 10, 10).getEdge();\n\n assertPath(calcPath(0, 2, sourceNorth, targetNorth), 0.4, 4, 400, nodes(0, 1, 2));\n assertNotFound(calcPath(0, 2, sourceNorth, targetSouth));\n assertNotFound(calcPath(0, 2, sourceSouth, targetNorth));\n assertPath(calcPath(0, 2, sourceSouth, targetSouth), 0.6, 6, 600, nodes(0, 3, 2));\n }", "public Enumeration edges();", "public void testGetEdge() {\n System.out.println(\"getEdge\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n\n for (int i = 0; i < 25; i++) {\n for (int j = 0; j < 25; j++) {\n if ((i + j) % 2 != 0) {\n Assert.assertNull(graph.getEdge(new Integer(i), new Integer(j)));\n } else {\n Assert.assertNotNull(graph.getEdge(new Integer(i), new Integer(j)));\n }\n }\n }\n }", "@Test\r\n\tpublic void testAdjacencyDoorways()\r\n\t{\r\n\t\t// Test beside a door direction DOWN\r\n\t\tSet<BoardCell> testList = board.getAdjList(9, 2);\r\n\t\tassertTrue(testList.contains(board.getCellAt(10, 2)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(8, 2)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(9, 3)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(9, 1)));\r\n\t\tassertEquals(4, testList.size());\r\n\t\t// Test beside a door direction RIGHT\r\n\t\ttestList = board.getAdjList(19, 7);\r\n\t\tassertTrue(testList.contains(board.getCellAt(19, 8)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(19, 6)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(20, 7)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(18, 7)));\r\n\t\tassertEquals(4, testList.size());\r\n\t\t// Test beside a door direction LEFT\r\n\t\ttestList = board.getAdjList(8, 21);\r\n\t\tassertTrue(testList.contains(board.getCellAt(9, 21)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(7, 21)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(8, 22)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(8, 20)));\r\n\t\tassertEquals(4, testList.size());\r\n\t\t// Test beside a door direction UP\r\n\t\ttestList = board.getAdjList(16, 10);\r\n\t\tassertTrue(testList.contains(board.getCellAt(17, 10)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(15, 10)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(16, 9)));\r\n\t\tassertTrue(testList.contains(board.getCellAt(16, 11)));\r\n\t\tassertEquals(4, testList.size());\r\n\t}", "private void awayFromCollider(Graph graph, Node a, Node b, Node c) {\n Endpoint BC = graph.getEndpoint(b, c);\n Endpoint CB = graph.getEndpoint(c, b);\n\n if (!(graph.isAdjacentTo(a, c)) &&\n (graph.getEndpoint(a, b) == Endpoint.ARROW)) {\n if (CB == Endpoint.CIRCLE || CB == Endpoint.TAIL) {\n if (BC == Endpoint.CIRCLE) {\n if (!isArrowpointAllowed(graph, b, c)) {\n return;\n }\n\n graph.setEndpoint(b, c, Endpoint.ARROW);\n changeFlag = true;\n }\n }\n\n if (BC == Endpoint.CIRCLE || BC == Endpoint.ARROW) {\n if (CB == Endpoint.CIRCLE) {\n graph.setEndpoint(c, b, Endpoint.TAIL);\n changeFlag = true;\n }\n }\n }\n }", "@Test \r\n void insert_two_vertexs_then_create_edge(){\r\n graph.addVertex(\"A\");\r\n graph.addVertex(\"B\");\r\n graph.addEdge(\"A\", \"B\");\r\n List<String> adjacentA = graph.getAdjacentVerticesOf(\"A\");\r\n List<String> adjacentB = graph.getAdjacentVerticesOf(\"B\");\r\n if(!adjacentA.contains(\"B\")) { \r\n fail();\r\n }\r\n if(adjacentB.contains(\"A\")) { \r\n fail();\r\n }\r\n }", "private Edge(int index1, int index2, float crease, boolean inFace) {\n this.index1 = index1;\n this.index2 = index2;\n this.crease = crease;\n this.inFace = inFace;\n }", "public void testRemoveEdge_betweenVertices() {\n System.out.println(\"removeEdge\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n\n for (int i = 0; i < 25; i++) {\n for (int j = 0; j < 25; j++) {\n if ((i + j) % 2 != 0) {\n continue;\n }\n\n Assert.assertNotNull(graph.removeEdge(new Integer(i), new Integer(j)));\n Assert.assertFalse(graph.containsEdge(new Integer(i), new Integer(j)));\n }\n }\n }", "String getEdges();", "public void triangulo() {\n fill(0);\n stroke(255);\n strokeWeight(5);\n triangle(width/2, 50, height+100, 650, 350, 650);\n //(width/2, height-100, 350, 150, 900, 150);\n }", "@Test\n void test03_addEdgeBetweenVerticesWhichDontExist() {\n graph.addEdge(\"a\", \"b\");\n Set<String> vertices = new LinkedHashSet<>();\n vertices.add(\"a\");\n vertices.add(\"b\"); // creates mock up vertex list\n if (!graph.getAllVertices().equals(vertices)) { // compares vertices list\n fail(\"Graph didn't add the vertices correctly\");\n }\n List<String> adjOfA = new ArrayList<>();\n adjOfA.add(\"b\"); // creates mock up adjacent list\n if (!graph.getAdjacentVerticesOf(\"a\").equals(adjOfA)) { // compares adjacent lists\n fail(\"Graph didn't correctly place adjacent vertices\");\n }\n }", "public void conecta (Integer a, Integer b){\n listaEdges[a].add(b);\n listaEdges[b].add(a);\n }", "private void transferLocal(Graph graph) {\n Set<NodePair> nonadjacencies = nonadjacencies(graph);\n for (Graph pag : input) {\n for (Edge edge : pag.getEdges()) {\n NodePair graphNodePair = new NodePair(graph.getNode(edge.getNode1().getName()), graph.getNode(edge.getNode2().getName()));\n if (nonadjacencies.contains(graphNodePair)) {\n continue;\n }\n if (!graph.isAdjacentTo(graphNodePair.getFirst(), graphNodePair.getSecond())) {\n graph.addEdge(new Edge(graphNodePair.getFirst(), graphNodePair.getSecond(), edge.getEndpoint1(), edge.getEndpoint2()));\n continue;\n }\n Endpoint first = edge.getEndpoint1();\n Endpoint firstCurrent = graph.getEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst());\n if (!first.equals(Endpoint.CIRCLE)) {\n if ((first.equals(Endpoint.ARROW) && firstCurrent.equals(Endpoint.TAIL)) ||\n (first.equals(Endpoint.TAIL) && firstCurrent.equals(Endpoint.ARROW))) {\n graph.setEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst(), Endpoint.CIRCLE);\n } else {\n graph.setEndpoint(graphNodePair.getSecond(), graphNodePair.getFirst(), edge.getEndpoint1());\n }\n }\n Endpoint second = edge.getEndpoint2();\n Endpoint secondCurrent = graph.getEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond());\n if (!second.equals(Endpoint.CIRCLE)) {\n if ((second.equals(Endpoint.ARROW) && secondCurrent.equals(Endpoint.TAIL)) ||\n (second.equals(Endpoint.TAIL) && secondCurrent.equals(Endpoint.ARROW))) {\n graph.setEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond(), Endpoint.CIRCLE);\n } else {\n graph.setEndpoint(graphNodePair.getFirst(), graphNodePair.getSecond(), edge.getEndpoint2());\n }\n }\n }\n for (Triple triple : pag.getUnderLines()) {\n Triple graphTriple = new Triple(graph.getNode(triple.getX().getName()), graph.getNode(triple.getY().getName()), graph.getNode(triple.getZ().getName()));\n if (graphTriple.alongPathIn(graph)) {\n graph.addUnderlineTriple(graphTriple.getX(), graphTriple.getY(), graphTriple.getZ());\n definiteNoncolliders.add(graphTriple);\n }\n }\n }\n }", "ArrayList<Edge> getAdjacencies();", "public static void main(String[] args) {\n String []str={\"A\",\"B\",\"C\"};\r\n \r\n String [][]str1={{\"A\",\"B\",\"3\"},{\"B\",\"C\",\"4\"},{\"A\",\"C\",\"5\"}};\r\n\t\tListUDirected lud=new ListUDirected(str,str1);\r\n\t\tSystem.out.println(\"以下是有向图的邻接表\");\r\n\t\tlud.printList();\r\n\t\t\r\n\t\t\r\n\t\t String [][]str2={{\"A\",\"B\",\"2\"},{\"B\",\"A\",\"2\"},{\"B\",\"C\",\"3\"},{\"C\",\"B\",\"3\"},{\"A\",\"C\",\"4\"},{\"C\",\"A\",\"4\"}};\r\n\t\tListUDirected lud2=new ListUDirected(str,str2);\r\n\t\tSystem.out.println();\r\n\t\tSystem.out.println(\"以下是无向图的邻接表\");\r\n\t\tlud2.printList();\r\n\t\t\r\n\t\t \r\n\t}", "public DCEL_Edge getConnectingEdge(Cell c) {\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tIterator<DCEL_Edge> it = (Iterator<DCEL_Edge>) face.edges().iterator();\n\n\t\twhile (it.hasNext()) {\n\n\t\t\tDCEL_Edge e = it.next();\n\n\t\t\tif ((e.getLeftFace().equals(this.face) && e.getRightFace().equals(\n\t\t\t\t\tc.face))\n\t\t\t\t\t|| (e.getLeftFace().equals(c.face) && e.getRightFace()\n\t\t\t\t\t\t\t.equals(this.face))) {\n\n\t\t\t\treturn e;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.err\n\t\t\t\t.println(\"Edge Not Found-Error: This should not have happened\");\n\t\treturn null;\n\t}", "@Override\n protected Double[] getCorners(){\n return new Double[]{\n //leftmost point\n getXPos(), getYPos(),\n //rightmost point\n getXPos() + getWidth(), getYPos(),\n //middle point\n getXPos() + getWidth() / 2, getYPos() + getHeight() * getThirdTriangleYPoint(pointUp)\n };\n }", "private List<Edge<String>> getPath(Vertex<String> end,\n Vertex<String> start) {\n if (graph.label(end) != null) {\n List<Edge<String>> path = new ArrayList<>();\n\n Vertex<String> cur = end;\n Edge<String> road;\n while (cur != start) {\n road = (Edge<String>) graph.label(cur); // unchecked cast ok\n path.add(road);\n cur = graph.from(road);\n }\n return path;\n }\n return null;\n }", "public void drawUndirectedEdge(String label1, String label2) {\n }", "public static void main(String[] args) {\n\n // create random DAG with V vertices and E aristas; then add F random aristas\n int V = Integer.parseInt(args[0]);\n int A = Integer.parseInt(args[1]);\n int F = Integer.parseInt(args[2]);\n DigrafoAristaPonderada G = new DigrafoAristaPonderada(V);\n int[] vertices = new int[V];\n for (int i = 0; i < V; i++)\n vertices[i] = i;\n StdRandom.shuffle(vertices);\n for (int i = 0; i < A; i++) {\n int v, w;\n do {\n v = StdRandom.uniform(V);\n w = StdRandom.uniform(V);\n } while (v >= w);\n double peso = StdRandom.uniform();\n G.agregarArista(new AristaDirigida(v, w, peso));\n }\n\n // add F extra aristas\n for (int i = 0; i < F; i++) {\n int v = StdRandom.uniform(V);\n int w = StdRandom.uniform(V);\n double peso = StdRandom.uniform(0.0, 1.0);\n G.agregarArista(new AristaDirigida(v, w, peso));\n }\n\n StdOut.println(G);\n\n // find a directed ciclo\n AristaPonderadaDeCicloDirigido descubridor = \n new AristaPonderadaDeCicloDirigido(G);\n if (descubridor.tieneCiclo()) {\n StdOut.print(\"Ciclo: \");\n for (AristaDirigida a : descubridor.ciclo()) {\n StdOut.print(a + \" \");\n }\n StdOut.println();\n }\n\n // or give topologial sort\n else {\n StdOut.println(\"No existen ciclos dirigidos\");\n }\n }", "private Polygon createTriangle(Point a, Point b, Point c) {\n Polygon p = new Polygon();\n p.addPoint(a.x, a.y);\n p.addPoint(b.x, b.y);\n p.addPoint(c.x, c.y);\n\n return p;\n }", "Iterable<Vertex> computePathToGraph(Loc start, Vertex end) throws GraphException;", "public static void main(String[] args) {\n PointNode A = new PointNode(\"A\",0,0);\r\n PointNode B = new PointNode(\"B\",20,10);\r\n PointNode C = new PointNode(\"C\",40,20);\r\n PointNode D = new PointNode(\"D\",30,30);\r\n PointNode E = new PointNode(\"E\",20,50);\r\n PointNode F = new PointNode(\"F\",-10,40);\r\n PointNode G = new PointNode(\"G\",10,20);\r\n PointNode H = new PointNode(\"H\",10,40);\r\n PointNode I = new PointNode(\"I\",30,40);\r\n PointNode K = new PointNode(\"K\",30,20);\r\n PointNode L = new PointNode(\"L\",40,40);\r\n\r\n A.connectWithPoint(B);\r\n A.connectWithPoint(G);\r\n G.connectWithPoint(F);\r\n G.connectWithPoint(H);\r\n G.connectWithPoint(D);\r\n K.connectWithPoint(L);\r\n B.connectWithPoint(C);\r\n D.connectWithPoint(I);\r\n D.connectWithPoint(E);\r\n L.connectWithPoint(E);\r\n F.connectWithPoint(E);\r\n H.connectWithPoint(E);\r\n I.connectWithPoint(E);\r\n A.connectWithPoint(K);\r\n\r\n Route route = searchWay(A, E);\r\n System.out.println(route);\r\n }", "Set<CyEdge> getExternalEdgeList();", "public Iterable<Edge> pathTo(final int one) {\n if (!hasPath(one)) {\n return null;\n }\n Stack<Edge> sta = new Stack<Edge>();\n int two = one;\n for (Edge each = edge[one]; each != null; each = edge[two]) {\n sta.push(each);\n two = each.other(two);\n }\n return sta;\n }", "private static void InitializeEdges()\n {\n edges = new ArrayList<Edge>();\n\n for (int i = 0; i < Size -1; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n edges.add(new Edge(cells[i][j].Point, cells[i + 1][ j].Point));\n edges.add(new Edge(cells[j][i].Point, cells[j][ i + 1].Point));\n }\n }\n\n for (Edge e : edges)\n {\n if ((e.A.X - e.B.X) == -1)\n {\n e.Direction = Edge.EdgeDirection.Vertical;\n }\n else\n {\n e.Direction = Edge.EdgeDirection.Horizontal;\n }\n }\n }", "@Nullable\n public EdgePath<A> findAnyEdgePath(@Nonnull DirectedGraph<V, A> graph,\n V start, V goal) {\n Deque<A> arrows = new ArrayDeque<>();\n BackLinkWithArrow<V, A> current = breadthFirstSearch(graph, start, goal);\n if (current == null) {\n return null;\n }\n for (BackLinkWithArrow<V, A> i = current; i.arrow != null; i = i.parent) {\n arrows.addFirst(i.arrow);\n }\n return new EdgePath<>(arrows);\n }", "@Test\n void test08_getAllAdjacentVertices() {\n graph.addEdge(\"a\", \"b\");\n graph.addEdge(\"a\", \"c\"); // add two edges\n\n List<String> check = new ArrayList<>();\n check.add(\"b\");\n check.add(\"c\"); // create mock up adjacent list\n\n if (!check.equals(graph.getAdjacentVerticesOf(\"a\"))) { // checks if both are same\n fail(\"graph didn't record adjacent vertices correctly\");\n }\n }", "private static void breadcrumbArrow(int width, int height, int indent, int c1, int c2) {\n\n\t\tdouble x0 = 0, y0 = height / 2d;\n\t\tdouble x1 = indent, y1 = 0;\n\t\tdouble x2 = indent, y2 = height / 2d;\n\t\tdouble x3 = indent, y3 = height;\n\t\tdouble x4 = width, y4 = 0;\n\t\tdouble x5 = width, y5 = height / 2d;\n\t\tdouble x6 = width, y6 = height;\n\t\tdouble x7 = indent + width, y7 = 0;\n\t\tdouble x8 = indent + width, y8 = height;\n\n\t\tint fc1 = ColorHelper.mixAlphaColors(c1, c2, 0);\n\t\tint fc2 = ColorHelper.mixAlphaColors(c1, c2, (indent)/(width + 2f * indent));\n\t\tint fc3 = ColorHelper.mixAlphaColors(c1, c2, (indent + width)/(width + 2f * indent));\n\t\tint fc4 = ColorHelper.mixAlphaColors(c1, c2, 1);\n\n\t\tRenderSystem.disableTexture();\n\t\tRenderSystem.enableBlend();\n\t\tRenderSystem.disableAlphaTest();\n\t\tRenderSystem.defaultBlendFunc();\n\t\tRenderSystem.shadeModel(GL11.GL_SMOOTH);\n\n\t\tTessellator tessellator = Tessellator.getInstance();\n\t\tBufferBuilder bufferbuilder = tessellator.getBuffer();\n\t\tbufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);\n\n\t\tbufferbuilder.vertex(x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x7, y7, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();\n\n\t\tbufferbuilder.vertex(x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex();\n\t\tbufferbuilder.vertex(x8, y8, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex();\n\n\t\ttessellator.draw();\n\t\tRenderSystem.shadeModel(GL11.GL_FLAT);\n\t\tRenderSystem.disableBlend();\n\t\tRenderSystem.enableAlphaTest();\n\t\tRenderSystem.enableTexture();\n\t}", "@Test\n public void forcingDirectionDoesNotMeanWeCannotUseEdgeAtAll() {\n int north = graph.edge(1, 0).setDistance(1).set(speedEnc, 10, 10).getEdge();\n int south = graph.edge(1, 2).setDistance(1).set(speedEnc, 10, 10).getEdge();\n graph.edge(2, 5).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(5, 4).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(4, 3).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(3, 2).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(1, 0).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(0, 6).setDistance(1).set(speedEnc, 10, 0);\n int targetEdge = graph.edge(6, 7).setDistance(1).set(speedEnc, 10, 0).getEdge();\n assertPath(calcPath(1, 7, north, targetEdge), 0.3, 3, 300, nodes(1, 0, 6, 7));\n assertPath(calcPath(1, 7, south, targetEdge), 0.9, 9, 900, nodes(1, 2, 5, 4, 3, 2, 1, 0, 6, 7));\n }", "private static void addEdgeDiag(int n1num, int n2num, int x, int y,\n\t\t\tboolean b) {\n\t\taddEdgeReal(n1num, n2num, x, y);\n\t\taddEdgeReal(n2num, n1num, x, y);\n\t}", "@Test\r\n void insert_multiple_vertexes_and_edges_remove_vertex() {\r\n graph.addEdge(\"A\", \"B\");\r\n graph.addEdge(\"B\", \"C\");\r\n graph.addEdge(\"A\", \"C\");\r\n graph.addEdge(\"B\", \"D\");\r\n \r\n List<String> adjacent;\r\n vertices = graph.getAllVertices(); \r\n int numberOfEdges = graph.size();\r\n int numberOfVertices = graph.order();\r\n if(numberOfEdges != 4) {\r\n fail();\r\n }\r\n if(numberOfVertices != 4) {\r\n fail();\r\n }\r\n \r\n // Check that graph has all added vertexes\r\n if(!vertices.contains(\"A\")| !vertices.contains(\"B\")|\r\n !vertices.contains(\"C\")|!vertices.contains(\"D\")) {\r\n fail();\r\n }\r\n \r\n // Check that A's outgoing edges are correct\r\n adjacent = graph.getAdjacentVerticesOf(\"A\");\r\n if (!adjacent.contains(\"B\") || !adjacent.contains(\"C\"))\r\n fail();\r\n // Check that B's outgoing edges are correct\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if (!adjacent.contains(\"C\") | !adjacent.contains(\"D\"))\r\n fail(); \r\n // C and D have no out going edges \r\n adjacent = graph.getAdjacentVerticesOf(\"C\");\r\n if (!adjacent.isEmpty())\r\n fail(); \r\n adjacent = graph.getAdjacentVerticesOf(\"D\");\r\n if (!adjacent.isEmpty())\r\n fail(); \r\n // Remove B from the graph \r\n graph.removeVertex(\"B\");\r\n // Check that A's outgoing edges are correct\r\n // An edge to B should no exist any more \r\n adjacent = graph.getAdjacentVerticesOf(\"A\");\r\n if (adjacent.contains(\"B\") || !adjacent.contains(\"C\"))\r\n fail();\r\n // There should be no elements in the list of successors\r\n // of B since its deleted form the graph\r\n adjacent = graph.getAdjacentVerticesOf(\"B\");\r\n if (!adjacent.isEmpty())\r\n fail(); \r\n // Check that graph has still has all vertexes not removed\r\n if(!vertices.contains(\"A\")| !vertices.contains(\"C\")|\r\n !vertices.contains(\"D\")) {\r\n fail();\r\n }\r\n //Check that vertex B was removed from graph \r\n if(vertices.contains(\"B\")) {\r\n fail();\r\n }\r\n numberOfEdges = graph.size();\r\n numberOfVertices = graph.order();\r\n if(numberOfEdges != 1) {\r\n fail();\r\n }\r\n if(numberOfVertices != 3) {\r\n fail();\r\n }\r\n }", "@Test\n public void blockArea() {\n EdgeIteratorState edge1 = graph.edge(0, 1).setDistance(10).set(speedEnc, 10, 10);\n graph.edge(1, 2).setDistance(10).set(speedEnc, 10, 10);\n EdgeIteratorState edge2 = graph.edge(2, 3).setDistance(10).set(speedEnc, 10, 10);\n graph.edge(0, 4).setDistance(100).set(speedEnc, 10, 10);\n graph.edge(4, 5).setDistance(100).set(speedEnc, 10, 10);\n graph.edge(5, 6).setDistance(100).set(speedEnc, 10, 10);\n graph.edge(6, 3).setDistance(100).set(speedEnc, 10, 10);\n\n // usually we would take the direct route\n assertPath(calcPath(0, 3, ANY_EDGE, ANY_EDGE), 3, 30, 3000, nodes(0, 1, 2, 3));\n\n // with forced edges we might have to go around\n assertPath(calcPath(0, 3, 3, ANY_EDGE), 40, 400, 40000, nodes(0, 4, 5, 6, 3));\n assertPath(calcPath(0, 3, ANY_EDGE, 6), 40, 400, 40000, nodes(0, 4, 5, 6, 3));\n\n // with avoided edges we also have to take a longer route\n assertPath(calcPath(0, 3, ANY_EDGE, ANY_EDGE, createAvoidEdgeWeighting(edge1)), 40, 400, 40000, nodes(0, 4, 5, 6, 3));\n assertPath(calcPath(0, 3, ANY_EDGE, ANY_EDGE, createAvoidEdgeWeighting(edge2)), 40, 400, 40000, nodes(0, 4, 5, 6, 3));\n\n // enforcing forbidden start/target edges still does not allow using them\n assertNotFound(calcPath(0, 3, edge1.getEdge(), edge2.getEdge(), createAvoidEdgeWeighting(edge1)));\n assertNotFound(calcPath(0, 3, edge1.getEdge(), edge2.getEdge(), createAvoidEdgeWeighting(edge2)));\n\n // .. even when the nodes are just next to each other\n assertNotFound(calcPath(0, 1, edge1.getEdge(), ANY_EDGE, createAvoidEdgeWeighting(edge1)));\n assertNotFound(calcPath(0, 1, ANY_EDGE, edge2.getEdge(), createAvoidEdgeWeighting(edge2)));\n }", "private List<Graph.Edge> getEdge(PathMap map) {\n // record the visited coordinates\n List<Coordinate> visited = new ArrayList<>();\n // get all coordinates from the map\n List<Coordinate> allCoordinates = map.getCoordinates();\n // for record all generated edges\n List<Graph.Edge> edges = new ArrayList<>();\n\n\n while (visited.size() <= allCoordinates.size() - 1) {\n for (Coordinate temp : allCoordinates) {\n\n if (visited.contains(temp)) {\n continue;\n }\n visited.add(temp);\n List<Coordinate> neighbors = map.neighbours(temp);\n for (Coordinate tempNeighbour : neighbors) {\n edges.add(new Graph.Edge(temp, tempNeighbour, tempNeighbour.getTerrainCost()));\n }\n }\n }\n // trim impassable coordinates\n List<Graph.Edge> fEdges = new ArrayList<>();\n for (Graph.Edge dd : edges) {\n if (dd.startNode.getImpassable() || dd.endNode.getImpassable()) {\n continue;\n }\n fEdges.add(dd);\n }\n return fEdges;\n }", "private static Lane newLaneConnection(Lane upLane, Lane downLane, boolean createCurve, Lane oldLane, boolean sameOutlink) {\n \t\tdouble laneWidth = downLane.getWidth();\r\n \t\tLane newLane = new Lane(null, null, null, 0, laneWidth, Lane.NOORIGIN, Lane.NODESTINATION);\r\n \t\tnewLane.addDownLane(downLane);\r\n \t\tnewLane.addUpLane(upLane);\t\t\t\t\t\t\t\r\n \t\tdownLane.addUpLane(newLane);\r\n \t\tupLane.addDownLane(newLane);\r\n \t\tif (null == upLane.getLaneVerticesCenter()) {\r\n \t\t\tSystem.err.println(\"newLaneConnection: linkPointList is null\");\r\n \t\t\tupLane.getLaneVerticesCenter();\r\n \t\t\treturn null;\r\n \t\t}\r\n \t\tif (null == downLane.getLaneVerticesCenter()) {\r\n \t\t\tSystem.err.println(\"newLaneConnection: linkPointList is null\");\r\n \t\t\treturn null;\r\n \t\t}\r\n \t\tif (createCurve) {\r\n \t\t\tArrayList<Vertex> up = upLane.getLaneVerticesCenter();\r\n \t\t\tArrayList<Vertex> down = downLane.getLaneVerticesCenter();\t\t\r\n \t\t\tPoint2D.Double ctrlPoint = \tCurves.createControlPoint(up, down);\r\n \t\t\tnewLane.setCtrlPointCenter(ctrlPoint);\r\n \t\t\tArrayList<Vertex> laneVerticesCenter = new ArrayList<Vertex>();\r\n \t\t\tlaneVerticesCenter = Curves.connectVerticesCurve(up, down, ctrlPoint, 0.3);\r\n \t\t\t// laneVerticesCenter.get(0).setPoint(up.get(up.size()-1).getX(), up.get(up.size()-1).getY(), up.get(up.size()-1).getZ());\r\n \t\t\t// laneVerticesCenter.get(laneVerticesCenter.size()-1).setPoint(down.get(0).getX(), down.get(0).getY(), down.get(0).getZ());\r\n \t\t\tnewLane.setDesignLine(laneVerticesCenter);\t\t\t\r\n \t\t\tnewLane.setLaneVerticesInner(Planar.createParallelVertices(laneVerticesCenter, - newLane.getLateralWidth() / 2));\r\n \t\t\tnewLane.setLaneVerticesOuter(Planar.createParallelVertices(laneVerticesCenter, + newLane.getLateralWidth() / 2));\r\n \t\t}\r\n \t\telse {\r\n \t\t\tboolean sameUp = false;\r\n \t\t\tboolean sameDown = false;\r\n \t\t\tArrayList<Vertex> laneVerticesCenter = new ArrayList<Vertex>();\r\n \t\t\tArrayList<Vertex> prevLaneVerticesCenter = oldLane.getUp().get(0).getLaneVerticesCenter();\r\n \t\t\tVertex oldUp = prevLaneVerticesCenter.get(prevLaneVerticesCenter.size()-1);\r\n \t\t\tprevLaneVerticesCenter = oldLane.getDown().get(0).getLaneVerticesCenter();\r\n \t\t\tVertex oldDown = prevLaneVerticesCenter.get(0);\r\n \t\t\tVertex up = upLane.getLaneVerticesCenter().get(upLane.getLaneVerticesCenter().size()-1);\r\n \t\t\tVertex down = downLane.getLaneVerticesCenter().get(0);\t\t\r\n \t\t\t\r\n \t\t\tif (up.equals(oldUp) && sameOutlink)\r\n \t\t\t\tsameUp = true;\r\n \t\t\tif (down.equals(oldDown))\r\n \t\t\t\tsameDown = true;\r\n \t\t\t// create parallel vertices\r\n \t\t\tprevLaneVerticesCenter = oldLane.getLaneVerticesCenter();\r\n \t\t\tlaneVerticesCenter = Planar.createParallelVertices(prevLaneVerticesCenter, -oldLane.getLateralWidth());\r\n \t\t\t// if same upLane: create weighted vertices inbetween\r\n \t\t\tif (sameUp == true) {\r\n \t\t\t\tlaneVerticesCenter = Planar.createPartlyParallelVertices(prevLaneVerticesCenter, laneVerticesCenter, sameUp, sameDown);\r\n \t\t\t}\r\n \t\t\tnewLane.setDesignLine(laneVerticesCenter);\r\n \t\t\tnewLane.setLaneVerticesInner(Planar.createParallelVertices(laneVerticesCenter, - newLane.getLateralWidth() / 2));\r\n \t\t\tnewLane.setLaneVerticesOuter(Planar.createParallelVertices(laneVerticesCenter, + newLane.getLateralWidth() / 2));\r\n \t\t}\r\n \t\treturn newLane; \t\r\n }", "public abstract void addEdge(Point p, Direction dir);", "int[] getOutEdges(int... nodes);", "public void test4_c() {/*\n\t\tGDGraph gdGraph = new GDGraph();\n\t\tGDGVertex gdVertex = gdGraph.addVertex();\n\t\tGDGEdge gdEdge1 = gdGraph.addEdge(gdVertex, gdVertex);\n\t\tGDGEdge gdEdge2 = gdGraph.addEdge(gdVertex, gdVertex);\n\n\t\tgdEdge1.dataDependence = convertIntTableToAffineTrafoRational(new int[][]{ // (i, j - 1) \n\t\t\t\t{ 1, 0, 0},\n\t\t\t\t{ 0, 1, -1},\n\t\t\t\t{ 0, 0, 1}\n });\n\t\tgdEdge1.producedDomain = convertIntTableToPIPDRational(2, 0, new int[][]{ // (0..+inf, 1..+inf)\n\t\t\t\t{ 1, 0, 0},\n\t\t\t\t{ 0, 1, -1}\n\t\t});\n\n\t\tgdEdge2.dataDependence = convertIntTableToAffineTrafoRational(new int[][]{ // (i - 1, j + 7) \n\t\t\t\t{ 1, 0, -1},\n\t\t\t\t{ 0, 1, 7},\n\t\t\t\t{ 0, 0, 1}\n });\n\t\tgdEdge2.producedDomain = convertIntTableToPIPDRational(2, 0, new int[][]{ // (1..+inf, 0..+inf)\n\t\t\t\t{ 1, 0, -1},\n\t\t\t\t{ 0, 1, 0}\n\t\t});\n\n\t\tgdVertex.computationDomain = convertIntTableToPIPDRational(2, 0, new int[][]{ // (1..+inf, 1..+inf)\n\t\t\t\t{ 1, 0, -1},\n\t\t\t\t{ 0, 1, -1}\n\t\t});\n\t\t\n\t\tgdGraph.calculateFeautrierSchedule(false);\n\t\n\t\tgdGraph.<Rational>codeGeneration(Rational.ZERO, Rational.ONE);\n\t*/}", "private Candidate fetchEndpointCandidate(Coordinate endPointA, Coordinate endPointB, List<Coordinate> intersectionPoints, \r\n\t\t\tCoordinate midPointNeighbor, String[] candAttributes, boolean upperEndpoint) {\r\n\t\t\r\n\t\tCoordinate [] candPointOrder = new Coordinate[2];\r\n\t\tString type = null;\r\n\t\tString [] attributes = candAttributes; \r\n\t\tCoordinate closestIntersection = fetchClosestIntersection(endPointA, intersectionPoints); //fetch closest intersection point to endPoint\t\r\n\t\t//UPPER ENDPOINT LINK (distance < 20m) \r\n\t\tif (endPointA.distance(endPointB) < this.slopeThreshold) {\r\n\t\t\t//check for common endPoint (case upper slope_in to be common with lower slope_out)\r\n\t\t\tif (commonEndPoint(endPointA, endPointB)){\r\n\t\t\t\tcandPointOrder[0] = endPointB;\r\n\t\t\t\tcandPointOrder[1] = endPointA;\r\n\t\t\t\ttype = \"Endpoint-Intersection\";\r\n\t\t\t\tremovePointFromIntersections(intersectionPoints, endPointA);\r\n\t\t\t}\r\n\t\t\t//check if closest intersection point is within a 20m distance from upper end point (if there's no common endPoint) \r\n\t\t\telse if (closestIntersection!=null && closestIntersection.distance(endPointA) < this.slopeThreshold) {\r\n\t\t\t\tcandPointOrder[0] = closestIntersection;\r\n\t\t\t\tcandPointOrder[1] = closestIntersection;\r\n\t\t\t\ttype = \"Intersection\";\r\n\t\t\t\tintersectionPoints.remove(intersectionPoints.indexOf(closestIntersection));\r\n\t\t\t}\r\n\t\t\t//check for mid-point connection with a 10m distance at 3rd Level (if there's no intersection)s\r\n\t\t\telse if (midPointNeighbor!=null) {\r\n\t\t\t\tcandPointOrder[0] = midPointNeighbor;\r\n\t\t\t\tcandPointOrder[1] = endPointA;\r\n\t\t\t\ttype = \"Slope2Slope\";\r\n\t\t\t}\r\n\t\t\t//else create endPoint candidate at 4rth Level\r\n\t\t\telse {\r\n\t\t\t\tcandPointOrder[0] = endPointB;\r\n\t\t\t\tcandPointOrder[1] = endPointA;\r\n\t\t\t\ttype = \"Slope2Slope\";\r\n\t\t\t}\r\n\t\t}\r\n\t\t//else if no end-point to end-point connection found investigate from end-point to midpoint connection\r\n\t\telse if (hasMidpointConnection(midPointNeighbor, endPointA, closestIntersection)) {\r\n\t\t\tcandPointOrder[0] = midPointNeighbor;\r\n\t\t\tcandPointOrder[1] = endPointA;\r\n\t\t\ttype = \"Slope2Slope\";\r\n\t\t}\r\n\t\t\r\n\t\tif (type!=null) {\r\n\t\t\t//return upperEndpoint Candidate (traverse direction from slope_out to slope_in)\r\n\t\t\tif (upperEndpoint) {\r\n\t\t\t\treturn new Candidate(candPointOrder[0], candPointOrder[1], type, attributes[1], attributes[0], attributes[2]);\r\n\t\t\t}\r\n\t\t\t//return lowerEndpoint Candidate (traverse direction from slope_in to slope_out)\r\n\t\t\telse {\r\n\t\t\t\treturn new Candidate( candPointOrder[1], candPointOrder[0], type, attributes[0], attributes[1], attributes[2]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\t\t\r\n\t}", "@Test\n @SuppressWarnings(\"JUnitTestMethodWithNoAssertions\")\n public void testTriangleToOsmAndGraphhopper() throws RoutingNetworkStoreException, IOException\n {\n\n }", "private boolean discrimPaths(Graph graph) {\n List<Node> nodes = graph.getNodes();\n\n for (Node b : nodes) {\n\n //potential A and C candidate pairs are only those\n // that look like this: A<-oBo->C or A<->Bo->C\n List<Node> possAandC = graph.getNodesOutTo(b, Endpoint.ARROW);\n\n //keep arrows and circles\n List<Node> possA = new LinkedList<>(possAandC);\n possA.removeAll(graph.getNodesInTo(b, Endpoint.TAIL));\n\n //keep only circles\n List<Node> possC = new LinkedList<>(possAandC);\n possC.retainAll(graph.getNodesInTo(b, Endpoint.CIRCLE));\n\n for (Node a : possA) {\n for (Node c : possC) {\n if (!graph.isParentOf(a, c)) {\n continue;\n }\n\n LinkedList<Node> reachable = new LinkedList<>();\n reachable.add(a);\n if (reachablePathFindOrient(graph, a, b, c, reachable)) {\n return true;\n }\n }\n }\n }\n return false;\n }", "private void connectVertex(IndoorVertex indoorV1, IndoorVertex indoorV2)\n {\n XYPos firstPos = indoorV1.getPosition();\n XYPos secondPos = indoorV2.getPosition();\n\n //Change in only X position means that the vertex's are East/West of eachother\n //Change in only Y position means that the vertex's are North/South of eachother\n if(firstPos.getX() > secondPos.getX() && Math.floor(firstPos.getY() - secondPos.getY()) == 0.0)\n {\n indoorV1.addWestConnection(indoorV2);\n indoorV2.addEastConnection(indoorV1);\n }\n else if(firstPos.getX() < secondPos.getX() && Math.floor(firstPos.getY() - secondPos.getY()) == 0.0)\n {\n indoorV1.addEastConnection(indoorV2);\n indoorV2.addWestConnection(indoorV1);\n }\n else if(firstPos.getY() > secondPos.getY() && Math.floor(firstPos.getX() - secondPos.getX()) == 0.0)\n {\n indoorV1.addSouthConnection(indoorV2);\n indoorV2.addNorthConnection(indoorV1);\n }\n else if(firstPos.getY() < secondPos.getY() && Math.floor(firstPos.getX() - secondPos.getX()) == 0.0)\n {\n indoorV1.addNorthConnection(indoorV2);\n indoorV2.addSouthConnection(indoorV1);\n }\n\n\n indoorV1.addConnection(indoorV2);\n indoorV2.addConnection(indoorV1);\n }", "public abstract void removeEdge(int from, int to);", "public static strictfp void main(String... args) {\n\t\tArrayList<Vertex> graph = new ArrayList<>();\r\n\t\tHashMap<Character, Vertex> map = new HashMap<>();\r\n\t\t// add vertices\r\n\t\tfor (char c = 'a'; c <= 'i'; c++) {\r\n\t\t\tVertex v = new Vertex(c);\r\n\t\t\tgraph.add(v);\r\n\t\t\tmap.put(c, v);\r\n\t\t}\r\n\t\t// add edges\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tif (v.getNodeId() == 'a') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'b') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'c') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'd') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'e') {\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'f') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t} else if (v.getNodeId() == 'g') {\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'h') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'i') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t// graph created\r\n\t\t// create disjoint sets\r\n\t\tDisjointSet S = null, V_S = null;\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tchar c = v.getNodeId();\r\n\t\t\tif (c == 'a' || c == 'b' || c == 'd' || c == 'e') {\r\n\t\t\t\tif (S == null) {\r\n\t\t\t\t\tS = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (V_S == null) {\r\n\t\t\t\t\tV_S = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(V_S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Disjoint sets created\r\n\t\tfor (Vertex u: graph) {\r\n\t\t\tfor (Vertex v: u.getAdjacents()) {\r\n\t\t\t\tif (DisjointSet.findSet((DisjointSet) u.getDisjointSet()) == \r\n\t\t\t\t DisjointSet.findSet((DisjointSet) v.getDisjointSet())) {\r\n\t\t\t\t\tSystem.out.println(\"The cut respects (\" + u.getNodeId() + \", \" + v.getNodeId() + \").\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public List<E> createEdgeListPath()\r\n/* */ {\r\n/* 146 */ List<E> path = new ArrayList();\r\n/* 147 */ AbstractPathElement<V, E> pathElement = this;\r\n/* */ \r\n/* */ \r\n/* 150 */ while (pathElement.getPrevEdge() != null) {\r\n/* 151 */ path.add(pathElement.getPrevEdge());\r\n/* */ \r\n/* 153 */ pathElement = pathElement.getPrevPathElement();\r\n/* */ }\r\n/* */ \r\n/* 156 */ Collections.reverse(path);\r\n/* */ \r\n/* 158 */ return path;\r\n/* */ }", "public Edge3D(I3DVertex start, I3DVertex end) {\r\n\t\tthis.start = start;\r\n\t\tthis.end = end;\r\n\t}", "@Test\n public void simpleGraph() {\n graph.edge(0, 1).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(1, 2).setDistance(1).set(speedEnc, 10, 10);\n\n // source edge does not exist -> no path\n assertNotFound(calcPath(0, 2, 5, 0));\n // target edge does not exist -> no path\n assertNotFound(calcPath(0, 2, 0, 5));\n // using NO_EDGE -> no path\n assertNotFound(calcPath(0, 2, NO_EDGE, 0));\n assertNotFound(calcPath(0, 2, 0, NO_EDGE));\n // using ANY_EDGE -> no restriction\n assertPath(calcPath(0, 2, ANY_EDGE, 1), 0.2, 2, 200, nodes(0, 1, 2));\n assertPath(calcPath(0, 2, 0, ANY_EDGE), 0.2, 2, 200, nodes(0, 1, 2));\n // edges exist -> they are used as restrictions\n assertPath(calcPath(0, 2, 0, 1), 0.2, 2, 200, nodes(0, 1, 2));\n }", "public void testEdgesSet_ofVertices() {\n System.out.println(\"edgesSet\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n\n for (int i = 0; i < 25; i++) {\n for (int j = 0; j < 25; j++) {\n Set<Edge<Integer>> set = graph.edgesSet(new Integer(i), new Integer(j));\n\n if ((i + j) % 2 == 0) {\n Assert.assertEquals(set.size(), 1);\n } else {\n Assert.assertEquals(set.size(), 0);\n }\n }\n }\n }", "public void fillTriangle(int px1, int py1, int px2, int py2, int px3, \n int py3, int color) {\n \n int[] ordered = new int[6];\n if (!orderByPointY(px1, py1, px2, py2, px3, py3, ordered)) {\n if (!orderByPointY(px2, py2, px1, py1, px3, py3, ordered)) {\n if (!orderByPointY(px3, py3, px2, py2, px1, py1, ordered)) {\n String errorMsg = \"could not order triangle points !\";\n throw new RuntimeException(errorMsg);\n }\n }\n }\n px1 = ordered[0]; py1 = ordered[1];\n px2 = ordered[2]; py2 = ordered[3];\n px3 = ordered[4]; py3 = ordered[5];\n fillHalfTriangle(px1, py1, px2, py2, px3, py3, color, 1); // top\n fillHalfTriangle(px3, py3, px2, py2, px1, py1, color, -1); // down\n }", "public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter w = new PrintWriter(System.out);\n\n String[] inputs = r.readLine().split(\" \");\n \n int start = Integer.parseInt(inputs[0]);\n int end = Integer.parseInt(inputs[1]); \n //today you learned that the distance between the eyes from years 10 to 15 expands from about 62 to 64mm.\n \n inputs = r.readLine().split(\" \");\n \n int n = Integer.parseInt(inputs[0]); //number of junktions\n int m = Integer.parseInt(inputs[1]); //number of rodes\n \n Vertex[] vertices = new Vertex[n + 1];\n for (int i = 0; i < n; i++) {\n inputs = r.readLine().split(\" \");\n boolean blue = inputs[0].equals(\"B\");\n vertices[i + 1] = new Vertex(i + 1, blue, Integer.parseInt(inputs[0]), Integer.parseInt(inputs[1]), Integer.parseInt(inputs[2]));\n }\n \n for (int i = 0; i < m; i++) {\n inputs = r.readLine().split(\" \");\n int a = Integer.parseInt(inputs[0]);\n int b = Integer.parseInt(inputs[1]);\n int c = Integer.parseInt(inputs[2]);\n vertices[a].addPath(b, c);\n vertices[b].addPath(a, c);\n }\n \n \n \n \n }", "private void drawEdge(Graphics2D g2d,Point p0, Point p1) {\n int x0 = (int)p0.x + FRAME_WIDTH/2;\n int y0 = FRAME_HEIGHT/2 - (int)p0.y ;\n int x1 = (int)p1.x + FRAME_WIDTH/2;\n int y1 = FRAME_HEIGHT/2 - (int)p1.y;\n if(DEBUG) System.out.println(\"In drawEdge: \" + x0 + \" \" + y0 + \" \"\n + x1 + \" \" + y1);\n g2d.drawLine(x0, y0, x1, y1);\n \n }", "public void isItATriangle(){\n Scanner firstSide = new Scanner(System.in);\n System.out.println(\"Please put in your first side length: \");\n int side1 = firstSide.nextInt();\n\n Scanner secondSide = new Scanner(System.in);\n System.out.println(\"Please put in your second side length: \");\n int side2 = secondSide.nextInt();\n\n Scanner thirdSide = new Scanner(System.in);\n System.out.println(\"Please put in your third side length: \");\n int side3 = thirdSide.nextInt();\n\n System.out.println(\"\\nNow calculating to see if you have a Triangle...\");\n System.out.println(\"Your first side value: \" + side1 + \"\\nYour second side value: \" + side2 + \"\\nYour third side value: \" + side3 + \"\\n\");\n\n //*****************************************************************\n /*\n *This is seeing is the sides are going to be enough for a Triangle\n *using Triangle Inequality Theorem\n */\n if(side1 + side2 > side3){\n if(side1 + side3 > side2){\n if(side2 + side3 > side1){\n System.out.println(\"Yes! This is a Triangle!\");\n\n if ((side1 == side2) && (side2 == side3) && (side3 == side1)){\n System.out.println(\"Oh hey! Your Triangle is an Equilaterall Triangle!\");\n }else{\n System.out.print(\"\");\n }\n\n if (((side1 == side2) && (side2 != side3)) || ((side2 == side3) && (side3 != side1)) || ((side3 == side1) && (side3 != side2))){\n System.out.println(\"Wow! Your triangle is Isosoleces!\");\n }else{\n System.out.print(\"\");\n }\n\n }else{\n System.out.println(\"No, Not a Triangle\");\n }\n }else{\n System.out.println(\"No, Not a Triangle\");\n }\n }else{\n System.out.println(\"No, Not a Triangle.\");\n return;\n }\n\n //checking to see if equilaterall\n\n }", "public void setSeparateCommonEdges(boolean a) {\n\t\tthis.separateCommonEdges = a;\n\t}", "@Test\n\tpublic void connectTest_North_VerticalStraight() throws Exception {\n\n\t\tfinal Factory<Node> railNodeFactory = new DefaultRailNodeFactory();\n\n\t\tfinal RailNode switchLeft0RailNode = (RailNode) railNodeFactory.create(1, 1, ShapeType.SWITCH_LEFT_0);\n\t\tfinal RailNode horizontalRailNode = (RailNode) railNodeFactory.create(1, 0, ShapeType.STRAIGHT_VERTICAL);\n\n\t\tfinal Model model = new DefaultModel();\n\t\tmodel.setNode(1, 1, switchLeft0RailNode);\n\t\tmodel.setNode(1, 0, horizontalRailNode);\n\n\t\tswitchLeft0RailNode.connect(model);\n\t\thorizontalRailNode.connect(model);\n\n\t\tSystem.out.println(switchLeft0RailNode.toString());\n\t\tSystem.out.println(horizontalRailNode.toString());\n\n\t\tassertEquals(1, switchLeft0RailNode.getGraphNodeOne().getChildren().size());\n\t\tassertEquals(0, switchLeft0RailNode.getGraphNodeTwo().getChildren().size());\n\t\tassertEquals(2, switchLeft0RailNode.getGraphNodeOne().getChildren().get(0).getId());\n\n\t\tassertEquals(0, horizontalRailNode.getGraphNodeOne().getChildren().size());\n\t\tassertEquals(1, horizontalRailNode.getGraphNodeTwo().getChildren().size());\n\t\tassertEquals(1, horizontalRailNode.getGraphNodeTwo().getChildren().get(0).getId());\n\t}", "public boolean isAdjacent(int from, int to) {\n//your code here\n// LinkedList<Edge> list = adjLists[from];\n// for (Edge a : list) {\n// if(a.from()==from&&a.to()==to){\n// return true;\n// }\n// };\n// return false;\n return pathExists(from, to);\n }", "List<ConnectingFlights> getPossibleRoutes(int loc_start_id, int loc_end_id);" ]
[ "0.58128554", "0.5631211", "0.56077766", "0.5564957", "0.55443126", "0.54480267", "0.54217476", "0.54206455", "0.53802973", "0.5371011", "0.53528756", "0.53354454", "0.5296786", "0.52850884", "0.5279236", "0.5276082", "0.52682716", "0.51731193", "0.5158775", "0.5140045", "0.51367486", "0.51170516", "0.51116794", "0.5105296", "0.509366", "0.5082028", "0.5066157", "0.5055363", "0.50432485", "0.5037744", "0.50255024", "0.5017238", "0.49866253", "0.49644142", "0.49640036", "0.49587515", "0.49534577", "0.4950707", "0.49494424", "0.49462527", "0.4944163", "0.4942597", "0.4936594", "0.4933661", "0.49310467", "0.49270278", "0.49197602", "0.49178737", "0.49114504", "0.49013487", "0.49013045", "0.48848566", "0.4876487", "0.48510692", "0.48448026", "0.48383418", "0.4835776", "0.4825092", "0.48244995", "0.48139766", "0.48096034", "0.48094544", "0.4807588", "0.48057815", "0.48053554", "0.47954348", "0.47924906", "0.4785699", "0.47828066", "0.4774491", "0.4768511", "0.47622824", "0.4758216", "0.47445366", "0.474322", "0.4743024", "0.47369486", "0.4727809", "0.47269443", "0.47232467", "0.4722634", "0.4722433", "0.47138965", "0.47011065", "0.4698601", "0.4696937", "0.46963513", "0.46949255", "0.46934253", "0.46896785", "0.46856952", "0.46714386", "0.4668858", "0.4668063", "0.4664861", "0.465177", "0.46516183", "0.46462515", "0.46421602", "0.46412528" ]
0.5185486
17
Constructs a triple of nodes.
public IonIndependenceFacts(Node x, Node y, Collection<List<Node>> z) { if (x == null || y == null || z == null) { throw new NullPointerException(); } this.x = x; this.y = y; this.z = z; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "TripleGraph createTripleGraph();", "NodeChain createNodeChain();", "private void createNodes() {\n head = new ListNode(30);\n ListNode l2 = new ListNode(40);\n ListNode l3 = new ListNode(50);\n head.next = l2;\n l2.next = l3;\n }", "public TrieNode(){}", "public void create(Triple start, Triple end) {\n\t\t\n\t}", "public void createNode()\r\n\t{\r\n\t\tTreeNode first=new TreeNode(1);\r\n\t\tTreeNode second=new TreeNode(2);\r\n\t\tTreeNode third=new TreeNode(3);\r\n\t\tTreeNode fourth=new TreeNode(4);\r\n\t\tTreeNode fifth=new TreeNode(5);\r\n\t\tTreeNode sixth=new TreeNode(6);\r\n\t\tTreeNode seventh=new TreeNode(7);\r\n\t\tTreeNode eight=new TreeNode(8);\r\n\t\tTreeNode nine=new TreeNode(9);\r\n\t\troot=first;\r\n\t\tfirst.left=second;\r\n\t\tfirst.right=third;\r\n\t\tsecond.left=fourth;\r\n\t\tthird.left=fifth;\r\n\t\tthird.right=sixth;\r\n\t\tfifth.left=seventh;\r\n\t\tseventh.right=eight;\r\n\t\teight.left=nine;\r\n\t\t\r\n\t}", "public Triple createTriple(Expression subject, Atom predicate, Expression object){\r\n\t\tExpression exp = predicate.getExpression();\r\n\t\tTriple t;\r\n\t\tif (exp == null){\r\n\t\t\tt = Triple.create(subject, predicate, object);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tt = createPath(subject, predicate, object, exp);\r\n\t\t}\r\n\t\treturn t;\r\n\t}", "public TrieNode() {\n \n }", "TNode createTNode();", "private BTNode createNode() {\n BTNode btNode;\n btNode = new <DataPair>BTNode ();\n btNode.mIsLeaf = true;\n btNode.mCurrentKeyNum = 0;\n return btNode;\n }", "Vertex createVertex();", "public TrieNode() {\n children = new HashMap<>();\n isWord = false;\n }", "public Tour(Point a, Point b, Point c, Point d) {\n Node second = new Node();\n Node third = new Node();\n Node fourth = new Node();\n first.p = a;\n first.next = second;\n second.p = b;\n second.next = third;\n third.p = c;\n third.next = fourth;\n fourth.p = d;\n fourth.next = first;\n }", "private static TriNode buildTri(String[] str) {\r\n TriNode n = new TriNode();\r\n for (String s : str) {\r\n n.append(s);\r\n }\r\n return n;\r\n }", "public static TreeNode generateBinaryTree3() {\n // Nodes\n TreeNode root = new TreeNode(1);\n TreeNode rootLeft = new TreeNode(2);\n TreeNode rootLeftLeft = new TreeNode(3);\n TreeNode rootLeftLeftLeft = new TreeNode(4);\n TreeNode rootRight = new TreeNode(5);\n TreeNode rootRightRight = new TreeNode(6);\n TreeNode rootRightRightRight = new TreeNode(7);\n // Edges\n root.left = rootLeft;\n rootLeft.left = rootLeftLeft;\n rootLeftLeft.left = rootLeftLeftLeft;\n root.right = rootRight;\n rootRight.right = rootRightRight;\n rootRightRight.right = rootRightRightRight;\n\n // Return root\n return root;\n }", "private Node createNode(EventPair ep, Color c, Node parent) {\n Node node = new Node();\n node.ID = ep.ID;\n node.count = ep.count;\n node.color = c;\n node.left = createNullLeaf(node);\n node.right = createNullLeaf(node);\n node.parent = parent;\n return node;\n }", "TriNode() {\r\n children = new HashMap<>();\r\n isValidWord = false;\r\n }", "void createNode(NodeKey key);", "public ThingTimeTriple(String english, Entity t, long from, long to)\r\n/* 390: */ {\r\n/* 391:344 */ this.english = english;\r\n/* 392:345 */ this.t = t;\r\n/* 393:346 */ this.from = from;\r\n/* 394:347 */ this.to = to;\r\n/* 395: */ }", "public TrieNode() {\n children = new HashMap<Character, TrieNode>();\n hasWord = false;\n }", "public TrieTree() {\n head = new Node();\n head.pass = 0;\n head.end = 0;\n head.next = new Node[26];\n }", "public TrieNode() {\n this.arr = new TrieNode[26];\n }", "private void instantiateVarsTriple(IntVar var1, int coeff1, IntVar var2, int coeff2, IntVar var3, int coeff3, int constant, Propagator prop) throws ContradictionException {\n this.instantiateThirdVar(var1, coeff1, var2, coeff2, var3, coeff3, constant, prop);\n this.instantiateThirdVar(var2, coeff2, var3, coeff3, var1, coeff1, constant, prop);\n this.instantiateThirdVar(var1, coeff1, var3, coeff3, var2, coeff2, constant, prop);\n }", "public Vertex3D() {\n this(0.0, 0.0, 0.0);\n }", "public TrieNode() {\n map = new HashMap<Character, TrieNode>();\n isLeaf = false;\n }", "public void create(NetworkNode networkNode);", "public Tuple(Node nd, ArrayList<Integer> list, char [] str, char letter){\r\n node = nd;\r\n trail = list;\r\n int charArrayLength = str.length;\r\n prefix = new char[charArrayLength + 1];\r\n System.arraycopy(str, 0, prefix, 0, charArrayLength);\r\n prefix[charArrayLength] = letter;\r\n alphabet = letter;\r\n }", "void nodeCreate( long id );", "public Trie() {\n root = new Node();\n }", "protected SceneGraphObject createNode( Class state ) {\n\tSceneGraphObject ret;\n\n\ttry {\n\t ret = (SceneGraphObject)state.newInstance();\n\n\t //System.err.println(\"Created J3D node for \"+className );\n\t} catch( IllegalAccessException exce ) {\n\t throw new SGIORuntimeException( \"Broken State class for \"+\n\t\t\t\t\t\tstate.getClass().getName()+\" - IllegalAccess\" );\n\t} catch( InstantiationException excep ) {\n\t throw new SGIORuntimeException( \"Broken State class for \"+\n\t\t\t\t\t\tstate.getClass().getName() );\n\t}\n\n\treturn ret;\n }", "public Node() {}", "public Node() {}", "public Node() {}", "public Node() {}", "public Trie() {\n\t\tnodes = new Trie[26];\n\t}", "public Node(){}", "Node(Vertex x,int w)\n\t{\n\t\tv=x;\n\t\tweight=w;\n\t}", "private static Node createLoopedList()\n {\n Node n1 = new Node(1);\n Node n2 = new Node(2);\n Node n3 = new Node(3);\n Node n4 = new Node(4);\n Node n5 = new Node(5);\n Node n6 = new Node(6);\n Node n7 = new Node(7);\n Node n8 = new Node(8);\n Node n9 = new Node(9);\n Node n10 = new Node(10);\n Node n11 = new Node(11);\n\n n1.next = n2;\n n2.next = n3;\n n3.next = n4;\n n4.next = n5;\n n5.next = n6;\n n6.next = n7;\n n7.next = n8;\n n8.next = n9;\n n9.next = n10;\n n10.next = n11;\n n11.next = n5;\n\n return n1;\n }", "public TrieNode() {\n\t\t\tisWord = false;\n\t\t\tchildren = new HashMap<>();\n\t\t}", "public Triangle() { \n super(\"Triangle: \");\n this.setP1(new Point());\n this.setP2(new Point());\n this.setP3(new Point());\n }", "public static Node constructTree() {\n\n Node node2 = new Node(2, null, null);\n Node node8 = new Node(8, null, null);\n Node node12 = new Node(12, null, null);\n Node node17 = new Node(17, null, null);\n\n Node node6 = new Node(6, node2, node8);\n Node node15 = new Node(15, node12, node17);\n\n //Root Node\n Node node10 = new Node(10, node6, node15);\n\n return node10;\n }", "public abstract GraphNode<N, E> createNode(N value);", "public TrieNode() {\n this.children = new TrieNode[256];\n this.code = -1;\n }", "public Trie() {\n \troot=new TrieNode();\n }", "public Triangle(\n IPoint firstPoint,\n IPoint secondPoint,\n IPoint thirdPoint,\n IPrimitive parent)\n {\n super(parent);\n this.addVertex(firstPoint);\n this.addVertex(secondPoint);\n this.addVertex(thirdPoint);\n\n }", "public TrieTree()\n {\n prefixes = 0;\n children = new TreeMap<>();\n childrenAdded = new ArrayList<>();\n }", "public static void main(String[] args) \n\t{\n\t\ttree x = new tree(0);\n\t\t\n\t\ttreenode r = x.root;\n\t\t\n//\t\ttreenode c = r;\n//\t\tfor(int i =1;i<=4;i++)\n//\t\t{\n//\t\t\tfor(int j=0;j<=8;j=j+4)\n//\t\t\t{\n//\t\t\t\ttreenode n = new treenode(i+j);\n//\t\t\t\tif(j==0)\n//\t\t\t\t{\n//\t\t\t\t\tr.child.add(n);\n//\t\t\t\t\tc = n;\n//\t\t\t\t}\n//\t\t\t\telse\n//\t\t\t\t{\n//\t\t\t\t\tc.child.add(n);\n//\t\t\t\t\tc = n;\n//\t\t\t\t}\n//\t\t\t}\n//\t\t}\n\t\ttreenode c1 = r;\n\t\ttreenode c2 = r;\n\t\ttreenode c3 = r;\n\t\ttreenode c4 = r;\n\t\tfor(int i=1;i<13;i++)\n\t\t{\n\t\t\ttreenode n = new treenode(i);\n\t\t\tif(i%4==1)\n\t\t\t{\n\t\t\t\tc1.child.add(n);\n\t\t\t\tc1 = n;\n\t\t\t}\n\t\t\tif(i%4==2)\n\t\t\t{\n\t\t\t\tc2.child.add(n);\n\t\t\t\tc2 = n;\n\t\t\t}\n\t\t\tif(i%4==3)\n\t\t\t{\n\t\t\t\tc3.child.add(n);\n\t\t\t\tc3 = n;\n\t\t\t}\n\t\t\tif(i%4==0)\n\t\t\t{\n\t\t\t\tc4.child.add(n);\n\t\t\t\tc4 = n;\n\t\t\t}\n\t\t}\n\t\tx.traverse(r);\n\t}", "public TrieNode() {children = new HashMap<Character, TrieNode>();hasWord = false;}", "private Board create3by3Board() {\n Tile[][] tiles;\n Tile t1 = new Tile(0, 3);\n Tile t2 = new Tile(1, 3);\n Tile t3 = new Tile(2, 3);\n Tile t4 = new Tile(3, 3);\n Tile t5 = new Tile(4, 3);\n Tile t6 = new Tile(5, 3);\n Tile t7 = new Tile(6, 3);\n Tile t8 = new Tile(7, 3);\n Tile t9 = new Tile(8, 3);\n tiles = new Tile[3][3];\n tiles[0][0] = t7;\n tiles[0][1] = t6;\n tiles[0][2] = t2;\n tiles[1][0] = t5;\n tiles[1][1] = t9;\n tiles[1][2] = t3;\n tiles[2][0] = t1;\n tiles[2][1] = t8;\n tiles[2][2] = t4;\n return new Board(tiles);\n }", "public Node(T t, Node n) {\r\n \r\n element = t;\r\n next = n;\r\n }", "Graph(int n){\r\n numberOfVertices = n;\r\n adjacentVertices = new LinkedList[numberOfVertices];\r\n for (int i = 0; i < numberOfVertices; i++){\r\n adjacentVertices[i] = new LinkedList<>();\r\n }\r\n }", "public Graph(Node... nodes)\r\n\t{\r\n\t\tedges = new ArrayList<>();\r\n\r\n\t\tfor (int i = 0; i < nodes.length - 1; i += 2)\r\n\t\t{\r\n\t\t\tedges.add(new Node[]\r\n\t\t\t{\r\n\t\t\t\tnodes[i], nodes[i + 1]\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (nodes.length % 2 == 1)\r\n\t\t{\r\n\t\t\tedges.add(new Node[]\r\n\t\t\t{\r\n\t\t\t\tnodes[nodes.length - 1]\r\n\t\t\t});\r\n\t\t}\r\n\t}", "public Trie() \n\t {\n\t root = new TrieNode();\n\t }", "@SafeVarargs\n\tpublic static <R> Tuple<R> construct(R... data) {\n\t\tLinkedList<R> list = new LinkedList<>();\n\t\tfor (R element : data) {\n\t\t\tlist.add(element);\n\t\t}\n\n\t\treturn new Tuple<>(list);\n\t}", "Node(TNode i, Node n){\t\t\t//A function to create a Node\n\t\telement = i;\t\t\t\t\n\t\tnext = n;\n\t}", "public Trie() {\n root = new TrieNode();\n }", "public Trie() {\n root = new TrieNode();\n }", "@Override\n public Setup build(int numberOfNodes) {\n Setup setup = new Setup();\n List connections = setup.getConnections();\n List immovableNodes = setup.getImmovableNodes();\n List typicalNodes = setup.getTypicalNodes();\n\n List<TypicalNode> nodes = new LinkedList<>();\n TypicalNode typicalNode;\n int id = 1;\n double n = (numberOfNodes - 1)/2.0;\n for (double i = -n; i < n + 1; i++, id++) {\n if (i == -n || i == n) {\n typicalNode = new ImmovableNode(i, 0, 0, id);\n immovableNodes.add(typicalNode);\n } else {\n typicalNode = new TypicalNode(i, 0, 0, id);\n typicalNodes.add(typicalNode);\n }\n nodes.add(typicalNode);\n }\n\n for (int i = 0; i < nodes.size() - 1; i++) {\n connections.add(new Connection(nodes.get(i), nodes.get(i+1), 0.07));\n }\n\n setup.setCentralNode(new TypicalNode(0, -1, 0, 0));\n\n return setup;\n }", "void graph3() {\n\t\tconnect(\"0\", \"0\");\n\t\tconnect(\"2\", \"2\");\n\t\tconnect(\"2\", \"3\");\n\t\tconnect(\"3\", \"0\");\n\t}", "public Tuple(List<Term> elts) {\n\t\tTerm[] tmp = new Term[elts.size()];\n\t\tthis.elts = elts.toArray(tmp);\n\t}", "public void insertTripleDistributedByObject(Triple triple) {\n\r\n }", "Node<X> make(Node<X> left, Node<X> right);", "public Triangulo(double l1, double l2, double l3)\n {\n // initialise instance variables\n lado1=l1;\n lado2=l2;\n lado3=l3;\n }", "public Node(){\n this(9);\n }", "public Triangle( Point p1, Point p2, Point p3 ) {\n super(\"Triangle: \");\n this.setP1(p1);\n this.setP2(p2);\n this.setP3(p3);\n }", "private static Node setupMatrix()\n {\n Node thomasAnderson = graphDb.createNode();\n thomasAnderson.setProperty( \"name\", \"Thomas Anderson\" );\n thomasAnderson.setProperty( \"age\", 29 );\n \n Node trinity = graphDb.createNode();\n trinity.setProperty( \"name\", \"Trinity\" );\n Relationship rel = thomasAnderson.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"3 days\" );\n \n Node morpheus = graphDb.createNode();\n morpheus.setProperty( \"name\", \"Morpheus\" );\n morpheus.setProperty( \"rank\", \"Captain\" );\n morpheus.setProperty( \"occupation\", \"Total badass\" );\n thomasAnderson.createRelationshipTo( morpheus, MatrixRelationshipTypes.KNOWS );\n rel = morpheus.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"12 years\" );\n \n Node cypher = graphDb.createNode();\n cypher.setProperty( \"name\", \"Cypher\" );\n cypher.setProperty( \"last name\", \"Reagan\" );\n rel = morpheus.createRelationshipTo( cypher, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"public\" );\n \n Node smith = graphDb.createNode();\n smith.setProperty( \"name\", \"Agent Smith\" );\n smith.setProperty( \"version\", \"1.0b\" );\n smith.setProperty( \"language\", \"C++\" );\n rel = cypher.createRelationshipTo( smith, MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"secret\" );\n rel.setProperty( \"age\", \"6 months\" );\n \n Node architect = graphDb.createNode();\n architect.setProperty( \"name\", \"The Architect\" );\n smith.createRelationshipTo( architect, MatrixRelationshipTypes.CODED_BY );\n \n return thomasAnderson;\n }", "public Graph(int n) {\n if (n <= 0) {\n throw new IllegalArgumentException(\"There must be at least 1 node in the graph\");\n }\n nodes = new MyArrayList<>(n);\n // adds nodes 1-n *in indices 0-(n-1)*\n for (int i = 0; i < n; i++) {\n nodes.add(new Node(i + 1));\n }\n }", "private Node(int c) {\n this.childNo = c; // Construct a node with c children.\n }", "public Trie() {\n \troot=new TrieNode();\n }", "TupleExpr createTupleExpr();", "public GraphNode buildGraph()\n {\n GraphNode node1 = new GraphNode(1);\n GraphNode node2 = new GraphNode(2);\n GraphNode node3 = new GraphNode(3);\n GraphNode node4 = new GraphNode(4);\n List<GraphNode> v = new ArrayList<GraphNode>();\n v.add(node2);\n v.add(node4);\n node1.neighbours = v;\n v = new ArrayList<GraphNode>();\n v.add(node1);\n v.add(node3);\n node2.neighbours = v;\n v = new ArrayList<GraphNode>();\n v.add(node2);\n v.add(node4);\n node3.neighbours = v;\n v = new ArrayList<GraphNode>();\n v.add(node3);\n v.add(node1);\n node4.neighbours = v;\n return node1;\n }", "public DNode(String e, DNode p, DNode n) { element = e; prev = p; next = n;}", "public Triangle (double x1,double y1,double x2, double y2,double x3,double y3)\r\n {\r\n v1 = new Point(x1,y1);\r\n v2 = new Point(x2,y2);\r\n v3 = new Point(x3,y3);\r\n }", "public Node(){\n\n\t\t}", "private Node() {\n\n }", "public Triangle (int x, int y, int z){ \r\n \r\n \r\n }", "public Node(double x, double y, NodeType type) {\n this(new Coordinates(x, y), type);\n }", "public Trie() {\n root = new TreeNode();\n }", "public DoubleNode(){\r\n this( null, '\\0', null );\r\n }", "public Node(String name, String state) {\n\t\tthis.name = name;\n\t\tthis.state = state;\n\t\tID = (name + state + lon + \"\" + lat).hashCode();\n\n\t\tedgeList = new ArrayList<Edge>();\n\t}", "public Trie() { // 这里只需要两个field, 不需要存自身值\n root = new TrieNode();\n }", "private void constructTree() {\r\n\t\tsortLeaves();\r\n\t\tNode currentNode;\r\n\t\tint index = 0;\r\n\t\t\tdo{\r\n\t\t\t\t// Create a new node with the next two least frequent nodes as its children\r\n\t\t\t\tcurrentNode = new Node(this.treeNodes[0], this.treeNodes[1]); \r\n\t\t\t\taddNewNode(currentNode);\r\n\t\t\t}\r\n\t\t\twhile (this.treeNodes.length > 1); // Until there is only one root node\r\n\t\t\tthis.rootNode = currentNode;\r\n\t\t\tindex++;\r\n\t}", "public AdjListNode(int n) {\n\t\tvertexIndex = n;\n\t}", "private Node constructParsedTree(Node[] nodes) {\n int rootIndex = 0;\n for (int i = 0; i < nodes.length; i++) {\n if (nodes[i].getFather() > 0)\n nodes[nodes[i].getFather() - 1].addChild(nodes[i]);\n else\n rootIndex = i;\n }\n return nodes[rootIndex];\n }", "public Graph(int numberOfVertices){\r\n this.numberOfVertices = numberOfVertices;\r\n this.adjacencyList = new TreeMap<>();\r\n }", "public Node createNode(String p_name) {\n\t\tNode n = new Node(p_name, this);\n\t\taddNode(n);\n\t\treturn n;\n\t}", "public Node(String n) {\n\t\tname = n;\n\t\t//connections = new ArrayList<Node>();\n\t\t//connections = new HashSet<String>();\n\t\t\n\t\t//checkRep();\n\t}", "public Triangle() {\n\t\tsuper.addPoint(new java.awt.Point(0,1));\n\t\tsuper.addPoint(new java.awt.Point(1,0));\n\t\tsuper.addPoint(new java.awt.Point(2,1));\n\t}", "private final void createAndAddNode(String name) {\n\t}", "public TrieNode(String name) {\n this.map = new TreeMap<>();\n this.name = name;\n this.key = null;\n }", "private D3() {\n super(3);\n }", "public Trie() {\n root = new TrieNode();\n }", "protected SceneGraphObject createNode( String className ) {\n\tSceneGraphObject ret;\n\n\ttry {\n Class state = Class.forName( className, true, control.getClassLoader() );\n\n\t ret = createNode( state );\n\n\t //System.err.println(\"Created J3D node for \"+className );\n\t} catch(ClassNotFoundException e) {\n if (control.useSuperClassIfNoChildClass())\n ret = createNodeFromSuper( className );\n else\n throw new SGIORuntimeException( \"No Such Class \"+\n\t\t\t\t\t\tclassName );\n\t}\n\n\treturn ret;\n }", "private Tuples() {}", "public static HuffmanNode[] createNodes(int[] freqNums){\n HuffmanNode[] nodeArr = new HuffmanNode[94];\n for(int i = 0; i < freqNums.length; i++){\n nodeArr[i] = new HuffmanNode((char)(i+32), freqNums[i], null, null);\n }\n return nodeArr;\n }", "Node(Object e, Node p, Node n) {\n element = e;\n previous = p;\n next = n;\n }", "public CassandraNode() {\r\n\t\tthis(null, 0);\r\n\t}", "public Node()\n {\n this.name=\"/\";\n this.type=0;\n this.stage=0;\n children=new ArrayList<Node>();\n }", "protected Node createSceneGraph(Entity entity) {\n String name = cell.getCellID().toString();\n\n /* Create the new mesh for the shape */\n TriMesh mesh = new Box(name, new Vector3f(), 0.5f, 0.5f, 0.5f);\n\n /* Create the scene graph object and set its wireframe state */\n node = new Node();\n node.attachChild(mesh);\n node.setModelBound(new BoundingSphere());\n node.updateModelBound();\n node.setName(\"Cell_\"+cell.getCellID()+\":\"+cell.getName());\n\n return node;\n }", "Vertex(){}", "public Node(){\r\n primarySequence = null;\r\n dotBracketString = null;\r\n validity = false;\r\n prev = null;\r\n next = null;\r\n }" ]
[ "0.70181614", "0.6185237", "0.60655576", "0.5941989", "0.58958775", "0.57093734", "0.57078505", "0.5702455", "0.56916475", "0.5667885", "0.56088084", "0.5595286", "0.55942565", "0.5535861", "0.5525903", "0.54929143", "0.54902476", "0.54774284", "0.54501265", "0.5427246", "0.54270077", "0.5384833", "0.5383177", "0.5380942", "0.53565025", "0.53554195", "0.5341954", "0.53342843", "0.5329878", "0.53284746", "0.53205687", "0.53205687", "0.53205687", "0.53205687", "0.5317204", "0.5313357", "0.53097504", "0.5308182", "0.53044945", "0.5283616", "0.5273483", "0.52656937", "0.5263214", "0.5262335", "0.52590096", "0.5253575", "0.5246653", "0.5239128", "0.5227735", "0.5219223", "0.5209126", "0.5205649", "0.5198436", "0.5192703", "0.51901466", "0.51789117", "0.51789117", "0.51692045", "0.51663256", "0.5159162", "0.51590794", "0.51425964", "0.51380426", "0.51305676", "0.5128603", "0.5122997", "0.5120536", "0.5110446", "0.51088077", "0.50951445", "0.50931513", "0.509032", "0.5089022", "0.5084989", "0.50715667", "0.5068596", "0.5068311", "0.50638187", "0.50634944", "0.5063318", "0.50628376", "0.5058872", "0.5056179", "0.50541645", "0.50541013", "0.50526243", "0.50524133", "0.5045068", "0.5043695", "0.5043302", "0.50422853", "0.5041751", "0.50380325", "0.5035886", "0.50358266", "0.5032723", "0.50174695", "0.50164396", "0.50127274", "0.5012691", "0.50114745" ]
0.0
-1
Constructs the list of treks between node1 and node2.
private static void treks(Graph graph, Node node1, Node node2, LinkedList<Node> path, List<List<Node>> paths) { path.addLast(node1); for (Edge edge : graph.getEdges(node1)) { Node next = Edges.traverse(node1, edge); if (next == null) { continue; } if (path.size() > 1) { Node node0 = path.get(path.size() - 2); if (next == node0) { continue; } if (graph.isDefCollider(node0, node1, next)) { continue; } } if (next == node2) { LinkedList<Node> _path = new LinkedList<>(path); _path.add(next); paths.add(_path); continue; } if (path.contains(next)) { continue; } treks(graph, next, node2, path, paths); } path.removeLast(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ArrayList<GraphNode> getAroundNodes(GraphNode n1){\n ArrayList<GraphNode> temp1 = new ArrayList<GraphNode>();\n if(!n1.isValid())\n return temp1;\n EdgeList<GraphEdge> m1 = edgeListVector.get(n1.getIndex());\n\n\n for(GraphEdge e1:m1){\n temp1.add(nodeVector.get(e1.getTo()));\n }\n return temp1;\n }", "void graph2() {\n\t\tconnect(\"1\", \"7\");\n\t\tconnect(\"1\", \"8\");\n\t\tconnect(\"1\", \"9\");\n\t\tconnect(\"9\", \"1\");\n\t\tconnect(\"9\", \"0\");\n\t\tconnect(\"9\", \"4\");\n\t\tconnect(\"4\", \"8\");\n\t\tconnect(\"4\", \"3\");\n\t\tconnect(\"3\", \"4\");\n\t}", "private static void commonNodesIterInOrd(Node root1,Node root2)\n {\n if(root1 == null || root2 == null) return;\n \n LinkedList<Node> stack1 = new LinkedList<>();\n LinkedList<Node> stack2 = new LinkedList<>();\n \n Node n1 = root1, n2 = root2;\n \n while(true)\n {\n if(n1!=null)\n {\n stack1.push(n1); n1 = n1.left;\n }\n if(n2!=null)\n {\n stack2.push(n2); n2 = n2.left;\n } \n \n if(n1 == null && n2 == null)\n {\n if(stack1.size() == 0 || stack2.size() == 0)\n break;\n \n n1 = stack1.peekFirst(); n2 = stack2.peekFirst();\n \n if(n1.data < n2.data)\n {\n stack1.pop(); n1 = n1.right; n2 = null;\n }\n else if(n1.data > n2.data)\n {\n stack2.pop(); n2 = n2.right; n1 = null;\n }\n else\n {\n stack1.pop(); stack2.pop(); \n System.out.print(n1.data+\" \");\n n1 = n1.right; n2 = n2.right;\n }\n }\n }\n }", "public static Tree reproduce(Tree tree1, Tree tree2){\n Tree tree1Copy = tree1.treeCopy();\n if (tree2 == null) System.out.println(\"know\");\n if (tree1 == null) System.out.println(\"know\");\n Tree tree2Copy = tree2.treeCopy();\n //select tree1 one crossover point\n //select terminal node as crossover with 10 percent probability. o\\w pick function\n \n Node tree1Cross;\n tree1Cross = getCrossType(tree1Copy);\n //select tree2 crossover points\n \n Node tree2Cross;\n tree2Cross = getCrossType(tree2Copy);\n \n tree1Cross.setData(tree2Cross.getData());\n tree1Cross.setLeft(tree2Cross.getLeft());\n tree1Cross.setRight(tree2Cross.getRight());\n return tree1Copy;\n \n \n }", "NodeChain createNodeChain();", "public static void main(String[] args) {\n LinkedListTar2.Node anchor=new LinkedListTar2.Node(2);\n LinkedListTar2.Node node1 =\n new LinkedListTar2.Node(90,\n new LinkedListTar2.Node(171,\n new LinkedListTar2.Node(11,\n new LinkedListTar2.Node(1))));\n LinkedListTar2 list1=new LinkedListTar2(anchor,node1);\n LinkedListTar2.Node node=new LinkedListTar2.Node(4);\n\n\n list1.insertionSortLinkedList();\n // list1.printList();\n //list1.bubbleSortLinkedList();\n//list1.insertionSortLinkedList();\n // list1.insertNode(node);\n // list1.printList();\n//list1.printList();\n\n\n\n NodeWithHead.Node list2 =\n new NodeWithHead.Node(1,\n new NodeWithHead.Node(2,\n new NodeWithHead.Node(3)));\n NodeWithHead.Node list3 =\n new NodeWithHead.Node(4,\n new NodeWithHead.Node(10,\n new NodeWithHead.Node(20)));\n NodeWithHead.Node list4 =\n new NodeWithHead.Node(5,\n new NodeWithHead.Node(8,\n new NodeWithHead.Node(30)));\n\n\n\n NodeWithHead nodeWithHead=\n new NodeWithHead(list3,\n new NodeWithHead(list2,\n new NodeWithHead(list4)));\n NodeWithHead.sortKlists1(nodeWithHead);\n\n }", "public static void main(String[] args) {\n\t\tLinkedListOperation<Integer> opr1 = new LinkedListOperation<>();\r\n\t\tLinkedListOperation<Integer> opr2 = new LinkedListOperation<>();\r\n\t\t\r\n\t\tNode<Integer> node1 = new Node<>(1);\r\n\t\tNode<Integer> node2 = new Node<>(2);\r\n\t\tNode<Integer> node3 = new Node<>(3);\r\n\t\tNode<Integer> node4 = new Node<>(4);\r\n\t\tNode<Integer> node5 = new Node<>(5);\r\n\t\tNode<Integer> node6 = new Node<>(6);\r\n\t\t\r\n\t\topr1.addInLast(node1);\r\n\t\topr1.addInLast(node2);\r\n\t\topr1.addInLast(node3);\r\n\t\topr1.addInLast(node4);\r\n\t\topr1.addInLast(node5);\r\n\t\topr1.addInLast(node6);\r\n\t\t\r\n\t\topr2.addInLast(node1);\r\n\t\topr2.addInLast(node2);\r\n\t\topr2.addInLast(node3);\r\n\t\topr2.addInLast(node4);\r\n\t\topr2.addInLast(node5);\r\n\t\topr2.addInLast(node6);\r\n\t\t\r\n\t\topr1.reverse();\r\n\t\topr1.print();\r\n\t\tSystem.out.println(\"*********\");\r\n\t\topr2.reverse();\r\n\t\topr2.print();\r\n\t\t\r\n\t\t\r\n\t\t//add(opr1.start,opr2.start);\r\n\t}", "private List<SimilarNode> astCCImplmentation(HashMap<ASTNode, NodeInfo> fileNodeMap1, HashMap<ASTNode, NodeInfo> fileNodeMap2) {\n TreeMap<Integer, List<NodeInfo>> treeMap1 = convertToTreeMap(fileNodeMap1);\n TreeMap<Integer, List<NodeInfo>> treeMap2 = convertToTreeMap(fileNodeMap2);\n List<SimilarNode> result = new ArrayList<>();\n int[] array1 = getArray(treeMap1.keySet());\n int[] array2 = getArray(treeMap2.keySet());\n int i = 0;\n int j = 0;\n int sum = 0;\n while (i < array1.length && j < array2.length) {\n if (array1[i] == array2[j]) {\n // obtain list of nodeInfos for both and compare them if match found then add it to report\n List<NodeInfo> list1 = treeMap1.get(array1[i]);\n List<NodeInfo> list2 = treeMap2.get(array2[j]);\n for (NodeInfo nodeInfo1 : list1) {\n for (NodeInfo nodeInfo2 : list2) {\n if ((nodeInfo1.hashValue == nodeInfo2.hashValue) && (nodeInfo1.nodeType == nodeInfo2.nodeType)) {\n result.add(new SimilarNode(nodeInfo1, nodeInfo2));\n\n }\n }\n }\n i++;\n j++;\n\n } else if (array1[i] > array2[j]) {\n j++;\n } else if (array1[i] < array2[j]) {\n i++;\n }\n }\n return result;\n }", "protected ObservableList<TreeItem> createTreeItems(ObservableList other) {\r\n ObservableList items = FXCollections.observableArrayList();\r\n other.stream().forEach(value -> items.add(createItem(value)));\r\n return items;\r\n }", "public int compare(Object nodes1, Object nodes2) {\r\n\t\tdouble w1 = 0.0;\r\n\t\tIterator it = ((Set)nodes1).iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tDouble v = ((Node) it.next()).getWeightValueUnsynchronized(\"value\");\r\n\t\t\tw1 += (v==null ? 1.0 : v.doubleValue());\r\n\t\t}\r\n\t\tdouble w2 = 0.0;\r\n\t\tit = ((Set)nodes2).iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tDouble v = ((Node) it.next()).getWeightValueUnsynchronized(\"value\");\r\n\t\t\tw2 += (v==null ? 1.0 : v.doubleValue());\r\n\t\t}\r\n\t\tint res = Double.compare(w2, w1);\r\n\t\tif (res==0) { // oops, must figure out how they differ\r\n\t\t\tSet ns1 = (Set) nodes1;\r\n\t\t\tSet ns2 = (Set) nodes2;\r\n\t\t\tint ns1sz = ns1.size();\r\n\t\t\tint ns2sz = ns2.size();\r\n\t\t\tif (ns1sz>ns2sz) return -1; // more nodes, the better\r\n\t\t\telse if (ns1sz<ns2sz) return 1;\r\n\t\t\t// go through the *very* expensive nodes discrimination\r\n\t\t\tIterator it1 = ns1.iterator();\r\n\t\t\tIntSet nis1 = new IntSet();\r\n\t\t\twhile (it1.hasNext()) {\r\n\t\t\t\tNode n = (Node) it1.next();\r\n\t\t\t\tnis1.add(new Integer(n.getId()));\r\n\t\t\t}\r\n\t\t\tIterator it2 = ns2.iterator();\r\n\t\t\tIntSet nis2 = new IntSet();\r\n\t\t\twhile (it2.hasNext()) {\r\n\t\t\t\tNode n = (Node) it2.next();\r\n\t\t\t\tnis2.add(new Integer(n.getId()));\r\n\t\t\t}\r\n\t\t\treturn nis2.compareTo(nis1);\r\n\t\t}\r\n\t\treturn res;\r\n\t}", "public abstract List<? extends GraphEdge<N, E>> getEdges(N n1, N n2);", "List<Node> nodes();", "public List<T> findPathBetween(T data1, T data2) {\n LinkedList<T> list = new LinkedList<T>();\n if (data1 == null || data2 == null) {\n throw new IllegalArgumentException(\n \"Cannot find path between null data.\");\n } else if (data1 != null && data2 != null) {\n try {\n return helperOne(data1, data2, root, list);\n } catch (Exception e) {\n throw new NoSuchElementException(\n \"Cannot find data in the tree\");\n }\n } else {\n throw new NoSuchElementException(\n \"Cannot find data in the tree.\");\n }\n\n }", "public Object[] getStartNodes ();", "private void phaseTwo(){\r\n\r\n\t\tCollections.shuffle(allNodes, random);\r\n\t\tList<Pair<Node, Node>> pairs = new ArrayList<Pair<Node, Node>>();\r\n\t\t\r\n\t\t//For each node in allNode, get all relationshpis and iterate through each relationship.\r\n\t\tfor (Node n1 : allNodes){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//If a node n1 is related to any other node in allNodes, add those relationships to rels.\r\n\t\t\t\t//Avoid duplication, and self loops.\r\n\t\t\t\tIterable<Relationship> ite = n1.getRelationships(Direction.BOTH);\t\t\t\t\r\n\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\tNode n2 = rel.getOtherNode(n1);\t//Get the other node\r\n\t\t\t\t\tif (allNodes.contains(n2) && !n1.equals(n2)){\t\t\t\t\t//If n2 is part of allNodes and n1 != n2\r\n\t\t\t\t\t\tif (!rels.contains(rel)){\t\t\t\t\t\t\t\t\t//If the relationship is not already part of rels\r\n\t\t\t\t\t\t\tPair<Node, Node> pA = new Pair<Node, Node>(n1, n2);\r\n\t\t\t\t\t\t\tPair<Node, Node> pB = new Pair<Node, Node>(n2, n1);\r\n\r\n\t\t\t\t\t\t\tif (!pairs.contains(pA)){\r\n\t\t\t\t\t\t\t\trels.add(rel);\t\t\t\t\t\t\t\t\t\t\t//Add the relationship to the lists.\r\n\t\t\t\t\t\t\t\tpairs.add(pA);\r\n\t\t\t\t\t\t\t\tpairs.add(pB);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}", "public TraceGraph(Collection<EventNode> nodes, Event initEvent,\n Event termEvent) {\n this(initEvent, termEvent);\n this.nodes.addAll(nodes);\n }", "public void addTwoWayVertex(String node1, String node2) {\r\n addEdge(node1, node2);\r\n addEdge(node2, node1);\r\n }", "List<Node> getNodes();", "Node[] merge(List<Node> nodeList1, List<Node> nodeList2, List<Node> exhaustedNodes);", "public List<BPGNode> get() {\n List l = new ArrayList();\n l.add(n1);\n l.add(n2);\n return l;\n }", "public List<DrawableNode> getGroupSelectedNodes(Double x, Double y, Double x2, Double y2) {\n List<DrawableNode> selectedNodeList = new ArrayList<>();\n\n for (DrawableNode node : nodes) {\n if (x < node.getX() && x2 > node.getX()) {\n if (y < node.getY() && y2 > node.getY()) {\n selectedNodeList.add(node);\n }\n }\n }\n\n return selectedNodeList;\n }", "private List<BinaryTreeNode> findAncestor(BinaryTreeNode head, BinaryTreeNode node1, BinaryTreeNode node2) {\n if (head == null) {\n return new ArrayList<BinaryTreeNode>();\n }\n\n List<BinaryTreeNode> leftSearch = findAncestor(head.getLeft(), node1, node2);\n List<BinaryTreeNode> rightSearch = findAncestor(head.getRight(), node1, node2);\n\n leftSearch.addAll(rightSearch);\n if (leftSearch.contains(node1) && leftSearch.contains(node2)) {\n if (leftSearch.size() == 2) {\n leftSearch.add(head);\n }\n return leftSearch;\n }\n\n if (head.getValue() == node1.getValue() || head.getValue() == node2.getValue()) {\n leftSearch.add(head);\n }\n return leftSearch;\n }", "public TreeNode solution(TreeNode t1, TreeNode t2) {\n if(t2 == null){\n return t1;\n }\n if(t1 == null){\n return t2;\n }\n TreeNode root = new TreeNode(t1.val+t2.val);\n Peer peer = new Peer(t1,t2);\n List<TreeNode> quene = new LinkedList<>();\n quene.add(root);\n List<Peer> peers = new LinkedList();\n peers.add(peer);\n while(peers.size()>0){\n Peer cur = peers.get(0);\n TreeNode curNode = quene.get(0);\n if(cur.t1.left == null){\n curNode.left = cur.t2.left;\n }else if(cur.t2.left == null){\n curNode.left = cur.t1.left;\n }else{\n TreeNode left = new TreeNode(cur.t1.left.val + cur.t2.left.val);\n curNode.left = left;\n quene.add(left);\n peers.add(new Peer(cur.t1.left,cur.t2.left));\n }\n\n if(cur.t1.right == null){\n curNode.right = cur.t2.right;\n }else if(cur.t2.right == null){\n curNode.right = cur.t1.right;\n }else{\n TreeNode right = new TreeNode(cur.t1.right.val + cur.t2.right.val);\n curNode.right = right;\n quene.add(right);\n peers.add(new Peer(cur.t1.right,cur.t2.right));\n }\n peers.remove(0);\n quene.remove(0);\n }\n return root;\n }", "private void categoriseNodes(final CyNetwork result, final Set<CyNode> leftSet,\n\t\t\t\t final Set<CyNode> rightSet)\n\t{\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal Set<CyNode> orig1 = new HashSet<CyNode>(network1.nodesList());\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal Set<CyNode> orig2 = new HashSet<CyNode>(network2.nodesList());\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal List<CyNode> resultNodes = (List<CyNode>)result.nodesList();\n\t\t\n\t\tfinal CyAttributes nodeAttr = Cytoscape.getNodeAttributes();\n\t\t\n\t\tfor (final CyNode node : resultNodes) {\n\t\t\tfinal boolean inNetwork1 = orig1.contains(node);\n\t\t\tfinal boolean inNetwork2 = orig2.contains(node);\n\t\t\t\n\t\t\tif (inNetwork1 && inNetwork2)\n\t\t\t\t/* Do Nothing. */;\n\t\t\telse if (inNetwork1 && !inNetwork2) {\n\t\t\t\tleftSet.add(node);\n\t\t\t\tnodeAttr.setAttribute(node.getIdentifier(), visualStyleName, network1.getTitle());\n\t\t\t} else if (!inNetwork1 && inNetwork2) {\n\t\t\t\trightSet.add(node);\n\t\t\t\tnodeAttr.setAttribute(node.getIdentifier(), visualStyleName, network2.getTitle());\n\t\t\t} else // This should never happen!\n\t\t\t\tthrow new IllegalStateException(\"Do not know how to categorise a node!\");\n\t\t}\n\t}", "public static List<ResidentNode> createOrderedResidentNodeList(MultiEntityBayesianNetwork mebn){\r\n\r\n\t\tList<ResidentNode> listResident = new ArrayList<ResidentNode>(); \r\n\t\t\r\n\t\tfor(MFrag mfrag: mebn.getMFragList()){\r\n\t\t\tfor(ResidentNode node: mfrag.getResidentNodeList()){\r\n\t\t\t\tlistResident.add(node);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tCollections.sort(listResident); \t\r\n\t\t\r\n\t\treturn listResident; \r\n\t}", "private void initiate(Node start) {\n\t\t\tfor (Node node : network.nodes.values()){\r\n\t \r\n\t \t\tdouble nodeCost;\r\n\t if(node.getId() == start.getId()){\r\n\t \tnodeCost = 0.;\r\n\t }\r\n\t else{\r\n\t \tnodeCost = Double.MAX_VALUE;\r\n\t }\r\n\t DijkstraNode dijk = new DijkstraNode(node, nodeCost);\r\n\t this.remainingNodes.add(dijk);\r\n\t this.correspondingNodes.put(node, dijk);\r\n\t }\r\n\t \tCollections.sort(this.remainingNodes);\r\n//\t \tSystem.out.println(\"remainingNodes.size = \" + remainingNodes.size());\r\n\t }", "private static void commonNodesInOrdSuc(Node r1, Node r2)\n {\n Node n1 = r1, n2 = r2;\n \n if(n1==null || n2==null)\n return;\n \n while(n1.left != null)\n n1 = n1.left;\n \n while(n2.left!= null)\n n2 = n2.left;\n \n while(n1!=null && n2!=null)\n {\n if(n1.data < n2.data)\n n1 = inOrdSuc(n1);\n \n else if(n1.data > n2.data)\n n2 = inOrdSuc(n2);\n \n else\n {\n System.out.print(n1.data+\" \"); n1 = inOrdSuc(n1); n2 = inOrdSuc(n2);\n }\n }\n \n System.out.println();\n }", "private NodePath<T> collectPathNodes( WeightedGraph<T> graph, Object startNodeId, Object endNodeId ) {\n\t\tArrayDeque<Node<T>> deque = new ArrayDeque<>( searchNodes.size() );\n\t\tNode<T> startNode = graph.getNode( startNodeId );\n\t\tNode<T> endNode = graph.getNode( endNodeId );\n\t\tSearchNode<T> node = getSearchNode( endNode );\n\n\t\t//\tkeep this before we flush the maps\n\t\tfinal int finalDistance = node.getDistance();\n\n\t\t//\twalk backwards through the \"previous\" links\n\t\tdo {\n\t\t\tdeque.push( node.getNode() );\n\t\t}\n\t\twhile ( (node = getSearchNode( node.getPrevious() )) != null && ! node.equals( startNode ) );\n\t\tdeque.push( startNode );\n\n\t\tclearSearchNodes();\n\t\treturn new NodePath<>( new ArrayList<>( deque ), finalDistance );\n\t}", "public static ArrayList<String> shortestChain(Graph g, String p1, String p2) {\t\n\t\tif (g == null || p1 == null || p2 == null) {\n\t\t\treturn null;\n\t\t}\n\t\tif (g.map.get(p1) == null || g.map.get(p2) == null) {\n\t\t\treturn null;\n\t\t}\n\t\tboolean [] traversed = new boolean [g.members.length];\n\t\tboolean targetfound = false;\n\t\tArrayList <Person> names = new ArrayList<>();\n\t\tArrayList <String> shortestPath = new ArrayList<>();\n\t\tQueue <Person> list = new Queue<>();\n\t\tPerson start = g.members[g.map.get(p1)];\n\t\tPerson target = g.members[g.map.get(p2)];\n\t\t\n\t\tlist.enqueue(start);\n\t\twhile(!list.isEmpty()) {\n\t\t\tPerson temp = list.dequeue();\n\t\t\tnames.add(temp);\n\t\t\tif(target.equals(temp)) {\n\t\t\t\ttargetfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tint nameIndex = g.map.get(temp.name);\n\t\t\ttraversed[nameIndex] = true;\n\t\t\tFriend adjacent = g.members[nameIndex].first;\n\t\t\twhile(adjacent != null) {\n\t\t\t\tif(traversed[adjacent.fnum] == false) {\n\t\t\t\t\tlist.enqueue(g.members[adjacent.fnum]);\n\t\t\t\t\t\tif(target.equals(g.members[adjacent.fnum])) {\n\t\t\t\t\t\t\ttargetfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tadjacent = adjacent.next;\n\t\t\t}\n\t\t}\t\t\n\t\tStack <String> flip = new Stack<>();\n\t\tif (targetfound == true) {\n\t\t\tint minIndex;\n\t\t\tint i = names.size()-1;\n\t\t\tflip.push(names.get(i).name);\n\t\t\twhile (i != 0) {\n\t\t\t\tFriend ptr = names.get(i).first; \n\t\t\t\tminIndex = Integer.MAX_VALUE;\n\t\t\t\twhile (ptr != null) {\n\t\t\t\t\tPerson tempName = g.members[ptr.fnum];\n\t\t\t\t\tfor (int j = 0; j<names.size(); j++) {\n\t\t\t\t\t\tif ( j < i && tempName == names.get(j) && j < minIndex){\n\t\t\t\t\t\t\tminIndex = j;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tptr = ptr.next;\n\t\t\t\t}\n\t\t\t\ti = minIndex;\n\t\t\t\tflip.push(names.get(i).name);\n\t\t\t}\n\t\t\twhile (!flip.isEmpty()) {\n\t\t\t\tshortestPath.add(flip.pop());\n\t\t\t} \n\t\t\treturn shortestPath;\n\t\t}\n\t\treturn null;\n\t}", "public static ArrayList<edges<String, Double>> Dijkstra(String CHAR1, String CHAR2, graph<String,Float> g) {\n\t\tPriorityQueue<ArrayList<edges<String, Double>>> active = \n\t\t\tnew PriorityQueue<ArrayList<edges<String, Double>>>(10,new Comparator<ArrayList<edges<String, Double>>>() {\n\t\t\t\tpublic int compare(ArrayList<edges<String, Double>> path1, ArrayList<edges<String, Double>> path2) {\n\t\t\t\t\tedges<String, Double> dest1 = path1.get(path1.size() - 1);\n\t\t\t\t\tedges<String, Double> dest2 = path2.get(path2.size() - 1);\n\t\t\t\t\tif (!(dest1.getLabel().equals(dest2.getLabel())))\n\t\t\t\t\t\treturn dest1.getLabel().compareTo(dest2.getLabel());\n\t\t\t\t\treturn path1.size() - path2.size();\n\t\t\t\t}\n\t\t\t});\n\t\t\tSet<String> known = new HashSet<String>();\n\t\t\tArrayList<edges<String, Double>> begin = new ArrayList<edges<String, Double>>();\n\t\t\tbegin.add(new edges<String, Double>(CHAR1, 0.0));\n\t\t\tactive.add(begin);\t\t\n\t\t\twhile (!active.isEmpty()) {\n\t\t\t\tArrayList<edges<String, Double>> minPath = active.poll();\n\t\t\t\tedges<String, Double> endOfMinPath = minPath.get(minPath.size() - 1);\n\t\t\t\tString minDest = endOfMinPath.getDest();\n\t\t\t\tdouble minCost = endOfMinPath.getLabel();\n\t\t\t\tif (minDest.equals(CHAR2)) {\n\t\t\t\t\treturn minPath;\n\t\t\t\t}\n\t\t\t\tif (known.contains(minDest))\n\t\t\t\t\tcontinue;\n\t\t\t\tSet<edges<String,Float>> children = g.childrenOf(minDest);\n\t\t\t\tfor (edges<String, Float> e : children) {\n\t\t\t\t\tif (!known.contains(e.getDest())) {\n\t\t\t\t\t\tdouble newCost = minCost + e.getLabel();\n\t\t\t\t\t\tArrayList<edges<String, Double>> newPath = new ArrayList<edges<String, Double>>(minPath); \n\t\t\t\t\t\tnewPath.add(new edges<String, Double>(e.getDest(), newCost));\n\t\t\t\t\t\tactive.add(newPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tknown.add(minDest);\n\t\t\t}\n\t\t\treturn null;\n\t}", "public void makePreferredOTTOLRelationshipsConflicts(){\n \t\tTransaction tx;\n \t\tString name = \"life\";\n \t\tIndexHits<Node> foundNodes = findTaxNodeByName(name);\n Node firstNode = null;\n if (foundNodes.size() < 1){\n System.out.println(\"name '\" + name + \"' not found. quitting.\");\n return;\n } else if (foundNodes.size() > 1) {\n System.out.println(\"more than one node found for name '\" + name + \"'not sure how to deal with this. quitting\");\n } else {\n for (Node n : foundNodes)\n firstNode = n;\n }\n \t\tTraversalDescription CHILDOF_TRAVERSAL = Traversal.description()\n \t\t\t\t.relationships( RelTypes.TAXCHILDOF,Direction.INCOMING );\n \t\tSystem.out.println(firstNode.getProperty(\"name\"));\n \t\tint count = 0;\n \t\ttx = graphDb.beginTx();\n \t\ttry{\n \t\t\tfor(Node friendnode : CHILDOF_TRAVERSAL.traverse(firstNode).nodes()){\n \t\t\t\tboolean conflict = false;\n \t\t\t\tString endNode = \"\";\n \t\t\t\tRelationship ncbirel = null;\n \t\t\t\tRelationship ottolrel = null;\n \t\t\t\tfor(Relationship rel : friendnode.getRelationships(Direction.OUTGOING)){\n \t\t\t\t\tif (rel.getEndNode() == rel.getStartNode()){\n \t\t\t\t\t\tcontinue;\n \t\t\t\t\t}else{\n \t\t\t\t\t\tif (endNode == \"\")\n \t\t\t\t\t\t\tendNode = (String) rel.getEndNode().getProperty(\"name\");\n \t\t\t\t\t\tif ((String)rel.getEndNode().getProperty(\"name\") != endNode){\n \t\t\t\t\t\t\tconflict = true;\n \t\t\t\t\t\t}\n \t\t\t\t\t\tif(((String)rel.getProperty(\"source\")).compareTo(\"ncbi\")==0)\n \t\t\t\t\t\t\tncbirel = rel;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\tif (conflict && ncbirel != null){\n \t\t\t\t\tcount += 1;\n //\t\t\t\t\tSystem.out.println(\"would make one from \"+ncbirel.getStartNode().getProperty(\"name\")+\" \"+ncbirel.getEndNode().getProperty(\"name\"));\n \t\t\t\t\tif(ncbirel.getStartNode()!=ncbirel.getEndNode()){\n \t\t\t\t\t\tncbirel.getStartNode().createRelationshipTo(ncbirel.getEndNode(), RelTypes.PREFTAXCHILDOF);\n \t\t\t\t\t\tRelationship newrel2 = ncbirel.getStartNode().createRelationshipTo(ncbirel.getEndNode(), RelTypes.TAXCHILDOF);\n \t\t\t\t\t\tnewrel2.setProperty(\"source\", \"ottol\");\n \t\t\t\t\t}else{\n \t\t\t\t\t\tSystem.out.println(\"would make cycle from \"+ncbirel.getEndNode().getProperty(\"name\"));\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t}\n \t\t\t\tif(count % transaction_iter == 0)\n \t\t\t\t\tSystem.out.println(count);\n \t\t\t}\n \t\t\ttx.success();\n \t\t}finally{\n \t\t\ttx.finish();\n \t\t}\n \t}", "public static ArrayList<String> markov_blank(String node_name, String Rchain_value,Connection con2) throws SQLException{\n\t\t\n\t\t//list of the children of the node \n\t\tArrayList<String> children=new ArrayList<String>(); \n\t\t//list of markov blanket\n\t\tArrayList<String> blanket=new ArrayList<String>(); \n\t\t//first store markov blanket in a set to reduce the duplicate\n\t Set<String> markov_blanket=new HashSet<String>();\n\t \n\t Statement st=con2.createStatement();\n\t //select the parents of the node\n\t String query1=\"select distinct parent from `Path_BayesNets` where child = '\"+node_name+\"' and Rchain= '\"+Rchain_value+\"' and parent <> '';\";\n\t //System.out.println(query1);\n\t\tResultSet rst1=st.executeQuery(query1);\n\t\twhile(rst1.next()){\n\t\t\t//add parents to markov blanket\n\t\t\tmarkov_blanket.add(rst1.getString(1));\n\t\t\t\n\t\t}\n\t\t\n\t\t//select the children of the node\n\t\tString query2=\"select distinct child from `Path_BayesNets` where parent = '\"+node_name+\"' and Rchain= '\"+Rchain_value+\"';\";\n\t//\tSystem.out.println(query2);\n\t\tResultSet rst2=st.executeQuery(query2);\n\t\n\t\twhile(rst2.next()){\n\t\t\t//add children to markov blanket and children list\n\t\t\tchildren.add(rst2.getString(1));\n\t\t\tmarkov_blanket.add(rst2.getString(1));\n\t\t} \n\t\t\n\t\t//select the spouses of the node\n\t\tfor(int i=0;i<children.size();i++){\n\t\t\tResultSet rst_temp;\n\t\t\tString temp=children.get(i);\n\t\t\tString query_temp=\"select distinct parent from `Path_BayesNets` where child = '\"+temp+\"' and Rchain= '\"+Rchain_value+\"' and parent <>'' and parent<> '\"+node_name+\"' ;\";\n\t\t\t//System.out.println(query_temp);\n\t\t\trst_temp=st.executeQuery(query_temp);\n\t\t\twhile(rst_temp.next())markov_blanket.add(rst_temp.getString(1));\n\t\t}\n\t\t\t\t\n\t\t\n\t\tObject[] list_blanket=markov_blanket.toArray();\n\t\tfor(int i=0;i<list_blanket.length;i++){\n\t\t\tblanket.add(list_blanket[i].toString()) ; \t\t\n\t\t}\n\t\t\n\t\tst.close();\n\t\treturn blanket;\n\t}", "@DISPID(25)\n\t// = 0x19. The runtime will prefer the VTID if present\n\t@VTID(36)\n\t@ReturnValue(type = NativeType.Dispatch)\n\tcom4j.Com4jObject buildTrendGraph(\n\t\t\t@Optional @DefaultValue(\"\") java.lang.String groupByField,\n\t\t\t@Optional @DefaultValue(\"\") java.lang.String sumOfField,\n\t\t\t@Optional @DefaultValue(\"0\") int maxCols,\n\t\t\t@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object filter,\n\t\t\t@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object frDate,\n\t\t\t@Optional @DefaultValue(\"0\") boolean forceRefresh,\n\t\t\t@Optional @DefaultValue(\"0\") boolean showFullPath);", "@Test\n public void cyclicalGraphs2Test() throws Exception {\n // Test history tracking -- the \"last a\" in g1 and g2 below and\n // different kinds of nodes topologically. At k=4 this becomes apparent\n // with kTails, if we start at the first 'a'.\n\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"b\",\n \"c\", \"d\" });\n // Create a loop in g1, with 4 nodes\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(3), Event.defTimeRelationStr);\n g1Nodes.get(3).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g1, 0);\n\n // g1.a is k-equivalent to g1.a for all k\n for (int k = 1; k < 6; k++) {\n testKEqual(g1Nodes.get(0), g1Nodes.get(0), k);\n }\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"a\" });\n // Create a chain from a to a'.\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(2), Event.defTimeRelationStr);\n g2Nodes.get(2).addTransition(g2Nodes.get(3), Event.defTimeRelationStr);\n g2Nodes.get(3).addTransition(g2Nodes.get(4), Event.defTimeRelationStr);\n exportTestGraph(g2, 1);\n\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 1);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 2);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 3);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 4);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 5);\n\n testNotKEqual(g1Nodes.get(0), g2Nodes.get(0), 6);\n testNotKEqual(g1Nodes.get(0), g2Nodes.get(0), 7);\n }", "public List<Vertex> newPath() {\r\n\t\tList<Vertex> Pathchange = new ArrayList<Vertex>();\r\n\t\tList<Vertex> tempPath = new ArrayList<Vertex>();\r\n\t\tint BestEval = Integer.MAX_VALUE;\r\n\t\tVertex changeVertexV1 = new Vertex();\r\n\t\tVertex changeVertexV2 = new Vertex();\r\n\r\n\t\tfor (int position = 0; position < this.LastPath.size() - 1; position++) {\r\n\t\t\tfor (int changement = position+1; changement < this.LastPath.size(); changement++) {\r\n\r\n\t\t\t\ttempPath.clear();\r\n\t\t\t\ttempPath = new ArrayList<Vertex>(this.LastPath);\r\n\t\t\t\tif (!(this.TabuListV1.contains(tempPath.get(position)) || this.TabuListV1.contains(tempPath.get(changement)) || this.TabuListV2.contains(tempPath.get(position)) || this.TabuListV2.contains(tempPath.get(changement)))) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tCollections.swap(tempPath, position, changement);\r\n\t\t\t\t\tif (this.fit(tempPath) < BestEval) {\r\n\t\t\t\t\t\tPathchange.clear();\r\n\t\t\t\t\t\tPathchange = new ArrayList<Vertex>(tempPath);\r\n\t\t\t\t\t\tchangeVertexV1 = tempPath.get(position);\r\n\t\t\t\t\t\tchangeVertexV2 = tempPath.get(changement);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(this.tabuElementType == 0) {\r\n\t\t\tthis.TabuListV1.add(0, changeVertexV1);\r\n\t\t}else if(this.tabuElementType == 1) {\r\n\t\t\tthis.TabuListV2.add(0, changeVertexV2);\r\n\t\t}else {\r\n\t\t\tthis.TabuListV1.add(0, changeVertexV1);\r\n\t\t\tthis.TabuListV2.add(0, changeVertexV2);\r\n\t\t}\r\n\t\t\r\n\t\tif (this.TabuListV1.size() > this.TabuListSize) {\r\n\t\t\tthis.TabuListV1.remove(this.TabuListV1.size() - 1);\r\n\t\t}\r\n\t\tif (this.TabuListV2.size() > this.TabuListSize) {\r\n\t\t\tthis.TabuListV2.remove(this.TabuListV2.size() - 1);\r\n\t\t}\r\n\r\n\t\treturn Pathchange;\r\n\t}", "private List<routerNode> getPathVertexList(routerNode beginNode, routerNode endNode) {\r\n\t\tTransformer<routerLink, Integer> wtTransformer; // transformer for getting edge weight\r\n\t\twtTransformer = new Transformer<routerLink, Integer>() {\r\n public Integer transform(routerLink link) {\r\n return link.getWeight();\r\n \t}\r\n };\t\t\r\n\r\n\t\t\r\n\t\tList<routerNode> vlist;\r\n\t\tDijkstraShortestPath<routerNode, routerLink> DSPath = \r\n\t \t new DijkstraShortestPath<routerNode, routerLink>(gGraph, wtTransformer);\r\n \t// get the shortest path in the form of edge list \r\n List<routerLink> elist = DSPath.getPath(beginNode, endNode);\r\n\t\t\r\n \t\t// get the node list form the shortest path\r\n\t Iterator<routerLink> ebIter = elist.iterator();\r\n\t vlist = new ArrayList<routerNode>(elist.size() + 1);\r\n \tvlist.add(0, beginNode);\r\n\t for(int i=0; i<elist.size(); i++){\r\n\t\t routerLink aLink = ebIter.next();\r\n\t \t \t// get the nodes corresponding to the edge\r\n \t\tPair<routerNode> endpoints = gGraph.getEndpoints(aLink);\r\n\t routerNode V1 = endpoints.getFirst();\r\n\t routerNode V2 = endpoints.getSecond();\r\n\t \tif(vlist.get(i) == V1)\r\n\t \t vlist.add(i+1, V2);\r\n\t else\r\n\t \tvlist.add(i+1, V1);\r\n\t }\r\n\t return vlist;\r\n\t}", "public static Node cccc_combination(LinkedList list1, LinkedList list2) {\n\n Node Katlyn1 = list1.head;\n Node Katlyn2 = list2.head;\n Node nodethaniel = new Node(0);\n Node tail = nodethaniel;\n\n while (true) {\n if (Katlyn1 == null) {\n tail.next = Katlyn2;\n break;\n }\n if (Katlyn2 == null) {\n tail.next = Katlyn1;\n break;\n }\n // Arrow function in Java?\n if (Katlyn1.valueData <= Katlyn2.valueData) {\n tail.next = Katlyn1;\n Katlyn1 = Katlyn1.next;\n } else {\n tail.next = Katlyn2;\n Katlyn2 = Katlyn2.next;\n }\n tail = tail.next;\n }\n return nodethaniel.next;\n }", "private void createRestaurantTrees() {\r\n while (!restaurantArray.isEmpty()) {\r\n Restaurant element = restaurantArray.dequeue();\r\n ratingTree.add(element);\r\n deliveryTree.add(element);\r\n }\r\n }", "public void makePreferredOTTOLRelationshipsNOConflicts() {\n \n // TraversalDescription CHILDOF_TRAVERSAL = Traversal.description()\n // .relationships(RelType.TAXCHILDOF, Direction.INCOMING);\n \n // get the start point\n Node life = getLifeNode();\n System.out.println(life.getProperty(\"name\"));\n \n Transaction tx = beginTx();\n addToPreferredIndexes(life, ALLTAXA);\n HashSet<Long> traveled = new HashSet<Long>();\n int nNewRels = 0;\n try {\n // walk out to the tips from the base of the tree\n for (Node n : TAXCHILDOF_TRAVERSAL.traverse(life).nodes()) {\n if (n.hasRelationship(Direction.INCOMING, RelType.TAXCHILDOF) == false) {\n \n // when we hit a tip, start walking back\n Node curNode = n;\n while (curNode.hasRelationship(Direction.OUTGOING, RelType.TAXCHILDOF)) {\n Node startNode = curNode;\n if (traveled.contains((Long)startNode.getId())){\n \tbreak;\n }else{\n \ttraveled.add((Long)startNode.getId());\n }\n Node endNode = null;\n \n // if the current node already has a preferred relationship, we will just follow it\n if (startNode.hasRelationship(Direction.OUTGOING, RelType.PREFTAXCHILDOF)) {\n Relationship prefRel = startNode.getSingleRelationship(RelType.PREFTAXCHILDOF, Direction.OUTGOING);\n \n // make sure we don't get stuck in an infinite loop (should not happen, could do weird things to the graph)\n if (prefRel.getStartNode().getId() == prefRel.getEndNode().getId()) {\n System.out.println(\"pointing to itself \" + prefRel + \" \" + prefRel.getStartNode().getId() + \" \" + prefRel.getEndNode().getId());\n break;\n }\n \n // prepare to move on\n endNode = prefRel.getEndNode();\n \n } else {\n \n // if there is no preferred rel then they all point to the same end node; just follow the first non-looping relationship\n for (Relationship rel : curNode.getRelationships(RelType.TAXCHILDOF, Direction.OUTGOING)) {\n if (rel.getStartNode().getId() == rel.getEndNode().getId()) {\n System.out.println(\"pointing to itself \" + rel + \" \" + rel.getStartNode().getId() + \" \" + rel.getEndNode().getId());\n break;\n } else {\n endNode = rel.getEndNode();\n break;\n }\n }\n \n // if we found a dead-end, die\n if (endNode == null) {\n System.out.println(curNode.getProperty(\"name\"));\n System.out.println(\"Strange, this relationship seems to be pointing at a nonexistent node. Quitting.\");\n System.exit(0);\n }\n \n // create preferred relationships\n curNode.createRelationshipTo(endNode, RelType.PREFTAXCHILDOF);\n curNode.createRelationshipTo(endNode, RelType.TAXCHILDOF).setProperty(\"source\", \"ottol\");\n nNewRels += 1;\n }\n \n if (startNode == endNode) {\n System.out.println(startNode);\n System.out.println(\"The node seems to be pointing at itself. This is a problem. Quitting.\");\n System.exit(0);\n \n // prepare for next iteration\n } else {\n curNode = endNode;\n addToPreferredIndexes(startNode, ALLTAXA);\n }\n }\n }\n \n if (nNewRels % transaction_iter == 0) {\n System.out.println(nNewRels);\n // tx.success();\n // tx.finish();\n // tx = beginTx();\n }\n }\n tx.success();\n } finally {\n tx.finish();\n }\n }", "public void findTaxonomyCycles(String name){\n \t IndexHits<Node> foundNodes = findTaxNodeByName(name);\n Node firstNode = null;\n if (foundNodes.size() < 1){\n System.out.println(\"name '\" + name + \"' not found. quitting.\");\n return;\n } else if (foundNodes.size() > 1) {\n System.out.println(\"more than one node found for name '\" + name + \"'not sure how to deal with this. quitting\");\n } else {\n for (Node n : foundNodes)\n firstNode = n;\n }\n \t\tTraversalDescription CHILDOF_TRAVERSAL = Traversal.description()\n \t\t .relationships( RelTypes.TAXCHILDOF,Direction.INCOMING );\n \t\tSystem.out.println(firstNode.getProperty(\"name\"));\n \t\tArrayList<Node> conflictingnodes = new ArrayList<Node>();\n \t\tfor(Node friendnode : CHILDOF_TRAVERSAL.traverse(firstNode).nodes()){\n \t\t\tint count = 0;\n \t\t\tboolean conflict = false;\n \t\t\tString endNode = \"\";\n \t\t\tfor(Relationship rel : friendnode.getRelationships(Direction.OUTGOING)){\n \t\t\t\tif (endNode == \"\")\n \t\t\t\t\tendNode = (String) rel.getEndNode().getProperty(\"name\");\n \t\t\t\tif ((String)rel.getEndNode().getProperty(\"name\") != endNode){\n \t\t\t\t\tconflict = true;\n \t\t\t\t}\n \t\t\t\tcount += 1;\n \t\t\t}\n \t\t\tif (count > 1 && conflict){\n \t\t\t\tconflictingnodes.add(friendnode);\n \t\t\t}\n \t\t}\n \t\tSystem.out.println(conflictingnodes.size());\n \t\tfor(int i=0;i<conflictingnodes.size();i++){\n \t\t\tSystem.out.println(conflictingnodes.get(i).getProperty(\"name\"));\n \t\t}\n \t}", "private void CreateTree()\r\n\t{\r\n\r\n\t\t//sample nodes which are not identical\r\n\t\ta = new Node(1);\r\n\t\ta.left = new Node(3);\r\n\t\ta.left.left = new Node(5);\r\n\t\ta.right = new Node(2);\r\n\r\n\r\n\t\tb = new Node(2);\r\n\t\tb.left = new Node(1);\r\n\t\tb.right = new Node(3);\r\n\t\tb.right.right = new Node(7);\r\n\t\tb.left.right = new Node(4);\r\n\r\n\t\t//sample nodes which are identical\r\n\t\ta1 = new Node(1);\r\n\t\ta1.left = new Node(3);\r\n\t\ta1.left.left = new Node(5);\r\n\t\ta1.right = new Node(2);\r\n\r\n\r\n\t\tb1 = new Node(1);\r\n\t\tb1.left = new Node(3);\r\n\t\tb1.right = new Node(2);\r\n\t\tb1.left.left = new Node(5); \r\n\t}", "public List<Individual> crossover2Point2(Individual parent1, Individual parent2) {\n List <Individual> listOffsprings = new ArrayList<Individual>();\n Individual offspring1 = new Individual(parent1.getChromosomeLength());\n Individual offspring2 = new Individual(parent1.getChromosomeLength());\n int crossoverPoint1 = Service.rand(0, parent1.getChromosomeLength()-1);\n int crossoverPoint2 = Service.rand(crossoverPoint1 + 1, crossoverPoint1 + parent1.getChromosomeLength() - 1);\n\n for(int geneIndex = 0; geneIndex < parent1.getChromosomeLength(); geneIndex++) {\n if (crossoverPoint2 >= parent1.getChromosomeLength()) {\n if(geneIndex >= crossoverPoint1 || geneIndex < (crossoverPoint2 - parent1.getChromosomeLength())) {\n offspring1.setGene(geneIndex, parent2.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent1.getGene(geneIndex ));\n } else {\n offspring1.setGene(geneIndex, parent1.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent2.getGene(geneIndex ));\n }\n }else {\n if(geneIndex >= crossoverPoint1 && geneIndex < crossoverPoint2) {\n offspring1.setGene(geneIndex, parent2.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent1.getGene(geneIndex ));\n } else {\n offspring1.setGene(geneIndex, parent1.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent2.getGene(geneIndex ));\n }\n }\n }\n listOffsprings.add(offspring1);\n listOffsprings.add(offspring2);\n return listOffsprings;\n }", "public static void main(String[] args) {\n Node l1 = new Node(2, new Node(4, new Node(3, null)));\n Node l2 = new Node(5, new Node(6, new Node(4, null)));\n Node result = AddTwoNumbers.addTwoNumbers(l1, l2);\n while (result != null) {\n System.out.println(result.getData());\n result = result.next;\n }\n }", "private static PhyloTreeNode findLeastCommonAncestor(PhyloTreeNode node1, PhyloTreeNode node2) {\n if(node1 == null || node2 == null) {\n return null;\n }\n else{\n String label1 = node1.getLabel();\n String label2 = node2.getLabel();\n if(label1.contains(label2) && (label2.contains(\"+\") || label1.equals(label2)))\n return node1;\n else if(label2.contains(label1) && (label2.contains(\"+\") || label2.equals(label1)))\n return node2;\n else{\n return findLeastCommonAncestor(node1.getParent(), node2.getParent());\n }\n }\n }", "public static void main(String[] args) {\n\t\tListNode node1 = new ListNode(5);\n node1.next = new ListNode(6);\n node1.next.next = new ListNode(7);\n\n ListNode node2 = new ListNode(5);\n node2.next = new ListNode(6);\n node2.next.next = new ListNode(7);\n\n ListNode result = new MergeTwoSortedLists().mergeTwoLists(node1, node2);\n\t}", "public ArrayList<Node> getBusNodes(ArrayList<Node> initialList, LatLng startLocation, LatLng EndLocation){\n ArrayList<String> matchingBusRoutes = nodeMinimisation.findMatchingBusRoutes(initialList);\n for(String route:matchingBusRoutes){\n System.out.println(\"Route is: \"+route);\n }\n // get further bus routes if needed\n //nodeMinimisation.furtherBusRouteMatches(initialList);\n // gets stop list from route\n ArrayList<Node> busStopList = nodeMinimisation.getStopList(initialList,startLocation,EndLocation);\n\n //ArrayList<Node> reducedStopList = nodeMinimisation.ReduceNodes(busStopList,startLocation, EndLocation);\n\n // returns the minimised list\n\n return busStopList;\n }", "@Test\n public void differentLinearGraphsTest() throws Exception {\n EventNode[] g1Nodes = getChainTraceGraphNodesInOrder(new String[] {\n \"a\", \"b\", \"c\", \"d\" });\n\n EventNode[] g2Nodes = getChainTraceGraphNodesInOrder(new String[] {\n \"a\", \"b\", \"c\", \"e\" });\n\n // ///////////////////\n // g1 and g2 are k-equivalent at first three nodes for k=1,2,3\n // respectively, but no further. Subsumption follows the same pattern.\n\n // \"INITIAL\" not at root:\n testKEqual(g1Nodes[0], g2Nodes[0], 1);\n testKEqual(g1Nodes[0], g2Nodes[0], 2);\n testKEqual(g1Nodes[0], g2Nodes[0], 3);\n testKEqual(g1Nodes[0], g2Nodes[0], 4);\n testNotKEqual(g1Nodes[0], g2Nodes[0], 5);\n testNotKEqual(g1Nodes[0], g2Nodes[0], 6);\n\n // \"a\" node at root:\n testKEqual(g1Nodes[1], g2Nodes[1], 1);\n testKEqual(g1Nodes[1], g2Nodes[1], 2);\n testKEqual(g1Nodes[1], g2Nodes[1], 3);\n testNotKEqual(g1Nodes[1], g2Nodes[1], 4);\n testNotKEqual(g1Nodes[1], g2Nodes[1], 5);\n\n // \"b\" node at root:\n testKEqual(g1Nodes[2], g2Nodes[2], 1);\n testKEqual(g1Nodes[2], g2Nodes[2], 2);\n testNotKEqual(g1Nodes[2], g2Nodes[2], 3);\n\n // \"c\" node at root:\n testKEqual(g1Nodes[3], g2Nodes[3], 1);\n testNotKEqual(g1Nodes[3], g2Nodes[3], 2);\n\n // \"d\" and \"e\" nodes at root:\n testNotKEqual(g1Nodes[4], g2Nodes[4], 1);\n }", "public static NavigableMap<Range, List<Node>> replicate(List<Node> nodes, int rf)\n {\n nodes.sort(Node::compareTo);\n List<Range> ranges = toRanges(nodes);\n return replicate(ranges, nodes, rf);\n }", "public List<AxiomTreeMapping> getMappingCandidates(AxiomTreeNode t1, AxiomTreeNode t2) {\n if (t1 != null && t2 != null) {\n // main call to match the trees\n List<AxiomTreeMapping> mappingCandidates = match(t1, t2, new AxiomTreeMapping());\n return mappingCandidates;\n }\n return Collections.emptyList();\n }", "@Override\r\n public List<T> breadthFirstPath(T start, T end) {\r\n\r\n Vertex<T> startV = vertices.get(start);\r\n Vertex<T> endV = vertices.get(end);\r\n\r\n LinkedList<Vertex<T>> vertexList = new LinkedList<>();\r\n //Set<Vertex<T>> visited = new HashSet<>();\r\n ArrayList<Vertex<T>> visited = new ArrayList<>();\r\n\r\n LinkedList<Vertex<T>> pred = new LinkedList<>();\r\n int currIndex = 0;\r\n\r\n pred.add(null);\r\n\r\n vertexList.add(startV);\r\n visited.add(startV);\r\n\r\n LinkedList<T> path = new LinkedList<>();\r\n\r\n if (breadthFirstSearch(start, end) == false) {\r\n path = new LinkedList<>();\r\n return path;\r\n } else {\r\n while (vertexList.size() > 0) {\r\n Vertex<T> next = vertexList.poll();\r\n if(next == null){\r\n continue;\r\n }\r\n if (next == endV) {\r\n path.add(endV.getValue());\r\n break;\r\n }\r\n for (Vertex<T> neighbor : next.getNeighbors()) {\r\n if (!visited.contains(neighbor)) {\r\n pred.add(next);\r\n visited.add(neighbor);\r\n vertexList.add(neighbor);\r\n }\r\n }\r\n currIndex++;\r\n //path.add(next.getValue());\r\n\r\n }\r\n while (currIndex != 0) {\r\n Vertex<T> parent = pred.get(currIndex);\r\n path.add(parent.getValue());\r\n currIndex = visited.indexOf(parent);\r\n }\r\n }\r\n Collections.reverse(path);\r\n return path;\r\n }", "public void swapNodes(int data1, int data2) {\n\t\tif(head == null || size == 1) {\n\t\t\tSystem.out.println(\"List is empty or only one node present!!\");\n\t\t\treturn;\n\t\t}\n\t\tNode node1 = null;\n\t\tNode node1Prev = null;\n\t\tNode node2 = null;\n\t\tNode node2Prev = null;\n\t\tNode start = head;\n\t\tif(start.data == data1) {\n\t\t\tnode1Prev = null;\n\t\t\tnode1 = start;\n\t\t}\n\t\tif(start.data == data2) {\n\t\t\tnode2Prev = null;\n\t\t\tnode2 = start;\n\t\t}\n\t\twhile(start.next != null) {\n\t\t\tif(start.next.data == data1) {\n\t\t\t\tnode1Prev = start;\n\t\t\t\tnode1 = start.next;\n\t\t\t}\n\t\t\tif(start.next.data == data2) {\n\t\t\t\tnode2Prev = start;\n\t\t\t\tnode2 = start.next;\n\t\t\t}\n\t\t\tstart = start.next;\n\t\t}\n\n\t\tif(node1 != null && node2 != null) {\n\t\t\tif(node1Prev == null) {\n\t\t\t\thead = node2;\n\t\t\t}\n\t\t\tif(node2Prev == null) {\n\t\t\t\thead = node1;\n\t\t\t}\n\t\t\tNode tempNext = node2.next;\n\t\t\tif(node1Prev != null)\n\t\t\t\tnode1Prev.next = node2;\n\t\t\tnode2.next = node1.next;\n\n\t\t\tif(node2Prev != null)\n\t\t\t\tnode2Prev.next = node1;\n\t\t\tnode1.next = tempNext;\n\t\t}\n\t}", "public static void main(String[] args) {\n\n Node<Integer> node1 = new Node<>(1);\n Node<Integer> node2 = new Node<>(2);\n Node<Integer> node3 = new Node<>(3);\n Node<Integer> node4 = new Node<>(4);\n\n node1.setLeftChild(node2);\n node1.setRightChild(node3);\n\n node2.setLeftChild(node4);\n\n node3.setLeftChild(new Node<>(5));\n node3.setRightChild(new Node<>(6));\n\n node4.setLeftChild(new Node<>(7));\n node4.setRightChild(new Node<>(8));\n\n traverse(node1);\n }", "public static void main(String[] args) throws IOException {\n File file = new File(args[0]);\r\n //FileOutputStream f = new FileOutputStream(\"prat_dfs_data2.txt\");\r\n //System.setOut(new PrintStream(f));\r\n BufferedReader reader = new BufferedReader(new FileReader(file));\r\n String line;\r\n line = reader.readLine();\r\n int nodecount = 0;\r\n HashMap <String , Integer> nodeMap = new HashMap <String , Integer>(); \r\n while ((line = reader.readLine()) != null ) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n if (!nodeMap.containsKey(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"))){\r\n nodeMap.put(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"), nodecount);\r\n nodecount++;\r\n }\r\n }\r\n reader.close();\r\n Vertex adjList[] = new Vertex[nodecount];\r\n Vertex sortVer[] = new Vertex[nodecount];\r\n for(int it = 0; it < nodecount; it++){\r\n adjList[it] = new Vertex(it);\r\n }\r\n nodeMap.forEach((k, v) -> adjList[v].val = k);\r\n File file2 = new File(args[1]);\r\n BufferedReader reader2 = new BufferedReader(new FileReader(file2));\r\n line = reader2.readLine();\r\n while ((line = reader2.readLine()) !=null) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n String source = data[0].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n String target = data[1].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n\r\n int weight = Integer.parseInt(data[2]);\r\n Vertex current = adjList[nodeMap.get(source)];\r\n Vertex newbie = new Vertex(nodeMap.get(target));\r\n current.countN++;\r\n current.co_occur += weight;\r\n if (adjList[nodeMap.get(source)].next == null){\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n else{\r\n current.next.prev = newbie;\r\n newbie.next = current.next;\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n Vertex current1 = adjList[nodeMap.get(target)];\r\n Vertex newbie1 = new Vertex(nodeMap.get(source));\r\n current1.co_occur += weight;\r\n current1.countN++;\r\n if (current1.next == null){\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n else{\r\n current1.next.prev = newbie1;\r\n newbie1.next = current1.next;\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n }\r\n reader2.close();\r\n \r\n for(int it = 0; it < nodecount; it++){\r\n sortVer[it] = new Vertex(adjList[it].id);\r\n sortVer[it].val = adjList[it].val;\r\n sortVer[it].co_occur = adjList[it].co_occur;\r\n }\r\n if (args[2].equals(\"average\")){\r\n double countdeg = 0;\r\n for(int it = 0; it<nodecount; it++){\r\n countdeg+= (double) adjList[it].countN;\r\n }\r\n countdeg = countdeg / (double) (nodecount);\r\n System.out.printf(\"%.2f\", countdeg);\r\n System.out.println();\r\n //long toc= System.nanoTime();\r\n //System.out.println((toc- startTime)/1000000000.0);\r\n }\r\n \r\n if(args[2].equals(\"rank\")){\r\n Graph.mergesort(sortVer, 0, nodecount-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n System.out.print(sortVer[0].val);\r\n for(int kk=1; kk<nodecount; kk++){\r\n System.out.print(\",\" + sortVer[kk].val.toString());\r\n }\r\n System.out.println();\r\n }\r\n if(args[2].equals(\"independent_storylines_dfs\")){\r\n boolean visited[] = new boolean[nodecount];\r\n int ind = 0;\r\n ArrayList<ArrayList<Vertex>> comps = new ArrayList<ArrayList<Vertex>>();\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n visited[it1] = false;\r\n }\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n if (visited[it1] == false){\r\n ArrayList<Vertex> temp = new ArrayList<Vertex>();\r\n Graph.dfs(it1, visited, ind, adjList, temp);\r\n ind++;\r\n Graph.mergesort2(temp, 0, temp.size()-1);\r\n comps.add(temp);\r\n }\r\n }\r\n Graph.mergesort3(comps, 0, comps.size()-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n for(int a1 = 0; a1 < ind; a1++){\r\n System.out.print(comps.get(a1).get(0).val);\r\n for(int j1 = 1; j1<comps.get(a1).size(); j1++){\r\n System.out.print(\",\" + comps.get(a1).get(j1).val);\r\n }\r\n System.out.println();\r\n }\r\n }\r\n }", "int[] concat(int s1,int t1,int s2,int t2)\r\n\t{\r\n\t\tint [] st=new int[2];\r\n st[0] = s1;\r\n\t\tst[1] = t2;\r\n\t\t\r\n\t\taddEdge(t1, epssymbol, s2);\r\n\t\t\r\n\t\treturn st;\r\n\t}", "public static void main(String[] args){\n\t\tNode_2 r1 = new Node_2(1);\n\t\tr1.left\t= new Node_2(2);\n\t\tr1.right = new Node_2(3);\n\t\tr1.left.left = new Node_2(4);\n\t\tr1.left.right = new Node_2(5);\n\t\tr1.right.left = new Node_2(8); \n\t\t\n\t\tPrintKDistant obj = new PrintKDistant();\n\t\tobj.getNodeAtKDistance(r1, 2);\n\t}", "private static <V> Graph<V> unirGrafos(Graph<V> grafo1, Graph<V> grafo2) {\n V[] array = grafo2.getValuesAsArray();\n double[][] matriz = grafo2.getGraphStructureAsMatrix();\n for (int x = 0; x < array.length; x++) {\n grafo1.addNode(array[x]);\n for (int y = 0; y < array.length; y++) {\n if (matriz[x][y] != -1) {\n if (!grafo2.isDirected()) {\n matriz[y][x] = -1;\n }\n grafo1.addNode(array[y]);\n grafo1.addEdge(array[x], array[y], grafo2.getWeight(array[x], array[y]));\n }\n }\n }\n return grafo1;\n }", "public List<TreeNode> generateTrees(int n) {\n return helper(1, n);\n }", "public List<Node> getNodes();", "public Pathfinder(Node start, List<Node> ends){\n this.start = start;\n\n // Made up a formula to measure distance between start and end node simply\n // dist = | difference in floors | * FLOOR_COST + (horizontal distance between nodes)\n\n // if ends is empty\n if(ends.isEmpty()){\n this.end = start;\n return;\n }\n\n Node closest = ends.get(0);\n double lowestCost = distanceEstimate(start, closest);\n\n for(Node n: ends){\n double estimate = distanceEstimate(start, n);\n\n if(estimate < lowestCost){\n closest = n;\n lowestCost = estimate;\n }\n }\n this.end = closest;\n\n }", "private TreeNode<K> combine(TreeNode<K> x, TreeNode<K> y) {\n TreeNode<K> z = new TreeNode<K>();\n z.left = x;\n z.right = y;\n z.rank = x.rank + 1;\n sift(z);\n return z;\n }", "ArrayList<Node> DFSIter( Graph graph, final Node start, final Node end)\n {\n boolean visited[] = new boolean[graph.numNodes];\n Stack<Node> stack = new Stack<Node>();\n Map< Node,Node> parentPath = new HashMap< Node,Node>(); \n stack.push(start);\n\n while ( !stack.isEmpty() )\n {\n Node currNode = stack.pop();\n // end loop when goal node is found\n if ( currNode == end )\n break;\n // If node has already been visited, skip it\n if ( visited[currNode.id] )\n continue;\n else\n {\n visited[currNode.id] = true;\n int numEdges = currNode.connectedNodes.size();\n\n for ( int i = 0; i < numEdges; i++ )\n {\n Node edgeNode = currNode.connectedNodes.get(i);\n if ( !visited[edgeNode.id] )\n {\n stack.push( edgeNode );\n parentPath.put( edgeNode, currNode);\n }\n }\n \n }\n }\n\n ArrayList<Node> path = new ArrayList<Node>();\n Node currNode = end;\n while ( currNode != null )\n {\n path.add(0, currNode);\n currNode = parentPath.get(currNode);\n }\n\n return path;\n }", "private void createNodes() {\n head = new ListNode(30);\n ListNode l2 = new ListNode(40);\n ListNode l3 = new ListNode(50);\n head.next = l2;\n l2.next = l3;\n }", "protected void sortTeams(Node node1, Node node2) {\n\t\tif (node1.getNodeName().equals(\"team\")) {\n\t\t\tif (node2.getNodeName().equals(\"name\")) {\n\t\t\t\tteamNodeCounter++;\n\t\t\t\ttempteamName = tempteamName + \" \" + node2.getNodeValue();\n\t\t\t} else if (node2.getNodeName().equals(\"market\")) {\n\t\t\t\tteamNodeCounter++;\n\t\t\t\ttempteamName = tempteamName + node2.getNodeValue();\n\t\t\t} else if (node2.getNodeName().equals(\"id\")) {\n\t\t\t\tteamIDList.add(node2.getNodeValue());\n\t\t\t}\n\t\t\tif (teamNodeCounter >= 2) {\n\t\t\t\tteamNameList.add(tempteamName);\n\t\t\t\ttempteamName = \"\";\n\t\t\t\tteamNodeCounter = 0;\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) {\n\n ListNode l1 = new ListNode(5);\n// l1.next = new ListNode(8);\n// l1.next.next = new ListNode(3);\n//\n ListNode l2 = new ListNode(5);\n// l2.next=new ListNode(6);\n// l2.next.next = new ListNode(4);\n addTwoNumbers(l1, l2);\n\n\n }", "@SuppressWarnings( \"unchecked\" )\n public List<Node> getSecondChoices() {\n final List<Part> relatedParts = findRelatedParts();\n final Node node = getNode();\n final Node other = getOther();\n return (List<Node>) CollectionUtils.select(\n IteratorUtils.toList( node.getSegment().parts() ),\n new Predicate() {\n @Override\n public boolean evaluate( Object object ) {\n Part part = (Part) object;\n return !part.equals( node )\n && !part.equals( other )\n && !relatedParts.contains( part );\n }\n }\n );\n }", "List<String> getTrees();", "TripleGraph createTripleGraph();", "public static void main(String[] args) {\n List<Node<Integer>> lst = new ArrayList<Node<Integer>>();\n for (int i = 0; i < 10; i++) {\n Node<Integer> n1 = new Node<Integer>(i);\n lst.add(n1);\n }\n for (int i = 0; i < lst.size() - 1; i++) {\n lst.get(i).next = lst.get(i + 1);\n }\n Node<Integer> start = lst.get(0);\n\n LinkListLearn l = new LinkListLearn();\n\n l.printLinkList(start);\n\n start = l.reverseRecursively(start);\n System.out.println();\n l.printLinkList(start);\n }", "@Test\n public void treeGraphsTest() throws Exception {\n // Construct a tree, rooted at INITIAL, with two \"a\" children, both of\n // which have different \"b\" and \"c\" children.\n String traceStr = \"1,0 a\\n\" + \"2,0 b\\n\" + \"1,1 c\\n\" + \"--\\n\"\n + \"1,0 a\\n\" + \"2,0 b\\n\" + \"1,1 c\\n\";\n TraceParser parser = genParser();\n ArrayList<EventNode> parsedEvents = parser.parseTraceString(traceStr,\n getTestName().getMethodName(), -1);\n DAGsTraceGraph inputGraph = parser\n .generateDirectPORelation(parsedEvents);\n exportTestGraph(inputGraph, 0);\n\n // This returns a set with one node -- INITIAL. It will have two\n // children -- the two \"a\" nodes, which should be k-equivalent for all\n // k.\n EventNode initNode = inputGraph.getDummyInitialNode();\n\n List<Transition<EventNode>> initNodeTransitions = initNode\n .getAllTransitions();\n EventNode firstA = initNodeTransitions.get(0).getTarget();\n EventNode secondA = initNodeTransitions.get(1).getTarget();\n for (int k = 1; k < 4; k++) {\n testKEqual(firstA, secondA, k);\n }\n\n // In this tree the firstA and secondA should _not_ be 1-equivalent (one\n // has children {b,c}, while the other has children {b,d}), but\n // they are still 0-equivalent.\n traceStr = \"1,0 a\\n\" + \"2,0 b\\n\" + \"1,1 c\\n\" + \"--\\n\" + \"1,0 a\\n\"\n + \"2,0 b\\n\" + \"1,1 d\\n\";\n parser = genParser();\n parsedEvents = parser.parseTraceString(traceStr, getTestName()\n .getMethodName(), -1);\n inputGraph = parser.generateDirectPORelation(parsedEvents);\n exportTestGraph(inputGraph, 1);\n\n initNode = inputGraph.getDummyInitialNode();\n initNodeTransitions = initNode.getAllTransitions();\n firstA = initNodeTransitions.get(0).getTarget();\n secondA = initNodeTransitions.get(1).getTarget();\n testKEqual(firstA, secondA, 1);\n testNotKEqual(firstA, secondA, 2);\n }", "@Override\n\tpublic List<node_data> TSP(List<Integer> targets) {\n\t\tList<Integer> targets1 = new ArrayList<>();\n\t\tList<node_data> ans = new ArrayList<>();\n\t\tfor (Integer target: targets) {\n\t\t\tif(!targets1.contains(target)){\n\t\t\t\ttargets1.add(target);\n\t\t\t}\n\t\t}\n\t\tif(targets1.size()==1){\n\t\t\tans.add(this.GA.getNode(targets.get(0)));\n\t\t\treturn ans;\n\t\t}\n\t\tint help=targets1.get(0);\n\t\tint targetSize = targets1.size();\n\t\twhile(!targets1.isEmpty()) {\n\t\t\tdouble minWeight = Integer.MAX_VALUE;\n\t\t\tint geti=-1;\n\t\t\tfor (int j = 0; j <targetSize ; j++) {\n\t\t\t\tif(shortestPathDist(help,targets1.get(j)) !=0 &&shortestPathDist(help,targets1.get(j))<minWeight || targets1.size()==1 && shortestPathDist(help,targets1.get(j)) ==0) {\n\t\t\t\t\tminWeight = shortestPathDist(help, targets1.get(j));\n\t\t\t\t\tgeti = targets1.get(j);\n\t\t\t\t}\n\t\t\t}\n\t\t\tList<node_data> ans2 = new ArrayList<>();\n\t\t\tif(geti==-1) return null;\n\t\t\tif(targets1.size()>1) {\n\t\t\t\tans2 = shortestPath(help, geti);\n\t\t\t\tans.addAll(ans2);\n\t\t\t\ttargets1.remove((Integer) help);\n\t\t\t\ttargetSize--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttargets1.remove((Integer)geti);\n\t\t\t}\n\t\t\thelp=geti;\n\t\t}\n\t\tfor (int ii = 0; ii <ans.size()-1 ; ii++) {\n\t\t\tif(ans.get(ii)==ans.get(ii+1)){\n\t\t\t\tans.remove(ii);\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}", "@BeforeAll\n\tstatic void setNodes() {\n\t\tLCA = new LowestCommonAncestor();\n\t\tnine = new Node(9,null);\n\t\tten = new Node(10, null);\n\t\teight = new Node(8, null);\n\t\tseven = new Node(7, new Node[] {ten});\n\t\tfour = new Node(4, new Node[] {ten});\n\t\tthree = new Node(3, new Node[] {four});\n\t\tfive = new Node(5, new Node[] {nine, eight, seven});\n\t\ttwo = new Node(2, new Node[] {three, five});\n\t\tone = new Node(1, new Node[] {two});\n\t}", "void create(Node node) {\n if (node.table.negatives() == 0) {\r\n node.atribute = 1;\r\n return;\r\n }\r\n if (node.table.positives() == 0) {\r\n node.atribute = 0;\r\n return;\r\n }\r\n\r\n //If no test split the data, make it a leaf with the majoriti of the target atribute\r\n int atr;\r\n //Choose the best atribute\r\n atr = this.chooseBestAtrib(node);\r\n node.atribute = atr;\r\n\r\n //No atribute split the data, so make the node a leaf with the majoriti of the class (either positive or negative)\r\n if (node.atribute == -1) {\r\n //System.out.println(\"Atribute is -1 in TeeBuidler.create\");\r\n if (node.table.negatives() > node.table.positives()) {\r\n node.atribute = 0;\r\n return;\r\n }\r\n if (node.table.positives() >= node.table.negatives()) {\r\n node.atribute = 1;\r\n return;\r\n }\r\n }\r\n\r\n Table table_left = new Table(), table_right = new Table();\r\n node.table.splitByAtrib(node.atribute, table_left, table_right);\r\n\r\n //Create two children for the current node //parameters: identifier,parent_result,atribute of split,id_child1, id_child2, table\r\n node.child_left = new Node(node.id + node.id, \"1\", -1, -1, -1, table_left);\r\n node.child_right = new Node(node.id + node.id+1, \"0\", -1, -1, -1, table_right);\r\n node.id_child_left = node.id + node.id;\r\n node.id_child_right = node.id + node.id+1;\r\n\r\n\r\n TreeBuilder builder = new TreeBuilder();\r\n builder.create(node.child_left);\r\n builder.create(node.child_right);\r\n\r\n }", "public Object[] nodeRecombine(node aNode, node newNode1, node newNode2,\n\t\t\tdouble gen, double loc){\n\t\tseg aSeg,seg1,seg2;\n\t\tObject[] returnArray; //container for nodes to return....\n\t\taSeg = new seg(0,loc);\n\t\tseg1 = segFactory.segIntersect(aNode.getSegment(), aSeg);\n\t\tseg2 = segFactory.segIntersect(aNode.getSegment(),segFactory.segInverse(aSeg));\n\t\taSeg = null;\n\t\tif(seg1 == null || seg2 == null){\n\t\t\tif(seg1 != null )\n\t\t\t\tseg1 = null;\n\t\t\tif(seg2 != null)\n\t\t\t\tseg2 = null;\n\t\t\treturnArray = new Object[1];\n\t\t\treturnArray[0] = 1;\n\t\t\treturn returnArray;\n\t\t}\n\t\treturnArray = new Object[3];\n\t\tnewNode1 = makeEmptyNode(gen,aNode.pop, aNode);\n\t\tnewNode1.setSegment(seg1);\n\t\tnewNode2 = makeEmptyNode(gen,aNode.pop,aNode);\n\t\tnewNode2.setSegment(seg2);\n\t\treturnArray[0] = 2;\n\t\treturnArray[1] = newNode1;\n\t\treturnArray[2] = newNode2;\n\t\t\n\t\treturn returnArray;\n\t}", "public ListNode swapNodes(ListNode head, int v1, int v2) {\n ListNode start = new ListNode(0);\n start.next = head;\n ListNode preOne = null;\n ListNode preTwo = null;\n\n ListNode search = start;\n\n while (search.next != null) {\n ListNode next = search.next;\n if (next.val == v1) {\n preOne = search;\n }\n if (next.val == v2) {\n preTwo = search;\n }\n search = next;\n }\n if (preOne == null || preTwo == null) {\n return start.next;\n }\n\n\n ListNode one = preOne.next;\n ListNode two = preTwo.next;\n if (two.next == one) {\n preTwo.next = one;\n two.next = one.next;\n one.next = two;\n return start.next;\n } else if (one.next == two) {\n preOne.next = two;\n one.next = two.next;\n two.next = one;\n return start.next;\n }\n ListNode befone = preOne.next.next;\n ListNode beftwo = preTwo.next.next;\n one.next = beftwo;\n two.next = befone;\n preOne.next = two;\n preTwo.next = one;\n return start.next;\n }", "public static void main(String[] args) {\n\r\n TreeSet<point> ts1 = new TreeSet<>();\r\n ts1.add(new point(1,1));\r\n ts1.add(new point(5, 5));\r\n ts1.add(new point(5, 2));\r\n\r\n System.out.println(ts1);\r\n }", "Iterable<T> followNodeAndSelef(T start) throws NullPointerException;", "public static int distanceBetweenNodes(Node node, int d1, int d2){\r\n ArrayList<Integer> path1 = nodeToRootPath(node, d1);\r\n ArrayList<Integer> path2 = nodeToRootPath(node, d2);\r\n \r\n //Traverse from behind to avoid time complexity\r\n int i = path1.size() - 1;\r\n int j = path2.size() - 1;\r\n \r\n //Check for valid iterations and till the time data is common, first occurence of diff data in arraulist is the time to stop\r\n while(i>=0 && j>=0 && path1.get(i) == path2.get(j)){\r\n i--; j--;\r\n }\r\n \r\n //Here returning i+1 and j+1 means there are i+1 elements left and j+1 elements left which are not common in \r\n //both ArrayList so answer will be addition of these, it will give us the distance between two nodes\r\n //+1 is two times for two edges between i to LCA and j to LCA\r\n return (i+1) + (j+1);\r\n }", "public Vector<Node> GetAdditionalSubNodes();", "public static void main(String[] args) {\n ListNode node1 = new ListNode(1, new ListNode(4, new ListNode(5)));\n // ListNode[] arr = new ListNode[3];\n // ListNode node1 = new ListNode(1, new ListNode(4, new ListNode(5)));\n // ListNode node2 = new ListNode(1, new ListNode(3, new ListNode(4)));\n // ListNode node3 = new ListNode(3, new ListNode(6));\n // arr[0] = node1;\n // arr[1] = node2;\n // arr[2] = node3;\n\n // ListNode result = new ListNode();\n System.out.println(node1.toString());\n // System.out.println(arr.toString());\n // result = mergeArraysHelper(arr, 0, arr.length - 1);\n // System.out.println(result.toString());\n }", "final public Expression TriplesNode(Exp stack) throws ParseException {\n Expression expression1;\n switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\n case ATLIST:\n case ATPATH:\n case LPAREN:\n case AT:\n expression1 = Collection(stack);\n break;\n case LBRACKET:\n expression1 = BlankNodePropertyList(stack);\n break;\n default:\n jj_la1[224] = jj_gen;\n jj_consume_token(-1);\n throw new ParseException();\n }\n {if (true) return expression1;}\n throw new Error(\"Missing return statement in function\");\n }", "public String[] findRestaurant(String[] list1, String[] list2) {\n Map<String, Integer> map = new HashMap<String, Integer>();\n for (int i = 0; i < list1.length; i++) {\n map.put(list1[i], i);\n }\n int min = Integer.MAX_VALUE;\n for (int i = 0; i < list2.length; i++) {\n Integer j = map.get(list2[i]);\n if (j != null) {\n min = Math.min(min, i + j);\n }\n }\n List<String> list = new LinkedList<String>();\n for (int i = 0; i < list2.length; i++) {\n Integer j = map.get(list2[i]);\n if (j != null && (i + j) == min) {\n list.add(list2[i]);\n }\n } \n String[] re = new String[]{};\n return list.toArray(re);\n }", "public static void main(String[] args) {\n TreeNode n7 = new TreeNode(7);\n TreeNode n6 = new TreeNode(6);\n TreeNode n5 = new TreeNode(5);\n TreeNode n4 = new TreeNode(4);\n TreeNode n3 = new TreeNode(3);\n TreeNode n2 = new TreeNode(2);\n TreeNode n1 = new TreeNode(1);\n\n n4.left = n2;\n n4.right = n6;\n\n n2.left = n1;\n n2.right = n3;\n\n n6.left = n5;\n n6.right = n7;\n\n System.out.println(\"Cay n4\");\n List<Integer> resultPreOrder = preOrderTravel(n4);\n for (Integer integer : resultPreOrder) {\n System.out.println(integer);\n }\n\n System.out.println(\"Cay n2\");\n resultPreOrder = preOrderTravel(n2);\n for (Integer integer : resultPreOrder) {\n System.out.println(integer);\n }\n }", "Iterable<T> followNode(T start) throws NullPointerException;", "private ArrayList<Node> getPathBetweenNodes(Node s, Node t, int distance){\n\t\tArrayList<Node> path = new ArrayList<Node>();\n\t\tpath.add(0,t);\n\t\tSet<Node> nodes = distanceFromS.keySet();\n\t\tfor (int i = distance -1 ; i > 0; i --) {\n\t\t\tfor (Node n: nodes) {\n\t\t\t\tif (path.get(0).getNeighbors().contains(n) && distanceFromS.get(n) == i) {\n\t\t\t\t\tpath.add(0, n);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpath.add(0,s);\n\t\treturn path;\n\t}", "@Test\n public void whenAddNodesOnDifferentLevelsThenResultThreeNodeFromBottomToTop() {\n tree.addChild(nodeOne, \"1\");\n nodeOne.addChild(nodeTwo, \"2\");\n nodeTwo.addChild(nodeThree, \"3\");\n assertThat(tree.getChildren().toString(), is(\"[3, 2, 1]\"));\n }", "public List<Node> findPath(Node start);", "private void initGraph() {\n nodeMap = Maps.newIdentityHashMap();\n stream.forEach(t -> {\n Object sourceKey = sourceId.extractValue(t.get(sourceId.getTableId()));\n Object targetKey = targetId.extractValue(t.get(targetId.getTableId()));\n ClosureNode sourceNode = nodeMap.get(sourceKey);\n ClosureNode targetNode = nodeMap.get(targetKey);\n if (sourceNode == null) {\n sourceNode = new ClosureNode(sourceKey);\n nodeMap.put(sourceKey, sourceNode);\n }\n if (targetNode == null) {\n targetNode = new ClosureNode(targetKey);\n nodeMap.put(targetKey, targetNode);\n }\n sourceNode.next.add(targetNode);\n });\n\n }", "public TrieDifferentCombinations() {\n this.root = new TrieDifferentCombinationsNode();\n }", "public ArrayList<UUSearchNode> getSuccessors() {\n\n ArrayList<UUSearchNode> successors = new ArrayList<UUSearchNode>();//this will be returned\n ArrayList<CannibalNode> helper = new ArrayList<CannibalNode>();\n\n if (this.state[2]==1){ //if the boat is on the starting shore\n helper.add(new CannibalNode(this.state[0] - 2, this.state[1],\n this.state[2] - 1, this.depth + 1)); //subtracting <201>\n helper.add(new CannibalNode(this.state[0], this.state[1] - 2,\n this.state[2] - 1, this.depth + 1)); //subtracting <021>\n helper.add(new CannibalNode(this.state[0] - 1, this.state[1] - 1,\n this.state[2] - 1, this.depth + 1)); //subtracting <111>\n helper.add(new CannibalNode(this.state[0] - 1, this.state[1],\n this.state[2] - 1, this.depth + 1)); //subtracting <101>\n helper.add(new CannibalNode(this.state[0], this.state[1] - 1,\n this.state[2] - 1, this.depth + 1)); //subtracting <011>\n }else{ //if the boat is on the opposite shore\n helper.add(new CannibalNode(this.state[0] + 2, this.state[1],\n this.state[2] + 1, this.depth + 1)); //adding <201>\n helper.add(new CannibalNode(this.state[0], this.state[1] + 2,\n this.state[2] + 1, this.depth + 1)); //adding <021>\n helper.add(new CannibalNode(this.state[0] + 1, this.state[1] + 1,\n this.state[2] + 1, this.depth + 1)); //adding <111>\n helper.add(new CannibalNode(this.state[0] + 1, this.state[1],\n this.state[2] + 1, this.depth + 1)); //adding <101>\n helper.add(new CannibalNode(this.state[0], this.state[1] + 1,\n this.state[2] + 1, this.depth + 1)); //adding <011>\n }\n\n //now we check for feasibility and legality\n for(CannibalNode n : helper){\n if(isFeasibleState(n.state) && isLegalState(n.state)){\n successors.add(n);\n }\n }\n return successors;\n }", "public List<Double> calculate1a(List<C> listOfNodes,double a, double b);", "void backtrackTree(StringBuilder sequence1, StringBuilder sequence2, int position) {\n int n = table[0].length;\n if (position == 0) {\n results.add(new StringBuilder[]{new StringBuilder(sequence1), new StringBuilder(sequence2)});\n }\n else {\n List<Integer> listOfParents = parents.get(position);\n for (Integer parent: listOfParents) {\n if (parent == northWest(position)) {\n StringBuilder newSeq1 = new StringBuilder(sequence1);\n StringBuilder newSeq2 = new StringBuilder(sequence2);\n newSeq1.append(seq1.charAt(seq1position(position)));\n newSeq2.append(seq2.charAt(seq2position(position)));\n backtrackTree(newSeq1, newSeq2, parent);\n }\n else if (parent / n == position / n) {\n StringBuilder newSeq1 = new StringBuilder(sequence1);\n StringBuilder newSeq2 = new StringBuilder(sequence2);\n while (position != parent) {\n newSeq1.append('_');\n newSeq2.append(seq2.charAt(seq2position(position)));\n position--;\n }\n backtrackTree(newSeq1, newSeq2, parent);\n }\n else if (parent % n == position % n) {\n StringBuilder newSeq1 = new StringBuilder(sequence1);\n StringBuilder newSeq2 = new StringBuilder(sequence2);\n while (position != parent) {\n newSeq1.append(seq1.charAt(seq1position(position)));\n newSeq2.append('_');\n position = position - n;\n }\n backtrackTree(newSeq1, newSeq2, parent);\n }\n }\n }\n }", "void traverse2() {\n BTNode node = root, prev = null, next;\n while (node != null) {\n if (prev == node.parent) {\n if (node.left != null) {\n next = node.left;\n }\n else if (node.right != null) {\n next = node.right;\n }\n else {\n next = node.parent;\n }\n } else if (prev == node.left) {\n if (node.right != null) {\n next = node.right;\n }\n else {\n next = node.parent;\n }\n } else {\n next = node.parent;\n }\n prev = node;\n node = next;\n }\n }", "@Override\n public List<GraphNode> getNodes() {\n List<String> namesOfFiles = ProjectFileNamesUtil.getFileNamesFromProject(project.getBaseDir());\n this.relations = RelationsService.getRelations(project, namesOfFiles);\n List<GraphNode> nodes = new ArrayList<>();\n nodeHashTable = new Hashtable();\n nodeHashTable.clear();\n resultsOfRanTests = HashtableResultsUtil.copyHashtableTestResults(TestResultsCollector.getInstance().getTestResults());\n int i = 0;\n for (String nameOfFile : namesOfFiles){ //for each name of file\n String[] str = nameOfFile.split(\"/\");\n String file = str[str.length-1];\n Hashtable fileTestResults = (Hashtable) resultsOfRanTests.get(file.replace(\".py\",\"\"));\n if (nodeHashTable.get(file)!=null){ //a node with this name already exists\n file=file.concat(\" (\" + i++ + \")\");\n }\n CoverageNode node = new CoverageNode(file,nameOfFile);\n node.setCoverage(GetOnlyCoveragedFileNames.getCovForFile(file,project)); //get coverage\n node.getTypes().add(\"Coverage is: \" + node.getCoverage() + \"%.\");\n node.setColor(node.getCoverage()/10);\n if (fileTestResults != null) { //check for test changes in node\n node.setOutColorNumber(getNodeOutColor(fileTestResults));\n }\n HashMap<String, Object> properties = new HashMap<>();\n getPropertiesForNodes(properties, nameOfFile);\n ResultsPropertyContainer resultsPropertyContainer = new ResultsPropertyContainer(properties);\n node.setResultsPropertyContainer(resultsPropertyContainer);\n nodeHashTable.put(file, node);\n nodes.add(node);\n }\n if (HashtableResultsUtil.getInstance().getOnlyCoveraged()) { //this runs if we want only coveraged nodes\n nodes = doCleaning(nodes);\n }\n HashtableResultsUtil.getInstance().setNodes(nodes);\n return nodes;\n }", "public static NodoListaS append(NodoListaS p1, NodoListaS p2) {\r\n\t\tNodoListaS r = new NodoListaS(null,null);\r\n\t\t// nodo generatore\r\n\t\tNodoListaS t = r;\r\n\t\tNodoListaS q = p1;\r\n\t\twhile (q != null) {\r\n\t\t\tt.next = new NodoListaS(q.info,null);\r\n\t\t\tq = q.next;\r\n\t\t\tt = t.next;\r\n\t\t}\r\n\t\tq = p2;\r\n\t\twhile (q != null) {\r\n\t\t\tt.next = new NodoListaS(q.info,null);\r\n\t\t\tq = q.next;\r\n\t\t\tt = t.next;\r\n\t\t}\r\n\t\treturn r.next;\r\n\t}", "public void buildTaxonomyTree(String name){\n IndexHits<Node> foundNodes = findTaxNodeByName(name);\n Node firstNode = null;\n if (foundNodes.size() < 1){\n System.out.println(\"name '\" + name + \"' not found. quitting.\");\n return;\n } else if (foundNodes.size() > 1) {\n System.out.println(\"more than one node found for name '\" + name + \"'not sure how to deal with this. quitting\");\n } else {\n for (Node n : foundNodes)\n firstNode = n;\n }\n TraversalDescription CHILDOF_TRAVERSAL = Traversal.description()\n \t\t .relationships( RelTypes.TAXCHILDOF,Direction.INCOMING );\n \t\tSystem.out.println(firstNode.getProperty(\"name\"));\n \t\tJadeNode root = new JadeNode();\n \t\troot.setName(((String) firstNode.getProperty(\"name\")).replace(\" \", \"_\"));\n \t\tHashMap<Node,JadeNode> nodes = new HashMap<Node,JadeNode>();\n \t\tnodes.put(firstNode, root);\n \t\tint count =0;\n \t\tfor(Relationship friendrel : CHILDOF_TRAVERSAL.traverse(firstNode).relationships()){\n \t\t\tcount += 1;\n \t\t\tif (nodes.containsKey(friendrel.getStartNode())==false){\n \t\t\t\tJadeNode node = new JadeNode();\n \t\t\t\tnode.setName(((String) friendrel.getStartNode().getProperty(\"name\")).replace(\" \", \"_\").replace(\",\", \"_\").replace(\")\", \"_\").replace(\"(\", \"_\").replace(\":\", \"_\"));\n \t\t\t\tnodes.put(friendrel.getStartNode(), node);\n \t\t\t}\n \t\t\tif(nodes.containsKey(friendrel.getEndNode())==false){\n \t\t\t\tJadeNode node = new JadeNode();\n \t\t\t\tnode.setName(((String)friendrel.getEndNode().getProperty(\"name\")).replace(\" \", \"_\").replace(\",\", \"_\").replace(\")\", \"_\").replace(\"(\", \"_\").replace(\":\", \"_\"));\n \t\t\t\tnodes.put(friendrel.getEndNode(),node);\n \t\t\t}\n \t\t\tnodes.get(friendrel.getEndNode()).addChild(nodes.get(friendrel.getStartNode()));\n \t\t\tif (count % 100000 == 0)\n \t\t\t\tSystem.out.println(count);\n \t\t}\n \t\tJadeTree tree = new JadeTree(root);\n \t\tPrintWriter outFile;\n \t\ttry {\n \t\t\toutFile = new PrintWriter(new FileWriter(\"taxtree.tre\"));\n \t\t\toutFile.write(tree.getRoot().getNewick(false));\n \t\t\toutFile.write(\";\\n\");\n \t\t\toutFile.close();\n \t\t} catch (IOException e) {\n \t\t\te.printStackTrace();\n \t\t}\n \t}", "public Iterator trip() {\n\t\tStack path = new Stack();\n\t\ttry {\n\t\t\t// initializes path to the stack of nodes from starting point to end\n\t\t\t// point\n\t\t\tpath = path(BusLines, BusLines.getNode(start), BusLines.getNode(dest));\n\n\t\t\t// checks if there is a path, otherwise return null\n\t\t\tif (path == null) {\n\t\t\t\treturn null;\n\t\t\t} else {\n\t\t\t\treturn path.iterator();\n\t\t\t}\n\t\t} catch (GraphException e) {\n\t\t\tSystem.out.println(\"Error: the path does not exists.\");\n\t\t}\n\t\treturn null;\n\n\t}", "private void buildTree(Species[] species) {\n List<PhyloTreeNode> treeList = new ArrayList<PhyloTreeNode>();\n MultiKeyMap<Double> speciesMap = new MultiKeyMap<Double>();\n for(Species s : species) {\n treeList.add(new PhyloTreeNode(null, s));\n }\n for(int i = 0; i < species.length - 1; i++) {\n for(int j = i + 1; j < species.length; j++) {\n speciesMap.put(species[i].getName(), species[j].getName(), Species.distance(species[i], species[j]));\n }\n }\n while(treeList.size() > 1) {\n double minValue = java.lang.Double.POSITIVE_INFINITY;\n String currentString = \"\";\n for (Map.Entry<String, Double> entry : speciesMap.entrySet()) {\n double value = entry.getValue();\n if(value < minValue ) {\n minValue = value;\n }\n }\n for (Map.Entry<String, Double> entry : speciesMap.entrySet()) {\n String key = entry.getKey();\n double value = entry.getValue();\n String[] wordArray = compareKeys(key);\n String newString = (wordArray[0] + \"|\" + wordArray[1]);\n if(value == minValue && (newString.compareTo(currentString) < 1 || currentString == \"\" )) {\n currentString = newString;\n }\n }\n PhyloTreeNode less = null;\n PhyloTreeNode great = null;\n String[] twoWords = compareKeys(currentString);\n for(int i = 0; i < treeList.size(); i++) {\n if(treeList.get(i).getLabel().equals(twoWords[0]))\n less = treeList.get(i);\n if(treeList.get(i).getLabel().equals(twoWords[1]))\n great = treeList.get(i);\n }\n String lesser = less.getLabel();\n String greater = great.getLabel();\n for(PhyloTreeNode s : treeList) {\n if(!s.getLabel().equals(lesser) && !s.getLabel().equals(greater)) {\n double numLessLeaf = less.getNumLeafs();\n double numGreatLeaf = great.getNumLeafs();\n double answer = ( ((numLessLeaf /(numLessLeaf + numGreatLeaf)) * speciesMap.get(lesser, s.getLabel())) +\n ((numGreatLeaf /(numLessLeaf + numGreatLeaf)) * speciesMap.get(greater, s.getLabel())));\n speciesMap.remove(lesser, s.getLabel());\n speciesMap.remove(greater, s.getLabel());\n speciesMap.put(lesser + \"+\" + greater, s.getLabel(), answer);\n }\n }\n PhyloTreeNode combined = new PhyloTreeNode(lesser + \"+\" + greater, null, less, great, speciesMap.get(lesser, greater) / 2.0);\n combined.getLeftChild().setParent(combined);\n combined.getRightChild().setParent(combined);\n treeList.add(combined);\n treeList.remove(less);\n treeList.remove(great);\n speciesMap.remove(lesser, greater);\n }\n if(treeList.size() != 0)\n overallRoot = treeList.get(0);\n return;\n }", "private List<AxiomTreeMapping> match(AxiomTreeNode t1, AxiomTreeNode t2, AxiomTreeMapping mapping) {\n if (mapping.contains(t1, t2)) {\n \t\n return matchChildren(t1, t2, mapping);\n }\n\n // else if the root nodes match and we haven't yet found a mapping for the node in t2\n if (!mapping.containsTarget(t2) && isMatch(t1, t2, mapping)) {\n \t\n // copy the mapping and add the two nodes to the existing mapping\n mapping = mapping.copy();\n \n if (t1.isLeaf() && t2.isLeaf()) {\n \t\tmapping.addMapping(t1, t2);\n \t\t//System.out.println(\"LEAF MAP\");\n \t\t//System.out.println(\"Current state of mapping: \");\n \t\t//mapping.printMapping();\n \t\t//System.out.println(\"-------------------------\");\n \t//System.out.println(\"\");\n \t\t//System.out.println(\"SHARED: \" + t1.getParent().toString()); \n\t //ystem.out.println(\"Leaf to leaf map: \" + t1.toString() + \" \" + t2.toString()); \t\n } \n\n // then continue with the child nodes\n return matchChildren(t1, t2, mapping);\n }\n\n // otherwise if the nodes don't match, return an empty list of mappings\n //System.out.println(\"Childe nodes don't match.\");\n return Collections.emptyList();\n }", "private void getAllNodesBreadthFirstSearch(List<Expression> nodesList)\n/* */ {\n/* 156 */ int indx = 0;\n/* 157 */ nodesList.add(this);\n/* */ \n/* 159 */ while (indx < nodesList.size()) {\n/* 160 */ Expression node = (Expression)nodesList.get(indx++);\n/* 161 */ for (Expression child : node.childs) {\n/* 162 */ nodesList.add(child);\n/* */ }\n/* */ }\n/* */ }", "public PairList parseTreeFrequences(){\r\n\r\n\t\tPairList nGramList = new PairList();\r\n\t\tparseNodeFrequences(nGramList, treeRoot, null);\r\n\t\treturn nGramList;\r\n\t}" ]
[ "0.52292466", "0.5183918", "0.5136256", "0.5055446", "0.50291973", "0.50272614", "0.49898455", "0.4988652", "0.49458942", "0.49417424", "0.49408978", "0.49126944", "0.49116838", "0.48960128", "0.48937196", "0.48877695", "0.48356166", "0.48342073", "0.48259014", "0.48116925", "0.47958466", "0.47862682", "0.47852942", "0.47695264", "0.4768132", "0.47666392", "0.47598928", "0.47531185", "0.47482187", "0.474299", "0.4740646", "0.47333664", "0.47270477", "0.47256267", "0.472276", "0.4707852", "0.47055477", "0.46961337", "0.46893144", "0.46879786", "0.4678103", "0.46413645", "0.4627114", "0.46270484", "0.46252304", "0.46081838", "0.4607059", "0.46037194", "0.459653", "0.45892707", "0.4587175", "0.4585755", "0.4584674", "0.45809117", "0.4578588", "0.4572672", "0.457174", "0.4569794", "0.45637453", "0.45631373", "0.45598134", "0.4552712", "0.45493028", "0.45431978", "0.45426202", "0.45407468", "0.45391092", "0.45372912", "0.45313674", "0.45302546", "0.45268613", "0.452595", "0.4525507", "0.45249838", "0.45223945", "0.4518719", "0.45034552", "0.45007566", "0.45004424", "0.44990534", "0.44985694", "0.44934735", "0.44914764", "0.44906664", "0.44869673", "0.44863996", "0.44835266", "0.4480095", "0.44784874", "0.44699895", "0.44681576", "0.44679344", "0.44625804", "0.44624084", "0.44609135", "0.44595504", "0.44561273", "0.44514105", "0.44499406", "0.44494036" ]
0.60340273
0
TODO Autogenerated method stub
public static void main(String[] args) { System.out.println(multiplication(5,2)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Creates a new visitor.
MetadataVisitor() { visited = new IdentityHashMap<>(); propertyPath = new String[6]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Visitor() {}", "public void accept(Visitor visitor);", "void accept(Visitor visitor);", "void accept(Visitor<V> visitor);", "public Visitor visitor(Visitor v) \n { \n return visitor = v; \n }", "void visit(Visitor visitor);", "public void accept(IVisitor visitor);", "public abstract void accept(Visitor visitor);", "public void accept(ExpressionNodeVisitor visitor);", "public abstract void accept0(IASTNeoVisitor visitor);", "public interface Visitor {\n\t/* METHODS */\n\t/**\n\t * Visits a Liquor.\n\t * @param liquor The Liquor to visit.\n\t */\n\tvoid visit(Liquor liquor);\n\t\n\t/**\n\t * Visits a Tobacco.\n\t * @param tobacco The Tobacco to visit.\n\t */\n\tvoid visit(Tobacco tobacco);\n\t\n\t/**\n\t * Visits a Necessity.\n\t * @param necessity The Necessity to visit.\n\t */\n\tvoid visit(Necessity necessity);\n}", "public abstract void accept(Visitor v);", "@Override\n\tpublic void accept(Visitor visitor) {\n\t\t\n\t}", "public Object accept(Visitor v, Object params);", "public Object accept(ExpressionNodeVisitor visitor) {\n\t\t\n\t\treturn visitor.visit(this);\n\t\t\n\t}", "public void accept(Visitor v) {\n/* 103 */ v.visitLoadClass(this);\n/* 104 */ v.visitAllocationInstruction(this);\n/* 105 */ v.visitExceptionThrower(this);\n/* 106 */ v.visitStackProducer(this);\n/* 107 */ v.visitTypedInstruction(this);\n/* 108 */ v.visitCPInstruction(this);\n/* 109 */ v.visitNEW(this);\n/* */ }", "@SuppressWarnings(\"unused\")\npublic interface Visitor {\n /**\n * <p>\n * Visits the given <code>Document</code>\n * </p>\n * \n * @param document\n * is the <code>Document</code> node to visit.\n */\n void visit(Document document);\n\n /**\n * <p>\n * Visits the given <code>DocumentType</code>\n * </p>\n * \n * @param documentType\n * is the <code>DocumentType</code> node to visit.\n */\n void visit(DocumentType documentType);\n\n /**\n * <p>\n * Visits the given <code>Element</code>\n * </p>\n * \n * @param node\n * is the <code>Element</code> node to visit.\n */\n void visit(Element node);\n\n /**\n * <p>\n * Visits the given <code>Attribute</code>\n * </p>\n * \n * @param node\n * is the <code>Attribute</code> node to visit.\n */\n void visit(Attribute node);\n\n /**\n * <p>\n * Visits the given <code>CDATA</code>\n * </p>\n * \n * @param node\n * is the <code>CDATA</code> node to visit.\n */\n void visit(CDATA node);\n\n /**\n * <p>\n * Visits the given <code>Comment</code>\n * </p>\n * \n * @param node\n * is the <code>Comment</code> node to visit.\n */\n void visit(Comment node);\n\n /**\n * <p>\n * Visits the given <code>Entity</code>\n * </p>\n * \n * @param node\n * is the <code>Entity</code> node to visit.\n */\n void visit(Entity node);\n\n /**\n * <p>\n * Visits the given <code>Namespace</code>\n * </p>\n * \n * @param namespace\n * is the <code>Namespace</code> node to visit.\n */\n void visit(Namespace namespace);\n\n /**\n * <p>\n * Visits the given <code>ProcessingInstruction</code>\n * </p>\n * \n * @param node\n * is the <code>ProcessingInstruction</code> node to visit.\n */\n void visit(ProcessingInstruction node);\n\n /**\n * <p>\n * Visits the given <code>Text</code>\n * </p>\n * \n * @param node\n * is the <code>Text</code> node to visit.\n */\n void visit(Text node);\n}", "@Override\n public void accept(TreeVisitor visitor) {\n }", "public abstract void visit();", "public Object accept (Visitor v) {\n return v.visit(this);\n }", "private <R> TraversingDiffVisitor<R> newVisitor(Path<Object> path) {\r\n return new TraversingDiffVisitor<>(path, processor);\r\n }", "public abstract void accept(CodeVisitor v);", "@Override\n\tpublic <T> T accept(ASTVisitor<T> v) {\n\t\treturn v.visit(this);\n\t}", "@Override\n\tpublic @NonNull EvaluationVisitor createEvaluationVisitor(@NonNull EvaluationEnvironment evalEnv) {\n\t\tEvaluationVisitor visitor = delegated.createEvaluationVisitor(evalEnv);\n\n\t\tif (!(visitor instanceof TracingOCLEvaluationVisitor)) {\n\t\t\tvisitor = new TracingOCLEvaluationVisitor((EvaluationVisitorExtension) visitor);\n\t\t}\n\n\t\treturn visitor;\n\t}", "@Override\n public void accept(Visitor visitor) {\n visitor.visit(this);\n }", "@Override\n public void accept(Visitor visitor) {\n visitor.visit(this);\n }", "@Override\n\tpublic void accept(TreeVisitor visitor) {\n\n\t}", "@Override\r\n\tpublic void accept(Visitor v) {\r\n\t\tv.visit(this);\t\r\n\t}", "public interface Visitor<R> {\n\n //Lists\n public <T extends IRNode> R visit(List<T> ns);\n\n //IRStms\n public R visit(CJUMP n);\n\n public R visit(CMOVE n);\n\n public R visit(EXP n);\n\n public R visit(JUMP n);\n\n public R visit(LABEL n);\n\n public R visit(MOVE n);\n\n public R visit(SEQ n);\n\n //Types\n public R visit(BINOP n);\n\n public R visit(CALL n);\n\n public R visit(CONST n);\n\n public R visit(ESEQ n);\n\n //Statements\n public R visit(MEM n);\n\n public R visit(NAME n);\n\n public R visit(TEMP n);\n}", "public void accept(Visitor visitor) {\n\t\tvisitor.visit(this);\n\t}", "@Override\n public <T> T accept(Visitor<T> v) {\n return v.visit(this);\n }", "@Override\n\tpublic Object accept(Visitor visitor) {\n\t\treturn visitor.visit(this);\n\t}", "public interface LambdaVisitor<T> {\n T visit(ASTAbstraction node);\n T visit(ASTApplication node);\n T visit(ASTConstant node);\n T visit(ASTVariable node);\n}", "public interface Visitor {\n //----------------------------------------------------------------------------------- \n\n /**\n * Visit method to handle <code>Assignment</code> elements.\n * \n * @param assignment Assignment object to be handled.\n */\n void visit(final Assignment assignment);\n\n /**\n * Visit method to handle <code>Delete</code> elements.\n * \n * @param delete Delete object to be handled.\n */\n void visit(final Delete delete);\n\n /**\n * Visit method to handle <code>Insert</code> elements.\n * \n * @param insert Insert object to be handled.\n */\n void visit(final Insert insert);\n\n /**\n * Visit method to handle <code>Join</code> elements.\n * \n * @param join Join object to be handled\n */\n void visit(final Join join);\n\n /**\n * Visit method to handle select elements.\n * \n * @param select Select object to be handled.\n */\n void visit(final Select select);\n\n /**\n * Visit method to handle <code>Table</code> elements.\n * \n * @param table Table object to be handled.\n */\n void visit(final Table table);\n\n /**\n * Visit method to handle <code>TableAlias</code> elements.\n * \n * @param tableAlias TableAlias object to be handled.\n */\n void visit(final TableAlias tableAlias);\n\n /**\n * Visit method to handle update elements.\n * \n * @param update Update object to be handled.\n */\n void visit(final Update update);\n\n /**\n * Visit method to handle <code>AndCondition</code> elements.\n * \n * @param andCondition AndCondition object to be handled.\n */\n void visit(final AndCondition andCondition);\n\n /**\n * Visit method to handle <code>Compare</code> elements.\n * \n * @param compare Compare object to be handled.\n */\n void visit(final Compare compare);\n\n /**\n * Visit method to handle <code>IsNullPredicate</code> elements.\n * \n * @param isNullPredicate IsNullPredicate object to be handled.\n */\n void visit(final IsNullPredicate isNullPredicate);\n\n /**\n * Visit method to handle <code>OrCondition</code> elements.\n * \n * @param orCondition OrCondition object to be handled.\n */\n void visit(final OrCondition orCondition);\n\n /**\n * Visit method to handle <code>Column</code> elements.\n * \n * @param column Column object to be handled.\n */\n void visit(final Column column);\n\n /**\n * Visit method to handle <code>NextVal</code> elements.\n * \n * @param nextVal NextVal object to be handled.\n */\n void visit(final NextVal nextVal);\n\n /**\n * Visit method to handle <code>Parameter</code> elements.\n * \n * @param parameter Parameter object to be handled.\n */\n void visit(final Parameter parameter);\n\n //-----------------------------------------------------------------------------------\n\n /**\n * Method returning constructed String.\n * \n * @return Constructed query string.\n */\n String toString();\n\n //----------------------------------------------------------------------------------- \n}", "@Override\r\n \tpublic final void accept(IASTNeoVisitor visitor) {\r\n \t\tassertNotNull(visitor);\r\n \t\t\r\n \t\t// begin with the generic pre-visit\r\n \t\tif(visitor.preVisit(this)) {\r\n \t\t\t// dynamic dispatch to internal method for type-specific visit/endVisit\r\n \t\t\taccept0(visitor);\r\n \t\t}\r\n \t\t// end with the generic post-visit\r\n \t\tvisitor.postVisit(this);\r\n \t}", "Object visitorResponse();", "public abstract void visit(V v) throws VisitorException;", "@Override\n\tpublic void accept(NodeVisitor visitor) {\n\t\tvisitor.visit(this);\n\t}", "@Override\n\tpublic void accept(Visitor visitor) {\n\t\tvisitor.visit(this);\n\t}", "public void accept(MessageVisitor visitor);", "@Override\r\n\tpublic void accept(Visitor visitor) {\r\n\t\tvisitor.visit(this);\r\n\t}", "@Override\n\tpublic void accept(Visitor v) {\n\t\tv.visit(this);\n\t}", "@Override public <T> T apply(TreeVisitor<T> visitor)\n {\n return visitor.visit(this);\n }", "@Override public <T> T apply(TreeVisitor<T> visitor)\n {\n return visitor.visit(this);\n }", "interface VisitorAccept {\n\t/**\n\t * Methode permettant d'accepter le visiteur.\n\t * \n\t * @param visitor\n\t * ; MessageVisitor\n\t */\n\tpublic void accept(MessageVisitor visitor);\n}", "public void accept(ParseNodeVisitor visitor) {\n visitor.visit(this);\n }", "<R,D> R accept(TreeVisitor<R,D> visitor, D data);", "public void accept(Visitor v) {\n\t\tv.visit(this);\n\t}", "@Override\r\n\tpublic void visit() {\n\r\n\t}", "<R> R accept(ValueVisitor<R> visitor);", "public interface Visitor extends DLABoxAxiom.Visitor, DLTBoxAxiom.Visitor {\n\n\t}", "public interface Visitor {\n\tpublic void visit(WordTreeI wt);\n}", "@Override\n public void visit(NodeVisitor v){\n v.visit(this);\n }", "public abstract <E, F, D, I> E accept(ReturnVisitor<E, F, D, I> visitor);", "public DispatchVisitor(BaseVisitor nextVisitor) {\n\t\tsuper(nextVisitor);\n\t}", "public interface Visitor {\n\n public void visitCode(Code obj);\n\n public void visitCodeException(CodeException obj);\n\n public void visitConstantClass(ConstantClass obj);\n\n public void visitConstantDouble(ConstantDouble obj);\n\n public void visitConstantFieldref(ConstantFieldref obj);\n\n public void visitConstantFloat(ConstantFloat obj);\n\n public void visitConstantInteger(ConstantInteger obj);\n\n public void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj);\n\n public void visitConstantLong(ConstantLong obj);\n\n public void visitConstantMethodref(ConstantMethodref obj);\n\n public void visitConstantNameAndType(ConstantNameAndType obj);\n\n public void visitConstantPool(ConstantPool obj);\n\n public void visitConstantString(ConstantString obj);\n\n public void visitConstantUtf8(ConstantUtf8 obj);\n\n public void visitConstantValue(ConstantValue obj);\n\n public void visitDeprecated(Deprecated obj);\n\n public void visitExceptionTable(ExceptionTable obj);\n\n public void visitField(Field obj);\n\n public void visitInnerClass(InnerClass obj);\n\n public void visitInnerClasses(InnerClasses obj);\n\n public void visitJavaClass(JavaClass obj);\n\n public void visitLineNumber(LineNumber obj);\n\n public void visitLineNumberTable(LineNumberTable obj);\n\n public void visitLocalVariable(LocalVariable obj);\n\n public void visitLocalVariableTable(LocalVariableTable obj);\n\n public void visitMethod(Method obj);\n\n public void visitSignature(Signature obj);\n\n public void visitSourceFile(SourceFile obj);\n\n public void visitSynthetic(Synthetic obj);\n\n public void visitUnknown(Unknown obj);\n\n public void visitStackMap(StackMap obj);\n\n public void visitStackMapEntry(StackMapEntry obj);\n\n // Java5\n public void visitEnclosingMethod(EnclosingMethod obj);\n\n public void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations obj);\n\n public void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations obj);\n\n public void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations obj);\n\n public void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations obj);\n\n public void visitAnnotationDefault(AnnotationDefault obj);\n\n public void visitLocalVariableTypeTable(LocalVariableTypeTable obj);\n}", "public Visitante() {\r\n }", "public interface Visitor {\n void accept(Element element);\n}", "public interface Acceptor {\n\n /**\n * Accepts a visitor for further processing.\n *\n * @param visitor the visitor class to accept.\n */\n void accept(Visitor visitor);\n}", "public interface Visitor {\r\n \r\n /**\r\n * Visits an Operand and performs the action given when overriding\r\n * this method.\r\n * @param operand An Operand this Visitor has visited\r\n * @return \r\n * @see Operand\r\n */\r\n public void visit(Operand operand);\r\n \r\n /**\r\n * Visits an Operator and performs the action given when overriding\r\n * this method.\r\n * @param operator An Operator this Visitor has visited.\r\n * @see Operator\r\n */\r\n public void visit(Operator operator);\r\n \r\n}", "public interface IGraphvizFormatterVisitable {\n\n String accept(AGraphvizFormatter visitor);\n\n}", "@Override\n\tpublic Void visit(NewType type) {\n\t\tprintIndent(\"new\");\n\t\tindent++;\n\t\ttype.type.accept(this);\n\t\tindent--;\n\t\treturn null;\n\t}", "public void accept(Visitor v, Context c) {\n\t\tv.visit(this, c);\n\t}", "public VisitAction() {\n }", "public interface ParseNodeVisitor {\r\n // non-leaf nodes: visitEnter and visitLeave\r\n\r\n ///////////////////////////////////////////////////////////\r\n // Constructs larger than statements\r\n void visitEnter(ParseNode node);\r\n\r\n void visitLeave(ParseNode node);\r\n\r\n void visitEnter(ProgramNode node);\r\n\r\n void visitLeave(ProgramNode node);\r\n\r\n ///////////////////////////////////////////////////////////\r\n // Function Node\r\n void visitEnter(GlobalDefinitionNode node);\r\n\r\n void visitLeave(GlobalDefinitionNode node);\r\n\r\n void visitEnter(FunctionDefinitionNode node);\r\n\r\n void visitLeave(FunctionDefinitionNode node);\r\n\r\n void visitEnter(LambdaNode node);\r\n\r\n void visitLeave(LambdaNode node);\r\n\r\n void visitEnter(LambdaParamTypeNode node);\r\n\r\n void visitLeave(LambdaParamTypeNode node);\r\n\r\n void visitEnter(ParameterListNode node);\r\n\r\n void visitLeave(ParameterListNode node);\r\n\r\n void visitEnter(ParameterSpecificationNode node);\r\n\r\n void visitLeave(ParameterSpecificationNode node);\r\n\r\n void visitEnter(FunctionInvocationNode node);\r\n\r\n void visitLeave(FunctionInvocationNode node);\r\n\r\n ///////////////////////////////////////////////////////////\r\n // Statement Node\r\n void visitEnter(BlockStatementNode node);\r\n\r\n void visitLeave(BlockStatementNode node);\r\n\r\n void visitEnter(PrintStatementNode node);\r\n\r\n void visitLeave(PrintStatementNode node);\r\n\r\n void visitEnter(DeclarationNode node);\r\n\r\n void visitLeave(DeclarationNode node);\r\n\r\n void visitEnter(AssignmentStatementNode node);\r\n\r\n void visitLeave(AssignmentStatementNode node);\r\n\r\n void visitEnter(IfStatementNode node);\r\n\r\n void visitLeave(IfStatementNode node);\r\n\r\n void visitEnter(WhileStatementNode node);\r\n\r\n void visitLeave(WhileStatementNode node);\r\n\r\n void visitEnter(ReleaseStatementNode node);\r\n\r\n void visitLeave(ReleaseStatementNode node);\r\n\r\n void visitEnter(ReturnStatementNode node);\r\n\r\n void visitLeave(ReturnStatementNode node);\r\n\r\n void visitEnter(CallStatementNode node);\r\n\r\n void visitLeave(CallStatementNode node);\r\n\r\n void visitEnter(BreakStatementNode node);\r\n\r\n void visitLeave(BreakStatementNode node);\r\n\r\n void visitEnter(ContinueStatementNode node);\r\n\r\n void visitLeave(ContinueStatementNode node);\r\n \r\n void visitEnter(ForStatementNode node);\r\n\r\n void visitLeave(ForStatementNode node);\r\n\r\n ///////////////////////////////////////////////////////////\r\n // Expression Node\r\n void visitEnter(BinaryOperatorNode node);\r\n\r\n void visitLeave(BinaryOperatorNode node);\r\n\r\n void visitEnter(UnaryOperatorNode node);\r\n\r\n void visitLeave(UnaryOperatorNode node);\r\n\r\n void visitEnter(TypeCastingNode node);\r\n\r\n void visitLeave(TypeCastingNode node);\r\n\r\n void visitEnter(ExpressionListNode node);\r\n\r\n void visitLeave(ExpressionListNode node);\r\n\r\n void visitEnter(NewArrayTypeLengthNode node);\r\n\r\n void visitLeave(NewArrayTypeLengthNode node);\r\n\r\n void visitEnter(TypeNode node);\r\n\r\n void visitLeave(TypeNode node);\r\n\r\n void visitEnter(TypeListNode node);\r\n\r\n void visitLeave(TypeListNode node);\r\n \r\n void visitEnter(LambdaTypeNode node);\r\n\r\n void visitLeave(LambdaTypeNode node);\r\n \r\n void visitEnter(ArrayIndexingNode node);\r\n\r\n void visitLeave(ArrayIndexingNode node);\r\n\r\n // leaf nodes: visitLeaf only\r\n void visit(BooleanConstantNode node);\r\n\r\n void visit(TypeCastedToNode node);\r\n\r\n void visit(ErrorNode node);\r\n\r\n void visit(IdentifierNode node);\r\n\r\n void visit(IntegerConstantNode node);\r\n\r\n void visit(FloatingConstantNode node);\r\n\r\n void visit(CharConstantNode node);\r\n\r\n void visit(StringConstantNode node);\r\n\r\n void visit(NewlineNode node);\r\n\r\n void visit(TabNode node);\r\n\r\n void visit(SpaceNode node);\r\n\r\n public static class Default implements ParseNodeVisitor {\r\n ///////////////////////////////////////////////////////////////////////////\r\n // Constructs larger than statements\r\n\r\n public void defaultVisit(ParseNode node) {}\r\n\r\n public void defaultVisitEnter(ParseNode node) {\r\n defaultVisit(node);\r\n }\r\n\r\n public void defaultVisitLeave(ParseNode node) {\r\n defaultVisit(node);\r\n }\r\n\r\n public void defaultVisitForLeaf(ParseNode node) {\r\n defaultVisit(node);\r\n }\r\n\r\n public void visitEnter(ParseNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ParseNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(ProgramNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ProgramNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // Function Node\r\n public void visitEnter(GlobalDefinitionNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(GlobalDefinitionNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(FunctionDefinitionNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(FunctionDefinitionNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(LambdaNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(LambdaNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(LambdaParamTypeNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(LambdaParamTypeNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(ParameterListNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ParameterListNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(ParameterSpecificationNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ParameterSpecificationNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(FunctionInvocationNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(FunctionInvocationNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////////////////////\r\n // Statements\r\n\r\n /*\r\n * Statements -> BlockStatement PrintStatement Declaration AssignmentStatement IfStatement\r\n * WhileStatement ReleaseStatement ReturnStatement CallStatement BreakStatement\r\n * ContinueStatement\r\n */\r\n\r\n ///////////////////////////////////////////////////////////\r\n // BlockStatement\r\n public void visitEnter(BlockStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(BlockStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // PrintStatement\r\n public void visitEnter(PrintStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(PrintStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // DeclarationStatement\r\n public void visitEnter(DeclarationNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(DeclarationNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // AssignmentStatement\r\n public void visitEnter(AssignmentStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(AssignmentStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // IfStatement\r\n public void visitEnter(IfStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(IfStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // WhileStatement\r\n public void visitEnter(WhileStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(WhileStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // ReleaseStatement\r\n public void visitEnter(ReleaseStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ReleaseStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // ReturnStatement\r\n public void visitEnter(ReturnStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ReturnStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // CallStatement\r\n public void visitEnter(CallStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(CallStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // BreakStatement\r\n public void visitEnter(BreakStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(BreakStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////\r\n // ContinueStatement\r\n public void visitEnter(ContinueStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ContinueStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n \r\n ///////////////////////////////////////////////////////////\r\n // ForStatement\r\n public void visitEnter(ForStatementNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ForStatementNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////////////////////\r\n // ExpressionNode\r\n\r\n public void visitEnter(BinaryOperatorNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(BinaryOperatorNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(UnaryOperatorNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(UnaryOperatorNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(TypeCastingNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(TypeCastingNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(ExpressionListNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(ExpressionListNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(NewArrayTypeLengthNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(NewArrayTypeLengthNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitLeave(ArrayIndexingNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n public void visitEnter(ArrayIndexingNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitEnter(TypeNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(TypeNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n \r\n public void visitEnter(LambdaTypeNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(LambdaTypeNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n \r\n public void visitEnter(TypeListNode node) {\r\n defaultVisitEnter(node);\r\n }\r\n\r\n public void visitLeave(TypeListNode node) {\r\n defaultVisitLeave(node);\r\n }\r\n\r\n ///////////////////////////////////////////////////////////////////////////\r\n // Leaf nodes\r\n public void visit(IdentifierNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(TypeCastedToNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(BooleanConstantNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(ErrorNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(IntegerConstantNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(FloatingConstantNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(CharConstantNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(StringConstantNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(NewlineNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(TabNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n\r\n public void visit(SpaceNode node) {\r\n defaultVisitForLeaf(node);\r\n }\r\n }\r\n}", "public static MethodCallExpression accept(ExpressionVisitor visitor) { throw Extensions.todo(); }", "public interface FilterVisitor<R> {\r\n\r\n /**\r\n * A FilterVistor must visit all these methods below, per visitor design pattern. \r\n * And a FilterExpression just need implements an accept() method.\r\n */\r\n\r\n <T extends Comparable<T>> R visit(Eq<T> eq);\r\n\r\n <T extends Comparable<T>> R visit(NotEq<T> notEq);\r\n\r\n <T extends Comparable<T>> R visit(LtEq<T> ltEq);\r\n\r\n <T extends Comparable<T>> R visit(GtEq<T> gtEq);\r\n\r\n R visit(Not not);\r\n\r\n R visit(And and);\r\n\r\n R visit(Or or);\r\n\r\n}", "public interface Acceptor<V>\n{\n /**\n * Accepts a visitor and applies it to this.\n *\n * @param visitor The visitor to apply to this.\n */\n void accept(Visitor<V> visitor);\n}", "@Override\n\tpublic void accept(ASTVisitor v) {\n\t\tv.visitProgram(this);\n\t}", "public abstract void accept(GameObjectVisitor v);", "public <C> void accept(Visitor<B> visitor, Class<C> clz);", "void accept(TmxElementVisitor visitor);", "public abstract void accept(PhysicalPlanVisitor visitor);", "public Object accept(FilterVisitor visitor, Object extraData) {\n \treturn visitor.visit(this,extraData);\n }", "public Visit() {\n\t\t//dateTime = LocalDateTime.now();\n\t}", "@Override\n public void visit(final OpDiff opDiff) {\n if (LOG.isDebugEnabled()) {\n LOG.debug(\"Starting visiting OpDiff\");\n }\n final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);\n addOp(OpDiff.create(rewriteOp2(opDiff, rewriter), rewriter.getResult()));\n }", "public void setVisitorName(String visitorName) {\n this.visitorName = visitorName;\n }", "void accept0(ASTVisitor visitor) {\r\n\t\tboolean visitChildren = visitor.visit(this);\r\n\t\tif (visitChildren) {\r\n\t\t\t// visit children in normal left to right reading order\r\n\t\t\tacceptChild(visitor, getExpression());\r\n\t\t\tacceptChildren(visitor, newArguments);\r\n\t\t\tacceptChildren(visitor, constructorArguments);\r\n\t\t\tacceptChildren(visitor, baseClasses);\r\n\t\t\tacceptChildren(visitor, declarations);\r\n\t\t}\r\n\t\tvisitor.endVisit(this);\r\n\t}", "public interface Visitor {\n\n void visit(Home home);\n}", "public interface EntityVisitor<T> {\n T visit(DefinedVariable definedVariable);\n\n T visit(UndefinedVariable undefinedVariable);\n\n T visit(DefinedFunction definedFunction);\n\n T visit(UndefinedFunction undefinedFunction);\n\n T visit(Constant constant);\n}", "public static com.idetronic.eis.model.VisitorCategory create(\n\t\tlong visitorCategoryId) {\n\t\treturn getPersistence().create(visitorCategoryId);\n\t}", "public interface FlowerElement {\n public void accept(Visitor visitor);\n}", "@Override\r\n\tpublic Relation accept(Visitor v)\t\t{ return v.visit(this);\t\t\t\t\t\t\t}", "public void processWith(IVariableVisitor iVariableVisitor);", "void accept(Visitor visitor, BufferedImage im);", "public interface Visitable {\n\n\tpublic double accept(Visitor visitor);\n}", "public abstract int visit(SpatialVisitor visitor);", "public interface Visitor {\n\n /**\n * please refer to the java doc inside the implementation classes\n * @param user\n */\n void visit(User user);\n\n /**\n * please refer to the java doc inside the implementation classes\n * @param entitlement\n */\n void visit(Entitlement entitlement);\n\n /**\n * please refer to the java doc inside the implementation classes\n * @param authToken\n */\n void visit(AuthToken authToken);\n\n /**\n * please refer to the java doc inside the implementation classes\n * @param resource\n */\n void visit(Resource resource);\n\n /**\n * please refer to the java doc inside the implementation classes\n * @return\n */\n boolean isValidStatus();\n\n /**\n * please refer to the java doc inside the implementation classes\n * @return\n */\n boolean isValidExpTime();\n\n /**\n * please refer to the java doc inside the implementation classes\n * @return\n */\n boolean isHasPermissions();\n\n /**\n * please refer to the java doc inside the implementation classes\n * @return\n */\n boolean isHasResources();\n\n /**\n * please refer to the java doc inside the implementation classes\n * @return\n */\n User getUserUnderValidation();\n\n}", "public interface MethodVisitor\n{\n\n\tpublic abstract void visitInsn(int i);\n\n\tpublic abstract void visitIntInsn(int i, int j);\n\n\tpublic abstract void visitVarInsn(int i, int j);\n\n\tpublic abstract void visitTypeInsn(int i, String s);\n\n\tpublic abstract void visitFieldInsn(int i, String s, String s1, String s2);\n\n\tpublic abstract void visitMethodInsn(int i, String s, String s1, String s2);\n\n\tpublic abstract void visitJumpInsn(int i, Label label);\n\n\tpublic abstract void visitLabel(Label label);\n\n\tpublic abstract void visitLdcInsn(Object obj);\n\n\tpublic abstract void visitIincInsn(int i, int j);\n\n\tpublic abstract void visitMaxs(int i, int j);\n\n\tpublic abstract void visitEnd();\n}", "void accept0(ASTVisitor visitor) {\n boolean visitChildren = visitor.visit(this);\n if (visitChildren) {\n // visit children in normal left to right reading order\n acceptChildren(visitor, initializers);\n acceptChild(visitor, getExpression());\n acceptChildren(visitor, updaters);\n acceptChild(visitor, getBody()); }\n visitor.endVisit(this); }", "public interface ExpressionVisitor{\n\n void handel(BracketExpression bracketExpression);\n\n void handel(NaturalNumber naturalNumber);\n\n\n void handel(Sum sum);\n void handel(Difference difference);\n void handel(Product product);\n void handel(Quotient quotient);\n\n void handel(VariableExpression variableExpression);\n}", "private Node newInstrumentationNode(NodeTraversal traversal, Node node, String fnName) {\n\n String type = \"Type.FUNCTION\";\n\n String encodedParam = parameterMapping.getEncodedParam(traversal.getSourceName(), fnName, type);\n\n Node innerProp = IR.getprop(IR.name(MODULE_RENAMING), IR.string(INSTRUMENT_CODE_INSTANCE));\n Node outerProp = IR.getprop(innerProp, IR.string(INSTRUMENT_CODE_FUNCTION_NAME));\n Node functionCall = IR.call(outerProp, IR.string(encodedParam), IR.number(node.getLineno()));\n Node exprNode = IR.exprResult(functionCall);\n\n return exprNode.useSourceInfoIfMissingFromForTree(node);\n }", "@Override\n public void accept(final SqlNodeVisitor<E> visitor) throws SQLException {\n visitor.visit(this);\n }", "public interface Visitable {\n public boolean accept(Visitor v);\n}", "public void visit(Operand operand);", "protected void addVisitor(String name, short rating) {\n\t\tif(!isVisitedBy(name)) {\n\t\t\t//recalculate wird in der aufrufenden Methode gesetzt\n\t\t\tvisitors.add(new Visitor(name, rating));\n\t\t\tvisitors.trimToSize();\n\t\t}\n\t}", "@Override\n public void visit(NodeVisitor v) {\n if (v.visit(this)) {\n target.visit(v);\n if (initializer != null) {\n initializer.visit(v);\n }\n }\n }", "public interface Visitable {\n\tvoid accept(ModelVisitor visitor);\n}", "@Override\n\tpublic void visit(Function arg0) {\n\t\t\n\t}", "public void accept(ParseNodeVisitor visitor) {\n\t\tvisitor.visitEnter(this);\n\t\tvisitChildren(visitor);\n\t\tvisitor.visitLeave(this);\n\t}", "public void accept(ParseNodeVisitor visitor) {\n\t\tvisitor.visitEnter(this);\n\t\tvisitChildren(visitor);\n\t\tvisitor.visitLeave(this);\n\t}" ]
[ "0.7419392", "0.6870752", "0.6809964", "0.6734062", "0.6698606", "0.668431", "0.66822076", "0.6633472", "0.62853235", "0.626553", "0.6258367", "0.62492025", "0.6222093", "0.61949307", "0.5901925", "0.59016544", "0.5885093", "0.58594847", "0.58202326", "0.57979333", "0.5795451", "0.5791709", "0.5754373", "0.57481265", "0.574608", "0.574608", "0.57301277", "0.5718613", "0.5716391", "0.57082325", "0.5700589", "0.566648", "0.5659888", "0.5650464", "0.56501037", "0.5638192", "0.56366175", "0.5623795", "0.5621003", "0.5591658", "0.559088", "0.5587947", "0.5548926", "0.553924", "0.5538881", "0.5532007", "0.55261946", "0.5510122", "0.550126", "0.5489884", "0.54878026", "0.547991", "0.54644233", "0.5449489", "0.54283565", "0.5410471", "0.5407205", "0.54011357", "0.53885776", "0.53841245", "0.5362353", "0.5348155", "0.533651", "0.5320657", "0.531471", "0.5303059", "0.52763563", "0.52716386", "0.52427125", "0.52405626", "0.5235309", "0.5210193", "0.5206629", "0.51854324", "0.517022", "0.5148036", "0.51383036", "0.5129734", "0.51038295", "0.5100837", "0.5097274", "0.5093595", "0.50863475", "0.5077458", "0.5055331", "0.50505805", "0.50459063", "0.5038528", "0.50347257", "0.50280195", "0.50259566", "0.50222653", "0.50205654", "0.5014872", "0.50075597", "0.50057274", "0.49959177", "0.4979717", "0.49775082", "0.49763483", "0.49763483" ]
0.0
-1
Finds best target between specified possible targetsMap
public EntityID nextTarget(Set<StandardEntity> victims) { // Clustering clustering = this.moduleManager.getModule(SampleModuleKey.AMBULANCE_MODULE_CLUSTERING); // if (this.clusterIndex == -1) { this.clusterIndex = clustering.getClusterIndex(this.agentInfo.getID()); // } Collection<StandardEntity> elements = clustering.getClusterEntities(this.clusterIndex); calculateMapCenters(this.clusterIndex, elements); targetsMap.clear(); if (previousTarget != null && !victims.contains(worldInfo.getEntity(previousTarget.getVictimID()))) { previousTarget = null; } refreshTargetsMap(victims, targetsMap); calculateDecisionParameters(victims, targetsMap); calculateVictimsCostValue(); AmbulanceTarget bestTarget = null; bestTarget = findBestVictim(targetsMap, elements); //considering inertia for the current target to prevent loop in target selection if (previousTarget != null && victims.contains(worldInfo.getEntity(previousTarget.getVictimID()))) { if (bestTarget != null && !bestTarget.getVictimID().equals(previousTarget.getVictimID())) { Human bestHuman = (Human) worldInfo.getEntity(bestTarget.getVictimID()); Human previousHuman = (Human) worldInfo.getEntity(previousTarget.getVictimID()); double bestHumanCost = pathPlanning.setFrom(agentInfo.getPosition()).setDestination(bestHuman.getPosition()).calc().getDistance(); double previousHumanCost = pathPlanning.setFrom(agentInfo.getPosition()).setDestination(previousHuman.getPosition()).calc().getDistance(); if (previousHumanCost < bestHumanCost) { bestTarget = previousTarget; } } } previousTarget = bestTarget; if (bestTarget != null) { return bestTarget.getVictimID(); } else { return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public TargetReport retrieveBestTarget()\n\t{\n\t\t// get targets...\n\t\tgetTargetReports(allTargets);\n//\t\tSystem.out.println(\"All Targets: \" + allTargets);\n\t\t\n\t\t// and find the best one\n\t\tTargetReport bestTarget = null;\n\t\tdouble bestScore = 0;\n\t\tfor (TargetReport target : allTargets)\n\t\t{\n\t\t\t// Eliminate targets based on range\n\t\t\tdouble targetRange = getRangeToTarget(target);\n\t\t\tif (targetRange > MAX_REASONABLE_RANGE || targetRange < MIN_REASONABLE_RANGE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// When DRIVERS are lining up, eliminate based on the assumption that the target is aligned.\n\t\t\t// (targetCloseToCenter is set to true during teleop, because we would expect it to be with human drivers)\n\t\t\tif (targetCloseToCenter && Math.abs(target.centerX - IMAGE_WIDTH / 2) > CENTER_ZONE_SIZE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// add score for distance from throttle-based guess\n\t\t\tguessedRange = MAX_REASONABLE_RANGE*0.5*(-Robot.oi.UtilStick.getThrottle() + 1);\n\t\t\tif (Math.abs(guessedRange) > 0.01)\n\t\t\t{\n\t\t\t\t// give a bunch of weight (see TargetReport) based on closesness to guessedRange\n\t\t\t\ttarget.addScoreFromDistance(guessedRange, targetRange);\n\t\t\t\t\n\t\t\t\t// highly prioritize a target close to a guess (this basically overrides the above line...)\n\t\t\t\tif (Math.abs(guessedRange - targetRange) < GUESS_ACCURACY_TOLERANCE)\n\t\t\t\t{\n\t\t\t\t\tbestTarget = target;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// if a target is better than the best, it's now the best\n\t\t\tif (target.getCumulativeScore() > bestScore)\n\t\t\t{\n\t\t\t\tbestTarget = target;\n\t\t\t\tbestScore = target.getCumulativeScore();\n\t\t\t}\n\t\t}\n\t\tallTargets.clear(); // we thought this might have been taking up too much memory, so we cleared it once we were done with it. (It wasn't the issue)\n\t\t\n\t\t// determine if in launcher range to target and set notification based on this\n\t\tcurrentRangeToBestTarget = getRangeToBestTarget();\n\t\tif (Robot.launcherWheels.inRange(currentRangeToBestTarget))\n\t\t\tRobot.launcherstatus.setInRange();\n\t\telse\n\t\t\tRobot.launcherstatus.setOutOfRange();\n\n\t\t// if we've found one, cache and return it\n\t\t// otherwise, return null (it will just default to the first value of bestTarget)\n\t\tcurrentBestTarget = bestTarget;\n\t\t\n\t\t// ALSO, report bestTarget to Driver station\n//\t\tsendBestTargetReport(); // Didn't work, see below\n\t\t\n// \tSystem.out.println(currentBestTarget);\n\t\t\n\t\treturn bestTarget;\n\t}", "@Override\n\tpublic List<node_data> TSP(List<Integer> targets) {\n\t\tList<Integer> targets1 = new ArrayList<>();\n\t\tList<node_data> ans = new ArrayList<>();\n\t\tfor (Integer target: targets) {\n\t\t\tif(!targets1.contains(target)){\n\t\t\t\ttargets1.add(target);\n\t\t\t}\n\t\t}\n\t\tif(targets1.size()==1){\n\t\t\tans.add(this.GA.getNode(targets.get(0)));\n\t\t\treturn ans;\n\t\t}\n\t\tint help=targets1.get(0);\n\t\tint targetSize = targets1.size();\n\t\twhile(!targets1.isEmpty()) {\n\t\t\tdouble minWeight = Integer.MAX_VALUE;\n\t\t\tint geti=-1;\n\t\t\tfor (int j = 0; j <targetSize ; j++) {\n\t\t\t\tif(shortestPathDist(help,targets1.get(j)) !=0 &&shortestPathDist(help,targets1.get(j))<minWeight || targets1.size()==1 && shortestPathDist(help,targets1.get(j)) ==0) {\n\t\t\t\t\tminWeight = shortestPathDist(help, targets1.get(j));\n\t\t\t\t\tgeti = targets1.get(j);\n\t\t\t\t}\n\t\t\t}\n\t\t\tList<node_data> ans2 = new ArrayList<>();\n\t\t\tif(geti==-1) return null;\n\t\t\tif(targets1.size()>1) {\n\t\t\t\tans2 = shortestPath(help, geti);\n\t\t\t\tans.addAll(ans2);\n\t\t\t\ttargets1.remove((Integer) help);\n\t\t\t\ttargetSize--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttargets1.remove((Integer)geti);\n\t\t\t}\n\t\t\thelp=geti;\n\t\t}\n\t\tfor (int ii = 0; ii <ans.size()-1 ; ii++) {\n\t\t\tif(ans.get(ii)==ans.get(ii+1)){\n\t\t\t\tans.remove(ii);\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}", "private CFGNode findTarget(String target, ArrayList<CFGNode> nodes) {\n for (CFGNode n: nodes) {\n if (n.block.label != null && n.block.label.trim().equals(target.trim())) {\n return n;\n }\n }\n\n return null;\n }", "public BoardCell pickLocation(Set<BoardCell> targets){\n\t\tfor (BoardCell i: targets)\r\n\t\t\tif (i.isRoom() && !(((RoomCell) i).getInitial() == lastRoomVisited))\r\n\t\t\t\treturn i;\r\n\t\t//\tpick random cell\r\n\t\tObject[] cell = targets.toArray();\r\n\t\tRandom generator = new Random();\r\n\t\tint random = generator.nextInt(cell.length);\r\n\t\treturn (BoardCell) cell[random];\r\n\t}", "public Map<Integer, TargetDef> getTargetQueries();", "public MapLocation findNearestAction() {\n MapLocation origin = rc.getLocation();\n MapLocation nearestHelp = findNearestHelp();\n MapLocation nearestArchon = findNearestArchon();\n\n if (nearestArchon == null && nearestHelp == null) {\n return rc.getInitialArchonLocations(rc.getTeam().opponent())[0]; // when no target is known, go to enemy archon initial position\n } else if (nearestArchon == null) { // when some of the targets is not present, just return the other one\n return nearestHelp; // is not null\n } else if (nearestHelp == null) {\n return nearestArchon; // is not null\n }\n\n if (origin.distanceSquaredTo(nearestHelp) < origin.distanceSquaredTo(nearestArchon)) {\n return nearestHelp;\n } else {\n return nearestArchon;\n }\n }", "private Target getMatchingTarget(Element targetElement)\n {\n String targetName = targetElement.getAttribute(\"name\").getValue();\n\n for (Target target : targets)\n {\n String label = target.getName();\n\n if (label.equals(targetName))\n {\n return target;\n }\n }\n\n return null;\n }", "private void calculateDecisionParameters(Set<StandardEntity> victims, Map<EntityID, AmbulanceTarget> targetsMap) {\n\n AmbulanceTarget target;\n Human human;\n if (victims != null && !victims.isEmpty()) {\n for (StandardEntity victim : victims) {\n target = targetsMap.get(victim.getID());\n human = (Human) worldInfo.getEntity(victim.getID());\n if (target == null) {\n //creating a new AmbulanceTarget object\n target = new AmbulanceTarget(victim.getID());\n\n //set target position\n target.setPositionID(human.getPosition());\n\n //euclidean distance from this victim to the nearest refuge\n target.setDistanceToRefuge(worldInfo.getDistance(human.getPosition(), findNearestRefuge(human.getPosition())));\n\n target.setDistanceToPartition(Util.distance(victim.getLocation(worldInfo.getRawWorld()), clusterCenterMap.get(this.clusterIndex)));\n }\n //euclidean distance from this victim to the me\n target.setDistanceToMe(computingDistance(human));\n\n target.setVictimSituation(calculateVictimProfitability(human));\n\n targetsMap.put(victim.getID(), target);\n }\n }\n\n }", "@DSGenerator(tool_name = \"Doppelganger\", tool_version = \"2.0\", generated_on = \"2013-12-30 12:36:07.082 -0500\", hash_original_method = \"71B2FD618F41F3F10AED78DDC584C5B5\", hash_generated_method = \"D5C1464D9CBFFD7FDEF25798ABF91481\")\n \npublic static RouteInfo selectBestRoute(Collection<RouteInfo> routes, InetAddress dest) {\n if ((routes == null) || (dest == null)) return null;\n\n RouteInfo bestRoute = null;\n // pick a longest prefix match under same address type\n for (RouteInfo route : routes) {\n if (NetworkUtils.addressTypeMatches(route.mDestination.getAddress(), dest)) {\n if ((bestRoute != null) &&\n (bestRoute.mDestination.getNetworkPrefixLength() >=\n route.mDestination.getNetworkPrefixLength())) {\n continue;\n }\n if (route.matches(dest)) bestRoute = route;\n }\n }\n return bestRoute;\n }", "final int getNextBuildTarget(int difficulty) {\n/* 1970 */ difficulty = Math.min(5, difficulty);\n/* 1971 */ int start = difficulty * 3;\n/* 1972 */ int templateFound = -1;\n/* */ int x;\n/* 1974 */ for (x = start; x < 17; x++) {\n/* */ \n/* 1976 */ if (this.epicTargetItems[x] <= 0L) {\n/* */ \n/* 1978 */ templateFound = x;\n/* */ \n/* */ break;\n/* */ } \n/* */ } \n/* 1983 */ if (templateFound == -1)\n/* */ {\n/* */ \n/* 1986 */ for (x = start; x > 0; x--) {\n/* */ \n/* 1988 */ if (this.epicTargetItems[x] <= 0L) {\n/* */ \n/* 1990 */ templateFound = x;\n/* */ \n/* */ break;\n/* */ } \n/* */ } \n/* */ }\n/* 1996 */ if (templateFound > -1) {\n/* */ \n/* 1998 */ if (templateFound < 3)\n/* 1999 */ return 717; \n/* 2000 */ if (templateFound < 6)\n/* 2001 */ return 714; \n/* 2002 */ if (templateFound < 9)\n/* 2003 */ return 713; \n/* 2004 */ if (templateFound < 12)\n/* 2005 */ return 715; \n/* 2006 */ if (templateFound < 15) {\n/* 2007 */ return 712;\n/* */ }\n/* 2009 */ return 716;\n/* */ } \n/* 2011 */ return -1;\n/* */ }", "private void setTargetCosts(){\n\t\t//Check which targets that are inside of this building\n\t\tfor(LinkedList<Node> list : targets){\n\t\t\tfor(Node node : list){\n\t\t\t\t//Make a walkable square at the position so that the target is reachable\n\t\t\t\tfor(int k = node.getXPos()-PedestriansSimulator.PEDESTRIAN_RADIUS; k < node.getXPos()+PedestriansSimulator.PEDESTRIAN_RADIUS; k++) {\n\t\t\t\t\tif(Math.round(scaleCollision * k) >= 0 && Math.round(scaleCollision * k) < COLLISION_ROWS){\n\t\t\t\t\t\tfor(int l = node.getYPos()-PedestriansSimulator.PEDESTRIAN_RADIUS; l < node.getYPos()+PedestriansSimulator.PEDESTRIAN_RADIUS; l++) {\n\t\t\t\t\t\t\tif(Math.round(scaleCollision * l) >= 0 && Math.round(scaleCollision * l) < COLLISION_ROWS){\n\t\t\t\t\t\t\t\tcollisionMatrix[Math.round(scaleCollision * k)][Math.round(scaleCollision * l)] = FOOTWAY_COST;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Test\n\tpublic void targetsTest() {\n\t\tgraph.addVertex(A);\n\t\tgraph.addVertex(B);\n\t\tgraph.addVertex(C);\n\t\tgraph.addVertex(D);\n\t\tList<Vertex> vertices = new ArrayList<>();\n\t\tvertices.add(A);\n\t\tvertices.add(B);\n\t\tedge_0.addVertices(vertices);\n\t\tgraph.addEdge(edge_0);\n\t\tassertTrue(graph.targets(A).keySet().contains(B));\n\t\tassertTrue(graph.targets(A).get(B) == 1);\n\t}", "@Test\r\n\tpublic void testTargetsTwoSteps() {\r\n\t\tboard.calcTargets(10, 1, 2);\r\n\t\tSet<BoardCell> targets= board.getTargets();\r\n\t\tassertEquals(6, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(9, 0)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 0)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(9, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(12, 1)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(10, 3)));\r\n\t\t\r\n\t\tboard.calcTargets(17, 13, 2);\r\n\t\ttargets= board.getTargets();\r\n\t\tassertEquals(5, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(17, 15)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(18, 14)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(16, 14)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(16, 12)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(15, 13)));\r\n\t}", "public Node selectNode(List<Node> nodes){\n float minCost = Integer.MAX_VALUE;\n Node bestNode = null;\n float costToStart = 0, totalCost = 0;\n\n for(Node n:nodes){\n costToStart = n.getCostEstimated();\n int distance = Math.abs(n.getX()-finish.getX())+Math.abs(n.getY()-finish.getY());\n totalCost = costToStart+distance;\n\n if(minCost>totalCost){\n minCost = totalCost;\n bestNode = n;\n }\n }\n return bestNode;\n }", "public List<Tile> findTargets() {\n List<Tile> targets = new ArrayList<>(); // our return value\n int fearDistance = 2; // Ideally we're 2 spots away from their head, increases when we can't do that.\n int foodDistance = 3; // We look at a distance 3 for food.\n\n // If fearDistance gets this big, then its just GG i guess\n while (targets.size() == 0 && fearDistance < 15) {\n // Get the tiles around the Enemy's head\n targets = this.gb.nearByTiles(this.enemy_head_x, this.enemy_head_y, fearDistance);\n fearDistance += 1;\n }\n\n // Get the food tiles near us\n for (int i=0; i < foodDistance; i++) {\n List<Tile> nearBy = this.gb.nearByTiles(this.us_head_x, this.us_head_y, i);\n for (Tile t : nearBy) {\n if (t.isFood() && !targets.contains(t)) targets.add(t);\n }\n }\n return targets;\n }", "@Test\r\n\tpublic void testTargetsOneStep() {\r\n\t\tboard.calcTargets(24, 17, 1);\r\n\t\tSet<BoardCell> targets= board.getTargets();\r\n\t\tassertEquals(2, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(23, 17)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(24, 18)));\t\r\n\t\t\r\n\t\tboard.calcTargets(10, 24, 1);\r\n\t\ttargets= board.getTargets();\r\n\t\tassertEquals(2, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 24)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(10, 23)));\t\t\t\r\n\t}", "@Test\n\tpublic void testTargetsOneStep() {\n\t\tboard.calcTargets(7, 6, 1);\n\t\tSet<BoardCell> targets= board.getTargets();\n\t\tassertEquals(4, targets.size());\n\t\tassertTrue(targets.contains(board.getCellAt(7, 7)));\n\t\tassertTrue(targets.contains(board.getCellAt(7, 5)));\t\n\t\tassertTrue(targets.contains(board.getCellAt(6, 6)));\t\n\t\tassertTrue(targets.contains(board.getCellAt(8, 6)));\t\n\n\n\t\tboard.calcTargets(14, 24, 1);\n\t\ttargets= board.getTargets();\n\t\tassertEquals(2, targets.size());\n\t\tassertTrue(targets.contains(board.getCellAt(15, 24)));\n\t\tassertTrue(targets.contains(board.getCellAt(14, 23)));\t\t\t\n\t}", "@Test\n\tpublic void testTargetsTwoSteps() {\n\t\tboard.calcTargets(7, 6, 2);\n\t\tSet<BoardCell> targets= board.getTargets();\n\t\tassertEquals(7, targets.size());\n\t\tassertTrue(targets.contains(board.getCellAt(5, 6)));\n\t\tassertTrue(targets.contains(board.getCellAt(6, 7)));\n\t\tassertTrue(targets.contains(board.getCellAt(6, 5)));\n\t\tassertTrue(targets.contains(board.getCellAt(8, 7)));\n\t\tassertTrue(targets.contains(board.getCellAt(8, 5)));\n\t\tassertTrue(targets.contains(board.getCellAt(9, 6)));\n\t\tassertTrue(targets.contains(board.getCellAt(7, 4)));\n\t\tboard.calcTargets(14, 24, 2);\n\t\ttargets= board.getTargets();\n\t\tassertEquals(3, targets.size());\n\t\tassertTrue(targets.contains(board.getCellAt(14, 22)));\n\t\tassertTrue(targets.contains(board.getCellAt(15, 23)));\t\n\t\tassertTrue(targets.contains(board.getCellAt(16, 24)));\t\t\t\n\t}", "com.google.ads.googleads.v14.services.SuggestGeoTargetConstantsRequest.GeoTargets getGeoTargets();", "@Test\r\n\tpublic void testTargets22_2() {\r\n\t\tBoardCell cell = board.getCell(2, 2);\r\n\t\tboard.calcTargets(cell, 2);\r\n\t\tSet<BoardCell> targets = board.getTargets();\r\n\t\tassertTrue(targets != null);\r\n\t\tassertEquals(6, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCell(0, 2)));\r\n\t\tassertTrue(targets.contains(board.getCell(2, 0)));\r\n\t\tassertTrue(targets.contains(board.getCell(1, 1)));\r\n\t\tassertTrue(targets.contains(board.getCell(3, 1)));\r\n\t\tassertTrue(targets.contains(board.getCell(1, 3)));\r\n\t\tassertTrue(targets.contains(board.getCell(3, 3)));\r\n\r\n\t}", "@Test\n\tpublic void selectTargetLocation() {\n\t\tboard.findAllTargets(playerComputer.getCurrentLocation(), 6);\n\t\tSet<BoardCell> targets = board.getTargets();\n\t\t\n\t\t//Tests to make sure the computers chosen cell is in targets\n\t\tBoardCell cell = ((computerPlayer) playerComputer).pickLocation(targets);\n\t\tassertTrue(targets.contains(cell));\n\t\t\n\t\t//This test ensures that if there is a room that hasn't been visited the computer picks that cell\n\t\tIterator<BoardCell> iterator = targets.iterator();\n\t\twhile(iterator.hasNext()) {\n\t\t\tBoardCell cell2 = iterator.next();\n\t\t\tif(cell2.isRoom()) {\n\t\t\t\tif(cell2.getInitial() != ((computerPlayer) playerComputer).getLastVisited()) {\n\t\t\t\t\tassertEquals(cell2.getInitial(), cell.getInitial());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Test\r\n\tpublic void testTargets11_2() {\r\n\t\tBoardCell cell = board.getCell(1, 1);\r\n\t\tboard.calcTargets(cell, 2);\r\n\t\tSet<BoardCell> targets = board.getTargets();\r\n\t\tassertTrue(targets != null);\r\n\t\tassertEquals(6, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCell(3, 1)));\r\n\t\tassertTrue(targets.contains(board.getCell(1, 3)));\r\n\t\tassertTrue(targets.contains(board.getCell(2, 2)));\r\n\t\tassertTrue(targets.contains(board.getCell(2, 0)));\r\n\t\tassertTrue(targets.contains(board.getCell(0, 2)));\r\n\t\tassertTrue(targets.contains(board.getCell(0, 0)));\r\n\r\n\t}", "@Test\r\n\tpublic void testTargets00_2() {\r\n\t\tBoardCell cell = board.getCell(0, 0);\r\n\t\tboard.calcTargets(cell, 2);\r\n\t\tSet<BoardCell> targets = board.getTargets();\r\n\t\tassertTrue(targets != null);\r\n\t\tassertEquals(3, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCell(0, 2)));\r\n\t\tassertTrue(targets.contains(board.getCell(2, 0)));\r\n\t\tassertTrue(targets.contains(board.getCell(1, 1)));\r\n\r\n\t}", "@Test\r\n\tpublic void testTargets00_1() {\r\n\t\tBoardCell cell = board.getCell(0, 0);\r\n\t\tboard.calcTargets(cell, 1);\r\n\t\tSet<BoardCell> targets = board.getTargets();\r\n\t\tassertTrue(targets != null);\r\n\t\tassertEquals(2, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCell(0, 1)));\r\n\t\tassertTrue(targets.contains(board.getCell(1, 0)));\r\n\r\n\t}", "@Test\n\tpublic void testTargetsIntoRoomShortcut() \n\t{\n\t\tboard.calcTargets(9, 18, 2);\n\t\tSet<BoardCell> targets= board.getTargets();\n\t\tassertEquals(6, targets.size());\n\t\tassertTrue(targets.contains(board.getCellAt(9, 19)));\n\t\tassertTrue(targets.contains(board.getCellAt(10, 19)));\n\t\tassertTrue(targets.contains(board.getCellAt(11, 18)));\n\t\tassertTrue(targets.contains(board.getCellAt(10, 17)));\n\t\tassertTrue(targets.contains(board.getCellAt(8, 17)));\n\t\tassertTrue(targets.contains(board.getCellAt(7, 18)));\n\t}", "private void checkTargetsReachable(){\n\t\tPathfinder pathfinder = new Pathfinder(collisionMatrix);\n\t\tLinkedList<Node> removeList = new LinkedList<Node>();\n\t\tboolean pathWasFound = false;\n\t\tLinkedList<Node> currentPath;\n\t\tLinkedList<Node> reversePath;\n\t\t\n\t\t//Go through all starting positions\n\t\tfor(LinkedList<Node> startList : targets){\n\t\t\tprogress += 8;\n\t\t\tsetProgress(progress);\n\t\t\tfor(Node startNode : startList){\n\t\t\t\t\n\t\t\t\tboolean outsideMap = (startNode.getCollisionXPos(scaleCollision) < 0 || startNode.getCollisionXPos(scaleCollision) >= (collisionMatrix.length-1) || startNode.getCollisionYPos(scaleCollision) < 0 || startNode.getCollisionYPos(scaleCollision) >= (collisionMatrix.length-1));\n\t\t\t\t\n\t\t\t\tpathWasFound = false;\n\t\t\t\t//Make sure that target is inside of map\n\t\t\t\tif(!outsideMap){\n\t\t\t\t\t//Check against all target positions\n\t\t\t\t\tfor(LinkedList<Node> targetList : targets){\n\t\t\t\t\t\tfor(Node targetNode : targetList){\n\t\t\t\t\t\t\t//Only check against targets that have not already been marked as unreachable\n\t\t\t\t\t\t\tboolean selfCheck = (targetNode.getXPos() != startNode.getXPos() || targetNode.getYPos() != startNode.getYPos());\n\t\t\t\t\t\t\tif(!removeList.contains(targetNode) && selfCheck){\n\t\t\t\t\t\t\t\t//Check if this path has already been checked\n\t\t\t\t\t\t\t\tif(!preCalculatedPaths.containsKey(startNode.toStringCollision(scaleCollision) + \"-\" + targetNode.toStringCollision(scaleCollision))){\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tcurrentPath = new LinkedList<Node>();\n\t\t\t\t\t\t\t\t\t//Check if a path can be found for this start and target node\n\t\t\t\t\t\t\t\t\tif(pathfinder.findPath(startNode.getCollisionXPos(scaleCollision), startNode.getCollisionYPos(scaleCollision), targetNode.getCollisionXPos(scaleCollision), targetNode.getCollisionYPos(scaleCollision), currentPath)){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif(Frame.USE_PRECALCULATED_PATHS)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpreCalculatedPaths.put(startNode.toStringCollision(scaleCollision) + \"-\" + targetNode.toStringCollision(scaleCollision), currentPath);\n\t\t\t\t\t\t\t\t\t\t\treversePath = new LinkedList<Node>();\n\t\t\t\t\t\t\t\t\t\t\treversePath.addAll(currentPath);\n\t\t\t\t\t\t\t\t\t\t\tCollections.reverse(reversePath);\n\t\t\t\t\t\t\t\t\t\t\treversePath.removeFirst();\n\t\t\t\t\t\t\t\t\t\t\treversePath.add(startNode);\n\t\t\t\t\t\t\t\t\t\t\tpreCalculatedPaths.put(targetNode.toStringCollision(scaleCollision) + \"-\" + startNode.toStringCollision(scaleCollision) ,reversePath);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tpathWasFound = true;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\tpathWasFound = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//Remove nodes which we cannot find a path from\n\t\t\t\tif(!pathWasFound){\n\t\t\t\t\tremoveList.add(startNode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Go through the remove list and remove unreachable nodes\n\t\tfor(Node node : removeList){\n\t\t\tfor(LinkedList<Node> startList : targets){\n\t\t\t\tstartList.remove(node);\n\t\t\t}\n\t\t}\n\t}", "@Override public Map<L, Integer> targets(L source) {\r\n \t Map<L, Integer> res= new HashMap <L, Integer>();\r\n \tif(!vertices.contains(source)) {\r\n \t\t//System.out.println(source+\" is not in the graph!\");\r\n \t\treturn res;\r\n \t}\r\n \tIterator<Edge<L>> iter=edges.iterator();\r\n \twhile(iter.hasNext()) {\r\n \t\tEdge<L> tmp=iter.next();\r\n \t\t//if(tmp.getSource()==source)\r\n \t\tif(tmp.getSource().equals(source))\r\n \t\t\tres.put(tmp.getTarget(), tmp.getWeight());\r\n \t\t\r\n \t}\r\n \tcheckRep();\r\n \treturn res;\r\n\r\n }", "private ProcessProfile findTargetNode(Set<String> localAddrs, List<ProcessProfile> nodeAddrs) {\n for (String localAddr : localAddrs) {\n for (ProcessProfile node : nodeAddrs) {\n // If this addresses bound to the nics on this host are contained on the current node\n // send back the data object containing the required info.\n if (node.boundAddresses.contains(localAddr)) {\n return node;\n }\n }\n }\n\n // If we got this far and came up empty, signal our displeasure\n logger.error( \"Comparison did not result in an IP or Host match. {} {}\", localAddrs, nodeAddrs);\n throw new RuntimeException(\"Could not find the target node.\");\n }", "@Test\n\t\t\tpublic void testTargetsTwoSteps() {\n\t\t\t\t//Length of 2\n\t\t\t\tboard.calcTargets(8, 16, 2);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(4, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(6, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(10, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(7, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(9, 15)));\n\t\t\t\t//Length of 2\n\t\t\t\tboard.calcTargets(15, 15, 2);\n\t\t\t\ttargets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(4, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(17, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(14, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(15, 17)));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t}", "@Override\n\tprotected boolean chooseTargetRels() throws Exception {\n\t\tList<RelationType> rels = new ArrayList<RelationType> ();\n\t\tint numTries = 0;\n\t\tint created = 0;\n\t\tboolean found = false;\n\t\tRelationType rel;\n\t\t//MN wanted to preserve the initial values of numOfTgtTables and attsPerTargetRel - 26 April 2014\n\t\tString[][] attrs = new String[numOfTgtTables][];\n\t\t\t\n\t\t// first choose one that has attsPerTargetRel\n\t\twhile(created < numOfTgtTables) {\n\t\t\tfound = true;\n\t\t\t\t\n\t\t\t//MN check the following again (it is really tricky) - 26 April 2014\n\t\t\tif(created == 0){\n\t\t\t\tif(keySize < attsPerTargetRel)\n\t\t\t\t\trel = getRandomRel(false, attsPerTargetRel);\n\t\t\t\telse\n\t\t\t\t\t//MN we use minimum to increase reusability - 3 May 2014\n\t\t\t\t\trel = getRandomRel(false, keySize);\n\t\t\t}\n\t\t\telse{\n\t\t\t\trel = getRandomRel(false, attsPerTargetRel+keySize, attsPerTargetRel+keySize);\n\t\t\t\t\t\n\t\t\t\tif(rel != null){\n\t\t\t\t\tfor(int j=0; j<rels.size(); j++)\n\t\t\t\t\t\tif(rels.get(j).getName().equals(rel.getName()))\n\t\t\t\t\t\t\tfound = false;\n\t\t\t\t}else{\n\t\t\t\t\tfound = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\n\t\t\t//MN VPISA cares about primary key - 26 April 2014\n\t\t\tif(found && !rel.isSetPrimaryKey()) {\n\t\t\t\t//MN set to false because this is target relation (Am I right?) - 3 May 2014\n\t\t\t\tint [] primaryKeyPos = new int [keySize];\n\t\t\t\tfor(int i=0; i<keySize; i++)\n\t\t\t\t\tprimaryKeyPos[i] = i;\n\t\t\t\tfac.addPrimaryKey(rel.getName(), primaryKeyPos, false);\n\t\t\t}\n\t\t\t\t\n\t\t\tif(found && rel.isSetPrimaryKey()){\n\t\t\t\t//MN keySize should be keySize and key attrs should be the first attrs- 3 May 2014\n\t\t\t\tint[] pkPos = model.getPKPos(rel.getName(), false);\n\t\t\t\t\t\n\t\t\t\tif(pkPos[0] != 0)\n\t\t\t\t\tfound = false;\n\t\t\t}\n\t\t\t\t\n\t\t\t// found a fitting relation\n\t\t\tif (found) {\n\t\t\t\trels.add(rel);\n\t\t\t\tm.addTargetRel(rel);\n\n\t\t\t\tattrs[created] = new String[rel.sizeOfAttrArray()];\n\t\t\t\tfor(int i = 0; i < rel.sizeOfAttrArray(); i++)\n\t\t\t\t\tattrs[created][i] = rel.getAttrArray(i).getName();\n\t\t\t\t\t\n\t\t\t\t//MN attsPerTargetRel should be set (check that) (it is really tricky) - 26 April 2014\n\t\t\t\tif(created == 0){\n\t\t\t\t\tkeySize = model.getPKPos(rel.getName(), false).length; \n\t\t\t\t\tattsPerTargetRel = rel.getAttrArray().length- keySize;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcreated++;\n\t\t\t\tnumTries = 0;\n\t\t\t}\n\t\t\t// not found, have exhausted number of tries? then create new one - path tested 1 May 2014\n\t\t\telse {\n\t\t\t\tnumTries++;\n\t\t\t\tif (numTries >= MAX_NUM_TRIES)\n\t\t\t\t{\n\t\t\t\t\tnumTries = 0;\n\t\t\t\t\tattrs[created] = new String[attsPerTargetRel+keySize];\n\t\t\t\t\tfor(int j = 0; j < attsPerTargetRel+keySize; j++)\n\t\t\t\t\t\tattrs[created][j] = randomAttrName(created, j);\n\t\t\t\t\t\t\n\t\t\t\t\t// create the relation\n\t\t\t\t\tString relName = randomRelName(created);\n\t\t\t\t\trels.add(fac.addRelation(getRelHook(created), relName, attrs[created], false));\n\t\t\t\t\t\t\n\t\t\t\t\t// primary key should be set and its size should be 1- 26 April 2014\n\t\t\t\t\tint [] primaryKeyPos = new int [keySize];\n\t\t\t\t\tfor(int i=0; i<keySize; i++)\n\t\t\t\t\t\tprimaryKeyPos[i] = i;\n\t\t\t\t\tfac.addPrimaryKey(relName, primaryKeyPos, false);\n\t\t\t\t\t\t\n\t\t\t\t\t//MN should I add it to TargetRel? - 26 April 2014\n\t\t\t\t\t//m.addTargetRel(rels.get(rels.size()-1));\n\t\t\t\t\t\t\n\t\t\t\t\tcreated++;\n\t\t\t\t\tnumTries = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t\t//MN set attrRemainder and numOfSrcTables - 26 April 2014\n\t\tnumOfSrcTblAttr= (numOfTgtTables * attsPerTargetRel) + keySize; \n\t\t//MN considering only this case - 26 April 2014\n\t\tattrRemainder =0;\n\t\t\t\n\t\t//MN foreign key should be set - 26 April 2014\n\t\t//MN should be fixed - 24 June 2014\n\t\taddFKsNoReuse();\n\t\t\n\t\t//MN - 13 May 2014\n\t\ttargetReuse = true;\n\t\t//MN\n\t\treturn true;\n\t}", "private Map.Entry<Activity, Prediction> chooseBestPrediction(Map<Activity, Prediction> predictions) {\n \n Map.Entry<Activity, Prediction> prediction = null;\n int result1, result2, lastIndex;\n double probability1, probability2;\n \n \n for (Map.Entry<Activity, Prediction> entry : predictions.entrySet()) {\n \n if (prediction == null) {\n prediction = entry;\n } else {\n lastIndex = prediction.getValue().getObservations().length - 1;\n \n result1 = prediction.getValue().getPredictions()[lastIndex];\n probability1 = prediction.getValue().getProbability();\n result2 = entry.getValue().getPredictions()[lastIndex];\n probability2 = entry.getValue().getProbability();\n \n /*a result 1 means that an activity has been detected,\n * thus we prefer a result that predicts an activity*/\n if (result2 == 1 && result1 == 0)\n prediction = entry;\n \n /* if both predict an activity, or don't predict anything then\n * we take the probability into consideration */\n if (result1 == result2) {\n if (probability2 > probability1)\n prediction = entry;\n }\n \n }\n \n }\n \n return prediction;\n \n }", "N getTarget();", "@Test\r\n\tpublic void testTargets00_3() {\r\n\t\tBoardCell cell = board.getCell(0, 0);\r\n\t\tboard.calcTargets(cell, 3);\r\n\t\tSet<BoardCell> targets = board.getTargets();\r\n\t\tassertTrue(targets != null);\r\n\t\tassertEquals(6, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCell(0, 3)));\r\n\t\tassertTrue(targets.contains(board.getCell(1, 2)));\r\n\t\tassertTrue(targets.contains(board.getCell(2, 1)));\r\n\t\tassertTrue(targets.contains(board.getCell(3, 0)));\r\n\t\tassertTrue(targets.contains(board.getCell(1, 0)));\r\n\t\tassertTrue(targets.contains(board.getCell(0, 1)));\r\n\t}", "private <T> void getPossibleTargets(TargetingScheme<T> t, TargetList<T> current, List<? extends T> searchSpace, int startInd,\n List<TargetList<T>> outputList) {\n if (t.isFullyTargeted(current)) {\n outputList.add(current);\n return;\n }\n if (startInd >= searchSpace.size()) {\n System.out.println(\"this shouldn't happen lmao\");\n }\n int numToSelect = Math.min(searchSpace.size(), t.getMaxTargets());\n for (int i = startInd; i < searchSpace.size() - (numToSelect - current.targeted.size() - 1); i++) {\n T c = searchSpace.get(i);\n if (!current.targeted.contains(c)) {\n TargetList<T> copy = current.clone();\n copy.targeted.add(c);\n this.getPossibleTargets(t, copy, searchSpace, i + 1, outputList);\n }\n }\n }", "@Test \n\tpublic void testTargetsIntoRoom()\n\t{\n\t\t// One room is exactly 2 away\n\t\tboard.calcTargets(5, 24, 2);\n\t\tSet<BoardCell> targets= board.getTargets();\n\t\tassertEquals(4, targets.size());\n\t\tassertTrue(targets.contains(board.getCellAt(3, 24)));\n\t\tassertTrue(targets.contains(board.getCellAt(6, 23)));\n\t\tassertTrue(targets.contains(board.getCellAt(5, 22)));\n\t\tassertTrue(targets.contains(board.getCellAt(4, 23)));\n\t}", "Point2D getNextMove(Point2D target, boolean pursuit, Set<Point2D> map);", "public String match(boolean flags[]) {\n\t\tString bestKey = null;\n\t\tdouble bestScore = Double.NEGATIVE_INFINITY;\n\n\t\tfor (String key : GLOBAL_MAPPING.keySet()) {\n\t\t\tList<Set<Integer>> possible_mappings = GLOBAL_MAPPING.get(key);\n\n\t\t\tdouble score = 0;\n\t\t\tfor (Set<Integer> mapping : possible_mappings) {\n\t\t\t\tscore = Math.max(score, calc_score(flags, mapping));\n\t\t\t}\n\n\t\t\tif (score > bestScore) {\n\t\t\t\tbestKey = key;\n\t\t\t\tbestScore = score;\n\t\t\t}\n\t\t}\n\t\treturn bestKey;\n\t}", "private TargetInformation findHighGoal(Mat image) {\r\n\t\tTargetInformation ret = new TargetInformation();\r\n\t\tret.targetingPeg = false;\r\n\t\t\r\n long[] xsums = sums(image, true);\r\n long[] ysums = sums(image, false);\r\n \r\n\t List<PeakLoc> xpeaks = findPeaks(xsums, 10);\r\n\t List<PeakLoc> ypeaks = findPeaks(ysums, 10);\r\n\r\n\t if (ypeaks.size() == 2 && xpeaks.size() > 0) {\r\n\t \tret.targetFound = true;\r\n\t \tret.x = (xpeaks.get(0).getStop() - xpeaks.get(0).getStart()) / 2;\r\n\t \tret.gap = ypeaks.get(1).getStart() - ypeaks.get(0).getStop();\r\n\t \tret.width = xpeaks.get(0).getStop() - xpeaks.get(0).getStart();\r\n\t \tret.height = ypeaks.get(1).getStop() - ypeaks.get(0).getStart();\r\n\t \tret.y = (ypeaks.get(0).getStop() + ypeaks.get(1).getStart())/2;\r\n\t \t\r\n\t \tdouble pixelsPerInch = ret.gap / highGoalGapInches;\r\n\t \tif (xpeaks.get(0).isTruePeak() && xpeaks.get(1).isTruePeak())\r\n\t \t{\r\n\t \t\tpixelsPerInch = (pixelsPerInch + ret.width / highGoalWidthInches) / 2;\r\n\t \t}\r\n\t \tif (ypeaks.get(0).isTruePeak())\r\n\t \t{\r\n\t \t\tif (xpeaks.get(0).isTruePeak() && xpeaks.get(1).isTruePeak())\r\n\t \t\t{\r\n\t \t\t\tpixelsPerInch = (pixelsPerInch * 2 + ret.width / highGoalHeightInches) / 3;\r\n\t \t\t}\r\n\t \t\telse\r\n\t \t\t{\r\n\t \t\t\tpixelsPerInch = (pixelsPerInch + ret.width / highGoalHeightInches) / 2;\r\n\t \t\t}\r\n\t \t} \t\r\n\t \t\r\n\t \tret.aimX = ret.x + (cameraOffsetInches - shooterOffsetInches) * pixelsPerInch;\r\n\t \t\r\n\t \tret.correctionAngle = (double)((ret.aimX - image.cols() / 2)) / pixelsPerXDegree;\r\n\t }\r\n\t else\r\n\t {\r\n\t \tret.targetFound = false;\r\n\t }\r\n\t \r\n\t return ret;\r\n\t}", "public void findBestRoute(Node src, Node dst) {\r\n\t\tArrayList<Node> route = new ArrayList<>();\r\n\t\tNode curr = src;\r\n\t\twhile (!curr.getName().equals(dst.getName())) {\r\n\t\t\tcurr = curr.getForwardingTable().get(dst);\r\n\t\t\troute.add(curr);\r\n\t\t}\r\n\r\n\t\tSystem.out.print(\"Best route so far is: \");\r\n\t\tfor (Node node : route) {\r\n\t\t\tSystem.out.print(node.getName() + \" \");\r\n\t\t}\r\n\t}", "@Test\r\n\tpublic void testTargets33_1() {\r\n\t\tBoardCell cell = board.getCell(3, 3);\r\n\t\tboard.calcTargets(cell, 1);\r\n\t\tSet<BoardCell> targets = board.getTargets();\r\n\t\tassertTrue(targets != null);\r\n\t\tassertEquals(2, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCell(2, 3)));\r\n\t\tassertTrue(targets.contains(board.getCell(3, 2)));\r\n\r\n\t}", "@Test\r\n\tpublic void testTargetsFourSteps() {\r\n\t\tboard.calcTargets(24, 0, 4);\r\n\t\tSet<BoardCell> targets= board.getTargets();\r\n\t\tassertEquals(4, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(24, 4)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(23, 3)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(24, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(23, 1)));\r\n\t\t\r\n\t\tboard.calcTargets(0, 20, 4);\r\n\t\ttargets = board.getTargets();\r\n\t\tassertEquals(4, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(1, 19)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(2, 20)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(3, 19)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(4, 20)));\r\n\t\t\r\n\t\t// Includes a path that doesn't have enough length plus one door\r\n\t\tboard.calcTargets(9, 0, 4);\r\n\t\ttargets= board.getTargets();\r\n\t\tassertEquals(8, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(9, 4)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(9, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(10, 3)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(10, 1)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(12, 1)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(8, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 0)));\t\r\n\t}", "public Balloon acquireTarget() {\r\n\r\n\t\tBalloon closest = null;\r\n\t\tfloat closestDistance = 1000;\r\n\t\tif (balloons != null) {\r\n\t\t\tfor (Balloon balloons : balloons) {\r\n\t\t\t\tif (isInRange(balloons) && findDistance(balloons) < closestDistance && balloons.getHiddenHealth() > 0) {\r\n\t\t\t\t\tclosestDistance = findDistance(balloons);\r\n\t\t\t\t\tclosest = balloons;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (closest != null) {\r\n\t\t\t\ttargeted = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn closest;\r\n\r\n\t}", "private Node closestUnvisitedNeighbour(HashMap <Node, Integer > shortestPathMap){\n int shortestDistance = Integer.MAX_VALUE;\n Node closestReachableNode = null;\n for (Node node : getNodes()) {\n if (node.isVisited())\n continue;\n\n int currentDistance = shortestPathMap.get(node);\n if (currentDistance == Integer.MAX_VALUE)\n continue;\n\n if (currentDistance < shortestDistance) {\n shortestDistance = currentDistance;\n closestReachableNode = node;\n }\n }\n return closestReachableNode;\n }", "@Test\n\t\t\tpublic void testTargetOneStep()\n\t\t\t{\n\t\t\t\t//Test one step and check for the right space\n\t\t\t\tboard.calcTargets(0, 7, 1);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(1, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(1, 7)));\n\n\t\t\t\t// Test one step near a door with the incorrect direction\n\t\t\t\tboard.calcTargets(13, 6, 1);\n\t\t\t\ttargets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(3, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(14, 6)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 5)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 7)));\n\t\t\t\t\n\t\t\t\t\n\t\t\t}", "private void sendBestTargetReport()\n {\n // define arrays (just of the bestTarget and a vertical bar so length 2)\n double[] centerXs = new double[2];\n double[] centerYs = new double[2];\n //double[] areas = new double[2];\n double[] widths = new double[2];\n double[] heights = new double[2];\n \n // send currentBestTarget if it exists\n if (currentBestTarget != null)\n {\n\t // set props of bestTarget\n\t centerXs[0] = currentBestTarget.centerX;\n\t centerYs[0] = currentBestTarget.centerY;\n\t //areas[0]\n\t widths[0] = currentBestTarget.width;\n\t heights[0] = currentBestTarget.height;\n }\n \n // create artificial target to display center bar\n centerXs[1] = IMAGE_WIDTH/2;\n centerYs[1] = IMAGE_HEIGHT/2;\n widths[1] = 10;\n heights[1] = IMAGE_HEIGHT;\n \n // send info\n Robot.targetSendingTable.putNumberArray(\"centerX\", centerXs);\n Robot.targetSendingTable.putNumberArray(\"centerY\", centerYs);\n //Robot.targetSendingTable.putNumberArray(\"area\", areas);\n Robot.targetSendingTable.putNumberArray(\"width\", widths);\n Robot.targetSendingTable.putNumberArray(\"height\", heights);\n }", "@Test\n\t\t\tpublic void testTargetsThreeSteps() {\n\t\t\t\t//Using walkway space that will go near a door with the wrong direction\n\t\t\t\tboard.calcTargets(8, 16, 2);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(4, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(6, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(10, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(7, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(9, 15)));\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t}", "@Override\n public void run(Game game, Map<String, List<Targetable>> targets) {\n\n }", "@Test \r\n\tpublic void testTargetsIntoRoom()\r\n\t{\r\n\t\t// One room is exactly 2 away\r\n\t\tboard.calcTargets(19, 8, 2);\r\n\t\tSet<BoardCell> targets= board.getTargets();\r\n\t\tassertEquals(5, targets.size());\r\n\t\t// directly left (can't go right 2 steps)\r\n\t\tassertTrue(targets.contains(board.getCellAt(19, 6)));\r\n\t\t// directly up and down\r\n\t\tassertTrue(targets.contains(board.getCellAt(17, 8)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(21, 8)));\r\n\t\t// one up/down, one left/right\r\n\t\tassertTrue(targets.contains(board.getCellAt(18, 7)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(20, 7)));\r\n\t}", "com.google.ads.googleads.v14.services.SuggestGeoTargetConstantsRequest.GeoTargetsOrBuilder getGeoTargetsOrBuilder();", "@Test\r\n\tpublic void testTargetsIntoRoomShortcut() \r\n\t{\r\n\t\tboard.calcTargets(11, 24, 3);\r\n\t\tSet<BoardCell> targets= board.getTargets();\r\n\t\tassertEquals(6, targets.size());\r\n\t\t//up and then left\r\n\t\tassertTrue(targets.contains(board.getCellAt(10, 22)));\r\n\t\t//up left down\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 23)));\r\n\t\t//left up right\r\n\t\tassertTrue(targets.contains(board.getCellAt(10, 24)));\r\n\t\t//left only\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 21)));\r\n\t\t// into the rooms\r\n\t\tassertTrue(targets.contains(board.getCellAt(12, 23)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(12, 22)));\t\t\t\r\n\t}", "protected boolean findTarget(){\n\t\t// shoot units\n\t\tfloat tmpDist = -1;\n\t\tUnit tmpUnit = null;\n\t\tfor(Unit u:Game.map.get(tileId).unitMap){ // loop through units on\n\t\t\t\t\t\t\t\t\t\t\t\t\t// maptile\n\t\t\tif(this.id == u.id)\n\t\t\t\tcontinue;\n\t\t\tif(this.ownerId == u.ownerId)\n\t\t\t\tcontinue;\n\t\t\tif(u.dead)\n\t\t\t\tcontinue;\n\t\t\tVector3f tmp = Vector3f.sub(this.modelPos, u.modelPos, null);\n\t\t\tif(tmpDist == -1 || tmp.length() < tmpDist){\n\t\t\t\ttmpUnit = u;\n\t\t\t\ttmpDist = tmp.length();\n\t\t\t}else\n\t\t\t\tcontinue;\n\t\t}\n\t\tif(tmpDist != -1 && tmpDist <= range && tmpUnit != null){\n\t\t\tthis.hostile = tmpUnit;\n\t\t\tthis.target = this.hostile.modelPos;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public static ResourceCollection selectSources(final ProjectComponent logTo,\n ResourceCollection source,\n final FileNameMapper mapper,\n final ResourceFactory targets,\n final ResourceSelectorProvider selector) {\n if (source.isEmpty()) {\n logTo.log(\"No sources found.\", Project.MSG_VERBOSE);\n return Resources.NONE;\n }\n source = Union.getInstance(source);\n\n final Union result = new Union();\n for (final Resource sr : source) {\n String srName = sr.getName();\n if (srName != null) {\n srName = srName.replace('/', File.separatorChar);\n }\n\n\n String[] targetnames = null;\n try {\n targetnames = mapper.mapFileName(srName);\n } catch (final Exception e) {\n logTo.log(\"Caught \" + e + \" mapping resource \" + sr,\n Project.MSG_VERBOSE);\n }\n if (targetnames == null || targetnames.length == 0) {\n logTo.log(sr + \" skipped - don\\'t know how to handle it\",\n Project.MSG_VERBOSE);\n continue;\n }\n final Union targetColl = new Union();\n for (String targetname : targetnames) {\n if (targetname == null) {\n targetname = \"(no name)\";\n }\n targetColl.add(targets.getResource(\n targetname.replace(File.separatorChar, '/')));\n }\n //find the out-of-date targets:\n final Restrict r = new Restrict();\n r.add(selector.getTargetSelectorForSource(sr));\n r.add(targetColl);\n if (r.size() > 0) {\n result.add(sr);\n final Resource t = r.iterator().next();\n logTo.log(sr.getName() + \" added as \" + t.getName()\n + (t.isExists() ? \" is outdated.\" : \" doesn\\'t exist.\"),\n Project.MSG_VERBOSE);\n continue;\n }\n //log uptodateness of all targets:\n logTo.log(sr.getName()\n + \" omitted as \" + targetColl.toString()\n + (targetColl.size() == 1 ? \" is\" : \" are \")\n + \" up to date.\", Project.MSG_VERBOSE);\n }\n return result;\n }", "@Test\r\n\tpublic void testTargetsSixSteps() {\r\n\t\tboard.calcTargets(24, 17, 6);\r\n\t\tSet<BoardCell> targets= board.getTargets();\r\n\t\tassertEquals(8, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(18, 17)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(20, 17)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(22, 17)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(19, 18)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(21, 18)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(23, 18)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(22, 19)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(22, 17)));\r\n\t\t\r\n\t}", "private StepList selectBestSteps( int top )\n {\n int maxlen = 0;\n int mincom = MINCOMMONALITY;\n int candidates[] = new int[length];\n int p = 0;\n \n StepList res = new StepList( top );\n for( int i=1; i<length; i++ ){\n if( commonality[i]>=mincom ){\n \t\t// TODO: we should also consider pairs that\n \t\t// have too much overlap, but make it up in subsequent\n \t\t// entries. This does mean that we must create a new\n \t\t// candidate array for each new possibility, since we\n \t\t// may have to throw it away.\n int pos0 = indices[i-1];\n \t\tint pos1 = indices[i];\n \t\tint len = Math.min( Math.abs( pos1-pos0 ), commonality[i] );\n \n \t\tif( len>maxlen ){\n \t\t // This is a better candidate.\n \t\t candidates[0] = pos0;\n \t\t candidates[1] = pos1;\n \t\t p = 2;\n \n \t\t // Now search for non-overlapping substrings that \n \t\t // are equal for `len' characters. All possibilities\n \t\t // are the subsequent entries in the suffix array, up to\n // the first one with less than 'len' characters\n // commonality.\n \t\t // We must test each one for overlap with all\n \t\t // previously selected strings.\n // TODO: this fairly arbitrary way of gathering candidates\n // is not optimal, since a different subset of strings may\n // be larger.\n \t\t int j = i+1;\n \t\t while( j<length && commonality[j]>=len ){\n \t\t\tint posj = indices[j];\n \n \t\t\tif( !areOverlapping( candidates, p, posj, len ) ){\n \t\t\t candidates[p++] = posj;\n \t\t\t}\n \t\t\tj++;\n \t\t }\n \t\t maxlen = len;\n \t\t mincom = len;\n res.add( new Step( candidates, p, maxlen ) );\n \t\t}\n }\n }\n return res;\n }", "protected void targetClosestPlanet ()\r\n {\r\n double closestTargetDistance = getWorld().getWidth();\r\n double distanceToActor;\r\n\r\n // search the whole World for planets\r\n planets = (ArrayList)getWorld().getObjects(TargetPlanet.class);\r\n\r\n if (planets.size() > 0)\r\n {\r\n // Loop through the objects in the ArrayList to find the closest target\r\n for (TargetPlanet o : planets)\r\n {\r\n // Cast for use in generic method\r\n Actor a = (Actor) o;\r\n\r\n //if looking for nearest planet OR nearest unconquered planet and current planet is not on the same team\r\n if(findNearestPlanet || (!findNearestPlanet && !sameTeamCheck(o.getState())))\r\n {\r\n // Measure distance from me\r\n distanceToActor = SpaceWorld.getDistance(this, a);\r\n\r\n // if target planet closer than current target is found, target will change\r\n if (distanceToActor < closestTargetDistance)\r\n {\r\n planet = o;\r\n closestTargetDistance = distanceToActor;\r\n }\r\n }\r\n }\r\n }\r\n }", "public boolean findBestMatch() {\n\t\t\tif(nodes.size() >= nodeLimit) return false;\n\n\t\t\tdouble bestScore = 0.0;\n\t\t\tint bestLight = -1;\n\t\t\tfor(int p = 0; p < lights.size(); p++) {\n\t\t\t\tif(nodeIndex.contains(p)) continue;\n\t\t\t\tdouble score = scoreByDistance(lights.get(p));\n\t\t\t\tif(score != Double.NaN && score > bestScore) {\n\t\t\t\t\tbestScore = score;\n\t\t\t\t\tbestLight = p;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(bestLight >= 0) {\n\t\t\t\taddNode(bestLight);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "Execution getClosestDistance();", "public static int searchForConnections(int target1, int target2)\n\t{\n\t\t// Insert pathfinding algorithm here\n\t\tQueue<Integer> queue = new LinkedList<Integer>();\n\t\tBoolean [] visited = new Boolean[targets.size()];\n\t\tint [] hops = new int[targets.size()];\n\n\t\t//Initialize visited array to false (unvisited) and hop count to some arbitrary value signifying no hop count exists\n\t\tfor (int i = 0; i < visited.length; i++)\n\t\t{\n\t\t\tvisited[i] = false;\n\t\t\thops[i] = -1;\n\t\t}\n\n\t\tqueue.add(target1);\n\t\tvisited[target1] = true;\n\t\twhile (queue.peek() != null)\n\t\t{\n\t\t\tint currentNode = queue.remove();\n\n\t\t\tif (target2 == currentNode)\n\t\t\t{\n\t\t\t\treturn hops[currentNode];\n\t\t\t}\n\n\t\t\tfor(String adjNode : targets.get(currentNode))\n\t\t\t{\n\t\t\t\tint adjNodeI = getTargetIndex(adjNode);\n\t\t\t\tif (!visited[adjNodeI])\n\t\t\t\t{\n\t\t\t\t\tvisited[adjNodeI] = true;\n\t\t\t\t\thops[adjNodeI] = hops[currentNode] + 1;\n\t\t\t\t\tqueue.add(adjNodeI);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "@Override\n\tpublic int[] locate(int target) {\n\t\tint n = this.length(); //number of rows\n\t\tint min = 0;\n\t\tint max = n-1;\n\t\tint mid = 0;\n\t\tint mid_element = 0;\n\t\twhile(min <= max){\n\t\t\tmid = (min + max)/2;\n\t\t\tmid_element = inspect(mid,mid);\n\t\t\tif(mid_element == target){\n\t\t\t\treturn new int[]{mid, mid};\n\t\t\t}\n\t\t\telse if(mid_element < target){\n\t\t\t\tmin = mid + 1;\n\t\t\t}\n\t\t\telse if(mid_element > target){\n\t\t\t\tmax = mid - 1;\n\t\t\t}\n\t\t}\n\t\tif(target < mid_element){\n\t\t\tif(target <= inspect(0, max)){\n\t\t\t\tfor(int r = 0; r < max; r++){\n\t\t\t\t\tif(inspect(r, max) == target){\n\t\t\t\t\t\treturn new int[]{r,max};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(int c = 0; c <= mid; c++){\n\t\t\t\t\tif(inspect(mid, c) == target){\n\t\t\t\t\t\treturn new int[]{mid,c};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tif(target > inspect(0, n-1)){\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\telse if(target <= inspect(0, max)){\n\t\t\t\tfor(int r = 0; r < max; r++){\n\t\t\t\t\tif(inspect(r, max) == target){\n\t\t\t\t\t\treturn new int[]{r, max};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(int c = 0; c < min; c++){\n\t\t\t\t\tif(inspect(min, c) == target){\n\t\t\t\t\t\treturn new int[]{min, c};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "TrgPlace getTarget();", "@Test\n\tpublic void testTargetsFourSteps() {\n\t\tboard.calcTargets(14, 24, 4);\n\t\tSet<BoardCell> targets= board.getTargets();\n\t\tassertEquals(7, targets.size());\n\t\tassertTrue(targets.contains(board.getCellAt(14, 20)));\n\t\tassertTrue(targets.contains(board.getCellAt(15, 21)));\n\t\tassertTrue(targets.contains(board.getCellAt(16, 22)));\n\t\tassertTrue(targets.contains(board.getCellAt(17, 23)));\t\t\t\n\t\tassertTrue(targets.contains(board.getCellAt(15, 23)));\n\t\tassertTrue(targets.contains(board.getCellAt(16, 24)));\t\t\t\n\t\tassertTrue(targets.contains(board.getCellAt(14, 22)));\n\t}", "@Override\n\tpublic double getBestTargetValue() {\n\t\treturn 0;\n\t}", "@SuppressWarnings(\"null\")\n\tpublic static Node optimalIterativeSolution (Node Tree, int target) {\n\t\tNode curr = Tree;\n\t\tNode Closest = null;\n\t\tClosest.val = Integer.MAX_VALUE;\n\t\twhile (curr != null) {\n\t\t\tif (Math.abs(target - Closest.val) > Math.abs(target - curr.val)) {\n\t\t\t\tClosest = curr;\n\t\t\t} else if (target < curr.val) {\n\t\t\t\tcurr = curr.left;\n\t\t\t} else if (target > curr.val) {\n\t\t\t\tcurr = curr.right;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn Closest;\n\t}", "@Nullable\n ImmutableList<ImmutableList<Label>> calculateTargetBatches(\n Set<Label> targets, SyncStrategy syncStrategy, int suggestedShardSize);", "@SuppressWarnings(\"null\")\n\tpublic static void optimalRecursiveSolution (Node Tree, int target) {\n\t\tNode Closest = null;\n\t\tClosest.val = Integer.MAX_VALUE;\n\t\tNode ret = recursiveHelper(Tree, target, Closest);\n\t\tSystem.out.println(String.format(\"%d\", ret.val));\n\t}", "private void findMTedJobs(List<Job> jobs, List<GlobalSightLocale> p_selectedTargetLocales,\n List<Job> mtedJobs, List<GlobalSightLocale> mtedTargetLocales)\n {\n Set<GlobalSightLocale> selectedTargetLocales = new HashSet<GlobalSightLocale>();\n selectedTargetLocales.addAll(p_selectedTargetLocales);\n\n Set<Job> mtedJobsSet = new HashSet<Job>();\n Set<GlobalSightLocale> mtedTargetLocalesSet = new HashSet<GlobalSightLocale>();\n for (Job job : jobs)\n {\n for (Workflow w : job.getWorkflows())\n {\n GlobalSightLocale gsl = w.getTargetLocale();\n if (w.getMtTotalWordCount() > 0 && selectedTargetLocales.contains(gsl))\n {\n mtedTargetLocalesSet.add(w.getTargetLocale());\n mtedJobsSet.add(job);\n }\n }\n }\n\n mtedTargetLocales.addAll(mtedTargetLocalesSet);\n SortUtil.sort(mtedTargetLocales,\n new GlobalSightLocaleComparator(GlobalSightLocaleComparator.ISO_CODE, Locale.US));\n\n mtedJobs.addAll(mtedJobsSet);\n SortUtil.sort(mtedJobs, new JobComparator(JobComparator.JOB_ID, Locale.US));\n }", "@Test\n\tpublic void multipleSolutionsTest(){\n\t\tDjikstrasMap m = new DjikstrasMap();\t//Creates new DjikstrasMap object\n\t\t\n\t\tm.addRoad(\"Guildford\", \"Portsmouth\", 20.5, \"M3\");\t//Adds a road from Guildford to portsmouth to the map\n m.addRoad(\"Portsmouth\", \"Guildford\", 20.5, \"M3\");\n \n m.addRoad(\"Guildford\", \"Winchester\", 20.5, \"A33\");\t//Adds a road from Guildford to winchester to the map\n m.addRoad(\"Winchester\", \"Guildford\", 20.5, \"A33\");\n \n m.addRoad(\"Winchester\", \"Fareham\", 20.5, \"M27\");\t//Adds a road from winchester to fareham to the map\n m.addRoad(\"Fareham\", \"Winchester\", 20.5, \"M27\");\n\t\t\n m.addRoad(\"Portsmouth\", \"Fareham\", 20.5, \"M25\");\t//Adds a road from fareham to portsmouth to the map\n m.addRoad(\"Fareham\", \"Portsmouth\", 20.5, \"M25\");\n \n m.findShortestPath(\"Fareham\");\t//Starts the algorithm to find the shortest path\n \n List<String> temp = new ArrayList<String>();\t//Holds the route plan\n temp = m.createRoutePlan(\"Guildford\");\t//Calls methods to assign the route plan to temp\n \n assertEquals(\"1. Take the M27 to Winchester\",temp.get(0));\t//tests that the different lines in the route plan are correct and that the algorithm did indeed take the shortest route\n assertEquals(\"2. Take the A33 to Guildford\", temp.get(1));\n assertEquals(\"\", temp.get(2));\n assertEquals(\"The Journey will take 41 hours and .00 minutes long.\", temp.get(3));\n assertEquals(\"\", temp.get(4));\n \n assertEquals(5, temp.size());\t//tests to see that the route plan is 5 line large as it should be\n\t}", "@VisibleForTesting\n int[] findMatches(Token[] source, Token[] target) {\n final LevenshteinDistance table = new LevenshteinDistance(source, target);\n table.calculate();\n final int targetLen = target.length;\n final int[] result = new int[targetLen];\n LevenshteinDistance.EditOperation[] ops = table.getTargetOperations();\n for (int i = 0; i < targetLen; ++i) {\n if (ops[i].getType() == LevenshteinDistance.EDIT_UNCHANGED) {\n result[i] = ops[i].getPosition();\n } else {\n result[i] = -1;\n }\n }\n return result;\n }", "@Experimental\n @Returns(\"targetInfo\")\n TargetInfo getTargetInfo(@Optional @ParamName(\"targetId\") String targetId);", "@Test\n\t\t\tpublic void testTargetsFourSteps() {\n\t\t\t\t//Using random walkway space\n\t\t\t\tboard.calcTargets(5, 18, 3);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(10, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(5, 21)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(6, 20)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(4, 20)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(5, 19)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(3, 17)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(6, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(4, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(5, 17)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(4, 18)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(6, 18)));\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t}", "private void findBestPath(){\n\t\t// The method will try to find the best path for every starting point and will use the minimum\n\t\tfor(int start = 0; start < this.getDimension(); start++){\n\t\t\tfindBestPath(start);\t\n\t\t}\t\n\t}", "private double[] chooseBestMove(List<double[]> possibleMoves) {\n double bestScore = 0;\n int indexBest = 0;\n for (int i = 0; i < possibleMoves.size(); i++) {\n if (possibleMoves.get(i)[4] > bestScore) {\n bestScore = possibleMoves.get(i)[4];\n indexBest = i;\n }\n }\n return possibleMoves.get(indexBest);\n }", "private final long getRandomTarget(int attempts, int targetTemplate, @Nullable ArrayList<Long> itemList) {\n/* 1746 */ long itemFound = -1L;\n/* */ \n/* */ \n/* */ \n/* */ \n/* 1751 */ if (Servers.localServer.PVPSERVER) {\n/* */ \n/* 1753 */ int numsExisting = 0;\n/* */ int x;\n/* 1755 */ for (x = 0; x < 17; x++) {\n/* */ \n/* 1757 */ if (this.epicTargetItems[x] > 0L)\n/* 1758 */ numsExisting++; \n/* */ } \n/* 1760 */ if (numsExisting > 0)\n/* */ {\n/* */ \n/* 1763 */ for (x = 0; x < 17; x++) {\n/* */ \n/* 1765 */ if (this.epicTargetItems[x] > 0L) {\n/* */ \n/* */ try {\n/* */ \n/* 1769 */ Item eti = Items.getItem(this.epicTargetItems[x]);\n/* 1770 */ Village v = Villages.getVillage(eti.getTilePos(), eti.isOnSurface());\n/* */ \n/* */ \n/* */ \n/* 1774 */ if (v == null) {\n/* */ \n/* 1776 */ if (itemFound == -1L) {\n/* 1777 */ itemFound = this.epicTargetItems[x];\n/* 1778 */ } else if (Server.rand.nextInt(numsExisting) == 0) {\n/* 1779 */ itemFound = this.epicTargetItems[x];\n/* */ } \n/* */ } else {\n/* */ \n/* 1783 */ logger.info(\"Disqualified Epic Mission Target item due to being in village \" + v.getName() + \": Name: \" + eti\n/* 1784 */ .getName() + \" | WurmID: \" + eti.getWurmId() + \" | TileX: \" + eti.getTileX() + \" | TileY: \" + eti\n/* 1785 */ .getTileY());\n/* */ \n/* */ }\n/* */ \n/* */ \n/* */ }\n/* 1791 */ catch (NoSuchItemException nsie) {\n/* */ \n/* 1793 */ logger.warning(\"Epic mission item could not be found when loaded, maybe it was wrongfully deleted? WurmID:\" + this.epicTargetItems[x] + \". \" + nsie);\n/* */ } \n/* */ }\n/* */ } \n/* */ }\n/* */ } else {\n/* */ int templateId;\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 1807 */ if (logger.isLoggable(Level.FINE)) {\n/* 1808 */ logger.fine(\"Entering Freedom Version of Valrei Mission Target Structure selection.\");\n/* */ }\n/* 1810 */ Connection dbcon = null;\n/* 1811 */ PreparedStatement ps1 = null;\n/* 1812 */ ResultSet rs = null;\n/* */ \n/* 1814 */ int structureType = Server.rand.nextInt(6);\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 1820 */ if (targetTemplate > 0) {\n/* */ \n/* 1822 */ templateId = targetTemplate;\n/* */ }\n/* */ else {\n/* */ \n/* 1826 */ switch (structureType) {\n/* */ \n/* */ case 0:\n/* 1829 */ templateId = 717;\n/* */ break;\n/* */ case 1:\n/* 1832 */ templateId = 714;\n/* */ break;\n/* */ case 2:\n/* 1835 */ templateId = 713;\n/* */ break;\n/* */ case 3:\n/* 1838 */ templateId = 715;\n/* */ break;\n/* */ case 4:\n/* 1841 */ templateId = 712;\n/* */ break;\n/* */ case 5:\n/* 1844 */ templateId = 716;\n/* */ break;\n/* */ default:\n/* 1847 */ templateId = 713;\n/* */ break;\n/* */ } \n/* */ \n/* */ \n/* */ } \n/* 1853 */ if (logger.isLoggable(Level.FINE)) {\n/* 1854 */ logger.fine(\"Selected template with id=\" + templateId);\n/* */ }\n/* 1856 */ if (itemList == null) {\n/* */ \n/* 1858 */ itemList = new ArrayList<>();\n/* */ \n/* */ \n/* */ try {\n/* 1862 */ String dbQueryString = \"SELECT WURMID FROM ITEMS WHERE TEMPLATEID=?\";\n/* */ \n/* 1864 */ if (logger.isLoggable(Level.FINER)) {\n/* 1865 */ logger.finer(\"Query String [ SELECT WURMID FROM ITEMS WHERE TEMPLATEID=? ]\");\n/* */ }\n/* 1867 */ dbcon = DbConnector.getItemDbCon();\n/* 1868 */ ps1 = dbcon.prepareStatement(\"SELECT WURMID FROM ITEMS WHERE TEMPLATEID=?\");\n/* 1869 */ ps1.setInt(1, templateId);\n/* 1870 */ rs = ps1.executeQuery();\n/* */ \n/* 1872 */ while (rs.next())\n/* */ {\n/* 1874 */ long currentLong = rs.getLong(\"WURMID\");\n/* 1875 */ if (currentLong > 0L)\n/* */ {\n/* 1877 */ itemList.add(Long.valueOf(currentLong));\n/* */ }\n/* 1879 */ if (logger.isLoggable(Level.FINEST)) {\n/* 1880 */ logger.finest(rs.toString());\n/* */ }\n/* */ }\n/* */ \n/* 1884 */ } catch (SQLException ex) {\n/* */ \n/* 1886 */ logger.log(Level.WARNING, \"Failed to locate mission items with templateid=\" + templateId, ex);\n/* */ }\n/* */ finally {\n/* */ \n/* 1890 */ DbUtilities.closeDatabaseObjects(ps1, null);\n/* 1891 */ DbConnector.returnConnection(dbcon);\n/* */ } \n/* */ } \n/* */ \n/* */ \n/* 1896 */ if (itemList.size() > 0) {\n/* */ \n/* 1898 */ int randomIndex = Server.rand.nextInt(itemList.size());\n/* */ \n/* 1900 */ if (itemList.get(randomIndex) != null)\n/* */ {\n/* */ \n/* 1903 */ long selectedTarget = ((Long)itemList.get(randomIndex)).longValue();\n/* */ \n/* */ \n/* */ try {\n/* 1907 */ Item eti = Items.getItem(selectedTarget);\n/* 1908 */ Village v = Villages.getVillage(eti.getTilePos(), eti.isOnSurface());\n/* */ \n/* */ \n/* */ \n/* 1912 */ if (v == null) {\n/* */ \n/* 1914 */ logger.info(\"Selected mission target with wurmid=\" + selectedTarget);\n/* 1915 */ return selectedTarget;\n/* */ } \n/* */ \n/* */ \n/* 1919 */ logger.info(\"Disqualified Epic Mission Target item due to being in village \" + v.getName() + \": Name: \" + eti\n/* 1920 */ .getName() + \" | WurmID: \" + eti.getWurmId() + \" | TileX: \" + eti.getTileX() + \" | TileY: \" + eti\n/* 1921 */ .getTileY());\n/* */ \n/* */ \n/* 1924 */ int ATTEMPT_NUMBER_OF_TIMES = 25;\n/* */ \n/* 1926 */ if (attempts < 25) {\n/* */ \n/* 1928 */ logger.fine(\"Failing roll number \" + attempts + \"/\" + '\\031' + \" and trying again.\");\n/* 1929 */ return getRandomTarget(attempts + 1, templateId, itemList);\n/* */ } \n/* */ \n/* */ \n/* 1933 */ logger.info(\"Failing roll of finding structure with templateID=\" + templateId + \" completely, could not find any mission structure not in a village in \" + '\\031' + \" tries.\");\n/* */ \n/* 1935 */ return -1L;\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ }\n/* 1943 */ catch (NoSuchItemException noSuchItemException) {}\n/* */ \n/* */ \n/* */ }\n/* */ else\n/* */ {\n/* */ \n/* */ \n/* 1951 */ logger.warning(\"WURMID was null for item with templateId=\" + templateId);\n/* 1952 */ return -1L;\n/* */ }\n/* */ \n/* */ }\n/* */ else {\n/* */ \n/* 1958 */ logger.info(\"Couldn't find any items with itemtemplate=\" + templateId + \" failing, the roll.\");\n/* 1959 */ return -1L;\n/* */ } \n/* */ } \n/* */ \n/* */ \n/* 1964 */ return itemFound;\n/* */ }", "private Target findTargetByName(String targetName, String environment) {\n if (targetName == null || targetName.isEmpty()) {\n return NO_TARGET;\n }\n\n Target target = environmentRepository.getAndValidateServer(targetName, environment);\n\n Optional<NetworkDescription> networkDescription = currentNetworkDescription.findCurrent();\n if (networkDescription.isPresent() && networkDescription.get().localAgent().isPresent()) {\n final Agent localAgent = networkDescription.get().localAgent().get();\n List<Agent> agents = localAgent.findFellowAgentForReaching(target.id);\n return Target.builder()\n .copyOf(target)\n .withAgents(agents.stream().map(a -> a.agentInfo).collect(Collectors.toList()))\n .build();\n }\n return target;\n }", "private void identifySuccessors(T node, T goal, Set<T> goals, Queue<T> open, Set<T> closed, Map<T, T> parentMap,\n Map<T, Double> fMap, Map<T, Double> gMap, Map<T, Double> hMap) {\n // get all neighbors to the current node\n Collection<T> neighbors = findNeighbors(node, parentMap);\n\n double d;\n double ng;\n for (T neighbor : neighbors) {\n // jump in the direction of our neighbor\n T jumpNode = jump(neighbor, node, goals);\n\n // don't add a node we have already gotten to quicker\n if (jumpNode == null || closed.contains(jumpNode)) continue;\n\n // determine the jumpNode's distance from the start along the current path\n d = graph.getDistance(jumpNode, node);\n ng = gMap.getOrDefault(node, 0d) + d;\n\n // if the node has already been opened and this is a shorter path, update it\n // if it hasn't been opened, mark as open and update it\n if (!open.contains(jumpNode) || ng < gMap.getOrDefault(jumpNode, 0d)) {\n gMap.put(jumpNode, ng);\n hMap.put(jumpNode, graph.getHeuristicDistance(jumpNode, goal));\n fMap.put(jumpNode, gMap.getOrDefault(jumpNode, 0d) + hMap.getOrDefault(jumpNode, 0d));\n //System.out.println(\"jumpNode: \" + jumpNode.x + \",\" + jumpNode.y + \" f: \" + fMap.get(jumpNode));\n parentMap.put(jumpNode, node);\n\n if (!open.contains(jumpNode)) {\n open.offer(jumpNode);\n }\n }\n }\n }", "public void solveUsingLeastCostMethod() {\n\n this.solution = new Solution();\n\n Source[] proxySources = Arrays.copyOf(sources, sources.length);\n Destination[] proxyDestinations = Arrays.copyOf(destinations, destinations.length);\n int[][] matrix = new int[costs.length][costs[0].length];\n\n List<Integer> rows = new ArrayList<Integer>();\n List<Integer> columns = new ArrayList<Integer>();\n while ( rows.size() != proxySources.length && columns.size() != proxyDestinations.length ) {\n //getting minimum cell (if there is a tie, we choose where is the maximum quantity)\n int indexI,indexJ, value;\n indexI = 0;\n indexJ = 0;\n value = 0;\n boolean firstElement = true;\n for(int i=0;i<proxySources.length;i++) {\n if( !rows.contains(i) ) {\n for(int j=0;j<proxyDestinations.length;j++) {\n if( !columns.contains(j) ) {\n if ( firstElement ) {\n indexI = i;\n indexJ = j;\n value = costs[i][j];\n firstElement = false;\n }\n if( costs[i][j] < value ) {\n indexI = i;\n indexJ = j;\n value = costs[i][j];\n }\n else if( costs[i][j] == value ) {\n if( Math.min(proxySources[i].getSupply(),proxyDestinations[j].getDemand()) > Math.min(proxySources[indexI].getSupply(),proxyDestinations[indexJ].getDemand()) ) {\n indexI = i;\n indexJ = j;\n value = costs[i][j];\n }\n }\n }\n }\n }\n }\n int supply = proxySources[indexI].getSupply();\n int demand = proxyDestinations[indexJ].getDemand();\n\n\n this.solution.add(sources[indexI], destinations[indexJ], Math.min(supply,demand), costs[indexI][indexJ]);\n\n if ( supply < demand ) {\n proxySources[indexI].setSupply(0);\n proxyDestinations[indexJ].setDemand(demand - supply);\n rows.add(indexI);\n }\n else if( supply > demand ) {\n proxySources[indexI].setSupply(supply-demand);\n proxyDestinations[indexJ].setDemand(0);\n columns.add(indexJ);\n }\n else {\n proxySources[indexI].setSupply(0);\n proxyDestinations[indexJ].setDemand(0);\n rows.add(indexI);\n columns.add(indexJ);\n }\n }\n this.solution.showSolution();\n\n\n }", "public List<Integer> DP(int target, int[] numbers, HashMap<Integer, List<Integer>> memoMap) {\n\n if (memoMap.containsKey(target))\n return memoMap.get(target);\n if (target == 0)\n return List.of();\n if (target < 0)\n return null;\n\n List<Integer> minCombinationResult = null;\n\n for (int number : numbers) {\n\n List<Integer> potentialResult = DP(target - number, numbers, memoMap);\n if (potentialResult != null) {\n\n List<Integer> validResult = new ArrayList<Integer>(potentialResult);\n validResult.add(number);\n\n if (minCombinationResult == null || validResult.size() < minCombinationResult.size())\n minCombinationResult = validResult;\n }\n }\n\n memoMap.put(target, minCombinationResult);\n return memoMap.get(target);\n }", "private WeightedSampler<String> getPossibleActions(int team) {\n if (this.b.getCurrentPlayerTurn() != team || this.b.getWinner() != 0) {\n return null;\n }\n Player p = this.b.getPlayer(team);\n WeightedSampler<String> poss = new WeightedRandomSampler<>();\n // playing cards & selecting targets\n List<Card> hand = p.getHand();\n for (Card c : hand) {\n if (p.canPlayCard(c)) {\n double totalWeight = PLAY_CARD_TOTAL_WEIGHT + PLAY_CARD_COST_WEIGHT_MULTIPLIER * c.finalStats.get(Stat.COST);\n List<List<List<TargetList<?>>>> targetSearchSpace = new LinkedList<>();\n this.getPossibleListTargets(c.getBattlecryTargetingSchemes(), new LinkedList<>(), targetSearchSpace);\n if (targetSearchSpace.isEmpty()) {\n targetSearchSpace.add(List.of());\n }\n if (c instanceof BoardObject) {\n double weightPerPos = totalWeight / (p.getPlayArea().size() + 1);\n // rip my branching factor lol\n for (int playPos = 0; playPos <= p.getPlayArea().size(); playPos++) {\n for (List<List<TargetList<?>>> targets : targetSearchSpace) {\n poss.add(new PlayCardAction(p, c, playPos, targets).toString().intern(), weightPerPos / targetSearchSpace.size());\n }\n }\n } else {\n // spells don't require positioning\n for (List<List<TargetList<?>>> targets : targetSearchSpace) {\n poss.add(new PlayCardAction(p, c, 0, targets).toString().intern(), totalWeight / targetSearchSpace.size());\n }\n }\n }\n }\n this.b.getMinions(team, false, true).forEachOrdered(m -> {\n // unleashing cards & selecting targets\n if (p.canUnleashCard(m)) {\n List<List<List<TargetList<?>>>> targetSearchSpace = new LinkedList<>();\n this.getPossibleListTargets(m.getUnleashTargetingSchemes(), new LinkedList<>(), targetSearchSpace);\n if (targetSearchSpace.isEmpty()) {\n targetSearchSpace.add(List.of());\n }\n for (List<List<TargetList<?>>> targets : targetSearchSpace) {\n poss.add(new UnleashMinionAction(p, m, targets).toString().intern(), UNLEASH_TOTAL_WEIGHT / targetSearchSpace.size());\n }\n }\n // minion attack\n if (m.canAttack()) {\n double totalWeight = ATTACK_TOTAL_WEIGHT + ATTACK_WEIGHT_MULTIPLIER * m.finalStats.get(Stat.ATTACK);\n double weight = totalWeight / m.getAttackableTargets().count();\n m.getAttackableTargets().forEachOrdered(target -> {\n double bonus = target instanceof Leader ? ATTACK_TARGET_LEADER_MULTIPLIER : 1;\n double overkillMultiplier = Math.pow(ATTACK_WEIGHT_OVERKILL_PENALTY, Math.max(0, m.finalStats.get(Stat.ATTACK) - target.health));\n poss.add(new OrderAttackAction(m, target).toString().intern(), overkillMultiplier * bonus * weight);\n });\n }\n });\n // ending turn\n poss.add(new EndTurnAction(team).toString().intern(), END_TURN_WEIGHT);\n return poss;\n }", "public static void main(String[] args){\n if (args.length != 4){\n System.out.println(\"Please provide a file name, source and destination node and an output file.\");\n System.exit(0);\n }\n\n findShortestRoadMap(args[0], args[1], args[2], args[3]);\n }", "@Override\n\tpublic void findTarget(List<Combat> other) {\n\t}", "public static int searchTriplet(int[] arr, int targetSum) {\n\n Arrays.sort(arr); // need to make fiding number easier n * log(n) with qsort\n // we fix one value\n\n // internal array would have: value, left, right, target\n // when sum value+left+right.\n // if exactly target => return result\n // if > than target sum: move right pointer. Calculate absolute difference.\n // if < than target sum: move left pointers. Calculate absolute difference.\n // if at any point absolute difference becomes larger -> there is no point to continue iteratig\n // (^ how true if that?)\n // at the end of one cycle return absolute difference. If it is zero -> early exist,\n // if not, try again with different fixed number\n\n int smallestDifference = Integer.MAX_VALUE;\n for (int i = 0; i < arr.length - 2; i++) {\n int left = i + 1;\n int right = arr.length - 1;\n\n while (left < right) {\n int diffWithTarget = targetSum - arr[i] - arr[left] - arr[right];\n if (diffWithTarget == 0) {\n return diffWithTarget;\n }\n\n if (Math.abs(diffWithTarget) < Math.abs(smallestDifference)) {\n smallestDifference = diffWithTarget;\n }\n\n if (diffWithTarget > 0) {\n left++;\n } else {\n right--;\n }\n }\n }\n return targetSum - smallestDifference;\n }", "private List<Pair<Integer, Integer>> getBestPath(Pair<Integer, Integer> curLocation, Pair<Integer, Integer> dest) {\n\t\tList<Pair<Integer, Integer>> path = new LinkedList<Pair<Integer, Integer>>();\n\t\t\n\t\t\n\t\tNode current = new Node(curLocation.getX(), curLocation.getY(), getHitProbability(curLocation.getX(), curLocation.getY()));\n\t\tNode target = new Node(dest.getX(), dest.getY(), getHitProbability(dest.getX(), dest.getY()));\n\t\tList<Node> openSet = new ArrayList<>();\n List<Node> closedSet = new ArrayList<>();\n \n \n while (true) {\n openSet.remove(current);\n List<Node> adjacent = getAdjacentNodes(current, closedSet, target);\n\n // Find the adjacent node with the lowest heuristic cost.\n for (Node neighbor : adjacent) {\n \tboolean inOpenset = false;\n \tList<Node> openSetCopy = new ArrayList<>(openSet);\n \tfor (Node node : openSetCopy) {\n \t\tif (neighbor.equals(node)) {\n \t\t\tinOpenset = true;\n \t\t\tif (neighbor.getAccumulatedCost() < node.getAccumulatedCost()) {\n \t\t\t\topenSet.remove(node);\n \t\t\t\topenSet.add(neighbor);\n \t\t\t}\n \t\t}\n \t}\n \t\n \tif (!inOpenset) {\n \t\topenSet.add(neighbor);\n \t}\n }\n\n // Exit search if done.\n if (openSet.isEmpty()) {\n System.out.printf(\"Target (%d, %d) is unreachable from position (%d, %d).\\n\",\n target.getX(), target.getY(), curLocation.getX(), curLocation.getY());\n return null;\n } else if (/*isAdjacent(current, target)*/ current.equals(target)) {\n break;\n }\n\n // This node has been explored now.\n closedSet.add(current);\n\n // Find the next open node with the lowest cost.\n Node next = openSet.get(0);\n for (Node node : openSet) {\n if (node.getCost(target) < next.getCost(target)) {\n next = node;\n }\n }\n// System.out.println(\"Moving to node: \" + current);\n current = next;\n }\n \n // Rebuild the path using the node parents\n path.add(new Pair<Integer, Integer>(curLocation.getX(), curLocation.getY()));\n while(current.getParent() != null) {\n \tcurrent = current.getParent();\n \tpath.add(0, new Pair<Integer, Integer>(current.getX(), current.getY()));\n }\n \n if (path.size() > 1) {\n \tpath.remove(0);\n }\n \n\t\treturn path;\n\t}", "@Override public Map<L, Integer> sources(L target) {\r\n Map<L, Integer> res= new HashMap <L, Integer>();\r\n \tif(!vertices.contains(target)) {\r\n \t\t//System.out.println(target+\" is not in the graph!\");\r\n \t\treturn res;\r\n \t}\r\n \tIterator<Edge<L>> iter=edges.iterator();\r\n \twhile(iter.hasNext()) {\r\n \t\tEdge<L> tmp=iter.next();\r\n \t\t//if(tmp.getTarget()==target)\r\n \t\tif(tmp.getTarget().equals(target))\r\n \t\t\r\n \t\t\tres.put(tmp.getSource(), tmp.getWeight());\r\n \t\t\r\n \t}\r\n \tcheckRep();\r\n \treturn res;\r\n }", "public Coordinate find(ManhattanSquare ms, int target) {\n\t\tsize = ms.N;\n\t\tCoordinate toReturn;\n\t\tmidPoint = middle(size-1);\n\n\t\t//This is to make sure that Slicer is large enough to contain target\n\t\tif ((Math.pow(size, 2) - 1) < target){\n\t\t\tthrow new IndexOutOfBoundsException(\"Target: \" + target + \" is outside of the bounds. \" +\n\t\t\t\t\t\"Max target = \" + (Math.pow(size, 2) - 1));\n\t\t} if (size < 3){\n\t\t\treturn size == 1 ? new Coordinate(0,0) : findTwoByTwo(ms, target);\n\t\t}\n\n\t\ttoReturn = findCoords(ms, target);\n\n\n\t\treturn toReturn;\n\t}", "public static void findShortestRoadMap(String fileName, String source, String dest, String outputName){\n try {\n PrintWriter writer = new PrintWriter(outputName, \"UTF-8\");\n\n Dijkstra d = new Dijkstra(new Graph(fileName));\n writer.println(d.getPath(source, dest));\n writer.close();\n\n System.out.println(\"Wrote path to file \" + outputName);\n } catch (Exception e){\n e.printStackTrace();\n }\n }", "private Module getBestModuleId(Collection<Module> candidates) {\n\t\tint minDistance = NOT_USED_DISTANCE;\n\n\t\tModule bestModule = null;\n\t\tfor(Module module : candidates) {\n\t\t\tModuleStat stat = getModuleStat(module);\n\t\t\tif(!stat.waitLoading()) {\n\t\t\t\tif(stat.isRecentlyUsed()) {\n\t\t\t\t\tbestModule = module;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint curDistance = stat.lastUseDistance();\n\t\t\t\t\n\t\t\t\tif(bestModule==null || curDistance<minDistance) {\n\t\t\t\t\tbestModule = module;\n\t\t\t\t\tminDistance = curDistance;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn bestModule;\n\t}", "public Map<String, Integer> findPossibilities(char startName, char finishName, int maxDistance) {\r\n Map<String, Integer> routes = new TreeMap<>();\r\n \r\n // get vertex identified by startName\r\n Vertex startVertex = null;\r\n for(Vertex v : listOfVertices) {\r\n if(v.getName() == startName) {\r\n startVertex = v;\r\n break;\r\n }\r\n }\r\n if(startVertex == null) {\r\n throw new IllegalArgumentException(\"Vertex \" + startName + \" is not in graph\");\r\n }\r\n \r\n // get vertex identified by finishName\r\n Vertex finishVertex = null;\r\n for(Vertex v : listOfVertices) {\r\n if(v.getName() == finishName) {\r\n finishVertex = v;\r\n break;\r\n }\r\n }\r\n if(finishVertex == null) {\r\n throw new IllegalArgumentException(\"Vertex \" + finishName + \" is not in graph\");\r\n }\r\n \r\n // search which will do DFS and alter routes whenever it finds a route\r\n search(routes, startVertex, finishVertex, maxDistance, Character.toString(startName), 0);\r\n \r\n /*for(Edge e : startVertex.getIncidentEdges()) {\r\n if(e.getDistance() <= maxDistance)\r\n search(routes, e.getOppositeVertex(startVertex), finishVertex, maxDistance, Character.toString(startName) + e.getOppositeVertex(startVertex).getName(), e.getDistance());\r\n }*/\r\n \r\n return routes;\r\n }", "static Integer readTargetChoice(List<EnemyInfo> enemyInfoList) throws IllegalArgumentException{\n if(enemyInfoList.isEmpty()){\n throw new IllegalArgumentException(\"The list of possible targets should not be empty.\");\n }\n if(enemyInfoList.size() == 1) { //only one possible target\n return enemyInfoList.get(0).getId();\n }\n else { //choose between the possible targets\n System.out.println(\"Choose one of these targets: \");\n List<String> options = new ArrayList<>();\n for (int i = 0; i < enemyInfoList.size(); i++) {\n System.out.println((i + 1) + \": \" + enemyInfoList.get(i).getName());\n options.add(Integer.toString(i + 1));\n }\n System.out.print(GeneralInfo.ASK_INPUT);\n String userChoice = ToolsView.readUserChoice(options, false);\n if (userChoice != null) {//time not expired\n return enemyInfoList.get(Integer.parseInt(userChoice) - 1).getId();\n }\n else{\n return null;\n }\n }\n }", "EValidTargetTypes getTargets();", "protected int bestDirection(int _y, int _x)\n {\n int sX = -1, sY = -1;\n for (int i = 0; i < m; i++) {\n boolean breakable = false;\n for (int j = 0; j < n; j++) {\n if (map[i][j] == 'p' || map[i][j] == '5') {\n sX = i;\n sY = j;\n breakable = true;\n break;\n }\n }\n if(breakable) break;\n sX =0; sY = 0;\n }\n Pair s = new Pair(sX, sY);\n Queue<Pair> queue = new Queue<Pair>();\n int[][] distance = new int[m][n];\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n distance[i][j] = -1;\n distance[sX][sY] = 0;\n queue.add(s);\n /*\n System.out.println(\"DEBUG TIME!!!!\");\n for(int i = 0; i < m; i++)\n {\n for(int j = 0; j < n; j++)\n System.out.print(map[i][j]);\n System.out.println();\n }\n System.out.println();\n */\n while (!queue.isEmpty())\n {\n Pair u = queue.remove();\n for (int i = 0; i < 4; i++)\n {\n int x = u.getX() + hX[i];\n int y = u.getY() + hY[i];\n if (!validate(x, y)) continue;\n if (distance[x][y] != -1) continue;\n if (!canGo.get(map[x][y])) continue;\n distance[x][y] = distance[u.getX()][u.getY()] + 1;\n queue.add(new Pair(x, y));\n }\n }\n\n //slove if this enemy in danger\n //System.out.println(_x + \" \" + _y);\n if (inDanger[_x][_y])\n {\n int direction = -1;\n boolean canAlive = false;\n int curDistance = dangerDistance[_x][_y];\n int distanceToBomber = m * n;\n if (curDistance == -1) return 0;\n for (int i = 0; i < 4; i++)\n {\n int x = _x + hX[i];\n int y = _y + hY[i];\n if (!validate(x, y)) continue;\n if (dangerDistance[x][y] == -1) continue;\n if (dangerDistance[x][y] < curDistance)\n {\n curDistance = dangerDistance[x][y];\n direction = i;\n distanceToBomber = distance[x][y];\n } else if (dangerDistance[x][y] == curDistance)\n {\n if (distanceToBomber == -1 || distanceToBomber > distance[x][y])\n {\n direction = i;\n distanceToBomber = distance[x][y];\n }\n }\n }\n if (direction == -1) direction = random.nextInt(4);\n allowSpeedUp = true;\n return direction;\n }\n // or not, it will try to catch bomber\n else\n {\n /*\n System.out.println(\"x = \" + _x + \"y = \" + _y);\n for(int i = 0; i < n; i++) System.out.printf(\"%2d \",i);\n System.out.println();\n for(int i = 0; i < m; i++)\n {\n for(int j = 0; j < n; j++)\n System.out.printf(\"%2d \",distance[i][j]);\n System.out.println();\n }\n System.out.println();\n System.out.println();\n */\n int direction = -1;\n int[] die = new int[4];\n for (int i = 0; i < 4; i++)\n die[i] = 0;\n int curDistance = distance[_x][_y];\n for (int i = 0; i < 4; i++)\n {\n int x = _x + hX[i];\n int y = _y + hY[i];\n if (!validate(x, y))\n {\n die[i] = 1;\n continue;\n }\n ;\n if (inDanger[x][y])\n {\n die[i] = 2;\n continue;\n }\n if (distance[x][y] == -1) continue;\n if (distance[x][y] < curDistance)\n {\n curDistance = distance[x][y];\n direction = i;\n }\n }\n if(curDistance < 4) allowSpeedUp = true;\n else allowSpeedUp = false; //TODO: TEST :))\n if (direction == -1)\n {\n for (int i = 0; i < 4; i++)\n if (die[i] == 0) return i;\n for (int i = 0; i < 4; i++)\n if (die[i] == 1) return i;\n return 0;\n } else return direction;\n }\n }", "private String assignTaskToBestResource(Task t, List<String> resources) {\n Parameter[] params = t.getCore().getParameters();\n HashMap<String, Integer> hostToScore = new HashMap<String, Integer>(params.length * 2);\n\n // Obtain the scores for each host: number of task parameters that are located in the host\n for (Parameter p : params) {\n if (p instanceof DependencyParameter && p.getDirection() != ParamDirection.OUT) {\n DependencyParameter dp = (DependencyParameter) p;\n DataInstanceId dId = null;\n switch (dp.getDirection()) {\n case IN:\n RAccessId raId = (RAccessId) dp.getDataAccessId();\n dId = raId.getReadDataInstance();\n break;\n case INOUT:\n RWAccessId rwaId = (RWAccessId) dp.getDataAccessId();\n dId = rwaId.getReadDataInstance();\n break;\n case OUT:\n break;\n }\n\n if (dId != null) {\n TreeSet<String> hosts = FTM.getHosts(dId);\n for (String host : hosts) {\n Integer score;\n if ((score = hostToScore.get(host)) == null) {\n score = new Integer(0);\n hostToScore.put(host, score);\n }\n hostToScore.put(host, score + 1);\n }\n }\n }\n }\n\n if (hostToScore.isEmpty()) {\n return resources.get(0);\n }\n\n Collections.sort(resources);\n\n // Select the resource with best score among those that are suitable for the task (they match its constraints).\n String bestResource = null;\n int bestScore = 0;\n for (Map.Entry<String, Integer> e : hostToScore.entrySet()) {\n String host = e.getKey();\n Integer score = e.getValue();\n // Check whether the host is actually in the list of suitable resources\n if (score > bestScore && Collections.binarySearch(resources, host) >= 0) {\n bestResource = host;\n bestScore = score;\n }\n }\n\n if (debug) {\n logger.debug(\"Best scoring resource is \" + bestResource + \" with score \" + bestScore);\n }\n\n if (bestResource == null) {\n return resources.get(0);\n } else {\n return bestResource;\n }\n }", "public static final List<EntityMob> acquireNearestLookMobTargetList(EntityLivingBase seeker, int distance, double radius, int numberOfTargets) \r\n\t{\r\n\t\tList<EntityMob> targets = new ArrayList<EntityMob>();\r\n\r\n\t\ttargets = acquireAllLookMobTargets(seeker, distance, radius);\r\n\r\n\t\tList<EntityMob> closestMobsArray = new ArrayList<EntityMob>();\r\n\r\n\t\tint counter = 0;\r\n\t\tboolean isListExhausted = false;\r\n\r\n\t\twhile(counter < numberOfTargets && !isListExhausted)\r\n\t\t{\r\n\t\t\tdouble currentDistance = MAX_DISTANCE_SQ;\r\n\r\n\t\t\tEntityMob currentTarget = null;\r\n\r\n\t\t\tfor (EntityMob target : targets) \r\n\t\t\t{\r\n\t\t\t\tif(!closestMobsArray.contains(target))\r\n\t\t\t\t{\r\n\t\t\t\t\tdouble newDistance = target.getDistanceSq(seeker);\r\n\r\n\t\t\t\t\tif (newDistance < currentDistance) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcurrentTarget = target;\r\n\t\t\t\t\t\tcurrentDistance = newDistance;\r\n\r\n\t\t\t\t\t\t//System.out.println( \"Test Entity Detected By Dance of Arrows\" );\r\n\t\t\t\t\t\t//System.out.println( \"Target Found \" + Integer.toString( target.getEntityId() ) );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(currentTarget != null)\r\n\t\t\t{\r\n\t\t\t\tclosestMobsArray.add(currentTarget);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tisListExhausted = true;\r\n\t\t\t}\r\n\r\n\t\t\tcounter++;\r\n\t\t}\r\n\r\n\t\treturn closestMobsArray;\r\n\t}", "public static void hint(int[][] map, int x, int y) {\n\t\t// show neighbor of this shot\n\t\tfor (int i = -1; i < 2; i++) {\n\t\t\tfor (int j = -1; j < 2; j++) {\n\n\t\t\t\tif (x + i < 0 || y + j < 0 || x + i > 9 || y + j > 9) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (map[x + i][y + j] == 0) {\n\t\t\t\t\tmap[x + i][y + j] = 3;\n\t\t\t\t\tSystem.out.println(\n\t\t\t\t\t\t\t\"x axis is \" + (x + i) + \" and y axis is \" + (y + j) + \"\" + \", it is not the target!\");\n\t\t\t\t} else if (map[x + i][y + j] == 1) {\n\t\t\t\t\t// map[x + i][y + j] = MINE_FOUND;\n\t\t\t\t\tSystem.out\n\t\t\t\t\t\t\t.println(\"x axis is \" + (x + i) + \" and y axis is \" + (y + j) + \"\" + \", this is a target!\");\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(\"-------------------------------------\");\n\t\t// print all the previous shots.\n\t\tfor (int i = 0; i < map.length; i++) {\n\t\t\tfor (int j = 0; j < map[i].length; j++) {\n\t\t\t\tif (map[i][j] == 3) {\n\t\t\t\t\tSystem.out.println(\"x axis is \" + i + \" and y axis is \" + j + \"\" + \", it is not the target!\");\n\t\t\t\t} else if (map[i][j] == 2) {\n\t\t\t\t\tSystem.out.println(\"x axis is \" + i + \" and y axis is \" + j + \"\" + \", it is a found target!\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "protected MoveToTask searchAccessPoint(final Point start, final Point target, final Goblin goblin) {\n\t\tObjects.requireNonNull(start, \"start must not be null!\");\n\t\tObjects.requireNonNull(target, \"target must not be null!\");\n\t\tObjects.requireNonNull(goblin, \"goblin must not be null!\");\n\n\t\tfor (Point neighbour : target.getNeighbours()) {\n\t\t\tif (goblin.getAI().getBlockadeMap().isBlocked(neighbour)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tMoveToTask path = new MoveToTask(start, neighbour, goblin, goblin.getAI().getBlockadeMap());\n\n\t\t\tif (path.hasPath()) {\n\t\t\t\treturn path;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}", "private void getPossibleListTargets(List<List<TargetingScheme<?>>> list, List<List<TargetList<?>>> alreadyTargeted, List<List<List<TargetList<?>>>> outputList) {\n // and the lord said let there be triple nested lists, trust me bro\n if (list.isEmpty()) {\n outputList.add(new ArrayList<>(alreadyTargeted));\n return;\n }\n List<TargetingScheme<?>> schemesForFirstEffect = list.get(0);\n List<List<TargetList<?>>> searchSpace = new LinkedList<>();\n this.getPossibleListTargetsPerEffect(schemesForFirstEffect, new LinkedList<>(), searchSpace);\n if (searchSpace.isEmpty()) {\n // if no targets, add that possibility to our search space\n searchSpace.add(List.of());\n }\n for (List<TargetList<?>> t : searchSpace) {\n alreadyTargeted.add(t);\n this.getPossibleListTargets(list.subList(1, list.size()), alreadyTargeted, outputList);\n alreadyTargeted.remove(alreadyTargeted.size() - 1);\n }\n }", "@Override\n public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {\n \n }", "public int threeSumClosest(int[] nums, int target) {\n\t\tArrays.sort(nums);\n\t\tif (nums.length < 3)\n\t\t\treturn -1;\n\t\tint n = nums.length;\n\t\tint result = 0;\n\t\tint diff = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tint l = i + 1;\n\t\t\tint h = n - 1;\n\t\t\twhile (l < h) {\n\t\t\t\tint value = nums[i] + nums[l] + nums[h];\n\t\t\t\tif (value == target)\n\t\t\t\t\treturn target;\n\t\t\t\tif (value > target) {\n\t\t\t\t\th--;\n\t\t\t\t} else {\n\t\t\t\t\tl++;\n\t\t\t\t}\n\t\t\t\tif (Math.abs(value - target) < Math.abs(diff)) {\n\t\t\t\t\tresult = value;\n\t\t\t\t\tdiff = value - target;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "@SuppressWarnings(\"unlikely-arg-type\")\n\tpublic int minCost(List<String> lines, String source, String target, int k) {\n\t\t\n\t\tMap<String, Map<String, Integer>> map = new HashMap<String, Map<String, Integer>>();\n\t\tfor (String line : lines) {\n\t\t\tString[] s = line.trim().split(\",\");\n\t\t\tString[] t = s[0].trim().split(\"->\");\n\t\t\t\n\t\t\tString from = t[0];\n\t\t\tString to = t[1];\n\t\t\tint cost = Integer.valueOf(s[1].trim());\n\t\t\t\n\t\t\tmap.putIfAbsent(from, new HashMap<String, Integer>());\n\t\t\tmap.putIfAbsent(to, new HashMap<String, Integer>());\n\t\t\t\n\t\t\tmap.get(from).put(to, cost);\n\t\t}\n\t\t\n\t\tint min = Integer.MAX_VALUE, stop = 0;\n\t\tQueue<Node> q = new LinkedList<Node>();\n\t\tq.add(new Node(source, 0));\n\t\t\n\t\twhile (!q.isEmpty()) {\n\t\t\tif (stop > k) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tint size = q.size();\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\tNode cur = q.poll();\n\t\t\t\tString dest = cur.dest;\n\t\t\t\tint currCost = cur.minCost;\n\t\t\t\t\n\t\t\t\tif (dest.equals(target)) {\n\t\t\t\t\tmin = Math.min(min, currCost);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (String next : map.get(dest).keySet()) {\n\t\t\t\t\tint nextCost = currCost + map.get(dest).get(next);\n\t\t\t\t\t//if (nextCost <= min) {\n\t\t\t\t\t\tq.add(new Node(next, nextCost));\n\t\t\t\t\t//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tstop++;\n\t\t}\n\t\t\n\t\treturn min != Integer.MAX_VALUE ? min : -1;\n\t}", "private static int getHeuristic(MazeState current, HashSet<MazeState> goals) {\n\t\tint lowestCost = Integer.MAX_VALUE;\n\t\tint currentCost = 0;\n\t\tfor (MazeState goal : goals) {\n\t\t\tcurrentCost = Math.abs(current.col - goal.col) + Math.abs(current.row - goal.row);\n\t\t\tif (currentCost <= lowestCost) {\n\t\t\t\tlowestCost = currentCost;\n\t\t\t}\n\t\t}\n\t\treturn currentCost;\n\t}", "private MovingEntity nextTarget(MovingEntity currTarget, ArrayList<MovingEntity> availableTargets, ArrayList <MovingEntity> battlers){\n int currIndex = availableTargets.indexOf(currTarget);\n\n if (currTarget.getCurrHP() > 0) {\n return currTarget;\n }\n\n // currTarget is now dead, remove from availableTargets and battlers\n availableTargets.remove(currTarget);\n battlers.remove(currTarget);\n \n if(currIndex < availableTargets.size()){\n System.out.println(currTarget.getID() + \" is dead, moving on to next target is \" + availableTargets.get(currIndex).getID());\n return availableTargets.get(currIndex);\n } else {\n return null;\n }\n }" ]
[ "0.6241609", "0.61127067", "0.60999435", "0.60665977", "0.60554856", "0.59103924", "0.5898972", "0.5812612", "0.57561505", "0.5731103", "0.5724341", "0.5631864", "0.55837995", "0.55595064", "0.55471367", "0.55320007", "0.5476772", "0.5464031", "0.5461966", "0.54140544", "0.53949326", "0.5384394", "0.53806055", "0.53294915", "0.532421", "0.53176457", "0.5313862", "0.5312007", "0.52941006", "0.5259004", "0.52544737", "0.52464473", "0.52276736", "0.52247983", "0.5221935", "0.52183515", "0.5217327", "0.521329", "0.5196847", "0.51646733", "0.5131497", "0.5131055", "0.5097692", "0.5091842", "0.5086675", "0.50845605", "0.5079201", "0.50670123", "0.50543696", "0.50417143", "0.5041008", "0.50381076", "0.5034666", "0.50336903", "0.50231445", "0.50214756", "0.5017041", "0.50086975", "0.5006349", "0.49978393", "0.49726278", "0.4960543", "0.49580687", "0.4949484", "0.4947663", "0.4935413", "0.49265048", "0.49185842", "0.49184337", "0.49152216", "0.4912479", "0.49110663", "0.48960567", "0.48937586", "0.48844746", "0.48829487", "0.48794818", "0.48754463", "0.4874311", "0.487055", "0.48695013", "0.48596805", "0.48588032", "0.48538175", "0.48445907", "0.4831531", "0.48303625", "0.48133364", "0.48132938", "0.48132774", "0.48088965", "0.4806244", "0.48037425", "0.480007", "0.47972268", "0.47938484", "0.4781935", "0.4779816", "0.4773461", "0.47716653" ]
0.62716204
0
Calculates different parameters for a target such as distance of the target to nearest refuge, distance of target to this agent partitions, distance of this agent to the target and situations of the target based on its BRD and DMG
private void calculateDecisionParameters(Set<StandardEntity> victims, Map<EntityID, AmbulanceTarget> targetsMap) { AmbulanceTarget target; Human human; if (victims != null && !victims.isEmpty()) { for (StandardEntity victim : victims) { target = targetsMap.get(victim.getID()); human = (Human) worldInfo.getEntity(victim.getID()); if (target == null) { //creating a new AmbulanceTarget object target = new AmbulanceTarget(victim.getID()); //set target position target.setPositionID(human.getPosition()); //euclidean distance from this victim to the nearest refuge target.setDistanceToRefuge(worldInfo.getDistance(human.getPosition(), findNearestRefuge(human.getPosition()))); target.setDistanceToPartition(Util.distance(victim.getLocation(worldInfo.getRawWorld()), clusterCenterMap.get(this.clusterIndex))); } //euclidean distance from this victim to the me target.setDistanceToMe(computingDistance(human)); target.setVictimSituation(calculateVictimProfitability(human)); targetsMap.put(victim.getID(), target); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getDistanceToTarget() {\n if (!Config.isVisionInstalled) {\n return 0;\n }\n double distanceToVisionTarget =\n Config.visionDistanceConstant * (Config.fieldVisionTargetHeight-Config.limelightMountingHeight) /\n Math.tan(Math.toRadians(limelight.getTy() + Config.limelightMountingAngle));\n\n //now we can convert the new values into a new distance\n return distanceToVisionTarget;\n }", "private void setTargetCosts(){\n\t\t//Check which targets that are inside of this building\n\t\tfor(LinkedList<Node> list : targets){\n\t\t\tfor(Node node : list){\n\t\t\t\t//Make a walkable square at the position so that the target is reachable\n\t\t\t\tfor(int k = node.getXPos()-PedestriansSimulator.PEDESTRIAN_RADIUS; k < node.getXPos()+PedestriansSimulator.PEDESTRIAN_RADIUS; k++) {\n\t\t\t\t\tif(Math.round(scaleCollision * k) >= 0 && Math.round(scaleCollision * k) < COLLISION_ROWS){\n\t\t\t\t\t\tfor(int l = node.getYPos()-PedestriansSimulator.PEDESTRIAN_RADIUS; l < node.getYPos()+PedestriansSimulator.PEDESTRIAN_RADIUS; l++) {\n\t\t\t\t\t\t\tif(Math.round(scaleCollision * l) >= 0 && Math.round(scaleCollision * l) < COLLISION_ROWS){\n\t\t\t\t\t\t\t\tcollisionMatrix[Math.round(scaleCollision * k)][Math.round(scaleCollision * l)] = FOOTWAY_COST;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public double getEstimatedDistanceToTarget() {\n return estimatedDistanceToTarget;\n }", "public float getDistanceTo(DoGMaximum target)\n \t{\n \t\tif (target == null)\n \t\t\treturn Float.NaN;\n \t\t\n \t\tfloat difference = 0;\n \t\t\n\t\tdifference += Math.pow(this.x - target.x,2); \n\t\tdifference += Math.pow(this.y - target.y,2);\n\t\tdifference += Math.pow(this.z - target.z,2);\n\t\tdifference += Math.pow(this.sigma - target.sigma,2); \t\t\n \t\t\n\t\treturn (float)Math.sqrt(difference);\n \t}", "double treeNodeTargetFunctionValue(){\n\t\t\t//loop counter variable\n\t\t\tint i;\n\t\t\t\n\t\t\t//stores the cost\n\t\t\tdouble sum = 0.0;\n\n\t\t\tfor(i=0; i<this.n; i++){\n\t\t\t\t//stores the distance\n\t\t\t\tdouble distance = 0.0;\n\n\t\t\t\t//loop counter variable\n\t\t\t\tint l;\n\n\t\t\t\tfor(l=0;l<this.points[i].dimension;l++){\n\t\t\t\t\t//centroid coordinate of the point\n\t\t\t\t\tdouble centroidCoordinatePoint;\n\t\t\t\t\tif(this.points[i].weight != 0.0){\n\t\t\t\t\t\tcentroidCoordinatePoint = this.points[i].coordinates[l] / this.points[i].weight;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcentroidCoordinatePoint = this.points[i].coordinates[l];\n\t\t\t\t\t}\n\t\t\t\t\t//centroid coordinate of the centre\n\t\t\t\t\tdouble centroidCoordinateCentre;\n\t\t\t\t\tif(this.centre.weight != 0.0){\n\t\t\t\t\t\tcentroidCoordinateCentre = this.centre.coordinates[l] / this.centre.weight;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcentroidCoordinateCentre = this.centre.coordinates[l];\n\t\t\t\t\t}\n\t\t\t\t\tdistance += (centroidCoordinatePoint-centroidCoordinateCentre) * \n\t\t\t\t\t\t\t(centroidCoordinatePoint-centroidCoordinateCentre) ;\n\t\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tsum += distance*this.points[i].weight;\t\n\t\t\t}\n\t\t\treturn sum;\n\t\t}", "private double getDistance(double initX, double initY, double targetX, double targetY) {\n\t\treturn Math.sqrt(Math.pow((initX - targetX), 2) + Math.pow((initY - targetY), 2));\n\t}", "@SuppressWarnings(\"unchecked\")\n\tpublic double getTargetHeight(Target t) {\n \tdouble h = 0;\n \tdouble T = 0, B = 0;\n\t\tArrayList<Integer> YLocal;\n\t\tArrayList<Integer> XLocal;\n\t\tArrayList<Integer> heightLocal;\n\t\tsynchronized(YLock){\n\t\t\tYLocal = (ArrayList<Integer>) Y.clone();\n\t\t}\n\t\t\n\t\tsynchronized(XLock){\n\t\t\tXLocal = (ArrayList<Integer>) X.clone();\n\t\t}\n\t\t\n\t\tsynchronized(heightLock){\n\t\t\theightLocal = (ArrayList<Integer>) Y.clone();\n\t\t}\n\t\t\n \tif (targets.length > 1) {\n \t\tfor (int i = 0; i < targets.length; i++) {\n \t\t\tswitch (t) {\n \t\t\tcase Boiler:\n \t\t\t\t//TODO: Fix this stuff\n \t\t\t\tbreak;\n \t\t\tcase Gear:\n \t\t\t\tif (Math.abs(XLocal.get(i) - XLocal.get(i+1)) <= 5) {\n \t\t\t\t\tT = (YLocal.get(targets[i]) + heightLocal.get(targets[i]) / 2);\n \t\t\t\t\tB = (YLocal.get(targets[i+1]) + heightLocal.get(targets[i+1]) / 2);\n \t\t\t\t} else if (Math.abs(XLocal.get(i+1) - XLocal.get(i+2)) <= 5) {\n \t\t\t\t\tT = (YLocal.get(targets[i]) + heightLocal.get(targets[i]) / 2);\n \t\t\t\t\tB = (YLocal.get(targets[i]) + heightLocal.get(targets[i]) / 2);\n \t\t\t\t} else {\n \t\t\t\t\treturn heightLocal.get(i);\n \t\t\t\t}\n \t\t\t\tbreak;\n \t\t\tdefault:\n \t\t\t}\n \t\t}\n \t}\n \th = T - B;\n\t\treturn h;\n }", "public void approachTargetWithVision() {\n final double STEER_P = 0.005; \n final double DRIVE_P = 0.05; \n final double DESIRED_TARGET_AREA = 4; // Area of the target when the robot reaches the wall\n final double MAX_DRIVE = 0.75; // Simple speed limit so we don't drive too fast\n final double STEER_I = 0.005;\n final double DRIVE_I = 0.0;\n final double STEER_D = 0.02;\n final double xError;\n final double aError;\n double DRIVE_INTEGRAL = 0;\n\n \n\n double tv = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"tv\").getDouble(0);\n double tx = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"tx\").getDouble(0);\n double ta = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"ta\").getDouble(0);\n xError = tx;\n aError = (DESIRED_TARGET_AREA - ta);\n // SmartDashboard.putNumber(\"TA\", ta);\n // SmartDashboard.putNumber(\"TA Error\", aError);\n SmartDashboard.putNumber(\"TX Error\", xError);\n STEER_INTEGRAL = STEER_INTEGRAL + (xError*0.02);\n DRIVE_INTEGRAL = DRIVE_INTEGRAL + (aError * 0.02);\n STEER_DERIVATIVE = (xError - STEER_ERROR_PRIOR)/0.02;\n SmartDashboard.putNumber(\"Integral\", STEER_INTEGRAL);\n SmartDashboard.putNumber(\"Derivative\", STEER_DERIVATIVE);\n SmartDashboard.putNumber(\"TA\", ta);\n\n\n if (tv < 1.0) {\n m_LimelightHasValidTarget = false;\n drive_cmd = 0.0;\n steer_cmd = 0.0;\n } else {\n m_LimelightHasValidTarget = true;\n // Start with proportional steering\n steer_cmd = (xError * STEER_P) + (STEER_INTEGRAL * STEER_I) + (STEER_DERIVATIVE * STEER_D);\n\n // try to drive forward until the target area reaches our desired area\n drive_cmd = (aError * DRIVE_P) + (DRIVE_INTEGRAL * DRIVE_I);\n // don't let the robot drive too fast into the goal\n if (drive_cmd > MAX_DRIVE){\n drive_cmd = MAX_DRIVE;\n }\n }\n\n Robot.driveTrain.setLeftMotors(-drive_cmd - steer_cmd);\n Robot.driveTrain.setRightMotors(-drive_cmd + steer_cmd);\n\n STEER_ERROR_PRIOR = xError;\n\n }", "private void sendBestTargetReport()\n {\n // define arrays (just of the bestTarget and a vertical bar so length 2)\n double[] centerXs = new double[2];\n double[] centerYs = new double[2];\n //double[] areas = new double[2];\n double[] widths = new double[2];\n double[] heights = new double[2];\n \n // send currentBestTarget if it exists\n if (currentBestTarget != null)\n {\n\t // set props of bestTarget\n\t centerXs[0] = currentBestTarget.centerX;\n\t centerYs[0] = currentBestTarget.centerY;\n\t //areas[0]\n\t widths[0] = currentBestTarget.width;\n\t heights[0] = currentBestTarget.height;\n }\n \n // create artificial target to display center bar\n centerXs[1] = IMAGE_WIDTH/2;\n centerYs[1] = IMAGE_HEIGHT/2;\n widths[1] = 10;\n heights[1] = IMAGE_HEIGHT;\n \n // send info\n Robot.targetSendingTable.putNumberArray(\"centerX\", centerXs);\n Robot.targetSendingTable.putNumberArray(\"centerY\", centerYs);\n //Robot.targetSendingTable.putNumberArray(\"area\", areas);\n Robot.targetSendingTable.putNumberArray(\"width\", widths);\n Robot.targetSendingTable.putNumberArray(\"height\", heights);\n }", "public EntityID nextTarget(Set<StandardEntity> victims) {\n\n// Clustering clustering = this.moduleManager.getModule(SampleModuleKey.AMBULANCE_MODULE_CLUSTERING);\n\n// if (this.clusterIndex == -1) {\n this.clusterIndex = clustering.getClusterIndex(this.agentInfo.getID());\n// }\n\n\n Collection<StandardEntity> elements = clustering.getClusterEntities(this.clusterIndex);\n\n calculateMapCenters(this.clusterIndex, elements);\n\n\n targetsMap.clear();\n\n if (previousTarget != null && !victims.contains(worldInfo.getEntity(previousTarget.getVictimID()))) {\n previousTarget = null;\n }\n\n\n refreshTargetsMap(victims, targetsMap);\n\n calculateDecisionParameters(victims, targetsMap);\n\n calculateVictimsCostValue();\n\n\n AmbulanceTarget bestTarget = null;\n bestTarget = findBestVictim(targetsMap, elements);\n\n //considering inertia for the current target to prevent loop in target selection\n if (previousTarget != null && victims.contains(worldInfo.getEntity(previousTarget.getVictimID()))) {\n if (bestTarget != null && !bestTarget.getVictimID().equals(previousTarget.getVictimID())) {\n Human bestHuman = (Human) worldInfo.getEntity(bestTarget.getVictimID());\n Human previousHuman = (Human) worldInfo.getEntity(previousTarget.getVictimID());\n\n double bestHumanCost = pathPlanning.setFrom(agentInfo.getPosition()).setDestination(bestHuman.getPosition()).calc().getDistance();\n double previousHumanCost = pathPlanning.setFrom(agentInfo.getPosition()).setDestination(previousHuman.getPosition()).calc().getDistance();\n if (previousHumanCost < bestHumanCost) {\n bestTarget = previousTarget;\n }\n }\n }\n\n previousTarget = bestTarget;\n\n if (bestTarget != null) {\n return bestTarget.getVictimID();\n } else {\n return null;\n }\n\n }", "private double getRangeToTarget(TargetReport target)\n\t{\n\t\tif (target != null)\n\t\t{\n\t\t\t// chose to use height because most consistent across view angles\n\t\t\t// d = TargetHeightFeet*FOVHeightPixel / (2*TargetHeightPixel*tan(FOV/2) ) (HYPOTENUSE)\n\t\t\treturn TARGET_HEIGHT*IMAGE_HEIGHT / (2*target.height*Math.tan(Math.toRadians(CAMERA_FOV/2)))\n\t\t\t\t\t*Math.cos(Math.toRadians(CAMERA_ELEVATION)); // convert to horizontal\n\t\t}\n\t\telse\n\t\t\treturn 0;\n\t}", "public double[] getTargetDistanceFromCenter()\n\t{\n\t\t// watch for no valid target, in which case give no displacement\n\t\tdouble[] distance = new double[2];\n\t\tif (currentBestTarget != null)\n\t\t{\n\t\t\t// x increases to right, but y increased downwards, so invert y\n\t\t\tdistance[0] = (currentBestTarget.centerX - IMAGE_WIDTH/2.0 ) / (IMAGE_WIDTH/2);\n\t\t\tdistance[1] = -(currentBestTarget.centerY - IMAGE_HEIGHT/2.0) / (IMAGE_HEIGHT/2);\n\t\t}\n\t\treturn distance;\n\t}", "private double getDistance() {\n\t\tfinal double h2 = 86.7;\n\t\t// h1: height of top of camera\n\t\tfinal double h1 = 17.6;\n\n\t\t// a1: angle of camera (relative to chasis)\n\t\tfinal double a1 = 36.175;\n\t\t// a2: angle of target relative to a1\n\t\tfinal double a2 = ty.getDouble(0.0);\n\n\t\t// distance: distance from camera to base of target\n\t\tfinal double distance = ((h2 - h1) / Math.tan(Math.toRadians(a1 + a2)));\n\n\t\tfinal double d = Math.sqrt(Math.pow(h2 - h1, 2) + Math.pow(distance, 2));\n\t\tSmartDashboard.putNumber(\"Py Distance\", d);\n\n\t\treturn (distance);\n\n\t}", "@Override\n\tpublic double getFinalBestTargetValue() {\n\t\treturn 0;\n\t}", "private static int predictDistance(Position source, Position target) {\n int x = source.getX() - target.getX();\n int y = source.getY() - target.getY();\n int c = (int)Math.ceil(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));\n return c;\n }", "public TargetReport retrieveBestTarget()\n\t{\n\t\t// get targets...\n\t\tgetTargetReports(allTargets);\n//\t\tSystem.out.println(\"All Targets: \" + allTargets);\n\t\t\n\t\t// and find the best one\n\t\tTargetReport bestTarget = null;\n\t\tdouble bestScore = 0;\n\t\tfor (TargetReport target : allTargets)\n\t\t{\n\t\t\t// Eliminate targets based on range\n\t\t\tdouble targetRange = getRangeToTarget(target);\n\t\t\tif (targetRange > MAX_REASONABLE_RANGE || targetRange < MIN_REASONABLE_RANGE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// When DRIVERS are lining up, eliminate based on the assumption that the target is aligned.\n\t\t\t// (targetCloseToCenter is set to true during teleop, because we would expect it to be with human drivers)\n\t\t\tif (targetCloseToCenter && Math.abs(target.centerX - IMAGE_WIDTH / 2) > CENTER_ZONE_SIZE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// add score for distance from throttle-based guess\n\t\t\tguessedRange = MAX_REASONABLE_RANGE*0.5*(-Robot.oi.UtilStick.getThrottle() + 1);\n\t\t\tif (Math.abs(guessedRange) > 0.01)\n\t\t\t{\n\t\t\t\t// give a bunch of weight (see TargetReport) based on closesness to guessedRange\n\t\t\t\ttarget.addScoreFromDistance(guessedRange, targetRange);\n\t\t\t\t\n\t\t\t\t// highly prioritize a target close to a guess (this basically overrides the above line...)\n\t\t\t\tif (Math.abs(guessedRange - targetRange) < GUESS_ACCURACY_TOLERANCE)\n\t\t\t\t{\n\t\t\t\t\tbestTarget = target;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// if a target is better than the best, it's now the best\n\t\t\tif (target.getCumulativeScore() > bestScore)\n\t\t\t{\n\t\t\t\tbestTarget = target;\n\t\t\t\tbestScore = target.getCumulativeScore();\n\t\t\t}\n\t\t}\n\t\tallTargets.clear(); // we thought this might have been taking up too much memory, so we cleared it once we were done with it. (It wasn't the issue)\n\t\t\n\t\t// determine if in launcher range to target and set notification based on this\n\t\tcurrentRangeToBestTarget = getRangeToBestTarget();\n\t\tif (Robot.launcherWheels.inRange(currentRangeToBestTarget))\n\t\t\tRobot.launcherstatus.setInRange();\n\t\telse\n\t\t\tRobot.launcherstatus.setOutOfRange();\n\n\t\t// if we've found one, cache and return it\n\t\t// otherwise, return null (it will just default to the first value of bestTarget)\n\t\tcurrentBestTarget = bestTarget;\n\t\t\n\t\t// ALSO, report bestTarget to Driver station\n//\t\tsendBestTargetReport(); // Didn't work, see below\n\t\t\n// \tSystem.out.println(currentBestTarget);\n\t\t\n\t\treturn bestTarget;\n\t}", "public double getDist(){\n double dist=0;\n double DA = 0;\n double minDist = this.getMotors()[0].getTargetPosition();\n for(int i =0;i<this.getMotors().length;i++) {\n double current = this.getMotors()[i].getCurrentPosition();\n double target = this.getMotors()[i].getTargetPosition();\n DA = Math.abs(target) - Math.abs(current);\n dist = target - current;\n if(Math.abs(DA)<Math.abs(minDist)){\n minDist = dist;\n }\n }\n return (minDist);\n }", "private TrackingResult followTarget(Rect target)\n\t{\n\t\t// Clear any existing target rectangle.\n\t\tcamera.addTarget(null);\n\t\t\n\t\t// Outline the target being tracked.\n\t\tcamera.addTarget(target);\n\t\t\n\t\t// This is field of view size.\n\t\tSize imageSize = camera.getImageSize();\n\t\t\n\t\t// get size of target outline area.\n\t\tint targetArea = target.height * target.width;\n\t\t\n\t\t// If we have just acquired target, record initial size. Size comparison\n\t\t// is how we determine distance to target.\n\t\t\n\t\tif (initialTargetArea == 0) initialTargetArea = targetArea;\n\t\t\n\t\t// Compute center point of target in the camera view image.\n\t\tint targetCenterX = target.x + target.width / 2;\n\t\tint imageCenterX = (int) (imageSize.width / 2);\n\t\t\n\t\t// offset minus indicates target is left of image center,\n\t\t// plus to the right. If target is left, drone needs to turn\n\t\t// left to center the target in the image which is a minus yaw value.\n\t\t\n\t\tint offset = targetCenterX - imageCenterX;\n\n\t\tlogger.fine(\"offset=\" + offset);\n\t\t\n\t\toffset *= .25;\t// Scale offset down;\n\t\t\n\t\t// Determine change in distance from last target acquisition.\n\t\t\n\t\tdouble distance = initialTargetArea - targetArea;\n\t\t\n\t\tlogger.fine(String.format(\"ia=%d ta=%d dist=%.0f\", initialTargetArea, targetArea, distance));\n\t\t\n\t\t//initialTargetArea = targetArea;\n\t\t\n\t\tdouble scaleFactor = 0.0;\n\t\t\n\t\t// If distance is small, call it good otherwise the drone\n\t\t// hunts back and forth. Value must be determined by testing.\n\t\t\n\t\tif (Math.abs(distance) < 2000.0) \n\t\t\tdistance = 0.0;\n\t\telse\n\t\t{\n\t\t\t// Scale distance change to a fwd/back movement value of 20% for flyRC command.\n\t\t\t// For some unknown reason, need more power to fly forward than back and even\n\t\t\t// with 30%, forward seems not reliable.\n\t\t\t// scaleFactor must be positive to preserve the sign of distance value.\n\t\t\t\n\t\t\tscaleFactor = 20.0 / Math.abs(distance);\n\t\t\n\t\t\tdistance = distance * scaleFactor;\n\t\t}\n\t\t\n\t\tlogger.fine(String.format(\"dist=%.1f fact=%f\", distance, scaleFactor));\n\t\t\n\t\treturn new TrackingResult(offset, (int) distance);\n\t}", "double estimatedDistanceToGoal(Vertex s, Vertex goal);", "private void updateDesiredDirection() {\n\t\t/* http://www.cs.mcgill.ca/~hsafad/robotics/, accessed 28/02/16 */\n\n\t\t// First, set all seen bots' charge to -VE, all on LEDs to +VE, all off LEDs to 0.0D\n\t\tpopulateCharges();\n\t\t\n\t\t// VARIABLES\n\t\tdouble dirX = 0.0D; // relative dirX and dirY that the bot will need to face\n\t\tdouble dirY = 0.0D; \n\t\tdouble dx = 0.0D;\t// used to calculate each push/pull force, added to dirX, dirY\n\t\tdouble dy = 0.0D;\n\t\tdouble targetCharge = 0.0D;\t// charge of current target bot / led\n\t\tdouble minS = 50;\n\t\tdouble distSq = 0.0D;\t// distance^2 to bot/led\n\t\tdouble safety = 0.0D;\n\t\tdouble norm = 0.0D;\n\t\t\n\t\tfor (int i = 0; i < seenCharges.size(); i++) {\n\t\t\ttry {\n\t\t\t\t\n\t\t\t\t// now, update direction depending on charges\n\t\t\t\tif (seenCharges.get(i) instanceof Bot) {\n\t\t\t\t\t\t\n\t\t\t\t\ttargetCharge = ((Bot) seenCharges.get(i)).getCharge();\n\t\t\t\t\tdistSq = sens.getDistanceTo((Bot) seenCharges.get(i));\n\t\t\t\t\tdistSq = distSq * distSq;\n\t\t\t\t\t\n\t\t\t\t\t// calculated forces\n\t\t\t\t\tdx = targetCharge * (((Bot) seenCharges.get(i)).getX() - this.getX()) / distSq;\n\t\t\t\t\tdy = targetCharge * (((Bot) seenCharges.get(i)).getY() - this.getY()) / distSq;\n\n\t\t\t\t\t// add calculated forces to overall direction so far\n\t\t\t\t\tdirX += dx;\n\t\t\t\t\tdirY += dy;\n\t\t\t\t\t\n\t\t\t\t\tsafety = distSq / ((dx*dirX + dy*dirY));\n\t\t\t\t\tif ((safety > 0) && (safety < minS)) { minS = safety; }\n\t\t\t\t\t\t\n\t\t\t\t} else if ((seenCharges.get(i) instanceof LED)) {\n\t\t\t\t\n\t\t\t\t\ttargetCharge = ((LED) seenCharges.get(i)).getCharge();\n\t\t\t\t\t\n\t\t\t\t\tif (targetCharge != 0.0D) { \n\t\t\t\t\t\t\n\t\t\t\t\t\tdistSq = sens.getDistanceTo((LED) seenCharges.get(i));\n\t\t\t\t\t\tdistSq = distSq * distSq;\n\n\t\t\t\t\t\t// calculated forces\n\t\t\t\t\t\tdx = targetCharge * (((LED) seenCharges.get(i)).getTargetX() - this.getX()) / distSq;\n\t\t\t\t\t\tdy = targetCharge * (((LED) seenCharges.get(i)).getTargetY() - this.getY()) / distSq;\n\t\t\t\t\t\t\n\t\t\t\t\t\t// add calculated forces to overall direction so far\n\t\t\t\t\t\tdirX += dx;\n\t\t\t\t\t\tdirY += dy;\n\t\t\t\t\t\t\n\t\t\t\t\t\tsafety = distSq / ((dx*dirX + dy*dirY));\n\t\t\t\t\t\tif ((safety > 0) && (safety < minS)) { minS = safety; }\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (minS < 5) {\n\t\t\t\t\t\t\ttargetCharge *= minS/5;\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t \n\t\t\t\t\t\tif (minS > 50) {\n\t\t\t\t\t\t\ttargetCharge *= minS/50;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"ERROR: unknown seenCharges item \"+i);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t\t// calculate vector normal, apply to dirX, dirY\n\t\tnorm = Math.sqrt(dirX*dirX + dirY*dirY);\n\t\tdirX = dirX / norm;\n\t\tdirY = dirY / norm;\n\t\t\n\t\t// set desired direction if it calculates a number\n\t\tif (dirX == (double) dirX && dirY == (double) dirY) {\n\t\t\tthis.setDesiredDirection(sens.getDirectionTo(dirX + sens.getXPos(), dirY + sens.getYPos()));\n\t\t}\n\t}", "@Override\n\tpublic double getBestTargetValue() {\n\t\treturn 0;\n\t}", "@Override\n public int estimatedDistanceToGoal() {\n return manhattan();\n }", "public float distanceToTarget(Vector2 target) {\r\n\t\tdouble underRoot = Math.pow(target.y() - position.y(), 2) + Math.pow(target.x() - position.x(), 2);\r\n\t\treturn (float)Math.sqrt(underRoot);\r\n\t}", "public void setEstimatedDistanceToTarget(double estimatedDistanceToTarget) {\n this.estimatedDistanceToTarget = estimatedDistanceToTarget;\n }", "void calculate_distance()\n {\n \t\n \tfor(int i = 0; i<V ; i++)\n \t{\n \t\tfor(int j = 0; j<E ; j++)\n \t\t{\n \t\t\trelax(edge[j].src, edge[j].destination, edge[j].weight);\n \t\t}\n \t\tsp[i] = dist[i];\n \t\tx[i] = dist[i];\n \t}\n \tSystem.out.println();\n }", "@Override\n public void execute() {\n double forwardSpeed;\n double rotationSpeed;\n\n // Vision-alignment mode\n // Query the latest result from PhotonVision\n double target = RobotContainer.m_Drive.Get_tv();\n\n if (target != 0.0f) {\n // First calculate range\n double range =\n PhotonUtils.calculateDistanceToTargetMeters(\n CAMERA_HEIGHT_METERS,\n TARGET_HEIGHT_METERS,\n CAMERA_PITCH_RADIANS,\n Units.degreesToRadians(RobotContainer.m_Drive.Get_ty()));\n SmartDashboard.putNumber(\"range\", range);\n // Use this range as the measurement we give to the PID controller.\n // -1.0 required to ensure positive PID controller effort _increases_ range\n if(RobotContainer.m_Drive.Get_ty()<-1){\n forwardSpeed = 1.0 * forwardController.calculate(range, GOAL_RANGE_METERS);;\n }\n else if(RobotContainer.m_Drive.Get_ty() > 1){\n forwardSpeed = -1.0 * forwardController.calculate(range, GOAL_RANGE_METERS);\n }\n else{\n forwardSpeed = 0;\n }\n\n\n // Also calculate angular power\n // -1.0 required to ensure positive PID controller effort _increases_ yaw\n rotationSpeed = -1.0 * turnController.calculate(RobotContainer.m_Drive.Get_tx(), 0);\n } else {\n // If we have no targets, stay still.\n forwardSpeed = 0;\n rotationSpeed = 0;\n } \n // Use our forward/turn speeds to control the drivetrain\n Robot.hardware.m_diffDrive.arcadeDrive(forwardSpeed,rotationSpeed);\n }", "public static double calculate(String target) {return calculate(target, true); }", "public Target()\n\t{\n\t\tx = 2.0;\n\t\ty = 2.0;\n\t\tangle = 0.0;\n\t\tdistance = 0.0;\n\t\tnullTarget=true;\n\t}", "private double calculateDistance(int sourceX, int sourceY, int targetX, int targetY){\n int xLength = targetX - sourceX;\n int yLength = targetY - sourceY;\n return Math.sqrt((xLength*xLength)+(yLength*yLength)); \n }", "@Test\n\t\t\tpublic void testTargetOneStep()\n\t\t\t{\n\t\t\t\t//Test one step and check for the right space\n\t\t\t\tboard.calcTargets(0, 7, 1);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(1, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(1, 7)));\n\n\t\t\t\t// Test one step near a door with the incorrect direction\n\t\t\t\tboard.calcTargets(13, 6, 1);\n\t\t\t\ttargets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(3, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(14, 6)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 5)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 7)));\n\t\t\t\t\n\t\t\t\t\n\t\t\t}", "private void calculateGlobals() {\n if (!edge.getIncomingLinks().isEmpty()) {\n this.source = edge.getIncomingLinks().get(0);\n } else\n throw new RuntimeException(\"edge hs no source : \" + edge.getId());\n if (!edge.getOutgoingLinks().isEmpty()) {\n this.target = edge.getOutgoingLinks().get(0);\n } else\n throw new RuntimeException(\"edge hs no target : \" + edge.getId());\n\n this.sourceGeometry = source.getGeometry();\n this.targetGeometry = target.getGeometry();\n\n // get relative centers of elements\n this.sourceRelativCenterX = this.sourceGeometry.getWidth() / 2;\n this.sourceRelativCenterY = this.sourceGeometry.getHeight() / 2;\n this.targetRelativCenterX = this.targetGeometry.getWidth() / 2;\n this.targetRelativCenterY = this.targetGeometry.getHeight() / 2;\n\n // get parent adjustments\n double sourceParentAdjustmentX = 0;\n double sourceParentAdjustmentY = 0;\n LayoutingElement parent = this.source.getParent();\n while (parent != null) {\n sourceParentAdjustmentX += parent.getGeometry().getX();\n sourceParentAdjustmentY += parent.getGeometry().getY();\n parent = parent.getParent();\n }\n\n double targetParentAdjustmentX = 0;\n double targetParentAdjustmentY = 0;\n parent = this.target.getParent();\n while (parent != null) {\n targetParentAdjustmentX += parent.getGeometry().getX();\n targetParentAdjustmentY += parent.getGeometry().getY();\n parent = parent.getParent();\n }\n\n // get absolute coordinates\n double sourceAbsoluteX = this.sourceGeometry.getX() + sourceParentAdjustmentX;\n this.sourceAbsoluteY = this.sourceGeometry.getY() + sourceParentAdjustmentY;\n this.sourceAbsoluteX2 = this.sourceGeometry.getX2() + sourceParentAdjustmentX;\n this.sourceAbsoluteY2 = this.sourceGeometry.getY2() + sourceParentAdjustmentY;\n\n this.targetAbsoluteX = this.targetGeometry.getX() + targetParentAdjustmentX;\n this.targetAbsoluteY = this.targetGeometry.getY() + targetParentAdjustmentY;\n this.targetAbsoluteY2 = this.targetGeometry.getY2() + targetParentAdjustmentY;\n\n this.sourceAbsoluteCenterX = sourceAbsoluteX + this.sourceRelativCenterX;\n this.sourceAbsoluteCenterY = this.sourceAbsoluteY + this.sourceRelativCenterY;\n this.targetAbsoluteCenterX = this.targetAbsoluteX + this.targetRelativCenterX;\n this.targetAbsoluteCenterY = this.targetAbsoluteY + this.targetRelativCenterY;\n\n // layout hints\n this.sourceJoin = this.source.isJoin();\n this.sourceSplit = this.source.isSplit();\n this.targetJoin = this.target.isJoin();\n this.target.isSplit();\n this.backwards = this.sourceAbsoluteCenterX > this.targetAbsoluteCenterX;\n }", "public static void driveDistance(double targetLeft, double targetRight) {\n\n leftMotorA.set(ControlMode.MotionMagic, targetLeft);\n rightMotorA.set(ControlMode.MotionMagic, targetRight);\n\n }", "@Override\n public void init()\n {\n target.setAbsoluteTolerance(ANGLE_ABSOLUTE_TOLERANCE); // Configure the target's absolute tolerance\n /*\n Limit the speed on the target between these values to prevent overshooting and damage to motors\n Normally we would leave the output range without bounds because we wish for the end affector to reach the setpoint\n as fast as possible, in a constant time, which would mean having an output proportional to it's error, but in this case\n We don't care how long it takes to reach its target, we just want it to get there in one piece */\n //System.out.println(\"INITIALIZING PID CONTROL\");\n target.setOutputRange(-0.15, 0.15);\n\n /* load percent control in because output is simply a percentage */\n target.loadLeftController(\"percent\");\n target.loadRightController(\"percent\");\n }", "public static native double OpenMM_AmoebaVdwForce_getCutoffDistance(PointerByReference target);", "public void calculate(double[] theta) {\r\n dvModel.vectorToParams(theta);\r\n\r\n double localValue = 0.0;\r\n double[] localDerivative = new double[theta.length];\r\n\r\n TwoDimensionalMap<String, String, SimpleMatrix> binaryW_dfsG,binaryW_dfsB;\r\n binaryW_dfsG = TwoDimensionalMap.treeMap();\r\n binaryW_dfsB = TwoDimensionalMap.treeMap();\r\n TwoDimensionalMap<String, String, SimpleMatrix> binaryScoreDerivativesG,binaryScoreDerivativesB ;\r\n binaryScoreDerivativesG = TwoDimensionalMap.treeMap();\r\n binaryScoreDerivativesB = TwoDimensionalMap.treeMap();\r\n Map<String, SimpleMatrix> unaryW_dfsG,unaryW_dfsB ;\r\n unaryW_dfsG = new TreeMap<String, SimpleMatrix>();\r\n unaryW_dfsB = new TreeMap<String, SimpleMatrix>();\r\n Map<String, SimpleMatrix> unaryScoreDerivativesG,unaryScoreDerivativesB ;\r\n unaryScoreDerivativesG = new TreeMap<String, SimpleMatrix>();\r\n unaryScoreDerivativesB= new TreeMap<String, SimpleMatrix>();\r\n\r\n Map<String, SimpleMatrix> wordVectorDerivativesG = new TreeMap<String, SimpleMatrix>();\r\n Map<String, SimpleMatrix> wordVectorDerivativesB = new TreeMap<String, SimpleMatrix>();\r\n\r\n for (TwoDimensionalMap.Entry<String, String, SimpleMatrix> entry : dvModel.binaryTransform) {\r\n int numRows = entry.getValue().numRows();\r\n int numCols = entry.getValue().numCols();\r\n binaryW_dfsG.put(entry.getFirstKey(), entry.getSecondKey(), new SimpleMatrix(numRows, numCols));\r\n binaryW_dfsB.put(entry.getFirstKey(), entry.getSecondKey(), new SimpleMatrix(numRows, numCols));\r\n binaryScoreDerivativesG.put(entry.getFirstKey(), entry.getSecondKey(), new SimpleMatrix(1, numRows));\r\n binaryScoreDerivativesB.put(entry.getFirstKey(), entry.getSecondKey(), new SimpleMatrix(1, numRows));\r\n }\r\n for (Map.Entry<String, SimpleMatrix> entry : dvModel.unaryTransform.entrySet()) {\r\n int numRows = entry.getValue().numRows();\r\n int numCols = entry.getValue().numCols();\r\n unaryW_dfsG.put(entry.getKey(), new SimpleMatrix(numRows, numCols));\r\n unaryW_dfsB.put(entry.getKey(), new SimpleMatrix(numRows, numCols));\r\n unaryScoreDerivativesG.put(entry.getKey(), new SimpleMatrix(1, numRows));\r\n unaryScoreDerivativesB.put(entry.getKey(), new SimpleMatrix(1, numRows));\r\n }\r\n if (op.trainOptions.trainWordVectors) {\r\n for (Map.Entry<String, SimpleMatrix> entry : dvModel.wordVectors.entrySet()) {\r\n int numRows = entry.getValue().numRows();\r\n int numCols = entry.getValue().numCols();\r\n wordVectorDerivativesG.put(entry.getKey(), new SimpleMatrix(numRows, numCols));\r\n wordVectorDerivativesB.put(entry.getKey(), new SimpleMatrix(numRows, numCols));\r\n }\r\n }\r\n\r\n // Some optimization methods prints out a line without an end, so our\r\n // debugging statements are misaligned\r\n Timing scoreTiming = new Timing();\r\n scoreTiming.doing(\"Scoring trees\");\r\n int treeNum = 0;\r\n MulticoreWrapper<Tree, Pair<DeepTree, DeepTree>> wrapper = new MulticoreWrapper<Tree, Pair<DeepTree, DeepTree>>(op.trainOptions.trainingThreads, new ScoringProcessor());\r\n for (Tree tree : trainingBatch) {\r\n wrapper.put(tree);\r\n }\r\n wrapper.join();\r\n scoreTiming.done();\r\n while (wrapper.peek()) {\r\n Pair<DeepTree, DeepTree> result = wrapper.poll();\r\n DeepTree goldTree = result.first;\r\n DeepTree bestTree = result.second;\r\n\r\n StringBuilder treeDebugLine = new StringBuilder();\r\n Formatter formatter = new Formatter(treeDebugLine);\r\n boolean isDone = (Math.abs(bestTree.getScore() - goldTree.getScore()) <= 0.00001 || goldTree.getScore() > bestTree.getScore());\r\n String done = isDone ? \"done\" : \"\";\r\n formatter.format(\"Tree %6d Highest tree: %12.4f Correct tree: %12.4f %s\", treeNum, bestTree.getScore(), goldTree.getScore(), done);\r\n System.err.println(treeDebugLine.toString());\r\n if (!isDone){\r\n // if the gold tree is better than the best hypothesis tree by\r\n // a large enough margin, then the score difference will be 0\r\n // and we ignore the tree\r\n\r\n double valueDelta = bestTree.getScore() - goldTree.getScore();\r\n //double valueDelta = Math.max(0.0, - scoreGold + bestScore);\r\n localValue += valueDelta;\r\n\r\n // get the context words for this tree - should be the same\r\n // for either goldTree or bestTree\r\n List<String> words = getContextWords(goldTree.getTree());\r\n\r\n // The derivatives affected by this tree are only based on the\r\n // nodes present in this tree, eg not all matrix derivatives\r\n // will be affected by this tree\r\n backpropDerivative(goldTree.getTree(), words, goldTree.getVectors(),\r\n binaryW_dfsG, unaryW_dfsG,\r\n binaryScoreDerivativesG, unaryScoreDerivativesG,\r\n wordVectorDerivativesG);\r\n\r\n backpropDerivative(bestTree.getTree(), words, bestTree.getVectors(),\r\n binaryW_dfsB, unaryW_dfsB,\r\n binaryScoreDerivativesB, unaryScoreDerivativesB,\r\n wordVectorDerivativesB);\r\n\r\n }\r\n ++treeNum;\r\n }\r\n\r\n double[] localDerivativeGood;\r\n double[] localDerivativeB;\r\n if (op.trainOptions.trainWordVectors) {\r\n localDerivativeGood = NeuralUtils.paramsToVector(theta.length,\r\n binaryW_dfsG.valueIterator(), unaryW_dfsG.values().iterator(),\r\n binaryScoreDerivativesG.valueIterator(),\r\n unaryScoreDerivativesG.values().iterator(),\r\n wordVectorDerivativesG.values().iterator());\r\n\r\n localDerivativeB = NeuralUtils.paramsToVector(theta.length,\r\n binaryW_dfsB.valueIterator(), unaryW_dfsB.values().iterator(),\r\n binaryScoreDerivativesB.valueIterator(),\r\n unaryScoreDerivativesB.values().iterator(),\r\n wordVectorDerivativesB.values().iterator());\r\n } else {\r\n localDerivativeGood = NeuralUtils.paramsToVector(theta.length,\r\n binaryW_dfsG.valueIterator(), unaryW_dfsG.values().iterator(),\r\n binaryScoreDerivativesG.valueIterator(),\r\n unaryScoreDerivativesG.values().iterator());\r\n\r\n localDerivativeB = NeuralUtils.paramsToVector(theta.length,\r\n binaryW_dfsB.valueIterator(), unaryW_dfsB.values().iterator(),\r\n binaryScoreDerivativesB.valueIterator(),\r\n unaryScoreDerivativesB.values().iterator());\r\n }\r\n\r\n // correct - highest\r\n for (int i =0 ;i<localDerivativeGood.length;i++){\r\n localDerivative[i] = localDerivativeB[i] - localDerivativeGood[i];\r\n }\r\n\r\n // TODO: this is where we would combine multiple costs if we had parallelized the calculation\r\n value = localValue;\r\n derivative = localDerivative;\r\n\r\n // normalizing by training batch size\r\n value = (1.0/trainingBatch.size()) * value;\r\n ArrayMath.multiplyInPlace(derivative, (1.0/trainingBatch.size()));\r\n\r\n // add regularization to cost:\r\n double[] currentParams = dvModel.paramsToVector();\r\n double regCost = 0;\r\n for (int i = 0 ; i<currentParams.length;i++){\r\n regCost += currentParams[i] * currentParams[i];\r\n }\r\n regCost = op.trainOptions.regCost * 0.5 * regCost;\r\n value += regCost;\r\n // add regularization to gradient\r\n ArrayMath.multiplyInPlace(currentParams, op.trainOptions.regCost);\r\n ArrayMath.pairwiseAddInPlace(derivative, currentParams);\r\n\r\n }", "public TargetPointReport getTargetPoint(Translation robot) {\n TargetPointReport rv = new TargetPointReport();\n PathSegment currentSegment = segments.get(0);\n rv.closest_point = currentSegment.getClosestPoint(robot);\n rv.closest_point_distance = new Translation(robot, rv.closest_point).norm();\n rv.remaining_segment_distance = currentSegment.getRemainingDistance(rv.closest_point);\n rv.remaining_path_distance = rv.remaining_segment_distance;\n for (int i = 1; i < segments.size(); ++i) {\n rv.remaining_path_distance += segments.get(i).getLength();\n }\n rv.closest_point_speed = currentSegment\n .getSpeedByDistance(currentSegment.getLength() - rv.remaining_segment_distance);\n double lookahead_distance = getLookaheadForSpeed(rv.closest_point_speed) + rv.closest_point_distance;\n if (rv.remaining_segment_distance < lookahead_distance && segments.size() > 1) {\n lookahead_distance -= rv.remaining_segment_distance;\n for (int i = 1; i < segments.size(); ++i) {\n currentSegment = segments.get(i);\n final double length = currentSegment.getLength();\n if (length < lookahead_distance && i < segments.size() - 1) {\n lookahead_distance -= length;\n } else {\n break;\n }\n }\n } else {\n lookahead_distance += (currentSegment.getLength() - rv.remaining_segment_distance);\n }\n rv.max_speed = currentSegment.getMaxSpeed();\n rv.lookahead_point = currentSegment.getPointByDistance(lookahead_distance);\n rv.lookahead_point_speed = currentSegment.getSpeedByDistance(lookahead_distance);\n checkSegmentDone(rv.closest_point);\n return rv;\n }", "public static void calculatePoint(double robotHeading, \n double dist, \n double targetHeading)\n {\n double b = dist * Math.sin(Math.toRadians(robotHeading));\n double a = b * Math.tan(Math.toRadians(robotHeading + targetHeading));\n specifiedPoint = new Point(a, b);\n\n /* This will probably change as we figure out how to better localize */\n specifiedHeading = robotHeading;\n }", "float getFocusDistancePref(boolean is_target_distance);", "public void recalculateStats(){\n weight = .25f * (shaftMat.getParameter(\"Density\") * length + headMat.getParameter(\"Density\") * .4f);\n sharpness = headMat.getParameter(\"Malleability\") + 1f / headMat.getParameter(\"Durability\"); //Malleable objects can be sharp, as can fragile objects\n// fragility = 1f / (shaftMat.getParameter(\"Durability\") * .5f + headMat.getParameter(\"Durability\") * .5f);\n durability = (shaftMat.getParameter(\"Durability\") * .5f + headMat.getParameter(\"Durability\") * .5f);\n trueness = shaftMat.getParameter(\"Regularity\") + headMat.getParameter(\"Regularity\");\n// length = 2f;\n }", "public void setTarget(double target, TrcWarpSpace warpSpace)\n {\n final String funcName = \"setTarget\";\n\n if (debugEnabled)\n {\n dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API, \"target=%f,warpSpace=%s\", target, warpSpace);\n }\n //\n // Read from input device without holding a lock on this object, since this could\n // be a long-running call.\n //\n final double input = pidInput.get();\n\n synchronized (this)\n {\n if (!absSetPoint)\n {\n //\n // Set point is relative, add target to current input to get absolute set point.\n //\n setPoint = input + target;\n currError = target;\n }\n else\n {\n //\n // Set point is absolute, use as is but optimize it if it is in warp space.\n //\n setPoint = target;\n if (warpSpace != null)\n {\n setPoint = warpSpace.getOptimizedTarget(setPoint, input);\n }\n currError = setPoint - input;\n }\n\n if (inverted)\n {\n currError = -currError;\n }\n\n setPointSign = Math.signum(currError);\n //\n // If there is a valid target range, limit the set point to this range.\n //\n if (maxTarget > minTarget)\n {\n if (setPoint > maxTarget)\n {\n setPoint = maxTarget;\n }\n else if (setPoint < minTarget)\n {\n setPoint = minTarget;\n }\n }\n\n totalError = 0.0;\n prevTime = settlingStartTime = TrcUtil.getCurrentTime();\n // Only init the prevOutputTime if this setTarget is called after a reset()\n // If it's called mid-operation, we don't want to reset the prevOutputTime clock\n if (prevOutputTime == 0.0)\n {\n prevOutputTime = prevTime;\n }\n }\n\n if (debugEnabled)\n {\n dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API);\n }\n }", "public void collectAndVerifyTarget() {\n System.out.println(\"Enter the total no of targets that needs to be achieved\");\n Scanner sc = new Scanner(System.in);\n int tCount = sc.nextInt();\n for (int i = 0; i < tCount; i++) {\n System.out.println(\"Enter the value of target \");\n double d = sc.nextDouble();\n double aTarget = 0;\n for (int j = 0; j < tranCount; j++) {\n aTarget = aTarget + transactions[j];\n if (aTarget >= d) {\n System.out.println(\"Target achieved after \" + (j + 1) + \" transactions \\n\");\n break;\n }\n }\n if (aTarget < d) {\n System.out.println(\"Given target is not achieved\");\n }\n }\n }", "public float getTargetSpd()\n\t{\n\t\treturn targetSpd;\n\t}", "@Override\r\n\tpublic int calculateDistance(Attackable target, Attackable attacker) {\r\n\t\tint attackerPosX = attacker.getPosition().getX();\r\n\t\tint attackerPosY = attacker.getPosition().getY();\r\n\t\tint targetPosX = target.getPosition().getX();\r\n\t\tint targetPosY = target.getPosition().getY();\r\n\t\tif ((targetPosX <= attackerPosX+2 && targetPosY == attackerPosY) || (targetPosX <= attackerPosX-2 && targetPosY == attackerPosY)\r\n\t\t\t\t|| (targetPosX == attackerPosX && targetPosY <= attackerPosY+2) || (targetPosX == attackerPosX && targetPosY <= attackerPosY-2)\r\n\t\t\t\t|| (targetPosX <= attackerPosX+2 && targetPosY <= attackerPosY-2) || (targetPosX <= attackerPosX+2 && targetPosY <= attackerPosY+2)\r\n\t\t\t\t|| (targetPosX <= attackerPosX-2 && targetPosY <= attackerPosY-2) || (targetPosX <= attackerPosX-2 && targetPosY <= attackerPosY+2)){\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\treturn -1;\r\n\t}", "@Override\n\tpublic double getTargetValueInCurrentBest() {\n\t\treturn 0;\n\t}", "N getTarget();", "private void target() {\n\t\t// find distance to flower\n\t\tdouble dist = grid.getDistance(grid.getLocation(this),\n\t\t\t\t\t\t\t\t\t grid.getLocation(targetFlower));\n\t\t// if close to flower start harvesting nectar\n\t\tif(dist < 3) {\n\t\t\tstate = \"HARVESTING\";\n\t\t}\n\t\t// if VERY far from flower, it must have died. start scouting\n\t\telse if(dist > 200){\n\t\t\tstate = \"SCOUTING\";\n\t\t}\n\t\t// else keep moving toward flower\n\t\telse{\n\t\t\tmoveTowards(grid.getLocation(targetFlower), 3);\n\t\t\tfood -= highMetabolicRate;\n\t\t}\n\t}", "private void setGraphParameters()\r\n\t{\r\n\r\n\t\tlogger.info(\"Setting graph parameters.\");\r\n\t\tlogger.info(\"Treating the graph as undirected.\");\r\n\r\n\t\t// Diameter is the maximum of all shortest path lengths\r\n\t\t// Average shortest path length is (as the name says) the average of the\r\n\t\t// shortest path length between all node pairs\r\n\r\n\t\tdouble maxPathLength = 0.0;\r\n\t\tdouble shortestPathLengthSum = 0.0;\r\n\t\tdouble degreeSum = 0.0;\r\n\t\tdouble clusterCoefficientSum = 0.0;\r\n\r\n\t\t// iterate over all node pairs\r\n\t\tCollection<Entity> nodes = undirectedGraph.getVertices();\r\n\r\n\t\t// a hashset of the nodes which have been the start node of the\r\n\t\t// computation process\r\n\t\t// for such nodes all path lengths have been already computed\r\n\t\tSet<Entity> wasSource = new HashSet<Entity>();\r\n\r\n\t\tint progress = 0;\r\n\t\tfor (Entity node : nodes) {\r\n\r\n\t\t\tprogress++;\r\n\t\t\tLoggingUtils.printProgressInfo(progress, nodes.size(), 100,\r\n\t\t\t\t\tLoggingUtils.ProgressInfoMode.TEXT,\r\n\t\t\t\t\t\"Getting graph parameters\");\r\n\r\n\t\t\tint nodeDegree = getDegree(node);\r\n\t\t\t// degreeSum += nodeDegree;\r\n\r\n\t\t\t// logger.info(\"Updating degree distribution.\");\r\n\t\t\t// updateDegreeDistribution(nodeDegree);\r\n\r\n\t\t\t// cluster coefficient C_v of a node v is the fraction of the\r\n\t\t\t// connections that exist between the\r\n\t\t\t// neighbor nodes (k_v) of this node and all allowable connections\r\n\t\t\t// between the neighbors (k_v(k_v -1)/2)\r\n\t\t\t// for degrees 0 or 1 there is no cluster coefficient, as there can\r\n\t\t\t// be no connections between neighbors\r\n\t\t\tif (nodeDegree > 1) {\r\n\t\t\t\tdouble numberOfNeighborConnections = getNumberOfNeighborConnections(node);\r\n\t\t\t\tclusterCoefficientSum += (numberOfNeighborConnections / (nodeDegree * (nodeDegree - 1)));\r\n\t\t\t}\r\n\r\n\t\t\t// Returns the new shortestPathLengthSum and the new maxPathLength.\r\n\t\t\t// They are returned as an double array for performance reasons.\r\n\t\t\t// I do not want to create an object, as this function is called\r\n\t\t\t// *very* often\r\n\t\t\t// logger.info(\"Computing shortest path lengths.\");\r\n\t\t\tdouble[] returnValues = computeShortestPathLengths(node,\r\n\t\t\t\t\tshortestPathLengthSum, maxPathLength, wasSource);\r\n\t\t\tshortestPathLengthSum = returnValues[0];\r\n\t\t\tmaxPathLength = returnValues[1];\r\n\r\n\t\t\t// save the info that the node was already used as the source of\r\n\t\t\t// path computation\r\n\t\t\twasSource.add(node);\r\n\t\t}\r\n\r\n\t\tif (nodes.size() > 1) {\r\n\t\t\tthis.averageShortestPathLength = shortestPathLengthSum\r\n\t\t\t\t\t/ (nodes.size() * (nodes.size() - 1) / 2);\r\n\t\t\t// sum of path lengths / (number of node pairs)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis.averageShortestPathLength = 0; // there is only one node\r\n\t\t}\r\n\t\tthis.diameter = maxPathLength;\r\n\t\tthis.averageDegree = degreeSum / nodes.size();\r\n\t\tthis.clusterCoefficient = clusterCoefficientSum / nodes.size();\r\n\t}", "public float getDistance(){\n\t\t\treturn s1.start.supportFinal.dot(normal);\n\t\t}", "public static native double OpenMM_HippoNonbondedForce_getCutoffDistance(PointerByReference target);", "public double getRangeToBestTarget()\n\t{\n\t\treturn getRangeToTarget(currentBestTarget);\n\t}", "public static native double OpenMM_HippoNonbondedForce_getSwitchingDistance(PointerByReference target);", "public double costNEX() {\r\n double diff=0;\r\n double intensity=0;\r\n \r\n for(int x=Config.ptvXLow-0; x < Config.ptvXHigh+0; x++) {\r\n// for(int x=Solver.xBoundsTumor[0]; x < Solver.xBoundsTumor[1]; x+= Config.scaleFactor) {\r\n for(int y=Config.ptvYLow-0; y < Config.ptvYHigh+0; y++) {\r\n// for(int y=Solver.yBoundsTumor[0]; y < Solver.yBoundsTumor[1]; y+= Config.scaleFactor) {\r\n for(int z=Config.ptvZLow-0; z < Config.ptvZHigh+0; z++) {\r\n// for(int z=Solver.zBoundsTumor[0]; z < Solver.zBoundsTumor[1]; z+= Config.scaleFactor) {\r\n\r\n this.body2[x][y][z].setCurrentDosis(0.0); //Set currentPtvVoxel Dose to 0 \r\n for(int i=0; i<Config.numberOfSeeds;++i) { \r\n // Calculate intensity based based on current dwelltime\r\n intensity = this.body2[x][y][z].radiationIntensity(this.seeds2[i].getCoordinate(), New_state[i]);\r\n if (intensity>0) {\r\n// LogTool.print(\"Cost: Intensity :\" + intensity + \"@ \" + x + \" \" + y + \" \" + z,\"notification\");\r\n }\r\n this.body2[x][y][z].addCurrentDosis(intensity);\r\n } \r\n diff += Math.pow((this.body2[x][y][z].getGoalDosis()-this.body2[x][y][z].getCurrentDosis()),2);\r\n// LogTool.print(\" diffdose \" + (Looper.body2[x][y][z].getGoalDosis()-Looper.body2[x][y][z].getCurrentDosis()),\"notification\");\r\n } \r\n }\r\n }\r\n return Math.sqrt(diff);\r\n// return Math.random();\r\n }", "private Position computeTargetConsideringLead(Position sourcePos, TargetGridElement targetGridElement) {\r\n\r\n // Target-Position & velocity-Vector\r\n Position targetPosition = targetGridElement.getCurrentGridElementPosition();\r\n Direction targetPosDirection = Directions.of(targetPosition.getDirection(), targetGridElement.getTargetVelocity());\r\n\r\n // Source-Position & velocity-Vector\r\n double angleBetweenSourceAndTarget = sourcePos.calcAngleRelativeTo(targetPosition);\r\n sourcePos = sourcePos.rotate(angleBetweenSourceAndTarget);\r\n Direction sourcePosDirection = Directions.of(sourcePos.getDirection(), velocity);\r\n\r\n Float64Vector targetVMinusSourceV = targetPosition.getVector().minus(sourcePos.getVector());\r\n double a = targetPosDirection.getVector().normValue() * targetPosDirection.getVector().normValue()\r\n - (sourcePosDirection.getVector().normValue() * sourcePosDirection.getVector().normValue());\r\n double b = 2 * targetVMinusSourceV.times(targetPosDirection.getVector()).doubleValue();\r\n double c = targetVMinusSourceV.normValue() * targetVMinusSourceV.normValue();\r\n\r\n if (a >= 0) {\r\n return targetPosition;\r\n }\r\n double sqrt = Math.sqrt(b * b - 4 * a * c);\r\n double dt1 = solveQuadraticFormula(a, b, sqrt, -1);\r\n double dt = computeDeltaT(a, b, sqrt, dt1);\r\n Float64Vector targetDirVectorWithTime = targetPosDirection.getVector().times(dt);\r\n return Positions.of(targetPosition.getX() + targetDirVectorWithTime.getValue(0), targetPosition.getY() + targetDirVectorWithTime.getValue(1),\r\n sourcePos.getZ());\r\n }", "public void calculateCost()\n\t{\n\t\tLogManager lgmngr = LogManager.getLogManager(); \n\t\tLogger log = lgmngr.getLogger(Logger.GLOBAL_LOGGER_NAME);\n\t\tString s = \"\";\n\t\tint costperfeet = 0;\n\t\tif (this.materialStandard.equals(\"standard materials\") && this.fullyAutomated == false)\n\t\t\tcostperfeet = 1200;\n\t\telse if (this.materialStandard.equals(\"above standard materials\") && this.fullyAutomated == false)\n\t\t\tcostperfeet = 1500;\n\t\telse if(this.materialStandard.equals(\"high standard materials\") && this.fullyAutomated == false)\n\t\t\tcostperfeet = 1800;\n\t\telse if (this.materialStandard.equals(\"high standard materials\") && this.fullyAutomated == true)\n\t\t\tcostperfeet = 2500;\n\t\t\n\t\tint totalCost = costperfeet * this.totalArea;\n\t\t/*s = \"Total Cost of Construction is :- \";\n\t\twriter.printf(\"%s\" + totalCost, s);\n\t\twriter.flush();*/\n\t\tlog.log(Level.INFO, \"Total Cost of Construction is :- \" + totalCost);\n\t}", "private Movement computeMovement(int startX, int startY, int targetX, int targetY) {\n float deltaX = targetX - startX;\n float deltaY = targetY - startY;\n float distance = (float) Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\n float unitDis = 3;\n float moveX = getSpeed() * unitDis * deltaX / distance;\n float moveY = getSpeed() * unitDis * deltaY / distance;\n return new Movement(moveX, moveY);\n }", "protected void setPropagationEffectParams() {\n\n\t\tif ( (this.site != null) && (this.eqkRupture != null)) {\n\t\t\tdistanceJBParam.setValue(eqkRupture, site);\n\t\t}\n\t}", "@Test\n public void sourceEqualsTarget() {\n graph.edge(0, 1).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(0, 2).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(1, 2).setDistance(1).set(speedEnc, 10, 10);\n assertPath(calcPath(0, 0, 0, 1), 0.3, 3, 300, nodes(0, 1, 2, 0));\n assertPath(calcPath(0, 0, 1, 0), 0.3, 3, 300, nodes(0, 2, 1, 0));\n // without restrictions the weight should be zero\n assertPath(calcPath(0, 0, ANY_EDGE, ANY_EDGE), 0, 0, 0, nodes(0));\n // in some cases no path is possible\n assertNotFound(calcPath(0, 0, 1, 1));\n assertNotFound(calcPath(0, 0, 5, 1));\n }", "protected void execute() {\t\n \ttarget = Robot.trackingCamera.getTargetPosition();\n \t\n \tSmartDashboard.putNumber(\"targetX\", target[0]);\n \tSmartDashboard.putNumber(\"targetY\", target[1]);\n \t\n \tif(target[0] == TrackingCamera.NOTFOUND || lastDistance < 28){\n \t\tsuper.execute();\n \t\treturn;\n \t}\n \t\n \ttargetX = target[0];\n \ttargetY = target[1];\n \t\n \tsuper.execute();\n \t//System.out.println(distance);\n }", "@Override public Map<L, Integer> targets(L source) {\r\n \t Map<L, Integer> res= new HashMap <L, Integer>();\r\n \tif(!vertices.contains(source)) {\r\n \t\t//System.out.println(source+\" is not in the graph!\");\r\n \t\treturn res;\r\n \t}\r\n \tIterator<Edge<L>> iter=edges.iterator();\r\n \twhile(iter.hasNext()) {\r\n \t\tEdge<L> tmp=iter.next();\r\n \t\t//if(tmp.getSource()==source)\r\n \t\tif(tmp.getSource().equals(source))\r\n \t\t\tres.put(tmp.getTarget(), tmp.getWeight());\r\n \t\t\r\n \t}\r\n \tcheckRep();\r\n \treturn res;\r\n\r\n }", "private TargetInformation findHighGoal(Mat image) {\r\n\t\tTargetInformation ret = new TargetInformation();\r\n\t\tret.targetingPeg = false;\r\n\t\t\r\n long[] xsums = sums(image, true);\r\n long[] ysums = sums(image, false);\r\n \r\n\t List<PeakLoc> xpeaks = findPeaks(xsums, 10);\r\n\t List<PeakLoc> ypeaks = findPeaks(ysums, 10);\r\n\r\n\t if (ypeaks.size() == 2 && xpeaks.size() > 0) {\r\n\t \tret.targetFound = true;\r\n\t \tret.x = (xpeaks.get(0).getStop() - xpeaks.get(0).getStart()) / 2;\r\n\t \tret.gap = ypeaks.get(1).getStart() - ypeaks.get(0).getStop();\r\n\t \tret.width = xpeaks.get(0).getStop() - xpeaks.get(0).getStart();\r\n\t \tret.height = ypeaks.get(1).getStop() - ypeaks.get(0).getStart();\r\n\t \tret.y = (ypeaks.get(0).getStop() + ypeaks.get(1).getStart())/2;\r\n\t \t\r\n\t \tdouble pixelsPerInch = ret.gap / highGoalGapInches;\r\n\t \tif (xpeaks.get(0).isTruePeak() && xpeaks.get(1).isTruePeak())\r\n\t \t{\r\n\t \t\tpixelsPerInch = (pixelsPerInch + ret.width / highGoalWidthInches) / 2;\r\n\t \t}\r\n\t \tif (ypeaks.get(0).isTruePeak())\r\n\t \t{\r\n\t \t\tif (xpeaks.get(0).isTruePeak() && xpeaks.get(1).isTruePeak())\r\n\t \t\t{\r\n\t \t\t\tpixelsPerInch = (pixelsPerInch * 2 + ret.width / highGoalHeightInches) / 3;\r\n\t \t\t}\r\n\t \t\telse\r\n\t \t\t{\r\n\t \t\t\tpixelsPerInch = (pixelsPerInch + ret.width / highGoalHeightInches) / 2;\r\n\t \t\t}\r\n\t \t} \t\r\n\t \t\r\n\t \tret.aimX = ret.x + (cameraOffsetInches - shooterOffsetInches) * pixelsPerInch;\r\n\t \t\r\n\t \tret.correctionAngle = (double)((ret.aimX - image.cols() / 2)) / pixelsPerXDegree;\r\n\t }\r\n\t else\r\n\t {\r\n\t \tret.targetFound = false;\r\n\t }\r\n\t \r\n\t return ret;\r\n\t}", "public Double getDistance(List<Double> target, List<Double> current) {\n int dim = target.size();\n\n // loop through coordinates to find euclidean distance\n double distance = 0;\n for (int i = 0; i < dim; i++) {\n distance += this.axisDistance(target, current, i);\n }\n\n return distance;\n }", "@Override\n\tpublic List<node_data> TSP(List<Integer> targets) {\n\t\tList<Integer> targets1 = new ArrayList<>();\n\t\tList<node_data> ans = new ArrayList<>();\n\t\tfor (Integer target: targets) {\n\t\t\tif(!targets1.contains(target)){\n\t\t\t\ttargets1.add(target);\n\t\t\t}\n\t\t}\n\t\tif(targets1.size()==1){\n\t\t\tans.add(this.GA.getNode(targets.get(0)));\n\t\t\treturn ans;\n\t\t}\n\t\tint help=targets1.get(0);\n\t\tint targetSize = targets1.size();\n\t\twhile(!targets1.isEmpty()) {\n\t\t\tdouble minWeight = Integer.MAX_VALUE;\n\t\t\tint geti=-1;\n\t\t\tfor (int j = 0; j <targetSize ; j++) {\n\t\t\t\tif(shortestPathDist(help,targets1.get(j)) !=0 &&shortestPathDist(help,targets1.get(j))<minWeight || targets1.size()==1 && shortestPathDist(help,targets1.get(j)) ==0) {\n\t\t\t\t\tminWeight = shortestPathDist(help, targets1.get(j));\n\t\t\t\t\tgeti = targets1.get(j);\n\t\t\t\t}\n\t\t\t}\n\t\t\tList<node_data> ans2 = new ArrayList<>();\n\t\t\tif(geti==-1) return null;\n\t\t\tif(targets1.size()>1) {\n\t\t\t\tans2 = shortestPath(help, geti);\n\t\t\t\tans.addAll(ans2);\n\t\t\t\ttargets1.remove((Integer) help);\n\t\t\t\ttargetSize--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttargets1.remove((Integer)geti);\n\t\t\t}\n\t\t\thelp=geti;\n\t\t}\n\t\tfor (int ii = 0; ii <ans.size()-1 ; ii++) {\n\t\t\tif(ans.get(ii)==ans.get(ii+1)){\n\t\t\t\tans.remove(ii);\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}", "public ModelParams optimize() throws Exception {\n\t\tint iterCount = 0;\n\t\tdivergence = KLDivergenceCalculator.calculate(cState, tState);\n\t\tSystem.out.println(\"KL Divergence : \" + divergence);\n\t\t// ((DivergenceChart) BeanFinder\n\t\t// .findBean(MetaConstants.BEAN_DIVERGENCE_CHART)).update(\n\t\t// iterCount, divergence);\n\t\tdouble delta[] = null;\n\t\tdouble theta[] = data.getParams().getParams();\n\t\tdouble newDivergence = 0.0d;\n\t\tdouble initialStep = data.getInitialStepSize();\n\t\tboolean optimized = false;\n\t\tdo {\n\t\t\tdelta = computeGradient(theta);\n\t\t\tfor (double step = initialStep; iterCount < data.getMaxIterations(); step /= 10) {\n\t\t\t\tSystem.out.println(\"Step size : \" + step);\n\t\t\t\tSystem.out.println(\"KL divergence before taking a step : \"\n\t\t\t\t\t\t+ KLDivergenceCalculator.calculate(cState, tState));\n\t\t\t\tfor (int i = 0; i < delta.length; i++) {\n\t\t\t\t\tif (Double.isNaN(delta[i]))\n\t\t\t\t\t\tSystem.out.print(\"delta is NAN!!\" + delta[i] + \", \");\n\t\t\t\t\ttheta[i] -= step * delta[i];\n\t\t\t\t\tSystem.out.print((theta[i]) + \", \");\n\t\t\t\t}\n\t\t\t\tSystem.out.println();\n\t\t\t\tgetNewState(theta);\n\t\t\t\titerCount++;\n\t\t\t\tnewDivergence = KLDivergenceCalculator\n\t\t\t\t\t\t.calculate(cState, tState);\n\t\t\t\tSystem.out.println(\"KL Divergence : \" + newDivergence);\n\t\t\t\t// ((DivergenceChart) BeanFinder\n\t\t\t\t// .findBean(MetaConstants.BEAN_DIVERGENCE_CHART)).update(\n\t\t\t\t// iterCount, newDivergence);\n\t\t\t\tif (newDivergence < divergence) {\n\t\t\t\t\tdivergence = newDivergence;\n\t\t\t\t\tinitialStep = step;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// before taking the next step size, reset theta to what it was\n\t\t\t\tfor (int i = 0; i < delta.length; i++)\n\t\t\t\t\ttheta[i] += step * delta[i];\n\t\t\t\tgetNewState(theta); // Added for checking. Not required.\n\t\t\t}\n\t\t\toptimized = optimized(theta);\n\t\t} while (!optimized && iterCount < data.getMaxIterations());\n\t\tModelParams optimParams = null;\n\t\tif (optimized) {\n\t\t\toptimParams = new ModelParams();\n\t\t\toptimParams.setParams(theta);\n\t\t}\n\t\treturn optimParams;\n\t}", "public interface MovementParameters {\n\n\t/**\n\t * Value to make the robot steer right on its center\n\t */\n\tstatic final int STEER_RIGHT = -200;\n\t/**\n\t * Value to make the robot steer left on its center\n\t */\n\tstatic final int STEER_LEFT = 200;\n\t/**\n\t * Angular speed of the robot for rotations in degrees / sec\n\t */\n\tstatic final double ANGULAR_SPEED = 5;\n\t/**\n\t * Speed for a single motor\n\t */\n\tstatic final double MOTOR_SPEED = 20;\n\t\n\t/**\n\t * Linear speed of the robot in cm / s\n\t */\n\tstatic final double LINEAR_SPEED = 40;\n\t/**\n\t * Linear acceleration of the robot in cm / s^2\n\t */\n\tstatic final double LINEAR_ACCELERATION = 2;\n\t/**\n\t * Tolerance set to the heading in degrees\n\t */\n\tstatic final float HEADING_TOLERANCE = 1f;\n\t/**\n\t * Minimum distance the robot can reach when is approaching an object\n\t */\n\tstatic final int MIN_DISTANCE = 40;\n}", "public void setTarget(double target)\n {\n setTarget(target, null);\n }", "public double getTargetArea() {\n return getDouble(\"ta\");\n }", "public abstract double getHeuristic(State state);", "protected void computeTranslationVelocityCommand() { // (Solution)\n\t\tdouble translationError = targetRange - desiredFixationDistance; // (Solution)\n\t\tif (Math.abs(translationError) < translationErrorTolerance) // (Solution)\n\t\t\ttranslationVelocityCommand = 0.0; // (Solution)\n\t\telse\n\t\t\t// (Solution)\n\t\t\ttranslationVelocityCommand = // (Solution)\n\t\t\tMath.max(-translationVelocityMax, // (Solution)\n\t\t\t\t\tMath.min(translationVelocityMax, // (Solution)\n\t\t\t\t\t\t\ttranslationError * translationVelocityGain)); // (Solution)\n\t}", "void calculateFitness() {\n if (reachedGoal) {\n fitness = 1d / 16d + 8192d / (genome.step * genome.step);\n } else {\n double d = position.distance(Game.Setup.goal);\n fitness = 1d / (d * d);\n }\n }", "public static native double OpenMM_AmoebaMultipoleForce_getCutoffDistance(PointerByReference target);", "private void updateCurrentTarget(){\n switch (state){\n case States.DEAD:\n currentTarget = currentLocation;\n break;\n case States.FIGHT:\n if (targetEnemy != null)\n currentTarget = targetEnemy.getCurrentLocation();\n else\n currentTarget = targetBuilding.getLocation();\n break;\n case States.RETREAT:\n currentTarget = new Point(20,20);\n break;\n case States.LOSS:\n currentTarget = new Point(20,20);\n break;\n case States.WIN:\n currentTarget = village.getCenter();\n break;\n case States.IDLE:\n currentTarget = targetBuilding.getLocation();\n }\n }", "public Map<Integer, TargetDef> getTargetQueries();", "public void setChargerTarget() {\n if (getEnemies().size() > 0) {\n ArrayList<RobotReference> enemies = getEnemies();\n RobotReference closestEnemy = enemies.get(0);\n if (chargerTarget == null && teamTarget != null) {\n for (RobotReference enemy : enemies) {\n if (!enemy.isTeammate()) {\n if (Vector2d.getDistanceTo(closestEnemy.getLocation(), getLocation()) > Vector2d.getDistanceTo(enemy.getLocation(), getLocation()))\n closestEnemy = enemy;\n }\n }\n chargerTarget = closestEnemy;\n } else {\n chargerTarget = enemies.get(0);\n }\n }\n }", "public double getTargetValue(StateTransition nextStateTransition) {\n return nextStateTransition.tdTarget;\n }", "private double dijkstraSingleTarget(Map<Integer, List<Node>> graph, int vertices, int source, int target) {\n Queue<Node> minHeap = new PriorityQueue<>(\n Comparator.comparingDouble(a -> a.weight)\n );\n\n double[] dist = new double[vertices + 1]; //shortest distance for each vertex\n Arrays.fill(dist, 0.0);\n\n boolean visited[] = new boolean[vertices + 1];\n\n // Distance for starting node is 0\n dist[source] = -1;\n minHeap.add((new Node(-1,source)));\n\n while (!minHeap.isEmpty()) {\n Node topPair = minHeap.remove();\n int currNode = topPair.vertex;\n double currDistance = topPair.weight;\n\n if (!graph.containsKey(currNode)) {\n continue;\n }\n\n if (visited[currNode]) continue;\n visited[currNode] = true;\n\n\n for (Node edge : graph.get(currNode)) {\n double weight = edge.weight;\n int neighborNode = edge.vertex;\n double nextDist = currDistance * weight;\n\n if (!visited[neighborNode] && nextDist < dist[neighborNode]) {\n dist[neighborNode] = nextDist;\n minHeap.add((new Node(nextDist, neighborNode)));\n\n }\n\n }\n\n\n }\n\n return -dist[target];\n }", "public static double getTargetDistance(double value) {\n double distance;\n if (value < 0)\n distance = -1.0;\n\n if (value >= 0 && value < 150)\n distance = -1.0;\n else if (value >= 150 && value < 300)\n distance = 0.0;\n else\n distance = 1.0;\n\n return distance;\n }", "public static void setTamerAgentParams(TamerAgent agent) {\t\t\n\t\t/*\n\t\t * Set all TamerAgent params here, not in Params class. That way you have\n\t\t * a single location that's specific to this experiment that contains\n\t\t * all of your algorithmic information when it's time for writing.\n\t\t */\n\t\tSystem.out.println(agent.params);\n\t\tagent.param(\"distClass\",\"previousStep\"); //// immediate, previousStep, or uniform\n\t\tagent.param(\"extrapolateFutureRew\",false);\n\t\tagent.param(\"traceDecayFactor\",0.0);\n\t\tagent.param(\"featClass\",\"FeatGen_Tetris\");\n\t\tagent.param(\"modelClass\",\"IncGDLinearModel\"); \n\t\tagent.param(\"modelAddsBiasFeat\",true);\n\t\tagent.param(\"stepSize\",0.000005 / 47); // python code takes input value and divides by number of features // 0.02;\n\t\t\n\t\tagent.param(\"delayWtedIndivRew\",false); \n\t\tagent.param(\"noUpdateWhenNoRew\",false); \n\t\tagent.param(\"selectionMethod\",\"greedy\");\n\t\n\t\tagent.param(\"initModelWSamples\",false);\n\t\tagent.param(\"numBiasingSamples\",0);\n\t\tagent.param(\"biasSampleWt\",0.1);\n\t\tagent.param(\"traceDecayFactor\",0.0);\n\t}", "public double getMaximumAltitude(TargetTrackCalculator tgt1, long t1, long t2) throws AstrometryException;", "protected long travel() {\n\n return Math.round(((1 / Factory.VERTEX_PER_METER_RATIO) / (this.speed / 3.6)) * 1000);\n }", "public static double getApproximatedHopsToDest(VCAgent current, VCAgent dest, List<VCAgent> anchorAgents, VCContext context) throws RuntimeException{\r\n\t\tArrayList<Double> neighborDistances = new ArrayList<Double>();\r\n\t\tfor(VCAgent neighbor : current.getNeighbors()) {\r\n\t\t\t\tneighborDistances.add(virtualDistance(current, neighbor, \r\n\t\t\t\t\t\tanchorAgents.get(0), anchorAgents.get(1), false));\r\n\t\t}\r\n\t\tdouble alpha12 = Collections.min(neighborDistances);\r\n\t\tdouble beta12 = Collections.max(neighborDistances);\r\n\t\t\r\n\t\tneighborDistances.clear();\r\n\t\tfor(VCAgent neighbor : current.getNeighbors()) {\r\n\t\t\tneighborDistances.add(virtualDistance(current, neighbor, \r\n\t\t\t\t\tanchorAgents.get(2), anchorAgents.get(3), false));\r\n\t\t}\r\n\t\tdouble alpha34 = Collections.max(neighborDistances);\r\n\t\tdouble beta34 = Collections.min(neighborDistances);\r\n\t\t\r\n\t\tdouble distToDest12 = virtualDistance(current, dest, \r\n\t\t\t\tanchorAgents.get(0), anchorAgents.get(1), current.equals(context.getSinkAgent()) && dest.equals(context.getSinkAgent()));\r\n\t\tdouble distToDest34 = virtualDistance(current, dest, \r\n\t\t\t\tanchorAgents.get(2), anchorAgents.get(3), current.equals(context.getSinkAgent()) && dest.equals(context.getSinkAgent()));\r\n\t\t\r\n\t\t\r\n\t\t// jscience package was used to solve the equation better. \r\n\t\t// It probably uses psuedo inverse when matrix is singular. \r\n//\t\tFloat64Matrix A = Float64Matrix.valueOf(new double[][] {{alpha12, beta12},{alpha34, beta34}});\r\n//\t\tFloat64Matrix B = Float64Matrix.valueOf(new double[][]{{distToDest12},{distToDest34}});\r\n//\t\torg.jscience.mathematics.vector.Matrix<Float64> x = A.solve(B);\r\n//\t\tdouble n = x.get(0, 0).doubleValue();\r\n//\t\tdouble m = x.get(1, 0).doubleValue();\r\n\t\t\r\n\t\t\r\n\t\tdouble n = (distToDest12*beta34 - distToDest34*beta12)/(alpha12*beta34-alpha34*beta12);\r\n\t\tdouble m = -(distToDest12*alpha34 - distToDest34*alpha12)/(alpha12*beta34-alpha34*beta12);\r\n\t\t\r\n\t\treturn Math.abs(n)+Math.abs(m);\r\n\t}", "double getSolutionCost();", "public static void setParams(MapLocation target, int thresholdDistanceSq, boolean staySafe) {\n Bugging.target = target;\n Bugging.thresholdDistanceSq = thresholdDistanceSq;\n Bugging.staySafe = staySafe;\n }", "@Test\n\t\t\tpublic void testTargetsTwoSteps() {\n\t\t\t\t//Length of 2\n\t\t\t\tboard.calcTargets(8, 16, 2);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(4, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(6, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(10, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(7, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(9, 15)));\n\t\t\t\t//Length of 2\n\t\t\t\tboard.calcTargets(15, 15, 2);\n\t\t\t\ttargets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(4, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(17, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(14, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(15, 17)));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t}", "public ConditionTargetWeight(int weight)\n\t{\n\t\t_weight = weight;\n\t}", "DeepSkyTarget(Node targetElement, IObserver... observers) throws SchemaException {\n\n super(targetElement, observers);\n\n Element target = (Element) targetElement;\n\n // Getting data\n // First mandatory stuff and down below optional data\n\n // Get optional small diameter\n NodeList children = target.getElementsByTagName(DeepSkyTarget.XML_ELEMENT_SMALLDIAMETER);\n Angle smallDiameter = null;\n if (children.getLength() == 1) {\n Element child = (Element) children.item(0);\n String value = child.getFirstChild().getNodeValue();\n String unit = child.getAttribute(Angle.XML_ATTRIBUTE_UNIT);\n smallDiameter = new Angle(Double.parseDouble(value), unit);\n this.setSmallDiameter(smallDiameter);\n } else if (children.getLength() > 1) {\n throw new SchemaException(\"DeepSkyTarget can only have one small diameter entry. \");\n }\n\n // Get optional large diameter\n children = target.getElementsByTagName(DeepSkyTarget.XML_ELEMENT_LARGEDIAMETER);\n Angle largeDiameter = null;\n if (children.getLength() == 1) {\n Element child = (Element) children.item(0);\n String value = child.getFirstChild().getNodeValue();\n String unit = child.getAttribute(Angle.XML_ATTRIBUTE_UNIT);\n largeDiameter = new Angle(Double.parseDouble(value), unit);\n this.setLargeDiameter(largeDiameter);\n } else if (children.getLength() > 1) {\n throw new SchemaException(\"DeepSkyTarget can only have one large diameter entry. \");\n }\n\n // Get optional visible magintude\n children = target.getElementsByTagName(DeepSkyTarget.XML_ELEMENT_VISIBLEMAGNITUDE);\n if (children.getLength() == 1) {\n Element child = (Element) children.item(0);\n String visMag = child.getFirstChild().getNodeValue();\n this.setVisibleMagnitude(FloatUtil.parseFloat(visMag));\n } else if (children.getLength() > 1) {\n throw new SchemaException(\"DeepSkyTarget can only have one visible magnitude entry. \");\n }\n\n // Get optional surface brightness\n children = target.getElementsByTagName(DeepSkyTarget.XML_ELEMENT_SURFACEBRIGHTNESS);\n if (children.getLength() == 1) {\n Element child = (Element) children.item(0);\n String surBright = child.getFirstChild().getNodeValue();\n // Check if unit is explicitly given (from OAL 2.0 this is the case)\n String unit = child.getAttribute(SurfaceBrightness.XML_ATTRIBUTE_UNIT);\n if (StringUtils.isBlank(unit)) {\n unit = SurfaceBrightness.MAGS_SQR_ARC_MIN; // Prio to 2.0 the value was always giben in mags per sqr\n // args min\n }\n this.setSurfaceBrightness(new SurfaceBrightness(FloatUtil.parseFloat(surBright), unit));\n } else if (children.getLength() > 1) {\n throw new SchemaException(\"DeepSkyTarget can only have one surface brightness entry. \");\n }\n\n }", "public synchronized double getTarget()\n {\n final String funcName = \"getTarget\";\n\n if (debugEnabled)\n {\n dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API);\n dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API, \"=%f\", setPoint);\n }\n\n return setPoint;\n }", "public double NormalizeTarget(Instance inst) {\n\n\t\t\tif (this.statsTarget.getCounter()==0)\n\t\t\t\t\treturn 0 ;\n\t\t\t\n\t\t\tdouble value = 0;\n\t\t\tif (normalizeationOption.getChosenIndex() == 0 || normalizeationOption.getChosenIndex() == 1) {\n\t\t\t\tif (this.statsTarget.getStandardDeviation() < Constants.SMALL_EPSILON)\n\t\t\t\t\tvalue = (inst.classValue() - this.statsTarget.getCurrentMean());\n\t\t\t\telse\n\t\t\t\t\tvalue = (inst.classValue() - this.statsTarget.getCurrentMean())\n\t\t\t\t\t\t\t/ (this.statsTarget.getStandardDeviation());\n\t\t\t}else if (normalizeationOption.getChosenIndex() == 2){\n\t\t\t\tif (this.statsTarget.getRange() < Constants.SMALL_EPSILON)\n\t\t\t\t\tvalue = (inst.classValue() - this.statsTarget.getMin());\n\t\t\t\telse\n\t\t\t\t\tvalue = (inst.classValue() - this.statsTarget.getMin()) / (this.statsTarget.getRange());\n\t\t\t}else {\n\t\t\t\tvalue = inst.classValue() ;\n\t\t\t}\n\t\t\t\n\t\t\treturn value;\n\t\t}", "private void getCostAndEta() {\n\n GetVehiclesData vehiclesData = RetrofitClientInstance.getRetrofitInstance().create(GetVehiclesData.class);\n getVehicles.getVehiclesData(vehiclesData);\n setCostToLabel(getVehicles.getCost());\n setETAToLabel(getVehicles.getETA());\n\n }", "private void calculateManhattanDistance(Vertex source, Vertex target) {\n\t\tQueue<Vertex> fifo = new ArrayDeque<Vertex>();\n\t\ttarget.setNbr(1);\n\t\tfifo.add(target);\n\t\twhile(!fifo.isEmpty()) {\n\t\t\tVertex actual = fifo.remove();\n\t\t\tfor (direction dir : direction.values()) {\n\t\t\t\tif (!this.g.edgeDoesntExist(actual, dir)) {\n\t\t\t\t\tVertex next = g.getEqualVertex(g.vertexByDir(actual, dir));\n\t\t\t\t\tif (next.getNbr() == 0) {\n\t\t\t\t\t\tnext.setNbr(actual.getNbr()+1);\n\t\t\t\t\t\tif (next != source) {\n\t\t\t\t\t\t\tfifo.add(next);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public SpaceProbe gradientDescend(SpaceObject source, SpaceObject goal, double yearsTime){\n double swarmspeed = 10E7;\n Boolean stop = false;\n SpaceProbe localBestProbe = new SpaceProbe(source.getPosition().clone().addConstant(source.getRadius()), source.getVelocity().clone(),5000);\n SpaceProbe globalBestProbe = localBestProbe.clone();\n\n while (!stop){\n System.out.println(swarmspeed);\n ArrayList<SpaceProbe> probesList = new ArrayList<>();\n probesList.addAll(createSwarm(localBestProbe, swarmspeed));\n solarSystem = solarSystem.reset();\n solarSystem.objectList.addAll(probesList);\n\n\n for (int i = 0; i < (int) (yearsTime * 365 * 86400 / 60); i++) {\n solarSystem.updateSolarSystem(60);\n for (SpaceProbe p : probesList) {\n p.calcMinDist(goal);\n }\n }\n localBestProbe = bestProbe(probesList);\n System.out.println(localBestProbe);\n if (localBestProbe.getMinDist() < goal.getRadius()){\n stop = true;\n globalBestProbe = localBestProbe.clone();\n return globalBestProbe;\n }\n if (localBestProbe.getMinDist() < globalBestProbe.getMinDist()){\n globalBestProbe = localBestProbe.clone();\n }\n swarmspeed *= 0.7;\n if (swarmspeed < 1){\n return globalBestProbe;\n }\n Vector3D bestVelocity = globalBestProbe.getVelocity().clone();\n localBestProbe.reset();\n localBestProbe.setVelocity(bestVelocity.clone());\n }\n return globalBestProbe;\n }", "public void estimateParameter(){\r\n int endTime=o.length;\r\n int N=hmm.stateCount;\r\n double p[][][]=new double[endTime][N][N];\r\n for (int t=0;t<endTime;++t){\r\n double count=EPS;\r\n for (int i=0;i<N;++i){\r\n for (int j=0;j<N;++j){\r\n p[t][i][j]=fbManipulator.alpha[t][i]*hmm.a[i][j]*hmm.b[i][j][o[t]]*fbManipulator.beta[t+1][j];\r\n count +=p[t][j][j];\r\n }\r\n }\r\n for (int i=0;i<N;++i){\r\n for (int j=0;j<N;++j){\r\n p[t][i][j]/=count;\r\n }\r\n }\r\n }\r\n double pSumThroughTime[][]=new double[N][N];\r\n for (int i=0;i<N;++i){\r\n for (int j=0;j<N;++j){\r\n pSumThroughTime[i][j]=EPS;\r\n }\r\n }\r\n for (int t=0;t<endTime;++t){\r\n for (int i=0;i<N;++i){\r\n for (int j=0;j<N;++j){\r\n pSumThroughTime[i][j]+=p[t][i][j];\r\n }\r\n }\r\n }\r\n\r\n //rebuild gamma\r\n for (int t=0;t<endTime;++t){\r\n for (int i=0;i<N;++i) fbManipulator.gamma[t][i]=0;\r\n for (int i=0;i<N;++i){\r\n for (int j=0;j<N;++j){\r\n fbManipulator.gamma[t][i]+=p[t][i][j];\r\n }\r\n }\r\n }\r\n\r\n double gammaCount=EPS;\r\n //maximum parameter\r\n for (int i=0;i<N;++i){\r\n gammaCount+=fbManipulator.gamma[0][i];\r\n hmm.pi[i]=fbManipulator.gamma[0][i];\r\n }\r\n for (int i=0;i<N;++i){\r\n hmm.pi[i]/=gammaCount;\r\n }\r\n\r\n for (int i=0;i<N;++i) {\r\n gammaCount = EPS;\r\n for (int t = 0; t < endTime; ++t) gammaCount += fbManipulator.gamma[t][i];\r\n for (int j = 0; j < N; ++j) {\r\n hmm.a[i][j] = pSumThroughTime[i][j] / gammaCount;\r\n }\r\n }\r\n for (int i=0;i<N;i++){\r\n for (int j=0;j<N;++j){\r\n double tmp[]=new double[hmm.observationCount];\r\n for (int t=0;t<endTime;++t){\r\n tmp[o[t]]+=p[t][i][j];\r\n }\r\n for (int k=0;k<hmm.observationCount;++k){\r\n hmm.b[i][j][k]=(tmp[k]+1e-8)/pSumThroughTime[i][j];\r\n }\r\n }\r\n }\r\n //rebuild fbManipulator\r\n fbManipulator=new HMMForwardBackwardManipulator(hmm,o);\r\n }", "float estimateCostToGoal( int current_x, int current_y, int current_z, boolean fromStart ) {\n\t\treturn 0;\n\t}", "public double calculateDistanceAgvH(int agvId, AGVStatus msg){\n\t\tdouble x1 = hpX; //human_position.x;\n\t\tdouble x2 = -2.7 - msg.position; //robot_position.x;\n\t\tdouble y1 = hpY; //human_position.y;\n\t\tdouble y2 = 0.0; //robot_position.y is STATIC\n\t\tif(agvId==1) y2 = 4.8;\n\t\telse if(agvId==2) y2 = 1.2;\n\t\telse if(agvId==3) y2 =-1.2;\n\t\telse if(agvId==4) y2 =-4.8;\n\n\t\tdouble dis=Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));\n\t\treturn dis;\n\t}", "public double[] runOptimizer() {\n List<Integer> sents = new ArrayList<Integer>();\n for(int i=0; i<sentNum; i++)\n sents.add(i);\n \n if(needShuffle)\n Collections.shuffle(sents);\n \n double oraMetric, oraScore, predMetric, predScore;\n double[] oraPredScore = new double[4];\n double eta = 1.0; //learning rate, will not be changed if run percep\n double avgEta = 0; //average eta, just for analysis\n double loss = 0;\n double featNorm = 0;\n double featDiffVal;\n double sumMetricScore = 0;\n double sumModelScore = 0;\n String oraFeat = \"\";\n String predFeat = \"\";\n String[] oraPredFeat = new String[2];\n String[] vecOraFeat;\n String[] vecPredFeat;\n String[] featInfo;\n boolean first = true;\n //int processedSent = 0;\n Iterator it;\n Integer diffFeatId;\n double[] avgLambda = new double[initialLambda.length]; //only needed if averaging is required\n for(int i=0; i<initialLambda.length; i++)\n avgLambda[i] = 0.0;\n\n //update weights\n for(Integer s : sents) {\n //find out oracle and prediction\n if(first)\n findOraPred(s, oraPredScore, oraPredFeat, initialLambda, featScale);\n else\n findOraPred(s, oraPredScore, oraPredFeat, finalLambda, featScale);\n \n //the model scores here are already scaled in findOraPred\n oraMetric = oraPredScore[0];\n oraScore = oraPredScore[1];\n predMetric = oraPredScore[2];\n predScore = oraPredScore[3];\n oraFeat = oraPredFeat[0];\n predFeat = oraPredFeat[1];\n \n //update the scale\n if(needScale) { //otherwise featscale remains 1.0\n sumMetricScore += java.lang.Math.abs(oraMetric+predMetric);\n sumModelScore += java.lang.Math.abs(oraScore+predScore)/featScale; //restore the original model score\n \n if(sumModelScore/sumMetricScore > scoreRatio)\n featScale = sumMetricScore/sumModelScore;\n\n /* a different scaling strategy \n if( (1.0*processedSent/sentNum) < sentForScale ) { //still need to scale\n double newFeatScale = java.lang.Math.abs(scoreRatio*sumMetricDiff / sumModelDiff); //to make sure modelScore*featScale/metricScore = scoreRatio\n \n //update the scale only when difference is significant\n if( java.lang.Math.abs(newFeatScale-featScale)/featScale > 0.2 )\n featScale = newFeatScale;\n }*/\n }\n// processedSent++;\n\n HashMap<Integer, Double> allOraFeat = new HashMap<Integer, Double>();\n HashMap<Integer, Double> allPredFeat = new HashMap<Integer, Double>();\n HashMap<Integer, Double> featDiff = new HashMap<Integer, Double>();\n\n vecOraFeat = oraFeat.split(\"\\\\s+\");\n vecPredFeat = predFeat.split(\"\\\\s+\");\n \n for (int i = 0; i < vecOraFeat.length; i++) {\n featInfo = vecOraFeat[i].split(\":\");\n diffFeatId = Integer.parseInt(featInfo[0]);\n allOraFeat.put(diffFeatId, Double.parseDouble(featInfo[1]));\n featDiff.put(diffFeatId, Double.parseDouble(featInfo[1]));\n }\n\n for (int i = 0; i < vecPredFeat.length; i++) {\n featInfo = vecPredFeat[i].split(\":\");\n diffFeatId = Integer.parseInt(featInfo[0]);\n allPredFeat.put(diffFeatId, Double.parseDouble(featInfo[1]));\n\n if (featDiff.containsKey(diffFeatId)) //overlapping features\n featDiff.put(diffFeatId, featDiff.get(diffFeatId)-Double.parseDouble(featInfo[1]));\n else //features only firing in the 2nd feature vector\n featDiff.put(diffFeatId, -1.0*Double.parseDouble(featInfo[1]));\n }\n\n if(!runPercep) { //otherwise eta=1.0\n featNorm = 0;\n\n Collection<Double> allDiff = featDiff.values();\n for(it =allDiff.iterator(); it.hasNext();) {\n featDiffVal = (Double) it.next();\n featNorm += featDiffVal*featDiffVal;\n }\n \n //a few sanity checks\n if(! evalMetric.getToBeMinimized()) {\n if(oraSelectMode==1 && predSelectMode==1) { //\"hope-fear\" selection\n /* ora_score+ora_metric > pred_score+pred_metric\n * pred_score-pred_metric > ora_score-ora_metric\n * => ora_metric > pred_metric */\n if(oraMetric+1e-10 < predMetric) {\n System.err.println(\"WARNING: for hope-fear selection, oracle metric score must be greater than prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n \n if(oraSelectMode==2 || predSelectMode==3) {\n if(oraMetric+1e-10 < predMetric) {\n System.err.println(\"WARNING: for max-metric oracle selection or min-metric prediction selection, the oracle metric \" +\n \t\t\"score must be greater than the prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n } else {\n if(oraSelectMode==1 && predSelectMode==1) { //\"hope-fear\" selection\n /* ora_score-ora_metric > pred_score-pred_metric\n * pred_score+pred_metric > ora_score+ora_metric\n * => ora_metric < pred_metric */\n if(oraMetric-1e-10 > predMetric) {\n System.err.println(\"WARNING: for hope-fear selection, oracle metric score must be smaller than prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n \n if(oraSelectMode==2 || predSelectMode==3) {\n if(oraMetric-1e-10 > predMetric) {\n System.err.println(\"WARNING: for min-metric oracle selection or max-metric prediction selection, the oracle metric \" +\n \"score must be smaller than the prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n }\n \n if(predSelectMode==2) {\n if(predScore+1e-10 < oraScore) {\n System.err.println(\"WARNING: for max-model prediction selection, the prediction model score must be greater than oracle model score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n \n //cost - margin\n //remember the model scores here are already scaled\n loss = evalMetric.getToBeMinimized() ? //cost should always be non-negative \n (predMetric-oraMetric) - (oraScore-predScore)/featScale: \n (oraMetric-predMetric) - (oraScore-predScore)/featScale;\n \n if(loss<0)\n loss = 0;\n\n if(loss == 0)\n eta = 0;\n else\n //eta = C < loss/(featNorm*featScale*featScale) ? C : loss/(featNorm*featScale*featScale); //feat vector not scaled before\n eta = C < loss/(featNorm) ? C : loss/(featNorm); //feat vector not scaled before\n }\n \n avgEta += eta;\n\n Set<Integer> diffFeatSet = featDiff.keySet();\n it = diffFeatSet.iterator();\n\n if(first) {\n first = false;\n \n if(eta!=0) {\n while(it.hasNext()) {\n diffFeatId = (Integer)it.next();\n finalLambda[diffFeatId] = initialLambda[diffFeatId] + eta*featDiff.get(diffFeatId);\n }\n }\n }\n else {\n if(eta!=0) {\n while(it.hasNext()) {\n diffFeatId = (Integer)it.next();\n finalLambda[diffFeatId] = finalLambda[diffFeatId] + eta*featDiff.get(diffFeatId);\n }\n }\n }\n \n if(needAvg) {\n for(int i=0; i<avgLambda.length; i++)\n avgLambda[i] += finalLambda[i];\n }\n }\n \n if(needAvg) {\n for(int i=0; i<finalLambda.length; i++)\n finalLambda[i] = avgLambda[i]/sentNum;\n }\n \n avgEta /= sentNum;\n System.out.println(\"Average learning rate: \"+avgEta);\n\n // the intitialLambda & finalLambda are all trainable parameters\n //if (!trainMode.equals(\"3\")) // for mode 3, no need to normalize sparse\n // feature weights\n //normalizeLambda(finalLambda);\n //else\n //normalizeLambda_mode3(finalLambda);\n\n /*\n * for( int i=0; i<finalLambda.length; i++ ) System.out.print(finalLambda[i]+\" \");\n * System.out.println(); System.exit(0);\n */ \n\n double initMetricScore = computeCorpusMetricScore(initialLambda); // compute the initial corpus-level metric score\n double finalMetricScore = computeCorpusMetricScore(finalLambda); // compute final corpus-level metric score // the\n\n // prepare the printing info\n int numParamToPrint = 0;\n String result = \"\";\n\n if (trainMode.equals(\"1\") || trainMode.equals(\"4\")) {\n numParamToPrint = paramDim > 10 ? 10 : paramDim; // how many parameters\n // to print\n result = paramDim > 10 ? \"Final lambda(first 10): {\" : \"Final lambda: {\";\n\n for (int i = 1; i < numParamToPrint; i++)\n // in ZMERT finalLambda[0] is not used\n result += finalLambda[i] + \" \";\n } else {\n int sparseNumToPrint = 0;\n if (trainMode.equals(\"2\")) {\n result = \"Final lambda(regular feats + first 5 sparse feats): {\";\n for (int i = 1; i <= regParamDim; ++i)\n result += finalLambda[i] + \" \";\n\n result += \"||| \";\n\n sparseNumToPrint = 5 < (paramDim - regParamDim) ? 5 : (paramDim - regParamDim);\n\n for (int i = 1; i <= sparseNumToPrint; i++)\n result += finalLambda[regParamDim + i] + \" \";\n } else {\n result = \"Final lambda(first 10 sparse feats): {\";\n sparseNumToPrint = 10 < paramDim ? 10 : paramDim;\n\n for (int i = 1; i < sparseNumToPrint; i++)\n result += finalLambda[i] + \" \";\n }\n }\n\n output.add(result + finalLambda[numParamToPrint] + \"}\\n\" + \"Initial \"\n + evalMetric.get_metricName() + \": \" + initMetricScore + \"\\nFinal \"\n + evalMetric.get_metricName() + \": \" + finalMetricScore);\n\n // System.out.println(output);\n\n if (trainMode.equals(\"3\")) {\n // finalLambda = baseline(unchanged)+disc\n for (int i = 0; i < paramDim; i++)\n copyLambda[i + regParamDim + 1] = finalLambda[i];\n\n finalLambda = copyLambda;\n }\n\n return finalLambda;\n }", "public double calculateCost(GridState newPoint){\n\t // Does the agent have access to weather information?\n\t return agent.danger(newPoint.getPosition());\n\t \n\t \n\t /* if(agent.hasWeatherInfo()) {\n\t\t // Check fire speed, check wind speed, calculate new fire speed, see if it is likely to spread to the state its gridpoint\n\t\t // Check if it is raining, because then it is slowing down the rain again\n\t\t return danger(newPoint);\n\t }\n\t else return 1.0;*/\n }", "@Ignore\n @Test\n public void run_RL() {\n String configfile = \"C:\\\\Users\\\\gomes\\\\Desktop\\\\traffic_master\\\\n_Capstone_0426_9000.xml\";\n\n float duration = 3600f;\n float outdt = 300f;\n\n // Load ..............................\n api.OTM otm = null;\n\n try {\n otm = new api.OTM(configfile);\n\n// // Output requests .....................\n// List<Long> list_orig_link_ids = otm.scenario.get_link_ids();\n// otm.output.request_links_flow(null, list_orig_link_ids, outdt);\n// otm.output.request_links_veh(null, list_orig_link_ids, outdt);\n//\n// List<Long> ramp_ids = new ArrayList<>();\n// for(ActuatorInfo act_info : otm.scenario.get_actuators())\n// ramp_ids.add(act_info.target.getId());\n\n// ControllerCapacity controller = (ControllerCapacity) otm.scenario.get_actual_controller_with_id(1);\n\n // Qtable loop\n\n double[] sum_vehicles = new double[6];\n double[] sum_flow = new double[6];\n\n// for( int i=0 ; i<6 ; i++){\n//\n// // update control\n// for(Long ramp_id : ramp_ids) {\n// float rate_ramp = i*300f;\n// controller.set_rate_vph_for_actuator(ramp_id, rate_ramp);\n// }\n//\n// System.out.println(\"i=\" + i);\n//\n// otm.run(0,duration);\n//\n// // extract output .........................\n// sum_vehicles[i] = 0d;\n// sum_flow[i] = 0d;\n//\n// for(AbstractOutput output : otm.output.get_data()){\n//\n// if (output instanceof LinkFlow){\n//\n// for(Long link_id : list_orig_link_ids) {\n// Profile1D profile = ((LinkFlow) output).get_flow_profile_for_link_in_vph(link_id);\n// List<Double> values = profile.get_values();\n// // System.out.println(String.format(\"LinkFlow: id=%d num_values=%d\",link_id,values.size()));\n//\n// sum_flow[i] += values.stream().mapToDouble(x->x).sum();\n// }\n// }\n//\n//\n// if (output instanceof LinkVehicles) {\n// for(Long link_id : list_orig_link_ids) {\n// Profile1D profile = ((LinkVehicles) output).get_profile_for_linkid(link_id);\n// List<Double> values = profile.get_values();\n// // System.out.println(String.format(\"LinkVehicles: id=%d num_values=%d\",link_id,values.size()));\n//\n// sum_vehicles[i] += values.stream().mapToDouble(x->x).sum();\n// }\n// }\n//\n// }\n//\n// System.out.println(i + \"\\t\" + sum_flow[i] + \"\\t\" + sum_vehicles[i]);\n//\n// // do some Qtable calculation\n\n\n\n// }\n } catch (OTMException e) {\n e.printStackTrace();\n }\n\n }", "@Test\r\n\tpublic void testTargetsTwoSteps() {\r\n\t\tboard.calcTargets(10, 1, 2);\r\n\t\tSet<BoardCell> targets= board.getTargets();\r\n\t\tassertEquals(6, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(9, 0)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(11, 0)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(9, 2)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(12, 1)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(10, 3)));\r\n\t\t\r\n\t\tboard.calcTargets(17, 13, 2);\r\n\t\ttargets= board.getTargets();\r\n\t\tassertEquals(5, targets.size());\r\n\t\tassertTrue(targets.contains(board.getCellAt(17, 15)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(18, 14)));\t\r\n\t\tassertTrue(targets.contains(board.getCellAt(16, 14)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(16, 12)));\r\n\t\tassertTrue(targets.contains(board.getCellAt(15, 13)));\r\n\t}", "public int TakeStep()\n\t\t{\n\t\t// the eventual movement command is placed here\n\t\tVec2\tresult = new Vec2(0,0);\n\n\t\t// get the current time for timestamps\n\t\tlong\tcurr_time = abstract_robot.getTime();\n\n\n\t\t/*--- Get some sensor data ---*/\n\t\t// get vector to the ball\n\t\tVec2 ball = abstract_robot.getBall(curr_time);\n\n\t\t// get vector to our and their goal\n\t\tVec2 ourgoal = abstract_robot.getOurGoal(curr_time);\n\t\tVec2 theirgoal = abstract_robot.getOpponentsGoal(curr_time);\n\n\t\t// get a list of the positions of our teammates\n\t\tVec2[] teammates = abstract_robot.getTeammates(curr_time);\n\n\t\t// find the closest teammate\n\t\tVec2 closestteammate = new Vec2(99999,0);\n\t\tfor (int i=0; i< teammates.length; i++)\n\t\t\t{\n\t\t\tif (teammates[i].r < closestteammate.r)\n\t\t\t\tclosestteammate = teammates[i];\n\t\t\t}\n\n\n\t\t/*--- now compute some strategic places to go ---*/\n\t\t// compute a point one robot radius\n\t\t// behind the ball.\n\t\tVec2 kickspot = new Vec2(ball.x, ball.y);\n\t\tkickspot.sub(theirgoal);\n\t\tkickspot.setr(abstract_robot.RADIUS);\n\t\tkickspot.add(ball);\n\n\t\t// compute a point three robot radii\n\t\t// behind the ball.\n\t\tVec2 backspot = new Vec2(ball.x, ball.y);\n\t\tbackspot.sub(theirgoal);\n\t\tbackspot.setr(abstract_robot.RADIUS*5);\n\t\tbackspot.add(ball);\n\n\t\t// compute a north and south spot\n\t\tVec2 northspot = new Vec2(backspot.x,backspot.y+0.7);\n\t\tVec2 southspot = new Vec2(backspot.x,backspot.y-0.7);\n\n\t\t// compute a position between the ball and defended goal\n\t\tVec2 goaliepos = new Vec2(ourgoal.x + ball.x,\n\t\t\t\tourgoal.y + ball.y);\n\t\tgoaliepos.setr(goaliepos.r*0.5);\n\n\t\t// a direction away from the closest teammate.\n\t\tVec2 awayfromclosest = new Vec2(closestteammate.x,\n\t\t\t\tclosestteammate.y);\n\t\tawayfromclosest.sett(awayfromclosest.t + Math.PI);\n\n\n\t\t/*--- go to one of the places depending on player num ---*/\n\t\tint mynum = abstract_robot.getPlayerNumber(curr_time);\n\n\t\t/*--- Goalie ---*/\n\t\tif (mynum == 0)\n\t\t\t{\n\t\t\t// go to the goalie position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = goaliepos;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.1) \n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\t/*--- midback ---*/\n\t\telse if (mynum == 1)\n\t\t\t{\n\t\t\t// go to a midback position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = backspot;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.30) \n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse if (mynum == 2)\n\t\t\t{\n\t\t\t// go to a the northspot position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = northspot;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.30) \n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\telse if (mynum == 4)\n\t\t\t{\n\t\t\t// go to a the northspot position if far from the ball\n\t\t\tif (ball.r > 0.5) \n\t\t\t\tresult = southspot;\n\t\t\t// otherwise go to kick it\n\t\t\telse if (ball.r > 0.3 )\n\t\t\t\tresult = kickspot;\n\t\t\telse \n\t\t\t\tresult = ball;\n\t\t\t// keep away from others\n\t\t\tif (closestteammate.r < 0.3)\n\t\t\t\t{\n\t\t\t\tresult = awayfromclosest;\n\t\t\t\t}\n\t\t\t}\n\n\t\t/*---Lead Forward ---*/\n\t\telse if (mynum == 3)\n\t\t\t{\n\t\t\t// if we are more than 4cm away from the ball\n\t\t\tif (ball.r > .3)\n\t\t\t\t// go to a good kicking position\n\t\t\t\tresult = kickspot;\n\t\t\telse\n\t\t\t\t// go to the ball\n\t\t\t\tresult = ball;\n\t\t\t}\n\n\n\t\t/*--- Send commands to actuators ---*/\n\t\t// set the heading\n\t\tabstract_robot.setSteerHeading(curr_time, result.t);\n\n\t\t// set speed at maximum\n\t\tabstract_robot.setSpeed(curr_time, 1.0);\n\n\t\t// kick it if we can\n\t\tif (abstract_robot.canKick(curr_time))\n\t\t\tabstract_robot.kick(curr_time);\n\n\t\t/*--- Send message to other robot ---*/\n\t\t// COMMUNICATION\n\t\t// if I can kick\n\t\tif (abstract_robot.canKick(curr_time))\n\t\t\t{\n\t\t\t// and I am robot #3\n\t\t\tif ((mynum==3))\n\t\t\t\t{\n\t\t\t\t// construct a message\n\t\t\t\tStringMessage m = new StringMessage();\n\t\t\t\tm.val = (new Integer(mynum)).toString();\n\t\t\t\tm.val = m.val.concat(\" can kick\");\n\n\t\t\t\t// send the message to robot 2\n\t\t\t\t// note: broadcast and multicast are also\n\t\t\t\t// available.\n\t\t\t\ttry{abstract_robot.unicast(2,m);}\n\t\t\t\tcatch(CommunicationException e){}\n\t\t\t\t}\n\t\t\t}\n\n\t\t/*--- Look for incoming messages ---*/\n\t\t//COMMUNICATION\n\t\twhile (messagesin.hasMoreElements())\n\t\t\t{\n\t\t\tStringMessage recvd = \n\t\t\t\t(StringMessage)messagesin.nextElement();\n\t\t\tSystem.out.println(mynum + \" received:\\n\" + recvd);\n\t\t\t}\n\n\t\t// tell the parent we're OK\n\t\treturn(CSSTAT_OK);\n\t\t}", "@Test\n\t\t\tpublic void testTargetsThreeSteps() {\n\t\t\t\t//Using walkway space that will go near a door with the wrong direction\n\t\t\t\tboard.calcTargets(8, 16, 2);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(4, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(6, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(10, 16)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(7, 15)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(9, 15)));\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t}", "private Vector2 findTarget() \r\n\t{\r\n\t\tVector2 tempVector = new Vector2(1,1);\r\n\t\ttempVector.setLength(Constants.RANGEDSPEED); //TODO make so it can be changed when level difficulty increases\r\n\t\ttempVector.setAngle(rotation + 90);\r\n\t\treturn tempVector;\r\n\t}" ]
[ "0.63556796", "0.6302632", "0.60963565", "0.5984661", "0.5805028", "0.5791289", "0.57698375", "0.5643999", "0.55936784", "0.5590978", "0.55894524", "0.5423312", "0.5404816", "0.5399349", "0.53961486", "0.5364665", "0.536039", "0.5346604", "0.5344275", "0.53356755", "0.53354156", "0.5295615", "0.52552766", "0.52437437", "0.52369916", "0.52211064", "0.51958495", "0.51721144", "0.51440775", "0.5142801", "0.51269", "0.51208574", "0.51195186", "0.5104714", "0.5099882", "0.50946504", "0.5089624", "0.50866944", "0.5082572", "0.50645995", "0.50315017", "0.5023747", "0.5018227", "0.5017964", "0.5006887", "0.5005409", "0.49931163", "0.49916014", "0.498834", "0.4986246", "0.49808636", "0.49779084", "0.497447", "0.49739146", "0.49698558", "0.49670422", "0.49585098", "0.49438658", "0.4930488", "0.4922414", "0.4890383", "0.48828745", "0.4877739", "0.48745668", "0.48722777", "0.48717353", "0.48649588", "0.4859875", "0.48552766", "0.4853823", "0.48537484", "0.48494342", "0.48488653", "0.4833836", "0.48265564", "0.48256126", "0.4820961", "0.48191524", "0.481678", "0.4816721", "0.48156613", "0.48138615", "0.4812081", "0.48092917", "0.4801833", "0.47820035", "0.47772628", "0.47721305", "0.47717935", "0.47717422", "0.47642452", "0.4762944", "0.47628292", "0.47628152", "0.47615713", "0.47560987", "0.4752991", "0.4752871", "0.4746233", "0.4745129" ]
0.5848453
4
This method computes distance based on euclidean distance. Note: Based on human importance, the distance may be changed to lower value
private int computingDistance(Human human) { double coefficient = 1; if (human instanceof AmbulanceTeam) { coefficient = 0.90; } else if (human instanceof PoliceForce) { coefficient = 0.95; } else if (human instanceof FireBrigade) { coefficient = 0.97; } else {//human is instance of Civilian coefficient = 1; } return (int) (coefficient * Util.distance(human.getPosition(worldInfo.getRawWorld()).getLocation(worldInfo.getRawWorld()), worldInfo.getLocation(agentInfo.me()))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int euclideanDistance(DataValue<T> value1, DataValue<T> value2)\r\n\t{\n\t\tint difference = value1.difference(value2);\r\n\t\tdifference = difference * difference;\t\r\n\t\treturn (int) Math.sqrt(difference);\r\n\t}", "public double getEuclideanDistanceTo(Position other) {\n\n double sum = 0;\n //POEY comment: values.length = the number of extraction functions\n //find different values of every object's values in each function (round-robin tournament event itself)\n for (int i = 0; i < values.length; i++) {\n double value = values[i];\n double otherValue = other.values[i];\n double diff = value - otherValue;\n sum += (diff * diff);\n }\n\n return Math.sqrt(sum);\n \n }", "public double distance() {\n \tif (dist == -1) {\n \t\tdist = distance(vertex1, vertex2);\n \t}\n \n \treturn dist;\n }", "double getDistance();", "private static double dist(Data d, Centroid c)\r\n \t{\r\n \t\treturn Math.sqrt(Math.pow((c.Y() - d.Y()), 2) + Math.pow((c.X() - d.X()), 2));\r\n \t}", "default double euclideanDistance(double[] a, double[] b) {\n checkLengthOfArrays(a, b);\n double sum = 0.0;\n for (int i = 0; i < a.length; i++) {\n final double d = a[i] - b[i];\n sum += d * d;\n }\n return Math.sqrt(sum);\n }", "public static double euclideanDistance(Prototype one, Prototype two)\r\n {\r\n return d(one, two);\r\n }", "public double getDistance()\n {\n return Math.abs(getDifference());\n }", "public double getDistance() {\n\n final int R = 6371; // Radius of the earth\n double lat1 = latitude;\n double lon1 = longitude;\n double lat2 = 41.917715; //lat2, lon2 is location of St.Charles, IL\n double lon2 = -88.266027;\n double el1=0,el2 = 0;\n double latDistance = Math.toRadians(lat2 - lat1);\n double lonDistance = Math.toRadians(lon2 - lon1);\n double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2)\n + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2))\n * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2);\n double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n double distance = R * c * 1000; // convert to meters\n\n double height = el1 - el2;\n\n distance = Math.pow(distance, 2) + Math.pow(height, 2);\n\n return Math.sqrt(distance);\n }", "public double ComputeDistance(){ \n\t\tdouble lat1 = this.depAirportCity.getLatDegs() + (double)(this.depAirportCity.getLatMins())/60; \n\t\tdouble lon1 = this.depAirportCity.getLongDegs() + (double)(this.depAirportCity.getLongMins())/60;\n\t\tdouble lat2 = this.arrAirportCity.getLatDegs() + (double)(this.arrAirportCity.getLatMins())/60; \n\t\tdouble lon2 = this.arrAirportCity.getLongDegs() + (double)(this.arrAirportCity.getLongMins())/60;\n\t\t\n\t\tdouble distance = Haversine.getMiles(lat1, lon1, lat2, lon2);\n\t\treturn distance;\n\t}", "private static double EuclideanDistance(Point p1, Point p2) {\n\t\tdouble dx = p2.X - p1.X;\n\t\tdouble dy = p2.Y - p1.Y;\n\t\treturn Math.sqrt(dx * dx + dy * dy);\n\t}", "public double getDistance() { \n\t\treturn Math.pow(input.getAverageVoltage(), exp) * mul; \n\t}", "private void euclidean(Node node, int d){\n int row1 = this.row;\n int col1 = this.col;\n int row2 = node.getRow();\n int col2 = node.getCol();\n\n double aSquared = Math.pow((row1-row2), 2);\n double bSquared = Math.pow((col1-col2), 2);\n\n if(d == 0) //Euclidean normal\n this.hVal = (float)Math.sqrt(aSquared+bSquared);\n else //Euclidean squared\n this.hVal = (float)(aSquared+bSquared);\n\n }", "private Double euclidean(LatitudeLongitude point1, LatitudeLongitude point2) {\n return Double.valueOf(Math.sqrt(Math.pow(point1.getLatitude() - point2.getLatitude(), 2)\n + Math.pow(point1.getLongitude() - point2.getLongitude(), 2)));\n }", "public double distance(double x, double y);", "public float getDistance();", "public static double distancia(Entidade e1,Entidade e2){\r\n\t\tdouble dx = e1.getPosicaoX() - e2.getPosicaoX();\r\n\t\tdouble dy = e1.getPosicaoY() - e2.getPosicaoY();\r\n\t\tdouble d = Math.sqrt(dx*dx + dy*dy);\r\n\t\treturn d;\r\n\t}", "private double distance() {\n\t\tdouble dist = 0;\n\t\tdist = Math.sqrt(Math.abs((xOrigin - x) * (xOrigin - x) + (yOrigin - y) * (yOrigin - y)));\n\t\treturn dist;\n\t}", "double getSquareDistance();", "public void calcDistance() {\n if (DataManager.INSTANCE.getLocation() != null && location.getLength() == 2) {\n Log.e(\"asdf\", DataManager.INSTANCE.getLocation().getLength() + \"\");\n Log.e(\"asdf\", DataManager.INSTANCE.getLocation().getLength() + \"\");\n double dLat = Math.toRadians(location.getLatitude() - DataManager.INSTANCE.getLocation().getLatitude()); // deg2rad below\n double dLon = Math.toRadians(location.getLongitude() - DataManager.INSTANCE.getLocation().getLongitude());\n double a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(Math.toRadians(location.getLatitude()))\n * Math.cos(Math.toRadians(location.getLatitude()))\n * Math.sin(dLon / 2)\n * Math.sin(dLon / 2);\n double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n double d = KM_IN_RADIUS * c; // Distance in km\n distance = (float) d;\n } else distance = null;\n }", "public double getDistance(){\r\n\t\treturn Math.sqrt(\r\n\t\t\t\t(\r\n\t\t\t\t\tMath.pow(\r\n\t\t\t\t\t\tthis.getFirstObject().getCenterX()\r\n\t\t\t\t\t\t- this.getSecondObject().getCenterX()\r\n\t\t\t\t\t, 2 )\r\n\t )\r\n\t\t\t\t+ (\r\n\t\t\t\t\tMath.pow(\r\n\t\t\t\t\t\tthis.getFirstObject().getCenterY()\r\n\t\t\t\t\t\t- this.getSecondObject().getCenterY()\r\n\t\t\t\t\t, 2 )\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t}", "public double dist(Data d, Centroid c)\n {\n return Math.sqrt(Math.pow((c.Y() - d.Y()), 2) + Math.pow((c.X() - d.X()), 2));\n }", "public double distance() {\n return distance;\n }", "public double distance() {\n return distance;\n }", "public double getDistance() {\n\t\tdouble sum = 0;\n\t\tfor(int i = 0; i < ordering.size() - 1; i++) {\n\t\t\tsum += cost[ordering.get(i) - 1][ordering.get(i+1) - 1];\n\t\t}\n\t\treturn sum;\n\t}", "public double getDist() {\n return distance;\n }", "public float getTheDistance(){\n\t\t\n\t\tdistance = sonic.getDistance();\n\t\tSystem.out.println(\"value:\"+ distance);\n\t\t//considering the test results we see after 23 cm we see the +1cm precision and below 23cm we see + 5cm range \n\t\tif (distance<=25){\n\t\treturn (distance-7);\n\t\t}\n\t\telse{return (distance-3);}\n\t}", "private int calcDistance()\n\t{\n\t\tint distance = 0;\n\n\t\t// Generate a sum of all of the difference in locations of each list element\n\t\tfor(int i = 0; i < listSize; i++) \n\t\t{\n\t\t\tdistance += Math.abs(indexOf(unsortedList, sortedList[i]) - i);\n\t\t}\n\n\t\treturn distance;\n\t}", "private double distanceResult(double preLng, double preLat, double nextLng, double nextLat) {\n\t\treturn Math.sqrt((preLng - nextLng) * (preLng - nextLng) + (preLat - nextLat) * (preLat - nextLat));\n\t}", "public double computeDistance(cluster c1, cluster c2) {\n\t\tdouble closest = 4000;\n\t\tfor (point p1 : c1.getPoints()) {\n\t\t\tfor (point p2 : c2.getPoints()) {\n\t\t\t\tdouble dist = Math.sqrt(Math.pow( (p1.x() - p2.x()) , 2) + Math.pow( (p1.y() - p2.y()) , 2));\n\t\t\t\tif (dist < closest) {\n\t\t\t\t\tclosest = dist;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn closest;\n\t}", "private double distance(Double[] e1, Double[] e2) {\n if(e1.length != e2.length)\n throw new IllegalArgumentException(\"e1 and e2 lie in two different dimensional spaces.\");\n\n double sum = 0.0;\n for(int i = 0; i < e1.length; ++i)\n sum += Math.pow(e1[i] - e2[i], 2);\n return Math.sqrt(sum);\n }", "private double getDistance() {\n\t\tfinal double h2 = 86.7;\n\t\t// h1: height of top of camera\n\t\tfinal double h1 = 17.6;\n\n\t\t// a1: angle of camera (relative to chasis)\n\t\tfinal double a1 = 36.175;\n\t\t// a2: angle of target relative to a1\n\t\tfinal double a2 = ty.getDouble(0.0);\n\n\t\t// distance: distance from camera to base of target\n\t\tfinal double distance = ((h2 - h1) / Math.tan(Math.toRadians(a1 + a2)));\n\n\t\tfinal double d = Math.sqrt(Math.pow(h2 - h1, 2) + Math.pow(distance, 2));\n\t\tSmartDashboard.putNumber(\"Py Distance\", d);\n\n\t\treturn (distance);\n\n\t}", "private float distanceTo(BasicEvent event) {\n final float dx = event.x - location.x;\n final float dy = event.y - location.y;\n// return Math.abs(dx)+Math.abs(dy);\n return distanceMetric(dx, dy);\n// dx*=dx;\n// dy*=dy;\n// float distance=(float)Math.sqrt(dx+dy);\n// return distance;\n }", "public float getDistance(){\n\t\t\treturn s1.start.supportFinal.dot(normal);\n\t\t}", "public abstract double distanceFrom(double x, double y);", "public double getDistance(){\n\t\treturn this.distance;\n\t}", "public static double calculateEuclideanDistance(GridPoint point1, GridPoint point2) {\n\t\treturn Math.sqrt(Math.pow(point1.getX() - point2.getX(), 2) + Math.pow(point1.getY() - point2.getY(), 2));\n\t}", "public double computeDistance(Object o){\n \n if (o!=null && o.getClass()==this.getClass()){\n NDimensionalPoint newPoint = (NDimensionalPoint) o;\n if (newPoint.values.size()==values.size()){\n double dist = 0.0;\n for (int i=0;i<values.size();i++){\n dist+=Math.pow(newPoint.getValues().get(i) -values.get(i),2);\n }\n return Math.sqrt(dist);\n }else\n {\n return MAX_DIST;\n }\n }else{\n return MAX_DIST;\n }\n }", "public double calDistance()\n {\n double closest = poly[0].getD();\n\n for(int i = 1; i < sides; i++)\n {\n if(closest > poly[i].getD())\n {\n closest = poly[i].getD();\n }\n }\n this.distance = closest;\n\n return closest;\n }", "protected double getSquaredEuclideanDistance(double[] v1, double[] v2) {\r\n \r\n double sum = 0;\r\n \r\n for(int i = 0; i < v1.length; i++) {\r\n sum += Math.pow((v1[i] - v2[i]), 2);\r\n }\r\n \r\n return sum;\r\n }", "public final double calcDistance( Point a, Point b )\r\n {\r\n return( Math.sqrt( (Math.pow(a.y - b.y, 2)) +\r\n (Math.pow(a.x - b.x, 2)) ) );\r\n }", "public static double dist (ECEF a, ECEF b)\r\n\t{\r\n\t\tdouble distsquared = square (a.x-b.x) + square (a.y-b.y) + square (a.z-b.z);\r\n\t\treturn Math.sqrt(distsquared);\r\n\t}", "void calculate_distance()\n {\n \t\n \tfor(int i = 0; i<V ; i++)\n \t{\n \t\tfor(int j = 0; j<E ; j++)\n \t\t{\n \t\t\trelax(edge[j].src, edge[j].destination, edge[j].weight);\n \t\t}\n \t\tsp[i] = dist[i];\n \t\tx[i] = dist[i];\n \t}\n \tSystem.out.println();\n }", "public double distance(DataInstance d1, DataInstance d2, List<Attribute> attributeList);", "public HashMap getClusterDiameter() {\n double maxEuclideanDistance = 0;\n double maxCorrelationDistance = 0;\n\n Set probeIDSet = points.keySet();\n Iterator probeIt = probeIDSet.iterator();\n \n int comparisonIndex = 0;\n \n while (probeIt.hasNext()) {\n int probeID = (Integer) probeIt.next();\n double[] pointA = (double[]) points.get(probeID);\n\n Set probeIDSet2 = points.keySet();\n Iterator probeIt2 = probeIDSet2.iterator();\n while (probeIt2.hasNext()) {\n int probeID2 = (Integer) probeIt2.next();\n double[] pointB = (double[]) points.get(probeID2);\n \n HashMap distances = KMeans.getDistances(pointA, pointB);\n double eucDist = (Double) distances.get(\"euclidean\");\n double correlDist = (Double) distances.get(\"correlation\");\n \n if (comparisonIndex == 0) { // First distance\n maxEuclideanDistance = eucDist;\n maxCorrelationDistance = correlDist;\n } else if (eucDist > maxEuclideanDistance) {\n maxEuclideanDistance = eucDist;\n } else if ( Math.abs(correlDist) < maxCorrelationDistance) {\n maxCorrelationDistance = correlDist;\n }\n comparisonIndex++;\n }\n }\n \n HashMap<String, Double> distances = new HashMap<String, Double>();\n distances.put(\"euclidean\", maxEuclideanDistance);\n distances.put(\"correlation\", maxCorrelationDistance);\n return distances;\n }", "default double euclideanDistanceAbs(double[] a, double[] b) {\n checkLengthOfArrays(a, b);\n double sum = 0.0;\n for (int i = 0; i < a.length; i++) {\n final double d = Math.abs(a[i] - b[i]);\n sum += d * d;\n }\n return Math.sqrt(sum);\n }", "public double distance(InputDatum datum, InputDatum datum2) throws MetricException;", "public double getEuclideanDistance2D( double x1, double x2, double y1, double y2 )\n {\n double distance;\n double t1 = x1 - y1;\n double t2 = t1 * t1;\n t1 = x2 - y2;\n t2 += ( t1 * t1 );\n distance = Math.sqrt( t2 );\n\n return distance;\n }", "public double distance(){\n return DistanceTraveled;\n }", "public int distance() {\n return distance;\n }", "public static float euclideanDistance(PointF firstPoint, PointF secondPoint) {\n return PointF.length(secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y);\n }", "public double getDistanceTo(CoordPair dest)\r\n\t{\n\t\tif(isAdjacent(dest))\r\n\t\t\treturn 1;\r\n\t\tint rowDiff = this.row - dest.getRow();\r\n\t\tint colDiff = this.col - dest.getCol();\r\n\t\tint sumSquares = (int) (Math.pow(rowDiff,2) + Math.pow(colDiff, 2));\r\n\t\tdouble distance = Math.sqrt(sumSquares);\r\n\t\t\r\n\t\treturn distance;\r\n\t}", "public double getDistance() {\n return distance;\n }", "public double getDistance() {\n\t\treturn distance;\n\t}", "public double getDistance() {\n\t\treturn distance;\n\t}", "double getDistance(int i, int j){\r\n\tdouble d = (coord[i][0]-coord[j][0])*(coord[i][0]-coord[j][0])+ (coord[i][1]-coord[j][1])*(coord[i][1]-coord[j][1]);\r\n\td = Math.sqrt(d);\r\n\treturn d;\r\n}", "public int getDistance(int row1, int col1, int row2, int col2) throws EnvironmentException\r\n\t{\r\n\t\tif(row1 < rows && row2 < rows && col1 < columns && col2 < columns &&\r\n\t\t\t\trow1 >= 0 && row2 >= 0 && col1 >= 0 && col2 >= 0)\r\n\t\t{\r\n\t\t\t//if same row, return the absolute value of column difference times 5\r\n\t\t\tif(row1 == row2)\r\n\t\t\t{\r\n\t\t\t\treturn Math.abs(col1-col2)*5;\r\n\t\t\t}\r\n\t\t\t//if same col, return the absolute value of row difference times 5\r\n\t\t\telse if(col1 == col2)\r\n\t\t\t{\r\n\t\t\t\treturn Math.abs(row1-row2)*5;\r\n\t\t\t}\r\n\t\t\t//if different rows and columns, use Pythagorean Theorem to compute distance\r\n\t\t\treturn (int)Math.sqrt(Math.pow((row1-row2)*5, 2)+Math.pow((col1-col2)*5, 2));\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthrow new EnvironmentException();\r\n\t\t}\r\n\t}", "protected float getDistance(float distance) {\r\n\t\treturn distance * parent.pixelsPerUnit;\r\n\t}", "public double getDistance () {\n return distance;\n }", "public double calcDistance(GpsCoordinate other)\n\t{\n\t\tdouble lat1 = degToRadian(this.latitude);\n\t\tdouble lng1 = degToRadian(this.longitude);\n\t\tdouble lat2 = degToRadian(other.latitude);\n\t\tdouble lng2 = degToRadian(other.longitude);\n\t\t\n\t\t/*\n\t\t * use haversine Formula to calc the distance\n\t\t * @see: http://en.wikipedia.org/wiki/Haversine_formula\n\t\t */\n\t\tdouble inRootFormula = Math.sqrt(\n\t\t\t\tMath.sin((lat1 - lat2)/2)*Math.sin((lat1 - lat2)/2)+\n\t\t\t\tMath.cos(lat1)*Math.cos(lat2)*Math.sin((lng1-lng2)/2)*Math.sin((lng1-lng2)/2));\n\t\t\n\t\treturn 2* EARTH_RADIUS * Math.asin(inRootFormula);\n\n\t\n\t}", "public float getDistance() {\r\n return distance;\r\n }", "double distanceEcl(Coord other) {\n\t\tint deltaX = x - other.x;\n\t\tint deltaY = y - other.y;\n\t\treturn sqrt(((double)deltaX * deltaX) + ((double)deltaY * deltaY));\n\t}", "public double getDistance(College c) {\n double salary_diff = Math.pow(this.medianSalary - c.getMedianSalary(), 2.0);\n double sat_diff = Math.pow(this.avgSAT - c.getAvgSAT(), 2.0);\n double gpa_diff = Math.pow(this.avgGPA - c.getAvgGPA(), 2.0);\n double accRate_diff = Math.pow(this.accRate - c.getAccRate(), 2.0);\n\n return Math.sqrt(salary_diff + sat_diff + gpa_diff + accRate_diff);\n }", "public final float getDistance() {\n return distance;\n }", "public double averageEuclideanDistance() {\n\n\t\tdouble sumEuclideanDistances = 0;\n\t\tdouble nDistances = popSize * popSize;\n\t\t// double distance = 0;\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tfor (int j = 0; j < popSize; j++){\n\t\t\t\tIndividual oneIndividual = getIndividualAtIndex(i);\n\t\t\t\tIndividual otherIndividual = getIndividualAtIndex(j);\n\t\t\t\tdouble[] genotypeOneIndidivual = oneIndividual.getGenotype();\n\t\t\t\tdouble[] genotypeOtherIndidivual = otherIndividual.getGenotype();\n\t\t\t\tdouble distance = euclideanDistanceMetric(genotypeOneIndidivual, genotypeOtherIndidivual);\n\t\t\t\tsumEuclideanDistances += distance;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t// double average = sumEuclideanDistances / nDistances;\n\n\t\treturn sumEuclideanDistances / nDistances;\n\t}", "public float getDistance() {\n return distance;\n }", "public static EquationExpression dist(final EquationPoint a, final EquationPoint b) {\n return sqrt(dist2(a,b));\n }", "public double getEuclideanDistance( Double[] x, Double[] y )\n {\n double distance = 0;\n double t = 0;\n double s = 0;\n\n for( int i=0; i<x.length; i++ )\n {\n t = x[ i ] - y[ i ];\n s += (t * t);\n }\n\n distance = Math.sqrt( s );\n\n return distance;\n }", "double getDistanceInMiles();", "public int distance(Coord coord1, Coord coord2);", "public static double getEuclideanDistance(DblArray1SparseVector x, \r\n\t\t DblArray1SparseVector y) {\r\n if (x==null || y==null) \r\n\t\t\tthrow new IllegalArgumentException(\"at least one arg null\");\r\n if (x.getNumCoords()!=y.getNumCoords()) \r\n\t\t\tthrow new IllegalArgumentException(\"args of different dimensions\");\r\n\t\tfinal int n = x.getNumCoords();\r\n double dist = 0.0;\r\n\t\tif (Double.compare(x.getDefaultValue(),y.getDefaultValue())==0) {\r\n\t\t\tfinal int xs_nz = x.getNumNonZeros();\r\n\t\t\tfinal int ys_nz = y.getNumNonZeros();\r\n\t\t\tfinal double defVal = x.getDefaultValue();\r\n\t\t\tint x_ind = 0;\r\n\t\t\tint y_ind = 0;\r\n\t\t\twhile (x_ind<xs_nz || y_ind<ys_nz) {\r\n\t\t\t\tint x_pos = x_ind < xs_nz ? x.getIthNonZeroPos(x_ind) : \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tInteger.MAX_VALUE;\r\n\t\t\t\tint y_pos = y_ind < ys_nz ? y.getIthNonZeroPos(y_ind) :\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tInteger.MAX_VALUE;\r\n\t\t\t\tif (y_pos < x_pos) {\r\n\t\t\t\t\tdouble yi = y.getIthNonZeroVal(y_ind)-defVal;\r\n\t\t\t\t\tdist += yi*yi;\r\n\t\t\t\t\ty_ind++;\r\n\t\t\t\t}\r\n\t\t\t\telse if (x_pos < y_pos) {\r\n\t\t\t\t\tdouble xi = x.getIthNonZeroVal(x_ind)-defVal;\r\n\t\t\t\t\tdist += xi*xi;\r\n\t\t\t\t\tx_ind++;\r\n\t\t\t\t}\r\n\t\t\t\telse { // x_pos==y_pos\r\n\t\t\t\t\tdouble xmyi = y.getIthNonZeroVal(y_ind)-x.getIthNonZeroVal(x_ind);\r\n\t\t\t\t\tdist += xmyi*xmyi;\r\n\t\t\t\t\tx_ind++;\r\n\t\t\t\t\ty_ind++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn Math.sqrt(dist);\r\n\t\t}\r\n for (int i=0; i<n; i++) {\r\n double xi = x.getCoord(i);\r\n double yi = y.getCoord(i);\r\n dist += (xi-yi)*(xi-yi);\r\n }\r\n return Math.sqrt(dist);\t\t\r\n\t}", "public double getDistance() {\r\n return this.distance;\r\n }", "private static double calculaDistancia(double[] param1, double[] param2){\n\t\tdouble res1= Math.pow((param1[0]-param2[0]), 2);\n\t\tdouble res2= Math.pow((param1[1]-param2[1]), 2);\n\t\tdouble res3= Math.pow((param1[2]-param2[2]), 2);\n\t\tdouble res4= res1 + res2 + res3;\n\t\tdouble res5= res4/3;\n\t\tdouble res6= Math.sqrt(res5);\n\t\treturn res6;\n\t}", "private static final double[][] computeDistances(Tree tree, IdGroup idGroup)\n\t{\n\t\treturn computeDistances(tree, idGroup, false, 0.0);\n\t}", "private static int calculateEuclidianDistance(Node actualNode, Node targetNode)\n\t{\n\t\t\n\t\treturn (int)Math.sqrt(Math.pow((actualNode.getRow() - targetNode.getRow()), 2) +\n\t\t\t\t\tMath.pow((actualNode.getColumn() - targetNode.getColumn()), 2));//distance*(int)Math.sqrt(dx+dy);\n\t}", "public double calcDist(int [] colorList){\r\n\t\t\r\n\t\tdouble red = colorList[0] - 186;\r\n\t\tdouble green = colorList[1] - 149;\r\n\t\tdouble blue = colorList[2] - 107;\r\n\t\tdouble dist = Math.sqrt(red * red + green * green +\r\n\t\t\t\tblue * blue);\r\n\t\t\r\n\t\tdouble red1 = colorList[0] - 91.0;\r\n\t\tdouble green1 = colorList[1] - 70.0;\r\n\t\tdouble blue1 = colorList[2] - 45.0;\r\n\t\tdouble dist1 = Math.sqrt(red1 * red1 + green1 * green1 +\r\n\t\t\t\tblue1 * blue1);\r\n\t\treturn Math.min(dist, dist1) ;\r\n\t}", "public static EquationExpression dist(final EquationPoint a,\n\t\t\tfinal EquationPoint b) {\n\t\treturn sqrt(dist2(a, b));\n\t}", "static private double dist(double[] a, double[] b) {\n\t\treturn new gov.pnnl.jac.geom.distance.Euclidean().distanceBetween(a, b);\n }", "public double getDistance() {\n\t\t// miles = miles/hr * s / (s/hr)\n\t\treturn (double)speed/10.0 * duration / 3600.0;\n\t}", "public double distance(int x, int y){\n double distanceSq= Math.pow(this.x-x,2.0) + Math.pow(this.y-y,2.0);\n //double distance= Math.sqrt(distanceSq);\n return Math.sqrt(distanceSq);\n }", "public double getEuclideanDistance( double[] x, double[] y )\n {\n double distance = 0;\n double t = 0;\n double s = 0;\n\n for( int i=0; i<x.length; i++ )\n {\n t = x[ i ] - y[ i ];\n s += (t * t);\n }\n\n distance = Math.sqrt( s );\n\n return distance;\n }", "double distance(double x1, double y1, double x2, double y2) {\r\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\r\n }", "public float getDistance() {\n shouldUpdateDistance = true;\n if (shouldUpdateDistance) {\n distance = getDistance(createSuggestedWindowFilter());\n shouldUpdateDistance = false;\n }\n return distance;\n }", "public double getSquaredEuclidianDistanceTo(final Coordinate c2){\n return Math.pow(c2.latitude - this.latitude,2) + Math.pow(c2.longitude - this.longitude, 2);\n }", "public float getDistance() {\n return distance;\n }", "public static double getDistance( GameObject one, GameObject two )\n {\n double deltaX = getDeltaX( one, two );\n double deltaY = getDeltaY( one, two );\n return Math.sqrt( deltaX * deltaX + deltaY * deltaY );\n }", "Execution getClosestDistance();", "public double getDistance() {\n return this.distance;\n }", "public static double getEuclideanDistance(VectorIntf x, VectorIntf y) {\r\n if (x==null || y==null) \r\n\t\t\tthrow new IllegalArgumentException(\"at least one arg null\");\r\n if (x.getNumCoords()!=y.getNumCoords()) \r\n\t\t\tthrow new IllegalArgumentException(\"args of different dimensions\");\r\n\t\tfinal int n = x.getNumCoords();\r\n double dist = 0.0;\r\n for (int i=0; i<n; i++) {\r\n double xi = x.getCoord(i);\r\n double yi = y.getCoord(i);\r\n dist += (xi-yi)*(xi-yi);\r\n }\r\n return Math.sqrt(dist);\r\n }", "public abstract double GetDistance();", "private static double distance(double lat1, double lat2, double lon1, double lon2,\n\t double el1, double el2) {\n\n\t final int R = 6371; // Radius of the earth\n\n\t Double latDistance = deg2rad(lat2 - lat1);\n\t Double lonDistance = deg2rad(lon2 - lon1);\n\t Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2)\n\t + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2))\n\t * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2);\n\t Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\t double distance = R * c * 1000; // convert to meters\n\n\t double height = el1 - el2;\n\t distance = Math.pow(distance, 2) + Math.pow(height, 2);\n\t return Math.sqrt(distance);\n\t}", "@Override\n public double distance(NumberVector o1, NumberVector o2) {\n double dt = Math.abs(o1.doubleValue(0) - o2.doubleValue(0));\n // distance value of earth coordinates in meter\n double dc = getDistance(o1.doubleValue(1), o1.doubleValue(2), o2.doubleValue(1), o2.doubleValue(2));\n return dt + dc;\n }", "public double getDistance(ArrayList<Integer> e, ArrayList<Integer> f) {\n double distance =0;\n if(e.size()>2 || f.size()>2){\n \n ArrayList<Double> aux = new ArrayList<>();\n aux.add (Math.sqrt(Math.pow(e.get(0) - f.get(0), 2) + Math.pow(e.get(1) - f.get(1), 2)));\n aux.add(Math.sqrt(Math.pow(e.get(0) - f.get(2), 2) + Math.pow(e.get(1) - f.get(3), 2)));\n aux.add(Math.sqrt(Math.pow(e.get(0) - f.get(4), 2) + Math.pow(e.get(1) - f.get(5), 2)));\n aux.add(Math.sqrt(Math.pow(e.get(0) - f.get(6), 2) + Math.pow(e.get(1) - f.get(7), 2)));\n Collections.sort(aux);\n distance = aux.get(0);\n \n }\n else{\n\n distance = Math.sqrt(Math.pow(e.get(0) - f.get(0), 2) + Math.pow(e.get(1) - f.get(1), 2));\n //distancia entre dois pontos\n }\n return distance;\n\n }", "private double calculateDistance(Example first, Example second) {\n\t\tdouble distance = 0;\n\t\tfor (Attribute attribute : first.getAttributes()) {\n\t\t\tdouble diff = first.getValue(attribute) - second.getValue(attribute);\n\t\t\tdistance += diff * diff;\n\t\t}\n\t\treturn Math.sqrt(distance);\n\t}", "public static long distSquared(Datum d1, Datum d2) {\r\n\r\n\t\tlong result = 0;\r\n\t\tfor (int dim = 0; dim < d1.x.length; dim++) {\r\n\t\t\tresult += (d1.x[dim] - d2.x[dim])*((long) (d1.x[dim] - d2.x[dim]));\r\n\t\t}\r\n\t\t// if the Datum coordinate values are large then we can easily exceed the limit of 'int'.\r\n\t\treturn result;\r\n\t}", "public double euclideDistance(ArrayList<Double> vectorA, ArrayList<Double> vectorB) {\n double distance = 0.0;\n for (int i = 0; i < vectorA.size(); i++) {\n distance += Math.pow(vectorA.get(i) - vectorB.get(i), 2);\n }\n return Math.sqrt(distance);\n }", "private double calculateDistance(int sourceX, int sourceY, int targetX, int targetY){\n int xLength = targetX - sourceX;\n int yLength = targetY - sourceY;\n return Math.sqrt((xLength*xLength)+(yLength*yLength)); \n }", "private void calculateDistances() {\n for (int point = 0; point < ntree.size(); point++) {\n calculateDistances(point);\n }\n }", "public double distancia(Pixel pixel) {\r\n\t\tdouble distX = this.xDouble - pixel.xDouble;\r\n\t\tdouble distY = this.yDouble - pixel.yDouble;\r\n\t\tdouble val = distX * distX + distY * distY;\r\n\t\tif (val != 0)\r\n\t\t\treturn Math.sqrt(val);\r\n\t\treturn 0;\r\n\t}", "public double getDistance(){\n return sensor.getVoltage()*100/2.54 - 12;\n }", "public double getClosestDistance(){\n\t\t\tdouble distance;\n\t\t\tdouble distanceMin = Double.MAX_VALUE;\n\t\t\tPoint centroid = centroid();\n\t\t\tfor(Point p : clusterPointsList){\n\t\t\t\tdistance = p.dist(centroid);\t\t\t\n\t\t\t\tif(distance < distanceMin){\n\t\t\t\t\tdistanceMin = distance;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn distanceMin;\n\t\t}" ]
[ "0.74070835", "0.6879562", "0.6856477", "0.6817672", "0.6816904", "0.6778078", "0.67774713", "0.6699773", "0.6646563", "0.6637409", "0.66348124", "0.66270584", "0.66264766", "0.6604974", "0.6604686", "0.65473425", "0.6505142", "0.64949536", "0.645954", "0.6443619", "0.64363927", "0.64320564", "0.642634", "0.642634", "0.64245397", "0.64134187", "0.6406474", "0.6386812", "0.6386775", "0.6372185", "0.63697696", "0.6323835", "0.6310471", "0.62856305", "0.628479", "0.6274042", "0.62677294", "0.62643826", "0.6260735", "0.6259054", "0.62561226", "0.6252142", "0.62451494", "0.6230464", "0.6227953", "0.6213595", "0.6211263", "0.6196681", "0.6193633", "0.6192365", "0.6187732", "0.6183735", "0.61778265", "0.6170989", "0.6170989", "0.61503273", "0.61416227", "0.6138623", "0.6132927", "0.6121181", "0.6116641", "0.6116296", "0.61135834", "0.6110528", "0.61092335", "0.6106323", "0.6103438", "0.6102524", "0.61008745", "0.60990024", "0.60965204", "0.6094377", "0.60870695", "0.6084067", "0.6083053", "0.60809743", "0.60786104", "0.60775805", "0.60753715", "0.60674363", "0.60670966", "0.6065122", "0.6057831", "0.605694", "0.60534155", "0.6051968", "0.60461426", "0.6033228", "0.6032773", "0.6030215", "0.6027174", "0.60155654", "0.6013967", "0.6006533", "0.5999054", "0.5996448", "0.5995469", "0.5991007", "0.5983087", "0.59806436", "0.5978304" ]
0.0
-1
Retourne potentiellement un Compte en fonction de son ID.
@Override public Optional<Compte> getById(Long idCompte) { Session session = entityManager.unwrap(Session.class); return Optional.of(session.get(Compte.class, idCompte)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Integer getCompteId();", "public String getCompoId() {\n\t return compoId;\r\n\t }", "public Long getCompId() {\n return compId;\n }", "public Long getCompId() {\n return compId;\n }", "public Integer getCompId() {\n return compId;\n }", "public Integer getCompid() {\n return compid;\n }", "public int getId()\r\n/* 53: */ {\r\n/* 54: 79 */ return this.idDetalleComponenteCosto;\r\n/* 55: */ }", "@Override\n public Complaint getComplaintById(int id) {\n DataConnection db = new DataConnection();\n Connection conn = db.getConnection();\n\n String query = \"SELECT * FROM Complaint WHERE id = ?\";\n ResultSet rs = null;\n try {\n PreparedStatement ps = conn.prepareStatement(query);\n ps.setInt(1, id);\n rs = ps.executeQuery();\n if (rs.next()) {\n return this.createComplaintObj(rs);\n }\n } catch (SQLException ex) {\n Logger.getLogger(DefaultComplaintsManagements.class.getName()).log(Level.SEVERE, null, ex);\n }\n return null;\n }", "@Override\r\n\tpublic Integer getId() {\n\t\treturn this.codContacto;\r\n\t}", "public int getIdCompI() {\n\t\treturn ID_COMP_I;\n\t}", "public Long getId()\r\n\t{\r\n\t\treturn idContrat;\r\n\t}", "public java.lang.Long getId_tecnico();", "Object getId();", "public Long getId() {\r\n return idComentario;\r\n }", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "java.lang.String getId();", "public int getId()\r\n/* 208: */ {\r\n/* 209:381 */ return this.idCargaEmpleado;\r\n/* 210: */ }", "public Componente getComponente(int id) {\n\t\ttry {\n\t\t\tfor(Map.Entry<String, ArrayList<Componente>> entry : this.mappaComponenti.entrySet()) {\n\t\t\t\tArrayList<Componente> tempList = entry.getValue();\n\t\t\t\tfor(Componente c : tempList) {\n\t\t\t\t\tif(c.getId() == id) return c;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t} catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}", "java.lang.String getID();", "public abstract java.lang.Long getId_causal_peticion();", "public Integer getIdCurso() {\r\n return idCurso;\r\n }", "@Override\n Optional<Complaint> findById(Integer id);", "public CompraResponse idCompra(Long idCompra) {\n this.idCompra = idCompra;\n return this;\n }", "@Override\n public long getCompanyId() {\n return _partido.getCompanyId();\n }", "CE findById(ID id);", "@Override\n\tpublic TransferCompra detalleCompra(int id) {\n\t\t\n\t\t//Creamos la Transaccion\n\t\tTransactionManager.getInstance().nuevaTransaccion();\n\t\tTransactionManager.getInstance().getTransaccion().start();\n\t\t\n\t\t//Hacemos Commit \n\t\tTransferCompra t = FactoriaDAO.getInstance().createDAOCompra().searchId(id);\n\t\tTransactionManager.getInstance().getTransaccion().commit();\n\t\t\n\t\t//Finalmente cerramos la Transaccion\n\t\tTransactionManager.getInstance().eliminaTransaccion();\n\t\treturn t;\n\t}", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "String getId();", "CTipoComprobante selectByPrimaryKey(String idTipoComprobante)\r\n\t\t\tthrows SQLException;", "Integer getId();", "Integer getId();", "Integer getId();", "public java.lang.String getClienteComplementoID() {\n\t\treturn clienteComplementoID;\n\t}", "public Conge find( Integer idConge ) ;", "Integer getID();", "Integer getID();", "String getCampoId();", "String getID();", "String getID();", "String getID();", "String getID();", "@Override\n\tpublic Optional<Comprobante> findById(Integer id) throws Exception {\n\t\treturn comproRepository.findById(id);\n\t}" ]
[ "0.7837721", "0.73290443", "0.7152379", "0.7152379", "0.7094046", "0.70904064", "0.6908809", "0.68714654", "0.68087596", "0.67653567", "0.6636247", "0.66037154", "0.65567976", "0.6523787", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.65110505", "0.64843833", "0.6440454", "0.64320177", "0.64300233", "0.6410592", "0.63876003", "0.6382636", "0.6382197", "0.6379985", "0.6347178", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.63438296", "0.6309098", "0.6304936", "0.6304936", "0.6304936", "0.62902683", "0.62824076", "0.624339", "0.624339", "0.62412304", "0.623592", "0.623592", "0.623592", "0.623592", "0.6228187" ]
0.6935366
6
Supprime un Compte en fonction de son ID.
@Override public void deleteById(Long idCompte) { Session session = entityManager.unwrap(Session.class); Compte compte = session.get(Compte.class, idCompte); session.remove(compte); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean supprimerCompte(int id);", "public static int suprrimerCompte(int Compteid){\n\t\ttry{\n\t\t\tDAO.getLog().envoyerlog(10, \"DAOUtilisateur\", \"suprrimerCompte: tentative suppression enregistrement compte= \"+Compteid );\n\t Connection maConnexion = DAO.getConnection();\n\t PreparedStatement st = maConnexion.prepareStatement(\"DELETE FROM t_compte WHERE Compte_Id=?;\");\t\t \n\t st.setInt(1, Compteid);\n\t \n\t st.executeUpdate();\n\t maConnexion.close();\n\t \n\t\t\treturn 1;\n\t\t}\n\t\tcatch(SQLException e)\n\t\t{\n\t\t\tDAO.getLog().envoyerlog(2, \"DAOUtilisateur\", \"suprrimerCompte: Echec supression enregistrement compte= \"+Compteid );\n\t\t\treturn -1;\n\t\t}\n\t}", "@Override\n\tpublic boolean supprimerConseillerByID(int pIDConseiller) {\n\t\treturn false;\n\t}", "@Override\n\tpublic void eliminar(Integer id) {\n\t\t\n\t}", "@Override\n\tpublic void eliminar(Integer id) {\n\t\t\n\t}", "@Override\r\n\tpublic void deleteFamille (Long idFamilleComp) {\n\t\tSession session=HibernateUtil.getSessionFactory().getCurrentSession();\r\n \t\tsession.beginTransaction();\r\n \t\tObject C=session.get(Famille.class, idFamilleComp);\r\n \t\tif(C==null) throw new RuntimeException(\"FamilleComp non crées\");\r\n \t session.delete(C);\r\n \t session.getTransaction().commit();\r\n\t}", "@Override\r\n\tpublic int elimina(int id) throws Exception {\n\t\treturn 0;\r\n\t}", "void eliminar(Long id);", "void DeleteCompteUser(int id);", "public static void supprimerEnseignant(int id) {\n EntityManager em = GestionFactory.factory.createEntityManager();\n\n // Recherche\n @SuppressWarnings(\"unchecked\")\n Query query = em.createQuery(\n \"SELECT e FROM Enseignant e WHERE e.idEnseignant = :idEnseignant\")\n .setParameter(\"idEnseignant\", id);\n\n Enseignant enseignant = (Enseignant) query.getSingleResult();\n List<Module> listeModules = enseignant.getModules();\n\n for(int i=0;i < listeModules.size();i++){\n listeModules.get(i).setEnseignant(null);\n ModuleDAO.update(listeModules.get(i));\n }\n\n em.getTransaction().begin();\n em.remove(enseignant);\n em.getTransaction().commit();\n\n em.close();\n\n }", "@Override\r\n\tpublic void excluir(int id) throws Exception {\n\t\t\r\n\t}", "public void deletar(Integer id) {\n\t\t\n\t}", "public boolean supprimerProduit(int id, Magasin mag);", "public void supprimerParcelle() {\n\t\tboolean isEmpty=false;\n\t\tint nbParcelleSup=0;\n\t\tList<String> nomParcellesNonSupprimees = new ArrayList<>();\n\t\tList<String> nomParcellesSupprimees = new ArrayList<>();\n\n\t\tfor (String emplacement : emplacementsSelectionneesFromJS.split(\"-\")) {\n\t\t\tnbParcelleSup++;\n\n\t\t\tif (!isEmpty(emplacement)){\n\t\t\t\tString[] refEmplacement= emplacement.split(\"_\");\n\t\t\t\tint numLigne = Integer.parseInt(refEmplacement[0]);\n\t\t\t\tint numColonne = Integer.parseInt(refEmplacement[1]);\n\t\t\t\tEmplacement e = obtenirEmplacement(numLigne,numColonne);\n\n\t\t\t\tif(e != null && notHaveTachePlanified(parcelle).equals(\"true\") ) {\n\t\t\t\t\t// Suppression de la parcelle \n\t\t\t\t\tthis.parcelle = e.getParcelle();\n\t\t\t\t\taffecterDateRetraitPuisMAJParcelleEnBase(parcelle);\n\t\t\t\t\tnomParcellesSupprimees.add(parcelle.getLibelleParcelle());\n\t\t\t\t\tSystem.out.println(\"Supprimer Parcelle OK \");\n\t\t\t\t}else {\n\t\t\t\t\tnomParcellesNonSupprimees.add(parcelle.getLibelleParcelle());\n\t\t\t\t}\n\t\t\t}else {\n\t\t\t\t//Probleme de selection d'emplacement\n\t\t\t\tisEmpty=true;\n\t\t\t}\n\t\t}\n\n\t\tif(isEmpty&&nbParcelleSup==1) {\n\t\t\tmsgInfoActionGrilleJS=\"Erreur : La selection ne correspond à aucune parcelle !\";\n\t\t\tetatMsgInfoGrilleJS=\"color:red;\";\n\t\t\tSystem.out.println(\"Supprimer Parcelle KO : L'emplacement selectionnee n'est pas affecté à une parcelle \");\n\t\t}else {\n\t\t\tif(nbParcelleSup>1) {\n\t\t\t\tString listeLibelleParcellesSupprimees=\"\";\n\t\t\t\tString listeLibelleParcellesNonSupprimees=\"\";\n\n\t\t\t\tfor (String string : nomParcellesSupprimees) {\n\t\t\t\t\tlisteLibelleParcellesSupprimees+=string+\", \";\n\t\t\t\t}\n\t\t\t\tfor (String string : nomParcellesNonSupprimees) {\n\t\t\t\t\tlisteLibelleParcellesNonSupprimees+=string+\", \";\n\t\t\t\t}\n\t\t\t\tif(listeLibelleParcellesSupprimees.length()>0) {\n\t\t\t\t\tint i = listeLibelleParcellesSupprimees.length()-2;\n\t\t\t\t\tmsgInfoActionGrilleJS=\"Les parcelles ' \"+listeLibelleParcellesSupprimees.substring(0, i)+\" ' ont bien été retirées !\";\n\t\t\t\t}\n\t\t\t\tif(listeLibelleParcellesNonSupprimees.length()>0) {\n\t\t\t\t\tint j = listeLibelleParcellesNonSupprimees.length()-2;\n\n\t\t\t\t\tmsgInfoActionGrilleJS=\"\\n Attention : Les parcelles ' \"+listeLibelleParcellesNonSupprimees.substring(0, j)+\" ' n'ont pas pu être supprimées (Taches en cours ou emplamcement vide)!\";\n\t\t\t\t}\n\n\t\t\t}else {\n\t\t\t\tmsgInfoActionGrilleJS=\"La parcelle '\"+parcelle.getLibelleParcelle()+\"'a bien été retirée !\";\n\t\t\t}\n\t\t\tetatMsgInfoGrilleJS=\"color:green;\";\n\t\t}\n\t\tthis.clearForm();\n\t}", "void deletar(Long id);", "@Override\n\tpublic boolean eliminar(Long id) {\n\t\treturn false;\n\t}", "public static void supprimerGroupe(int id) {\n\n // Creation de l'entity manager\n EntityManager em = GestionFactory.factory.createEntityManager();\n\n // Recherche\n @SuppressWarnings(\"unchecked\")\n Query query = em.createQuery(\n \"SELECT e FROM Groupe e WHERE e.idGroupe = :idGroupe\")\n .setParameter(\"idGroupe\", id);\n\n Groupe groupe = (Groupe) query.getSingleResult();\n List<Etudiant> listeEtudiants = groupe.getEtudiants();\n\n for(int i=0;i < listeEtudiants.size();i++){\n listeEtudiants.get(i).setGroupe(null);\n EtudiantDAO.update(listeEtudiants.get(i));\n }\n\n em.getTransaction().begin();\n em.remove(groupe);\n em.getTransaction().commit();\n\n em.close();\n\n }", "public void eliminarCajeros(int id);", "public void eliminarTripulante(Long id);", "void unsetID();", "public void supprimerAuteur(Long id) {\n auteurDao.supprimerAuteur(id);\n\n }", "void unsetId();", "public void removeCarritoDeCompras (Long compradorId) {\r\n\r\n CompradorEntity compradorEntity = compradorPersistence.find(compradorId); \r\n CarritoDeComprasEntity carroEntity = carroPersistence.find(compradorEntity.getCarritoDeCompras().getId());\r\n carroPersistence.delete(compradorEntity.getListaDeDeseos().getId());\r\n compradorEntity.setListaDeDeseos(null);\r\n carroEntity.setComprador(null);\r\n \r\n}", "public void effacerProduit(String id, Connection myConn) throws SQLException {\n PreparedStatement myStmt = null;\n\n String sqlExecute = \"DELETE FROM enseignant WHERE id_enseignant ='\" + id + \"'\";\n try {\n myStmt = myConn.prepareStatement(sqlExecute);\n myStmt.executeUpdate();\n\n } catch (SQLException ex) {\n ex.printStackTrace();\n } finally {\n myConn.close();\n myStmt.close();\n }\n }", "public void eliminarCompraComic();", "@Override\n\tpublic TransferCompra detalleCompra(int id) {\n\t\t\n\t\t//Creamos la Transaccion\n\t\tTransactionManager.getInstance().nuevaTransaccion();\n\t\tTransactionManager.getInstance().getTransaccion().start();\n\t\t\n\t\t//Hacemos Commit \n\t\tTransferCompra t = FactoriaDAO.getInstance().createDAOCompra().searchId(id);\n\t\tTransactionManager.getInstance().getTransaccion().commit();\n\t\t\n\t\t//Finalmente cerramos la Transaccion\n\t\tTransactionManager.getInstance().eliminaTransaccion();\n\t\treturn t;\n\t}", "public void supprimerLivre(int id_livre) {\n\t\tsupprimerEmpruntsParLivre(id_livre);\n\t\tsupprimer(new String[] {Integer.toString(id_livre)}, new String[] {\"id\"}, \"livres\");\n\t}", "public void elimina(Long id) {\n\n final EntityManager em = getEntityManager();\n\n try {\n\n final EntityTransaction tx = em.getTransaction();\n\n tx.begin();\n\n // Busca un conocido usando su llave primaria.\n\n final Conocido modelo = em.find(Conocido.class, id);\n\n if (modelo != null) {\n\n /* Si la referencia no es nula, significa que el modelo se encontró la\n\n * referencia no es nula y se elimina. */\n\n em.remove(modelo);\n\n }\n\n tx.commit();\n\n } finally {\n\n em.close();\n\n }\n\n }", "@Override\n public void remove(Integer id) {\n Connection c = null;\n PreparedStatement pstmt = null;\n\n try {\n c = DBUtils.getConnection();\n pstmt = c.prepareStatement(\"DELETE FROM curso WHERE idcurso = ?\");\n\n pstmt.setInt(1, id);\n\n pstmt.executeUpdate();\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (pstmt != null) {\n pstmt.close();\n }\n DBUtils.closeConnection(c);\n } catch (SQLException ex) {\n Logger.getLogger(JdbcCursoRepository.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "public void eliminar(Long id) throws AppException;", "@Override\r\n\tpublic void del(Integer id) {\n\t\t\r\n\t}", "public void supprimerRole(Long idRoUt);", "public String eliminarComentario(int id){\r\n\t\tcomDao.borrar(id);\r\n\t\tinit();\r\n\t\treturn null;\r\n\t}", "@Override\n\tpublic void remove(int id) {\n\n\t}", "public void delete(int id) {\n\t \t\n\t T entity = getEntityManager().find(getEntityClass(), id);\n\t System.out.print(\"------ \" + ((Conexion)entity).getCamposConexion().size()+ \" - - - - - \");\n\t getEntityManager().getTransaction().begin();\n\t getEntityManager().remove(entity);\n\t getEntityManager().getTransaction().commit();\n\t }", "@Override\n\tpublic void remove(int id) {\n\t}", "@Override\r\n\tpublic void eliminar(Long idRegistro) {\n\t\t\r\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "public int delete( Integer idConge ) ;", "public void removeInwDepartCompetence(final String id);", "private void clearId() {\n \n id_ = 0;\n }", "public void setIdDetalleComponenteCosto(int idDetalleComponenteCosto)\r\n/* 63: */ {\r\n/* 64: 87 */ this.idDetalleComponenteCosto = idDetalleComponenteCosto;\r\n/* 65: */ }", "public boolean eliminarCursoPorId(CatCurso catCurso) throws NSJPNegocioException;", "boolean excluir(long id);", "public void supprimerFiche(Fiche fiche) ;", "public abstract void setCompteId(Integer pCompteId);", "@Override\n public Componente remove(Object key) {\n Componente cp = this.get(key);\n try {\n conn = Connect.connect();\n \n PreparedStatement stm = conn.prepareStatement(\"UPDATE Componente SET visivel=FALSE WHERE nome=?;\");\n \n stm.setString(1, (String)key); //parse da key para a querie\n stm.executeUpdate();\n \n } catch (SQLException | ClassNotFoundException e) {\n throw new NullPointerException(e.getMessage());\n } finally {\n Connect.close(conn);\n }\n return cp;\n }", "@Override\r\n\tpublic void DeleteCitizen(int cin) {\n\r\n\t\tem.remove(em.find(Citizen.class, cin));\r\n\r\n\t}", "public void deleteCrime(UUID id) {\n\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "public Long getIdExcluir() {\r\n\t\treturn idExcluir;\r\n\t}", "public abstract Integer getCompteId();", "public void deleteCita(int id){\n try {\n PreparedStatement preparedStatement = con.prepareStatement(\"DELETE FROM paciente WHERE id_paciente=?;\");\n preparedStatement.setInt(1,id);\n preparedStatement.executeUpdate();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }", "public void supprimerImproductifs(){\n grammaireCleaner.nettoyNonProdGramm();\n setChanged();\n notifyObservers(\"2\");\n }", "public void setIdExcluir(Long idExcluir) {\r\n\t\tthis.idExcluir = idExcluir;\r\n\t}", "void eliminar(PK id);", "@Override\r\n\tpublic void deleteConcursoContrataById(int id) {\n\r\n\t}", "public void remove(Integer id) {\n\t\t\r\n\t}", "public void remove(Integer id) {\n\r\n\t}", "private void remove() {\n disableButtons();\n clientgui.getClient().sendDeleteEntity(cen);\n cen = Entity.NONE;\n }", "@Override\n\t/**\n\t * Elimino un empleado.\n\t */\n\tpublic boolean delete(Object Id) {\n\t\treturn false;\n\t}", "private void jBtn_SupprimerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtn_SupprimerActionPerformed\n // Si onglet Client\n if(numOnglet() == 0){\n // On stock l index quand une ligne de la table est selectionnnee\n int rowIndex = jTable_Clients.getSelectedRow();\n // Si pas de ligne selectionnee\n if(rowIndex == -1){\n showMessageDialog(null, \"Veuillez sélectionner la ligne du Client \"\n + \"à supprimer\");\n }\n else{\n // On appelle la methode d instance associee au Client selectionne\n laListeClient.get(rowIndex).Suppression();\n try {\n tableClient();\n } catch (Exception ex) {\n Logger.getLogger(JFrame_Accueil.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }\n // Onglet Prospect\n else{\n // On stock l index quand une ligne de la table est selectionnnee\n int rowIndex = jTable_Prospects.getSelectedRow();\n // Si pas de ligne selectionnee\n if(rowIndex == -1){\n showMessageDialog(null, \"Veuillez sélectionner la ligne du Prospect \"\n + \"à supprimer\");\n }\n else{\n // On appelle la methode d instance associee au Client selectionne\n laListeProspeect.get(rowIndex).Suppression();\n try {\n tableProspect();\n } catch (Exception ex) {\n Logger.getLogger(JFrame_Accueil.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }\n hideButton();\n }", "@Override\r\n\tpublic void eliminar() {\n\t\ttab_cuenta.eliminar();\r\n\t}", "public void eliminarProductoComprado(int id, boolean usarNumeroProducto){\n if(usarNumeroProducto){\n Iterator<Producto> itr = listaProductosComprados.iterator();\n while(itr.hasNext()){\n Producto temp = itr.next();\n if(temp.obtenerNumeroProducto()==id){\n itr.remove();\n }\n }\n }else{\n if(id>=0 && id < listaProductosComprados.size()){\n listaProductosComprados.remove(id);\n }\n }\n }", "@Override\n\tpublic void deleteById(Integer id) throws Exception {\n\t\tcomproRepository.deleteById(id);\n\t}", "@Override\n\tpublic void del(Object id) {\n\n\t}", "@Override\n public void delete(int id) {\n repr.delete(id);\n }", "public void eliminaBD() {\r\n CBD.openConexion();\r\n //------Reune los datos de producto con id--------------//\r\n String A = CBD.getInveID(II.lblid.getText());\r\n String B[] = A.split(\",\");\r\n //------Reune los datos de producto con id--------------//\r\n //------Verifica si la cantidad es 0--------------//\r\n if (Integer.parseInt(B[5]) == 0) {\r\n //------Elimina--------------//\r\n if(CBD.deleteDBProd(\"[ID PRODUCTO]\", B[7])){\r\n JOptionPane.showMessageDialog(II, \"Producto eliminado\");\r\n }else{\r\n JOptionPane.showMessageDialog(II, \"Error producto no pudo ser eliminado\");\r\n }\r\n //------Elimina--------------//\r\n } else {\r\n JOptionPane.showMessageDialog(II, \"No puedes eliminar un producto si su existencia es mayor a 0\");\r\n }\r\n CBD.closeConexion();\r\n }", "public void deleteCt() {\n\t\tlog.info(\"-----deleteCt()-----\");\n\t\t//int index = selected.getCtXuatKho().getCtxuatkhoThutu().intValue() - 1;\n\t\tlistCtKhoLeTraEx.remove(selected);\n\t\tthis.count = listCtKhoLeTraEx.size();\n\t\ttinhTien();\n\t}", "public void setIdSucursal(int idSucursal)\r\n/* 105: */ {\r\n/* 106:134 */ this.idSucursal = idSucursal;\r\n/* 107: */ }", "public int getId()\r\n/* 53: */ {\r\n/* 54: 79 */ return this.idDetalleComponenteCosto;\r\n/* 55: */ }", "public void setIdSucursal(int idSucursal)\r\n/* 98: */ {\r\n/* 99:176 */ this.idSucursal = idSucursal;\r\n/* 100: */ }", "public static void deleteCorsoMateria(long idCorso) {\n\t\tSystem.out.println(\"Eliminazione utente in corso\");\n\t\tRequestContent rp = new RequestContent();\n\t\trp.type = RequestType.DELETE_COURSE;\n\t\trp.parameters = new Object[] { idCorso };\n\t\tsend(rp);\n\t}", "public void eliminarEmpleado(CLEmpleado cl) throws SQLException{\r\n String sql = \"{CALL sp_eliminarEmpleado(?)}\";\r\n \r\n try{\r\n ps = cn.prepareCall(sql);\r\n ps.setInt(1, cl.getIdEmpleado());\r\n ps.execute();\r\n \r\n }catch(SQLException e){\r\n JOptionPane.showMessageDialog(null, \"error: \"+ e.getMessage());\r\n \r\n }\r\n \r\n }", "public void supprimer(Etudiant t) {\n\t\tdao.supprimer(t);\r\n\t}", "public String getCompoId() {\n\t return compoId;\r\n\t }", "boolean remove (I id);", "@Override\n public void deletePartida(String idPartida) {\n template.opsForHash().delete(idPartida, \"jugador1\");\n template.opsForHash().delete(idPartida, \"jugador2\");\n template.opsForSet().remove(\"partidas\",idPartida);\n }", "public void eliminarSolicitud(int id){\n listaSolicitudes.remove(id);\n }", "@Override\r\n\tpublic Object getId() {\n\t\treturn null;\r\n\t}", "public void delUtente(int id);", "@Override\r\n public void removerConcursando(long id) throws Exception {\n rnConcursando.remover(id);\r\n }", "void deletById(Integer id);", "@Override\n\tpublic void compPicked(Long id) {\n\n\t}", "@Override\n public void delete(int id) {\n Connection connection = createConnection();\n try {\n PreparedStatement preparedStatement = connection.prepareStatement(\"UPDATE gebruiker set isActief = FALSE WHERE ID = ?\");\n preparedStatement.setInt(1,id);\n preparedStatement.executeUpdate();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n closeConnection( connection);\n }", "@Override\r\n\tpublic boolean deletetdfy(Long id) throws Exception {\n\t\treturn false;\r\n\t}", "public int Rejectcomp(Long id) throws SQLException {\n\tLong idd=null;\r\n\trs=DbConnect.getStatement().executeQuery(\"select login_id from company where comp_id=\"+id+\"\");\r\n\tif(rs.next())\r\n\t{\r\n\t\tidd=rs.getLong(1);\r\n\t}\r\n\tSystem.out.println(idd);\r\n\tint i=DbConnect.getStatement().executeUpdate(\"delete from login where login_id=\"+idd+\"\");\r\n\treturn i;\r\n}", "public void deletar() {\n if(Sessao.isConfirm()){\n Usuario use = new Usuario();\n use.setId(Sessao.getId());\n Delete_Banco del = new Delete_Banco();\n del.Excluir_Usuario(use);\n this.setVisible(false);\n Sessao.setId(0);\n tela_Principal prin = Sessao.getPrin();\n prin.atualizar_Tela();\n }\n }", "public boolean supprimerMagasin(int id);", "void remove(int id);", "protected void excluirLotofacil(long id) {\r\n\t\tLotofacilListagemResultados.repositorio.Deletar(id);\r\n\t}", "public void removePlayer(int id) {\n\n Jogador j = this.listaJogadores.get(id);\n\n if(bankruptcy && j.temPropriedades() && j.isBankruptcy()){\n //System.out.println(\"vez: \" + vez + \"id: \" + id );\n jogoInterrompidoEm = vez = voltaVez(vez);\n j.addComandoGiveUp();\n j.removeComandoRoll();\n j.setBankruptcy(true);\n vez = voltaVez(id);\n if(build)\n j.removerComandoBuild();\n }else{\n falirJogador(id);\n }\n\n }", "public void eliminar(Long Id){\r\n EspecieEntity productoEliminar=em.find(EspecieEntity.class, Id);\r\n em.remove(productoEliminar);\r\n }", "@Override\n\tpublic Object getId() {\n\t\treturn null;\n\t}" ]
[ "0.7554082", "0.7410682", "0.65403897", "0.65273184", "0.65273184", "0.6474279", "0.6370051", "0.6335649", "0.6269458", "0.61745346", "0.6170361", "0.6150006", "0.6115635", "0.6103546", "0.60955775", "0.608091", "0.6071186", "0.6052878", "0.6043812", "0.6034022", "0.60337675", "0.60258603", "0.59861714", "0.59235585", "0.5914621", "0.59134394", "0.59133816", "0.59122366", "0.58991146", "0.58920205", "0.5865149", "0.5855933", "0.58158153", "0.58054787", "0.57845867", "0.5783974", "0.57750493", "0.5775049", "0.5771745", "0.5764747", "0.5758201", "0.57507384", "0.57442987", "0.57247305", "0.5723191", "0.57079536", "0.5707734", "0.57034355", "0.5701051", "0.56977224", "0.56977224", "0.56977224", "0.56977224", "0.56977224", "0.56977224", "0.56977224", "0.56950814", "0.5688359", "0.5686573", "0.56815445", "0.56647086", "0.5649781", "0.564052", "0.56390566", "0.5635873", "0.5631053", "0.56257176", "0.5619804", "0.5618355", "0.56150204", "0.5612701", "0.5606536", "0.56063855", "0.55973995", "0.5586151", "0.55794865", "0.5578565", "0.5578404", "0.5578227", "0.55769175", "0.55763996", "0.5573887", "0.5573156", "0.55712134", "0.5570061", "0.5569927", "0.5557575", "0.5554752", "0.55452764", "0.5540699", "0.55397093", "0.553846", "0.55344826", "0.5533778", "0.5530987", "0.55266017", "0.5524961", "0.5520878", "0.5520735", "0.5520335" ]
0.6835304
2
Permet de crediter un compte d'un certain montant.
@Override public void credit(Long idClient, Double value) { log.info("methode credit"); Optional<Compte> compteClient = getByIdClient(idClient); if (compteClient.isPresent()) { Double solde = compteClient.get().getSolde(); compteClient.get().setSolde(solde + value); log.info("Methode credit : " + compteClient.get().toString()); update(compteClient.get()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void addCredito(double montante) {\r\n\t\tcredito += montante;\r\n\t}", "public void simulerCreditConso(Client client, float emprunt, int nbMois) {\n\t\tSystem.out.println(\"Proposition de credit consommation : \");\n\t\tCredit creditconso = new Credit(emprunt, nbMois);\n\t\tcreditconso.CreditConso(emprunt, nbMois);\n\t\t\n\t\t\n\t}", "public void acionarInadimplencia(CestaGarantiasDO cesta);", "public void creditar(int valor){\r\n this.contaCorrente.creditar(valor);\r\n }", "public void coupCritique(Personnage ennemi, double valeur) throws InterruptedException { // Allows a critical strike\n\t\tint x;\n\t\tx = (int) (Math.random() * 10);\n\t\tif (x <= valeur) { // Proba valeur+1/10\n\t\t\tennemi.setHp(ennemi.getHp() - (this.getStrength()));\n\t\t\tUtilitaire.lettreParLettre(\"Coup critique !!!\");\n\t\t}\n\n\t}", "public FacturaCompra pagoCreditCard(String userName,TipoMoneda tipoMoneda);", "public Integer pesquisarIdCreditoRealizadoContratoDemanda(Conta conta, CreditoTipo ctContratoDemanda)\n\t\t\tthrows ErroRepositorioException;", "public void simulerCreditImmo(Client client, float emprunt, int nbMois) {\n\t\tSystem.out.println(\"Proposition de credit immobilier : \");\n\t\tCredit creditimmo = new Credit(emprunt, nbMois);\n\t\tcreditimmo.CreditImmo(emprunt, nbMois);\n\t}", "public FacturaCompra cashOnDelivery(String userName,TipoMoneda tipoMoneda);", "public Integer pesquisarDebitoCreditoSituacaoAtualConta(Integer idImovel, Integer anoMesReferencia)\n\t\t\tthrows ErroRepositorioException ;", "@Override\n\tpublic void credite() {\n\t\t\n\t}", "public CreditoARealizar pesquisarCreditoARealizarContratoDemanda(Integer idImovel, Integer anoMesFaturamento) throws ErroRepositorioException;", "public Integer pesquisarDebitoCreditoSituacaoAtualDaConta(Integer idImovel,\n\t\t\tInteger anoMesReferencia) throws ErroRepositorioException;", "public static void main(String args[]){\n ControlAcceso controlador = new ControlAcceso();\n\n //se asignan los comportamientos\n controlador.asignarComportamientoAcceso(new AccesoPassword());\n\n controlador.asignarComportamientoCifrado(new CifradoNormal());\n\n controlador.acceder();\n controlador.cifrar(\"texto\");\n\n //de forma dinamica cmbio el comportamiento\n controlador.asignarComportamientoCifrado(new CifradoNulo());\n controlador.cifrar(\"djad\");\n }", "public void verserCompteEpargneVersCompteCourant(Client client, float mt) {\n\t\tif (client.getCompteCourant() == null) {\n\t\t\tSystem.out.println(\"Erreur : le client n a pas de compte courant !\");\n\t\t\tSystem.out.println(\"Ouvrir d abord un compte courant au client !\");\n\t\t} else {\n\t\t\tif (client.getCompteEpargne() == null) {\n\t\t\t\tSystem.out.println(\"Erreur : le client n a pas de compte epargne !\");\n\t\t\t\tSystem.out.println(\"Ouvrir d abord un compte epargne au client !\");\n\t\t\t} else {\n\t\t\t\tsoldeCompteCourantClient = client.getCompteCourant().getSolde();\n\t\t\t\tsoldeCompteEpargneClient = client.getCompteEpargne().getSolde();\n\t\t\t\tclient.getCompteEpargne().retirer(mt);\n\t\t\t\tif (soldeCompteEpargneClient == client.getCompteEpargne().getSolde()) {\n\t\t\t\t\tSystem.out.println(\"Erreur de versement du compte epargne vers le compte courant !\");\n\t\t\t\t} else {\n\t\t\t\t\tclient.getCompteCourant().verser(mt);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\r\n\tpublic void solicitarMonto(int monto) {\n\t\tSystem.out.println(\"Comprobar dinero dentro de la cuenta\");\r\n\t\tSystem.out.println(\"Leer monto\");\r\n\t}", "public static void imprimeCredito(float credito){\r\n System.out.println(\"muestra tu credito actual \"+credito);\r\n }", "public Transferencia(double monto, int plazo, int frecuencia) {\r\n\t\tsuper(monto);\r\n\t\tthis.plazo = plazo;\r\n\t\tthis.frecuencia = frecuencia;\r\n\t}", "public String trouverChiffreSecret(String pResultat) {\r\n\t\tlogger.info(\"Entre dans OrdinateurJoueur.trouverChiffreSecret()\");\r\n\t\t\r\n\t\tif (this.getChiffreJoueur() == \"null\") {\r\n\t\t\tthis.setIA();\r\n\t\t}\r\n\t\t\r\n\t\tthis.setChiffreJoueur(this.ia.trouverChiffreSecret(pResultat));\r\n\t\treturn this.getChiffreJoueur();\r\n\t}", "public void setNumeroCredito(java.lang.String numeroCredito) {\n this.numeroCredito = numeroCredito;\n }", "public void ingresaAdministrativo() {\n\tEstableceDatosAdministrativos();\n\tint cambio=0;\n\tdo {\n\t\t\n\t\ttry {\n\t\t\tsetMontoCredito(Double.parseDouble(JOptionPane.showInputDialog(\"Ingrese el monto del credito (�3 600 000 maximo)\")));\n\t\t\tcambio=1;\n\t\t\tif(getMontoCredito()<0||getMontoCredito()>3600000) {\n\t\t\t\tJOptionPane.showMessageDialog(null, \"El monto debe ir de �0 a �3600000\");\n\t\t\t}\t\t\t\n\t\t} catch (Exception e) {\n\t\t\tJOptionPane.showMessageDialog(null, \"Ingrese solo numeros\");\n\t\t}\n\t}while(getMontoCredito()<0||getMontoCredito()>3600000||cambio==0);\n\tsetInteres(12);\n\tsetPlazo(60);\n\tsetCuotaPagar(calculoCuotaEspecialOrdinario());\n\testableceEquipoComputo();\n}", "public void comportement() {\n\t\tif (compteurPas > 0) {\n seDeplacer(deplacementEnCours);\n compteurPas--;\n\n // sinon charge le prochain deplacement\n\t\t} else {\n\t\t // recalcul le chemin si la cible a bouge\n boolean cibleBouger = calculPosCible();\n if (cibleBouger)\n calculerChemin();\n\n if (suiteDeDeplacement.size() > 0) {\n deplacementEnCours = suiteDeDeplacement.pollFirst();\n compteurPas = Case.TAILLE / vitesse;\n // pour le sprite\n if (deplacementEnCours == 'E')\n direction = true;\n else if (deplacementEnCours == 'O')\n direction = false;\n }\n }\n\t\tattaque = attaquer();\n\t}", "public Membre consulterCompte(String email,String motDePasse) {\n List<Membre> membre=new ArrayList<Membre>();\n membre=gerantMembre.ChercherMembreByEmailPass(email,motDePasse);\n\t\tif(membre==null) {throw new RuntimeException(\"membre non inscrit\");};\n\t\tSystem.out.println(\"la taille est\"+membre.size());\n\t\treturn membre.get(0);\n\t}", "public void enviarControlador(ControladorABMSalon controladorABMSalon) {\n\t\tthis.controladorABMSalon = controladorABMSalon;\n\t}", "public void principal() {\r\n int opciones = 0;\r\n do {\r\n opciones = op.capInt(\"CLINICA LA EVALUACIÓN\\n\\n\"\r\n + \"1. Gestionar Pacientes.\\n\"\r\n + \"2. Gestionar Médicos.\\n\"\r\n + \"3. Gestionar Historial Clínico.\\n\"\r\n + \"4. Salir\");\r\n switch (opciones) {\r\n case 1:\r\n gesPaciente();\r\n break;\r\n case 2:\r\n gesMedico();\r\n break;\r\n case 3:\r\n gesHistoria();\r\n break;\r\n case 4:\r\n op.mensaje(\"Hasta la proxima\");\r\n break;\r\n default:\r\n op.mensajeError(\"La opcione Ingresada no es valida\");\r\n break;\r\n }\r\n } while (opciones != 4);\r\n }", "public void registrarCompraIngrediente(String nombre, int cantidad, int precioCompra, int tipo) {\n //Complete\n }", "public boolean deposito(int idConta, double quantia) {\n try {\n Conta conta = new Conta(idConta); //deveria poder fazer isto\n boolean executado = conta.depositoConta(quantia);\n System.out.println(executado ? \"Deposito efetuado com sucesso.\" : \"Erro ao Efeuar o Deposito\" );\n return executado;\n } catch (Exception e) {\n System.out.println(\"Erro no serviço deposito: \" + e.getMessage());\n return false;\n } \n}", "public void setTipoCredito(java.lang.String tipoCredito) {\n this.tipoCredito = tipoCredito;\n }", "public ControladorCombate(int tipo_simulacion,\r\n Entrenador entrenador1, Entrenador entrenador2, ControladorPrincipal cp){\r\n this.esLider = false;\r\n this.controlador_principal = cp;\r\n this.tipo_simulacion = tipo_simulacion;\r\n this.combate = new Combate();\r\n this.equipo1 = entrenador1.getPokemones();\r\n this.equipo2 = entrenador2.getPokemones();\r\n this.entrenador1 = entrenador1;\r\n this.entrenador2 = entrenador2;\r\n this.vc = new VistaCombate();\r\n this.va = new VistaAtaque();\r\n this.ve = new VistaEquipo();\r\n this.creg = new ControladorRegistros();\r\n String[] nombres1 = new String[6];\r\n String[] nombres2 = new String[6];\r\n for (int i = 0; i < 6; i++) {\r\n nombres1[i]=equipo1[i].getPseudonimo();\r\n nombres2[i]=equipo2[i].getPseudonimo(); \r\n }\r\n this.vpc = new VistaPreviaCombate(tipo_simulacion, entrenador1.getNombre(), entrenador2.getNombre());\r\n this.vpc.agregarListener(this);\r\n this.vpc.setjC_Equipo1(nombres1);\r\n this.vpc.setjC_Equipo2(nombres2);\r\n this.vpc.setVisible(true);\r\n this.termino = false;\r\n resetearEntrenadores();\r\n }", "public void creercompteAdmin(String login, int admin, int statut) {\n\t\tCompte session = new Compte();\n\t\tsession.setLogin(login);\n\t\tsession.setNumeroutilisateur(admin);\n\t\tsession.setStatut(0);\n\t\tsession.setPassword(password());\n\t\tem.persist(session);\n\t}", "@Override\n public Coup meilleurCoup(Plateau _plateau, Joueur _joueur, boolean _ponder) {\n \n _plateau.sauvegardePosition(0);\n \n /* On créé un noeud père, qui est le noeud racine de l'arbre. On définit arbitrairement le joueur associé (\n (0 ou 1, il importe peu de savoir quel joueur correspond à ce nombre, cette information étant déjà portée par \n j1 et j2 dans l'algorithme. Le tout est de faire alterner cette valeur à chaque niveau de l'arbre. */\n \n Noeud pere = new Noeud();\n pere.joueurAssocie = 0;\n \n // On définit ici c, le coefficient d'arbitrage entre exploration et exploitation. Ce dernier est théroquement optimal pour una valeur égale à sqrt(2).\n \n double c = 10 * Math.sqrt(2);\n double[] resultat = new double[2];\n \n // Conditions de fonctionnement par itération\n \n //int i = 1;\n //int nbTours = 10000;\n \n //while(i <= nbTours){\n \n // Conditions de fonctionnement en mode \"compétition\" (100 ms pour se décider au maximum).\n \n long startTime = System.currentTimeMillis();\n \n while((System.currentTimeMillis()-startTime) < 100){\n\n // La valeur résultat ne sert à rien fondamentalement ici, elle sert uniquement pour le bon fonctionnement de l'algorithme en lui même.\n // On restaure le plateau à chaque tour dans le MCTS (Sélection - Expension - Simulation - Backpropagation). \n \n resultat = MCTS(pere, _plateau, this.j_humain, this.j_ordi, c, this.is9x9, this.methodeSimulation);\n _plateau.restaurePosition(0);\n \n //i++;\n }\n\n // On doit maintenant choisir le meilleur coup parmi les fils du noeud racine, qui correspondent au coup disponibles pour l'IA.\n \n double maxValue = 0;\n int maxValueIndex = 0;\n \n for(int j = 0; j < pere.fils.length; j++){\n \n double tauxGain = ((double)pere.fils[j].nbPartiesGagnees / (double)pere.fils[j].nbPartiesJouees);\n\n // On choisirat le coup qui maximise le taux de gain des parties simulées.\n \n if(tauxGain >= maxValue){\n maxValueIndex = j;\n maxValue = tauxGain;\n \n }\n }\n \n // On retourne le coup associé au taux de gain le plus élevé.\n\n return pere.fils[maxValueIndex].coupAssocie;\n }", "public FiltroCreditoTipo() {\r\n\t}", "protected void botonAceptarPulsado() {\n\t\tString pass = this.vista.getClave();\n\t\tchar[] arrayC = campoClave.getPassword();\n\t\tString clave = new String(arrayC);\n\t\tclave = Vista.md5(clave);\n\t\t\n\t\tif (pass.equals(clave)) {\n\t\t\tarrayC = campoClaveNueva.getPassword();\n\t\t\tString pass1 = new String(arrayC);\n\t\t\t\n\t\t\tarrayC = campoClaveRepita.getPassword();\n\t\t\tString pass2 = new String(arrayC);\n\t\t\t\n\t\t\tif (pass1.equals(pass2)) {\n\t\t\t\tif (this.vista.cambiarClave(pass1)) {\n\t\t\t\t\tthis.vista.msg(this, \"Contraseña maestra cambiada con éxito\");\n\t\t\t\t\tthis.setVisible(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.vista.error(this, \"Error al cambiar la contraseña maestra\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.vista.error(this, \"Las contraseñas no coinciden\");\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.vista.error(this, \"Contraseña incorrecta\");\n\t\t}\n\t}", "private void comerFantasma(Fantasma fantasma) {\n // TODO implement here\n }", "public void realizarRetiro(String codigo_cuenta, double credito) {\n try {\n PreparedStatement PrSt;\n String Query = \"UPDATE Cuenta SET Credito = ? WHERE Codigo = ?\";\n PrSt = conexion.prepareStatement(Query);\n PrSt.setDouble(1, credito);\n PrSt.setString(2, codigo_cuenta);\n PrSt.executeUpdate();\n PrSt.close();\n } catch (SQLException e) {\n System.out.println(e.toString());\n }\n }", "public void verserCompteCourantVersCompteEpargne(Client client, float mt) {\n\t\tif (client.getCompteCourant() == null) {\n\t\t\tSystem.out.println(\"Erreur : le client n a pas de compte courant !\");\n\t\t\tSystem.out.println(\"Ouvrir d abord un compte courant au client !\");\n\t\t} else {\n\t\t\tif (client.getCompteEpargne() == null) {\n\t\t\t\tSystem.out.println(\"Erreur : le client n a pas de compte epargne !\");\n\t\t\t\tSystem.out.println(\"Ouvrir d abord un compte epargne au client !\");\n\t\t\t} else {\n\t\t\t\tsoldeCompteCourantClient = client.getCompteCourant().getSolde();\n\t\t\t\tsoldeCompteEpargneClient = client.getCompteEpargne().getSolde();\n\t\t\t\tclient.getCompteCourant().retirer(mt);\n\t\t\t\tif (soldeCompteCourantClient == client.getCompteCourant().getSolde()) {\n\t\t\t\t\tSystem.out.println(\"Erreur de versement du compte courant vers le compte epargne !\");\n\t\t\t\t} else {\n\t\t\t\t\tclient.getCompteEpargne().verser(mt);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void ComprobarCredenciales(SharedPreferences preferencias){\n\n if(preferencias.getBoolean(\"autenticado\", false)){\n //Toast.makeText(this, \"Autenticado\", Toast.LENGTH_SHORT).show();\n startActivity(new Intent(this, ContentActivity.class));\n }\n\n }", "public static void main(String [ ] args){\n\t\t Fecha Hoy = new Fecha(12,12,2020);\r\n\t\t ArrayList<Cuenta> cuentas = new ArrayList<Cuenta>();\r\n\t\t \r\n\t\t Cuenta c0 = new CtaAhorros(10000,10);\r\n\t\t Cuenta c1 = new CtaCheques(256070,0);\r\n\t\t Cuenta c2 = new CtaCredito(13245,100);\r\n\t\t Cuenta c3 = new CtaCheques(765,20);\r\n\t\t Cuenta c4 = new CtaAhorros(9000,20);\r\n\t\t Cuenta c5 = new CtaAhorros(2300,10);\r\n\t\t Cuenta c6 = new CtaCredito(25000,12);\r\n\t\t \r\n\t\t cuentas.add(c0);\r\n\t\t cuentas.add(c1);\r\n\t\t cuentas.add(c2);\r\n\t\t cuentas.add(c3);\r\n\t\t cuentas.add(c4);\r\n\t\t cuentas.add(c5);\r\n\t\t \r\n\t\t Cliente C1=new Cliente(\"QUIJOTE\",cuentas,\"QX400\");\r\n\t\t Hoy.AvanzarTiempo(11,1,0);\r\n\t\t \r\n\t\t C1.depositar(1,1200, Hoy);\r\n\t\t C1.retirar(2,1100, Hoy);\r\n\t\t System.out.println(\"saldo cuenta 3:\"+C1.consultar(3,Hoy));\r\n\t\t C1.depositar(4,600, Hoy);\r\n\t\t \r\n\t\t //C1.reportarEdosCtas();\r\n\t\t \r\n\t\t }", "public void effetCarte(Partie partie) {\r\n\r\n\t\tint nbHuitsJoues = partie.getLesJoueurs().get(partie.getTour()).getNbCartesJouees();\r\n\r\n\t\tpartie.setNbTouraPasser( partie.getNbTouraPasser() + (1*nbHuitsJoues) );\r\n\r\n\t\tif (nbHuitsJoues==1)\r\n\t\t\tSystem.out.println(\"--> Le joueur suivant passe son tour\");\r\n\t\telse\r\n\t\t\tSystem.out.println(\"--> Les \"+nbHuitsJoues+\" joueurs suivants passent leurs tour\");\r\n\r\n\r\n\r\n\r\n\t}", "private void actualitzaPasswd(String nou){\n user.setPasswd(nou);\n try{\n helperU.actualitzar(user, false);\n \n info(\"Contrasenya actualitzada!\");\n }catch(Exception ex){\n avis(\"Error al actualitzar la contrasenya!\");\n }\n }", "private static void muta(Cromosoma c)\n\t{\n\t}", "public boolean modifierCompte(int id, String nom, String prenom, String mdp, String email, String numrue, String codeP, String ville);", "public static float mostrarCredito(){\n JOptionPane.showMessageDialog(null,\"Actualmente hay \"+Monedero.getCredito());\n return Monedero.getCredito();\n }", "public Conta(String numero, String agencia, Double saldo) { // Construtor 1\n this.numero = numero;\n this.agencia = agencia;\n this.saldo = saldo;\n }", "@Override\r\n\tpublic float chekearDatos(){\r\n\t\t\r\n\t\tfloat monto = 0f;\r\n\t\tfloat montoPorMes = creditoSolicitado/plazoEnMeses;\r\n\t\tdouble porcentajeDeSusIngesosMensuales = (cliente.getIngresosMensuales()*0.7);\r\n\t\t\r\n\t\tif(cliente.getIngresoAnual()>=15000f && montoPorMes<=porcentajeDeSusIngesosMensuales){\r\n\t\t\t\r\n\t\t\tmonto = this.creditoSolicitado;\r\n\t\t\tsetEstadoDeSolicitud(true);\r\n\t\t}\t\r\n\t\t\r\n\t\t\r\n\t\treturn monto;\r\n\t}", "public CuentaAhorroP(int numCl, String nom, String numCu, double inve, double intAnual, int plazoInv,\n double saldo){\n this.numCl = numCl;\n this.nom = nom;\n this.numCu = numCu;\n this.inve = inve;\n this.intAnual = intAnual;\n this.plazoInv = plazoInv;\n this.saldo = saldo;\n }", "public static void main(String[] args) {\n\n Poupanca poupanca = new Poupanca();\n\n Corrente corrente = new Corrente();\n\n poupanca.setNome(\"maria\");\n poupanca.setNumero(123);\n poupanca.setDiaAniversario(10);\n poupanca.depositar(100);\n\n\n System.out.println(\"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");\n System.out.println(\"nome do cliente da poupança:\" + poupanca.getNome());\n\n boolean operacao = poupanca.sacar(50);\n\n if(operacao){\n System.out.println(\"saque realizado com sucesso\");\n }else {\n System.out.println(\"saldo insuficiente\");\n }\n\n System.out.println(\"saldo de \" + poupanca.getNome() + \": \" + poupanca.getSaldo());\n\n\n // para conta corrente\n corrente.setNumero(234);\n corrente.setNome(\"rafael\");\n corrente.depositar(1000);\n corrente.setLimite(500);\n\n System.out.println(\"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");\n System.out.println(\"nome do cliente: \" + corrente.getNome());\n System.out.println(\"saldo atual: \" + corrente.getSaldo());\n\n operacao = corrente.sacar(500);\n\n if(operacao){\n System.out.println(\"saque realizado com sucesso\");\n }else {\n System.out.println(\"saldo insuficiente\");\n }\n\n System.out.println(\"saldo atual: \" + corrente.getSaldo());\n System.out.println(\"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");\n\n Corrente corrente1 = new Corrente();\n corrente1.setSaldo(1000);\n\n GerenciarPatrimonioBanco gp = new GerenciarPatrimonioBanco();\n gp.adicionarConta(corrente);\n gp.adicionarConta(poupanca);\n gp.adicionarConta(corrente1);\n\n System.out.println();\n System.out.println(\"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");\n System.out.println(\"total do dinheiro dos clientes no banco: \" );\n System.out.println(gp.getTotalPatrimonio());\n\n System.out.println(\"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");\n\n }", "public void setTarjetasCredito(List<TarjetaCreditoEntity> tarjetasCredito) {\r\n this.tarjetasCredito = tarjetasCredito;\r\n }", "public boolean ajouterCompte(String nom, String prenom, String mdp, String email, String numrue, String codeP, String ville);", "private void AtulizaBanco(String cod, int matricula, double valor, int qte) {\n try {\n venda.Atualizar(cod, matricula, valor);\n Produto.ProdAtualizarQte(cod, qte);\n } catch (Exception ex) {\n Logger.getLogger(ViewCaixa.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public void setPrim_credito(java.util.Calendar prim_credito) {\n this.prim_credito = prim_credito;\n }", "public void enviarControlador(ControladorABMCuarto controladorABMCuarto) {\n\t\tthis.controladorABMCuarto = controladorABMCuarto;\n\t}", "public Motocicleta(Persona chofer, int kilometrosRecorridos, Persona acompanante) { \r\n\t\tsuper(chofer, kilometrosRecorridos);\r\n\t\tthis.setAcompanante(acompanante);\r\n\t}", "private void executeRicercaAccertamentoPerOrdinativo() {\n \tif (model.getGestioneOrdinativoStep1Model().getAnnoAccertamento() == null || model.getGestioneOrdinativoStep1Model().getNumeroAccertamento() == null) {\n\n \t\tif(!sonoInAggiornamento()){\n \t\t\t\n \t\t\tmodel.getGestioneOrdinativoStep2Model().setListaAccertamento(new ArrayList<Accertamento>());\n \t\t\tmodel.getGestioneOrdinativoStep2Model().setListaAccertamentoOriginale(new ArrayList<Accertamento>());\n \t\t\tmodel.getGestioneOrdinativoStep2Model().setResultSize(0);\n\n \t\t\tRicercaAccertamentiSubAccertamenti request= new RicercaAccertamentiSubAccertamenti();\n \t\t\trequest.setEnte(sessionHandler.getEnte());\n \t\t\trequest.setRichiedente(sessionHandler.getRichiedente());\n\n\n \t\t\tParametroRicercaAccSubAcc param= new ParametroRicercaAccSubAcc();\n \t\t\tparam.setAnnoEsercizio(Integer.parseInt(sessionHandler.getAnnoEsercizio()));\n \t\t\tparam.setAnnoAccertamento(Integer.parseInt(sessionHandler.getAnnoEsercizio()));\n \t\t\tparam.setDisponibilitaAdIncassare(true);\n\n \t\t\t// Capitolo\n \t\t\tif (model.getGestioneOrdinativoStep1Model().getCapitolo() != null) {\n \t\t\t\tparam.setNumeroCapitolo(model.getGestioneOrdinativoStep1Model().getCapitolo().getNumCapitolo());\n \t\t\t\tparam.setNumeroArticolo(model.getGestioneOrdinativoStep1Model().getCapitolo().getArticolo());\n \t\t\t\tif(null!=model.getGestioneOrdinativoStep1Model().getCapitolo().getUeb()){\n \t\t\t\t\tparam.setNumeroUEB(model.getGestioneOrdinativoStep1Model().getCapitolo().getUeb().intValue());\n \t\t\t\t}\n \t\t\t}\n\n\n \t\t\tparam.setCodiceDebitore(model.getGestioneOrdinativoStep1Model().getSoggetto().getCodCreditore());\n \t\t\tparam.setIsRicercaDaAccertamento(false);\n \t\t\trequest.setParametroRicercaAccSubAcc(param);\n\n\n \t\t\taddNumAndPageSize(request, \"listaAccertamentoOrdinativoId\");\n\n \t\t\tRicercaAccertamentiSubAccertamentiResponse response= movimentoGestionService.ricercaAccertamentiSubAccertamentiPerOrdinativoIncasso(request);\n\n \t\t\tif(response.isFallimento() || !response.getErrori().isEmpty()){\n\n \t\t\t\t//setto gli errori cosi che siano segnalati lato app!\n \t\t\t\taddErrori(response.getErrori());\n\n \t\t\t}else{\n\n \t\t\t\tif (response.getListaAccertamenti() != null && response.getListaAccertamenti().size() > 0) {\n \t\t\t\t\tfor (Accertamento currentAccetamento : response.getListaAccertamenti()) {\n \t\t\t\t\t\taddAccertamentiESubAccertamentiInUnicaLista(currentAccetamento);\n \t\t\t\t\t}\n\n \t\t\t\t\tmodel.getGestioneOrdinativoStep2Model().setResultSize(response.getNumRisultati());\n \t\t\t\t\t\n \t\t\t\t\tif(model.getGestioneOrdinativoStep2Model().getListaAccertamento()==null || model.getGestioneOrdinativoStep2Model().getListaAccertamento().size()==0){\n \t\t\t\t\t\taddPersistentActionWarning(ErroreFin.CRU_WAR_1003.getErrore().getCodice()+\" : \"+ErroreFin.CRU_WAR_1003.getErrore(\" accertamenti o subaccertamenti\").getDescrizione());\n \t\t\t\t\t}\n \t\t\t\t} else {\n \t\t\t\t\taddPersistentActionWarning(ErroreFin.CRU_WAR_1003.getErrore().getCodice()+\" : \"+ErroreFin.CRU_WAR_1003.getErrore(\" accertamenti o subaccertamenti\").getDescrizione());\n \t\t\t\t}\n \t\t\t}\n\n \t\t}\n \t}\n }", "public String getTarjetaCredito(){\n return tarjetaCredito;\n }", "public double calculoCuotaEspecialOrdinario() {\n\tdouble resultado =0;\n\tresultado = (getMontoCredito()+(getMontoCredito()*getInteres()/100))/getPlazo(); \n\treturn resultado;\n}", "public void calculoPersonal(){\n ayudantes = getAyudantesNecesarios();\n responsables = getResponsablesNecesarios();\n \n //Calculo atencion al cliente (30% total trabajadores) y RRPP (10% total trabajadores):\n \n int total = ayudantes + responsables;\n \n atencion_al_cliente = (total * 30) / 100;\n \n RRPP = (total * 10) / 100;\n \n //Creamos los trabajadores\n \n gestor_trabajadores.crearTrabajadores(RRPP, ayudantes,responsables,atencion_al_cliente);\n \n }", "public void setUlt_credito(java.util.Calendar ult_credito) {\n this.ult_credito = ult_credito;\n }", "@Test\n\tpublic void testAdicionaDisciplinaAoTutor() {\n\t\t\n\t\ttutorUm.adicionarDisciplina(\"Teoria dos Grafos\", 5);\n\t\n\t}", "public void setTarjetaCredito(String tarjetaCredito){\n if(tarjetaCredito == null){\n throw new IllegalArgumentException(\"Tarjeta de usuario igual a null\");\n }\n this.tarjetaCredito = tarjetaCredito;\n }", "public CompteEpargne(int numeroDeCompte, String dateOuvertureCompte, double taux) {\n\t\tsuper();\n\t\tsuper.numeroDeCompte = numeroDeCompte;\n\t\tsuper.dateOuvertureCompte = dateOuvertureCompte;\n\t\tthis.taux = taux;\n\t\tsuper.typeDeCompte = true;\n\t}", "public String agregarCuenta(String tipo, String nombre, String ced, String num)throws ExCliente, ExPlan, ExCuenta\n\t{\n\t\t//Crear la cuenta y almacenarla en la lista de cuentas de dicho plan.\n\t\t//Luego asignarsela al cliente\n\t\t//Numero ya usado?\n\t\t\n\t\tPlan p;\n\t\n\t\tif (! clientes.containsKey(ced))\n\t\t{\n\t\t\tthrow (new ExCliente(\"Cedula no encontrada\"));\n\t\t}\n\t\t\n\t\tCuenta obj = buscarCuentaNumero(num);\n\t\tif (obj != null)\n\t\t{\n\t\t\tthrow (new ExCuenta(\"Numero ya ocuopado\"));\n\t\t}\n\t\t\n\t\tif(tipo.equalsIgnoreCase(\"PREPAGO\"))\n\t\t{\n\t\t\tp = buscarPlan(nombre);\n\t\t\tif (p == null || (p != null && p instanceof PlanPostpago))\n\t\t\t{\n\t\t\t\tthrow (new ExPlan(\"El Plan no existe\"));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tCliente c = clientes.get(ced);\n\t\t\t\t\n\t\t\t\treturn c.agregarCuenta(((PlanPrepago)p).agregarCuenta(num));\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(tipo.equalsIgnoreCase(\"POSTPAGO\"))\n\t\t\t{\n\t\t\t\tp = buscarPlan(nombre);\n\t\t\t\tif (p == null || (p != null && p instanceof PlanPrepago))\n\t\t\t\t{\n\t\t\t\t\tthrow (new ExPlan(\"El plan no existe\"));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tCliente c = clientes.get(ced);\n\t\t\t\t\treturn c.agregarCuenta(((PlanPostpago)p).agregarCuenta(num));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow (new ExCuenta(\"Tipo Incorrecto\"));\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t}", "private boolean solicitarAutorizacionCxC(int intCodEmp, int intCodLoc, int intCodCot){\n boolean blnRes=false;\n try{\n java.sql.Connection conLoc;\n conLoc=DriverManager.getConnection(objParSis.getStringConexion(),objParSis.getUsuarioBaseDatos(),objParSis.getClaveBaseDatos());\n if(conLoc!=null){\n int EstAut = 1;\n EstAut = objAutPrg.checkCtlsCot(\"tbm_cabautcotven\", \"tbm_detautcotven\",intCodEmp,intCodLoc, intCodCot, conLoc,true);\n switch (EstAut) {\n case 1: // Todo Correcto\n //System.out.println(\"No necesita autorizaciones....\");\n blnRes=true;\n break;\n case 2:\n //System.out.println(\"Autorizacion....\");\n conLoc.setAutoCommit(false);\n \n if (objAutPrg.insertarCabDetAut(conLoc, intCodEmp, intCodLoc, intCodCot, 3)) {\n if(colocarCotizacionComoNecesitaAutorizacion(conLoc, intCodEmp, intCodLoc, intCodCot)){\n conLoc.commit();\n blnRes=true;\n }else{conLoc.rollback();}\n } else { conLoc.rollback();}\n \n break; \n };\n }\n \n }\n catch(Exception Evt){ \n objUti.mostrarMsgErr_F1(this, Evt);\n } \n return blnRes;\n }", "protected String cargarVisitaTerrenoParticipante(String url, String username,\n String password) throws Exception {\n try {\n if(mVisitasTerrenoP.size()>0){\n // La URL de la solicitud POST\n final String urlRequest = url + \"/movil/visitasterrenoparti\";\n VisitaTerrenoParticipante[] envio = mVisitasTerrenoP.toArray(new VisitaTerrenoParticipante[mVisitasTerrenoP.size()]);\n HttpHeaders requestHeaders = new HttpHeaders();\n HttpAuthentication authHeader = new HttpBasicAuthentication(username, password);\n requestHeaders.setContentType(MediaType.APPLICATION_JSON);\n requestHeaders.setAuthorization(authHeader);\n HttpEntity<VisitaTerrenoParticipante[]> requestEntity =\n new HttpEntity<VisitaTerrenoParticipante[]>(envio, requestHeaders);\n RestTemplate restTemplate = new RestTemplate();\n restTemplate.getMessageConverters().add(new StringHttpMessageConverter());\n restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());\n // Hace la solicitud a la red, pone la vivienda y espera un mensaje de respuesta del servidor\n ResponseEntity<String> response = restTemplate.exchange(urlRequest, HttpMethod.POST, requestEntity,\n String.class);\n return response.getBody();\n }\n else{\n return \"Datos recibidos!\";\n }\n } catch (Exception e) {\n Log.e(TAG, e.getMessage(), e);\n return e.getMessage();\n }\n }", "public void acessarBuscaCep() throws InterruptedException {\n navegador.findElement(By.xpath(\"//*[@class='bt-link-ic bt-login link-btn-meu-correios']\")).click();\n\n // REALIZAR O LOGIN COM USUARIO E SENHA\n navegador.findElement(By.id(\"username\")).click();\n navegador.findElement(By.id(\"username\")).sendKeys(\"31403971862\");\n navegador.findElement(By.id(\"password\")).click();\n navegador.findElement(By.id(\"password\")).sendKeys(\"haenois001\");\n\n //CLICAR NO BOTÃO ENTRAR\n navegador.findElement(By.xpath(\"//button[@class='primario']\")).click();\n\n // ESPERAR OPÇÕES E CLICAR EM BUSCA CEP\n WebDriverWait wait = new WebDriverWait(navegador, 20);\n wait.until(ExpectedConditions.elementToBeClickable(By.id(\"opcoes\")));\n navegador.findElement(By.id(\"busca-cep\")).click();\n Thread.sleep(1000);\n\n }", "public void Pedircarnet() {\n\t\tSystem.out.println(\"solicitar carnet para verificar si es cliente de ese consultorio\");\r\n\t}", "private void credit(JDA jda)\n {\n return;\n }", "Activite getActiviteCourante();", "public void payement(int montant, Scanner in, String cheminDossier) {\n\t\tString numeroCarte;\n\n\t\tif (montant > 0) {\n\t\t\tSystem.out.println(\"Vous devez : \" + montant + \" euros, merci de donner votre numero de carte\");\n\t\t} else if (montant < 0) {\n\t\t\tSystem.out.println(\n\t\t\t\t\t\"Nous vous remboursons : \" + montant * -1 + \" euros, merci de donner votre numero de carte\");\n\t\t}\n\n\t\tnumeroCarte = in.nextLine();\n\n\t\t// alimentation du fichier transaction\n\t\tif (montant > 0) {\n\t\t\ttransaction(LocalDate.now(), \"payement\", montant, numeroCarte, cheminDossier);\n\t\t} else if (montant < 0) {\n\t\t\ttransaction(LocalDate.now(), \"remboursement\", montant * -1, numeroCarte, cheminDossier);\n\t\t}\n\t}", "public FacturaCompra pagoPSE(String userName,TipoMoneda tipoMoneda);", "@Before\n\tpublic void incoporacionDeCandidatosYProvinciasHabilitadasALaJuntaElectoral(){\n\t\tmendoza.agregarPartido(pro);\n\t\tbuenosaires.agregarPartido(pro);\n\t\trionegro.agregarPartido(pro);\n\t\tentrerios.agregarPartido(pro);\n\t\tmendoza.agregarPartido(renovador);\n\t\tbuenosaires.agregarPartido(renovador);\n\t\trionegro.agregarPartido(renovador);\n\t\tentrerios.agregarPartido(renovador);\n\t\tmendoza.agregarPartido(fpv);\n\t\tbuenosaires.agregarPartido(fpv);\n\t\trionegro.agregarPartido(fpv);\n\t\tentrerios.agregarPartido(fpv);\n\n\t\t//Incorporacion de los candidatos habilitados al centro de computos\n\t\tjuntaElectoral.agregarCandidato(macri);\t\t\n\t\tjuntaElectoral.agregarCandidato(massa);\t\t\n\t\tjuntaElectoral.agregarCandidato(scioli);\n\n\t\t//Incorporacion de las provincias habilitadas al centro de computos\n\t\tjuntaElectoral.agregarProvincia(mendoza);\n\t\tjuntaElectoral.agregarProvincia(buenosaires);\n\t\tjuntaElectoral.agregarProvincia(rionegro);\n\t\tjuntaElectoral.agregarProvincia(entrerios);\n\t}", "public void modificarCuadrante (int primerDia, int mes, int anio, String idDepartamento, Cuadrante c) {\r\n\t\tint i = 0;\r\n\t\tboolean encontrado = false;\r\n\t\twhile (i<cuadrantes.size() && !encontrado) {\r\n\t\t\tif (cuadrantes.get(i).getAnio()!=anio || cuadrantes.get(i).getMes()!=mes || !cuadrantes.get(i).getIdDepartamento().equals(idDepartamento)) \r\n\t\t\t\ti++;\r\n\t\t\telse\r\n\t\t\t\tencontrado = true;\r\n\t\t}\r\n\t\tfor (int j=primerDia-1;j<c.getNumDias();j++)\r\n\t\t\tcuadrantes.get(i).getCuad()[j]=c.getCuad()[j];\r\n\t}", "public void cargaDatosInicialesSoloParaModificacionDeCuenta() throws Exception {\n GestionContableWrapper gestionContableWrapper = parParametricasService.factoryGestionContable();\n gestionContableWrapper.getNormaContable3();\n parAjustesList = parParametricasService.listaTiposDeAjuste(obtieneEnumTipoAjuste(gestionContableWrapper.getNormaContable3()));\n selectAuxiliarParaAsignacionModificacion = cntEntidadesService.listaDeAuxiliaresPorEntidad(selectedEntidad);\n //Obtien Ajuste Fin\n\n //Activa formulario para automatico modifica \n switch (selectedEntidad.getNivel()) {\n case 1:\n swParAutomatico = true;\n numeroEspaciador = 200;\n break;\n case 2:\n swParAutomatico = true;\n swActivaBoton = true;\n numeroEspaciador = 200;\n break;\n case 3:\n swParAutomatico = false;\n numeroEspaciador = 1;\n break;\n default:\n break;\n }\n\n cntEntidad = (CntEntidad) getCntEntidadesService().find(CntEntidad.class, selectedEntidad.getIdEntidad());\n }", "public void realizarDeposito(String codigo_cuenta, double monto) {\n try {\n Cuenta cuenta = obtenerCuenta(codigo_cuenta);\n double credito_total = cuenta.getCredito() + monto;\n PreparedStatement PrSt;\n String Query = \"UPDATE Cuenta SET Credito = ? WHERE Codigo = ?\";\n PrSt = conexion.prepareStatement(Query);\n PrSt.setDouble(1, credito_total);\n PrSt.setString(2, codigo_cuenta);\n PrSt.executeUpdate();\n PrSt.close();\n } catch (SQLException e) {\n System.out.println(e.toString());\n }\n }", "public void cargarPantalla() throws Exception {\n Long oidCabeceraMF = (Long)conectorParametroSesion(\"oidCabeceraMF\");\n\t\tthis.pagina(\"contenido_matriz_facturacion_consultar\");\n\n DTOOID dto = new DTOOID();\n dto.setOid(oidCabeceraMF);\n dto.setOidPais(UtilidadesSession.getPais(this));\n dto.setOidIdioma(UtilidadesSession.getIdioma(this));\n MareBusinessID id = new MareBusinessID(\"PRECargarPantallaConsultarMF\"); \n Vector parametros = new Vector();\n \t\tparametros.add(dto);\n parametros.add(id);\n \t\tDruidaConector conector = conectar(\"ConectorCargarPantallaConsultarMF\", parametros);\n if (oidCabeceraMF!=null)\n asignarAtributo(\"VAR\",\"varOidCabeceraMF\",\"valor\",oidCabeceraMF.toString());\n\t\t asignar(\"COMBO\", \"cbTiposOferta\", conector, \"dtoSalida.resultado_ROWSET\");\n\t\t///* [1]\n\n\n\n\t\ttraza(\" >>>>cargarEstrategia \");\n\t\t//this.pagina(\"contenido_catalogo_seleccion\"); \n\t\t \n\t\tComposerViewElementList cv = crearParametrosEntrada();\n\t\tConectorComposerView conectorV = new ConectorComposerView(cv, this.getRequest());\n\t\tconectorV.ejecucion();\n\t\ttraza(\" >>>Se ejecuto el conector \");\n\t\tDruidaConector resultados = conectorV.getConector();\n\t\tasignar(\"COMBO\", \"cbEstrategia\", resultados, \"PRECargarEstrategias\");\n\t\ttraza(\" >>>Se asignaron los valores \");\n\t\t// */ [1]\n\t\t\n\n }", "public void reversarComprobanteContabilidad() {\r\n String ide_cnccc = ser_comprobante.reversarComprobante(tab_tabla1.getValorSeleccionado(), null);\r\n if (guardarPantalla().isEmpty()) {\r\n utilitario.agregarMensaje(\"Se genero el Comprobante Num: \", ide_cnccc);\r\n }\r\n }", "public void afficher (UneCommande22<Integer> cde){ //POURQUOI CETTE MÉTHODE EST STATIQUE??? LA DEPLACER PE DANS COMMANDE\n\t\t\t\tif(cde.taille()==0) {ClientJava1DateUser.affiche(\"\\n\\t\\t COMMANDE EST VIDE\");\n\t\t\t\t}\n\t\t\t\telse {ClientJava1DateUser.affiche(cde.toString());}\t\n\t\t\t}", "PrimitivaComunicacion(String simbolo){\r\n this.simbolo = simbolo;\r\n }", "private void teletransportar(Personaje p, Celda destino) {\n // TODO implement here\n }", "@Override\n\tpublic void relizarCobro(double monto) {\n\t\tif (!loggedIn) {\n\t\t\t\n\t\t\tloggedInUser();\n\t\t}\n\t\t\n\t\t//cargar el monto de compra al medio de pago\n\t}", "private static int login(String username, String passe) {\n PreparedStatement stmt;\r\n try {\r\n stmt = c.prepareStatement(\"SELECT * FROM utilizador where nome = ? and passe = ?;\");\r\n stmt.setString(1, username);\r\n stmt.setString(2, passe);\r\n ResultSet rs = stmt.executeQuery();\r\n rs.next();\r\n utilizador_corrente = new Utilizador(username, passe, rs.getBoolean(4));\r\n cartao_cidadao = rs.getInt(1);\r\n if (rs.getBoolean(4))//tem direitos\r\n return 2;\r\n else if (!rs.getBoolean(4))//nao tem direitos\r\n return 1;\r\n stmt.close();\r\n } catch (SQLException e) {\r\n }\r\n return 0;\r\n }", "public List<NotaDeCredito> procesar();", "public Repartidor(String nombre, String apellido, String direccion, String telefono, String cedula) {\n super(nombre, apellido, direccion, telefono, cedula);\n this.disponible = true; //empieza siendo disponible luego cuando lo utilicemos pasara a no estarlo y asi...\n this.salario = 50; //establecemos un salario inicial de 50 al que luego le adicionaremos segun la cantidad de envios que haya realizado con exito \n }", "@Override\r\n public void combattre(Creature c) {\r\n System.out.println(\"Tour de combat de \" + getNom() + \" :\");\r\n if (this.getPtMana() > 0) {\r\n this.setPtMana(this.getPtMana() - 1);\r\n Random rand = new Random();\r\n int success = rand.nextInt(100), distance;\r\n distance = this.getPos().distance(c.getPos());\r\n if (distance <= this.getDistAttMax()) {//On vérifie que l'on peut toucher l'adversaire\r\n if (success < this.getPourcentageMag()) { // L'attaque réussie\r\n c.setPtVie(c.getPtVie() - this.getDegAtt()); //on inflige des dégats à l'adversaire.\r\n System.out.println(\"Attaque réussie de \" + getNom() + \" : \" + this.getDegAtt() + \" dégats infligés.\");\r\n } else {\r\n System.out.println(\"Dans le vide!\");\r\n }\r\n } else {\r\n System.out.println(\"Trop loin.\");\r\n }\r\n } else {\r\n System.out.println(\"Oups... plus de mana.\");\r\n }\r\n }", "public void modifica(DTOAcreditacionGafetes acreGafete) throws Exception ;", "@Override\n\tpublic void createCpteCourant(CompteCourant cpt) {\n\t\t\n\t}", "public void tener_acceso_a_la_plataforma() {\n\t\tbaseState.setUrl(\"http://km.choucairtesting.com/login/index.php\");\t\n\t\tbaseState.setBrowserType(BrowserType.GoogleChrome);\n\t\tbaseState.execute(desktop);\t\n\t\tSerenity.takeScreenshot();\n\t\t\n\t}", "public TarjetaCreditoLogic()throws SQLException,Exception {\r\n\t\tsuper();\r\n\t\t\r\n\t\ttry\t{\t\t\t\t\t\t\r\n\t\t\tthis.tarjetacreditoDataAccess = new TarjetaCreditoDataAccess();\r\n\t\t\t\r\n\t\t\tthis.tarjetacreditos= new ArrayList<TarjetaCredito>();\r\n\t\t\tthis.tarjetacredito= new TarjetaCredito();\r\n\t\t\t\r\n\t\t\tthis.tarjetacreditoObject=new Object();\r\n\t\t\tthis.tarjetacreditosObject=new ArrayList<Object>();\r\n\t\t\t\t\r\n\t\t\t/*\r\n\t\t\tthis.connexion=new Connexion();\r\n\t\t\tthis.datosCliente=new DatosCliente();\r\n\t\t\tthis.arrDatoGeneral= new ArrayList<DatoGeneral>();\r\n\t\t\t\r\n\t\t\t//INICIALIZA PARAMETROS CONEXION\r\n\t\t\tthis.connexionType=Constantes.CONNEXIONTYPE;\r\n\t\t\tthis.parameterDbType=Constantes.PARAMETERDBTYPE;\r\n\t\t\t\r\n\t\t\tif(Constantes.CONNEXIONTYPE.equals(ConnexionType.HIBERNATE)) {\r\n\t\t\t\tthis.entityManagerFactory=ConstantesCommon.JPAENTITYMANAGERFACTORY;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.datosDeep=new DatosDeep();\r\n\t\t\tthis.isConDeep=false;\r\n\t\t\t*/\r\n\t\t\t\r\n\t\t\tthis.tarjetacreditoDataAccess.setConnexionType(this.connexionType);\r\n\t\t\tthis.tarjetacreditoDataAccess.setParameterDbType(this.parameterDbType);\r\n\t\t\t\r\n\t\t\t\r\n\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tthis.invalidValues=new InvalidValue[0];\r\n\t\t\tthis.stringBuilder=new StringBuilder();\r\n\t\t\tthis.conMostrarMensajesStringBuilder=true;\r\n\t\t\t\r\n\t\t} catch(Exception e) {\r\n\t\t\tFunciones.manageException(logger,e);\r\n\t\t\tthrow e;\r\n\t\t}\t \r\n }", "@Override\n public boolean valida() {\n mediatorCredito m = new mediatorCredito();\n try{\n BigInteger dit = new BigInteger(JOptionPane.showInputDialog(null,\"Digite su número de \"\n + \"tarjeta de crédito\",\"\"));\n String pag = JOptionPane.showInputDialog(null,\"Ingrese su medio de pago: (Visa, master Card\"\n + \", American Express)\",\"\");\n if(m.verificarForm(dit, pag)==false){\n JOptionPane.showMessageDialog(null,\"ups, el medio de pago o la tarjeta de crédito no es válido\"\n ,\"Error\",0);\n }\n return m.verificarForm(dit, pag);\n \n }catch(Exception e){\n JOptionPane.showMessageDialog(null,\"Acción cancelada\",\"Advertencia\",2);\n return false;\n }\n }", "public void initialiseCred() {\n t1Cred = 0;\n t2Cred = 0;\n t1Sel.getItems().forEach(m -> t1Cred += m.getCredits());\n t2Sel.getItems().forEach(m -> t2Cred += m.getCredits());\n yrSel.getItems().forEach(m -> t1Cred += (m.getCredits() / 2));\n yrSel.getItems().forEach(m -> t2Cred += (m.getCredits() / 2)); //adds yr long credits split to both terms\n txtt1Cred.setText(\"\" + t1Cred);\n txtt2Cred.setText(\"\" + t2Cred);\n }", "@TransactionAttribute(TransactionAttributeType.REQUIRED)\n @Override\n public void descontarValorCompraTarjeta(ArrayList<Mueble> muebles, Usuario cliente)throws CupoInsuficienteException{\n double valor = calcularValorCompra(muebles);\n \n TarjetaCreditoAlpes tarjeta = (TarjetaCreditoAlpes) entityManagerDerby.createNamedQuery(\"TarjetaCreditoAlpes.findByNombretitular\").setParameter(\"nombreTitular\", cliente.getLogin()).getSingleResult();\n \n // Se valida que la tarjeta exista\n if(tarjeta == null){\n throw new CupoInsuficienteException(\"La tarjeta no existe!!\");\n }\n \n // Se valida el cupo de la tarjeta para realizar la transacción\n if(tarjeta.getCupo()< valor){\n throw new CupoInsuficienteException(\"El cliente no tiene cupo disponible en la tarjeta para realizar la compra.\\n\"\n + \"En el cupo de la tarjeta tiene: \" + tarjeta.getCupo() + \" y la compra es de : \" + valor);\n } else {\n tarjeta.setCupo(tarjeta.getCupo() - valor);\n entityManagerDerby.merge(tarjeta);\n System.out.println(\"Se actualizó el valor del cupo de la tarjeta\");\n }\n \n }", "public Integer pesquisarDebitoCreditoSituacaoAtualConta(Integer idConta) \n\t\t\tthrows ErroRepositorioException;", "public BigDecimal pesquisarValorCreditosARealizar(\n\t\t\tInteger idImovel,Integer anoMesCredito) throws ErroRepositorioException ;", "public boolean retirer(float montant) {\r\n\t\t\tboolean etat = false;\r\n\t\t\t\r\n\t\t\t// on ne retire le montant que si le solde reste positif ou nul\r\n\t\t\tif ((this.solde - montant) >= 0) {\r\n\t\t\t\tthis.solde=this.solde-montant;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tSystem.out.println(\"Solde insuffisant !!!!!!\");\r\n\t\t\t\tetat=false;\r\n\t\t\t}\r\n\t\t\t// affichage du nouveau solde apr�s retrait ou pas\r\n\t\t\tthis.afficheSolde();\r\n\t\t\treturn etat;\r\n\t\t}", "@Override\n public Boolean colisionoCon(Policia gr) {\n return true;\n }", "public Compagnie(int numeroTerrain, String nomTerrain, int prixAchat) {\n super(numeroTerrain, nomTerrain, prixAchat);\n setLoyer(20);\n }", "public void construirCargo() {\n persona.setCargo(Cargos.SUPERVISOR);\n }", "public Collection<CreditoRealizado> pesquisarCreditosRealizado(\n\t\t\tInteger idImovel,Integer anoMesCobrancaCredito) throws ErroRepositorioException ;", "public Comercial(String nombre ,int edad,double salario,double comision){\r\n\t\tsuper(nombre,edad,salario);\r\n\t\tthis.Comision=comision;\r\n\t}", "public Comercial(String nombre, String apellido, int edad, double salario, double comision)\n {\n \tsuper(nombre, apellido, edad, salario);\n \tthis.comision=comision;\n }" ]
[ "0.6715479", "0.6047241", "0.6010099", "0.59352946", "0.58912724", "0.5830262", "0.57151926", "0.5706986", "0.5685342", "0.56757444", "0.5642625", "0.55858266", "0.5572313", "0.5530399", "0.551818", "0.5513667", "0.5489456", "0.54888785", "0.5486181", "0.54816717", "0.54772323", "0.5471739", "0.54675275", "0.5466343", "0.54530245", "0.5447607", "0.54463696", "0.54229814", "0.5411968", "0.5408563", "0.538132", "0.53741944", "0.537358", "0.5366027", "0.5355003", "0.5354044", "0.53524435", "0.53514516", "0.53486335", "0.5333823", "0.53293306", "0.53183043", "0.531717", "0.53145725", "0.53139096", "0.5305419", "0.53043187", "0.52961963", "0.5295553", "0.52943265", "0.5291636", "0.5277774", "0.5274658", "0.5265214", "0.5263515", "0.52436304", "0.52425253", "0.52389824", "0.5231216", "0.5228054", "0.52278155", "0.52128446", "0.52086204", "0.52003527", "0.51966774", "0.5189698", "0.5182146", "0.516795", "0.5159077", "0.51565564", "0.5152228", "0.51489323", "0.51488566", "0.5146159", "0.51460314", "0.51452476", "0.51450694", "0.51440966", "0.5141972", "0.5137845", "0.5137108", "0.5137067", "0.5134248", "0.51328313", "0.5121726", "0.5121325", "0.5121076", "0.51141477", "0.51118565", "0.51112825", "0.51103544", "0.5103636", "0.50949645", "0.509149", "0.50914705", "0.5090165", "0.5089179", "0.508874", "0.5079733", "0.50784177" ]
0.518663
66
Permet de debiter un compte d'un certain montant.
@Override public void debit(Long idClient, Double value) { Optional<Compte> compteClient = getByIdClient(idClient); if (compteClient.isPresent()) { Double solde = compteClient.get().getSolde(); compteClient.get().setSolde(solde - value); update(compteClient.get()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void debiterMontant( double montant);", "public void comportement() {\n\t\tif (compteurPas > 0) {\n seDeplacer(deplacementEnCours);\n compteurPas--;\n\n // sinon charge le prochain deplacement\n\t\t} else {\n\t\t // recalcul le chemin si la cible a bouge\n boolean cibleBouger = calculPosCible();\n if (cibleBouger)\n calculerChemin();\n\n if (suiteDeDeplacement.size() > 0) {\n deplacementEnCours = suiteDeDeplacement.pollFirst();\n compteurPas = Case.TAILLE / vitesse;\n // pour le sprite\n if (deplacementEnCours == 'E')\n direction = true;\n else if (deplacementEnCours == 'O')\n direction = false;\n }\n }\n\t\tattaque = attaquer();\n\t}", "@Override\n public Coup meilleurCoup(Plateau _plateau, Joueur _joueur, boolean _ponder) {\n \n _plateau.sauvegardePosition(0);\n \n /* On créé un noeud père, qui est le noeud racine de l'arbre. On définit arbitrairement le joueur associé (\n (0 ou 1, il importe peu de savoir quel joueur correspond à ce nombre, cette information étant déjà portée par \n j1 et j2 dans l'algorithme. Le tout est de faire alterner cette valeur à chaque niveau de l'arbre. */\n \n Noeud pere = new Noeud();\n pere.joueurAssocie = 0;\n \n // On définit ici c, le coefficient d'arbitrage entre exploration et exploitation. Ce dernier est théroquement optimal pour una valeur égale à sqrt(2).\n \n double c = 10 * Math.sqrt(2);\n double[] resultat = new double[2];\n \n // Conditions de fonctionnement par itération\n \n //int i = 1;\n //int nbTours = 10000;\n \n //while(i <= nbTours){\n \n // Conditions de fonctionnement en mode \"compétition\" (100 ms pour se décider au maximum).\n \n long startTime = System.currentTimeMillis();\n \n while((System.currentTimeMillis()-startTime) < 100){\n\n // La valeur résultat ne sert à rien fondamentalement ici, elle sert uniquement pour le bon fonctionnement de l'algorithme en lui même.\n // On restaure le plateau à chaque tour dans le MCTS (Sélection - Expension - Simulation - Backpropagation). \n \n resultat = MCTS(pere, _plateau, this.j_humain, this.j_ordi, c, this.is9x9, this.methodeSimulation);\n _plateau.restaurePosition(0);\n \n //i++;\n }\n\n // On doit maintenant choisir le meilleur coup parmi les fils du noeud racine, qui correspondent au coup disponibles pour l'IA.\n \n double maxValue = 0;\n int maxValueIndex = 0;\n \n for(int j = 0; j < pere.fils.length; j++){\n \n double tauxGain = ((double)pere.fils[j].nbPartiesGagnees / (double)pere.fils[j].nbPartiesJouees);\n\n // On choisirat le coup qui maximise le taux de gain des parties simulées.\n \n if(tauxGain >= maxValue){\n maxValueIndex = j;\n maxValue = tauxGain;\n \n }\n }\n \n // On retourne le coup associé au taux de gain le plus élevé.\n\n return pere.fils[maxValueIndex].coupAssocie;\n }", "private void comerFantasma(Fantasma fantasma) {\n // TODO implement here\n }", "@Override\r\n\tpublic void verser(double mt, String cpte, Long codeEmp) {\n dao.addOperation(new Versement(new Date(),mt), cpte, codeEmp);\r\n Compte cp=dao.consulterCompte(cpte);\r\n cp.setSolde(cp.getSolde()+mt);\r\n\t}", "public boolean retirer(float montant) {\r\n\t\t\tboolean etat = false;\r\n\t\t\t\r\n\t\t\t// on ne retire le montant que si le solde reste positif ou nul\r\n\t\t\tif ((this.solde - montant) >= 0) {\r\n\t\t\t\tthis.solde=this.solde-montant;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tSystem.out.println(\"Solde insuffisant !!!!!!\");\r\n\t\t\t\tetat=false;\r\n\t\t\t}\r\n\t\t\t// affichage du nouveau solde apr�s retrait ou pas\r\n\t\t\tthis.afficheSolde();\r\n\t\t\treturn etat;\r\n\t\t}", "public void ajouterMontant( double montant){\r\n\t\tthis.solde += montant;\r\n\t}", "@Override\r\n\tpublic void retirer(double mt, String cpte, Long codeEmp) {\n\t dao.addOperation(new Retrait(new Date(),mt), cpte, codeEmp);\r\n\t Compte cp=dao.consulterCompte(cpte);\r\n\t cp.setSolde(cp.getSolde()-mt);\r\n\r\n\t}", "@Override\r\n public void combattre(Creature c) {\r\n System.out.println(\"Tour de combat de \" + getNom() + \" :\");\r\n if (this.getPtMana() > 0) {\r\n this.setPtMana(this.getPtMana() - 1);\r\n Random rand = new Random();\r\n int success = rand.nextInt(100), distance;\r\n distance = this.getPos().distance(c.getPos());\r\n if (distance <= this.getDistAttMax()) {//On vérifie que l'on peut toucher l'adversaire\r\n if (success < this.getPourcentageMag()) { // L'attaque réussie\r\n c.setPtVie(c.getPtVie() - this.getDegAtt()); //on inflige des dégats à l'adversaire.\r\n System.out.println(\"Attaque réussie de \" + getNom() + \" : \" + this.getDegAtt() + \" dégats infligés.\");\r\n } else {\r\n System.out.println(\"Dans le vide!\");\r\n }\r\n } else {\r\n System.out.println(\"Trop loin.\");\r\n }\r\n } else {\r\n System.out.println(\"Oups... plus de mana.\");\r\n }\r\n }", "@Override\n public synchronized void demarrer(){\n if(modele.getQuiterJeu()){return;}\n modele.getMoteurJeu().setEtapeJeu(this);\n // apercu dans le termial pour debuger\n System.out.println(\"-----------------nom joueur: \"+modele.getJoueurCourant().getNom());\n System.out.print(\" humain: \"+modele.getJoueurCourant().estHumain());\n System.out.print(\" stand: \"+modele.getJoueurCourant().getMainCourant().getStand());\n System.out.print(\" perdu: \"+modele.getJoueurCourant().getMainCourant().estPerdu());\n System.out.print(\" blackjack: \"+modele.getJoueurCourant().getMainCourant().estBlackJack());\n System.out.println(\" jeu: \"+modele.getJoueurCourant().getMainCourant().getJeu().toString());\n //-------------------------------------------------\n // On ne fait pas une boucle ici pour que l'observer\n // puisse acceder a son observé et se mettre a jour\n //-------------------------------------------------\n new Thread(){\n @Override\n public void run() {\n try {\n // si plus de carte\n if(modele.getPioche().getCartes().size() < 1){\n for(Carte carte:modele.getDefausse().getCartes()){\n carte.setFaceCarte(Face.VERSO);\n modele.getPioche().ajouterDessous(carte);\n }\n modele.getDefausse().vider();\n modele.getPioche().melanger();\n }\n \n \n // si il peut plus jouer\n if(modele.getJoueurCourant().getMainCourant().estBlackJack() || modele.getJoueurCourant().getMainCourant().estPerdu() \n || modele.getJoueurCourant().getMainCourant().getStand() || modele.getJoueurCourant().getMainCourant().est21()\n || modele.getJoueurCourant().getMainCourant().getAAbandonner() || modele.getJoueurCourant().getAPerduJeu()){\n \n // si le joueur a une autre main\n if(modele.getJoueurCourant().mainSuivant()){\n Thread.sleep(2000);\n demarrer();\n \n }\n // sinon si il y a un joueur suivant on fait joueur suivant\n else if(modele.joueurSuivant()){\n Thread.sleep(2000);\n demarrer();\n }else{\n modele.getMoteurJeu().setEtapeJeu(etapeSuivant);\n Thread.sleep(2000);\n modele.setMessage(modele.getCroupier().getNom()+\" plays\");\n // on affiche les carte du croupier\n for(Carte carte: modele.getCroupier().getMainCourant().getJeu().getCartes()){\n carte.setFaceCarte(Face.RECTO);\n }\n System.out.println(\"+++++++++++++++++++++++++++++++++++++++++++++++++\");\n Thread.sleep(3000);\n demarrerEtapeSuivant();\n\n }\n\n }\n // sinon\n else{\n modele.setMessage(modele.getJoueurCourant().getNom()+\" plays\");\n if(!modele.getJoueurCourant().estHumain()){\n modele.getJoueurCourant().jouer(modele.getPioche(),modele.getDefausse());\n Thread.sleep(3000);\n demarrer();\n }\n \n\n }\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n }.start();\n \n }", "public void afficher (UneCommande22<Integer> cde){ //POURQUOI CETTE MÉTHODE EST STATIQUE??? LA DEPLACER PE DANS COMMANDE\n\t\t\t\tif(cde.taille()==0) {ClientJava1DateUser.affiche(\"\\n\\t\\t COMMANDE EST VIDE\");\n\t\t\t\t}\n\t\t\t\telse {ClientJava1DateUser.affiche(cde.toString());}\t\n\t\t\t}", "@Override\n public void cantidad_Ataque(){\n ataque=5+2*nivel+aumentoT;\n }", "public void calculEtatSuccesseur() { \r\n\t\tboolean haut = false,\r\n\t\t\t\tbas = false,\r\n\t\t\t\tgauche = false,\r\n\t\t\t\tdroite = false,\r\n\t\t\t\thautGauche = false,\r\n\t\t\t\tbasGauche = false,\r\n\t\t\t\thautDroit = false,\r\n\t\t\t\tbasDroit = false;\r\n\t\t\r\n\t\tString blanc = \" B \";\r\n\t\tString noir = \" N \";\r\n\t\tfor(Point p : this.jetonAdverse()) {\r\n\t\t\tString [][]plateau;\r\n\t\t\tplateau= copieEtat();\r\n\t\t\tint x = (int) p.getX();\r\n\t\t\tint y = (int) p.getY();\r\n\t\t\tif(this.joueurActuel.getCouleur() == \"noir\") { //dans le cas ou le joueur pose un pion noir\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif(p.getY()>0 && p.getY()<plateau[0].length-1 && p.getX()>0 && p.getX()<plateau.length-1) { //on regarde uniquement le centre du plateaau \r\n\t\t\t\t\t//on reinitialise x,y et plateau a chaque étape\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t\r\n\t\t\t\t\tdroite = getDroite(x,y,blanc);\r\n\t\t\t\t\thaut = getHaut(x, y, blanc);\r\n\t\t\t\t\tbas = getBas(x, y, blanc);\r\n\t\t\t\t\tgauche = getGauche(x, y, blanc);\r\n\t\t\t\t\thautDroit = getDiagHautdroite(x, y, blanc);\r\n\t\t\t\t\thautGauche = getDiagHautGauche(x, y, blanc);\r\n\t\t\t\t\tbasDroit = getDiagBasDroite(x, y, blanc);\r\n\t\t\t\t\tbasGauche = getDiagBasGauche(x, y, blanc);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(this.plateau[x][y-1]==noir) {//regarder si à gauche du pion blanc il y a un pion noir\r\n\r\n\t\t\t\t\t\t//on regarde si il est possible de poser un pion noir à droite\r\n\t\t\t\t\t\tif(droite) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = noir;\r\n\t\t\t\t\t\t\t\ty++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//1\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(this.plateau[x-1][y]==noir) {//regardre au dessus si le pion est noir\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(bas) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tplateau[x][y]= noir;\r\n\t\t\t\t\t\t\t\tx++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//2\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(this.plateau[x][y+1]==noir) { //regarde a droite si le pion est noir\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(gauche) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\tplateau[x][y]= noir;\r\n\t\t\t\t\t\t\t\ty--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//3\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\tif(this.plateau[x+1][y] == noir) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(haut) {\r\n\t\t\t\t\t\t\t//System.out.println(\"regarde en dessous\");\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = noir;\r\n\t\t\t\t\t\t\t\tx--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//4\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diaghautgauche\r\n\t\t\t\t\tif(this.plateau[x+1][y+1]==noir) {\r\n\t\t\t\t\t\tif(hautGauche) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = noir;\r\n\t\t\t\t\t\t\t\tx--;\r\n\t\t\t\t\t\t\t\ty--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//5\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diagbasGauche\r\n\t\t\t\t\tif(this.plateau[x-1][y+1]==noir) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(basGauche) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = noir;\r\n\t\t\t\t\t\t\t\tx++;\r\n\t\t\t\t\t\t\t\ty--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}//6\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diaghautDroit : OK!\r\n\t\t\t\t\tif(this.plateau[x+1][y-1]==noir) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(hautDroit) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = noir;\r\n\t\t\t\t\t\t\t\tx--;\r\n\t\t\t\t\t\t\t\ty++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}//7\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diagBasDroit\r\n\t\t\t\t\tif(this.plateau[x-1][y-1]==noir) {\r\n\t\t\t\t\t\tif(basDroit) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == blanc) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = noir;\r\n\t\t\t\t\t\t\t\tx++;\r\n\t\t\t\t\t\t\t\ty++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=noir;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, noir, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t\t//System.out.println(\"ajouté!\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//8\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\telse {//si le joueur actuel a les pions blanc\r\n\t\t\t\tif(p.getY()>0 && p.getY()<plateau[0].length-1 && p.getX()>0 && p.getX()<plateau.length-1) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\tif(this.plateau[x][y-1]==blanc) {//regarder si à gauche du pion blanc il y a un pion noir\r\n\t\t\t\t\t\t//on regarde si il est possible de poser un pion noir à droite\r\n\t\t\t\t\t\tif(getDroite(x,y,noir)) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = blanc;\r\n\t\t\t\t\t\t\t\ty++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t}//1.1\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(this.plateau[x-1][y]==blanc) {//regardre au dessus si le pion est noir\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(getBas(x, y, noir)) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tplateau[x][y]= blanc;\r\n\t\t\t\t\t\t\t\tx++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//2.2\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(this.plateau[x][y+1]==blanc) { //regarde a droite si le pion est noir\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(getGauche(x, y, noir)) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\tplateau[x][y]= blanc;\r\n\t\t\t\t\t\t\t\ty--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//3.3\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\tif(this.plateau[x+1][y] == blanc) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(getHaut(x, y, noir)) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = blanc;\r\n\t\t\t\t\t\t\t\tx--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//4.4\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diaghautgauche\r\n\t\t\t\t\tif(this.plateau[x+1][y+1]==blanc) {\r\n\t\t\t\t\t\tif(getDiagHautGauche(x,y,noir)) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = blanc;\r\n\t\t\t\t\t\t\t\tx--;\r\n\t\t\t\t\t\t\t\ty--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]= blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//5.5\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diagbasGauche\r\n\t\t\t\t\tif(this.plateau[x-1][y+1]==blanc) {\r\n\t\t\t\t\t\tif(getDiagBasGauche(x,y,noir)) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = blanc;\r\n\t\t\t\t\t\t\t\tx++;\r\n\t\t\t\t\t\t\t\ty--;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//6.6\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diaghautDroit\r\n\t\t\t\t\tif(this.plateau[x+1][y-1]==blanc) {\r\n\t\t\t\t\t\tif(getDiagHautdroite(x,y,noir)) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = blanc;\r\n\t\t\t\t\t\t\t\tx--;\r\n\t\t\t\t\t\t\t\ty++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}//7.7\r\n\t\t\t\t\t\r\n\t\t\t\t\tx = (int) p.getX();\r\n\t\t\t\t\ty = (int) p.getY();\r\n\t\t\t\t\tplateau= copieEtat();\r\n\t\t\t\t\t//diagBasDroit\r\n\t\t\t\t\tif(this.plateau[x-1][y-1]==blanc) {\r\n\t\t\t\t\t\tif(getDiagBasDroite(x,y,noir)) {\r\n\t\t\t\t\t\t\twhile(plateau[x][y] == noir) {\r\n\t\t\t\t\t\t\t\tplateau[x][y] = blanc;\r\n\t\t\t\t\t\t\t\tx++;\r\n\t\t\t\t\t\t\t\ty++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tplateau[x][y]=blanc;\r\n\t\t\t\t\t\t\tplateau=pionPosé(x, y, blanc, plateau);\r\n\t\t\t\t\t\t\tthis.setSuccesseur(new EtatReversi(this, plateau));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}//8.8\r\n\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\n public void cantidad_Punteria(){\n punteria=69.5+05*nivel+aumentoP;\n }", "public double getMontant() {\n\t\treturn _montant;\n\t}", "public static void establecerMano(Monton todas,Mano[] jugadores){\n int pos;\n Pieza pieza;\n for (int i = 0; i < jugadores.length; i++) {\n for (int j = 0; j < Ajustes.PIEZAS_MANO; j++) {\n if(todas.getNPiezasMonton()>0){\n pos=(int) (Math.random()*todas.getNPiezasMonton());\n pieza=todas.getUnaPieza(pos);\n jugadores[i].setUnaPieza(pieza);\n todas.eliminarPiezaMonton(pieza); \n }\n \n }\n }\n System.out.println(\"\\nCada jugador tiene \"+jugadores[0].getNPiezas()+\" piezas.\");\n if(todas.getNPiezasMonton()!=0)\n System.out.println(\"Y en el monton quedan \"+todas.getNPiezasMonton());\n else\n System.out.println(\"No quedan piezas en el monton\");\n }", "AbbayeduMontdesCats(Machecoulais machecoulais, Context context) {\n super(1);\n this.f16560a = machecoulais;\n this.f16561b = context;\n }", "public void effetCarte(Partie partie) {\r\n\r\n\t\tint nbHuitsJoues = partie.getLesJoueurs().get(partie.getTour()).getNbCartesJouees();\r\n\r\n\t\tpartie.setNbTouraPasser( partie.getNbTouraPasser() + (1*nbHuitsJoues) );\r\n\r\n\t\tif (nbHuitsJoues==1)\r\n\t\t\tSystem.out.println(\"--> Le joueur suivant passe son tour\");\r\n\t\telse\r\n\t\t\tSystem.out.println(\"--> Les \"+nbHuitsJoues+\" joueurs suivants passent leurs tour\");\r\n\r\n\r\n\r\n\r\n\t}", "@Override\r\n\t/**\r\n\t * Actionne l'effet de la carte.\r\n\t * \r\n\t * @param listejoueur\r\n\t * \t\t\tLa liste des joueurs de la partie.\r\n\t * @param cible\r\n\t * \t\t\tLa joueur contre qui l'effet sera joué.\r\n\t * @param table\r\n\t * \t\t\tCollection de cartes situées au centre de la table de jeu.\r\n\t * @param carte\r\n\t * \t\t\tLa carte qui joue l'effet.\r\n\t * @param j\r\n\t * \t\t\tLe joueur qui joue la carte.\r\n\t * @param collection\r\n\t * \t\t\tLe deck de cartes.\r\n\t * @param tourjoueur\r\n\t * \t\t\tLa liste des joueurs selon l'ordre de jeu.\r\n\t */\r\n\tpublic void utiliserEffet(ArrayList<Joueur> listejoueur, int cible, ArrayList<Carte> table, Carte carte,\r\n\t\t\tint j, ArrayList<Carte> collection,ArrayList<Joueur> tourjoueur) {\n\t\tcont = Controller.getInstance();\r\n\t\tint id = carte.getIdentifiantCarte();\r\n\t\tif (id ==9 || id ==10 || id==22 || id==23){\r\n\t\t\tif (tourjoueur.get(j) == listejoueur.get(0)){\r\n\t\t\t\tSystem.out.println(\"Choisissez le Divinité qui sera forcer de sacrifier un croyant\");\r\n\t\t\t\t\r\n\t\t\t\tcont.setChoisirCible(true);\r\n\t\t\t\t\r\n\t\t\t\twhile(cont.getChoixCible()==-1){\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tThread.sleep(200);\r\n\t\t\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tSystem.out.println(\"Effet: Le \" +tourjoueur.get(j).getNom() + \" force le \" +listejoueur.get(cont.getChoixCible()).getNom() + \" à sacrifier un Croyant\");\r\n\t\t\t\t\r\n\t\t\t\tif (listejoueur.get(cont.getChoixCible()).getNombreCroyantTotal()>0){\r\n\t\t\t\t\tfor(int i=0;i<listejoueur.get(cont.getChoixCible()).getGuidePossede().size();i++){\r\n\t\t\t\t\t\tfor (int k=0;k<listejoueur.get(cont.getChoixCible()).getGuidePossede().get(i).getCroyantPossede().size();k++){\r\n\t\t\t\t\t\t\tlistejoueur.get(cont.getChoixCible()).getGuidePossede().get(i).getCroyantPossede().get(k).setSelectionnee(true); // On rend possible l'utilisation de la carte\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tlistejoueur.get(cont.getChoixCible()).setDoitSacrifierCroyant(true);\r\n\t\t\t\ttourjoueur.get(j).forcerAction(cont.getChoixCible(),listejoueur.get(cont.getChoixCible()).isDoitSacrifierCroyant(), listejoueur,0,table,collection,tourjoueur);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tSystem.out.println(\"Info : Le \" +listejoueur.get(cont.getChoixCible()).getNom() + \" n'a aucun croyant a sacrifier \");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t\r\n\t\t\t\t max = 0;\r\n\t\t\t\t\tjoueurCible =-1;;\r\n\t\t\t\tfor (int i=0; i<listejoueur.size();i++){\r\n\t\t\t\t\r\n\t\t\t\t\tif (listejoueur.get(i).getGuidePossede().size() > max){\r\n\t\t\t\t\tmax = listejoueur.get(i).getGuidePossede().size();\r\n\t\t\t\t\tjoueurCible = i;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\tSystem.out.println(\"Effet: Le \" +tourjoueur.get(j).getNom() + \" force le \" +listejoueur.get(joueurCible).getNom() + \" à sacrifier un Croyant\");\r\n\t\t\tif (listejoueur.get(joueurCible).getNombreCroyantTotal()>0){\r\n\t\t\t\t\r\n\t\t\t\t\tfor(int i=0;i<listejoueur.get(joueurCible).getGuidePossede().size();i++){\r\n\t\t\t\t\t\tfor (int k=0;k<listejoueur.get(joueurCible).getGuidePossede().get(i).getCroyantPossede().size();k++){\r\n\t\t\t\t\t\t\tlistejoueur.get(joueurCible).getGuidePossede().get(i).getCroyantPossede().get(k).setSelectionnee(true); // On rend possible l'utilisation de la carte\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tlistejoueur.get(joueurCible).setDoitSacrifierCroyant(true);\r\n\t\t\ttourjoueur.get(j).forcerAction(joueurCible,listejoueur.get(joueurCible).isDoitSacrifierCroyant(), listejoueur,0,table,collection,tourjoueur);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tSystem.out.println(\"Info : Le \" +listejoueur.get(joueurCible).getNom() + \" n'a aucun croyant à sacrifier\");\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if ( id==11){\r\n\t\t\tif (tourjoueur.get(j) == listejoueur.get(0)){\r\n\t\t\t\tSystem.out.println(\"Choisissez le Divinité qui sera forcer de sacrifier un guide\");\r\n\t\t\t\twhile(cont.getChoixCible()==-1){\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tThread.sleep(200);\r\n\t\t\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tSystem.out.println(\"Effet: Le \" +tourjoueur.get(j).getNom() + \" force le \" +listejoueur.get(cont.getChoixCible()).getNom() + \" à sacrifier un Guide\");\r\n\t\t\t\t\r\n\t\t\t\tif(listejoueur.get(cont.getChoixCible()).getGuidePossede().size()>0){\r\n\t\t\t\t\tfor (int i=0;i<listejoueur.get(cont.getChoixCible()).getGuidePossede().size();i++){\r\n\t\t\t\t\t\tfor(int k=0;k<listejoueur.get(cont.getChoixCible()).getGuidePossede().get(i).getCroyantPossede().size();k++){\r\n\t\t\t\t\t\t\tlistejoueur.get(cont.getChoixCible()).getGuidePossede().get(i).getCroyantPossede().get(k).setSelectionnee(true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlistejoueur.get(cont.getChoixCible()).setDoitSacrifierGuide(true);\r\n\t\t\t\t\ttourjoueur.get(j).forcerAction(cont.getChoixCible(),listejoueur.get(cont.getChoixCible()).isDoitSacrifierGuide(), listejoueur,0,table,collection,tourjoueur);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tSystem.out.println(\"Info : Le \" +listejoueur.get(joueurCible).getNom() + \" n'a aucun guide à sacrifier\");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t\r\n\t\t\t\t max = 0;\r\n\t\t\t\t\tjoueurCible =-1;;\r\n\t\t\t\tfor (int i=0; i<listejoueur.size();i++){\r\n\t\t\t\t\r\n\t\t\t\t\tif (listejoueur.get(i).getGuidePossede().size() > max){\r\n\t\t\t\t\tmax = listejoueur.get(i).getGuidePossede().size();\r\n\t\t\t\t\tjoueurCible = i;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"Effet: Le \" +tourjoueur.get(j).getNom() + \" force le \" +listejoueur.get(joueurCible).getNom() + \" à sacrifier un Guide\");\r\n\t\t\t\tif (listejoueur.get(joueurCible).getGuidePossede().size()>0){\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tfor(int i=0;i<listejoueur.get(joueurCible).getGuidePossede().size();i++){\r\n\t\t\t\t\t\t\tlistejoueur.get(joueurCible).getGuidePossede().get(i).setSelectionnee(true); // On rend possible l'utilisation de la carte\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tlistejoueur.get(joueurCible).setDoitSacrifierGuide(true);\r\n\t\t\t\ttourjoueur.get(j).forcerAction(joueurCible,listejoueur.get(joueurCible).isDoitSacrifierGuide(), listejoueur,0,table,collection,tourjoueur);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tSystem.out.println(\"Info : Le \" +listejoueur.get(joueurCible).getNom() + \" n'a aucun guide à sacrifier\");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\t\r\n\t}", "public double getMontant() {\n\t\treturn montant;\n\t}", "public IJoueur quiEstMonMaitre();", "public abstract void setMontant(Double unMontant);", "public CompteEpargne(int numeroDeCompte, String dateOuvertureCompte, double taux) {\n\t\tsuper();\n\t\tsuper.numeroDeCompte = numeroDeCompte;\n\t\tsuper.dateOuvertureCompte = dateOuvertureCompte;\n\t\tthis.taux = taux;\n\t\tsuper.typeDeCompte = true;\n\t}", "public boolean jeu() {\n int k;\n\n String compJoueur = \"\";\n String compOrdi = \"\";\n String reponse;\n\n boolean victoireJoueur = false;\n boolean victoireOrdi = false;\n String mystJoueur = challenger.nbMystere(); /**nb que le joueur doit trouver*/\n String mystOrdi = defenseur.nbMystere(); /**nb que l'ordinateur doit trouver*/\n String propOrdi = defenseur.proposition(); /**ordinateur genere un code aleatoire en premiere proposition*/\n log.info(\"Proposition ordinateur : \" + propOrdi); /**afficher proposition ordinateur*/\n String propJoueur = \"\";\n String goodResult = MethodesRepetitives.bonResultat();\n\n\n for (k = 1; !victoireJoueur && !victoireOrdi && k <= nbEssais; k++) { /**si ni le joueur ou l'ordinateur n'ont gagne et si le nombre d'essais n'est pas atteind, relancer*/\n\n compOrdi = MethodesRepetitives.compare(mystOrdi, propOrdi); /**lancer la methode de comparaison du niveau defenseur*/\n log.info(\"Reponse Ordinateur :\" + compOrdi); /**afficher la comparaison*/\n propJoueur = challenger.proposition(); /**demander une saisie au joueur selon le mode challenger*/\n compJoueur = MethodesRepetitives.compare(mystJoueur, propJoueur); /**comparer selon le mode challenger*/\n log.info(\"Reponse Joueur :\" + compJoueur); /**afficher la comparaison*/\n\n if (compOrdi.equals(goodResult)) { /**si l'ordinateur a gagne, changement de la valeur victoireOrdi*/\n victoireOrdi = true;\n }else if(compJoueur.equals(goodResult)) {/**si le joueur a gagne changement de la valeur victoireJoeur*/\n victoireJoueur = true;\n } else if (k < nbEssais) { /**sinon redemander un code a l'ordinateur selon les symboles de comparaison*/\n propOrdi = defenseur.ajuste(propOrdi, compOrdi);\n log.info(\"Proposition Ordinateur :\" + propOrdi);\n }\n }\n\n if (victoireOrdi || !victoireJoueur)/**si l'ordinateur ou le joueur perdent alors perdu sinon gagne*/\n victoireJoueur = false;\n else\n victoireJoueur = true;\n\n return victoireJoueur;\n\n\n }", "public void coupCritique(Personnage ennemi, double valeur) throws InterruptedException { // Allows a critical strike\n\t\tint x;\n\t\tx = (int) (Math.random() * 10);\n\t\tif (x <= valeur) { // Proba valeur+1/10\n\t\t\tennemi.setHp(ennemi.getHp() - (this.getStrength()));\n\t\t\tUtilitaire.lettreParLettre(\"Coup critique !!!\");\n\t\t}\n\n\t}", "public abstract Double getMontant();", "public void distribuirAportes2(){\n\n if(comprobanteSeleccionado.getAporteorganismo().floatValue() > 0f){\n comprobanteSeleccionado.setAportecomitente(comprobanteSeleccionado.getMontoaprobado().subtract(comprobanteSeleccionado.getAporteuniversidad().add(comprobanteSeleccionado.getAporteorganismo())));\n }\n }", "public void placerBateauSurVue() {\n\t\tint compteur = 1;\n\t\tif (partie.verifierSiPoseBateauPossible()) {\n\t\t\tfor (int i : partie.getJoueur().getBateau()[partie.getJoueur().getIndiceBateauEnCours()].getCaseOnId()) {\n\t\t\t\tif (i != -1)\n\t\t\t\t\tvue.setfield(i, partie.getJoueur().getBateau()[partie.getJoueur().getIndiceBateauEnCours()]\n\t\t\t\t\t\t\t.getImageDirectoryFinal(), compteur, true);\n\n\t\t\t\tcompteur++;\n\t\t\t}\n\t\t} else {\n\t\t\tfor (int i : partie.getJoueur().getBateau()[partie.getJoueur().getIndiceBateauEnCours()].getCaseOnId()) {\n\t\t\t\tif (i != -1)\n\t\t\t\t\tvue.setfield(i, partie.getJoueur().getBateau()[partie.getJoueur().getIndiceBateauEnCours()]\n\t\t\t\t\t\t\t.getImageDirectoryFinal(), compteur, false);\n\n\t\t\t\tcompteur++;\n\t\t\t}\n\t\t}\n\t}", "private static void statistique(){\n\t\tfor(int i = 0; i<7; i++){\n\t\t\tfor(int j = 0; j<7; j++){\n\t\t\t\tfor(int l=0; l<jeu.getJoueurs().length; l++){\n\t\t\t\t\tif(jeu.cases[i][j].getCouleurTapis() == jeu.getJoueurs()[l].getNumJoueur()){\n\t\t\t\t\t\tjeu.getJoueurs()[l].setTapis(jeu.getJoueurs()[l].getTapisRest()+1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tJoueur j;\n\t\tSystem.out.println(\"// Fin de la partie //\");\n\t\tfor(int i=0; i<jeu.getJoueurs().length; i++) {\n\t\t\tj =jeu.getJoueurs()[i];\n\t\t\tSystem.out.println(\"Joueur \"+ (j.getNumJoueur()+1) + \" a obtenue \"+j.getTapisRest()+j.getMonnaie()+\" points\" );\n\t\t}\n\t}", "public void gastarDinero(double cantidad){\r\n\t\t\r\n\t}", "public void partieEnCour(int niveau){\n\t\t\t\n\t\t\tif(niveau<=0){\n\t\t\t\tSystem.out.println(\"Quel niveau ?\");\n\t\t\t\tniveau=lire.nextInt();\n\t\t\t}\n\t\t\tthis.niveau=niveau;\n\t\t\tthis.terrainDeLaPartie=this.EnsembleNiveau.listeMap.get(niveau-1);\n\t\t\tSystem.out.println(terrainDeLaPartie.getCave().toString());\n\t\t\tthis.terrainDeLaPartie.afficherMap();\n\t\t\tboolean heroEnVie=true;\n\t\t\twhile(sortieNonAtteint()&& tempsNonEcoule() && heroEnVie==true){\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tfor(ObjetVivant eleViv:terrainDeLaPartie.getPersonnageSurLeTerrain()){\n\t\t\t\t\ttry{\n\t\t\t\t\t\tif(eleViv.estEnVie()){\n\t\t\t\t\t\t\teleViv.seDeplacer(terrainDeLaPartie);\n\t\t\t\t\t\t}\n\t\t\t\t\t}catch(DeplacementInvalideException e){\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tfor(ObjetNonVivant eleNonViv:terrainDeLaPartie.getObjetSurLeTerrain()){\n\t\t\t\t\teleNonViv.tomber(terrainDeLaPartie);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\tquiEstMort();\n\t\t\t\tquiEstDetruit();\n\t\t\t\tthis.terrainDeLaPartie.getObjetSurLeTerrain().addAll(this.terrainDeLaPartie.reinitialisationObjet());\n\t\t\t\tthis.terrainDeLaPartie.afficherMap();\n\t\t\t\tCave a=this.terrainDeLaPartie.getCave();\n\t\t\t\ta.setCaveTime(a.getCaveTime()-1);\t\t\t\n\t\t\t\tSystem.out.println(this.terrainDeLaPartie.getPersonnageSurLeTerrain().size()-1+\" enemie\");\n\t\t\t\tSystem.out.println(this.terrainDeLaPartie.getObjetSurLeTerrain().size()-1+\" objet\");\n\t\t\t\t\n\t\t\t\theroEnVie=heroEncoreDansListe(this.terrainDeLaPartie.getPersonnageSurLeTerrain());\n\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif(heroEnVie && !sortieNonAtteint()){\n\t\t\t\tthis.terrainDeLaPartie=this.EnsembleNiveau.listeMap.get(niveau);\n\t\t\t\tpartieEnCour(niveau+1);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(\"Vous avez perdu ! Voulez vous rejouer ?\");\n\t\t\t\tSystem.out.println(\"1:rejouer\");\n\t\t\t\tSystem.out.println(\"2:quitter \");\n\t\t\t\tint rep=lire.nextInt();\n\t\t\t\tif(rep==1){\n\t\t\t\t\tFile f=new File(\"BD01plus.bdcff\");\n\t\t\t\t\tEnsembleNiveau=new Univers();\n\t\t\t\t\tLireFichier.lire(f, EnsembleNiveau);\n\t\t\t\t\tthis.partieEnCour(niveau);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}", "public int fondMagasin(){\n\tint total =this.jeton;\n\tfor(Caisse c1 : this.lesCaisses){\n\ttotal = c1.getTotal()+total;\n\t}\n\treturn total;\n}", "public Personnage attaqueSurPersonnage() {\n\t\tdouble rand = Math.random();\n\t\t\tif (rand >= 0.85){\n\t\t\t\tfrappeMonstre = monstre.getCaracter().getForce() * 2;\n\t\t\t\tjoueur.setDiminutionPV(frappeMonstre);\n\t\t\t\tsetVictimeKO(joueur);\n\t\t\t\tetatAttaque = 'C';\n\t\t\t\treturn joueur;\n\t\t\t}\n\t\t\telse if ((rand < 0.85) && (rand >= 0.15)){\n\t\t\t\tfrappeMonstre = monstre.getCaracter().getForce();\n\t\t\t\tjoueur.setDiminutionPV(frappeMonstre);\n\t\t\t\tsetVictimeKO(joueur);\n\t\t\t\tetatAttaque = 'N';\n\t\t\t\treturn joueur;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tetatAttaque = 'F';\n\t\t\t\tfrappeMonstre = 0;\n\t\t\t\treturn joueur;\n\t\t\t}\n\t\t}", "private void cpu_jogada(){\n\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(matriz[i][j] == jd2){\n // verificarAtaque(i,j,jd2);\n //verificarAtaque as posssibilidades de\n // ataque : defesa : aleatorio\n //ataque tem prioridade 1 - ve se tem como comer quem ataca\n //defesa tem prioridade 2 - ou movimenta a peca que esta sob ataque ou movimenta a outa para ajudar\n //aleatorio nao tem prioridade -- caso nao esteja sob ataque ou defesa\n }\n }\n }\n }", "public void donnerArtefact() {\r\n\t\tZone z = j.getZone();\r\n\t\tif (z.getElement() == modele.Element.Neutre) {\r\n\t\t\tSystem.out.println(\"Cette zone ne contient pas d'artefact !\");\r\n\t\t}\r\n\t\tif (this.clefsMinimum <= j.combienCles(z.getElement())) {\r\n\t\t\tj.recupereObjet(new Artefact(z.getElement()));\r\n\t\t\tj.enleveCles(new Clef(z.getElement()), clefsMinimum);\r\n\t\t\t\r\n\t\t\tthis.incrNbAction();\r\n\t\t\tthis.notifyObservers();\r\n\t\t\tj.getIle().notifyObservers(); // Pour l'affichage d'inventaire.\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic void utiliserEffetDivinite(ArrayList<Joueur> listejoueur, int j, ArrayList<Carte> collection,\r\n\t\t\tArrayList<Carte> table, int cible, ArrayList<Joueur> tourJoueur) {\n\t\t\r\n\t}", "@Test\n public void testVirement1() {\n\n //Arrange\n CompteBancaire cpt1 = new CompteBancaire(63000.0);\n CompteBancaire cpt2 = new CompteBancaire(43000.0);\n double montant_a_virer = 28000.0;\n double excepted_solde_cpt1 = 35000.0;\n double excepted_solde_cpt2 = 71000.0;\n\n //Act\n assertEquals(true, cpt1.virerArgent(cpt2, montant_a_virer));\n\n //Assert\n assertEquals(excepted_solde_cpt1, cpt1.getSolde(), 0);\n assertEquals(excepted_solde_cpt2, cpt2.getSolde(), 0);\n\n }", "public static void main(String[] args) {\n\n\t\tMulta_Trafico mt1 = new Multa_Trafico(20, \"B\");\n\t\tmt1.setResponsable(\"Paco\");\n\t\tmt1.setDescripcion(\"Exceso de velocidad\");\n\t\tmt1.setMatricula(\"MK\");\n\t\tmt1.setFecha(\"Viernes\");\n\t\tmt1.verdatos();\n\n\t\tMulta_Covid mc2 = new Multa_Covid(10, \"C\");\n\t\tmc2.setResponsable(\"Pepa\");\n\t\tmc2.setDescripcion(\"No llevaba mascarilla\");\n\t\tmc2.setMascarilla(false);\n\t\tmc2.setFecha(\"Jueves\");\n\t\tmc2.verdatos();\n\n\t\t// Para saber de qué tipo es una clase, objeto, etc... con instanceof\n\t\t// Método saberTipo\n\n\t\tExpediente expe1 = new Expediente(10, \"A\");\n\t\tSystem.out.println(saberTipo(expe1));\n\t\tSystem.out.println(saberTipo(mt1));\n\t\tSystem.out.println(saberTipo(mc2));\n\n\t\tMulta m3 = new Multa(10, \"A\"); // variables del metodo ImporteMayor\n\t\tMulta m4 = new Multa(10, \"B\");\n\t\tm3.setDescripcion(\"Multa\");\n\t\tm3.setResponsable(\"Alberto\");\n\t\tm3.setImporte(200);\n\t\tm4.setImporte(2000);\n\n\t\tSystem.out.println(ImporteMayor(m3, m4));\n\t\tSystem.out.println(conocerTipo(m3));\n\t\tSystem.out.println(m3);\n\n\t\t// array de 50 posiciones para el método MultaMayor\n\n\t\tMulta multas[] = new Multa[50];\n\n\t\tfor (int i = 0; i < multas.length; i++) { // Relleno con descripción e importe\n\t\t\tmultas[i] = new Multa(i, \"A\");\n\t\t\tmultas[i].setDescripcion(\"Descripción\" + i);\n\t\t\tmultas[i].setImporte(Math.random() * 1000 + 25);\n\t\t}\n\t\tSystem.out.println(CalcularMayor(multas));\n\n\t}", "@Override\n\tpublic void setMontant(double s) {\n\t\t\n\t}", "public static boolean cumpleEdadMinima(String tipoLicencia, int edad) {\n boolean cumple = false;\n switch(tipoLicencia){\n case \"Clase A\": \n if(edad >= 17)\n { \n cumple = true;\n }\n else\n {\n cumple = false;\n }\n break;\n case \"Clase B\": if(edad >= 17)\n { \n cumple = true;\n }\n else\n {\n cumple = false;\n }\n break;\n case \"Clase C\": if(edad >= 21)\n { \n cumple = true;\n }\n else\n {\n cumple = false;\n }\n break;\n case \"Clase D\": if(edad >= 21)\n { \n cumple = true;\n }\n else\n {\n cumple = false;\n }\n break;\n case \"Clase E\": if(edad >= 21)\n { \n cumple = true;\n }\n else\n {\n cumple = false;\n }\n break;\n case \"Clase F\": if(edad >= 17)\n { \n cumple = true;\n }\n else\n {\n cumple = false;\n }\n break;\n case \"Clase G\": if(edad >= 17)\n { \n cumple = true;\n }\n else\n {\n cumple = false;\n }\n break;\n } \n return cumple;\n }", "@Test\n public void testVirement3() {\n\n //Arrange\n CompteBancaire cpt1 = new CompteBancaire(0.0);\n CompteBancaire cpt2 = new CompteBancaire(43000.0);\n double montant_a_virer = 8000.0;\n double excepted_solde_cpt1 = 0.0;\n double excepted_solde_cpt2 = 43000.0;\n\n //Act\n assertEquals(false, cpt1.virerArgent(cpt2, montant_a_virer));\n\n //Assert\n assertEquals(excepted_solde_cpt1, cpt1.getSolde(), 0);\n assertEquals(excepted_solde_cpt2, cpt2.getSolde(), 0);\n\n }", "@Test\n public void testVerser1() {\n\n //Arrange\n CompteBancaire cpt = new CompteBancaire(5000.0);\n double montant_a_verser = 1000.0;\n double excepted = 6000.0;\n\n //Act\n assertEquals(true, cpt.verser(montant_a_verser));\n\n //Assert\n assertEquals(excepted, cpt.getSolde(), 0);\n }", "public Camion(int peso,Marcas marca,int kilometraje,int antiguedad) {\n super(peso,marca,kilometraje,antiguedad);\n if (super.getMarca().equals(\"FORD\")|| super.getMarca().equals(\"FIAT\"))\n {\n super.setArticulado();\n }\n if(super.getArticulado() && getPeso()<3000)\n {\n super.setCumpleNormativa();\n }\n if(!super.getArticulado() && getPeso()<2000)\n {\n super.setCumpleNormativa();\n }\n\n }", "@Override\n\tpublic double getMontant() {\n\t\treturn 0;\n\t}", "public static void main(String[] args) {\n\t\tMaison maison = new Maison();\n\t\t\n\t\t// ajouts de différentes pièces à maison\n\t\tmaison.ajouterPiece(new Chambre(12, 1));\n\t\tmaison.ajouterPiece(new Chambre(10, 1));\n\t\tmaison.ajouterPiece(new Salon(18, 0));\n\t\tmaison.ajouterPiece(new Cuisine(10, 0));\n\t\tmaison.ajouterPiece(new SalleDeBain(4, 1));\n\t\tmaison.ajouterPiece(new Wc(1, 0));\n\n\t\t\n\t\t// affichage des résultats\n\t\tSystem.out.println(\"Superficie totale : \" + maison.superficieTotale() + \" m2\");\n\t\tSystem.out.println(\"Superficie rez de chaussée : \" + maison.superficieEtage(0)+ \" m2\");\n\t\tSystem.out.println(\"Superficie étage 1 : \" + maison.superficieEtage(1)+ \" m2\");\n\t\t\n\t\tSystem.out.println(\"La superficie totale des chambres est de : \" + maison.superficieTypePiece(\"Chambre\") + \" m2\");\n\t\tSystem.out.println(\"Il y a \" + maison.nbPieceType(\"Chambre\") + \" chambres.\");\n\t}", "public void actionsTouches () {\n\t\t//Gestion des deplacements du mineur si demande\n\t\tif (Partie.touche == 'g' || Partie.touche == 'd' || Partie.touche == 'h' || Partie.touche == 'b') deplacements();\n\n\t\t//Affichage du labyrinthe et des instructions, puis attente de consignes clavier.\n\t\tpartie.affichageLabyrinthe();\n\n\t\t//Quitte la partie si demande.\n\t\tif (Partie.touche == 'q') partie.quitter();\n\n\t\t//Trouve et affiche une solution si demande.\n\t\tif (Partie.touche == 's') affichageSolution();\n\n\t\t//Recommence la partie si demande.\n\t\tif (Partie.touche == 'r') {\n\t\t\tgrille.removeAll();\n\t\t\tpartie.initialisation();\n\t\t}\n\n\t\t//Affichage de l'aide si demande\n\t\tif (Partie.touche == 'a') {\n\t\t\tString texteAide = new String();\n\t\t\tswitch(themeJeu) {\n\t\t\tcase 2 : texteAide = \"Le but du jeu est d'aider Link à trouver la sortie du donjon tout en récupérant le(s) coffre(s).\\n Link doit egalement recuperer la Master Sword qui permet de tuer le monstre bloquant le chemin.\\n\\nLink se déplace à l'aide des touches directionnelles.\\nUne solution peut-être affichée en appuyant sur la touche (s).\\nLa touche (r) permet de recommencer, (q) de quitter.\\n\\n Bon jeu !\"; break;\n\t\t\tcase 3 : texteAide = \"Le but du jeu est d'aider Samus à trouver la sortie du vaisseau tout en récupérant le(s) émeraude(s).\\nSamus doit egalement recuperer la bombe qui permet de tuer le metroid qui bloque l'accès à la sortie.\\n\\nSamus se déplace à l'aide des touches directionnelles.\\nUne solution peut-être affichée en appuyant sur la touche (s).\\nLa touche (r) permet de recommencer, (q) de quitter.\\n\\n Bon jeu !\"; break;\n\t\t\tcase 4 : texteAide = \"Le but du jeu est d'aider le pompier à trouver la sortie du batiment tout en sauvant le(s) rescapé(s).\\nLe pompier doit egalement recuperer l'extincteur qui permet d'éteindre le feu qui bloque l'accès à la sortie.\\n\\nLe pompier se déplace à l'aide des touches directionnelles.\\nUne solution peut-être affichée en appuyant sur la touche (s).\\nLa touche (r) permet de recommencer, (q) de quitter.\\n\\n Bon jeu !\"; break;\n\t\t\tcase 5 : texteAide = \"Le but du jeu est d'aider Mario à trouver le drapeau de sortie tout en ramassant le(s) pièce(s).\\nMario doit egalement recuperer l'étoile d'invincibilité qui permet de se débarasser du Goomba qui l'empêche de sortir.\\n\\nMario se déplace à l'aide des touches directionnelles.\\nUne solution peut-être affichée en appuyant sur la touche (s).\\nLa touche (r) permet de recommencer, (q) de quitter.\\n\\n Here we gooo !\"; break;\n\t\t\tdefault : texteAide = \"Le but du jeu est d'aider le mineur à trouver la sortie du labyrinthe tout en extrayant le(s) filon(s).\\nLe mineur doit egalement recuperer la clef qui permet l'ouverture de le porte qui bloque l'accès à la sortie.\\n\\nLe mineur se déplace à l'aide des touches directionnelles.\\nUne solution peut-être affichée en appuyant sur la touche (s).\\nLa touche (r) permet de recommencer, (q) de quitter.\\n\\n Bon jeu !\"; break;\n\t\t\t}\n\t\t\tSystem.out.println(\"\\n============================================ AIDE ========================================\\n\\n\" + texteAide + \"\\n\\n==========================================================================================\\n\");\n\t\t\tJOptionPane.showMessageDialog(null, texteAide, \"Aide\", JOptionPane.QUESTION_MESSAGE);\n\t\t\tPartie.touche = ' ';\n\t\t}\n\n\t\t//Affichage de les infos si demande\n\t\tif (Partie.touche == 'i') {\n\t\t\tSystem.out.println(\"\\n============================================ INFOS =======================================\\n\\nCe jeu a ete developpe par Francois ADAM et Benjamin Rancinangue\\ndans le cadre du projet IPIPIP 2015.\\n\\n==========================================================================================\\n\");\n\t\t\tPartie.touche = ' ';\n\t\t\tJOptionPane.showMessageDialog(null, \"Ce jeu a été développé par François Adam et Benjamin Rancinangue\\ndans le cadre du projet IPIPIP 2015.\", \"Infos\", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(\"/images/EMN.png\")));\n\t\t}\n\n\t\t//Nettoyage de l'ecran de console\n\t\tSystem.out.println(\"\\n==========================================================================================\\n\");\n\t}", "@Test\n public void test_distanceLinaireSurY_ParcourOptimum_Pour_4villes() {\n\n Pays pays = new Pays(4);\n\n int positionX = (int) (Math.random() * 50);\n\n pays.setPositionVille(0, new Point(positionX, 2));\n pays.setPositionVille(1, new Point(positionX, 3));\n pays.setPositionVille(2, new Point(positionX, 4));\n pays.setPositionVille(3, new Point(positionX, 5));\n\n brutForceV3.recherche(pays, 0);\n\n assertEquals(\"0>1>2>3>0\", brutForceV3.getParcours().getVillesEmprunté());\n assertEquals(brutForceV3.getParcours().getDistance(),\n parcoursVilles(pays, brutForceV3.getParcours().getVillesEmprunté(),\">\"));\n\n }", "int compteMonstres(Soldat unites[][]);", "public void coMina(){\n espM=true;\r\n }", "private static void muta(Cromosoma c)\n\t{\n\t}", "public void setMontantOp(double montantOp) {\n this.montantOp = montantOp;\n }", "@Test\n public void testVirement2() {\n\n //Arrange\n CompteBancaire cpt1 = new CompteBancaire(63000.0);\n CompteBancaire cpt2 = new CompteBancaire(43000.0);\n double montant_a_virer = 88000.0;\n double excepted_solde_cpt1 = 63000.0;\n double excepted_solde_cpt2 = 43000.0;\n\n //Act\n assertEquals(false, cpt1.virerArgent(cpt2, montant_a_virer));\n\n //Assert\n assertEquals(excepted_solde_cpt1, cpt1.getSolde(), 0);\n assertEquals(excepted_solde_cpt2, cpt2.getSolde(), 0);\n\n }", "@Override\n\tpublic void doit() {\n\t\tafficher_texte(UtilitaireChainesCommunes.demande_saisie_nombre);\n\t\tint i = saisie_entier();\n\t\tafficher_texte(UtilitaireChainesCommunes.demande_saisie_nombre);\n\t\tint j = saisie_entier();\n\t\t// tous deux strictements positifs ou strictement négatifs? \n\t\t// vrai => produit positif\n\t\t// faux => produit negatif ou nul\n\t\tboolean Truth = TrueIfSameTruthValue(i,j,this.estposit);\n if (Truth){afficher_texte(UtilitaireChainesCommunes.resultat_positif);}\n else{ \n \t// l un des deux est soit de signe différent soit nul.\n \t// on vire le cas \"est de signe différent\" (on aurait pu faire l autre)\n \tboolean Truth2 = ((i < 0 && j > 0) || (i > 0 && j < 0));\n \tif (Truth2){afficher_texte(UtilitaireChainesCommunes.resultat_negatif);}\n \telse {afficher_texte(UtilitaireChainesCommunes.nombre_nul);}\n }\n\n\t}", "@Test\n public void test_distanceLinaireSurX_distanceLinaireSurX_ParcourOptimum_Pour_4villes() {\n\n Pays pays = new Pays(4);\n\n int positionY = (int) (Math.random() * 50);\n\n pays.setPositionVille(0, new Point(2, positionY));\n pays.setPositionVille(1, new Point(3, positionY));\n pays.setPositionVille(2, new Point(4, positionY));\n pays.setPositionVille(3, new Point(5, positionY));\n\n brutForceV3.recherche(pays, 0);\n\n assertEquals(\"0>1>2>3>0\", brutForceV3.getParcours().getVillesEmprunté());\n assertEquals(brutForceV3.getParcours().getDistance(),\n parcoursVilles(pays, brutForceV3.getParcours().getVillesEmprunté(),\">\"));\n\n }", "@Override\n\tpublic int manufacturando(int unidades) {\n\t\treturn unidades*this.getTiempoEstimadoParaProducirse();\n\t}", "public void verserCompteEpargneVersCompteCourant(Client client, float mt) {\n\t\tif (client.getCompteCourant() == null) {\n\t\t\tSystem.out.println(\"Erreur : le client n a pas de compte courant !\");\n\t\t\tSystem.out.println(\"Ouvrir d abord un compte courant au client !\");\n\t\t} else {\n\t\t\tif (client.getCompteEpargne() == null) {\n\t\t\t\tSystem.out.println(\"Erreur : le client n a pas de compte epargne !\");\n\t\t\t\tSystem.out.println(\"Ouvrir d abord un compte epargne au client !\");\n\t\t\t} else {\n\t\t\t\tsoldeCompteCourantClient = client.getCompteCourant().getSolde();\n\t\t\t\tsoldeCompteEpargneClient = client.getCompteEpargne().getSolde();\n\t\t\t\tclient.getCompteEpargne().retirer(mt);\n\t\t\t\tif (soldeCompteEpargneClient == client.getCompteEpargne().getSolde()) {\n\t\t\t\t\tSystem.out.println(\"Erreur de versement du compte epargne vers le compte courant !\");\n\t\t\t\t} else {\n\t\t\t\t\tclient.getCompteCourant().verser(mt);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void payement(int montant, Scanner in, String cheminDossier) {\n\t\tString numeroCarte;\n\n\t\tif (montant > 0) {\n\t\t\tSystem.out.println(\"Vous devez : \" + montant + \" euros, merci de donner votre numero de carte\");\n\t\t} else if (montant < 0) {\n\t\t\tSystem.out.println(\n\t\t\t\t\t\"Nous vous remboursons : \" + montant * -1 + \" euros, merci de donner votre numero de carte\");\n\t\t}\n\n\t\tnumeroCarte = in.nextLine();\n\n\t\t// alimentation du fichier transaction\n\t\tif (montant > 0) {\n\t\t\ttransaction(LocalDate.now(), \"payement\", montant, numeroCarte, cheminDossier);\n\t\t} else if (montant < 0) {\n\t\t\ttransaction(LocalDate.now(), \"remboursement\", montant * -1, numeroCarte, cheminDossier);\n\t\t}\n\t}", "public static void miedo(){\n int aleatorio; //variables locales a utilizar\n Random numeroAleatorio = new Random(); //declarando variables tipo random para aleatoriedad\n aleatorio = (numeroAleatorio.nextInt(10-5+1)+5);\n \n if(oro>aleatorio){//condicion de finalizar battalla y sus acciones\n oroPerdido= (nivel*2)+aleatorio;\n oro= oro-oroPerdido;\n System.out.println(\"Huiste de la batalla!!!\");\n\t\t System.out.println(\"oro perdido:\"+oroPerdido);\n opcionMiedo=1; //finalizando battalla por huida del jugador \n }\n else{\n System.out.println(\"No pudes huir de la batalla\");\n } \n }", "public void aumentarMinas(){\n\r\n if(espM==false){\r\n minascerca++;\r\n }\r\n }", "public void distribuirAportes1(){\n\n if(null == comprobanteSeleccionado.getAporteuniversidad()){\n System.out.println(\"comprobanteSeleccionado.getAporteuniversidad() >> NULO\");\n }\n\n if(null == comprobanteSeleccionado.getAporteorganismo()){\n System.out.println(\"comprobanteSeleccionado.getAporteorganismo() >> NULO\");\n }\n\n if(null == comprobanteSeleccionado.getMontoaprobado()){\n System.out.println(\"comprobanteSeleccionado.getMontoaprobado() >> NULO\");\n }\n\n try{\n if(comprobanteSeleccionado.getAporteuniversidad().floatValue() > 0f){\n comprobanteSeleccionado.setAporteorganismo(comprobanteSeleccionado.getMontoaprobado().subtract(comprobanteSeleccionado.getAporteuniversidad()));\n comprobanteSeleccionado.setAportecomitente(BigDecimal.ZERO);\n }\n } catch(NullPointerException npe){\n System.out.println(\"Error de NullPointerException\");\n npe.printStackTrace();\n }\n\n }", "public Membre consulterCompte(String email,String motDePasse) {\n List<Membre> membre=new ArrayList<Membre>();\n membre=gerantMembre.ChercherMembreByEmailPass(email,motDePasse);\n\t\tif(membre==null) {throw new RuntimeException(\"membre non inscrit\");};\n\t\tSystem.out.println(\"la taille est\"+membre.size());\n\t\treturn membre.get(0);\n\t}", "private void facturer(UneCommande22<Integer> cde, TableArticle22 tabArt) { //Une commande\n\t\t\t\tif(cde.taille()==0){\n\t\t\t\t\tClientJava1DateUser.affiche(\"\\n\\t COMMANDE EST VIDE\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tClientJava1DateUser.affiche(cde.facturer(tabArt)); // Affiche ligne de commande\n\t\t\t\t}\t\n\t\t\t}", "private void calculerChemin() {\n suiteDeDeplacement.clear();\n int[][] empreinte = lab.getEmpreinte();\n lee(empreinte, x / Case.TAILLE, y / Case.TAILLE, cibleX, cibleY);\n }", "private void procedureBasePrDessin(){\n if(courante == null){\n reset();\n courante = new Tortue(simpleLogo.getFeuille(), true);\n simpleLogo.setBarreOutilsVisible(true);\n }\n }", "@Override\n public void compraProducto(String nombre, int cantidad) {\n\n }", "public static void jouerAuJustePrix() {\n\t\tint nbVies=Tools.inputInt(\"Combien de tentatives voulez-vous ? \");\n\t\tint limite=Tools.inputInt(\"Quel est le nombre maximum à prendre en compte?\");\n\t\tint nbATrouver=Tools.randomint(limite);\n\t\tint nbPropose;\n\t\t\n\t\twhile (nbVies>0){\n\t\t\tnbPropose=Tools.inputInt(\"Saisissez un nombre : \");\n\t\t\tif (afficherResultatProposition(nbPropose, nbATrouver)) {\n\t\t\t\tbreak;\n\t\t\t};\n\t\t\tnbVies=nbVies-1;\n\t\t}\n\t\t\n\t\tif (nbVies==0) {\n\t\t\tSystem.out.println(\"Game Over\");\n\t\t}\n\t}", "public ControladorCombate(int tipo_simulacion,\r\n Entrenador entrenador1, Entrenador entrenador2, ControladorPrincipal cp){\r\n this.esLider = false;\r\n this.controlador_principal = cp;\r\n this.tipo_simulacion = tipo_simulacion;\r\n this.combate = new Combate();\r\n this.equipo1 = entrenador1.getPokemones();\r\n this.equipo2 = entrenador2.getPokemones();\r\n this.entrenador1 = entrenador1;\r\n this.entrenador2 = entrenador2;\r\n this.vc = new VistaCombate();\r\n this.va = new VistaAtaque();\r\n this.ve = new VistaEquipo();\r\n this.creg = new ControladorRegistros();\r\n String[] nombres1 = new String[6];\r\n String[] nombres2 = new String[6];\r\n for (int i = 0; i < 6; i++) {\r\n nombres1[i]=equipo1[i].getPseudonimo();\r\n nombres2[i]=equipo2[i].getPseudonimo(); \r\n }\r\n this.vpc = new VistaPreviaCombate(tipo_simulacion, entrenador1.getNombre(), entrenador2.getNombre());\r\n this.vpc.agregarListener(this);\r\n this.vpc.setjC_Equipo1(nombres1);\r\n this.vpc.setjC_Equipo2(nombres2);\r\n this.vpc.setVisible(true);\r\n this.termino = false;\r\n resetearEntrenadores();\r\n }", "GenerateurDeCartesMot(String nomDuTheme, String[] Tableau){\n\t\tsuper(nomDuTheme);\n\t\tthis.nomDuTheme=nomDuTheme;\n\t\tthis.optionsDeMot=Tableau;\n\t\tinitializePickedCardsArray();\n\t}", "public static void aceleracion(int distancia) {\n\t\t\n\t\tDifferentialPilot pilot = new DifferentialPilot(9.5, 3, Motor.A, Motor.B, true); \n\t\tpilot.travel(distancia);\n\t}", "public Motocicleta(Persona chofer, int kilometrosRecorridos, Persona acompanante) { \r\n\t\tsuper(chofer, kilometrosRecorridos);\r\n\t\tthis.setAcompanante(acompanante);\r\n\t}", "private void AtulizaBanco(String cod, int matricula, double valor, int qte) {\n try {\n venda.Atualizar(cod, matricula, valor);\n Produto.ProdAtualizarQte(cod, qte);\n } catch (Exception ex) {\n Logger.getLogger(ViewCaixa.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public Perso designerCible(){\r\n\t\tRandom rand = new Random();\r\n\t\tint x = rand.nextInt((int)provocGlob);\r\n\t\tboolean trouve =false;\r\n\t\tdouble cpt=0;\r\n\t\tPerso res=groupe.get(0);\r\n\t\tfor(Perso pers : groupeAble){\r\n\t\t\tcpt+=pers.getProvoc();\r\n\t\t\tif(cpt>x && !trouve){\r\n\t\t\t\tres=pers;\r\n\t\t\t\ttrouve=true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn res;\r\n\t}", "public void parler() {\n\t System.out.println(this.formulerMonNom()); // appel d'une méthode de l'objet\n\t System.out.println(\"Je suis un animal et j'ai \" + this.nombreDePatte + \" pattes\");\n\t }", "Batiment choixBatiment(Partie partie, int nbDoublon, Plateau plateau);", "@Override\n public Proposition proposerUneCombinaison(IResultat resultat) {\n DemandeInfo demandeInfo = new DemandeInfo();\n return demandeInfo.demandecombinaisonMastermind();\n }", "public Transferencia(double monto, int plazo, int frecuencia) {\r\n\t\tsuper(monto);\r\n\t\tthis.plazo = plazo;\r\n\t\tthis.frecuencia = frecuencia;\r\n\t}", "public void carroPulando() {\n\t\tpulos++;\n\t\tpulo = (int) (PULO_MAXIMO/10);\n\t\tdistanciaCorrida += pulo;\n\t\tif (distanciaCorrida > distanciaTotalCorrida) {\n\t\t\tdistanciaCorrida = distanciaTotalCorrida;\n\t\t}\n\t}", "public void effetDeCarte(int idEffet, Joueur joueurQuiJoueLaCarte, Plateau plateau) {\n switch (idEffet) {\n case 0:\n joueurQuiJoueLaCarte.deck.piocher(1);\n break;\n case 1:\n joueurQuiJoueLaCarte.deck.piocher(2);\n break;\n case 2:\n joueurQuiJoueLaCarte.deck.piocher(3);\n break;\n case 3:\n joueurQuiJoueLaCarte.gagnerDegats(1);\n break;\n case 4:\n joueurQuiJoueLaCarte.gagnerDegats(2);\n break;\n case 5:\n joueurQuiJoueLaCarte.gagnerDegats(3);\n\n break;\n case 6:\n joueurQuiJoueLaCarte.gagnerDegats(4);\n break;\n case 7:\n joueurQuiJoueLaCarte.gagnerRunes(1);\n break;\n case 8:\n gagnerDesRunes(joueurQuiJoueLaCarte,2);\n break;\n case 9:\n gagnerDesRunes(joueurQuiJoueLaCarte,3);\n break;\n case 11:\n gagnerDesRunes(joueurQuiJoueLaCarte,1);\n gagnerDesDegats(joueurQuiJoueLaCarte,1);\n break;\n case 12:\n joueurQuiJoueLaCarte.gagnerPointsHonneur(1);\n break;\n case 14:\n joueurQuiJoueLaCarte.gagnerPointsHonneur(2);\n joueurQuiJoueLaCarte.piocher(1);\n break;\n case 15:\n joueurQuiJoueLaCarte.tuerUneCarteAvecDeLattaqueGratuitement(plateau);\n System.out.println(\"DEfeat a monster that has 4 D or less without paying it cost\");\n break;\n case 16:\n System.out.println(\"DEfeat a monster that has 6 D or less without paying it cost\");\n break;\n case 17:\n //joueurQuiJoueLaCarte.deck.piocher(1);\n System.out.println(\" You may banish a card in the center row\");\n break;\n case 18:\n System.out.println(\"Discard a card, if you do, draw two cards\");\n break;\n case 19:\n System.out.println(\"Copy l'effet d'un Héros joué ce tour-ci\");\n break;\n case 20:\n System.out.println(\"Once per turn you may draw a card\");\n break;\n case 21:\n System.out.println(\"You may banish this Construct to take an additional turn after this one.\");\n break;\n case 22:\n System.out.println(\"Acquire a Hero without paying its cost. Place in on top of your deck.\");\n break;\n case 23:\n joueurQuiJoueLaCarte.gagnerPointsHonneur(1);\n gagnerDesRunes(joueurQuiJoueLaCarte,1);\n break;\n case 24:\n gagnerDesRunes(joueurQuiJoueLaCarte,2);\n verifLifebound(joueurQuiJoueLaCarte);\n break;\n case 25:\n gagnerDesRunes(joueurQuiJoueLaCarte,1);\n joueurQuiJoueLaCarte.deck.piocher(1);\n break;\n case 26:\n System.out.println(\"Once per turn, gain 1 runes, the first time you play a lifebound hero, each turn gain 1 recompense\");\n break;\n case 27:\n System.out.println(\"Once per turn , gain 1d\" +\n \"Once per turn, you may spend 4r to gain 3 recompense\");\n break;\n case 28:\n gagnerDesDegats(joueurQuiJoueLaCarte,2);\n plusDeDeuxConstructeur(joueurQuiJoueLaCarte);\n System.out.println(\"Draw a card if you control 2 or moreConstrcut\");\n break;\n case 29:\n System.out.println(\"Gain 1d or 1r\");\n break;\n case 30:\n joueurQuiJoueLaCarte.gagnerPointsHonneur(2);\n System.out.println(\"Gain 2r You pay 1R less the next time you acquire a Construc this turn\");\n break;\n case 31:\n joueurQuiJoueLaCarte.gagnerPointsHonneur(2);\n System.out.println(\"Once per turn, when you put a Mechana Construc into play (including this one) , draw a card\");\n break;\n case 32:\n joueurQuiJoueLaCarte.gagnerPointsHonneur(2);\n System.out.println(\"Once per turn, gain 2d.You may spend it only to acquire Mechana Construct\");\n break;\n case 33:\n joueurQuiJoueLaCarte.gagnerPointsHonneur(2);\n System.out.println(\" Once per turn\");\n gagner1DParTourPourChaqueMechaConstruct(joueurQuiJoueLaCarte);\n\n break;\n case 34:\n System.out.println(\"You may treat all Construcs as Mechana Construcs\");\n break;\n case 35:\n System.out.println(\"Once per turn, when you acquire another Mechana Construc, you may put it directly into play\");\n break;\n case 36:\n System.out.println(\"Once per turn ,gain 1 r . you may spend it only to acquire Mechana Construc\");\n break;\n case 37:\n joueurQuiJoueLaCarte.deck.piocher(2);\n System.out.println(\"Banish a card in you hand\");\n break;\n case 38:\n gagnerDesDegats(joueurQuiJoueLaCarte,2);\n System.out.println(\"Banish a card in you hand or discard pile\");\n break;\n case 39:\n gagnerDesDegats(joueurQuiJoueLaCarte,1);\n System.out.println(\"Banish a card in you hand or discard pile\");\n break;\n case 40:\n System.out.println(\"Once per turn, gain 3d\");\n break;\n case 41:\n System.out.println(\"Once per turn, gain 1d\");\n break;\n case 42:\n System.out.println(\"Once per turn gain 1 The first time you deafeat a monster in the center row each turn, gain 1 R\");\n break;\n case 43:\n System.out.println(\"Unbanishable You may acquire or defeat any car in the center row without paying its cost\");\n break;\n case 44:\n System.out.println(\"Each opponent must destryo a Construc he controls\");\n break;\n case 45:\n System.out.println(\"Banish a card un the center row and/or in you discard pile\");\n break;\n case 46:\n System.out.println(\"Banish a card un the center row\");\n break;\n case 47:\n System.out.println(\"If an opponent has more than one construct, that player must destroy all but one Construct he controls\");\n break;\n case 48:\n System.out.println(\"Take a card at random from each oppenent's hand and add that card to your hands\");\n break;\n }\n\n }", "@Override\r\n\tprotected boolean puedeExtraer(double monto) {\n\t\treturn ((super.getSaldo() - monto) >= 0) ? true : false;\r\n\t}", "public void demarrerPartie(long idPartie) {\n Partie p = daocrud.findOne(idPartie);\r\n\r\n // Erreur si pas au moins 2 joueurs dans la partie\r\n if (jService.recupererNbJoueursParPartieId(idPartie) < 2) {\r\n throw new RuntimeException(\"Erreur : nb joueurs moins 2\");\r\n }\r\n\r\n // passe le joueur d'ordre 1 à etat a la main\r\n jService.passeJoueurOrdre1EtatALaMain(idPartie);\r\n\r\n // distribue 7 cartes d'ingrédients au hasard à chaque joueur de la partie\r\n for (Joueur j : p.getJoueurs()) {\r\n\r\n cService.distribue7CartesParJoueurIdEtPartieId(j.getId(), idPartie);\r\n }\r\n\r\n }", "public void primerTicketDisponibleEncontrado() {\n\t\tprimerTicketDisponible();\n\t\tint f; int c;\n\t\tString ticket = primerTicketDisponible();\n\t\tString[] dividir = ticket.split(\" \");\n\t\tString fila = dividir[0];\n\t\tString columna = dividir[1];\n\t\tSystem.out.println(fila);\n\t\tSystem.out.println(columna);\n\t\tf = Integer.parseInt(fila);\n\t\tc = Integer.parseInt(columna);\n\t\tactualizarPlazas(f, c);\n\t}", "public void executer()\r\n\t{\r\n\t\tswitch(this.type)\r\n\t\t{\r\n\t\tcase \"Gain\":\r\n\t\t\tPartie.getJoueurCourant().changeSolde(this.valeur);\r\n\t\t\tbreak;\r\n\t\tcase \"Perte\":\r\n\t\t\tPartie.getJoueurCourant().changeSolde(-this.valeur);\r\n\t\t\tbreak;\r\n\t\tcase \"Avancer\":\r\n\t\t\tPartie.getJoueurCourant().deplace(this.valeur);\r\n\t\t\tbreak;\r\n\t\tcase \"Aller en prison\":\r\n\t\t\tPartie.getJoueurCourant().setPosition(this.valeur);\r\n\t\t\tbreak;\r\n\t\tcase \"Sortie de prison\":\r\n\t\t\tPartie.getJoueurCourant().setEnPrison(false);\r\n\t\t\tbreak;\r\n\t\t}\t\r\n\t}", "public Agnello prelevaMontone() {\n\t\tfor (int i=0; i<pecore.size(); i++)\n\t\t\tif ((pecore.get(i) instanceof PecoraAdulta)\n\t\t\t\t\t&& (((PecoraAdulta) pecore.get(i)).isMaschio())) {\n\t\t\t\tnumMontoni--;\n\t\t\t\treturn pecore.remove(i);\n\t\t\t}\n\t\treturn null;\n\t}", "public void setMontantTotal(int montantTotal_) {\n\t\tmontantTotal = montantTotal_;\n\t}", "public void Caracteristicas(){\n System.out.println(\"La resbaladilla tiene las siguientes caracteristicas: \");\r\n if (escaleras==true) {\r\n System.out.println(\"Tiene escaleras\");\r\n }else System.out.println(\"No tiene escaleras\");\r\n System.out.println(\"Esta hecho de \"+material);\r\n System.out.println(\"Tiene una altura de \"+altura);\r\n }", "@When(\"je verifie le montant des frais de port et clique sur suivant\")\n\tpublic void je_verifie_le_montant_des_frais_de_port_et_clique_sur_suivant() {\n\t throw new PendingException();\n\t}", "public int choixAttaque(Caracter monstre, Caracter player){\n Inventory inventaire = monstre.getInventory();\n Weapon armeSecondaire = inventaire.getSecondWeapon();\n Weapon armePrincipale = inventaire.getMainWeapon();\n Spell conso = inventaire.getSpell();\n \n if (armeSecondaire == null)\n {\n return 1;\n }\n else if(armeSecondaire != null)\n {\n if(armePrincipale.dmin + armePrincipale.dmax > armeSecondaire.dmin + armeSecondaire.dmax){\n return 1;\n }\n else{\n return 2;\n }\n }\n \n return 1;\n }", "@Override\n\tpublic void manejoVida(int cantVida, int tipCambio) {\n\t\t\n\t}", "public boolean sucheMitspieler();", "void compareExposantDec(int exposant, String mantisse){\n \t\tif (exposant< -45) {\n \t\t\tthrow new InvalidFloatSmall(this, getInputStream());\n\n \t\t}\n\n \t\t// cas limite il faut comparer mantisse\n \t\tif(exposant== -45) {\n \t\t\tcompareMantisseminDec(mantisse);\n \t\t}\n \t\tif(exposant== 38) {\n \t\t\tcompareManthissemaxDec(mantisse); \n \t\t}\n \t\tif (exposant> 38) {\n \t\t\tthrow new InvalidFloatBig(this, getInputStream());\n \t\t}\n \t}", "public interface CaracteristiquesJoueurDeChamps{\n /**\n * This method is for a celebration when a goal is scored\n */\n \n void celebrer();\n \n /**\n * This method is for shoot on the goal\n * @return double, the stat of shoot\n */\n \n double tirer();\n \n /**\n * This method is for pass the ball\n * @return double, the stat of pass\n */\n \n double passer();\n \n /**\n * This method is for defend on the ball\n * @return double, the stat of defense\n */\n \n double defendre();\n \n /**\n * This method is for injury a player\n * @return double, the stat of injury\n */\n double seBlesser();\n \n /**\n * This method is for the mood of the player\n * @return double, the stat of agressivity\n */\n double agression();\n \n \n /**\n * This method is for run\n */\n void courir();\n \n \n double fatigue();\n \n \n }", "public void cambiarDificultad(){\r\n\t\tif (Menu.dificultad == \"facil\") {\r\n\t\t\tspeed = 10;\r\n\t\t\tspace = 350;\r\n\t\t}else if (Menu.dificultad == \"normal\") {\r\n\t\t\tspeed = 10;\r\n\t\t\tspace = 280;\r\n\t\t}else if (Menu.dificultad == \"dificil\") {\r\n\t\t\tspeed = 15 ;\r\n\t\t\tspace = 300;\r\n\t\t}else if (Menu.dificultad == \"Invertido\") {\r\n\t\t\tspeed = 10;\r\n\t\t\tspace = 280;\r\n\t\t}\r\n\t}", "public void simulerCreditConso(Client client, float emprunt, int nbMois) {\n\t\tSystem.out.println(\"Proposition de credit consommation : \");\n\t\tCredit creditconso = new Credit(emprunt, nbMois);\n\t\tcreditconso.CreditConso(emprunt, nbMois);\n\t\t\n\t\t\n\t}", "@Test\n public void testVerser2() {\n\n //Arrange\n CompteBancaire cpt = new CompteBancaire(6500.0);\n double montant_a_verser = -2000.0;\n double excepted = 6500.0;\n\n //Act\n assertEquals(false, cpt.verser(montant_a_verser));\n\n //Assert\n assertEquals(excepted, cpt.getSolde(), 0);\n\n }", "private static void verifPayement(){\n\t\tint x,y, dime;\n\t\tx=jeu.getAssam().getXPion()-1;\n\t\ty=jeu.getAssam().getYPion()-1;\n\t\tint caseInfoTapis = jeu.cases[x][y].getCouleurTapis();\n\t\tif(caseInfoTapis == tour || caseInfoTapis == 0){\n\t\t\treturn;\n\t\t}\n\t\telse{\n\t\t\tdime = jeu.payerDime(caseInfoTapis,x,y,0,new boolean[7][7]);\n\t\t\tJoueur payeur = jeu.getJoueurs()[tour-1];\n\t\t\tJoueur paye = jeu.getJoueurs()[caseInfoTapis-1];\n\t\t\tif(jeu.payerVraimentDime(payeur,paye,dime)){\n\t\t\t\tjoueurElimine++;\n\t\t\t}\n\t\t\tconsole.afficherPayeurPaye(payeur, paye, dime);\n\t\t}\n\t}", "public boolean editionElementFacture(Habitation hab){\r\n\t\t\r\n\t\tboolean res = false;\r\n\t\tdouble totalGeneralHT = 0;\r\n\t\tfinal double tva = 0.62;\r\n\t\t\r\n\t\tCalendar cal = null;\r\n\t\tcal = Calendar.getInstance();\r\n\t\t\r\n\t\tDate actuelle = new Date();\r\n\t\t\r\n\t\t//SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\r\n\t\t//String dat = dateFormat.format(actuelle);\r\n\t\t\r\n\t\tcal.setTime(actuelle);\r\n\t\t\r\n\t\tint year = cal.get(Calendar.YEAR);\r\n\t\t// extraction du mois mettre + 1 car d�marre � 0 et non pas 1\r\n\t\tint month = cal.get(Calendar.MONTH) + 1;\r\n\t\tint day = cal.get(Calendar.DAY_OF_MONTH);\r\n\t\t\r\n\t\tString mois=tabMois[month];\r\n\t\t\r\n\t\tSystem.out.println(\"**************\");\r\n\t\tSystem.out.println(\"Société Trisel\");\r\n\t\tSystem.out.println(\"**************\");\r\n\t\t\r\n\t\tSystem.out.println(\"Facture du mois de \"+mois);\r\n\t\tSystem.out.println(\"Editée le lundi \"+day+\" \"+mois+\" \"+year);\r\n\t\tSystem.out.println(\"\");\r\n\t\tSystem.out.println(hab.getUsager().getNomUsager()+\" \"+hab.getUsager().getPrenomUsager());\r\n\t\tSystem.out.println(hab.getAdresseRue());\r\n\t\tSystem.out.println(hab.getCp()+\" \"+hab.getAdresseVille());\r\n\t\tSystem.out.println(\"\");\r\n\t\tSystem.out.println(\"Code usager : \"+hab.getUsager().getIdUsager());\r\n\t\tSystem.out.println(\"Récapitulatif des pesées des poubelles au mois de : \"+mois);\r\n\t\t\r\n\t\tArrayList<Poubelle> lespoubelles = hab.getLesPoubelles();\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\tfor(Poubelle p : lespoubelles)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tdouble totalPoubelleHT = 0;\r\n\t\t\t\tSystem.out.println(\"\");\r\n\t\t\t\tSystem.out.println(\"Poubelle : \"+p.getIdPoubelle()+\" Nature des déchets : \"+p.getNature().getLibelle());\r\n\t\t\t\t\r\n\t\t\t\tArrayList<Levee> leslevees = p.getLesLevees(year,month);\r\n\t\t\t\t\r\n\t\t\t\tif(leslevees.size()==0)\r\n\t\t\t\t{\r\n\t\t\t\t\tSystem.out.println(\"Pas de levees pour cette poubelle\");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\telse{\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(Levee l : leslevees)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tSystem.out.println(\"\");\r\n\t\t\t\t\t\tSystem.out.println(\"Date de pesée : \"+l.getDate());\r\n\t\t\t\t\t\tSystem.out.println(\"Nombre de kg : \"+l.getPoids());\r\n\t\t\t\t\t\tSystem.out.println(\"Prix HT au kg : \"+p.getNature().getTarif());\r\n\t\t\t\t\t\tSystem.out.println(\"Total HT - levee \"+l.getIdLevee()+\" : \"+(p.getNature().getTarif())*(l.getPoids()));\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\ttotalPoubelleHT = p.getCout(year, month);\r\n\t\t\t\t\ttotalGeneralHT = totalPoubelleHT + totalPoubelleHT ;\r\n\t\t\t\t\t\r\n\t\t\t\t\tSystem.out.println(\"Total HT - poubelle \"+p.getIdPoubelle()+\" : \"+totalPoubelleHT);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tSystem.out.println(\"------------------\");\r\n\t\t\tSystem.out.println(\"Total général HT : \"+totalGeneralHT);\r\n\t\t\tSystem.out.println(\"Montant TVA : \"+tva);\r\n\t\t\tSystem.out.println(\"Montant Total : \"+(totalGeneralHT+tva)+\" \"+hab.getCout(year, month));\r\n\t\t\tSystem.out.println(\"------------------\");\r\n\t\t\tSystem.out.println(\"\");\r\n\t\t\t\r\n\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\treturn res;\r\n\t\r\n\t}", "@Override\n public void llenardeposito(){\n this.setCombustible(getTankfuel());\n }", "void evoluer()\n {\n int taille = grille.length;\n int nbVivantes = 0;\n for(int i=-1; i<2; i++)\n {\n int xx = ((x+i)+taille)%taille; // si x+i=-1, xx=taille-1. si x+i=taille, xx=0\n for(int j=-1; j<2; j++)\n {\n if (i==0 && j==0) continue;\n int yy = ((y+j)+taille)%taille;\n if (grille[xx][yy].vivante) nbVivantes++;\n }\n }\n if (nbVivantes<=1 || nbVivantes>=4) {vientDeChanger = (vivante==true); vivante = false;}\n if (nbVivantes==3) {vientDeChanger = (vivante==false); vivante = true;}\n }", "public void deplacerAgent(Agent a, Cell c)\n { \n // MAJ de la grille\n this.grille[a.x][a.y] = \"0\";\n this.grille[c.row][c.col] = \"1\";\n \n // MAJ de l'agent\n a.x = c.row;\n a.y = c.col;\n }", "public static void main(String[] args)\n\t{\n\t\tPoint point_test = new Point(2,2);\n\t\tdouble niveauContamination_test = 0;\n\t\tString fonction_test = \"Citoyens\";\n\t\tint joursMalades_test = 0;\n\t\tdouble probaTransmettre_test = 0;\n\t\tboolean etatMortalite_test = false;\n\t\tdouble risqueMortalite_test = 0;\n\t\tdouble risqueMaladie_test = 0;\n\t\tint joursGueris_test = 0;\n\t\tboolean etatMaladie_test = false;\n\t\tboolean existence_test = false;\n\t\tCitoyen c1 = new Medecin(\"FAN\",point_test,niveauContamination_test,risqueMaladie_test,probaTransmettre_test,risqueMortalite_test);\n\t\tCitoyen c2 = new Medecin(\"JIANG\",point_test,niveauContamination_test,risqueMaladie_test,probaTransmettre_test,risqueMortalite_test,\"Medecin\",true,10);\n\t\tPoint coord = new Point(2,2);\n\t\tcoord = c1.getCoordonnees();\n\t\tSystem.out.println(\"x = \"+coord.getLigne()+\": y = \"+coord.getColonne());\n\t\t\n\t\tpoint_test.setCoordonnees(8,8);\n\t\tc2.setCoordonnees(point_test);\n\t\tcoord = c2.getCoordonnees();\n\t\tSystem.out.println(\"x = \"+coord.getLigne()+\": y = \"+coord.getColonne());\n\t\tif(c2.getExistence())\tSystem.out.println(\"L'existence = true.\");\n\t\telse\tSystem.out.println(\"L'existence = false.\");\n\t\t\n\t\tSystem.out.println(\"INFORMATIONS\");\n\t\tSystem.out.println(c2.toString());\n\t}", "public void acionarInadimplencia(CestaGarantiasDO cesta);" ]
[ "0.67094964", "0.66778696", "0.6321536", "0.62640405", "0.61379594", "0.6109003", "0.6068976", "0.6010698", "0.5957064", "0.59056324", "0.59019333", "0.5890511", "0.5858637", "0.5838498", "0.5835983", "0.5787519", "0.57865816", "0.5779444", "0.57257205", "0.57129055", "0.5708467", "0.568127", "0.5638106", "0.5634196", "0.5623508", "0.5619226", "0.55891454", "0.5586427", "0.5572777", "0.55648905", "0.55624217", "0.5562241", "0.55620784", "0.5552866", "0.55452305", "0.55446404", "0.5542579", "0.55388", "0.5538292", "0.5523272", "0.5522868", "0.55206394", "0.5513863", "0.55123925", "0.550813", "0.5491929", "0.5482049", "0.54800916", "0.5478056", "0.5475162", "0.5470274", "0.5468705", "0.5464686", "0.5452547", "0.544585", "0.5444838", "0.5433944", "0.5426821", "0.5422275", "0.5419646", "0.5419375", "0.54177684", "0.5410929", "0.54093796", "0.540308", "0.5398539", "0.53946656", "0.5393302", "0.5393", "0.5392813", "0.539219", "0.538392", "0.53828156", "0.5382603", "0.53804946", "0.5380253", "0.53786594", "0.53783816", "0.5372056", "0.5370867", "0.5366319", "0.53602695", "0.53561306", "0.53520393", "0.53498626", "0.5341726", "0.53409195", "0.5338625", "0.5338016", "0.53341323", "0.5325988", "0.53257716", "0.5318483", "0.53171015", "0.53161156", "0.53103286", "0.5308708", "0.5307491", "0.53050935", "0.52982813", "0.5295689" ]
0.0
-1
TODO Autogenerated method stub
public void display() { applet.image(applet.loadImage("/keypad.png"), 22,410); // TODO Auto-generated method stub }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
don't allow construction of an instance Get the operational step for given binary operator.
public static EvaluationStep getBinaryOperation(final String theOperator) { if("+".equals(theOperator)) return Addition; if("-".equals(theOperator)) return Subtraction; if("*".equals(theOperator)) return Mulitplication; if("/".equals(theOperator)) return Division; if("^".equals(theOperator)) return Exponentiation; throw new IllegalStateException("Invalid binary operator ($operator).".replace("$operator", (null != theOperator) ? theOperator : "null")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public com.hps.july.persistence.OperatorAccessBean getOperator() throws java.rmi.RemoteException, javax.ejb.FinderException, javax.naming.NamingException {\n instantiateEJB();\n com.hps.july.persistence.Operator localEJBRef = ejbRef().getOperator();\n if ( localEJBRef != null )\n return new com.hps.july.persistence.OperatorAccessBean(localEJBRef);\n else\n return null;\n }", "public Object getOperatorInstance() {\n return operatorInstance;\n }", "Operator.Type getOperation();", "public static EvaluationStep getUnaryOperation(final String theOperator)\n {\n if(\"+\".equals(theOperator)) return NoOp;\n if(\"-\".equals(theOperator)) return Negation;\n throw new IllegalStateException(\"Invalid unary operator ($operator).\".replace(\"$operator\", (null != theOperator) ? theOperator : \"null\"));\n }", "Object findOperatorNeedCheck();", "Operation getOperation();", "Operation createOperation();", "Operation createOperation();", "public Command createOperationCommand(int operator, Operand operand1, Operand operand2);", "public java.lang.Integer getOperator() throws java.rmi.RemoteException;", "public java.lang.Integer getOperator() throws java.rmi.RemoteException, javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException {\n return (((java.lang.Integer) __getCache(\"operator\")));\n }", "public void setOperator(String operator) {\n this.operator = operator;\n }", "private OperatorManager() {}", "public Operator getOperator() {\n return this.operator;\n }", "public ChainOperator(){\n\n }", "Unary operator(Operator o);", "public Operation getOperation();", "public static Operator takeOperator(Actor self, Prop prop) {\n\n\t\t// Set conditions that must be true\n\t\tArrayList<ICondition> beTrue = new ArrayList<ICondition>();\n\t\tbeTrue.add(new LivesCondition(self));\n\t\tbeTrue.add(new SamePlaceCondition(self, prop));\n\n\t\t// Set conditions that must be false\n\t\tArrayList<ICondition> beFalse = new ArrayList<ICondition>();\n\n\t\t// Set conditions that will be set true\n\t\tArrayList<ICondition> setTrue = new ArrayList<ICondition>();\n\t\tsetTrue.add(new BelongsToCondition(prop, self));\n\n\t\t// Set conditions that will be set false\n\t\tArrayList<ICondition> setFalse = new ArrayList<ICondition>();\n\t\t\n\t\t// Add the corresponding action to the operator\n\t\tAction action = new Action(Action.ActionType.TAKE, self, prop);\n\t\t\n\t\t// The weight for taking actions\n\t\tint weight = 5;\n\n\t\treturn new Operator(beTrue, beFalse, setTrue, setFalse, action, weight);\n\t}", "String getOperator();", "com.google.protobuf.ByteString getOperatorBytes();", "Operator operator();", "public static BinaryOperation Create(IConstraintExpression operand1,\n\t\t\tIConstraintExpression operand2, BinaryOperator operator) {\n\t\tif (BoolBinaryOperators.contains(operator)) {\n\t\t\treturn new BinaryBoolOperation(operand1, operand2, operator);\n\t\t} else {\n\t\t\treturn new BinaryNumericOperation(operand1, operand2, operator);\n\t\t}\n\t}", "public Operator operator() {\n\treturn this.op;\n }", "abstract String getOp();", "OperationCallExp createOperationCallExp();", "private OperatorStateBackend createOperatorStateBackend() throws Exception {\n\t\treturn getStateBackend().createOperatorStateBackend(\n\t\t\tnew DummyEnvironment(), \"test_op\", Collections.emptyList(), new CloseableRegistry());\n\t}", "public Operator getOperator()\n {\n return operator;\n }", "@GetMapping(path = \"/{operatorId}\", produces = \"application/hal+json\")\n @ApiOperation(value = \"Retrieves an existing operator entity identified by its id if it's available for the requesting entity.\", produces = \"application/hal+json\")\n @ApiResponses({@ApiResponse(code = 200, message = \"Success!\"),\n @ApiResponse(code = 401, message = \"Not authorized to access the operator!\"),\n @ApiResponse(code = 404, message = \"OPerator or requesting user not found!\")})\n public ResponseEntity<EntityModel<Operator>> one(\n @RequestHeader(\"X-MBP-Access-Request\") String accessRequestHeader,\n @PathVariable(\"operatorId\") String operatorId,\n @ApiParam(value = \"Page parameters\", required = true) Pageable pageable) throws EntityNotFoundException, MissingPermissionException {\n Operator operator = userEntityService.getForIdWithAccessControlCheck(operatorRepository, operatorId, ACAccessType.READ, ACAccessRequest.valueOf(accessRequestHeader));\n return ResponseEntity.ok(userEntityService.entityToEntityModel(operator));\n }", "public com.hps.july.persistence.OperatorKey getOperatorKey() throws java.rmi.RemoteException, javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException {\n return (((com.hps.july.persistence.OperatorKey) __getCache(\"operatorKey\")));\n }", "public Binary operator(Operator op) {\n\tBinary_c n = (Binary_c) copy();\n\tn.op = op;\n\treturn n;\n }", "InOper createInOper();", "private DoubleBinaryOperator chooseOperator() {\n\t\tswitch(name) {\n\t\tcase \"+\":\n\t\t\treturn ADD;\n\t\t\t\n\t\tcase \"-\":\n\t\t\treturn SUB;\n\t\t\t\n\t\tcase \"*\":\n\t\t\treturn MULTIPLY;\n\t\t\t\n\t\tcase \"/\":\n\t\t\treturn DIVIDE;\n\t\t\t\n\t\tcase \"x^n\":\n\t\t\treturn POW;\n\t\t\t\n\t\tdefault:\n\t\t\tthrow new IllegalStateException(\"Invalid binary operator\");\n\t\t}\n\t}", "Nop createNop();", "public V1Toleration withOperator(String operator) {\n this.operator = operator;\n return this;\n }", "public String getOperator() {\n return operator;\n }", "String getOp();", "String getOp();", "String getOp();", "public Operation createOperation(String symbol) throws InstantiationException, IllegalAccessException {\n checkForNull(symbol);\n\n if (map.containsKey(symbol)) {\n return (Operation) map.get(symbol).newInstance();\n } else {\n return null;\n }\n }", "private void addOp(Class op){\n try {\n //Create a new instance and add it to the list\n Operation operation = (Operation)op.newInstance();\n operations.put(operation.getTextualRepresentation(), operation);\n } catch (InstantiationException | IllegalAccessException ex) {\n Logger.getLogger(RPC.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public final Operator operator() {\n return operator;\n }", "public User getOperator () {\n\t\treturn operator;\n\t}", "public Calculator() {\r\n\t\tthis.operator = new Addition();\r\n\t}", "java.lang.String getOperator();", "public String getOperator()\r\n {\r\n return operator;\r\n }", "@Override\n\tpublic Operation createOperate() {\n\t\treturn new OperationDiv();\n\t}", "public int calculateUsingFactory(int a ,int b ,String operator) {\n\t\tOperation targetOperation = OperatorFactory.getOperationNull(operator);\n\t\tif(targetOperation instanceof Addition) {\n\t\t\tSystem.out.println(\"Addiction Object\");\n\t\t}else if(targetOperation instanceof Subtraction) {\n\t\t\tSystem.out.println(\"Subtraction Object\");\n\t\t}\n\t\treturn targetOperation.apply(a, b);\n\t}", "public OperatorEnum getOperator() {\n return operator;\n }", "public void setOperator (User operator) {\n\t\tthis.operator = operator;\n\t}", "static BinaryOperator<SibillaValue> getOperator(String op) {\n if (op.equals(\"+\")) {return SibillaValue::sum;}\n if (op.equals(\"-\")) {return SibillaValue::sub; }\n if (op.equals(\"%\")) {return SibillaValue::mod; }\n if (op.equals(\"*\")) {return SibillaValue::mul; }\n if (op.equals(\"/\")) {return SibillaValue::div; }\n if (op.equals(\"//\")) {return SibillaValue::zeroDiv; }\n return (x,y) -> SibillaValue.ERROR_VALUE;\n }", "void visitOperatorImpl(OperatorImpl operator);", "public void addOperator(Operator operator){\n _operators.add(operator);\n }", "public Operator getOp() {\n return op;\n }", "public Operation() {\n super();\n }", "public static ObjectInstance getAddOperationObjectInstance()\n {\n ObjectName o = null;\n try\n {\n Hashtable<String, String> properties = new Hashtable<String, String>(\n 4);\n properties.put(\"name\", StringMangler\n .EncodeForJmx(getAddOperationMBean().getName()));\n properties.put(\"jmxType\", new Operation().getJmxType());\n o = new ObjectName(_domain, properties);\n\n }\n catch (Exception e)\n {\n Assert.fail(\"'Add' Operation ObjectInstance could not be created. \"\n + e.getMessage());\n }\n return new ObjectInstance(o, new Operation().getClass().getName());\n }", "public void setOperator(String incomingOperator)\r\n {\r\n \r\n operator = incomingOperator;\r\n \r\n }", "public Operation() {\n /* empty */\n }", "private Operator findOperatorToResolve(Predicate predToResolve) throws Exception {\n\t\tfor (Operator op : this.operators) {\n\t\t\tOperator opCopy = op.getClass().newInstance();\n\t\t\tfor (Predicate predCandidate : opCopy.getAdd().toList()) {\n\t\t\t\tif (predCandidate.isCompatibleTo(predToResolve)) {\n\t\t\t\t\t// instantiate opCopy with predToResolve\n\t\t\t\t\tfor (int i = 0; i < predToResolve.getValence(); i++) {\n\t\t\t\t\t\tif (!predCandidate.getArgument(i).isInstantiated()) {\n\t\t\t\t\t\t\tpredCandidate.getArgument(i).instantiate(predToResolve.getArgument(i).getValue());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn opCopy;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tthrow new RuntimeException(\"There was no operator found to resolve a predicate. There is no possible plan.\");\n\t}", "String getOperation();", "String getOperation();", "public interface Operator {\n\n Map<String, Operator> oprators = Factory.instance();\n\n /**\n * calculate first operator second such as 1 + 2\n * @param first\n * @param second\n * @return\n */\n @NotNull\n BigDecimal calculate(@NotNull BigDecimal first, @NotNull BigDecimal second);\n\n int priority();\n\n\n\n class Factory {\n public static Map<String, Operator> instance() {\n Map<String, Operator> instance = new HashMap();\n\n instance.put(\"+\", new AddOperator());\n instance.put(\"-\", new SubOperator());\n instance.put(\"*\", new MultiOperator());\n instance.put(\"/\", new DiviOperator());\n\n return instance;\n }\n }\n\n}", "IOperationable create(String operationType);", "@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = \"application/hal+json\")\n @ApiOperation(value = \"Retrieves an existing operator entity identified by its id if it's available for the requesting entity.\", produces = \"application/hal+json\")\n @ApiResponses({@ApiResponse(code = 200, message = \"Success!\"),\n @ApiResponse(code = 409, message = \"Operator already exists!\")})\n public ResponseEntity<EntityModel<Operator>> create(\n @RequestHeader(\"X-MBP-Access-Request\") String accessRequestHeader,\n @ApiParam(value = \"Page parameters\", required = true) Pageable pageable,\n @RequestBody OperatorRequestDTO requestDTO) throws EntityAlreadyExistsException, EntityNotFoundException {\n Operator operator = (Operator) new Operator()\n .setName(requestDTO.getName())\n .setDataModel(requestDTO.getDataModelId() == null ? null : userEntityService.getForId(dataModelRepository, requestDTO.getDataModelId()))\n .setDescription(requestDTO.getDescription())\n .setParameters(requestDTO.getParameters())\n .setRoutines(requestDTO.getRoutines())\n .setUnit(requestDTO.getUnit())\n .setAccessControlPolicyIds(requestDTO.getAccessControlPolicyIds());\n\n //Replace bad line breaks of plain text operator files\n operator.replaceLineBreaks();\n\n // Save operator in the database\n Operator createdOperator = userEntityService.create(operatorRepository, operator);\n return ResponseEntity.ok(userEntityService.entityToEntityModel(createdOperator));\n }", "public boolean isOperator(){\n return true;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public Operation(){\n\t}", "public interface Operator {\n /**\n * String literal to enter operator\n * @return\n */\n String getKey();\n\n void execute(EvaluatedParameters evaluatedParameters) throws ProcessorException;\n}", "BOperation createBOperation();", "public void setOperator(com.hps.july.persistence.Operator arg0) throws java.rmi.RemoteException, javax.ejb.FinderException, javax.naming.NamingException {\n\n instantiateEJB();\n ejbRef().setOperator(arg0);\n }", "public void setOp(Operator op) {\n this.op = op;\n }", "public final SymbolNode getOperator() { return this.operator; }", "public String operator( String op);", "public UnknownOperatorException(){\n\t\tsuper(\"UnknownOperatorException\");\n\t}", "public Long getOperator() {\n return operator;\n }", "public String getOperation();", "org.jetbrains.kotlin.backend.common.serialization.proto.IrOperation getOperation();", "public void setOperator(Long operator) {\n this.operator = operator;\n }", "public java.lang.Integer getOperator() {\n\treturn operator;\n}", "public Operation() {\n\t}", "boolean hasOperator();", "public Automato aplicaOperacao(Automato a, Automato b, Character op){\n\t\tAutomato r = new Automato();\n\t\tswitch (op) {\n\t\tcase '*': r = Operacao.estrela(a);\n\t\t\t\t break;\n\n\t\tcase '.': r = Operacao.concatencao(a, b);\n\t\t \t\t break;\n\t\tcase '+': r = Operacao.uniao(a, b);\n\t\t break;\n\t\tdefault: r = simples(op);\n\t\t\tbreak;\n\t\t}\n\t\treturn r;\n\t}", "@Override\r\n\tpublic void execute() {\r\n\t\tCreateOperatorWizard wizard = new CreateOperatorWizard(\r\n\t\t\t\t\"TypeOfOperator\");\r\n\t\tWizardDialog dialog = new WizardDialog(shell, wizard);\r\n\t\tdialog.create();\r\n\t\tdialog.getShell().setSize(280, 325);\r\n\r\n\t\tdialog.setTitle(\"Set Operator Wizard\");\r\n\t\tif (dialog.open() == WizardDialog.OK) {\r\n\t\t\ttype = wizard.getType();\r\n\t\t\tnum = wizard.getNum();\r\n\t\t}\r\n\t\toperator.setType(type);\r\n\t\tif(!num.equals(\"\")){\r\n\t\t\toperator.setNum(Integer.parseInt(num));\r\n\t\t}\r\n\t\tparent.addChild(operator);\r\n\t\toperator.setLocation(bounds.getLocation());//这一行以及下一行代码解决了,operator创建的point的问题\r\n\t\toperator.setSize(bounds.getSize());\r\n\t}", "public static LogicalOperator getLogicalOperator(String operator) {\r\n LogicalOperator logicalOperator = LogicalOperator.And;\r\n if (ClientConstants.OPERATOR_OR.equals(operator)) {\r\n logicalOperator = LogicalOperator.Or;\r\n }\r\n\r\n return logicalOperator;\r\n }", "public void setOperator(int opr) {\n this.operator = opr;\n }", "public abstract OperatorImpl getParent();", "OperationalizingSoftgoal createOperationalizingSoftgoal();", "Operand createOperand();", "private static OperatorBuilder binary(String symbol, DoubleBinaryOperator binaryOp, Type type) {\n if (binaryOp == null) {\n throw new IllegalArgumentException(\"operator argument must not be null\");\n }\n if (type.arity() != 2) {\n throw new IllegalArgumentException(\"type argument must be INFIXL, INFIXN, or INFIXR\");\n }\n // XXX ensure valid symbol\n return new OperatorBuilder(null, binaryOp, symbol, 10, type);\n }", "private static OperatorBuilder unary(String symbol, DoubleUnaryOperator unaryOp, Type type) {\n if (unaryOp == null) {\n throw new IllegalArgumentException(\"operator argument must not be null\");\n }\n if (type.arity() != 1) {\n throw new IllegalArgumentException(\"type argument must be PREFIX or POSTFIX\");\n }\n // XXX ensure valid symbol\n return new OperatorBuilder(unaryOp, null, symbol, 90, type);\n }", "private Operator checkOperator(char c){\n if (c == '+'){\n return new AddOperator(); \n }\n else if (c == '-'){\n return new SubOperator(); \n }\n else if (c == '*'){\n return new MulOperator(); \n }\n else if (c == '/'){\n return new DivOperator(); \n }\n else \n return null;\n }", "public JButton makeOperatorButton(String op)\r\n {\r\n JButton button = new JButton(op); \r\n ActionListener listener = new OperatorButtonListener(op);\r\n button.addActionListener(listener); \r\n return button; \r\n }", "public String operator() {\n return this.operator;\n }", "public void setOperation(String op) {this.operation = op;}", "protected Container2OperationEvaluator(Container2Operation op) {\r\n this.op = op;\r\n }", "OpList createOpList();" ]
[ "0.6501083", "0.62320817", "0.6199239", "0.6180463", "0.6129221", "0.6023977", "0.5934199", "0.5934199", "0.59292865", "0.59103125", "0.58646137", "0.58610207", "0.5855632", "0.5830829", "0.5829585", "0.580401", "0.5765868", "0.57658654", "0.5756521", "0.57391196", "0.5726003", "0.5719156", "0.5708108", "0.56921047", "0.5682139", "0.56607085", "0.56476164", "0.56373876", "0.56368077", "0.5607705", "0.558097", "0.5543436", "0.5540553", "0.55346584", "0.55326086", "0.5530617", "0.5530617", "0.5530617", "0.55301154", "0.5529992", "0.5526675", "0.5512479", "0.55033875", "0.5495944", "0.54957604", "0.54876465", "0.5487226", "0.54866177", "0.54836595", "0.5476306", "0.5466828", "0.5460007", "0.5459047", "0.54423463", "0.5439684", "0.54388845", "0.5409558", "0.5400801", "0.5387803", "0.5387803", "0.5383673", "0.5377285", "0.5376488", "0.53656226", "0.5361072", "0.5361072", "0.5361072", "0.5361072", "0.5361072", "0.5361072", "0.53473604", "0.5344805", "0.5344247", "0.5340107", "0.53400445", "0.5330179", "0.53171927", "0.5314034", "0.53100014", "0.53078306", "0.53076345", "0.53029996", "0.5283881", "0.52808106", "0.52796936", "0.5267266", "0.52663743", "0.5258767", "0.5256052", "0.52433044", "0.52349544", "0.5234548", "0.5232558", "0.5215504", "0.52103823", "0.51926917", "0.51861686", "0.5180744", "0.51794946", "0.5179362" ]
0.6493145
1
Get the operational step for a given unary operator.
public static EvaluationStep getUnaryOperation(final String theOperator) { if("+".equals(theOperator)) return NoOp; if("-".equals(theOperator)) return Negation; throw new IllegalStateException("Invalid unary operator ($operator).".replace("$operator", (null != theOperator) ? theOperator : "null")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Unary operator(Operator o);", "private Expr unary() {\n if(match(BANG, MINUS)) { // If this thing can be accurately considered a unary...\n Token operator = previous();\n Expr right = unary();\n return new Expr.Unary(operator, right);\n }\n\n return call(); // Otherwise, pass it up the chain of precedence\n }", "Operator.Type getOperation();", "public static EvaluationStep getBinaryOperation(final String theOperator)\n {\n if(\"+\".equals(theOperator)) return Addition;\n if(\"-\".equals(theOperator)) return Subtraction;\n if(\"*\".equals(theOperator)) return Mulitplication;\n if(\"/\".equals(theOperator)) return Division;\n if(\"^\".equals(theOperator)) return Exponentiation;\n throw new IllegalStateException(\"Invalid binary operator ($operator).\".replace(\"$operator\", (null != theOperator) ? theOperator : \"null\"));\n }", "public java.lang.Integer getOperator() throws java.rmi.RemoteException;", "String getOperator();", "public final SymbolNode getOperator() { return this.operator; }", "static BinaryOperator<SibillaValue> getOperator(String op) {\n if (op.equals(\"+\")) {return SibillaValue::sum;}\n if (op.equals(\"-\")) {return SibillaValue::sub; }\n if (op.equals(\"%\")) {return SibillaValue::mod; }\n if (op.equals(\"*\")) {return SibillaValue::mul; }\n if (op.equals(\"/\")) {return SibillaValue::div; }\n if (op.equals(\"//\")) {return SibillaValue::zeroDiv; }\n return (x,y) -> SibillaValue.ERROR_VALUE;\n }", "public String getOperator()\r\n\t{\r\n\t\tSystem.out.println(\"Choose the any operation from the following operations:\");\r\n System.out.println(\"1.+\");\r\n System.out.println(\"2.-\");\r\n System.out.println(\"3.*\");\r\n System.out.println(\"4./\");\r\n \r\n\t\tString op=sc.next();\r\n\t\treturn op;\r\n\t}", "java.lang.String getOperator();", "public java.lang.Integer getOperator() throws java.rmi.RemoteException, javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException {\n return (((java.lang.Integer) __getCache(\"operator\")));\n }", "public Operator getOperator() {\n return this.operator;\n }", "public final String unary_operator(int tab) throws RecognitionException {\n String value = null;\n\n\n\n \tvalue = null;\n\n try {\n // src\\\\calculator.g:524:2: ( '++' | '--' )\n int alt30=2;\n int LA30_0 = input.LA(1);\n\n if ( (LA30_0==22) ) {\n alt30=1;\n }\n else if ( (LA30_0==26) ) {\n alt30=2;\n }\n else {\n NoViableAltException nvae =\n new NoViableAltException(\"\", 30, 0, input);\n\n throw nvae;\n\n }\n switch (alt30) {\n case 1 :\n // src\\\\calculator.g:524:4: '++'\n {\n match(input,22,FOLLOW_22_in_unary_operator2031); \n\n value = \"++\";\n\n }\n break;\n case 2 :\n // src\\\\calculator.g:526:4: '--'\n {\n match(input,26,FOLLOW_26_in_unary_operator2040); \n\n value = \"--\";\n\n }\n break;\n\n }\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n\n finally {\n \t// do for sure before leaving\n }\n return value;\n }", "public java.lang.Integer getOperator() {\n\treturn operator;\n}", "public String operator( String op);", "public static IntermediateOpcode getOpcode(String operator) {\n if(StringUtils.isBlank(operator)) {\n return null;\n }\n for(IntermediateOpcode opcode : IntermediateOpcode.class.getEnumConstants()) {\n if(opcode.operator.equals(operator)) {\n return opcode;\n }\n }\n return null;\n }", "public int getPrecedence(char operator) {\n switch (operator) {\n case '+':\n case '-':\n return 1;\n case '*':\n case '/':\n return 2;\n case '^':\n return 3;\n }\n\n return -1;\n }", "Expression unaryExpression() throws SyntaxException {\r\n\t\tToken first = t;\r\n\t\tif (isKind(OP_PLUS)) { //throw away the plus here\r\n\t\t\tToken op = consume();\r\n\t\t\tExpression e = unaryExpression();\r\n\t\t\treturn new ExpressionUnary(first, op, e);\r\n\t\t}\r\n\t\telse if (isKind(OP_MINUS)){\r\n\t\t\tToken op = consume();\r\n\t\t\tExpression e = unaryExpression();\r\n\t\t\treturn new ExpressionUnary(first, op, e);\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn unaryExpressionNotPlusMinus();\r\n\t\t}\r\n\t}", "public String getOperator() {\n return operator;\n }", "public String operator() {\n return this.operator;\n }", "public final Operator operator() {\n return operator;\n }", "public String getOperator()\r\n {\r\n return operator;\r\n }", "private static char getOperator() throws ParseError {\n TextIO.skipBlanks(); // Skip past any blanks in the input.\n\n char op = TextIO.peek();\n\n if ( op == '+' || op == '-' || op == '*' || op == '/' )\n TextIO.getAnyChar(); // Read the operator.\n else\n throw new ParseError( \"Found \" + op + \" instead of an operator.\" );\n\n return op;\n\n }", "public static Object compute(OpUnary op, Object value) {\n\t\tswitch (op) {\n\t\tcase BITNOT:\n\t\t\treturn ValueUtil.not(value);\n\t\tcase LOGIC_NOT:\n\t\t\treturn ValueUtil.logicNot(value);\n\t\tcase MINUS:\n\t\t\treturn ValueUtil.negate(value);\n\t\tcase NUM_ELTS:\n\t\t\treturn ValueUtil.length(value);\n\t\tdefault:\n\t\t\treturn null;\n\t\t}\n\t}", "public Operator operator() {\n\treturn this.op;\n }", "public OperatorEnum getOperator() {\n return operator;\n }", "public PredicateOperator getOperator();", "public User getOperator () {\n\t\treturn operator;\n\t}", "String getOp();", "String getOp();", "String getOp();", "public Operator getOp() {\n return op;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public String getOperator() {\n return operator;\n }", "public Long getOperator() {\n return operator;\n }", "private static int getPrecedence(char operator)\r\n\t{\r\n\t\tswitch (operator)\r\n\t\t{\r\n\t\tcase '(': case ')': return 0;\r\n\t\tcase '+': case '-': return 1;\r\n\t\tcase '*': case '/': return 2;\r\n\t\tcase '^':\t\t\treturn 3;\r\n\t\tcase '.': return 4;\r\n\t\t} // end switch\r\n\r\n\t\treturn -1;\r\n\t\t\r\n\t}", "private Expr unaryPre(Position pos, X10Unary_c.Operator op, Expr e) throws SemanticException {\n Type ret = e.type();\n Expr one = getLiteral(pos, ret, 1);\n Assign.Operator asgn = (op == X10Unary_c.PRE_INC) ? Assign.ADD_ASSIGN : Assign.SUB_ASSIGN;\n Expr a = assign(pos, e, asgn, one);\n a = visitAssign((Assign) a);\n return a;\n }", "public Operator getOperator()\n {\n return operator;\n }", "@Override\n public NodeType ExecuteOperation()\n {\n //if the first child is an operator\n if(this.childNodes[0].isOperator==true)\n {\n BasicOperator basicOperator=(BasicOperator)this.childNodes[0]; \n if(basicOperator.operands==1)\n {\n UnaryOperator unaryOperator=(UnaryOperator)childNodes[0];\n return unaryOperator.PerformOperation(childNodes[1]);\n }\n else if(basicOperator.operands==2)\n {\n BinaryOperator binaryOperator=(BinaryOperator)childNodes[0];\n return binaryOperator.PerformOperation(childNodes[1], childNodes[2]);\n }\n else if(basicOperator.operands==3)\n {\n TernaryOperator ternaryOperator=(TernaryOperator)childNodes[0];\n return ternaryOperator.PerformOperation(childNodes[1], childNodes[2], childNodes[3]);\n }\n }\n //if not an operator\n else\n {\n return this.childNodes[0].ExecuteOperation();\n }\n return null;\n }", "private Token getNextOperator() {\n char currChar = this.data[currentIndex];\n\n if (currChar == '+' || currChar == '-' || currChar == '*' || currChar == '/' || currChar == '^') {\n currentIndex++;\n return new Token(TokenType.OPERATOR, currChar);\n } else {\n throw new LexerException(\"Invalid character in tags\");\n }\n }", "private static UnaryExpr retrieveUnaryExpression(Expression expression) {\n return expression.asUnaryExpr();\n }", "public int getOperatorNum() {\n return operatorNum;\n }", "public String getOperator() {\n\t\treturn operator;\n\t}", "public String getOperator() {\n\t\treturn operator;\n\t}", "@Test\n public void unaryTest() {\n UnaryOperator<String> postfix = (a) -> a + \"postfix\";\n UnaryOperator<Integer> increment = (a) -> a + 1;\n\n Assert.assertEquals(\"valuepostfix\", postfix.apply(\"value\"));\n Assert.assertEquals(new Integer(2), increment.apply(1));\n }", "@Override\n\tpublic void VisitUnaryNode(UnaryOperatorNode Node) {\n\n\t}", "public int operation(int number1,int number2,String operator)", "public final Enumerator ruleUnaryOperator() throws RecognitionException {\n Enumerator current = null;\n\n setCurrentLookahead(); resetLookahead(); \n try {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6874:6: ( ( ( '-' ) | ( '!' ) ) )\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6875:1: ( ( '-' ) | ( '!' ) )\n {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6875:1: ( ( '-' ) | ( '!' ) )\n int alt103=2;\n int LA103_0 = input.LA(1);\n\n if ( (LA103_0==61) ) {\n alt103=1;\n }\n else if ( (LA103_0==74) ) {\n alt103=2;\n }\n else {\n NoViableAltException nvae =\n new NoViableAltException(\"6875:1: ( ( '-' ) | ( '!' ) )\", 103, 0, input);\n\n throw nvae;\n }\n switch (alt103) {\n case 1 :\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6875:2: ( '-' )\n {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6875:2: ( '-' )\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6875:4: '-'\n {\n match(input,61,FOLLOW_61_in_ruleUnaryOperator12122); \n\n current = grammarAccess.getUnaryOperatorAccess().getMinusEnumLiteralDeclaration_0().getEnumLiteral().getInstance();\n createLeafNode(grammarAccess.getUnaryOperatorAccess().getMinusEnumLiteralDeclaration_0(), null); \n \n\n }\n\n\n }\n break;\n case 2 :\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6881:6: ( '!' )\n {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6881:6: ( '!' )\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6881:8: '!'\n {\n match(input,74,FOLLOW_74_in_ruleUnaryOperator12137); \n\n current = grammarAccess.getUnaryOperatorAccess().getLogicalNotEnumLiteralDeclaration_1().getEnumLiteral().getInstance();\n createLeafNode(grammarAccess.getUnaryOperatorAccess().getLogicalNotEnumLiteralDeclaration_1(), null); \n \n\n }\n\n\n }\n break;\n\n }\n\n\n }\n\n resetLookahead(); \n \tlastConsumedNode = currentNode;\n \n }\n \n catch (RecognitionException re) { \n recover(input,re); \n appendSkippedTokens();\n } \n finally {\n }\n return current;\n }", "public java.lang.String getOperator_lx() {\r\n return localOperator_lx;\r\n }", "public java.lang.String getOperator_lx() {\r\n return localOperator_lx;\r\n }", "Operation getOperation();", "Object findOperatorNeedCheck();", "public Operation getOperation();", "String getOperation();", "String getOperation();", "public final Enumerator ruleUnaryOperator() throws RecognitionException {\r\n Enumerator current = null;\r\n\r\n Token enumLiteral_0=null;\r\n Token enumLiteral_1=null;\r\n Token enumLiteral_2=null;\r\n\r\n enterRule(); \r\n try {\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4102:28: ( ( (enumLiteral_0= '+' ) | (enumLiteral_1= '-' ) | (enumLiteral_2= '~' ) ) )\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4103:1: ( (enumLiteral_0= '+' ) | (enumLiteral_1= '-' ) | (enumLiteral_2= '~' ) )\r\n {\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4103:1: ( (enumLiteral_0= '+' ) | (enumLiteral_1= '-' ) | (enumLiteral_2= '~' ) )\r\n int alt63=3;\r\n switch ( input.LA(1) ) {\r\n case 72:\r\n {\r\n alt63=1;\r\n }\r\n break;\r\n case 73:\r\n {\r\n alt63=2;\r\n }\r\n break;\r\n case 76:\r\n {\r\n alt63=3;\r\n }\r\n break;\r\n default:\r\n if (state.backtracking>0) {state.failed=true; return current;}\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 63, 0, input);\r\n\r\n throw nvae;\r\n }\r\n\r\n switch (alt63) {\r\n case 1 :\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4103:2: (enumLiteral_0= '+' )\r\n {\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4103:2: (enumLiteral_0= '+' )\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4103:4: enumLiteral_0= '+'\r\n {\r\n enumLiteral_0=(Token)match(input,72,FOLLOW_72_in_ruleUnaryOperator9575); if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n\r\n current = grammarAccess.getUnaryOperatorAccess().getPositiveEnumLiteralDeclaration_0().getEnumLiteral().getInstance();\r\n newLeafNode(enumLiteral_0, grammarAccess.getUnaryOperatorAccess().getPositiveEnumLiteralDeclaration_0()); \r\n \r\n }\r\n\r\n }\r\n\r\n\r\n }\r\n break;\r\n case 2 :\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4109:6: (enumLiteral_1= '-' )\r\n {\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4109:6: (enumLiteral_1= '-' )\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4109:8: enumLiteral_1= '-'\r\n {\r\n enumLiteral_1=(Token)match(input,73,FOLLOW_73_in_ruleUnaryOperator9592); if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n\r\n current = grammarAccess.getUnaryOperatorAccess().getNegativeEnumLiteralDeclaration_1().getEnumLiteral().getInstance();\r\n newLeafNode(enumLiteral_1, grammarAccess.getUnaryOperatorAccess().getNegativeEnumLiteralDeclaration_1()); \r\n \r\n }\r\n\r\n }\r\n\r\n\r\n }\r\n break;\r\n case 3 :\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4115:6: (enumLiteral_2= '~' )\r\n {\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4115:6: (enumLiteral_2= '~' )\r\n // ../org.yakindu.sct.model.stext/src-gen/org/yakindu/sct/model/stext/parser/antlr/internal/InternalSText.g:4115:8: enumLiteral_2= '~'\r\n {\r\n enumLiteral_2=(Token)match(input,76,FOLLOW_76_in_ruleUnaryOperator9609); if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n\r\n current = grammarAccess.getUnaryOperatorAccess().getComplementEnumLiteralDeclaration_2().getEnumLiteral().getInstance();\r\n newLeafNode(enumLiteral_2, grammarAccess.getUnaryOperatorAccess().getComplementEnumLiteralDeclaration_2()); \r\n \r\n }\r\n\r\n }\r\n\r\n\r\n }\r\n break;\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n if ( state.backtracking==0 ) {\r\n leaveRule(); \r\n }\r\n }\r\n \r\n catch (RecognitionException re) { \r\n recover(input,re); \r\n appendSkippedTokens();\r\n } \r\n finally {\r\n }\r\n return current;\r\n }", "private static OperatorBuilder unary(String symbol, DoubleUnaryOperator unaryOp, Type type) {\n if (unaryOp == null) {\n throw new IllegalArgumentException(\"operator argument must not be null\");\n }\n if (type.arity() != 1) {\n throw new IllegalArgumentException(\"type argument must be PREFIX or POSTFIX\");\n }\n // XXX ensure valid symbol\n return new OperatorBuilder(unaryOp, null, symbol, 90, type);\n }", "Expression unaryExpressionNotPlusMinus() throws SyntaxException {\r\n\t\tToken first = t;\r\n\t\tif (isKind(OP_EXCLAMATION)) {\r\n\t\t\tToken op = consume();\r\n\t\t\tExpression e = unaryExpression();\r\n\t\t\treturn new ExpressionUnary(first,op,e);\r\n\t\t} else \t{\r\n\t\t\treturn primary(); //errors will be reported by primary()\r\n\t\t}\r\n\t}", "public double getOperand1()\r\n\t{\r\n\t\tSystem.out.println(\"enter the operand 1:\");\r\n\t\tdouble op1=sc.nextDouble();\r\n\t\treturn op1;\r\n\t}", "boolean hasOperator();", "public void addop() {\n if (lexer.token != Symbol.PLUS && lexer.token != Symbol.MINUS) {\n error.signal(\"Wrong operator for addop. Using not a plus or not a minus.\");\n }\n lexer.nextToken();\n }", "public XbaseGrammarAccess.OpUnaryElements getOpUnaryAccess() {\n\t\treturn gaXbase.getOpUnaryAccess();\n\t}", "public XbaseGrammarAccess.OpUnaryElements getOpUnaryAccess() {\n\t\treturn gaXbase.getOpUnaryAccess();\n\t}", "com.google.protobuf.ByteString getOperatorBytes();", "public String getOp() {\n return op;\n }", "public String getOp() {\n return op;\n }", "public XbaseGrammarAccess.OpUnaryElements getOpUnaryAccess() {\r\n\t\treturn gaXbase.getOpUnaryAccess();\r\n\t}", "public int getOp() {\n\t\treturn op;\n\t}", "public final String entryRuleUnaryOperatorName() throws RecognitionException {\n String current = null;\n\n AntlrDatatypeRuleToken iv_ruleUnaryOperatorName = null;\n\n\n try {\n // InternalMyDsl.g:5430:57: (iv_ruleUnaryOperatorName= ruleUnaryOperatorName EOF )\n // InternalMyDsl.g:5431:2: iv_ruleUnaryOperatorName= ruleUnaryOperatorName EOF\n {\n if ( state.backtracking==0 ) {\n newCompositeNode(grammarAccess.getUnaryOperatorNameRule()); \n }\n pushFollow(FOLLOW_1);\n iv_ruleUnaryOperatorName=ruleUnaryOperatorName();\n\n state._fsp--;\n if (state.failed) return current;\n if ( state.backtracking==0 ) {\n current =iv_ruleUnaryOperatorName.getText(); \n }\n match(input,EOF,FOLLOW_2); if (state.failed) return current;\n\n }\n\n }\n\n catch (RecognitionException re) {\n recover(input,re);\n appendSkippedTokens();\n }\n finally {\n }\n return current;\n }", "private void processOperator() {\r\n\t\tif (expression[currentIndex] == '*') {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.AND_STRING);\r\n\t\t} else if (expression[currentIndex] == '+') {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.OR_STRING);\r\n\t\t} else if (expression[currentIndex] == '!') {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.NOT_STRING);\r\n\t\t} else {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.XOR_STRING);\r\n\t\t\t// xor operator has 2 characters more than any other operator.\r\n\t\t\tcurrentIndex += 2;\r\n\t\t}\r\n\r\n\t\tcurrentIndex++;\r\n\t}", "private DoubleBinaryOperator chooseOperator() {\n\t\tswitch(name) {\n\t\tcase \"+\":\n\t\t\treturn ADD;\n\t\t\t\n\t\tcase \"-\":\n\t\t\treturn SUB;\n\t\t\t\n\t\tcase \"*\":\n\t\t\treturn MULTIPLY;\n\t\t\t\n\t\tcase \"/\":\n\t\t\treturn DIVIDE;\n\t\t\t\n\t\tcase \"x^n\":\n\t\t\treturn POW;\n\t\t\t\n\t\tdefault:\n\t\t\tthrow new IllegalStateException(\"Invalid binary operator\");\n\t\t}\n\t}", "public R visit(Operator n) {\n R _ret=null;\n int which = n.f0.which;\n String s = \" \";\n switch (which)\n {\n case 0 : {s=\"LT\"; break;}\n case 1 : {s= \"PLUS\"; break;}\n case 2 : {s= \"MINUS\";break;}\n case 3 : {s= \"TIMES\"; break;}\n }\n \t return (R)s;\n }", "public final LLVMParser.operator_return operator() throws RecognitionException {\r\n LLVMParser.operator_return retval = new LLVMParser.operator_return();\r\n retval.start = input.LT(1);\r\n\r\n\r\n Instruction t =null;\r\n\r\n\r\n try {\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:240:5: (t= binary_op |t= vector_op |t= aggregate_op |t= memory_op |t= conversion_op |t= icmp_op |t= fcmp_op |t= select_op |t= call_op )\r\n int alt37=9;\r\n switch ( input.LA(1) ) {\r\n case GLOBAL_VARIABLE:\r\n {\r\n int LA37_1 = input.LA(2);\r\n\r\n if ( (LA37_1==47) ) {\r\n switch ( input.LA(3) ) {\r\n case BINARY_OP:\r\n {\r\n alt37=1;\r\n }\r\n break;\r\n case VOLATILE:\r\n case 53:\r\n case 66:\r\n case 74:\r\n {\r\n alt37=4;\r\n }\r\n break;\r\n case CONVERSION_OP:\r\n {\r\n alt37=5;\r\n }\r\n break;\r\n case 68:\r\n {\r\n alt37=6;\r\n }\r\n break;\r\n case 65:\r\n {\r\n alt37=7;\r\n }\r\n break;\r\n case 79:\r\n {\r\n alt37=8;\r\n }\r\n break;\r\n case 63:\r\n case 71:\r\n case 80:\r\n {\r\n alt37=2;\r\n }\r\n break;\r\n case 64:\r\n case 72:\r\n {\r\n alt37=3;\r\n }\r\n break;\r\n case 57:\r\n case 84:\r\n {\r\n alt37=9;\r\n }\r\n break;\r\n default:\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 37, 6, input);\r\n\r\n throw nvae;\r\n\r\n }\r\n\r\n }\r\n else {\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 37, 1, input);\r\n\r\n throw nvae;\r\n\r\n }\r\n }\r\n break;\r\n case LOCAL_VARIABLE:\r\n {\r\n int LA37_2 = input.LA(2);\r\n\r\n if ( (LA37_2==47) ) {\r\n switch ( input.LA(3) ) {\r\n case BINARY_OP:\r\n {\r\n alt37=1;\r\n }\r\n break;\r\n case VOLATILE:\r\n case 53:\r\n case 66:\r\n case 74:\r\n {\r\n alt37=4;\r\n }\r\n break;\r\n case CONVERSION_OP:\r\n {\r\n alt37=5;\r\n }\r\n break;\r\n case 68:\r\n {\r\n alt37=6;\r\n }\r\n break;\r\n case 65:\r\n {\r\n alt37=7;\r\n }\r\n break;\r\n case 79:\r\n {\r\n alt37=8;\r\n }\r\n break;\r\n case 63:\r\n case 71:\r\n case 80:\r\n {\r\n alt37=2;\r\n }\r\n break;\r\n case 64:\r\n case 72:\r\n {\r\n alt37=3;\r\n }\r\n break;\r\n case 57:\r\n case 84:\r\n {\r\n alt37=9;\r\n }\r\n break;\r\n default:\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 37, 6, input);\r\n\r\n throw nvae;\r\n\r\n }\r\n\r\n }\r\n else {\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 37, 2, input);\r\n\r\n throw nvae;\r\n\r\n }\r\n }\r\n break;\r\n case UNDEF:\r\n {\r\n int LA37_3 = input.LA(2);\r\n\r\n if ( (LA37_3==47) ) {\r\n switch ( input.LA(3) ) {\r\n case BINARY_OP:\r\n {\r\n alt37=1;\r\n }\r\n break;\r\n case VOLATILE:\r\n case 53:\r\n case 66:\r\n case 74:\r\n {\r\n alt37=4;\r\n }\r\n break;\r\n case CONVERSION_OP:\r\n {\r\n alt37=5;\r\n }\r\n break;\r\n case 68:\r\n {\r\n alt37=6;\r\n }\r\n break;\r\n case 65:\r\n {\r\n alt37=7;\r\n }\r\n break;\r\n case 79:\r\n {\r\n alt37=8;\r\n }\r\n break;\r\n case 63:\r\n case 71:\r\n case 80:\r\n {\r\n alt37=2;\r\n }\r\n break;\r\n case 64:\r\n case 72:\r\n {\r\n alt37=3;\r\n }\r\n break;\r\n case 57:\r\n case 84:\r\n {\r\n alt37=9;\r\n }\r\n break;\r\n default:\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 37, 6, input);\r\n\r\n throw nvae;\r\n\r\n }\r\n\r\n }\r\n else {\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 37, 3, input);\r\n\r\n throw nvae;\r\n\r\n }\r\n }\r\n break;\r\n case VOLATILE:\r\n case 82:\r\n {\r\n alt37=4;\r\n }\r\n break;\r\n case 57:\r\n case 84:\r\n {\r\n alt37=9;\r\n }\r\n break;\r\n default:\r\n NoViableAltException nvae =\r\n new NoViableAltException(\"\", 37, 0, input);\r\n\r\n throw nvae;\r\n\r\n }\r\n\r\n switch (alt37) {\r\n case 1 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:240:7: t= binary_op\r\n {\r\n pushFollow(FOLLOW_binary_op_in_operator1321);\r\n t=binary_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 2 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:241:7: t= vector_op\r\n {\r\n pushFollow(FOLLOW_vector_op_in_operator1332);\r\n t=vector_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 3 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:242:7: t= aggregate_op\r\n {\r\n pushFollow(FOLLOW_aggregate_op_in_operator1342);\r\n t=aggregate_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 4 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:243:7: t= memory_op\r\n {\r\n pushFollow(FOLLOW_memory_op_in_operator1352);\r\n t=memory_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 5 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:244:7: t= conversion_op\r\n {\r\n pushFollow(FOLLOW_conversion_op_in_operator1362);\r\n t=conversion_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 6 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:245:7: t= icmp_op\r\n {\r\n pushFollow(FOLLOW_icmp_op_in_operator1372);\r\n t=icmp_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 7 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:246:7: t= fcmp_op\r\n {\r\n pushFollow(FOLLOW_fcmp_op_in_operator1383);\r\n t=fcmp_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 8 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:247:7: t= select_op\r\n {\r\n pushFollow(FOLLOW_select_op_in_operator1394);\r\n t=select_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n case 9 :\r\n // D:\\\\workspace\\\\s\\\\JLLVM_b\\\\src\\\\cn\\\\edu\\\\sjtu\\\\jllvm\\\\VMCore\\\\Parser\\\\LLVM.g:248:7: t= call_op\r\n {\r\n pushFollow(FOLLOW_call_op_in_operator1405);\r\n t=call_op();\r\n\r\n state._fsp--;\r\n\r\n\r\n }\r\n break;\r\n\r\n }\r\n retval.stop = input.LT(-1);\r\n\r\n\r\n\r\n retval.inst = t;\r\n\r\n }\r\n catch (RecognitionException re) {\r\n reportError(re);\r\n recover(input,re);\r\n }\r\n\r\n finally {\r\n \t// do for sure before leaving\r\n }\r\n return retval;\r\n }", "Unary expr(Expr e);", "public final ManchesterOWLSyntaxAutoComplete.unary_return unary() {\n ManchesterOWLSyntaxAutoComplete.unary_return retval = new ManchesterOWLSyntaxAutoComplete.unary_return();\n retval.start = input.LT(1);\n ManchesterOWLSyntaxTree IDENTIFIER3 = null;\n ManchesterOWLSyntaxTree ENTITY_REFERENCE5 = null;\n ManchesterOWLSyntaxAutoComplete.expression_return e = null;\n ManchesterOWLSyntaxAutoComplete.qualifiedRestriction_return qualifiedRestriction4 = null;\n try {\n // /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntaxAutoComplete.g:144:1:\n // ( IDENTIFIER | ^( NEGATED_EXPRESSION e= expression ) |\n // qualifiedRestriction | ENTITY_REFERENCE )\n int alt7 = 4;\n switch (input.LA(1)) {\n case IDENTIFIER: {\n alt7 = 1;\n }\n break;\n case NEGATED_EXPRESSION: {\n alt7 = 2;\n }\n break;\n case SOME_RESTRICTION:\n case ALL_RESTRICTION:\n case VALUE_RESTRICTION:\n case CARDINALITY_RESTRICTION:\n case ONE_OF: {\n alt7 = 3;\n }\n break;\n case ENTITY_REFERENCE: {\n alt7 = 4;\n }\n break;\n default:\n if (state.backtracking > 0) {\n state.failed = true;\n return retval;\n }\n NoViableAltException nvae = new NoViableAltException(\"\", 7, 0, input);\n throw nvae;\n }\n switch (alt7) {\n case 1:\n // /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntaxAutoComplete.g:145:3:\n // IDENTIFIER\n {\n IDENTIFIER3 = (ManchesterOWLSyntaxTree) match(input, IDENTIFIER,\n FOLLOW_IDENTIFIER_in_unary376);\n if (state.failed) {\n return retval;\n }\n if (state.backtracking == 1) {\n ((ManchesterOWLSyntaxTree) retval.start)\n .setCompletions(getSymbolTable().match(\n IDENTIFIER3.getText()));\n }\n }\n break;\n case 2:\n // /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntaxAutoComplete.g:150:5:\n // ^( NEGATED_EXPRESSION e= expression )\n {\n match(input, NEGATED_EXPRESSION,\n FOLLOW_NEGATED_EXPRESSION_in_unary389);\n if (state.failed) {\n return retval;\n }\n match(input, Token.DOWN, null);\n if (state.failed) {\n return retval;\n }\n pushFollow(FOLLOW_expression_in_unary395);\n e = expression();\n state._fsp--;\n if (state.failed) {\n return retval;\n }\n match(input, Token.UP, null);\n if (state.failed) {\n return retval;\n }\n if (state.backtracking == 1) {\n ((ManchesterOWLSyntaxTree) retval.start).setCompletions(e.node\n .getCompletions());\n }\n }\n break;\n case 3:\n // /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntaxAutoComplete.g:154:5:\n // qualifiedRestriction\n {\n pushFollow(FOLLOW_qualifiedRestriction_in_unary409);\n qualifiedRestriction4 = qualifiedRestriction();\n state._fsp--;\n if (state.failed) {\n return retval;\n }\n if (state.backtracking == 1) {\n ((ManchesterOWLSyntaxTree) retval.start)\n .setCompletions(qualifiedRestriction4.node\n .getCompletions());\n }\n }\n break;\n case 4:\n // /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntaxAutoComplete.g:158:5:\n // ENTITY_REFERENCE\n {\n ENTITY_REFERENCE5 = (ManchesterOWLSyntaxTree) match(input,\n ENTITY_REFERENCE, FOLLOW_ENTITY_REFERENCE_in_unary423);\n if (state.failed) {\n return retval;\n }\n if (state.backtracking == 1) {\n ((ManchesterOWLSyntaxTree) retval.start)\n .setCompletions(getSymbolTable().match(\n ENTITY_REFERENCE5.getText()));\n }\n }\n break;\n }\n if (state.backtracking == 1) {\n retval.node = (ManchesterOWLSyntaxTree) retval.start;\n }\n } catch (@SuppressWarnings(\"unused\") RecognitionException | RewriteEmptyStreamException exception) {}\n return retval;\n }", "double getActiveOperand();", "private void operator() {\n reduce();\n shift();\n getDispenser().advance();\n if(getDispenser().tokenIsNumber()) setState(State.NUMBER);\n else if (getDispenser().tokenIsLeftParen()) setState(State.LEFT_PAREN);\n else syntaxError(NUM);\n \n }", "public String getOper() {\n return oper;\n }", "DoubleBinaryOperator getPendingBinaryOperation();", "public int oper() {\n int ope = getFilter().getExp().oper();\n return ope;\n }", "public interface Unary extends Expr \n{\n /** Unary expression operator. */\n public static enum Operator {\n BIT_NOT (\"~\", true),\n NEG (\"-\", true),\n POST_INC (\"++\", false),\n POST_DEC (\"--\", false),\n PRE_INC (\"++\", true),\n PRE_DEC (\"--\", true),\n POS (\"+\", true),\n NOT (\"!\", true),\n CARET (\"^\", true),\n BAR (\"|\", true),\n AMPERSAND(\"&\", true),\n STAR (\"*\", true),\n SLASH (\"/\", true),\n PERCENT (\"%\", true);\n\n protected boolean prefix;\n protected String name;\n\n private Operator(String name, boolean prefix) {\n this.name = name;\n this.prefix = prefix;\n }\n\n /** Returns true of the operator is a prefix operator, false if\n * postfix. */\n public boolean isPrefix() { return prefix; }\n\n @Override public String toString() { return name; }\n }\n\n public static final Operator BIT_NOT = Operator.BIT_NOT;\n public static final Operator NEG = Operator.NEG;\n public static final Operator POST_INC = Operator.POST_INC;\n public static final Operator POST_DEC = Operator.POST_DEC;\n public static final Operator PRE_INC = Operator.PRE_INC;\n public static final Operator PRE_DEC = Operator.PRE_DEC;\n public static final Operator POS = Operator.POS;\n public static final Operator NOT = Operator.NOT;\n public static final Operator CARET = Operator.CARET;\n public static final Operator BAR = Operator.BAR;\n public static final Operator AMPERSAND = Operator.AMPERSAND;\n public static final Operator STAR = Operator.STAR;\n public static final Operator SLASH = Operator.SLASH;\n public static final Operator PERCENT = Operator.PERCENT;\n\n /** The sub-expression on that to apply the operator. */\n Expr expr();\n /** Set the sub-expression on that to apply the operator. */\n Unary expr(Expr e);\n\n /** The operator to apply on the sub-expression. */\n Operator operator();\n /** Set the operator to apply on the sub-expression. */\n Unary operator(Operator o);\n}", "public String getOperator() {\n return m_operatorBox.getSelectedItem().toString();\n }", "public int getOperandA();", "public final void unaryExpression() throws RecognitionException {\n int unaryExpression_StartIndex = input.index();\n try { dbg.enterRule(getGrammarFileName(), \"unaryExpression\");\n if ( getRuleLevel()==0 ) {dbg.commence();}\n incRuleLevel();\n dbg.location(815, 1);\n\n try {\n if ( state.backtracking>0 && alreadyParsedRule(input, 121) ) { return ; }\n // Java.g:816:5: ( '+' unaryExpression | '-' unaryExpression | '++' unaryExpression | '--' unaryExpression | unaryExpressionNotPlusMinus )\n int alt142=5;\n try { dbg.enterDecision(142);\n\n switch ( input.LA(1) ) {\n case 105:\n {\n alt142=1;\n }\n break;\n case 106:\n {\n alt142=2;\n }\n break;\n case 109:\n {\n alt142=3;\n }\n break;\n case 110:\n {\n alt142=4;\n }\n break;\n case Identifier:\n case FloatingPointLiteral:\n case CharacterLiteral:\n case StringLiteral:\n case HexLiteral:\n case OctalLiteral:\n case DecimalLiteral:\n case 47:\n case 56:\n case 57:\n case 58:\n case 59:\n case 60:\n case 61:\n case 62:\n case 63:\n case 65:\n case 66:\n case 69:\n case 70:\n case 71:\n case 72:\n case 111:\n case 112:\n case 113:\n {\n alt142=5;\n }\n break;\n default:\n if (state.backtracking>0) {state.failed=true; return ;}\n NoViableAltException nvae =\n new NoViableAltException(\"\", 142, 0, input);\n\n dbg.recognitionException(nvae);\n throw nvae;\n }\n\n } finally {dbg.exitDecision(142);}\n\n switch (alt142) {\n case 1 :\n dbg.enterAlt(1);\n\n // Java.g:816:9: '+' unaryExpression\n {\n dbg.location(816,9);\n match(input,105,FOLLOW_105_in_unaryExpression4918); if (state.failed) return ;\n dbg.location(816,13);\n pushFollow(FOLLOW_unaryExpression_in_unaryExpression4920);\n unaryExpression();\n\n state._fsp--;\n if (state.failed) return ;\n\n }\n break;\n case 2 :\n dbg.enterAlt(2);\n\n // Java.g:817:9: '-' unaryExpression\n {\n dbg.location(817,9);\n match(input,106,FOLLOW_106_in_unaryExpression4930); if (state.failed) return ;\n dbg.location(817,13);\n pushFollow(FOLLOW_unaryExpression_in_unaryExpression4932);\n unaryExpression();\n\n state._fsp--;\n if (state.failed) return ;\n\n }\n break;\n case 3 :\n dbg.enterAlt(3);\n\n // Java.g:818:9: '++' unaryExpression\n {\n dbg.location(818,9);\n match(input,109,FOLLOW_109_in_unaryExpression4942); if (state.failed) return ;\n dbg.location(818,14);\n pushFollow(FOLLOW_unaryExpression_in_unaryExpression4944);\n unaryExpression();\n\n state._fsp--;\n if (state.failed) return ;\n\n }\n break;\n case 4 :\n dbg.enterAlt(4);\n\n // Java.g:819:9: '--' unaryExpression\n {\n dbg.location(819,9);\n match(input,110,FOLLOW_110_in_unaryExpression4954); if (state.failed) return ;\n dbg.location(819,14);\n pushFollow(FOLLOW_unaryExpression_in_unaryExpression4956);\n unaryExpression();\n\n state._fsp--;\n if (state.failed) return ;\n\n }\n break;\n case 5 :\n dbg.enterAlt(5);\n\n // Java.g:820:9: unaryExpressionNotPlusMinus\n {\n dbg.location(820,9);\n pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_unaryExpression4966);\n unaryExpressionNotPlusMinus();\n\n state._fsp--;\n if (state.failed) return ;\n\n }\n break;\n\n }\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n if ( state.backtracking>0 ) { memoize(input, 121, unaryExpression_StartIndex); }\n }\n dbg.location(821, 5);\n\n }\n finally {\n dbg.exitRule(getGrammarFileName(), \"unaryExpression\");\n decRuleLevel();\n if ( getRuleLevel()==0 ) {dbg.terminate();}\n }\n\n return ;\n }", "private int findExpression(List<Operator> ops, int offset, int length) {\n \n Operator op = ops.get(offset);\n if (op instanceof BinaryOperator) {\n \n // Invalid\n throw new RuntimeException(\"Expression must not start with binary operator\");\n } else if (op instanceof UnaryOperator) {\n \n // Just a unary operator\n return 1;\n \n } else if (op instanceof PrecedenceOperator) {\n \n PrecedenceOperator pop = (PrecedenceOperator)op;\n \n if (!pop.begin) {\n \n // Invalid\n throw new RuntimeException(\"Invalid paranthesis\");\n \n } else {\n \n // Find closing bracket\n int open = 1;\n for (int i=offset+1; i<length; i++){\n if (ops.get(i) instanceof PrecedenceOperator){\n pop = (PrecedenceOperator)ops.get(i);\n if (pop.begin) open++;\n else open--;\n if (open == 0){\n return i-offset+1;\n }\n }\n }\n // Invalid\n throw new RuntimeException(\"Missing closing paranthesis\");\n }\n } else {\n \n // Invalid\n throw new RuntimeException(\"Unknown operator\");\n }\n }", "int getOperationValue();", "LogicExpression getLeft();", "public PrefixExpression.Operator getReverse(PostfixExpression.Operator op) {\n if (op == PostfixExpression.Operator.DECREMENT)\n return PrefixExpression.Operator.INCREMENT;\n else if (op == PostfixExpression.Operator.INCREMENT)\n return PrefixExpression.Operator.DECREMENT;\n else\n return null;\n }", "SEIntegerVariable getOperand1();", "public PostfixExpression.Operator getReverse(PrefixExpression.Operator op) {\n if (op == PrefixExpression.Operator.DECREMENT)\n return PostfixExpression.Operator.INCREMENT;\n else if (op == PrefixExpression.Operator.INCREMENT)\n return PostfixExpression.Operator.DECREMENT;\n else\n return null;\n }", "@JsonProperty(\"operator\")\n public String getOperator() {\n return operator;\n }", "int getStep();", "int getStep();", "int getStep();", "public final Enumerator rulePowerOperator() throws RecognitionException {\n Enumerator current = null;\n\n setCurrentLookahead(); resetLookahead(); \n try {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6853:6: ( ( ( '^' ) | ( '.^' ) ) )\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6854:1: ( ( '^' ) | ( '.^' ) )\n {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6854:1: ( ( '^' ) | ( '.^' ) )\n int alt102=2;\n int LA102_0 = input.LA(1);\n\n if ( (LA102_0==60) ) {\n alt102=1;\n }\n else if ( (LA102_0==73) ) {\n alt102=2;\n }\n else {\n NoViableAltException nvae =\n new NoViableAltException(\"6854:1: ( ( '^' ) | ( '.^' ) )\", 102, 0, input);\n\n throw nvae;\n }\n switch (alt102) {\n case 1 :\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6854:2: ( '^' )\n {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6854:2: ( '^' )\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6854:4: '^'\n {\n match(input,60,FOLLOW_60_in_rulePowerOperator12064); \n\n current = grammarAccess.getPowerOperatorAccess().getPowerEnumLiteralDeclaration_0().getEnumLiteral().getInstance();\n createLeafNode(grammarAccess.getPowerOperatorAccess().getPowerEnumLiteralDeclaration_0(), null); \n \n\n }\n\n\n }\n break;\n case 2 :\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6860:6: ( '.^' )\n {\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6860:6: ( '.^' )\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:6860:8: '.^'\n {\n match(input,73,FOLLOW_73_in_rulePowerOperator12079); \n\n current = grammarAccess.getPowerOperatorAccess().getElementWisePowerEnumLiteralDeclaration_1().getEnumLiteral().getInstance();\n createLeafNode(grammarAccess.getPowerOperatorAccess().getElementWisePowerEnumLiteralDeclaration_1(), null); \n \n\n }\n\n\n }\n break;\n\n }\n\n\n }\n\n resetLookahead(); \n \tlastConsumedNode = currentNode;\n \n }\n \n catch (RecognitionException re) { \n recover(input,re); \n appendSkippedTokens();\n } \n finally {\n }\n return current;\n }", "public String getArithmeticOperator() {\n return (String)getAttributeInternal(ARITHMETICOPERATOR);\n }" ]
[ "0.6579088", "0.64441353", "0.6239744", "0.6212987", "0.6094108", "0.5996377", "0.59488976", "0.5921858", "0.5896969", "0.58484334", "0.57923895", "0.57666504", "0.57221454", "0.5711161", "0.57066345", "0.57062995", "0.5691747", "0.5689459", "0.5685396", "0.5679413", "0.5677071", "0.5669629", "0.5662808", "0.56471354", "0.5642316", "0.5617653", "0.5610737", "0.5608469", "0.5602239", "0.5602239", "0.5602239", "0.5591888", "0.5588395", "0.5588395", "0.5588395", "0.5588395", "0.5588395", "0.5588395", "0.55776066", "0.5559954", "0.5556791", "0.55400383", "0.55268884", "0.5526356", "0.54859", "0.54692775", "0.5467397", "0.5467397", "0.5461358", "0.5434564", "0.54290813", "0.5425726", "0.5411573", "0.5411573", "0.53418905", "0.5341074", "0.53381133", "0.5337959", "0.5337959", "0.53120846", "0.53094697", "0.5297916", "0.5285835", "0.5283258", "0.52801937", "0.52766293", "0.52766293", "0.52756774", "0.5274546", "0.5274546", "0.5267569", "0.5255122", "0.5249678", "0.52488154", "0.5245134", "0.52279514", "0.5227789", "0.5226689", "0.5218632", "0.521116", "0.52019125", "0.51999795", "0.5198579", "0.51886326", "0.5180273", "0.5172578", "0.516842", "0.5161038", "0.5154185", "0.5151075", "0.5141376", "0.513846", "0.51382744", "0.51229036", "0.5117393", "0.5107234", "0.5107234", "0.5107234", "0.5106841", "0.51064163" ]
0.7294194
0
pop the top 2 values and add them and push the result onto the value stack
@Override public void step(final EvaluationContext theContext) { // pop the top 2 values and add them // and push the result onto the value stack // final Double theSecondOperand = theContext.popValue(); final Double theFirstOperand = theContext.popValue(); theContext.pushValue(theFirstOperand + theSecondOperand); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand - theSecondOperand);\n }", "public final void add() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue + topMostValue);\n\t\t}\n\t}", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "private void uminus() throws Exception{\n\t\tif(stackEmpty()) throw new Exception(\"Stack ist leer\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tstack.push(value1*(-1));\n\t\t}\n\t\t\n\t}", "public int pop() {\r\n LinkedList<Integer> queue = new LinkedList<>();\r\n int value = stack.poll();\r\n while(!stack.isEmpty()){\r\n queue.offer(value);\r\n value = stack.poll();\r\n }\r\n stack = queue;\r\n return value;\r\n }", "public void pop() {\r\n \t Queue<Integer> temp=new LinkedList<Integer>();\r\n \t int counter=0;\r\n \t while(!stack.isEmpty()){\r\n \t temp.add((Integer) stack.poll());\r\n \t counter++;\r\n \t \r\n \t }\r\n \t while(counter>1)\r\n \t {\r\n \t \r\n \t stack.add(temp.poll());\r\n \t counter--;\r\n \t }\r\n }", "public double pop()\n {\n if (empty()) {\n \tthrow new IllegalArgumentException(\"too many operators!\");\n \t\n }\n else\n {\n return s[top--];\n }\n }", "private void addition() throws Exception {\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.peek();\n\t\t\tstack.push(value2+value1);\n\t\t}\n\t\t\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand * theSecondOperand);\n }", "int pop2(TwoStack sq)\n {\n if(sq.top2<sq.size)\n {\n int yo2=sq.arr[sq.top2];\n sq.top2++;\n return yo2;\n }\n else\n {\n return -1;\n }\n \n }", "private void addRValueToStack (){\n if (numStack.size() < 23){\n numStack.push(rValues[rCount]);\n if(rCount< rValues.length){ // cycles through the 'r' values\n rCount++;\n }\n else{ \n rCount=0; // if end of r values reached, rCount is set to 0.\n }\n }\n else {\n System.out.println(\"Stack overflow.\"); \n }\n }", "public ExParValue pop() {\r\n\t\tExParValue v = null;\r\n\t\tif (value.next != null) {\r\n\t\t\tv = value;\r\n\t\t\tvalue = value.next;\r\n\t\t\t// System.out.println(\"ExPar.pop() Popping \" + v.toString() +\r\n\t\t\t// \" now on top: \" + value.toString());\r\n\t\t} else {\r\n\t\t\tnew ParameterValueError(\"ExPar.pop() without preceding push()\");\r\n\t\t}\r\n\t\t/*\r\n\t\t * if (value == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack empty.\"); } else if\r\n\t\t * (value.next == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): A single value is on the stack: \" +\r\n\t\t * value.toString()); } else {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack: \" + value.toString() +\r\n\t\t * \", \" + value.next.toString()); }\r\n\t\t */\r\n\t\treturn (v);\r\n\t}", "public int pop() { //第二个栈为空 , 就将第一个栈的数据往第二个里面加\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n return temp2.pop(); //不管是否为空,直接pop第二个栈\n }", "public int top() {\r\n Queue<Integer> temp=new LinkedList<Integer>();\r\n int counter=0;\r\n while(!stack.isEmpty()){\r\n temp.add((Integer) stack.poll());\r\n counter++;\r\n \r\n }\r\n while(counter>1)\r\n {\r\n \r\n stack.add(temp.poll());\r\n counter--;\r\n }\r\n int topInteger=temp.poll();\r\n stack.add(topInteger);\r\n return topInteger;\r\n \r\n }", "public int top() {\n if(!stack2.isEmpty()) {\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n }", "public int pop() {\n int result;\n while(!stack.isEmpty()){\n cache.add(stack.removeLast());\n }\n result = cache.removeLast();\n while(!cache.isEmpty()){\n stack.add(cache.removeLast());\n }\n System.out.println(result);\n return result;\n }", "public final void max() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t} else {\n\t\t\t\tpush(topMostValue);\n\t\t\t}\n\t\t}\n\t}", "int pop2()\n {\n if(top2 == size) {\n System.out.println(\"Second Stack is empty.\");\n return -1;\n }\n\n int popped = arr[top2];\n ++top2;\n return popped;\n }", "@Override\n\tpublic int pop() {\n\t\tint topValue;\n\t\tif (top != -1) {\n\t\t\ttopValue = intContainer[top];\n\t\t\ttop = top - 1;\n\t\t\treturn topValue;\n\t\t} else {\n\t\t\tSystem.out.println(\"Stack Undeflow\");\n\t\t\treturn -1;\n\t\t}\n\t}", "int pop2(TwoStack sq) {\n if (sq.top2 < sq.size) {\n int x = sq.arr[sq.top2];\n sq.top2++;\n return x;\n } else {\n return -1;\n }\n }", "private void minus() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value2-value1);\n\t\t}\n\t}", "public Integer pop() \n\t{ \n\t\tint x = super.pop(); \n\t\tmin.pop(); \n\t\treturn x; \n\t}", "public int pop() {\n int value = top.value;\n top = top.pre;\n top.next = null;\n size--;\n return value;\n }", "public final void swap() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(topMostValue);\n\t\t\tpush(secondTopMostValue);\n\t\t}\n\t}", "int pop() {\r\n\t\ttop--;\r\n\t\treturn stack[top];\r\n\t}", "void push2(int x) {\n --top2;\n if(top2 == size / 2) {\n System.out.println(\"Second stack is full\");\n return;\n }\n arr[top2] = x;\n }", "public int pop(){\n \tint data=0;\n \tif(isEmpty())\n \tSystem.out.println(\"Stack is underflow\");\n \telse\n \tdata=elements[top--];\n \treturn data;\n\t}", "@Test\n public void testThreePushPop(){\n ms = new MyStack();\n int pn1=3, pn2=4, pn3=5;\n ms.push(pn1);\n ms.push(pn2);\n ms.push(pn3);\n assertEquals(pn3,ms.pop());\n assertEquals(pn2,ms.pop());\n assertEquals(pn1,ms.pop());\n }", "public int pop(){\n if (isEmpty()) throw new RuntimeException(\"Stack underflow\");\n int tmp=myarray[top];\n top--;\n return tmp;\n \n \n }", "public final void rot() {\n\t\tif (size > 2) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tdouble thirdTopMostValue = pop();\n\n\t\t\tpush(secondTopMostValue);\n\t\t\tpush(topMostValue);\n\t\t\tpush(thirdTopMostValue);\n\n\t\t}\n\t}", "private void multiple() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value1*value2);\n\t\t}\n\t}", "public int pop() {\n while (!push.isEmpty()){\n pull.push(push.pop());\n }\n int result= pull.pop();\n while (!pull.isEmpty()){\n push.push(pull.pop());\n }\n return result;\n }", "private void topEval(Stack<Operator> pOperatorStack, Stack<Operand> pOperandStack) {\n Operand right = pOperandStack.pop();\n Operator operator = pOperatorStack.pop();\n if (operator instanceof UnaryOperator) {\n pOperandStack.push(((UnaryOperator)operator).evaluate(right));\n } else {\n Operand left = pOperandStack.pop();\n pOperandStack.push(((BinaryOperator)operator).evaluate(left, right));\n }\n }", "int pop() \r\n {\n if(top < 0)\r\n {\r\n System.out.println(\"Stack Underflow Occurred!\");\r\n return -1;\r\n }\r\n //Write your code here\r\n int p = a[top];\r\n top--;\r\n return p; \r\n }", "public int pop(int valueIfEmpty) {\n\t\t\tif (isEmpty()) {\n\t\t\t\treturn valueIfEmpty;\n\t\t\t}\n\n\t\t\tstoredValues--;\n\t\t\tint result = stack[bottom++];\n\n\t\t\tif (bottom == capacity) {\n\t\t\t\tbottom = 0;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "private static int pop(Stack<Integer> top_ref) {\n /*If stack is empty then error */\n if (top_ref.isEmpty()) {\n System.out.println(\"Stack Underflow\");\n System.exit(0);\n }\n //pop the data from the stack\n return top_ref.pop();\n }", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand / theSecondOperand);\n }", "public void push(int value){\n //To be written by student\n localSize++;\n top++;\n if(localSize>A.getSize()){\n A.doubleSize();\n try{\n A.modifyElement(value,top);\n }catch(Exception c){c.printStackTrace();}\n }\n else{try{\n A.modifyElement(value,top);\n }catch(Exception a){a.printStackTrace();} }\n }", "int pop() {\n if (data.size() == 1) {\r\n min = 0;\r\n return data.pop();\r\n }\r\n else if (data.size() > 1) {\r\n int val = data.peek();\r\n if (val < min) {\r\n val = min;\r\n min = min * 2 - data.peek();\r\n data.pop();\r\n return val;\r\n }\r\n return data.pop();\r\n }\r\n else {\r\n System.out.println(\"Stack underflow\");\r\n return -1;\r\n }\r\n }", "public T pop() {\n \tT retVal = stack.get(stack.size() - 1); // get the value at the top of the stack\n \tstack.remove(stack.size() - 1); // remove the value at the top of the stack\n \treturn retVal;\n }", "public int pop(){\n if (top==null) throw new EmptyStackException();\n int data = top.data;\n top=top.next;\n return data;\n }", "public int top() {\r\n int value = this.pop();\r\n this.stack.offer(value);\r\n return value;\r\n }", "int pop()\n\t{\n // Your code here\n if(top == -1){\n return -1;\n }\n int x = arr[top];\n top--;\n return x;\n\t}", "public int pop() {\n if (stk2.isEmpty()) {\n while (!stk1.isEmpty())\n stk2.push(stk1.pop());\n }\n return stk2.pop();\n }", "public final double pop() {\n\t\tdouble returnValue = defaultValue;\n\n\t\tif (!isEmpty()) {\n\n\t\t\tdouble value = stack[index];\n\t\t\tindex--;\n\t\t\tsize--;\n\t\t\treturnValue = value;\n\t\t}\n\n\t\treturn returnValue;\n\t}", "public int top() {\n // Write your code here\n int ret = 0;\n if (!queue1.isEmpty()) {\n while (queue1.size() > 1) {\n queue2.offer(queue1.poll());\n }\n ret = queue1.peek();\n queue2.offer(queue1.poll());\n } else if (!queue2.isEmpty()) {\n while (queue2.size() > 1) {\n queue1.offer(queue2.poll());\n }\n ret = queue2.peek();\n queue1.offer(queue2.poll());\n }\n return ret;\n }", "public void push(int value) {\n\t\t\tif (storedValues == capacity) {\n\t\t\t\ttop = bottom;\n\t\t\t\tbottom++;\n\t\t\t\tif (bottom == capacity) {\n\t\t\t\t\tbottom = 0;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstoredValues++;\n\t\t\t}\n\n\t\t\tif (top == capacity) {\n\t\t\t\ttop = 0;\n\t\t\t}\n\n\t\t\tstack[top++] = value;\n\t\t}", "void push2(int x, TwoStack sq)\n {\n \n if(sq.top2>sq.size/2)\n {\n sq.top2--;\n sq.arr[sq.top2]=x;\n }\n \n }", "private synchronized BackStep pop() {\r\n\t\t\tBackStep bs;\r\n\t\t\tbs = stack[top];\r\n\t\t\tif (size == 1) {\r\n\t\t\t\ttop = -1;\r\n\t\t\t} else {\r\n\t\t\t\ttop = (top + capacity - 1) % capacity;\r\n\t\t\t}\r\n\t\t\tsize--;\r\n\t\t\treturn bs;\r\n\t\t}", "public final void mod() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue > 0) {\n\t\t\t\tpush(secondTopMostValue % topMostValue);\n\t\t\t}\n\t\t}\n\t}", "static int pop(Stack<Integer> top_ref) {\r\n /* If stack is empty then error */\r\n if (top_ref.isEmpty()) {\r\n System.out.println(\"Stack Underflow\");\r\n System.exit(0);\r\n }\r\n\r\n // pop the data from the stack\r\n return top_ref.pop();\r\n }", "void pop() {\n // -\n top = top.getNextNode();\n }", "void push2(int x, TwoStack sq) {\n if (sq.top1 < sq.top2 - 1) {\n sq.top2--;\n sq.arr[sq.top2] = x;\n }\n }", "public void pop() {\n\t List<Integer> temp = new ArrayList<>();\n\t Integer last = null;\n\t first = null;\n\t \n\t do{\n\t last = s.pop();\n\t if(s.isEmpty()){\n\t break;\n\t }\n\t first = last;\n\t temp.add(last);\n\t \n\t }while (true);\n\t \n\t for(int i = temp.size()-1; i >=0; i--){\n\t s.push(temp.get(i));\n\t }\n\t \n\t}", "public void pop() throws StackUnderflowException;", "private void stackPopElements(int height,int p){\n\t\tint recEnd = p-1;\n\t\tint size;\n\t\t//again, for the equal case; we pop element that equal to height in the stack; cause it's not useful anymore.\n\t\t// and also, we don't need to calc the value for it, cause it's guaranteed no the best value yet;\n\t\twhile(!hStack.isEmpty()&&hStack.peek()>=height){\n\t\t\tint sh = hStack.pop();\n\t\t\tint sp = pStack.pop();\n//\t\t\tSystem.out.println(\"------------- sh and sp is: \"+sh+\" sp:\"+sp+\" size left is: \"+pStack.size());\n\t\t\t\n\t\t\tint start;\n\t\t\tif(sh==height){\n\t\t\t\t//ignore;\n\t\t\t}else{\n\t\t\t\tif(pStack.isEmpty()){\n\t\t\t\t\tstart = 0;\n\t\t\t\t}else{\n\t\t\t\t\tstart = pStack.peek()+1; // element smaller than this height is at this position;\n\t\t\t\t}\n\t\t\t\tsize = (p-start)*sh; // size is width*height;\n//\t\t\t\tSystem.out.println(\" height : \"+sh+\" size: \"+size);\n//\t\t\t\tSystem.out.println(\" p and start : \"+p+\" start:\"+start);\n\t\t\t\tif(size>max){\n\t\t\t\t\t// also can record other things if we want;\n\t\t\t\t\tmax = size; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int pop() {\n q1.remove();\n int res = top;\n if (!q1.isEmpty()) {\n top = q1.peek();\n }\n return res;\n }", "public void pop(){\n \n if(top==null) System.out.println(\"stack is empty\");\n else top=top.next;\n \t\n }", "void push(int val) {\n if (data.size() == 0) {\r\n data.push(val);\r\n min = val;\r\n }\r\n else {\r\n if (val <= min) {\r\n data.push(val * 2 - min);\r\n min = val;\r\n }\r\n else\r\n data.push(val);\r\n }\r\n }", "public void pop() {\n s2.pop();\n temp = (Stack<Integer>) s2.clone();\n s1.clear();\n while (!temp.isEmpty()) {\n s1.push(temp.pop());\n }\n }", "public int pop() {\n int res= q1.remove();\n if (!q1.isEmpty())\n top = q1.peek();\n return res;\n }", "public int pop() {\n if (isEmpty()) {\n throw new IllegalStateException(\"Der Stack ist leer.\");\n }\n if((values.length / 2) >= size) {\t\t\t\t// Überprüfen, ob das Array nicht zu groß ist und ob nicht die Hälfte auch reicht\n \tint[] save = this.values;\t\t\t\t\t// sichere altes Array\n \tthis.values = new int[save.length / 2];\t\t// verkleinere values Array\n \tfor (int i = 0; i < values.length; i++) {\t// kopiere die alten Werte in das neue Array\n \t\tvalues[i] = save[i];\n \t}\n }\n int save = values[size-1];\n values[--size] = 0;\n return save;\n }", "public T pop() {\n\t\tT value = null;\n\t\tif (!isEmpty()) {\n\t\t\ttop = top.next;\n\t\t\tvalue = top.value;\n\t\t}\n\t\treturn value; // returning popped value\n\t}", "public void popAllStacks(){\n // if top is lost then all elements are lost.\n top = null;\n }", "@Test\n public void testTop() {\n System.out.println(\"top\");\n Stack2 instance = new Stack2();\n int expResult = 7;\n instance.push(7);\n int result = instance.top();\n assertEquals(expResult, result);\n }", "public int peek() { //使用栈的peek\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n int data = temp2.peek() ;\n return data; \n }", "public int pop() {\n if (this.stack2.empty()) {\n while (!this.stack1.empty()) {\n this.stack2.push(this.stack1.pop());\n }\n }\n if (!this.stack2.empty()) {\n return this.stack2.pop();\n }\n return -1;\n\n }", "public void pop(){\n // check if there is any stack present or not\n if(this.arr==null){\n System.out.println(\"No stack present, first create a stack\");\n return;\n }\n // check if stack is empty\n if(this.topOfStack==-1){\n System.out.println(\"Stack is empty, can't pop from stack\");\n return;\n }\n // if stack is not empty\n this.arr[this.topOfStack]=Integer.MIN_VALUE;\n this.topOfStack--;\n }", "public int pop() {\n if(!stack2.isEmpty()) return stack2.pop();\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n return stack2.pop();\n }\n }", "public static int sumOfStack2(Deque<Integer> stack) {\n\t int sum = 0;\n\t while(!stack.isEmpty()) {\n\t \tsum += stack.pop();\n\t }\n\t return sum;\n\t}", "public final void min() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(topMostValue);\n\t\t\t} else {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t}\n\t\t}\n\t}", "public final void dup() {\n\t\tif (size > 0) {\n\t\t\tdouble topMostValue = stack[index];\n\t\t\tpush(topMostValue);\n\t\t}\n\t}", "public void pop()\r\n\t{\r\n\t\ttop--;\r\n\t\tstack[top] = null;\r\n\t}", "public E pop()\n {\n E topVal = stack.removeFirst();\n return topVal;\n }", "public int pop() {\n while (!s1.isEmpty()) {\n s2.push(s1.pop());\n }\n int pop = s2.pop();\n while (!s2.isEmpty()) {\n s1.push(s2.pop());\n }\n return pop;\n }", "public void push(T value) {\n top = new Entry<>(value, top); // diamond operator (syntactic sugar)\n }", "public void sumValues(){\n\t\tint index = 0;\n\t\tDouble timeIncrement = 2.0;\n\t\tDouble timeValue = time.get(index);\n\t\tDouble packetValue;\n\t\twhile (index < time.size()){\n\t\t\tDouble packetTotal = 0.0;\n\t\t\twhile (timeValue < timeIncrement && index < packets.size()){\n\t\t\t\ttimeValue = time.get(index);\n\t\t\t\tpacketValue = packets.get(index);\n\t\t\t\tpacketTotal= packetTotal + packetValue;\n\t\t\t\tindex = index + 1;\n\t\t\t}\n\t\t\tArrayList<Double> xy = new ArrayList<Double>();\n\t\t\txy.add(timeIncrement);\n\t\t\txy.add(packetTotal);\n\t\t\ttotalIncrements.add(xy);\n\t\t\t// to get max and min need separate arrays\n\t\t\ttimeIncrements.add(timeIncrement);\n\t\t\tbyteIncrements.add(packetTotal);\n\t\t\ttimeIncrement = timeIncrement + 2.0;\t\n\t\t}\n\t\treturn;\n\n\t}", "public int pop() {\n\n if (top > 0) {\n top --;\n }\n else {\n System.out.println(\"Stack Underflow\");\n return -100;\n }\n return stack[top];\n }", "public ValueWrapper pop(String keyName) {\n\t\tif(isEmpty(keyName)) {\n\t\t\tthrow new EmptyStackException();\n\t\t}\n\t\tvar value = multistack.get(keyName);\n\t\tif(value.next != null) {\n\t\t\tmultistack.put(keyName, value.next);\n\t\t}\n\t\telse {\n\t\t\tmultistack.remove(keyName);\n\t\t}\n\t\treturn value.value;\n\t}", "void push(int a)\n\t{\n\t // Your code here\n\t top++;\n\t arr[top]=a;\n\t}", "public ListNode addTwoNumbers(ListNode l1, ListNode l2) {\n Stack<Integer> s1 = new Stack<>();\n Stack<Integer> s2 = new Stack<>();\n while (l1 != null) {\n s1.push(l1.val);\n l1 = l1.next;\n }\n while (l2 != null) {\n s2.push(l2.val);\n l2 = l2.next;\n }\n ListNode current = new ListNode(0);\n int overflow = 0;\n while (!s1.empty() || !s2.empty()) {\n int x = (!s1.empty()) ? s1.pop() : 0;\n int y = (!s2.empty()) ? s2.pop() : 0;\n int value = overflow + x + y;\n overflow = value / 10;\n current.val = value % 10;\n ListNode temp = new ListNode(overflow);\n temp.next = current;\n current = temp;\n }\n return current.val == 0 ? current.next : current;\n}", "public T pop() {\r\n\t\t\r\n\t\tT numPila = this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\tfor (StackObserver<T> o : observers )\r\n\t\t\to.onPop(numPila);\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\treturn numPila;\r\n\t\t\r\n\t\t//return this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\t\r\n\t}", "public T pop(){ \r\n \t--this.size;\r\n \treturn stack1.pop();\r\n }", "static void stack_pop(Stack<Integer> stack)\r\n\t{\r\n\t\t\r\n\t\tSystem.out.print(\"Pop : \");\r\n\t\tfor(int i=0;i<5;i++)\r\n\t\t{\r\n\t\t\tInteger dataElement=(Integer)stack.pop();\r\n\t\t\tSystem.out.print(\" \"+ dataElement);\r\n\t\t\t\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}", "public T push(T data){\r\n \tboolean sorted = false;\r\n \twhile(!sorted) {\r\n \t\tif(stack1.empty() || data.compareTo(stack1.peek()) < 0) {\r\n \t\t\tstack2.push(data);\r\n \t\t\tsorted = true;\r\n \t\t}else {\r\n \t\t\tstack2.push(stack1.pop());\r\n \t\t}\r\n \t}\r\n \twhile(stack1.size() > 0) {\r\n \t\tstack2.push(stack1.pop());\r\n \t}\r\n \twhile(stack2.size() > 0) {\r\n \t\tstack1.push(stack2.pop());\r\n \t}\r\n \t++this.size;\r\n \treturn data;\r\n }", "public void pop()\n {\n this.top = this.top.getNext();\n }", "public int pop() throws EmptyStackException{\n //To be written by student\n if(top==-1){\n System.out.println(\"Stack is Empty!\");\n throw new EmptyStackException();\n }\n else if(localSize==A.getSize()/2){\n \tint tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n A.halveSize();\n return tp;\n }\n else{ int tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n \n return tp;\n }\n }", "public T pop() { //pop = remove the last element added to the array, in a stack last in, first out (in a queue pop and push from different ends)\n try {\n T getOut = (T) myCustomStack[numElements - 1]; //variable for element to remove (pop off) = last element (if you have 7 elements, the index # is 6)\n myCustomStack[numElements] = null; //remove element by making it null\n numElements--; //remove last element, decrease the numElements\n return getOut; //return popped number\n\n } catch (Exception exc) {\n System.out.println(\"Can't pop from empty stack!\");\n return null;\n }\n }", "int pop1(TwoStack sq)\n {\n if(sq.top1>=0)\n {\n int yo=sq.arr[sq.top1];\n sq.top1--;\n return yo;\n }\n else\n {\n return -1;\n }\n \n }", "public void pop() {\n\t\tif(stackTmp.isEmpty()){\n\t\t\twhile(!stack.isEmpty()){\n\t\t\t\tint tmp = stack.peek();\n\t\t\t\tstackTmp.push(tmp);\n\t\t\t\tstack.pop();\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tstackTmp.pop();\n\t\t}\n\t}", "private T pop(Node topNode)\n {\n if (isEmpty())\n {\n return null;\n }\n else // not empty\n {\n T result = (T) topNode.getData();\n first = topNode.getNextNode();\n return result;\n }\n }", "public int pop() {\n if (!s2.empty()) {\n return s2.pop();\n } else {\n while (!s1.empty()) {\n s2.push(s1.pop());\n }\n return s2.pop();\n }\n }", "public static void main(String[] args) {\n \n \n \n Stack st = new Stack();\n st.push(40);\n st.push(30);\n \n int poppedElement = (int) st.pop();\n System.out.println(poppedElement);\n \n \n \n }", "private static void push(Stack<Integer> top_ref, int new_data) {\n //Push the data onto the stack\n top_ref.push(new_data);\n }", "public int pop() {\n\t\tif (isEmpty())\n\t\t\treturn NEGATIVE_ONE;\n\t\tint ret = last.value;\n\t\tlast = last.prev;\n\t\treturn ret;\n\t}", "@Override\r\n\tpublic T top() throws StackUnderflowException{\r\n\t\tif (!isEmpty()) {\r\n\t\t\tT e = stack.get(size()-1);\r\n\t\t\treturn e;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthrow new StackUnderflowException();\r\n\t\t}\r\n\t}", "public int pop() throws IndexOutOfBoundsException {\n try {\n for (int i = size() - 1; i >= 0; i--) { // Iterate backwards\n if (this.values[i] != 0) { // First occurance of value\n int oldvalue = this.values[i];\n this.values[i] = 0; // Set to 0\n this.size--;\n return oldvalue;\n }\n }\n\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n\n } catch (Exception e) {\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n }\n }", "public int pop() {\n /**\n * 将stack中所有元素逆序保存到otherStack中后弹出otherStack栈顶元素\n */\n while (!stack.isEmpty()) {\n otherStack.push(stack.pop());\n }\n return otherStack.pop();\n }", "public void pop() {\n if(stack.pop() == min)\n min=stack.pop();\n }", "public int peek(int valueIfEmpty) {\n\t\t\tif (storedValues > 0) {\n\t\t\t\treturn stack[bottom];\n\t\t\t}\n\t\t\treturn valueIfEmpty;\n\t\t}" ]
[ "0.68377626", "0.6803724", "0.6747728", "0.6344156", "0.6331312", "0.6324791", "0.62872905", "0.6274577", "0.6266223", "0.62451106", "0.6237114", "0.623234", "0.61845", "0.6169413", "0.6142062", "0.6141208", "0.6125802", "0.61072373", "0.60982776", "0.609537", "0.6073347", "0.60680807", "0.6052387", "0.60474104", "0.6043057", "0.60371274", "0.60271287", "0.6009613", "0.60015047", "0.60006356", "0.59824735", "0.5974733", "0.59675705", "0.59649456", "0.59524035", "0.59428257", "0.59337926", "0.592613", "0.5892032", "0.5888017", "0.5886703", "0.58739525", "0.5860405", "0.5852685", "0.5835458", "0.58041996", "0.5791222", "0.5784217", "0.57816666", "0.5778162", "0.5767329", "0.5758771", "0.5758483", "0.5755058", "0.575373", "0.5752055", "0.57458454", "0.5742993", "0.57393265", "0.5738557", "0.57271147", "0.5718871", "0.5701397", "0.5699625", "0.5690713", "0.568251", "0.5679317", "0.5664285", "0.56623703", "0.56620944", "0.56592613", "0.5654663", "0.56524336", "0.56335175", "0.5632567", "0.562796", "0.56278586", "0.56277823", "0.5625819", "0.5622136", "0.56049496", "0.56023306", "0.5600271", "0.56000155", "0.5593124", "0.55929154", "0.5591225", "0.558895", "0.55823296", "0.55805767", "0.5578153", "0.5572257", "0.55640084", "0.5562903", "0.5561806", "0.55530274", "0.5551992", "0.5550134", "0.554362", "0.55381453" ]
0.6692639
3
pop the top 2 values and add them and push the result onto the value stack
@Override public void step(final EvaluationContext theContext) { // pop the top 2 values and add them // and push the result onto the value stack // final Double theSecondOperand = theContext.popValue(); final Double theFirstOperand = theContext.popValue(); theContext.pushValue(theFirstOperand - theSecondOperand); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public final void add() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue + topMostValue);\n\t\t}\n\t}", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand + theSecondOperand);\n }", "private void uminus() throws Exception{\n\t\tif(stackEmpty()) throw new Exception(\"Stack ist leer\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tstack.push(value1*(-1));\n\t\t}\n\t\t\n\t}", "public int pop() {\r\n LinkedList<Integer> queue = new LinkedList<>();\r\n int value = stack.poll();\r\n while(!stack.isEmpty()){\r\n queue.offer(value);\r\n value = stack.poll();\r\n }\r\n stack = queue;\r\n return value;\r\n }", "public void pop() {\r\n \t Queue<Integer> temp=new LinkedList<Integer>();\r\n \t int counter=0;\r\n \t while(!stack.isEmpty()){\r\n \t temp.add((Integer) stack.poll());\r\n \t counter++;\r\n \t \r\n \t }\r\n \t while(counter>1)\r\n \t {\r\n \t \r\n \t stack.add(temp.poll());\r\n \t counter--;\r\n \t }\r\n }", "public double pop()\n {\n if (empty()) {\n \tthrow new IllegalArgumentException(\"too many operators!\");\n \t\n }\n else\n {\n return s[top--];\n }\n }", "private void addition() throws Exception {\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.peek();\n\t\t\tstack.push(value2+value1);\n\t\t}\n\t\t\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand * theSecondOperand);\n }", "int pop2(TwoStack sq)\n {\n if(sq.top2<sq.size)\n {\n int yo2=sq.arr[sq.top2];\n sq.top2++;\n return yo2;\n }\n else\n {\n return -1;\n }\n \n }", "private void addRValueToStack (){\n if (numStack.size() < 23){\n numStack.push(rValues[rCount]);\n if(rCount< rValues.length){ // cycles through the 'r' values\n rCount++;\n }\n else{ \n rCount=0; // if end of r values reached, rCount is set to 0.\n }\n }\n else {\n System.out.println(\"Stack overflow.\"); \n }\n }", "public ExParValue pop() {\r\n\t\tExParValue v = null;\r\n\t\tif (value.next != null) {\r\n\t\t\tv = value;\r\n\t\t\tvalue = value.next;\r\n\t\t\t// System.out.println(\"ExPar.pop() Popping \" + v.toString() +\r\n\t\t\t// \" now on top: \" + value.toString());\r\n\t\t} else {\r\n\t\t\tnew ParameterValueError(\"ExPar.pop() without preceding push()\");\r\n\t\t}\r\n\t\t/*\r\n\t\t * if (value == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack empty.\"); } else if\r\n\t\t * (value.next == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): A single value is on the stack: \" +\r\n\t\t * value.toString()); } else {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack: \" + value.toString() +\r\n\t\t * \", \" + value.next.toString()); }\r\n\t\t */\r\n\t\treturn (v);\r\n\t}", "public int pop() { //第二个栈为空 , 就将第一个栈的数据往第二个里面加\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n return temp2.pop(); //不管是否为空,直接pop第二个栈\n }", "public int top() {\r\n Queue<Integer> temp=new LinkedList<Integer>();\r\n int counter=0;\r\n while(!stack.isEmpty()){\r\n temp.add((Integer) stack.poll());\r\n counter++;\r\n \r\n }\r\n while(counter>1)\r\n {\r\n \r\n stack.add(temp.poll());\r\n counter--;\r\n }\r\n int topInteger=temp.poll();\r\n stack.add(topInteger);\r\n return topInteger;\r\n \r\n }", "public int top() {\n if(!stack2.isEmpty()) {\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n }", "public int pop() {\n int result;\n while(!stack.isEmpty()){\n cache.add(stack.removeLast());\n }\n result = cache.removeLast();\n while(!cache.isEmpty()){\n stack.add(cache.removeLast());\n }\n System.out.println(result);\n return result;\n }", "public final void max() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t} else {\n\t\t\t\tpush(topMostValue);\n\t\t\t}\n\t\t}\n\t}", "int pop2()\n {\n if(top2 == size) {\n System.out.println(\"Second Stack is empty.\");\n return -1;\n }\n\n int popped = arr[top2];\n ++top2;\n return popped;\n }", "@Override\n\tpublic int pop() {\n\t\tint topValue;\n\t\tif (top != -1) {\n\t\t\ttopValue = intContainer[top];\n\t\t\ttop = top - 1;\n\t\t\treturn topValue;\n\t\t} else {\n\t\t\tSystem.out.println(\"Stack Undeflow\");\n\t\t\treturn -1;\n\t\t}\n\t}", "int pop2(TwoStack sq) {\n if (sq.top2 < sq.size) {\n int x = sq.arr[sq.top2];\n sq.top2++;\n return x;\n } else {\n return -1;\n }\n }", "private void minus() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value2-value1);\n\t\t}\n\t}", "public Integer pop() \n\t{ \n\t\tint x = super.pop(); \n\t\tmin.pop(); \n\t\treturn x; \n\t}", "public int pop() {\n int value = top.value;\n top = top.pre;\n top.next = null;\n size--;\n return value;\n }", "public final void swap() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(topMostValue);\n\t\t\tpush(secondTopMostValue);\n\t\t}\n\t}", "int pop() {\r\n\t\ttop--;\r\n\t\treturn stack[top];\r\n\t}", "void push2(int x) {\n --top2;\n if(top2 == size / 2) {\n System.out.println(\"Second stack is full\");\n return;\n }\n arr[top2] = x;\n }", "public int pop(){\n \tint data=0;\n \tif(isEmpty())\n \tSystem.out.println(\"Stack is underflow\");\n \telse\n \tdata=elements[top--];\n \treturn data;\n\t}", "@Test\n public void testThreePushPop(){\n ms = new MyStack();\n int pn1=3, pn2=4, pn3=5;\n ms.push(pn1);\n ms.push(pn2);\n ms.push(pn3);\n assertEquals(pn3,ms.pop());\n assertEquals(pn2,ms.pop());\n assertEquals(pn1,ms.pop());\n }", "public int pop(){\n if (isEmpty()) throw new RuntimeException(\"Stack underflow\");\n int tmp=myarray[top];\n top--;\n return tmp;\n \n \n }", "public final void rot() {\n\t\tif (size > 2) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tdouble thirdTopMostValue = pop();\n\n\t\t\tpush(secondTopMostValue);\n\t\t\tpush(topMostValue);\n\t\t\tpush(thirdTopMostValue);\n\n\t\t}\n\t}", "private void multiple() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value1*value2);\n\t\t}\n\t}", "public int pop() {\n while (!push.isEmpty()){\n pull.push(push.pop());\n }\n int result= pull.pop();\n while (!pull.isEmpty()){\n push.push(pull.pop());\n }\n return result;\n }", "private void topEval(Stack<Operator> pOperatorStack, Stack<Operand> pOperandStack) {\n Operand right = pOperandStack.pop();\n Operator operator = pOperatorStack.pop();\n if (operator instanceof UnaryOperator) {\n pOperandStack.push(((UnaryOperator)operator).evaluate(right));\n } else {\n Operand left = pOperandStack.pop();\n pOperandStack.push(((BinaryOperator)operator).evaluate(left, right));\n }\n }", "int pop() \r\n {\n if(top < 0)\r\n {\r\n System.out.println(\"Stack Underflow Occurred!\");\r\n return -1;\r\n }\r\n //Write your code here\r\n int p = a[top];\r\n top--;\r\n return p; \r\n }", "public int pop(int valueIfEmpty) {\n\t\t\tif (isEmpty()) {\n\t\t\t\treturn valueIfEmpty;\n\t\t\t}\n\n\t\t\tstoredValues--;\n\t\t\tint result = stack[bottom++];\n\n\t\t\tif (bottom == capacity) {\n\t\t\t\tbottom = 0;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "private static int pop(Stack<Integer> top_ref) {\n /*If stack is empty then error */\n if (top_ref.isEmpty()) {\n System.out.println(\"Stack Underflow\");\n System.exit(0);\n }\n //pop the data from the stack\n return top_ref.pop();\n }", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand / theSecondOperand);\n }", "public void push(int value){\n //To be written by student\n localSize++;\n top++;\n if(localSize>A.getSize()){\n A.doubleSize();\n try{\n A.modifyElement(value,top);\n }catch(Exception c){c.printStackTrace();}\n }\n else{try{\n A.modifyElement(value,top);\n }catch(Exception a){a.printStackTrace();} }\n }", "int pop() {\n if (data.size() == 1) {\r\n min = 0;\r\n return data.pop();\r\n }\r\n else if (data.size() > 1) {\r\n int val = data.peek();\r\n if (val < min) {\r\n val = min;\r\n min = min * 2 - data.peek();\r\n data.pop();\r\n return val;\r\n }\r\n return data.pop();\r\n }\r\n else {\r\n System.out.println(\"Stack underflow\");\r\n return -1;\r\n }\r\n }", "public T pop() {\n \tT retVal = stack.get(stack.size() - 1); // get the value at the top of the stack\n \tstack.remove(stack.size() - 1); // remove the value at the top of the stack\n \treturn retVal;\n }", "public int pop(){\n if (top==null) throw new EmptyStackException();\n int data = top.data;\n top=top.next;\n return data;\n }", "public int top() {\r\n int value = this.pop();\r\n this.stack.offer(value);\r\n return value;\r\n }", "int pop()\n\t{\n // Your code here\n if(top == -1){\n return -1;\n }\n int x = arr[top];\n top--;\n return x;\n\t}", "public int pop() {\n if (stk2.isEmpty()) {\n while (!stk1.isEmpty())\n stk2.push(stk1.pop());\n }\n return stk2.pop();\n }", "public final double pop() {\n\t\tdouble returnValue = defaultValue;\n\n\t\tif (!isEmpty()) {\n\n\t\t\tdouble value = stack[index];\n\t\t\tindex--;\n\t\t\tsize--;\n\t\t\treturnValue = value;\n\t\t}\n\n\t\treturn returnValue;\n\t}", "public int top() {\n // Write your code here\n int ret = 0;\n if (!queue1.isEmpty()) {\n while (queue1.size() > 1) {\n queue2.offer(queue1.poll());\n }\n ret = queue1.peek();\n queue2.offer(queue1.poll());\n } else if (!queue2.isEmpty()) {\n while (queue2.size() > 1) {\n queue1.offer(queue2.poll());\n }\n ret = queue2.peek();\n queue1.offer(queue2.poll());\n }\n return ret;\n }", "public void push(int value) {\n\t\t\tif (storedValues == capacity) {\n\t\t\t\ttop = bottom;\n\t\t\t\tbottom++;\n\t\t\t\tif (bottom == capacity) {\n\t\t\t\t\tbottom = 0;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstoredValues++;\n\t\t\t}\n\n\t\t\tif (top == capacity) {\n\t\t\t\ttop = 0;\n\t\t\t}\n\n\t\t\tstack[top++] = value;\n\t\t}", "void push2(int x, TwoStack sq)\n {\n \n if(sq.top2>sq.size/2)\n {\n sq.top2--;\n sq.arr[sq.top2]=x;\n }\n \n }", "private synchronized BackStep pop() {\r\n\t\t\tBackStep bs;\r\n\t\t\tbs = stack[top];\r\n\t\t\tif (size == 1) {\r\n\t\t\t\ttop = -1;\r\n\t\t\t} else {\r\n\t\t\t\ttop = (top + capacity - 1) % capacity;\r\n\t\t\t}\r\n\t\t\tsize--;\r\n\t\t\treturn bs;\r\n\t\t}", "public final void mod() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue > 0) {\n\t\t\t\tpush(secondTopMostValue % topMostValue);\n\t\t\t}\n\t\t}\n\t}", "static int pop(Stack<Integer> top_ref) {\r\n /* If stack is empty then error */\r\n if (top_ref.isEmpty()) {\r\n System.out.println(\"Stack Underflow\");\r\n System.exit(0);\r\n }\r\n\r\n // pop the data from the stack\r\n return top_ref.pop();\r\n }", "void pop() {\n // -\n top = top.getNextNode();\n }", "void push2(int x, TwoStack sq) {\n if (sq.top1 < sq.top2 - 1) {\n sq.top2--;\n sq.arr[sq.top2] = x;\n }\n }", "public void pop() {\n\t List<Integer> temp = new ArrayList<>();\n\t Integer last = null;\n\t first = null;\n\t \n\t do{\n\t last = s.pop();\n\t if(s.isEmpty()){\n\t break;\n\t }\n\t first = last;\n\t temp.add(last);\n\t \n\t }while (true);\n\t \n\t for(int i = temp.size()-1; i >=0; i--){\n\t s.push(temp.get(i));\n\t }\n\t \n\t}", "public void pop() throws StackUnderflowException;", "private void stackPopElements(int height,int p){\n\t\tint recEnd = p-1;\n\t\tint size;\n\t\t//again, for the equal case; we pop element that equal to height in the stack; cause it's not useful anymore.\n\t\t// and also, we don't need to calc the value for it, cause it's guaranteed no the best value yet;\n\t\twhile(!hStack.isEmpty()&&hStack.peek()>=height){\n\t\t\tint sh = hStack.pop();\n\t\t\tint sp = pStack.pop();\n//\t\t\tSystem.out.println(\"------------- sh and sp is: \"+sh+\" sp:\"+sp+\" size left is: \"+pStack.size());\n\t\t\t\n\t\t\tint start;\n\t\t\tif(sh==height){\n\t\t\t\t//ignore;\n\t\t\t}else{\n\t\t\t\tif(pStack.isEmpty()){\n\t\t\t\t\tstart = 0;\n\t\t\t\t}else{\n\t\t\t\t\tstart = pStack.peek()+1; // element smaller than this height is at this position;\n\t\t\t\t}\n\t\t\t\tsize = (p-start)*sh; // size is width*height;\n//\t\t\t\tSystem.out.println(\" height : \"+sh+\" size: \"+size);\n//\t\t\t\tSystem.out.println(\" p and start : \"+p+\" start:\"+start);\n\t\t\t\tif(size>max){\n\t\t\t\t\t// also can record other things if we want;\n\t\t\t\t\tmax = size; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int pop() {\n q1.remove();\n int res = top;\n if (!q1.isEmpty()) {\n top = q1.peek();\n }\n return res;\n }", "public void pop(){\n \n if(top==null) System.out.println(\"stack is empty\");\n else top=top.next;\n \t\n }", "void push(int val) {\n if (data.size() == 0) {\r\n data.push(val);\r\n min = val;\r\n }\r\n else {\r\n if (val <= min) {\r\n data.push(val * 2 - min);\r\n min = val;\r\n }\r\n else\r\n data.push(val);\r\n }\r\n }", "public void pop() {\n s2.pop();\n temp = (Stack<Integer>) s2.clone();\n s1.clear();\n while (!temp.isEmpty()) {\n s1.push(temp.pop());\n }\n }", "public int pop() {\n int res= q1.remove();\n if (!q1.isEmpty())\n top = q1.peek();\n return res;\n }", "public int pop() {\n if (isEmpty()) {\n throw new IllegalStateException(\"Der Stack ist leer.\");\n }\n if((values.length / 2) >= size) {\t\t\t\t// Überprüfen, ob das Array nicht zu groß ist und ob nicht die Hälfte auch reicht\n \tint[] save = this.values;\t\t\t\t\t// sichere altes Array\n \tthis.values = new int[save.length / 2];\t\t// verkleinere values Array\n \tfor (int i = 0; i < values.length; i++) {\t// kopiere die alten Werte in das neue Array\n \t\tvalues[i] = save[i];\n \t}\n }\n int save = values[size-1];\n values[--size] = 0;\n return save;\n }", "public T pop() {\n\t\tT value = null;\n\t\tif (!isEmpty()) {\n\t\t\ttop = top.next;\n\t\t\tvalue = top.value;\n\t\t}\n\t\treturn value; // returning popped value\n\t}", "public void popAllStacks(){\n // if top is lost then all elements are lost.\n top = null;\n }", "@Test\n public void testTop() {\n System.out.println(\"top\");\n Stack2 instance = new Stack2();\n int expResult = 7;\n instance.push(7);\n int result = instance.top();\n assertEquals(expResult, result);\n }", "public int peek() { //使用栈的peek\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n int data = temp2.peek() ;\n return data; \n }", "public int pop() {\n if (this.stack2.empty()) {\n while (!this.stack1.empty()) {\n this.stack2.push(this.stack1.pop());\n }\n }\n if (!this.stack2.empty()) {\n return this.stack2.pop();\n }\n return -1;\n\n }", "public void pop(){\n // check if there is any stack present or not\n if(this.arr==null){\n System.out.println(\"No stack present, first create a stack\");\n return;\n }\n // check if stack is empty\n if(this.topOfStack==-1){\n System.out.println(\"Stack is empty, can't pop from stack\");\n return;\n }\n // if stack is not empty\n this.arr[this.topOfStack]=Integer.MIN_VALUE;\n this.topOfStack--;\n }", "public int pop() {\n if(!stack2.isEmpty()) return stack2.pop();\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n return stack2.pop();\n }\n }", "public static int sumOfStack2(Deque<Integer> stack) {\n\t int sum = 0;\n\t while(!stack.isEmpty()) {\n\t \tsum += stack.pop();\n\t }\n\t return sum;\n\t}", "public final void min() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(topMostValue);\n\t\t\t} else {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t}\n\t\t}\n\t}", "public final void dup() {\n\t\tif (size > 0) {\n\t\t\tdouble topMostValue = stack[index];\n\t\t\tpush(topMostValue);\n\t\t}\n\t}", "public void pop()\r\n\t{\r\n\t\ttop--;\r\n\t\tstack[top] = null;\r\n\t}", "public E pop()\n {\n E topVal = stack.removeFirst();\n return topVal;\n }", "public int pop() {\n while (!s1.isEmpty()) {\n s2.push(s1.pop());\n }\n int pop = s2.pop();\n while (!s2.isEmpty()) {\n s1.push(s2.pop());\n }\n return pop;\n }", "public void push(T value) {\n top = new Entry<>(value, top); // diamond operator (syntactic sugar)\n }", "public void sumValues(){\n\t\tint index = 0;\n\t\tDouble timeIncrement = 2.0;\n\t\tDouble timeValue = time.get(index);\n\t\tDouble packetValue;\n\t\twhile (index < time.size()){\n\t\t\tDouble packetTotal = 0.0;\n\t\t\twhile (timeValue < timeIncrement && index < packets.size()){\n\t\t\t\ttimeValue = time.get(index);\n\t\t\t\tpacketValue = packets.get(index);\n\t\t\t\tpacketTotal= packetTotal + packetValue;\n\t\t\t\tindex = index + 1;\n\t\t\t}\n\t\t\tArrayList<Double> xy = new ArrayList<Double>();\n\t\t\txy.add(timeIncrement);\n\t\t\txy.add(packetTotal);\n\t\t\ttotalIncrements.add(xy);\n\t\t\t// to get max and min need separate arrays\n\t\t\ttimeIncrements.add(timeIncrement);\n\t\t\tbyteIncrements.add(packetTotal);\n\t\t\ttimeIncrement = timeIncrement + 2.0;\t\n\t\t}\n\t\treturn;\n\n\t}", "public int pop() {\n\n if (top > 0) {\n top --;\n }\n else {\n System.out.println(\"Stack Underflow\");\n return -100;\n }\n return stack[top];\n }", "public ValueWrapper pop(String keyName) {\n\t\tif(isEmpty(keyName)) {\n\t\t\tthrow new EmptyStackException();\n\t\t}\n\t\tvar value = multistack.get(keyName);\n\t\tif(value.next != null) {\n\t\t\tmultistack.put(keyName, value.next);\n\t\t}\n\t\telse {\n\t\t\tmultistack.remove(keyName);\n\t\t}\n\t\treturn value.value;\n\t}", "void push(int a)\n\t{\n\t // Your code here\n\t top++;\n\t arr[top]=a;\n\t}", "public ListNode addTwoNumbers(ListNode l1, ListNode l2) {\n Stack<Integer> s1 = new Stack<>();\n Stack<Integer> s2 = new Stack<>();\n while (l1 != null) {\n s1.push(l1.val);\n l1 = l1.next;\n }\n while (l2 != null) {\n s2.push(l2.val);\n l2 = l2.next;\n }\n ListNode current = new ListNode(0);\n int overflow = 0;\n while (!s1.empty() || !s2.empty()) {\n int x = (!s1.empty()) ? s1.pop() : 0;\n int y = (!s2.empty()) ? s2.pop() : 0;\n int value = overflow + x + y;\n overflow = value / 10;\n current.val = value % 10;\n ListNode temp = new ListNode(overflow);\n temp.next = current;\n current = temp;\n }\n return current.val == 0 ? current.next : current;\n}", "public T pop() {\r\n\t\t\r\n\t\tT numPila = this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\tfor (StackObserver<T> o : observers )\r\n\t\t\to.onPop(numPila);\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\treturn numPila;\r\n\t\t\r\n\t\t//return this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\t\r\n\t}", "public T pop(){ \r\n \t--this.size;\r\n \treturn stack1.pop();\r\n }", "static void stack_pop(Stack<Integer> stack)\r\n\t{\r\n\t\t\r\n\t\tSystem.out.print(\"Pop : \");\r\n\t\tfor(int i=0;i<5;i++)\r\n\t\t{\r\n\t\t\tInteger dataElement=(Integer)stack.pop();\r\n\t\t\tSystem.out.print(\" \"+ dataElement);\r\n\t\t\t\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}", "public T push(T data){\r\n \tboolean sorted = false;\r\n \twhile(!sorted) {\r\n \t\tif(stack1.empty() || data.compareTo(stack1.peek()) < 0) {\r\n \t\t\tstack2.push(data);\r\n \t\t\tsorted = true;\r\n \t\t}else {\r\n \t\t\tstack2.push(stack1.pop());\r\n \t\t}\r\n \t}\r\n \twhile(stack1.size() > 0) {\r\n \t\tstack2.push(stack1.pop());\r\n \t}\r\n \twhile(stack2.size() > 0) {\r\n \t\tstack1.push(stack2.pop());\r\n \t}\r\n \t++this.size;\r\n \treturn data;\r\n }", "public void pop()\n {\n this.top = this.top.getNext();\n }", "public int pop() throws EmptyStackException{\n //To be written by student\n if(top==-1){\n System.out.println(\"Stack is Empty!\");\n throw new EmptyStackException();\n }\n else if(localSize==A.getSize()/2){\n \tint tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n A.halveSize();\n return tp;\n }\n else{ int tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n \n return tp;\n }\n }", "public T pop() { //pop = remove the last element added to the array, in a stack last in, first out (in a queue pop and push from different ends)\n try {\n T getOut = (T) myCustomStack[numElements - 1]; //variable for element to remove (pop off) = last element (if you have 7 elements, the index # is 6)\n myCustomStack[numElements] = null; //remove element by making it null\n numElements--; //remove last element, decrease the numElements\n return getOut; //return popped number\n\n } catch (Exception exc) {\n System.out.println(\"Can't pop from empty stack!\");\n return null;\n }\n }", "int pop1(TwoStack sq)\n {\n if(sq.top1>=0)\n {\n int yo=sq.arr[sq.top1];\n sq.top1--;\n return yo;\n }\n else\n {\n return -1;\n }\n \n }", "public void pop() {\n\t\tif(stackTmp.isEmpty()){\n\t\t\twhile(!stack.isEmpty()){\n\t\t\t\tint tmp = stack.peek();\n\t\t\t\tstackTmp.push(tmp);\n\t\t\t\tstack.pop();\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tstackTmp.pop();\n\t\t}\n\t}", "private T pop(Node topNode)\n {\n if (isEmpty())\n {\n return null;\n }\n else // not empty\n {\n T result = (T) topNode.getData();\n first = topNode.getNextNode();\n return result;\n }\n }", "public int pop() {\n if (!s2.empty()) {\n return s2.pop();\n } else {\n while (!s1.empty()) {\n s2.push(s1.pop());\n }\n return s2.pop();\n }\n }", "public static void main(String[] args) {\n \n \n \n Stack st = new Stack();\n st.push(40);\n st.push(30);\n \n int poppedElement = (int) st.pop();\n System.out.println(poppedElement);\n \n \n \n }", "private static void push(Stack<Integer> top_ref, int new_data) {\n //Push the data onto the stack\n top_ref.push(new_data);\n }", "public int pop() {\n\t\tif (isEmpty())\n\t\t\treturn NEGATIVE_ONE;\n\t\tint ret = last.value;\n\t\tlast = last.prev;\n\t\treturn ret;\n\t}", "@Override\r\n\tpublic T top() throws StackUnderflowException{\r\n\t\tif (!isEmpty()) {\r\n\t\t\tT e = stack.get(size()-1);\r\n\t\t\treturn e;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthrow new StackUnderflowException();\r\n\t\t}\r\n\t}", "public int pop() throws IndexOutOfBoundsException {\n try {\n for (int i = size() - 1; i >= 0; i--) { // Iterate backwards\n if (this.values[i] != 0) { // First occurance of value\n int oldvalue = this.values[i];\n this.values[i] = 0; // Set to 0\n this.size--;\n return oldvalue;\n }\n }\n\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n\n } catch (Exception e) {\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n }\n }", "public int pop() {\n /**\n * 将stack中所有元素逆序保存到otherStack中后弹出otherStack栈顶元素\n */\n while (!stack.isEmpty()) {\n otherStack.push(stack.pop());\n }\n return otherStack.pop();\n }", "public void pop() {\n if(stack.pop() == min)\n min=stack.pop();\n }", "public int peek(int valueIfEmpty) {\n\t\t\tif (storedValues > 0) {\n\t\t\t\treturn stack[bottom];\n\t\t\t}\n\t\t\treturn valueIfEmpty;\n\t\t}" ]
[ "0.6803724", "0.6747728", "0.6692639", "0.6344156", "0.6331312", "0.6324791", "0.62872905", "0.6274577", "0.6266223", "0.62451106", "0.6237114", "0.623234", "0.61845", "0.6169413", "0.6142062", "0.6141208", "0.6125802", "0.61072373", "0.60982776", "0.609537", "0.6073347", "0.60680807", "0.6052387", "0.60474104", "0.6043057", "0.60371274", "0.60271287", "0.6009613", "0.60015047", "0.60006356", "0.59824735", "0.5974733", "0.59675705", "0.59649456", "0.59524035", "0.59428257", "0.59337926", "0.592613", "0.5892032", "0.5888017", "0.5886703", "0.58739525", "0.5860405", "0.5852685", "0.5835458", "0.58041996", "0.5791222", "0.5784217", "0.57816666", "0.5778162", "0.5767329", "0.5758771", "0.5758483", "0.5755058", "0.575373", "0.5752055", "0.57458454", "0.5742993", "0.57393265", "0.5738557", "0.57271147", "0.5718871", "0.5701397", "0.5699625", "0.5690713", "0.568251", "0.5679317", "0.5664285", "0.56623703", "0.56620944", "0.56592613", "0.5654663", "0.56524336", "0.56335175", "0.5632567", "0.562796", "0.56278586", "0.56277823", "0.5625819", "0.5622136", "0.56049496", "0.56023306", "0.5600271", "0.56000155", "0.5593124", "0.55929154", "0.5591225", "0.558895", "0.55823296", "0.55805767", "0.5578153", "0.5572257", "0.55640084", "0.5562903", "0.5561806", "0.55530274", "0.5551992", "0.5550134", "0.554362", "0.55381453" ]
0.68377626
0
pop the top 2 values and add them and push the result onto the value stack
@Override public void step(final EvaluationContext theContext) { // pop the top 2 values and add them // and push the result onto the value stack // final Double theSecondOperand = theContext.popValue(); final Double theFirstOperand = theContext.popValue(); theContext.pushValue(theFirstOperand * theSecondOperand); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand - theSecondOperand);\n }", "public final void add() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue + topMostValue);\n\t\t}\n\t}", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand + theSecondOperand);\n }", "private void uminus() throws Exception{\n\t\tif(stackEmpty()) throw new Exception(\"Stack ist leer\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tstack.push(value1*(-1));\n\t\t}\n\t\t\n\t}", "public int pop() {\r\n LinkedList<Integer> queue = new LinkedList<>();\r\n int value = stack.poll();\r\n while(!stack.isEmpty()){\r\n queue.offer(value);\r\n value = stack.poll();\r\n }\r\n stack = queue;\r\n return value;\r\n }", "public void pop() {\r\n \t Queue<Integer> temp=new LinkedList<Integer>();\r\n \t int counter=0;\r\n \t while(!stack.isEmpty()){\r\n \t temp.add((Integer) stack.poll());\r\n \t counter++;\r\n \t \r\n \t }\r\n \t while(counter>1)\r\n \t {\r\n \t \r\n \t stack.add(temp.poll());\r\n \t counter--;\r\n \t }\r\n }", "public double pop()\n {\n if (empty()) {\n \tthrow new IllegalArgumentException(\"too many operators!\");\n \t\n }\n else\n {\n return s[top--];\n }\n }", "private void addition() throws Exception {\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.peek();\n\t\t\tstack.push(value2+value1);\n\t\t}\n\t\t\n\t}", "int pop2(TwoStack sq)\n {\n if(sq.top2<sq.size)\n {\n int yo2=sq.arr[sq.top2];\n sq.top2++;\n return yo2;\n }\n else\n {\n return -1;\n }\n \n }", "private void addRValueToStack (){\n if (numStack.size() < 23){\n numStack.push(rValues[rCount]);\n if(rCount< rValues.length){ // cycles through the 'r' values\n rCount++;\n }\n else{ \n rCount=0; // if end of r values reached, rCount is set to 0.\n }\n }\n else {\n System.out.println(\"Stack overflow.\"); \n }\n }", "public ExParValue pop() {\r\n\t\tExParValue v = null;\r\n\t\tif (value.next != null) {\r\n\t\t\tv = value;\r\n\t\t\tvalue = value.next;\r\n\t\t\t// System.out.println(\"ExPar.pop() Popping \" + v.toString() +\r\n\t\t\t// \" now on top: \" + value.toString());\r\n\t\t} else {\r\n\t\t\tnew ParameterValueError(\"ExPar.pop() without preceding push()\");\r\n\t\t}\r\n\t\t/*\r\n\t\t * if (value == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack empty.\"); } else if\r\n\t\t * (value.next == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): A single value is on the stack: \" +\r\n\t\t * value.toString()); } else {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack: \" + value.toString() +\r\n\t\t * \", \" + value.next.toString()); }\r\n\t\t */\r\n\t\treturn (v);\r\n\t}", "public int pop() { //第二个栈为空 , 就将第一个栈的数据往第二个里面加\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n return temp2.pop(); //不管是否为空,直接pop第二个栈\n }", "public int top() {\r\n Queue<Integer> temp=new LinkedList<Integer>();\r\n int counter=0;\r\n while(!stack.isEmpty()){\r\n temp.add((Integer) stack.poll());\r\n counter++;\r\n \r\n }\r\n while(counter>1)\r\n {\r\n \r\n stack.add(temp.poll());\r\n counter--;\r\n }\r\n int topInteger=temp.poll();\r\n stack.add(topInteger);\r\n return topInteger;\r\n \r\n }", "public int top() {\n if(!stack2.isEmpty()) {\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n }", "public int pop() {\n int result;\n while(!stack.isEmpty()){\n cache.add(stack.removeLast());\n }\n result = cache.removeLast();\n while(!cache.isEmpty()){\n stack.add(cache.removeLast());\n }\n System.out.println(result);\n return result;\n }", "public final void max() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t} else {\n\t\t\t\tpush(topMostValue);\n\t\t\t}\n\t\t}\n\t}", "int pop2()\n {\n if(top2 == size) {\n System.out.println(\"Second Stack is empty.\");\n return -1;\n }\n\n int popped = arr[top2];\n ++top2;\n return popped;\n }", "@Override\n\tpublic int pop() {\n\t\tint topValue;\n\t\tif (top != -1) {\n\t\t\ttopValue = intContainer[top];\n\t\t\ttop = top - 1;\n\t\t\treturn topValue;\n\t\t} else {\n\t\t\tSystem.out.println(\"Stack Undeflow\");\n\t\t\treturn -1;\n\t\t}\n\t}", "int pop2(TwoStack sq) {\n if (sq.top2 < sq.size) {\n int x = sq.arr[sq.top2];\n sq.top2++;\n return x;\n } else {\n return -1;\n }\n }", "private void minus() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value2-value1);\n\t\t}\n\t}", "public Integer pop() \n\t{ \n\t\tint x = super.pop(); \n\t\tmin.pop(); \n\t\treturn x; \n\t}", "public int pop() {\n int value = top.value;\n top = top.pre;\n top.next = null;\n size--;\n return value;\n }", "public final void swap() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(topMostValue);\n\t\t\tpush(secondTopMostValue);\n\t\t}\n\t}", "int pop() {\r\n\t\ttop--;\r\n\t\treturn stack[top];\r\n\t}", "void push2(int x) {\n --top2;\n if(top2 == size / 2) {\n System.out.println(\"Second stack is full\");\n return;\n }\n arr[top2] = x;\n }", "public int pop(){\n \tint data=0;\n \tif(isEmpty())\n \tSystem.out.println(\"Stack is underflow\");\n \telse\n \tdata=elements[top--];\n \treturn data;\n\t}", "@Test\n public void testThreePushPop(){\n ms = new MyStack();\n int pn1=3, pn2=4, pn3=5;\n ms.push(pn1);\n ms.push(pn2);\n ms.push(pn3);\n assertEquals(pn3,ms.pop());\n assertEquals(pn2,ms.pop());\n assertEquals(pn1,ms.pop());\n }", "public int pop(){\n if (isEmpty()) throw new RuntimeException(\"Stack underflow\");\n int tmp=myarray[top];\n top--;\n return tmp;\n \n \n }", "public final void rot() {\n\t\tif (size > 2) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tdouble thirdTopMostValue = pop();\n\n\t\t\tpush(secondTopMostValue);\n\t\t\tpush(topMostValue);\n\t\t\tpush(thirdTopMostValue);\n\n\t\t}\n\t}", "private void multiple() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value1*value2);\n\t\t}\n\t}", "public int pop() {\n while (!push.isEmpty()){\n pull.push(push.pop());\n }\n int result= pull.pop();\n while (!pull.isEmpty()){\n push.push(pull.pop());\n }\n return result;\n }", "private void topEval(Stack<Operator> pOperatorStack, Stack<Operand> pOperandStack) {\n Operand right = pOperandStack.pop();\n Operator operator = pOperatorStack.pop();\n if (operator instanceof UnaryOperator) {\n pOperandStack.push(((UnaryOperator)operator).evaluate(right));\n } else {\n Operand left = pOperandStack.pop();\n pOperandStack.push(((BinaryOperator)operator).evaluate(left, right));\n }\n }", "int pop() \r\n {\n if(top < 0)\r\n {\r\n System.out.println(\"Stack Underflow Occurred!\");\r\n return -1;\r\n }\r\n //Write your code here\r\n int p = a[top];\r\n top--;\r\n return p; \r\n }", "public int pop(int valueIfEmpty) {\n\t\t\tif (isEmpty()) {\n\t\t\t\treturn valueIfEmpty;\n\t\t\t}\n\n\t\t\tstoredValues--;\n\t\t\tint result = stack[bottom++];\n\n\t\t\tif (bottom == capacity) {\n\t\t\t\tbottom = 0;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "private static int pop(Stack<Integer> top_ref) {\n /*If stack is empty then error */\n if (top_ref.isEmpty()) {\n System.out.println(\"Stack Underflow\");\n System.exit(0);\n }\n //pop the data from the stack\n return top_ref.pop();\n }", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand / theSecondOperand);\n }", "public void push(int value){\n //To be written by student\n localSize++;\n top++;\n if(localSize>A.getSize()){\n A.doubleSize();\n try{\n A.modifyElement(value,top);\n }catch(Exception c){c.printStackTrace();}\n }\n else{try{\n A.modifyElement(value,top);\n }catch(Exception a){a.printStackTrace();} }\n }", "int pop() {\n if (data.size() == 1) {\r\n min = 0;\r\n return data.pop();\r\n }\r\n else if (data.size() > 1) {\r\n int val = data.peek();\r\n if (val < min) {\r\n val = min;\r\n min = min * 2 - data.peek();\r\n data.pop();\r\n return val;\r\n }\r\n return data.pop();\r\n }\r\n else {\r\n System.out.println(\"Stack underflow\");\r\n return -1;\r\n }\r\n }", "public T pop() {\n \tT retVal = stack.get(stack.size() - 1); // get the value at the top of the stack\n \tstack.remove(stack.size() - 1); // remove the value at the top of the stack\n \treturn retVal;\n }", "public int pop(){\n if (top==null) throw new EmptyStackException();\n int data = top.data;\n top=top.next;\n return data;\n }", "public int top() {\r\n int value = this.pop();\r\n this.stack.offer(value);\r\n return value;\r\n }", "int pop()\n\t{\n // Your code here\n if(top == -1){\n return -1;\n }\n int x = arr[top];\n top--;\n return x;\n\t}", "public int pop() {\n if (stk2.isEmpty()) {\n while (!stk1.isEmpty())\n stk2.push(stk1.pop());\n }\n return stk2.pop();\n }", "public final double pop() {\n\t\tdouble returnValue = defaultValue;\n\n\t\tif (!isEmpty()) {\n\n\t\t\tdouble value = stack[index];\n\t\t\tindex--;\n\t\t\tsize--;\n\t\t\treturnValue = value;\n\t\t}\n\n\t\treturn returnValue;\n\t}", "public int top() {\n // Write your code here\n int ret = 0;\n if (!queue1.isEmpty()) {\n while (queue1.size() > 1) {\n queue2.offer(queue1.poll());\n }\n ret = queue1.peek();\n queue2.offer(queue1.poll());\n } else if (!queue2.isEmpty()) {\n while (queue2.size() > 1) {\n queue1.offer(queue2.poll());\n }\n ret = queue2.peek();\n queue1.offer(queue2.poll());\n }\n return ret;\n }", "public void push(int value) {\n\t\t\tif (storedValues == capacity) {\n\t\t\t\ttop = bottom;\n\t\t\t\tbottom++;\n\t\t\t\tif (bottom == capacity) {\n\t\t\t\t\tbottom = 0;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstoredValues++;\n\t\t\t}\n\n\t\t\tif (top == capacity) {\n\t\t\t\ttop = 0;\n\t\t\t}\n\n\t\t\tstack[top++] = value;\n\t\t}", "void push2(int x, TwoStack sq)\n {\n \n if(sq.top2>sq.size/2)\n {\n sq.top2--;\n sq.arr[sq.top2]=x;\n }\n \n }", "private synchronized BackStep pop() {\r\n\t\t\tBackStep bs;\r\n\t\t\tbs = stack[top];\r\n\t\t\tif (size == 1) {\r\n\t\t\t\ttop = -1;\r\n\t\t\t} else {\r\n\t\t\t\ttop = (top + capacity - 1) % capacity;\r\n\t\t\t}\r\n\t\t\tsize--;\r\n\t\t\treturn bs;\r\n\t\t}", "public final void mod() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue > 0) {\n\t\t\t\tpush(secondTopMostValue % topMostValue);\n\t\t\t}\n\t\t}\n\t}", "static int pop(Stack<Integer> top_ref) {\r\n /* If stack is empty then error */\r\n if (top_ref.isEmpty()) {\r\n System.out.println(\"Stack Underflow\");\r\n System.exit(0);\r\n }\r\n\r\n // pop the data from the stack\r\n return top_ref.pop();\r\n }", "void pop() {\n // -\n top = top.getNextNode();\n }", "void push2(int x, TwoStack sq) {\n if (sq.top1 < sq.top2 - 1) {\n sq.top2--;\n sq.arr[sq.top2] = x;\n }\n }", "public void pop() {\n\t List<Integer> temp = new ArrayList<>();\n\t Integer last = null;\n\t first = null;\n\t \n\t do{\n\t last = s.pop();\n\t if(s.isEmpty()){\n\t break;\n\t }\n\t first = last;\n\t temp.add(last);\n\t \n\t }while (true);\n\t \n\t for(int i = temp.size()-1; i >=0; i--){\n\t s.push(temp.get(i));\n\t }\n\t \n\t}", "public void pop() throws StackUnderflowException;", "private void stackPopElements(int height,int p){\n\t\tint recEnd = p-1;\n\t\tint size;\n\t\t//again, for the equal case; we pop element that equal to height in the stack; cause it's not useful anymore.\n\t\t// and also, we don't need to calc the value for it, cause it's guaranteed no the best value yet;\n\t\twhile(!hStack.isEmpty()&&hStack.peek()>=height){\n\t\t\tint sh = hStack.pop();\n\t\t\tint sp = pStack.pop();\n//\t\t\tSystem.out.println(\"------------- sh and sp is: \"+sh+\" sp:\"+sp+\" size left is: \"+pStack.size());\n\t\t\t\n\t\t\tint start;\n\t\t\tif(sh==height){\n\t\t\t\t//ignore;\n\t\t\t}else{\n\t\t\t\tif(pStack.isEmpty()){\n\t\t\t\t\tstart = 0;\n\t\t\t\t}else{\n\t\t\t\t\tstart = pStack.peek()+1; // element smaller than this height is at this position;\n\t\t\t\t}\n\t\t\t\tsize = (p-start)*sh; // size is width*height;\n//\t\t\t\tSystem.out.println(\" height : \"+sh+\" size: \"+size);\n//\t\t\t\tSystem.out.println(\" p and start : \"+p+\" start:\"+start);\n\t\t\t\tif(size>max){\n\t\t\t\t\t// also can record other things if we want;\n\t\t\t\t\tmax = size; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int pop() {\n q1.remove();\n int res = top;\n if (!q1.isEmpty()) {\n top = q1.peek();\n }\n return res;\n }", "public void pop(){\n \n if(top==null) System.out.println(\"stack is empty\");\n else top=top.next;\n \t\n }", "void push(int val) {\n if (data.size() == 0) {\r\n data.push(val);\r\n min = val;\r\n }\r\n else {\r\n if (val <= min) {\r\n data.push(val * 2 - min);\r\n min = val;\r\n }\r\n else\r\n data.push(val);\r\n }\r\n }", "public void pop() {\n s2.pop();\n temp = (Stack<Integer>) s2.clone();\n s1.clear();\n while (!temp.isEmpty()) {\n s1.push(temp.pop());\n }\n }", "public int pop() {\n int res= q1.remove();\n if (!q1.isEmpty())\n top = q1.peek();\n return res;\n }", "public int pop() {\n if (isEmpty()) {\n throw new IllegalStateException(\"Der Stack ist leer.\");\n }\n if((values.length / 2) >= size) {\t\t\t\t// Überprüfen, ob das Array nicht zu groß ist und ob nicht die Hälfte auch reicht\n \tint[] save = this.values;\t\t\t\t\t// sichere altes Array\n \tthis.values = new int[save.length / 2];\t\t// verkleinere values Array\n \tfor (int i = 0; i < values.length; i++) {\t// kopiere die alten Werte in das neue Array\n \t\tvalues[i] = save[i];\n \t}\n }\n int save = values[size-1];\n values[--size] = 0;\n return save;\n }", "public T pop() {\n\t\tT value = null;\n\t\tif (!isEmpty()) {\n\t\t\ttop = top.next;\n\t\t\tvalue = top.value;\n\t\t}\n\t\treturn value; // returning popped value\n\t}", "public void popAllStacks(){\n // if top is lost then all elements are lost.\n top = null;\n }", "@Test\n public void testTop() {\n System.out.println(\"top\");\n Stack2 instance = new Stack2();\n int expResult = 7;\n instance.push(7);\n int result = instance.top();\n assertEquals(expResult, result);\n }", "public int peek() { //使用栈的peek\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n int data = temp2.peek() ;\n return data; \n }", "public int pop() {\n if (this.stack2.empty()) {\n while (!this.stack1.empty()) {\n this.stack2.push(this.stack1.pop());\n }\n }\n if (!this.stack2.empty()) {\n return this.stack2.pop();\n }\n return -1;\n\n }", "public void pop(){\n // check if there is any stack present or not\n if(this.arr==null){\n System.out.println(\"No stack present, first create a stack\");\n return;\n }\n // check if stack is empty\n if(this.topOfStack==-1){\n System.out.println(\"Stack is empty, can't pop from stack\");\n return;\n }\n // if stack is not empty\n this.arr[this.topOfStack]=Integer.MIN_VALUE;\n this.topOfStack--;\n }", "public int pop() {\n if(!stack2.isEmpty()) return stack2.pop();\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n return stack2.pop();\n }\n }", "public static int sumOfStack2(Deque<Integer> stack) {\n\t int sum = 0;\n\t while(!stack.isEmpty()) {\n\t \tsum += stack.pop();\n\t }\n\t return sum;\n\t}", "public final void min() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(topMostValue);\n\t\t\t} else {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t}\n\t\t}\n\t}", "public final void dup() {\n\t\tif (size > 0) {\n\t\t\tdouble topMostValue = stack[index];\n\t\t\tpush(topMostValue);\n\t\t}\n\t}", "public void pop()\r\n\t{\r\n\t\ttop--;\r\n\t\tstack[top] = null;\r\n\t}", "public E pop()\n {\n E topVal = stack.removeFirst();\n return topVal;\n }", "public int pop() {\n while (!s1.isEmpty()) {\n s2.push(s1.pop());\n }\n int pop = s2.pop();\n while (!s2.isEmpty()) {\n s1.push(s2.pop());\n }\n return pop;\n }", "public void push(T value) {\n top = new Entry<>(value, top); // diamond operator (syntactic sugar)\n }", "public void sumValues(){\n\t\tint index = 0;\n\t\tDouble timeIncrement = 2.0;\n\t\tDouble timeValue = time.get(index);\n\t\tDouble packetValue;\n\t\twhile (index < time.size()){\n\t\t\tDouble packetTotal = 0.0;\n\t\t\twhile (timeValue < timeIncrement && index < packets.size()){\n\t\t\t\ttimeValue = time.get(index);\n\t\t\t\tpacketValue = packets.get(index);\n\t\t\t\tpacketTotal= packetTotal + packetValue;\n\t\t\t\tindex = index + 1;\n\t\t\t}\n\t\t\tArrayList<Double> xy = new ArrayList<Double>();\n\t\t\txy.add(timeIncrement);\n\t\t\txy.add(packetTotal);\n\t\t\ttotalIncrements.add(xy);\n\t\t\t// to get max and min need separate arrays\n\t\t\ttimeIncrements.add(timeIncrement);\n\t\t\tbyteIncrements.add(packetTotal);\n\t\t\ttimeIncrement = timeIncrement + 2.0;\t\n\t\t}\n\t\treturn;\n\n\t}", "public int pop() {\n\n if (top > 0) {\n top --;\n }\n else {\n System.out.println(\"Stack Underflow\");\n return -100;\n }\n return stack[top];\n }", "public ValueWrapper pop(String keyName) {\n\t\tif(isEmpty(keyName)) {\n\t\t\tthrow new EmptyStackException();\n\t\t}\n\t\tvar value = multistack.get(keyName);\n\t\tif(value.next != null) {\n\t\t\tmultistack.put(keyName, value.next);\n\t\t}\n\t\telse {\n\t\t\tmultistack.remove(keyName);\n\t\t}\n\t\treturn value.value;\n\t}", "void push(int a)\n\t{\n\t // Your code here\n\t top++;\n\t arr[top]=a;\n\t}", "public ListNode addTwoNumbers(ListNode l1, ListNode l2) {\n Stack<Integer> s1 = new Stack<>();\n Stack<Integer> s2 = new Stack<>();\n while (l1 != null) {\n s1.push(l1.val);\n l1 = l1.next;\n }\n while (l2 != null) {\n s2.push(l2.val);\n l2 = l2.next;\n }\n ListNode current = new ListNode(0);\n int overflow = 0;\n while (!s1.empty() || !s2.empty()) {\n int x = (!s1.empty()) ? s1.pop() : 0;\n int y = (!s2.empty()) ? s2.pop() : 0;\n int value = overflow + x + y;\n overflow = value / 10;\n current.val = value % 10;\n ListNode temp = new ListNode(overflow);\n temp.next = current;\n current = temp;\n }\n return current.val == 0 ? current.next : current;\n}", "public T pop() {\r\n\t\t\r\n\t\tT numPila = this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\tfor (StackObserver<T> o : observers )\r\n\t\t\to.onPop(numPila);\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\treturn numPila;\r\n\t\t\r\n\t\t//return this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\t\r\n\t}", "public T pop(){ \r\n \t--this.size;\r\n \treturn stack1.pop();\r\n }", "static void stack_pop(Stack<Integer> stack)\r\n\t{\r\n\t\t\r\n\t\tSystem.out.print(\"Pop : \");\r\n\t\tfor(int i=0;i<5;i++)\r\n\t\t{\r\n\t\t\tInteger dataElement=(Integer)stack.pop();\r\n\t\t\tSystem.out.print(\" \"+ dataElement);\r\n\t\t\t\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}", "public T push(T data){\r\n \tboolean sorted = false;\r\n \twhile(!sorted) {\r\n \t\tif(stack1.empty() || data.compareTo(stack1.peek()) < 0) {\r\n \t\t\tstack2.push(data);\r\n \t\t\tsorted = true;\r\n \t\t}else {\r\n \t\t\tstack2.push(stack1.pop());\r\n \t\t}\r\n \t}\r\n \twhile(stack1.size() > 0) {\r\n \t\tstack2.push(stack1.pop());\r\n \t}\r\n \twhile(stack2.size() > 0) {\r\n \t\tstack1.push(stack2.pop());\r\n \t}\r\n \t++this.size;\r\n \treturn data;\r\n }", "public void pop()\n {\n this.top = this.top.getNext();\n }", "public int pop() throws EmptyStackException{\n //To be written by student\n if(top==-1){\n System.out.println(\"Stack is Empty!\");\n throw new EmptyStackException();\n }\n else if(localSize==A.getSize()/2){\n \tint tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n A.halveSize();\n return tp;\n }\n else{ int tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n \n return tp;\n }\n }", "public T pop() { //pop = remove the last element added to the array, in a stack last in, first out (in a queue pop and push from different ends)\n try {\n T getOut = (T) myCustomStack[numElements - 1]; //variable for element to remove (pop off) = last element (if you have 7 elements, the index # is 6)\n myCustomStack[numElements] = null; //remove element by making it null\n numElements--; //remove last element, decrease the numElements\n return getOut; //return popped number\n\n } catch (Exception exc) {\n System.out.println(\"Can't pop from empty stack!\");\n return null;\n }\n }", "int pop1(TwoStack sq)\n {\n if(sq.top1>=0)\n {\n int yo=sq.arr[sq.top1];\n sq.top1--;\n return yo;\n }\n else\n {\n return -1;\n }\n \n }", "public void pop() {\n\t\tif(stackTmp.isEmpty()){\n\t\t\twhile(!stack.isEmpty()){\n\t\t\t\tint tmp = stack.peek();\n\t\t\t\tstackTmp.push(tmp);\n\t\t\t\tstack.pop();\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tstackTmp.pop();\n\t\t}\n\t}", "private T pop(Node topNode)\n {\n if (isEmpty())\n {\n return null;\n }\n else // not empty\n {\n T result = (T) topNode.getData();\n first = topNode.getNextNode();\n return result;\n }\n }", "public int pop() {\n if (!s2.empty()) {\n return s2.pop();\n } else {\n while (!s1.empty()) {\n s2.push(s1.pop());\n }\n return s2.pop();\n }\n }", "public static void main(String[] args) {\n \n \n \n Stack st = new Stack();\n st.push(40);\n st.push(30);\n \n int poppedElement = (int) st.pop();\n System.out.println(poppedElement);\n \n \n \n }", "private static void push(Stack<Integer> top_ref, int new_data) {\n //Push the data onto the stack\n top_ref.push(new_data);\n }", "public int pop() {\n\t\tif (isEmpty())\n\t\t\treturn NEGATIVE_ONE;\n\t\tint ret = last.value;\n\t\tlast = last.prev;\n\t\treturn ret;\n\t}", "@Override\r\n\tpublic T top() throws StackUnderflowException{\r\n\t\tif (!isEmpty()) {\r\n\t\t\tT e = stack.get(size()-1);\r\n\t\t\treturn e;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthrow new StackUnderflowException();\r\n\t\t}\r\n\t}", "public int pop() throws IndexOutOfBoundsException {\n try {\n for (int i = size() - 1; i >= 0; i--) { // Iterate backwards\n if (this.values[i] != 0) { // First occurance of value\n int oldvalue = this.values[i];\n this.values[i] = 0; // Set to 0\n this.size--;\n return oldvalue;\n }\n }\n\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n\n } catch (Exception e) {\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n }\n }", "public int pop() {\n /**\n * 将stack中所有元素逆序保存到otherStack中后弹出otherStack栈顶元素\n */\n while (!stack.isEmpty()) {\n otherStack.push(stack.pop());\n }\n return otherStack.pop();\n }", "public void pop() {\n if(stack.pop() == min)\n min=stack.pop();\n }", "public int peek(int valueIfEmpty) {\n\t\t\tif (storedValues > 0) {\n\t\t\t\treturn stack[bottom];\n\t\t\t}\n\t\t\treturn valueIfEmpty;\n\t\t}" ]
[ "0.68377626", "0.6803724", "0.6747728", "0.6692639", "0.6344156", "0.6331312", "0.6324791", "0.62872905", "0.6274577", "0.62451106", "0.6237114", "0.623234", "0.61845", "0.6169413", "0.6142062", "0.6141208", "0.6125802", "0.61072373", "0.60982776", "0.609537", "0.6073347", "0.60680807", "0.6052387", "0.60474104", "0.6043057", "0.60371274", "0.60271287", "0.6009613", "0.60015047", "0.60006356", "0.59824735", "0.5974733", "0.59675705", "0.59649456", "0.59524035", "0.59428257", "0.59337926", "0.592613", "0.5892032", "0.5888017", "0.5886703", "0.58739525", "0.5860405", "0.5852685", "0.5835458", "0.58041996", "0.5791222", "0.5784217", "0.57816666", "0.5778162", "0.5767329", "0.5758771", "0.5758483", "0.5755058", "0.575373", "0.5752055", "0.57458454", "0.5742993", "0.57393265", "0.5738557", "0.57271147", "0.5718871", "0.5701397", "0.5699625", "0.5690713", "0.568251", "0.5679317", "0.5664285", "0.56623703", "0.56620944", "0.56592613", "0.5654663", "0.56524336", "0.56335175", "0.5632567", "0.562796", "0.56278586", "0.56277823", "0.5625819", "0.5622136", "0.56049496", "0.56023306", "0.5600271", "0.56000155", "0.5593124", "0.55929154", "0.5591225", "0.558895", "0.55823296", "0.55805767", "0.5578153", "0.5572257", "0.55640084", "0.5562903", "0.5561806", "0.55530274", "0.5551992", "0.5550134", "0.554362", "0.55381453" ]
0.6266223
9
pop the top 2 values and add them and push the result onto the value stack
@Override public void step(final EvaluationContext theContext) { // pop the top 2 values and add them // and push the result onto the value stack // final Double theSecondOperand = theContext.popValue(); final Double theFirstOperand = theContext.popValue(); theContext.pushValue(theFirstOperand / theSecondOperand); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand - theSecondOperand);\n }", "public final void add() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue + topMostValue);\n\t\t}\n\t}", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand + theSecondOperand);\n }", "private void uminus() throws Exception{\n\t\tif(stackEmpty()) throw new Exception(\"Stack ist leer\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tstack.push(value1*(-1));\n\t\t}\n\t\t\n\t}", "public int pop() {\r\n LinkedList<Integer> queue = new LinkedList<>();\r\n int value = stack.poll();\r\n while(!stack.isEmpty()){\r\n queue.offer(value);\r\n value = stack.poll();\r\n }\r\n stack = queue;\r\n return value;\r\n }", "public void pop() {\r\n \t Queue<Integer> temp=new LinkedList<Integer>();\r\n \t int counter=0;\r\n \t while(!stack.isEmpty()){\r\n \t temp.add((Integer) stack.poll());\r\n \t counter++;\r\n \t \r\n \t }\r\n \t while(counter>1)\r\n \t {\r\n \t \r\n \t stack.add(temp.poll());\r\n \t counter--;\r\n \t }\r\n }", "public double pop()\n {\n if (empty()) {\n \tthrow new IllegalArgumentException(\"too many operators!\");\n \t\n }\n else\n {\n return s[top--];\n }\n }", "private void addition() throws Exception {\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.peek();\n\t\t\tstack.push(value2+value1);\n\t\t}\n\t\t\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand * theSecondOperand);\n }", "int pop2(TwoStack sq)\n {\n if(sq.top2<sq.size)\n {\n int yo2=sq.arr[sq.top2];\n sq.top2++;\n return yo2;\n }\n else\n {\n return -1;\n }\n \n }", "private void addRValueToStack (){\n if (numStack.size() < 23){\n numStack.push(rValues[rCount]);\n if(rCount< rValues.length){ // cycles through the 'r' values\n rCount++;\n }\n else{ \n rCount=0; // if end of r values reached, rCount is set to 0.\n }\n }\n else {\n System.out.println(\"Stack overflow.\"); \n }\n }", "public ExParValue pop() {\r\n\t\tExParValue v = null;\r\n\t\tif (value.next != null) {\r\n\t\t\tv = value;\r\n\t\t\tvalue = value.next;\r\n\t\t\t// System.out.println(\"ExPar.pop() Popping \" + v.toString() +\r\n\t\t\t// \" now on top: \" + value.toString());\r\n\t\t} else {\r\n\t\t\tnew ParameterValueError(\"ExPar.pop() without preceding push()\");\r\n\t\t}\r\n\t\t/*\r\n\t\t * if (value == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack empty.\"); } else if\r\n\t\t * (value.next == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): A single value is on the stack: \" +\r\n\t\t * value.toString()); } else {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack: \" + value.toString() +\r\n\t\t * \", \" + value.next.toString()); }\r\n\t\t */\r\n\t\treturn (v);\r\n\t}", "public int pop() { //第二个栈为空 , 就将第一个栈的数据往第二个里面加\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n return temp2.pop(); //不管是否为空,直接pop第二个栈\n }", "public int top() {\r\n Queue<Integer> temp=new LinkedList<Integer>();\r\n int counter=0;\r\n while(!stack.isEmpty()){\r\n temp.add((Integer) stack.poll());\r\n counter++;\r\n \r\n }\r\n while(counter>1)\r\n {\r\n \r\n stack.add(temp.poll());\r\n counter--;\r\n }\r\n int topInteger=temp.poll();\r\n stack.add(topInteger);\r\n return topInteger;\r\n \r\n }", "public int top() {\n if(!stack2.isEmpty()) {\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n }", "public int pop() {\n int result;\n while(!stack.isEmpty()){\n cache.add(stack.removeLast());\n }\n result = cache.removeLast();\n while(!cache.isEmpty()){\n stack.add(cache.removeLast());\n }\n System.out.println(result);\n return result;\n }", "public final void max() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t} else {\n\t\t\t\tpush(topMostValue);\n\t\t\t}\n\t\t}\n\t}", "int pop2()\n {\n if(top2 == size) {\n System.out.println(\"Second Stack is empty.\");\n return -1;\n }\n\n int popped = arr[top2];\n ++top2;\n return popped;\n }", "@Override\n\tpublic int pop() {\n\t\tint topValue;\n\t\tif (top != -1) {\n\t\t\ttopValue = intContainer[top];\n\t\t\ttop = top - 1;\n\t\t\treturn topValue;\n\t\t} else {\n\t\t\tSystem.out.println(\"Stack Undeflow\");\n\t\t\treturn -1;\n\t\t}\n\t}", "int pop2(TwoStack sq) {\n if (sq.top2 < sq.size) {\n int x = sq.arr[sq.top2];\n sq.top2++;\n return x;\n } else {\n return -1;\n }\n }", "private void minus() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value2-value1);\n\t\t}\n\t}", "public Integer pop() \n\t{ \n\t\tint x = super.pop(); \n\t\tmin.pop(); \n\t\treturn x; \n\t}", "public int pop() {\n int value = top.value;\n top = top.pre;\n top.next = null;\n size--;\n return value;\n }", "public final void swap() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(topMostValue);\n\t\t\tpush(secondTopMostValue);\n\t\t}\n\t}", "int pop() {\r\n\t\ttop--;\r\n\t\treturn stack[top];\r\n\t}", "void push2(int x) {\n --top2;\n if(top2 == size / 2) {\n System.out.println(\"Second stack is full\");\n return;\n }\n arr[top2] = x;\n }", "public int pop(){\n \tint data=0;\n \tif(isEmpty())\n \tSystem.out.println(\"Stack is underflow\");\n \telse\n \tdata=elements[top--];\n \treturn data;\n\t}", "@Test\n public void testThreePushPop(){\n ms = new MyStack();\n int pn1=3, pn2=4, pn3=5;\n ms.push(pn1);\n ms.push(pn2);\n ms.push(pn3);\n assertEquals(pn3,ms.pop());\n assertEquals(pn2,ms.pop());\n assertEquals(pn1,ms.pop());\n }", "public final void rot() {\n\t\tif (size > 2) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tdouble thirdTopMostValue = pop();\n\n\t\t\tpush(secondTopMostValue);\n\t\t\tpush(topMostValue);\n\t\t\tpush(thirdTopMostValue);\n\n\t\t}\n\t}", "public int pop(){\n if (isEmpty()) throw new RuntimeException(\"Stack underflow\");\n int tmp=myarray[top];\n top--;\n return tmp;\n \n \n }", "private void multiple() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value1*value2);\n\t\t}\n\t}", "public int pop() {\n while (!push.isEmpty()){\n pull.push(push.pop());\n }\n int result= pull.pop();\n while (!pull.isEmpty()){\n push.push(pull.pop());\n }\n return result;\n }", "private void topEval(Stack<Operator> pOperatorStack, Stack<Operand> pOperandStack) {\n Operand right = pOperandStack.pop();\n Operator operator = pOperatorStack.pop();\n if (operator instanceof UnaryOperator) {\n pOperandStack.push(((UnaryOperator)operator).evaluate(right));\n } else {\n Operand left = pOperandStack.pop();\n pOperandStack.push(((BinaryOperator)operator).evaluate(left, right));\n }\n }", "int pop() \r\n {\n if(top < 0)\r\n {\r\n System.out.println(\"Stack Underflow Occurred!\");\r\n return -1;\r\n }\r\n //Write your code here\r\n int p = a[top];\r\n top--;\r\n return p; \r\n }", "public int pop(int valueIfEmpty) {\n\t\t\tif (isEmpty()) {\n\t\t\t\treturn valueIfEmpty;\n\t\t\t}\n\n\t\t\tstoredValues--;\n\t\t\tint result = stack[bottom++];\n\n\t\t\tif (bottom == capacity) {\n\t\t\t\tbottom = 0;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "private static int pop(Stack<Integer> top_ref) {\n /*If stack is empty then error */\n if (top_ref.isEmpty()) {\n System.out.println(\"Stack Underflow\");\n System.exit(0);\n }\n //pop the data from the stack\n return top_ref.pop();\n }", "public void push(int value){\n //To be written by student\n localSize++;\n top++;\n if(localSize>A.getSize()){\n A.doubleSize();\n try{\n A.modifyElement(value,top);\n }catch(Exception c){c.printStackTrace();}\n }\n else{try{\n A.modifyElement(value,top);\n }catch(Exception a){a.printStackTrace();} }\n }", "int pop() {\n if (data.size() == 1) {\r\n min = 0;\r\n return data.pop();\r\n }\r\n else if (data.size() > 1) {\r\n int val = data.peek();\r\n if (val < min) {\r\n val = min;\r\n min = min * 2 - data.peek();\r\n data.pop();\r\n return val;\r\n }\r\n return data.pop();\r\n }\r\n else {\r\n System.out.println(\"Stack underflow\");\r\n return -1;\r\n }\r\n }", "public T pop() {\n \tT retVal = stack.get(stack.size() - 1); // get the value at the top of the stack\n \tstack.remove(stack.size() - 1); // remove the value at the top of the stack\n \treturn retVal;\n }", "public int pop(){\n if (top==null) throw new EmptyStackException();\n int data = top.data;\n top=top.next;\n return data;\n }", "public int top() {\r\n int value = this.pop();\r\n this.stack.offer(value);\r\n return value;\r\n }", "int pop()\n\t{\n // Your code here\n if(top == -1){\n return -1;\n }\n int x = arr[top];\n top--;\n return x;\n\t}", "public int pop() {\n if (stk2.isEmpty()) {\n while (!stk1.isEmpty())\n stk2.push(stk1.pop());\n }\n return stk2.pop();\n }", "public final double pop() {\n\t\tdouble returnValue = defaultValue;\n\n\t\tif (!isEmpty()) {\n\n\t\t\tdouble value = stack[index];\n\t\t\tindex--;\n\t\t\tsize--;\n\t\t\treturnValue = value;\n\t\t}\n\n\t\treturn returnValue;\n\t}", "public int top() {\n // Write your code here\n int ret = 0;\n if (!queue1.isEmpty()) {\n while (queue1.size() > 1) {\n queue2.offer(queue1.poll());\n }\n ret = queue1.peek();\n queue2.offer(queue1.poll());\n } else if (!queue2.isEmpty()) {\n while (queue2.size() > 1) {\n queue1.offer(queue2.poll());\n }\n ret = queue2.peek();\n queue1.offer(queue2.poll());\n }\n return ret;\n }", "public void push(int value) {\n\t\t\tif (storedValues == capacity) {\n\t\t\t\ttop = bottom;\n\t\t\t\tbottom++;\n\t\t\t\tif (bottom == capacity) {\n\t\t\t\t\tbottom = 0;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstoredValues++;\n\t\t\t}\n\n\t\t\tif (top == capacity) {\n\t\t\t\ttop = 0;\n\t\t\t}\n\n\t\t\tstack[top++] = value;\n\t\t}", "void push2(int x, TwoStack sq)\n {\n \n if(sq.top2>sq.size/2)\n {\n sq.top2--;\n sq.arr[sq.top2]=x;\n }\n \n }", "private synchronized BackStep pop() {\r\n\t\t\tBackStep bs;\r\n\t\t\tbs = stack[top];\r\n\t\t\tif (size == 1) {\r\n\t\t\t\ttop = -1;\r\n\t\t\t} else {\r\n\t\t\t\ttop = (top + capacity - 1) % capacity;\r\n\t\t\t}\r\n\t\t\tsize--;\r\n\t\t\treturn bs;\r\n\t\t}", "public final void mod() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue > 0) {\n\t\t\t\tpush(secondTopMostValue % topMostValue);\n\t\t\t}\n\t\t}\n\t}", "static int pop(Stack<Integer> top_ref) {\r\n /* If stack is empty then error */\r\n if (top_ref.isEmpty()) {\r\n System.out.println(\"Stack Underflow\");\r\n System.exit(0);\r\n }\r\n\r\n // pop the data from the stack\r\n return top_ref.pop();\r\n }", "void push2(int x, TwoStack sq) {\n if (sq.top1 < sq.top2 - 1) {\n sq.top2--;\n sq.arr[sq.top2] = x;\n }\n }", "void pop() {\n // -\n top = top.getNextNode();\n }", "public void pop() {\n\t List<Integer> temp = new ArrayList<>();\n\t Integer last = null;\n\t first = null;\n\t \n\t do{\n\t last = s.pop();\n\t if(s.isEmpty()){\n\t break;\n\t }\n\t first = last;\n\t temp.add(last);\n\t \n\t }while (true);\n\t \n\t for(int i = temp.size()-1; i >=0; i--){\n\t s.push(temp.get(i));\n\t }\n\t \n\t}", "public void pop() throws StackUnderflowException;", "private void stackPopElements(int height,int p){\n\t\tint recEnd = p-1;\n\t\tint size;\n\t\t//again, for the equal case; we pop element that equal to height in the stack; cause it's not useful anymore.\n\t\t// and also, we don't need to calc the value for it, cause it's guaranteed no the best value yet;\n\t\twhile(!hStack.isEmpty()&&hStack.peek()>=height){\n\t\t\tint sh = hStack.pop();\n\t\t\tint sp = pStack.pop();\n//\t\t\tSystem.out.println(\"------------- sh and sp is: \"+sh+\" sp:\"+sp+\" size left is: \"+pStack.size());\n\t\t\t\n\t\t\tint start;\n\t\t\tif(sh==height){\n\t\t\t\t//ignore;\n\t\t\t}else{\n\t\t\t\tif(pStack.isEmpty()){\n\t\t\t\t\tstart = 0;\n\t\t\t\t}else{\n\t\t\t\t\tstart = pStack.peek()+1; // element smaller than this height is at this position;\n\t\t\t\t}\n\t\t\t\tsize = (p-start)*sh; // size is width*height;\n//\t\t\t\tSystem.out.println(\" height : \"+sh+\" size: \"+size);\n//\t\t\t\tSystem.out.println(\" p and start : \"+p+\" start:\"+start);\n\t\t\t\tif(size>max){\n\t\t\t\t\t// also can record other things if we want;\n\t\t\t\t\tmax = size; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int pop() {\n q1.remove();\n int res = top;\n if (!q1.isEmpty()) {\n top = q1.peek();\n }\n return res;\n }", "public void pop(){\n \n if(top==null) System.out.println(\"stack is empty\");\n else top=top.next;\n \t\n }", "void push(int val) {\n if (data.size() == 0) {\r\n data.push(val);\r\n min = val;\r\n }\r\n else {\r\n if (val <= min) {\r\n data.push(val * 2 - min);\r\n min = val;\r\n }\r\n else\r\n data.push(val);\r\n }\r\n }", "public void pop() {\n s2.pop();\n temp = (Stack<Integer>) s2.clone();\n s1.clear();\n while (!temp.isEmpty()) {\n s1.push(temp.pop());\n }\n }", "public int pop() {\n int res= q1.remove();\n if (!q1.isEmpty())\n top = q1.peek();\n return res;\n }", "public int pop() {\n if (isEmpty()) {\n throw new IllegalStateException(\"Der Stack ist leer.\");\n }\n if((values.length / 2) >= size) {\t\t\t\t// Überprüfen, ob das Array nicht zu groß ist und ob nicht die Hälfte auch reicht\n \tint[] save = this.values;\t\t\t\t\t// sichere altes Array\n \tthis.values = new int[save.length / 2];\t\t// verkleinere values Array\n \tfor (int i = 0; i < values.length; i++) {\t// kopiere die alten Werte in das neue Array\n \t\tvalues[i] = save[i];\n \t}\n }\n int save = values[size-1];\n values[--size] = 0;\n return save;\n }", "public T pop() {\n\t\tT value = null;\n\t\tif (!isEmpty()) {\n\t\t\ttop = top.next;\n\t\t\tvalue = top.value;\n\t\t}\n\t\treturn value; // returning popped value\n\t}", "public void popAllStacks(){\n // if top is lost then all elements are lost.\n top = null;\n }", "@Test\n public void testTop() {\n System.out.println(\"top\");\n Stack2 instance = new Stack2();\n int expResult = 7;\n instance.push(7);\n int result = instance.top();\n assertEquals(expResult, result);\n }", "public int peek() { //使用栈的peek\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n int data = temp2.peek() ;\n return data; \n }", "public int pop() {\n if (this.stack2.empty()) {\n while (!this.stack1.empty()) {\n this.stack2.push(this.stack1.pop());\n }\n }\n if (!this.stack2.empty()) {\n return this.stack2.pop();\n }\n return -1;\n\n }", "public static int sumOfStack2(Deque<Integer> stack) {\n\t int sum = 0;\n\t while(!stack.isEmpty()) {\n\t \tsum += stack.pop();\n\t }\n\t return sum;\n\t}", "public void pop(){\n // check if there is any stack present or not\n if(this.arr==null){\n System.out.println(\"No stack present, first create a stack\");\n return;\n }\n // check if stack is empty\n if(this.topOfStack==-1){\n System.out.println(\"Stack is empty, can't pop from stack\");\n return;\n }\n // if stack is not empty\n this.arr[this.topOfStack]=Integer.MIN_VALUE;\n this.topOfStack--;\n }", "public int pop() {\n if(!stack2.isEmpty()) return stack2.pop();\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n return stack2.pop();\n }\n }", "public final void min() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(topMostValue);\n\t\t\t} else {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t}\n\t\t}\n\t}", "public final void dup() {\n\t\tif (size > 0) {\n\t\t\tdouble topMostValue = stack[index];\n\t\t\tpush(topMostValue);\n\t\t}\n\t}", "public void pop()\r\n\t{\r\n\t\ttop--;\r\n\t\tstack[top] = null;\r\n\t}", "public void sumValues(){\n\t\tint index = 0;\n\t\tDouble timeIncrement = 2.0;\n\t\tDouble timeValue = time.get(index);\n\t\tDouble packetValue;\n\t\twhile (index < time.size()){\n\t\t\tDouble packetTotal = 0.0;\n\t\t\twhile (timeValue < timeIncrement && index < packets.size()){\n\t\t\t\ttimeValue = time.get(index);\n\t\t\t\tpacketValue = packets.get(index);\n\t\t\t\tpacketTotal= packetTotal + packetValue;\n\t\t\t\tindex = index + 1;\n\t\t\t}\n\t\t\tArrayList<Double> xy = new ArrayList<Double>();\n\t\t\txy.add(timeIncrement);\n\t\t\txy.add(packetTotal);\n\t\t\ttotalIncrements.add(xy);\n\t\t\t// to get max and min need separate arrays\n\t\t\ttimeIncrements.add(timeIncrement);\n\t\t\tbyteIncrements.add(packetTotal);\n\t\t\ttimeIncrement = timeIncrement + 2.0;\t\n\t\t}\n\t\treturn;\n\n\t}", "public E pop()\n {\n E topVal = stack.removeFirst();\n return topVal;\n }", "public void push(T value) {\n top = new Entry<>(value, top); // diamond operator (syntactic sugar)\n }", "public int pop() {\n while (!s1.isEmpty()) {\n s2.push(s1.pop());\n }\n int pop = s2.pop();\n while (!s2.isEmpty()) {\n s1.push(s2.pop());\n }\n return pop;\n }", "public int pop() {\n\n if (top > 0) {\n top --;\n }\n else {\n System.out.println(\"Stack Underflow\");\n return -100;\n }\n return stack[top];\n }", "public ValueWrapper pop(String keyName) {\n\t\tif(isEmpty(keyName)) {\n\t\t\tthrow new EmptyStackException();\n\t\t}\n\t\tvar value = multistack.get(keyName);\n\t\tif(value.next != null) {\n\t\t\tmultistack.put(keyName, value.next);\n\t\t}\n\t\telse {\n\t\t\tmultistack.remove(keyName);\n\t\t}\n\t\treturn value.value;\n\t}", "void push(int a)\n\t{\n\t // Your code here\n\t top++;\n\t arr[top]=a;\n\t}", "public ListNode addTwoNumbers(ListNode l1, ListNode l2) {\n Stack<Integer> s1 = new Stack<>();\n Stack<Integer> s2 = new Stack<>();\n while (l1 != null) {\n s1.push(l1.val);\n l1 = l1.next;\n }\n while (l2 != null) {\n s2.push(l2.val);\n l2 = l2.next;\n }\n ListNode current = new ListNode(0);\n int overflow = 0;\n while (!s1.empty() || !s2.empty()) {\n int x = (!s1.empty()) ? s1.pop() : 0;\n int y = (!s2.empty()) ? s2.pop() : 0;\n int value = overflow + x + y;\n overflow = value / 10;\n current.val = value % 10;\n ListNode temp = new ListNode(overflow);\n temp.next = current;\n current = temp;\n }\n return current.val == 0 ? current.next : current;\n}", "public T pop() {\r\n\t\t\r\n\t\tT numPila = this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\tfor (StackObserver<T> o : observers )\r\n\t\t\to.onPop(numPila);\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\treturn numPila;\r\n\t\t\r\n\t\t//return this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\t\r\n\t}", "public T pop(){ \r\n \t--this.size;\r\n \treturn stack1.pop();\r\n }", "static void stack_pop(Stack<Integer> stack)\r\n\t{\r\n\t\t\r\n\t\tSystem.out.print(\"Pop : \");\r\n\t\tfor(int i=0;i<5;i++)\r\n\t\t{\r\n\t\t\tInteger dataElement=(Integer)stack.pop();\r\n\t\t\tSystem.out.print(\" \"+ dataElement);\r\n\t\t\t\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}", "public T push(T data){\r\n \tboolean sorted = false;\r\n \twhile(!sorted) {\r\n \t\tif(stack1.empty() || data.compareTo(stack1.peek()) < 0) {\r\n \t\t\tstack2.push(data);\r\n \t\t\tsorted = true;\r\n \t\t}else {\r\n \t\t\tstack2.push(stack1.pop());\r\n \t\t}\r\n \t}\r\n \twhile(stack1.size() > 0) {\r\n \t\tstack2.push(stack1.pop());\r\n \t}\r\n \twhile(stack2.size() > 0) {\r\n \t\tstack1.push(stack2.pop());\r\n \t}\r\n \t++this.size;\r\n \treturn data;\r\n }", "public void pop()\n {\n this.top = this.top.getNext();\n }", "public int pop() throws EmptyStackException{\n //To be written by student\n if(top==-1){\n System.out.println(\"Stack is Empty!\");\n throw new EmptyStackException();\n }\n else if(localSize==A.getSize()/2){\n \tint tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n A.halveSize();\n return tp;\n }\n else{ int tp=0;\n \ttry{\n \t\t tp=A.getElement(top);\n \t}catch(Exception e){e.printStackTrace();}\n top--;localSize--;\n \n return tp;\n }\n }", "public T pop() { //pop = remove the last element added to the array, in a stack last in, first out (in a queue pop and push from different ends)\n try {\n T getOut = (T) myCustomStack[numElements - 1]; //variable for element to remove (pop off) = last element (if you have 7 elements, the index # is 6)\n myCustomStack[numElements] = null; //remove element by making it null\n numElements--; //remove last element, decrease the numElements\n return getOut; //return popped number\n\n } catch (Exception exc) {\n System.out.println(\"Can't pop from empty stack!\");\n return null;\n }\n }", "int pop1(TwoStack sq)\n {\n if(sq.top1>=0)\n {\n int yo=sq.arr[sq.top1];\n sq.top1--;\n return yo;\n }\n else\n {\n return -1;\n }\n \n }", "public void pop() {\n\t\tif(stackTmp.isEmpty()){\n\t\t\twhile(!stack.isEmpty()){\n\t\t\t\tint tmp = stack.peek();\n\t\t\t\tstackTmp.push(tmp);\n\t\t\t\tstack.pop();\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tstackTmp.pop();\n\t\t}\n\t}", "private T pop(Node topNode)\n {\n if (isEmpty())\n {\n return null;\n }\n else // not empty\n {\n T result = (T) topNode.getData();\n first = topNode.getNextNode();\n return result;\n }\n }", "public int pop() {\n if (!s2.empty()) {\n return s2.pop();\n } else {\n while (!s1.empty()) {\n s2.push(s1.pop());\n }\n return s2.pop();\n }\n }", "private static void push(Stack<Integer> top_ref, int new_data) {\n //Push the data onto the stack\n top_ref.push(new_data);\n }", "public static void main(String[] args) {\n \n \n \n Stack st = new Stack();\n st.push(40);\n st.push(30);\n \n int poppedElement = (int) st.pop();\n System.out.println(poppedElement);\n \n \n \n }", "public int pop() {\n\t\tif (isEmpty())\n\t\t\treturn NEGATIVE_ONE;\n\t\tint ret = last.value;\n\t\tlast = last.prev;\n\t\treturn ret;\n\t}", "@Override\r\n\tpublic T top() throws StackUnderflowException{\r\n\t\tif (!isEmpty()) {\r\n\t\t\tT e = stack.get(size()-1);\r\n\t\t\treturn e;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthrow new StackUnderflowException();\r\n\t\t}\r\n\t}", "public int pop() throws IndexOutOfBoundsException {\n try {\n for (int i = size() - 1; i >= 0; i--) { // Iterate backwards\n if (this.values[i] != 0) { // First occurance of value\n int oldvalue = this.values[i];\n this.values[i] = 0; // Set to 0\n this.size--;\n return oldvalue;\n }\n }\n\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n\n } catch (Exception e) {\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n }\n }", "public int pop() {\n /**\n * 将stack中所有元素逆序保存到otherStack中后弹出otherStack栈顶元素\n */\n while (!stack.isEmpty()) {\n otherStack.push(stack.pop());\n }\n return otherStack.pop();\n }", "public void pop() {\n if(stack.pop() == min)\n min=stack.pop();\n }", "public int peek(int valueIfEmpty) {\n\t\t\tif (storedValues > 0) {\n\t\t\t\treturn stack[bottom];\n\t\t\t}\n\t\t\treturn valueIfEmpty;\n\t\t}" ]
[ "0.68380815", "0.6806844", "0.67462766", "0.6693638", "0.6342677", "0.6328589", "0.63218766", "0.628542", "0.62755173", "0.62668246", "0.62422603", "0.623853", "0.6230382", "0.61809534", "0.61687183", "0.61401945", "0.6139249", "0.6124462", "0.6103724", "0.60959554", "0.60923094", "0.60696846", "0.6065524", "0.605035", "0.6045578", "0.60406446", "0.6035474", "0.6024197", "0.60064673", "0.5999787", "0.5999356", "0.5980213", "0.59719324", "0.5966128", "0.59627956", "0.5950467", "0.59399533", "0.5927807", "0.588875", "0.5885127", "0.5884787", "0.58729297", "0.5858382", "0.5849309", "0.5833335", "0.5802028", "0.5793602", "0.57829666", "0.57784957", "0.57775915", "0.5764575", "0.5757117", "0.5756739", "0.57519215", "0.57500213", "0.57494295", "0.57432866", "0.57404304", "0.57404166", "0.5734201", "0.5724351", "0.57165897", "0.5699636", "0.5696514", "0.5689216", "0.5680175", "0.5675514", "0.56619656", "0.5661056", "0.5658746", "0.5658543", "0.5654954", "0.5648711", "0.5631523", "0.56311774", "0.5629957", "0.5629297", "0.5625084", "0.5623866", "0.56234235", "0.5605081", "0.5599137", "0.5596773", "0.5595693", "0.5592985", "0.5590817", "0.55880743", "0.55851924", "0.5578632", "0.5577136", "0.55755985", "0.5569068", "0.5563661", "0.5560823", "0.55598056", "0.5551815", "0.5549279", "0.5547198", "0.5540545", "0.55378973" ]
0.5934216
37
pop the top 2 values and do a power calculation and push the result onto the value stack
@Override public void step(EvaluationContext theContext) { // pop the top 2 values and do a power calculation // and push the result onto the value stack // final Double theSecondOperand = theContext.popValue(); final Double theFirstOperand = theContext.popValue(); theContext.pushValue(Math.pow(theFirstOperand, theSecondOperand)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void pow() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse {\n\t\t\tvalue1= stack.pop();\n\t\t\tvalue2= stack.pop();\n\t\t\tstack.push(Math.pow(value2, value1));\n\t\t}\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand - theSecondOperand);\n }", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand * theSecondOperand);\n }", "final void mulV2() {\n\t\t\tV2Obj r = stack[--sp];\r\n\t\t\tV2Obj l = stack[--sp];\r\n\t\t\tV2Obj res = heap[hp++];\r\n\t\t\tres.a = l.a * r.a - l.a * r.b;\r\n\t\t\tres.b = l.a * r.b + l.b * r.a;\r\n\t\t\tstack[sp++] = res;\r\n\t\t}", "private void topEval(Stack<Operator> pOperatorStack, Stack<Operand> pOperandStack) {\n Operand right = pOperandStack.pop();\n Operator operator = pOperatorStack.pop();\n if (operator instanceof UnaryOperator) {\n pOperandStack.push(((UnaryOperator)operator).evaluate(right));\n } else {\n Operand left = pOperandStack.pop();\n pOperandStack.push(((BinaryOperator)operator).evaluate(left, right));\n }\n }", "public final void mul() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue * topMostValue);\n\t\t}\n\t}", "public double pop()\n {\n if (empty()) {\n \tthrow new IllegalArgumentException(\"too many operators!\");\n \t\n }\n else\n {\n return s[top--];\n }\n }", "private void multiple() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value1*value2);\n\t\t}\n\t}", "private void twoPower()\n\t{\n\t\tif(Fun == null)\n\t\t{\n\t\t\tsetLeftValue();\n\t\t\tresult = calc.twoPower ( );\n\t\t\tupdateText();\n\t\t}\n\t}", "public final void mod() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue > 0) {\n\t\t\t\tpush(secondTopMostValue % topMostValue);\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand + theSecondOperand);\n }", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the top 2 values and add them\n // and push the result onto the value stack\n //\n final Double theSecondOperand = theContext.popValue();\n final Double theFirstOperand = theContext.popValue();\n theContext.pushValue(theFirstOperand / theSecondOperand);\n }", "private void uminus() throws Exception{\n\t\tif(stackEmpty()) throw new Exception(\"Stack ist leer\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tstack.push(value1*(-1));\n\t\t}\n\t\t\n\t}", "private void minus() throws Exception{\n\t\tif(!(stackBiggerThanTwo())) throw new Exception(\"Stack hat zu wenig einträge mindestens 2 werden gebraucht!!\");\n\t\telse{\n\t\t\tvalue1=stack.pop();\n\t\t\tvalue2=stack.pop();\n\t\t\tstack.push(value2-value1);\n\t\t}\n\t}", "@Test\n public void testCal(){\n Stack<Double> stack = new Stack<>();\n Double num = 3.14;\n stack.push(num);\n operator = new UndoOperator();\n Stack<String> historyStack = new Stack<>();\n historyStack.push(num.toString());\n try {\n operator.cal(stack,historyStack);\n }catch (Exception e){\n Assert.fail(\"No exception should be thrown.\");\n }\n Assert.assertEquals(0,stack.size());\n Assert.assertEquals(0,historyStack.size());\n\n //test \"+\"\n Double result = 100.00;\n stack.clear();\n stack.push(result);\n operator = new UndoOperator();\n Double secOperand = 5.00;\n historyStack.clear();\n historyStack.push(secOperand.toString());\n historyStack.push(OperatorType.PLUS.getName());\n try {\n operator.calculate(stack,historyStack);\n }catch (Exception e){\n Assert.fail(\"No exception should be thrown.\");\n }\n Assert.assertEquals(secOperand,stack.pop(),0.0000001);\n Assert.assertEquals(result-secOperand,stack.pop(),0.0000001);\n\n //test \"-\"\n result = 100.00;\n stack.clear();\n stack.push(result);\n operator = new UndoOperator();\n secOperand = 5.00;\n historyStack.clear();\n historyStack.push(secOperand.toString());\n historyStack.push(OperatorType.MINUS.getName());\n try {\n operator.calculate(stack,historyStack);\n }catch (Exception e){\n Assert.fail(\"No exception should be thrown.\");\n }\n Assert.assertEquals(secOperand,stack.pop(),0.0000001);\n Assert.assertEquals(result+secOperand,stack.pop(),0.0000001);\n\n //test \"*\"\n result = 100.00;\n stack.clear();\n stack.push(result);\n operator = new UndoOperator();\n secOperand = 5.00;\n historyStack.clear();\n historyStack.push(secOperand.toString());\n historyStack.push(OperatorType.MULTIPLY.getName());\n try {\n operator.calculate(stack,historyStack);\n }catch (Exception e){\n Assert.fail(\"No exception should be thrown.\");\n }\n Assert.assertEquals(secOperand,stack.pop(),0.0000001);\n Assert.assertEquals(result/secOperand,stack.pop(),0.0000001);\n\n //test \"/\"\n result = 100.00;\n stack.clear();\n stack.push(result);\n operator = new UndoOperator();\n secOperand = 5.00;\n historyStack.clear();\n historyStack.push(secOperand.toString());\n historyStack.push(OperatorType.DIVIDE.getName());\n try {\n operator.calculate(stack,historyStack);\n }catch (Exception e){\n Assert.fail(\"No exception should be thrown.\");\n }\n Assert.assertEquals(secOperand,stack.pop(),0.0000001);\n Assert.assertEquals(result*secOperand,stack.pop(),0.0000001);\n\n //test \"sqrt\"\n result = 100.00;\n stack.clear();\n stack.push(result);\n operator = new UndoOperator();\n historyStack.clear();\n secOperand = 5.00;\n historyStack.push(secOperand.toString());\n historyStack.push(OperatorType.SQRT.getName());\n try {\n operator.calculate(stack,historyStack);\n }catch (Exception e){\n Assert.fail(\"No exception should be thrown.\");\n }\n Assert.assertEquals(result*result,stack.pop(),0.0000001);\n }", "public final void max() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t} else {\n\t\t\t\tpush(topMostValue);\n\t\t\t}\n\t\t}\n\t}", "Double postfixCalc(PostFixReturn returnValue){\r\n //data initialization\r\n Stack<Character> input = returnValue.postFix;\r\n\r\n char event;\r\n Stack<Double> Values = new Stack<>();\r\n String numStr=\"\";\r\n double number1,number2,number;\r\n double result = 0.0000;\r\n Long temp;\r\n //main loop\r\n while (!input.empty()){\r\n //detects numerics and converts it into doubles and place it within stack\r\n if(input.peek()=='|'){\r\n input.pop();\r\n while(input.peek()!='|'){\r\n Character c = input.pop();\r\n numStr += c;\r\n }\r\n input.pop();\r\n //detects strings as keys\r\n if(map.containsKey(numStr)){\r\n number = map.get(numStr);\r\n }\r\n else {\r\n number = Double.valueOf(numStr);\r\n }\r\n// number = Double.valueOf(numStr);\r\n Values.push(number);\r\n numStr = deleteString();\r\n }\r\n // checks operand and uses the last 2 numerics as input\r\n else if(operator(input.peek())){\r\n //checks events and does calculations\r\n event = input.pop();\r\n number1= Values.pop();\r\n System.out.println(\"Operand1: \" + number1);\r\n number2 = Values.pop();\r\n System.out.println(\"Operand2: \" + number2);\r\n System.out.println(\"Operator: \" + event);\r\n if (event == '+'){\r\n result = number2 + number1;\r\n }\r\n else if (event == '-'){\r\n result = number2 - number1;\r\n }\r\n else if (event == '*'){\r\n result = number2 * number1;\r\n }\r\n else if (event == '/'){\r\n result = number2 / number1;\r\n }\r\n else if (event == '^') {\r\n result = Math.pow(number2, number1);\r\n }\r\n System.out.println(\"result: \"+result);\r\n Values.push(result);\r\n }\r\n\r\n else{\r\n input.pop();\r\n }\r\n }\r\n result = Values.pop();\r\n //places into hashmap\r\n if (returnValue.status){\r\n map.put(returnValue.key,result);\r\n }\r\n\r\n return result;\r\n }", "public int pop() {\r\n LinkedList<Integer> queue = new LinkedList<>();\r\n int value = stack.poll();\r\n while(!stack.isEmpty()){\r\n queue.offer(value);\r\n value = stack.poll();\r\n }\r\n stack = queue;\r\n return value;\r\n }", "private void processOperator(String operator){\n if (numStack.size() <2){\n System.out.println(\"Stack underflow.\");\n }\n else if (dividingByZero(operator)){\n System.out.println(\"Divide by 0.\"); \n }\n else{\n int num1 = numStack.pop();\n int num2 = numStack.pop();\n int result = performCalculation(num1, num2, operator);\n numStack.push(result);\n }\n\n }", "int pop() {\n if (data.size() == 1) {\r\n min = 0;\r\n return data.pop();\r\n }\r\n else if (data.size() > 1) {\r\n int val = data.peek();\r\n if (val < min) {\r\n val = min;\r\n min = min * 2 - data.peek();\r\n data.pop();\r\n return val;\r\n }\r\n return data.pop();\r\n }\r\n else {\r\n System.out.println(\"Stack underflow\");\r\n return -1;\r\n }\r\n }", "public void pop() {\r\n \t Queue<Integer> temp=new LinkedList<Integer>();\r\n \t int counter=0;\r\n \t while(!stack.isEmpty()){\r\n \t temp.add((Integer) stack.poll());\r\n \t counter++;\r\n \t \r\n \t }\r\n \t while(counter>1)\r\n \t {\r\n \t \r\n \t stack.add(temp.poll());\r\n \t counter--;\r\n \t }\r\n }", "public final double pop() {\n\t\tdouble returnValue = defaultValue;\n\n\t\tif (!isEmpty()) {\n\n\t\t\tdouble value = stack[index];\n\t\t\tindex--;\n\t\t\tsize--;\n\t\t\treturnValue = value;\n\t\t}\n\n\t\treturn returnValue;\n\t}", "public Integer pop() \n\t{ \n\t\tint x = super.pop(); \n\t\tmin.pop(); \n\t\treturn x; \n\t}", "private void eToPower()\n\t{\n\t\tif(Fun == null)\n\t\t{\n\t\t\tsetLeftValue();\n\t\t\tresult = calc.eToPower ();\n\t\t\tupdateText();\n\t\t\tsetLeftValue();\n\t\t}\n\t}", "private int minusExpoBaseTwo(int order){\n double cnt = 0;\n //This allows us to add the exponatials together whilst decreasing the power each time effectively making 2^(order) + 2^(order-1)....until order equals 1\n for(int i = order;i>0;i--){\n cnt = cnt + Math.pow(2, i);\n }\n //Converts it back to an int\n return (int) cnt;\n }", "public void printEval()\r\n {\r\n eval = ((int)numbers.pop());\r\n System.out.println(\"Postfix Evaluation: \" + eval);\r\n pw.println(\"Postfix Evaluation: \" + eval);\r\n}", "private void stackPopElements(int height,int p){\n\t\tint recEnd = p-1;\n\t\tint size;\n\t\t//again, for the equal case; we pop element that equal to height in the stack; cause it's not useful anymore.\n\t\t// and also, we don't need to calc the value for it, cause it's guaranteed no the best value yet;\n\t\twhile(!hStack.isEmpty()&&hStack.peek()>=height){\n\t\t\tint sh = hStack.pop();\n\t\t\tint sp = pStack.pop();\n//\t\t\tSystem.out.println(\"------------- sh and sp is: \"+sh+\" sp:\"+sp+\" size left is: \"+pStack.size());\n\t\t\t\n\t\t\tint start;\n\t\t\tif(sh==height){\n\t\t\t\t//ignore;\n\t\t\t}else{\n\t\t\t\tif(pStack.isEmpty()){\n\t\t\t\t\tstart = 0;\n\t\t\t\t}else{\n\t\t\t\t\tstart = pStack.peek()+1; // element smaller than this height is at this position;\n\t\t\t\t}\n\t\t\t\tsize = (p-start)*sh; // size is width*height;\n//\t\t\t\tSystem.out.println(\" height : \"+sh+\" size: \"+size);\n//\t\t\t\tSystem.out.println(\" p and start : \"+p+\" start:\"+start);\n\t\t\t\tif(size>max){\n\t\t\t\t\t// also can record other things if we want;\n\t\t\t\t\tmax = size; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int pop() {\n int result;\n while(!stack.isEmpty()){\n cache.add(stack.removeLast());\n }\n result = cache.removeLast();\n while(!cache.isEmpty()){\n stack.add(cache.removeLast());\n }\n System.out.println(result);\n return result;\n }", "protected void operation(String op) {\n \tint value;\n \tif (stack.empty()) {\n \t\tenter();\n \t}\n \telse {\n \t\tint second = stack.pop();\n \t // handles when only one value in stack\n \t\tif (stack.empty()) {\n \t\t\tif (op.equals(\"+\")) {\n \t\t\t\tstack.push(second);\n \t\t\t}\n \t\t\telse if (op.equals(\"-\")) {\n \t\t\t\tcurrent = second *-1;\n \t\t\t\tstack.push(current);\n \t\t\t\tshow(stack.peek());\n \t\t\t\tcurrent = 0;\n \t\t\t}\n \t\t\telse if (op.equals(\"*\")) {\n \t\t\t\tstack.push(0);\n \t\t\t\tshow(stack.peek());\n \t\t\t}\n \t\t\telse {\n \t\t\t\tstack.push(0);\n \t\t\t\tshow(stack.peek());\n \t\t\t}\n \t\t}\n \t // handles the other cases\n \t\telse {\n \t\t\tif (op.equals(\"+\")) {\n \t\t\t\tvalue = second + stack.pop();\n \t\t\t\tdisplayOperatedValue(value);\n \t\t\t}\n \t\t\telse if (op.equals(\"-\")) {\n \t\t\t\tvalue = stack.pop() - second;\n \t\t\t\tdisplayOperatedValue(value);\n \t\t\t}\n \t\t\telse if (op.equals(\"*\")) {\n \t\t\t\tvalue = stack.pop() * second;\n \t\t\t\tdisplayOperatedValue(value);\n \t\t\t}\n \t\t\telse {\n \t\t\t\tvalue = stack.pop() / second;\n \t\t\t\tdisplayOperatedValue(value);\n \t\t\t}\n \t\t}\n \t}\n }", "@Override\n public void step(final EvaluationContext theContext)\n {\n // pop the value, negate, push the value\n //\n final Double theOperand = theContext.popValue();\n theContext.pushValue(-theOperand);\n }", "public double processPostfix(String postfix){\n char[] postfixArr = postfix.toCharArray(); //Convert string to Char Array\n\n //loop through the array, looking at each value\n for(int i = 0; i < postfixArr.length; i++){\n\n //If digit, push it into the stack\n if(Character.isDigit(postfixArr[i])){\n s.push(postfixArr[i]);\n }\n else{\n double d1 = convertToDbl(s.pop()); //convert to double\n double d2 = convertToDbl(s.pop());\n\n //switch to determine what operation should be performed - printed out for testing\n switch(postfixArr[i]){\n case '+':\n System.out.println(d2 + \" + \" + d1); s.push(d2+d1); System.out.println(\"= \" + (d2+d1)); break;\n case '-':\n System.out.println(d2 + \" - \" + d1); s.push(d2-d1); System.out.println(\"= \" + (d2-d1)); break;\n case '*':\n System.out.println(d2 + \" * \" + d1); s.push(d2 * d1); System.out.println(\"= \" + (d2*d1));break;\n case '/':\n System.out.println(d2 + \"/\" + d1); s.push(d2/d1); System.out.println(\"= \" + (d2/d1));break;\n case '^':\n System.out.println(d2 + \" ^ \" + d1); s.push(Math.pow(d2, d1)); System.out.println(\"= \" + (Math.pow(d2,d1))); break;\n default:\n System.out.println(\"ERROR IN CODE!\");\n }\n }\n\n\n }\n\n double result = convertToDbl(s.top()); //return the item at top of the stack (converted to a double)\n s.pop();\n return result;\n }", "int pop2(TwoStack sq)\n {\n if(sq.top2<sq.size)\n {\n int yo2=sq.arr[sq.top2];\n sq.top2++;\n return yo2;\n }\n else\n {\n return -1;\n }\n \n }", "@Test\n public void testTop() {\n System.out.println(\"top\");\n Stack2 instance = new Stack2();\n int expResult = 7;\n instance.push(7);\n int result = instance.top();\n assertEquals(expResult, result);\n }", "int pop2(TwoStack sq) {\n if (sq.top2 < sq.size) {\n int x = sq.arr[sq.top2];\n sq.top2++;\n return x;\n } else {\n return -1;\n }\n }", "public int pop(){\n \tint data=0;\n \tif(isEmpty())\n \tSystem.out.println(\"Stack is underflow\");\n \telse\n \tdata=elements[top--];\n \treturn data;\n\t}", "private synchronized BackStep pop() {\r\n\t\t\tBackStep bs;\r\n\t\t\tbs = stack[top];\r\n\t\t\tif (size == 1) {\r\n\t\t\t\ttop = -1;\r\n\t\t\t} else {\r\n\t\t\t\ttop = (top + capacity - 1) % capacity;\r\n\t\t\t}\r\n\t\t\tsize--;\r\n\t\t\treturn bs;\r\n\t\t}", "public int top() {\r\n Queue<Integer> temp=new LinkedList<Integer>();\r\n int counter=0;\r\n while(!stack.isEmpty()){\r\n temp.add((Integer) stack.poll());\r\n counter++;\r\n \r\n }\r\n while(counter>1)\r\n {\r\n \r\n stack.add(temp.poll());\r\n counter--;\r\n }\r\n int topInteger=temp.poll();\r\n stack.add(topInteger);\r\n return topInteger;\r\n \r\n }", "@Test\n public void testPop() {\n System.out.println(\"pop\");\n Stack2 instance = new Stack2();\n int expResult = 3;\n instance.push(1);\n instance.push(2);\n instance.push(expResult);\n int result = instance.pop();\n assertEquals(expResult, result);\n }", "public int pop(){\n if (isEmpty()) throw new RuntimeException(\"Stack underflow\");\n int tmp=myarray[top];\n top--;\n return tmp;\n \n \n }", "double peek()\n {\n if (empty()) {\n \tthrow new IllegalArgumentException(\"empty stack!\");\n }\n else\n {\n return s[top];\n }\n }", "@Test\n public void testCalculateRPNStack() throws Exception {\n String[] expression = {\"3\",\"4\",\"+\",\"8\",\"3\",\"-\",\"+\",\"10\",\"2\",\"/\", \"3\", \"+\", \"*\", \"15\",\"/\"};\n double result = solver.calculateRPNCustom(expression);\n\n assertThat(result, is(6.4));\n }", "public Integer eval() {\r\n Stack<String> operatorStack = new Stack<String>();\r\n Stack<Integer> valueStack = new Stack<Integer>();\r\n\r\n // ADD YOUR CODE BELOW HERE\r\n // ..\r\n for (int i = tokenList.size() - 1; i >= 0; i--) {\r\n if (isInteger(tokenList.get(i))) {\r\n valueStack.push(Integer.parseInt(tokenList.get(i)));\r\n } else {\r\n operatorStack.push(tokenList.get(i));\r\n }\r\n }\r\n \r\n \r\n \r\n help(operatorStack,valueStack);\r\n \r\n // ..\r\n // ADD YOUR CODE ABOVE HERE\r\n\r\n return valueStack.get(0); // DELETE THIS LINE\r\n }", "private static int pop(Stack<Integer> top_ref) {\n /*If stack is empty then error */\n if (top_ref.isEmpty()) {\n System.out.println(\"Stack Underflow\");\n System.exit(0);\n }\n //pop the data from the stack\n return top_ref.pop();\n }", "public int top() {\n if(!stack2.isEmpty()) {\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n else {\n while(!stack1.isEmpty()) {\n stack2.push(stack1.pop());\n }\n Integer k = stack2.pop();\n stack2.push(k);\n return k;\n }\n }", "public static void main(String[] args) {\n BigDecimal bigDecimal = new BigDecimal(2);\n BigDecimal divisor = bigDecimal.pow(256);\n BigDecimal dividend = divisor.add(new BigDecimal(-1));\n BigDecimal multiplier = new BigDecimal(2).pow(128);\n// BigDecimal result = dividend.divide(divisor).pow(multiplier);\n// System.out.println(result);\n }", "int pop() {\r\n\t\ttop--;\r\n\t\treturn stack[top];\r\n\t}", "int pop() \r\n {\n if(top < 0)\r\n {\r\n System.out.println(\"Stack Underflow Occurred!\");\r\n return -1;\r\n }\r\n //Write your code here\r\n int p = a[top];\r\n top--;\r\n return p; \r\n }", "public ExParValue pop() {\r\n\t\tExParValue v = null;\r\n\t\tif (value.next != null) {\r\n\t\t\tv = value;\r\n\t\t\tvalue = value.next;\r\n\t\t\t// System.out.println(\"ExPar.pop() Popping \" + v.toString() +\r\n\t\t\t// \" now on top: \" + value.toString());\r\n\t\t} else {\r\n\t\t\tnew ParameterValueError(\"ExPar.pop() without preceding push()\");\r\n\t\t}\r\n\t\t/*\r\n\t\t * if (value == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack empty.\"); } else if\r\n\t\t * (value.next == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): A single value is on the stack: \" +\r\n\t\t * value.toString()); } else {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack: \" + value.toString() +\r\n\t\t * \", \" + value.next.toString()); }\r\n\t\t */\r\n\t\treturn (v);\r\n\t}", "@Override\n public void popOperands(Stack<ExpNode> stack) {\n this.expr = stack.pop();\n }", "public static void popCostlyOperation(){\r\n Queue<Integer> queue=new LinkedList<>();\r\n Queue<Integer> supportQueue=new LinkedList<>();\r\n for(int i=0;i<10;++i){\r\n while(!queue.isEmpty())\r\n supportQueue.add(queue.poll());\r\n\r\n queue.add(i*i);\r\n while(!supportQueue.isEmpty())\r\n queue.add(supportQueue.poll());\r\n\r\n System.out.println(queue);\r\n System.out.println();\r\n }\r\n\r\n\r\n System.out.println(\"The pop operation\");\r\n while(!queue.isEmpty()){\r\n System.out.println(queue);\r\n while(!queue.isEmpty())supportQueue.add(queue.poll());\r\n System.out.println(supportQueue.poll());\r\n while(!supportQueue.isEmpty())queue.add(supportQueue.poll());\r\n }\r\n\r\n }", "public final void swap() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(topMostValue);\n\t\t\tpush(secondTopMostValue);\n\t\t}\n\t}", "@Test\n public void testThreePushPop(){\n ms = new MyStack();\n int pn1=3, pn2=4, pn3=5;\n ms.push(pn1);\n ms.push(pn2);\n ms.push(pn3);\n assertEquals(pn3,ms.pop());\n assertEquals(pn2,ms.pop());\n assertEquals(pn1,ms.pop());\n }", "public int pop() {\n int value = top.value;\n top = top.pre;\n top.next = null;\n size--;\n return value;\n }", "private CustomQueue<String> evaluatePostFix(CustomQueue<String>postfix){\r\n CustomStack<String> numberStack = new CustomStack();\r\n CustomQueue<String> result = new CustomQueue();\r\n \r\n while (postfix.isEmpty() == false){\r\n String value = postfix.remove();\r\n if (isOperator(value)){\r\n //First popped value should be on the right hand side of the operator\r\n double val2 = Double.parseDouble(numberStack.pop());\r\n //Second popped value should be on the left hand side of the operator\r\n double val1 = Double.parseDouble(numberStack.pop());\r\n String operation_result = calculate(val1, val2, value);\r\n numberStack.push(operation_result);\r\n }\r\n else{\r\n //It should be a number\r\n numberStack.push(value);\r\n }\r\n }\r\n \r\n if (numberStack.empty())\r\n result.add(\"0\");\r\n else\r\n result.add(numberStack.pop());\r\n \r\n return result;\r\n }", "public static void main(String args[]) {\n StackVenkataKalyanKrishnaVarmaSagi<Integer> stackVenkataKalyanKrishnaVarmaSagi = new StackVenkataKalyanKrishnaVarmaSagi();\n\n //Take input\n System.out.println(\"Enter a string: \");\n Scanner scanner = new Scanner(System.in);\n String input = scanner.next();\n for (int i = 0; i < input.length(); i++) {\n if (input.charAt(i) == '*' || input.charAt(i) == '+' || input.charAt(i) == '-' || input.charAt(i) == '*' || input.charAt(i) == '^') {\n char operator = input.charAt(i);\n int a = stackVenkataKalyanKrishnaVarmaSagi.pop();\n int b = stackVenkataKalyanKrishnaVarmaSagi.pop();\n if (operator == '+')\n stackVenkataKalyanKrishnaVarmaSagi.push(b + a);\n if (operator == '-')\n stackVenkataKalyanKrishnaVarmaSagi.push(b - a);\n if (operator == '*')\n stackVenkataKalyanKrishnaVarmaSagi.push(b * a);\n if (operator == '/' && a != 0) //make sure you are not performing division with 0\n stackVenkataKalyanKrishnaVarmaSagi.push(b / a);\n if (operator == '^')\n stackVenkataKalyanKrishnaVarmaSagi.push((int) Math.pow(b, a));\n } else {\n int operand = Character.getNumericValue(input.charAt(i));\n stackVenkataKalyanKrishnaVarmaSagi.push(operand);\n }\n }\n if (stackVenkataKalyanKrishnaVarmaSagi.size() > 1)\n System.out.println(\"The input Postfix expression is not valid.\");\n else\n System.out.println(\"Result value: \" + stackVenkataKalyanKrishnaVarmaSagi.pop());\n }", "public void pop() throws StackUnderflowException;", "public Object peak(){\n \t if(top==null) System.out.println(\"stack is empty\");\n \t return top.value;\n }", "public double power ( int num1, int num2) throws RemoteException;", "int pop2()\n {\n if(top2 == size) {\n System.out.println(\"Second Stack is empty.\");\n return -1;\n }\n\n int popped = arr[top2];\n ++top2;\n return popped;\n }", "public void pop() {\n if(stack.pop() == min)\n min=stack.pop();\n }", "public void peekStack() {\n\n\t\tSystem.out.println(\"The Peek value is: \" + arrayValues[topOfStack]);\n\n\t}", "void push(int val) {\n if (data.size() == 0) {\r\n data.push(val);\r\n min = val;\r\n }\r\n else {\r\n if (val <= min) {\r\n data.push(val * 2 - min);\r\n min = val;\r\n }\r\n else\r\n data.push(val);\r\n }\r\n }", "@Override\n\tpublic int pop() {\n\t\tint topValue;\n\t\tif (top != -1) {\n\t\t\ttopValue = intContainer[top];\n\t\t\ttop = top - 1;\n\t\t\treturn topValue;\n\t\t} else {\n\t\t\tSystem.out.println(\"Stack Undeflow\");\n\t\t\treturn -1;\n\t\t}\n\t}", "void push2(int x, TwoStack sq)\n {\n \n if(sq.top2>sq.size/2)\n {\n sq.top2--;\n sq.arr[sq.top2]=x;\n }\n \n }", "void push2(int x) {\n --top2;\n if(top2 == size / 2) {\n System.out.println(\"Second stack is full\");\n return;\n }\n arr[top2] = x;\n }", "public final void dup() {\n\t\tif (size > 0) {\n\t\t\tdouble topMostValue = stack[index];\n\t\t\tpush(topMostValue);\n\t\t}\n\t}", "public int top() {\r\n int value = this.pop();\r\n this.stack.offer(value);\r\n return value;\r\n }", "public ValueWrapper pop(String keyName) {\n\t\tif(isEmpty(keyName)) {\n\t\t\tthrow new EmptyStackException();\n\t\t}\n\t\tvar value = multistack.get(keyName);\n\t\tif(value.next != null) {\n\t\t\tmultistack.put(keyName, value.next);\n\t\t}\n\t\telse {\n\t\t\tmultistack.remove(keyName);\n\t\t}\n\t\treturn value.value;\n\t}", "public final void rot() {\n\t\tif (size > 2) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tdouble thirdTopMostValue = pop();\n\n\t\t\tpush(secondTopMostValue);\n\t\t\tpush(topMostValue);\n\t\t\tpush(thirdTopMostValue);\n\n\t\t}\n\t}", "public T pop() {\r\n\t\t\r\n\t\tT numPila = this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\tfor (StackObserver<T> o : observers )\r\n\t\t\to.onPop(numPila);\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\treturn numPila;\r\n\t\t\r\n\t\t//return this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\t\r\n\t}", "public double Multiplicacion(Stack<String> StackLinea) {\n double resultado = 1;\n try {\n if (ComprobarNumero(StackLinea.peek())) {\n resultado = Double.parseDouble(StackLinea.pop());\n } else {\n if(auxiliar.isEmpty()) {\n resultado = hashmap.get(StackLinea.pop());\n }\n else {\n resultado = auxiliar.get(StackLinea.peek());\n auxiliar.remove(StackLinea.pop());\n }\n }\n\n while (!StackLinea.isEmpty()) {\n if (ComprobarNumero(StackLinea.peek())) {\n double variable = Double.parseDouble(StackLinea.pop());\n resultado = resultado * variable;\n } else {\n if(auxiliar.isEmpty()) {\n double variable = hashmap.get(StackLinea.pop());\n resultado = resultado * variable;\n }\n else {\n double variable = auxiliar.get(StackLinea.peek());\n resultado = resultado * variable;\n auxiliar.remove(StackLinea.pop());\n }\n }\n }\n } catch (Exception e) {\n System.out.println(\"Error de Sintaxis\");\n }\n\n return resultado;\n }", "public int pop() {\n\n if (top > 0) {\n top --;\n }\n else {\n System.out.println(\"Stack Underflow\");\n return -100;\n }\n return stack[top];\n }", "public static void main(String[] args) throws FileNotFoundException {\n Stack postfixStack = new Stack();\n\n// create a dat file scanner\n\n //String path = new File(\"HW1/src/com/sunynp/assign1-in.dat\").getAbsolutePath();\n //System.out.println(path);\n Scanner datscan = new Scanner(new File(\"assign1-in.dat\"));\n double[] input = new double[100];\n int i = 0;\n\n while (datscan.hasNextLine()) {\n String s = datscan.nextLine();\n System.out.print(\"The value of \\\"\" + s + \"\\\" is \");\n String op = \"\";\n\n\n String[] parts = s.split(\" \");\n for (String next : parts) {\n\n Double a;\n Double b;\n switch (next) {\n case \"+\":\n a = postfixStack.pop();\n b = postfixStack.pop();\n // System.out.println(a + b);\n postfixStack.push(a + b);\n\n break;\n case \"-\":\n b = postfixStack.pop();\n a = postfixStack.pop();\n // System.out.println(a - b);\n postfixStack.push(a - b);\n break;\n case \"*\":\n a = postfixStack.pop();\n b = postfixStack.pop();\n //System.out.println(a * b);\n postfixStack.push(a * b);\n break;\n case \"/\":\n b = postfixStack.pop();\n a = postfixStack.pop();\n // System.out.println(a / b);\n postfixStack.push(a / b);\n break;\n case \"_\":\n a = postfixStack.pop();\n // System.out.println(0 - a);\n postfixStack.push(0 - a);\n break;\n case \"#\":\n a = postfixStack.pop();\n\n // System.out.println(Math.sqrt(a));\n postfixStack.push(Math.sqrt(a));\n break;\n case \"^\":\n b = postfixStack.pop();\n a = postfixStack.pop();\n // System.out.println(Math.pow(a, b));\n postfixStack.push(Math.pow(a, b));\n break;\n case \" \":\n //System.out.println(\"SPACE\");\n break;\n default:\n\n\n postfixStack.push(Double.valueOf(next));\n\n }\n }\n System.out.println(postfixStack.pop());\n System.out.println();\n }\n\n System.out.println(\"Bye-bye!\");\n datscan.close();\n }", "public void pop()\r\n\t{\r\n\t\ttop--;\r\n\t\tstack[top] = null;\r\n\t}", "public int pop() { //第二个栈为空 , 就将第一个栈的数据往第二个里面加\n if(empty()){\n throw new UnsupportedOperationException(\"栈为空\");\n }\n if(temp2.empty()){\n while(!temp1.empty()){\n temp2.push(temp1.pop());\n }\n }\n return temp2.pop(); //不管是否为空,直接pop第二个栈\n }", "public T pop() {\n \tT retVal = stack.get(stack.size() - 1); // get the value at the top of the stack\n \tstack.remove(stack.size() - 1); // remove the value at the top of the stack\n \treturn retVal;\n }", "@Override\n\tpublic double GetValue() {\n\t\tdouble spot = inputs.getSpot();\n\t\tdouble strike = inputs.getStrike();\n\t\tdouble vol = inputs.getVol();\n\t\tint noSteps=inputs.getNoSteps();\n\t\tdouble expiry=inputs.getExpiry();\n\t OptionType type=inputs.getType();\n\t ExerciseType exercise=inputs.getExercise();\n\t InterestRate interestRate=inputs.getR();\n\t\t\n\t double timestep = expiry/noSteps;\n\t double DF = Math.exp(-interestRate.GetRate(1.)*timestep);\n\t double temp1 = Math.exp((interestRate.GetRate(1.) + vol * vol)*timestep);\n\t double temp2 = 0.5 * (DF + temp1);\n\t double up = temp2 + Math.sqrt(temp2*temp2 - 1);\n\t double down = 1/ up;\n\t double probaUp = (Math.exp(interestRate.GetRate(1.) * timestep) - down)/(up -down) ;\n\t double probaDown = 1 - probaUp;\n\n\t //stock price tree\n\t\tstockPrice[0][0]=spot;\n\t for (int n = 1; n <= noSteps; n ++) {\n for (int j = n; j > 0; j--){\n \tstockPrice[j][n] = up * stockPrice[j-1][n-1];\n }\n \t\tstockPrice[0][n] = down * stockPrice[0][n-1];\n }\n\t \n\t //last column set payoffs\n\t\tfor (int j = 0; j <= noSteps; j++) {\n\t\t\t\tif(type.equals(OptionType.CALL)) {\n\t\t\t\t\tpayOff[j][noSteps] = Math.max(this.stockPrice[j][noSteps] - strike, .0);\n\t\t\t\t}else {\n\t\t\t\t\tpayOff[j][noSteps] = Math.max(strike - this.stockPrice[j][noSteps], .0);\n\t\t\t\t}\n\t\t}\n\n\t\t\n\t //payoff tree in backwardation\n\t \n\t for (int i = noSteps ; i >= 1; i--) {\n for (int j = 0; j <= i-1; j++) {\n\t \tif(exercise.equals(ExerciseType.AMERICAN)) { \n\t //American\t\n\t \t\tif(type.equals(OptionType.CALL)) {\n\t \t\t\t\tpayOff[j][i-1] = Math.max(DF * (probaUp * payOff[j+1][i] + probaDown * payOff[j][i]) ,\n\t \t\t\t\tMath.max(this.stockPrice[j][i-1] - strike, .0));\n\t \t\t\t\n\t \t\t}else \tpayOff[j][i-1] = Math.max(DF * (probaUp * payOff[j+1][i] + probaDown * payOff[j][i]) ,\n\t \t\t\t\tMath.max(strike - this.stockPrice[j][i-1] , .0));\n\t \t}else { \n\t \t\t\t//European put and call option\n\t \t\t\t\tpayOff[j][i-1] = DF * (probaUp * payOff[j+1][i] + probaDown * payOff[j][i]);\n\t }\n }\n }\n\t \n\t double deltaUp = (payOff[0][2]-payOff[1][2])/(stockPrice[0][2]-stockPrice[1][2]);\n\t double deltaDown = (payOff[1][2]-payOff[2][2])/(stockPrice[1][2]-stockPrice[2][2]);\n\t delta = (deltaUp + deltaDown) /2;\n\t gamma = (deltaUp-deltaDown)/((stockPrice[0][2]-stockPrice[2][2])/2);\n\t theta = (payOff[1][2]-payOff[0][0])/(365*2*timestep);//time in days\n\t \n\t long rounded = Math.round(payOff[0][0]*10000);\n\t return rounded/10000.0;\n\t}", "public T top() throws StackUnderflowException;", "@Override\n public void reduce() {\n if(null != getState())\n switch(getState()) {\n case OPERATOR:\n if (getDispenser().tokenIsOperator() && numOpNumOnStack())\n priorityReduce();\n break;\n case RIGHT_PAREN:\n if (getDispenser().tokenIsRightParen()) {\n if (!getStack().contains('('))\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n while ((char)getStack().get(getStack().size() - 2) != '(')\n reduceNumOpNum();\n double aNum = (double)getStack().pop();\n getStack().pop();\n getStack().push(aNum);\n }\n break;\n case END:\n if (getDispenser().tokenIsEOF()) {\n if(getStack().contains('('))\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n while(numOpNumOnStack())\n reduceNumOpNum();\n if(getStack().size() != 1)\n throw new RuntimeException(\"Error -- mismatched parentheses\");\n }\n break;\n }\n }", "static int pop(Stack<Integer> top_ref) {\r\n /* If stack is empty then error */\r\n if (top_ref.isEmpty()) {\r\n System.out.println(\"Stack Underflow\");\r\n System.exit(0);\r\n }\r\n\r\n // pop the data from the stack\r\n return top_ref.pop();\r\n }", "int pop1(TwoStack sq)\n {\n if(sq.top1>=0)\n {\n int yo=sq.arr[sq.top1];\n sq.top1--;\n return yo;\n }\n else\n {\n return -1;\n }\n \n }", "int pop()\n\t{\n // Your code here\n if(top == -1){\n return -1;\n }\n int x = arr[top];\n top--;\n return x;\n\t}", "public Object pop() {\n if (top != null) {\n Object item = top.getOperand();\n\n top = top.next;\n return item;\n }\n\n System.out.println(\"Stack is empty\");\n return null;\n\n }", "public final void div() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue > 0) {\n\t\t\t\tpush(secondTopMostValue / topMostValue);\n\t\t\t}\n\t\t}\n\t}", "public void pop(){\n // check if there is any stack present or not\n if(this.arr==null){\n System.out.println(\"No stack present, first create a stack\");\n return;\n }\n // check if stack is empty\n if(this.topOfStack==-1){\n System.out.println(\"Stack is empty, can't pop from stack\");\n return;\n }\n // if stack is not empty\n this.arr[this.topOfStack]=Integer.MIN_VALUE;\n this.topOfStack--;\n }", "void push2(int x, TwoStack sq) {\n if (sq.top1 < sq.top2 - 1) {\n sq.top2--;\n sq.arr[sq.top2] = x;\n }\n }", "public void pop(){\n \n if(top==null) System.out.println(\"stack is empty\");\n else top=top.next;\n \t\n }", "private void sqrt() throws Exception{\n\t\tif(stackEmpty()) throw new Exception(\"Stack ist leer\");\n\t\telse{\n\t\t\tvalue1 = stack.pop();\n\t\t\tstack.push(Math.sqrt(value1));\n\t\t}\n\t\t\n\t}", "int pop1(TwoStack sq) {\n if (sq.top1 >= 0) {\n int x = sq.arr[sq.top1];\n sq.top1--;\n return x;\n } else {\n return -1;\n }\n }", "public int pop() {\n while (!push.isEmpty()){\n pull.push(push.pop());\n }\n int result= pull.pop();\n while (!pull.isEmpty()){\n push.push(pull.pop());\n }\n return result;\n }", "public Polynomial postfixEval(List<Token> postfixtokenList){\n ArrayDeque<Token> stack = new ArrayDeque<Token>(); \n\n Polynomial result = new Polynomial(); \n for (Token token : postfixtokenList){\n if (token instanceof Polynomial)\n stack.push(token); \n else if (token instanceof Operator){\n Polynomial op2 = (Polynomial) stack.pop(); \n Polynomial op1 = (Polynomial) stack.pop(); \n result = ((Operator) token).operate(op1, op2);\n if (result == null) //for division by 0\n return null;\n stack.push(result); \n }\n }\n result = (Polynomial) stack.pop(); \n if (storingVar != ' '){\n memory.put(storingVar, result); \n storingVar = ' ';\n }\n return result; \n }", "public final void min() {\n\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (secondTopMostValue > topMostValue) {\n\t\t\t\tpush(topMostValue);\n\t\t\t} else {\n\t\t\t\tpush(secondTopMostValue);\n\t\t\t}\n\t\t}\n\t}", "static void stack_pop(Stack<Integer> stack)\r\n\t{\r\n\t\t\r\n\t\tSystem.out.print(\"Pop : \");\r\n\t\tfor(int i=0;i<5;i++)\r\n\t\t{\r\n\t\t\tInteger dataElement=(Integer)stack.pop();\r\n\t\t\tSystem.out.print(\" \"+ dataElement);\r\n\t\t\t\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}", "@Test\r\n public void testMaxSum() {\r\n Player player = new Player();\r\n int expResult = -1;\r\n int result = player.maxSum();\r\n assertEquals(expResult, result);\r\n \r\n Stack stack=new Stack(false);\r\n player.setHand(stack.drawTiles(28));\r\n int expResult2=12;\r\n int result2=player.maxSum();\r\n assertEquals(expResult2, result2);\r\n }", "private synchronized BackStep peek() {\r\n\t\t\treturn stack[top];\r\n\t\t}", "public static void main(String[] args) {\n\t\tStack<Double> stack = new Stack<Double>();\n\t\t//2. Use a loop to push 100 random doubles between 0 and 100 to the Stack.\n\t\tfor(int i=0;i<100;i++) {\n\t\t\tdouble rand = new Random().nextInt(100) + new Random().nextDouble();\n\t\t\tstack.push(rand);\n\t\t}\n\t\tScanner input = new Scanner(System.in);\n\t\t//3. Ask the user to enter in two numbers between 0 and 100, inclusive. \n\t\tJOptionPane.showMessageDialog(null, \"Enter a number between 0 and 100\");\n\t\tdouble userOne = input.nextDouble();\n\t\tJOptionPane.showMessageDialog(null, \"Enter a number between 0 and 100\");\n\t\tdouble userTwo = input.nextDouble();\n\t\t//4. Pop all the elements off of the Stack. Every time a double is popped that is\n\t\t// between the two numbers entered by the user, print it to the screen.\n\t\tfor(int i=0;i<stack.size();i++) {\n\t\t\tdouble pop = stack.pop();\n\t\t\tif(pop>userOne&&pop<userTwo) {\n\t\t\t\tSystem.out.println(pop);\n\t\t\t}\n\t\t}\n\t\t//while(!stack.isEmpty()) --- run until all elements pop \n\t\t\n\t\tSystem.out.println(\"///////////////////////////////////\");\n\t\tfor(int i=0;i<stack.size();i++) {\n\t\t\tSystem.out.println(stack.get(i));\n\t\t}\n\t\t// EXAMPLE:\n\t\t// NUM 1: 65\n\t\t// NUM 2: 75\n\t\t\n\t\t// Popping elements off stack...\n\t\t// Elements between 65 and 75:\n\t\t// 66.66876846\n\t\t// 74.51651681\n\t\t// 70.05110654\n\t\t// 69.21350456\n\t\t// 71.54506465\n\t\t// 66.47984807\n\t\t// 74.12121224\n\t}", "private final Object pop() {\r\n\t\treturn eval_stack.remove(eval_stack.size() - 1);\r\n\t}", "void pop() {\n // -\n top = top.getNextNode();\n }", "public final void add() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue + topMostValue);\n\t\t}\n\t}" ]
[ "0.71680355", "0.6601423", "0.6564644", "0.6508011", "0.644852", "0.64347404", "0.6428437", "0.63760763", "0.63366026", "0.63198936", "0.62985086", "0.6158783", "0.6088106", "0.6049005", "0.59233296", "0.5906486", "0.5827587", "0.58191913", "0.57590675", "0.5703018", "0.56899965", "0.5667884", "0.5654283", "0.5614528", "0.5603122", "0.55729896", "0.5551091", "0.5541468", "0.55412924", "0.55365455", "0.5530029", "0.55246156", "0.5522973", "0.55175114", "0.55152655", "0.5510044", "0.550276", "0.54980123", "0.5480471", "0.5478842", "0.54769075", "0.5476181", "0.5466184", "0.5461744", "0.54541147", "0.54427415", "0.54359305", "0.54312056", "0.54102093", "0.5392577", "0.5385041", "0.53811646", "0.53737444", "0.53674656", "0.535798", "0.53504395", "0.5334202", "0.5332511", "0.5331631", "0.5328554", "0.53219473", "0.5320942", "0.5315986", "0.53067094", "0.53041834", "0.53026927", "0.5295371", "0.5293936", "0.52817285", "0.5281435", "0.5279225", "0.52786005", "0.52764255", "0.5271184", "0.5256843", "0.5256313", "0.5255062", "0.5255023", "0.5243033", "0.524251", "0.5240892", "0.52408195", "0.5233744", "0.5231183", "0.52305335", "0.5228138", "0.52259165", "0.52256703", "0.5222261", "0.52218306", "0.52207685", "0.52203315", "0.5215606", "0.52124465", "0.521212", "0.52084744", "0.52051634", "0.51995003", "0.51903087", "0.51806223" ]
0.7109281
1
pop the value, negate, push the value
@Override public void step(final EvaluationContext theContext) { // pop the value, negate, push the value // final Double theOperand = theContext.popValue(); theContext.pushValue(-theOperand); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void dequeue(){\n if(isEmpty()!=1){\n\n for(int i=0;i<size-1;i++){\n values[i] = values[i+1];\n }\n\n values[size-1] = (-1);\n }\n }", "public ExParValue pop() {\r\n\t\tExParValue v = null;\r\n\t\tif (value.next != null) {\r\n\t\t\tv = value;\r\n\t\t\tvalue = value.next;\r\n\t\t\t// System.out.println(\"ExPar.pop() Popping \" + v.toString() +\r\n\t\t\t// \" now on top: \" + value.toString());\r\n\t\t} else {\r\n\t\t\tnew ParameterValueError(\"ExPar.pop() without preceding push()\");\r\n\t\t}\r\n\t\t/*\r\n\t\t * if (value == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack empty.\"); } else if\r\n\t\t * (value.next == null) {\r\n\t\t * System.out.println(\"ExPar.pop(): A single value is on the stack: \" +\r\n\t\t * value.toString()); } else {\r\n\t\t * System.out.println(\"ExPar.pop(): Value stack: \" + value.toString() +\r\n\t\t * \", \" + value.next.toString()); }\r\n\t\t */\r\n\t\treturn (v);\r\n\t}", "@Override\r\n\tpublic boolean pushValuesBackward() {\r\n\t\tboolean mod = false;\r\n\r\n\t\tValue resultBusValue = getResultBus().getValue();\r\n\r\n\t\tValue newValue = new Value(resultBusValue.getSize(),\r\n\t\t\t\tresultBusValue.isSigned());\r\n\r\n\t\tfor (int i = 0; i < resultBusValue.getSize(); i++) {\r\n\t\t\tBit bit = resultBusValue.getBit(i);\r\n\t\t\tif (!bit.isCare()) {\r\n\t\t\t\tnewValue.setBit(i, Bit.DONT_CARE);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tmod |= getDataPorts().get(0).pushValueBackward(newValue);\r\n\r\n\t\treturn mod;\r\n\t}", "private void pop() {\r\n pop( false );\r\n }", "public void pop();", "public void pop() {\r\n \t Queue<Integer> temp=new LinkedList<Integer>();\r\n \t int counter=0;\r\n \t while(!stack.isEmpty()){\r\n \t temp.add((Integer) stack.poll());\r\n \t counter++;\r\n \t \r\n \t }\r\n \t while(counter>1)\r\n \t {\r\n \t \r\n \t stack.add(temp.poll());\r\n \t counter--;\r\n \t }\r\n }", "public void pop() {\n int size = q.size();\n for(int i = 1; i<size;i++){\n q.offer(q.poll());\n }\n q.poll();\n }", "E pop();", "E pop();", "E pop();", "public int popNegate(int valueIfEmpty) {\n\t\t\treturn pop(valueIfEmpty) * -1;\n\t\t}", "public E pop();", "public E pop();", "public E pop();", "public E pop();", "public E pop();", "public Object pop();", "public ValueType pop() {\r\n // TODO\r\n return null;\r\n }", "public TYPE pop();", "T pop();", "T pop();", "T pop();", "public int pop() {\n\t\tif (isEmpty())\n\t\t\treturn NEGATIVE_ONE;\n\t\tint ret = last.value;\n\t\tlast = last.prev;\n\t\treturn ret;\n\t}", "public int pop() {\n while (!push.isEmpty()){\n pull.push(push.pop());\n }\n int result= pull.pop();\n while (!pull.isEmpty()){\n push.push(pull.pop());\n }\n return result;\n }", "void pushBack(T value) throws ListException;", "public int pop() {\r\n LinkedList<Integer> queue = new LinkedList<>();\r\n int value = stack.poll();\r\n while(!stack.isEmpty()){\r\n queue.offer(value);\r\n value = stack.poll();\r\n }\r\n stack = queue;\r\n return value;\r\n }", "public void pop() {\n\t List<Integer> temp = new ArrayList<>();\n\t Integer last = null;\n\t first = null;\n\t \n\t do{\n\t last = s.pop();\n\t if(s.isEmpty()){\n\t break;\n\t }\n\t first = last;\n\t temp.add(last);\n\t \n\t }while (true);\n\t \n\t for(int i = temp.size()-1; i >=0; i--){\n\t s.push(temp.get(i));\n\t }\n\t \n\t}", "public Integer pop() \n\t{ \n\t\tint x = super.pop(); \n\t\tmin.pop(); \n\t\treturn x; \n\t}", "public int pop() { return 0; }", "public void pop() {\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\twhile (!queue.isEmpty())\n\t\t\tlist.add(queue.poll());\n\t\tfor (int i = 0; i < list.size() - 1; i++)\n\t\t\tqueue.add(list.get(i));\n\t}", "public int pop() {\n if (isEmpty()) {\n throw new IllegalStateException(\"Der Stack ist leer.\");\n }\n if((values.length / 2) >= size) {\t\t\t\t// Überprüfen, ob das Array nicht zu groß ist und ob nicht die Hälfte auch reicht\n \tint[] save = this.values;\t\t\t\t\t// sichere altes Array\n \tthis.values = new int[save.length / 2];\t\t// verkleinere values Array\n \tfor (int i = 0; i < values.length; i++) {\t// kopiere die alten Werte in das neue Array\n \t\tvalues[i] = save[i];\n \t}\n }\n int save = values[size-1];\n values[--size] = 0;\n return save;\n }", "abstract void pop();", "public T pop();", "public T pop();", "public T pop();", "public T pop();", "public T pop();", "public T pop();", "public T pop();", "public T pop();", "public int pop();", "public void pop() {\n \n if(!q1.isEmpty())q1.remove();\n \n }", "Object pop();", "public abstract Object pop();", "public T pop() {\n\t\tT value = null;\n\t\tif (!isEmpty()) {\n\t\t\ttop = top.next;\n\t\t\tvalue = top.value;\n\t\t}\n\t\treturn value; // returning popped value\n\t}", "public int pop() throws IndexOutOfBoundsException {\n try {\n for (int i = size() - 1; i >= 0; i--) { // Iterate backwards\n if (this.values[i] != 0) { // First occurance of value\n int oldvalue = this.values[i];\n this.values[i] = 0; // Set to 0\n this.size--;\n return oldvalue;\n }\n }\n\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n\n } catch (Exception e) {\n throw new IndexOutOfBoundsException(\"No values were found in stack.\");\n }\n }", "@Override\n\tpublic int pop() {\n\t\treturn 0;\n\t}", "@Override\n public E pop() {\n E result = peek();\n storage[ top-- ] = null;\n return result;\n\n }", "@Override\n public int pop() {\n isEmptyList();\n int result = first.value;\n first = first.next;\n size--;\n return result;\n }", "public void pop() throws StackUnderflowException;", "public int pop(int valueIfEmpty) {\n\t\t\tif (isEmpty()) {\n\t\t\t\treturn valueIfEmpty;\n\t\t\t}\n\n\t\t\tstoredValues--;\n\t\t\tint result = stack[bottom++];\n\n\t\t\tif (bottom == capacity) {\n\t\t\t\tbottom = 0;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "public void pushBack(int val) {\n\n\t\tDLNode a;\n\t\tif (val == Integer.MIN_VALUE) {\n\t\t\ta = new DLNode();\n\t\t} else {\n\t\t\ta = new DLNode(val);\n\t\t}\n\t\tif (head == null) {\n\t\t\thead = tail = a;\n\t\t\tif (a.val == Integer.MIN_VALUE) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telements++;\n\t\t\treturn;\n\t\t}\n\t\ta.prev = tail;\n\t\ttail.next = a;\n\t\ttail = a;\n\t\tif (a.val == Integer.MIN_VALUE) {\n\t\t\treturn;\n\t\t}\n\t\telements++;\n\n\t}", "public E pop() {\n E value = head.prev.data;\n head.prev.delete();\n if (size > 0) size--;\n return value;\n }", "public Integer dequeue() {\n\t\t // get last val in heap, copy value to index 0\n\t\t // decrease size \n\t\t // create a recursive helper, percolateDown,\n\t\t // that allows you move the removed val \n\t\t // in the right place\n\t\t \n\t\t if (size == 0) \n\t\t\t throw new EmptyStackException();\n\t int item = data[0]; \n\t data[0] = data[size - 1]; \n\t size--;\n\t percolateDown(0); \n\t return item;\n\t }", "static void pop() {\n\t\t\tif (q1.isEmpty()) \n\t\t\t\treturn; \n\t\t\tq1.remove(); \n\t\t\tcurr_size--; \n\t\t}", "public int pop() {\n int value = top.value;\n top = top.pre;\n top.next = null;\n size--;\n return value;\n }", "public T pop() {\r\n\t\t\r\n\t\tT numPila = this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\tfor (StackObserver<T> o : observers )\r\n\t\t\to.onPop(numPila);\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\treturn numPila;\r\n\t\t\r\n\t\t//return this.num.remove(this.num.size()-1);\r\n\t\t\r\n\t\t\r\n\t}", "public ValueWrapper pop(String keyName) {\n\t\tif(isEmpty(keyName)) {\n\t\t\tthrow new EmptyStackException();\n\t\t}\n\t\tvar value = multistack.get(keyName);\n\t\tif(value.next != null) {\n\t\t\tmultistack.put(keyName, value.next);\n\t\t}\n\t\telse {\n\t\t\tmultistack.remove(keyName);\n\t\t}\n\t\treturn value.value;\n\t}", "public void pop() {\n one.poll();\n \n }", "int pop() {\n\t\tint[] temp = new int[array.length - 1]; // temporary place holder\n\t\tfor (int i = 0; i < array.length - 1; i++) {\n\t\t\ttemp[i] = array[i];\n\t\t}\n\t\t// returning last value in array\n\t\tint lastValue = array[array.length - 1];// array.length - 1 bc its the\n\t\t\t\t\t\t\t\t\t\t\t\t// last term\n\t\tarray = temp;\n\t\treturn lastValue;\n\t}", "public void pop() {\n if(stack.pop() == min)\n min=stack.pop();\n }", "public T pop() {\n\t\tT value = peek();\n\t\tstack.remove(value);\n\t\treturn value;\n\t}", "public final void sub() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tpush(secondTopMostValue - topMostValue);\n\t\t}\n\t}", "public void pop() {\n \tint size = s.size();\n \tfor(int i = 0; i < size; i++) {\n \t\ts2.push(s.pop());\n \t}\n s2.pop();\n }", "public void pop() {\n// \tSystem.out.println(s2.empty());\n \tint l1 = s1.size();\n \tfor(int i=0;i<l1;i++){\n \ts2.push(s1.pop());\n }\n// \tSystem.out.println(s1.empty());\n// \tSystem.out.println(s2.pop());\n \tint l2 = s2.size();\n \tfor(int i=0;i<l2;i++){\n \ts1.push(s2.pop());\n }\n }", "int pop();", "int pop();", "int pop();", "int pop();", "int pop();", "@Override\n\tpublic T pop() {\n\t\tLink_Node<T>node = this.last;\n\t\tlast = last.getPrevious();\n\t\tnode.setPrevious(null);\n\t\t--counts;\n\t\treturn node.getValue();\n\t}", "public T pop() {\n \tT retVal = stack.get(stack.size() - 1); // get the value at the top of the stack\n \tstack.remove(stack.size() - 1); // remove the value at the top of the stack\n \treturn retVal;\n }", "@Override\r\n\tpublic E pop() {\n\t\treturn null;\r\n\t}", "public void pop() {\n move();\n reverseQueue.poll();\n }", "private synchronized BackStep pop() {\r\n\t\t\tBackStep bs;\r\n\t\t\tbs = stack[top];\r\n\t\t\tif (size == 1) {\r\n\t\t\t\ttop = -1;\r\n\t\t\t} else {\r\n\t\t\t\ttop = (top + capacity - 1) % capacity;\r\n\t\t\t}\r\n\t\t\tsize--;\r\n\t\t\treturn bs;\r\n\t\t}", "void push(int val) {\n if (data.size() == 0) {\r\n data.push(val);\r\n min = val;\r\n }\r\n else {\r\n if (val <= min) {\r\n data.push(val * 2 - min);\r\n min = val;\r\n }\r\n else\r\n data.push(val);\r\n }\r\n }", "public T pop(){ \r\n \t--this.size;\r\n \treturn stack1.pop();\r\n }", "public void pop(){\n // check if there is any stack present or not\n if(this.arr==null){\n System.out.println(\"No stack present, first create a stack\");\n return;\n }\n // check if stack is empty\n if(this.topOfStack==-1){\n System.out.println(\"Stack is empty, can't pop from stack\");\n return;\n }\n // if stack is not empty\n this.arr[this.topOfStack]=Integer.MIN_VALUE;\n this.topOfStack--;\n }", "@Override\n\tpublic E pop() {\n\t\treturn null;\n\t}", "public E pop(){\n return this.stack.remove(stack.size()-1);\n }", "public void push(int value){\n //To be written by student\n localSize++;\n top++;\n if(localSize>A.getSize()){\n A.doubleSize();\n try{\n A.modifyElement(value,top);\n }catch(Exception c){c.printStackTrace();}\n }\n else{try{\n A.modifyElement(value,top);\n }catch(Exception a){a.printStackTrace();} }\n }", "public double pop()\n {\n if (empty()) {\n \tthrow new IllegalArgumentException(\"too many operators!\");\n \t\n }\n else\n {\n return s[top--];\n }\n }", "public int pop() {\n peek();\n return right.pop();\n }", "public int popBack() {\n int y = 0;\n if(tail == null) {\n return Integer.MIN_VALUE;\n }\n\n Node node = tail;\n tail = node.prev;\n\n size--;\n\n return node.val;\n }", "public void pop() {\n while(!stack.isEmpty()) container.push(stack.pop());\n container.pop();\n while(!container.isEmpty()) stack.push(container.pop());\n }", "int pop(){\n int x = head.val;\n head = head.next; //Se borra el primer elemento de la lista\n if(-- n == 0) tail = null;\n return x;\n }", "public int pop() {\n int size=queue.size();\n for (int i = 0; i <size-1 ; i++) {\n int temp=queue.poll();\n queue.add(temp);\n }\n return queue.poll();\n }", "public String pop();", "public T pop() {\r\n T o = get(size() - 1);\r\n remove(size() - 1);\r\n return o;\r\n\t}", "public void push(E value);", "public void pop()\n {\n this.top = this.top.getNext();\n }", "public void pushBack(DoubleLinkedList other) {\n\n\t\tDoubleLinkedList l = other.clone();\n\t\tDLNode n = l.head;\n\t\tfor (int i = 0; i < l.nodeCounter(); i++) {\n\t\t\tif (n.val != Integer.MIN_VALUE) {\n\t\t\t\tthis.pushBack(n.val);\n\t\t\t} else {\n\t\t\t\tthis.pushBackRecursive(n.list);\n\t\t\t}\n\t\t\tn = n.next;\n\t\t}\n\t}", "public void pop() {\n \n q1.poll();\n }", "T pop() {\n return contents.removeFromHead();\n }", "public int pop() {\n while (!s1.isEmpty()) {\n s2.push(s1.pop());\n }\n int pop = s2.pop();\n while (!s2.isEmpty()) {\n s1.push(s2.pop());\n }\n return pop;\n }", "@Override\r\n\tpublic boolean pushValuesForward() {\r\n\t\tboolean mod = false;\r\n\r\n\t\tValue in0 = getDataPorts().get(0).getValue();\r\n\r\n\t\tint newSize = in0.getSize();\r\n\t\tboolean isSigned = in0.isSigned();\r\n\r\n\t\tValue newValue = new Value(newSize, isSigned);\r\n\r\n\t\tfor (int i = 0; i < newSize; i++) {\r\n\t\t\tBit bit = in0.getBit(i);\r\n\r\n\t\t\tif (!bit.isCare()) {\r\n\t\t\t\t/*\r\n\t\t\t\t * Don't-cares will be ignored going forward.\r\n\t\t\t\t */\r\n\t\t\t\tnewValue.setBit(i, Bit.DONT_CARE);\r\n\t\t\t} else if (bit.isConstant()) {\r\n\t\t\t\t/*\r\n\t\t\t\t * Push the inversion of the constant.\r\n\t\t\t\t */\r\n\t\t\t\tnewValue.setBit(i, bit.isOn() ? Bit.ZERO : Bit.ONE);\r\n\t\t\t} else {\r\n\t\t\t\t/*\r\n\t\t\t\t * Otherwise just push a generic CARE until we're sure that\r\n\t\t\t\t * there's a Value on the result Bus.\r\n\t\t\t\t */\r\n\t\t\t\tnewValue.setBit(0, Bit.CARE);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// update all bits above the carry out bit to be signed\r\n\t\t// extended of carry out bit\r\n\t\tif (getResultBus().getValue() != null) {\r\n\t\t\tif (!in0.isConstant()) {\r\n\t\t\t\tint compactedSize = Math.min(newSize, in0.getCompactedSize());\r\n\t\t\t\tBit carryoutBit = getResultBus().getValue().getBit(\r\n\t\t\t\t\t\tcompactedSize - 1);\r\n\r\n\t\t\t\tfor (int i = compactedSize; i < newSize; i++) {\r\n\t\t\t\t\tif (newValue.getBit(i) != Bit.DONT_CARE)\r\n\t\t\t\t\t\tnewValue.setBit(i, carryoutBit);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tmod |= getResultBus().pushValueForward(newValue);\r\n\r\n\t\tfor (int i = 0; i < newSize; i++) {\r\n\t\t\tBit bit = in0.getBit(i);\r\n\t\t\tif (!bit.isGlobal()) {\r\n\t\t\t\t/*\r\n\t\t\t\t * Set the inversion shortcut if appropriate.\r\n\t\t\t\t */\r\n\t\t\t\tgetResultBus().getValue().getBit(i).setInvertedBit(bit);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn mod;\r\n\t}", "public T pop() { //pop = remove the last element added to the array, in a stack last in, first out (in a queue pop and push from different ends)\n try {\n T getOut = (T) myCustomStack[numElements - 1]; //variable for element to remove (pop off) = last element (if you have 7 elements, the index # is 6)\n myCustomStack[numElements] = null; //remove element by making it null\n numElements--; //remove last element, decrease the numElements\n return getOut; //return popped number\n\n } catch (Exception exc) {\n System.out.println(\"Can't pop from empty stack!\");\n return null;\n }\n }", "public int pop() {\n if (!forReverse.isEmpty()) {\n return forReverse.poll();\n }\n\n while (queue.size() > 1) {\n forReverse.add(queue.poll());\n }\n\n int val = queue.poll();\n \n Queue<Integer> temp = queue;\n queue = forReverse;\n forReverse = temp;\n\n return val;\n }", "public int pop(){\n if (isEmpty()) throw new RuntimeException(\"Stack underflow\");\n int tmp=myarray[top];\n top--;\n return tmp;\n \n \n }", "@Override\n public void backtrack() {\n if (!stack.isEmpty()) {\n int index = (Integer) stack.pop();\n\n if (index > arr.length) {//popping the insert function unneeded push\n insert((Integer) stack.pop());\n stack.pop();\n }\n if (index < arr.length) {//popping the delete function unneeded push\n delete(index);\n stack.pop();\n stack.pop();\n }\n System.out.println(\"backtracking performed\");\n }\n }", "public void push(T value) {\n top = new Entry<>(value, top); // diamond operator (syntactic sugar)\n }" ]
[ "0.6628337", "0.6615048", "0.6586896", "0.6518616", "0.6441966", "0.6384828", "0.62439126", "0.6234343", "0.6234343", "0.6234343", "0.6213064", "0.62128943", "0.62128943", "0.62128943", "0.62128943", "0.62128943", "0.6210871", "0.620669", "0.6169978", "0.6158341", "0.6158341", "0.6158341", "0.6157994", "0.6151521", "0.6148868", "0.61438847", "0.61137986", "0.6112799", "0.61029327", "0.6098795", "0.60893846", "0.60785186", "0.6071692", "0.6071692", "0.6071692", "0.6071692", "0.6071692", "0.6071692", "0.6071692", "0.6071692", "0.60651654", "0.6063664", "0.6056798", "0.604978", "0.6025188", "0.6013985", "0.6012882", "0.6012439", "0.6001979", "0.59906715", "0.59747046", "0.5967233", "0.5966712", "0.59564567", "0.5950505", "0.5945231", "0.5931542", "0.5923521", "0.59194523", "0.5908388", "0.58910704", "0.5885167", "0.5879009", "0.5877212", "0.587206", "0.58424073", "0.58424073", "0.58424073", "0.58424073", "0.58424073", "0.58394283", "0.5837418", "0.5825873", "0.5821097", "0.5819525", "0.5819262", "0.5818179", "0.58123434", "0.5802337", "0.5797651", "0.5794498", "0.57901156", "0.578995", "0.57791275", "0.57779", "0.5737625", "0.573749", "0.57350487", "0.5734883", "0.5731061", "0.5730046", "0.57281524", "0.5720019", "0.5715383", "0.57053447", "0.5703657", "0.569578", "0.5683421", "0.56771475", "0.5673182", "0.5672779" ]
0.0
-1
Returns the only app engine standard artifact found for the given module or null if there aren't any or more than one.
@Nullable public static Artifact findOneAppEngineStandardArtifact(@NotNull Module module) { Collection<Artifact> artifacts = ArtifactUtil.getArtifactsContainingModuleOutput(module); Collection<Artifact> appEngineStandardArtifacts = Lists.newArrayList(); appEngineStandardArtifacts.addAll( artifacts .stream() .filter( artifact -> AppEngineProjectService.getInstance().isAppEngineStandardArtifactType(artifact)) .collect(toList())); return appEngineStandardArtifacts.size() == 1 ? appEngineStandardArtifacts.iterator().next() : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Optional<T> getModule() {\n return Optional.ofNullable(this.module);\n }", "Artifact getArtifact(String version) throws ArtifactNotFoundException;", "private Artifact getArtifactFromReactor(Artifact artifact) {\n\t\t// check project dependencies first off\n\t\tfor (Artifact a : (Set<Artifact>) project.getArtifacts()) {\n\t\t\tif (equals(artifact, a) && hasFile(a)) {\n\t\t\t\treturn a;\n\t\t\t}\n\t\t}\n\n\t\t// check reactor projects\n\t\tfor (MavenProject p : reactorProjects == null ? Collections.<MavenProject> emptyList() : reactorProjects) {\n\t\t\t// check the main artifact\n\t\t\tif (equals(artifact, p.getArtifact()) && hasFile(p.getArtifact())) {\n\t\t\t\treturn p.getArtifact();\n\t\t\t}\n\n\t\t\t// check any side artifacts\n\t\t\tfor (Artifact a : (List<Artifact>) p.getAttachedArtifacts()) {\n\t\t\t\tif (equals(artifact, a) && hasFile(a)) {\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// not available\n\t\treturn null;\n\t}", "public Module findModule(String moduleName) {\n if(modules.containsKey(moduleName))\n return modules.get(moduleName);\n //TODO: search in joined mobiles\n return null;\n }", "NobaseValue findRequiresValue(NobaseFile forfile,String nm)\n{\n NobaseFile result = forfile.getProject().findRequiresFile(forfile,nm);\n if (result == null) return null;\n NobaseValue nv = export_map.get(result);\n if (nv == null) {\n for_project.buildIfNeeded(result);\n nv = export_map.get(result);\n }\n return nv;\n}", "GWTModuleReleaseInfo getInfoForModuleRelease(String moduleId) throws GWTJahiaServiceException;", "private File getLastArtifact() throws MojoExecutionException {\n\t\torg.eclipse.aether.version.Version v = getLastVersion();\n\t\tif (v == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\tArtifact artifactQuery = new DefaultArtifact(groupId.concat(\":\")\n\t\t\t\t.concat(name).concat(\":\").concat(v.toString()));\n\t\tgetLog().debug(\n\t\t\t\tString.format(\"looking for artifact %s\",\n\t\t\t\t\t\tartifactQuery.toString()));\n\t\treturn getArtifactFile(artifactQuery);\n\n\t}", "Optional<Module> getReadModule();", "private FileObject findServiceArchiveForName(String appName) throws FileSystemException {\n List<FileObject> serviceArchives\n = Utils.findChildrenWithSuffix(deploymentDirectoryFile,\n com.stratuscom.harvester.Strings.JAR);\n //Then find the one that starts with the client name\n for (FileObject fo : serviceArchives) {\n if (fo.getName().getBaseName().startsWith(appName + com.stratuscom.harvester.Strings.DASH)) {\n return fo;\n }\n }\n return null;\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic <T extends AModule> Optional<T> getModuleOpt(Class<T> moduleId)\n\t{\n\t\tfinal AModule aModule = modules.get(moduleId);\n\t\tif (aModule != null)\n\t\t{\n\t\t\treturn Optional.of((T) aModule);\n\t\t}\n\t\treturn modules.values().stream()\n\t\t\t\t.filter(m -> m.getClass().equals(moduleId))\n\t\t\t\t.map(a -> (T) a)\n\t\t\t\t.findFirst();\n\t}", "private Manifest getManifest( final File artifact ) throws IOException {\n if ( artifact.isDirectory() ) {\n // this is maybe a classes directory, try to read manifest file directly\n final File dir = new File(artifact, \"META-INF\");\n if ( !dir.exists() || !dir.isDirectory() ) {\n return null;\n }\n final File mf = new File(dir, \"MANIFEST.MF\");\n if ( !mf.exists() || !mf.isFile() ) {\n return null;\n }\n final InputStream is = new FileInputStream(mf);\n try {\n return new Manifest(is);\n } finally {\n try { is.close(); } catch (final IOException ignore) { }\n }\n }\n JarFile file = null;\n try {\n file = new JarFile( artifact );\n return file.getManifest();\n } finally {\n if ( file != null ) {\n try { file.close(); } catch ( final IOException ignore ) {}\n }\n }\n }", "String getApplicationDependencies();", "ArtifactIdentifier getLatestVersion();", "private org.apache.maven.artifact.Artifact findMatchingArtifact(MavenProject project, Artifact requestedArtifact) {\n String requestedRepositoryConflictId = getConflictId(requestedArtifact);\n\n org.apache.maven.artifact.Artifact mainArtifact = project.getArtifact();\n if (requestedRepositoryConflictId.equals(getConflictId(mainArtifact))) {\n return mainArtifact;\n }\n\n Collection<org.apache.maven.artifact.Artifact> attachedArtifacts = project.getAttachedArtifacts();\n if (attachedArtifacts != null && !attachedArtifacts.isEmpty()) {\n for (org.apache.maven.artifact.Artifact attachedArtifact : attachedArtifacts) {\n if (requestedRepositoryConflictId.equals(getConflictId(attachedArtifact))) {\n return attachedArtifact;\n }\n }\n }\n\n return null;\n }", "public ArtifactStorage getArtifactStorage() {\n if(artifactStorageMap.firstEntry() != null) {\n return artifactStorageMap.firstEntry().getValue();\n }\n return null;\n }", "private VirtualFile getFile(Module module, String schemaFilePath) {\n for (VirtualFile contentRoot : OrderEnumerator.orderEntries(module).recursively().productionOnly().sources().getRoots()) {\n VirtualFile schemaFile = contentRoot.findFileByRelativePath(schemaFilePath);\n if (schemaFile != null) {\n return schemaFile;\n }\n }\n return null;\n }", "private String getExportPackage() {\n boolean hasSharedPackages = false;\n StringBuilder exportPackage = new StringBuilder();\n // XXX: Because of issue #1517, root package is returned more than once\n // I wrap packages in the LinkedHashSet, that elliminates duplicates \n // while retaining the insertion order. \n // (see https://github.com/ceylon/ceylon-compiler/issues/1517)\n for (Package pkg : new LinkedHashSet<>(module.getPackages())) {\n if (pkg.isShared()) {\n if (hasSharedPackages) {\n exportPackage.append(\";\");\n }\n exportPackage.append(pkg.getNameAsString());\n //TODO : should we analyze package uses as well?\n hasSharedPackages = true;\n }\n }\n if (hasSharedPackages) {\n // Ceylon has no separate versioning of packages, so all\n // packages implicitly inherit their respective module version\n exportPackage.append(\";version=\").append(module.getVersion());\n }\n return exportPackage.toString();\n }", "public String getAssetModuleId();", "public String getPackaging();", "java.lang.String getArtifactStorage();", "private ILaunch findLaunch() throws CoreException {\n ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();\n for (ILaunch launch : manager.getLaunches()) {\n\n // TODO: figure out a more correct way of doing this\n if ( launch.getLaunchMode().equals(ILaunchManager.DEBUG_MODE)\n && launch.getLaunchConfiguration() != null\n && launch.getLaunchConfiguration().getAttribute(\"launchable-adapter-id\", \"\")\n .equals(\"com.amazonaws.eclipse.wtp.elasticbeanstalk.launchableAdapter\")\n && launch.getLaunchConfiguration().getAttribute(\"module-artifact\", \"\")\n .contains(moduleToPublish.getName()) ) {\n return launch;\n }\n }\n return null;\n }", "private Optional<String> toPackageName(String name) {\n assert !name.endsWith(\"/\");\n int index = name.lastIndexOf(\"/\");\n if (index == -1) {\n if (name.endsWith(\".class\") && !name.equals(MODULE_INFO)) {\n String msg = name + \" found in top-level directory\"\n + \" (unnamed package not allowed in module)\";\n throw new InvalidModuleDescriptorException(msg);\n }\n return Optional.empty();\n }\n\n String pn = name.substring(0, index).replace('/', '.');\n if (Checks.isPackageName(pn)) {\n return Optional.of(pn);\n } else {\n // not a valid package name\n return Optional.empty();\n }\n }", "java.lang.String getArtifactId();", "public ProgramModule getDefaultRootModule();", "public String getArtifact() {\n return artifact;\n }", "protected URL convertedFindResource(String name) {\n ServiceReference reference = bundle.getBundleContext().getServiceReference(PackageAdmin.class.getName());\n PackageAdmin packageAdmin = (PackageAdmin) bundle.getBundleContext().getService(reference);\n try {\n List<URL> resources = findResources(packageAdmin, bundle, name, false);\n if (resources.isEmpty() && isMetaInfResource(name)) {\n LinkedHashSet<Bundle> wiredBundles = getWiredBundles();\n Iterator<Bundle> iterator = wiredBundles.iterator();\n while (iterator.hasNext() && resources.isEmpty()) { \n Bundle wiredBundle = iterator.next();\n resources = findResources(packageAdmin, wiredBundle, name, false);\n }\n }\n return (resources.isEmpty()) ? null : resources.get(0);\n } catch (Exception e) {\n return null;\n } finally {\n bundle.getBundleContext().ungetService(reference);\n }\n }", "private String getRequireBundle() {\n StringBuilder requires = new StringBuilder();\n if (!isLanguageModule()) {\n for (ModuleImport anImport : module.getImports()) {\n Module m = anImport.getModule();\n if (!m.isJava() && !m.equals(module)) {\n if (requires.length() > 0) {\n requires.append(\",\");\n }\n \n requires.append(m.getNameAsString())\n .append(\";bundle-version=\").append(m.getVersion());\n \n if (anImport.isExport()) {\n requires.append(\";visibility:=reexport\");\n }\n if (anImport.isOptional()) {\n requires.append(\";resolution:=optional\");\n }\n }\n }\n }\n return requires.toString();\n }", "java.lang.String getArtifactUrl();", "String getArtifactId();", "Value require(String module);", "FileSystem getArtifacts(final HudsonMavenModuleBuild module) {\n return getFileSystemFromCache(artifacts, module.getBuild().getJob().getName() + \"/\" + // NOI18N\n module.getBuild().getNumber() + \"/\" + module.getName(), // NOI18N\n new Callable<RemoteFileSystem>() {\n @Override public RemoteFileSystem call() throws Exception {\n return builderConnector.getArtifacts(module);\n }\n });\n }", "String getPackager();", "public org.eclipse.stardust.engine.api.runtime.RuntimeArtifact\n getRuntimeArtifact(long oid)\n throws org.eclipse.stardust.common.error.WorkflowException;", "private String getModuleName() {\n \t\t// If there is an autoconnect page then it has the module name\n \t\tif (autoconnectPage != null) {\n \t\t\treturn autoconnectPage.getSharing().getRepository();\n \t\t}\n \t\tString moduleName = modulePage.getModuleName();\n \t\tif (moduleName == null) moduleName = project.getName();\n \t\treturn moduleName;\n \t}", "protected abstract Artifact getArtifact(BuildContext buildContext) throws BuildStepException;", "public abstract List<AbstractDeploymentArtifact> getDeploymentArtifacts();", "public final String tryGetRsyncModule()\n {\n return rsyncModuleOrNull;\n }", "private JavaPackage checkAndUseApplicationModule(JavaPackage controllerPackage) {\n\n if (!typeLocationService.hasModuleFeature(\n projectOperations.getPomFromModuleName(controllerPackage.getModule()),\n ModuleFeatureName.APPLICATION)) {\n\n LOGGER\n .log(\n Level.WARNING,\n \"Focused or specified module isn't an application module (containing a class \"\n + \"annotated with @SpringBootApplication). Looking for an application module and default package...\");\n\n // Validate that project has at least one application module\n Validate.notEmpty(typeLocationService.getModuleNames(ModuleFeatureName.APPLICATION),\n \"The project must have at least one application module to publish web finders.\");\n\n // Get the first application module\n String moduleName =\n typeLocationService.getModuleNames(ModuleFeatureName.APPLICATION).iterator().next();\n Pom module = projectOperations.getPomFromModuleName(moduleName);\n controllerPackage =\n new JavaPackage(typeLocationService.getTopLevelPackageForModule(module).concat(\".web\"),\n moduleName);\n }\n return controllerPackage;\n }", "Path getArtifact(String identifier);", "URI location() {\n if (module.isNamed() && module.getLayer() != null) {\n Configuration cf = module.getLayer().configuration();\n ModuleReference mref\n = cf.findModule(module.getName()).get().reference();\n return mref.location().orElse(null);\n }\n return null;\n }", "public Module getModule(String name) {\n\t\tif (this._modules == null)\n\t\t\treturn null;\n\t\treturn _modules.get(name);\n\t}", "public static Module getModuleForLibraryFile(Project project, VirtualFile file) {\n for (Module module : ModuleManager.getInstance(project).getModules()) {\n if (ModuleUtilCore.moduleContainsFile(module, file, true)) {\n return module;\n }\n }\n return null;\n }", "public String module(String name)\n {\n return modules.get(name);\n }", "String pkg();", "public Collection<ArtifactDTO> getConsumedArtifacts( final String moduleId )\n {\n Set<ArtifactDTO> consumedArtifacts = new HashSet<ArtifactDTO>();\n \n for ( ArtifactDTO artifact : adp.getList() )\n {\n for ( String dependendentModule : artifact.getDependentProjects() )\n {\n if( moduleId.equals( dependendentModule ) )\n {\n // TODO: should the operations be filtered to only what's applicable\n // to this moduleId?\n // This would require filtering in the Display or creating \n // a new list here (increasing the client size).\n // Maybe this would be a case for restructuring the build state\n // so that each project contains it's artifacts and operations.\n // Would probably still leave the artifact state as is when \n // used in eventspy to keep it more compact and less chatty, \n // but transform it once it's been committed to Hudson.\n \n consumedArtifacts.add( artifact );\n }\n }\n }\n \n return consumedArtifacts;\n }", "public JsonObject getArtifact(String wrksName, String artName) throws CartagoException {\n var info = getArtInfo(wrksName, artName);\n\n var artifact = Json.createObjectBuilder()\n .add(\"artifact\", artName)\n .add(\"type\", info.getId().getArtifactType());\n\n\n // Get artifact's properties\n var properties = Json.createArrayBuilder();\n for (ArtifactObsProperty op : info.getObsProperties()) {\n var values = Json.createArrayBuilder();\n for (Object vl : op.getValues()) {\n values.add(\n Json.createValue(vl.toString())\n );\n }\n properties.add(\n Json.createObjectBuilder()\n .add(op.getName(), values)\n );\n }\n artifact.add(\"properties\", properties);\n\n // Get artifact's operations\n var operations = Json.createArrayBuilder();\n info.getOperations().forEach(y -> {\n operations.add(y.getOp().getName());\n });\n artifact.add(\"operations\", operations);\n\n // Get agents that are observing the artifact\n var observers = Json.createArrayBuilder();\n info.getObservers().forEach(y -> {\n // do not print agents_body observation\n if (!info.getId().getArtifactType().equals(AgentBodyArtifact.class.getName())) {\n observers.add(y.getAgentId().getAgentName());\n }\n });\n artifact.add(\"observers\", observers);\n\n // linked artifacts\n /* not used anymore\n var linkedArtifacts = Json.createArrayBuilder();\n info.getLinkedArtifacts().forEach(y -> {\n // linked artifact node already exists if it belongs to this workspace\n linkedArtifacts.add(y.getName());\n });\n artifact.add(\"linkedArtifacts\", linkedArtifacts);*/\n\n return artifact.build();\n }", "public static String getModuleId(File f)\n {\n FileReader fr = null;\n try\n {\n fr = new FileReader(f);\n\n final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();\n final XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(fr);\n\n while (xmlStreamReader.hasNext())\n {\n if (xmlStreamReader.next() == XMLStreamReader.START_ELEMENT\n && \"module\".equals(xmlStreamReader.getLocalName()))\n {\n for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)\n {\n String name = xmlStreamReader.getAttributeLocalName(i);\n if (\"name\".equals(name))\n {\n return xmlStreamReader.getAttributeValue(i);\n }\n }\n }\n }\n }\n catch (Exception e)\n {\n // Nothing to do\n }\n finally\n {\n if (null != fr)\n {\n try\n {\n fr.close();\n }\n catch (IOException ioe)\n {\n // Ignore\n }\n }\n }\n\n return null;\n }", "private Optional<String> getPackage(File javaFile) {\n try (var lines = LineStream.newInstance(javaFile)) {\r\n while (lines.hasNextLine()) {\r\n var line = lines.nextLine().strip().toLowerCase();\r\n\r\n // Found package\r\n if (line.startsWith(\"package \")) {\r\n var packageName = line.substring(\"package \".length()).strip();\r\n int colonIndex = packageName.indexOf(';');\r\n if (colonIndex == -1) {\r\n SpecsLogs.info(\"Found package, but could not find ';': \" + line);\r\n return Optional.empty();\r\n }\r\n\r\n return Optional.of(packageName.substring(0, colonIndex).strip());\r\n }\r\n\r\n // Stop when import, class, interface or modifier is found\r\n if (line.startsWith(\"import \") || line.startsWith(\"public \") || line.startsWith(\"class \")\r\n || line.startsWith(\"interface \") || line.startsWith(\"enum \")) {\r\n break;\r\n }\r\n\r\n // Ignore other lines\r\n }\r\n }\r\n\r\n return Optional.empty();\r\n }", "public Optional<ApplicationVersion> application() { return application; }", "public static DictItem find(List<DictItem> dictionary,\n String groupId,\n String artifactId,\n String version) {\n DictItem match=null;\n for(DictItem item:dictionary) {\n if(item.groupId.equals(groupId)&&\n item.artifactId.equals(artifactId)) {\n // If there is a version matching this version, pick that\n if(version.equals(item.version))\n match=item;\n else if(item.version.equals(\"*\")) {\n if(match!=null&&match.version.equals(\"*\"))\n throw new RuntimeException(\"Duplicate:\"+match);\n if(match==null)\n match=item;\n }\n }\n }\n return match;\n }", "public Long readLatestVersionId(final Artifact artifact);", "EisPackage getEisPackage();", "List<BinaryArtifact> getArtifacts(String instanceUrl, String repoName, long lastUpdated);", "private String checkRequireBundle(BundleImpl b) {\n // NYI! More speed?\n if (b.bpkgs.require != null) {\n if (Debug.packages) {\n Debug.println(\"checkRequireBundle: check requiring bundle \" + b);\n }\n if (!framework.perm.okRequireBundlePerm(b)) {\n return b.symbolicName;\n }\n HashMap res = new HashMap();\n for (Iterator i = b.bpkgs.require.iterator(); i.hasNext(); ) {\n RequireBundle br = (RequireBundle)i.next();\n List bl = framework.bundles.getBundles(br.name, br.bundleRange);\n BundleImpl ok = null;\n for (Iterator bci = bl.iterator(); bci.hasNext() && ok == null; ) {\n BundleImpl b2 = (BundleImpl)bci.next();\n if (tempResolved.contains(b2)) {\n ok = b2;\n } else if ((b2.state & BundleImpl.RESOLVED_FLAGS) != 0) {\n HashMap oldTempProvider = (HashMap)tempProvider.clone();\n ok = b2;\n for (Iterator epi = b2.bpkgs.getExports(); epi.hasNext(); ) {\n ExportPkg ep = (ExportPkg)epi.next();\n if (!checkUses(ep)) {\n tempProvider = oldTempProvider;\n tempBlackList.add(ep);\n ok = null;\n }\n }\n } else if (b2.state == Bundle.INSTALLED &&\n framework.perm.okProvideBundlePerm(b2) &&\n checkResolve(b2)) {\n ok = b2;\n }\n }\n if (ok != null) {\n if (Debug.packages) {\n Debug.println(\"checkRequireBundle: added required bundle \" + ok);\n }\n res.put(br, ok.bpkgs);\n } else if (br.resolution == Constants.RESOLUTION_MANDATORY) {\n if (Debug.packages) {\n Debug.println(\"checkRequireBundle: failed to satisfy: \" + br.name);\n }\n return br.name;\n }\n }\n tempRequired.putAll(res);\n }\n return null;\n }", "public abstract String getModuleName( );", "default String getArtifactId() {\n return getIdentifier().getArtifactId();\n }", "public static File getWarFileName( final Set inArtifacts, String fileName )\n {\n if ( inArtifacts == null || inArtifacts.isEmpty() )\n {\n throw new IllegalArgumentException( \"WAR not found in artifact list.\" );\n }\n\n final Iterator iter = inArtifacts.iterator();\n while ( iter.hasNext() )\n {\n Artifact artifact = (Artifact) iter.next();\n\n if ( \"war\".equals( artifact.getType() ) && artifact.getFile().getName().contains( fileName ) )\n {\n return artifact.getFile();\n }\n }\n throw new IllegalArgumentException( \"WAR not found in artifact list.\" );\n }", "public static String getProcessDefVersion(String processDefId) {\n String result = null;\n if (processDefId != null) {\n StringTokenizer st = new StringTokenizer(processDefId, \"#\");\n if (st.countTokens() > 2) {\n st.nextToken(); // packageId\n result = st.nextToken();\n }\n }\n return result;\n }", "public Optional<URI> findLink(String rel) {\n NakadiException.throwNonNull(rel, \"Please provide a rel value\");\n URI uri = null;\n for (ResourceLink link : links) {\n if (rel.equals(link.rel())) {\n uri = link.href();\n break;\n }\n }\n return Optional.ofNullable(uri);\n }", "public java.lang.CharSequence getModule() {\n return module;\n }", "private String name(String module)\n {\n return module.split(\"%%\")[1];\n }", "public String getArtifactId()\n {\n return artifactId;\n }", "private List<String> getSubModulesForEar(com.sun.enterprise.deployment.Application application) {\n List<String> moduleInfoList = new ArrayList<String>();\n for (ModuleDescriptor moduleDesc : application.getModules()) { \n String moduleInfo = moduleDesc.getArchiveUri() + \":\" + \n moduleDesc.getModuleType(); \n if (moduleDesc.getModuleType().equals(XModuleType.WAR)) {\n moduleInfo = moduleInfo + \":\" + moduleDesc.getContextRoot(); \n }\n moduleInfoList.add(moduleInfo);\n }\n return moduleInfoList;\n }", "String getModuleId();", "@Nullable\n Application getApplication(String name);", "private static String getVersionFromPom() {\n\n final String absolutePath = new File(BuildVersion.class.getResource(BuildVersion.class\n .getSimpleName() + \".class\").getPath())\n .getParentFile().getParentFile().getParentFile().getParentFile().getParentFile()\n .getParentFile().getParentFile().getAbsolutePath();\n\n final File file = new File(absolutePath + \"/pom.xml\");\n\n try (InputStreamReader reader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)) {\n\n final MavenXpp3Reader xpp3Reader = new MavenXpp3Reader();\n Model model = xpp3Reader.read(reader);\n return model.getVersion();\n\n } catch (NoClassDefFoundError e) {\n // if you want to get the version possibly in development add in to your pom\n // pax-url-aether.jar\n return null;\n } catch (Exception e) {\n return null;\n }\n }", "String getModuleVersionNumber();", "public static String getAppJarName() {\n try {\n String r = (String)Class.forName(\"hr.restart.util.IntParam\")\n .getMethod(\"getTag\", new Class[] {String.class})\n .invoke(null, new Object[] {\"appjarname\"});\n System.out.println(\"appjarname = \"+r);\n return r.equals(\"\")?\"ra-spa.jar\":r;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return \"ra-spa.jar\";\n }", "@Nullable\n public static Module ofInnermostEnclosingStarlarkFunction(StarlarkThread thread) {\n for (Debug.Frame fr : thread.getDebugCallStack().reverse()) {\n if (fr.getFunction() instanceof StarlarkFunction) {\n return ((StarlarkFunction) fr.getFunction()).getModule();\n }\n }\n return null;\n }", "@NotNull\n public static String getHaxelibPath(@NotNull Module module) {\n\n // ModuleRootManager.getInstance returns either a ModuleJdkOrderEntryImpl\n // or an InheritedJdgOrderEntryImpl, as appropriate.\n Sdk sdk = HaxelibSdkUtils.lookupSdk(module);\n return sdk == null ? \"haxelib\" : getHaxelibPath(sdk);\n }", "private LanguageModule getModuleByProvidedInterface(ArrayList<LanguageModule> modulesList, ProvidedInterface providedInterface){\n\t\tfor (LanguageModule languageModule : modulesList) {\n\t\t\tif(languageModule.getProvidedInterface() != null && languageModule.getProvidedInterface().getName().equals(providedInterface.getName()))\n\t\t\t\treturn languageModule;\n\t\t}\n\t\treturn null;\n\t}", "private org.eclipse.aether.version.Version getLastVersion()\n\t\t\tthrows MojoExecutionException {\n\n\t\t// build the artifact description with version range from 0 up to (non\n\t\t// inclusive) current version\n\n\t\tString artifactDescription = ARTIFACT_DESCRIPTION.replace(\"groupId\",\n\t\t\t\tgroupId);\n\t\tartifactDescription = artifactDescription.replace(\"artifactId\", name);\n\t\tartifactDescription = artifactDescription.replace(\"version\", version);\n\n\t\tArtifact artifact = new DefaultArtifact(artifactDescription);\n\t\tgetLog().info(\n\t\t\t\tString.format(\"searching for artifacts in range %s\",\n\t\t\t\t\t\tartifactDescription));\n\t\tVersionRangeRequest rangeRequest = new VersionRangeRequest();\n\t\trangeRequest.setArtifact(artifact);\n\t\trangeRequest.setRepositories(projectRepos);\n\n\t\tVersionRangeResult rangeResult;\n\t\ttry {\n\t\t\trangeResult = repoSystem.resolveVersionRange(repoSession,\n\t\t\t\t\trangeRequest);\n\t\t\tList<org.eclipse.aether.version.Version> versions = rangeResult\n\t\t\t\t\t.getVersions();\n\t\t\tgetLog().debug(\n\t\t\t\t\tString.format(\"found versions %s\",\n\t\t\t\t\t\t\trangeResult.getVersions()));\n\t\t\t// could not find a previous version\n\t\t\tif (versions.isEmpty()) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\torg.eclipse.aether.version.Version lastVersion = versions\n\t\t\t\t\t.get(versions.size() - 1);\n\t\t\tgetLog().debug(String.format(\"previous version is %s\", lastVersion));\n\t\t\treturn lastVersion;\n\n\t\t} catch (VersionRangeResolutionException e) {\n\t\t\tthrow new MojoExecutionException(\"could not calculate versions\", e);\n\t\t}\n\n\t}", "public final EObject entryRuleGetArtifact() throws RecognitionException {\n EObject current = null;\n\n EObject iv_ruleGetArtifact = null;\n\n\n try {\n // InternalRMParser.g:6797:52: (iv_ruleGetArtifact= ruleGetArtifact EOF )\n // InternalRMParser.g:6798:2: iv_ruleGetArtifact= ruleGetArtifact EOF\n {\n newCompositeNode(grammarAccess.getGetArtifactRule()); \n pushFollow(FOLLOW_1);\n iv_ruleGetArtifact=ruleGetArtifact();\n\n state._fsp--;\n\n current =iv_ruleGetArtifact; \n match(input,EOF,FOLLOW_2); \n\n }\n\n }\n\n catch (RecognitionException re) {\n recover(input,re);\n appendSkippedTokens();\n }\n finally {\n }\n return current;\n }", "private String getXMLDependencyStanza(String sha1Hash)\n {\n try\n {\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n DocumentBuilder db = dbf.newDocumentBuilder();\n Document doc = db.parse(new URL(REST_BASE_URL + sha1Hash).openStream());\n\n NodeList nl = doc.getElementsByTagName(\"artifact\");\n if (nl.getLength() > 0)\n {\n String groupId = ((Element) nl.item(0)).getElementsByTagName(\"groupId\").item(0).getTextContent();\n String artifactId = ((Element) nl.item(0)).getElementsByTagName(\"artifactId\").item(0).getTextContent();\n String version = ((Element) nl.item(0)).getElementsByTagName(\"version\").item(0).getTextContent();\n\n StringBuilder b = new StringBuilder(\"<dependency>\\n\");\n b.append(\" <groupId>\");\n b.append(groupId);\n b.append(\"</groupId>\\n\");\n\n b.append(\" <artifactId>\");\n b.append(artifactId);\n b.append(\"</artifactId>\\n\");\n\n b.append(\" <version>\");\n b.append(version);\n b.append(\"</version>\\n\");\n\n b.append(\"</dependency>\\n\");\n\n return b.toString();\n }\n\n return null;\n }\n catch (Exception e)\n {\n throw new RuntimeException(e);\n }\n }", "private Resource useDeveloperBuild() throws IOException { Find ourselves in the CLASSPATH. We should be a loose class file.\n //\n URL u = getClass().getResource(getClass().getSimpleName() + \".class\");\n if (u == null) {\n throw new FileNotFoundException(\"Cannot find web application root\");\n }\n if (!\"file\".equals(u.getProtocol())) {\n throw new FileNotFoundException(\"Cannot find web root from \" + u);\n }\n\n // Pop up to the top level classes folder that contains us.\n //\n File dir = new File(u.getPath());\n String myName = getClass().getName();\n for (;;) {\n int dot = myName.lastIndexOf('.');\n if (dot < 0) {\n dir = dir.getParentFile();\n break;\n }\n myName = myName.substring(0, dot);\n dir = dir.getParentFile();\n }\n\n // We should be in a Maven style output, that is $jar/target/classes.\n //\n if (!dir.getName().equals(\"classes\")) {\n throw new FileNotFoundException(\"Cannot find web root from \" + u);\n }\n dir = dir.getParentFile(); // pop classes\n if (!dir.getName().equals(\"target\")) {\n throw new FileNotFoundException(\"Cannot find web root from \" + u);\n }\n dir = dir.getParentFile(); // pop target\n dir = dir.getParentFile(); // pop the module we are in\n\n // Drop down into gerrit-gwtui to find the WAR assets we need.\n //\n dir = new File(new File(dir, \"gerrit-gwtui\"), \"target\");\n final File[] entries = dir.listFiles();\n if (entries == null) {\n throw new FileNotFoundException(\"No \" + dir);\n }\n for (File e : entries) {\n if (e.isDirectory() /* must be a directory */\n && e.getName().startsWith(\"gerrit-gwtui-\")\n && new File(e, \"gerrit/gerrit.nocache.js\").isFile()) {\n return Resource.newResource(e.toURI());\n }\n }\n throw new FileNotFoundException(\"No \" + dir + \"/gerrit-gwtui-*\");\n }", "static Application getModuleDescriptor(String appDir) throws IASDeploymentException\n {\n return getModuleDescriptor(appDir, false);\n }", "private SystemDef getSystemDef(String systemDefName) {\n for (DatacollectionGroup group : externalGroupsMap.values()) {\n for (SystemDef sd : group.getSystemDefCollection()) {\n if (sd.getName().equals(systemDefName)) {\n return sd;\n }\n }\n }\n return null;\n }", "private static Project findProject(String name) {\r\n \t\tfor (Project project : ProjectPlugin.getPlugin().getProjectRegistry().getProjects()) {\r\n \t\t\tif (project.getName().equals(name)) {\r\n \t\t\t\treturn project;\r\n \t\t\t}\r\n \t\t}\r\n \t\treturn null;\r\n \t}", "public void removeArtifact() {\r\n\t\tRandom r = new Random();\r\n\t\tint num;\r\n\t\tString artifact;\r\n\t\t// Pick random artifact and remove it\r\n\t\tdo {\r\n\t\t\tnum = r.nextInt(artifacts.length);\r\n\t\t\tartifact = artifacts[num];\r\n\t\t} while (artifact == null);\r\n\t\tfor (int i = 0; i < mapContents.length; i++) {\r\n\t\t\tif (mapContents[i] != null && artifact.contentEquals(mapContents[i])) {\r\n\t\t\t\tmapContents[i] = null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tartifacts[num] = null;\r\n\t}", "public java.lang.CharSequence getModule() {\n return module;\n }", "default Optional<ItemStack> matchItemStack(String material) {\n return matchItemStack(material, 0);\n }", "public IFile getBundleFile(String uri){\r\n \t\tif(project == null || !project.isOpen()) {\r\n \t\t\treturn null;\r\n \t\t}\r\n \t\ttry {\r\n \t\t\tif(!project.hasNature(JavaCore.NATURE_ID)) {\r\n \t\t\t\treturn null;\r\n \t\t\t}\r\n \t\t\tIJavaProject javaProject = JavaCore.create(project);\t\t\r\n \t\t\tIClasspathEntry[] es = javaProject.getResolvedClasspath(true);\r\n \t\t\tfor (int i = 0; i < es.length; i++) {\r\n \t\t\t\tif(es[i].getEntryKind() != IClasspathEntry.CPE_SOURCE) {\r\n \t\t\t\t\tcontinue;\r\n \t\t\t\t}\r\n \t\t\t\tIFile file = (IFile) project.getWorkspace().getRoot()\r\n \t\t\t\t\t.getFolder(es[i].getPath()).findMember(\"/\" + getBundleFileName(uri)); //$NON-NLS-1$\r\n \t\t\t\tif(file != null && file.exists()) {\r\n \t\t\t\t\treturn file;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t} catch (CoreException e) {\r\n \t\t\tJspEditorPlugin.getPluginLog().logError(e);\r\n \t\t\treturn null;\r\n \t\t}\r\n \t\treturn null;\r\n \t}", "public static String getProcessDefIdWithoutVersion(String processDefId) {\n String result = processDefId;\n if (processDefId != null) {\n StringTokenizer st = new StringTokenizer(processDefId, \"#\");\n if (st.countTokens() > 2) {\n st.nextToken(); // packageId\n st.nextToken(); // version\n result = st.nextToken();\n }\n }\n return result;\n }", "ArtifactRepository getRepository();", "public ProgramModule getRootModule(String treeName);", "public <T extends AModule> T getModule(Class<T> moduleId)\n\t{\n\t\treturn getModuleOpt(moduleId)\n\t\t\t\t.orElseThrow(() -> new ModuleNotFoundException(moduleMessage(moduleId, \"not found\")));\n\t}", "public Optional<Product> getProduct(String productId);", "SmallEcorePackage getSmallEcorePackage();", "private void excludeFromWarPackaging() {\n getLog().info(\"excludeFromWarPackaging\");\n String pluginGroupId = \"org.apache.maven.plugins\";\n String pluginArtifactId = \"maven-war-plugin\";\n if (project.getBuildPlugins() != null) {\n for (Object o : project.getBuildPlugins()) {\n Plugin plugin = (Plugin) o;\n\n if (pluginGroupId.equals(plugin.getGroupId()) && pluginArtifactId.equals(plugin.getArtifactId())) {\n Xpp3Dom dom = (Xpp3Dom) plugin.getConfiguration();\n if (dom == null) {\n dom = new Xpp3Dom(\"configuration\");\n plugin.setConfiguration(dom);\n }\n Xpp3Dom excludes = dom.getChild(\"packagingExcludes\");\n if (excludes == null) {\n excludes = new Xpp3Dom(\"packagingExcludes\");\n dom.addChild(excludes);\n excludes.setValue(\"\");\n } else if (excludes.getValue().trim().length() > 0) {\n excludes.setValue(excludes.getValue() + \",\");\n }\n\n Set<Artifact> dependencies = getArtifacts();\n getLog().debug(\"Size of getArtifacts: \" + dependencies.size());\n String additionalExcludes = \"\";\n for (Artifact dependency : dependencies) {\n getLog().debug(\"Dependency: \" + dependency.getGroupId() + \":\" + dependency.getArtifactId() + \"type: \" + dependency.getType());\n if (!dependency.isOptional() && Types.JANGAROO_TYPE.equals(dependency.getType())) {\n getLog().debug(\"Excluding jangaroo dependency form war plugin [\" + dependency.toString() + \"]\");\n // Add two excludes. The first one is effective when no name clash occurs\n additionalExcludes += \"WEB-INF\" + File.separator + \"lib\" + File.separator + dependency.getArtifactId() + \"-\" + dependency.getVersion() + \".jar,\";\n // the second when a name clash occurs (artifact will hav groupId prepended before copying it into the lib dir)\n additionalExcludes += \"WEB-INF\" + File.separator + \"lib\" + File.separator + dependency.getGroupId() + \"-\" + dependency.getArtifactId() + \"-\" + dependency.getVersion() + \".jar,\";\n }\n }\n excludes.setValue(excludes.getValue() + additionalExcludes);\n }\n }\n }\n }", "RestPackage getRestPackage();", "public Bundle findBundle(String packageName, String version)\n \t{\n \t\tClassService classService = ClassServiceUtility.getClassService();\n \t\tif (classService == null)\n \t\t\treturn null;\t// Never\n \t\tClassFinder classFinder = classService.getClassFinder(context);\n \t\tif (classFinder == null)\n \t\t\treturn null;\n \t\tBundle bundle = classFinder.findBundle(null, context, packageName, version);\n \t\tif (bundle == null)\n \t\t{\n \t Object resource = classFinder.deployThisResource(packageName + \".ClassName\", false, false); // Deploy, but do not start the bundle\n \t if (resource != null)\n \t \tbundle = classFinder.findBundle(resource, context, packageName, version);\n \t\t}\n \t\treturn bundle;\n \t}", "public static Entity getSingleKitesProtoArtifact(String kitesprotoartifactName) {\r\n\t\tKey key = KeyFactory.createKey(\"KitesProtoArtifact\", kitesprotoartifactName);\r\n\t\treturn Util.findEntity(key);\r\n\t}", "public final EObject ruleGetArtifact() throws RecognitionException {\n EObject current = null;\n\n Token otherlv_0=null;\n Token this_BEGIN_1=null;\n Token this_END_3=null;\n EObject lv_artifact_2_0 = null;\n\n\n\n \tenterRule();\n\n try {\n // InternalRMParser.g:6810:2: ( (otherlv_0= Get_artifact this_BEGIN_1= RULE_BEGIN ( (lv_artifact_2_0= ruleGetArtifactBody ) ) this_END_3= RULE_END ) )\n // InternalRMParser.g:6811:2: (otherlv_0= Get_artifact this_BEGIN_1= RULE_BEGIN ( (lv_artifact_2_0= ruleGetArtifactBody ) ) this_END_3= RULE_END )\n {\n // InternalRMParser.g:6811:2: (otherlv_0= Get_artifact this_BEGIN_1= RULE_BEGIN ( (lv_artifact_2_0= ruleGetArtifactBody ) ) this_END_3= RULE_END )\n // InternalRMParser.g:6812:3: otherlv_0= Get_artifact this_BEGIN_1= RULE_BEGIN ( (lv_artifact_2_0= ruleGetArtifactBody ) ) this_END_3= RULE_END\n {\n otherlv_0=(Token)match(input,Get_artifact,FOLLOW_6); \n\n \t\t\tnewLeafNode(otherlv_0, grammarAccess.getGetArtifactAccess().getGet_artifactKeyword_0());\n \t\t\n this_BEGIN_1=(Token)match(input,RULE_BEGIN,FOLLOW_74); \n\n \t\t\tnewLeafNode(this_BEGIN_1, grammarAccess.getGetArtifactAccess().getBEGINTerminalRuleCall_1());\n \t\t\n // InternalRMParser.g:6820:3: ( (lv_artifact_2_0= ruleGetArtifactBody ) )\n // InternalRMParser.g:6821:4: (lv_artifact_2_0= ruleGetArtifactBody )\n {\n // InternalRMParser.g:6821:4: (lv_artifact_2_0= ruleGetArtifactBody )\n // InternalRMParser.g:6822:5: lv_artifact_2_0= ruleGetArtifactBody\n {\n\n \t\t\t\t\tnewCompositeNode(grammarAccess.getGetArtifactAccess().getArtifactGetArtifactBodyParserRuleCall_2_0());\n \t\t\t\t\n pushFollow(FOLLOW_8);\n lv_artifact_2_0=ruleGetArtifactBody();\n\n state._fsp--;\n\n\n \t\t\t\t\tif (current==null) {\n \t\t\t\t\t\tcurrent = createModelElementForParent(grammarAccess.getGetArtifactRule());\n \t\t\t\t\t}\n \t\t\t\t\tset(\n \t\t\t\t\t\tcurrent,\n \t\t\t\t\t\t\"artifact\",\n \t\t\t\t\t\tlv_artifact_2_0,\n \t\t\t\t\t\t\"org.sodalite.dsl.RM.GetArtifactBody\");\n \t\t\t\t\tafterParserOrEnumRuleCall();\n \t\t\t\t\n\n }\n\n\n }\n\n this_END_3=(Token)match(input,RULE_END,FOLLOW_2); \n\n \t\t\tnewLeafNode(this_END_3, grammarAccess.getGetArtifactAccess().getENDTerminalRuleCall_3());\n \t\t\n\n }\n\n\n }\n\n\n \tleaveRule();\n\n }\n\n catch (RecognitionException re) {\n recover(input,re);\n appendSkippedTokens();\n }\n finally {\n }\n return current;\n }", "@NonNull\n RepoPackage getPackage();", "public Optional<ModuleData> getModuleData(int moduleId, String name) throws SQLException {\n QueryBuilder<ModuleData, Integer> queryBuilder = DB.MODULE_DATA_DAO.queryBuilder();\n Where<ModuleData, Integer> where = queryBuilder.where();\n where.eq(\"module_id\", moduleId).and().eq(\"name\", name);\n\n PreparedQuery<ModuleData> preparedQuery = queryBuilder.prepare();\n\n\n ModuleData data = DB.MODULE_DATA_DAO.queryForFirst(preparedQuery);\n if (data != null) {\n return Optional.of(data);\n } else {\n return Optional.empty();\n }\n }", "private WebApp findWebAppForDep(final App.Dependency dep, final Set<WebApp> webApps) {\n\t\tfor (final WebApp webApp : webApps) {\n\t\t\tif (webApp.getFullName().equalsIgnoreCase(dep.getName())) {\n\t\t\t\treturn webApp;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "java.lang.String getPackageName();", "@RequestMapping(value = \"/findByModule/{moduleId}\", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE })\n\tpublic ResponseEntity<?> findByModule(@PathVariable Integer moduleId){\n\t\tList<TeachingMaterialDto> lista = tmService.findByModule(moduleId);\n\t\tif (lista.isEmpty()) {\n \t\treturn new ResponseEntity<>(new CustomErrorType(\"List empty.\"),\n \t\t\tHttpStatus.NO_CONTENT);\n \t}\n\t\treturn new ResponseEntity<List<TeachingMaterialDto>>(lista, HttpStatus.OK);\n\t}", "@Override\n\tpublic List<ExportProduct> find(Map paraMap) {\n\t\treturn null;\n\t}", "public ArtifactType getArtifactType() {\r\n \t\treturn(ArtifactType.ServiceImplementation);\r\n \t}" ]
[ "0.5530873", "0.5478128", "0.54414666", "0.5269066", "0.52288824", "0.50519204", "0.49951097", "0.49780652", "0.4939315", "0.4933144", "0.48617852", "0.48304576", "0.47965303", "0.47666886", "0.47453362", "0.47323096", "0.47261962", "0.47246358", "0.47074926", "0.46859148", "0.46808898", "0.467342", "0.4641135", "0.46254238", "0.4610238", "0.4603269", "0.46016806", "0.4596172", "0.45918187", "0.45568144", "0.45365608", "0.45228797", "0.4503621", "0.45009372", "0.44990754", "0.44752568", "0.44695938", "0.44671395", "0.4464903", "0.44553784", "0.44502547", "0.4429169", "0.43917033", "0.43352428", "0.43314528", "0.43247452", "0.42838106", "0.42836377", "0.4279575", "0.4268145", "0.42599893", "0.42452177", "0.42334422", "0.42214695", "0.42044637", "0.4203827", "0.41982624", "0.41764727", "0.41714314", "0.41646546", "0.41613144", "0.41547835", "0.41479984", "0.4133644", "0.4127172", "0.41246936", "0.41245282", "0.41187808", "0.41179344", "0.41162366", "0.41141304", "0.4112217", "0.41095507", "0.4107781", "0.40952918", "0.40886906", "0.40826428", "0.4080064", "0.40789074", "0.40783477", "0.4072204", "0.40686983", "0.4059638", "0.40528822", "0.404591", "0.4036374", "0.4035452", "0.40337095", "0.40298218", "0.40218875", "0.40209645", "0.40190747", "0.40176946", "0.401746", "0.40145776", "0.40140924", "0.40123633", "0.40115887", "0.40113106", "0.40098152" ]
0.82510495
0
With extra space Time: O(n1+n2) Space: O(n1+n2)
public ListNode mergeTwoListsWithExtraLinkedList(ListNode l1, ListNode l2) { ListNode dummy=new ListNode(); ListNode curr=dummy,temp; while(l1!=null && l2!=null){ if(l1.val<l2.val){ temp=new ListNode(l1.val); l1=l1.next; } else{ temp=new ListNode(l2.val); l2=l2.next; } curr.next=temp; curr=curr.next; } while(l1!=null){ curr.next=new ListNode(l1.val); l1=l1.next; curr=curr.next; } while(l2!=null){ curr.next=new ListNode(l2.val); l2=l2.next; curr=curr.next; } return dummy.next; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int f2(int N) { \n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n)\n // O(n)`\n for(int j = 0; j < i; j++) \n x++;\n return x;\n }", "public static int example2(int[] arr) { // O(1)\r\n\t\tint n = arr.length, total = 0; // O(1)\r\n\t\tfor (int j = 0; j < n; j += 2) // note the increment of 2 // O(1)\r\n\t\t\ttotal += arr[j];\r\n\t\treturn total;\r\n\r\n\t\t/*\r\n\t\t * Explanation: Once Again, we have a (for) loop and it runs (n) times and this\r\n\t\t * for loop dominates the runtime.So this is linear time and the answer is O(n).\r\n\t\t * \r\n\t\t */\r\n\t}", "public static int f1(int N) {\n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n) \n x++; \n return x; \n \n }", "public int[] squareUp(int n) {\r\n int[]arreglo=new int[(n*n)]; // O(1)\r\n if(n==0){ // O(1)\r\n return arreglo; // O(1)\r\n }\r\n for(int i=n-1;i<arreglo.length;i=i+n){ // O(n)\r\n for (int j=i;j>=i-(i/n);j--){ // O(1)\r\n arreglo[j]=1+(i-j); // O(1)\r\n }\r\n }\r\n return arreglo; // O(1)\r\n}", "public void sum2(int n){\n int sum =0; //1\n for (int j = 0; j < n; j++) //2n+2\n for (int k = 0; k < n; k++) //2n+2\n sum += k + j; //1\n for (int l = 0; l < n; l++) //2n+2\n sum += l; //1\n }", "private static List<Integer> getCommonElementsAlgo2(int [] arr1, int [] arr2) {\n\t\t\n\t\tList<Integer> duplicates = new ArrayList<>();\n\t\t\n\t\tHashtable<Integer, Integer> table = new Hashtable<>();\n\t\t\n\t\tfor (int i : arr1) {\n\t\t\tif (table.containsKey(i)) {\n\t\t\t\ttable.put(i, table.get(i) + 1);\n\t\t\t}\n\t\t\ttable.put(i, 1);\n\t\t}\n\t\t\n\t\tfor (int j : arr2) {\n\t\t\tif (table.containsKey(j)) {\n\t\t\t\tduplicates.add(j);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn duplicates;\n\t\t\n\t}", "public static int example4(int[] arr) { // O(1)\r\n\t\tint n = arr.length, prefix = 0, total = 0; // O(1), O(1), (1)\r\n\t\tfor (int j = 0; j < n; j++) { // loop from 0 to n-1 // O(n)\r\n\t\t\tprefix += arr[j];\r\n\t\t\ttotal += prefix;\r\n\t\t}\r\n\t\treturn total;\r\n\r\n\t\t/*\r\n\t\t * Explanation: The method contains a (for) loop and it runs (n) times.This loop\r\n\t\t * dominates the runtime.We always aim for the worse-case and maximum time. The\r\n\t\t * answer is it is linear time of O(n) notation.\r\n\t\t * \r\n\t\t */\r\n\t}", "private static String subProcess(int[] n1, int[] n2) {\n\n\t\t// if n1.length is smaller than n2.length, we are going to be too small.\n\t\tif (n1.length < n2.length) {\n\t\t\treturn \"+\" + toString (n1);\n\t\t}\n\t\t\n\t\t// we have to extend, and reduce length. Note that this WILL terminate because\n\t\t// we would have left earlier if n2 were greater than n1.\n\t\tint off = 0;\n\t\tint length = n2.length;\n\t\twhile (compareTo(n2,0,length,n1,off) > 0) {\n\t\t\tn2 = expand(n2);\n\t\t\tlength = n2.length;\n\t\t\t\n\t\t\tif (length > n1.length) {\n\t\t\t\t// gone too far! We at last have our remainder! Return as \"+remainder\".\n\t\t\t\treturn \"+\" + toString(n1);\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tint []innerSum = new int[n1.length+1]; // add 1 just in case we get too high\n\t\tint []result = new int[length]; \n\t\tint start;\n\t\t\n\t\t// initial set.\n\t\tif (n2[0] == 0) { start = 9; } else { start = n1[0]/n2[0]; }\n\t\t\n\t\tmultiply(n2, start, innerSum);\n\t\tinnerSum = reduce(innerSum);\n\t\t\n\t\tif (innerSum.length < n2.length) {\n\t\t\t// perfect fit. Expand back out to work with subtractDown. REALLY UGLY CODE\n\t\t\tinnerSum = expand(innerSum);\n\t\t} else {\n\t\t\t// must reduce and continue....\n\t\t\twhile (n2.length < innerSum.length) {\n\t\t\t\tstart--; // had gone too far! Back down.\n\t\t\t\tinnerSum = new int[n1.length+1];\n\t\t\t\tmultiply (n2, start, innerSum);\n\t\t\t\tinnerSum = reduce(innerSum);\n\t\t\t}\n\t\t}\n\t\t\n\t\tboolean subtractDown = compareTo(innerSum, n1, innerSum.length) > 0; // if false, we have to add up\n\t\twhile (true) {\n\t\t\tif (subtractDown) {\n\t\t\t\tstart--;\n\t\t\t\tsubtract(innerSum, n2, result, subProcessSign);\n\t\t\t\tassign(innerSum, result);\n\t\t\t\t\n\t\t\t\tsubtractDown = compareTo(innerSum, n1, innerSum.length) > 0;\n\t\t\t} else {\n\t\t\t\t// found. Note that 'start' is the digit in the quotient. Subtract from and replace.\n\t\t\t\tint []newTop = new int[innerSum.length];\n\t\t\t\textract(newTop,0,n1,0,innerSum.length);\n\t\t\t\t\n\t\t\t\tresult = new int[innerSum.length];\n\t\t\t\tsubtract(newTop, innerSum, result, subProcessSign); \n\t\t\t\textract(n1,0,result,0,result.length); // copy back in\n\t\t\t\t\n\t\t\t\tint[]normalized_n1 = reduce(n1);\n\t\t\t\tint[]normalized_n2 = reduce(n2);\n\t\t\t\tString s = start + subProcess(normalized_n1, normalized_n2);\n\t\t\t\treturn s;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "private int calcDistanceMemoize(int i, int j, char[] one, char[] two, int [][]table) {\n if (i < 0)\n return j+1;\n\tif (j < 0)\n\t return i+1;\n\n if (table[i][j] == -1) \n table[i][j] = calcDistanceRecursive(i, j, one, two, table);\n\t\n return table[i][j];\n }", "private static void sortAccording(int A1[], int A2[], int m, int n)\n {\n // The temp array is used to store a copy \n // of A1[] and visited[] is used to mark the \n // visited elements in temp[].\n int temp[] = new int[m], visited[] = new int[m];\n for (int i = 0; i < m; i++)\n {\n temp[i] = A1[i];\n visited[i] = 0;\n }\n \n // Sort elements in temp\n Arrays.sort(temp);\n \n // for index of output which is sorted A1[]\n int ind = 0; \n \n // Consider all elements of A2[], find them\n // in temp[] and copy to A1[] in order.\n for (int i = 0; i < n; i++){\n\n // Find index of the first occurrence\n // of A2[i] in temp\n int f = first(temp, 0, m-1, A2[i], m);\n \n // If not present, no need to proceed\n if (f == -1) \n continue;\n \n // Copy all occurrences of A2[i] to A1[]\n for (int j = f; (j < m && temp[j] == A2[i]); j++){\n \n A1[ind++] = temp[j];\n visited[j] = 1;\n }\n }\n \n // Now copy all items of temp[] which are \n // not present in A2[]\n for (int i = 0; i < m; i++)\n if (visited[i] == 0)\n A1[ind++] = temp[i];\n }", "public static List<Integer> lcs(List<Integer> arr1, List<Integer> arr2) {\r\n ArrayList empty = new ArrayList();\r\n /* BEFORE WE ALLOCATE ANY DATA STORAGE, VALIDATE ARGS */\r\n if (null == arr1 || 0 == arr1.size())\r\n return empty;\r\n if (null == arr2 || 0 == arr2.size())\r\n return empty;\r\n\r\n if (equalLists(arr1, arr2)) {\r\n return arr1;\r\n }\r\n\r\n /* ALLOCATE VARIABLES WE'LL NEED FOR THE ROUTINE */\r\n ArrayList<Integer> bestMatch = new ArrayList<Integer>();\r\n ArrayList<Integer> currentMatch = new ArrayList<Integer>();\r\n ArrayList<List<Integer>> dataSuffixList = new ArrayList<List<Integer>>();\r\n ArrayList<List<Integer>> lineSuffixList = new ArrayList<List<Integer>>();\r\n\r\n /* FIRST, COMPUTE SUFFIX ARRAYS */\r\n for (int i = 0; i < arr1.size(); i++) {\r\n dataSuffixList.add(arr1.subList(i, arr1.size()));\r\n }\r\n for (int i = 0; i < arr2.size(); i++) {\r\n lineSuffixList.add(arr2.subList(i, arr2.size()));\r\n }\r\n\r\n /* STANDARD SORT SUFFIX ARRAYS */\r\n IntegerListComparator comp = new IntegerListComparator();\r\n Collections.sort(dataSuffixList, comp);\r\n Collections.sort(lineSuffixList, comp);\r\n\r\n /* NOW COMPARE ARRAYS MEMBER BY MEMBER */\r\n List<?> d = null;\r\n List<?> l = null;\r\n List<?> shorterTemp = null;\r\n int stopLength = 0;\r\n int k = 0;\r\n boolean match = false;\r\n\r\n bestMatch.retainAll(empty);\r\n bestMatch.addAll(currentMatch);\r\n for (int i = 0; i < dataSuffixList.size(); i++) {\r\n d = (List) dataSuffixList.get(i);\r\n for (int j = 0; j < lineSuffixList.size(); j++) {\r\n l = (List) lineSuffixList.get(j);\r\n if (d.size() < l.size()) {\r\n shorterTemp = d;\r\n } else {\r\n shorterTemp = l;\r\n }\r\n\r\n currentMatch.retainAll(empty);\r\n k = 0;\r\n stopLength = shorterTemp.size();\r\n match = (l.get(k).equals(d.get(k)));\r\n while (k < stopLength && match) {\r\n if (l.get(k).equals(d.get(k))) {\r\n currentMatch.add((Integer) shorterTemp.get(k));\r\n k++;\r\n } else {\r\n match = false;\r\n }\r\n }\r\n if (currentMatch.size() > bestMatch.size()) {\r\n bestMatch.retainAll(empty);\r\n bestMatch.addAll(currentMatch);\r\n }\r\n }\r\n }\r\n return bestMatch;\r\n }", "public static int findCommon2(int[] in1, int[] in2) {\r\n\t\tint common = 0;\r\n\t\t//iterate through the shorter array and do a binary search for every element of short array in big array\r\n\t\tif (in2.length > in1.length) {\r\n\t\t\tfindCommon2(in2, in1);\r\n\t\t}\r\n\t\t//nlogn\r\n\t\tArrays.sort(in2);\r\n\t\t//mlogn\r\n\t\tfor (int i = 0; i < in1.length; i++) {\r\n\t\t\tif(Arrays.binarySearch(in2, in1[i]) > 0) {\r\n\t\t\t\t++common;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn common;\r\n\t}", "public boolean linearIn(int[] outer, int[] inner) {\r\n int comp=0; // O(1)\r\n int count=0; // O(1)\r\n if(inner.length==0) // O(1)\r\n return true; // O(1)\r\n for(int i=0; i<outer.length; i++) { // O(n)\r\n if(outer[i]==inner[count]) { // O(1)\r\n comp++; // O(1)\r\n count++; // O(1)\r\n } else if(outer[i]>inner[count]) // O(1)\r\n return false; // O(1)\r\n if (comp==inner.length) // O(1)\r\n return true; // O(1)\r\n }\r\n return false; // O(1)\r\n}", "public void merge2(int[] nums1, int m, int[] nums2, int n) {\n int p1 = m - 1;\n int p2 = n - 1;\n // set pointer for nums1\n int p = m + n - 1;\n\n // while there are still elements to compare\n while ((p1 >= 0) && (p2 >= 0))\n // compare two elements from nums1 and nums2\n // and add the largest one in nums1\n nums1[p--] = (nums1[p1] < nums2[p2]) ? nums2[p2--] : nums1[p1--];\n\n // add missing elements from nums2\n System.arraycopy(nums2, 0, nums1, 0, p2 + 1);\n\n }", "static void UseArrayList(ArrayList<Integer> myList2){\r\n\t\tLong start = System.currentTimeMillis();\r\n\t\tfor (int n=0; n<myList2.size();n++)\r\n\t\t{\r\n\t\t\tfor (int m=n+1; m<myList2.size();m++){\r\n\t\t\t\tif( myList2.get(n)== myList2.get(m) ) {System.out.println(\"Duplicate found \"+myList2.get(n));}\r\n\t\t\t}\r\n\t\t}\r\n\t\tLong End = System.currentTimeMillis();\r\n\t\tSystem.out.println(\"Total time taken for executing this code is: \" + (End-start));\r\n\t}", "private static List<Integer> getCommonElementsAlgo1(int [] arr1, int [] arr2) {\n\t\t\n\t\tList<Integer> list1 = new ArrayList<Integer>();\n\t\tfor (int i : arr1) {\n\t\t\tlist1.add(i);\n\t\t}\n\t\tList<Integer> list2 = new ArrayList<Integer>();\n\t\tfor (int i : arr2) {\n\t\t\tlist2.add(i);\n\t\t}\n\t\tif (list1.size() > list2.size()) {\n\t\t\tlist1.retainAll(list2);\n\t\t\treturn list1;\n\t\t}\n\t\telse {\n\t\t\tlist2.retainAll(list1);\n\t\t\treturn list2;\n\t\t}\n\t\t\n\t}", "private static int[] p2(int[] ar, int n) {\n int[] p2 = new int[n];\n Arrays.fill(p2, n);\n Stack<Integer> st = new Stack<>();\n for (int i = 0; i < n; i++) {\n while (st.size() != 0 && ar[i] < ar[st.peek()]) {\n p2[st.peek()] = i;\n st.pop();\n }\n st.push(i);\n }\n return p2;\n }", "public static double findMedianSortedArraysBrutalForce(int[] nums1, int[] nums2) {\n int m = nums1.length;\n int n = nums2.length;\n if (n == 0) {\n return getMedian(nums1);\n }\n if (m == 0) {\n return getMedian(nums2);\n }\n\n int[] nums = new int[m + n];\n\n int count = 0;\n int i = 0, j = 0;\n while (count != (m + n)) {\n // if nums1 reach the end first\n if (i == m) {\n // push all the rest of the nums2 into result array\n while (j != n) {\n nums[count++] = nums2[j++];\n }\n // then get rid of the while loop\n break;\n }\n // if nums2 reach the end of the while loop\n if (j == n) {\n while (i != m) {\n nums[count++] = nums1[i++];\n }\n break;\n }\n\n // compare current value then only push the small one into result array\n if (nums1[i] < nums2[j]) {\n nums[count++] = nums1[i++];\n } else {\n nums[count++] = nums2[j++];\n }\n }\n\n return getMedian(nums);\n }", "@Override\r\n public long problem2() {\r\n ArrayList<String> arrList = new ArrayList<>();\r\n long start = System.currentTimeMillis(); \r\n for(int i = 0; i<1234567; i++){\r\n arrList.add(Integer.toString(i));\r\n }\r\n long end = System.currentTimeMillis(); \r\n return end - start; \r\n }", "public static int example3(int[] arr) { // O(n)\r\n\t\tint n = arr.length, total = 0; // O(1)\r\n\t\tfor (int j = 0; j < n; j++) // loop from 0 to n-1 // O(n^2)\r\n\t\t\tfor (int k = 0; k <= j; k++) // loop from 0 to j\r\n\t\t\t\ttotal += arr[j];\r\n\t\treturn total;\r\n\r\n\t\t/*\r\n\t\t * Explanation: Since we have nested for loop which dominates here and it is\r\n\t\t * O(n^2) and we always take the maximum. so the answer is quadratic time O(n^2)\r\n\t\t * \r\n\t\t */\r\n\t}", "public static int solveEfficient(int n) {\n if (n == 0 || n == 1)\n return 1;\n\n int n1 = 1;\n int n2 = 1;\n int sum = 0;\n\n for (int i = 2; i <= n; i++) {\n sum = n1 + n2;\n n1 = n2;\n n2 = sum;\n }\n return sum;\n }", "public static int[] mergeTwoSortedArraysWithoutExtraSpace(int arr1[],int m,int arr2[],int n)\r\n { \r\n int l=(arr1.length-1);\r\n if(n!=0){\r\n for(int i=m-1;i>=0;i--)\r\n {\r\n arr1[l]=arr1[i];\r\n --l;\r\n arr1[i]=0;\r\n }\r\n }\r\n Simple.printArray(arr1);\r\n int i=arr1.length-m;\r\n System.out.println(i);\r\n int j=0;\r\n int k=0;\r\n while(i<arr1.length && j<n)\r\n {\r\n System.out.println(i);\r\n if(arr1[i]<arr2[j])\r\n {\r\n arr1[k]=arr1[i];\r\n i++;\r\n k++;\r\n }\r\n else \r\n {\r\n {\r\n arr1[k]=arr2[j];\r\n j++;\r\n k++;\r\n }\r\n }\r\n }\r\n\r\n while(j<n)\r\n {\r\n\r\n arr1[k]=arr2[j];\r\n j++;\r\n k++;\r\n }\r\n\r\n Simple.printArray(arr1);\r\n return arr1;\r\n }", "public int[] twoSum2(int[] nums, int target) {\n int[] res = new int[2];\n int n = nums.length;\n Map<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n map.put(nums[i], i);\n }\n for (int i = 0; i < n; i++) {\n int key = target - nums[i];\n if (map.containsKey(key) && map.get(key) != i) {\n res[0] = i;\n res[1] = map.get(key);\n return res;\n }\n }\n return res;\n }", "public int[] twoSum2(int[] nums, int target) {\n int max = nums[0];\n int min = max;\n // get rank\n for (int e : nums) {\n if (e > max) {\n max = e;\n }\n if (e < min) {\n min = e;\n }\n }\n // show up table\n Integer[] showUpMap = new Integer[max - min + 1];\n LinkedList[] indicesMap = new LinkedList[max - min + 1];\n for (int i = 0; i < nums.length; i++) {\n showUpMap[nums[i] - min] = 1;\n if (indicesMap[nums[i] - min] == null) {\n indicesMap[nums[i] - min] = new LinkedList<Integer>();\n }\n indicesMap[nums[i] - min].add(i);\n }\n System.out.println(Arrays.toString(showUpMap));\n System.out.println(Arrays.toString(indicesMap));\n for (int i = 0; i < showUpMap.length; i++) {\n boolean show = showUpMap[i] != null;\n if (show) {\n int a = i + min;\n int need = target - a;\n if (need - min < showUpMap.length &&\n showUpMap[need - min] != null) {\n int ai = (int) indicesMap[i].get(0);\n int bi = (int) indicesMap[need - min].get(0);\n if (ai == bi) {\n bi = (int) indicesMap[need - min].get(1);\n }\n return new int[]{ai, bi};\n }\n }\n }\n return null;\n }", "public int[] fix34(int[] nums) {\r\n\tint i=0; // O(1)\r\n while(i<nums.length && nums[i]!=3) // O(n)\r\n i++; // n+1\r\n int j=i; // O(1)\r\n while(j+1<nums.length && nums[j+1]!=4) // O(n)\r\n j++; // n+1\r\n while(i<nums.length){ // O(n)\r\n if(nums[i]==3){ // O(1)\r\n int temp=nums[i+1]; // O(1)\r\n nums[i+1]=nums[j+1]; //O(1)\r\n nums[j+1]=temp; // O(1)\r\n while(j+1<nums.length && nums[j+1] != 4) //O(n)\r\n j++; // n+1\r\n }\r\n i++; // n+1\r\n }\r\n return nums; //O(1)\r\n}", "public static int[] twoSum(int[] numbers, int target) {\n // Start typing your Java solution below\n // DO NOT write main() function\n int[] aux = new int[numbers.length];\n HashMap<Integer, Integer> valueToIndex = new HashMap<Integer, Integer>();\n for (int i = 0; i < numbers.length; i++) {\n valueToIndex.put(numbers[i], i);\n aux[i] = numbers[i];\n }\n \n int i = 0, j = numbers.length - 1;\n boolean found = false;\n \n Arrays.sort(aux);\n \n while (i != j) {\n if (aux[i] + aux[j] < target) i++;\n else if (aux[i] + aux[j] > target) j--;\n else {\n found = true;\n break;\n }\n }\n \n if (!found) return null;\n \n int[] result = new int[2];\n if (aux[i] == aux[j]) { /* Handle duplicates */\n int first = -1, second = -1;\n for (int k = 0; k < numbers.length; k++) {\n if (numbers[k] == aux[i]) {\n if (first == -1) {\n first = k;\n } else if (second == -1) {\n second = k;\n break;\n }\n }\n }\n result[0] = first + 1;\n result[1] = second + 1;\n return result;\n }\n \n \n if (valueToIndex.get(aux[i]) < valueToIndex.get(aux[j])) {\n result[0] = valueToIndex.get(aux[i]) + 1;\n result[1] = valueToIndex.get(aux[j]) + 1;\n } else {\n result[0] = valueToIndex.get(aux[j]) + 1;\n result[1] = valueToIndex.get(aux[i]) + 1;\n }\n return result;\n }", "public static int example1(int[] arr) { // O(1)\r\n\t\tint n = arr.length, total = 0; // O(1)\r\n\t\tfor (int j = 0; j < n; j++) // loop from 0 to n-1 // O(n)\r\n\t\t\ttotal += arr[j];\r\n\t\treturn total;\r\n\t}", "public int findDuplicate(int[] nums) {\n if(nums == null || nums.length == 0) return 0;\n\n int slow = nums[0];\n int fast = nums[nums[0]];\n\n while(slow != fast) {\n slow = nums[slow];\n fast = nums[nums[fast]];\n }\n\n fast = 0;\n while(slow != fast) {\n slow = nums[slow];\n fast = nums[fast];\n }\n\n return slow;\n}", "private final int m()\n\t { int n = 0;\n\t int i = 0;\n\t while(true)\n\t { if (i > j) return n;\n\t if (! cons(i)) break; i++;\n\t }\n\t i++;\n\t while(true)\n\t { while(true)\n\t { if (i > j) return n;\n\t if (cons(i)) break;\n\t i++;\n\t }\n\t i++;\n\t n++;\n\t while(true)\n\t { if (i > j) return n;\n\t if (! cons(i)) break;\n\t i++;\n\t }\n\t i++;\n\t }\n\t }", "static Object m11869n(@NullableDecl int[] iArr, @NullableDecl Object[] objArr, int i, int i2, @NullableDecl Object obj) {\n Object obj2 = null;\n if (obj == null) {\n return null;\n }\n if (i == 1) {\n if (objArr[i2].equals(obj)) {\n obj2 = objArr[i2 ^ 1];\n }\n return obj2;\n } else if (iArr == null) {\n return null;\n } else {\n int length = iArr.length - 1;\n int b = Hashing.m11897b(obj.hashCode());\n while (true) {\n int i3 = b & length;\n int i4 = iArr[i3];\n if (i4 == -1) {\n return null;\n }\n if (objArr[i4].equals(obj)) {\n return objArr[i4 ^ 1];\n }\n b = i3 + 1;\n }\n }\n }", "public int[] addNegabinary2(int[] arr1, int[] arr2) {\n LinkedList<Integer> list = new LinkedList<>();\n int n = Math.max(arr1.length, arr2.length);\n for (int i = 0, carry = 0; i < n || carry != 0; i++) {\n int b1 = (i < arr1.length) ? arr1[arr1.length - i - 1] : 0;\n int b2 = (i < arr2.length) ? arr2[arr2.length - i - 1] : 0;\n int sum = b1 + b2 + carry;\n list.push(Math.abs(sum) % 2);\n carry = (sum < 0) ? 1 : (sum > 1) ? -1 : 0;\n }\n for (; list.size() > 1 && list.get(0) == 0; list.pop()) {}\n return list.stream().mapToInt(i->i).toArray();\n }", "public void merge(int[] nums1, int m, int[] nums2, int n) {\n\n\n int i = m-1,j=n-1;\n int k=m+n-1;\n\n while(i>=0 && j>=0){\n if(nums1[i]>nums2[j]){\n nums1[k] = nums1[i];\n i--;\n } else{\n nums1[k]=nums2[j];\n j--;\n }\n k--;\n }\n while(j>=0){\n nums1[k]=nums2[j];\n k--;\n j--;\n }\n }", "public static int[] twoSumBetter(int[] numbers, int target) {\n int[] aux = new int[numbers.length];\n for (int i = 0; i < numbers.length; i++) {\n aux[i] = numbers[i];\n }\n \n int i = 0, j = numbers.length - 1;\n boolean found = false;\n \n Arrays.sort(aux);\n \n while (i != j) {\n if (aux[i] + aux[j] < target) i++;\n else if (aux[i] + aux[j] > target) j--;\n else {\n found = true;\n break;\n }\n }\n \n if (!found) return null;\n int firstTarget = aux[i], secondTarget = aux[j];\n \n int[] result = new int[2];\n boolean foundOne = false;\n int leftOver = -1;\n for (int k = 0; k < numbers.length; k++) {\n \n if (foundOne) {\n if (numbers[k] == leftOver) {\n result[1] = k + 1;\n return result;\n }\n }\n \n if (numbers[k] == firstTarget || numbers[k] == secondTarget) {\n \n foundOne = true;\n leftOver = numbers[k] == firstTarget ? secondTarget : firstTarget;\n result[0] = k + 1;\n }\n }\n \n return result;\n \n }", "private int d(@Nullable K ☃) {\r\n/* 127 */ return (xq.f(System.identityHashCode(☃)) & Integer.MAX_VALUE) % this.b.length;\r\n/* */ }\r\n/* */ private int b(@Nullable K ☃, int i) {\r\n/* */ int j;\r\n/* 131 */ for (j = i; j < this.b.length; j++) {\r\n/* 132 */ if (this.b[j] == ☃) {\r\n/* 133 */ return j;\r\n/* */ }\r\n/* 135 */ if (this.b[j] == a) {\r\n/* 136 */ return -1;\r\n/* */ }\r\n/* */ }", "public static void merge(int[] nums1, int m, int[] nums2, int n) {\n for (int i = 0; i < m; i++) {\n nums1[m + n - 1 - i] = nums1[m - 1 - i];\n }\n\n int index = 0;\n int indexNum1 = n;\n int indexNum2 = 0;\n\n while (indexNum2 < n) {\n // if empty num1, insert all num2\n if (indexNum1 == m + n) {\n while (indexNum2 < n) {\n nums1[index++] = nums2[indexNum2++];\n }\n\n return;\n }\n\n if (nums1[indexNum1] <= nums2[indexNum2]) {\n nums1[index] = nums1[indexNum1++];\n } else {\n nums1[index] = nums2[indexNum2++];\n\n }\n index++;\n }\n }", "public static int[] exe1(int[] arr){ // Solution O(n) in time and constant in Memory\n int nzeros=0;\n\n for (int i=0; i<arr.length; i++) {\n arr[i-nzeros] = arr[i];\n if (arr[i] == 0) {\n nzeros++;\n }\n }\n for (int i=arr.length-1; i>arr.length-nzeros-1; i--) {\n arr[i] = 0;\n }\n\n return arr;\n }", "public ListNode findMergePointIn_Time_Order_N_(ListNode list1,ListNode list2 ){\n\t\t\n\t\tif(list1==null || list2==null)\n\t\t\treturn null;\n//\t\telse if((list1!=null && list1.next==null) && (list2!=null && list2.next==null) && (list1.val==list2.val) )) {\n//\t\t return list1;\n//\t\t}\t\n//\t\n\t\telse{\n\t\t\tint length1=0,length2=0,diff = 0;\n\t\t\tListNode head1 =list1;\n\t\t\tListNode head2 = list2;\n\t\t\twhile(head1!=null){\n\t\t\t\tlength1++;\n\t\t\t\thead1=head1.getNextNode();\n\t\t\t}\n\t\t\twhile(head2!=null){\n\t\t\t\tlength1++;\n\t\t\t\thead2=head2.getNextNode();\n\t\t\t}\n\t\t\tif(length1<length2){\n\t\t\t\thead1=list2;//bigger list in h1\n\t\t\t\thead2=list1;//smaller in h2\n\t\t\t\tdiff= length2-length1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\thead1=list1;//bigger list in h1\n\t\t\t\thead2=list2;//smaller list in h2\n\t\t\t\tdiff= length2-length1;\n\t\t\t}\n\t\t\tint pos =0;\n\t\t\twhile(pos<diff){ //till we are at (diff+1) position in larger list \n\t\t\t\thead1=head1.getNextNode();\n\t\t\t\tpos++;\n\t\t\t}\n\t\t\twhile(head1!=null && head2!=null){//increase till end of link list \n\t\t\t\tif(head1==head2){\n\t\t\t\t\treturn head1;\n\t\t\t\t}\n\t\t\t\thead1=head1.getNextNode();\n\t\t\t\thead2=head2.getNextNode();\n\t\t\t}\n\t\t\treturn head1.getNextNode();\n\t\t}\n\t}", "private static List<Integer> getCommonElementsIterativeMethod(int [] arr1, int [] arr2) {\n\t\tList<Integer> duplicates = new ArrayList<Integer>();\n\t\t\n\t\t// Iterate through both arrays and find common elements. (O(n2) steps!)\n\t\tfor (int i=0; i< arr1.length; i++) {\n\t\t\tfor (int j=0; j < arr2.length; j++) {\n\t\t\t\tif (arr1[i] == arr2[j]) {\n\t\t\t\t\tduplicates.add(arr1[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn duplicates;\n\t\t\n\t}", "private void faster() {\n BigInteger[] denoms = new BigInteger[1000];\n BigInteger[] nums = new BigInteger[1000];\n\n nums[0] = BigInteger.valueOf(3);\n denoms[0] = BigInteger.valueOf(2);\n\n for (int i = 1; i < 1000; i++) {\n denoms[i] = nums[i - 1].add(denoms[i - 1]);\n nums[i] = denoms[i].add(denoms[i - 1]);\n }\n\n int count = 0;\n for (int i = 1; i < 1000; i++) {\n if (nums[i].toString().length() > denoms[i].toString().length()) {\n count++;\n }\n }\n this.answer = count;\n }", "static int[] sol1(int[]a, int n){\r\n\t\tMap <Integer,Integer> map= new HashMap();\r\n\t\tfor (int i = 0; i< a.length; i++){\r\n\t\t\tmap.put(a[i],i);\r\n\t\t}\r\n\t\tArrays.sort(a);\r\n\t\tint i = 0; \r\n\t\tint j = a.length -1;\r\n\t\twhile (i <= j){\r\n\t\t\tif(a[i]+a[j]>n) j--;\r\n\t\t\telse if (a[i]+a[j]<n) i++;\r\n\t\t\telse break;\r\n\t\t}\r\n\t\tint[] ans= {map.get(a[i]),map.get(a[j])};\r\n\t\treturn ans;\r\n\t}", "public static void a2v2(int[] A)\n {\n Map<Integer, List<Integer>> hashMap = new HashMap<>();\n\n insert(hashMap, 0, -1);\n\n int sum = 0;\n\n for (int i = 0; i < A.length; i++)\n {\n sum += A[i];\n\n if (hashMap.containsKey(sum))\n {\n List<Integer> list = hashMap.get(sum);\n\n // find all subarrays with the same sum\n for (Integer value: list)\n {\n System.out.println(\"Subarray [\" + (value + 1) + \"…\" +\n i + \"]\");\n }\n }\n\n // insert (sum so far, current index) pair into the hashmap\n insert(hashMap, sum, i);\n }\n }", "private static int f(int n, int complete, int other, int[] arr) {\n if(n<=0)\n return 0;\n int res=0;\n ArrayList<Integer>list=new ArrayList<Integer>();\n for(int a:arr)\n if(a>0)\n list.add(a);\n int brr[]=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n while(brr.length!=0){\n int index=0;\n for(int i=1;i<brr.length;i++)\n if(brr[index]<brr[i])\n index=i;\n for(int i=0;i<brr.length;i++){\n if(index==i)\n brr[i]-=complete;\n else\n brr[i]-=other;\n }\n list=new ArrayList<Integer>();\n for(int a:brr)\n if(a>0)\n list.add(a);\n brr=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n res++;\n }\n return res;\n }", "private int[] caculatehashposition(BigInteger decicode1,\n\t\t\tBigInteger decicode2, int k2) {\n\t\tint[] position=new int[k2];\n\t\tBigInteger index;\n\t\tBigInteger decicode_k;\n\t\tBigInteger k;\n\t\t\n\t\tfor(int i=0;i<k2;i++){\n\t\t\n\t\tk=BigInteger.valueOf(k2);\n\t\t\n\t\tdecicode_k= decicode1.add(decicode2.multiply(k));\n\t\tindex=decicode_k.mod(BigInteger.valueOf(this.m));\n\t\tposition[i]= index.intValue();\n\t\t}\n\t\t\n\t\treturn position ;\n\t}", "private int[] hashSetMethod(int[] nums1, int[] nums2) {\n HashSet<Integer> s = new HashSet<Integer>();\n for (Integer i : nums1) {\n if (!s.contains(i)) s.add(i);\n }\n HashSet<Integer> intersection = new HashSet<Integer>();\n for (Integer i : nums2) {\n if (s.contains(i) && !intersection.contains(i)) {\n \tintersection.add(i);\n }\n }\n int[] res = new int[intersection.size()];\n Iterator<Integer> iter = intersection.iterator();\n for (int i = 0; iter.hasNext(); i++) {\n res[i] = iter.next();\n }\n return res;\n }", "public static int f5(int N) { \n int x = 0;\n // log(n)\n for(int i = N; i > 0; i = i/2)\n // O(n) + O(n/2) + O(n/4)\n x += f1(i);\n \n return x; \n \n }", "static int[] find2(int a[]){\r\n int sum = a[0];\r\n int pro = a[0];\r\n for(int i=1;i<a.length;i++){\r\n sum += a[i];\r\n pro += a[i]*a[i];\r\n }\r\n int s = (n*(n+1))/2 - sum;\r\n int p = (n*(n+1)*(2*n+1))/6 - pro;\r\n return solveSP(s, p);\r\n }", "public int[] nextGreaterElement2(int[] nums1, int[] nums2) {\n int[] res = new int[nums1.length];\n if (nums1 == null || nums2 == null \n || nums1.length == 0 || nums2.length == 0) {\n return res;\n }\n Map<Integer, Integer> cache = new HashMap<>();\n Deque<Integer> stack = new LinkedList<>();\n int n = nums2.length;\n for (int num : nums2) {\n while (!stack.isEmpty() && stack.peekFirst() < num) {\n cache.put(stack.pollFirst(), num);\n }\n stack.offerFirst(num);\n }\n \n n = nums1.length;\n for (int i = 0; i < n; ++i) {\n res[i] = cache.getOrDefault(nums1[i], -1);\n }\n return res;\n }", "public void merge(int[] nums1, int m, int[] nums2, int n) {\n int p1 = m-1;\n\tint p2 = n-1;\n\tint p = m+n-1;\n\n\twhile(p >= 0){\n\t\tint v1 = p1 >= 0 ? nums1[p1] : Integer.MIN_VALUE;\n\t\tint v2 = p2 >= 0 ? nums2[p2] : Integer.MIN_VALUE;\n\n\t\tif(v1 >= v2){\n\t\t\tnums1[p] = v1;\n\t\t\tp1--;\n\t\t}else{\n\t\t\tnums1[p] = v2;\n\t\t\tp2--;\n\t\t}\n\t\tp--;\n\t}\n }", "public static int[] merge_v1(int[] arr1, int[] arr2) {\n\n\t\t// checking if the arrays are null\n\t\tif ((arr1 == null || arr1.length == 0) && (arr2 == null || arr2.length == 0)) {\n\t\t\treturn null;\n\t\t} else if (arr1 == null || arr1.length == 0) {\n\t\t\treturn arr2;\n\t\t} else if (arr2 == null || arr2.length == 0) {\n\t\t\treturn arr1;\n\t\t}\n\n\t\tint[] result = new int[arr1.length + arr2.length];\n\t\tboolean[] isUsed = new boolean[arr1.length + arr2.length];\n\t\tArrays.fill(isUsed, false);\n\n\t\tint index = -1;\n\t\tboolean check;\n\t\tfor (int i = 0; i < result.length; i++) {\n\t\t\tresult[i] = Integer.MIN_VALUE;\n\t\t\tcheck = false;\n\n\t\t\tfor (int j = 0; j < arr1.length; j++) {\n\t\t\t\t// if the current int is greater than lowest and is not used\n\t\t\t\tif ((check == false && isUsed[j] == false) || (result[i] > arr1[j] && isUsed[j] == false)) {\n\t\t\t\t\tresult[i] = arr1[j];\n\t\t\t\t\tindex = j;\n\t\t\t\t\tcheck = true;\n\t\t\t\t\t// isUsed[j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int j = 0; j < arr2.length; j++) {\n\t\t\t\t// if the current int is greater than lowest and is not used\n\t\t\t\tif ((check == false && isUsed[j + arr1.length] == false)\n\t\t\t\t\t\t|| (result[i] > arr2[j] && isUsed[j + arr1.length] == false)) {\n\t\t\t\t\tresult[i] = arr2[j];\n\t\t\t\t\tindex = j + arr1.length;\n\t\t\t\t\tcheck = true;\n\t\t\t\t\t// isUsed[j + + arr1.length] = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tisUsed[index] = true;\n\t\t}\n\n\t\treturn result;\n\t}", "private int fibonacci(int n, int acc1, int acc2) {\n\t\tif (n < 2) {\n\t\t\treturn n == 0 ? 0 : acc1;\n\t\t}\n\t\treturn fibonacci(n - 1, acc2, acc1 + acc2);// time complexity: O(n)\n\t}", "public static int findCommon4(int[] in1, int[] in2) {\r\n\t\tint common = 0;\r\n\t\t//mlogn\r\n\t\tArrays.sort(in1);\r\n\t\t//nlogn\r\n\t\tArrays.sort(in2);\r\n\t\t//m+n-1 (as one element will remain uncompared in the end)\r\n\t\tint i=0,j=0;\r\n\t\twhile (i < in1.length && j < in2.length) {\r\n\t\t\tif (in1[i] == in2[j]) {\r\n\t\t\t\t++common;\r\n\t\t\t\t++i;\r\n\t\t\t\t++j;\r\n\t\t\t} else if (in1[i] < in2[j]) {\r\n\t\t\t\t++i;\r\n\t\t\t} else {\r\n\t\t\t\t++j;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn common;\r\n\t}", "private static void findDuplicatesByNegation(int[] arr2) {\n\t\t\n\t\tfor ( int i =0 ; i<arr2.length ; i++)\n\t\t{\n\t\t\t\n\t\t\tif(arr2[Math.abs(arr2[i])] < 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(\" Duplicates exist by Negation \" + arr2[i]);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tarr2[arr2[i]] = -arr2[arr2[i]];\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}", "public int get_odd_occurences_optimal_v2(int[] a) {\n\t\tint result = 0;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tresult ^= i;\n\t\t}\n\t\treturn result;\n\t}", "public static void findIntersection(int[] ip1, int[] ip2) {\n int[] smaller, bigger;\n if (ip1.length <= ip2.length) {\n smaller = ip1;\n bigger = ip2;\n } else {\n smaller = ip2;\n bigger = ip1;\n }\n\n\n //O(n)\n for (int i = 0; i < smaller.length; ) {\n for (int j = 0; j < bigger.length; ) {\n\n if (smaller[i] == bigger[j]) {\n System.out.print(smaller[i]+\" \");\n i++;\n j++;\n } else if (smaller[i] < bigger[j]) {\n i++;\n } else {\n j++;\n }\n\n\n }\n }\n\n\n }", "private static int[] countInversion(int[] left, int[] right)\n {\n int i = 0, j = 0, k = 0, leftLen = left.length, rightLen = right.length;\n int l = leftLen + rightLen;\n int[] merged = new int[l];\n do\n {\n if(left[i] <= right[j])\n merged[k++] = left[i++];\n else\n {\n splitCount += (leftLen - i);\n merged[k++] = right[j++];\n }\n\n } while (i < leftLen && j < rightLen);\n\n //copy remaining\n if(i < leftLen)\n for(; i < leftLen; i++)\n merged[k++] = left[i];\n\n else if(j < rightLen)\n for(; j < rightLen; j++)\n merged[k++] = right[j];\n\n return merged;\n }", "public int fib_solution2(int N) {\n if (N <= 1) {\n return N;\n }\n int[] cache = new int[N + 1];\n cache[1] = 1;\n\n for (int i = 2; i <= N; i++) {\n cache[i] = cache[i-1] + cache[i-2];\n }\n return cache[N];\n }", "private int getCondensedIndex(int n, int i, int j) {\n if (i < j) {\n return n * i - (i * (i + 1) / 2) + (j - i - 1);\n }\n else if (i > j) {\n return n * j - (j * (j + 1) / 2) + (i - j - 1);\n }\n else{\n return 0;\n }\n }", "public int DeleteOperationforTwoStrings(String word1, String word2)\n\t{\n\t\tint n1 = word1.length();\n int n2 = word2.length();\n int[][] dp = new int[n1 + 1][n2 + 1];\n for(int i = 1; i <= n1; i ++)\n {\n for(int j = 1; j <= n2; j ++)\n {\n dp[i][j] = word1.charAt(i - 1) == word2.charAt(j - 1) ? \n dp[i - 1][j - 1] + 1 : Math.max(dp[i - 1][j], dp[i][j - 1]);\n }\n }\n return n1 + n2 - 2 * dp[n1][n2];\n\t}", "public void merge(int[] nums1, int m, int[] nums2, int n) {\n int p=m+n-1;\n int l=m-1;\n int r=n-1;\n while((r>=0)&&(l>=0)){\n if(nums1[l]>=nums2[r]){\n nums1[p]=nums1[l];\n l--;\n p--;\n }else{\n nums1[p]=nums2[r];\n r--;\n p--;\n }\n }\n if(r<0){\n while(l>=0){\n nums1[p]=nums1[l];\n l--;\n p--;\n }\n }\n if(l<0){\n while(r>=0){\n nums1[p]=nums2[r];\n r--;\n p--;\n }\n \n }\n \n }", "public int solution2(int N) {\n\n int l = 0; // 2*l - r\n int r = 1; // 2*r - l\n\n return search2(l, r, N);\n }", "private void resize()\n {\n int [] result = new int[3];\n\n n *= 2; // resizing\n\n // Find first hash function;\n result = findHashValues(n);\n\n // if a hash function cannot be found with the current n, increase n by 1 until one can be found;\n while(result[2] == 0)\n {\n n += 1;\n result = findHashValues(n);\n }\n\n a1 = result[0];\n b1 = result[1];\n\n // Find second hash function\n if(a1 + 1 < n)\n result = findHashValues(a1 + 1, 0, n); // Ensure a different hash function is found\n else\n result = findHashValues(a1, b1 + 1, n);\n // Assume that another hash function can be found with the same n\n\n a2 = result[0];\n b2 = result[1];\n\n int [] temp1 = array1.clone();\n int [] temp2 = array2.clone();\n\n array1 = new int[n];\n array2 = new int[n];\n\n for(int elem : temp1)\n insert(elem);\n for(int elem : temp2)\n insert(elem);\n\n }", "static long arrayManipulation(int n, int[][] queries) {\r\n long result = 0, sum = 0;\r\n long[] arr = new long[n];\r\n for(int i = 0; i < queries.length; i++){\r\n int firstIndex = queries[i][0] - 1;\r\n int lastIndex = queries[i][1] - 1;\r\n long numberToAdd = queries[i][2];\r\n arr[firstIndex] += numberToAdd;\r\n if (lastIndex+1 < n)\r\n arr[lastIndex+1] -= numberToAdd;\r\n }\r\n\r\n for(long l : arr){\r\n sum += l;\r\n if(sum > result)\r\n result = sum;\r\n }\r\n\r\n return result;\r\n }", "public static int[] twoNumbersAddToN(int[] arr, int n){\n\n int[] result = new int[2];\n int pointerA = 0, pointerB = 0;\n\n while(pointerB < arr.length && pointerA < arr.length){\n if(arr[pointerA] + arr[pointerB] == n && pointerA != pointerB){\n break;\n }\n if(pointerB == arr.length-1){\n pointerA++;\n pointerB = pointerA;\n }else {\n pointerB++;\n }\n }\n\n if(arr[pointerA] + arr[pointerB] != n){\n return result;\n }\n\n result[0] = arr[pointerA];\n result[1] = arr[pointerB];\n\n return result;\n }", "public static double findMedianSortedArraysBinary(int[] nums1, int[] nums2) {\n int m = nums1.length;\n int n = nums2.length;\n if (n == 0) {\n return getMedian(nums1);\n }\n if (m == 0) {\n return getMedian(nums2);\n }\n if (m > n) {\n // Make sure the first array is the shorter one\n return findMedianSortedArraysBinary(nums2, nums1);\n }\n // Init the start curser with the first and the last point of the shorter array\n int start = 0;\n int end = m;\n\n // Loop until start and end met\n while (start <= end) {\n // The `nums1` index will be the center between `start` and `end`\n int i = (start + end) / 2;\n // The `nums2` index will be the complement of `i` from the total length\n // m+n+1(the amount of gaps)\n int j = (m + n + 1) / 2 - i;\n if (j > 0 && i < m && nums1[i] < nums2[j - 1]) {\n // If the left max of `nums2` is still larger than right min of `nums1`\n // we move start curser to the right position of the middle\n start = i + 1;\n\n } else if (i > 0 && j < n && nums2[j] < nums1[i - 1]) {\n // If the left max of `nums1` is still larger than right min of `nums2`\n // we move end curser to the left position of the middle\n end = i - 1;\n } else {\n // find the max value of left\n int maxLeft = 0;\n if (i == 0) {\n // if i-1 out of index\n maxLeft = nums2[j - 1];\n } else if (j == 0) {\n // if j-1 out of index\n maxLeft = nums1[i - 1];\n } else {\n maxLeft = Math.max(nums1[i - 1], nums2[j - 1]);\n }\n if ((m + n) % 2 == 1) {\n // If total length is odd\n // The max value of left is the median\n return maxLeft;\n }\n // find the min value of right\n int minRight = 0;\n if (i == m) {\n // If i out of index\n minRight = nums2[j];\n } else if (j == n) {\n // If j out of index\n minRight = nums1[i];\n } else {\n minRight = Math.min(nums1[i], nums2[j]);\n }\n // If total length is even\n return (maxLeft + minRight) / 2.0;\n }\n }\n // If no answer found, we give the answer of 0.0\n return 0.0;\n }", "public static void main(String[] args) {\n\n pairsSum();\n\n printAllSubArrays();\n\n tripletZero();\n\n // int[][] sub = subsets();\n\n PairsSum sum = new PairsSum();\n int[] arr = { 10, 1, 2, 3, 4, 5, 6, 1 };\n boolean flag = sum.almostIncreasingSequence(arr);\n System.out.println(flag);\n\n String s = \"\";\n for (int i = 0; i < 100000; i++) {\n // s += \"CodefightsIsAwesome\";\n }\n long start = System.currentTimeMillis();\n // int k = subStr(s, \"IsA\");\n System.out.println(System.currentTimeMillis() - start);\n // System.out.println(k);\n\n String[] a = { \"aba\", \"aa\", \"ad\", \"vcd\", \"aba\" };\n String[] b = sum.allLongestStrings(a);\n System.out.println(Arrays.deepToString(b));\n\n List<String> al = new ArrayList<>();\n al.toArray();\n\n Map<Integer, Integer> map = new HashMap<>();\n Set<Integer> keySet = map.keySet();\n for (Integer integer : keySet) {\n\n }\n\n String st = reverseBracksStack(\"a(bc(de)f)g\");\n System.out.println(st);\n\n int[] A = { 1, 2, 3, 2, 2, 3, 3, 33 };\n int[] B = { 1, 2, 2, 2, 2, 3, 2, 33 };\n\n System.out.println(sum.isIPv4Address(\"2.2.34\"));\n\n Integer[] AR = { 5, 3, 6, 7, 9 };\n int h = sum.avoidObstacles(AR);\n System.out.println(h);\n\n int[][] image = { { 36, 0, 18, 9 }, { 27, 54, 9, 0 }, { 81, 63, 72, 45 } };\n int[][] im = { { 7, 4, 0, 1 }, { 5, 6, 2, 2 }, { 6, 10, 7, 8 }, { 1, 4, 2, 0 } };\n int[][] res = sum.boxBlur(im);\n\n for (int i = 0; i < res.length; i++) {\n for (int j = 0; j < res[0].length; j++) {\n System.out.print(res[i][j] + \" \");\n }\n System.out.println();\n }\n\n boolean[][] ms = { { true, false, false, true }, { false, false, true, false }, { true, true, false, true } };\n int[][] mines = sum.minesweeper(ms);\n for (int i = 0; i < mines.length; i++) {\n for (int j = 0; j < mines[0].length; j++) {\n System.out.print(mines[i][j] + \" \");\n }\n System.out.println();\n }\n\n System.out.println(sum.variableName(\"var_1__Int\"));\n\n System.out.println(sum.chessBoard());\n\n System.out.println(sum.depositProfit(100, 20, 170));\n\n String[] inputArray = { \"abc\", \"abx\", \"axx\", \"abx\", \"abc\" };\n System.out.println(sum.stringsRearrangement(inputArray));\n\n int[][] queens = { { 1, 1 }, { 3, 2 } };\n int[][] queries = { { 1, 1 }, { 0, 3 }, { 0, 4 }, { 3, 4 }, { 2, 0 }, { 4, 3 }, { 4, 0 } };\n boolean[] r = sum.queensUnderAttack(5, queens, queries);\n\n }", "public void sum(int n) {\n int sum = 0;\n for (int j = 0; j < n; j++) // 2n+2\n sum += j;\n for (int k = 0; k < n; k++) // 2n+2\n sum += k;\n for (int l = 0; l < n; l++) //2n+2\n sum += l;\n }", "public static void main(String[] args) {\n int l1=1000, l2=1000;\n int[] a1=new int[l1];\n int[] a2=new int[l2];\n int[] combine = new int[l1+l2];\n\n Random r = new Random();\n for (int i=0; i<a1.length; ++i){\n a1[i]=r.nextInt(a1.length*3);\n combine[i]=a1[i];\n }\n\n for (int i=0; i<a2.length; ++i){\n a2[i]=r.nextInt(a2.length*3);\n combine[l1+i]=a2[i];\n }\n\n Arrays.sort(a1);\n Arrays.sort(a2);\n Arrays.sort(combine);\n\n cnt=0;\n int m = findByRank(a1, 0, a1.length, a2, 0, a2.length, (a1.length+a2.length)/2);\n int m2 = combine[combine.length/2-1];\n\n System.out.printf(\"m=%d, m2=%d, cnt=%d\", m, m2, cnt);\n\n\n\n }", "public int sget2(int n) {\n\t\tint res = get(n);\n\t\tint top = 1 << (n - 1);\n\t\tif ((res & top) != 0) {\n\t\t\tint mask = top - 1;\n\t\t\tif ((res & mask) == 0) {\n\t\t\t\tint res2 = sget2(n);\n\t\t\t\tres = (~mask | res) + 1 + res2;\n\t\t\t} else {\n\t\t\t\tres = ~mask | res;\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}", "private int[] optimum(int x1, int y1, int x2, int y2) {\n if (lookupNodes[x1][y1][x2][y2] != Integer.MAX_VALUE) {\n return new int[]{lookupNodes[x1][y1][x2][y2], lookupDepth[x1][y1][x2][y2]};\n }\n if (hasOneColor(x1, y1, x2, y2)) {\n lookupNodes[x1][y1][x2][y2] = 1;\n lookupDepth[x1][y1][x2][y2] = 0;\n return new int[]{1, 0};\n }\n int nodes;\n int depth;\n for (int X = x1; X < x2; X++) {\n nodes = optimum(x1, y1, X, y2)[0] + optimum(X+1, y1, x2, y2)[0] + 1;\n depth = Math.max(optimum(x1, y1, X, y2)[1], optimum(X+1, y1, x2, y2)[1]) + 1;\n updateLookupNodes(nodes, x1, y1, x2, y2);\n updateLookupDepth(depth, x1, y1, x2, y2);\n }\n for (int Y = y1; Y < y2; Y++) {\n nodes = optimum(x1, y1, x2, Y)[0] + optimum(x1, Y+1, x2, y2)[0] + 1;\n depth = Math.max(optimum(x1, y1, x2, Y)[1], optimum(x1, Y+1, x2, y2)[1]) + 1;\n updateLookupNodes(nodes, x1, y1, x2, y2);\n updateLookupDepth(depth, x1, y1, x2, y2);\n }\n return new int[]{lookupNodes[x1][y1][x2][y2], lookupDepth[x1][y1][x2][y2]};\n }", "static int[] OnepassSol1(int[]a, int n){\r\n Map<Integer, Integer> map = new HashMap<>();\r\n for (int i = 0; i < a.length; i++) {\r\n int complement = n - a[i];\r\n if (map.containsKey(complement)) {\r\n return new int[] { map.get(complement), i };\r\n }\r\n map.put(a[i], i);\r\n }\r\n int[] ans = {-1,-1};\r\n return ans;\r\n }", "public int findLength(int[] nums1, int[] nums2) {\n if (nums1 == null || nums2 == null || nums1.length == 0 || nums2.length == 0) return 0;\n if (nums1.length < nums2.length) return findLength(nums2, nums1);\n \n int res = 0, n = nums1.length, m = nums2.length;\n int[] prev = new int[m], cur = new int[m];\n \n for (int i = 0; i < m; i++)\n if (nums1[0] == nums2[i]) prev[i] = 1;\n \n for (int i = 1; i < n; i++) {\n for (int j = 0; j < m; j++) {\n int toAdd = j == 0 ? 0 : prev[j - 1], val = nums1[i] == nums2[j] ? 1 + toAdd : 0;\n cur[j] = val;\n res = Math.max(cur[j], res);\n }\n \n prev = cur;\n cur = new int[m];\n }\n \n return res;\n }", "public static int solutionN2(int[] A) {\n\n\t\tclass Pair {\n\t\t\tpublic int start;\n\t\t\tpublic int end;\n\n\t\t\tpublic Pair(int start, int end) {\n\t\t\t\tthis.start = start;\n\t\t\t\tthis.end = end;\n\t\t\t}\n\t\t}\n\n\t\tPair[] pairs = new Pair[A.length];\n\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tpairs[i] = new Pair(i - A[i], i + A[i]);\n\t\t}\n\n\t\tArrays.sort(pairs, new Comparator<Pair>() {\n\t\t\t@Override\n\t\t\tpublic int compare(Pair o1, Pair o2) {\n\t\t\t\treturn o1.start - o2.start;\n\t\t\t}\n\t\t});\n\n\t\tint countIntersection = 0;\n\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tPair current = pairs[i];\n\n\t\t\tfor (int j = i + 1; j < A.length; j++) {\n\t\t\t\tPair p = pairs[j];\n\t\t\t\tif (current.end >= p.start) {\n\t\t\t\t\tcountIntersection++;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif (countIntersection > 10000000)\n\t\t\treturn -1;\n\n\t\treturn countIntersection;\n\t}", "public int[] intersect(int[] nums1, int[] nums2) {\n if(nums2.length > nums1.length) return intersect(nums2,nums1);\n\n\n Map<Integer,Integer> hash = new HashMap<>();\n\n\n for(int j=0; j<nums1.length;j++){\n\n if(hash.containsKey(nums1[j])) hash.put(nums1[j], hash.get(nums1[j]) + 1);\n else hash.put(nums1[j], 1);\n\n }\n\n List<Integer> intersection = new ArrayList<>();\n\n for(int k=0;k<nums2.length;k++){\n\n int count = hash.getOrDefault(nums2[k],0);\n\n if(count > 0){\n intersection.add(nums2[k]);\n hash.put(nums2[k], hash.get(nums2[k]) - 1);\n }\n }\n\n\n int[] result = new int[intersection.size()];\n int count = 0;\n\n for(Integer i:intersection){\n result[count] = i;\n count++;\n }\n\n\n return result;\n\n\n }", "public static void getLeastNumbers_2(int[] input, int[] output) {\n int start = 0;\n int end = input.length - 1;\n int k = output.length;\n int index = partition(input, start, end);\n while(index != k - 1) {\n if(index > k - 1) {\n end = index - 1;\n index = partition(input, start, end);\n }\n else {\n start = index + 1;\n index = partition(input, start, end);\n }\n }\n \n for(int i = 0; i < k; ++i)\n output[i] = input[i];\n }", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "public static double findMedianSortedArrays(int[] nums1, int[] nums2) {\r\n boolean isOdd = true;\r\n double result=0;\r\n int middle = 0;\r\n \r\n int nums1Len = nums1.length;\r\n int nums2Len = nums2.length;\r\n int fullLen = nums1Len + nums2Len;\r\n \r\n int nums1Cnt = 0;\r\n int nums2Cnt = 0;\r\n \r\n boolean nums1Cut = false;\r\n boolean nums2Cut = false;\r\n \r\n HashMap<Integer, Integer> hm = new HashMap<> ();\r\n \r\n if(fullLen % 2 == 0) {\r\n isOdd = false;\r\n }\r\n \r\n middle = fullLen / 2;\r\n \r\n if(fullLen != 1){\r\n for(int i =0; i <= middle; i++) {\r\n if(nums1Cnt == nums1Len) {\r\n hm.put(i, nums2[nums2Cnt]);\r\n nums2Cnt++;\r\n }else if(nums2Cnt == nums2Len) {\r\n hm.put(i, nums1[nums1Cnt]);\r\n nums1Cnt++;\r\n }else if(nums1[nums1Cnt] > nums2[nums2Cnt]) {\r\n hm.put(i, nums2[nums2Cnt]);\r\n nums2Cnt++;\r\n } else {\r\n hm.put(i, nums1[nums1Cnt]);\r\n nums1Cnt++;\r\n }\r\n }\r\n }\r\n \r\n if(fullLen == 1) {\r\n if(nums1Len > nums2Len) {\r\n result = nums1[0];\r\n } else {\r\n result = nums2[0];\r\n }\r\n } else if(isOdd) {\r\n result = hm.get(middle);\r\n } else {\r\n result = (hm.get(middle) + hm.get(middle-1)) / 2.0;\r\n }\r\n return result;\r\n }", "private static void get4ElementsSumCountFastest(String inputLine, int target) {\n String[] arr = inputLine.split(\" \");\n if (arr.length < 3) {\n System.out.println(0);\n return;\n }\n\n Map<Integer, Set<String>> pairSumMap = new HashMap<>();\n List<Integer> list = new ArrayList<>(arr.length);\n for (String s : arr) {\n list.add(Integer.parseInt(s.trim()));\n }\n\n int sum = 0, diff = 0;\n for (int i = 0; i < arr.length; i++) {\n for (int j = i + 1; j < arr.length; j++) {\n sum = list.get(i) + list.get(j);\n if (sum < target) {\n pairSumMap.putIfAbsent(sum, new HashSet<>());\n pairSumMap.get(sum).add(i + \"-\" + j);\n }\n }\n }\n\n for (Map.Entry<Integer, Set<String>> mk : pairSumMap.entrySet()) {\n diff = target - mk.getKey();\n if (pairSumMap.containsKey(diff)) {\n Set<String> indexesList = mk.getValue();\n for (String index : indexesList) {\n int indexOrgX = Integer.parseInt(index.split(\"-\")[0]);\n int indexOrgY = Integer.parseInt(index.split(\"-\")[1]);\n for (String newIdx : pairSumMap.get(diff)) {\n int indexNewX = Integer.parseInt(newIdx.split(\"-\")[0]);\n int indexNewY = Integer.parseInt(newIdx.split(\"-\")[1]);\n if (indexOrgX != indexNewX && indexOrgX != indexNewY && indexOrgY != indexNewX && indexOrgY != indexNewY) {\n System.out.println(1);\n return;\n }\n }\n }\n }\n }\n System.out.println(0);\n }", "public static ArrayList<ArrayList<Integer>> fourSum(ArrayList<Integer> a, int k) {\n Collections.sort(a);\n System.out.println(a);\n LinkedHashMap<Integer, List<List<Integer>>> m = new LinkedHashMap<Integer, List<List<Integer>>>();\n for (int i = 0; i <= a.size() - 3; i++) {\n for (int j = i + 1; j <= a.size() - 2; j++) {\n if (m.get(a.get(i) + a.get(j)) == null) {\n ArrayList<List<Integer>> v = new ArrayList<List<Integer>>();\n List<Integer> c = new ArrayList<Integer>();\n c.add(i);\n c.add(j);\n v.add(c);\n m.put(a.get(i) + a.get(j), v);\n } else {\n List<List<Integer>> v = m.get(a.get(i) + a.get(j));\n List<Integer> c = new ArrayList<Integer>();\n c.add(i);\n c.add(j);\n v.add(c);\n m.put(a.get(i) + a.get(j), v);\n }\n\n }\n }\n LinkedHashSet<ArrayList<Integer>> res = new LinkedHashSet<ArrayList<Integer>>();\n for (int i = 2; i <= a.size() - 1; i++) {\n for (int j = i + 1; j < a.size(); j++) {\n List<List<Integer>> v = m.get(k - (a.get(i) + a.get(j)));\n if (v != null && v.size() >= 1) {\n for (List<Integer> l : v) {\n\n if (l.get(0) < l.get(1) && l.get(1) < i && l.get(1) < j) {\n //System.out.println(l.get(0) + \" \" + l.get(1) + \" \" + i + \" \" + j);\n ArrayList<Integer> out = new ArrayList<Integer>();\n out.add(a.get(l.get(0)));\n out.add(a.get(l.get(1)));\n out.add(a.get(i));\n out.add(a.get(j));\n Collections.sort(out);\n //System.out.println(out);\n res.add(out);\n }\n }\n }\n }\n }\n return new ArrayList<ArrayList<Integer>>(res);\n }", "public static void main(String args[] ) throws Exception {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] seqArray = new int[n];\n for (int i = 0; i < n; i++) {\n seqArray[i] = scanner.nextInt();\n }\n // getSeqValue(seqArray); //this method is an accepted one on Hackerrank but time complexity is not order n; i.e. !O(n);\n getLinearOrderY(seqArray); // trying to get O(n) time complexity;\n }", "private static boolean kthSmallesElementFound(int[] list1, int[] list2, int nElementsList1, int nElementsList2) {\n if(nElementsList2 < 1) {\n return true;\n }\n\n if(list1[nElementsList1-1] == list2[nElementsList2-1]) {\n return true;\n }\n\n if(nElementsList1 == list1.length) {\n return list1[nElementsList1-1] <= list2[nElementsList2];\n }\n\n if(nElementsList2 == list2.length) {\n return list2[nElementsList2-1] <= list1[nElementsList1];\n }\n\n return list1[nElementsList1-1] <= list2[nElementsList2] && list2[nElementsList2-1] <= list1[nElementsList1];\n }", "static int countCollinearFast(int[] a1, int[] a2, int[] a3)\n {\n //TODO: implement this method\n \tsort(a3);\n \tint count = 0;\n \tint search;\n \t\n \tfor (int i=0; i<a1.length; i++)\n \t\tfor (int j=0; j<a2.length; j++)\n \t\t{\n \t\t\tsearch = 2*a2[j] - a1[i];\n \t\t\tif (binarySearch(a3, search))\n \t\t\t\tcount++;\n \t\t}\n \t\n \treturn count;\n }", "public static List<Integer> solution2(int n) {\n List<Integer> rs=new ArrayList<Integer>();\n rs.add(0);\n for(int i=0;i<n;i++){\n int size=rs.size();\n for(int k=size-1;k>=0;k--)\n rs.add(rs.get(k) | 1<<i);\n }\n return rs;\n }", "public static boolean addUpToFast(int[] array, int n){\n\t\tHashSet<Integer> hs = new HashSet<Integer>();\n\t\tfor(int i = 0; i < array.length; i++){\n\t\t\tif(hs.contains(n-array[i]))\n\t\t\t\treturn true;\n\t\t\ths.add(array[i]);\n\t\t}\n\t\treturn false;\n\t}", "private int hammingDistance(int[] i, int[] i2) {\n\t\tint dist = 0;\n\t\tfor(int j = 0 ; j < i.length ; j++)\n\t\t\tdist += i[j] ^ i2[j]; // X-OR\n\t\treturn dist;\n\t}", "public static void main(String[] args){\n int MIN = Integer.parseInt(args[0]);\n MAX = Integer.parseInt(args[1]);\n cutoffs = new int[args.length - 2];\n cache = new ArrayList<IndexedArrayList<SuperSavvyTrieHelper2>>();\n for (int i = 2; i < args.length; i++){\n cutoffs[i - 2] = Integer.parseInt(args[i]);\n cache.add(new IndexedArrayList<SuperSavvyTrieHelper2>());\n }\n for (int i = 0; i < cutoffs.length / 2; i++){\n int temp = cutoffs[i];\n cutoffs[i] = cutoffs[cutoffs.length - 1 - i];\n cutoffs[cutoffs.length - 1 - i] = temp;\n }\n multiplicitiesUsed = new boolean[MAX + 1];\n basesUsed = new DoublyLinkedArray(MAX + 1);\n SuperSavvyTrieHelper2.setCorrespondance(basesUsed);\n /*\n long count1 = lowerRecursion(MAX, 0);\n long count2 = middleRecursion(MAX, 0);\n long count3 = upperRecursion(MAX, 0);\n long total = count1 + count2 + count3;\n System.out.printf(\"%d + %d + %d = %d\\n\", count1, count2, count3, total);\n */\n hitCounts = new long[cutoffs.length];\n missCounts = new long[cutoffs.length];\n statCollector = new StatCollector(cutoffs);\n\n long startTime = System.nanoTime();\n long[] values = new long[MAX - MIN + 1];\n for (int i = MIN; i <= MAX; i++) {\n values[i - MIN] = upperRecursionWrapper(i);\n }\n //long[] testValues = new long[] {1752443,1911046, 2067456,2249444,2429337, 2647532,2852449,3101167,3350292,3632299,3916575};\n for (int i = 0; i < values.length; i++){\n //if (testValues[i] != values[i]){\n System.out.printf(\"%d: %d\\n\", i + MIN, values[i]);\n //}\n }\n long endTime = System.nanoTime();\n System.out.printf(\"%f,\", (double)(endTime - startTime) / 1000000000.0);\n long totalMissCounts = 0;\n long totalMissWeight1 = 0;\n long totalMissWeight2 = 0;\n long totalMissWeight3 = 0;\n /*\n for (int i = 0; i < cutoffs.length; i++){\n long totalCounts = hitCounts[i] + missCounts[i];\n totalMissCounts += missCounts[i];\n totalMissWeight1 += missCounts[i] * cutoffs[i];\n totalMissWeight2 += (hitCounts[i] / missCounts[i]) * cutoffs[i];\n totalMissWeight3 += (hitCounts[i] - missCounts[i]) * cutoffs[i] * cutoffs[i];\n System.out.printf(\"\\tCache %d: %d/%d/%d (%.5f%%)\", cutoffs[i], hitCounts[i], missCounts[i], totalCounts, (double) hitCounts[i] / totalCounts);\n }\n System.out.printf(\"\\t\\tMissCounts: %d, weighted: %d, ratio: %d, diff^2: %d\\n\", totalMissCounts, totalMissWeight1, totalMissWeight2, totalMissWeight3);\n */\n statCollector.printAll();\n }", "public int removeDuplicatesMethod2(int[] nums) {\n \tint len = 0;\n \tfor(int num : nums) {\n \t\tif(len < 2 || num > nums[len - 2]) {\n \t\t\tnums[len++] = num;\n \t\t}\n \t}\n \treturn len;\n }", "public int[] twoSum(int[] numbers, int target) {\n HashMap<Integer,Integer> map = new HashMap<>();\n\n for(int i = 0; i < numbers.length; i++){\n if(map.get(numbers[i]) != null){\n int[] res = {map.get(numbers[i]),i};\n return res;\n }\n map.put(target-numbers[i],i);\n }\n\n int[] res={};\n return res;\n}", "public boolean containsNearbyDuplicate2(int[] nums, int k) {\n\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < nums.length; i++) {\n max=Math.max(max,nums[i]);\n }\n Integer[] map = new Integer[max+1];\n for (int i = 0; i < nums.length; i++) {\n Integer c = map[nums[i]];\n if(c!=null && i-c<=k){\n return true;\n }else {\n map[nums[i]]=i;\n }\n }\n return false;\n }", "public int[] twoSum_1(int[] nums, int target) {\n Map<Integer, Integer> map = new HashMap<>();\n int[] result = new int[2];\n for (int i = 0; i < nums.length; i++) {\n if (map.containsKey(target - nums[i])) {\n result[0] = map.get(target - nums[i]);\n result[1] = i;\n return result;\n } else {\n map.put(nums[i], i);\n }\n }\n return result;\n }", "private static BigInteger findSum(BigInteger start, BigInteger end) {\n return start.add(end).multiply(end.subtract(start).add(new BigInteger(\"1\"))).divide(new BigInteger(\"2\"));\n }", "private int hash2(K key){\r\n return indexFor(hash(key.hashCode2()), capacity);\r\n }", "public static void times (int[] n1, int[] n2, int[] result) {\n\t\tint pos = result.length-1;\n\n\t\t// clear all values....\n\t\tfor (int i = 0; i < result.length; i++) { result[i] = 0; }\n\n\t\tfor (int m = n1.length-1; m>=0; m--) {\n\t\t\tint iPos = pos - (n1.length-1 - m);\n\t\t\tint iPosSubOne = iPos-1;\n\t\t\tif (n1[m] == 0) {\n\t\t\t\tcontinue; // skip zero multiplier! Won't affect total.\n\t\t\t}\n\n\t\t\tfor (int n = n2.length-1; n>=0; n--, iPos--,iPosSubOne--) {\n\t\t\t\tint prod = n1[m]*n2[n];\n\t\t\t\t\n\t\t\t\t// GENERATED-BEGIN\n\t\t\t\tswitch (prod) {\n\t\t\t\tcase 0: break;\n\t\t\t\tcase 1: result[iPos] += 1;break;\n\t\t\t\tcase 2: result[iPos] += 2;break;\n\t\t\t\tcase 3: result[iPos] += 3;break;\n\t\t\t\tcase 4: result[iPos] += 4;break;\n\t\t\t\tcase 5: result[iPos] += 5;break;\n\t\t\t\tcase 6: result[iPos] += 6;break;\n\t\t\t\tcase 7: result[iPos] += 7;break;\n\t\t\t\tcase 8: result[iPos] += 8;break;\n\t\t\t\tcase 9: result[iPos] += 9;break;\n\t\t\t\tcase 10: result[iPosSubOne] += 1;break;\n\t\t\t\tcase 11: result[iPos] += 1;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 12: result[iPos] += 2;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 13: result[iPos] += 3;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 14: result[iPos] += 4;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 15: result[iPos] += 5;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 16: result[iPos] += 6;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 17: result[iPos] += 7;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 18: result[iPos] += 8;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 19: result[iPos] += 9;result[iPosSubOne] += 1;break;\n\t\t\t\tcase 20: result[iPosSubOne] += 2;break;\n\t\t\t\tcase 21: result[iPos] += 1;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 22: result[iPos] += 2;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 23: result[iPos] += 3;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 24: result[iPos] += 4;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 25: result[iPos] += 5;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 26: result[iPos] += 6;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 27: result[iPos] += 7;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 28: result[iPos] += 8;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 29: result[iPos] += 9;result[iPosSubOne] += 2;break;\n\t\t\t\tcase 30: result[iPosSubOne] += 3;break;\n\t\t\t\tcase 31: result[iPos] += 1;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 32: result[iPos] += 2;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 33: result[iPos] += 3;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 34: result[iPos] += 4;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 35: result[iPos] += 5;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 36: result[iPos] += 6;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 37: result[iPos] += 7;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 38: result[iPos] += 8;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 39: result[iPos] += 9;result[iPosSubOne] += 3;break;\n\t\t\t\tcase 40: result[iPosSubOne] += 4;break;\n\t\t\t\tcase 41: result[iPos] += 1;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 42: result[iPos] += 2;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 43: result[iPos] += 3;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 44: result[iPos] += 4;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 45: result[iPos] += 5;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 46: result[iPos] += 6;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 47: result[iPos] += 7;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 48: result[iPos] += 8;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 49: result[iPos] += 9;result[iPosSubOne] += 4;break;\n\t\t\t\tcase 50: result[iPosSubOne] += 5;break;\n\t\t\t\tcase 51: result[iPos] += 1;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 52: result[iPos] += 2;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 53: result[iPos] += 3;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 54: result[iPos] += 4;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 55: result[iPos] += 5;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 56: result[iPos] += 6;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 57: result[iPos] += 7;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 58: result[iPos] += 8;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 59: result[iPos] += 9;result[iPosSubOne] += 5;break;\n\t\t\t\tcase 60: result[iPosSubOne] += 6;break;\n\t\t\t\tcase 61: result[iPos] += 1;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 62: result[iPos] += 2;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 63: result[iPos] += 3;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 64: result[iPos] += 4;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 65: result[iPos] += 5;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 66: result[iPos] += 6;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 67: result[iPos] += 7;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 68: result[iPos] += 8;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 69: result[iPos] += 9;result[iPosSubOne] += 6;break;\n\t\t\t\tcase 70: result[iPosSubOne] += 7;break;\n\t\t\t\tcase 71: result[iPos] += 1;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 72: result[iPos] += 2;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 73: result[iPos] += 3;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 74: result[iPos] += 4;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 75: result[iPos] += 5;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 76: result[iPos] += 6;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 77: result[iPos] += 7;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 78: result[iPos] += 8;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 79: result[iPos] += 9;result[iPosSubOne] += 7;break;\n\t\t\t\tcase 80: result[iPosSubOne] += 8;break;\n\t\t\t\tcase 81: result[iPos] += 1;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 82: result[iPos] += 2;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 83: result[iPos] += 3;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 84: result[iPos] += 4;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 85: result[iPos] += 5;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 86: result[iPos] += 6;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 87: result[iPos] += 7;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 88: result[iPos] += 8;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 89: result[iPos] += 9;result[iPosSubOne] += 8;break;\n\t\t\t\tcase 90: result[iPosSubOne] += 9;break;\n\t\t\t\tcase 91: result[iPos] += 1;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 92: result[iPos] += 2;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 93: result[iPos] += 3;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 94: result[iPos] += 4;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 95: result[iPos] += 5;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 96: result[iPos] += 6;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 97: result[iPos] += 7;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 98: result[iPos] += 8;result[iPosSubOne] += 9;break;\n\t\t\t\tcase 99: result[iPos] += 9;result[iPosSubOne] += 9;break;\n\t\t\t\t};\n\t\t\t\tswitch (result[iPos]) {\n\t\t\t\tcase 0: break; \n\t\t\t\tcase 1: break; \n\t\t\t\tcase 2: break; \n\t\t\t\tcase 3: break; \n\t\t\t\tcase 4: break; \n\t\t\t\tcase 5: break; \n\t\t\t\tcase 6: break; \n\t\t\t\tcase 7: break; \n\t\t\t\tcase 8: break; \n\t\t\t\tcase 9: break; \n\t\t\t\tcase 10: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 11: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 12: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 13: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 14: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 15: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 16: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 17: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 18: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 19: result[iPosSubOne] += 1; result[iPos] -= 10; break; \n\t\t\t\tcase 20: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 21: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 22: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 23: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 24: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 25: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 26: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 27: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 28: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 29: result[iPosSubOne] += 2; result[iPos] -= 20; break; \n\t\t\t\tcase 30: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 31: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 32: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 33: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 34: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 35: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 36: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 37: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 38: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 39: result[iPosSubOne] += 3; result[iPos] -= 30; break; \n\t\t\t\tcase 40: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 41: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 42: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 43: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 44: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 45: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 46: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 47: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 48: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 49: result[iPosSubOne] += 4; result[iPos] -= 40; break; \n\t\t\t\tcase 50: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 51: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 52: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 53: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 54: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 55: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 56: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 57: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 58: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 59: result[iPosSubOne] += 5; result[iPos] -= 50; break; \n\t\t\t\tcase 60: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 61: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 62: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 63: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 64: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 65: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 66: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 67: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 68: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 69: result[iPosSubOne] += 6; result[iPos] -= 60; break; \n\t\t\t\tcase 70: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 71: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 72: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 73: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 74: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 75: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 76: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 77: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 78: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 79: result[iPosSubOne] += 7; result[iPos] -= 70; break; \n\t\t\t\tcase 80: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 81: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 82: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 83: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 84: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 85: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 86: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 87: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 88: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 89: result[iPosSubOne] += 8; result[iPos] -= 80; break; \n\t\t\t\tcase 90: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 91: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 92: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 93: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 94: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 95: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 96: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 97: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 98: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\tcase 99: result[iPosSubOne] += 9; result[iPos] -= 90; break; \n\t\t\t\t};\n\t\t\t\t\n\t\t\t\t// GENERATED-END\n\t\t\t}\n\t\t}\n\t}", "private static int subN(int[] a, int[] b, int len) {\n long sum = 0;\n\n while (--len >= 0) {\n sum = (a[len] & LONG_MASK) -\n (b[len] & LONG_MASK) + (sum >> 32);\n a[len] = (int)sum;\n }\n\n return (int)(sum >> 32);\n }", "public static int method2(int temp[]) {\r\n\r\n\t\tMap<Integer, Integer> map = new HashMap<Integer, Integer>();\r\n\r\n\t\tfor (int i = 0; i < temp.length; i++) {\r\n\t\t\tif (map.containsKey(temp[i])) {\r\n\t\t\t\tmap.put(temp[i], map.get(temp[i]) + 1);\r\n\t\t\t} else {\r\n\t\t\t\tmap.put(temp[i], 1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tIterator<Entry<Integer, Integer>> it = map.entrySet().iterator();\r\n\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tEntry<Integer, Integer> entry = it.next();\r\n\t\t\tint key = entry.getKey();\r\n\t\t\tint count = entry.getValue();\r\n\r\n\t\t\tif ((count % 2) != 0) {\r\n\t\t\t\treturn key;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\treturn -1;\r\n\t}", "static int[] mergeTwoSortedArrays(int a1[],int m,int a2[] ,int n)\r\n {\r\n int arr[]=new int[a1.length+a2.length];\r\n int i=0,j=0,k=0;\r\n while(i<m && j<n)\r\n {\r\n if(a1[i]<a2[j])\r\n {\r\n arr[k]=a1[i];\r\n i++;\r\n k++;\r\n }\r\n else\r\n {\r\n arr[k]=a2[j];\r\n j++;\r\n k++;\r\n }\r\n }\r\n while(i<m)\r\n {\r\n arr[k]=a1[i];\r\n i++;\r\n k++;\r\n }\r\n \r\n\r\n while(j<n)\r\n {\r\n arr[k]=a2[j];\r\n j++;\r\n k++;\r\n }\r\n \r\n System.out.println(i+\" \"+ j);\r\n return arr;\r\n }", "public int[] twoSum2(int[] numbers, int target) {\n HashMap<Integer, Integer> hm = new HashMap<>();\n int[] result = null;\n for (int i = 0; i < numbers.length; i++) {\n if (hm.containsKey(target - numbers[i])) {\n int j = hm.get(target - numbers[i]);\n if (i != j) {\n result = new int[] {j + 1, i + 1};\n return result;\n }\n }\n hm.put(numbers[i], i);\n }\n return result;\n }", "public int getCost(Tile<T> n1, Tile<T> n2);", "public static int[] mergeArrays(int[] a1, int[] a2) {\n if (a1 == null || a1.length == 0) {\n if (a2 == null || a2.length == 0) {\n return new int[0];\n }\n return a2;\n }\n if (a2 == null || a2.length == 0) {\n return a1;\n }\n\n // Теперь работаем с массивами, где есть хотя бы 1 элемент.\n int[] a3 = new int[a1.length + a2.length];\n for (int index1 = 0, index2 = 0, index3 = 0; index3 < a3.length; ) {\n int minValue = a1[index1] < a2[index2] ? a1[index1] : a2[index2];\n // Работаем с первым массивом\n while (index1 < a1.length && minValue == a1[index1]) {\n a3[index3++] = a1[index1++];\n }\n if (index1 == a1.length) {\n // Первый массив закончился, сливаем хвост второго\n while (index2 < a2.length && index3 < a3.length) {\n a3[index3++] = a2[index2++];\n }\n return a3;\n }\n // Работаем со вторым массивом\n while (index2 < a2.length && minValue == a2[index2]) {\n a3[index3++] = a2[index2++];\n }\n if (index2 == a2.length) {\n // Второй массив закончился, сливаем хвост первого массива\n while (index1 < a1.length && index3 < a3.length) {\n a3[index3++] = a1[index1++];\n }\n return a3;\n }\n }\n return a3;\n }", "static long nPolyNTime(int[] n) {\n int temp = n.length;\n long sum = 0;\n if(n == null || n.length == 0) return -1;\n for(int i = 0; i < n.length; ++i) {\n while(temp --> 0) {\n for(int j = 0; j < n.length; ++j) {\n sum += n[i] + n[j];\n }\n }\n }\n return sum;\n }", "static long findSum(int N)\n\t{\n\t\tif(N==0) return 0;\n\t\treturn (long)((N+1)>>1)*((N+1)>>1)+findSum((int)N>>1);\n\t\t\n\t}", "public int[] twoSum3(int[] nums, int target) {\n int[] res = new int[2];\n int n = nums.length;\n Map<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n int key = target - nums[i];\n if (map.containsKey(key) && map.get(key) != i) {\n res[0] = map.get(key);\n res[1] = i;\n return res;\n }\n map.put(nums[i], i);\n }\n return res;\n }" ]
[ "0.706756", "0.64110523", "0.6395304", "0.60193986", "0.59794015", "0.5892131", "0.5755833", "0.56705076", "0.56557506", "0.5622811", "0.5605218", "0.55792505", "0.5576256", "0.553115", "0.5524217", "0.55240536", "0.5473857", "0.54517335", "0.5430535", "0.54290205", "0.54279566", "0.54250646", "0.54135185", "0.5396323", "0.5387647", "0.5386226", "0.5366378", "0.5357736", "0.53571224", "0.53398395", "0.5328934", "0.53253186", "0.5305424", "0.5304883", "0.5302578", "0.52848446", "0.5279028", "0.5275857", "0.5272335", "0.5271456", "0.5270072", "0.5269142", "0.5261536", "0.5257074", "0.5228199", "0.52276796", "0.52262855", "0.5225239", "0.5223077", "0.52054805", "0.520427", "0.5200771", "0.51985973", "0.5188919", "0.51869464", "0.5176191", "0.51759744", "0.5172556", "0.51721525", "0.5155781", "0.51506644", "0.5150185", "0.5148477", "0.5145531", "0.51405704", "0.51386166", "0.5128584", "0.51199275", "0.51187086", "0.5114992", "0.5111874", "0.51115346", "0.51062965", "0.5103352", "0.5091813", "0.50917876", "0.509133", "0.50852364", "0.5082546", "0.50823385", "0.5080246", "0.5072628", "0.50624764", "0.50595677", "0.5059413", "0.50583935", "0.5056888", "0.5052991", "0.50426155", "0.50421494", "0.5022674", "0.50077313", "0.5005557", "0.5004127", "0.5003503", "0.50031763", "0.5001887", "0.49988657", "0.49925333", "0.49897867", "0.49883464" ]
0.0
-1
Iterative choice Time: O(n1+n2) Space: O(1)
public ListNode mergeTwoListsIterative(ListNode l1, ListNode l2) { ListNode dummy=new ListNode(); ListNode curr=dummy; while(l1!=null && l2!=null){ if(l1.val<l2.val){ curr.next=l1; l1=l1.next; curr=curr.next; } else{ curr.next=l2; l2=l2.next; curr=curr.next; } } while(l1!=null){ curr.next=l1; l1=l1.next; curr=curr.next; } while(l2!=null){ curr.next=l2; l2=l2.next; curr=curr.next; } return dummy.next; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static int choose(int n, int k) {\n return factorial(n) / (factorial(k) * factorial(n - k));\n }", "public static BigInteger choose(int n, int k) {\n\n\t\t\t if (k > n) return BI0;\n\t\t\t else if (k == 0 || n == k) return BI1;\n\t\t\t else if (k == 1 || k == n-1) return BigInteger.valueOf(n);\n\n\t\t\t List<Integer> nk = Arrays.asList(n, k);\n\t\t\t if (!choose_cache.containsKey(nk)) {\n\t\t\t BigInteger ntok = BI1;\n\t\t\t BigInteger ktok = BI1;\n\t\t\t int min = k;\n\t\t\t if ((n - k) < k) min = n - k;\n\t\t\t for (int i=1; i <= min; i++) {\n\t\t\t ntok = ntok.multiply(BigInteger.valueOf(n));\n\t\t\t ktok = ktok.multiply(BigInteger.valueOf(i));\n\t\t\t n -= 1;\n\t\t\t }\n\n\t\t\t choose_cache.put(nk, ntok.divide(ktok));\n\t\t\t }\n\t\t\t return choose_cache.get(nk);\n\t\t\t }", "private static int betterSolution(int n) {\n return n*n*n;\n }", "@Test\n public void badChoicePunisher() {\n Edge[] edgelist = {new Edge(new int[] {1, 7}), new Edge(new int[] {1, 8}),\n new Edge(new int[] {7, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5})};\n timeMethod(edgelist, 8, 2);\n\n\n Edge[] edgelist1 = {new Edge(new int[] {1, 6}), new Edge(new int[] {1, 7}),\n new Edge(new int[] {6, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5})};\n timeMethod(edgelist1, 7, 1);\n\n Edge[] edgelist2 = {new Edge(new int[] {1, 6}), new Edge(new int[] {1, 7}),\n new Edge(new int[] {6, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5}), new Edge(new int[] {2, 8})};\n timeMethod(edgelist2, 8, 2);\n\n Edge[] edgelist3 = {new Edge(new int[] {1, 6}), new Edge(new int[] {1, 7}),\n new Edge(new int[] {6, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5})};\n timeMethod(edgelist3, 7, 1);\n }", "public static int f2(int N) { \n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n)\n // O(n)`\n for(int j = 0; j < i; j++) \n x++;\n return x;\n }", "public static int bestApproach(int n) {\n \n if(n<=2){\n return n;\n }\n int a = 0;\n int b = 1;\n int c = 2;\n \n while(n-->2){\n a = b+c;\n b = c;\n c = a;\n }\n return a;\n }", "public void findSubSeqWithGivenSum(int[] a, int n, int k, List<Integer> chosen) {\n\t\t// base case\n\t\t// Remaining sum == 0\n\t\tif (k == 0) {\n\t\t\tSystem.out.println(\"Combination found : \" + chosen);\n\t\t\treturn;\n\t\t}\n\n\t\t// if remaining elements == 0\n\t\tif (n == -1) {\n\t\t\tSystem.out.println(\"Hitting end\");\n\t\t\treturn;\n\t\t}\n\n\t\tList<Integer> withCurrent = new ArrayList<>();\n\t\twithCurrent.addAll(chosen);\n\t\twithCurrent.add(a[n]);\n\n\t\tList<Integer> withoutCurrent = new ArrayList<>();\n\t\twithoutCurrent.addAll(chosen);\n\n\t\t// If a[n] is chosen\n\t\tif (a[n] <= k)\n\t\t\tfindSubSeqWithGivenSum(a, n - 1, k - a[n], withCurrent);\n\n\t\tfindSubSeqWithGivenSum(a, n - 1, k, withoutCurrent);\n\n\t}", "public static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint t = s.nextInt();\n\t\twhile(t-->0)\n\t\t{\n\t\t\tint n = s.nextInt();\n\t\t\tint k = s.nextInt();\n\t\t\tint[] arr = new int[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\tarr[i] = s.nextInt();\n\t\t\tArrays.sort(arr);\n\t\t\tint[][] dp = new int[k+1][n+1];\n\t\t\tfor(int i=0;i<=k;i++)\n\t\t\t\tfor(int j=0;j<=n;j++)\n\t\t\t\t{\n\t\t\t\t\tif(i==0)\n\t\t\t\t\t\tdp[i][j] = 0;\n\t\t\t\t\telse if(j==0)\n\t\t\t\t\t\tdp[i][j] = -1;\n\t\t\t\t\telse if(i-arr[j-1]>=0)\n\t\t\t\t\t{\n\t\t\t\t\t\tint val1 = dp[i-arr[j-1]][j-1];\n\t\t\t\t\t\tint val2 = dp[i][j-1];\n\t\t\t\t\t\tif(val1!=-1 && val2!=-1)\n\t\t\t\t\t\t\tdp[i][j] = Math.min(1+val1,val2);\n\t\t\t\t\t\telse if(val1!=-1)\n\t\t\t\t\t\t\tdp[i][j] = 1+val1;\n\t\t\t\t\t\telse if(val2!=-1)\n\t\t\t\t\t\t\tdp[i][j] = val2;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdp[i][j] = -1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(dp[i][j-1]==-1)\n\t\t\t\t\t\t\tdp[i][j] = -1;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdp[i][j] = dp[i][j-1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif(dp[k][n]!=-1)\n\t\t\t\tSystem.out.println(dp[k][n]);\n\t\t\telse\n\t\t\t\tSystem.out.println(\"impossible\");\n\t\t}\n\t}", "public static void main(String args[] ) throws Exception {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] seqArray = new int[n];\n for (int i = 0; i < n; i++) {\n seqArray[i] = scanner.nextInt();\n }\n // getSeqValue(seqArray); //this method is an accepted one on Hackerrank but time complexity is not order n; i.e. !O(n);\n getLinearOrderY(seqArray); // trying to get O(n) time complexity;\n }", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "static int[] find2(int a[]){\r\n int sum = a[0];\r\n int pro = a[0];\r\n for(int i=1;i<a.length;i++){\r\n sum += a[i];\r\n pro += a[i]*a[i];\r\n }\r\n int s = (n*(n+1))/2 - sum;\r\n int p = (n*(n+1)*(2*n+1))/6 - pro;\r\n return solveSP(s, p);\r\n }", "@Override\n public Z computeNext() {\n int n = size();\n if (n <= 2) {\n return Z.valueOf(mInits[n]);\n }\n final int pow2 = Integer.highestOneBit(n);\n final int j = n - pow2;\n Z result = a(j).multiply(mFaj0).add(a(j + 1).multiply(mFaj1));\n if (j == pow2 - 1) {\n result = result.add(1);\n }\n return result;\n \n }", "public static long journeyToMoon(int n, List<List<Integer>> astronaut) {\n // Write your code here\n Map<Integer, Node<Integer>> countryMap = new HashMap<>();\n for(List<Integer> pairs: astronaut) {\n Node<Integer> node1 = countryMap.computeIfAbsent(pairs.get(0), Node::new);\n Node<Integer> node2 = countryMap.computeIfAbsent(pairs.get(1), Node::new);\n node1.connected.add(node2);\n node2.connected.add(node1);\n }\n\n List<Integer> countryCluster = new ArrayList<>();\n for(Node<Integer> node: countryMap.values()) {\n if(node.connected.size() == 0) {\n countryCluster.add(1);\n } else if(!node.visited){\n countryCluster.add(getNodeCount3(node));\n }\n }\n List<Integer> countryNodes = countryMap.values().stream().map(nn -> nn.value).collect(Collectors.toList());\n List<Integer> missingNodes = new ArrayList<>();\n for(int i=0; i < n; i++) {\n if(!countryNodes.contains(i))\n missingNodes.add(i);\n }\n\n for(int i=0; i < missingNodes.size(); i++) {\n countryCluster.add(1);\n }\n\n long ans = 0;\n //For one country we cannot pair with any other astronauts\n if(countryCluster.size() >= 2) {\n ans = (long) countryCluster.get(0) * countryCluster.get(1);\n if(countryCluster.size() > 2) {\n int sum = countryCluster.get(0) + countryCluster.get(1);\n for(int i=2; i < countryCluster.size(); i++) {\n ans += (long) sum * countryCluster.get(i);\n sum += countryCluster.get(i);\n }\n }\n }\n\n /*\n permutation of two set with size A and B = AxB\n permutation of three set with size A,B,C = AxB + AxC + BxC = AxB + (A+B)xC\n permutation of four set with size A,B,C,D = AxB + AxC + AxD + BxC + BxD + CxD = AxB + (A+B)xC + (A+B+C)xD\n */\n /*\n if(keys.length == 1) {\n ans = keys[0].size();\n } else {\n ans = keys[0].size() * keys[1].size();\n if(keys.length > 2) {\n int sum = keys[0].size() + keys[1].size();\n for (int i = 2; i < keys.length; i++) {\n ans += sum * keys[i].size();\n sum += keys[i].size();\n }\n }\n }\n */\n return ans;\n }", "public static int solveEfficient(int n) {\n if (n == 0 || n == 1)\n return 1;\n\n int n1 = 1;\n int n2 = 1;\n int sum = 0;\n\n for (int i = 2; i <= n; i++) {\n sum = n1 + n2;\n n1 = n2;\n n2 = sum;\n }\n return sum;\n }", "private int optimize() {\n\t\t// items: Items sorted by value-to-weight ratio for linear relaxation\n\t\t// t: the decision vector being tested at each node\n\t\t// ws, vs, is, bs: stacks of weight, value, item id, whether bring item\n\t\t// p: stack pointer; i, b, weight, value: loop caches; best: max search\n\t\t// ss: stack size: Always <=2 children on stack for <=n-1 parents\n\t\tItem[] items = new Item[n];\n\t\tint ss = 2 * n;\n\t\tint[] itemsSorted = new int[n], t = new int[n], ws = new int[ss],\n\t\t\tvs = new int[ss], is = new int[ss], bs = new int[ss];\n\t\tint i, b, weight, value, best = 0, p = 0;\n\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titems[j] = new Item(j);\n\t\tArrays.sort(items);\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titemsSorted[j] = items[j].i();\n\t\titems = null; // For garbage collection.\n\n\t\t// Push item 0 onto the stack with and without bringing it.\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 1; p++;\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 0; p++;\n\n\t\twhile (p > 0) {\n\t\t\tp--; // Pop the latest item off the stack\n\t\t\ti = is[p]; b = bs[p];\n\t\t\tweight = ws[p] + w[i] * b;\n\t\t\tif (weight > k)\n\t\t\t\tcontinue;\n\t\t\tvalue = vs[p] + v[i] * b;\n\t\t\tif (bound(i, weight, value, itemsSorted) < best)\n\t\t\t\tcontinue;\n\t\t\tbest = Math.max(value, best);\n\t\t\tt[i] = b;\n\t\t\tif (i < n - 1) { // Push children onto stack w/ & w/o bringing item\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 1; p++;\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 0; p++;\n\t\t\t}\n\t\t\telse if (value >= best)\n\t\t\t\tSystem.arraycopy(t, 0, x, 0, n);\n\t\t}\n\t\treturn best;\n\t}", "static int[] sol1(int[]a, int n){\r\n\t\tMap <Integer,Integer> map= new HashMap();\r\n\t\tfor (int i = 0; i< a.length; i++){\r\n\t\t\tmap.put(a[i],i);\r\n\t\t}\r\n\t\tArrays.sort(a);\r\n\t\tint i = 0; \r\n\t\tint j = a.length -1;\r\n\t\twhile (i <= j){\r\n\t\t\tif(a[i]+a[j]>n) j--;\r\n\t\t\telse if (a[i]+a[j]<n) i++;\r\n\t\t\telse break;\r\n\t\t}\r\n\t\tint[] ans= {map.get(a[i]),map.get(a[j])};\r\n\t\treturn ans;\r\n\t}", "private void helper(int[] S, int k, int p, ArrayList<ArrayList<Integer>> result, ArrayList<Integer> set) {\n if(k==0) {\n result.add(set);\n return;\n }\n if(S.length-p>=k) {\n ArrayList<Integer> newSet = new ArrayList<Integer>(set);\n newSet.add(S[p]);\n helper(S, k-1, p+1, result, newSet); //if S[p] be choosen\n helper(S, k, p+1, result, set); // if S[p] not be choosen\n }\n\n }", "public void explore(Node node, int nchoices) {\n /**\n * Solution strategy: recursive backtracking.\n */\n\n if (nchoices == graphSize) {\n //\n // BASE CASE\n //\n if (this.this_distance < this.min_distance || this.min_distance < 0) {\n // if this_distance < min_distance, this is our new minimum distance\n // if min_distance < 0, this is our first minimium distance\n this.min_distance = this.this_distance;\n\n\n printSolution();\n\n\n } else {\n printFailure();\n }\n\n } else {\n //\n // RECURSIVE CASE\n //\n Set<Node> neighbors = graph.adjacentNodes(node);\n for (Node neighbor : neighbors) {\n if (neighbor.visited == false) {\n\n int distance_btwn = 0;\n\n for (Edge edge : graph.edgesConnecting(node, neighbor)) {\n distance_btwn = edge.value;\n\n\n }\n\n\n // Make a choice\n\n this.route[nchoices] = neighbor;\n neighbor.visit();\n this.this_distance += distance_btwn;\n\n // Explore the consequences\n explore(neighbor, nchoices+ 1);\n\n // Unmake the choice\n\n this.route[nchoices] = null;\n neighbor.unvisit();\n this.this_distance -= distance_btwn;\n\n }\n\n // Move on to the next choice (continue loop)\n }\n\n\n } // End base/recursive case\n\n\n }", "static int solve(int n) \n\t{ \n\t // base case \n\t if (n < 0) \n\t return 0; \n\t if (n == 0) \n\t return 1; \n\t \n\t return solve(n-1) + solve(n-3) + solve(n-5); \n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int T = sc.nextInt();\n for(int i = 0 ; i < T; i++) {\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n PriorityQueue<Integer> queue = new PriorityQueue<Integer>();\n int[][] m = new int[n][n];\n //n^2 * log(n)\n for(int row = 0; row < n; row++) {\n for(int col = 0; col < n; col++) {\n if(row == 0 && col == 0 && n != 1) {\n continue;\n }else if(row == 0) {\n m[row][col] = m[row][col - 1] + a;\n }else if(col == 0) {\n m[row][col] = m[row-1][col] + b;\n }else {\n m[row][col] = m[row-1][col-1] + a + b;\n }\n\n if(row + col == (n -1)) {\n pool.add(m[row][col]); //log(n)\n }\n }\n }\n //O(n*log(n))\n for (Integer item:pool) {\n queue.add(item); //O(logn)\n }\n while(!queue.isEmpty()) {\n System.out.print(queue.poll() + \" \"); //O(1)\n }\n System.out.println();\n queue.clear();\n pool.clear();\n }\n }", "public void RunAlgo(int i,Set<Session> s, ArrayList<Set<Session>> courses){\n System.out.println(i);\n if(i==courses.size()) {\n Set<Session> temp= copySet(s);\n if(allCombinations.size()>maxSize) flag=false;\n allCombinations.add(temp);\n System.out.println(allCombinations.size());\n return;\n }\n Set<Session> current = courses.get(i);\n for (Session x : current) {\n if (isGoodMatch(x, s)) {\n s.add(x);\n if(flag)\n RunAlgo(i + 1, s, courses);\n s.remove(x);\n }\n }\n\n }", "static int[] OnepassSol1(int[]a, int n){\r\n Map<Integer, Integer> map = new HashMap<>();\r\n for (int i = 0; i < a.length; i++) {\r\n int complement = n - a[i];\r\n if (map.containsKey(complement)) {\r\n return new int[] { map.get(complement), i };\r\n }\r\n map.put(a[i], i);\r\n }\r\n int[] ans = {-1,-1};\r\n return ans;\r\n }", "Optional<Pairof<X, MultiSet<X>>> choose();", "public static int f1(int N) {\n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n) \n x++; \n return x; \n \n }", "private static void iterative(String[] set, int n) {\n if(set == null || n <= 0) {\n return;\n }\n \n // number of power sets is 2 ^ n\n long powerSetSize = (long)Math.pow(2, n); // or 1<<n\n \n \n // Run a loop for printing all 2^n subsets\n for(int i = 0; i < powerSetSize; i++) {\n System.out.print(\"\\\"\");\n \n for(int j = 0; j < n; j++) {\n /* \n * Don't understand!\n * \n * Check if jth bit in the counter i is set.\n * If set then print jth element from set \n */\n // (1<<j) is a number with jth bit 1\n // so when we 'and' them with the\n // subset number we get which numbers\n // are present in the subset and which\n // are not\n if((i & (1 << j)) > 0) {\n System.out.print(set[j]);\n }\n }\n System.out.print(\"\\\"\");\n \n System.out.println();\n }\n }", "private static long combinations(int n, int k) {\n\t\tif (k > n / 2) {\n\t\t\tk = n - k;\n\t\t}\n\n\t\tlong result = 1;\n\n\t\tfor (int i = 1, j = n - k + 1; i <= k; i++, j++) {\n\t\t\tresult = result * j / i;\n\t\t}\n\n\t\treturn result;\n\t}", "public int C(int n, int k) {\n\tif (choose[n][k] != -1)\n\t\treturn choose[n][k];\n\tint t = C(n-1,k-1) + C(n-1,k);\n\tchoose[n][k] = t;\n\treturn t;\n}", "protected void SelectTournament() {\n\t // Torneo.length -> tournament size\n\t // if (tournament size == 2) then BinaryTournament\n this.setRanking();\n\t \n\t for (int i=0; i<this.PopLength; i++) {\n\t Torneo[0] = Randint(0,this.PopLength-1);\n\t int mejor_torneo=Torneo[0];\n\t \n\t for (int j=1; j<Torneo.length; j++) {\n\t boolean repetido= false;\n\t do {\n\t Torneo[j] = Randint(0,this.PopLength-1);\n\t repetido=false;\n\t int k=0;\n\t while ((k<j) && (!repetido))\n\t if (Torneo[j]==Torneo[k])\n\t repetido=true;\n\t else\n\t k++;\n\t } while (repetido);\n\t \n\t if (OLDevaluation[Torneo[j]] < OLDevaluation[mejor_torneo])\n\t mejor_torneo=Torneo[j];\n\t }\n\t sample[i] = mejor_torneo;\n\t }\n\t // Se crea la nueva poblacion\n\t for (int n=0; n<this.PopLength; n++) {\n\t int kk=sample[n];\n\t for (int m=0; m<this.NbGenes; m++) {\n\t NEWpopulation[n][m]= OLDpopulation[kk][m];\n\t }\n\t NEWevaluation[n]= OLDevaluation[kk];\n\t NEWevalIndex[n]= OLDevalIndex[kk];\n\t }\n }", "private int[] constructCandidates1(int n) {\n int cands[] = new int[subsetCount];\n for (int i = 0; i < subsetCount; i++) {\n cands[i] = i;\n }\n for (int i = 0; i < n; i++) { // Remove currently used sets in partialSol.\n cands[partialSol[i]] = DNU;\n }\n for (int i = 0; i < n; i++) {\n if (getDiff(cands, i, n) == 0) {\n cands[i] = DNU;\n }\n }\n int dnuCount = 0;\n for (int i = 0; i < cands.length; i++) {\n if (cands[i] == DNU) {\n dnuCount++;\n }\n }\n int[] ret = new int[cands.length - dnuCount];\n int retIndex = 0;\n for (int i = 0; i < cands.length; i++) {\n if (cands[i] != DNU) {\n ret[retIndex] = i;\n retIndex++;\n }\n }\n return sortCandidates(ret, n);\n// return ret;\n }", "@Override\n \tpublic Solution solve() {\n \t\tfor (int i = 0; i < n; i++) {\n \t\t\tnest[i] = generator.getSolution();\n \t\t}\n \n \t\tfor (int t = 0; t < maxGeneration; t++) { // While (t<MaxGeneration) or\n \t\t\t\t\t\t\t\t\t\t\t\t\t// (stop criterion)\n \t\t\t// Get a cuckoo randomly (say, i) and replace its solution by\n \t\t\t// performing random operations;\n \t\t\tint i = r.nextInt(n);\n \t\t\tSolution randomNest = nest[i];\n \t\t\t//FIXME: randomNest = solutionModifier.modify(nest[i]);\n \n \t\t\t// Evaluate its quality/fitness\n \t\t\tint fi = randomNest.f();\n \n \t\t\t// Choose a nest among n (say, j) randomly;\n \t\t\tint j = r.nextInt(n);\n \t\t\tint fj = f[j];\n \n \t\t\tif (fi > fj) {\n \t\t\t\tnest[i] = randomNest;\n \t\t\t\tf[i] = fi;\n \t\t\t}\n \n \t\t\tsort();\n \t\t\t// A fraction (pa) of the worse nests are abandoned and new ones are built;\n\t\t\tfor(i = n-toAbandon; i<n; i++) {\n \t\t\t\tnest[i] = generator.getSolution();\n \t\t\t}\n \t\t\t\n \t\t\t// Rank the solutions/nests and find the current best;\n \t\t\tsort();\n \t\t}\n \n \t\treturn nest[0];\n \t}", "private int siguientePrimo(int n)\r\n {\r\n if (n%2 == 0) n++;\r\n for (; !esPrimo(n); n+=2);\r\n return n;\r\n }", "public static void main(String[] args) {\n int N, Q;\n int a, x, y;\n int lastAnswer = 0;\n\n Scanner sc = new Scanner(System.in);\n N = sc.nextInt();\n Q = sc.nextInt();\n\n ArrayList<ArrayList<Integer>> seqList = new ArrayList<ArrayList<Integer>>(N);\n ArrayList<Integer> seq;\n for (int i = 0; i < N; i++) {\n seq = new ArrayList<Integer>();\n seqList.add(seq);\n }\n for (int i = 0; i < Q; i++) {\n seq = new ArrayList<Integer>();\n a = sc.nextInt();\n x = sc.nextInt();\n y = sc.nextInt();\n\n seq = seqList.get((x ^ lastAnswer) % N);\n if (a == 1) {\n seq.add(y);\n } else if(a == 2) {\n lastAnswer = seq.get(y % seq.size());\n System.out.println(lastAnswer);\n }\n\n }\n }", "public int iterative(int n) {\r\n //base cases\r\n if (n <= 1) {\r\n return n;\r\n }\r\n if (n == 2) {\r\n return 1;\r\n }\r\n //initialize current and previous two values\r\n int current = 0;\r\n int prev1 = 1;\r\n int prev2 = 1;\r\n\r\n //iterate starting at 3\r\n for (int i = 3; i <= n; i++) {\r\n //set current to value being computed\r\n current = prev1 + prev2;\r\n //set prev2 to n - 1\r\n prev2 = prev1;\r\n //set prev1 to current, reaching n + 1 exits loop and returns current\r\n prev1 = current;\r\n }\r\n return current;\r\n }", "@Test\n @Order(1)\n void algorithms() {\n \n Combination initialComb = new Combination();\n for (int i = 0; i < assignementProblem.getAssignmentData().getLength(); i++) {\n initialComb.add((long) i + 1);\n }\n assignementProblem.setInCombination(initialComb);\n executeAlgo(SearchTestUtil.ALGO.TABU);\n executeAlgo(SearchTestUtil.ALGO.RECUIT);\n }", "private static Integer packDPRec(Integer capacity, List<Integer> weights, List<ItemDTO> items, Integer n, Integer[][] mem, List<Integer> optimalChoice) {\n // Base condition\n if (n == 0 || capacity <= 0)\n return 0;\n\n if (mem[n][capacity] != -1) {\n return mem[n][capacity];\n }\n\n if (weights.get(n - 1) > capacity) {\n // Store the value of function call\n // stack in table before return\n List<Integer> subOptimalChoice = new ArrayList<>();\n mem[n][capacity] = packDPRec(capacity, weights, items, n - 1, mem, subOptimalChoice);\n optimalChoice.addAll(subOptimalChoice);\n return mem[n][capacity];\n } else {\n // Return value of table after storing\n List<Integer> optimalChoiceIncluded = new ArrayList<>();\n List<Integer> optimalChoiceExcluded = new ArrayList<>();\n Integer valueIncluded = items.get(n - 1).getValue() + packDPRec(capacity - weights.get(n - 1), weights, items, n - 1, mem, optimalChoiceIncluded);\n Integer valueExcluded = packDPRec(capacity, weights, items, n - 1, mem, optimalChoiceExcluded);\n if (valueIncluded > valueExcluded) {\n optimalChoice.addAll(optimalChoiceIncluded);\n optimalChoice.add(items.get(n - 1).getId());\n mem[n][capacity] = valueIncluded;\n }else{\n optimalChoice.addAll(optimalChoiceExcluded);\n mem[n][capacity] = valueExcluded;\n }\n return mem[n][capacity];\n }\n }", "public int[] squareUp(int n) {\r\n int[]arreglo=new int[(n*n)]; // O(1)\r\n if(n==0){ // O(1)\r\n return arreglo; // O(1)\r\n }\r\n for(int i=n-1;i<arreglo.length;i=i+n){ // O(n)\r\n for (int j=i;j>=i-(i/n);j--){ // O(1)\r\n arreglo[j]=1+(i-j); // O(1)\r\n }\r\n }\r\n return arreglo; // O(1)\r\n}", "public static List<Integer> solution2(int n) {\n List<Integer> rs=new ArrayList<Integer>();\n rs.add(0);\n for(int i=0;i<n;i++){\n int size=rs.size();\n for(int k=size-1;k>=0;k--)\n rs.add(rs.get(k) | 1<<i);\n }\n return rs;\n }", "@Override\n public DRFLPSolution algorithm(DRFLPInstance instance) {\n try {\n List<Future<DRFLPSolution>> futures = new ArrayList<>();\n RandomManager.reinitialize(RandomType.LEGACY, 0, this.n);\n for (int i = 0; i < n; i++) {\n int _i = i;\n futures.add(executor.submit(() -> {\n RandomManager.reset(_i);\n return alg.algorithm(instance);\n }));\n }\n var results = ConcurrencyUtil.awaitAll(futures);\n DRFLPSolution best = null;\n for(var solution: results){\n if(solution.isBetterThan(best)){\n best = solution;\n }\n }\n return best;\n } finally {\n executor.shutdown();\n }\n }", "public Vector genCandidate(int k) {\n\t\tVector<String> tempCandidateList = new Vector<String>();\n\t\tVector<String> temp_v = new Vector<String>();\n\t\tint length;\n\t\tString candidate1 = new String();\n\t\tString candidate2 = new String();\n\t\tString newCandidate = new String();\n\t\t// 1 itemset\n\t\tif( 1 == k ) {\n\t\t\tfor(int i = 1; i<=NUM; i++) {\n\t\t\t\ttempCandidateList.addElement(Integer.toString(i));\n\t\t\t}\n\t\t}\n\t\t// >=2\n\t\telse {\n\t\t\ttemp_v = (Vector)largeItemset.get(k-2); //-2, not 1\n\t\t\tlength = temp_v.size();\n\t\t\tfor(int j = 0; j<length; j++) {\n\t\t\t\t// get 1 itemset element\n\t\t\t\tcandidate1 = temp_v.get(j);\n\t\t\t\t// newCandidate = new String();\n\t\t\t\tfor(int jj=j+1; jj<length; jj++) {\n\t\t\t\t\tcandidate2 = temp_v.get(jj);\n\t\t\t\t\tnewCandidate = new String();\n\t\t\t\t\t// attention: if k == 2, no rule, just join\n\t\t\t\t\tif( 2 == k) {\n\t\t\t\t\t\tnewCandidate = candidate1.concat(\" \");\n\t\t\t\t\t\tnewCandidate = newCandidate.concat(candidate2);\n\t\t\t\t\t\ttempCandidateList.addElement(newCandidate.trim());\n\t\t\t\t\t}\n\t\t\t\t\telse { //only first k-2 element same ->downward closure property!\n\t\t\t\t\t\tString s1, s2;\n\t\t\t\t\t\tboolean same = true;\n\t\t\t\t\t\tfor(int pos = 1; pos<k-1; pos++) {\n\t\t\t\t\t\t\ts1 = getItemAt(candidate1, pos);\n\t\t\t\t\t\t\ts2 = getItemAt(candidate2, pos);\n\t\t\t\t\t\t\tif(s1.compareToIgnoreCase(s2) != 0) {\n\t\t\t\t\t\t\t\tsame = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tnewCandidate = newCandidate.concat(\" \");\n\t\t\t\t\t\t\t\tnewCandidate = newCandidate.concat(s1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// a legal C(k+1) element we've got\n\t\t\t\t\t\tif(same) {\n\t\t\t\t\t\t\ts1 = getItemAt(candidate1, k-1);\n\t\t\t\t\t\t\ts2 = getItemAt(candidate2, k-1);\n\t\t\t\t\t\t\tnewCandidate = newCandidate.concat(\" \");\n\t\t\t\t\t\t\tnewCandidate = newCandidate.concat(s1);\n\t\t\t\t\t\t\tnewCandidate = newCandidate.concat(\" \");\n\t\t\t\t\t\t\tnewCandidate = newCandidate.concat(s2);\n\t\t\t\t\t\t\ttempCandidateList.addElement(newCandidate.trim());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\treturn tempCandidateList;\n\t}", "public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int k = in.nextInt();\n int q = in.nextInt();\n\n int a[] = new int[n];\n for(int a_i=0; a_i < n; a_i++){\n a[a_i] = in.nextInt();\n }\n\n int fist;\n int last;\n\n //brute force will get timeout\n for(int i = 0; i< k; i++){\n fist = a[0];\n last = a[n-1];\n a[0] = last;\n for (int j = 1; j<n; j++){\n last = a[j];\n a[j] = fist;\n fist = last;\n }\n }\n\n for(int a0 = 0; a0 < q; a0++){\n System.out.println(a[in.nextInt()]);\n }\n\n\n }", "public static void main(String[] args) {\n\t\tArrayList<Integer> primelist = sieve(7071);\n\t\tArrayList<Double> second = new ArrayList<Double>();\n\t\tfor(int one : primelist) \n\t\t\tsecond.add(Math.pow(one, 2));\n\t\tArrayList<Double> third = new ArrayList<Double>();\n\t\tprimelist = sieve(368);\n\t\tfor(int one : primelist)\n\t\t\tthird.add(Math.pow(one, 3));\n\t\tArrayList<Double> fourth = new ArrayList<Double>();\n\t\tprimelist = sieve(84);\n\t\tfor(int one : primelist)\n\t\t\tfourth.add(Math.pow(one, 4));\n\n\t\tArrayList<Double> possibilities = new ArrayList<Double>();\n\t\tfor (int k = fourth.size() - 1; k >=0 ; k--) {\n\t\t\tfor (int j = 0; j < third.size(); j++) {\n\t\t\t\tdouble sum = fourth.get(k) + third.get(j);\n\t\t\t\tif (sum > 50000000)\n\t\t\t\t\tbreak;\n\t\t\t\telse {\n\t\t\t\t\tfor (int i = 0; i < second.size(); i++) {\n\t\t\t\t\t\tdouble nextsum = sum + second.get(i);\n\t\t\t\t\t\tif (nextsum > 50000000)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// I am not sure whether it can be proved that the sum is unique.\n\t\t\t\t\t\t\tif (!possibilities.contains(nextsum))\n\t\t\t\t\t\t\t\tpossibilities.add(nextsum);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint totalcount = possibilities.size();\n\t\tSystem.out.println(totalcount);\n\t}", "private static long calc1()\n {\n final int min = 1000;\n final int max = 10000;\n\n // initialize\n List<List<Integer>> m = new ArrayList<>();\n for (int k = 0; k < end; k++) {\n List<Integer> list = new ArrayList<Integer>();\n int n = 1;\n while (k >= start) {\n int p = pkn(k, n);\n if (p >= max) {\n break;\n }\n if (p >= min) {\n list.add(p);\n }\n n++;\n }\n m.add(list);\n }\n\n boolean[] arr = new boolean[end];\n arr[start] = true;\n\n List<Integer> solutions = new ArrayList<>();\n List<Integer> list = m.get(start);\n for (Integer first : list) {\n LinkedList<Integer> values = new LinkedList<>();\n values.add(first);\n f(m, arr, values, 1, solutions);\n // we stop at the first solution found\n if (!solutions.isEmpty()) {\n break;\n }\n }\n\n // solutions.stream().forEach(System.out::println);\n int res = solutions.stream().reduce(0, Integer::sum);\n return res;\n }", "static int recursiva2(int n)\n\t\t{\n\t\t\tif (n==0)\n\t\t\treturn 10; \n\t\t\tif (n==1)\n\t\t\treturn 20;\n\t\t\tif (n==2)\n\t\t\treturn 30;\n\t\t\t\n\t\t\treturn recursiva2(n-1) + recursiva2 (n-2) * recursiva2 (n-3); \n\t\t}", "public StandardSolution (long[] nums){\n \t\tsequence = nums;\n \t\tpartitions = new boolean[sequence.length];\n \t\t\n \t\tRandom rand = new Random();\n \t\tfor (int i = 0; i < partitions.length; i++){\n \t\t\t// worry about seeing?\n \t\t\tpartitions[i] = rand.nextBoolean();\n \t\t}\n \t}", "@Override\n\tpublic int chooseNum(TreeSet<Integer> avail) {\n\t\tIterator<Integer> iter = avail.descendingIterator();\n\t\t\n\t\tint i = iter.next();\n\t\t\n\t\t//Find a number which we previous have not chosen yet\n\t\twhile(prevChosen.contains(i)){\n\t\t\ti = iter.next();\n\t\t}\n\t\t\n\t\t//Add our chosen number to the list of chosen numbers\n\t\tprevChosen.add(i);\n\t\t\n\t\t//Return the chosen number\n\t\treturn i;\n\t}", "public static void main(String[] args){\n\t\t\n\t\tfor (int i = 0; i<999999;i++) results.add(0);\t\n\n\t\tsetChain(1L);\n\t\tboolean switcher = true;\n\t\t//while switch=true ... and once chain length is added to, switch = false\n \t\tlong best = 0L;\n\t\tint index=0;\n\t\t\t\n\t\tfor (long j = 1L; j < 1000000L; j++) {\n\n\t\t\tsetCur((int)j);\n\n\t\t\tfindChain(j);//} catch(Exception e){System.out.println(\"stackOverFlow :D\");}\n\t\t\tif (getChain() > best) {best = getChain(); index=getCur();}\n\t\t\t//now store results for later use if we come across that number.\n\t\t\tresults.set(getCur()-1, (int)getChain());\t\n\t\t\tsetChain(1L); //reset\n\t\t\t/* \t\n\t\t\tswitcher=true;\n\t\t\tint i = j;\n\t\t\twhile (switcher) {\n\n\t\t\t\tif (i==1) {//results.add(chainLength); \n\t\t\t\t\tif (chainLength > best) { best=chainLength; index = j;}\n\t\t\t \tchainLength=1; switcher=false;}\n\t\n\t\t\t\telse { i=recurse(i); chainLength++; }\t\n\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n//\t\t }\n\t\t}\n\t\tSystem.out.println(index);\n\t}", "public Collection<MatchingPair> matchingPairs(Collection<Integer> values, Integer targetSum)\n {\n HashMap<Integer, Integer> tableCompteur = new HashMap<>();\n LinkedHashMap<Integer, Integer> tablePaire = new LinkedHashMap<Integer, Integer>();\n Collection<MatchingPair> paireSansDuplication = new LinkedList();\n Collection<MatchingPair> solution = new LinkedList();\n\n // On itere sur les valeurs donnee pour savoir le compte de chaque valeur\n for (Integer valeur : values)\n {\n if (tableCompteur.containsKey(valeur))\n {\n // Partie Compteur\n Integer compteur = tableCompteur.get(valeur);\n compteur++;\n tableCompteur.put(valeur, compteur);\n }\n else {\n tableCompteur.put(valeur, 0);\n }\n\n }\n\n // On itere sur les valeurs donnee pour savoir les paires\n for (Integer element : values)\n {\n int temp = targetSum - element;\n if (tablePaire.containsKey(element))\n {\n if (tablePaire.get(element) != null)\n {\n paireSansDuplication.add(new MatchingPair(element, temp));\n }\n // si la table contient l'element on met nul pour ne pas avoir de repetition\n tablePaire.put(temp, null);\n }\n else if (!tablePaire.containsKey(element))\n {\n tablePaire.put(temp, element);\n }\n }\n\n // On trouve le minimum count entre les paire et leur compte pour tenir en compte de toutes les possibilites. Ici le meilleur cas reste O(n) ( pas de paire)\n for (MatchingPair paire : paireSansDuplication)\n {\n if (paire != null) { // verification au debug pr erreur nullpointer\n int a = tableCompteur.get(paire.first);\n int b = tableCompteur.get(paire.second);\n int minCount = Math.min(a+1, b+1);\n for (int i = 0; i < pow(minCount, 2); i++)\n {\n solution.add(new MatchingPair(paire.first, paire.second));\n }\n }\n }\n return solution;\n }", "private void apriori(){\n HashMap<BitSet, Integer> frequentItemsBit = new HashMap<>();\n HashMap<BitSet, Integer> allAssociations = new HashMap<>();\n \n // Put all the 1-itemsets in frequent item hashmap. It will be scanned\n // for getting k-itemsets and cleared iteratively. \n for (int i = 0; i < frequentItemListSetLenOne.size(); i++) {\n BitSet bitSet = new BitSet(bitsetLen);\n bitSet.set(i, true);\n frequentItemsBit.put(bitSet, frequentItemListSetLenOne.get(i).getValue());\n }\n\n int currentK = 1;\n boolean emptyFrequentSet = false;\n \n while (!emptyFrequentSet) {\n \n // create candidates\n if(currentK > 1){\n HashMap<BitSet, Integer> frequentItemsBitT = (HashMap)frequentItemsBit.clone();\n frequentItemsBit.clear();\n frequentItemsBit = candidate_gen(frequentItemsBitT, currentK);\n }\n \n // If no frequent itemSet in current level break\n if(frequentItemsBit.isEmpty())\n break;\n \n // if currentK >= minimumK insert into final list\n if (currentK >= min_itemset_size_K) {\n for (Map.Entry<BitSet, Integer> entry : frequentItemsBit.entrySet()) {\n allAssociations.put(entry.getKey(), entry.getValue());\n }\n }\n currentK++;\n }\n \n printAssociations(allAssociations);\n }", "public static long choose(int n,int r) throws NumberOutOfLimitsException{\n \tif(r<0||n<0){\n \t\tthrow new NumberOutOfLimitsException();\n \t}\n if(r==0||r==n){\n return 1;\n }else{\n return choose(n-1,r-1) + choose(n-1,r);\n }\n }", "public void inOrderTraverseIterative();", "public void initial()\n\t{ \n\t\tint i,j; \n\t\tint tempValue=0;\n\t\tfor(i=0; i<n; i++) \n\t\t{ \n\t\t\tfor(j=0; j<n; j++)\n\t\t\t {\n\t\t\t\tif(j==0)\n\t\t\t\t{\n\t\t\t\t\ttempValue = cost[i][j];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(tempValue> cost[i][j])\n\t\t\t\t\t{\n\t\t\t\t\t\ttempValue = cost[i][j];\n\t\t\t\t\t}\t\t\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tfor (j=0; j<n;j++)\n\t\t\t{\n\t\t\t\tcost[i][j] = cost[i][j]- tempValue;\n\t\t\t}\t\t\t\n\t\t}\n\t\t\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tfor (i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tif(i==0)\n\t\t\t\t{\n\t\t\t\t\ttempValue = cost[i][j];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t if(tempValue> cost[i][j])\n\t\t\t\t {\n\t\t\t\t \ttempValue = cost[i][j];\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(i=0;i<n;i++)\n\t\t\t{\n\t\t\t\tcost[i][j] = cost[i][j] - tempValue;\n\t\t\t}\n\t\t}\t\n\t}", "static void whatFlavors(int[] cost, int money) {\n Map<Integer, List<Integer>> priceVsIndexMap = new HashMap<>();\n for(int i = 0; i < cost.length; i++) {\n int price = cost[i];\n List<Integer> entry = priceVsIndexMap.get(price);\n if(entry == null) {\n entry = new ArrayList<>();\n priceVsIndexMap.put(price, entry);\n }\n entry.add(i);\n }\n for(int i = 0; i < cost.length; i++) {\n List<Integer> entry = priceVsIndexMap.get(cost[i]);\n if(entry.size() > 1) {\n if(cost[entry.get(0)] + cost[entry.get(1)] == money) {\n System.out.println((entry.get(0)+1) +\" \"+ (entry.get(1)+1));\n break;\n }\n } else {\n int diff = money - cost[entry.get(0)];\n if(priceVsIndexMap.containsKey(diff)) {\n List<Integer> otherEntry = priceVsIndexMap.get(diff);\n if(entry.get(0) != otherEntry.get(0)) {\n System.out.println((entry.get(0)+1) +\" \"+ (otherEntry.get(0)+1));\n break;\n }\n }\n\n }\n }\n\n }", "public void combineTwo(int n, int k) {\n // init first combination\n LinkedList<Integer> nums = new LinkedList<Integer>();\n for(int i = 1; i < k + 1; ++i)\n nums.add(i);\n nums.add(n + 1); //add as a sentinel\n\n List<List<Integer>> output = new ArrayList<>();\n int j = 0;\n //the while loop breaks when you have processed the first k combinations\n while (j < k) {\n // add current combination\n output.add(new LinkedList(nums.subList(0, k)));\n //\n // if nums[j] + 1 == nums[j + 1] increase nums[j] by one\n // the loop breaks when nums[j] + 1 != nums[j + 1]\n j = 0;\n while ((j < k) && (nums.get(j + 1) == nums.get(j) + 1))\n nums.set(j, j++ + 1);\n nums.set(j, nums.get(j) + 1); //increment the number at jth index\n }\n this.possibleCombinations = output;\n }", "public boolean canPartition(int[] nums) {\n int sum = 0;\n int n = nums.length;\n for (int num : nums) sum += num;\n // sum cannot be splitted evenly\n if ((sum & 1) == 1) return false;\n int target = sum / 2;\n \n // dp[i][j] represents whether 0~i-1 numbers can reach\n // weight capacity j\n boolean[][] dp = new boolean[n+1][target+1];\n \n for (int i = 1; i <= n; i++) dp[i][0] = true;\n for (int j = 1; j <= target; j++) dp[0][j] = false;\n dp[0][0] = true;\n \n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= target; j++) {\n // if don't pick current number\n dp[i][j] = dp[i-1][j];\n if (j >= nums[i-1]) {\n dp[i][j] = dp[i][j] || dp[i-1][j-nums[i-1]];\n }\n }\n }\n return dp[n][target];\n \n \n // Solution2: optimizing to save space\n // https://leetcode.com/problems/partition-equal-subset-sum/discuss/90592/01-knapsack-detailed-explanation/94996\n int sum = 0;\n int n = nums.length;\n for (int num : nums) sum += num;\n if ((sum & 1) == 1) return false;\n int target = sum / 2;\n boolean[] dp = new boolean[target+1];\n dp[0] = true;\n for (int num : nums) {\n // here is the trick to save space\n // because we have to update dp[j] based on \n // previous dp[j-num] and dp[j] from previous loop.\n // if we update dp from left to right\n // we first update smaller dp which is dp[j-num]\n // then we won't be able to get original dp[j-num] and dp[j]\n // from previous loop, and eventually we get the wrong\n // answer. But if we update dp from right to left\n // we can assure everything is based on previous state\n for (int j = target; j >= num; j--) {\n // if (j >= num) {\n dp[j] = dp[j] || dp[j-num];\n // }\n }\n }\n return dp[target];\n }", "private static int f(int n, int complete, int other, int[] arr) {\n if(n<=0)\n return 0;\n int res=0;\n ArrayList<Integer>list=new ArrayList<Integer>();\n for(int a:arr)\n if(a>0)\n list.add(a);\n int brr[]=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n while(brr.length!=0){\n int index=0;\n for(int i=1;i<brr.length;i++)\n if(brr[index]<brr[i])\n index=i;\n for(int i=0;i<brr.length;i++){\n if(index==i)\n brr[i]-=complete;\n else\n brr[i]-=other;\n }\n list=new ArrayList<Integer>();\n for(int a:brr)\n if(a>0)\n list.add(a);\n brr=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n res++;\n }\n return res;\n }", "protected LinkedList<FunQuadruple> generateCandidates(List<FunQuadruple> lk) {\n\n LinkedList<FunQuadruple> lkPlus1 = new LinkedList<>();\n if (lk.isEmpty()) {\n return lkPlus1;\n }\n Set<ColumnCombinationBitset> subsets = new HashSet<>();\n int k = lk.get(0).candidate.size();\n ColumnCombinationBitset union = new ColumnCombinationBitset();\n for (FunQuadruple subsetQuadruple : lk) {\n // TODO optimise: all bits are set? --> break\n // If subsetQuadruple represents a unique do not add it to subsets and union (it should be pruned).\n if (subsetQuadruple.count == 0) {\n continue;\n }\n union = subsetQuadruple.candidate.union(union);\n subsets.add(subsetQuadruple.candidate);\n }\n\n Map<ColumnCombinationBitset, Integer> candidateGenerationCount = new HashMap<>();\n\n List<ColumnCombinationBitset> lkPlus1Candidates;\n FunQuadruple lkPlus1Member;\n for (ColumnCombinationBitset subset : subsets) {\n lkPlus1Candidates = union.getNSubsetColumnCombinationsSupersetOf(\n subset, k + 1);\n // FIXME add key conditional here\n // Removed key conditional - should not be triggerable?\n for (ColumnCombinationBitset candidate : lkPlus1Candidates) {\n if (candidateGenerationCount.containsKey(candidate)) {\n int count = candidateGenerationCount.get(candidate);\n count++;\n candidateGenerationCount.put(candidate, count);\n } else {\n candidateGenerationCount.put(candidate, 1);\n }\n }\n }\n\n for (ColumnCombinationBitset candidate : candidateGenerationCount\n .keySet()) {\n if (candidateGenerationCount.get(candidate) == (k + 1)) {\n lkPlus1Member = new FunQuadruple(candidate, addPliGenerate(\n candidate).getRawKeyError());\n lkPlus1.add(lkPlus1Member);\n }\n }\n return lkPlus1;\n }", "public int solution2(int[] nums, int k) {\n PriorityQueue<Integer> pq = new PriorityQueue<Integer>();\n \n for (int i : nums) {\n pq.offer(i);\n \n if (pq.size() > k) {\n pq.poll();\n }\n }\n \n \n return pq.peek();\n }", "static int gen(int n)\n{ \n int []S = new int [n + 1];\n \n S[0] = 0;\n if(n != 0)\n S[1] = 1;\n \n for (int i = 2; i <= n; i++)\n { \n \n // S(2 * n) = 4 * S(n)\n if (i % 2 == 0)\n S[i] = 4 * S[i / 2];\n \n // S(2 * n + 1) = 4 * S(n) + 1\n else\n S[i] = 4 * S[i/2] + 1;\n }\n \n return S[n];\n}", "static int numOfSubsets(int[] arr, int n, int k) {\n List<Integer> vect1 = new ArrayList<Integer>(); \n List<Integer> vect2 = new ArrayList<Integer>(); \n List<Integer> subset1 = new ArrayList<Integer>(); \n List<Integer> subset2 = new ArrayList<Integer>(); \n \n // ignore element greater than k and divide\n // array into 2 halves\n for (int i = 0; i < n; i++) {\n \n // ignore element if greater than k\n if (arr[i] > k)\n continue;\n if (i <= n / 2)\n vect1.add(arr[i]);\n else\n vect2.add(arr[i]);\n }\n \n // generate all subsets for 1st half (vect1)\n for (int i = 0; i < (1 << vect1.size()); i++) {\n int value = 1;\n for (int j = 0; j < vect1.size(); j++) {\n if (i & (1 << j))\n value *= vect1[j];\n }\n \n // add only in case subset product is less\n // than equal to k\n if (value <= k)\n subset1.add(value);\n }\n \n // generate all subsets for 2nd half (vect2)\n for (int i = 0; i < (1 << vect2.size()); i++) {\n int value = 1;\n for (int j = 0; j < vect2.size(); j++) {\n if (i & (1 << j))\n value *= vect2[j];\n }\n \n // add only in case subset product is\n // less than equal to k\n if (value <= k)\n subset2.add(value);\n }\n \n // sort subset2\n sort(subset2.begin(), subset2.end());\n \n int count = 0;\n for (int i = 0; i < subset1.size(); i++)\n count += upper_bound(subset2.begin(), subset2.end(),\n (k / subset1[i]))\n - subset2.begin();\n \n // for null subset decrement the value of count\n count--;\n \n // return count\n return count;\n }", "public int R_M(){\n\t\tBigInteger nminus1=n.subtract(BigInteger.ONE);\n\t\tdo{\n\t\t\tif(nminus1.mod(two.pow(a)).equals(BigInteger.ZERO)){\n\t\t\t\ttable.add(a);\n\t\t\t}\n\t\t\titerator++;\n\t\t\ta++;\n\t\t}while(!(two.pow(a).compareTo(n)>0));\n\t\t\n\t\ta=table.get(table.size()-1);\n\t\tBigInteger m=nminus1.divide(two.pow(a));\n\t\tint wlen=n.bitLength();\n\t\tBigInteger b;\n\t\tBigInteger z;\n\t\tfor(int i=0;i<iterations;i++){\n\t\t\tint straznik=0;\n\t\t\tint straznik1=0;\n\t\t\tdo{\n\t\t\t b=new BigInteger(wlen,new Random());\n\t\t\t}while(!(b.compareTo(BigInteger.ONE)>0) && !(b.compareTo(nminus1)<0));\n\t\t\tz=b.modPow(m, n);\n\t\t\tif(z.equals(BigInteger.ONE) || z.equals(nminus1)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(int j=0;j<a-1;j++){\n\t\t\t\t\tz=z.pow(2).mod(n);\n\t\t\t\t\tif(z.equals(nminus1)){\n\t\t\t\t\t\tstraznik++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(z.equals(BigInteger.ONE)){\n\t\t\t\t\t\tstraznik1++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(straznik==1){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(straznik1==1){\n\t\t\t\t\tgetComposite();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\tgetComposite();\n\t\t\treturn 0;\n\t\t}\n\t\tgetProbablyPrime();\n\t\treturn 1;\n\t\t}", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "static public int solve(int n,int A[])\n {\n int freqArr[] = new int[1001];\n int dp[] = new int[1001];\n\n for(int i=0; i<n; i++){\n freqArr[A[i]]++;\n }\n\n dp[0] = 0;\n dp[1] = freqArr[1] > 0 ? freqArr[1] : 0;\n\n for(int i=2; i<=1000; i++){\n dp[i] = Math.max(dp[i-2] + i*freqArr[i], dp[i-1]);\n }\n return dp[1000];\n }", "public static List<List<Integer>> combinationSum2(int[] candidates, int target) {\n Arrays.sort(candidates);\n List<List<List<Integer>>> dp = new ArrayList<>();\n Map<Integer, Integer> candMap = new HashMap<>();\n for (int i = 0; i < candidates.length; i++) {\n if (candidates[i] > target) break;\n if(candMap.containsKey(candidates[i])) candMap.put(candidates[i], candMap.get(candidates[i]) + 1);\n else candMap.put(candidates[i], 1);\n }\n for (int i = 1; i <= target; i++) {\n Set<List<Integer>> subCand = new HashSet<>();\n for (int j = 0; j < candidates.length && candidates[j] <= i; j++) {\n if (candidates[j] == i) subCand.add(Arrays.asList(i));\n else for (List<Integer> l : dp.get(i - 1 - candidates[j])) {\n if (candidates[j] <= l.get(0)) {\n List<Integer> cl = new ArrayList<>();\n cl.add(candidates[j]);\n cl.addAll(l);\n int cnt = 1;\n for (int a : l) {\n if(a == candidates[j]) cnt++;\n else break;\n }\n if(cnt <= candMap.get(candidates[j])) subCand.add(cl);\n }\n }\n }\n List<List<Integer>> subCandList = new ArrayList<>();\n subCandList.addAll(subCand);\n dp.add(subCandList);\n }\n return dp.get(target - 1);\n }", "public static void backtrack(int first, ArrayList<Integer> curr, int[] nums\n , List<List<Integer>> output, int n, int k) {\n if (curr.size() == k) {\n output.add(new ArrayList(curr));\n }\n for (int i = first; i < n; ++i) {\n // add i into the current combination\n curr.add(nums[i]);\n // use next integers to complete the combination\n backtrack(i + 1, curr, nums, output, n, k);\n // backtrack\n curr.remove(curr.size() - 1);\n }\n }", "private static int select (int[] arr, int p, int n, int k){\n //threshold of 17\n if(n < 17 ){\n insertionSort(arr, p, p+n-1);\n return arr[p + n - k];\n }else{\n int q = randomizedPartition(arr,p,p+n-1);\n int left = q-p;\n int right = n - left - 1;\n if(right >= k)\n return select(arr,q+1,right,k);\n else if(right + 1 == k )\n return arr[q];\n else\n return select(arr,p,left,k-right-1);\n }\n }", "private static <T> T choose(T opt1, T opt2) {\n\t\tint choice = randInt(1, 2);\n\t\tswitch (choice) {\n\t\tcase 1:\n\t\t\treturn opt1;\n\t\tcase 2:\n\t\t\treturn opt2;\n\t\tdefault:\n\t\t\tSystem.err.println(\"Error: Invalid choice: \" + choice);\n\t\t\treturn null;\n\t\t}\n\t}", "static void subsetSums(int arr[], int n)\n {\n \n // There are totoal 2^n subsets\n int total = 1 << n;\n \n // Consider all numbers from 0 to 2^n - 1\n for (int i = 0; i < total; i++) {\n int sum = 0;\n \n // Consider binary reprsentation of\n // current i to decide which elements\n // to pick.\n for (int j = 0; j < n; j++)\n if ((i & (1 << j)) != 0)\n sum += arr[j];\n \n // Print sum of picked elements.\n System.out.print(sum + \" \");\n }\n }", "public static long iterative (int n)\r\n {\r\n long mult=1;\r\n while(true)\r\n {\r\n if (n<1)\r\n throw new IllegalArgumentException(\"Number is non-positive!\");\r\n if (n==1)\r\n return (mult*n);\r\n mult=mult*n;\r\n n=n-1;\r\n }\r\n }", "public void sum2(int n){\n int sum =0; //1\n for (int j = 0; j < n; j++) //2n+2\n for (int k = 0; k < n; k++) //2n+2\n sum += k + j; //1\n for (int l = 0; l < n; l++) //2n+2\n sum += l; //1\n }", "private void combinationSum3(int[] candidates, int k, int i, int currentSum, int target, List<List<Integer>> response, List<Integer> temp) {\n if (temp.size() == k) {\n\n if (currentSum == target)\n response.add(new ArrayList<>(temp));\n\n\n return;\n }\n\n if (i == candidates.length)\n return;\n\n\n //1. Our choices: We can choose a number from the list any number of times and all the numbers\n for (int s = i; s < candidates.length; s++) {\n\n //if this element is greater than target, then adding it to current sum make bigger than target\n //since,elements are sorted, then all the element after this element are > target\n if (candidates[s] > target)\n break;\n\n //Our constraints : We can't go beyond target, we can take more element than available in array\n if (currentSum + candidates[s] <= target) {\n currentSum += candidates[s];\n temp.add(candidates[s]);\n\n combinationSum3(candidates, k, s + 1, currentSum, target, response, temp);\n\n //backtrack\n temp.remove(temp.size() - 1);\n currentSum -= candidates[s];\n }\n }\n\n }", "public Set<List<String>> getCombination(int[] inHand) {\n Set<List<String>> result = new HashSet<>();\n for (int i = 0; i < inHand.length; i++) {\n if (inHand[i] < 1) continue;\n int[] copyHand = copyArray(inHand);\n //possibility of A AA AAA\n for (int j = 1; j <= inHand[i]; j++) {\n if (j == 1) {\n String cSet = \"\";\n\n for (int seq = i; seq <= i + 2; seq++) {\n if (seq >= inHand.length || copyHand[seq] < 1) continue;\n cSet += seq;\n copyHand[seq] -= 1;\n }\n// System.out.println(\"i: \" + i + \" j: \" + j+\"inhand: \" + arrayToString\n// (inHand));\n\n Set<List<String>> a = getCombination(copyHand);\n Set<List<String>> newA = new HashSet<>();\n for (List<String> s : a) {\n s.add(cSet);\n s.sort(Comparator.naturalOrder());\n if (s.equals(\"\")) continue;\n newA.add(s);\n }\n result.addAll(newA);\n continue;\n }\n\n String currentSet = \"\";\n int[] copyOfInHand = copyArray(inHand);\n for (int t = 0; t < j; t++) {\n currentSet += i;\n }\n\n copyOfInHand[i] -= j;\n Set<List<String>> after = getCombination(copyOfInHand);\n Set<List<String>> newAfter = new HashSet<>();\n for (List<String> s : after) {\n s.add(currentSet);\n s.sort(Comparator.naturalOrder());\n newAfter.add(s);\n }\n result.addAll(newAfter);\n }\n }\n if (result.isEmpty()) result.add(new ArrayList<>());\n int min = result.stream().map(set -> set.size()).min(Comparator\n .naturalOrder()).get();\n Set<List<String>> minSets = result.stream().filter(set -> set.size() == min)\n .collect(Collectors\n .toSet());\n// combinationCache.put(inHand, minSets);\n return minSets;\n }", "public static void main(String[] args) throws IOException {\n\t\tbr = new BufferedReader(new FileReader(new File(\"input.txt\")));\r\n\t\tSystem.setOut(new PrintStream(new File(\"output.txt\")));\r\n\t\tint T = readInt();\r\n\t\t\r\n\t\tfor (int ind = 1; ind<=T; ind++) {\r\n\t\t\tSystem.out.print(\"Case #\" + ind + \": \");\r\n\t\t\t\r\n\t\t\tint N = readInt();\r\n\t\t\tint[] ar = readIntArr();\r\n\t\t\tfor (int i = 0; i < N; i++)ar[i]--;\r\n\t\t\tboolean used[] = new boolean[N];\r\n\t\t\tint ans = 0;\r\n\t\t\tint pairMax = 0;\r\n\t\t\tint cycleMax = 0;\r\n\t\t\tint cyclePair = 0;\r\n\t\t\tint pair = 0;\r\n\t\t\tfor (int i = 0; i < N; i++) {\r\n\t\t\t\tif (!used[i]) {\r\n\t\t\t\t\tList<Integer> list = new LinkedList<Integer>();\r\n\t\t\t\t\tlist.add(i);\r\n\t\t\t\t\tused[i] = true;\r\n\t\t\t\t\tint j = ar[i];\r\n\t\t\t\t\twhile(!list.contains(j) && !used[j]) {\r\n\t\t\t\t\t\tlist.add(j);\r\n\t\t\t\t\t\tused[j] = true;\r\n\t\t\t\t\t\tj = ar[j];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!list.contains(j))continue;\r\n\t\t\t\t\tif (list.size() == 2)pair++;\r\n\t\t\t\t\tboolean removed = false;\r\n\t\t\t\t\twhile(list.get(0) != j){list.remove(0);removed = true;}\r\n\t\t\t\t\tif (list.size() > 2 && list.size() > cycleMax) cycleMax = list.size();\r\n\t\t\t\t\tif (list.size() == 2) {\r\n\t\t\t\t\t\tint a = list.remove(0);\r\n\t\t\t\t\t\tint b = list.remove(0);\r\n\t\t\t\t\t\tint tmp = 2;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tboolean us[] = new boolean[N];\r\n\t\t\t\t\t\t\tus[a] = true;\r\n\t\t\t\t\t\t\tus[b] = true;\r\n\t\t\t\t\t\t\t//System.out.println(\" test \" + a + b);\r\n\t\t\t\t\t\t\tSet<Integer> set = new HashSet<Integer>();\r\n\t\t\t\t\t\t\tset.add(a);\r\n\t\t\t\t\t\t\twhile (true) {\r\n\t\t\t\t\t\t\t\tboolean found = false;\r\n\t\t\t\t\t\t\t\tSet<Integer> tSet = new HashSet<Integer>();\r\n\t\t\t\t\t\t\t\tfor (int ii = 0; ii < N; ii++) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tif (!us[ii] && set.contains(ar[ii])) {\r\n\t\t\t\t\t\t\t\t\t\tus[ii] = true;\r\n\t\t\t\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\t\t\t\ttSet.add(ii);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (found)tmp++;\r\n\t\t\t\t\t\t\t\tif (!found)break;\r\n\t\t\t\t\t\t\t\tset.addAll(tSet);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tset = new HashSet<Integer>();\r\n\t\t\t\t\t\t\tset.add(b);\r\n\t\t\t\t\t\t\twhile (true) {\r\n\t\t\t\t\t\t\t\tboolean found = false;\r\n\t\t\t\t\t\t\t\tSet<Integer> tSet = new HashSet<Integer>();\r\n\t\t\t\t\t\t\t\tfor (int ii = 0; ii < N; ii++) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tif (!us[ii] && set.contains(ar[ii])) {\r\n\t\t\t\t\t\t\t\t\t\tus[ii] = true;\r\n\t\t\t\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\t\t\t\ttSet.add(ii);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(found)tmp++;\r\n\t\t\t\t\t\t\t\tif (!found)break;\r\n\t\t\t\t\t\t\t\tset.addAll(tSet);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//if (removed) {\r\n\t\t\t\t\t\t//\tif (tmp > cyclePair)cyclePair = tmp;\r\n\t\t\t\t\t\t//} else {\r\n\t\t\t\t\t\t pairMax += tmp;\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//cyclePair += 2 * pair;\r\n\t\t\t//if (pair > 1) pairMax += 2 * (pair - 1);\r\n\t\t\tans = Math.max(cyclePair, pairMax);\r\n\t\t\tans = Math.max(cycleMax, ans);\r\n\t\t\tSystem.out.println(ans);\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\r\n\t}", "private static int combinationRecursive(int n, int k) {\n\t\tif (k == 0 || n == k) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn (int)(n/(double)k) * combinationRecursive(n-1, k-1);\n\t\t}\n\t}", "@Override\n\tprotected void computeWithoutTime() {\n\t\tinitShortestPaths();\n\n\t\t// Then we sort for each node v the list of terminals by the distance from v\n\t\tsortedRequiredVertices = new HashMap<Integer, TreeSet<Integer>>();\n\t\tsortRequiredVertices();\n\t\t\n\t\t// Copy of the terminals\n\t\tHashSet<Integer> req = new HashSet<Integer>(\n\t\t\t\tinstance.getRequiredVertices());\n\n\t\t// Union of all the solutions returned by the subalgorithm CH2\n\t\tHashSet<Arc> currentSol = new HashSet<Arc>();\n\n\t\t// Until all terminals are reached\n\t\twhile (req.size() > 0) {\n\n\t\t\t// We apply CH2 to reach some of the non reached terminals\n\t\t\tCouple<HashSet<Arc>, HashSet<Integer>> tree = applyCH2(req);\n\n\t\t\t// tree.first the tree returned by CH2\n\t\t\t// tree.second is the terminals of that tree\n\n\t\t\tcurrentSol.addAll(tree.first);\n\t\t\tfor (Arc a : tree.first)\n\t\t\t\tcosts.put(a, 0); // Set the cost of the arc to 0, as this arc is already used in the solution, it does not cost anything to use it again.\n\t\t\treq.removeAll(tree.second);\n\t\t}\n\n\t\t// Compute the returned solution and its cost.\n\t\tarborescence = new HashSet<Arc>();\n\t\tint c = 0;\n\t\tfor (Arc a : currentSol) {\n\t\t\tList<Arc> l = shortestPaths.get(a);\n\t\t\tif (a.getInput().equals(a.getOutput()))\n\t\t\t\tl = new ArrayList<Arc>();\n\t\t\tfor (Arc b : l) {\n\t\t\t\tarborescence.add(b);\n\t\t\t\tc += instance.getCost(b);\n\t\t\t}\n\t\t}\n\t\tcost = c;\n\t}", "public List<List<Integer>> getCandidateA(int nStartVal, int k, int n) {\n \tint nMin; \r\n \tint nMax; \r\n \tint i;\r\n \tList<List<Integer>> lstlstCombSum = new ArrayList<List<Integer>>();\r\n List<Integer> lstResult = new ArrayList<Integer>();\r\n \t\r\n \tif (nStartVal > n || k == 0) return lstlstCombSum;\r\n \t\r\n \tif (k == 1) {\r\n \t\tif (n > 9) return lstlstCombSum;\r\n \t\tlstResult.add(n);\r\n \t\tlstlstCombSum.add(lstResult);\r\n \t\treturn lstlstCombSum;\r\n \t}\r\n \t\r\n \tnMin = nStartVal;\r\n \tnMax = (int) (n - (k-1)*k/2)/k; //Max value occurs when the remaining numbers are: x (the maxvalue), x+1, x+2 ... x+k-1 (the sum should be n)\r\n \t\r\n \tfor (i = nMin; i <= nMax; i++) { //Possible value of the first\r\n \t\tList<List<Integer>> lstlstCombSumTmp = new ArrayList<List<Integer>>();\r\n \t\tlstlstCombSumTmp = getCandidateA(i+1, k-1, n-i);\r\n \t\t\r\n \t\tif (lstlstCombSumTmp.isEmpty()) continue;\r\n \t\t\r\n \t\tfor (List<Integer> lstOneCombSum:lstlstCombSumTmp) {\r\n \t\t\tlstOneCombSum.add(0, i);\r\n \t\t\tlstlstCombSum.add(lstOneCombSum);\r\n \t\t}\r\n \t\t\r\n \t}\r\n \t\r\n \treturn lstlstCombSum;\r\n }", "private static int determineSequence(int n) {\n\n // If the value is 1 or 2 (base case)\n if (n == 1 || n == 2) {\n return 1;\n } else {\n return determineSequence(n - 1) + determineSequence(n - 2);\n }\n }", "private static void dp() {\n\t\tm[0] = 0;\n\t\tk[0] = 0;\n\n\t\t// base case 1:for 1 cent we need give 1 cent\n\t\tm[1] = 1;\n\t\tk[1] = 1;\n\n\t\tfor (int i = 2; i <= n; i++) {\n\t\t\tint min = Integer.MAX_VALUE;\n\t\t\tint sel = -1;\n\t\t\tfor (int j = 0; j < sd; j++) {\n\t\t\t\tint a = d[j];\n\t\t\t\tif (a > i) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint v = 1 + m[i - a];\n\t\t\t\tif (v < min) {\n\t\t\t\t\tmin = v;\n\t\t\t\t\tsel = a;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (sel == -1)\n\t\t\t\tthrow new NullPointerException(\"sel != -1\");\n\t\t\tm[i] = min;\n\t\t\tk[i] = sel;\n\t\t}\n\t}", "public int generalSolution(int n, Set<Integer> x) {\n\t\treturn generalSolutionRecurse(n+1, x);\n\t}", "int tournament() {\r\n \tint ch1,ch2;\r\n\t\tch1 = (int)Math.floor(Math.random()*SIZE);\r\n\t\tdo {\r\n\t\t\tch2 = (int)Math.floor(Math.random()*SIZE);\r\n\t\t} while (ch1==ch2);\r\n\t\tif (fit[ch1]<fit[ch2]) return ch1;\r\n\t\telse return ch2;\r\n }", "public static long chooseUnordered(int n,int r) throws NumberOutOfLimitsException{\n \tif(r<0||n<0){\n \t\tthrow new NumberOutOfLimitsException();\n \t}\n \treturn choose(n,r)*factorial(r);\n }", "public static Tree solve() {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n Map<Integer, Set<Integer>> map = new HashMap<Integer,Set<Integer>>();\n int[] valArr = new int[n];\n int[] colArr = new int[n];\n for(int i =0;i<n;i++){\n valArr[i] = scan.nextInt();\n }\n for(int i =0;i<n;i++){\n colArr[i] = scan.nextInt();\n }\n for(int i=0;i<n-1;i++){\n //10^10 / 1024/ 1024/1024, 10GB\n int a = scan.nextInt()-1;\n int b = scan.nextInt()-1;\n \n //Tree[] treeArr = new Tree[n];\n if(map.containsKey(a)){\n map.get(a).add(b);\n }else{\n Set<Integer> set = new HashSet<Integer>();\n set.add(b);\n map.put(a,set);\n }\n //case 1-2, 2-1\n if(map.containsKey(b)){\n map.get(b).add(a);\n }else{\n Set<Integer> set = new HashSet<Integer>();\n set.add(a);\n map.put(b,set);\n } \n }\n Set<Integer> visited = new HashSet<Integer>();\n Tree root =buildTree(map,0,0,valArr,colArr);\n return root;\n }", "private ExpSem choose(AST.Expression exp, QvarSem qvar, ExpSem none, FunExpSem some)\n {\n if (qvar instanceof QvarSem.Single &&\n (none == null || none instanceof ExpSem.Single) &&\n some instanceof FunExpSem.Single)\n {\n QvarSem.Single qvar0 = (QvarSem.Single)qvar;\n ExpSem.Single none0 = (ExpSem.Single)none;\n FunExpSem.Single some0 = (FunExpSem.Single)some;\n if (translator.nondeterministic)\n return (ExpSem.Multiple)(Context c)-> \n {\n Seq<Value[]> v = qvar0.apply(c);\n // if (v.get() == null)\n // {\n // if (none0 == null)\n // return Seq.empty();\n // else\n // return Seq.cons(none0.apply(c), Seq.empty());\n // }\n // return v.apply((Value[] v1)->some0.apply(v1).apply(c));\n if (none0 == null)\n return v.apply((Value[] v1)->some0.apply(v1).apply(c));\n else\n return Seq.append(v.apply((Value[] v1)->some0.apply(v1).apply(c)),\n Seq.supplier(()->new Seq.Next<Value>(none0.apply(c), Seq.empty())));\n };\n else\n return (ExpSem.Single)(Context c)-> \n {\n Main.performChoice();\n Seq<Value[]> v = qvar0.apply(c);\n Seq.Next<Value[]> next = v.get();\n if (next == null) \n {\n if (none0 == null)\n {\n translator.runtimeError(exp, \"no choice possible\");\n return null;\n }\n else\n return none0.apply(c);\n }\n else\n return some0.apply(next.head).apply(c);\n };\n }\n else\n {\n QvarSem.Multiple qvar0 = qvar.toMultiple();\n FunExpSem.Multiple some0 = some.toMultiple();\n ExpSem.Multiple none0 = none == null ? null : none.toMultiple();\n return (ExpSem.Multiple)(Context c)->\n {\n Seq<Seq<Value[]>> result = qvar0.apply(c);\n return result.applyJoin((Seq<Value[]> v)->\n {\n if (v.get() == null) \n {\n if (none0 == null)\n return Seq.empty();\n else\n return none0.apply(c);\n }\n return v.applyJoin((Value[] v1)->some0.apply(v1).apply(c));\n });\n };\n }\n }", "public static int iterativeFactDP(int n){\n int[] table = new int[n+1];\n table[0] = 0;\n table[1] = 1;\n for (int i = 2; i <=n ; i++) {\n table[i] = table[i-2]+table[i-1];\n }\n return table[n];\n }", "public int stepOne(int step)\n\t{ \n\t\tint i,j; \n\t\tint min;\n\t\tfor(i=0; i<n; i++) \n\t\t{ \n\t\t\tmin=cost[i][0];\n\t\t\tfor(j=0; j<n; j++)\n\t\t\t {\n\t\t\t\tif(cost[i][j]<min)\n\t\t\t\t{\n\t\t\t\t\tmin = cost[i][j];\n\t\t\t\t}\t\t\t\t\t\t\n\t\t\t}\n\t\t\tfor (j=0; j<n;j++)\n\t\t\t{\n\t\t\t\tcost[i][j] = cost[i][j]- min;\n\t\t\t}\t\t\t\n\t\t}\n\t\tstep=2;\n\t\treturn step;\n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int T = sc.nextInt();\n int[] arr = new int[N];\n int[][] cases = new int[T][2];\n for(int i = 0; i < N; i++){\n arr[i] = sc.nextInt();\n }\n for(int i = 0; i < T; i++){\n cases[i][0] = sc.nextInt();\n cases[i][1] = sc.nextInt();\n }\n for(int i = 0; i < T; i++){\n int result = 3;\n for(int j = cases[i][0]; j <= cases[i][1]; j++){\n result = Math.min(result, arr[j]);\n }\n System.out.println(result);\n }\n }", "public static int getBetterApproach(int n){\n\t\t\n\t\tint t[] = new int[n+1];\n\t\t\n if(n<=2)\n return n;\n \n\t\tt[0] = 0;\n\t\tt[1] = 1;\n\t\tt[2] = 2;\n\t\tfor(int i = 3;i<=n;i++){\n\t\t\tt[i] = t[i-1] + t[i-2];\n\t\t}\n\t\treturn t[n];\n\t}", "public Ruteo procedimientoIterativoGrasp(Auxiliar a){\n\t\t double time1= System.currentTimeMillis();\n\t\t\n\t\tDouble mejorCosto=9999999999999999.9;\n\t\tRuteo mejorRuteo=null;\n\t\tlistaSetCovering=new ArrayList<Ruta>();\n\t\tfor(int i=0;i<k;i++){\n\t\t\tHeuristicasTSPManagger h=new HeuristicasTSPManagger();\n\t\t\tList<Obra>tsp=h.CWJPC();\n\n\t\t\tList<Obra>tsp1=a.busquedaLocal(tsp);\n\t\t\n\t\t\tRuteo r2=a.split(tsp1);\n\t\t\tSystem.out.println(r2.rutas);\n\t\t\tlistaSetCovering.addAll(r2.rutas);\n\t\t\tif(mejorCosto>r2.costoTotal){\n\t\t\t\tmejorCosto=r2.costoTotal;\n\t\t\t\tmejorRuteo=r2;\n\t\t\t}\n\t\t}\n\t\t double time2= System.currentTimeMillis();\n\t\t tiempoComputacionalIterGrasp=(time2-time1)/(1000.0*k);\n\t\t tiempoComputacionalGrasp=(time2-time1)/(1000.0);\n\t\treturn mejorRuteo;\n\t}", "static int combination(int num1,int num2){\n\t return (fact(num1)/(fact(num2)*fact(num1-num2)));\n\t}", "public int solution2(int N) {\n\n int l = 0; // 2*l - r\n int r = 1; // 2*r - l\n\n return search2(l, r, N);\n }", "static int recursiva1(int n)\n\t\t{\n\t\tif (n==0)\n\t\t\treturn 10; \n\t\tif (n==1)\n\t\t\treturn 20; \n\t\treturn recursiva1(n-1) - recursiva1 (n-2);\t\t\n\t\t}", "private int choose_table( int [] ix_abs, int begin, int end ) {\n\t\tint i, max;\n\n\t\tmax = ix_max(ix_abs,begin,end);\n\n\t\tif(max == 0)\n\t\t\treturn 0;\n\n\t\tint choice0 = 0, choice1 = 0;\n\t\tint sum0 = 0, sum1 = 1;\n\n\t\tif(max<15) {\n\t\t\t/* try tables with no linbits */\n\n\t\t\tfor ( i = 0; i <= 14; i++){\n\t\t\t\tif ( xlen[i] > max ) {\n\t\t\t\t\tchoice0 = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsum0 = count_bit( ix_abs, begin, end, choice0 );\n\n\t\t\tswitch ( choice0 ) {\n\t\t\tcase 2:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 3 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 3;\n\t\t\t\tbreak;\n\n\t\t\tcase 5:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 6 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 6;\n\t\t\t\tbreak;\n\n\t\t\tcase 7:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 8 );\n\t\t\t\tif ( sum1 <= sum0 ) {\n\t\t\t\t\tchoice0 = 8;\n\t\t\t\t\tsum0 = sum1;\n\t\t\t\t}\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 9 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 9;\n\t\t\t\tbreak;\n\n\t\t\tcase 10:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 11 );\n\t\t\t\tif ( sum1 <= sum0 ) {\n\t\t\t\t\tchoice0 = 11;\n\t\t\t\t\tsum0 = sum1;\n\t\t\t\t}\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 12 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 12;\n\t\t\t\tbreak;\n\n\t\t\tcase 13:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 15 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 15;\n\t\t\t\tbreak;\n\t\t\tdefault: break;\n\t\t\t}\n\t\t} else {\n\t\t\t/* try tables with linbits */\n\t\t\tmax -= 15;\n\n\t\t\tchoice0 = 15;\n\t\t\twhile (linmax[choice0] < max)\n\t\t\t\tchoice0++;\n\n\t\t\tchoice1 = 24;\n\t\t\twhile (linmax[choice1] < max)\n\t\t\t\tchoice1++;\n\t\t\tsum0 = count_bit(ix_abs, begin, end, choice0);\n\t\t\tsum1 = count_bit(ix_abs, begin, end, choice1);\n\t\t\tif (sum1 < sum0)\n\t\t\t\tchoice0 = choice1;\n\t\t}\n\n\t\treturn choice0;\n\t}", "public void candidateSelection(int n, int k, int m) //method that gives political selectors the amount of people (nodes) to go\n {\n Node forward; //node that represents the selector going clockwise \n Node backward; //node that represents the selector going counter-clockwise\n forward = Head; //clockwise selector starts at the first node\n backward = Tail; //counter-clockwise selector starts at the last node\n writer.println(\" \");\n writer.println(\"N = \" + n + \", \" + \"k = \" + k + \", \" + \"m = \" + m);\n writer.println(\" \");\n writer.println(\"Output\");\n writer.println(\"------\");\n if (m > n) //if so that the counter-clockwise selector doesn't waste time circling\n { \n m = m % n;\n }\n if (k > n) //if so that the clockwise selector doesn't waste time circling\n { \n k = k % n;\n }\n while (cand > 0) //as long as the candidates in the circle are > 0\n {\n for (int x = n - 1; x > (n - m); x--) //iterates until backward is on the person m away\n {\n backward = backward.getPrev();\n }\n for (int x = 1; x < k; x++) //iterates until forward is on the the person k away\n {\n forward = forward.getNext();\n }\n if (forward.getData() == backward.getData()) //if the selectors end\n { //on the same person\n writer.println(forward.getData()); //only print once, for\n delete(forward.getData()); //they are worthy\n backward = backward.getPrev(); //but still remove them\n forward = forward.getNext(); //from the circle and set\n } //the selectors on the next candidates\n else \n {\n writer.println(forward.getData() + \" \" + backward.getData());\n delete(backward.getData()); //if the selectors aren't on the\n delete(forward.getData()); //same candidate, remove both\n forward = forward.getNext(); //for they are not worthy,\n backward = backward.getPrev(); //then move the selectors to the\n if (cand == 2) //next candidates\n {\n backward = backward.getPrev(); //resloves an error that I was suffering\n } //with the last 2 lines of output\n }\n }\n }", "private static int[] p2(int[] ar, int n) {\n int[] p2 = new int[n];\n Arrays.fill(p2, n);\n Stack<Integer> st = new Stack<>();\n for (int i = 0; i < n; i++) {\n while (st.size() != 0 && ar[i] < ar[st.peek()]) {\n p2[st.peek()] = i;\n st.pop();\n }\n st.push(i);\n }\n return p2;\n }", "private static int getPermutations(int n, int r) {\n\t\t\n\t\tif(r == 0)\n\t\t\treturn 1;\n\t\t\n\t\treturn (n * getPermutations(n-1 , r-1));\n\t}", "private static int fact(int n) {\n\t\tint prod = 1;\n\t\tfor (int i = 1; i <= n; prod *= i++)\n\t\t\t;\n\t\treturn prod;\n\t}", "private static long combination(int n, int r) {\n if (r > n || n <= 0 || r <= 0) {\n throw new IllegalArgumentException(\"r must be smaller than n and both n and r must be positive ints\");\n }\n long result = 1;\n for (int i = r + 1; i <= n; i++) {\n result = result * i;\n }\n long nMinusRFactorial = factorial(n - r);\n result = result / nMinusRFactorial;\n// System.out.println(\"C(\" + n + \", \" + r + \") = \" + result);\n return result;\n }", "public static BigRat arrangements(int n) {\n\t\t\t if (n < 3) return BR1;\n\t\t\t if (!arrangements_cache.containsKey(n)) {\n\t\t\t BigInteger sum = BigInteger.valueOf(0);\n\t\t\t for (int k = 1; k < n; k++) {\n\t\t\t sum = sum.add(\n\t\t\t choose(n, k)\n\t\t\t .multiply(BigInteger.valueOf(n-k).pow(n-k))\n\t\t\t .multiply(BigInteger.valueOf(k).pow(k))\n\t\t\t );\n\t\t\t }\n\t\t\t arrangements_cache.put(n, new BigRat(sum, BigInteger.valueOf(n)));\n\t\t\t }\n\t\t\t return arrangements_cache.get(n);\n\t\t\t }", "public void minimize() {\n D = new boolean[states.length][states.length];\r\n S = new ArrayList<ArrayList<HashSet<Point>>>(); // lol\r\n\r\n //noinspection ForLoopReplaceableByForEach\r\n for (int i = 0; i < states.length; i++) {\r\n ArrayList<HashSet<Point>> innerList = new ArrayList<HashSet<Point>>();\r\n\r\n //noinspection ForLoopReplaceableByForEach\r\n for (int j = 0; j < states.length; j++) {\r\n Arrays.fill(D[i], false);\r\n innerList.add(new HashSet<Point>());\r\n }\r\n S.add(innerList);\r\n }\r\n\r\n // 2. states with different acceptances are distinguishable\r\n for (int i = 0; i < states.length; i++) {\r\n for (int j = i + 1; j < states.length; j++) {\r\n if (acceptStates.contains(i) != acceptStates.contains(j)) {\r\n D[i][j] = true;\r\n }\r\n }\r\n }\r\n\r\n // 3. mark as possibly indistinguishable, enforce distinguishability\r\n for (int i = 0; i < states.length; i++) {\r\n for (int j = i + 1; j < states.length; j++) {\r\n // only pairs that are as of yet indistinguishable\r\n if (D[i][j]) {\r\n continue;\r\n }\r\n\r\n DFAState qi = states[i];\r\n DFAState qj = states[j];\r\n\r\n // one of the things being compared is unreachable\r\n if (qi == null || qj == null) {\r\n continue;\r\n }\r\n\r\n // helps emulate \"for any\"\r\n boolean distinguished = false;\r\n for (int k = 0; k < qi.transitions.size(); k++) {\r\n int m = qi.transitions.get(k);\r\n int n = qj.transitions.get(k);\r\n\r\n // if on the same letter, qm and qn move to distinguishable states\r\n if (D[m][n] || D[n][m]) {\r\n dist(i, j);\r\n distinguished = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!distinguished) {\r\n // qm and qn are indistinguishable\r\n for (int k = 0; k < qi.transitions.size(); k++) {\r\n int m = qi.transitions.get(k);\r\n int n = qj.transitions.get(k);\r\n\r\n if (m < n && !(i == m && j == n)) {\r\n S.get(m).get(n).add(new Point(i, j));\r\n } else if (m > n && !(i == n && j == m)) {\r\n S.get(n).get(m).add(new Point(i, j));\r\n }\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n mergeStates();\r\n }", "public static void main(String[] args) throws NumberFormatException, IOException {\n\r\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tint T = Integer.parseInt(br.readLine());\r\n\t\tStringTokenizer st;\r\n\t\tfor (int test_case = 1; test_case <= T; test_case++) {\r\n\t\t\tst = new StringTokenizer(br.readLine());\r\n\t\t\tN = Integer.parseInt(st.nextToken());\r\n\t\t\tK = Integer.parseInt(st.nextToken());\r\n\t\t\tst = new StringTokenizer(br.readLine());\r\n\t\t\tlist = new ArrayList[N + 1];\r\n\t\t\tfor (int i = 1; i <= N; i++) {\r\n\t\t\t\tlist[i] = new ArrayList<Integer>();\r\n\t\t\t}\r\n\t\t\tfor (int i = 1; i <= N; i++) {\r\n\t\t\t\tint k = Integer.parseInt(st.nextToken());\r\n\t\t\t\tlist[k].add(i);\r\n\t\t\t}\r\n//\t\t\tfor (int i = 1; i <= N; i++) {\r\n//\t\t\t\tfor (int j = 0; j < list[i].size(); j++)\r\n//\t\t\t\t\tSystem.out.print(i + \", \" + list[i].get(j) + \" \");\r\n//\t\t\t}\r\n//\t\t\tSystem.out.println();\r\n\r\n\t\t\tQueue<Integer> q;\r\n//\t\t\tfor(int i = 1; i<=N;i++) {\r\n//\t\t\t\tif(list[i].size()==0) {\r\n//\t\t\t\t\tq.add(i);\r\n//\t\t\t\t}\r\n//\t\t\t}\r\n\t\t\tint visited[];\r\n\t\t\tint answer = 0;\r\n\t\t\tfor (int i = 1; i <= N; i++) {// 각 굴에 대해서 인원 센다\r\n\t\t\t\tq = new LinkedList<Integer>();\r\n\t\t\t\tvisited = new int[N + 1];\r\n\t\t\t\tint count = K;\r\n//\t\t\t\tfor (int j = 1; j < K; j++) {// 지날 수 있는 굴의 최대갯수 K\r\n\t\t\t\tif (list[i].size() < 1) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tint idx;\r\n\t\t\t\tfor (int u = 0; u < list[i].size(); u++) {\r\n\t\t\t\t\tidx = list[i].get(u);\r\n\t\t\t\t\tq.add(idx);\r\n\t\t\t\t}\r\n\t\t\t\twhile (count > 0 && !q.isEmpty()) {\r\n\t\t\t\t\tidx = q.poll();\r\n\r\n\t\t\t\t\tfor (int m = 0; m < list[idx].size(); m++) {\r\n\r\n\t\t\t\t\t\tint dd = list[idx].get(m);\r\n\t\t\t\t\t\tif (visited[dd] == 0 && dd != i) {\r\n\t\t\t\t\t\t\tvisited[dd] = 1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tq.add(list[idx].get(m));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcount--;\r\n\r\n\t\t\t\t}\r\n//\t\t\t\t}\r\n\t\t\t\tfor (int e = 1; e <= N; e++) {\r\n\t\t\t\t\tif (visited[e] == 1)\r\n\t\t\t\t\t\tanswer++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"#\" + test_case + \" \" + answer);\r\n\r\n\t\t}\r\n\r\n\t}", "public static void main(String[] args) {\n int n = 7;\n int k = 4;\n\n iterativeCombinationAlgorithm(n, k);\n }", "private static int[] computePermutations(int n) {\n final int[] indexes = new int[n];\n for (int i = 0; i < n; i++) {\n indexes[i] = i;\n //indexes[i] = i + 1;\n }\n\n final int total = computePermutations(indexes, 0, n);\n System.out.println(\"# \" + np + \"; total = \" + total);\n\n return indexes;\n }" ]
[ "0.58167946", "0.58003527", "0.5750926", "0.5664892", "0.559232", "0.5523889", "0.5516424", "0.54569244", "0.53861296", "0.5376345", "0.5337263", "0.53330445", "0.528848", "0.52870256", "0.52558124", "0.5252926", "0.5204713", "0.52010036", "0.5198079", "0.51965123", "0.5193193", "0.51887816", "0.51796913", "0.5176652", "0.517325", "0.5171818", "0.5159574", "0.5158128", "0.5154097", "0.5153089", "0.51477545", "0.5147372", "0.5141871", "0.5140117", "0.5140116", "0.5129614", "0.5126867", "0.51263046", "0.5122867", "0.51218367", "0.51157504", "0.5110664", "0.51034725", "0.5095662", "0.5085462", "0.5080902", "0.5069072", "0.5067258", "0.50666785", "0.50605524", "0.5055342", "0.5054511", "0.5049925", "0.5038885", "0.5036543", "0.50323653", "0.5030034", "0.5028494", "0.5013796", "0.5006656", "0.49992555", "0.4996387", "0.49877888", "0.4986548", "0.4983532", "0.4981895", "0.4981871", "0.49813455", "0.4959855", "0.49569938", "0.49559346", "0.494654", "0.49451768", "0.49431032", "0.4935439", "0.49326745", "0.49290764", "0.4928423", "0.49259144", "0.49231777", "0.4917394", "0.49130064", "0.49111617", "0.49075866", "0.49072427", "0.49038884", "0.49029192", "0.49009535", "0.4900556", "0.48921558", "0.48901707", "0.48782325", "0.48779082", "0.4869712", "0.4864629", "0.48527515", "0.48464984", "0.48408788", "0.48406", "0.48398572", "0.4838904" ]
0.0
-1
Recursive choice Time: O(n1+n2) Space: O(1)
public ListNode mergeTwoListsRecursion(ListNode l1, ListNode l2) { if(l1==null)return l2; if(l2==null)return l1; if(l1.val<l2.val){ l1.next=mergeTwoListsRecursion(l1.next,l2); return l1; } else{ l2.next=mergeTwoLists(l1,l2.next); return l2; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static BigInteger choose(int n, int k) {\n\n\t\t\t if (k > n) return BI0;\n\t\t\t else if (k == 0 || n == k) return BI1;\n\t\t\t else if (k == 1 || k == n-1) return BigInteger.valueOf(n);\n\n\t\t\t List<Integer> nk = Arrays.asList(n, k);\n\t\t\t if (!choose_cache.containsKey(nk)) {\n\t\t\t BigInteger ntok = BI1;\n\t\t\t BigInteger ktok = BI1;\n\t\t\t int min = k;\n\t\t\t if ((n - k) < k) min = n - k;\n\t\t\t for (int i=1; i <= min; i++) {\n\t\t\t ntok = ntok.multiply(BigInteger.valueOf(n));\n\t\t\t ktok = ktok.multiply(BigInteger.valueOf(i));\n\t\t\t n -= 1;\n\t\t\t }\n\n\t\t\t choose_cache.put(nk, ntok.divide(ktok));\n\t\t\t }\n\t\t\t return choose_cache.get(nk);\n\t\t\t }", "private static int choose(int n, int k) {\n return factorial(n) / (factorial(k) * factorial(n - k));\n }", "public void findSubSeqWithGivenSum(int[] a, int n, int k, List<Integer> chosen) {\n\t\t// base case\n\t\t// Remaining sum == 0\n\t\tif (k == 0) {\n\t\t\tSystem.out.println(\"Combination found : \" + chosen);\n\t\t\treturn;\n\t\t}\n\n\t\t// if remaining elements == 0\n\t\tif (n == -1) {\n\t\t\tSystem.out.println(\"Hitting end\");\n\t\t\treturn;\n\t\t}\n\n\t\tList<Integer> withCurrent = new ArrayList<>();\n\t\twithCurrent.addAll(chosen);\n\t\twithCurrent.add(a[n]);\n\n\t\tList<Integer> withoutCurrent = new ArrayList<>();\n\t\twithoutCurrent.addAll(chosen);\n\n\t\t// If a[n] is chosen\n\t\tif (a[n] <= k)\n\t\t\tfindSubSeqWithGivenSum(a, n - 1, k - a[n], withCurrent);\n\n\t\tfindSubSeqWithGivenSum(a, n - 1, k, withoutCurrent);\n\n\t}", "public static long choose(int n,int r) throws NumberOutOfLimitsException{\n \tif(r<0||n<0){\n \t\tthrow new NumberOutOfLimitsException();\n \t}\n if(r==0||r==n){\n return 1;\n }else{\n return choose(n-1,r-1) + choose(n-1,r);\n }\n }", "private static int combinationRecursive(int n, int k) {\n\t\tif (k == 0 || n == k) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn (int)(n/(double)k) * combinationRecursive(n-1, k-1);\n\t\t}\n\t}", "public void explore(Node node, int nchoices) {\n /**\n * Solution strategy: recursive backtracking.\n */\n\n if (nchoices == graphSize) {\n //\n // BASE CASE\n //\n if (this.this_distance < this.min_distance || this.min_distance < 0) {\n // if this_distance < min_distance, this is our new minimum distance\n // if min_distance < 0, this is our first minimium distance\n this.min_distance = this.this_distance;\n\n\n printSolution();\n\n\n } else {\n printFailure();\n }\n\n } else {\n //\n // RECURSIVE CASE\n //\n Set<Node> neighbors = graph.adjacentNodes(node);\n for (Node neighbor : neighbors) {\n if (neighbor.visited == false) {\n\n int distance_btwn = 0;\n\n for (Edge edge : graph.edgesConnecting(node, neighbor)) {\n distance_btwn = edge.value;\n\n\n }\n\n\n // Make a choice\n\n this.route[nchoices] = neighbor;\n neighbor.visit();\n this.this_distance += distance_btwn;\n\n // Explore the consequences\n explore(neighbor, nchoices+ 1);\n\n // Unmake the choice\n\n this.route[nchoices] = null;\n neighbor.unvisit();\n this.this_distance -= distance_btwn;\n\n }\n\n // Move on to the next choice (continue loop)\n }\n\n\n } // End base/recursive case\n\n\n }", "private static Integer packDPRec(Integer capacity, List<Integer> weights, List<ItemDTO> items, Integer n, Integer[][] mem, List<Integer> optimalChoice) {\n // Base condition\n if (n == 0 || capacity <= 0)\n return 0;\n\n if (mem[n][capacity] != -1) {\n return mem[n][capacity];\n }\n\n if (weights.get(n - 1) > capacity) {\n // Store the value of function call\n // stack in table before return\n List<Integer> subOptimalChoice = new ArrayList<>();\n mem[n][capacity] = packDPRec(capacity, weights, items, n - 1, mem, subOptimalChoice);\n optimalChoice.addAll(subOptimalChoice);\n return mem[n][capacity];\n } else {\n // Return value of table after storing\n List<Integer> optimalChoiceIncluded = new ArrayList<>();\n List<Integer> optimalChoiceExcluded = new ArrayList<>();\n Integer valueIncluded = items.get(n - 1).getValue() + packDPRec(capacity - weights.get(n - 1), weights, items, n - 1, mem, optimalChoiceIncluded);\n Integer valueExcluded = packDPRec(capacity, weights, items, n - 1, mem, optimalChoiceExcluded);\n if (valueIncluded > valueExcluded) {\n optimalChoice.addAll(optimalChoiceIncluded);\n optimalChoice.add(items.get(n - 1).getId());\n mem[n][capacity] = valueIncluded;\n }else{\n optimalChoice.addAll(optimalChoiceExcluded);\n mem[n][capacity] = valueExcluded;\n }\n return mem[n][capacity];\n }\n }", "static int solve(int n) \n\t{ \n\t // base case \n\t if (n < 0) \n\t return 0; \n\t if (n == 0) \n\t return 1; \n\t \n\t return solve(n-1) + solve(n-3) + solve(n-5); \n\t}", "static int recursiva2(int n)\n\t\t{\n\t\t\tif (n==0)\n\t\t\treturn 10; \n\t\t\tif (n==1)\n\t\t\treturn 20;\n\t\t\tif (n==2)\n\t\t\treturn 30;\n\t\t\t\n\t\t\treturn recursiva2(n-1) + recursiva2 (n-2) * recursiva2 (n-3); \n\t\t}", "private static int betterSolution(int n) {\n return n*n*n;\n }", "static int recursiva1(int n)\n\t\t{\n\t\tif (n==0)\n\t\t\treturn 10; \n\t\tif (n==1)\n\t\t\treturn 20; \n\t\treturn recursiva1(n-1) - recursiva1 (n-2);\t\t\n\t\t}", "public static Tree solve() {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n Map<Integer, Set<Integer>> map = new HashMap<Integer,Set<Integer>>();\n int[] valArr = new int[n];\n int[] colArr = new int[n];\n for(int i =0;i<n;i++){\n valArr[i] = scan.nextInt();\n }\n for(int i =0;i<n;i++){\n colArr[i] = scan.nextInt();\n }\n for(int i=0;i<n-1;i++){\n //10^10 / 1024/ 1024/1024, 10GB\n int a = scan.nextInt()-1;\n int b = scan.nextInt()-1;\n \n //Tree[] treeArr = new Tree[n];\n if(map.containsKey(a)){\n map.get(a).add(b);\n }else{\n Set<Integer> set = new HashSet<Integer>();\n set.add(b);\n map.put(a,set);\n }\n //case 1-2, 2-1\n if(map.containsKey(b)){\n map.get(b).add(a);\n }else{\n Set<Integer> set = new HashSet<Integer>();\n set.add(a);\n map.put(b,set);\n } \n }\n Set<Integer> visited = new HashSet<Integer>();\n Tree root =buildTree(map,0,0,valArr,colArr);\n return root;\n }", "public static long chooseUnordered(int n,int r) throws NumberOutOfLimitsException{\n \tif(r<0||n<0){\n \t\tthrow new NumberOutOfLimitsException();\n \t}\n \treturn choose(n,r)*factorial(r);\n }", "private int optimize() {\n\t\t// items: Items sorted by value-to-weight ratio for linear relaxation\n\t\t// t: the decision vector being tested at each node\n\t\t// ws, vs, is, bs: stacks of weight, value, item id, whether bring item\n\t\t// p: stack pointer; i, b, weight, value: loop caches; best: max search\n\t\t// ss: stack size: Always <=2 children on stack for <=n-1 parents\n\t\tItem[] items = new Item[n];\n\t\tint ss = 2 * n;\n\t\tint[] itemsSorted = new int[n], t = new int[n], ws = new int[ss],\n\t\t\tvs = new int[ss], is = new int[ss], bs = new int[ss];\n\t\tint i, b, weight, value, best = 0, p = 0;\n\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titems[j] = new Item(j);\n\t\tArrays.sort(items);\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titemsSorted[j] = items[j].i();\n\t\titems = null; // For garbage collection.\n\n\t\t// Push item 0 onto the stack with and without bringing it.\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 1; p++;\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 0; p++;\n\n\t\twhile (p > 0) {\n\t\t\tp--; // Pop the latest item off the stack\n\t\t\ti = is[p]; b = bs[p];\n\t\t\tweight = ws[p] + w[i] * b;\n\t\t\tif (weight > k)\n\t\t\t\tcontinue;\n\t\t\tvalue = vs[p] + v[i] * b;\n\t\t\tif (bound(i, weight, value, itemsSorted) < best)\n\t\t\t\tcontinue;\n\t\t\tbest = Math.max(value, best);\n\t\t\tt[i] = b;\n\t\t\tif (i < n - 1) { // Push children onto stack w/ & w/o bringing item\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 1; p++;\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 0; p++;\n\t\t\t}\n\t\t\telse if (value >= best)\n\t\t\t\tSystem.arraycopy(t, 0, x, 0, n);\n\t\t}\n\t\treturn best;\n\t}", "private static <T> T choose(T opt1, T opt2) {\n\t\tint choice = randInt(1, 2);\n\t\tswitch (choice) {\n\t\tcase 1:\n\t\t\treturn opt1;\n\t\tcase 2:\n\t\t\treturn opt2;\n\t\tdefault:\n\t\t\tSystem.err.println(\"Error: Invalid choice: \" + choice);\n\t\t\treturn null;\n\t\t}\n\t}", "public static int bestApproach(int n) {\n \n if(n<=2){\n return n;\n }\n int a = 0;\n int b = 1;\n int c = 2;\n \n while(n-->2){\n a = b+c;\n b = c;\n c = a;\n }\n return a;\n }", "int fact(int n) {\n if (n <= 1)\n return 1;\n else\n return n * fact(n-1);\n}", "private void helper(int[] S, int k, int p, ArrayList<ArrayList<Integer>> result, ArrayList<Integer> set) {\n if(k==0) {\n result.add(set);\n return;\n }\n if(S.length-p>=k) {\n ArrayList<Integer> newSet = new ArrayList<Integer>(set);\n newSet.add(S[p]);\n helper(S, k-1, p+1, result, newSet); //if S[p] be choosen\n helper(S, k, p+1, result, set); // if S[p] not be choosen\n }\n\n }", "static long factorialRecurse(int n) {\r\n if (n == 0 || n == 1) {\r\n return 1;\r\n }\r\n return factorialRecurse(n - 1) * n;\r\n }", "public static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint t = s.nextInt();\n\t\twhile(t-->0)\n\t\t{\n\t\t\tint n = s.nextInt();\n\t\t\tint k = s.nextInt();\n\t\t\tint[] arr = new int[n];\n\t\t\tfor(int i=0;i<n;i++)\n\t\t\t\tarr[i] = s.nextInt();\n\t\t\tArrays.sort(arr);\n\t\t\tint[][] dp = new int[k+1][n+1];\n\t\t\tfor(int i=0;i<=k;i++)\n\t\t\t\tfor(int j=0;j<=n;j++)\n\t\t\t\t{\n\t\t\t\t\tif(i==0)\n\t\t\t\t\t\tdp[i][j] = 0;\n\t\t\t\t\telse if(j==0)\n\t\t\t\t\t\tdp[i][j] = -1;\n\t\t\t\t\telse if(i-arr[j-1]>=0)\n\t\t\t\t\t{\n\t\t\t\t\t\tint val1 = dp[i-arr[j-1]][j-1];\n\t\t\t\t\t\tint val2 = dp[i][j-1];\n\t\t\t\t\t\tif(val1!=-1 && val2!=-1)\n\t\t\t\t\t\t\tdp[i][j] = Math.min(1+val1,val2);\n\t\t\t\t\t\telse if(val1!=-1)\n\t\t\t\t\t\t\tdp[i][j] = 1+val1;\n\t\t\t\t\t\telse if(val2!=-1)\n\t\t\t\t\t\t\tdp[i][j] = val2;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdp[i][j] = -1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(dp[i][j-1]==-1)\n\t\t\t\t\t\t\tdp[i][j] = -1;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdp[i][j] = dp[i][j-1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif(dp[k][n]!=-1)\n\t\t\t\tSystem.out.println(dp[k][n]);\n\t\t\telse\n\t\t\t\tSystem.out.println(\"impossible\");\n\t\t}\n\t}", "int solve(int p, int current) {\n int id = getId(p, current);\n if (p >= 0 && memo.containsKey(id)) {\n return memo.get(id);\n }\n List<Integer> adjList = adj.get(current);\n int n = adjList.size();\n if (n == 0) {\n throw new RuntimeException();\n }\n if ((n == 2 && p >= 0) || (n == 1 && p < 0)) {\n // should cut the nodes under current\n int ans = getDepth(p, current) - 1;\n // System.out.println(\"ans(\" + p + \",\" + current + \")=\" + ans);\n memo.put(id, ans);\n return ans;\n }\n if (n == 1) {\n // System.out.println(\"ans(\" + p + \",\" + current + \")=nochild\");\n return 0;\n }\n int ans = Integer.MAX_VALUE;\n\n for (int i = 0; i < n; i++) {\n int a = adjList.get(i);\n if (a == p) {\n continue;\n }\n for (int j = i + 1; j < n; j++) {\n int b = adjList.get(j);\n if (b == p) {\n continue;\n }\n // try a & b combo\n int tmp = solve(current, a);\n tmp += solve(current, b);\n for (int k = 0; k < n; k++) {\n int c = adjList.get(k);\n if (c != a && c != b && c != p) {\n tmp += getDepth(current, c);\n }\n }\n ans = Math.min(ans, tmp);\n }\n }\n memo.put(id, ans);\n // System.out.println(\"ans(\" + p + \",\" + current + \")=\" + ans);\n return ans;\n }", "public static void main(String[] args){\n\t\t\n\t\tfor (int i = 0; i<999999;i++) results.add(0);\t\n\n\t\tsetChain(1L);\n\t\tboolean switcher = true;\n\t\t//while switch=true ... and once chain length is added to, switch = false\n \t\tlong best = 0L;\n\t\tint index=0;\n\t\t\t\n\t\tfor (long j = 1L; j < 1000000L; j++) {\n\n\t\t\tsetCur((int)j);\n\n\t\t\tfindChain(j);//} catch(Exception e){System.out.println(\"stackOverFlow :D\");}\n\t\t\tif (getChain() > best) {best = getChain(); index=getCur();}\n\t\t\t//now store results for later use if we come across that number.\n\t\t\tresults.set(getCur()-1, (int)getChain());\t\n\t\t\tsetChain(1L); //reset\n\t\t\t/* \t\n\t\t\tswitcher=true;\n\t\t\tint i = j;\n\t\t\twhile (switcher) {\n\n\t\t\t\tif (i==1) {//results.add(chainLength); \n\t\t\t\t\tif (chainLength > best) { best=chainLength; index = j;}\n\t\t\t \tchainLength=1; switcher=false;}\n\t\n\t\t\t\telse { i=recurse(i); chainLength++; }\t\n\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n//\t\t }\n\t\t}\n\t\tSystem.out.println(index);\n\t}", "public static int factorialiterativa(int n){\n if(n>0){\r\n factorialrecursiva(n-1);//LLAMO A LA RECURSIVA\r\n }else {\r\n return 1;\r\n }\r\nreturn factorialrecursiva(n-1);\r\n }", "private ExpSem choose(AST.Expression exp, QvarSem qvar, ExpSem none, FunExpSem some)\n {\n if (qvar instanceof QvarSem.Single &&\n (none == null || none instanceof ExpSem.Single) &&\n some instanceof FunExpSem.Single)\n {\n QvarSem.Single qvar0 = (QvarSem.Single)qvar;\n ExpSem.Single none0 = (ExpSem.Single)none;\n FunExpSem.Single some0 = (FunExpSem.Single)some;\n if (translator.nondeterministic)\n return (ExpSem.Multiple)(Context c)-> \n {\n Seq<Value[]> v = qvar0.apply(c);\n // if (v.get() == null)\n // {\n // if (none0 == null)\n // return Seq.empty();\n // else\n // return Seq.cons(none0.apply(c), Seq.empty());\n // }\n // return v.apply((Value[] v1)->some0.apply(v1).apply(c));\n if (none0 == null)\n return v.apply((Value[] v1)->some0.apply(v1).apply(c));\n else\n return Seq.append(v.apply((Value[] v1)->some0.apply(v1).apply(c)),\n Seq.supplier(()->new Seq.Next<Value>(none0.apply(c), Seq.empty())));\n };\n else\n return (ExpSem.Single)(Context c)-> \n {\n Main.performChoice();\n Seq<Value[]> v = qvar0.apply(c);\n Seq.Next<Value[]> next = v.get();\n if (next == null) \n {\n if (none0 == null)\n {\n translator.runtimeError(exp, \"no choice possible\");\n return null;\n }\n else\n return none0.apply(c);\n }\n else\n return some0.apply(next.head).apply(c);\n };\n }\n else\n {\n QvarSem.Multiple qvar0 = qvar.toMultiple();\n FunExpSem.Multiple some0 = some.toMultiple();\n ExpSem.Multiple none0 = none == null ? null : none.toMultiple();\n return (ExpSem.Multiple)(Context c)->\n {\n Seq<Seq<Value[]>> result = qvar0.apply(c);\n return result.applyJoin((Seq<Value[]> v)->\n {\n if (v.get() == null) \n {\n if (none0 == null)\n return Seq.empty();\n else\n return none0.apply(c);\n }\n return v.applyJoin((Value[] v1)->some0.apply(v1).apply(c));\n });\n };\n }\n }", "public int C(int n, int k) {\n\tif (choose[n][k] != -1)\n\t\treturn choose[n][k];\n\tint t = C(n-1,k-1) + C(n-1,k);\n\tchoose[n][k] = t;\n\treturn t;\n}", "public MyList<Integer> solve(int typeSelectFunc, MyList<Integer> coinValues, int amount){\n\t\tMyList<Integer> res = null;\n\n\t\t// -----------------------------\n\t\t// SET OF OPS\n\t\t// -----------------------------\n\n\t\t// OP1. Auxiliary variables:\n\n\t\t// We use 'candidates' as a MyList with the items that can be considered\n\t\t// by the selectionFunction.\n\t\tMyList<Integer> candidates = null;\n\t\tMyList<Integer> objFunValues = null;\n\n\t\t// We use res for storing the values of the items that will be in the knapsack\n\t\t//MyList<Integer> resValues = null;\n\n\t\t// We use 'capacityUsed' to state the amount of weight our bin contains\n\t\t// so far.\n\t\tint capacityUsed = 0;\n\n\t\t// OP1. We initialise all variables:\n\n\t\t// OP1.1. 'res' is initialised to be a list of the items that will be in\n\t\t// the knapsack\n\t\tres = new MyDynamicList<Integer>();\n\t\tcandidates = new MyDynamicList<Integer>();\n\t\tobjFunValues =new MyDynamicList<Integer>();\n\n\t\t// we copy all the items in the candidates list\n\t\tfor (int i = 0; i < coinValues.length(); i++) {\n\t\t\tcandidates.addElement(i, coinValues.getElement(i));\n\t\t}\n\n\n\t\t// OP2. We construct the final solution:\n\t\twhile (solutionTest(candidates) == false) {\n\t\t\t// OP2.1 Auxiliary variables:\n\t\t\t// We use 'itemSelected' to state the index of the candidate being\n\t\t\t// selected.\n\t\t\tint candidateSelected = -1;\n\n\t\t\t// OP2.1. We pick the most promising candidate\n\t\t\tswitch (typeSelectFunc) {\n\t\t\tcase 1:\n\t\t\t\tcandidateSelected = selectionFunctionDummy(candidates);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tcandidateSelected = selectionFunctionBiggestCoin(candidates);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\twhile (feasibilityTest(candidates.getElement(candidateSelected), amount, capacityUsed) == true) {\n\t\t\t\tres.addElement(res.length(), candidates.getElement(candidateSelected));\n\t\t\t\t//int n = (amount - capacityUsed) / candidates.getElement(candidateSelected);\n\t\t\t\t//capacityUsed = capacityUsed + candidates.getElement(candidateSelected) * n;\n\t\t\t\tcapacityUsed = capacityUsed + candidates.getElement(candidateSelected);\n\t\t\t\t\n\t\t\t}\n\n\t\t\tcandidates.removeElement(candidateSelected);\n\t\t}\n\n\t\t// OP3. We print the solution and its associated objective value\n\t\tobjFunValues = objectiveFunction(res, capacityUsed, amount);\n\t\tSystem.out.println(\"Solution:\");\n\t\t\n\t\tSystem.out.print(\"Coins to be givin in change:\");\n\t\tdisplayElements(res);\n\t\tp(\"accuracy = \" + objFunValues.getElement(0));\n\t\tp(\"number of coins used = \" + objFunValues.getElement(1));\n\t\t//p(\"Total number of coins used = \" + objFunValues.getElement(2));\n\t\t\n\t\t\n//\t\t\n////\t\tpNl(\"\\t\\t\\t\\t\\t\\t \");\n////\t\tfor(int i = 0; i < res.length(); i++) {\n////\t\t\tpNl(\"* \");\n////\t\t}\n////\t\tSystem.out.print(\"\\nNumber of coins to be givin:\");\n////\t\tdisplayElements(objFunValues);\n////\t\tp(\"\");\n\t\t// -----------------------------\n\t\t// Output Variable --> Return FinalValue\n\t\t// -----------------------------\n\t\treturn res;\n\t}", "public int recursive(int n) {\r\n //base case: return n if <= 1\r\n if (n <= 1) {\r\n return n;\r\n }\r\n //else return result of of two previous #s being added to each other\r\n return recursive(n - 1) + recursive(n - 2);\r\n }", "private static int determineSequence(int n) {\n\n // If the value is 1 or 2 (base case)\n if (n == 1 || n == 2) {\n return 1;\n } else {\n return determineSequence(n - 1) + determineSequence(n - 2);\n }\n }", "private static int getPermutations(int n, int r) {\n\t\t\n\t\tif(r == 0)\n\t\t\treturn 1;\n\t\t\n\t\treturn (n * getPermutations(n-1 , r-1));\n\t}", "@Override\n \tpublic Solution solve() {\n \t\tfor (int i = 0; i < n; i++) {\n \t\t\tnest[i] = generator.getSolution();\n \t\t}\n \n \t\tfor (int t = 0; t < maxGeneration; t++) { // While (t<MaxGeneration) or\n \t\t\t\t\t\t\t\t\t\t\t\t\t// (stop criterion)\n \t\t\t// Get a cuckoo randomly (say, i) and replace its solution by\n \t\t\t// performing random operations;\n \t\t\tint i = r.nextInt(n);\n \t\t\tSolution randomNest = nest[i];\n \t\t\t//FIXME: randomNest = solutionModifier.modify(nest[i]);\n \n \t\t\t// Evaluate its quality/fitness\n \t\t\tint fi = randomNest.f();\n \n \t\t\t// Choose a nest among n (say, j) randomly;\n \t\t\tint j = r.nextInt(n);\n \t\t\tint fj = f[j];\n \n \t\t\tif (fi > fj) {\n \t\t\t\tnest[i] = randomNest;\n \t\t\t\tf[i] = fi;\n \t\t\t}\n \n \t\t\tsort();\n \t\t\t// A fraction (pa) of the worse nests are abandoned and new ones are built;\n\t\t\tfor(i = n-toAbandon; i<n; i++) {\n \t\t\t\tnest[i] = generator.getSolution();\n \t\t\t}\n \t\t\t\n \t\t\t// Rank the solutions/nests and find the current best;\n \t\t\tsort();\n \t\t}\n \n \t\treturn nest[0];\n \t}", "private static int select (int[] arr, int p, int n, int k){\n //threshold of 17\n if(n < 17 ){\n insertionSort(arr, p, p+n-1);\n return arr[p + n - k];\n }else{\n int q = randomizedPartition(arr,p,p+n-1);\n int left = q-p;\n int right = n - left - 1;\n if(right >= k)\n return select(arr,q+1,right,k);\n else if(right + 1 == k )\n return arr[q];\n else\n return select(arr,p,left,k-right-1);\n }\n }", "private static long combination(int n, int r) {\n if (r > n || n <= 0 || r <= 0) {\n throw new IllegalArgumentException(\"r must be smaller than n and both n and r must be positive ints\");\n }\n long result = 1;\n for (int i = r + 1; i <= n; i++) {\n result = result * i;\n }\n long nMinusRFactorial = factorial(n - r);\n result = result / nMinusRFactorial;\n// System.out.println(\"C(\" + n + \", \" + r + \") = \" + result);\n return result;\n }", "@Test\n public void badChoicePunisher() {\n Edge[] edgelist = {new Edge(new int[] {1, 7}), new Edge(new int[] {1, 8}),\n new Edge(new int[] {7, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5})};\n timeMethod(edgelist, 8, 2);\n\n\n Edge[] edgelist1 = {new Edge(new int[] {1, 6}), new Edge(new int[] {1, 7}),\n new Edge(new int[] {6, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5})};\n timeMethod(edgelist1, 7, 1);\n\n Edge[] edgelist2 = {new Edge(new int[] {1, 6}), new Edge(new int[] {1, 7}),\n new Edge(new int[] {6, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5}), new Edge(new int[] {2, 8})};\n timeMethod(edgelist2, 8, 2);\n\n Edge[] edgelist3 = {new Edge(new int[] {1, 6}), new Edge(new int[] {1, 7}),\n new Edge(new int[] {6, 3}), new Edge(new int[] {3, 2}), new Edge(new int[] {2, 4}),\n new Edge(new int[] {2, 5})};\n timeMethod(edgelist3, 7, 1);\n }", "@Override\n\tpublic int chooseNum(TreeSet<Integer> avail) {\n\t\tIterator<Integer> iter = avail.descendingIterator();\n\t\t\n\t\tint i = iter.next();\n\t\t\n\t\t//Find a number which we previous have not chosen yet\n\t\twhile(prevChosen.contains(i)){\n\t\t\ti = iter.next();\n\t\t}\n\t\t\n\t\t//Add our chosen number to the list of chosen numbers\n\t\tprevChosen.add(i);\n\t\t\n\t\t//Return the chosen number\n\t\treturn i;\n\t}", "public int generalSolution(int n, Set<Integer> x) {\n\t\treturn generalSolutionRecurse(n+1, x);\n\t}", "private static void backtrackHelper(TreeNode current, int targetSum, List<TreeNode> path, List<List<Integer>> allPaths){\n if(current.left == null && current.right == null){\n if(targetSum == current.val){\n List<Integer> tempResultList = new ArrayList<>();\n // for(TreeNode node: path){\n // tempResultList.add(node.val);\n // }\n tempResultList.addAll(path.stream().mapToInt(o -> o.val).boxed().collect(Collectors.toList()));\n tempResultList.add(current.val);\n\n allPaths.add(tempResultList); // avoid reference puzzle\n }\n return;\n }\n\n // loop-recursion (Here only 2 choices, so we donot need loop)\n if(current.left != null){\n path.add(current);\n backtrackHelper(current.left, targetSum - current.val, path, allPaths);\n path.remove(current);\n }\n\n if(current.right != null){\n path.add(current);\n backtrackHelper(current.right, targetSum - current.val, path, allPaths);\n path.remove(current);\n }\n }", "private void combinationSum3(int[] candidates, int k, int i, int currentSum, int target, List<List<Integer>> response, List<Integer> temp) {\n if (temp.size() == k) {\n\n if (currentSum == target)\n response.add(new ArrayList<>(temp));\n\n\n return;\n }\n\n if (i == candidates.length)\n return;\n\n\n //1. Our choices: We can choose a number from the list any number of times and all the numbers\n for (int s = i; s < candidates.length; s++) {\n\n //if this element is greater than target, then adding it to current sum make bigger than target\n //since,elements are sorted, then all the element after this element are > target\n if (candidates[s] > target)\n break;\n\n //Our constraints : We can't go beyond target, we can take more element than available in array\n if (currentSum + candidates[s] <= target) {\n currentSum += candidates[s];\n temp.add(candidates[s]);\n\n combinationSum3(candidates, k, s + 1, currentSum, target, response, temp);\n\n //backtrack\n temp.remove(temp.size() - 1);\n currentSum -= candidates[s];\n }\n }\n\n }", "public static void backtrack(int first, ArrayList<Integer> curr, int[] nums\n , List<List<Integer>> output, int n, int k) {\n if (curr.size() == k) {\n output.add(new ArrayList(curr));\n }\n for (int i = first; i < n; ++i) {\n // add i into the current combination\n curr.add(nums[i]);\n // use next integers to complete the combination\n backtrack(i + 1, curr, nums, output, n, k);\n // backtrack\n curr.remove(curr.size() - 1);\n }\n }", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "int pickTree(String actionStr)\r\n\t{\r\n\t\tboolean endLoop = false;\r\n\t\tString choiceStr = \"\";\r\n\t\tint intChoice = -1;\r\n\t\t\r\n\t\tif(createdTrees.isEmpty())\r\n\t\t{\r\n\t\t\tSystem.out.println(\"No trees created. Please build a tree first.\");\r\n\t\t\treturn -1;\r\n\t\t}\r\n\r\n\t\tdo\r\n\t\t{\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"Which tree to \" + actionStr + \"?: (1 to \" + createdTrees.size() + \")\");\r\n\t\t\t\tchoiceStr = lineReader.nextLine();\r\n\t\t\t\t\r\n\t\t\t\tif(false == choiceStr.matches(\"[+-]?\\\\d\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tSystem.out.println(\"Invalid choice. Please try again.\");\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tintChoice = Integer.parseInt(choiceStr);\r\n\t\t\t\t\r\n\t\t\t\tif((0 < intChoice) && (intChoice <= createdTrees.size()))\r\n\t\t\t\t{\r\n\t\t\t\t\tendLoop = true;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tSystem.out.println(\"Invalid choice. Please try again.\");\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch(NoSuchElementException|IllegalStateException|PatternSyntaxException|NumberFormatException e)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"Caught Exception: \" + e.getMessage());\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}while(false == endLoop);\r\n\t\t\r\n\t\treturn (intChoice-1);\r\n\t}", "public static BigInteger chooseBig(BigInteger n, BigInteger r) throws NumberOutOfLimitsException{\n \tif(r.compareTo(BigInteger.ZERO)<0||n.compareTo(BigInteger.ZERO)<0){\n \t\tthrow new NumberOutOfLimitsException();\n \t}\n \tif(r.equals(BigInteger.ZERO)||n.equals(r)){\n \t\treturn BigInteger.ONE;\n \t}else{\n \t\treturn chooseBig(n.subtract(BigInteger.ONE),r.subtract(BigInteger.ONE))\n \t\t.add(chooseBig(n.subtract(BigInteger.ONE),r));\n \t}\n }", "Optional<Pairof<X, MultiSet<X>>> choose();", "private static void solve2(Board bd) throws SolutionFoundException {\n\t\tst = new StackImage();\n\n\t\tdepth ++;\n\n\t\tif(depth < -1) {\n\t\t\tbd.checkForSolution();\n\t\t\tthrow new SolutionFoundException();\n\t\t}\n\n\t\tst.cnt = 0;\n\t\tfor( st.r=0;st.r<bd.getBoard_size();++st.r) \n\t\t\tfor( st.c=0;st.c<bd.getBoard_size(); ++st.c) {\n\t\t\t\tif(bd.getPossibilities(st.r, st.c) >= 1) {\n\n\t\t\t\t\tfor(st.p=0;st.p<bd.getBoard_size();++st.p) {\n\t\t\t\t\t\t//System.out.println(\"Status check \" + st.r + \" \" + st.c + \" \" + st.p + \" \" + (bd.check(st.r, st.c, st.p)) + \" \" + (bd.verify(st.r,st.c,st.p)));\n\t\t\t\t\t\tif(bd.check(st.r, st.c, st.p) && bd.verify(st.r,st.c,st.p)) {\n\t\t\t\t\t\t\tst.bi = bd.assign(st.r, st.c, st.p);\n\t\t\t\t\t\t\tSystem.out.println(\"CHoice at \" + st.r + \" \" + st.c + \" \" + st.p);\n\t\t\t\t\t\t\tmoves.add( st );\n\t\t\t\t\t\t\tsolve2(bd);\n\t\t\t\t\t\t\tst = moves.removeLast();\n\t\t\t\t\t\t\tbd.restore(st.r,st.c,st.bi);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t++st.cnt;\n\t\t\t\t\treturn;\n\t\t\t\t} else if(bd.getPossibilities(st.r, st.c) == 0 && !bd.isOnlyOne(st.r, st.c)) {\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t}\n\n\t\tif(st.cnt == 0) {\n\t\t\tbd.checkForSolution();\n\t\t\tthrow new SolutionFoundException();\n\t\t}\n\t\t--depth;\t\t\n\t\tst = null;\n\t}", "private int recursiveTopDown(int[] price, int n) {\n if( n== 0) return 0;\n int ans = Integer.MIN_VALUE;\n\n for (int i = 0; i < n; i++) {\n ans = Math.max(ans, price[i] + recursiveTopDown(price, n - 1 - i));\n }\n return ans;\n }", "public void candidateSelection(int n, int k, int m) //method that gives political selectors the amount of people (nodes) to go\n {\n Node forward; //node that represents the selector going clockwise \n Node backward; //node that represents the selector going counter-clockwise\n forward = Head; //clockwise selector starts at the first node\n backward = Tail; //counter-clockwise selector starts at the last node\n writer.println(\" \");\n writer.println(\"N = \" + n + \", \" + \"k = \" + k + \", \" + \"m = \" + m);\n writer.println(\" \");\n writer.println(\"Output\");\n writer.println(\"------\");\n if (m > n) //if so that the counter-clockwise selector doesn't waste time circling\n { \n m = m % n;\n }\n if (k > n) //if so that the clockwise selector doesn't waste time circling\n { \n k = k % n;\n }\n while (cand > 0) //as long as the candidates in the circle are > 0\n {\n for (int x = n - 1; x > (n - m); x--) //iterates until backward is on the person m away\n {\n backward = backward.getPrev();\n }\n for (int x = 1; x < k; x++) //iterates until forward is on the the person k away\n {\n forward = forward.getNext();\n }\n if (forward.getData() == backward.getData()) //if the selectors end\n { //on the same person\n writer.println(forward.getData()); //only print once, for\n delete(forward.getData()); //they are worthy\n backward = backward.getPrev(); //but still remove them\n forward = forward.getNext(); //from the circle and set\n } //the selectors on the next candidates\n else \n {\n writer.println(forward.getData() + \" \" + backward.getData());\n delete(backward.getData()); //if the selectors aren't on the\n delete(forward.getData()); //same candidate, remove both\n forward = forward.getNext(); //for they are not worthy,\n backward = backward.getPrev(); //then move the selectors to the\n if (cand == 2) //next candidates\n {\n backward = backward.getPrev(); //resloves an error that I was suffering\n } //with the last 2 lines of output\n }\n }\n }", "private boolean dfs(int n, int[] P) { // 0 is empty, 1 is false, 2 is true\n if (P[n] != 0) {\n if (P[n] == 1) {\n return false;\n }\n else {\n return true;\n }\n }\n\n if (n == 1) {\n P[1] = 2;\n //return true;\n }\n else if (n == 2) {\n P[2] = 2;\n //return true;\n }\n else if (n == 3) {\n P[3] = 1;\n //return false;\n }\n else {\n boolean res = dfs(n-2, P) && dfs(n-3, P) || dfs(n-3, P) && dfs(n-4, P);\n P[n] = res ? 2 : 1;\n }\n\n return P[n] == 2;\n\n //P[n] = P[n-2] + P[n-3] == 4 || P[n-3] + P[n-4] == 4 ? 2 : 1;\n //boolean res = dfs(n-2, P) && dfs(n-3, P) || dfs(n-3, P) && dfs(n-4, P);\n //P[n] = res ? 2 : 1;\n //return res;\n }", "protected abstract int quickSelect(Integer[] map, int right, int idx);", "private static long combinations(int n, int k) {\n\t\tif (k > n / 2) {\n\t\t\tk = n - k;\n\t\t}\n\n\t\tlong result = 1;\n\n\t\tfor (int i = 1, j = n - k + 1; i <= k; i++, j++) {\n\t\t\tresult = result * j / i;\n\t\t}\n\n\t\treturn result;\n\t}", "static int fact1(int n)\n {\n if(n == 0 || n == 1)\n return 1;\n return n * fact1(n-1);\n }", "public static void main(String[] args) {\n int n = 4;\n long[] coins1 = {1, 2, 3};\n runTestCase(n, coins1);\n /*\n Number of ways: 4\n Recursive: 4,595 ns\n Dynamic programming: 538,243 ns\n */\n\n // Test 2\n n = 10;\n long[] coins2 = {2, 3, 5, 6};\n runTestCase(n, coins2);\n /*\n Number of ways: 5\n Recursive: 6,057 ns\n Dynamic programming: 91,954 ns\n */\n\n // Test 3\n n = 100;\n long[] coins3 = {2, 3, 5, 6};\n runTestCase(n, coins3);\n /*\n Number of ways: 1163\n Recursive: 888,360 ns\n Dynamic programming: 3,817,729 ns\n */\n\n // Test 4\n n = 1000;\n long[] coins4 = {2, 3, 5, 6};\n runTestCase(n, coins4);\n /*\n Number of ways: 948,293\n Recursive: 804,397,007 ns\n Dynamic programming: 72,303,683 ns\n */\n\n // Test 5\n n = 2000;\n long[] coins5 = {2, 3, 5, 6};\n runTestCase(n, coins5);\n /*\n Number of ways: 7,496,697\n Recursive: 12,104,041,809 ns\n Dynamic programming: 112,009,974 ns\n */\n }", "private int choose_table( int [] ix_abs, int begin, int end ) {\n\t\tint i, max;\n\n\t\tmax = ix_max(ix_abs,begin,end);\n\n\t\tif(max == 0)\n\t\t\treturn 0;\n\n\t\tint choice0 = 0, choice1 = 0;\n\t\tint sum0 = 0, sum1 = 1;\n\n\t\tif(max<15) {\n\t\t\t/* try tables with no linbits */\n\n\t\t\tfor ( i = 0; i <= 14; i++){\n\t\t\t\tif ( xlen[i] > max ) {\n\t\t\t\t\tchoice0 = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsum0 = count_bit( ix_abs, begin, end, choice0 );\n\n\t\t\tswitch ( choice0 ) {\n\t\t\tcase 2:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 3 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 3;\n\t\t\t\tbreak;\n\n\t\t\tcase 5:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 6 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 6;\n\t\t\t\tbreak;\n\n\t\t\tcase 7:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 8 );\n\t\t\t\tif ( sum1 <= sum0 ) {\n\t\t\t\t\tchoice0 = 8;\n\t\t\t\t\tsum0 = sum1;\n\t\t\t\t}\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 9 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 9;\n\t\t\t\tbreak;\n\n\t\t\tcase 10:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 11 );\n\t\t\t\tif ( sum1 <= sum0 ) {\n\t\t\t\t\tchoice0 = 11;\n\t\t\t\t\tsum0 = sum1;\n\t\t\t\t}\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 12 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 12;\n\t\t\t\tbreak;\n\n\t\t\tcase 13:\n\t\t\t\tsum1 = count_bit( ix_abs, begin, end, 15 );\n\t\t\t\tif ( sum1 <= sum0 )\n\t\t\t\t\tchoice0 = 15;\n\t\t\t\tbreak;\n\t\t\tdefault: break;\n\t\t\t}\n\t\t} else {\n\t\t\t/* try tables with linbits */\n\t\t\tmax -= 15;\n\n\t\t\tchoice0 = 15;\n\t\t\twhile (linmax[choice0] < max)\n\t\t\t\tchoice0++;\n\n\t\t\tchoice1 = 24;\n\t\t\twhile (linmax[choice1] < max)\n\t\t\t\tchoice1++;\n\t\t\tsum0 = count_bit(ix_abs, begin, end, choice0);\n\t\t\tsum1 = count_bit(ix_abs, begin, end, choice1);\n\t\t\tif (sum1 < sum0)\n\t\t\t\tchoice0 = choice1;\n\t\t}\n\n\t\treturn choice0;\n\t}", "public static int solveEfficient(int n) {\n if (n == 0 || n == 1)\n return 1;\n\n int n1 = 1;\n int n2 = 1;\n int sum = 0;\n\n for (int i = 2; i <= n; i++) {\n sum = n1 + n2;\n n1 = n2;\n n2 = sum;\n }\n return sum;\n }", "private static int minCoins_my_way_one_coin_of_one_value_case(int[] coins, int startIndex, int endIndex, int amount) {\n\n if (coins.length == 0) return 0;\n\n if (startIndex == endIndex) {\n int currentCoin = coins[startIndex];\n\n if (currentCoin == amount) { // coins=(8) amount=8\n return 1;\n }\n if (currentCoin > amount) { // coins=(9) amount=8\n return 0;\n }\n if (currentCoin < amount) { // coins=(1) amount=8\n return 0; // this code changes when you can use infinite number of same coin\n }\n }\n\n // IMPORTANT:\n // Even though, amount is changing in recursive call, you don't need an exit condition for amount because amount will never become 0 or less than 0\n // amount is changing in recursive call when currentCoin < amount and it is doing amount-currentCoin. It means that amount will never become 0 or less than 0\n /*\n if (amount == 0) {\n return 0;\n }\n */\n\n int currentCoin = coins[startIndex];\n\n int minUsingCurrentCoin = 0;\n\n if (currentCoin == amount) {// coins=(8,9) amount=8\n // WRONG - if you see recursive call, you are trying to use remaining array (8) to make amount (8)\n // You are trying to make full amount using remaining array. It means that you will not be including currentCoin in coins that can make full amount.\n // Here, code should be all about including currentCoin in computation.\n /*\n minUsingCurrentCoin = 1\n int minUsingRemainingCoinsToMakeFullAmount = minCoins_my_way_one_coin_of_one_value_case(coins,startIndex+1, endIndex, amount)\n if(minUsingRemainingCoinsToMakeFullAmount > 0) {\n minUsingCurrentCoin = 1 + minUsingRemainingCoinsToMakeFullAmount\n }*/\n\n minUsingCurrentCoin = 1;\n } else if (currentCoin > amount) {// coins=(9,8) amount=8\n minUsingCurrentCoin = 0;\n // WRONG - if you see recursive call, you are trying to use remaining array (8) to make amount (8)\n // You are trying to make full amount using remaining array. It means that you will not be including currentCoin in coins that can make full amount.\n // Here, code should be all about including currentCoin in computation.\n // minUsingCurrentCoin = 0 + minCoins_my_way_one_coin_of_one_value_case(coins,startIndex+1, endIndex, amount);\n } else {\n /*\n case 1:\n coins = (1,6) amount=8\n currentCoin=1\n 1<8\n coinsRequiredUsingRemainingCoins=(6) to make amount (8-1=7) = 0\n coinsRequiredUsingRemainingCoinsAndAmount is 0, so by including current coin (1), you will not be able to make amount=8\n so, you cannot use (1) to make amount=8\n case 2:\n coins = (1,7) amount=8\n currentCoin=1\n 1<6\n coinsRequiredUsingRemainingCoins (7) And Amount (8-1=7) = 1\n so, coinsRequiredUsingCurrentCoin = 1 + coinsRequiredUsingRemainingCoinsAndAmount = 2\n\n */\n // this code changes when you can use infinite number of same coin\n int minUsingRestOfCoinsAndRestOfAmount = minCoins_my_way_one_coin_of_one_value_case(coins, startIndex + 1, endIndex, amount - currentCoin);\n if (minUsingRestOfCoinsAndRestOfAmount == 0) {\n minUsingCurrentCoin = 0;\n } else {\n minUsingCurrentCoin = 1 + minUsingRestOfCoinsAndRestOfAmount;\n }\n\n }\n\n // coins = (8,6) amount=8\n // minUsingCurrentCoin 8 to make amount 8 = 1\n // minWaysUsingRestOfTheCoins (6) to make amount 8 = 0\n // so, you cannot just blindly return Math.min(minUsingCurrentCoin, minWaysUsingRestOfTheCoins)\n // it will return 0 instead of 1\n int minWaysUsingRestOfTheCoins = minCoins_my_way_one_coin_of_one_value_case(coins, startIndex + 1, endIndex, amount);\n\n if (minWaysUsingRestOfTheCoins == 0 && minUsingCurrentCoin > 0) {\n return minUsingCurrentCoin;\n } else if (minWaysUsingRestOfTheCoins > 0 && minUsingCurrentCoin == 0) {\n return minWaysUsingRestOfTheCoins;\n }\n return Math.min(minUsingCurrentCoin, minWaysUsingRestOfTheCoins);\n\n }", "protected void SelectTournament() {\n\t // Torneo.length -> tournament size\n\t // if (tournament size == 2) then BinaryTournament\n this.setRanking();\n\t \n\t for (int i=0; i<this.PopLength; i++) {\n\t Torneo[0] = Randint(0,this.PopLength-1);\n\t int mejor_torneo=Torneo[0];\n\t \n\t for (int j=1; j<Torneo.length; j++) {\n\t boolean repetido= false;\n\t do {\n\t Torneo[j] = Randint(0,this.PopLength-1);\n\t repetido=false;\n\t int k=0;\n\t while ((k<j) && (!repetido))\n\t if (Torneo[j]==Torneo[k])\n\t repetido=true;\n\t else\n\t k++;\n\t } while (repetido);\n\t \n\t if (OLDevaluation[Torneo[j]] < OLDevaluation[mejor_torneo])\n\t mejor_torneo=Torneo[j];\n\t }\n\t sample[i] = mejor_torneo;\n\t }\n\t // Se crea la nueva poblacion\n\t for (int n=0; n<this.PopLength; n++) {\n\t int kk=sample[n];\n\t for (int m=0; m<this.NbGenes; m++) {\n\t NEWpopulation[n][m]= OLDpopulation[kk][m];\n\t }\n\t NEWevaluation[n]= OLDevaluation[kk];\n\t NEWevalIndex[n]= OLDevalIndex[kk];\n\t }\n }", "public boolean canPartition(int[] nums) {\n int sum = 0;\n int n = nums.length;\n for (int num : nums) sum += num;\n // sum cannot be splitted evenly\n if ((sum & 1) == 1) return false;\n int target = sum / 2;\n \n // dp[i][j] represents whether 0~i-1 numbers can reach\n // weight capacity j\n boolean[][] dp = new boolean[n+1][target+1];\n \n for (int i = 1; i <= n; i++) dp[i][0] = true;\n for (int j = 1; j <= target; j++) dp[0][j] = false;\n dp[0][0] = true;\n \n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= target; j++) {\n // if don't pick current number\n dp[i][j] = dp[i-1][j];\n if (j >= nums[i-1]) {\n dp[i][j] = dp[i][j] || dp[i-1][j-nums[i-1]];\n }\n }\n }\n return dp[n][target];\n \n \n // Solution2: optimizing to save space\n // https://leetcode.com/problems/partition-equal-subset-sum/discuss/90592/01-knapsack-detailed-explanation/94996\n int sum = 0;\n int n = nums.length;\n for (int num : nums) sum += num;\n if ((sum & 1) == 1) return false;\n int target = sum / 2;\n boolean[] dp = new boolean[target+1];\n dp[0] = true;\n for (int num : nums) {\n // here is the trick to save space\n // because we have to update dp[j] based on \n // previous dp[j-num] and dp[j] from previous loop.\n // if we update dp from left to right\n // we first update smaller dp which is dp[j-num]\n // then we won't be able to get original dp[j-num] and dp[j]\n // from previous loop, and eventually we get the wrong\n // answer. But if we update dp from right to left\n // we can assure everything is based on previous state\n for (int j = target; j >= num; j--) {\n // if (j >= num) {\n dp[j] = dp[j] || dp[j-num];\n // }\n }\n }\n return dp[target];\n }", "public <T> void getPossibleCombinationsOfPascal(List<T> aPossibleItems,\n List<T> aComboItems,\n int aStartIdx,\n int anEndIdx,\n int aCurrentIdx,\n int aChoiceSize,\n List<List<T>> aResults) {\n \n if (aCurrentIdx == aChoiceSize) {\n \n aResults.add(new ArrayList<T>(aComboItems));\n }\n else {\n \n if ( aStartIdx < anEndIdx) {\n \n aComboItems.set(aCurrentIdx, aPossibleItems.get(aStartIdx));\n this.getPossibleCombinationsOfPascal(aPossibleItems, \n aComboItems, \n aStartIdx+1, \n anEndIdx, \n aCurrentIdx+1, \n aChoiceSize, \n aResults);\n \n this.getPossibleCombinationsOfPascal(aPossibleItems, \n aComboItems, \n aStartIdx+1, \n anEndIdx, \n aCurrentIdx, \n aChoiceSize, \n aResults);\n }\n \n }\n\n }", "private static int f(int n, int complete, int other, int[] arr) {\n if(n<=0)\n return 0;\n int res=0;\n ArrayList<Integer>list=new ArrayList<Integer>();\n for(int a:arr)\n if(a>0)\n list.add(a);\n int brr[]=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n while(brr.length!=0){\n int index=0;\n for(int i=1;i<brr.length;i++)\n if(brr[index]<brr[i])\n index=i;\n for(int i=0;i<brr.length;i++){\n if(index==i)\n brr[i]-=complete;\n else\n brr[i]-=other;\n }\n list=new ArrayList<Integer>();\n for(int a:brr)\n if(a>0)\n list.add(a);\n brr=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n res++;\n }\n return res;\n }", "static int[] find2(int a[]){\r\n int sum = a[0];\r\n int pro = a[0];\r\n for(int i=1;i<a.length;i++){\r\n sum += a[i];\r\n pro += a[i]*a[i];\r\n }\r\n int s = (n*(n+1))/2 - sum;\r\n int p = (n*(n+1)*(2*n+1))/6 - pro;\r\n return solveSP(s, p);\r\n }", "public int R_M(){\n\t\tBigInteger nminus1=n.subtract(BigInteger.ONE);\n\t\tdo{\n\t\t\tif(nminus1.mod(two.pow(a)).equals(BigInteger.ZERO)){\n\t\t\t\ttable.add(a);\n\t\t\t}\n\t\t\titerator++;\n\t\t\ta++;\n\t\t}while(!(two.pow(a).compareTo(n)>0));\n\t\t\n\t\ta=table.get(table.size()-1);\n\t\tBigInteger m=nminus1.divide(two.pow(a));\n\t\tint wlen=n.bitLength();\n\t\tBigInteger b;\n\t\tBigInteger z;\n\t\tfor(int i=0;i<iterations;i++){\n\t\t\tint straznik=0;\n\t\t\tint straznik1=0;\n\t\t\tdo{\n\t\t\t b=new BigInteger(wlen,new Random());\n\t\t\t}while(!(b.compareTo(BigInteger.ONE)>0) && !(b.compareTo(nminus1)<0));\n\t\t\tz=b.modPow(m, n);\n\t\t\tif(z.equals(BigInteger.ONE) || z.equals(nminus1)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(int j=0;j<a-1;j++){\n\t\t\t\t\tz=z.pow(2).mod(n);\n\t\t\t\t\tif(z.equals(nminus1)){\n\t\t\t\t\t\tstraznik++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(z.equals(BigInteger.ONE)){\n\t\t\t\t\t\tstraznik1++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(straznik==1){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(straznik1==1){\n\t\t\t\t\tgetComposite();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\tgetComposite();\n\t\t\treturn 0;\n\t\t}\n\t\tgetProbablyPrime();\n\t\treturn 1;\n\t\t}", "public List<List<Integer>> findSubsequences2(int[] nums) {\n List<List<Integer>> ret = new ArrayList<>();\n Arrays.sort(nums);\n //remove set usages\n //let's do a permutation\n\n ret.add(new ArrayList<>());\n int index = 0;\n int new_added_length = 0;\n while (index < nums.length) {\n //try to add nums[index]\n int oldSize = ret.size();\n int cur_added_length = 0;\n\n int cur_start = 0;\n if (index > 0 && nums[index] == nums[index - 1]) {\n cur_start = oldSize - new_added_length;\n }\n for (int i = cur_start; i < oldSize; ++i) {\n List<Integer> pre = ret.get(i);\n if (pre.size() == 0 || pre.get(pre.size() - 1) <= nums[index]) {\n List<Integer> newList = new ArrayList<>(pre);\n newList.add(nums[index]);\n ret.add(newList);\n ++cur_added_length;\n }\n }\n\n new_added_length = cur_added_length;\n ++index;\n }\n\n\n List<List<Integer>> ret2 = new ArrayList<>();\n for (List<Integer> l : ret) {\n if (l.size() >= 2) {\n ret2.add(l);\n }\n }\n return ret2;\n }", "static int solveMemo(int n) \n\t{ \n\t // base case \n\t if (n < 0) \n\t return 0; \n\t if (n == 0) \n\t return 1; \n\t \n\t // checking if already calculated \n\t if (dp[n]!=-1) \n\t return dp[n]; \n\t \n\t // storing the result and returning \n\t return dp[n] = solveMemo(n-1) + solveMemo(n-3) + solveMemo(n-5); \n\t}", "private static BigInteger comprime(BigInteger input) {\n \t\n \t//krenemo od dva\n BigInteger candidate = BigInteger.valueOf(2);\n while (true) {\n \t\n \t//kada nadjemo odgovarajuci vratimo ga\n if (input.gcd(candidate).equals(BigInteger.ONE)) {\n return candidate;\n }\n candidate = candidate.add(BigInteger.ONE);\n }\n }", "public static int countUniqueCombinationsDP(int score) {\r\n /*\r\n * Return Type of DP array is same as return type of the recursive function\r\n * Dimensions of DP array is the number of non constant parameters to the recursive function\r\n */\r\n \t\r\n \t/*\r\n \t * Fn(s) = Fn(s-7) [if(s>=7)] + Fn(s-3) [if(s>=3)] + Fn(s-2) [if(s>=2)]\r\n\t\t * Fn(0) = 1\r\n\t\t * \r\n * F(11) = F(4) + F(8) + F(9)\r\n */\r\n \tint[][] comb = new int[score + 1][3];\r\n // int[] points = {2,3,7};\r\n \r\n // Halting Conditions\r\n comb[0][0] = 1;\r\n comb[0][1] = 1;\r\n comb[0][2] = 1;\r\n \r\n /*\r\n * Loop goes in the direction opposite to that of the recursion \r\n */\r\n for (int s = 1; s <= score; ++s) {\t\t// s is the score of the recursion\r\n \tfor (int p = 0; p < 3; ++p) {\r\n\t \tint total = 0;\r\n\t if (s >= 2 && p == 0)\r\n\t \ttotal = total + comb[s - 2][0];\r\n\t if (s >= 3 && p <= 1)\r\n\t \ttotal = total + comb[s - 3][1];\r\n\t if (s >= 7)\t\t\t// No need of condition p<=2; as it will always be true\r\n\t \ttotal = total + comb[s - 7][2];\r\n\t comb[s][p] = total;\r\n \t}\r\n }\r\n\r\n return comb[score][0];\r\n }", "static int utilityFunction(int choice, double[] finalRes) {\n\t\t// U(choice) = P(In loses to choice | history) - P(In wins to choice | history)\n\t\t// U(0) = P(2 | history) - P(1 | history)\n\t\t// U(1) = P(0 | history) - P(2 | history)\n\t\t// U(2) = P(1 | history) - P(0 | history)\n\t\tdouble u0, u1, u2;\n\t\tu0 = finalRes[2] - finalRes[1];\n\t\tu1 = finalRes[0] - finalRes[2];\n\t\tu2 = finalRes[1] - finalRes[0];\n\t\tRandom random = new Random();\n\t\t// If all three utilities are the same, randomize between the three\n\t\tif(u0 == u1 && u1 == u2)\n\t\t\treturn random.nextInt() % 3;\n\t\t// If two choices' utilities are the same, randomize between the two\n\t\telse if((u1 > u0 && u1 == u2) || (u2 > u0 && u2 == u1)) \n\t\t\treturn random.nextBoolean() ? 2 : 1;\n\t\telse if((u1 > u2 && u1 == u0)|| (u0 > u2 && u0 == u1)) \n\t\t\treturn random.nextBoolean() ? 0 : 1;\n\t\telse if((u2 > u1 && u2 == u0) || (u0 > u1 && u0 == u2)) \n\t\t\treturn random.nextBoolean() ? 2 : 0;\n\t\t// If one choice's utility is greater than the rest\n\t\telse if(u0 > u1 && u0 > u2) \n\t\t\treturn 0;\n\t\telse if(u1 > u2 && u1 > u0) \n\t\t\treturn 1;\n\t\t//(u2 > u0 && u2 > u1) \n\t\telse return 2;\n\t}", "public BigInteger calculateCombinations(long n, long r) {\n\t\treturn Factorial.factorial(n).divide(Factorial.factorial(r).multiply(Factorial.factorial(n-r)));\n\t}", "private int quickSelect(int[] arr, int n, int low, int high){\n\n int index = partition(arr, low, high);\n\n if (index - low == n - 1)\n return arr[index];\n\n if (index - low > n - 1)\n return quickSelect(arr, n, low, index - 1);\n\n return quickSelect(arr, n - index + low- 1,index + 1, high);\n }", "private static int factorial(int n) {\n if (n == 1 || n == 0)\n return 1;\n else\n return n * factorial(n - 1);\n }", "private int[] constructCandidates1(int n) {\n int cands[] = new int[subsetCount];\n for (int i = 0; i < subsetCount; i++) {\n cands[i] = i;\n }\n for (int i = 0; i < n; i++) { // Remove currently used sets in partialSol.\n cands[partialSol[i]] = DNU;\n }\n for (int i = 0; i < n; i++) {\n if (getDiff(cands, i, n) == 0) {\n cands[i] = DNU;\n }\n }\n int dnuCount = 0;\n for (int i = 0; i < cands.length; i++) {\n if (cands[i] == DNU) {\n dnuCount++;\n }\n }\n int[] ret = new int[cands.length - dnuCount];\n int retIndex = 0;\n for (int i = 0; i < cands.length; i++) {\n if (cands[i] != DNU) {\n ret[retIndex] = i;\n retIndex++;\n }\n }\n return sortCandidates(ret, n);\n// return ret;\n }", "private Stack<Select> selectionPathAux(JoinPointClass current, String joinPointName,\n ArrayList<JoinPointClass> visitedList, Set<JoinPointClass> ignoreSet, SelectionPathV2 selPath) {\n\n Stack<Select> path = new Stack<>();\n\n if (ignoreSet.contains(current) || visitedList.contains(current)) {\n\n return path;\n }\n\n final Select selected = select(current, joinPointName);\n if (selected != null) {\n\n path.push(selected);\n return path;\n }\n\n visitedList.add(current);\n\n // System.out.println(\"SELECTS: \" + current.getSelects());\n for (final Select select : current.getSelects()) {\n final JoinPointClass next = getJoinPoint(select);\n Stack<Select> pathAux = selectionPathAux(next, joinPointName, visitedList, ignoreSet, selPath);\n if (!pathAux.isEmpty()) {\n pathAux.add(select);\n if (selPath.hasSecondaryPath()) {\n selPath.getSecondaryPath().get().add(select);\n }\n if (!path.isEmpty()) {\n if (!alreadyFound) {\n selPath.setSecondaryPath(pathAux);\n selPath.setTieBreakReason(\"use the first path found (from a depth first search)\");\n // System.out.println(\n // \"More than one path for inital join point '\" + joinPointName + \"'. Two of then are: \");\n // Function<Pair<String, String>, String> converted = p -> {\n // if (p.getLeft().equals(p.getRight())) {\n // return p.getLeft();\n // }\n // return \"(\" + p.getRight() + \" as \" + p.getLeft() + \")\";\n // };\n //\n // System.out.println(\"\\t1. \" + StringUtils.join(path, converted, \".\"));\n // System.out.println(\"\\t2. \" + StringUtils.join(pathAux, converted, \".\"));\n //\n // System.out.println(\"Select uses a depth first search. Will use 1.\");\n alreadyFound = true;\n }\n break;\n }\n path = pathAux;\n } else {\n ignoreSet.add(next);\n }\n }\n visitedList.remove(current);\n\n return path;\n }", "private void helper(int n, List<Integer> cur, List<List<Integer>> result) {\n\t\tif (cur.size() == n) {\n\t\t\tresult.add(new ArrayList<Integer>(cur));\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t// check if putting a queen at column i at current row is valid.\n\t\t\tif (valid(cur, i)) {\n\t\t\t\tcur.add(i);\n\t\t\t\thelper(n, cur, result);\n\t\t\t\tcur.remove(cur.size() - 1);\n\t\t\t}\n\t\t} // end for\n\t}", "@Override\n public R visit(Constraint n, A argu) {\n R _ret = null;\n n.nodeChoice.accept(this, argu);\n return _ret;\n }", "@Override\n\tprotected void computeWithoutTime() {\n\t\tinitShortestPaths();\n\n\t\t// Then we sort for each node v the list of terminals by the distance from v\n\t\tsortedRequiredVertices = new HashMap<Integer, TreeSet<Integer>>();\n\t\tsortRequiredVertices();\n\t\t\n\t\t// Copy of the terminals\n\t\tHashSet<Integer> req = new HashSet<Integer>(\n\t\t\t\tinstance.getRequiredVertices());\n\n\t\t// Union of all the solutions returned by the subalgorithm CH2\n\t\tHashSet<Arc> currentSol = new HashSet<Arc>();\n\n\t\t// Until all terminals are reached\n\t\twhile (req.size() > 0) {\n\n\t\t\t// We apply CH2 to reach some of the non reached terminals\n\t\t\tCouple<HashSet<Arc>, HashSet<Integer>> tree = applyCH2(req);\n\n\t\t\t// tree.first the tree returned by CH2\n\t\t\t// tree.second is the terminals of that tree\n\n\t\t\tcurrentSol.addAll(tree.first);\n\t\t\tfor (Arc a : tree.first)\n\t\t\t\tcosts.put(a, 0); // Set the cost of the arc to 0, as this arc is already used in the solution, it does not cost anything to use it again.\n\t\t\treq.removeAll(tree.second);\n\t\t}\n\n\t\t// Compute the returned solution and its cost.\n\t\tarborescence = new HashSet<Arc>();\n\t\tint c = 0;\n\t\tfor (Arc a : currentSol) {\n\t\t\tList<Arc> l = shortestPaths.get(a);\n\t\t\tif (a.getInput().equals(a.getOutput()))\n\t\t\t\tl = new ArrayList<Arc>();\n\t\t\tfor (Arc b : l) {\n\t\t\t\tarborescence.add(b);\n\t\t\t\tc += instance.getCost(b);\n\t\t\t}\n\t\t}\n\t\tcost = c;\n\t}", "static int combination(int num1,int num2){\n\t return (fact(num1)/(fact(num2)*fact(num1-num2)));\n\t}", "private static int recursiveFibDP(int n) {\n\n Integer[] table = new Integer[n + 1];\n if(table[n]==null){\n if (n <= 1) {\n table[n] = n;\n }\n else {\n table[n] =recursiveFibDP(n-1)+recursiveFibDP(n-2);\n }\n }\n return table[n];\n }", "public void combineTwo(int n, int k) {\n // init first combination\n LinkedList<Integer> nums = new LinkedList<Integer>();\n for(int i = 1; i < k + 1; ++i)\n nums.add(i);\n nums.add(n + 1); //add as a sentinel\n\n List<List<Integer>> output = new ArrayList<>();\n int j = 0;\n //the while loop breaks when you have processed the first k combinations\n while (j < k) {\n // add current combination\n output.add(new LinkedList(nums.subList(0, k)));\n //\n // if nums[j] + 1 == nums[j + 1] increase nums[j] by one\n // the loop breaks when nums[j] + 1 != nums[j + 1]\n j = 0;\n while ((j < k) && (nums.get(j + 1) == nums.get(j) + 1))\n nums.set(j, j++ + 1);\n nums.set(j, nums.get(j) + 1); //increment the number at jth index\n }\n this.possibleCombinations = output;\n }", "private static void helper (int[] candidates,\n\t\t\t\t\t\t int remainTarget,\n\t\t\t\t\t\t int startPos,\n\t\t\t\t\t\t ArrayList<Integer> subset,\n\t\t\t\t\t\t List<List<Integer>> results) {\n\t\t//2. Exit, Judge bound\n\t\t//if (remainTarget < 0)\treturn;\t\t\t\t\t\t//Better to put the judgement inside the for loop\n\t\tif (remainTarget == 0) {\n\t\t\tresults.add(new ArrayList<Integer>(subset));\n\t\t\treturn;\t\t\t\t\t\t\t\t\t\t\t//Forgot to return here!!!\n\t\t}\n\t\t\n\t\t//3.\n\t\tfor (int i = startPos; i < candidates.length; i++) {\n\t\t\tif (remainTarget < candidates[i]) {\t\t\t\t//Since the nums has already sorted in descending order\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsubset.add(candidates[i]);\n\t\t\thelper(candidates, remainTarget - candidates[i], i, subset, results);\n\t\t\tsubset.remove(subset.size() - 1);\n\t\t}\n\t}", "static int numOfSubsets(int[] arr, int n, int k) {\n List<Integer> vect1 = new ArrayList<Integer>(); \n List<Integer> vect2 = new ArrayList<Integer>(); \n List<Integer> subset1 = new ArrayList<Integer>(); \n List<Integer> subset2 = new ArrayList<Integer>(); \n \n // ignore element greater than k and divide\n // array into 2 halves\n for (int i = 0; i < n; i++) {\n \n // ignore element if greater than k\n if (arr[i] > k)\n continue;\n if (i <= n / 2)\n vect1.add(arr[i]);\n else\n vect2.add(arr[i]);\n }\n \n // generate all subsets for 1st half (vect1)\n for (int i = 0; i < (1 << vect1.size()); i++) {\n int value = 1;\n for (int j = 0; j < vect1.size(); j++) {\n if (i & (1 << j))\n value *= vect1[j];\n }\n \n // add only in case subset product is less\n // than equal to k\n if (value <= k)\n subset1.add(value);\n }\n \n // generate all subsets for 2nd half (vect2)\n for (int i = 0; i < (1 << vect2.size()); i++) {\n int value = 1;\n for (int j = 0; j < vect2.size(); j++) {\n if (i & (1 << j))\n value *= vect2[j];\n }\n \n // add only in case subset product is\n // less than equal to k\n if (value <= k)\n subset2.add(value);\n }\n \n // sort subset2\n sort(subset2.begin(), subset2.end());\n \n int count = 0;\n for (int i = 0; i < subset1.size(); i++)\n count += upper_bound(subset2.begin(), subset2.end(),\n (k / subset1[i]))\n - subset2.begin();\n \n // for null subset decrement the value of count\n count--;\n \n // return count\n return count;\n }", "private static long calc1()\n {\n final int min = 1000;\n final int max = 10000;\n\n // initialize\n List<List<Integer>> m = new ArrayList<>();\n for (int k = 0; k < end; k++) {\n List<Integer> list = new ArrayList<Integer>();\n int n = 1;\n while (k >= start) {\n int p = pkn(k, n);\n if (p >= max) {\n break;\n }\n if (p >= min) {\n list.add(p);\n }\n n++;\n }\n m.add(list);\n }\n\n boolean[] arr = new boolean[end];\n arr[start] = true;\n\n List<Integer> solutions = new ArrayList<>();\n List<Integer> list = m.get(start);\n for (Integer first : list) {\n LinkedList<Integer> values = new LinkedList<>();\n values.add(first);\n f(m, arr, values, 1, solutions);\n // we stop at the first solution found\n if (!solutions.isEmpty()) {\n break;\n }\n }\n\n // solutions.stream().forEach(System.out::println);\n int res = solutions.stream().reduce(0, Integer::sum);\n return res;\n }", "public int factorial_2(int n) {\n // Base case: if n is 1, we can return the answer directly\n if (n == 1) return 1;\n\n // Recursion: otherwise make a recursive call with n-1\n // (towards the base case), i.e. call factorial(n-1).\n // Assume the recursive call works correctly, and fix up\n // what it returns to make our result.\n return n * factorial(n-1);\n }", "protected static int calcCombinations(int total, int selects){\n\t\t\n\t\tint combinations = 1; \n\t\tfor(int i=0; i<selects; i++)\n\t\t\tcombinations *= (total-i);\t\n\t\tfor(int i=1; i<=selects; i++)\n\t\t\tcombinations /= i; \n\t\treturn combinations ; \n\t}", "public static void combination(int n, int k) {\n\t\tSystem.out.print(n + \" choose \" + k + \" = \");\n\t\ttry {\n\t\t\tif (useFact)\n\t\t\t\tSystem.out.println(combinationFactorial(n, k));\n\t\t\telse\n\t\t\t\tSystem.out.println(combinationRecursive(n, k));\n\t\t} catch (ArithmeticException ex) {\n\t\t\tSystem.out.println(\"LOL!\");\n\t\t}\n\t}", "private static int coinChange(int[] arr,int n, int sum) {\n\t\tint[][] dp = new int[n+1][sum+1];\n\t\tfor(int i=0;i<n+1;i++) {\n\t\t\tdp[i][0]=1;\n\t\t}\n\t\tfor(int i=0;i<sum+1;i++) {\n\t\t\t\n\t\t\tif(i%arr[0]==0)\n\t\t\tdp[0][i]=i/arr[0];\n\t\t\telse\n\t\t\t\tdp[0][i]=0;\n\t\t}\n\t\t\n\t\tfor(int i=1;i<n+1;i++) {\n\t\t\tfor(int j=1;j<sum+1;j++) {\n\t\t\t\tif(arr[i-1]>j)\n\t\t\t\t\tdp[i][j]=dp[i-1][j];\n\t\t\t\telse\n\t\t\t\t\tdp[i][j]=Math.min(dp[i-1][j], dp[i][j-arr[i-1]]+1);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn dp[n][sum];\n\t}", "public int solution2(int N) {\n\n int l = 0; // 2*l - r\n int r = 1; // 2*r - l\n\n return search2(l, r, N);\n }", "private static int helper(TreeNode root, TreeNode p, TreeNode q, List<TreeNode> ans) {\n if (root == null)\n return 0;\n int sum = 0;\n if (root.val == p.val || root.val == q.val)\n ++sum;\n int leftSum = helper(root.left, p, q, ans);\n int rightSum = helper(root.right, p, q, ans);\n sum += leftSum + rightSum;\n if (sum == 2 && leftSum < 2 && rightSum < 2)\n ans.add(root);\n return sum;\n }", "public static void main(String[] args) {\n\t\tScanner ob=new Scanner(System.in);\n\t\tint n=ob.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ta[i]=ob.nextInt();\n\t\t}\n\t\tselectionRecursive(a,0);\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t}", "private static int factorial(int n) {\n if (n <= 0) {\n return 1;\n }\n\n return n * factorial(n - 1);\n }", "private static int recursion(int x) {\n\t\tif(x == 1) return 0;\n\n\t\tif(dp[x] != -1) return dp[x];\n\t\tint result = Integer.MAX_VALUE;\n\n\t\tif(x % 3 == 0) result = Math.min(recursion(x / 3), result);\n\t\tif(x % 2 == 0) result = Math.min(recursion(x >> 1), result);\n\t\tif(x >= 1) result = Math.min(recursion(x - 1), result);\n\n\t\treturn dp[x] = result + 1;\n\t}", "public int solution(int N) {\n\n int l = 0; // 2*l - r\n int r = 1; // 2*r - l\n\n return search(l, r, N);\n }", "public void player2(int sum) {\n\t\t// if sum itself is a choice\n\t\tif (sum <= 9 && choices[sum]) {\n\t\t\tchoices[sum] = false;\n\t\t\tsize--;\n\t\t} else {\n\t\t\t// choose Cover the Fewest Spaces (if sum is 1-9 and not flipped) choose that.\n\t\t\tList<int[]> res = getChoices(sum);\n\t\t\t// check if no sum res\n\t\t\tif (res.size() == 0) {\n\t\t\t\t// System.out.println(\"No Sum = \" + sum + \" You Lose!\");\n\t\t\t\tlose = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// pick a rand index form res.\n\t\t\tRandom rand = new Random();\n\t\t\tint randInd = rand.nextInt(res.size());\n\t\t\t// System.out.println(\"rand: \" + randInd + \" size \" + res.size());\n\t\t\tint[] choosed = res.get(randInd);\n\t\t\t// System.out.println(\"Sum \" + sum);\n\t\t\t// System.out.println(Arrays.toString(choosed));\n\t\t\t// flip the choosen\n\t\t\tchoices[choosed[0]] = false;\n \tchoices[choosed[1]] = false;\n \tsize -= 2;\n\t\t}\n\t\t// check for win\n\t\tif (size == 0) {\n\t\t\t// System.out.println(\"WIN!\");\n\t\t\twin = true;\n\t\t}\n\t}", "private static int coinExchange(int N, int[] S, int n) {\n\t\tif (N == 0)\n\t\t\treturn 1;\n\n\t\t// If N is less than 0 then no solution exists\n\t\tif (N < 0)\n\t\t\treturn 0;\n\n\t\t// If there are no coins and N is greater than 0, then no solution exist\n\t\tif (n <= 0 && N >= 1)\n\t\t\treturn 0;\n\n\t\tif (memo[n][N] != 0) {\n\t\t\tmemoHits++;\n\t\t\treturn memo[n][N];\n\t\t}\n\n\t\trecursionHits++;\n\n\t\tint retval = coinExchange(N - S[n - 1], S, n) + coinExchange(N, S, n - 1);\n\t\tmemo[n][N] = retval;\n\t\treturn retval;\n\t}", "int tournament() {\r\n \tint ch1,ch2;\r\n\t\tch1 = (int)Math.floor(Math.random()*SIZE);\r\n\t\tdo {\r\n\t\t\tch2 = (int)Math.floor(Math.random()*SIZE);\r\n\t\t} while (ch1==ch2);\r\n\t\tif (fit[ch1]<fit[ch2]) return ch1;\r\n\t\telse return ch2;\r\n }", "private static String subProcess(int[] n1, int[] n2) {\n\n\t\t// if n1.length is smaller than n2.length, we are going to be too small.\n\t\tif (n1.length < n2.length) {\n\t\t\treturn \"+\" + toString (n1);\n\t\t}\n\t\t\n\t\t// we have to extend, and reduce length. Note that this WILL terminate because\n\t\t// we would have left earlier if n2 were greater than n1.\n\t\tint off = 0;\n\t\tint length = n2.length;\n\t\twhile (compareTo(n2,0,length,n1,off) > 0) {\n\t\t\tn2 = expand(n2);\n\t\t\tlength = n2.length;\n\t\t\t\n\t\t\tif (length > n1.length) {\n\t\t\t\t// gone too far! We at last have our remainder! Return as \"+remainder\".\n\t\t\t\treturn \"+\" + toString(n1);\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tint []innerSum = new int[n1.length+1]; // add 1 just in case we get too high\n\t\tint []result = new int[length]; \n\t\tint start;\n\t\t\n\t\t// initial set.\n\t\tif (n2[0] == 0) { start = 9; } else { start = n1[0]/n2[0]; }\n\t\t\n\t\tmultiply(n2, start, innerSum);\n\t\tinnerSum = reduce(innerSum);\n\t\t\n\t\tif (innerSum.length < n2.length) {\n\t\t\t// perfect fit. Expand back out to work with subtractDown. REALLY UGLY CODE\n\t\t\tinnerSum = expand(innerSum);\n\t\t} else {\n\t\t\t// must reduce and continue....\n\t\t\twhile (n2.length < innerSum.length) {\n\t\t\t\tstart--; // had gone too far! Back down.\n\t\t\t\tinnerSum = new int[n1.length+1];\n\t\t\t\tmultiply (n2, start, innerSum);\n\t\t\t\tinnerSum = reduce(innerSum);\n\t\t\t}\n\t\t}\n\t\t\n\t\tboolean subtractDown = compareTo(innerSum, n1, innerSum.length) > 0; // if false, we have to add up\n\t\twhile (true) {\n\t\t\tif (subtractDown) {\n\t\t\t\tstart--;\n\t\t\t\tsubtract(innerSum, n2, result, subProcessSign);\n\t\t\t\tassign(innerSum, result);\n\t\t\t\t\n\t\t\t\tsubtractDown = compareTo(innerSum, n1, innerSum.length) > 0;\n\t\t\t} else {\n\t\t\t\t// found. Note that 'start' is the digit in the quotient. Subtract from and replace.\n\t\t\t\tint []newTop = new int[innerSum.length];\n\t\t\t\textract(newTop,0,n1,0,innerSum.length);\n\t\t\t\t\n\t\t\t\tresult = new int[innerSum.length];\n\t\t\t\tsubtract(newTop, innerSum, result, subProcessSign); \n\t\t\t\textract(n1,0,result,0,result.length); // copy back in\n\t\t\t\t\n\t\t\t\tint[]normalized_n1 = reduce(n1);\n\t\t\t\tint[]normalized_n2 = reduce(n2);\n\t\t\t\tString s = start + subProcess(normalized_n1, normalized_n2);\n\t\t\t\treturn s;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public void generate(ArrayList<List<Integer>> combos, int[] candidates,\n ArrayList<Integer> curr, int target, int sum,\n HashSet<ArrayList<Integer>> seen, int indx)\n {\n if (target == sum)\n {\n if (!seen.contains(curr))\n {\n ArrayList<Integer> entry = new ArrayList<Integer>(curr);\n seen.add(entry);\n combos.add(entry);\n }\n }\n else\n {\n for (int i = indx; i < candidates.length; ++i)\n {\n if (candidates[i] > target)\n {\n break;\n }\n else if (sum + candidates[i] <= target)\n {\n curr.add(candidates[i]);\n generate(combos, candidates, curr, target, sum + candidates[i], seen, i);\n curr.remove(curr.size() - 1);\n }\n }\n }\n }", "public static void main(String args[] ) throws Exception {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] seqArray = new int[n];\n for (int i = 0; i < n; i++) {\n seqArray[i] = scanner.nextInt();\n }\n // getSeqValue(seqArray); //this method is an accepted one on Hackerrank but time complexity is not order n; i.e. !O(n);\n getLinearOrderY(seqArray); // trying to get O(n) time complexity;\n }", "protected LinkedList<FunQuadruple> generateCandidates(List<FunQuadruple> lk) {\n\n LinkedList<FunQuadruple> lkPlus1 = new LinkedList<>();\n if (lk.isEmpty()) {\n return lkPlus1;\n }\n Set<ColumnCombinationBitset> subsets = new HashSet<>();\n int k = lk.get(0).candidate.size();\n ColumnCombinationBitset union = new ColumnCombinationBitset();\n for (FunQuadruple subsetQuadruple : lk) {\n // TODO optimise: all bits are set? --> break\n // If subsetQuadruple represents a unique do not add it to subsets and union (it should be pruned).\n if (subsetQuadruple.count == 0) {\n continue;\n }\n union = subsetQuadruple.candidate.union(union);\n subsets.add(subsetQuadruple.candidate);\n }\n\n Map<ColumnCombinationBitset, Integer> candidateGenerationCount = new HashMap<>();\n\n List<ColumnCombinationBitset> lkPlus1Candidates;\n FunQuadruple lkPlus1Member;\n for (ColumnCombinationBitset subset : subsets) {\n lkPlus1Candidates = union.getNSubsetColumnCombinationsSupersetOf(\n subset, k + 1);\n // FIXME add key conditional here\n // Removed key conditional - should not be triggerable?\n for (ColumnCombinationBitset candidate : lkPlus1Candidates) {\n if (candidateGenerationCount.containsKey(candidate)) {\n int count = candidateGenerationCount.get(candidate);\n count++;\n candidateGenerationCount.put(candidate, count);\n } else {\n candidateGenerationCount.put(candidate, 1);\n }\n }\n }\n\n for (ColumnCombinationBitset candidate : candidateGenerationCount\n .keySet()) {\n if (candidateGenerationCount.get(candidate) == (k + 1)) {\n lkPlus1Member = new FunQuadruple(candidate, addPliGenerate(\n candidate).getRawKeyError());\n lkPlus1.add(lkPlus1Member);\n }\n }\n return lkPlus1;\n }", "private int siguientePrimo(int n)\r\n {\r\n if (n%2 == 0) n++;\r\n for (; !esPrimo(n); n+=2);\r\n return n;\r\n }", "public static void findChain(long j) {\n\t\tif ((j<getCur()) && (results.get(((int)j)-1)!=0) && (j>0)){setChain(getChain()+results.get(((int)j)-1)); return;}\n\t\telse if (j==1L) return;\n\t\telse if ((j%2L)==0) {setChain(getChain()+1L); findChain(j/2L);}\n\t\telse {setChain(getChain()+1L); findChain(3L*j+1L);}\n\t\t//odd case will always be else ... right ... ?\n\t\t\n\t}", "public double run(int choice) {\n double startTime = System.nanoTime(); // we save the time at the start of calculation\n switch (choice) {\n case 1:\n bubbleSort(arr);\n break;\n case 2:\n selectionSort(arr);\n break;\n case 3:\n insertionSort(arr);\n break;\n case 4:\n new MergeSort().start(arr);\n break;\n case 5:\n new QuickSort().start(arr);\n break;\n default:\n throw new InputMismatchException();\n }\n return (System.nanoTime() - startTime) / Math.pow(10, 9); // we return the time spent on calculation\n }", "int factorial(int n){\n return (n==1||n==0)?1: n*factorial(n-1);\n }", "public static int getBetterApproach(int n){\n\t\t\n\t\tint t[] = new int[n+1];\n\t\t\n if(n<=2)\n return n;\n \n\t\tt[0] = 0;\n\t\tt[1] = 1;\n\t\tt[2] = 2;\n\t\tfor(int i = 3;i<=n;i++){\n\t\t\tt[i] = t[i-1] + t[i-2];\n\t\t}\n\t\treturn t[n];\n\t}", "public static int topDownApproach(int n, int table[]) {\r\n\t\tif (n < 2)\r\n\t\t\treturn n;\r\n\t\tif (table[n] != 0) {\r\n\t\t\treturn table[n];\r\n\t\t} else {\r\n\t\t\ttable[n] = topDownApproach(n - 1, table)\r\n\t\t\t\t\t+ topDownApproach(n - 2, table);\r\n\t\t}\r\n\r\n\t\treturn table[n];\r\n\t}" ]
[ "0.5962403", "0.5906308", "0.578635", "0.5722322", "0.56730765", "0.5651009", "0.5638849", "0.56182206", "0.56097263", "0.55620134", "0.55014944", "0.53240186", "0.53222", "0.53143257", "0.5313161", "0.5298194", "0.5290909", "0.5262699", "0.52578986", "0.52295136", "0.52133554", "0.51880276", "0.51845294", "0.5181571", "0.51677644", "0.5159241", "0.51553947", "0.51317745", "0.5101271", "0.5096049", "0.5085653", "0.50845385", "0.5079767", "0.5070941", "0.5069227", "0.5040516", "0.5033219", "0.50269574", "0.50023985", "0.4998239", "0.49932116", "0.49919572", "0.4988314", "0.49812925", "0.4960554", "0.49521923", "0.49326223", "0.49191034", "0.49184188", "0.49180114", "0.49098647", "0.49077472", "0.49068078", "0.4906061", "0.489877", "0.48944598", "0.48939988", "0.48891872", "0.48844233", "0.4877094", "0.48713195", "0.4868128", "0.48677722", "0.48618358", "0.48586145", "0.48534864", "0.48477727", "0.4842222", "0.48372224", "0.48356873", "0.48345578", "0.48214674", "0.48181114", "0.4817172", "0.4815859", "0.48157963", "0.48125562", "0.48096415", "0.4808147", "0.48056114", "0.48043576", "0.47963715", "0.47949532", "0.47928962", "0.47903717", "0.47873026", "0.478725", "0.47851527", "0.478399", "0.47838014", "0.4775705", "0.47740236", "0.47710854", "0.47688827", "0.47678077", "0.47650683", "0.47576514", "0.47529554", "0.47527704", "0.47413567", "0.47393003" ]
0.0
-1
All parameters are injected by GIN
@Inject public AppControllerImpl(PlaceController placeController, EventBus eventBus, PlaceHistoryHandler placeHistoryHandler, AppLayout appLayout, ActivityManagerInitializer activityManagerInitializer) { this.placeController = placeController; this.placeHistoryHandler = placeHistoryHandler; this.appPanelView = appLayout; this.eventBus = eventBus; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void inject() {\n }", "@GinModules(MyAppGinModule.class)\npublic interface MyAppGinjector extends Ginjector {\n\n String ANNOTATED_STRING_VALUE = \"abc\";\n\n MyApp getMyApp();\n\n SimpleObject getSimple();\n\n MyService getMyService();\n\n MyServiceImpl getMyServiceImpl();\n\n MyProvided getMyProvided();\n\n @Named(\"blue\") SimpleObject getSimpleBlue();\n @Named(\"red\") SimpleObject getSimpleRed();\n\n EagerObject getEagerObject();\n\n // Providers we never bound explicitly -- they should be synthesized\n // since we bound the keys directly\n Provider<SimpleObject> getSimpleProvider();\n @Named(\"blue\") Provider<SimpleObject> getSimpleBlueProvider();\n\n @MyBindingAnnotation String getAnnotatedString();\n\n MyRemoteServiceAsync getMyRemoteServiceAsync();\n}", "private final void inject() {\n }", "void inject(BaseApplication application);", "protected void setupParameters() {\n \n \n\n }", "void inject(MyMoneyApplication myMoneyApplication);", "@GinModules(InjectorModule.class)\npublic interface Injector extends Ginjector {\n PlaceHistoryHandler getPlaceHistoryHandler();\n MainView getAppWidget();\n}", "@Inject\n\tpublic ProviderBikes() { //has dependencies of its own that's why constructot\n\t\t\t\t\t\t\t\t\t\t//with @Inject annotation\n\t\t// TODO Auto-generated constructor stub\n\t\t\n\t\tSystem.out.println(\"Inside the constructor of the provide class\");\n\t}", "private LocalParameters() {\n\n\t}", "public interface Parameters {\n\t\n\t// HTTP request parameters\n\tfinal static String OPENID_REMEMBERME = \"rememberOpenid\";\n\tfinal static String OPENID_IDENTIFIER = \"openid_identifier\";\n\tfinal static String OPENID_IDENTITY_COOKIE = \"esg.openid.identity.cookie\";\n\tfinal static int OPENID_IDENTITY_COOKIE_LIFETIME = 86400*365*10; // ten years\n\t\n\t// OpenID RP target URL\n\tfinal static String OPENID_URL = \"/j_spring_openid_security_check.htm\";\n\t\n\t// OpenID RP login URL\n\tfinal static String LOGIN_URL = \"/home.htm\";\n\t\n\t// OpenID Relying Party parameters\n\tfinal static String KEYSTORE_PATH = \"kestorePath\";\n\tfinal static String KEYSTORE_PASSWORD = \"kestorePassword\";\n\tfinal static String KEYSTORE_ALIAS = \"kestoreAlias\";\n\t\n\t// Secured application parameters\n\tfinal static String POLICY_SERVICE = \"policyServiceClass\";\n\tfinal static String POLICY_SERVICES = \"policyServiceClasses\";\n\tfinal static String POLICY_FILES = \"policyFiles\";\n\tfinal static String AUTHORIZATION_SERVICE = \"authorizationServiceClass\";\n\tfinal static String TRUSTORE_FILE = \"trustoreFile\";\n\tfinal static String TRUSTORE_PASSWORD = \"trustorePassword\";\n\tfinal static String OPENID_RP_URL = \"openidRelyingPartyUrl\";\n\tfinal static String REGISTRATION_RELAY_URL = \"registrationRelayUrl\";\n\tfinal static String AUTHORIZATION_SERVICE_URL = \"authorizationServiceUrl\";\n\tfinal static String AUTHORIZATION_URL_TRANSFORMER = \"urlTransformer\";\n\tfinal static String AUTHORIZATION_URL_TRANSFORMER_REPLACEMENTS = \"urlTransformerReplacements\";\n final static String AUTHORIZATION_REQUEST_ATTRIBUTE = \"eske.model.security.AuthorizationToken\"; // legacy value compatible with old TDS filter\n final static String AUTHENTICATION_REQUEST_ATTRIBUTE = \"esg.openid\";\n final static String AUTHENTICATION_ONLY_FLAG = \"authenticationOnlyFlag\";\n final static String AUTHENTICATION_REQUIRED_PATTERNS = \"authenticationRequiredPatterns\";\n final static String AUTHENTICATION_NOT_REQUIRED_PATTERNS = \"authenticationNotRequiredPatterns\";\n final static String AUTHORIZED_IP = \"authorizedIp\";\n final static String IP_WHITELIST = \"ip_whitelist\";\n\t\n\t// shared parameters\n\tfinal static String OPENID_REDIRECT = \"redirect\";\n\tfinal static String OPENID_IDENTITY = \"openid\";\n\tfinal static String OPENID_SAML_COOKIE = \"esg.openid.saml.cookie\";\n\tfinal static String SESSION_AUTH = \"authentication\";\n\t\n\t// new cookies\n\tfinal static String ORP_SESSION_ID_COOKIE = \"esg.session.cookie\";\n\t\n\t// HTTP request parameters\n public final static String HTTP_PARAMETER_XML = \"xml\";\n public final static String HTTP_PARAMETER_GROUP = \"group\";\n public final static String HTTP_PARAMETER_ROLE = \"role\";\n public final static String HTTP_PARAMETER_USER = \"user\";\n public final static String HTTP_PARAMETER_URL = \"url\";\n public final static String HTTP_PARAMETER_RESOURCE = \"resource\";\n public final static String HTTP_PARAMETER_RESULT = \"result\";\n\t\n\t// test file\n\tfinal static String TEST_FILE = \"esg-saml-test-file.xml\";\n\tfinal static String TEST_OPENID = \"http://JoeTester.myopenid.com/\";\n\n}", "private Params()\n {\n }", "@Override\n\tprotected void initParams() {\n\t\t\n\t}", "@Override\n\tpublic void bindParameters() {\n\n\t}", "public void getParameters(Parameters parameters) {\n\n }", "private void initParameters() {\n Annotation[][] paramsAnnotations = method.getParameterAnnotations();\n for (int i = 0; i < paramsAnnotations.length; i++) {\n if (paramsAnnotations[i].length == 0) {\n contentBuilder.addUnnamedParam(i);\n } else {\n for (Annotation annotation : paramsAnnotations[i]) {\n Class<?> annotationType = annotation.annotationType();\n if (annotationType.equals(PathParam.class)\n && pathBuilder != null) {\n PathParam param = (PathParam) annotation;\n pathBuilder.addParam(param.value(), i);\n } else if (annotationType.equals(QueryParam.class)) {\n QueryParam param = (QueryParam) annotation;\n queryBuilder.addParam(param.value(), i);\n } else if (annotationType.equals(HeaderParam.class)) {\n HeaderParam param = (HeaderParam) annotation;\n headerBuilder.addParam(param.value(), i);\n } else if (annotationType.equals(NamedParam.class)) {\n NamedParam param = (NamedParam) annotation;\n contentBuilder.addNamedParam(param.value(), i);\n } else {\n contentBuilder.addUnnamedParam(i);\n }\n }\n }\n }\n }", "void inject(TravelsProvider provider);", "@Override\n protected void injectDependencies(Context context) {\n }", "protected void parametersInstantiation_EM() {\n }", "@Override\n protected void collectParameters(Consumer<Parameter<?>> parameterCollector) {\n }", "@Inject\n public \n GameServiceImp(\n IRepositoryContext context,\n IGameProcessor processor,\n IGameEventListener listener,\n ILogger logger)\n {\n itsContext = context;\n itsProcessor = processor;\n itsListener = listener;\n itsLogger = logger;\n }", "void inject(FeelingApp application);", "public void getParameters(Parameters parameters) {\n\n\t}", "protected void initParameterGenerators() {\n Map<String, List<Annotation>> methodAnnotationMap = initMethodAnnotationByParameterName();\n\n // 2.create ParameterGenerators by method parameters, merge annotations with method annotations\n initMethodParameterGenerators(methodAnnotationMap);\n\n // 3.create ParameterGenerators remains method annotations\n initRemainMethodAnnotationsParameterGenerators(methodAnnotationMap);\n }", "void setParameters() {\n\t\t\n\t}", "protected BackendModule(){ }", "public interface PatientService extends BaseService<Patient> {\n\n String POSTCODE_PARAM = \"postcode\";\n}", "public void preRegistration(InjectContainer injectContainer) {\n }", "public UserInfoGenerator(IRepository repository) {\n this.repository = repository;\n }", "@ApplicationScope\n@Component(modules = {AppModule.class})\npublic interface AppComponent {\n\n void inject(MyApplication application);\n\n Application application();\n\n Gson gson();\n\n OkHttpClient okHttpClient();\n\n}", "public BaseParameters(){\r\n\t}", "interface Injector {\n void inject(InternalContext context, Object o);\n }", "@Override\n public void setConfigParams(Map<String, Object> params) {\n\n }", "public interface Params {\n }", "@Singleton\n@Component(modules = {ContextModule.class, BusModule.class, GithubModule.class, GankModule.class, ZhiHuModule.class, RssModule.class})\npublic interface AppComponent {\n Context getContext();\n GankService getGankService();\n ZhiHuService getZhiHuService();\n RssService getRssService();\n EventBus getBus();\n}", "@Singleton\n@Component(modules = { AppModule.class, NetModule.class })\npublic interface NetComponent {\n void inject(MainHandler handler);\n}", "@Override\r\n public void load() throws ParamContextException {\n\r\n }", "private Globals(){\n HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();\n interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);\n OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();\n //Creem el Retrofit\n Retrofit retrofit = new Retrofit.Builder()\n .baseUrl(API_URL)\n .client(client)\n .addConverterFactory(ScalarsConverterFactory.create())\n .addConverterFactory(JacksonConverterFactory.create())\n .build();\n\n serveiRetrofit = retrofit.create(RetrofitAPI.class);\n }", "public Map getParameters();", "private void initStandardParams(ServletHolder jerseyServlet) {\n String initClasses = jerseyServlet.getInitParameter(ServerProperties.PROVIDER_CLASSNAMES);\n if (initClasses != null) {\n return;\n }\n\n initClasses = classProvider;\n\n if (this.swaggerId != null) {\n initClasses += \",\" + SWAGGER_INIT_CLASSNAMES_PARAM_VALUE;\n\n jerseyServlet.setInitParameter(SWAGGER_CONTEXT_ID, swaggerId);\n jerseyServlet.setInitParameter(SWAGGER_SCANNER_ID, swaggerId);\n }\n\n jerseyServlet.setInitParameter(ServerProperties.PROVIDER_CLASSNAMES, initClasses);\n\n jerseyServlet.setInitParameter(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, \"true\");\n }", "@Inject\n public MachineMonkeyRestApiImpl() {\n }", "public Parameters getParameters();", "private RESTBackend()\n\t\t{\n\t\t\t\n\t\t}", "public void init()\n {\n context = getServletContext();\n parameters = (Siu_ContainerLabel)context.getAttribute(\"parameters\");\n }", "private void setup(){\n\n // menginisialisasi variabel component\n component = DaggerApplicationComponent.builder()\n .applicationModule(new ApplicationModule(this)).build();\n\n // memanggil fungsi inject\n component.inject(this);\n }", "@Override\n\tpublic void entry(Object... params) {\n\n\t}", "void inject() throws Exception;", "public interface IParameters {\n\n /**\n * 设置请求参数\n * @param params\n */\n void params(Map<String, String> params);\n\n /**\n *设置请求参数\n * @param key\n * @param val\n */\n void addParams(String key, String val);\n}", "public interface AutoParamsRepository {\n AvtoParams getAvtoParamsById(@Param(\"id\")UUID id);\n /* void addAvtoParams(@Param(\"avtoParams\") AvtoParams avtoParams);\n void updateAvtoParams(@Param(\"avtoParams\") AvtoParams avtoParams);\n void deleteAvtoParams(@Param(\"id\")UUID id);*/\n}", "@Override\n\t\tpublic void configure(Binder binder) {\n\t\t\tbinder.bind(IFoodService.class).to(PizzaService.class);\n\t\t\t// bind the pizzaiolo named\n\t\t\tbinder.bind(String.class).annotatedWith(Names.named(\"pizzaiolo\"))\n\t\t\t\t\t.toInstance(\"Alberto\");\n\t\t\t// bind the print stream named to instance since we System.out is a\n\t\t\t// predefined singleton.\n\t\t\tbinder.bind(PrintStream.class)\n\t\t\t\t\t.annotatedWith(Names.named(\"printStream\"))\n\t\t\t\t\t.toInstance(System.out);\n\n\t\t}", "private RecipleazBackendService() {\n }", "static void register() {\n }", "@Singleton\n@Component(modules = {ApplicationModule.class})\npublic interface ApplicationComponent {\n\n void inject(GoToDream goToDream);\n\n @Named(\"application\")\n Context getContext();\n}", "@Component(modules = { ApplicationModule.class, SettingsDataModule.class, UserDataModule.class, RecipeDataModule.class })\n@ApplicationScope\npublic interface ApplicationComponent {\n\n void inject(HoppyApplication application);\n\n @ApplicationContext\n Context applicationContext();\n Navigator navigator();\n\n UserRepository userRepository();\n RecipeRepository recipeRepository();\n SettingsRepository settingsRepository();\n GetCurrentUserInteractor getCurrentUserInteractor();\n}", "Builder injectionFactory(InjectionObjectFactory factory);", "@Override\r\n\tpublic void configInterceptor(Interceptors me) {\n\r\n\t}", "public Parameters() {\n\t}", "void inject(MainActivity activity);", "@Parameters({\"name\", \"lastName\"})\n @Test\n public void test1(String name, String lastName){\n System.out.println(\"Name is \"+ name);\n System.out.println(\"Last name is \"+ lastName);\n }", "GlobalAuthorizationConfigurationBuilder authorization();", "public void init(Object[] parameters) {\n\n\t}", "private ServiceGenerator() {\n }", "@Override // com.sina.weibo.sdk.component.BrowserRequestParamBase\n public void onSetupRequestParam(Bundle bundle) {\n Bundle bundle2 = bundle.getBundle(EXTRA_KEY_AUTHINFO);\n if (bundle2 != null) {\n this.mAuthInfo = AuthInfo.parseBundleData(this.mContext, bundle2);\n }\n this.mAuthListenerKey = bundle.getString(EXTRA_KEY_LISTENER);\n if (!TextUtils.isEmpty(this.mAuthListenerKey)) {\n this.mAuthListener = WeiboCallbackManager.getInstance(this.mContext).getWeiboAuthListener(this.mAuthListenerKey);\n }\n }", "private Globals() {\n\n\t}", "@Before\n public void setUp() {\n underTest = context.registerInjectActivateService(new CropSquareServlet());\n }", "@PostConstruct\n public void init() {\n oAuthProviders.registerProvider(this);\n }", "@Override\n\tpublic void configure(Context arg0) {\n\t\t\n\t}", "@Override\n\tpublic void configure(Context arg0) {\n\t\t\n\t}", "private void initCommonParameter()\r\n {\r\n cp = new CommonParameterHolder();\r\n cp.setLoginId(userProfile.getLoginId());\r\n cp.setCurrentUserOid(userProfile.getUserOid());\r\n cp.setClientIp(this.getRequest().getRemoteAddr());\r\n cp.setMkMode(false);\r\n }", "public ModuleParams()\n\t{\n\t}", "public ModuleParams() {\n }", "public Parameterized() {\n setParameters(null);\n }", "@Singleton\n@Component(modules = ApplicationModule.class)\npublic interface ApplicationComponent {\n// @ApplicationContext\n// Context context();\n\n Application application();\n\n SharedPrefencesHelper sharedPrefencesHelper();\n\n DataManager dataManager();\n\n G3anService g3anService();\n}", "@Override\n\tpublic void configure(Context arg0) {\n\n\t}", "void inject(NYNewsViewModel nyNewsViewModel);", "private AnagramService() {\n\t}", "@FeignClient(\"greetings-service\")\ninterface GreetingsClient {\n\n\t@RequestMapping(method = RequestMethod.GET, value = \"/greetings/{name}\")\n\tGreeting greet(@PathVariable(\"name\") String name);\n}", "void setParameters(IParameterCollection parameters);", "@Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<String, String>();\n params.put(\"tag\", \"login\");\n params.put(\"username\", username);\n\n\n return params;\n }", "ServletRequestInjector getRequestInjector();", "private AddHarnessIdInterceptor() {}", "@DebugLog\npublic interface ApiService {\n final static String APPSETTINGS = \"/application_settings.json\";\n final static String MOVIES = \"/in_theaters.json\";\n\n // APPLICATION SETTINGS\n @Headers(\"Cache-Control: no-cache\")\n @GET(APPSETTINGS)\n void getApplicationSettings(Callback<ApplicationSettings> cb);\n\n // IN THEATERS\n @GET(MOVIES)\n void getMovies(@Query(\"apikey\") String key, @Query(\"page\") int page, @Query(\"page_limit\") int page_limit, Callback<Movies> cb);\n}", "public void bindArguments() {\n\n\t\tif (this.arguments != null) {\n\t\t\t// by default arguments in abstract/native methods are considered to be used (no complaint is expected)\n\t\t\tif (this.binding == null) {\n\t\t\t\tfor (int i = 0, length = this.arguments.length; i < length; i++) {\n\t\t\t\t\tthis.arguments[i].bind(this.scope, null, true);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tboolean used = this.binding.isAbstract() || this.binding.isNative();\n\t\t\tfor (int i = 0, length = this.arguments.length; i < length; i++) {\n\t\t\t\tArgument argument = this.arguments[i];\n\t\t\t\targument.bind(this.scope, this.binding.parameters[i], used);\n\t\t\t\tif (argument.annotations != null) {\n\t\t\t\t\tthis.binding.tagBits |= TagBits.HasParameterAnnotations;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public GenEncryptionParams() {\n }", "public RequestUrlHandler() {\n // requestService = SpringContextHolder.getBean(ScfRequestService.class);\n }", "@ApplicationScope\n@Component(modules = {ContextModule.class,ServiceModule.class}) // tell which modules to use in order to generate this instance\npublic interface ApplicationComponent {\n\n\n\n SharedPreferencesClass getSharedPrefs();\n\n RequestManager getGlide();\n\n void injectRepo(ProjectRepository repository);\n\n}", "void inject(MainActivity mainActivity);", "public Http()\n {\n numberOfParameters = -1;\n }", "@Override\n\tpublic void init(ServletConfig config) throws ServletException {\n\t\tsuper.init(config);\n\t\t\n\t\tString good = config.getInitParameter(\"good\");\n\t\t\n\t\tSystem.out.println(\"good = \" + good);\n\t\t\n\t\tEnumeration<String> enu = this.getInitParameterNames();\n\t\t\n\n\t\twhile (enu.hasMoreElements()) {\n\n\t\t\tString val = enu.nextElement();\n\t\t\tSystem.out.println(\"val = \" + val);\n\n\t\t}\n\t}", "public GameServiceTest() {\r\n\t\tsetupRequestContext();\r\n\t}", "public IntegrationRuntimeRegenerateKeyParameters() {\n }", "@Override\n\tprotected void configure() {\n\n\t\tbind(RacingBike.class).annotatedWith(ApacheRR.class).to(ApacheRR310.class);\n\t\tbind(RacingBike.class).annotatedWith(ApacheRS.class).to(ApacheRR200.class);\n//\t\tbind(RacingBike.class).annotatedWith(Names.named(\"ApacheRT\")).to(ApacheRR160.class);\n//\t\t\n//\t\tbind(String.class).annotatedWith(Names.named(\"Prajjwal Singh\")).toInstance(\"This is Prajjwal Singh Welcoming you here\");\n\t\t\n\t\t//provider class binding\n//\t\tbind(RacingBike.class).toProvider(ProviderBikes.class);\n\t\t\n//\t\tbind(ApacheRR310.class).to(ApacheRR200.class);\n\t\t\n\t}", "public void register(){\n }", "private Gng() {\n }", "public BackendClient loadClient() {\r\n final Injector inject = Guice.createInjector(new AbstractModule() {\r\n\r\n /*\r\n * (non-Javadoc)\r\n * \r\n * @see com.google.inject.AbstractModule#configure()\r\n */\r\n @Override\r\n protected void configure() {\r\n try {\r\n\r\n bind(BackendClient.class);\r\n if (verboseStream != null) {\r\n bind(PrintStream.class).annotatedWith(\r\n Names.named(\"verboseStream\")).toInstance(\r\n verboseStream);\r\n }\r\n bind(Boolean.class).annotatedWith(\r\n Names.named(\"verboseflag\")).toInstance(verbose);\r\n\r\n } catch (final Exception e) {\r\n e.printStackTrace();\r\n throw new IllegalStateException(e.getMessage(), e);\r\n }\r\n }\r\n\r\n // TODO: remove the if-else logic and make this more dynamic\r\n /** Provide input reader. */\r\n @Provides\r\n public DataInput provideInputReader() {\r\n DataInput input = null;\r\n final Reader inRdr = inReader;\r\n if ((inRdr != null) && (inputFormat != null)) {\r\n if (\"csv\".equalsIgnoreCase(inputFormat))\r\n input = new CSVDataInput(inRdr);\r\n else if (\"json\".equalsIgnoreCase(inputFormat))\r\n input = new JSONDataInput(inRdr);\r\n else\r\n throw new IllegalArgumentException(\"Input format \"\r\n + inputFormat + \" not supported.\"\r\n + \" Valid types are csv, json\");\r\n input.verboseOptions(verboseStream, verbose);\r\n }\r\n return input;\r\n }\r\n\r\n // TODO: remove the if-else logic and make this more dynamic\r\n @Provides\r\n public DataOutput provideOutputWriter() {\r\n DataOutput out = null;\r\n final PrintWriter oWriter = outWriter;\r\n if ((oWriter != null) && (outputFormat != null)) {\r\n if (\"csv\".equalsIgnoreCase(outputFormat)) {\r\n out = new CSVDataOutput(oWriter);\r\n } else if (\"json\".equalsIgnoreCase(outputFormat)) {\r\n out = new JSONDataOutput(oWriter);\r\n } else\r\n throw new IllegalArgumentException(\"Output format \"\r\n + outputFormat + \" not supported.\"\r\n + \" Valid types are csv, json\");\r\n out.verboseOptions(verboseStream, verbose);\r\n }\r\n return out;\r\n }\r\n\r\n /** Provides BackendInstanceWrapper instance to be injected where\r\n * \r\n * @see BackendClient\r\n * @return the backend instance wrapper */\r\n @Provides\r\n @Named(\"source\")\r\n public BackendInstanceWrapper provideSourceWrapper() {\r\n return backendInstanceWrapper(sourceDB);\r\n }\r\n\r\n @Provides\r\n @Named(\"target\")\r\n @Nullable\r\n @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = \"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE\")\r\n public BackendInstanceWrapper provideTargetWrapper() {\r\n if (targetDB != null) {\r\n return backendInstanceWrapper(targetDB);\r\n } else\r\n return null;\r\n }\r\n\r\n });\r\n return inject.getInstance(BackendClient.class);\r\n }", "@Override\n protected void configure() {\n MorphiaLoggerFactory.reset();\n init();\n bind();\n }", "@ServiceInit\n public void init() {\n }", "public DISPPARAMS() {\n\t\t\tsuper();\n\t\t}", "protected void onBind()\n\t{\n\t}", "public interface GoogleApi {\n\n @Headers(\"Content-Type: application/json\")\n @POST(VISION_CLOUD)\n Call<VisionRespose> processImage64(@Header(\"Content-Length\") String bodyLength, @Query(\"key\") String apiKey, @Body VisionRequest visionRequest);\n\n @Headers(\"Content-Type: application/json\")\n @POST(VISION_CLOUD)\n Call<LogoResponse> processLogoImage64(@Header(\"Content-Length\") String bodyLength, @Query(\"key\") String apiKey, @Body VisionRequest visionRequest);\n\n @Headers(\"Content-Type: application/json\")\n @GET(TRANSLATION_CLOUD)\n Call<TranslationResponse> translateQuery(@Query(\"key\") String apiKey, @Query(\"source\") String source, @Query(\"target\") String target, @Query(\"q\") List<String> queries);\n}", "public PreOauth2SSOGatewayFilter() {\n super(Config.class);\n }", "@Override\n protected void onHubRequest(Tuple input) throws Exception {\n }" ]
[ "0.6220878", "0.59634805", "0.59477264", "0.5780569", "0.5705217", "0.56719846", "0.5663709", "0.5588904", "0.5450064", "0.5405846", "0.53925925", "0.5358226", "0.5333029", "0.53205585", "0.5230679", "0.5205825", "0.5202148", "0.52002805", "0.5198679", "0.5175266", "0.5173786", "0.51486707", "0.5133532", "0.5096871", "0.507801", "0.5048515", "0.5036687", "0.5006522", "0.5001805", "0.49938476", "0.49850908", "0.498319", "0.49728867", "0.49665624", "0.4964743", "0.4962892", "0.4960788", "0.4959194", "0.4955683", "0.49500632", "0.4944978", "0.4943579", "0.4942954", "0.49372402", "0.49202028", "0.4915422", "0.49130476", "0.49049887", "0.48938838", "0.48896724", "0.4887507", "0.48823357", "0.48818988", "0.48784214", "0.48621923", "0.48588777", "0.48494625", "0.48488986", "0.48488024", "0.4848325", "0.48421237", "0.48417488", "0.48402905", "0.4838851", "0.4833236", "0.4831376", "0.4831376", "0.48312697", "0.4824518", "0.48225173", "0.4815955", "0.48109508", "0.48073697", "0.4801555", "0.4800814", "0.48002276", "0.47997287", "0.47935337", "0.47889194", "0.47875226", "0.47873375", "0.4784349", "0.47824463", "0.47779125", "0.47726437", "0.477121", "0.47674334", "0.4767166", "0.47631064", "0.47625715", "0.47617686", "0.4760563", "0.47576094", "0.47512937", "0.47501224", "0.47493997", "0.47482964", "0.47465995", "0.47454476", "0.47447816", "0.47420096" ]
0.0
-1
private static final int NUM_ACTORS = 3;
@PostMapping("/payment/pay/{user_id}/{order_id}/{amount}") public String postPayment(@PathVariable(name="user_id") String user_id, @PathVariable(name="amount") Integer amount) { String credit = ""; try (ActorClient client = new ActorClient()) { ActorProxyBuilder<PaymentActor> builder = new ActorProxyBuilder(PaymentActor.class, client); // List<Thread> threads = new ArrayList<>(NUM_ACTORS); ExecutorService threadPool = Executors.newSingleThreadExecutor(); ActorId actorId = new ActorId(user_id); PaymentActor actor = builder.build(actorId); Future<String> future = threadPool.submit(new CallActor(actorId.toString(), actor, 3, amount)); credit = future.get(); System.out.println("Got user credit: "+credit); } catch (ExecutionException | InterruptedException e) { e.printStackTrace(); } String json = "{\"user_id\":"+user_id+","+"\"credit\":"+credit+"}"; return json; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int getActionCount(){return 4;}", "public int numActors() { return ActorSet.size(); }", "public int getAccessibleActionCount() {\n return 1;\n }", "@Override\n public int howManyActivated(){\n return (gameboardPanel.howManyActivated() + leaderCardsPanel.howManyActivated());\n }", "p3(){ \n cnt++; // Increment the static variable by 1 for each object creation. \n }", "public int getNumberOfFloors() {\n\t\treturn 2;\r\n\t}", "public int numberOfBalls() {\r\n return 3;\r\n }", "@Override\n\tpublic long unidadesComida() {\n\t\treturn 3;\n\t}", "@Override\n public int getAttributeCount()\n {\n return 3;\n }", "public int getActorsSize() {\r\n\t\treturn actors.size();\r\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 4;\n\t}", "int getNumActive();", "public int howManyActivated() {\n int cont = 0;\n if(!baseProductionPanel.getProductionButton().isToken())\n cont++;\n for(int i = 0 ; i<3;i++){\n if (!productionButtons[i].isToken())\n cont++;\n }\n return cont;\n }", "public int getNumActive();", "private void setComponentsOfIndex() {\n\t\tint t = this.numbersIdex + 1;\n\t\tif (t == NUMBEROFEACHCARD) {\n\t\t\tthis.numbersIdex = 0;\n\t\t\tsetColorIndex();\n\t\t} else {\n\t\t\tthis.numbersIdex = t;\n\t\t}\n\t}", "public void createAttractors_step2() {\n\t\t// make a bunch of Attractors and sprinkle them around in the hypercube\n\t\tdouble count = Math.sqrt(observations.size());\n\t\tcount *= 2; \n\t\tint result = (int) count;\n\t\tif (result < 2) {\n\t\t\tresult = 2;\n\t\t}\n\t\tCaller.log(\"COUNT: \" + count);\n\t\tfor (int i = 0; i < result; i++) {\n\t\t\tdouble[] d = new double[shape];\n\t\t\tfor (int j = 0; j < shape; j++) {\n\t\t\t\td[j] = Math.random() * 4 - 2;\n\t\t\t}\n\t\t\tattractors.put(i, new _ReduxAttractor(i, d));\n\t\t}\n\t}", "public int getNumberOfComponents();", "@Override\n protected int getNumRepetitions() {\n return 1;\n }", "int getActionsCount();", "int getActionsCount();", "public static int getOrdinal() {\n\treturn 3;\n }", "private ButtonEnum(int numberOfJoystick, int numberOfButton) {\n buttonNum = numberOfButton; \n joystickNum = numberOfJoystick;\n }", "public int getEdgeCount() \n {\n return 3;\n }", "public void initDefaultActors() {\n\t\tactors.add(new Switcher(viewPort, 500));\r\n\t\tactors.add(new Rotator(viewPort, 100, 1, 0, 250));\r\n\t\tactors.add(new Rotator(viewPort, -300, -1.3, 0, 200));\r\n//\t\tactors.add(new MovingBar(viewPort, -500));\r\n//\t\tMovingBar temp = new MovingBar(viewPort, -800); temp.setSpeed(2);\r\n//\t\tactors.add(temp);\r\n//\t\tactors.add(new RotatingBen(viewPort, -1400, viewPort.width/2, 0, 1, 100));\r\n//\t\tactors.add(new RotatingRectangle(viewPort, -1800, viewPort.width/2-80, 0, 1, 160));\r\n//\t\tactors.add(new RotatingDoubleCross(viewPort, -2100, 100));\r\n//\t\t\r\n//\t\tactors.add(new RotatingWhiteBar(viewPort, -3000, viewPort.width/2, 0, 1, 100));\r\n\t\t\r\n\t\t//actors.add(new Rotator(viewPort, -3200, 2, 0, 300));\r\n\t\t//actors.add(new DoubleBar(viewPort, -4000));\r\n\t\t//actors.add(new RotatingSwagRectangle(viewPort, 600, viewPort.width/2-50, 0, 1, 100));\r\n\t\t//actors.add(new movingBar(viewPort, -1000));\r\n\t\t//ColorChanger switch1 = new ColorChanger(50, 1000, this);\r\n\t\t//test.setBoundaries(leftX, rightX, 200, 950);\r\n\t}", "@Override protected String[][] factors() { return FACTORS; }", "public void processActors(ArrayList<Actor> actors) {\n int count = 0;\n for (Actor temp : actors) {\n if (temp instanceof Critter) {\n count++;\n }\n }\n if (count < courage) {\n changeColor(2);\n } else {\n changeColor(-2);\n }\n }", "public void setCirculations()\r\n {\r\n circulations++;\r\n }", "private static int[] createAlternates() {\r\n\t\t// Initializes the key list\r\n\t\talternateKeys = new int[6];\r\n\t\t// Adds the KeyEvents to their respected index\r\n\t\talternateKeys[UP] = KeyEvent.VK_UP;\r\n\t\talternateKeys[LEFT] = KeyEvent.VK_LEFT;\r\n\t\talternateKeys[DOWN] = KeyEvent.VK_DOWN;\r\n\t\talternateKeys[RIGHT] = KeyEvent.VK_RIGHT;\r\n\t\talternateKeys[BUTTONA] = 2;\r\n\t\talternateKeys[BUTTONB] = 3;\r\n\t\t// Return (to the constructor, which is send to the super constructor)\r\n\t\treturn alternateKeys;\r\n\t}", "public int getNumberOfFloors() {\r\n return numberOfFloors;\r\n }", "public int howManyActivatedExceptBaseProduction() {\n int cont = 0;\n for(int i = 0 ; i<3;i++){\n if (!productionButtons[i].isToken())\n cont++;\n }\n return cont;\n }", "int getNumberOfCavalry();", "protected int numChildren() {\r\n return 3;\r\n }", "@Override\r\n public int numberOfBalls() {\r\n return 2;\r\n }", "private int numberOfCritters(int wave){\n\t\treturn 9 + (wave%3)*6;\n\t}", "public int getNumAyuAtracc();", "@Override\n\tpublic int max() {\n\t\treturn 4;\n\t}", "public int getConstantCount() {\r\n return EnthalpyVapour.CONSTANT_COUNT;\r\n }", "int pacemodulator() {\n int buckpacedirector = ((rand.nextInt() >> rightshift) & 7);\n int rbuckpacedirector = 0;\n\n rbuckpacedirector = switch (buckpacedirector)\n {\n case 0 -> 2;\n case 1 -> 3;\n case 2 -> 4;\n case 3 -> 5;\n case 4 -> 6;\n case 5 -> 7;\n case 6 -> 8;\n default -> 1;\n };\n return rbuckpacedirector;\n }", "public int getNumActions() {\r\n return numActions;\r\n }", "int getGuestAcceleratorsCount();", "@Override\n\tpublic int getNumberOfControls()\n\t{\n\t\treturn 1;\n\t}", "public CollisionPrevention3D(int n) {\r\n this.numberOfBees = n;\r\n this.beesArray = new Bee3D[n];\r\n }", "static int getNumPatterns() { return 64; }", "public void set_count(int c);", "public int NumCrits() {\n return 1;\n }", "void setNumberOfCavalry(int cavalery);", "public abstract int getCntOther();", "public void addNumOfActionTaken() {\n this.numOfActionTaken++;\n }", "public int getNumberOfCameras() {\n\t\treturn numberOfCameras;\n\t}", "private int createAbilityIndex() {\n if (this.getPokemonInfo().numAbilities() == 2) {\n return RandomUtils.getRandomInt(2);\n } else {\n return RandomUtils.getRandomInt(3);\n }\n }", "int getActionLogCount();", "public int getNumberConcurrentEmulators() {\n\t\treturn (numberConcurrentEmulators);\n\t}", "@Override\n public int howManyActivatedExceptBaseProduction(){\n return (gameboardPanel.howManyActivatedExceptBaseProduction() + leaderCardsPanel.howManyActivated());\n }", "public abstract void countLaunchingActivities(int num);", "@Test\r\n\tpublic void testRevealTicketsMultiple() {\n\t\tint i = 1;\r\n\t\tfor (RandomOrgClient roc : rocs) {\r\n\t\t\trevealTicket(roc, i, 3);\r\n\t\t\ti++;\r\n\t\t}\r\n\t}", "public List<Actor> getActors() {\n System.out.println(\"LENGTH:\"+actors.size());\n return actors;\n }", "public void int3_m() {\n\t\t\n\t}", "public CountMultipleCreations() {\r\n\t\tmultiples = new HashSet<String>();\r\n\t}", "private int getCounterLimit(Game game, Player player){\n if (!game.isFrenzy()) {\n return NORMAL_ACTION_NUMBER;\n } else {\n Logger.getGlobal().info(\"is before frenzy activator: \" + player.getCharacterState().isBeforeFrenzyActivator());\n if (player.getCharacterState().isBeforeFrenzyActivator()) {\n return BEFORE_FRENZY_NUMBER;\n } else {\n return AFTER_FRENZY_NUMBER;\n }\n }\n }", "private static int getCombo() {\n return generator.nextInt(COMBOS) + 1;\n }", "public int getAceCount(){\n return aceCount;\n }", "public static void main(String[] args) {\n\t\tint x = 120;\n\t\t\n\t\tint rob1 = 0;\n\t\tint rob2 = 0;\n\t\tint rob3 = 0;\n\t\tint rob4 = 0;\n\t\t\n\t\tint[] rob1c = {0, 0};\n\t\tint[] rob2c = {0, 0};\n\t\tint[] rob3c = {0, 0};\n\t\tint[] rob4c = {0, 0};\n\t\t\n\t\tint counts0 = 0;\n\t\tint counts1 = 0;\n\t\tint counts2 = 0;\n\t\tint counts3 = 0;\n\t\t\n\t\tRobot[] rob = new Robot[4];\n\t\tfor (int i = 0; i < rob.length; i++) {\n\t\t\trob[i] = new Robot();\n\t\t\trob[i].miniaturize();\n\t\t\trob[i].setX(x);\n\t\t\trob[i].setSpeed(100);\n\t\t\tif (i == 0) {\n\t\t\t\trob1c[0] = rob[0].getX();\n\t\t\t\trob1c[1] = rob[0].getY();\n\t\t\t}else if (i == 1) {\n\t\t\t\trob2c[0] = rob[1].getX();\n\t\t\t\trob2c[1] = rob[1].getY();\n\t\t\t}else if (i == 2) {\n\t\t\t\trob3c[0] = rob[2].getX();\n\t\t\t\trob3c[1] = rob[2].getY();\n\t\t\t}else if (i == 3) {\n\t\t\t\trob4c[0] = rob[3].getX();\n\t\t\t\trob4c[1] = rob[3].getY();\n\t\t\t}\n\t\t\tx = x - 30;\n\t\t}\n\t\t\n\t\tint dis = 0;\n\t\tboolean win = false;\n\t\twhile (win == false) {\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tif (i == 0) {\n\t\t\t\t\tdis = new Random().nextInt(30);\n\t\t\t\t\tfor (int j = 0; j < dis; j++) {\n\t\t\t\t\t\trob[0].move(1);\n\t\t\t\t\t\trob1++;\n\t\t\t\t\t\tif (rob1 == 30) {\n\t\t\t\t\t\t\trob[0].turn(36);\n\t\t\t\t\t\t\trob1 = 0;\n\t\t\t\t\t\t\tcounts0++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (counts0 == 10) {\n\t\t\t\t\tSystem.out.println(\"Robot 1 wins!!! ^_^\");\n\t\t\t\t\twin = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (i == 1) {\n\t\t\t\t\tdis = new Random().nextInt(60);\n\t\t\t\t\tfor (int j = 0; j < dis; j++) {\n\t\t\t\t\t\trob[1].move(1);\n\t\t\t\t\t\trob2++;\n\t\t\t\t\t\tif (rob2 == 60) {\n\t\t\t\t\t\t\trob[1].turn(36);\n\t\t\t\t\t\t\trob2 = 0;\n\t\t\t\t\t\t\tcounts1++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (counts1 == 10) {\n\t\t\t\t\tSystem.out.println(\"Robot 2 wins!!! ^_^\");\n\t\t\t\t\twin = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (i == 2) {\n\t\t\t\t\tdis = new Random().nextInt(90);\n\t\t\t\t\tfor (int j = 0; j < dis; j++) {\n\t\t\t\t\t\trob[2].move(1);\n\t\t\t\t\t\trob3++;\n\t\t\t\t\t\tif (rob3 == 90) {\n\t\t\t\t\t\t\trob[2].turn(36);\n\t\t\t\t\t\t\trob3 = 0;\n\t\t\t\t\t\t\tcounts2++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (counts2 == 10) {\n\t\t\t\t\tSystem.out.println(\"Robot 3 wins!!! ^_^\");\n\t\t\t\t\twin = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (i == 3) {\n\t\t\t\t\tdis = new Random().nextInt(120);\n\t\t\t\t\tfor (int j = 0; j < dis; j++) {\n\t\t\t\t\t\trob[3].move(1);\n\t\t\t\t\t\trob4++;\n\t\t\t\t\t\tif (rob4 == 120) {\n\t\t\t\t\t\t\trob[3].turn(36);\n\t\t\t\t\t\t\trob4 = 0;\n\t\t\t\t\t\t\tcounts3++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tif (counts3 == 10) {\n\t\t\t\t\tSystem.out.println(\"Robot 4 wins!!! ^_^\");\n\t\t\t\t\twin = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t}", "int getRepeatCount();", "int getOrientationsCount();", "public int numberOfOccorrence();", "interface Finals\r\n{\r\n /** Direction for Mario and barrels */\r\n public static final int LEFT = 1;\r\n /** Direction for Mario and barrels */\r\n public static final int RIGHT = 2;\r\n /** Direction for Mario and barrels */\r\n public static final int UP = 3;\r\n /** Direction for Mario and barrels */\r\n public static final int DOWN = 4;\r\n /** Direction for Mario and barrels */\r\n public static final int JUMP = 5;\r\n /** Level for the game to play */\r\n public static final int LEVEL6 = 6;\r\n /** Level for the game to play */\r\n public static final int LEVEL5 = 5;\r\n /** Level for the game to play */\r\n public static final int LEVEL4 = 4;\r\n /** Level for the game to play */\r\n public static final int LEVEL3 = 3;\r\n /** Level for the game to play */\r\n public static final int LEVEL2 = 2;\r\n /** Level for the game to play */\r\n public static final int LEVEL1 = 1;\r\n /** Maximum amount of barrels in use */\r\n public static final int AMOUNT_OF_BARRELS = 6;\r\n /** State for the MIDlet */\r\n public static final int NEWGAME_STATE = 1;\r\n /** State for the MIDlet */\r\n public static final int EXIT_STATE = 0;\r\n /** State for the MIDlet */\r\n public static final int MENUSCREEN_STATE = 2;\r\n \r\n\r\n}", "private int generateNumberOfDoors(String model) {\n\t\tif (model.equals(\"compact\")) {\n\t\t\treturn 2;\n\t\t} else {\n\t\t\treturn 4;\n\t\t}\n\t}", "public abstract int getCntRod();", "public int getMax_interactions() throws IOException\n\t{\n\t\tif ((__io__pointersize == 8)) {\n\t\t\treturn __io__block.readInt(__io__address + 124);\n\t\t} else {\n\t\t\treturn __io__block.readInt(__io__address + 104);\n\t\t}\n\t}", "private void m80391a(int i) {\n if (i == 3) {\n UnreadCountRepository.m111937l().mo101892c();\n }\n }", "public TestMatchmakingHandler() {\r\n\t\tchecks = new AtomicInteger[3];\r\n\t\tfor (int i = 0; i < 3; i++) {\r\n\t\t\tchecks[i] = new AtomicInteger(0);\r\n\t\t}\r\n\t}", "@Override\n\tpublic int cardinality() {\n\t\treturn 2;\n\t}", "public int getTaillePoule (){\n\t\treturn 3;\n\t}", "int getAchieveInfoCount();", "public int getNumOfMaxActions() {\n return numOfMaxActions;\n }", "public int getActions() {\n return actions;\n }", "private static int randomCycleCap() {\n int newValue = 0;\n int iterations = 3;\n Random bombRandGen = new Random();\n\n for (int i = 0; i <= iterations; i++) {\n newValue += bombRandGen.nextInt(4);\n }\n\n return newValue;\n }", "private Map<Integer, Operatable> intializeCorridors(Integer corridorCount, String type) {\n\t\tMap<Integer, Operatable> corridors = new HashMap<>();\n\t\tfor (Integer j = 1; j <= corridorCount; j++) {\n\n\t\t\tDevice lightCorridor = new Light();\n\t\t\tDevice acCorridor = new AC();\n\n\t\t\tacCorridor.turnOn();\n\t\t\t// by default keeping light in main corridor on and off at sub-corridors\n\t\t\tif (type == Constants.MAIN) {\n\t\t\t\tlightCorridor.turnOn();\n\t\t\t} else {\n\t\t\t\tlightCorridor.turnOff();\n\t\t\t}\n\n\t\t\tCorridor corridor = new MainCorridor(lightCorridor, acCorridor);\n\t\t\tcorridors.put(j, corridor);\n\t\t}\n\t\treturn corridors;\n\t}", "public void AumentarVictorias() {\r\n\t\tthis.victorias_actuales++;\r\n\t\tif (this.victorias_actuales >= 9) {\r\n\t\t\tthis.TituloNobiliario = 3;\r\n\t\t} else if (this.victorias_actuales >= 6) {\r\n\t\t\tthis.TituloNobiliario = 2;\r\n\t\t} else if (this.victorias_actuales >= 3) {\r\n\t\t\tthis.TituloNobiliario = 1;\r\n\t\t} else {\r\n\t\t\tthis.TituloNobiliario = 0;\r\n\t\t}\r\n\t}", "public void setNumOfActionTaken(int numOfActionTaken) {\n this.numOfActionTaken = numOfActionTaken;\n }", "public static int numJoinTypes() {\n return 3;\n }", "int countComponents() throws Exception;", "public int arn() {\n return 383;\n }", "public int get_podsActuels() {\r\n\t\tint pods = 0;\r\n\t\tfor(Objet value : _items.values())\r\n\t\t{\r\n\t\t\tpods = value.getTemplate().getPod() * value.getQuantity(); \r\n\t\t}\r\n\t\treturn pods;\r\n\t}", "public int getAceCount() {\r\n return aceCount;\r\n\t}", "public int[] podium(){\n //TODO\n int [] pod = new int[3];\n int [] tab = Trier(this.scores);\n int n= this.scores.length;\n pod[2]= tab[n-1];\n pod[1]= tab[n-2];\n pod[0]= tab[n-3];\n return pod;\n \n \n }", "public int components() {\n return numOfComponents;\n }", "public void choosedAction(int action) {\r\n countActions[action]++;\r\n }", "private ModalityState(int value) { this.value = value; }", "public void processActors(ArrayList<Actor> actors)\n {\n int n = actors.size();\n if (n < courage) {\n brighter();\n } else {\n darken();\n }\n }", "public abstract int numOfFoodCellToReproduce();", "public int getNumOfSides(){return numOfSides;}", "public void increseHitCount() {\n\r\n\t}", "public static int fastNumberOfCancellations(int[] tab) {\n }", "public int getModCount() {\n return 1;\n }", "private static int orderingType(){\n return ((SubjectControl.subjNumber + 3) % NUM_ORDER_TYPES) + 1;\n }", "int getNumCards();", "@Override\n\tprotected List<AbilityImpl> initAbility3() {\n\t\tDestroySpecificTilesAbilityComponent destroy1x1 = null;//new DestroySpecificTilesAbilityComponent(1, 1);\n\t\tDestroySpecificTilesAbilityComponent destroy3x3 = null;//new DestroySpecificTilesAbilityComponent(3, 3);\n\t\tDestroySpecificTilesAbilityComponent destroy5x5 = null;//new DestroySpecificTilesAbilityComponent(5, 5);\n\n\t\treturn buildAbilityList(\n\t\t\t\tbuildAbility(destroy1x1),\n\t\t\t\tbuildAbility(destroy1x1),\n\t\t\t\tbuildAbility(destroy3x3),\n\t\t\t\tbuildAbility(destroy3x3),\n\t\t\t\tbuildAbility(destroy5x5));\n\n\t}", "int getMaxConcurrent();", "int RandomGeneratorZeroToThree (){\n\t\t int randomInt = 0;\n\t\t Random randomGenerator = new Random();\n\t\t for (int idx = 1; idx <= 10; ++idx) {\n\t\t\t randomInt = randomGenerator.nextInt(4);\n\n\t\t }\n\t\t return randomInt;\n\t }", "int countObjectFlowStates();" ]
[ "0.66385233", "0.61165184", "0.5647382", "0.5638232", "0.56264865", "0.5602849", "0.5589131", "0.5558333", "0.551749", "0.55079824", "0.54840237", "0.5478982", "0.54789543", "0.5382739", "0.5350869", "0.5349922", "0.53430194", "0.5327863", "0.53102446", "0.53102446", "0.52883434", "0.5257606", "0.5256169", "0.5190236", "0.518796", "0.5179914", "0.51791954", "0.51622635", "0.51554376", "0.515501", "0.5152081", "0.5149794", "0.51356024", "0.51195693", "0.51039827", "0.5092221", "0.50782937", "0.5066578", "0.5065772", "0.50618106", "0.50569916", "0.5038433", "0.501372", "0.5007154", "0.50055075", "0.5003623", "0.49995327", "0.49984854", "0.4994347", "0.4991236", "0.49842963", "0.49715784", "0.4971403", "0.4960209", "0.4955382", "0.4943279", "0.49413347", "0.49404526", "0.49398187", "0.4934871", "0.4928796", "0.49280336", "0.49237227", "0.4912265", "0.4908242", "0.49004427", "0.4897725", "0.48977205", "0.48872784", "0.48867872", "0.48836216", "0.48835802", "0.48753875", "0.48686746", "0.48634943", "0.48563743", "0.4854572", "0.4851907", "0.48511782", "0.4845102", "0.48330706", "0.48201755", "0.481899", "0.4816904", "0.4813763", "0.48135158", "0.48132804", "0.4808207", "0.48075166", "0.48050427", "0.4804984", "0.4801239", "0.48009416", "0.47996044", "0.47947997", "0.4791764", "0.47913808", "0.47869143", "0.4785805", "0.47855273", "0.47838068" ]
0.0
-1
Read accessor for CourseEnCours attribute
public delistation.datatypes.Course[] CourseEnCours() { while(true) { if (!this._is_local()) { org.omg.CORBA.portable.InputStream _input = null; try { org.omg.CORBA.portable.OutputStream _output = this._request("_get_CourseEnCours",true); _input = this._invoke(_output); return delistation.datatypes.LCoursesHelper.read(_input); } catch (final org.omg.CORBA.portable.RemarshalException _exception) { continue; } catch (final org.omg.CORBA.portable.ApplicationException _exception) { final String _exception_id = _exception.getId(); throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id); } finally { this._releaseReply(_input); } } else { org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("_get_CourseEnCours",_opsClass); if (_so == null) continue; delistation.g_superviseur.G_SuperviseurOperations _self = (delistation.g_superviseur.G_SuperviseurOperations) _so.servant; try { return _self.CourseEnCours(); } finally { _servant_postinvoke(_so); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Course getCourse() {\n return course; //XXX-CHANGE-XXX\n }", "public Course getCourse() {\n return course;\n }", "@Override\r\n\tpublic double getCourse() {\n\t\treturn this.course;\r\n\t}", "public String getCourse() {\n return courseName;\n }", "public Course getCourseById(String id);", "public String getCourseName(){\n return courseName;\n }", "public int getCourseId()\n {\n return this.courseId;\n }", "public String getCourseName()\n {\n return courseName;\n }", "@AutoEscape\n\tpublic String getCourse();", "public String getcourse() {\n\t\treturn course;\n\t}", "public String getCourse() {\n\t\treturn Course;\n\t}", "public java.lang.String getCourseProperty() {\n return courseProperty;\n }", "public Course get(Course course) {\n\t\tString sql = \"SELECT * FROM course WHERE Cour_ID = ?\";\n\t\ttry {\n\t\t\tconn = dataSource.getConnection();\n\t\t\tsmt = conn.prepareStatement(sql);\n\t\t\tsmt.setInt(1, course.getCourId());\n\t\t\trs = smt.executeQuery();\n\t\t\tif(rs.next()){\t\t\t\t\n\t\t\t\tcourse.setCourName(rs.getString(\"Cour_Name\"));\n\t\t\t\tcourse.setCourSemester(rs.getInt(\"Cour_Semester\"));\n\t\t\t\tcourse.setCourObligatory(rs.getString(\"Cour_Obligatory\"));\n\t\t\t\tcourse.setCourBriefIntro(rs.getString(\"Cour_BriefIntro\"));\n//\t\t\t\tcomment.setComUploadDate(rs.getDate(\"Com_Upload_Date\"));\n\t\t\t\tcourse.getCourseCate().setCourCateId(rs.getInt(\"CourCate_ID\"));\n\t\t\t\t\n\t\t\t}\n\t\t\trs.close();\n\t\t\tsmt.close();\n \n\t\t} catch (SQLException e) {\n\t\t\tthrow new RuntimeException(e);\n \n\t\t} finally {\n\t\t\tif (conn != null) {\n\t\t\t\ttry {\n\t\t\t\t\tconn.close();\n\t\t\t\t} catch (SQLException e) {}\n\t\t\t}\n\t\t}\n\t\treturn course;\n\t}", "public Course getCourse() {\n\t\treturn null;\n\t}", "public String getCourseName() {\n return courseName;\n }", "public String getCourseName() {\n return this.courseName;\n }", "public int getCourseID() {\n return courseID;\n }", "public List<Course> getCourse() {\n\t\treturn null;\n\t}", "public Course[] getCourse() {\r\n return course.toArray(new Course[course.size()]);\r\n }", "public String getCourseId() {\n return courseId;\n }", "public String getCourseNum() {\n return this.courseNum;\n }", "public Long getIdCourse() {\n return idCourse;\n }", "public ArrayList<Course> getCoursesInField(){\r\n\t\treturn CourseFieldController.getFieldCourses(this);\r\n\t}", "public String getCourseName() {\n return courseName;\n }", "public String getCourseName() {\n return courseName;\n }", "public String getCourseName() {\n return courseName;\n }", "public String getCourseArea() {\n return courseArea;\n }", "public Courses getCourseTable();", "public Course getCourse(int index) {\n return courseList.get(index); \n }", "public String getCourseName(){//getCourseName body start\n\t\treturn CourseName;\n\t}", "public String getCourses() {\n return courses;\n }", "public String getCourseDesc() {\n return courseDesc;\n }", "@Generated(hash = 2084222915)\n public Court getCourt() {\n String __key = this.courtDm;\n if (court__resolvedKey == null || court__resolvedKey != __key) {\n final DaoSession daoSession = this.daoSession;\n if (daoSession == null) {\n throw new DaoException(\"Entity is detached from DAO context\");\n }\n CourtDao targetDao = daoSession.getCourtDao();\n Court courtNew = targetDao.load(__key);\n synchronized (this) {\n court = courtNew;\n court__resolvedKey = __key;\n }\n }\n return court;\n }", "public String getEventCourse() {\n\t\treturn courseRelation;\n\t}", "public String getCourseID() {\r\n return COURSE_ID;\r\n }", "java.lang.String getCourseName();", "public String getCourseCode() {\n return courseCode;\n }", "public int getEnCours() {\n\t\treturn enCours;\n\t}", "public CourseType getCourseType() {\n return courseType;\n }", "private Course getCourse(String courseId) {\n MongoCollection<Course> courseMongoCollection = mongoDatabase.getCollection(\"course\", Course.class);\n return courseMongoCollection.find(eq(\"_id\", new ObjectId(courseId))).first();\n }", "public String getCourseName()\n\t{\n\t\treturn courseName;\n\t}", "public String getCourseName() {\r\n return COURSE_NAME;\r\n }", "public String getIdCourse() {\n\t\t\treturn idCourse;\n\t\t}", "public String getCourseId() {\n\t\treturn courseId;\n\t}", "public String[] getCourses();", "public List<CurriculumVO> getCourseCurriculum(int courseID);", "public F returnCourse(String studentID){}", "public String getCourseName() {\r\n\t\treturn CourseName;\r\n\t}", "public String getCourseCode() {\r\n\t\treturn this.courseCode;\r\n\t}", "public String getCourseName() {\n\t\treturn CourseName;\n\t}", "public UnivClass getCourse(){\n\t\treturn courses.dequeue();\n\t}", "@Override\n public String getCourseName() {\n return this.deadline.getCourseName();\n }", "public CurricularCourseDTO getData() {\n\t\t// Retrieve data\n\t\tCurricularCourseDTO data = componentCurricularCourseIdentification\n\t\t\t\t.getData();\n\t\tdata.setDegreeCurricularPlan(componentDegreeCurricularPlan.getData());\n\n\t\treturn data;\n\t}", "public String getCourseCode() {\n\t\treturn CourseCode;\n\t}", "@Override\n\tpublic Course getCourse(String id) {\n\t\treturn null;\n\t}", "public LinkedList<Course> getCourseList() {\n return courseList;\n }", "public Long getTeacCourseId() {\n return teacCourseId;\n }", "private Course getCourse(int courseOrder) throws IOException {\n URL url = new URL(BASE_URL + courseOrder);\n InputStream input = url.openStream();\n Course course\n = JAXB.unmarshal(new InputStreamReader(input), Course.class);\n return course;\n }", "@GetMapping(\"/findCourseDetailsWithCourseID/{courseId}\")\n\tpublic ResponseEntity<?> getCourse(@PathVariable(\"courseId\") int id) {\n\t\t// UniversityStaffMember staff=universityService.viewStaff(sid);\n\t\tCourse c = courseService.viewCourse(id);\n\t\tif (c == null)\n\t\t\tthrow new DataNotFoundException(\"Request\", \"course with id \" + id + \" not found.\");\n\t\telse\n\t\t\treturn new ResponseEntity<Course>(c, HttpStatus.OK);\n\t}", "public String getColl(){\n return this.college;\n }", "public String getCourseAcademy() {\n return courseAcademy;\n }", "public CourseVo getCourseInfo(Integer courseId) {\n\t\treturn (CourseVo) courseVoMapper.getCourseInfo(courseId);\n\t}", "private static HashMap<Integer, Course> getCourses() {\r\n return IO.getCoursesFromInput(); // get courses from file\r\n }", "public String getCourseName() {\n\t\treturn courseName;\n\t}", "public Course getCourseFomCache(String courseId) {\n return courseIdToCourse.get(courseId);\n }", "public static Course get(int index) {\n return courses.get(index);\n }", "public String getCourseNumber ( )\n\t{\n\t\treturn courseNumber;\n\t}", "@Override\n\tpublic void readCpteCourant(CompteCourant cpt) {\n\t\t\n\t}", "public Float getCourseCredit() {\n return courseCredit;\n }", "public int getNumberOfCourses(){}", "public int getID() {\n return courseID;\n }", "com.google.protobuf.ByteString getCourseNameBytes();", "public ArrayList getCourses();", "public Course getCourse(int crn)\n\t{\n\t\tCourse rVal = null;\n\n\t\tCourse testKey = dummyCourse(crn);\n\t\tCourse possibleRVal = courseOfferings.floor(testKey);\n\n\t\tif (possibleRVal != null && possibleRVal.equals(testKey))\n\t\t{\n\t\t\trVal = possibleRVal;\n\t\t}\n\n\t\treturn rVal;\n\t}", "public Course getCourseById(int id) {\n\t\treturn null;\n\t}", "public ArrayList<String> getCourseList() {\r\n\t\treturn courseList;\r\n\t}", "public String getCourseTitle() {\n return courseTitle;\n }", "public Course getCourseById(int id) {\n\t\treturn this.getHibernateTemplate().get(Course.class, id);\n\t}", "public Course[] getCourses() {\n\t\tCourse[] temp = new Course[this.noc];\n\t\t\n\t\tfor(int i = 0; i < this.noc; i++) {\n\t\t\ttemp[i] = this.courseList[i];\n\t\t}\n\t\t\n\t\t\n\t\treturn temp;\n\t}", "public String getCourseType() {\n return courseType;\n }", "private void getCourseList(){\r\n\r\n CourseDAO courseDAO = new CourseDAO(Statistics.this);\r\n List<Course> courseList= courseDAO.readListofCourses();\r\n for(Course course: courseList) {\r\n courses.add(course.getName());\r\n }\r\n\r\n }", "public ArrayList <Course> getCourseList ()\n\n {\n\n // Returns courseList when called.\n return courseList;\n\n }", "@Override\r\n\tpublic Course getCourse(int cid) {\n\t\ttry {\r\n\t\t\tCourse dummy=new Course();\r\n\t\t\tdummy.setCid(cid);\r\n\t\t\tif(allCoursesList.contains(dummy))\r\n\t\t\t{\r\n\t\t\t\tint index=allCoursesList.indexOf(dummy);\r\n\t\t\t\treturn allCoursesList.get(index);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tConnection connection=DBConnection.getConnection();\r\n\t\t\tString sqlQuery=\"select * from \"+TABLECourse+\" where \"+COLcid+\" = ?\";\r\n\t\t\tPreparedStatement pst;\r\n\t\t\tpst = connection.prepareStatement(sqlQuery);\r\n\t\t\tpst.setInt(1, cid);\r\n\t\t\tpst.executeQuery();\r\n\t\t\tResultSet rs=pst.getResultSet();\r\n\t\t\t\r\n\t\t\tif(rs.next()==false)\r\n\t\t\t{\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\tString name=rs.getString(COLcname);\r\n\t\t\tint duration=rs.getInt(COLduration);\r\n\t\t\tint fees=rs.getInt(COLfees);\r\n\t\t\t\r\n\t\t\tCourse course =new Course(cid,name,duration,fees);\r\n\t\t\tallCoursesList.add(course);\r\n\t\t\treturn course;\r\n\t\t} catch (SQLException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn null;\r\n\t\t\r\n\t\t\r\n\t}", "Course() {\r\n\t\tsetValidDays(true);\r\n\t\tsetName(null);\r\n\t\tsetNumberOfDays(0);\r\n\t\tsetPrice(0.0);\r\n\t}", "public long getCourseId() {\n return _courseImage.getCourseId();\n }", "public CuentaContable getCuentaContableCierre()\r\n/* 98: */ {\r\n/* 99:115 */ return this.cuentaContableCierre;\r\n/* 100: */ }", "public CuentaContable getCuentaContable()\r\n/* 299: */ {\r\n/* 300:367 */ return this.cuentaContable;\r\n/* 301: */ }", "@Override\npublic ArrayList<String> courses() {\n\tArrayList<String> studentCourses = new ArrayList<String>();\n\tstudentCourses.add(\"CMPE - 273\");\n\tstudentCourses.add(\"CMPE - 206\");\n\tstudentCourses.add(\"CMPE - 277\");\n\tSystem.out.println(this.name+\" has take these courses\");\n\tfor(int i = 0 ; i < studentCourses.size() ; i++){\n\t\tSystem.out.println( studentCourses.get(i));\n\t}\n\treturn null;\n}", "CourseParticipant getCourseParticInOneCourse(UUID courseCourseParticUuid);", "@Override\n\tpublic String getCourseId() \n\t{\n\t\treturn null;\n\t}", "@GetMapping(\"/courses\")\r\n\tpublic List<Courses> getCourses() {\r\n\t\treturn this.cs.getCourses();\r\n\r\n\t}", "public void setCourse(String course);", "public CourseTypeList getCourseTypeList()\n {\n return courseTypeList;\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic List<Course> getAllCourses() {\n\t\treturn this.getHibernateTemplate().find(\"from Course cs order by cs.cno\");\n\t \n\t}", "@Override\n\tpublic String getCourseName() {\n\t\treturn null;\n\t}", "public java.lang.String getCourseName() {\n\t\t\t\tjava.lang.Object ref = courseName_;\n\t\t\t\tif (!(ref instanceof java.lang.String)) {\n\t\t\t\t\tcom.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;\n\t\t\t\t\tjava.lang.String s = bs.toStringUtf8();\n\t\t\t\t\tcourseName_ = s;\n\t\t\t\t\treturn s;\n\t\t\t\t} else {\n\t\t\t\t\treturn (java.lang.String) ref;\n\t\t\t\t}\n\t\t\t}", "public CourseMemberGet() {\n\t\tsuper();\n\t}", "public java.lang.String getCourseName() {\n\t\t\tjava.lang.Object ref = courseName_;\n\t\t\tif (ref instanceof java.lang.String) {\n\t\t\t\treturn (java.lang.String) ref;\n\t\t\t} else {\n\t\t\t\tcom.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;\n\t\t\t\tjava.lang.String s = bs.toStringUtf8();\n\t\t\t\tcourseName_ = s;\n\t\t\t\treturn s;\n\t\t\t}\n\t\t}", "public Course getCourse(String courseId) {\n return courses.get(courseId);\n }", "Map<String, String> fetchCourseDetails(String courseId);" ]
[ "0.7060265", "0.69882333", "0.65920794", "0.6562323", "0.6486885", "0.6423614", "0.64222586", "0.64124376", "0.6402834", "0.63868684", "0.63816607", "0.6257854", "0.6213117", "0.621111", "0.6188446", "0.6150706", "0.61500376", "0.6148725", "0.6111963", "0.6102329", "0.60964864", "0.60726714", "0.60636675", "0.6059707", "0.6059707", "0.6059707", "0.60429466", "0.601714", "0.6016931", "0.60054266", "0.6003418", "0.60011345", "0.5974062", "0.59544504", "0.5951976", "0.58979326", "0.5889395", "0.5869484", "0.585109", "0.5807138", "0.58050984", "0.5785152", "0.5781499", "0.5774122", "0.5767174", "0.575738", "0.5754008", "0.5753805", "0.5730346", "0.5721913", "0.56983197", "0.5697428", "0.56909657", "0.5680329", "0.5673146", "0.56715727", "0.5665695", "0.5657239", "0.5646861", "0.56305397", "0.56177646", "0.5609969", "0.55908555", "0.55858606", "0.5565874", "0.55539006", "0.55496794", "0.552519", "0.5517398", "0.55032283", "0.55026716", "0.549504", "0.54946524", "0.5473301", "0.5470338", "0.5465138", "0.5455053", "0.545397", "0.5440038", "0.54260564", "0.5409839", "0.5403647", "0.53939396", "0.5377191", "0.5374377", "0.5369284", "0.5364811", "0.53644496", "0.5363464", "0.5348174", "0.53436387", "0.53398824", "0.5338293", "0.5336163", "0.5315831", "0.531386", "0.53085846", "0.53003854", "0.5296892", "0.5295505" ]
0.667869
2
Initializes all config fields.
void init();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public synchronized static void initConfig() {\n SeLionLogger.getLogger().entering();\n Map<ConfigProperty, String> initialValues = new HashMap<>();\n\n initConfig(initialValues);\n\n SeLionLogger.getLogger().exiting();\n }", "public synchronized static void initConfig() {\n\t\tMap<CatPawConfigProperty, String> initialValues = new HashMap<CatPawConfigProperty, String>();\n\t\tinitConfig(initialValues);\n\t}", "private static synchronized void init() {\n if (CONFIG_VALUES != null) {\n return;\n }\n\n CONFIG_VALUES = new Properties();\n processLocalConfig();\n processIncludedConfig();\n }", "private void initConfiguration() {\n\t\tseedList = new ArrayList<String>();\n\t\t// TODO: add other initialization here...\n\t}", "public void init() {\n if (getConfig().isEnabled()) {\n super.init();\n }\n }", "@Override\n\tprotected void initializeFields() {\n\n\t}", "private static void initConfig() {\n /*\n * Human IO\n */\n {\n /*\n * Constants\n */\n {\n /*\n * Joysticks\n */\n {\n addToConstants(\"joysticks.left\", 0);\n addToConstants(\"joysticks.right\", 1);\n addToConstants(\"joysticks.operator\", 2);\n }\n\n /*\n * Buttons and axis\n */\n {\n }\n }\n }\n\n /*\n * RobotIO\n */\n {\n /*\n * Constants\n */\n {\n /*\n * Kicker\n */\n addToConstantsA(\"kicker.encoder.distPerPulse\", 360.0 / 1024.0);\n }\n }\n\n /*\n * Chassis\n */\n {\n /*\n * Constants\n */\n {\n }\n\n /*\n * Variables\n */\n {\n }\n }\n\n /*\n * Kicker\n */\n {\n /*\n * Constants\n */\n {\n addToConstants(\"kicker.kick.normal\", 1.75);\n addToConstants(\"kicker.kick.timeout\", 0.75);\n\n addToConstants(\"kicker.shaken.voltage\", -0.3316);\n addToConstants(\"kicker.shaken.tolerance\", 3.0);\n\n addToConstants(\"kicker.zero.voltage\", 0.8);\n addToConstants(\"kicker.zero.duration\", 0.75);\n }\n\n /*\n * Variables\n */\n {\n }\n }\n\n /*\n * Gripper\n */\n {\n /*\n * Constants\n */\n {\n addToConstants(\"gripper.collection.voltage\", 0.82);\n addToConstants(\"gripper.ejection.voltage\", -0.45);\n }\n }\n }", "public static void initialize() {\n \tinitialize(new Configuration().configure());\n }", "protected void initialise() {\r\n loadDefaultConfig();\r\n loadCustomConfig();\r\n loadSystemConfig();\r\n if (LOG.isDebugEnabled()) {\r\n LOG.debug(\"--- Scope properties ---\");\r\n for (Iterator i = properties.keySet().iterator(); i.hasNext(); ) {\r\n String key = (String) i.next();\r\n Object value = properties.get(key);\r\n LOG.debug(key + \" = \" + value);\r\n }\r\n LOG.debug(\"------------------------\");\r\n }\r\n }", "public void init() {\n \t\tif (initLock.start()) {\n \t\t\ttry {\n \t\t\t\tthis._init(this.config);\n \t\t\t} finally {\n \t\t\t\tinitLock.end();\n \t\t\t}\n \t\t}\n \t}", "protected void initialize() {\n \t\n }", "public static void initConfig()\r\n {\r\n try\r\n {\r\n ip = ConfigProperties.getKey(ConfigList.BASIC, \"AgentGateway_IP\");\r\n localIP = ConfigProperties.getKey(ConfigList.BASIC, \"Local_IP\");\r\n port = Integer.parseInt(ConfigProperties.getKey(ConfigList.BASIC, \"AgentGateway_PORT\"));\r\n }\r\n catch (NumberFormatException e)\r\n {\r\n log.error(\"read properties failed --\", e);\r\n }\r\n }", "protected void initialize()\n {\n uiFactory.configureUIComponent(this, UI_PREFIX);\n\n initializeFields();\n initializeLabels();\n initLayout();\n }", "protected void initialize() {\n\t\tif (fields != null) {\n\t\t\tIterator<FieldEditor> e = fields.iterator();\n\t\t\twhile (e.hasNext()) {\n\t\t\t\tFieldEditor pe = e.next();\n\t\t\t\tpe.setPage(this);\n\t\t\t\tpe.setPropertyChangeListener(this);\n\t\t\t\tpe.setPreferenceStore(getPreferenceStore());\n\t\t\t\tpe.load();\n\t\t\t}\n\t\t}\n\t}", "@Init\r\n\tpublic void init() {\r\n\t\t// Component initialization code.\r\n\t\t// All properties are initialized and references are injected.\r\n\t\tif(emailConfiguration==null){\r\n\t\t\tloadConfiguration();\r\n\t\t}\r\n\t\t\r\n\t}", "private void initialize()\n {\n aggregatedFields = new Fields(fieldToAggregator.keySet());\n }", "private void init() {\n\t\tinitDesign();\n\t\tinitHandlers();\n\t}", "private void init() {\r\n this.configMapping = ChannelConfigHolder.getInstance().getConfigs();\r\n if (!isValid(this.configMapping)) {\r\n SystemExitHelper.exit(\"Cannot load the configuations from the configuration file please check the channelConfig.xml\");\r\n }\r\n }", "public void initialize() {\n // empty for now\n }", "public void initialize() {\n final ConfigurationManager config = ConfigurationManager.getInstance();\n boolean overrideLog = System.getProperty(\"azureus.overridelog\") != null;\n\n for (int i = 0; i < ignoredComponents.length; i++) {\n ignoredComponents[i] = new ArrayList();\n }\n\n if (!overrideLog) {\n config.addListener(new COConfigurationListener() {\n public void configurationSaved() {\n checkLoggingConfig();\n }\n });\n }\n\n checkLoggingConfig();\n config.addParameterListener(CFG_ENABLELOGTOFILE, new ParameterListener() {\n public void parameterChanged(String parameterName) {\n FileLogging.this.reloadLogToFileParam();\n }\n });\n }", "protected void initialize() {\r\n }", "protected void initialize() {\r\n }", "public void init() {\n\t\t}", "protected void initialize() {\n\n\t}", "public void initialize()\n {\n }", "protected void init() {\n }", "public void initialize(){\n\t\t//TODO: put initialization code here\n\t\tsuper.initialize();\n\t\t\n\t}", "protected abstract void _init(DynMap config);", "public void initialize() {\n // TODO\n }", "private void initFields() {\n\n tipPercent = 0.0;\n noPersons = 1;\n totalPay = 0.0;\n totalTip = 0.0;\n totalPerPerson = 0.0;\n\n }", "public void init() {\n entityPropertyBuilders.add(new DefaultEntityComponentBuilder(environment));\n entityPropertyBuilders.add(new FilterTransientFieldComponentBuilder(environment));\n entityPropertyBuilders.add(new MakeAccessibleComponentBuilder(environment));\n entityPropertyBuilders.add(new PrimaryKeyComponentBuilder(environment));\n\n // Field meta property builders\n fieldPropertyBuilders.add(new FilterPrimaryKeyComponentBuilder(environment));\n fieldPropertyBuilders.add(new FilterTransientFieldComponentBuilder(environment));\n fieldPropertyBuilders.add(new MakeAccessibleComponentBuilder(environment));\n fieldPropertyBuilders.add(new TtlFieldComponentBuilder(environment));\n fieldPropertyBuilders.add(new CompositeParentComponentBuilder(environment));\n fieldPropertyBuilders.add(new CollectionFieldComponentBuilder(environment));\n fieldPropertyBuilders.add(new MapFieldComponentBuilder(environment));\n fieldPropertyBuilders.add(new SimpleFieldComponentBuilder(environment));\n }", "protected void init() {\n\t}", "protected void init() {\n\t}", "private void init() {\n\t\tinitProtocol();\n\t\tinitResultStorage();\n\t}", "private void initConfigVar() {\n\t\tConfigUtils configUtils = new ConfigUtils();\n\t\tmenuColor = configUtils.readConfig(\"MENU_COLOR\");\n\t\taboutTitle = configUtils.readConfig(\"ABOUT_TITLE\");\n\t\taboutHeader = configUtils.readConfig(\"ABOUT_HEADER\");\n\t\taboutDetails = configUtils.readConfig(\"ABOUT_DETAILS\");\n\t\tgsTitle = configUtils.readConfig(\"GS_TITLE\");\n\t\tgsHeader = configUtils.readConfig(\"GS_HEADER\");\n\t\tgsDetailsFiles = configUtils.readConfig(\"GS_DETAILS_FILES\");\n\t\tgsDetailsCases = configUtils.readConfig(\"GS_DETAILS_CASES\");\n\t}", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n }", "protected void initialize() {\n // Attribute Load\n this.attributeMap.clear();\n this.attributeMap.putAll(this.loadAttribute());\n // RuleUnique Load\n this.unique = this.loadRule();\n // Marker Load\n this.marker = this.loadMarker();\n // Reference Load\n this.reference = this.loadReference();\n }", "protected void initialize()\n\t{\n\t}", "protected void initialize() {\n\t}", "public void init() {\n \n }", "private void initialize() {\n\t\tinitializeModel();\n\t\tinitializeBoundary();\n\t\tinitializeController();\n\t}", "public void init() {\r\n\r\n\t}", "@Override\n public void init() throws Exception {\n config = new Config();\n }", "public void initialConfig() {\n }", "protected void initialize() {}", "protected void initialize() {}", "protected void initialize() {\n\t\t\n\t}", "protected void initialize() {\n\t\t\n\t}", "public void init() {\n // the config string contains just the asset store directory path\n //set baseDir?\n this.initialized = true;\n }", "@objid (\"4bb3363c-38e1-48f1-9894-6dceea1f8d66\")\n public void init() {\n }", "@Override public void init()\n\t\t{\n\t\t}", "@Override\n public void init()\n throws InitializationException\n {\n // Create a default configuration.\n String[] def = new String[]\n {\n DEFAULT_RUN_DATA,\n DEFAULT_PARAMETER_PARSER,\n DEFAULT_COOKIE_PARSER\n };\n configurations.put(DEFAULT_CONFIG, def.clone());\n\n // Check other configurations.\n Configuration conf = getConfiguration();\n if (conf != null)\n {\n String key,value;\n String[] config;\n String[] plist = new String[]\n {\n RUN_DATA_KEY,\n PARAMETER_PARSER_KEY,\n COOKIE_PARSER_KEY\n };\n for (Iterator<String> i = conf.getKeys(); i.hasNext();)\n {\n key = i.next();\n value = conf.getString(key);\n int j = 0;\n for (String plistKey : plist)\n {\n if (key.endsWith(plistKey) && key.length() > plistKey.length() + 1)\n {\n key = key.substring(0, key.length() - plistKey.length() - 1);\n config = (String[]) configurations.get(key);\n if (config == null)\n {\n config = def.clone();\n configurations.put(key, config);\n }\n config[j] = value;\n break;\n }\n j++;\n }\n }\n }\n\n\t\tpool = (PoolService)TurbineServices.getInstance().getService(PoolService.ROLE);\n\n if (pool == null)\n {\n throw new InitializationException(\"RunData Service requires\"\n + \" configured Pool Service!\");\n }\n\n parserService = (ParserService)TurbineServices.getInstance().getService(ParserService.ROLE);\n\n if (parserService == null)\n {\n throw new InitializationException(\"RunData Service requires\"\n + \" configured Parser Service!\");\n }\n\n setInit(true);\n }", "protected void initialize()\r\n {\n }", "public void init() {\n\n\t}", "public void init() {\n\n\t}", "public void init() {\n\n\t}", "public void initialize() {\n\t\tDynamoConfig config = new DynamoConfig();\n\t\tthis.setup(config);\n\t}", "protected void initDataFields() {\r\n //this module doesn't require any data fields\r\n }", "protected void initialize() {\n\t\tsetBodyColor(Color.BLACK);\r\n\t\tsetGunColor(Color.BLACK);\r\n\t\tsetRadarColor(Color.BLACK);\r\n\t\tsetScanColor(Color.BLUE);\r\n\t\tsetBulletColor(Color.RED);\r\n\t}", "private void init() {\n FieldWrapper id = new FieldWrapper();\n id.fieldDescription = new HashMap<String, Object>();\n id.fieldDescription.put(\"fullName\", \"Id\");\n id.fieldDescription.put(\"type\", \"Text\");\n\n FieldWrapper name = new FieldWrapper();\n name.fieldDescription = new HashMap<String, Object>();\n name.fieldDescription.put(\"fullName\", \"Name\");\n\n FieldWrapper createdBy = new FieldWrapper();\n createdBy.fieldDescription = new HashMap<String, Object>();\n createdBy.fieldDescription.put(\"fullName\", \"CreatedBy\");\n createdBy.fieldDescription.put(\"type\", \"Lookup\");\n\n FieldWrapper lastModifiedBy = new FieldWrapper();\n lastModifiedBy.fieldDescription = new HashMap<String, Object>();\n lastModifiedBy.fieldDescription.put(\"fullName\", \"LastModifiedBy\");\n lastModifiedBy.fieldDescription.put(\"type\", \"Lookup\");\n\n FieldWrapper owner = new FieldWrapper();\n owner.fieldDescription = new HashMap<String, Object>();\n owner.fieldDescription.put(\"fullName\", \"Owner\");\n owner.fieldDescription.put(\"type\", \"Lookup\");\n\n fieldDescribe = new HashMap<String, FieldWrapper>();\n\n fieldDescribe.put((String) id.fieldDescription.get(\"fullName\"), id);\n fieldDescribe.put((String) name.fieldDescription.get(\"fullName\"), name);\n fieldDescribe.put((String) createdBy.fieldDescription.get(\"fullName\"), createdBy);\n fieldDescribe.put((String) lastModifiedBy.fieldDescription.get(\"fullName\"), lastModifiedBy);\n fieldDescribe.put((String) owner.fieldDescription.get(\"fullName\"), owner);\n }", "private void initList() {\n long now = System.nanoTime();\n loadConfig();\n SlogEx.d(TAG, \"load config use:\" + (System.nanoTime() - now));\n }", "public void initialize() {\r\n }", "public void initialize() {\n\t}", "public void initialize() {\n\t}", "public void initDefaultValues() {\n }", "private Config() {\n }", "protected void initialize() {\n\n }", "private void initialize() {\n }", "protected void init(){\n }", "public void initialize() {\n\n fechaDeLaVisita.set(LocalDate.now());\n\n if (medico.get() != null) {\n medico.get().clear();\n } else {\n medico.set(new Medico());\n }\n\n turnoVisita.set(\"\");\n visitaAcompanadaSN.set(false);\n lugarVisita.set(\"\");\n if (causa.get() != null) {\n causa.get().clear();\n } else {\n causa.set(new Causa());\n }\n\n if (promocion.get() != null) {\n promocion.get().clear();\n } else {\n promocion.set(new Promocion());\n }\n\n observacion.set(\"\");\n persistida.set(false);\n persistidoGraf.set(MaterialDesignIcon.SYNC_PROBLEM.graphic());\n\n fechaCreacion.set(LocalDateTime.now());\n\n }", "private void init() {\n\n\t}", "public void initialize() {\n }", "private Config()\n {\n // Load from properties file:\n loadLocalConfig();\n // load the system property overrides:\n getExternalConfig();\n }", "public void init() {\n\t}", "public void init() {\n\t}", "public void init() {\n\t}", "private void initialize() {\n\t}", "private void init() {\n }", "private void init() {\n }", "private void init() {\n }", "private void init() {\n }", "@FXML protected void initialize() {\n\t\tinitConfigVar();\n\t\tapplyStyle();\n\t}", "public void init() {\n\t\n\t}", "public void init() {\n log.info(\"initialization\");\n }" ]
[ "0.7115953", "0.7097988", "0.70862854", "0.7039013", "0.6977848", "0.6887913", "0.6875101", "0.68419087", "0.68295187", "0.6823274", "0.6816665", "0.6807302", "0.6778714", "0.67688555", "0.67504066", "0.6725149", "0.66789293", "0.66453177", "0.6641786", "0.6641375", "0.6559981", "0.6559981", "0.6557842", "0.65445733", "0.6542207", "0.6528165", "0.6524855", "0.65218765", "0.652096", "0.6520322", "0.6514901", "0.6510958", "0.6510958", "0.6505769", "0.65015024", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6501089", "0.6490907", "0.64891905", "0.64875674", "0.6481238", "0.64729416", "0.64458674", "0.64394194", "0.64305985", "0.6428209", "0.6428209", "0.6426118", "0.6426118", "0.642405", "0.6423327", "0.64039767", "0.64038324", "0.63987064", "0.6398285", "0.6398285", "0.6398285", "0.6397896", "0.6378306", "0.6375515", "0.636728", "0.6362344", "0.6360191", "0.63591534", "0.63591534", "0.6351169", "0.63488585", "0.6329019", "0.6327107", "0.63263774", "0.63261336", "0.6324847", "0.6313955", "0.6306956", "0.6305987", "0.6305987", "0.6305987", "0.6303487", "0.6302738", "0.6302738", "0.6302738", "0.6302738", "0.630141", "0.6297814", "0.6295063" ]
0.0
-1
Gets the primary EmojIDE bot token to use.
String getPrimaryToken();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static String getToken() {\n String token = \"96179ce8939c4cdfacba65baab1d5ff8\";\n return token;\n }", "@Override\n public String getBotToken() {\n return \"412386556:AAHawYQpPaNLFdnpckQsYr7c3YdBQZEXy0I\";\n }", "@Override\r\n\tpublic String getBotToken() {\t\t\r\n\t\treturn BotConfig.BOT_TOKEN;\r\n\t}", "public String getToken() {\n return token.get();\n }", "public String token() {\n return Codegen.stringProp(\"token\").config(config).require();\n }", "public String getToken() {\n return instance.getToken();\n }", "public String getToken() {\n return instance.getToken();\n }", "public String getToken() {\n return instance.getToken();\n }", "public static String getToken() {\n \treturn mToken;\n }", "private String m2194g() {\n return this.f980b.m1158c().getSharedPreferences(\"com.facebook.login.AuthorizationClient.WebViewAuthHandler.TOKEN_STORE_KEY\", 0).getString(\"TOKEN\", \"\");\n }", "public String getToken()\n {\n return token;\n }", "public String getToken() {\r\n return token;\r\n }", "public String getToken() {\r\n return token;\r\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n\t\treturn token;\n\t}", "public String getToken() {\n\t\treturn token;\n\t}", "private static String getAppTokenId() {\n if (appTokenId == null) {\n synchronized (DefaultEntityManagerImpl.class) {\n if (appTokenId == null) {\n try {\n if (OAuthProperties.isServerMode()) {\n appTokenId = OAuthServiceUtils.getAdminTokenId();\n }\n else {\n final String username =\n OAuthProperties.get(PathDefs.APP_USER_NAME);\n final String password =\n OAuthProperties.get(PathDefs.APP_USER_PASSWORD);\n appTokenId =\n OAuthServiceUtils.authenticate(username, password, false);\n }\n }\n catch (final OAuthServiceException oe) {\n Logger.getLogger(DefaultEntityManagerImpl.class.getName()).log(\n Level.SEVERE, null, oe);\n throw new WebApplicationException(oe);\n }\n }\n }\n }\n return appTokenId;\n }", "public String getIdToken() throws IOException {\n return (String)userInfo.get(\"id_token\");\n }", "java.lang.String getRemoteToken();", "public String getToken() {\n return token_;\n }", "public String getToken() {\n return token_;\n }", "public String getToken() {\n return token_;\n }", "public String getTokenKey()\r\n\t{\r\n\t\treturn TOKEN_KEY;\r\n\t}", "@Nonnull\n public final String getToken() {\n return this.token;\n }", "public String getToken() {\n return this.token;\n }", "public String getToken();", "public String getToken() {\n return this.token;\n }", "public String getToken() {\n\n return this.token;\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getRemoteToken() {\n java.lang.Object ref = remoteToken_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n remoteToken_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n token_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n token_ = s;\n return s;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n token_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n token_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n }\n }", "public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n }\n }", "public String getToken() {\n return this.token;\n }", "public String getTokenId() {\n return tokenId;\n }", "public String getAppToken() {\r\n return appToken;\r\n }", "public java.lang.String getTokenId() {\n java.lang.Object ref = tokenId_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n tokenId_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "@java.lang.Override\n public java.lang.String getToken() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n token_ = s;\n }\n return s;\n }\n }", "public java.lang.String getTokenId() {\n java.lang.Object ref = tokenId_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n tokenId_ = s;\n return s;\n }\n }", "public byte[] getToken() {\n\t\treturn this.token;\n\t}", "@java.lang.Override\n public java.lang.String getRemoteToken() {\n java.lang.Object ref = remoteToken_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n remoteToken_ = s;\n return s;\n }\n }", "public String getToken()\n {\n return ssProxy.getToken();\n }", "public String getStringToken()\n\t{\n\t\tgetToken();\n\t\treturn token;\n\t}", "public T getToken() {\n return this.token;\n }", "public byte[] getToken() {\n if (token_ != null)\n return primitiveGetToken();\n return null;\n }", "public String getUserToken() {\n if (userinfo == null)\n return null;\n return userinfo.token;\n }", "static String getToken(Context context) {\r\n SharedPreferences preferences = context.getSharedPreferences(context.getString(R.string.shared_preferences), MODE_PRIVATE);\r\n return preferences.getString(context.getString(R.string.token), null);\r\n }", "public DsByteString getToken() {\n return sToken;\n }", "String getToken();", "String getToken();", "String getToken();", "String getToken();", "String getToken();", "public String token() {\n return this.token;\n }", "public io.lightcone.data.types.TokenID getTokenId() {\n if (tokenIdBuilder_ == null) {\n return tokenId_ == null ? io.lightcone.data.types.TokenID.getDefaultInstance() : tokenId_;\n } else {\n return tokenIdBuilder_.getMessage();\n }\n }", "java.lang.String getChannelToken();", "java.lang.String getChannelToken();", "public String userToken() {\n return userToken;\n }", "public Token getToken() {\n return token;\n }", "public String getAuthtoken() {\n return authtoken;\n }", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "public String getAuthToken() {\n\t\tString token = options.getProperty(\"auth-token\");\n\t\tif(token == null) {\n\t\t\ttoken = options.getProperty(\"Authentication-Token\");\n\t\t}\n\t\treturn trimedValue(token);\n\t}", "public java.lang.String getToken(){\n return localToken;\n }", "public String onCreateTokenForHistory() {\n switch (Storage.getCurrentlyLoadedView()) {\n case Constants.CLIENT_DEMANDS:\n return CLIENT_DEMANDS_STRING;\n case Constants.CLIENT_OFFERED_DEMANDS:\n return CLIENT_OFFERED_DEMANDS_STRING;\n case Constants.CLIENT_ASSIGNED_DEMANDS:\n return CLIENT_ASSIGNED_DEMANDS_STRING;\n case Constants.CLIENT_CLOSED_DEMANDS:\n return CLIENT_CLOSED_DEMANDS_STRING;\n case Constants.CLIENT_RATINGS:\n return CLIENT_RATINGS_STRING;\n default:\n return NONE_STRING;\n }\n }", "public String getDeviceToken() {\n return FirebaseInstanceId.getInstance().getToken();\n }", "public java.lang.String getToken(){\r\n return localToken;\r\n }", "public String getTokenId() {\n return this.TokenId;\n }", "public String getLongToken() {\n return instance.getLongToken();\n }", "public String getLongToken() {\n return instance.getLongToken();\n }", "public int getPlayerToken() {\n\t\treturn playerToken;\n\t}", "@java.lang.Override\n public com.google.protobuf.ByteString\n getTokenBytes() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n token_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public Guid getUserToken() {\n return localUserToken;\n }", "public Guid getUserToken() {\n return localUserToken;\n }", "public Guid getUserToken() {\n return localUserToken;\n }", "public String getPlayerToken(String playerName) throws Exception {\n return this.getJogadorByName(playerName).getCorPeao();\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n java.lang.Object ref = token_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n token_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n return instance.getTokenBytes();\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n return instance.getTokenBytes();\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n return instance.getTokenBytes();\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n java.lang.Object ref = token_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n token_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n java.lang.Object ref = token_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n token_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n java.lang.Object ref = token_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n token_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n java.lang.Object ref = token_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n token_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getTokenBytes() {\n java.lang.Object ref = token_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n token_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }" ]
[ "0.69581664", "0.6888638", "0.68491036", "0.65881974", "0.6567986", "0.6388356", "0.6388356", "0.6388356", "0.63559246", "0.6353398", "0.6351918", "0.6337298", "0.6337298", "0.63368917", "0.63368917", "0.63368917", "0.63368917", "0.63368917", "0.6266712", "0.6266712", "0.62662286", "0.626599", "0.6237464", "0.6203511", "0.6203511", "0.6203511", "0.6193965", "0.6171632", "0.61623734", "0.6159429", "0.6157645", "0.6154261", "0.61513305", "0.61513305", "0.61513305", "0.61207324", "0.6120447", "0.6120311", "0.6113932", "0.6113932", "0.6107812", "0.6107812", "0.6107812", "0.6107812", "0.61064154", "0.61055654", "0.60514927", "0.6044639", "0.6037501", "0.6037161", "0.6034161", "0.60170925", "0.6014185", "0.5997741", "0.5964234", "0.5963493", "0.5962931", "0.59481597", "0.5945337", "0.5926465", "0.5926465", "0.5926465", "0.5926465", "0.5926465", "0.59139496", "0.5913198", "0.5905891", "0.5905891", "0.58879304", "0.58774334", "0.58682626", "0.5864506", "0.5864506", "0.5864506", "0.5864506", "0.5864506", "0.5864506", "0.58573914", "0.5853088", "0.58486307", "0.5834239", "0.5830033", "0.58267975", "0.5801728", "0.5801728", "0.5801074", "0.57955784", "0.57874537", "0.57874537", "0.57874537", "0.57864654", "0.5760074", "0.5755504", "0.5755504", "0.5755504", "0.5749451", "0.5749451", "0.5749451", "0.5749451", "0.5749451" ]
0.66046834
3
Gets a list of servers the bot is in and has admin access to, to upload emojis.
List<Long> getServers();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static List<SkungeeServer> getServers() {\n\t\treturn ServerManager.getServers();\n\t}", "public List<Server> getServerList() {\n return new ArrayList<Server>(serversList);\n }", "public List<Server> getServerList() {\n return serverList;\n }", "public List<Server> getAllServers(){\n\t\tlogger.info(\"Getting the all server details\");\n\t\treturn new ArrayList<Server>(servers.values());\n\t}", "List<Server> servers() {\n return servers;\n }", "public ServerList getServers() {\r\n return this.servers;\r\n }", "public ArrayList<Server> getServers(){\n return this.serversList;\n }", "public List<String> getCPanelServerList() {\n\t\tString cPanelServerList = getProperties().getProperty(\"cpanel.server.list\").trim();\n\t\tString[] cPanelServerArray= cPanelServerList.split(\"#\");\n\t\tList<String> result = new ArrayList<String>(); \n\t\tfor(String cPanelServer: cPanelServerArray){\n\t\t\tString[] params = cPanelServer.split(\",\");\n\t\t\tif(params!= null && params.length>1){\n\t\t\t\tString cpanelIP = params[0];\n\t\t\t\tresult.add(cpanelIP);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public List<ServerHardware> getServers();", "private List<Server> getRemoteServers() {\n if (!isDas())\n throw new RuntimeException(\"Internal Error\"); // todo?\n\n List<Server> notdas = new ArrayList<Server>(targets.size());\n String dasName = serverEnv.getInstanceName();\n\n for (Server server : targets) {\n if (!dasName.equals(server.getName()))\n notdas.add(server);\n }\n\n return notdas;\n }", "public java.lang.String[] getServerIds() {\r\n return serverIds;\r\n }", "@SuppressWarnings(\"unused\")\n public static List<String> getDiscordChatMutedPlayers() {\n return DiscordListener.chatMuted;\n }", "public NetworkInstance[] getServers();", "public List<SkungeeServer> getServers(String... servers) {\n\t\treturn ServerManager.getServers(servers);\n\t}", "public static Server [] getServers(){\r\n Enumeration serversEnum = servers.elements();\r\n Server [] arr = new Server[servers.size()];\r\n for (int i = 0; i < arr.length; i++)\r\n arr[i] = (Server)serversEnum.nextElement();\r\n\r\n return arr;\r\n }", "public void notifyAdmins(){\n \tfor(PlayerHandler player : players){\n \t\tif(player.isAdmin()){\n \t\t\tplayer.notify(1);\n \t\t}\n \t}\n }", "public PropertyRemoteServers getServers() {\n return this.m_Servers;\n }", "List<HttpServletServer> getHttpServers();", "public List<String> nameServers() {\n return this.nameServers;\n }", "public List<TbccUser> getSysAdmin() {\n\t\treturn userdao.getSysAdmin();\n\t}", "public List<ApplicationGatewayBackendHealthServerInner> servers() {\n return this.servers;\n }", "public static ArrayList<Admin> getLockedAdmin() {\n\t\tRequestContent rp = new RequestContent();\n\t\trp.type = RequestType.GET_LOCKED_ADMINS;\n\t\tReceiveContent rpp = sendReceive(rp);\n\t\tArrayList<Admin> adminBloccati = (ArrayList<Admin>) rpp.parameters[0];\n\t\treturn adminBloccati;\n\t}", "@Override\n @GET\n @Path(\"/servers\")\n @Produces(\"application/json\")\n public Response getServers() throws Exception {\n log.trace(\"getServers() started.\");\n JSONArray json = new JSONArray();\n for (Server server : cluster.getServerList()) {\n JSONObject o = new JSONObject();\n String uri = String.format(\"%s/servers/%d\", rootUri, server.getServerId());\n String serverUri = String.format(\"/providers/%d/servers/%d\", provider.getProviderId(), server.getServerId());\n o.put(\"uri\", uri);\n o.put(\"baseUri\", serverUri);\n json.put(o);\n }\n\n log.trace(\"getServers() finished successfully.\");\n return Response.ok(json.toString()).build();\n }", "public String[] browseAdmin(Session session) throws RemoteException{\n\t\tSystem.out.println(\"Server model invokes browseAdmin() method\");\n\t\treturn null;\n\t\t\n\t}", "public ArrayList<Integer> getAdminIDs() {\n return adminIDs;\n }", "public List<User> getAdministrators() {\n \n QueryResult<User> admins = new AdminUsers(this, 1, \"asc\", null, 0, \n Integer.MAX_VALUE).executeQuery();\n \n return admins.getList();\n }", "public ObservableList<User> getAdminsList() {\n adminsList.addAll(userManager.getAdminsList());\n return adminsList;\n }", "public List<String> getmanagers();", "public Administrator[] getAllAdmin()\n {\n return admin;\n }", "List<String> getHosts();", "@External(readonly = true)\n\tpublic List<Address> get_admin(){\n\t\t\n\t\tif (DEBUG) {\n\t\t\tContext.println( Context.getOrigin().toString() + \" is getting admin addresses.\" + TAG);\n\t\t}\n\t\tAddress[] admin_list = new Address[this.admin_list.size()];\n\t\tfor(int i= 0; i< this.admin_list.size(); i++) {\n\t\t\tadmin_list[i] = this.admin_list.get(i);\n\t\t}\n\t\treturn List.of(admin_list);\n\t}", "@Override\n\tpublic String[] GetFileServers() {\n\t\tString fservers[]=new String[list.size()];\n\t\tint i=0;\n\t\tfor(String s:list){\n\t\t\tfservers[i++]=s;\n\t\t}\n\t\treturn fservers;\n\t}", "public Object[] getNameServers() {\n\t\treturn _nameservers.toArray();\n\t}", "public static List<Object[]> getServerDetails(){\n\t\t\n\t\tString filePath = Holders.getFlatConfig().get(\"statusFile.use\").toString();\n\n\t\treturn getServerDetailsFromCSV(filePath, \"hostname\", \"user\",\"password\");\n\t}", "@Override\n\tpublic List<Admin> getAdmins() {\n\t\treturn ar.findAll();\n\t}", "public Collection eleicoesAdmin(){\n return this.eleicaoDB.eleicoesAdmin();\n }", "private String getZkServers(ServletContext context){\n Configuration config = new Configuration();\n config.addResource(\"pxf-site.xml\");\n String zk_hosts = config.get(\"zookeeper\");\n if(LOG.isDebugEnabled())\n LOG.debug(\"zookeeper server is :\" + zk_hosts);\n\n return zk_hosts;\n }", "private List<PeerConnection.IceServer> createIceServers() {\n List<PeerConnection.IceServer> iceServers = new ArrayList<>();\n\n String username = null;\n String password = null;\n List<String> uris = null;\n\n for (int index = 0; index < uris.size(); index++) {\n String url = uris.get(index);\n\n if ((null != username) && (null != password)) {\n iceServers.add(new PeerConnection.IceServer(url, username, password));\n } else {\n iceServers.add(new PeerConnection.IceServer(url));\n }\n }\n\n // define at least on server\n if (iceServers.isEmpty()) {\n iceServers.add(new PeerConnection.IceServer(\"stun:stun.l.google.com:19302\"));\n }\n\n return iceServers;\n }", "@Override\n\tpublic List<?> selectBoardAdminList() {\n\t\treturn eduBbsDAO.selectBoardAdminList();\n\t}", "public void getPlayerList() {\n if (connected == true) {\n try {\n write(\"get playerlist\");\n } catch (IOException e) {\n System.out.println(\"No connecting with server:ServerCommunication:getPlayerList()\");\n }\n }\n }", "public List<String> dnsServers() {\n return this.dnsServers;\n }", "public Administrator[] getAllAdmin() {\n\t\ttry {\n\t\t\tConnection conn = DbConnections.getConnection(DbConnections.ConnectionType.POSTGRESQL);\n\t\t\tPreparedStatement ps = conn.prepareStatement(\"select * from public.administrator\");\n\t\t\tResultSet rs = ps.executeQuery();\n\t\t\tList<Administrator> adminList = new ArrayList<Administrator>();\n\t\t\twhile (rs.next()) {\n\t\t\t\tint id = rs.getInt(\"id\");\n\t\t\t\tint idUser = rs.getInt(\"id_user\");\n\t\t\t\tString nume = rs.getString(\"nume\");\n\t\t\t\tString prenume = rs.getString(\"prenume\");\n\t\t\t\t\n\t\t\t\tadminList.add(new Administrator(id, idUser, nume, prenume));\n\t\t\t}\n\t\t\tDbConnections.closeConnection(conn);\n\t\t\treturn adminList.toArray(new Administrator[adminList.size()]);\n\t\t} catch (SQLException e) {\n\t\t\treturn null;\n\t\t}\n\n\t}", "public ArrayList<UserBean> listOnlineUsers()\n\t{\n\t\ttry{\n\t\t\tSocket toServer = new Socket(server,directorySocket);\n\t\t\tObjectOutputStream outToServer = new ObjectOutputStream(toServer.getOutputStream());\n\t\t\t\n\t\t\tServerMessage m = new ServerMessage();\n\t\t\tm.setCommand(LIST);\n\t\t\t\n\t\t\toutToServer.writeObject(m);\n\t\t\t\n\t\t\tObjectInputStream serverInput = new ObjectInputStream(toServer.getInputStream());\n\t\t\tonlineUsers = (ArrayList<UserBean>) serverInput.readObject();\n\t\t\t\n\t\t\toutToServer.close();\n\t\t\tserverInput.close();\n\t\t\ttoServer.close();\n\t\t}catch(UnknownHostException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ClassNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn onlineUsers;\n\t}", "@Override\n\tpublic List<String> getServersDescription() {\n\t\treturn null;\n\t}", "public List<ServerServices> listServerServices();", "@Override\n\tpublic List<UsuariosEntity> findAdmin(){\n\t\treturn (List<UsuariosEntity>) iUsuarios.findAdmin();\n\t}", "@Override\n\tpublic List<BoardVO> admin_list() {\n\t\treturn dao.admin_listRow();\n\t}", "public String getPrivatenotes() {\r\n return privatenotes;\r\n }", "public List<ServerWorker> getWorkerList()\n {\n return workerList;\n }", "public List<SkungeePlayer> getPlayers(SkungeeServer... servers) throws TimeoutException, InterruptedException, ExecutionException {\n\t\tPlayersPacket packet = new PlayersPacket();\n\t\tpacket.setServers(servers);\n\t\treturn japson.sendPacket(packet);\n\t}", "public List<String> getAllPlayers() throws ServerProblem {\r\n\ttry (Connection connTDB = ConnectionManager.getInstance().getConnection()) {\r\n\t LOGGER.debug(\"Getting all players\");\r\n\t List<String> results = engine.getAllPlayers(connTDB);\r\n\t LOGGER.debug(\"Players found in the database: \" + results);\r\n\t return results;\r\n\t} catch (Exception ex) {\r\n\t String error = \"Problem encountered getting all players: \" + ex;\r\n\t LOGGER.error(error);\r\n\t throw new ServerProblem(error, ex);\r\n\t}\r\n }", "public ObservableList<Task> getAdminList() {\n return adminList;\n }", "public synchronized List<QuorumServerInfo> getQuorumServerInfoList() throws IOException {\n List<QuorumServerInfo> quorumMemberStateList = new LinkedList<>();\n GroupInfoReply groupInfo = getGroupInfo();\n if (groupInfo == null) {\n throw new UnavailableException(\"Cannot get raft group info\");\n }\n if (groupInfo.getException() != null) {\n throw groupInfo.getException();\n }\n RaftProtos.RoleInfoProto roleInfo = groupInfo.getRoleInfoProto();\n if (roleInfo == null) {\n throw new UnavailableException(\"Cannot get server role info\");\n }\n RaftProtos.LeaderInfoProto leaderInfo = roleInfo.getLeaderInfo();\n if (leaderInfo == null) {\n throw new UnavailableException(\"Cannot get server leader info\");\n }\n for (RaftProtos.ServerRpcProto member : leaderInfo.getFollowerInfoList()) {\n HostAndPort hp = HostAndPort.fromString(member.getId().getAddress());\n NetAddress memberAddress = NetAddress.newBuilder().setHost(hp.getHost())\n .setRpcPort(hp.getPort()).build();\n\n long maxElectionTimeoutMs =\n Configuration.getMs(PropertyKey.MASTER_EMBEDDED_JOURNAL_MAX_ELECTION_TIMEOUT);\n quorumMemberStateList.add(QuorumServerInfo.newBuilder()\n .setIsLeader(false)\n .setPriority(member.getId().getPriority())\n .setServerAddress(memberAddress)\n .setServerState(member.getLastRpcElapsedTimeMs() > maxElectionTimeoutMs\n ? QuorumServerState.UNAVAILABLE : QuorumServerState.AVAILABLE).build());\n }\n NetAddress self = NetAddress.newBuilder()\n .setHost(mLocalAddress.getHostString())\n .setRpcPort(mLocalAddress.getPort())\n .build();\n quorumMemberStateList.add(QuorumServerInfo.newBuilder()\n .setIsLeader(true)\n .setPriority(roleInfo.getSelf().getPriority())\n .setServerAddress(self)\n .setServerState(QuorumServerState.AVAILABLE).build());\n quorumMemberStateList.sort(Comparator.comparing(info -> info.getServerAddress().toString()));\n return quorumMemberStateList;\n }", "public List<Emote> getUserEmotes(Long userId) {\n\t\t// Check Scope\n\t\tOptional<OAuthCredential> credential = getTwitchClient().getCredentialManager().getTwitchCredentialsForChannel(userId);\n\t\tif (credential.isPresent()) {\n\t\t\tSet<String> requiredScopes = new HashSet<String>();\n\t\t\trequiredScopes.add(TwitchScopes.USER_SUBSCRIPTIONS.getKey());\n\n\t\t\tcheckScopePermission(credential.get().getOAuthScopes(), requiredScopes);\n\t\t} else {\n\t\t\tthrow new ChannelCredentialMissingException(userId);\n\t\t}\n\n\t\t// Endpoint\n\t\tString requestUrl = String.format(\"%s/users/%s/emotes\", Endpoints.API.getURL(), userId);\n\t\tRestTemplate restTemplate = getTwitchClient().getRestClient().getPrivilegedRestTemplate(credential.get());\n\n\t\t// REST Request\n\t\ttry {\n\t\t\tLogger.trace(this, \"Rest Request to [%s]\", requestUrl);\n\t\t\tEmoteSets responseObject = restTemplate.getForObject(requestUrl, EmoteSets.class);\n\n\t\t\tList<Emote> emoteList = new ArrayList<>();\n\n\t\t\tfor (List<Emote> emotes : responseObject.getEmoticonSets().values()) {\n\t\t\t\temoteList.addAll(emotes);\n\t\t\t}\n\n\t\t\treturn emoteList;\n\t\t} catch (RestException restException) {\n\t\t\tLogger.error(this, \"RestException: \" + restException.getRestError().toString());\n\t\t} catch (Exception ex) {\n\t\t\tLogger.error(this, \"Request failed: \" + ex.getMessage());\n\t\t\tLogger.trace(this, ExceptionUtils.getStackTrace(ex));\n\t\t}\n\n\t\treturn new ArrayList<Emote>();\n\t}", "public ArrayList<Character> getMembers() {\n\t\tArrayList<Character> lista = new ArrayList<Character>();\r\n\t\tfor(Character chr : guildArray) {\r\n\t\t\tlista.add(chr);\r\n\t\t}\r\n\t\treturn lista;\r\n\t}", "@Override\n\tpublic Collection<InetSocketAddress> getAvaliableServers() {\n\t\treturn null;\n\t}", "AdminKeys getAdminKeys();", "public List<Map.Entry<String, L>> entries() {\n rwLock.readLock().lock();\n try {\n return new ArrayList<Map.Entry<String, L>>(serversToLoad.entrySet());\n } finally {\n rwLock.readLock().unlock();\n }\n }", "@GET\n @Path(\"/admin/list\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response getUserAdminProjects() {\n HttpSession session = request.getSession();\n\n if (session.getAttribute(\"projectAdmin\") == null) {\n throw new ForbiddenRequestException(\"You must be the project's admin.\");\n }\n String username = session.getAttribute(\"user\").toString();\n\n projectMinter project= new projectMinter();\n String response = project.listUserAdminProjects(username);\n project.close();\n\n return Response.ok(response).build();\n }", "public static Collection<? extends Player> getOnlinePlayers() {\n return Bukkit.getServer().getOnlinePlayers();\n }", "@Override public Collection<String> getServerIds() {\n return getTrackedBranches().getServerIds();\n }", "List<AdminDomain> getDomains();", "public HostID[] getChunkServers()\n {\n return chunkServers;\n }", "public void setAdmins(ArrayList<Integer> adminIDs) {\n this.adminIDs = adminIDs;\n }", "public List<Admin> findAdmin(String identifier) {\n\t\treturn null;\r\n\t}", "public ArrayList<String> getConnectedUsers() {\r\n\t\tArrayList<String> connectedUsers = new ArrayList<>();\r\n\t\tString message=\"107\";\r\n\t\tsendDatagramPacket(message);\r\n\t\t\r\n\t\t//connectedUsers.add(\"Default\");\r\n\t\t\r\n\t\treturn connectedUsers;\r\n\t}", "public List<String> getHosts() {\n return getProperty(HOSTS);\n }", "public List<SkungeePlayer> getPlayers(SkungeeServer server, UUID... uuids) throws TimeoutException, InterruptedException, ExecutionException {\n\t\tPlayersPacket packet = new PlayersPacket();\n\t\tpacket.setUniqueIds(uuids);\n\t\tpacket.setServers(server);\n\t\treturn japson.sendPacket(packet);\n\t}", "public List<String> getHosts() {\n\t\treturn hosts;\n\t}", "public ServerConfigManager getServerConfigManager() {\n return this.serverConfigManager;\n }", "@Exported\n public ArrayList<Slave> getSlaves() {\n return this.slaves;\n }", "public List<String> getAvailableAssignees()\n {\n // TODO stefan an Rollen knüpfen\n final Matcher<String> m = new BooleanListRulesFactory<String>().createMatcher(\"admin/user/*\");\n final List<GWikiElementInfo> userInfos = wikiContext.getElementFinder()\n .getPageInfos(new GWikiPageIdMatcher(wikiContext, m));\n\n List<String> users = new ArrayList<String>();\n for (final GWikiElementInfo user : userInfos) {\n users.add(GWikiContext.getNamePartFromPageId(user.getId()));\n }\n return users;\n }", "public synchronized void sendUserList()\n {\n String userString = \"USERLIST#\" + getUsersToString();\n for (ClientHandler ch : clientList)\n {\n ch.sendUserList(userString);\n }\n }", "public ArrayList<String> getDbSlaves() throws JsonSyntaxException, JsonIOException, IOException {\n ArrayList<String> dbslaves = new ArrayList<>();\n if (dbhosts != null) {\n for (String h : dbhosts) {\n dbslaves.add(h);\n }\n return dbslaves;\n }\n if (slavesFile != null) {\n File f = new File(slavesFile);\n FileInputStream input = new FileInputStream(f);\n Gson gson = new Gson();\n Hosts hosts = gson.fromJson(new InputStreamReader(input), Hosts.class);\n dbhosts = hosts.getHosts();\n if (hosts != null) {\n for (String host : hosts.getHosts()) {\n dbslaves.add(host);\n }\n }\n }\n return dbslaves;\n }", "public ArrayList<String> getNameServerUrl() {\n\n if (nameListener.isServiceFound()) {\n return nameListener.getServiceURLs();\n }\n return new ArrayList<>();\n }", "public String[] addAdmin(Session session) throws RemoteException {\n\t\tSystem.out.println(\"Server model invokes addAdmin() method\");\n\t\treturn null;\n\t}", "public List<Usuario> getAdmins() {\n List<Usuario> lUsers = new ArrayList<>();\n try {\n\n if (em.isOpen()) {\n// lUsers = this.em.createNamedQuery(\"Usuario.findByTipoUsuario\")\n// .setParameter(\"tipoUsuario\", 1)\n// .setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache)\n// .getResultList();\n\n Query query = this.em.createNamedQuery(\"Usuario.findByTipoUsuario\")\n .setParameter(\"tipoUsuario\", 1)\n .setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache);\n\n lUsers = (List<Usuario>) query.getResultList();\n for (Usuario u : lUsers) {\n this.em.refresh(u);\n }\n }\n\n } catch (Exception e) {\n //e.printStackTrace();\n }\n\n return lUsers;\n }", "@Override\n public List<AppServerType> getServerType()\n {\n return AppServerType.allvalues();\n }", "public java.lang.Boolean getReceivesAdminInfoEmails() {\n return receivesAdminInfoEmails;\n }", "public Collection<String> getGroups() {\r\n \t\tCollection<String> serverGroups = this.groupList.getGroups();\r\n \r\n \t\treturn serverGroups;\r\n \t}", "@Override\r\n\tpublic List<Admins> getQueryAdminAll() {\n\t\treturn adi.queryAdminAll();\r\n\t}", "public ArrayList<ServerSocket> getConnectedClients() {\n return connectedClients;\n }", "public ArrayList<String> getWebserverUrl() {\n\n if (webListener.isServiceFound()) {\n return webListener.getServiceURLs();\n }\n return new ArrayList<>();\n }", "@Test\n public void getAdminsTest() throws ApiException {\n String scope = null;\n AdminResponse response = api.getAdmins(scope);\n\n // TODO: test validations\n }", "@ManyToMany(mappedBy = \"administeredRooms\", cascade = CascadeType.ALL)\r\n\t@OrderBy(\"lastName\")\r\n\tpublic Set<User> getAdministrators() {\r\n\t\treturn administrators;\r\n\t}", "public Map<String,ClientHandler> getUserList()\n {\n return userList;\n }", "private static void findAdministrators(Robot robot, JsonNode robotNode) {\n List<String> administrators = new ArrayList<String>();\n robot.getAdministrators().clear();\n for (JsonNode node : robotNode.get(\"administrators\")) {\n administrators.add(node.asText());\n }\n for (RosterEntry entry : robot.getRosters()) {\n if (administrators.contains(entry.getUser())) {\n robot.getAdministrators().add(entry);\n }\n }\n robot.setAdministratorIds(administrators);\n }", "org.jacorb.imr.HostInfo[] list_hosts();", "protected void selectValidServer() {\n boolean lastError = false;\n for (NotificationServiceOuterClass.MemberProto livingMember : livingMembers) {\n try {\n currentUri = livingMember.getServerUri();\n initNotificationServiceStub();\n NotificationServiceOuterClass.ListMembersRequest request =\n NotificationServiceOuterClass.ListMembersRequest.newBuilder()\n .setTimeoutSeconds(listMemberIntervalMs / 1000)\n .build();\n NotificationServiceOuterClass.ListMembersResponse response = notificationServiceStub.listMembers(request);\n if (response.getReturnCode() == NotificationServiceOuterClass.ReturnStatus.SUCCESS) {\n livingMembers = new HashSet<>(response.getMembersList());\n lastError = false;\n break;\n } else {\n lastError = true;\n }\n } catch (Exception e) {\n lastError = true;\n }\n }\n if (lastError) {\n logger.warn(\"No available server uri!\");\n }\n }", "public List<String> getListOfOwner() throws SQLException {\n\t\treturn adminService.listOfOwner();\n\t}", "long[] getAllServerSocketIds();", "List<Moderator> getModerators();", "com.google.protobuf.ByteString\n getAdminBytes();", "@ZAttr(id=772)\n public String[] getAdminConsoleLoginMessage() {\n return getMultiAttr(Provisioning.A_zimbraAdminConsoleLoginMessage);\n }", "public Server getServer() {\n return server;\n }", "public static server getServer(){\n return thisServer;\n }", "@Override\n\tpublic List<UserServer> registry() {\n\t\tResultSet result;\n\t\tList<UserServer> listUser = new ArrayList<UserServer>();\n\t\ttry {\n\t\t\tstat = conn.prepareStatement(\"SELECT * FROM client\");\n\t\t\tresult = stat.executeQuery();\n\t\t\twhile (result.next()) {\n\t\t\t\tUserServer user = new UserServer();\n\t\t\t\tuser.setId(result.getInt(\"idclient\"));\n\t\t\t\tuser.setName(result.getString(\"name\"));\n\t\t\t\tuser.setNick(result.getString(\"nick\"));\n\t\t\t\tuser.getTypeUser().setValue(result.getInt(\"typeuser\"));\n\t\t\t\tuser.setPhone(takePhone(user.getId()));\n\t\t\t\tuser.setEmail(takeEmail(user.getId()));\n\t\t\t\tlistUser.add(user);\n\t\t\t}\n\t\t\treturn listUser;\n\t\t} catch (SQLException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\treturn null;\n\t}", "Map<ServerName, List<String>> getDeployedHRIs(final HBaseAdmin admin) throws IOException {\n ClusterStatus status = admin.getClusterStatus();\n Collection<ServerName> regionServers = status.getServers();\n Map<ServerName, List<String>> mm =\n new HashMap<ServerName, List<String>>();\n for (ServerName hsi : regionServers) {\n AdminProtos.AdminService.BlockingInterface server = ((HConnection) connection).getAdmin(hsi);\n\n // list all online regions from this region server\n List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(server);\n List<String> regionNames = new ArrayList<String>();\n for (HRegionInfo hri : regions) {\n regionNames.add(hri.getRegionNameAsString());\n }\n mm.put(hsi, regionNames);\n }\n return mm;\n }", "public List<User> watchers(String owner, String repo) {\n return apiClient.deserializeAsList(apiClient.get(String.format(\"/repos/%s/%s/subscribers\", owner, repo)), User.class);\n }", "protected static AuoServer getServer() {\n return server;\n }" ]
[ "0.66255385", "0.64522266", "0.6442518", "0.6421698", "0.63552254", "0.63285697", "0.6276628", "0.6258488", "0.62436247", "0.61668104", "0.6147344", "0.61239904", "0.60760695", "0.5823568", "0.5817461", "0.57923436", "0.5752526", "0.56998074", "0.5696567", "0.5694851", "0.5619998", "0.5607636", "0.5595194", "0.5582142", "0.55769867", "0.5573133", "0.55390537", "0.55136085", "0.5498123", "0.54960984", "0.54931796", "0.5469208", "0.54523784", "0.5449774", "0.5423672", "0.5404313", "0.5398585", "0.5396512", "0.53772277", "0.5362244", "0.5353389", "0.534011", "0.5326294", "0.53217715", "0.5303162", "0.52710134", "0.5265924", "0.52470887", "0.52452", "0.52421594", "0.5240991", "0.5232978", "0.5209583", "0.519922", "0.5188248", "0.5186062", "0.51660854", "0.5165005", "0.5149489", "0.51471376", "0.51320374", "0.51159173", "0.51143223", "0.51111513", "0.50915414", "0.50848675", "0.506265", "0.5060395", "0.505726", "0.5050602", "0.50429976", "0.50394976", "0.503337", "0.50306654", "0.50301373", "0.5028894", "0.50268775", "0.5024651", "0.50207615", "0.50173616", "0.50116044", "0.5008113", "0.49977478", "0.49975398", "0.49852797", "0.49776402", "0.4972624", "0.4969841", "0.49682778", "0.49646467", "0.49625552", "0.4960105", "0.49572265", "0.49535048", "0.49321657", "0.49298453", "0.49261174", "0.4922935", "0.49219018", "0.49164936" ]
0.62627155
7
public static final double INTEREST_RATE = 0.0001;
public CheckingAccount() { super(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static double getInterestRate() {\n return DEFAULT_INTEREST_RATE ;\n }", "double getRate();", "public static double getInterestRate(){\n\t\t return interest_rate;\r\n\t }", "@Override\n\tpublic double calRate() {\n\t\treturn 0.9f;\n\t}", "double getTransRate();", "public double getRate() {\r\n\t\treturn (getRate(0)+getRate(1))/2.0;\r\n\t}", "private static double getWinRate() {\n\t\treturn winRate ;\n\t}", "public double getInterestRate(){\n return interestRate;\n }", "public int getReSampleRate() {\n return 0;\n }", "public float getRate(){\r\n return rate;\r\n }", "public float getFrameRate() { return 1000f/_interval; }", "public float getRate() {\n\treturn durationStretch * nominalRate;\n }", "public double getInterest(){return this.interest_rate;}", "protected InterestRate() {\n\t}", "public double getRate( ) {\nreturn monthlyInterestRate * 100.0 * MONTHS;\n}", "public double getInterestRate(){\n return annualInterestRate;\n }", "public void setRate(double annualRate) {\nmonthlyInterestRate = annualRate / 100.0 / MONTHS;\n}", "int getSmpRate();", "public double getInterestRate() {\n return interestRate;\n }", "double getLearningRate();", "public BigDecimal getEXCH_RATE() {\r\n return EXCH_RATE;\r\n }", "public void updateRate(double r){\r\n rate *= r;\r\n }", "public double getInterestRate()\n {\n return this.interestRate;\n }", "@Override\n\tpublic double getRate() {\n\t\treturn 7;\n\t}", "@Override\n public double salario() {\n return 2600 * 1.10;\n }", "public double tradeRate()\n\t{\n\t\treturn _dblTradeRate;\n\t}", "public double getRate() {\n return rate;\n }", "public double getRate() {\n return rate;\n }", "int getMortgageRate();", "public double getInterest()\n {\n return interestRate;\n }", "@Override\n public double tuition(){\n return 2500;\n }", "public double getRise(\n )\n {return rise;}", "public void InterestRate() {\n\t\t\tSystem.out.println(\"9 percent\");\n\t\t}", "public static void setInfectionRate(double newRate) {\n infectionRate = newRate;\n }", "Rate initRate(Rate iRate)\n {\n iRate.updateElementValue(\"Rate\");\n return iRate;\n }", "@Override\n\t\tpublic double getSlipRate() {\n\t\t\treturn 0;\n\t\t}", "public double getRate() {\n\t\treturn rate;\n\t}", "private float getRsiPotential() {\r\n\t\treturn 1F - (float)(stochRsiCalculator.getCurrentValue()/50.0);\r\n\t}", "public int getRate() {\n return rate_;\n }", "public int tickRate(World p_149738_1_) {\n\t\treturn 2;\n\t}", "@Override protected double convertRate(double rate) {\n return super.convertRate(rate);\n }", "public Integer getRate() {\r\n return rate;\r\n }", "public double getDefaultScanVelocity() {\n return 2.5;\n }", "public double calcInterest(){\n double interest = (interestRate + 1) * balance;\n return interest;\n }", "public NewtonRaphsonCalibrator()\r\n\t{\r\n\t}", "private float getRefreshRate() {\n return 1;\n }", "public double getSmooth_factor(){ \n return this.smooth_factor; \n }", "public void setRate();", "float getBoost();", "public void setRate(int rate) { this.rate = rate; }", "public float getRate() {\n\t\treturn rate;\n\t}", "public void setInterest(double rate)\n {\n interestRate = rate;\n }", "double getPWMRate();", "public double getEarnedInterest()\n {\n return startingBalance * (interestRate / 12);\n }", "public double getAverageRate() {\n return (leftEnc.getRate() + rightEnc.getRate()) / 2;\n }", "public Rate getDefaultStandardRate()\r\n {\r\n return (m_defaultStandardRate);\r\n }", "public int getRate() {\n return rate_;\n }", "public static double getOptimalInflation() {\n\t\treturn Constants.OPTIMAL_INFLATION;\n\t}", "public int getSamplingRate( ) {\r\n return samplingRate;\r\n }", "float getPreGain();", "double calculateRate(Temperature temperature, double Hrxn);", "Integer networkTickRate();", "public static double getRate(){\r\n Scanner s = new Scanner(System.in);\r\n double rate;\r\n do{\r\n System.out.print(\"Enter the current prime interest rate: \");\r\n rate = parseDouble(s.next());\r\n rate = rate * 0.01;\r\n }while(rate == -1);\r\n System.out.println(\"---------------------------------------------\");\r\n return rate;\r\n }", "@Override\n\tint getRateOfInterest() {\n\t\treturn 7;\n\t}", "public double getLearningRate() {\n return learningRate;\n }", "@Override\r\n\tpublic double recargoImpuesto() {\n\t\treturn 0.03;\r\n\t}", "public static final double internalRateOfReturn (\n double irrEstimate,\n double [ ] cashFlows )\n //////////////////////////////////////////////////////////////////////\n {\n double irr = irrEstimate;\n\n double delta = -irr * 0.1;\n\n double oldNpv = 0.0;\n\n while ( true )\n {\n double npv = netPresentValue ( irr, cashFlows );\n\n if ( npv == 0.0 )\n {\n return irr;\n }\n\n if ( oldNpv < 0.0 )\n {\n if ( npv > 0.0 )\n {\n delta *= -0.9;\n }\n else if ( npv > oldNpv )\n {\n delta *= 1.1;\n }\n else if ( npv < oldNpv )\n {\n delta = -delta;\n }\n else\n {\n delta = 0.0;\n }\n }\n else if ( oldNpv > 0.0 )\n {\n if ( npv < 0.0 )\n {\n delta *= -0.9;\n }\n else if ( npv < oldNpv )\n {\n delta *= 1.1;\n }\n else if ( npv > oldNpv )\n {\n delta = -delta;\n }\n else\n {\n delta = 0.0;\n }\n }\n\n/*\nSystem.out.println ( \"irr = \" + irr + \", oldNpv = \" + oldNpv + \", npv = \" + npv + \", delta = \" + delta );\n\ntry{\nnew BufferedReader ( new InputStreamReader ( System.in ) ).readLine ( );\n}catch (Exception x ) { }\n*/\n\n if ( delta == 0.0 )\n {\n return irr;\n }\n\n irr += delta;\n\n oldNpv = npv;\n }\n }", "public int getSampleRate() {\n return 0;\n }", "public int getSampleRate() {\r\n\treturn SAMPLES_IN_SECOND;\r\n}", "public static double getXoRate() {\n\t\treturn xoRate;\n\t}", "public BigDecimal getLBR_DIFAL_RateICMSInterPart();", "public double calculateRate() {\n\t\tdouble rate = 0;\n\t\tfor (int i = 0; i < upgrades.size(); i++) {\n\t\t\trate += upgrades.get(i).getProduction();\n\t\t}\n\t\tbrain.setRate(rate);\n\t\treturn rate;\n\t}", "public Double getReturnRate() {\r\n return returnRate;\r\n }", "abstract double calculateCurrentDiscountRate();", "public int getSamplingRate() {\n return samplingRate;\n }", "public double getLearningRate() {\r\n\t\treturn learningRate;\r\n\t}", "public double getPauseBetweenMIDISends() \n {\n return 0.0;\n }", "private void calculateSensitivityExponent() {\n this.sensitivityExponent = Math.exp(-1.88 * percentageSensitivity);\n }", "protected float computeUpdateRate(float senderupdateRate, float senderDesiredUR){\n float oldMax1 = this.updateRate;\n float oldMax2 = senderupdateRate;\n float maxRateAvg = (this.updateRate + senderupdateRate) / 2;\n if (this.desiredUR + senderDesiredUR <= this.updateRate + senderupdateRate){\n float delta = this.updateRate + senderupdateRate - this.desiredUR - senderDesiredUR;\n this.updateRate = this.desiredUR + delta / 2;\n senderupdateRate = senderDesiredUR + delta / 2;\n }else { // this.desiredUR + senderDesiredUR > this.updateRate + sender updateRate\n if (this.desiredUR >= maxRateAvg && senderDesiredUR >= maxRateAvg){\n // the participants both get the same value\n this.updateRate = senderupdateRate = maxRateAvg;\n }else if (this.desiredUR < maxRateAvg){\n senderupdateRate = this.updateRate + senderupdateRate - this.desiredUR;\n this.updateRate = this.desiredUR;\n }else{ // senderDesiredUR < maxRateAvg\n this.updateRate = this.updateRate + senderupdateRate - senderDesiredUR;\n senderupdateRate = senderDesiredUR;\n }\n }\n\n // in case we were not updating before and the new updateRate is > 0. Need to start updating again.\n if (oldMax1 == 0 && this.updateRate > 0){\n scheduleUpdateTimeout(Math.round(1000/this.updateRate), TimeUnit.MILLISECONDS);\n }\n\n return senderupdateRate;\n }", "public double getAnnualInterestRate() {\n return annualInterestRate;\n }", "public double getAnnualInterestRate() {\n return annualInterestRate;\n }", "private long[] getDefaultVibratePattern() {\n return new long[]{0, 150, 100, 150};\n }", "int getAutoCompactFillRate();", "public double getReturnRate() {\n return returnRate;\n }", "public java.math.BigDecimal getIndicativeExchangeRate() {\r\n return indicativeExchangeRate;\r\n }", "@Override\n\tpublic float calculateRunRate() {\n\t\tint remaingrun=Math.abs((super.getTarget()-super.getCurrentscore()));\n\t\tfloat remaingOver=20-super.getCurrentover();\n\t\treturn remaingrun/remaingOver;\n\t}", "public double getDefaultScanDy() {\n return 10.0;\n }", "public void mo1524a(int newRate) {\n this.f3854l = (long) (1000 / newRate);\n }", "@Override\r\n\tpublic double alapterulet() {\n\t\treturn 0;\r\n\t}", "public double getRightRate() {\n return rightEnc.getRate();\n }", "public Rate rate() {\n _initialize();\n return rate;\n }", "float getIva();", "public Object setintrate(double rate)\r\n/* */ {\r\n\t\t\t\tlogger.info(count++ + \" About to setintrate : \" + \"Agent\");\r\n/* 67 */ \tthis.intrate = rate;\r\n/* 68 */ \tthis.intratep1 = (this.intrate + 1.0D);\r\n/* 69 */ \treturn this;\r\n/* */ }", "public void setRate(Integer rate) {\r\n this.rate = rate;\r\n }", "public static float getConsumeRate() {\n return consumerate;\n }", "@Override\r\n\tpublic double basicRates() {\r\n\t\tdouble length = GPScoordinates.distance(getStartingPoint(), getDestinationPoint());\r\n\t\tif(length < 5) {\r\n\t\t\treturn 6.2;\r\n\t\t}else if(length >=5 && length <10) {\r\n\t\t\treturn 5.5;\r\n\t\t}else if (length >=10 && length <20) {\r\n\t\t\treturn 3.25;\r\n\t\t}else {\r\n\t\t\treturn 2.6;\r\n\t\t}\r\n\t}", "@Override\n\tpublic float calculateRunRate() {\n\t\tint remaingrun=Math.abs((super.getTarget()-super.getCurrentscore()));\n\t\tfloat remaingOver=30-super.getCurrentover();\n\t\treturn remaingrun/remaingOver;\n\t}", "public SavingsAccount(double rate) //setting interest rate with constructor\r\n { \r\n interestRate = rate;\r\n }", "public double getConversionRate() {\n return conversionRate;\n }", "float getVacationAccrualRate();", "public double getAnnualInterestRate() {\n\t\treturn annualInterestRate;\n\t}" ]
[ "0.719255", "0.69388855", "0.6775234", "0.6653872", "0.66117084", "0.65609527", "0.6406343", "0.63571554", "0.6302153", "0.6283851", "0.6264757", "0.6261198", "0.62511533", "0.6248882", "0.6241137", "0.62393165", "0.62002975", "0.6184107", "0.61562234", "0.6151598", "0.61490977", "0.60690415", "0.6051658", "0.60237366", "0.6020509", "0.601948", "0.60164714", "0.60164714", "0.5973633", "0.5970039", "0.5963511", "0.5958624", "0.59393346", "0.5929602", "0.5927575", "0.5924035", "0.59144336", "0.5900768", "0.59002185", "0.58959466", "0.5887896", "0.58860517", "0.5867205", "0.58640105", "0.5863849", "0.586044", "0.5846533", "0.5840523", "0.58399254", "0.5818723", "0.57872814", "0.57851946", "0.5783732", "0.57808465", "0.57706565", "0.57700694", "0.5763855", "0.57622653", "0.5760283", "0.5758831", "0.57506007", "0.5748702", "0.57460266", "0.5739738", "0.5731752", "0.5729087", "0.5723561", "0.57199776", "0.57171", "0.57099366", "0.57090586", "0.57071865", "0.56934935", "0.56910473", "0.5686985", "0.56812704", "0.56806", "0.56801254", "0.5678022", "0.56587315", "0.56587315", "0.5658238", "0.56317234", "0.56050086", "0.55860126", "0.55855644", "0.5585531", "0.5583057", "0.5580891", "0.55761915", "0.55650705", "0.5563493", "0.5551848", "0.5550559", "0.55448425", "0.5530845", "0.5526314", "0.55212265", "0.5517095", "0.55110884", "0.5510066" ]
0.0
-1
Mark online boolean as b in firebase
private void markOnline(boolean b) { usersRef.child(userMe.getId()).child("online").setValue(b); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean setOffline(boolean b);", "private void updateUserStatus(boolean online)\n {\n }", "public static void setOnline(boolean flag) {\r\n ONLINE = flag;\r\n }", "private void setOffline(boolean value) {\n \n offline_ = value;\n }", "public boolean isOnline() {\n return isOnline;\n }", "public void setIsOnlineResult(boolean value) {\n this.isOnlineResult = value;\n }", "public void setOnline() {\n if (this.shutdownButton.isSelected() == false) {\n this.online = true;\n this.statusLed.setStatus(\"ok\");\n this.updateOscilloscopeData();\n }\n }", "public void setOnlineRequired( boolean requiresOnline )\n {\n this.onlineRequired = requiresOnline;\n }", "public void setInDatabase(boolean b) {\n \n }", "public void turn_on () {\n this.on = true;\n }", "void setAlive(boolean isAlive);", "public boolean requiresOnline()\n {\n return onlineRequired;\n }", "boolean isOnline() {\n\t\treturn online;\n\t}", "void set(boolean on);", "public boolean isOnline() {\n return this.online;\n }", "private void onlinecheack(String online) {\r\n\r\n Calendar calendar_time = Calendar.getInstance();\r\n SimpleDateFormat simpleDateFormat_time = new SimpleDateFormat(DataManager.TimePattern);\r\n String CurrentTime = simpleDateFormat_time.format(calendar_time.getTime());\r\n\r\n\r\n Calendar calendar_date = Calendar.getInstance();\r\n SimpleDateFormat simpleDateFormat_date = new SimpleDateFormat(DataManager.DatePattern);\r\n String CurrentDate = simpleDateFormat_date.format(calendar_date.getTime());\r\n\r\n\r\n Map<String, Object> onlinemap = new HashMap<String, Object>();\r\n onlinemap.put(DataManager.UserCardActive, online);\r\n onlinemap.put(DataManager.UserActiveTime, CurrentTime);\r\n onlinemap.put(DataManager.UserActiveDate, CurrentDate);\r\n\r\n\r\n OnlineRoot.child(CurrentUserID).child(DataManager.UserOnlineRoot).updateChildren(onlinemap)\r\n .addOnCompleteListener(new OnCompleteListener<Void>() {\r\n @Override\r\n public void onComplete(@NonNull Task<Void> task) {\r\n if (task.isSuccessful()) {\r\n\r\n } else {\r\n Toast.makeText(getActivity(), task.getException().getMessage(), Toast.LENGTH_SHORT).show();\r\n }\r\n }\r\n })\r\n .addOnFailureListener(new OnFailureListener() {\r\n @Override\r\n public void onFailure(@NonNull Exception e) {\r\n Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();\r\n }\r\n });\r\n\r\n }", "public void setOffline(boolean offline) {\n this.offline = offline;\n }", "public boolean isOnlineRequired()\n {\n return onlineRequired;\n }", "public void status(String status) {\n FirebaseDatabase.getInstance().getReference(\"chef_account_settings\").child(firebaseUser.getUid()).child(\"status\").setValue(status);\n// HashMap<String, Object> hashMap = new HashMap<>();\n// hashMap.put(\"status\", status);\n// reference.updateChildren(hashMap);\n }", "public void setOn(boolean arg) {\n isOn = arg;\n }", "public void setOnline(int pos){\n }", "public void setWon(){\n won = true;\n }", "public void onHasUserTurnOnGps(boolean b) {\n mHasTurnOnGps = b;\n }", "public void setAnnounced(Boolean newValue);", "private void setAlive(boolean value) {\n \n alive_ = value;\n }", "public void setNetworkReachable(boolean value);", "void setOnStatus(Boolean on) {\n this.on = on;\n }", "public void status(boolean b) {\n status = b;\n }", "void setNetStatus(boolean status){\r\n\t\t\t\tready=status;\r\n\t\t\t}", "public void setPing(boolean ping)\n {\n _isPing = ping;\n }", "private static void addConnectStateToUser(String userId) {\n DatabaseReference userStatusDatabaseRef =\n userInfoRef.child(userId);\n\n // Create a reference to the special '.info/connected' path in\n // Realtime Database. This path returns `true` when connected\n // and `false` when disconnected.\n DatabaseReference firebaseConnectionRef= FirebaseDatabase.getInstance().getReference(\".info/connected\");\n firebaseConnectionRef.addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n boolean connected = snapshot.getValue(Boolean.class);\n //only if the user is connected (not connected users will be handled in the disconnect event listener\n if (connected) {\n // If we are currently connected, then use the 'onDisconnect()'\n // method to add a set which will only trigger once this\n // client has disconnected by closing the app,\n // losing internet, or any other means.\n HashMap<String, Object> offlineUpdateMap = new HashMap<String, Object>() {{\n put(\"status\", OFFLINE_STATE);\n }};\n userStatusDatabaseRef.onDisconnect().updateChildren(offlineUpdateMap);\n\n\n // We can now safely set ourselves as 'online' knowing that the\n // server will mark us as offline once we lose connection.\n HashMap<String, Object> onlineUpdateMap = new HashMap<String, Object>() {{\n put(\"status\", ONLINE_STATE);\n }};\n userStatusDatabaseRef.updateChildren(onlineUpdateMap);\n\n }\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n\n }\n });\n }", "public void setUserLogStatus(boolean bValue){\n /*SharedPreferences sharedPreferences = _context.getSharedPreferences(APP_PREFERENCES, PRIVATE_MODE);\n SharedPreferences.Editor editor;\n editor = sharedPreferences.edit();*/\n editor.putBoolean(IS_LOGGED_IN, bValue);\n editor.apply();\n }", "public void setOn(){\n state = true;\n //System.out.println(\"Se detecto un requerimiento!\");\n\n }", "public interface IsOnline\n {\n /**\n * offline\n */\n String OFFLINE = \"0\";\n\n /**\n * online\n */\n String ONLINE = \"1\";\n }", "private void MakemeOnlion() {\n progressDialog.setMessage(\"Checking user....\");\n Map<String,Object>map=new HashMap<>();\n map.put(\"onlion\",\"true\");\n\n //update value to db\n DatabaseReference databaseReference= FirebaseDatabase.getInstance().getReference(\"Users\");\n databaseReference.child(firebaseAuth.getCurrentUser().getUid()).updateChildren(map).addOnSuccessListener(new OnSuccessListener<Void>() {\n @Override\n public void onSuccess(Void aVoid) {\n \n CheckuserType();\n\n }\n }).addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n progressDialog.dismiss();\n Toast.makeText(Login_Activity.this, e.getMessage(), Toast.LENGTH_SHORT).show();\n\n }\n });\n }", "public void kinged(){this.king = true;}", "public void setClaim(boolean a){\n isClaimed= a;\n \n}", "public void turnOn() {\n\t\tOn = true;\n\t}", "public void onStore(boolean b);", "public void setAchieved(Boolean newValue);", "public void setOnline( Boolean online )\n {\n if ( online.booleanValue() == true ) \n printerSimulator.setOnline();\n else \n printerSimulator.setOffline();\n }", "public Builder setOffline(boolean value) {\n copyOnWrite();\n instance.setOffline(value);\n return this;\n }", "boolean getOffline();", "void setIsManaged(boolean isManaged);", "public static void putStatusOffline()\n {\n try\n {\n DatabaseData.updateUserStatusOffline(userId);\n }catch(Exception e) {\n putStatusOffline();\n }\n }", "@Override\n public void setStartGameChangedListener() {\n database.getReference(gameCodeRef).child(\"StartGame\").addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n String stringValue = String.valueOf(snapshot.getValue());\n if (!stringValue.equals(null) && !stringValue.equals(\"null\")){\n Boolean value = (Boolean) snapshot.getValue();\n if (value){\n Controller.getInstance().startGameChangedToTrue();\n }\n }\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n Log.w(TAG, \"Failed to read value.\", error.toException());\n }\n });\n }", "void setBoolean(String key, boolean val);", "public void updateTurnNotification(boolean b){\n if(b){\n gameNotificationL.setText(\"It's your turn!\");\n }\n else\n gameNotificationL.setText(\"It's not your turn.\");\n }", "public void setOffline() {\r\n \t for (Utente u: utenti) { \r\n \t\t u.setStatus(\"OFFLINE\");\r\n \t }\r\n }", "public void putBooleanValue(String key, boolean value){\n SharedPreferences sharedPreference = context.getSharedPreferences(LOGIN,Context.MODE_PRIVATE);\n SharedPreferences.Editor editor=sharedPreference.edit();\n editor.putBoolean(key,value);\n editor.apply();\n }", "public void setConnected(boolean connected);", "public void setAlive(boolean x){\n \talive = x;\r\n }", "public void setForua(boolean newValue);", "void setManualCheck (boolean value);", "public void turnOn() {\n\t\tisOn = true;\n\t}", "public void enableUpdates(boolean state) {\n sEnableUpdate = state;\n }", "public void setLive(Boolean live)\n\t{\n\t\tthis.live = live;\n\t}", "void setCheckedOut(boolean checkedOut);", "public interface onDeviceIsOnline {\n void onDeviceIsOnline(boolean isOnline);\n}", "public void setIsPrimary(boolean isPrimary);", "@Deprecated\n\tpublic void setBoolean(String fieldname, boolean value) {\n\t\tsetField(fieldname, (value ? \"1\" : \"0\"));\n\t}", "public void setIsReady(boolean param) {\n // setting primitive attribute tracker to true\n localIsReadyTracker = true;\n\n this.localIsReady = param;\n }", "public void setMediaNetworkReachable(boolean value);", "public synchronized void setMyGameStatus(boolean status)\n {\n \tgameStatus=status;\n }", "@CustomMetric(name = \"isConnected\", kind = Metric.Kind.GAUGE,\n \t\tdescription = \"Describes whether we are currently connected to Elasticsearch server.\")\n public void setIsConnected(Metric isConnected) {\n \tthis.isConnected = isConnected;\n }", "public void setTurning(java.lang.Boolean value);", "void set(boolean value);", "public void setOn(boolean on) {\n\t\tthis.on = on;\n\t}", "public void status(String status)\r\n {\r\n reference=FirebaseDatabase.getInstance().getReference(\"Users\").child(firebaseUser.getUid());\r\n HashMap<String,Object>hashMap=new HashMap<>() ;\r\n hashMap.put(\"status\",status) ;\r\n reference.updateChildren(hashMap);\r\n }", "void setInvoiced(boolean invoiced);", "private void postValue(boolean b){\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n networkLiveData.setValue(b);\n }\n });\n }", "public void setIsFromMassUpdate (boolean IsFromMassUpdate);", "public void setTallied(java.lang.Boolean value);", "void setHasLoggedIn(Boolean value);", "public void setActiveStatus(Boolean active){ this.status = active; }", "public synchronized static void setServiceFlag(boolean flag){\n editor.putBoolean(IS_SERVICE_RUNNING, flag);\n editor.commit();\n }", "@Override\n public void saveBoolean(String key, boolean value) {\n SharedPreferences.Editor prefs = mSharedPreferences.edit();\n prefs.putBoolean(key, value);\n prefs.commit();\n }", "BooleanProperty getOn();", "public void setAvailable(boolean x){\n availabile = x;\n }", "@Override\r\n public void turnOn(){\r\n isOn = true;\r\n Reporter.report(this, Reporter.Msg.SWITCHING_ON);\r\n if (isOn){\r\n engageLoads();\r\n }\r\n }", "public void setAktif(java.lang.Boolean value) {\n this.aktif = value;\n }", "public void setIsApproved (boolean IsApproved);", "public void setIsApproved (boolean IsApproved);", "public void onChanged(Boolean bool) {\n int i;\n if (bool != null) {\n LocationActivitySettingItem a = this.f107703a.mo102020a();\n C7573i.m23582a((Object) bool, \"it\");\n if (bool.booleanValue()) {\n i = 0;\n } else {\n i = 8;\n }\n a.setVisibility(i);\n }\n }", "private void setBidded(){\n this.status = \"Bidded\";\n }", "public void setOffline(int pos){\n }", "void setSaveStatus(boolean b) {\n int status = (b) ? 1 : 0;\n setStat(status, saveStatus);\n }", "public synchronized void setMyTurn(boolean status)\n {\n \tmyTurn[0]=status;\n }", "@Override\n public void setAllDoneBrainstormingChangedListener() {\n database.getReference(gameCodeRef).child(\"AllDoneBrainstorming\").addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n String stringValue = String.valueOf(snapshot.getValue());\n if (!stringValue.equals(null) && !stringValue.equals(\"null\")){\n Boolean value = (Boolean) snapshot.getValue();\n if (value){\n Controller.getInstance().allPlayersDoneBrainstorming();\n }\n }\n\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n Log.w(TAG, \"Failed to read value.\", error.toException());\n }\n });\n\n }", "public void setOffline() {\n if (this.shutdownButton.isSelected() == false) {\n this.online = false;\n this.statusLed.setStatus(\"warning\");\n this.setOutputPower(0);\n this.channel.updateOutput();\n }\n }", "public Boolean isActive(){return status;}", "public void mo62645a(Boolean bool) {\n try {\n if (!(!bool.booleanValue() || this.f3479d == null || context2 == null)) {\n MetaData.update(context2, this.f3479d);\n }\n C4936b.m2870c(context2);\n if (bVar2 != null) {\n bVar2.mo62538a(C5171a.SUCCESS);\n }\n } catch (Exception e) {\n C5017f.m3256a(context2, C5015d.EXCEPTION, \"PeriodicMetaData.onPostExecute\", e.getMessage(), \"\");\n }\n }", "public void setEnabled(boolean aFlag) { _enabled = aFlag; }", "public Builder setIsLocalClient(boolean value) {\n \n isLocalClient_ = value;\n onChanged();\n return this;\n }", "public void setAlive() {\n\t\tif (this.alive == true) {\n\t\t\tthis.alive = false;\n\t\t} else {\n\t\t\tthis.alive = true;\n\t\t}\n\t}", "@Override\n public void onDataChange(DataSnapshot dataSnapshot) {\n if (dataSnapshot.child(\"states\").child(\"CAM_BIEN_1\").getValue().toString().equalsIgnoreCase(\"true\")){\n led1.setText(\"led1 on\");\n }else\n led1.setText(\"led1 off\");\n\n //led2\n if (dataSnapshot.child(\"states\").child(\"CAM_BIEN_2\").getValue().toString().equalsIgnoreCase(\"true\")){\n led2.setText(\"led2 on\");\n }else\n led2.setText(\"led2 off\");\n\n //led3\n if (dataSnapshot.child(\"states\").child(\"CAM_BIEN_3\").getValue().toString().equalsIgnoreCase(\"true\")){\n led3.setText(\"led3 on\");\n }else\n led3.setText(\"led3 off\");\n\n //led4\n if (dataSnapshot.child(\"states\").child(\"CAM_BIEN_4\").getValue().toString().equalsIgnoreCase(\"true\")){\n led4.setText(\"led4 on\");\n }else\n led4.setText(\"led4 off\");\n\n //switch\n if (dataSnapshot.child(\"states\").child(\"autoupdate\").getValue().toString().equalsIgnoreCase(\"true\")){\n mswitch.setChecked(true);\n }else\n mswitch.setChecked(false);\n }", "public boolean isOn(){\n return state;\n }", "private reg_server_online(Builder builder) {\n super(builder);\n }", "public void updateUserLogin(String userName, boolean isOnOff){\n\t\tint isOn = isOnOff? 1 : 0;\n try {\n\t Connection c = new MyConnection().getConnection();\n\t Statement st = c.createStatement();\n \n\t st.executeUpdate(\"update users set IsConnected = \"+isOn+\" WHERE UserName ='\"+userName+\"'\"); \n\t} catch (Exception e) {\n\t\te.printStackTrace();\t\n\t}\n\t}", "public void turnOn(boolean truth) {\r\n setEnabled(truth);\r\n }" ]
[ "0.7001775", "0.6968461", "0.69197124", "0.6623774", "0.6296028", "0.6205458", "0.6202381", "0.61354053", "0.613008", "0.61029315", "0.60882044", "0.6069493", "0.6052231", "0.5981001", "0.59574497", "0.5952099", "0.59344095", "0.59006864", "0.5886733", "0.58844936", "0.587091", "0.58698475", "0.5852803", "0.58416927", "0.5837854", "0.58370394", "0.58364946", "0.5825974", "0.5823308", "0.5821817", "0.5784185", "0.57809705", "0.5768013", "0.5767913", "0.5723085", "0.5719771", "0.56981254", "0.5685746", "0.56561834", "0.56478924", "0.5630124", "0.5629091", "0.56246066", "0.562316", "0.5596318", "0.5592684", "0.5580875", "0.5577781", "0.55755", "0.55600834", "0.55560446", "0.5540821", "0.55289376", "0.5527835", "0.55260676", "0.5518315", "0.5512508", "0.5504138", "0.5488511", "0.54819155", "0.54766643", "0.5467608", "0.54478765", "0.54418635", "0.5435032", "0.5433956", "0.5433288", "0.542029", "0.5391653", "0.5389385", "0.5384533", "0.5384396", "0.5382886", "0.5381764", "0.53794116", "0.5377373", "0.53773266", "0.5373404", "0.53716856", "0.53714854", "0.5367632", "0.5367384", "0.5367384", "0.536643", "0.536624", "0.53599715", "0.5357106", "0.53522366", "0.5349786", "0.5346166", "0.53344053", "0.5334291", "0.5332506", "0.53299224", "0.5327548", "0.53266615", "0.53248465", "0.5324456", "0.53243494", "0.53146416" ]
0.8309003
0
constructor for the user
public User(String email, long locationId, String type) { this.email = email; this.locationId = locationId; this.type = type; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "User()\n\t{\n\n\t}", "public User() {\n\t\tsuper();\n\t}", "public User() {\n\t\tsuper();\n\t}", "public User() {\n\t\tsuper();\n\t}", "public User() {\n\t\tsuper(AppEntityCodes.USER);\n\t}", "public User() {\r\n this(\"\", \"\");\r\n }", "public User() {\r\n \r\n }", "public TUser() {\n this(\"t_user\", null);\n }", "public User() {\n super();\n }", "public User() {\n super();\n }", "public User(){\n this(null, null);\n }", "public User(String n) { // constructor\r\n name = n;\r\n }", "public User() {\r\n\r\n\t}", "public User() {\n this.id = 0;\n this.username = \"gfisher\";\n this.password = \"password\";\n this.email = \"[email protected]\";\n this.firstname = \"Gene\";\n this.lastname = \"Fisher\";\n this.type = new UserPermission(true, true, true, true);\n }", "public UserModel(){\n ID = 0; // The user's ID, largely used in conjuction with a database\n firstName = \"fname\"; //User's first name\n lastName = \"lname\"; // User's last name\n password= \"pass\"; ///User password\n username = \"testuser\"; //Valid email for user\n role = 0; //Whether the user is a typical user or administrator\n status = 0; //Whether the user is active or disabled\n }", "public UserInfo() {\r\n\t\t// TODO Auto-generated constructor stub\r\n\t}", "public User() {\n /**\n * default Cto'r\n */\n }", "public User() {\r\n\t}", "public User() {\n\n\t}", "public User() {\n }", "public UserInfo() {\n }", "public LibrarianUser() {\n\t\tsuper();\n\t}", "public User() {\n uid= 0;\n username = \"\";\n password = \"\";\n role = \"user\";\n status = false;\n updatedTime = new Timestamp(0);\n }", "public User() {\r\n }", "public User() {\n\t}", "public JSONUser(){\n\t}", "public QUser() {\n super(User.class);\n }", "public User()\n\t{\n\t}", "public UserObject() {\n command = \"\";\n lastCommand = \"\";\n response = \"\";\n }", "public GameUser() {\n\t}", "public User(){}", "public User(){}", "public User(){}", "public SecurityUser() {\n\t\tsuper();\n\t}", "private UserPrefernce(){\r\n\t\t\r\n\t}", "public User() {}", "public User() {}", "public User() {}", "public User(){\n\t username = \"Anonymous\";\n\t}", "private User() {}", "public DbUser() {\r\n\t}", "user(String username, int herotype) {\r\n this.username = username;\r\n this.herotype = herotype;\r\n }", "public User() {\n this.inv = new Inventory();\n this.fl = new FriendList();\n this.tradesList = new TradesList();\n this.tradeCount = 0;\n this.downloadsEnabled = true;\n }", "protected User() {}", "protected User() {}", "public User() {\n this.username = \"test\";\n }", "public AppUser() {\r\n\t\tsuper();\r\n\t}", "public User(){\n }", "protected User(){\n this.username = null;\n this.password = null;\n this.accessLevel = null;\n this.name = DEFAULT_NAME;\n this.telephone = DEFAULT_TELEPHONE;\n this.email = DEFAULT_EMAIL;\n }", "public UserRecord() {\n super(User.USER);\n }", "public UserRecord() {\n super(User.USER);\n }", "public UserRecord() {\n super(User.USER);\n }", "public UserRecord() {\n super(User.USER);\n }", "public User(){\n\n }", "private UserParser() {\n }", "private User() {\n }", "public User() { }", "public User() {\n\tsuper();\n}", "public User()\n\t{\n\t\tfirstName = \"\";\n\t\tlastName = \"\";\n\t\tusername = \"\";\n\t\tpassword = \"\";\n\t}", "public User() {\n log.debug(\"Create a User object\");\n }", "public User(String name){\n this.name = name;\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public User() {\n }", "public QUser(Database server) {\n super(User.class, server);\n }", "public User() {\r\n\t\temployee=new HashMap<Integer, Employee>();\r\n\t\tperformance=new HashMap<Employee,String>();\r\n\t}", "public User(String n, int a) { // constructor\r\n name = n;\r\n age = a;\r\n }", "public User()\n\t{\n\t\tif(UA.singleInstance())\n\t\t{\n\t\t\tua = UA.getInstance();\n\t\t}\n\t}", "public ActivityUser() {\n }", "protected User() {\n }", "public User() {\r\n // TODO - implement User.User\r\n throw new UnsupportedOperationException();\r\n }", "public User() {\n name = \"\";\n }", "public User() {\n\t\tsuper(\"User\", models.DefaultSchema.DEFAULT_SCHEMA);\n\t}", "public User() {\n this.firstName = \"Lorenzo\";\n this.lastName = \"Malferrari\";\n this.username = \"[email protected]\";\n this.email = \"[email protected]\";\n this.password = \"123456\";\n this.city = \"Bologna\";\n this.country = \"Italia\";\n this.gender = \"Maschio\";\n this.birthdate = new Date();\n this.age = 21;\n this.imgUser = 1;\n this.last_access = new Date();\n this.registration_date = new Date();\n }", "public UserModel()\n\t{}", "public UserData() {\n }", "public ChatUserRecord() {\n super(ChatUser.CHAT_USER);\n }", "public User() {\n\n }", "public AppUser() {\n super();\n }", "private User(){\n\n }", "private void initUser() {\n\t}", "public DMXUserInput() {\n }", "public UserAccount() {\n\n\t}", "public UserEntity() {\n\t\tsuper();\n\t}", "public User(String name) {\r\n\t\tthis.name = name;\r\n\t}", "public User(int user_id, String full_name, String address, String postal_code, int mobile_no,\n String snow_zone, String garbage_day, String password){\n this.user_id = user_id;\n this.full_name = full_name;\n this.address = address;\n this.postal_code = postal_code;\n this.mobile_no = mobile_no;\n this.snow_zone = snow_zone;\n this.garbage_day = garbage_day;\n this.password = password;\n\n }", "public User() {\r\n\t\tuName = null;\r\n\t\tpassword = null;\r\n\t\tfullName = null;\r\n\t\tphone = null;\r\n\t\temail = null;\r\n\t}", "public UserQuery() {\n super(QueryStrings.USER_QUERY_BASIC);\n }", "public User()\r\n\t{\r\n\t\tthis.userId = 0;\r\n\t\tthis.userName = \"\";\r\n\t\tthis.role = \"\";\r\n\t\tthis.firstName = \"\";\r\n\t\tthis.lastName = \"\";\r\n\t\tthis.emailAddress = \"\";\r\n\t\tthis.streetAddress = \"\";\r\n\t\tthis.city = \"\";\r\n\t\tthis.state = \"\";\r\n\t\tthis.zip = 0;\r\n\t\tthis.country = \"\";\r\n\t}", "public UserMember() {\r\n //this.email = \"[email protected]\";\r\n this.email = \"\";\r\n this.firstName = \"\";\r\n this.lastName = \"\";\r\n this.username = \"\";\r\n this.password = \"\";\r\n this.memberId = 0;\r\n }", "public Person(User user) {\n this.username = user.getUsername();\n this.email = user.getEmail();\n this.firstname = user.getFirstname();\n this.lastname = user.getLastname();\n }" ]
[ "0.8318456", "0.7813997", "0.7813997", "0.7813997", "0.7761916", "0.7750236", "0.7738098", "0.7693695", "0.76751924", "0.76751924", "0.76741606", "0.76546437", "0.76546067", "0.7641786", "0.7606404", "0.75897914", "0.7577998", "0.7564268", "0.7560402", "0.7549942", "0.7527262", "0.75005734", "0.74908006", "0.748613", "0.74845487", "0.7476994", "0.74763715", "0.74620867", "0.74426705", "0.7420964", "0.74096584", "0.74096584", "0.74096584", "0.7401479", "0.7398397", "0.7398094", "0.7398094", "0.7398094", "0.7395116", "0.7389118", "0.7387737", "0.73814785", "0.7371444", "0.73664564", "0.73664564", "0.73436064", "0.73434216", "0.7342304", "0.7328887", "0.7319903", "0.7319903", "0.7319903", "0.7319903", "0.7313723", "0.7307724", "0.7307687", "0.729959", "0.7298021", "0.728304", "0.7270981", "0.7268978", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7262897", "0.7256292", "0.7255131", "0.72405636", "0.7223203", "0.72198653", "0.7215882", "0.7211868", "0.72115445", "0.72103727", "0.71945024", "0.71776515", "0.71724397", "0.7165995", "0.71651775", "0.7154769", "0.71363187", "0.7135942", "0.71268994", "0.712609", "0.7113188", "0.71049505", "0.7071563", "0.70707023", "0.70700693", "0.7065745", "0.70639056", "0.7046844" ]
0.0
-1
(a) initialize vocabulary: words appear in both training and testing data (b) initialize H: a map from lexical to its ID TODO (c) initialize V: ??? (d)
public void load() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void train(Instance[] trainingData, int v) {\n\n\t\t// For all the words in the documents, count the number of occurrences. Save in\n\t\t// HashMap\n\t\t// e.g.\n\t\t// m_map[0].get(\"catch\") should return the number of \"catch\" es, in the\n\t\t// documents labeled sports\n\t\t// Hint: m_map[0].get(\"asdasd\") would return null, when the word has not\n\t\t// appeared before.\n\t\t// Use m_map[0].put(word,1) to put the first count in.\n\t\t// Use m_map[0].replace(word, count+1) to update the value\n\t\tm_trainingData = trainingData;\n\t\tm_v = v;\n\t\tm_map[0] = new HashMap<>();\n\t\tm_map[1] = new HashMap<>();\n\n\t\t// iterate the instances (i.e., articles) in the training data\n\t\tfor (int i = 0; i < m_trainingData.length; i++) {\n\t\t\tInstance article = m_trainingData[i];\n\t\t\t// if this article belongs to sports\n\t\t\tif (article.label.equals(Label.SPORTS)) {\n\t\t\t\t// iterate each word in this article\n\t\t\t\tfor (int j = 0; j < article.words.length; j++) {\n\t\t\t\t\tString word = article.words[j];\n\t\t\t\t\t// if this word exists in the sports hashmap\n\t\t\t\t\tif (m_map[0].containsKey(word)) {\n\t\t\t\t\t\tm_map[0].replace(word, m_map[0].get(word).intValue() + 1);\n\t\t\t\t\t}\n\t\t\t\t\t// if this word is a new word in the sports hashmap\n\t\t\t\t\telse {\n\t\t\t\t\t\tm_map[0].put(word, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// if this article belongs to business (i.e., non-sports)\n\t\t\telse {\n\t\t\t\t// iterate each word in this article\n\t\t\t\tfor (int j = 0; j < article.words.length; j++) {\n\t\t\t\t\tString word = article.words[j];\n\t\t\t\t\t// if this word exists in the business hashmap\n\t\t\t\t\tif (m_map[1].containsKey(word)) {\n\t\t\t\t\t\tm_map[1].replace(word, m_map[1].get(word).intValue() + 1);\n\t\t\t\t\t}\n\t\t\t\t\t// if this word is a new word in the sports hashmap\n\t\t\t\t\telse {\n\t\t\t\t\t\tm_map[1].put(word, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// |V| is the size of the total vocabulary we assume we will encounter (i.e.,\n\t\t// the dictionary size) from training data and test data\n\t\t// The value |V| will be passed to the train method of your classifier as the\n\t\t// argument int v.\n\n\t\t// To obtain the number of word type\n\t\tSet<String> all = new HashSet<String>();\n\t\tfor (int j = 0; j < m_trainingData.length; j++) {\n\t\t\tfor (int k = 0; k < m_trainingData[j].words.length; k++) {\n\t\t\t\tall.add(m_trainingData[j].words[k]);\n\t\t\t}\n\t\t}\n\n\t\t// To obtain the total number of words for each class(label)\n\t\tsumV[0] = 0.0;\n\t\tsumV[1] = 0.0;\n\t\tfor (String w : all) {\n\t\t\tif (m_map[0].get(w) != null) {\n\t\t\t\tsumV[0] += m_map[0].get(w);\n\t\t\t}\n\t\t\tif (m_map[1].get(w) != null) {\n\t\t\t\tsumV[1] += m_map[1].get(w);\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic void setTraining(String text) {\n\t\tmyWords = text.split(\"\\\\s+\");\n\t\tmyMap = new HashMap<String , ArrayList<String>>();\n\t\t\n\t\tfor (int i = 0; i <= myWords.length-myOrder; i++)\n\t\t{\n\t\t\tWordGram key = new WordGram(myWords, i, myOrder);\n\t\t\tif (!myMap.containsKey(key))\n\t\t\t{\n\t\t\t\tArrayList<String> list = new ArrayList<String>();\n\t\t\t\tif (i+myOrder != myWords.length)\n\t\t\t\t{\n\t\t\t\t\tlist.add(myWords[i+myOrder]);\n\t\t\t\t\tmyMap.put(key, list);\n\t\t\t\t} else {\n\t\t\t\t\tlist.add(PSEUDO_EOS);\n\t\t\t\t\tmyMap.put(key, list);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (i+myOrder != myWords.length)\n\t\t\t\t{\n\t\t\t\t\t((ArrayList<String>) myMap.get(key)).add(myWords[i+myOrder]);\n\t\t\t\t} else {\n\t\t\t\t\t((ArrayList<String>) myMap.get(key)).add(PSEUDO_EOS);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic void train(List<Instance> trainData, int v) {\n\t\t// TODO : Implement\n\t\t// Hint: First, calculate the documents and words counts per label and store\n\t\t// them.\n\t\t// Then, for all the words in the documents of each label, count the number of\n\t\t// occurrences of each word.\n\t\t// Save these information as you will need them to calculate the log\n\t\t// probabilities later.\n\t\t//\n\t\t// e.g.\n\t\t// Assume m_map is the map that stores the occurrences per word for positive\n\t\t// documents\n\t\t// m_map.get(\"catch\") should return the number of \"catch\" es, in the documents\n\t\t// labeled positive\n\t\t// m_map.get(\"asdasd\") would return null, when the word has not appeared before.\n\t\t// Use m_map.put(word,1) to put the first count in.\n\t\t// Use m_map.replace(word, count+1) to update the value\n\t\twordCount = new HashMap<Label, Integer>();\n\t\tdocCount = new HashMap<Label, Integer>();\n\t\t\n\t\tposWords = new HashMap<String, Integer>();\n\t\tnegWords = new HashMap<String, Integer>();\n\t\t\n\t\tgetWordsCountPerLabel(trainData);\n\t\tgetDocumentsCountPerLabel(trainData);\n\t\tthis.v = v;\n\t\t\n\t\tfor(Instance data: trainData) {\n\t\t\tif(data.label.equals(Label.POSITIVE)) {\n\t\t\t\tfor(String word: data.words) {\n\t\t\t\t\tif(posWords.containsKey(word)) {\n\t\t\t\t\t\tint num = posWords.get(word) + 1;\n\t\t\t\t\t\tposWords.put(word, num);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tposWords.put(word, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor(String word: data.words)\n\t\t\t\t\tif(negWords.containsKey(word)) {\n\t\t\t\t\t\tint num = negWords.get(word) + 1;\n\t\t\t\t\t\tnegWords.put(word, num);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tnegWords.put(word, 1);\n\t\t\t}\n\t\t}\n\t}", "public void train(Corpus[] trainingData) {\n\t\tSet<String> vocabulary = super.mergeVocabulary(trainingData);\n\t\ttrainingData[0].setVocabulary(vocabulary);\n\t\ttrainingData[1].setVocabulary(vocabulary);\n\t\tposMatrix = new TransitionMatrix(trainingData[0]);\n\t\tnegMatrix = new TransitionMatrix(trainingData[1]);\n\t}", "public static Hashtable<String,Thought> buildWordSet(Vector<Thought> words) {\r\n\t\tHashtable<String,Thought> ret = new Hashtable<String,Thought>();\r\n\t\tfor(Thought word : words) {\r\n\t\t\tret.put(word.representation, word);\r\n\t\t}\r\n\t\treturn ret;\r\n\t}", "private void initiateWordCount(){\n for(String key: DataModel.bloomFilter.keySet()){\n WordCountHam.put(key, 0);\n WordCountSpam.put(key, 0);\n }\n }", "public EfficientWordMarkov()\n\t{\n\t\tsuper();\n\t\tmyMap = new HashMap<WordGram , ArrayList<String>>();\n\t}", "public void getVector() throws IOException {\n\t\tint i=1;\r\n\t\tfor(String key:keyword){\r\n\t\t\tWord w=new Word();\r\n\t\t\tdouble tf=calTF(key);\r\n\t\t\tdouble idf=calIDF(key);\r\n\t\t\tdouble tfidf=tf*idf;\r\n\t\t\tw.setId(i);\r\n\t\t\ti++;\r\n\t\t\tw.setName(key);\r\n\t\t\tw.setTfidf(tfidf);\r\n\t\t\tif(word.containsKey(key)){\r\n\t\t\t\tw.setCount((Integer) word.get(key));\r\n\t\t\t}\r\n\t\t\tkeymap.add(w);\r\n\t\t}\r\n\t\tFileHelper.writeTrainFile(keymap);\r\n\t\tFileHelper.writeTestFile(keymap);\r\n\t}", "private Vocabulary() {\n }", "public q677() {\n hm = new HashMap<>();\n words = new HashMap<>();\n }", "private static void buildTrainingSet(ArrayList<ArrayList<String>> posTrainSet, HashMap<String, Integer> hashMap1,\r\n\t\t\tHashMap<String, Integer> hashMap2)\r\n\t{\n\tfor (ArrayList<String> currentReview : posTrainSet) \r\n\t{ \t\r\n\t \t\r\n \tint negation = 0;\r\n \t\r\n \tfor(String word : currentReview)\r\n {\r\n \t\t//ADD OTHER NEGATIVE WORDS.ALSO CONSIDER NOT ONLY AND NEITHER NOR\r\n \tif(word.equals(\"not\") || word.equals(\"but\") || word.equals(\"no\") || word.equals(\"never\"))\r\n \t{\r\n \t\tnegation = 1- negation;\r\n \t}\r\n \telse if(word.equals(\".\"))\r\n \t{\r\n \t\tnegation =0;\r\n \t}\r\n \telse if(negation == 0)\r\n \t{\r\n \t\tInteger count = hashMap1.get(word);\r\n \t\t if (count == null) {\r\n \t\t count = 0;\r\n \t\t }\r\n \t\t hashMap1.put(word, count + 1);\r\n \t\t \r\n \t\t //ADD TO NEGATIVE NOT_WORD\r\n \t\t String negForm = \"NOT_\"+ word;\r\n \t\t count = hashMap2.get(negForm);\r\n \t\t if (count == null) {\r\n \t\t count = 0;\r\n \t\t }\r\n \t\t hashMap2.put(negForm, count + 1);\r\n \t\t \r\n \t}\r\n \telse\r\n \t{\r\n \t\tString negForm = \"NOT_\"+ word;\r\n \t\tInteger count = hashMap1.get(negForm);\r\n \t\t if (count == null) {\r\n \t\t count = 0;\r\n \t\t }\r\n \t\t hashMap1.put(negForm, count + 1);\r\n \t}\r\n \t\r\n }\r\n\t\r\n }\r\n\t}", "public void constructOntologyVocabulary() {\n ontologyOwlClassVocabulary = new HashMap<>();\n ontologyOWLDataPropertyVocabulary = new HashMap<>();\n ontologyOWLNamedIndividualVocabulary = new HashMap<>();\n ontologyOWLObjectPropertylVocabulary = new HashMap<>();\n\n Set<OWLClass> classes = domainOntology.getClassesInSignature();\n Set<OWLNamedIndividual> individualPropertyAtom = domainOntology.getIndividualsInSignature();\n Set<OWLDataProperty> dataProperty = domainOntology.getDataPropertiesInSignature();\n Set<OWLObjectProperty> OWLObjectPropertyAtom = domainOntology.getObjectPropertiesInSignature();\n String tempName = null;\n\n for (OWLClass c : classes) {\n tempName = c.toString();\n tempName = tempName.substring(tempName.lastIndexOf(\"/\") + 1);\n tempName = TextUtil.formatName(tempName);\n ontologyOwlClassVocabulary.put(tempName, c);\n }\n for (OWLDataProperty d : dataProperty) {\n tempName = d.toString();\n tempName = tempName.substring(tempName.lastIndexOf(\"/\") + 1);\n tempName = TextUtil.formatName(tempName);\n ontologyOWLDataPropertyVocabulary.put(tempName, d);\n }\n for (OWLNamedIndividual i : individualPropertyAtom) {\n tempName = i.toString();\n tempName = tempName.substring(tempName.lastIndexOf(\"/\") + 1);\n tempName = TextUtil.formatName(tempName);\n ontologyOWLNamedIndividualVocabulary.put(tempName, i);\n }\n for (OWLObjectProperty o : OWLObjectPropertyAtom) {\n tempName = o.toString();\n tempName = tempName.substring(tempName.lastIndexOf(\"/\") + 1);\n tempName = TextUtil.formatName(tempName);\n ontologyOWLObjectPropertylVocabulary.put(tempName, o);\n }\n }", "private void populateMaps() {\n\t\t//populate the conversion map.\n\t\tconvertMap.put(SPACE,(byte)0);\n\t\tconvertMap.put(VERTICAL,(byte)1);\n\t\tconvertMap.put(HORIZONTAL,(byte)2);\n\n\t\t//build the hashed numbers based on the training input. 1-9\n\t\tString trainingBulk[] = new String[]{train1,train2,train3,\"\"};\n\t\tbyte[][] trainer = Transform(trainingBulk);\n\t\tfor(int i=0; i < 9 ;++i) {\n\t\t\tint val = hashDigit(trainer, i);\n\t\t\tnumbers.put(val,i+1);\n\t\t}\n\t\t//train Zero\n\t\ttrainingBulk = new String[]{trainz1,trainz2,trainz3,\"\"};\n\t\tint zeroVal = hashDigit(Transform(trainingBulk), 0);\n\t\tnumbers.put(zeroVal,0);\n\n\n\t}", "private void test() throws IOException {\n\t\tdouble wordFreq = 0, probAttr = 0, // overlapped word frequency,\n\t\t\t\t\t\t\t\t\t\t\t// probability of each attribute\n\t\tprobHam, probSpam;// probability of being ham and spam\n\t\tdouble wordAppearInVocab = 0; // whether words in test file appeared in\n\t\t\t\t\t\t\t\t\t\t// all training files\n\t\ttestContent = new String();// content of test file\n\n\t\t/* words in test, spam, ham files */\n\t\tArrayList<String> testWord = new ArrayList<String>();\n\t\tArrayList<String> hamWord = new ArrayList<String>();\n\t\tArrayList<String> spamWord = new ArrayList<String>();\n\t\tString buff;// tmp buffer for file reading\n\t\tBufferedReader in = new BufferedReader(new FileReader(inputTestFile));\n\n\t\t/* assign words */\n\t\twhile ((buff = in.readLine()) != null)\n\t\t\ttestContent += buff;\n\t\tfor (int i = 0; i < testContent.split(\" \").length; i++)\n\t\t\ttestWord.add(testContent.split(\" \")[i]);\n\t\tfor (int i = 0; i < hamContent.split(\" \").length; i++)\n\t\t\thamWord.add(hamContent.split(\" \")[i]);\n\t\tfor (int i = 0; i < spamContent.split(\" \").length; i++)\n\t\t\tspamWord.add(spamContent.split(\" \")[i]);\n\n\t\t/*\n\t\t * calculate the probability of being ham\n\t\t */\n\t\tfor (int i = 0; i < testWord.size(); i++) {\n\t\t\tif (vocabulary.contains(testWord.get(i))) // check whether a word is\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// in vocabulary, if\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// not, ignore it\n\t\t\t\twordAppearInVocab++;\n\t\t\tfor (int j = 0; j < hamWord.size(); j++) { // get word frequency of\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// words in training\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// files\n\t\t\t\tif (testWord.get(i).equals(hamWord.get(j))) {\n\t\t\t\t\twordFreq++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (wordAppearInVocab != 0) {\n\t\t\t\tprobAttr += java.lang.Math.log((double) (wordFreq + 1) // get\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// probability\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// of an\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// attribute\n\t\t\t\t\t\t/ (double) (hamWordCount + vocabLen));\n\t\t\t}\n\t\t\twordFreq = 0;\n\t\t\twordAppearInVocab = 0;\n\t\t}\n\t\tprobHam = java.lang.Math.log(pHam) + probAttr;\n\t\tprobAttr = 0;\n\t\t/*\n\t\t * calculate the probability of being spam\n\t\t */\n\t\tfor (int i = 0; i < testWord.size(); i++) {\n\t\t\tif (vocabulary.contains(testWord.get(i)))\n\t\t\t\twordAppearInVocab++;\n\n\t\t\tfor (int j = 0; j < spamWord.size(); j++) {\n\t\t\t\tif (testWord.get(i).equals(spamWord.get(j))) {\n\t\t\t\t\twordFreq++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tif (wordAppearInVocab != 0) {\n\t\t\t\tprobAttr += java.lang.Math.log((double) (wordFreq + 1)\n\t\t\t\t\t\t/ (double) (spamWordCount + vocabLen));\n\t\t\t}\n\t\t\twordFreq = 0;\n\t\t\twordAppearInVocab = 0;\n\t\t}\n\t\tprobSpam = java.lang.Math.log(pSpam) + probAttr;\n\t\tprobAttr = 0;\n\n\t\t/*\n\t\t * output\n\t\t */\n\n\t\t/*\n\t\t * for (int i = 0; i < vocabulary.size(); i++) {\n\t\t * System.out.println(vocabulary.get(i)); } System.out.println(probHam -\n\t\t * probSpam);\n\t\t */\n\t\tif (probHam > probSpam)\n\t\t\tSystem.out.println(\"ham\");\n\t\telse\n\t\t\tSystem.out.println(\"spam\");\n\t}", "public static void buildTrainData() throws IOException {\n\t\tString negativePath = \"./corpus/20ng-train-all-terms.txt\";\n\t\tString positivePath = \"./corpus/r8-train-all-terms.txt\";\n\t\tString fileout = \"./corpus/trainData\";\n\t\tFileReader fr1 = new FileReader(negativePath);\n\t\tFileReader fr2 = new FileReader(positivePath);\n\t\tFileWriter fw = new FileWriter(fileout);\n\t\tBufferedReader br1 = new BufferedReader(fr1);\n\t\tBufferedReader br2 = new BufferedReader(fr2);\n\t\tBufferedWriter bw = new BufferedWriter(fw);\n\t\tHashtable<String, Integer> map = new Hashtable<String, Integer>();\n\t\tString readoneline;\n\t\twhile (((readoneline = br1.readLine()) != null)) {\n\t\t\tint pos = readoneline.indexOf(\"\\t\");\n\t\t\tString topic = readoneline.substring(0, pos);\n\t\t\tString content = readoneline.substring(pos + 1);\n\n\t\t\tif (!map.containsKey(topic)) {\n\t\t\t\tmap.put(topic, new Integer(1));\n\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbw.write(\"-1\\t\" + result.toString());\n\t\t\t\tbw.newLine();\n\t\t\t} else {\n\t\t\t\tInteger num = map.get(topic);\n\t\t\t\tif (num < 50) {\n\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbw.write(\"-1\\t\" + result.toString());\n\t\t\t\t\tbw.newLine();\n\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (((readoneline = br2.readLine()) != null)) {\n\t\t\tint pos = readoneline.indexOf(\"\\t\");\n\t\t\tString topic = readoneline.substring(0, pos);\n\t\t\tString content = readoneline.substring(pos + 1);\n\t\t\tif (topic.equals(\"acq\") || topic.equals(\"earn\")\n\t\t\t\t\t|| topic.equals(\"money-fx\") || topic.equals(\"trade\")\n\t\t\t\t\t|| topic.equals(\"interest\")) {\n\t\t\t\tif (!map.containsKey(topic)) {\n\t\t\t\t\tmap.put(topic, new Integer(1));\n\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\tbw.newLine();\n\t\t\t\t} else {\n\t\t\t\t\tInteger num = map.get(topic);\n\t\t\t\t\tif (topic.equals(\"acq\") && num < 300) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"earn\") && num < 450) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"money-fx\") && num < 100) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"trade\") && num < 100) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"interest\") && num < 50) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbw.flush();\n\t\tbr1.close();\n\t\tbw.close();\n\t\tfw.close();\n\n\t}", "private void init() {\n this.sentences = new HashMap<>();\n\n String kapHeader = this.kapFormatter.getFormattedKapHeader();\n Scanner scanner = new Scanner(kapHeader);\n scanner.useDelimiter(\"\\n\");\n String currentSentence = null;\n\n while (scanner.hasNext()) {\n currentSentence = scanner.next();\n String key = currentSentence.substring(0, currentSentence.indexOf(\"/\"));\n String sentenceWithoutToken = currentSentence.substring(currentSentence.indexOf(\"/\") + 1, currentSentence.length());\n\n if (!this.sentences.containsKey(key)) {\n List<String> values = new ArrayList<>();\n this.sentences.put(key, values);\n }\n\n List<String> mapList = this.sentences.get(key);\n mapList.add(sentenceWithoutToken);\n }\n scanner.close();\n }", "public static Dictionary initializeVocabulary(Context context) {\n String filename = \"./res/raw/vocabulary.json\";\n String backup_url = \"www.axonbeats.com/resources/vocabulary.json\";\n int resourceID = R.raw.vocabulary;\n return ResourceLoader.loadDict(resourceID, context);\n }", "public void testVocabulary() throws Exception {\n assertVocabulary(a, getDataPath(\"kstemTestData.zip\"), \"kstem_examples.txt\");\n }", "private void initialise(String initialWord, int size, SimpleGraph<String, DefaultEdge> graph){\n\t\tHashtable<String, ArrayList<String>> progress = new Hashtable<String, ArrayList<String>>(size);\t\t\t\t\t\n\t\tfor(String s: words){\n\t\t\tif(!(progress.containsKey(s)))\n\t\t\t\tprogress.put(s, matchingWords(s));\n\t\t}\n\t\tEnumeration<String> key = progress.keys();\n\t\tString keyword;\n\t\tArrayList<String> values = new ArrayList<String>();\n\t\twhile(key.hasMoreElements()){\n\t\t\tkeyword=(String)key.nextElement();\n\t\t\tvalues = progress.get(keyword);\n\t\t\tif(!(graph.containsVertex(keyword))){\n\t\t\t\tgraph.addVertex(keyword);\n\t\t\t\tfor(String s: values){\n\t\t\t\t\tgraph.addVertex(s);\n\t\t\t\t\tgraph.addEdge(keyword, s);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tfor(String s: values){\n\t\t\t\t\tif(!(graph.containsEdge(keyword,s))){\n\t\t\t\t\t\tgraph.addVertex(s);\n\t\t\t\t\t\tgraph.addEdge(keyword, s);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void train() throws IOException {\n\t\thamContent = new String();// the content of ham training files\n\t\tspamContent = new String();// the content of spam training files\n\t\tvocabulary = new ArrayList<String>();// all the\n\t\t\t\t\t\t\t\t\t\t\t\t// vocabulary\n\t\t\t\t\t\t\t\t\t\t\t\t// within\n\t\t\t\t\t\t\t\t\t\t\t\t// training\n\t\t\t\t\t\t\t\t\t\t\t\t// files\n\t\thamSenderDomainHash = new HashMap<String, Integer>();\n\t\thamTimeHash = new HashMap<String, Integer>();\n\t\thamReplyHash = new HashMap<String, Integer>();\n\t\thamNonCharNumHash = new HashMap<String, Integer>();\n\t\tspamSenderDomainHash = new HashMap<String, Integer>();\n\t\tspamTimeHash = new HashMap<String, Integer>();\n\t\tspamReplyHash = new HashMap<String, Integer>();\n\t\tspamNonCharNumHash = new HashMap<String, Integer>();\n\n\t\thamWordProb = new HashMap<String, Double>();\n\t\tspamWordProb = new HashMap<String, Double>();\n\t\tclassProb = new HashMap<String, Double>();\n\n\t\tfor (int i = 0; i < 24; i++) {\n\t\t\thamTimeHash.put(String.valueOf(i), 0);\n\t\t\tspamTimeHash.put(String.valueOf(i), 0);\n\t\t}\n\t\tint numSpam = 0, numHam = 0, numFile = 0;// numbers of training files\n\t\tString buff;// file reading tmp buffer\n\n\t\t/* get all the files in the directory */\n\t\tFile directory = new File(inputDirectory);\n\t\tFile[] files = directory.listFiles();\n\n\t\t/*\n\t\t * assign the content of hams and spams while counting the number of\n\t\t * files\n\t\t */\n\t\tfor (File f : files) {\n\t\t\tif (f.getName().startsWith(\"spam\")) {\n\t\t\t\tString readbuffer = readFile(f, 1);\n\t\t\t\tif (!spamTime.equals(\"-1\")) {\n\t\t\t\t\tspamSenderDomainHash.put(spamSenderDomain, 0);\n\t\t\t\t\thamSenderDomainHash.put(spamSenderDomain, 0);\n\t\t\t\t\tspamNonCharNumHash.put(spamNonCharNum, 0);\n\t\t\t\t\thamNonCharNumHash.put(spamNonCharNum, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (f.getName().startsWith(\"ham\")) {\n\t\t\t\tString readbufferString = readFile(f, 0);\n\t\t\t\tif (!hamTime.equals(\"-1\")) {\n\t\t\t\t\tspamSenderDomainHash.put(hamSenderDomain, 0);\n\t\t\t\t\thamSenderDomainHash.put(hamSenderDomain, 0);\n\t\t\t\t\tspamNonCharNumHash.put(hamNonCharNum, 0);\n\t\t\t\t\thamNonCharNumHash.put(hamNonCharNum, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (File f : files) {\n\t\t\tnumFile++;\n\t\t\t// System.out.println(f.getName());\n\t\t\tif (f.getName().startsWith(\"spam\")) {\n\t\t\t\tnumSpam++; // add to the number of spams\n\t\t\t\tString readbuffer = readFile(f, 1);\n\t\t\t\tif (!spamNonCharNumHash.containsKey(spamNonCharNum))\n\t\t\t\t\tspamNonCharNumHash.put(spamNonCharNum, 1);\n\t\t\t\telse if (spamNonCharNumHash.containsKey(spamNonCharNum))\n\t\t\t\t\tspamNonCharNumHash.put(spamNonCharNum,\n\t\t\t\t\t\t\tspamNonCharNumHash.get(spamNonCharNum) + 1);\n\t\t\t\tif (!spamTime.equals(\"-1\")) {\n\t\t\t\t\tif (!spamSenderDomainHash.containsKey(spamSenderDomain)\n\t\t\t\t\t\t\t&& !(spamSenderDomain.equals(\"\"))\n\t\t\t\t\t\t\t&& (spamSenderDomain.length() <= 3))\n\t\t\t\t\t\tspamSenderDomainHash.put(spamSenderDomain, 1);\n\t\t\t\t\telse if (spamSenderDomainHash.containsKey(spamSenderDomain)\n\t\t\t\t\t\t\t&& !(spamSenderDomain.equals(\"\"))\n\t\t\t\t\t\t\t&& (spamSenderDomain.length() <= 3))\n\t\t\t\t\t\tspamSenderDomainHash.put(spamSenderDomain,\n\t\t\t\t\t\t\t\tspamSenderDomainHash.get(spamSenderDomain) + 1);\n\t\t\t\t\tif (!spamTimeHash.containsKey(spamTime))\n\t\t\t\t\t\tspamTimeHash.put(spamTime, 1);\n\t\t\t\t\telse if (spamTimeHash.containsKey(spamTime))\n\t\t\t\t\t\tspamTimeHash.put(spamTime,\n\t\t\t\t\t\t\t\tspamTimeHash.get(spamTime) + 1);\n\t\t\t\t\tif (!spamReplyHash.containsKey(spamReply))\n\t\t\t\t\t\tspamReplyHash.put(spamReply, 1);\n\t\t\t\t\telse if (spamReplyHash.containsKey(spamReply))\n\t\t\t\t\t\tspamReplyHash.put(spamReply,\n\t\t\t\t\t\t\t\tspamReplyHash.get(spamReply) + 1);\n\n\t\t\t\t}\n\t\t\t\tspamContent += readbuffer.toLowerCase();\n\t\t\t\tspamContent = spamContent.replaceAll(\"[^a-zA-Z$\\n]+\", \" \");\n\n\t\t\t} else if (f.getName().startsWith(\"ham\")) { // the same thing for\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// ham\n\t\t\t\tnumHam++;\n\t\t\t\tString readbuffer = readFile(f, 0);\n\t\t\t\tif (!hamNonCharNumHash.containsKey(hamNonCharNum))\n\t\t\t\t\thamNonCharNumHash.put(hamNonCharNum, 1);\n\t\t\t\telse if (hamNonCharNumHash.containsKey(hamNonCharNum))\n\t\t\t\t\thamNonCharNumHash.put(hamNonCharNum,\n\t\t\t\t\t\t\thamNonCharNumHash.get(hamNonCharNum) + 1);\n\t\t\t\tif (!hamTime.equals(\"-1\")) {\n\t\t\t\t\tif (!hamSenderDomainHash.containsKey(hamSenderDomain)\n\t\t\t\t\t\t\t&& !(hamSenderDomain.equals(\"\"))\n\t\t\t\t\t\t\t&& (hamSenderDomain.length() <= 3))\n\t\t\t\t\t\thamSenderDomainHash.put(hamSenderDomain, 1);\n\t\t\t\t\telse if (hamSenderDomainHash.containsKey(hamSenderDomain)\n\t\t\t\t\t\t\t&& !(hamSenderDomain.equals(\"\"))\n\t\t\t\t\t\t\t&& (hamSenderDomain.length() <= 3))\n\t\t\t\t\t\thamSenderDomainHash.put(hamSenderDomain,\n\t\t\t\t\t\t\t\thamSenderDomainHash.get(hamSenderDomain) + 1);\n\n\t\t\t\t\tif (!hamTimeHash.containsKey(hamTime))\n\t\t\t\t\t\thamTimeHash.put(hamTime, 1);\n\t\t\t\t\telse if (hamTimeHash.containsKey(hamTime))\n\t\t\t\t\t\thamTimeHash.put(hamTime, hamTimeHash.get(hamTime) + 1);\n\t\t\t\t\tif (!hamReplyHash.containsKey(hamReply))\n\t\t\t\t\t\thamReplyHash.put(hamReply, 1);\n\t\t\t\t\telse if (hamReplyHash.containsKey(hamReply))\n\t\t\t\t\t\thamReplyHash.put(hamReply,\n\t\t\t\t\t\t\t\thamReplyHash.get(hamReply) + 1);\n\n\t\t\t\t}\n\t\t\t\thamContent += readbuffer.toLowerCase();\n\t\t\t\thamContent = hamContent.replaceAll(\"[^a-zA-Z$\\n]+\", \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"file read complete!!!\");\n\t\t// System.out.println(hamSenderDomainHash);\n\t\t// System.out.println(hamTimeHash);\n\t\t// System.out.println(hamReplyHash);\n\t\t// System.out.println(hamNonCharNumHash);\n\t\t// System.out.println(spamSenderDomainHash);\n\t\t// System.out.println(spamTimeHash);\n\t\t// System.out.println(spamReplyHash);\n\t\t// System.out.println(spamNonCharNumHash);\n\t\t// System.out.println(spamContent);\n\t\t// System.out.println(hamContent);\n\n\t\t/* calculate probabilities */\n\t\tpHam = (double) numHam / (double) numFile;\n\t\tpSpam = (double) numSpam / (double) numFile;\n\t\t// System.out.println(numHam);\n\t\t// System.out.println(numSpam);\n\t\t// System.out.println(numFile);\n\n\t\tclassProb.put(\"hamProb\", pHam);\n\t\tclassProb.put(\"spamProb\", pSpam);\n\n\t\t/* get vocabulary and its length */\n\t\tString[] hamWord = hamContent.split(\"\\\\s+\");\n\t\tHashMap<String, Integer> hamWordFreq = new HashMap<String, Integer>();\n\t\tfor (int i = 0; i < hamWord.length; i++) {\n\t\t\tif (hamWordFreq.containsKey(hamWord[i]))\n\t\t\t\thamWordFreq.put(hamWord[i], hamWordFreq.get(hamWord[i]) + 1);\n\t\t\tif (!hamWordFreq.containsKey(hamWord[i]))\n\t\t\t\thamWordFreq.put(hamWord[i], 1);\n\t\t}\n\t\thamWordCount = hamWord.length;\n\t\tString[] spamWord = spamContent.split(\"\\\\s+\");\n\t\tHashMap<String, Integer> spamWordFreq = new HashMap<String, Integer>();\n\t\tfor (int i = 0; i < spamWord.length; i++) {\n\t\t\tif (spamWordFreq.containsKey(spamWord[i]))\n\t\t\t\tspamWordFreq\n\t\t\t\t\t\t.put(spamWord[i], spamWordFreq.get(spamWord[i]) + 1);\n\t\t\tif (!spamWordFreq.containsKey(spamWord[i]))\n\t\t\t\tspamWordFreq.put(spamWord[i], 1);\n\t\t}\n\t\tspamWordCount = spamWord.length;\n\t\tSystem.out.println(hamWordFreq.size());\n\t\tSystem.out.println(spamWordFreq.size());\n\t\tSystem.out.println(\"count get!!!\");\n\t\t// System.out.println(hamWordCount);\n\t\t// System.out.println(spamWordCount);\n\t\tfor (int i = 0; i < hamWordCount; i++) {\n\t\t\tif (!vocabulary.contains(hamWord[i]) && !hamWord[i].equals(\"\"))\n\t\t\t\tvocabulary.add(hamWord[i]);\n\t\t}\n\t\t// System.out.println(hamWordFreq);\n\t\tfor (int i = 0; i < spamWordCount; i++)\n\t\t\tif (!vocabulary.contains(spamWord[i]) && !spamWord[i].equals(\"\"))\n\t\t\t\tvocabulary.add(spamWord[i]);\n\t\tvocabLen = vocabulary.size();\n\t\tSystem.out.println(\"vocab init\");\n\t\t/* remove unnecessary words */\n\t\tfor (int i = 0; i < vocabulary.size(); i++) {\n\t\t\tint hamwordFreq = 0;\n\t\t\ttry {\n\t\t\t\thamwordFreq = hamWordFreq.get(vocabulary.get(i));\n\t\t\t} catch (Exception e) {\n\t\t\t\thamwordFreq = 0;\n\t\t\t}\n\t\t\tint spamwordFreq = 0;\n\t\t\ttry {\n\t\t\t\tspamwordFreq = spamWordFreq.get(vocabulary.get(i));\n\t\t\t} catch (Exception e) {\n\t\t\t\tspamwordFreq = 0;\n\t\t\t}\n\t\t\tif ((hamwordFreq <= 3) && (spamwordFreq <= 3)) {\n\t\t\t\tvocabulary.remove(i);\n\t\t\t\ti--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (((double) ((double) hamwordFreq / (double) hamWordCount) >= 0.005)\n\t\t\t\t\t&& ((double) ((double) spamwordFreq / (double) spamWordCount) >= 0.005)) {\n\t\t\t\t// System.out.println(vocabulary.get(i));\n\t\t\t\tvocabulary.remove(i);\n\t\t\t\ti--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"vocab complete!!!\");\n\t\tSystem.out.println(vocabulary.size());\n\t\tvocabLen = vocabulary.size();\n\t\tfor (int i = 0; i < vocabulary.size(); i++) {\n\t\t\tint hamwordFreq = 0;\n\t\t\ttry {\n\t\t\t\thamwordFreq = hamWordFreq.get(vocabulary.get(i));\n\t\t\t} catch (Exception e) {\n\t\t\t\thamwordFreq = 0;\n\t\t\t}\n\t\t\tint spamwordFreq = 0;\n\t\t\ttry {\n\t\t\t\tspamwordFreq = spamWordFreq.get(vocabulary.get(i));\n\t\t\t} catch (Exception e) {\n\t\t\t\tspamwordFreq = 0;\n\t\t\t}\n\t\t\thamWordProb.put(\n\t\t\t\t\tvocabulary.get(i),\n\t\t\t\t\tjava.lang.Math.log((double) (hamwordFreq + 1)\n\t\t\t\t\t\t\t/ (double) (hamWordCount + vocabLen)));\n\t\t\tspamWordProb.put(\n\t\t\t\t\tvocabulary.get(i),\n\t\t\t\t\tjava.lang.Math.log((double) (spamwordFreq + 1)\n\t\t\t\t\t\t\t/ (double) (spamWordCount + vocabLen)));\n\t\t\t// System.out.println(i);\n\n\t\t}\n\t\t// System.out.println(hamWordCount);\n\t\t// System.out.println(hamContent);\n\t\t// System.out.println(hamWordProb.size());\n\t\t// System.out.println(spamWordProb.size());\n\t\t// System.out.println(vocabulary.size());\n\t\t//\n\t\t// System.out.println(hamWordProb.size());\n\t\t// System.out.println(vocabulary);\n\t\t// System.out.println(vocabLen);\n\t\tSystem.out.println(\"word prob complete!!!\");\n\t}", "public VocabularyTerms() {}", "private static void setWordPosition() {\n\t\tSet setKeys = Utility.vocabHM.keySet();\n\t\tIterator i = setKeys.iterator();\n\t\tint position = 0;\n\t\twhile (i.hasNext()) {\n\t\t\tString w = (String) i.next();\n\t\t\tInteger rows[] = new Integer[2];\n\t\t\trows[0] = new Integer(position); /* word position */\n\t\t\trows[1] = (Integer) Utility.vocabHM.get(w); /* df */\n\n\t\t\tUtility.vocabHM.put(w, rows);\n\t\t\tposition++;\n\t\t}\n\t}", "public static void Pubmed() throws IOException \n\t{\n\t\t\n\t\tMap<String,Map<String,List<String>>> trainset = null ; \n\t\t//Map<String, List<String>> titles = ReadXMLFile.ReadCDR_TestSet_BioC() ;\n\t File fFile = new File(\"F:\\\\TempDB\\\\PMCxxxx\\\\articals.txt\");\n\t List<String> sents = readfiles.readLinesbylines(fFile.toURL()); \n\t\t\n\t\tSentinfo sentInfo = new Sentinfo() ; \n\t\t\n\t\ttrainset = ReadXMLFile.DeserializeT(\"F:\\\\eclipse64\\\\eclipse\\\\TrainsetTest\") ;\n\t\tLinkedHashMap<String, Integer> TripleDict = new LinkedHashMap<String, Integer>();\n\t\tMap<String,List<Integer>> Labeling= new HashMap<String,List<Integer>>() ;\n\t\t\n\t\tMetaMapApi api = new MetaMapApiImpl();\n\t\tList<String> theOptions = new ArrayList<String>();\n\t theOptions.add(\"-y\"); // turn on Word Sense Disambiguation\n\t theOptions.add(\"-u\"); // unique abrevation \n\t theOptions.add(\"--negex\"); \n\t theOptions.add(\"-v\");\n\t theOptions.add(\"-c\"); // use relaxed model that containing internal syntactic structure, such as conjunction.\n\t if (theOptions.size() > 0) {\n\t api.setOptions(theOptions);\n\t }\n\t \n\t\t\n\t\tif (trainset == null )\n\t\t{\n\t\t\ttrainset = new HashMap<String, Map<String,List<String>>>();\n\t\t}\n\t\t\n\t\t\n\t\t/************************************************************************************************/\n\t\t//Map<String, Integer> bagofwords = semantic.getbagofwords(titles) ; \n\t\t//trainxmllabeling(trainset,bagofwords); \n\t\t/************************************************************************************************/\n\t\t\n\t\t\n\t\tint count = 0 ;\n\t\tint count1 = 0 ;\n\t\tModel candidategraph = ModelFactory.createDefaultModel(); \n\t\tMap<String,List<String>> TripleCandidates = new HashMap<String, List<String>>();\n\t\tfor(String title : sents)\n\t\t{\n\t\t\t\n\t\t\tModel Sentgraph = sentInfo.graph;\n\t\t\tif (trainset.containsKey(title))\n\t\t\t\tcontinue ; \n\t\t\t//8538\n\t\t\tcount++ ; \n\n\t\t\tMap<String, List<String>> triples = null ;\n\t\t\t// get the goldstandard concepts for current title \n\t\t\tList<String> GoldSndconcepts = new ArrayList<String> () ;\n\t\t\tMap<String, Integer> allconcepts = null ; \n\t\t\t\n\t\t\t// this is optional and not needed here , it used to measure the concepts recall \n\t\t\tMap<String, List<String>> temptitles = new HashMap<String, List<String>>(); \n\t\t\ttemptitles.put(title,GoldSndconcepts) ;\n\t\t\t\t\t\t\n\t\t\t// get the concepts \n\t\t\tallconcepts = ConceptsDiscovery.getconcepts(temptitles,api);\n\t\t\t\n\t\t\tArrayList<String> RelInstances1 = SyntaticPattern.getSyntaticPattern(title,allconcepts,FILE_NAME_Patterns) ;\n\t\t\t//Methylated-CpG island recovery assay: a new technique for the rapid detection of methylated-CpG islands in cancer\n\t\t\tif (RelInstances1 != null && RelInstances1.size() > 0 )\n\t\t\t{\n\t\t\t\tcount1++ ;\n\t\t\t\tTripleCandidates.put(title, RelInstances1) ;\n\t\t\t\t\n\t\t\t\tif (count1 == 30)\n\t\t\t\t{\n\t\t\t\t\tReadXMLFile.Serialized(TripleCandidates,\"F:\\\\eclipse64\\\\eclipse\\\\Relationdisc1\") ;\n\t\t\t\t\tcount1 = 0 ;\n\t\t\t\t}\n\t\t\t}\n \n\t\t}\n\t\t\n\t\tint i = 0 ;\n\t\ti++ ; \n\t}", "public static void main( String[] args ) throws Exception {\n Vectorizer v =new Vectorizer();\n\t //Make a hashmap of arraylist to test makeVectors() function\n HashMap<String, ArrayList<List<String>> > hh = new HashMap<String, ArrayList<List<String>> >();\n\t String Id=\"1\";String s1=\"loving \" ;String s2=\"life\";\n\t List<String> l1 = new ArrayList<String>(); l1.add(s1);l1.add(s2);\n\t Id=\"3\";s1=\"street\" ;s2=\"washington\";\n\t List<String> l3 = new ArrayList<String>(); l3.add(s1);l3.add(s2);\n\t ArrayList<List<String>> al1=new ArrayList<List<String>>();\n\t al1.add(l1);al1.add(l3);\n\t hh.put(Id,al1);\n\t \t \n\t Id=\"2\";s1=\"having\" ;s2=\"dreams\";\n\t List<String> l2 = new ArrayList<String>(); l2.add(s1);l2.add(s2);\n\t ArrayList<List<String>> al2=new ArrayList<List<String>>();\n\t al2.add(l2);\n\t hh.put(Id,al2);\n\t \n\t HashMap<String, ArrayList<Counter<String>> > hm =v.makeVectors(hh);\n {//Print the hashmap-----------------------------\n // Get a set of the entries\n Set set = hm.entrySet();\n // Get an iterator\n Iterator i = set.iterator();\n // Display elements\n while(i.hasNext()) {\n Map.Entry me = (Map.Entry)i.next();\n System.out.print(me.getKey() + \": \");\n System.out.println(me.getValue());\n }\n }//End of the print section---------------------- \n }", "public void saveTrainingDataToFileHybridSampling1() throws Exception {\n NGramTokenizer tokenizer = new NGramTokenizer();\r\n tokenizer.setNGramMinSize(1);\r\n tokenizer.setNGramMaxSize(1);\r\n tokenizer.setDelimiters(\"\\\\W\");\r\n\r\n //set stemmer - set english stemmer\r\n SnowballStemmer stemmer = new SnowballStemmer();\r\n stemmer.setStemmer(\"english\");\r\n\r\n //set lemmatizer\r\n StanfordCoreNLPLemmatizer scnlpl = new StanfordCoreNLPLemmatizer();\r\n\r\n //create new filter for vector transformation\r\n StringToWordVector filter = new StringToWordVector();\r\n filter.setLowerCaseTokens(true);\r\n filter.setOutputWordCounts(true);\r\n filter.setTFTransform(true);\r\n filter.setIDFTransform(true);\r\n filter.setStopwords(new File(\"C:\\\\Users\\\\hp\\\\Desktop\\\\SVM implementation\\\\StopWordsR2.txt\")); // stop word removal given in research paper\r\n filter.setTokenizer(tokenizer);\r\n filter.setStemmer(scnlpl);\r\n\r\n System.out.println(\"Stemmer Name- \" + filter.getStemmer());\r\n\r\n InstanceQuery query = new InstanceQuery();\r\n query.setUsername(\"root\");\r\n query.setPassword(\"\");\r\n\r\n int numberOfPapers = 5;\r\n Instances[] otherArticles = new Instances[numberOfPapers];\r\n query.setQuery(\"SELECT content, label FROM article_ceylon_today_2013 where `label` = 'other'\");\r\n otherArticles[0] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2012 where `label` ='other'\");\r\n otherArticles[1] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2013 where `label` ='other'\");\r\n otherArticles[2] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2012 where `label` = 'other'\");\r\n otherArticles[3] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2013 where `label` = 'other'\");\r\n otherArticles[4] = query.retrieveInstances();\r\n\r\n Instances[] crimeArticles = new Instances[numberOfPapers];\r\n query.setQuery(\"SELECT content, label FROM article_ceylon_today_2013 where `label` = 'crime'\");\r\n crimeArticles[0] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2012 where `label` ='crime'\");\r\n crimeArticles[1] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2013 where `label` ='crime'\");\r\n crimeArticles[2] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2012 where `label` = 'crime'\");\r\n crimeArticles[3] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2013 where `label` = 'crime'\");\r\n crimeArticles[4] = query.retrieveInstances();\r\n\r\n FastVector attributeList = new FastVector(2);\r\n Attribute a1 = new Attribute(\"text\", (FastVector) null);\r\n FastVector classVal = new FastVector();\r\n classVal.addElement(\"crime\");\r\n classVal.addElement(\"other\");\r\n Attribute c = new Attribute(\"@@class@@\", classVal);\r\n //add class attribute and news text\r\n attributeList.addElement(a1);\r\n attributeList.addElement(c);\r\n Instances trainingData = new Instances(\"TrainingNews\", attributeList, 0);\r\n trainingData.setClassIndex(1);\r\n\r\n //up sampling using SMOTE\r\n int crimeArticlesCount = 0;\r\n for (int i = 0; i < numberOfPapers; i++) {\r\n for (int j = 0; j < crimeArticles[i].numInstances(); j++) {\r\n\r\n Instance inst = new Instance(trainingData.numAttributes());\r\n inst.setValue(a1, crimeArticles[i].instance(j).stringValue(0));\r\n inst.setValue(c, crimeArticles[i].instance(j).stringValue(1));\r\n inst.setDataset(trainingData);\r\n\r\n\r\n System.out.println(inst);\r\n trainingData.add(inst);\r\n crimeArticlesCount++;\r\n// if (crimeArticlesCount == 50) {\r\n// break;\r\n// }\r\n }\r\n// if (crimeArticlesCount == 50) {\r\n// break;\r\n// }\r\n }\r\n\r\n System.out.println(\"Total Number of Crime Instances: \" + crimeArticlesCount);\r\n\r\n //downsampling using ?? \r\n int otherArticlesCount = 0;\r\n for (int i = 0; i < numberOfPapers; i++) {\r\n for (int j = 0; j < otherArticles[i].numInstances(); j++) {\r\n Instance inst = new Instance(trainingData.numAttributes());\r\n inst.setValue(a1, otherArticles[i].instance(j).stringValue(0));\r\n inst.setValue(c, otherArticles[i].instance(j).stringValue(1));\r\n inst.setDataset(trainingData);\r\n System.out.println(inst);\r\n trainingData.add(inst);\r\n otherArticlesCount++;\r\n\r\n if (otherArticlesCount == 4872) {\r\n break;\r\n }\r\n }\r\n if (otherArticlesCount == 4872) {\r\n break;\r\n }\r\n }\r\n System.out.println(\"Total Number of Other Instances: \" + otherArticlesCount);\r\n System.out.println(\"Total num of instances= \" + trainingData.numInstances());\r\n\r\n // apply the StringToWordVector filter\r\n filter.setInputFormat(trainingData);\r\n Instances dataFiltered = Filter.useFilter(trainingData, filter);\r\n System.out.println(\"Number of Attributes after stop words removal- \" + dataFiltered.numAttributes());\r\n System.out.println(\"\\n\\nFiltered data:\\n\\n\" + dataFiltered);\r\n\r\n /**\r\n * Resamples a dataset by applying the Synthetic Minority Oversampling\r\n * TEchnique (SMOTE)\r\n * http://www.cs.cmu.edu/afs/cs/project/jair/pub/volume16/chawla02a-html/node6.html\r\n * http://weka.sourceforge.net/doc.packages/SMOTE/weka/filters/supervised/instance/SMOTE.html \r\n *\r\n */\r\n SMOTE s = new SMOTE();\r\n s.setInputFormat(dataFiltered);\r\n // Specifies percentage of SMOTE instances to create.\r\n s.setPercentage(300.0);//464\r\n Instances dataBalanced = Filter.useFilter(dataFiltered, s);\r\n\r\n Random r = new Random();\r\n dataBalanced.randomize(r);\r\n\r\n ArffSaver saver = new ArffSaver();\r\n saver.setInstances(dataBalanced);\r\n saver.setFile(new File(\"C:\\\\Users\\\\hp\\\\Desktop\\\\SVM implementation\\\\arffData\\\\balancedTrainingDataHybridRandom.arff\"));\r\n saver.writeBatch();\r\n }", "public void initialize(String name, Element element) throws Exception {\r\n\t\tsuper.initialize(name, element);\r\n\t\t\r\n\t\tif (log.isDebugEnabled()) {\r\n\t\t\tlog.debug(\"Initialising SVM classifier\");\r\n\t\t}\r\n\t\t\r\n\t\tNodeList elements = element.getElementsByTagName(\"vocabulary\");\r\n\t\tif (elements.getLength() != 1) {\r\n\t\t\tthrow new Exception(\"Found invalid vocabulary elements for concept: \" + name);\r\n\t\t}\r\n\t\tvocabulary = ((Element) elements.item(0)).getTextContent();\r\n\t\t\r\n\t\tif (log.isDebugEnabled()) {\r\n\t\t\tlog.debug(\"Found vocabulary: \" + vocabulary);\r\n\t\t}\r\n\t\t\r\n\t\telements = element.getElementsByTagName(\"include\");\r\n\t\tint docId = 0;\r\n\t\tfor(int i = 0; i < elements.getLength(); i++) {\r\n\t\t\tElement e = (Element) elements.item(i);\r\n\t\t\tConcept c = getConcept(e.getTextContent(), \"class\");\r\n\t\t\tc.setId(String.valueOf(docId++));\r\n\t\t\tuniverse.add(c);\r\n\t\t}\r\n\t\telements = element.getElementsByTagName(\"exclude\");\r\n\t\tfor(int i = 0; i < elements.getLength(); i++) {\r\n\t\t\tElement e = (Element) elements.item(i);\r\n\t\t\tConcept c = getConcept(e.getTextContent(), \"other\");\r\n\t\t\tc.setId(String.valueOf(docId++));\r\n\t\t\tuniverse.add(c);\r\n\t\t}\r\n\t\t\r\n\t\tString label = \"class\";\r\n\t\t/* Use null as value for the VectorSpace parameter forcing a new\r\n\t\t * VectorSpace instance to be created. Subsequently new Vectors are\r\n\t\t * added to the space. Note that each Modeller can be associated with\r\n\t\t * a single Concept. If more than one concept needs to be identified,\r\n\t\t * use a Modeller instance for each concept (label) and share\r\n\t\t * the space between them. */\r\n\t\tsvm = new Modeller(new GaussianKernel(5), label, new VectorSpace());\r\n\t\t// create a vector for each document in the universe\r\n\t\tfor(Iterator<String> i = universe.getCategorySet().iterator(); i.hasNext(); ) {\r\n\t\t\tString documentId = i.next();\r\n\t\t\tint n = 0;\r\n\t\t\tdouble[] x = new double[universe.getTermCount()];\r\n\t\t\tfor(String j : universe.getTerms())\r\n\t\t\t\tx[n++] = universe.getConceptTermFrequency(j, documentId);\r\n\t\t\t// normalise support vectors\r\n\t\t\tXY sv = new XY(x, universe.getConcept(documentId).getLabel(), true);\r\n\t\t\tsvm.addVector(sv);\r\n\t\t}\r\n\t\tif (log.isDebugEnabled()) {\r\n\t\t\tlog.debug(\"Starting training...\");\r\n\t\t}\r\n\t\tsvm.train();\r\n\t\tif (log.isDebugEnabled()) {\r\n\t\t\tlog.debug(\"Done training...\");\r\n\t\t}\r\n\t}", "private void initialize() {\n\t\tfor(String key: count_e_f.keySet()){\n\t\t\tcount_e_f.put(key, 0.0);\n\t\t}\n\t\t\n\t\tfor(Integer key: total_f.keySet()){\n\t\t\ttotal_f.put(key, 0.0);\n\t\t}\n\t\t\n\t\t//This code is not efficient.\n//\t\tfor(Entry<String, Integer> german : mainIBM.gerWordsIdx.entrySet()){\n//\t\t\tfor(Entry<String, Integer> english : mainIBM.engWordsIdx.entrySet()){\n//\t\t\t\tcount_e_f.put(english.getValue() + \"-\" + german.getValue(), 0.0);\n//\t\t\t}\n//\t\t\ttotal_f.put(german.getValue(), 0.0);\n//\t\t}\t\n\n\t}", "private void setupKeywordHashTable() {\n \tthis.keywordHashTable = new Hashtable<>();\n\n this.keywordHashTable.put(\"begin\", \"BeginKwTK\");\n this.keywordHashTable.put(\"end\", \"EndKwTK\");\n this.keywordHashTable.put(\"loop\", \"LoopKwTK\");\n this.keywordHashTable.put(\"void\", \"VoidKwTK\");\n this.keywordHashTable.put(\"var\", \"VarKwTK\");\n this.keywordHashTable.put(\"return\", \"ReturnKwTK\");\n this.keywordHashTable.put(\"in\", \"InKwTK\");\n this.keywordHashTable.put(\"out\", \"OutKwTK\");\n this.keywordHashTable.put(\"program\", \"ProgramKwTK\");\n this.keywordHashTable.put(\"iffy\", \"IffyKwTK\");\n this.keywordHashTable.put(\"then\", \"ThenKwTK\");\n this.keywordHashTable.put(\"let\", \"LetKwTK\");\n this.keywordHashTable.put(\"data\", \"DataKwTK\");\n }", "private void buildLanguageModel() {\n int total = 0;\n Map<Integer, Integer> wordCount = new HashMap<>();\n for (List<Integer> story : corpus.getStories()) {\n for (Integer word : story) {\n total++;\n if (wordCount.get(word) == null) wordCount.put(word, 0);\n wordCount.put(word, wordCount.get(word) + 1);\n }\n }\n wordValues = new HashMap<>();\n for (Map.Entry<Integer, Integer> entry : wordCount.entrySet()) {\n wordValues.put(entry.getKey(), total * 1.0 / entry.getValue());\n }\n }", "public void initialize(Vector<String> Records) {\n\t\tHashSet<String> hSet = new HashSet<String>();\n\t\tfor (String s : Records) {\n\t\t\tRuler r = new Ruler();\n\t\t\tr.setNewInput(s);\n\t\t\tfor (TNode t : r.vec) {\n\t\t\t\tif (!hSet.contains(t.text)) {\n\t\t\t\t\thSet.add(t.text);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvocabs = hSet.toArray(new String[hSet.size()]);\n\t}", "public LittleSearchEngine() {\n keywordsIndex = new HashMap<String, ArrayList<Occurrence>>(1000, 2.0f);\n noiseWords = new HashMap<String, String>(100, 2.0f);\n }", "public boolean buildVocab() {\n readStopWords();\n\n if(cache.vocabExists()) {\n log.info(\"Loading vocab...\");\n cache.loadVocab();\n cache.resetWeights();\n return true;\n }\n\n //vectorizer will handle setting up vocab meta data\n if(vectorizer == null)\n vectorizer = new TfidfVectorizer.Builder()\n .cache(cache).iterate(docIter).iterate(sentenceIter)\n .minWords(minWordFrequency).stopWords(stopWords)\n .tokenize(tokenizerFactory).build();\n vectorizer.fit();\n\n setup();\n\n return false;\n }", "private static HashMap<String, Integer> generateWordIndex()\n\t{\n\t\tHashMap<String, Integer> wordIndex = new HashMap<String, Integer>();\n\t\tint currIndex = 0;\n\t\tStringBuffer combinedHeaders;\n\t\tfor (MP mp : Capone.getInstance().getParliament().getMPList())\n\t\t{\n\t\t\tfor (Speech sp : mp.returnSpeeches())\n\t\t\t{\n\t\t\t\tcombinedHeaders = new StringBuffer();\n\t\t\t\tcombinedHeaders.append(sp.getHeader1());\n\t\t\t\tcombinedHeaders.append(sp.getHeader2());\n\t\t\t\tfor (String str : combinedHeaders.toString().split(\" \"))\n\t\t\t\t{\n\t\t\t\t\tif (!wordIndex.containsKey(str))\n\t\t\t\t\t{\n\t\t\t\t\t\twordIndex.put(str, currIndex);\n\t\t\t\t\t\tcurrIndex++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn wordIndex;\n\t}", "public HashMap<String, ArrayList<Counter<String>> > makeVectors(HashMap<String, ArrayList< List<String> > > hm) { \n HashMap<String, ArrayList<Counter<String>> > retHM = new HashMap<String, ArrayList<Counter<String>> >();\n for(String ID : hm.keySet() ){\n ArrayList<Counter<String>> tempVectList=new ArrayList<Counter<String>>();\n for(List<String> sentence : hm.get(ID) ){//loop through the list of sentences for that specific ID \n Counter<String> tempVect = new Counter<String>(); \n for(String word : sentence){//loop through the sentence\n tempVect.incrementCount(word,1.0);\n }\n tempVectList.add(tempVect);\n } \n retHM.put(ID,tempVectList);\n }\n return retHM;\n }", "public WordGenerator()\n {\n adjective1a = new ArrayList<String>();\n adjective1b = new ArrayList<String>();\n adjective1c = new ArrayList<String>();\n adjective2a = new ArrayList<String>();\n adjective2b = new ArrayList<String>();\n adjective2c = new ArrayList<String>();\n fillAdjectives();\n noun = \"\";\n adj1 = \"\";\n adj2 = \"\";\n }", "public void createHashTable() {\n\n String[] tempArray = new String[words.size()];\n\n for (int i = 0; i < words.size(); i++) {\n char[] word = words.get(i).toCharArray(); // char[] snarf\n Arrays.sort(word); // char[] afnrs\n tempArray[i] = toString(word); // String afnrs\n }\n\n for (int i = 0; i < words.size(); i++) {\n String word = tempArray[i];\n hashTable.put(word.substring(0, 4), i); // plocka bort bokstav nr 5\n String subString4 = (word.substring(0, 3) + word.substring(4, 5)); // plocka bort bokstav nr 4\n hashTable.put(subString4, i);\n String subString3 = (word.substring(0, 2) + word.substring(3, 5)); // plocka bort bokstav nr 3\n hashTable.put(subString3, i);\n String subString2 = (word.substring(0, 1) + word.substring(2, 5)); // plocka bort bokstav nr 2\n hashTable.put(subString2, i);\n hashTable.put(word.substring(1, 5), i); // plocka bort bokstav nr 1\n }\n }", "void init_embedding() {\n\n\t\tg_heir = new int[50]; // handles up to 8^50 points\n\t\tg_levels = 0; // stores the point-counts at the associated levels\n\n\t\t// reset the embedding\n\n\t\tint N = m_gm.getNodeCount();\n\t\tif (areUsingSubset) {\n\t\t\tN = included_points.size();\n\t\t}\n\t\t\n\t\tm_embed = new float[N*g_embedding_dims];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = 0; j < g_embedding_dims; j++) {\n\t\t\t\tm_embed[i * (g_embedding_dims) + j] = ((float) (myRandom\n\t\t\t\t\t\t.nextInt(10000)) / 10000.f) - 0.5f;\n\t\t\t}\n\t\t}\n\n\t\t// calculate the heirarchy\n\t\tg_levels = fill_level_count(N, g_heir, 0);\n\t\tg_levels = 1;\n\t\t\n\t\t// generate vector data\n\n\t\tg_current_level = g_levels - 1;\n\t\tg_vel = new float[g_embedding_dims * N];\n\t\tg_force = new float[g_embedding_dims * N];\n\n\t\t// compute the index sets\n\n\t\tg_idx = new IndexType[N * (V_SET_SIZE + S_SET_SIZE)];\n\t\tfor (int i = 0; i < g_idx.length; i++) {\n\n\t\t\tg_idx[i] = new IndexType();\n\t\t}\n\n\t\tg_done = false; // controls the movement of points\n\t\tg_interpolating = false; // specifies if we are interpolating yet\n\n\t\tg_cur_iteration = 0; // total number of iterations\n\t\tg_stop_iteration = 0; // total number of iterations since changing\n\t\t\t\t\t\t\t\t// levels\n\t}", "public void fillVerbTbl(String sentenceID){\n\t\t// implement me!\n\t}", "void Create(){\n map = new TreeMap<>();\r\n\r\n // Now we split the words up using punction and spaces\r\n String wordArray[] = wordSource.split(\"[{ \\n\\r.,]}}?\");\r\n\r\n // Now we loop through the array\r\n for (String wordArray1 : wordArray) {\r\n String key = wordArray1.toLowerCase();\r\n // If this word is not present in the map then add it\r\n // and set the word count to 1\r\n if (key.length() > 0){\r\n if (!map.containsKey(map)){\r\n map.put(key, 1);\r\n }\r\n else {\r\n int wordCount = map.get(key);\r\n wordCount++;\r\n map.put(key, wordCount);\r\n }\r\n }\r\n } // end of for loop\r\n \r\n // Get all entries into a set\r\n // I think that before this we just have key-value pairs\r\n entrySet = map.entrySet();\r\n \r\n }", "public Vector mapDocument(BOW bow) {\n //logger.info(\"lsm.mapDocument\");\n SparseVector vector = new SparseVector();\n\n Iterator<String> it = bow.termSet().iterator();\n String term = null;\n int index = 0;\n //int tf = 0;\n float tfIdf;\n for (int i = 0; it.hasNext(); i++) {\n //logger.info(i + \" \" + t[i]);\n term = it.next();\n index = termIndex.get(term);\n\n if (index != -1) {\n //tf = bow.getFrequency(term);\n //tfIdf = (float) (log2(tf)) * Iidf[index];\n //tfIdf = (float) bow.augmentedFrequency(term) * Iidf[index];\n tfIdf = (float) bow.tf(term) * Iidf[index];\n //logger.info(term + \" ==> \" + index + \", tf.idf = \" + tf + \"(\" + (log2(tf)) + \") * \" + Iidf[index] + \" = \" + tfIdf);\n vector.add(index, tfIdf);\n\n }\n } // end for\n\n return vector;\n }", "public static void main(String[] args) {\n\t\tUtility.dirPath = \"C:\\\\Users\\\\imSlappy\\\\workspace\\\\FeelingAnalysis\\\\Documents\\\\2_group_eng\";\n\t\tString sub[] = {\"dup\",\"bug\"};\n\t\tUtility.classLabel = sub;\n\t\tUtility.numdoc = 350;\n\t\tSetClassPath.read_path(Utility.dirPath);\n\t\tUtility.language = \"en\";\n\t\t\n\t\tUtility.stopWordHSEN = Fileprocess.FileHashSet(\"data/stopwordAndSpc_eng.txt\");\n\t\tUtility.dicen = new _dictionary();\n\t\tUtility.dicen.getDictionary(\"data/dicEngScore.txt\");\n\t\t\n\t\tUtility.vocabHM = new HashMap();\n\t\t// ================= completed initial main Program ==========================\n\n\t\tMainExampleNaive ob = new MainExampleNaive();\n\t\t\n\t\t// --------------------- Pre-process -----------------------\n\t\tob.word_arr = new HashSet [Utility.listFile.length][];\n\t\tob.wordSet = new ArrayList<String>();\n\t\tfor (int i = 0; i < Utility.listFile.length; i++) {\n\t\t\tob.word_arr[i]=new HashSet[Utility.listFile[i].length];\n\t\t\tfor (int j = 0; j < Utility.listFile[i].length; j++) {\n\t\t\t\tStringBuffer strDoc = Fileprocess.readFile(Utility.listFile[i][j]);\n\t\t\t\tob.word_arr[i][j]=ob.docTokenization(new String(strDoc));\n\t\t\t}\n\t\t\tob.checkBound(3, 10000);\n\t\t}\n\t\t\n\t\tSystem.out.println(\"++ Total : \"+Utility.vocabHM.size()+\" words\");\n\t\tSystem.out.println(\"++ \"+Utility.vocabHM);\n\t\t\n\t\t// ---------------------- Selection ------------------------\n//\t\tInformationGain ig = new InformationGain(ob.word_arr.length*ob.word_arr[0].length , ob.wordSet,ob.word_arr);\n//\t\tArrayList<String> ban_word = ig.featureSelection(0.0); // selected out with IG = 0\n//\t\t//ob.banFeature(ban_word);\n//\t\tSystem.out.println(\"ban list[\"+ban_word.size()+\"] : \"+ban_word);\n//\t\t\n//\t\tSystem.out.println(\"-- After \"+Utility.vocabHM.size());\n//\t\tSystem.out.println(\"-- \"+Utility.vocabHM);\n\t\t\n\t\tob.setWordPosition();\n\t\t// ---------------------- Processing -----------------------\n\t\tNaiveBayes naive = new NaiveBayes();\n\t\tnaive.naiveTrain(true);\n\t\t\n\t\tint result = naive.naiveUsage(\"after cold reset of my pc (crash of xp) the favorites of firefox are destroyed and all settings are standard again! Where are firefox-favorites stored and the settings ? how to backup them rgularely? All other software on my pc still works properly ! even INternetExplorer\");\n\t\tSystem.out.println(\"\\nResult : \"+Utility.classLabel[result]);\n\t}", "public static void main(String[] args) throws FileNotFoundException, IOException {\n \n \n File textBank = new File(\"textbank/\");\n Hashtable<Integer,Integer> frequency;\n Hashtable<Integer, String> table;\n table = new Hashtable<>();\n frequency = new Hashtable<>();\n Scanner input = new Scanner(new File(\"stoplist.txt\"));\n int max=0;\n while (input.hasNext()) {\n String next;\n next = input.next();\n if(next.length()>max)\n max=next.length();\n table.put(next.hashCode(), next); //to set up the hashmap with the wordsd\n \n }\n \n System.out.println(max);\n \n Pattern p0=Pattern.compile(\"[\\\\,\\\\=\\\\{\\\\}\\\\\\\\\\\\\\\"\\\\_\\\\+\\\\*\\\\#\\\\<\\\\>\\\\!\\\\`\\\\-\\\\?\\\\'\\\\:\\\\;\\\\~\\\\^\\\\&\\\\%\\\\$\\\\(\\\\)\\\\]\\\\[]\") \n ,p1=Pattern.compile(\"[\\\\.\\\\,\\\\@\\\\d]+(?=(?:\\\\s+|$))\");\n \n \n \n wor = new ConcurrentSkipListMap<>();\n \n ConcurrentMap<String , Map<String,Integer>> wordToDoc = new ConcurrentMap<String, Map<String, Integer>>() {\n @Override\n public Map<String, Integer> putIfAbsent(String key, Map<String, Integer> value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean remove(Object key, Object value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean replace(String key, Map<String, Integer> oldValue, Map<String, Integer> newValue) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Map<String, Integer> replace(String key, Map<String, Integer> value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public int size() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean isEmpty() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean containsKey(Object key) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean containsValue(Object value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Map<String, Integer> get(Object key) {\n return wor.get((String)key);//To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Map<String, Integer> put(String key, Map<String, Integer> value) {\n wor.put(key, value); // this saving me n \n //if(frequency.get(key.hashCode())== null)\n \n //frequency.put(key.hashCode(), )\n return null;\n }\n\n @Override\n public Map<String, Integer> remove(Object key) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public void putAll(Map<? extends String, ? extends Map<String, Integer>> m) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public void clear() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Set<String> keySet() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Collection<Map<String, Integer>> values() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Set<Map.Entry<String, Map<String, Integer>>> entrySet() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n };\n totalFiles = textBank.listFiles().length;\n for (File textFile : textBank.listFiles()) {\n totalReadFiles++;\n //checking whether file has txt extension and file size is higher than 0\n if(textFile.getName().contains(\".txt\") && textFile.length() > 0){\n docName.add(textFile.getName().replace(\".txt\", \".stp\"));\n StopListHandler sp = new StopListHandler(textFile, table,System.currentTimeMillis(),p0,p1,wordToDoc);\n sp.setFinished(() -> {\n \n tmp++;\n \n if(tmp==counter)\n //printTable(counter);\n \n if(totalReadFiles == totalFiles)\n {\n printTable(counter);\n }\n \n });\n \n sp.start();\n counter ++;}\n \n \n }\n System.out.println(counter);\n //while(true){if(tmp==counter-1) break;}\n System.out.println(\"s\");\n \n }", "@Override\r\n // WEI XU METHOD 2\r\n \r\n public void train(String sourceText) {\r\n String[] words1 = sourceText.split(\"[\\\\s]+\");\r\n // add starter to be a next word for the last word in the source text.\r\n List<String> words = new ArrayList<String>(Arrays.asList(words1));\r\n words.add(words1[0]);\r\n starter = words1[0];\r\n String prevWord = starter;\r\n for (int i = 1; i < words.size(); i++) {\r\n ListNode node = findNode(prevWord);//todo:it's a reference? but not a new Listnode? so no need set back?\r\n if (node == null) {\r\n node = new ListNode(prevWord);\r\n wordList.add(node);\r\n }\r\n node.addNextWord(words.get(i));//todo: why hashmap need set back value, linkedlist don't need?\r\n prevWord = words.get(i);\r\n }\r\n }", "private void createFreqVector(Path file) {\r\n\t\t\tVector vector = new Vector(vocabulary.size());\r\n\t\t\tList<String> lines;\r\n\t\t\ttry {\r\n\t\t\t\tlines = Files.readAllLines(file);\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tSet<String> words = new HashSet<>();\r\n\t\t\t//create frequency vector of words in single document -> tf(w,d)\r\n\t\t\tfor (String line : lines) {\r\n\t\t\t\tif (line.isEmpty()) continue;\r\n\t\t\t\tString[] values = p.split(line);\r\n\t\t\t\tfor (String value : values) { \r\n\t\t\t\t\tif (value.isEmpty()) continue;\r\n\t\t\t\t\tString lowWord = value.toLowerCase().trim();\r\n\t\t\t\t\t\r\n\t\t\t\t\tInteger[] arr = vocabulary.get(lowWord);\r\n\t\t\t\t\tif (arr == null) continue;\r\n\t\t\t\t\tvector.incrementValueAt(arr[0]);\r\n\t\t\t\t\tif (words.add(lowWord)) {\r\n\t\t\t\t\t\t arr[1] += 1;\t//first time occurrence of this word in document\r\n\t\t\t\t\t\tvocabulary.put(lowWord, arr);\t//increment number of documents for this word\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfreqVectors.put(file, vector);\t\t\r\n\t\t}", "private void populateDictionaryByLemmatizer() throws IOException {\n\n Enumeration e = dictionaryTerms.keys();\n while (e.hasMoreElements()) {\n String word = (String) e.nextElement();\n String tag = dictionaryTerms.get(word);\n\n if (!(word.contains(\" \")||word.contains(\"+\") ||word.contains(\"\\\"\") ||word.contains(\"'\")||word.contains(\".\") ||word.contains(\":\") || word.contains(\"(\") || word.contains(\")\") ||word.contains(\"-\")|| word.contains(\";\"))) {\n String tokenizedWords[] = tokenize(word);\n\n if (tokenizedWords.length == 1) {\n List<String> stemmings = stanfordLemmatizer.lemmatize(word);\n\n for (int i = 0; i < stemmings.size(); i++) {\n if (!dictionaryTerms.containsKey(stemmings.get(i))) {\n dictionaryTerms.put(stemmings.get(i), tag);\n System.out.println(\"Stemming: \" + word + \"\\t\" + stemmings.get(i));\n }\n }\n }\n }\n }\n }", "public void buildWordFileMap(){\n hashWords.clear();\n DirectoryResource dr = new DirectoryResource();\n for (File f : dr.selectedFiles()){ //for all the files selected make the hashWords hashmap\n addWordsFromFile(f);\n }\n \n }", "public static void testDictionary() throws IOException {\n String wnhome=\"c:\\\\Users\\\\Katherine\\\\Documents\\\\2nd sem\\\\IR\\\\project\\\\WordNet_3.1\";\n String path = wnhome + File.separator + \"dict\";\n\n\n URL url = new URL(\"file\", null, path);\n\n IDictionary dictionary = new Dictionary(url);\n dictionary.open();\n // /Users/Ward/Downloads\n IIndexWord indexWord = dictionary.getIndexWord(\"use\", POS.VERB);\n\n for (IWordID wordID : indexWord.getWordIDs()) {\n\n IWord word = dictionary.getWord(wordID);\n for (IWord word1 : word.getSynset().getWords()) {\n System.out.println(word1.getLemma());\n }\n// System.out.println(\"Id = \" + wordID);\n// System.out.println(\" Lemma = \" + word.getLemma());\n// System.out.println(\" Gloss = \" + word.getSynset().getGloss());\n\n List<ISynsetID> hypernyms =\n word.getSynset().getRelatedSynsets(Pointer.HYPERNYM);\n // print out each h y p e r n y m s id and synonyms\n List<IWord> words;\n for (ISynsetID sid : hypernyms) {\n words = dictionary.getSynset(sid).getWords();\n System.out.print(sid + \" {\");\n for (Iterator<IWord> i = words.iterator(); i.hasNext(); ) {\n System.out.print(i.next().getLemma());\n if (i.hasNext())\n System.out.print(\", \");\n }\n System.out.println(\"}\");\n }\n }\n }", "protected void setup(Context context) {\n\t\twordId = 0;\n\t}", "public CaseInsensitiveDictionary() {\n words = new HashSet<>();\n }", "public void sortAndReduceVocab (Vocabulary v, int min_count) {\n\t\tint hash;\n\t\tv.vocab = v.vocab.stream().sorted((e1, e2) -> (int) (e2.cn - e1.cn)).collect(Collectors.toList());\n\t\tint size = v.vocabSize;\n\t\tv.wordCount = 0;\n\t\tfor (int index = 0; index < size; index++) {\n\t\t\tif (v.vocab.get(index).cn < min_count) {\n\t\t\t\tv.vocab = v.vocab.subList(0, index);\n\t\t\t\tv.vocabSize = v.vocab.size();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// initialize hash table\n\t\tfor (int a = 0; a < vocabHashSize; a++) {\n\t\t\tv.vocabHash[a] = -1;\n\t\t}\n\t\t// Hash will be recomputed, as after the sorting it is not actual\n\t\tfor (int a = 0; a < v.vocabSize; a++) {\n\t\t\thash = getWordHash(v.vocab.get(a).word);\n\t\t\twhile (v.vocabHash[hash] != -1) hash = (hash + 1) % vocabHashSize;\n\t\t\tv.vocabHash[hash] = a;\n\t\t\tv.wordCount = v.wordCount + v.vocab.get(a).cn;\n\t\t}\n\t}", "public void random_initialize_ss()\r\n\t{\r\n//\t\tMersenneTwister mt = new MersenneTwister(10); //set seed\r\n\t\tRandom rand = new Random(); \r\n\t\tint k, n;\r\n\t\tfor (k = 0; k < num_topics; k++)\r\n\t {\r\n\t for (n = 0; n < num_terms; n++)\r\n\t {\r\n\t class_word[k][n] += 1.0/num_terms + rand.nextDouble();\r\n\t class_total[k] += class_word[k][n];\r\n\t }\r\n\t }\r\n\t}", "public static void selectFeature() throws IOException {\n\t\tString trainPath = \"./corpus/trainData\";\n\t\tString stopPath = \"./corpus/english.stop\";\n\t\tString outPath = \"./corpus/features\";\n\t\tFileWriter fw = new FileWriter(outPath);\n\t\tFileReader fr = new FileReader(trainPath);\n\t\tFileReader fr2 = new FileReader(stopPath);\n\t\tBufferedWriter bw = new BufferedWriter(fw);\n\t\tBufferedReader br = new BufferedReader(fr);\n\t\tBufferedReader br2 = new BufferedReader(fr2);\n\t\tString oneline;\n\n\t\tArrayList<String> as = new ArrayList<String>();\n\t\twhile ((oneline = br2.readLine()) != null) {\n\t\t\tas.add(oneline);\n\t\t}\n\t\tString[] stopWords = new String[as.size()];\n\t\tas.toArray(stopWords);\n\n\t\tHashtable<String, Integer> hs = new Hashtable<String, Integer>();\n\n\t\tAnalyzer analyzer = new SnowballAnalyzer(\"English\", stopWords);\n\n\t\ttry {\n\t\t\twhile ((oneline = br.readLine()) != null) {\n\t\t\t\tint pos = oneline.indexOf(\"\\t\");\n\t\t\t\tString topic = oneline.substring(0, pos);\n\t\t\t\tString content = oneline.substring(pos + 1);\n\t\t\t\t// StringTokenizer st=new StringTokenizer(content,\" \");\n\n\t\t\t\tTokenStream stream = analyzer.tokenStream(\"contents\",\n\t\t\t\t\t\tnew StringReader(content));\n\n\t\t\t\twhile (true) {\n\t\t\t\t\tToken token = stream.next();\n\t\t\t\t\tif (token == null)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tString tmp = token.termText();\n\t\t\t\t\tif (!hs.containsKey(tmp)) {\n\t\t\t\t\t\ths.put(tmp, new Integer(1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tInteger num = hs.get(tmp);\n\t\t\t\t\t\ths.put(tmp, num + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tList<Map.Entry> list = new ArrayList<Map.Entry>(hs.entrySet());\n\t\tCollections.sort(list, new Comparator<Map.Entry>() {\n\t\t\tpublic int compare(Map.Entry e1, Map.Entry e2) {\n\t\t\t\tInteger i1 = (Integer) e1.getValue();\n\t\t\t\tInteger i2 = (Integer) e2.getValue();\n\t\t\t\treturn i2.compareTo(i1);\n\t\t\t}\n\t\t});\n\t\tint count = 0;\n\t\tSystem.out.println(\"word - freq\");\n\t\tSystem.out.println(\"-------------\");\n\t\tfor (Map.Entry e : list) {\n\t\t\tInteger num = (Integer) e.getValue();\n\t\t\tString term = (String) e.getKey();\n\t\t\tif (count++ < 2000) {\n\t\t\t\tbw.write(term);\n\t\t\t\tbw.newLine();\n\t\t\t}\n\n\t\t}\n\n\t\tbw.close();\n\n\t\tSystem.out.println(hs.keySet().size());\n\t\tSystem.out.println(count);\n\n\t}", "protected void setup(Context context) throws IOException,InterruptedException{\n try {\n BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(\"/home/u2/hadoop_installs/hadoop-2.7.4/TrainingData_word_GR_sort/TrainingData_word_GR_sort.txt\")), \"UTF-8\"));\n String lineTxt = null;\n int get_line=0;\n while (((lineTxt = br.readLine()) != null)&&(get_line<1000)) {\n \t\n \tString[] getword = lineTxt.toString().split(\"\\t\");\n \ttop_ig_words[get_line] = new String(getword[1]);\n \tget_line++;\n }\n br.close();\n } catch (Exception e) {\n System.err.println(\"read errors :\" + e);\n }\n }", "WordList(){\r\n\t\tm_words = new HashMap();\r\n\t}", "public LittleSearchEngine() {\n\t\tkeywordsIndex = new HashMap<String,ArrayList<Occurrence>>(1000,2.0f);\n\t\tnoiseWords = new HashSet<String>(100,2.0f);\n\t}", "public LittleSearchEngine() {\n\t\tkeywordsIndex = new HashMap<String,ArrayList<Occurrence>>(1000,2.0f);\n\t\tnoiseWords = new HashSet<String>(100,2.0f);\n\t}", "public void saveTrainingDataToFileUpSampling() throws Exception {\r\n //set tokenizer - we can specify n-grams for classification\r\n NGramTokenizer tokenizer = new NGramTokenizer();\r\n tokenizer.setNGramMinSize(1);\r\n tokenizer.setNGramMaxSize(1);\r\n tokenizer.setDelimiters(\"\\\\W\");\r\n\r\n //set stemmer - set english stemmer\r\n SnowballStemmer stemmer = new SnowballStemmer();\r\n stemmer.setStemmer(\"english\");\r\n\r\n //set lemmatizer\r\n StanfordCoreNLPLemmatizer scnlpl = new StanfordCoreNLPLemmatizer();\r\n\r\n //create new filter for vector transformation\r\n StringToWordVector filter = new StringToWordVector();\r\n filter.setLowerCaseTokens(true);\r\n filter.setOutputWordCounts(true);\r\n filter.setTFTransform(true);\r\n filter.setIDFTransform(true);\r\n filter.setStopwords(new File(\"C:\\\\Users\\\\hp\\\\Desktop\\\\SVM implementation\\\\StopWordsR2.txt\")); // stop word removal given in research paper\r\n filter.setTokenizer(tokenizer);\r\n filter.setStemmer(scnlpl);\r\n\r\n System.out.println(\"Stemmer Name- \" + filter.getStemmer());\r\n\r\n InstanceQuery query = new InstanceQuery();\r\n query.setUsername(\"root\");\r\n query.setPassword(\"\");\r\n\r\n int numberOfPapers = 5;\r\n\r\n Instances[] otherArticles = new Instances[numberOfPapers];\r\n query.setQuery(\"SELECT content, label FROM article_ceylon_today_2013 where `label` = 'other'\");\r\n otherArticles[0] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2012 where `label` ='other'\");\r\n otherArticles[1] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2013 where `label` ='other'\");\r\n otherArticles[2] = query.retrieveInstances();\r\n\r\n //SELECT content, label FROM article_the_island_2012 where `label` IS NOT NULL\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2012 where `label` = 'other'\");\r\n otherArticles[3] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2013 where `label` = 'other'\");\r\n otherArticles[4] = query.retrieveInstances();\r\n\r\n Instances[] crimeArticles = new Instances[numberOfPapers];\r\n query.setQuery(\"SELECT content, label FROM article_ceylon_today_2013 where `label` = 'crime'\");\r\n crimeArticles[0] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2012 where `label` ='crime'\");\r\n crimeArticles[1] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_daily_mirror_2013 where `label` ='crime'\");\r\n crimeArticles[2] = query.retrieveInstances();\r\n\r\n //SELECT content, label FROM article_the_island_2012 where `label` IS NOT NULL\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2012 where `label` = 'crime'\");\r\n crimeArticles[3] = query.retrieveInstances();\r\n\r\n query.setQuery(\"SELECT content, label FROM article_the_island_2013 where `label` = 'crime'\");\r\n crimeArticles[4] = query.retrieveInstances();\r\n\r\n FastVector attributeList = new FastVector(2);\r\n Attribute a1 = new Attribute(\"text\", (FastVector) null);\r\n FastVector classVal = new FastVector();\r\n classVal.addElement(\"crime\");\r\n classVal.addElement(\"other\");\r\n Attribute c = new Attribute(\"@@class@@\", classVal);\r\n //add class attribute and news text\r\n attributeList.addElement(a1);\r\n attributeList.addElement(c);\r\n Instances trainingData = new Instances(\"TrainingNews\", attributeList, 0);\r\n trainingData.setClassIndex(1);\r\n\r\n int crimeArticlesCount = 0;\r\n for (int i = 0; i < numberOfPapers; i++) {\r\n for (int j = 0; j < crimeArticles[i].numInstances(); j++) {\r\n for (int k = 0; k < 5; k++) {\r\n Instance inst = new Instance(trainingData.numAttributes());\r\n inst.setValue(a1, crimeArticles[i].instance(j).stringValue(0));\r\n inst.setValue(c, crimeArticles[i].instance(j).stringValue(1));\r\n inst.setDataset(trainingData);\r\n\r\n\r\n System.out.println(inst);\r\n trainingData.add(inst);\r\n crimeArticlesCount++;\r\n }\r\n }\r\n }\r\n System.out.println(\"Total Number of Crime Instances: \" + crimeArticlesCount);\r\n\r\n int otherArticlesCount = 0;\r\n for (int i = 0; i < numberOfPapers; i++) {\r\n for (int j = 0; j < otherArticles[i].numInstances(); j++) {\r\n Instance inst = new Instance(trainingData.numAttributes());\r\n inst.setValue(a1, otherArticles[i].instance(j).stringValue(0));\r\n inst.setValue(c, otherArticles[i].instance(j).stringValue(1));\r\n inst.setDataset(trainingData);\r\n\r\n\r\n System.out.println(inst);\r\n trainingData.add(inst);\r\n otherArticlesCount++;\r\n\r\n if (otherArticlesCount == crimeArticlesCount) {\r\n break;\r\n }\r\n }\r\n if (otherArticlesCount == crimeArticlesCount) {\r\n break;\r\n }\r\n }\r\n System.out.println(\"Total Number of Other Instances: \" + otherArticlesCount);\r\n System.out.println(\"Total num of instances= \" + trainingData.numInstances());\r\n\r\n // apply the StringToWordVector filter\r\n filter.setInputFormat(trainingData);\r\n Instances dataFiltered = Filter.useFilter(trainingData, filter);\r\n System.out.println(\"Number of Attributes after stop words removal- \" + dataFiltered.numAttributes());\r\n System.out.println(\"\\n\\nFiltered data:\\n\\n\" + dataFiltered);\r\n\r\n Random r = new Random();\r\n dataFiltered.randomize(r);\r\n\r\n ArffSaver saver = new ArffSaver();\r\n saver.setInstances(dataFiltered);\r\n saver.setFile(new File(\"C:\\\\Users\\\\hp\\\\Desktop\\\\SVM implementation\\\\arffData\\\\balancedTrainingDataUSRandom.arff\"));\r\n saver.writeBatch();\r\n }", "private void createHashtable()\n {\n int numLanguages = languages.length;\n mapping = new Hashtable(numLanguages, 1.0f);\n for (int i = 0; i < numLanguages; i++)\n mapping.put(languages[i], values[i]);\n }", "public WordDictionary() {\n \n \n }", "public static void calcuTFIDF() throws IOException {\n\n\t\tHashtable<String, Double> idf = new Hashtable<String, Double>();\n\t\tArrayList<String> terms = new ArrayList<String>();\n\t\tdouble fileCount = 0.0;\n\t\tString featurePath = \"./corpus/features\";\n\t\tString featureWeight = \"./corpus/featureWeight\";\n\t\tString trainPath = \"./corpus/trainData\";\n\t\tString testPath = \"./corpus/testData\";\n\t\tString stopPath = \"./corpus/english.stop\";\n\t\tString trainOutPath = \"./corpus/trainVectors\";\n\t\tString testOutPath = \"./corpus/testVectors\";\n\t\tBufferedReader br = new BufferedReader(new FileReader(featurePath));\n\t\tBufferedWriter featureWriter = new BufferedWriter(new FileWriter(\n\t\t\t\tfeatureWeight));\n\t\tBufferedReader trainReader = new BufferedReader(new FileReader(\n\t\t\t\ttrainPath));\n\t\tBufferedReader testReader = new BufferedReader(new FileReader(testPath));\n\t\tBufferedReader br2 = new BufferedReader(new FileReader(stopPath));\n\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(trainOutPath));\n\t\tBufferedWriter testWriter = new BufferedWriter(new FileWriter(\n\t\t\t\ttestOutPath));\n\t\tString oneline;\n\t\tArrayList<String> as = new ArrayList<String>();\n\t\twhile ((oneline = br2.readLine()) != null) {\n\t\t\tas.add(oneline);\n\t\t}\n\t\tString[] stopWords = new String[as.size()];\n\t\tas.toArray(stopWords);\n\t\tAnalyzer analyzer = new SnowballAnalyzer(\"English\", stopWords);\n\n\t\twhile ((oneline = br.readLine()) != null) {\n\t\t\tidf.put(oneline, 0.0);\n\t\t\tterms.add(oneline);\n\t\t}\n\n\t\twhile ((oneline = trainReader.readLine()) != null) {\n\n\t\t\tint pos = oneline.indexOf(\"\\t\");\n\t\t\tString topic = oneline.substring(0, pos);\n\t\t\tString content = oneline.substring(pos + 1);\n\t\t\tfileCount++;\n\t\t\tHashtable<String, Integer> termList = new Hashtable<String, Integer>();\n\t\t\tTokenStream stream = analyzer.tokenStream(\"\", new StringReader(\n\t\t\t\t\tcontent));\n\t\t\twhile (true) {\n\t\t\t\tToken token = stream.next();\n\t\t\t\tif (token == null)\n\t\t\t\t\tbreak;\n\t\t\t\tString tmp = token.termText();\n\t\t\t\tif (!termList.containsKey(tmp))\n\t\t\t\t\ttermList.put(tmp, new Integer(1));\n\t\t\t}\n\t\t\tSet<String> keys = termList.keySet();\n\t\t\tfor (String tmp : keys) {\n\t\t\t\tif (idf.containsKey(tmp)) {\n\t\t\t\t\tDouble num = idf.get(tmp);\n\t\t\t\t\tidf.put(tmp, num + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (String term : terms) {\n\n\t\t\tdouble weightOfTerm = Math.log((double) fileCount / idf.get(term)\n\t\t\t\t\t+ 0.01);\n\t\t\tfeatureWriter.write(term + \" \" + weightOfTerm);\n\t\t\tfeatureWriter.newLine();\n\t\t\tidf.put(term, weightOfTerm);\n\n\t\t}\n\t\tfeatureWriter.flush();\n\t\tfeatureWriter.close();\n\n\t\ttrainReader = new BufferedReader(new FileReader(trainPath));\n\t\twhile ((oneline = trainReader.readLine()) != null) {\n\n\t\t\tint pos = oneline.indexOf(\"\\t\");\n\t\t\tString topic = oneline.substring(0, pos);\n\t\t\tString content = oneline.substring(pos + 1);\n\t\t\tHashtable<String, Integer> termFrequent = new Hashtable<String, Integer>();\n\t\t\tTokenStream stream = analyzer.tokenStream(\"\", new StringReader(\n\t\t\t\t\tcontent));\n\t\t\twhile (true) {\n\t\t\t\tToken token = stream.next();\n\t\t\t\tif (token == null)\n\t\t\t\t\tbreak;\n\t\t\t\tString tmp = token.termText();\n\t\t\t\tif (!termFrequent.containsKey(tmp))\n\t\t\t\t\ttermFrequent.put(tmp, new Integer(1));\n\t\t\t\telse {\n\t\t\t\t\tInteger num = termFrequent.get(tmp);\n\t\t\t\t\ttermFrequent.put(tmp, num + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble weights[] = new double[terms.size()];\n\t\t\tdouble denominator = 0.0;\n\t\t\tint i = 0;\n\t\t\tfor (String term : terms) {\n\t\t\t\tdouble count;\n\t\t\t\tif (termFrequent.containsKey(term)) {\n\t\t\t\t\tcount = termFrequent.get(term);\n\t\t\t\t} else {\n\t\t\t\t\tcount = 0;\n\t\t\t\t}\n\n\t\t\t\tdouble tmp = count * idf.get(term);\n\t\t\t\tdenominator += tmp;\n\t\t\t\tweights[i++] = tmp;\n\t\t\t}\n\t\t\tdenominator = Math.sqrt(denominator);\n\t\t\twriter.write(topic);\n\t\t\tfor (int j = 1; j <= weights.length; j++) {\n\t\t\t\tdouble tmp = weights[j - 1];\n\t\t\t\tif (tmp > 0.0) {\n\t\t\t\t\ttmp = Math.sqrt(tmp) / denominator;\n\t\t\t\t\twriter.write(\" \" + j + \":\" + tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t\twriter.newLine();\n\t\t}\n\n\t\twhile ((oneline = testReader.readLine()) != null) {\n\n\t\t\tint pos = oneline.indexOf(\"\\t\");\n\t\t\tString topic = oneline.substring(0, pos);\n\t\t\tString content = oneline.substring(pos + 1);\n\t\t\tHashtable<String, Integer> termFrequent = new Hashtable<String, Integer>();\n\t\t\tTokenStream stream = analyzer.tokenStream(\"\", new StringReader(\n\t\t\t\t\tcontent));\n\t\t\twhile (true) {\n\t\t\t\tToken token = stream.next();\n\t\t\t\tif (token == null)\n\t\t\t\t\tbreak;\n\t\t\t\tString tmp = token.termText();\n\t\t\t\tif (!termFrequent.containsKey(tmp))\n\t\t\t\t\ttermFrequent.put(tmp, new Integer(1));\n\t\t\t\telse {\n\t\t\t\t\tInteger num = termFrequent.get(tmp);\n\t\t\t\t\ttermFrequent.put(tmp, num + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble weights[] = new double[terms.size()];\n\t\t\tdouble denominator = 0.0;\n\t\t\tint i = 0;\n\t\t\tfor (String term : terms) {\n\t\t\t\tdouble count;\n\t\t\t\tif (termFrequent.containsKey(term)) {\n\t\t\t\t\tcount = termFrequent.get(term);\n\t\t\t\t} else {\n\t\t\t\t\tcount = 0;\n\t\t\t\t}\n\t\t\t\tdouble tmp = count * idf.get(term);\n\t\t\t\tdenominator += tmp;\n\t\t\t\tweights[i++] = tmp;\n\t\t\t}\n\t\t\tdenominator = Math.sqrt(denominator);\n\t\t\ttestWriter.write(topic);\n\t\t\tfor (int j = 1; j <= weights.length; j++) {\n\t\t\t\tdouble tmp = weights[j - 1];\n\t\t\t\tif (tmp > 0.0) {\n\t\t\t\t\ttmp = Math.sqrt(tmp) / denominator;\n\t\t\t\t\ttestWriter.write(\" \" + j + \":\" + tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttestWriter.newLine();\n\t\t}\n\t\twriter.close();\n\t\ttestWriter.close();\n\t}", "void createOrUpdateVocabulary(final VocabularyPE vocabularyPE);", "public Dictionary () {\n\t\tsuper();\n\t\t//words = new ArrayList < String > () ;\n\t}", "private void setVocabulary(int vocSize) {\n\t\tArrayList<String> chosen = new ArrayList<String>();\n\t\twhile (chosen.size() < vocSize) {\n\t\t\tint max = 0;\n\t\t\tString best = \"\";\n\t\t\tfor (String t : df.keySet()) {\n\t\t\t\tif (df.get(t) > max && !chosen.contains(t)) {\n\t\t\t\t\tmax = df.get(t);\n\t\t\t\t\tbest = t;\n\t\t\t\t}\n\t\t\t}\n\t\t\tchosen.add(best);\n\t\t}\n\t\tvocab = chosen;\n\t}", "public WordDictionary() {\n\n }", "public WordDictionary() {\n\n }", "public WordDictionary() {\n\n }", "public WordDictionary() {\n }", "private void populateDictionary() {\n Scanner scanner = null;\n try {\n scanner = new Scanner(new FileInputStream(filePath));\n while(scanner.hasNextLine()) {\n String word = scanner.nextLine();\n rwDictionary.put(reducedWord(word), word);\n lcDictionary.put(word.toLowerCase(), word);\n }\n } catch(IOException e) {\n System.err.println(e.toString());\n e.printStackTrace();\n } finally {\n if(scanner != null) {\n scanner.close();\n }\n }\n }", "private void initialiseWordsToSpell(){\n\t\t//normal quiz\n\t\tif(quiz_type==PanelID.Quiz){\n\t\t\twords_to_spell = parent_frame.getPreQuizHandler().getWordsForSpellingQuiz(parent_frame.getDataHandler().getNumWordsInQuiz(), PanelID.Quiz);\n\t\t} else { //review quiz\n\t\t\twords_to_spell = parent_frame.getPreQuizHandler().getWordsForSpellingQuiz(parent_frame.getDataHandler().getNumWordsInQuiz(), PanelID.Review);\n\t\t}\t\n\t}", "public static void buildTestData() throws IOException {\n\t\tString negativePath = \"./corpus/20ng-test-all-terms.txt\";\n\t\tString positivePath = \"./corpus/r8-test-all-terms.txt\";\n\t\tString fileout = \"./corpus/testData\";\n\t\tFileReader fr1 = new FileReader(negativePath);\n\t\tFileReader fr2 = new FileReader(positivePath);\n\t\tFileWriter fw = new FileWriter(fileout);\n\t\tBufferedReader br1 = new BufferedReader(fr1);\n\t\tBufferedReader br2 = new BufferedReader(fr2);\n\t\tBufferedWriter bw = new BufferedWriter(fw);\n\t\tHashtable<String, Integer> map = new Hashtable<String, Integer>();\n\t\tString readoneline;\n\t\twhile (((readoneline = br1.readLine()) != null)) {\n\t\t\tint pos = readoneline.indexOf(\"\\t\");\n\t\t\tString topic = readoneline.substring(0, pos);\n\t\t\tString content = readoneline.substring(pos + 1);\n\n\t\t\tif (!map.containsKey(topic)) {\n\t\t\t\tmap.put(topic, new Integer(1));\n\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbw.write(\"-1\\t\" + result.toString());\n\t\t\t\tbw.newLine();\n\t\t\t} else {\n\t\t\t\tInteger num = map.get(topic);\n\t\t\t\tif (num < 30) {\n\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbw.write(\"-1\\t\" + result.toString());\n\t\t\t\t\tbw.newLine();\n\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (((readoneline = br2.readLine()) != null)) {\n\t\t\tint pos = readoneline.indexOf(\"\\t\");\n\t\t\tString topic = readoneline.substring(0, pos);\n\t\t\tString content = readoneline.substring(pos + 1);\n\t\t\tif (topic.equals(\"acq\") || topic.equals(\"earn\")\n\t\t\t\t\t|| topic.equals(\"money-fx\") || topic.equals(\"trade\")\n\t\t\t\t\t|| topic.equals(\"interest\")) {\n\t\t\t\tif (!map.containsKey(topic)) {\n\t\t\t\t\tmap.put(topic, new Integer(1));\n\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\tbw.newLine();\n\t\t\t\t} else {\n\t\t\t\t\tInteger num = map.get(topic);\n\t\t\t\t\tif (topic.equals(\"acq\") && num < 200) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"earn\") && num < 350) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"money-fx\") && num < 80) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"trade\") && num < 80) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t} else if (topic.equals(\"interest\") && num < 50) {\n\t\t\t\t\t\tStringBuffer result = new StringBuffer();\n\t\t\t\t\t\tStringTokenizer st = new StringTokenizer(content, \" \");\n\t\t\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\t\t\tString tmp = st.nextToken();\n\t\t\t\t\t\t\tif (tmp.length() >= 3) {\n\t\t\t\t\t\t\t\tresult.append(tmp + \" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbw.write(\"1\\t\" + result.toString());\n\t\t\t\t\t\tbw.newLine();\n\t\t\t\t\t\tmap.put(topic, num + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbw.flush();\n\t\tbr1.close();\n\t\tbw.close();\n\t\tfw.close();\n\n\t}", "public WdVocabExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "public void trainModel(String input) {\n\n String[] words = input.split(\" \");\n String currentWord = \"\";\n\n for (int i = 0; i < words.length; i++) {\n\n if (i == 0 || words[i-1].contains(\".\")) {\n model.get(\"_begin\").add(words[i]);\n } else if (i == words.length - 1 || words[i].contains(\".\")) {\n model.get(\"_end\").add(words[i]);\n } else {\n model.putIfAbsent(currentWord, new ArrayList<String>());\n model.get(currentWord).add(words[i]);\n }\n\n currentWord = words[i];\n\n }\n }", "public void initState(KeyValueState<String, Long> state) {\n this.wordcount=state;\r\n\r\n }", "@Before\n public void setup() {\n kata4 = new SpinWords();\n }", "private void initMleCluster() {\n\t\tpseudoTf = new double[documents.size()][];\n\t\tpseudoTermIndex = new int[documents.size()][];\n\t\tpseudoTermWeight = new double[documents.size()][];\n\t\t\n\t\tfor(int docIdx=0; docIdx<documents.size(); docIdx++) {\n\t\t\tcountOnePseudoDoc(docIdx);\n\t\t}\n\t}", "private void populateDictionaryBySynonyms() {\n\n Enumeration e = dictionaryTerms.keys();\n while (e.hasMoreElements()) {\n String word = (String) e.nextElement();\n String tag = dictionaryTerms.get(word);\n\n ArrayList<String> synonyms = PyDictionary.findSynonyms(word);\n\n for (int i = 0; i < synonyms.size(); i++) {\n if (!dictionaryTerms.containsKey(synonyms.get(i))) {\n dictionaryTerms.put(synonyms.get(i), tag);\n }\n }\n }\n }", "public EfficientWordMarkov(int order)\n\t{\n\t\tsuper(order);\n\t\tmyMap = new HashMap<WordGram , ArrayList<String>>();\n\t}", "@Test\n public void tweakingEnglishStopwordsAndStemming() throws IOException {\n\n LanguageComponents english = LanguageComponents.load(\"English\");\n\n // Pass-through of all suppliers to English defaults.\n LinkedHashMap<Class<?>, Supplier<?>> componentSuppliers = new LinkedHashMap<>();\n for (Class<?> clazz : english.components()) {\n componentSuppliers.put(clazz, () -> english.get(clazz));\n }\n\n // Now override the suppliers of Stemmer and LexicalData interfaces. These suppliers should be\n // thread-safe, but the instances of corresponding components will not be reused across threads.\n\n // Override the Stemmer supplier.\n componentSuppliers.put(\n Stemmer.class,\n (Supplier<Stemmer>) () -> (word) -> word.toString().toLowerCase(Locale.ROOT));\n\n // Override the default lexical data.\n LexicalData lexicalData =\n new LexicalData() {\n Set<String> ignored = new HashSet<>(Arrays.asList(\"from\", \"what\"));\n\n @Override\n public boolean ignoreLabel(CharSequence labelCandidate) {\n // Ignore any label that has a substring 'data' in it; example.\n return labelCandidate.toString().toLowerCase(Locale.ROOT).contains(\"data\");\n }\n\n @Override\n public boolean ignoreWord(CharSequence word) {\n return word.length() <= 3 || ignored.contains(word.toString());\n }\n };\n componentSuppliers.put(LexicalData.class, () -> lexicalData);\n\n // The custom set of language components can be reused for multiple clustering requests.\n LanguageComponents customLanguage =\n new LanguageComponents(\"English (customized)\", componentSuppliers);\n\n LingoClusteringAlgorithm algorithm = new LingoClusteringAlgorithm();\n algorithm.desiredClusterCount.set(10);\n List<Cluster<Document>> clusters =\n algorithm.cluster(ExamplesData.documentStream(), customLanguage);\n System.out.println(\"Clusters:\");\n ExamplesCommon.printClusters(clusters);\n }", "public void setKB(String sentences[], inferenceEngine inf)\n\t{\n\n\t\tfor(int i=0;i<sentences.length;i++)\n\t\t{\n\t\t\tsentence s = new sentence();\n//\t\t\tSystem.out.println(sentences[i]);\n\t\t\ts.formPredicate(sentences[i], i);\n\t\t\tinf.putIntoHashMap(inf.predicateIntMapOriginal, s, i);\n\t\t\tinf.knowledgeBase.sentenceslist.add(s);\n\t\t//\tSystem.out.println(\"This sentence has \"+ s.toString());\n\t\t}\t\n//\t\tSystem.out.println(\"My Hash Table\\n\"+inf.predicateIntMap);\n\t\t\n\t}", "private void initTables()\n {\n if ( vc == null )\n {\n // statics are not initialised yet\n vc = new char[ 64 ];\n cv = new int[ 256 ];\n // build translate valueToChar table only once.\n // 0..25 -> 'A'..'Z'\n for ( int i = 0; i <= 25; i++ )\n {\n vc[ i ] = ( char ) ( 'A' + i );\n }\n // 26..51 -> 'a'..'z'\n for ( int i = 0; i <= 25; i++ )\n {\n vc[ i + 26 ] = ( char ) ( 'a' + i );\n }\n // 52..61 -> '0'..'9'\n for ( int i = 0; i <= 9; i++ )\n {\n vc[ i + 52 ] = ( char ) ( '0' + i );\n }\n vc[ 62 ] = spec1;\n vc[ 63 ] = spec2;\n // build translate charToValue table only once.\n for ( int i = 0; i < 256; i++ )\n {\n cv[ i ] = IGNORE;// default is to ignore\n }\n for ( int i = 0; i < 64; i++ )\n {\n cv[ vc[ i ] ] = i;\n }\n cv[ spec3 ] = PAD;\n }\n valueToChar = vc;\n charToValue = cv;\n }", "public Stemmer ()\n {\n AllWords = new HashMap<String,String>();\n dictionary = Dictionary.getInstance();\n p = PointerUtils.getInstance();\n\n try\n {\n // JWNL.initialize(new FileInputStream(\"file_properties.xml\"));\n JWNLConnecter.initializeJWNL();\n dic = Dictionary.getInstance();\n morph = dic.getMorphologicalProcessor();\n // ((AbstractCachingDictionary)dic).\n //\tsetCacheCapacity (10000);\n IsInitialized = true;\n }\n catch (Exception e){\n System.err.println(e.getMessage());\n }\n /*catch ( FileNotFoundException e )\n {\n System.out.println ( \"Error initializing Stemmer: JWNLproperties.xml not found\" );\n }\n catch ( JWNLException e )\n {\n System.out.println ( \"Error initializing Stemmer: \"\n + e.toString() );\n }*/\n\n }", "public void fillNounTbl(String sentenceID){\n\t\t// implement me!\n\t}", "public WordDictionary()\n {\n root = new TrieNode1();\n\n }", "public WordDictionary() {\n root = new TrieNode('#');\n }", "public void translate() {\n\t\tif(!init)\r\n\t\t\treturn; \r\n\t\ttermPhraseTranslation.clear();\r\n\t\t// document threshold: number of terms / / 8\r\n//\t\tdocThreshold = (int) (wordKeyList.size() / computeAvgTermNum(documentTermRelation) / 8.0);\r\n\t\t//\t\tuseDocFrequency = true;\r\n\t\tint minFrequency=1;\r\n\t\temBkgCoefficient=0.5;\r\n\t\tprobThreshold=0.001;//\r\n\t\titerationNum = 20;\r\n\t\tArrayList<Token> tokenList;\r\n\t\tToken curToken;\r\n\t\tint j,k;\r\n\t\t//p(w|C)\r\n\r\n\t\tint[] termValues = termIndexList.values;\r\n\t\tboolean[] termActive = termIndexList.allocated;\r\n\t\ttotalCollectionCount = 0;\r\n\t\tfor(k=0;k<termActive.length;k++){\r\n\t\t\tif(!termActive[k])\r\n\t\t\t\tcontinue;\r\n\t\t\ttotalCollectionCount +=termValues[k];\r\n\t\t}\r\n\t\t\r\n\t\t// for each phrase\r\n\t\tint[] phraseFreqKeys = phraseFrequencyIndex.keys;\r\n\t\tint[] phraseFreqValues = phraseFrequencyIndex.values;\r\n\t\tboolean[] states = phraseFrequencyIndex.allocated;\r\n\t\tfor (int phraseEntry = 0;phraseEntry<states.length;phraseEntry++){\r\n\t\t\tif(!states[phraseEntry]){\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (phraseFreqValues[phraseEntry] < minFrequency)\r\n\t\t\t\tcontinue;\r\n\t\t\ttokenList=genSignatureTranslation(phraseFreqKeys[phraseEntry]); // i is phrase number\r\n\t\t\tfor (j = 0; j <tokenList.size(); j++) {\r\n\t\t\t\tcurToken=(Token)tokenList.get(j);\r\n\t\t\t\tif(termPhraseTranslation.containsKey(curToken.getIndex())){\r\n\t\t\t\t\tIntFloatOpenHashMap old = termPhraseTranslation.get(curToken.getIndex());\r\n\t\t\t\t\tif(old.containsKey(phraseFreqKeys[phraseEntry])){\r\n\t\t\t\t\t\tSystem.out.println(\"aha need correction\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\told.put(phraseFreqKeys[phraseEntry], (float) curToken.getWeight()); //phrase, weight\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tIntFloatOpenHashMap newPhrase = new IntFloatOpenHashMap();\r\n\t\t\t\t\tnewPhrase.put(phraseFreqKeys[phraseEntry], (float) curToken.getWeight());\r\n\t\t\t\t\ttermPhraseTranslation.put(curToken.getIndex(), newPhrase);\r\n\t\t\t\t}\r\n\t\t\t\t//\t\t\t\toutputTransMatrix.add(i,curToken.getIndex(),curToken.getWeight());\r\n\t\t\t\t//\t\t\t\toutputTransTMatrix.add(curToken.getIndex(), i, curToken.getWeight());\r\n\t\t\t\t//TODO termPhrase exists, create PhraseTerm\r\n\t\t\t}\r\n\t\t\ttokenList.clear();\r\n\t\t}\r\n\r\n\t}", "public WordDictionary() {\n\n }", "public TweetTagger() throws IOException {\n super();\n loadModel(MODEL_LOCATION);\n tfIdf = new HashMap<String, Map<String, Integer>>();\n documentFrequencyMap = new HashMap<String, Integer>();\n previousTopWords = new HashMap<String, List<Map<String, Double>>>();\n }", "public KeyWordList extractKeyWords(String input);", "@Override\n public List<Prediction> predictWord(final String string) {\n Trace.beginSection(\"predictWord\");\n\n Trace.beginSection(\"preprocessText\");\n Log.e(TAG, \"inut_string: \" + string);\n //TODO\n\n String[] input_words = string.split(\" \");\n data_len[0] = input_words.length;\n Log.e(TAG, \"data_len: \" + data_len[0]);\n //intValues = new int[input_words.length];\n if (input_words.length < input_max_Size) {\n for (int i = 0; i < input_words.length; ++i) {\n Log.e(TAG, \"input_word: \" + input_words[i]);\n if (word_to_id.containsKey(input_words[i])) intValues[i] = word_to_id.get(input_words[i]);\n else intValues[i] = 6; //rare words, <unk> in the vocab\n Log.e(TAG, \"input_id: \" + intValues[i]);\n }\n for (int i = input_words.length; i < input_max_Size; ++i) {\n intValues[i] = 0; //padding using <eos>\n Log.e(TAG, \"input_id: \" + intValues[i]);\n }\n }\n else {\n Log.e(TAG, \"input out of max Size allowed!\");\n return null;\n }\n Trace.endSection();\n // Copy the input data into TensorFlow.\n Trace.beginSection(\"fillNodeFloat\");\n // TODO\n inferenceInterface.fillNodeInt(inputName, new int[] {1, input_max_Size}, intValues);\n Log.e(TAG, \"fillNodeInt success!\");\n inferenceInterface.fillNodeInt(inputName2, new int[] {1}, data_len);\n Log.e(TAG, \"fillDATA_LEN success!\");\n Trace.endSection();\n\n // Run the inference call.\n Trace.beginSection(\"runInference\");\n inferenceInterface.runInference(outputNames);\n Log.e(TAG, \"runInference success!\");\n Trace.endSection();\n\n // Copy the output Tensor back into the output array.\n Trace.beginSection(\"readNodeFloat\");\n inferenceInterface.readNodeFloat(outputName, outputs);\n Log.e(TAG, \"readNodeFloat success!\");\n Trace.endSection();\n\n // Find the best predictions.\n PriorityQueue<Prediction> pq = new PriorityQueue<Prediction>(3,\n new Comparator<Prediction>() {\n @Override\n public int compare(Prediction lhs, Prediction rhs) {\n // Intentionally reversed to put high confidence at the head of the queue.\n return Float.compare(rhs.getConfidence(), lhs.getConfidence());\n }\n });\n for (int i = 0; i < outputs.length; ++i) { //don't show i = 0 <unk>; i = 1<eos>\n if (outputs[i] > THRESHOLD) {\n pq.add(new Prediction(\"\" + i, id_to_word.get(i), outputs[i]));\n }\n }\n final ArrayList<Prediction> predictions = new ArrayList<Prediction>();\n for (int i = 0; i < Math.min(pq.size(), MAX_RESULTS); ++i) {\n predictions.add(pq.poll());\n }\n for (int i = 0; i < predictions.size(); ++i) {\n Log.e(TAG, predictions.get(i).toString());\n }\n Trace.endSection(); // \"predict word\"\n return predictions;\n }", "public void analyzeDocument(String text) {\n\t\tString[] tokens = m_tokenizer.tokenize(text.toLowerCase());\n\t\tfor (int j = 0; j < tokens.length; j++)\n\t\t\ttokens[j] = SnowballStemmingDemo(NormalizationDemo(tokens[j]));\n\t\tHashMap<String, Integer> document_tf = new HashMap<String, Integer>();\n\t\tfor (String token : tokens) {\n\t\t\tif (!document_tf.containsKey(token))\n\t\t\t\tdocument_tf.put(token, 1);\n\t\t\telse\n\t\t\t\tdocument_tf.put(token, document_tf.get(token) + 1);\n\t\t\tif (!df.containsKey(token))\n\t\t\t\tdf.put(token, 1);\n\t\t\telse\n\t\t\t\tdf.put(token, df.get(token) + 1);\n\t\t}\n\t\ttf.add(document_tf);\n\t\t/*\n\t\t * for(String token : document_tf.keySet()) { if(!df.containsKey(token))\n\t\t * df.put(token, 1); else df.put(token, df.get(token) + 1); if(!) }\n\t\t */\n\t\tm_reviews.add(text);\n\t}", "public WordDictionary() {\n root=new TrieNode();\n }", "public Vector mapDocument(MultiSet<String> bow) {\n //logger.info(\"lsm.mapDocument\");\n SparseVector vector = new SparseVector();\n\n Iterator<String> it = bow.iterator();\n String term = null;\n int index = 0;\n int tf = 0;\n float tfIdf;\n for (int i = 0; it.hasNext(); i++) {\n //logger.info(i + \" \" + t[i]);\n term = it.next();\n index = termIndex.get(term);\n\n if (index != -1) {\n tf = bow.getFrequency(term);\n tfIdf = (float) (log2(tf)) * Iidf[index];\n\n //logger.info(term + \" ==> \" + index + \", tf.idf = \" + tf + \"(\" + (log2(tf)) + \") * \" + Iidf[index] + \" = \" + tfIdf);\n vector.add(index, tfIdf);\n\n }\n } // end for\n\n return vector;\n }", "public static void main(String[] args) throws Exception \n\t{\n\t\tList<String> stopWords = new ArrayList<String>();\n\t\tstopWords = stopWordsCreation();\n\n\n\t\t\n\t\tHashMap<Integer, String> hmap = new HashMap<Integer, String>();\t//Used in tittle, all terms are unique, and any dups become \" \"\n\t\n\t\t\n\t\tList<String> uniqueTerms = new ArrayList<String>();\n\t\tList<String> allTerms = new ArrayList<String>();\n\t\t\t\t\n\t\t\n\t\tHashMap<Integer, String> hmap2 = new HashMap<Integer, String>();\n\t\tHashMap<Integer, String> allValues = new HashMap<Integer, String>();\n\t\tHashMap<Integer, Double> docNorms = new HashMap<Integer, Double>();\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tMap<Integer, List<String>> postingsFileListAllWords = new HashMap<>();\t\t\n\t\tMap<Integer, List<String>> postingsFileList = new HashMap<>();\n\t\t\n\t\tMap<Integer, List<StringBuilder>> docAndTitles = new HashMap<>();\n\t\tMap<Integer, List<StringBuilder>> docAndAbstract = new HashMap<>();\n\t\tMap<Integer, List<StringBuilder>> docAndAuthors = new HashMap<>();\n\t\t\n\t\t\n\t\tMap<Integer, List<Double>> termWeights = new HashMap<>();\n\t\t\n\t\tList<Integer> docTermCountList = new ArrayList<Integer>();\n\t\t\n\t\tBufferedReader br = null;\n\t\tFileReader fr = null;\n\t\tString sCurrentLine;\n\n\t\tint documentCount = 0;\n\t\tint documentFound = 0;\n\t\tint articleNew = 0;\n\t\tint docTermCount = 0;\n\t\t\n\t\t\n\t\tboolean abstractReached = false;\n\n\t\ttry {\n\t\t\tfr = new FileReader(FILENAME);\n\t\t\tbr = new BufferedReader(fr);\n\n\t\t\t// Continues to get 1 line from document until it reaches the end of EVERY doc\n\t\t\twhile ((sCurrentLine = br.readLine()) != null) \n\t\t\t{\n\t\t\t\t// sCurrentLine now contains the 1 line from the document\n\n\t\t\t\t// Take line and split each word and place them into array\n\t\t\t\tString[] arr = sCurrentLine.split(\" \");\n\n\n\t\t\t\t//Go through the entire array\n\t\t\t\tfor (String ss : arr) \n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\t/*\n\t\t\t\t\t * This section takes the array and checks to see if it has reached a new\n\t\t\t\t\t * document or not. If the current line begins with an .I, then it knows that a\n\t\t\t\t\t * document has just started. If it incounters another .I, then it knows that a\n\t\t\t\t\t * new document has started.\n\t\t\t\t\t */\n\t\t\t\t\t//System.out.println(\"Before anything: \"+sCurrentLine);\n\t\t\t\t\tif (arr[0].equals(\".I\")) \n\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\tif (articleNew == 0) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tarticleNew = 1;\n\t\t\t\t\t\t\tdocumentFound = Integer.parseInt(arr[1]);\n\t\t\t\t\t\t} \n\t\t\t\t\t\telse if (articleNew == 1) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tarticleNew = 0;\n\t\t\t\t\t\t\tdocumentFound = Integer.parseInt(arr[1]);\n\t\t\t\t\t\t}\t\t\t\n\t\t\t\t\t\t//System.out.println(documentFound);\n\t\t\t\t\t\t//count++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t/* This section detects that after a document has entered,\n\t\t\t\t\t * it has to gather all the words contained in the title \n\t\t\t\t\t * section.\n\t\t\t\t\t */\n\t\t\t\t\tif (arr[0].equals(\".T\") ) \n\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t// Go to line UNDER .T since that is where tittle is located\n\t\t\t\t\t\t//sCurrentLine = br.readLine();\n\t\t\t\t\t\tdocAndTitles.put(documentFound, new ArrayList<StringBuilder>());\n\t\t\t\t\t\t//System.out.println(\"docAndTitles.get(documentCount+1): \" +docAndTitles.get(documentFound));\n\t\t\t\t\t\t//System.out.println(\"Docs and titles: \"+docAndTitles);\n\t\t\t\t\t\tStringBuilder title = new StringBuilder();\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile ( !(sCurrentLine = br.readLine()).matches(\".B|.A|.N|.X|.K|.C\") )\n\t\t\t\t\t\t{\t\t\t\t\n\t\t\t\t\t\t\t/* In this section, there are 2 lists being made. One list\n\t\t\t\t\t\t\t * is for all the unique words in every title in the document (hmap).\n\t\t\t\t\t\t\t * Hmap contains all unique words, and anytime a duplicate word is \n\t\t\t\t\t\t\t * found, it is replaced with an empty space in the map.\n\t\t\t\t\t\t\t * All Values \n\t\t\t\t\t\t\t * \n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//postingsFileList.put(documentFound - 1, new ArrayList<String>());\n\t\t\t\t\t\t\t//postingsFileList.get(documentFound - 1).add(term2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//System.out.println(\"current line: \"+sCurrentLine);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tString[] tittle = sCurrentLine.split(\" \");\n\t\t\t\t\t\t\tif (tittle[0].equals(\".W\") )\n\t\t\t\t\t\t\t{\t\t\n\t\t\t\t\t\t\t\tabstractReached = true;\n\t\t\t\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttitle.append(sCurrentLine);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (String tittleWords : tittle)\n\t\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\ttittleWords = tittleWords.toLowerCase();\n\t\t\t\t\t\t\t\ttittleWords = tittleWords.replaceAll(\"[-&^%'{}*|$+\\\\/\\\\?!<>=.,;_:()\\\\[\\\\]\\\"\\\\d]\", \"\");\n\t\t\t\t\t\t\t\ttittleWords = tittleWords.replaceAll(\"[-&^%'*{}|$+\\\\/\\\\?!<>=.,;_:()\\\\[\\\\]\\\"\\\\d]\", \"\");\n\t\t\t\t\t\t\t\ttittleWords = tittleWords.replaceAll(\"[-&^%'{}*|$+\\\\/\\\\?!<>=.,;_:()\\\\[\\\\]\\\"\\\\d]\", \"\");\n\t\t\t\t\t\t\t\t//System.out.println(tittleWords);\n\t\t\t\t\t\t\t\tif (hmap.containsValue(tittleWords)) \n\t\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\thmap.put(documentCount, \" \");\n\t\t\t\t\t\t\t\t\tallValues.put(documentCount, tittleWords);\n\t\t\t\t\t\t\t\t\tallTerms.add(tittleWords);\n\t\t\t\t\t\t\t\t\tdocumentCount++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tallTerms.add(tittleWords);\n\t\t\t\t\t\t\t\t\tallValues.put(documentCount, tittleWords);\n\t\t\t\t\t\t\t\t\thmap.put(documentCount, tittleWords);\n\t\t\t\t\t\t\t\t\tif (!(uniqueTerms.contains(tittleWords)))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif ((stopWordsSetting && !(stopWords.contains(tittleWords))))\n\t\t\t\t\t\t\t\t\t\t\tuniqueTerms.add(tittleWords);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tdocumentCount++;\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//docAndTitles.get(documentCount).add(\" \");\n\t\t\t\t\t\t\ttitle.append(\"\\n\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//System.out.println(\"Title: \"+title);\n\t\t\t\t\t\t//System.out.println(\"docAndTitles.get(documentCount+1): \" +docAndTitles.get(documentFound));\n\t\t\t\t\t\tdocAndTitles.get(documentFound).add(title);\n\t\t\t\t\t\t//System.out.println(\"Done!: \"+ docAndTitles);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif (arr[0].equals(\".A\") ) \n\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t// Go to line UNDER .T since that is where tittle is located\n\t\t\t\t\t\t//sCurrentLine = br.readLine();\n\t\t\t\t\t\tdocAndAuthors.put(documentFound, new ArrayList<StringBuilder>());\n\t\t\t\t\t\t//System.out.println(\"docAndTitles.get(documentCount+1): \" +docAndTitles.get(documentFound));\n\t\t\t\t\t\t//System.out.println(\"Docs and titles: \"+docAndTitles);\n\t\t\t\t\t\tStringBuilder author = new StringBuilder();\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile ( !(sCurrentLine = br.readLine()).matches(\".N|.X|.K|.C\") )\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/* In this section, there are 2 lists being made. One list\n\t\t\t\t\t\t\t * is for all the unique words in every title in the document (hmap).\n\t\t\t\t\t\t\t * Hmap contains all unique words, and anytime a duplicate word is \n\t\t\t\t\t\t\t * found, it is replaced with an empty space in the map.\n\t\t\t\t\t\t\t * All Values \n\t\t\t\t\t\t\t * \n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//postingsFileList.put(documentFound - 1, new ArrayList<String>());\n\t\t\t\t\t\t\t//postingsFileList.get(documentFound - 1).add(term2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//System.out.println(\"current line: \"+sCurrentLine);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tString[] tittle = sCurrentLine.split(\" \");\n\t\t\t\t\t\t\tif (tittle[0].equals(\".W\") )\n\t\t\t\t\t\t\t{\t\t\n\t\t\t\t\t\t\t\tabstractReached = true;\n\t\t\t\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tauthor.append(sCurrentLine);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//docAndTitles.get(documentCount).add(\" \");\n\t\t\t\t\t\t\tauthor.append(\"\\n\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//System.out.println(\"Title: \"+title);\n\t\t\t\t\t\t//System.out.println(\"docAndTitles.get(documentCount+1): \" +docAndTitles.get(documentFound));\n\t\t\t\t\t\tdocAndAuthors.get(documentFound).add(author);\n\t\t\t\t\t\t//System.out.println(\"Done!: \"+ docAndTitles);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t/* Since there may or may not be an asbtract after\n\t\t\t\t\t * the title, we need to check what the next section\n\t\t\t\t\t * is. We know that every doc has a publication date,\n\t\t\t\t\t * so it can end there, but if there is no abstract,\n\t\t\t\t\t * then it will keep scanning until it reaches the publication\n\t\t\t\t\t * date. If abstract is empty (in tests), it will also finish instantly\n\t\t\t\t\t * since it's blank and goes straight to .B (the publishing date).\n\t\t\t\t\t * Works EXACTLY like Title \t\t \n\t\t\t\t\t */\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif (abstractReached) \n\t\t\t\t\t{\t\n\t\t\t\t\t\t//System.out.println(\"\\n\");\n\t\t\t\t\t\t//System.out.println(\"REACHED ABSTRACT and current line is: \" +sCurrentLine);\n\t\t\t\t\t\tdocAndAbstract.put(documentFound, new ArrayList<StringBuilder>());\n\t\t\t\t\t\tStringBuilder totalAbstract = new StringBuilder();\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile ( !(sCurrentLine = br.readLine()).matches(\".T|.I|.A|.N|.X|.K|.C\") )\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\tString[] abstaract = sCurrentLine.split(\" \");\n\t\t\t\t\t\t\tif (abstaract[0].equals(\".B\") )\n\t\t\t\t\t\t\t{\t\t\t\n\t\t\t\t\t\t\t\tabstractReached = false;\n\t\t\t\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttotalAbstract.append(sCurrentLine);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tString[] misc = sCurrentLine.split(\" \");\n\t\t\t\t\t\t\tfor (String miscWords : misc) \n\t\t\t\t\t\t\t{\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmiscWords = miscWords.toLowerCase(); \n\t\t\t\t\t\t\t\tmiscWords = miscWords.replaceAll(\"[-&^%'*$+|{}?!\\\\/<\\\\>=.,;_:()\\\\[\\\\]\\\"\\\\d]\", \"\");\n\t\t\t\t\t\t\t\tmiscWords = miscWords.replaceAll(\"[-&^%'*$+|?{}!\\\\/<\\\\>=.,;_:()\\\\[\\\\]\\\"\\\\d]\", \"\");\t\t\n\t\t\t\t\t\t\t\tmiscWords = miscWords.replaceAll(\"[-&^%'*$+|{}?!\\\\/<\\\\>=.,;_:()\\\\[\\\\]\\\"\\\\d]\", \"\");\t\t\n\t\t\t\t\t\t\t\t//System.out.println(miscWords);\n\t\t\t\t\t\t\t\tif (hmap.containsValue(miscWords)) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\thmap.put(documentCount, \" \");\n\t\t\t\t\t\t\t\t\tallValues.put(documentCount, miscWords);\n\t\t\t\t\t\t\t\t\tallTerms.add(miscWords);\n\t\t\t\t\t\t\t\t\tdocumentCount++;\n\t\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tallTerms.add(miscWords);\n\t\t\t\t\t\t\t\t\thmap.put(documentCount, miscWords);\n\t\t\t\t\t\t\t\t\tallValues.put(documentCount, miscWords);\n\t\t\t\t\t\t\t\t\tif (!(uniqueTerms.contains(miscWords)))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif ((stopWordsSetting && !(stopWords.contains(miscWords))))\n\t\t\t\t\t\t\t\t\t\t\tuniqueTerms.add(miscWords);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tdocumentCount++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\ttotalAbstract.append(\"\\n\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocAndAbstract.get(documentFound).add(totalAbstract);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\t\n\t\t\t\t//Once article is found, we enter all of of it's title and abstract terms \n\t\t\t\tif (articleNew == 0) \n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tdocumentFound = documentFound - 1;\n\t\t\t\t\t//System.out.println(\"Words found in Doc: \" + documentFound);\n\t\t\t\t\t//System.out.println(\"Map is\" +allValues);\n\t\t\t\t\tSet set = hmap.entrySet();\n\t\t\t\t\tIterator iterator = set.iterator();\n\n\t\t\t\t\tSet set2 = allValues.entrySet();\n\t\t\t\t\tIterator iterator2 = set2.iterator();\n\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tpostingsFileList.put(documentFound - 1, new ArrayList<String>());\n\t\t\t\t\tpostingsFileListAllWords.put(documentFound - 1, new ArrayList<String>());\n\t\t\t\t\twhile (iterator.hasNext()) {\n\t\t\t\t\t\tMap.Entry mentry = (Map.Entry) iterator.next();\n\t\t\t\t\t\t// (\"key is: \"+ mentry.getKey() + \" & Value is: \" + mentry.getValue());\n\t\t\t\t\t\t// (\"Value is: \" + mentry.getValue());\n\t\t\t\t\t\t// );\n\t\t\t\t\t\tString term = mentry.getValue().toString();\n\t\t\t\t\t\t// //\"This is going to be put in doc3: \"+ (documentFound-1));\n\t\t\t\t\t\tpostingsFileList.get(documentFound - 1).add(term);\n\t\t\t\t\t\t// if ( !((mentry.getValue()).equals(\" \")) )\n\t\t\t\t\t\tdocTermCount++;\n\t\t\t\t\t}\n\t\t\t\t\t// \"BEFORE its put in, this is what it looks like\" + hmap);\n\t\t\t\t\thmap2.putAll(hmap);\n\t\t\t\t\thmap.clear();\n\t\t\t\t\tarticleNew = 1;\n\n\t\t\t\t\tdocTermCountList.add(docTermCount);\n\t\t\t\t\tdocTermCount = 0;\n\n\t\t\t\t\twhile (iterator2.hasNext()) {\n\t\t\t\t\t\tMap.Entry mentry2 = (Map.Entry) iterator2.next();\n\t\t\t\t\t\t// (\"key is: \"+ mentry.getKey() + \" & Value is: \" + mentry.getValue());\n\t\t\t\t\t\t// (\"Value2 is: \" + mentry2.getValue());\n\t\t\t\t\t\t// );\n\t\t\t\t\t\tString term = mentry2.getValue().toString();\n\t\t\t\t\t\t// //\"This is going to be put in doc3: \"+ (documentFound-1));\n\t\t\t\t\t\tpostingsFileListAllWords.get(documentFound - 1).add(term);\n\t\t\t\t\t\t// if ( !((mentry.getValue()).equals(\" \")) )\n\t\t\t\t\t\t// docTermCount++;\n\t\t\t\t\t}\n\n\t\t\t\t\tallValues.clear();\t\t\t\t\t\n\t\t\t\t\tdocumentFound = Integer.parseInt(arr[1]);\n\n\t\t\t\t\t// \"MEANWHILE THESE ARE ALL VALUES\" + postingsFileListAllWords);\n\n\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//System.out.println(\"Looking at final doc!\");\n\t\t\t//Final loop for last sets\n\t\t\tSet set = hmap.entrySet();\n\t\t\tIterator iterator = set.iterator();\n\n\t\t\tSet setA = allValues.entrySet();\n\t\t\tIterator iteratorA = setA.iterator();\n\t\t\tpostingsFileList.put(documentFound - 1, new ArrayList<String>());\n\t\t\tpostingsFileListAllWords.put(documentFound - 1, new ArrayList<String>());\n\t\t\twhile (iterator.hasNext()) {\n\t\t\t\tMap.Entry mentry = (Map.Entry) iterator.next();\n\t\t\t\t// (\"key is: \"+ mentry.getKey() + \" & Value is: \" + mentry.getValue());\n\t\t\t\t// (\"Value is: \" + mentry.getValue());\n\t\t\t\t// //);\n\t\t\t\t// if ( !((mentry.getValue()).equals(\" \")) )\n\t\t\t\tString term2 = mentry.getValue().toString();\n\t\t\t\tpostingsFileList.get(documentFound - 1).add(term2);\n\n\t\t\t\tdocTermCount++;\n\t\t\t}\n\t\t\t//System.out.println(\"Done looking at final doc!\");\n\t\t\t\n\t\t\t\n\t\t\t//System.out.println(\"Sorting time!\");\n\t\t\twhile (iteratorA.hasNext()) {\n\t\t\t\tMap.Entry mentry2 = (Map.Entry) iteratorA.next();\n\t\t\t\t// (\"key is: \"+ mentry.getKey() + \" & Value is: \" + mentry.getValue());\n\t\t\t\t// (\"Value2 is: \" + mentry2.getValue());\n\t\t\t\t// //);\n\t\t\t\tString term = mentry2.getValue().toString();\n\t\t\t\t// //\"This is going to be put in doc3: \"+ (documentFound-1));\n\t\t\t\tpostingsFileListAllWords.get(documentFound - 1).add(term);\n\t\t\t\t// if ( !((mentry.getValue()).equals(\" \")) )\n\t\t\t\t// docTermCount++;\n\t\t\t}\n\n\t\t\thmap2.putAll(hmap);\n\t\t\thmap.clear();\n\t\t\tdocTermCountList.add(docTermCount);\n\t\t\tdocTermCount = 0;\n\n\n\t\t\t\n\t\t\n\t\t\t// END OF LOOKING AT ALL DOCS\n\t\t\t\n\t\t\t//System.out.println(\"Docs and titles: \"+docAndTitles);\n\t\t\t\n\t\t\t//System.out.println(\"All terms\" +allTerms);\n\t\t\tString[] sortedArray = allTerms.toArray(new String[0]);\n\t\t\tString[] sortedArrayUnique = uniqueTerms.toArray(new String[0]);\n\t\t\t//System.out.println(Arrays.toString(sortedArray));\n\t\t\t\n\t\t\tArrays.sort(sortedArray);\n\t\t\tArrays.sort(sortedArrayUnique);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//Sortings \n\t\t\tSet set3 = hmap2.entrySet();\n\t\t\tIterator iterator3 = set3.iterator();\n\n\t\t\t// Sorting the map\n\t\t\t//System.out.println(\"Before sorting \" +hmap2);\t\t\t\n\t\t\tMap<Integer, String> map = sortByValues(hmap2);\n\t\t\t//System.out.println(\"after sorting \" +map);\n\t\t\t// //\"After Sorting:\");\n\t\t\tSet set2 = map.entrySet();\n\t\t\tIterator iterator2 = set2.iterator();\n\t\t\tint docCount = 1;\n\t\t\twhile (iterator2.hasNext()) {\n\t\t\t\tMap.Entry me2 = (Map.Entry) iterator2.next();\n\t\t\t\t// (me2.getKey() + \": \");\n\t\t\t\t// //me2.getValue());\n\t\t\t}\n\t\t\t\n\t\t\t//System.out.println(\"Done sorting!\");\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//System.out.println(\"Posting starts \");\n\t\t\t//\"THIS IS START OF DICTIONARTY\" \n\t\t\tBufferedWriter bw = null;\n\t\t\tFileWriter fw = null;\n\t\t\t\n\t\t\t\n\t\t\t//System.out.println(\"Start making an array thats big as every doc total \");\n\t\t\tfor (int z = 1; z < documentFound+1; z++)\n\t\t\t{\n\t\t\t\ttermWeights.put(z, new ArrayList<Double>());\n\t\t\t}\n\t\t\t//System.out.println(\"Done making that large array Doc \");\n\t\t\t\n\t\t\t//System.out.println(\"Current Weights: \"+termWeights);\n\t\t\t\n\t\t\t//System.out.println(\"All terms\" +allTerms)\n\t\t\t//System.out.println(Arrays.toString(sortedArray));\n\t\t\t//System.out.println(Arrays.toString(sortedArrayUnique));\n\t\t\t//System.out.println(uniqueTerms);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//\tSystem.out.println(\"Posting starts \");\n\t\t\t// \tPOSTING FILE STARTS \n\t\t\ttry {\n\t\t\t\t// Posting File\n\t\t\t\t//System.out.println(\"postingsFileListAllWords: \"+postingsFileListAllWords); //Contains every word including Dups, seperated per doc\n\t\t\t\t//System.out.println(\"postingsFileList: \"+postingsFileList); \t\t //Contains unique words, dups are \" \", seperated per doc\n\t\t\t\t//System.out.println(\"postingsFileListAllWords.size(): \" +postingsFileListAllWords.size()); //Total # of docs \n\t\t\t\t//System.out.println(\"Array size: \"+sortedArrayUnique.length);\n\n\t\t\t\tfw = new FileWriter(POSTING);\n\t\t\t\tbw = new BufferedWriter(fw);\n\t\t\t\tString temp = \" \";\n\t\t\t\tDouble termFreq = 0.0;\n\t\t\t\t// //postingsFileListAllWords);\n\t\t\t\tList<String> finalTermList = new ArrayList<String>();\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\t// //postingsFileList.get(i).size());\n\t\t\t\t\tfor (int j = 0; j < sortedArrayUnique.length; ++j)\t\t\t\t\t // go thru each word, CURRENT TERM\n\t\t\t\t\t{\n\t\t\t\t\t\t//System.out.println(\"Term is: \" + sortedArrayUnique[j]);\n\t\t\t\t\t\ttemp = sortedArrayUnique[j];\t\t\t\t\t\n\t\t\t\t\t\tif ((stopWordsSetting && stopWords.contains(temp))) \n\t\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!(finalTermList.contains(temp))) \n\t\t\t\t\t\t{\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//PART TO FIND DOCUMENT FREQ\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tint docCountIDF = 0;\n\t\t\t\t\t\t\t//Start here for dictionary \n\t\t\t\t\t\t\tfor (int totalWords = 0; totalWords < sortedArray.length; totalWords++) \t\t\n\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (temp.compareTo(\" \") == 0 || (stopWordsSetting && stopWords.contains(temp))) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t//EITHER BLANK OR STOPWORD \n\t\t\t\t\t\t\t\t\t//System.out.println(\"fOUND STOP WORD\");\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tString temp2 = sortedArray[totalWords];\n\t\t\t\t\t\t\t\t\t//System.out.println(\"Compare: \"+temp+ \" with \" +temp2);\n\t\t\t\t\t\t\t\t\tif (temp.compareTo(temp2) == 0) {\n\t\t\t\t\t\t\t\t\t\t// (temp2+\" \");\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tdocCountIDF++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//System.out.println(\"Total Number: \" +docCountIDF);\n\t\t\t\t\t\t\t//System.out.println(\"documentFound: \" +documentFound);\n\t\t\t\t\t\t\t//System.out.println(\"So its \" + documentFound + \" dividied by \" +docCountIDF);\n\t\t\t\t\t\t\t//docCountIDF = 1;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdouble idf = (Math.log10(((double)documentFound/(double)docCountIDF)));\n\t\t\t\t\t\t\t//System.out.println(\"Calculated IDF: \"+idf);\n\t\t\t\t\t\t\tif (idf < 0.0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tidf = 0.0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//System.out.println(\"IDF is: \" +idf);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//System.out.println(\"Size of doc words: \" + postingsFileListAllWords.size());\n\t\t\t\t\t\t\tfor (int k = 0; k < postingsFileListAllWords.size(); k++) \t\t//Go thru each doc. Since only looking at 1 term, it does it once per doc\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//System.out.println(\"Current Doc: \" +(k+1));\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\ttermFreq = 1 + (Math.log10(Collections.frequency(postingsFileListAllWords.get(k), temp)));\t\t\t\n\t\t\t\t\t\t\t\t\t//System.out.println(\"Freq is: \" +Collections.frequency(postingsFileListAllWords.get(k), temp));\n\t\t\t\t\t\t\t\t\t//System.out.println(termFreq + \": \" + termFreq.isInfinite());\n\t\t\t\t\t\t\t\t\tif (termFreq.isInfinite() || termFreq <= 0)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttermFreq = 0.0;\n\t\t\t\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\t\t\t\t\t//System.out.println(\"termFreq :\" +termFreq); \n\t\t\t\t\t\t\t\t\t//System.out.println(\"idf: \" +idf);\n\t\t\t\t\t\t\t\t\ttermWeights.get(k+1).add( (idf*termFreq) );\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//System.out.println(\"\");\n\t\t\t\t\t\t\tfinalTermList.add(temp);\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\t//System.out.println(\"Current Weights: \"+termWeights);\n\t\t\t\t\t\t\n\t\t\t\t\t\t//FINALCOUNTER\n\t\t\t\t\t\t//System.out.println(\"Done looking at word: \" +j);\n\t\t\t\t\t\t//System.out.println(\"\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"Current Weights: \"+termWeights);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\twhile (true)\n\t\t\t\t {\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\tSystem.out.println(\"Enter a query: \");\n\t\t\t\t\t\n\t \tScanner scanner = new Scanner(System.in);\n\t \tString enterQuery = scanner.nextLine();\n\t \t\n\t \t\n\t\t\t\t\tList<Double> queryWeights = new ArrayList<Double>();\n\t\t\t\t\t\n\t\t\t\t\t// Query turn\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tenterQuery = enterQuery.toLowerCase();\t\t\n\t\t\t\t\tenterQuery = enterQuery.replaceAll(\"[-&^%'*$+|{}?!\\\\/<\\\\>=.,;_:()\\\\[\\\\]\\\"]\", \"\");\n\t\t\t\t\t//System.out.println(\"Query is: \" + enterQuery);\n\t\t\t\t\t\n\t\t\t\t\tif (enterQuery.equals(\"exit\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tString[] queryArray = enterQuery.split(\" \");\n\t\t\t\t\tArrays.sort(queryArray);\n\t\t\t\t\t\n\t\t\t\t\t//Find the query weights for each term in vocab\n\t\t\t\t\tfor (int j = 0; j < sortedArrayUnique.length; ++j)\t\t\t\t\t // go thru each word, CURRENT TERM\n\t\t\t\t\t{\n\t\t\t\t\t\t//System.out.println(\"Term is: \" + sortedArrayUnique[j]);\n\t\t\t\t\t\ttemp = sortedArrayUnique[j];\t\t\t\t\t\n\t\t\t\t\t\tif ((stopWordsSetting && stopWords.contains(temp))) \n\t\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\tint docCountDF = 0;\n\t\t\t\t\t\t//Start here for dictionary \n\t\t\t\t\t\tfor (int totalWords = 0; totalWords < queryArray.length; totalWords++) \t\t\n\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (temp.compareTo(\" \") == 0 || (stopWordsSetting && stopWords.contains(temp))) \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//EITHER BLANK OR STOPWORD\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tString temp2 = queryArray[totalWords];\n\t\t\t\t\t\t\t\t//System.out.println(\"Compare: \"+temp+ \" with \" +temp2);\n\t\t\t\t\t\t\t\tif (temp.compareTo(temp2) == 0) {\n\t\t\t\t\t\t\t\t\t// (temp2+\" \");\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tdocCountDF++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tDouble queryWeight = 1 + (Math.log10(docCountDF));\n\t\t\t\t\t\tif (queryWeight.isInfinite())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tqueryWeight = 0.0;\n\t\t\t\t\t\t}\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tqueryWeights.add(queryWeight);\n\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"Query WEights is: \"+queryWeights);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// Finding the norms for DOCS\t\t\t\t\t\n\t\t\t\t\tfor (int norms = 1; norms < documentFound+1; norms++)\n\t\t\t\t\t{\n\t\t\t\t\t\tdouble currentTotal = 0.0;\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (int weightsPerDoc = 0; weightsPerDoc < termWeights.get(norms).size(); weightsPerDoc++)\n\t\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t\tdouble square = Math.pow(termWeights.get(norms).get(weightsPerDoc), 2);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//System.out.println(\"Current square: \" + termWeights.get(norms).get(weightsPerDoc));\n\t\t\t\t\t\t\tcurrentTotal = currentTotal + square;\n\t\t\t\t\t\t\t//System.out.println(\"Current total: \" + currentTotal);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//System.out.println(\"About to square root this: \" +currentTotal);\n\t\t\t\t\t\tdouble root = Math.sqrt(currentTotal);\n\t\t\t\t\t\tdocNorms.put(norms, root);\n\t\t\t\t\t}\n\t\t\t\t\t//System.out.println(\"All of the docs norms: \"+docNorms);\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t//Finding the norm for the query\n\t\t\t\t\tdouble currentTotal = 0.0;\t\t\t\t\t\n\t\t\t\t\tfor (int weightsPerDoc = 0; weightsPerDoc < queryWeights.size(); weightsPerDoc++)\n\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tdouble square = Math.pow(queryWeights.get(weightsPerDoc), 2);\n\t\t\t\t\t\tcurrentTotal = currentTotal + square;\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tdouble root = Math.sqrt(currentTotal);\n\t\t\t\t\tdouble queryNorm = root; \t\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"Query norm \" + queryNorm);\n\t\t\t\t\t\n\t\t\t\t\t//Finding the cosine sim\n\t\t\t\t\t//System.out.println(\"Term Weights \" + termWeights);\n\t\t\t\t\tHashMap<Integer, Double> cosineScore = new HashMap<Integer, Double>();\n\t\t\t\t\tfor (int cosineSim = 1; cosineSim < documentFound+1; cosineSim++)\n\t\t\t\t\t{\n\t\t\t\t\t\tdouble total = 0.0;\n\t\t\t\t\t\tfor (int docTerms = 0; docTerms < termWeights.get(cosineSim).size(); docTerms++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdouble docTermWeight = termWeights.get(cosineSim).get(docTerms);\n\t\t\t\t\t\t\tdouble queryTermWeight = queryWeights.get(docTerms);\n\t\t\t\t\t\t\t//System.out.println(\"queryTermWeight \" + queryTermWeight);\n\t\t\t\t\t\t\t//System.out.println(\"docTermWeight \" + docTermWeight);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttotal = total + (docTermWeight*queryTermWeight);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdouble cosineSimScore = 0.0;\n\t\t\t\t\t\tif (!(total == 0.0 || (docNorms.get(cosineSim) * queryNorm) == 0))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcosineSimScore = total / (docNorms.get(cosineSim) * queryNorm);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcosineSimScore = 0.0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tcosineScore.put(cosineSim, cosineSimScore);\n\t\t\t\t\t}\n\t\t\t\t\tcosineScore = sortByValues2(cosineScore);\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"This is the cosineScores: \" +cosineScore);\n\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"docAndTitles: \"+ docAndTitles);\n\t\t\t\t\tint topK = 0;\n\t\t\t\t\tint noValue = 0;\n\t\t\t\t\tfor (Integer name: cosineScore.keySet())\n\t\t\t\t\t{\n\t\t\t\t\t\tif (topK < 50)\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t\n\t\t\t\t String key =name.toString();\n\t\t\t\t //String value = cosineScore.get(name).toString(); \n\t\t\t\t if (!(cosineScore.get(name) <= 0))\n\t\t\t\t {\n\t\t\t\t \tSystem.out.println(\"Doc: \"+key);\t\t\t\t \t\t\t\t\t \t\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \tStringBuilder builder = new StringBuilder();\n\t\t\t\t \tfor (StringBuilder value : docAndTitles.get(name)) {\n\t\t\t\t \t builder.append(value);\n\t\t\t\t \t}\n\t\t\t\t \tString text = builder.toString();\t\t\t\t \t\n\t\t\t\t \t//System.out.println(\"Title:\\n\" +docAndTitles.get(name));\n\t\t\t\t \tSystem.out.println(\"Title: \" +text);\n\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \t//System.out.println(\"Authors:\\n\" +docAndAuthors.get(name));\n\t\t\t\t \t\n\t\t\t\t \tif (docAndAuthors.get(name) == null || docAndAuthors.get(name).toString().equals(\"\"))\n\t\t\t\t \t{\n\t\t\t\t \t\tSystem.out.println(\"Authors: N\\\\A\\n\");\n\t\t\t\t \t}\n\t\t\t\t \telse \n\t\t\t\t \t{\t\t\t\t \t\t\t\t\t\t \t\n\t\t\t\t\t \tStringBuilder builder2 = new StringBuilder();\n\t\t\t\t\t \tfor (StringBuilder value : docAndAuthors.get(name)) {\n\t\t\t\t\t \t builder2.append(value);\n\t\t\t\t\t \t}\n\t\t\t\t\t \tString text2 = builder2.toString();\t\t\t\t \t\n\t\t\t\t\t \t\n\t\t\t\t\t \tSystem.out.println(\"Authors found: \" +text2);\n\t\t\t\t \t}\t\n\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \t/* ABSTRACT \n\t\t\t\t \tif (docAndAbstract.get(name) == null)\n\t\t\t\t \t{\n\t\t\t\t \t\tSystem.out.println(\"Abstract: N\\\\A\\n\");\n\t\t\t\t \t}\n\t\t\t\t \telse \n\t\t\t\t \t{\t\t\t\t \t\t\t\t\t\t \t\n\t\t\t\t\t \tStringBuilder builder2 = new StringBuilder();\n\t\t\t\t\t \tfor (StringBuilder value : docAndAbstract.get(name)) {\n\t\t\t\t\t \t builder2.append(value);\n\t\t\t\t\t \t}\n\t\t\t\t\t \tString text2 = builder2.toString();\t\t\t\t \t\n\t\t\t\t\t \t\n\t\t\t\t\t \tSystem.out.println(\"Abstract: \" +text2);\n\t\t\t\t \t}\t\n\t\t\t\t \t*/\n\t\t\t\t \t\n\t\t\t\t \tSystem.out.println(\"\");\n\t\t\t\t }\n\t\t\t\t else {\n\t\t\t\t \tnoValue++;\n\t\t\t\t }\n\t\t\t\t topK++;\n\t\t\t\t \n\t\t\t\t\t\t}\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (noValue == documentFound)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSystem.out.println(\"No documents contain query!\");\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\t\t\t\t\ttopK=0;\n\t\t\t\t\tnoValue = 0;\n\t\t\t\t }\n\t\t\t\t\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (bw != null)\n\t\t\t\t\t\tbw.close();\n\n\t\t\t\t\tif (fw != null)\n\t\t\t\t\t\tfw.close();\n\n\t\t\t\t} catch (IOException ex) {\n\n\t\t\t\t\tex.printStackTrace();\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (br != null)\n\t\t\t\t\tbr.close();\n\n\t\t\t\tif (fr != null)\n\t\t\t\t\tfr.close();\n\n\t\t\t} catch (IOException ex) {\n\n\t\t\t\tex.printStackTrace();\n\n\t\t\t}\n\n\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\tint itemCount = uniqueTerms.size();\n\t\t\t//System.out.println(allValues);\n\t\t\tSystem.out.println(\"Total Terms BEFORE STEMING: \" +itemCount);\n\t\t\tSystem.out.println(\"Total Documents \" + documentFound);\n\t\t\t\t\t\t\n\t\t \n\t\t\t \n\t\t\t \n\t\t\t//END OF MAIN\n\t\t}", "public void addInstances (InstanceList training)\n\t{\n\t\tSystem.out.println(\"LabeledLDA Model : Adding training instances ..%\");\n\t\t//Data Alphabet\n\t\talphabet = training.getDataAlphabet();\n\t\tnumTypes = alphabet.size();\n\t\tbetaSum = beta * numTypes;\n\t\t\n\t\t// We have one topic for every possible label.\n\t\tlabelAlphabet = training.getTargetAlphabet();\n\t\tnumTopics = labelAlphabet.size();\n\t\toneDocTopicCounts = new int[numTopics];\n\t\ttokensPerTopic = new int[numTopics];\n\t\ttypeTopicCounts = new int[numTypes][numTopics];\n\n\t\t//topicAlphabet = AlphabetFactory.labelAlphabetOfSize(numTopics); //generate d0,d1 [3shan target string w hwa 3wzo label]\n topicAlphabet = new LabelAlphabet();\n\t\tfor (int i = 0; i < numTopics; i++) {\n\t\t\tString target = labelAlphabet.lookupObject(i).toString();\n topicAlphabet.lookupLabel(target);\n\t\t}\n //System.out.println(topicAlphabet);\n\n for (Instance instance : training)\n\t\t{\n\t\t\tFeatureSequence tokens = (FeatureSequence) instance.getData(); //read data featureSequence\n\t\t\tLabelSequence topicSequence = new LabelSequence(topicAlphabet, new int[ tokens.size() ]);\n FeatureVector labels = (FeatureVector) instance.getTarget(); //read target featurevector\n\n\t\t\tint[] topics = topicSequence.getFeatures();\n\t\t\tfor (int position = 0; position < tokens.size(); position++)\n\t\t\t{\n\t\t\t\tint topic = labels.indexAtLocation(random.nextInt(labels.numLocations()));\n\t\t\t\ttopics[position] = topic;\n\t\t\t\ttokensPerTopic[topic]++;\n\t\t\t\tint type = tokens.getIndexAtPosition(position);\n\t\t\t\ttypeTopicCounts[type][topic]++;\n\t\t\t}\n\t\t\tTopicAssignment t = new TopicAssignment(instance, topicSequence);\n\t\t\tdata.add(t);\n\t\t}\n\t\t/*\n for (Instance instance : training)\n {\n FeatureSequence tokens = (FeatureSequence) instance.getData();\n LabelSequence topicSequence = new LabelSequence(topicAlphabet, new int[ tokens.size() ]);\n\n int[] topics = topicSequence.getFeatures();\n for (int position = 0; position < topics.length; position++) {\n int topic = random.nextInt(numTopics);\n topics[position] = topic;\n }\n TopicAssignment t = new TopicAssignment(instance, topicSequence);\n data.add(t);\n }\n\n buildInitialTypeTopicCounts();\n initializeHistograms();\n\t\t */\n\t\tSystem.out.println(\"Data loaded.\");\n\t}", "public void testAddData() {\n Message m1 = new Message(\"test\",\"bla bla david\",_u1);\n Message.incId();\n Message m2 = new Message(\"test2\",\"bla2 bla2 david\",_u1);\n Message.incId();\n\n this.allMsgs.put(m1.getMsg_id(), m1);\n this.allMsgs.put(m2.getMsg_id(), m2);\n \n this.searchEngine.addData(m1);\n this.searchEngine.addData(m2);\n\n\n Long w1 = this.ind.getWordID(\"test\");\n\n Vector<Message> msgs1 =this.ind.getMsgsByWordID(w1);\n assertEquals(1, msgs1.size());\n assertTrue(msgs1.contains(m1));\n\n Long w2 = this.ind.getWordID(\"bla2\");\n Vector<Message> msgs2 =this.ind.getMsgsByWordID(w2);\n assertEquals(1, msgs2.size());\n assertTrue(msgs2.contains(m2));\n\n Long w3 = this.ind.getWordID(\"david\");\n Vector<Message> msgs3 =this.ind.getMsgsByWordID(w3);\n assertEquals(2, msgs3.size());\n assertTrue(msgs3.contains(m2));\n assertTrue(msgs3.contains(m1));\n\n Long w4 = this.ind.getWordID(\"nothing\");\n assertEquals(null,w4);\n \n }", "public void initModel(LDAModel model, Corpus corpus);", "public WordDictionary() {\n \troot=new TrieNode(); \n \n }", "private void setTrainingData() throws IOException {\r\n\t\ttrainIdBodyMap = readInIdBodiesMap(new File(TRAIN_BODIES_CSV_LOCATION));\r\n\t\ttrainStances = readStances(new File(TRAIN_STANCES_CSV_LOCATION));\r\n\r\n\t}", "public static void init() {\r\n\t\twines = read();\r\n\t\tread_tasteNotes(wines);\r\n\t\tidSorted = duplicate(wines);\r\n\t}", "public void initialize() throws ResourceInitializationException {\n\n\tsuper.initialize();\n\n mContext = getUimaContext();\n\n mLogger = mContext.getLogger();\n\n if (mLogger.isLoggable(Level.INFO)) {\n mLogger.log(Level.INFO, \"Initializing the OpenNLP Tokenizer trainer.\");\n }\n\n mModelName = CasConsumerUtil.getRequiredStringParameter(mContext,\n UimaUtil.MODEL_PARAMETER);\n\n language = CasConsumerUtil.getRequiredStringParameter(mContext,\n UimaUtil.LANGUAGE_PARAMETER);\n\n isSkipAlphaNumerics =\n CasConsumerUtil.getOptionalBooleanParameter(\n mContext, IS_ALPHA_NUMERIC_OPTIMIZATION);\n\n if (isSkipAlphaNumerics == null) {\n \tisSkipAlphaNumerics = false;\n }\n\n additionalTrainingDataFile = CasConsumerUtil.getOptionalStringParameter(\n getUimaContext(), UimaUtil.ADDITIONAL_TRAINING_DATA_FILE);\n\n // If the additional training data is specified, the encoding must be provided!\n if (additionalTrainingDataFile != null) {\n additionalTrainingDataEncoding = CasConsumerUtil.getRequiredStringParameter(\n getUimaContext(), UimaUtil.ADDITIONAL_TRAINING_DATA_ENCODING);\n }\n\n String sampleTraceFileName = CasConsumerUtil.getOptionalStringParameter(\n getUimaContext(), \"opennlp.uima.SampleTraceFile\");\n\n if (sampleTraceFileName != null) {\n sampleTraceFile = new File(getUimaContextAdmin().getResourceManager()\n .getDataPath() + File.separatorChar + sampleTraceFileName);\n sampleTraceFileEncoding = CasConsumerUtil.getRequiredStringParameter(\n getUimaContext(), \"opennlp.uima.SampleTraceFileEncoding\");\n }\n }", "public void preInitializeData() throws Exception {\r\n try {\r\n //Inserisce tutti i campi dinamici del vocabolario nella struttura dati vocabularies\r\n vocabularies = Vocabulary.getInstance().getVocabularies();\r\n\r\n //Inserisce tutti le lingue statiche nella struttura dati languages\r\n languages = Utility.getLanguages();\r\n }catch (Exception ex) {\r\n ResourceBundle ex_bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader);\r\n throw new Exception(Utility.getBundleString(\"error22\",ex_bundle) + \": \" + ex.getMessage());\r\n } \r\n }" ]
[ "0.6400461", "0.60260856", "0.5978915", "0.5938277", "0.58937657", "0.5872086", "0.58641595", "0.58203834", "0.5721043", "0.5713476", "0.5712003", "0.5707434", "0.57045126", "0.5697029", "0.5690978", "0.56895584", "0.56555504", "0.5610744", "0.56088173", "0.5608138", "0.5603365", "0.5534679", "0.55142546", "0.55007416", "0.54948884", "0.5489527", "0.54596233", "0.54570705", "0.5448098", "0.54033077", "0.5400173", "0.53922445", "0.5365323", "0.5348427", "0.5338702", "0.53259283", "0.5321635", "0.53168285", "0.5282198", "0.52738816", "0.52666014", "0.5259884", "0.5246504", "0.52444816", "0.5237974", "0.523607", "0.5223981", "0.5221063", "0.5215192", "0.5211343", "0.5207056", "0.5202093", "0.5200582", "0.5196693", "0.5185365", "0.5185365", "0.5173066", "0.5165196", "0.51592636", "0.5152464", "0.5145837", "0.5142398", "0.5142146", "0.5140856", "0.5140856", "0.5140856", "0.51398206", "0.5136398", "0.51322657", "0.51315194", "0.5125323", "0.5108881", "0.5106556", "0.5101761", "0.5099721", "0.50964904", "0.509639", "0.5081592", "0.50812525", "0.5072793", "0.50643295", "0.50575393", "0.50515884", "0.505118", "0.50487524", "0.50346607", "0.5030416", "0.5029102", "0.5020596", "0.5017259", "0.5014522", "0.5014166", "0.50072026", "0.5006778", "0.49995264", "0.49939656", "0.49928367", "0.49811137", "0.4980727", "0.49732637", "0.49716142" ]
0.0
-1
train_model is initialized to be zero
public void train(int n_epochs) { TrainModel train_model = null; int lenW = vocabulary.length; int W = 3 * lenW + 3; // randomly initialize U_Ot, values are randomly selected between -0.1 to 0.1; double[][] U_Ot = new double[D][W]; // randomly initialize U_R, values are randomly selected between -0.1 and 0.1 double[][] U_R = new double[D][W]; double prev_err = 0D; for (int epoch = 0; epoch < n_epochs; epoch++) { double total_error = 0D; int n_wrong = 0; for (int i = 0; i < train_lines.size(); i++) { Instance line = train_lines.get(i); if ("q".equals(line.type)) { // indicates question List<Integer> refs = line.refs; // Indexing from 1 List<Integer> f = refs.stream() .map(ref -> ref-1) .collect(Collectors.toList()); // Indexing from 0 int id = line.ID - 1; // Indexing from 0 // all indices from List<Integer> indices = range(i-id, i+1); List<double[]> memory_list = indices.stream() .map(idx -> L_train[idx]) .collect(Collectors.toList()); if (train_model == null) { train_model = new TrainModel(lenW, f.size()); } List<Integer> m = f; // TODO List<Integer> mm = new ArrayList<>(); //TODO for (int j = 0; j < f.size(); j++) { mm.add(O_t( newM, memory_list )); } double err = train_model(H.get("answer"), gamma, memory_list, V, id, ???)[0]; total_error += err; System.out.println("epoch: " + epoch + "\terr: " + (total_error / train_lines.size())); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void train() {\n actual = observations.toArray();\n min_val_error = Double.MAX_VALUE;\n if (findDecayConstant)\n for (float alpha = 0f; alpha <= 1f; alpha += 0.01f)\n initializeAndTrainModel(alpha);\n else\n initializeAndTrainModel(optAlpha);\n }", "public ME_Model() {\n _nheldout = 0;\n _early_stopping_n = 0;\n _ref_modelp = null;\n }", "private void initializeModel() {\n\t\t\n\t}", "public void startTrainingMode() {\n\t\t\r\n\t}", "@Override\n public void initialize() {\n drivetrain.resetEncoders();\n }", "private void initTensorFlowAndLoadModel() {\n executor.execute(new Runnable() {\n @Override\n public void run() {\n try {\n classifierObject = ObjectClassifier.create(context.getAssets(), TYPE_MODEL, LABEL_TYPE, INPUT_SIZE_TYPE);\n } catch (final Exception e) {\n throw new RuntimeException(\"Error initializing TensorFlow!\", e);\n }\n }\n });\n }", "protected void initialize() {\r\n x = 0;\r\n y = 0;\r\n driveTrain.reInit();\r\n }", "@Override\n\tpublic void trainLocal() throws Exception {\n\t\tdouble [][] input = parameters.getInput();\n\t\tdouble [][] result = ann.getResults(parameters);\n\t\tif (state == preTraining) {//in this case, it is running in the pre-training mode.\n\t\t\tinput = newInput;\n\t\t\tresult = newInput;\n\t\t}\n\t\terr = 0; \n\t\tfor (int i = 0; i < mb; i++) {\t\n\t\t\tif (pos > input.length - 1) {\n\t\t\t\tpos = 0;\n\t\t\t}\n\t\t\terr = err + ann.runEpoch(input[pos], pos, result[pos], parameters);\n\t\t\tpos++;\n\t\t}\n\t}", "public void train(SieveDocuments trainingInfo) {\r\n\t\t// no training\r\n\t}", "private void initTensorFlowAndLoadModel() {\n executor.execute(new Runnable() {\n @Override\n public void run() {\n try {\n classifier = TensorFlowImageClassifier.create(\n getAssets(),\n MODEL_PATH,\n LABEL_PATH,\n INPUT_SIZE,\n QUANT);\n } catch (final Exception e) {\n throw new RuntimeException(\"Error initializing TensorFlow!\", e);\n }\n }\n });\n }", "private void initTensorFlowAndLoadModel() {\n executor.execute(new Runnable() {\n @Override\n public void run() {\n try {\n classifier = TensorFlowImageClassifier.create(\n getAssets(),\n MODEL_FILE,\n LABEL_FILE,\n INPUT_SIZE,\n IMAGE_MEAN,\n IMAGE_STD,\n INPUT_NAME,\n OUTPUT_NAME);\n } catch (final Exception e) {\n throw new RuntimeException(\"Error initializing TensorFlow!\", e);\n }\n }\n });\n }", "private void init() throws IOException, ModelException{\r\n // Check if the input file should be convert to libSVM format\r\n if(this.reformatInputFile){\r\n reformatInputFile();\r\n this.inputFileName = this.inputFileName + \".svm\";\r\n }\r\n\r\n // Scale the training set\r\n if(this.scale){\r\n scale();\r\n }\r\n\r\n setProblem();\r\n checkParams();\r\n\r\n // Check if cross validation is needed\r\n if(this.crossValidation == 1){\r\n crossValidate();\r\n }\r\n // Goes to here only if you use SVMModel without project context\r\n else{\r\n train();\r\n }\r\n }", "public KNN() {\r\n\t\tallowRun = true;\r\n\t}", "@Override\n public void initialize() {\n drivetrain.enable();\n }", "private void initializeAndTrainModel(float alpha) {\n\n double forecast;\n double lastValue = actual[0];\n double[][] trainMatrix = new double[trainPoints][2];\n double[][] valMatrix = new double[validationPoints][2];\n\n for (int i = 1; i < trainPoints; i++) {\n forecast = lastValue;\n\n trainMatrix[i][0] = actual[i];\n trainMatrix[i][1] = forecast;\n lastValue = (alpha * actual[i]) + ((1 - alpha) * lastValue);\n }\n\n for (int t = 1; t <= validationPoints; t++) {\n valMatrix[t - 1][1] = lastValue;\n valMatrix[t - 1][0] = actual[trainPoints + t - 1];\n }\n\n\n double biasness = BiasnessHandler.handle(valMatrix);\n AccuracyIndicators AI = new AccuracyIndicators();\n ModelUtil.computeAccuracyIndicators(AI, trainMatrix, valMatrix, dof);\n AI.setBias(biasness);\n if (min_val_error >= AI.getMAPE()) {\n min_val_error = AI.getMAPE();\n optAlpha = alpha;\n accuracyIndicators = AI;\n }\n }", "@Test\n public void test00() throws Throwable {\n TestInstances testInstances0 = new TestInstances();\n Instances instances0 = testInstances0.generate((String) null);\n Evaluation evaluation0 = new Evaluation(instances0);\n evaluation0.addNumericTrainClass('u', 4.9E-324);\n assertEquals(0.0, evaluation0.SFEntropyGain(), 0.01D);\n }", "void setTrainData(DataModel trainData);", "@Test(timeout = 4000)\n public void test051() throws Throwable {\n TextDirectoryLoader textDirectoryLoader0 = new TextDirectoryLoader();\n Instances instances0 = textDirectoryLoader0.getDataSet();\n Evaluation evaluation0 = new Evaluation(instances0);\n evaluation0.addNumericTrainClass(0.0, Double.NaN);\n assertEquals(0.0, evaluation0.SFPriorEntropy(), 0.01);\n }", "public void initModel() {\n gunControl.initSmoke();\n }", "public void train(){\r\n\t\tdouble output = 0.0;\r\n\t\tList<Integer> teacher = null;\r\n\t\tdouble adjustedWeight = 0.0;\r\n\t\tdouble error = 0.0;\r\n\t\tdouble deltaK = 0.0;\r\n\r\n\t\tfor(int counter = 0; counter < maxEpoch; counter++){\r\n\t\t\tfor(Instance inst : trainingSet){\r\n\t\t\t\tcalculateOutputForInstance(inst);\r\n\t\t\t\tteacher = inst.classValues;\r\n\t\t\t\t//jk weight\r\n\t\t\t\tfor(int i = 0; i < outputNodes.size(); i++){\r\n\t\t\t\t\tNode kNode = outputNodes.get(i);\r\n\t\t\t\t\toutput = kNode.getOutput();\r\n\t\t\t\t\terror = teacher.get(i) - output;\r\n\t\t\t\t\tdeltaK = error*getReLU(kNode.getSum());\r\n\t\t\t\t\tfor(int j = 0; j < kNode.parents.size(); j++){\r\n\t\t\t\t\t\tNodeWeightPair jkWeight = kNode.parents.get(j);\r\n\t\t\t\t\t\tNode jNode = jkWeight.node;\r\n\t\t\t\t\t\tadjustedWeight = getJK(jNode, deltaK);\r\n\t\t\t\t\t\tjkWeight.weight += adjustedWeight;\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//ij weight\r\n\t\t\t\tfor(int i = 0; i < hiddenNodes.size(); i++){\r\n\t\t\t\t\tNode jNode = hiddenNodes.get(i);\r\n\t\t\t\t\tif(jNode.parents == null) continue;\r\n\t\t\t\t\tfor(int j = 0; j < jNode.parents.size(); j++){\r\n\t\t\t\t\t\tNodeWeightPair ijWeight = jNode.parents.get(j);\r\n\t\t\t\t\t\tNode iNode = ijWeight.node;\r\n\t\t\t\t\t\tadjustedWeight = getIJ(iNode, jNode, teacher, i);\r\n\t\t\t\t\t\tijWeight.weight += adjustedWeight;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Test\n public void addModelData() {\n new FactoryInitializer()\n .initialize(\n ((tr, ev, is, np, md) -> new ResNetConv2DFactory(tr,ev,is,np,md).addModelData(new ArrayList<>()))\n );\n }", "public static void main(String[] args) throws Exception {\n final int numRows = 28;\n final int numColumns = 28;\n int outputNum = 10; // number of output classes\n int batchSize = 128; // batch size for each epoch\n int rngSeed = 123; // random number seed for reproducibility\n int numEpochs = 15; // number of epochs to perform\n String modelPath = \"モデルパスを入力\";\n\n //Get the DataSetIterators:\n DataSetIterator mnistTrain = new MnistDataSetIterator(batchSize, true, rngSeed);\n DataSetIterator mnistTest = new MnistDataSetIterator(batchSize, false, rngSeed);\n\n\n System.out.println(\"Build model....\");\n MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()\n .seed(rngSeed) //include a random seed for reproducibility\n // use stochastic gradient descent as an optimization algorithm\n .updater(new Nesterovs(0.006, 0.9))\n .l2(1e-4)\n .list()\n .layer(new DenseLayer.Builder() //create the first, input layer with xavier initialization\n .nIn(numRows * numColumns)\n .nOut(1000)\n .activation(Activation.RELU)\n .weightInit(WeightInit.XAVIER)\n .build())\n .layer(new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD) //create hidden layer\n .nIn(1000)\n .nOut(outputNum)\n .activation(Activation.SOFTMAX)\n .weightInit(WeightInit.XAVIER)\n .build())\n .build();\n\n\n MultiLayerNetwork model = new MultiLayerNetwork(conf);\n model.init();\n //print the score with every 1 iteration\n UIServer uiServer = UIServer.getInstance();\n InMemoryStatsStorage statsStorage = new InMemoryStatsStorage();\n uiServer.attach(statsStorage);\n model.setListeners(new StatsListener(statsStorage),new ScoreIterationListener(1));\n\n System.out.println(\"Train model....\");\n model.fit(mnistTrain, numEpochs);\n\n\n\n\n System.out.println(\"Evaluate model....\");\n Evaluation eval = model.evaluate(mnistTest);\n System.out.println(eval.stats());\n ModelSerializer.writeModel(model, new File(modelPath), false);\n System.out.println(\"****************Example finished********************\");\n\n }", "public void train ()\t{\t}", "public void train(){\n recoApp.training(idsToTest);\n }", "public void initModel(LDAModel model, Corpus corpus);", "protected float computeModelScoreOnTraining() {\n/* 508 */ float s = computeModelScoreOnTraining(0, this.samples.size() - 1, 0);\n/* 509 */ s /= this.samples.size();\n/* 510 */ return s;\n/* */ }", "@Override\n public LiteModelWrapper loadInitializeModel() throws IOException {\n return new LiteModelWrapper(this.loadMappedFile(\"softmax_initialize_ones.tflite\"));\n }", "private static native boolean train_auto_0(long nativeObj, long trainData_nativeObj, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long params_nativeObj, int k_fold, long Cgrid_nativeObj, long gammaGrid_nativeObj, long pGrid_nativeObj, long nuGrid_nativeObj, long coeffGrid_nativeObj, long degreeGrid_nativeObj, boolean balanced);", "public ConvergenceInputModelState()\n {\n this.inputModelReady = false;\n this.systemUpdated = false;\n }", "@Test(timeout = 4000)\n public void test068() throws Throwable {\n TextDirectoryLoader textDirectoryLoader0 = new TextDirectoryLoader();\n Instances instances0 = textDirectoryLoader0.getStructure();\n Evaluation evaluation0 = new Evaluation(instances0);\n evaluation0.addNumericTrainClass(360, (-336.251));\n assertEquals(0.0, evaluation0.SFPriorEntropy(), 0.01);\n }", "private void train() throws IOException {\r\n\r\n // Set Listeners, to see results of evaluation during training process and testing\r\n vgg16Transfer.setListeners(new ScoreIterationListener(100));\r\n trainWriter.write(\"\\n Train model....\");\r\n System.out.println(\"\\n Train model....\");\r\n int iterationsCounter = 0;\r\n // Go through all data \"epochs\" - number of times\r\n for(int n = 0; n < epochs; n++) {\r\n System.out.println(String.format(\"Epoch %d started training\", n + 1));\r\n trainWriter.write(String.format(\"Epoch %d started training\", n + 1));\r\n\r\n //Reset training iterator to the new epoch\r\n trainIterator.reset();\r\n // Go through all data once, till it's end\r\n while (trainIterator.hasNext()) {\r\n iterationsCounter++;\r\n trainingData = trainIterator.next();\r\n normalizer.fit(trainingData);\r\n vgg16Transfer.fit(trainingData);\r\n System.out.println(\"*** Completed iteration number # \" + iterationsCounter + \" ***\");\r\n trainWriter.write(\"*** Completed iteration number # \" + iterationsCounter + \" ***\");\r\n\r\n }\r\n System.out.println(String.format(\"Epoch %d finished training\", n + 1));\r\n trainWriter.write(\"*** Completed iteration number # \" + iterationsCounter + \" ***\");\r\n // Get results and check them\r\n Evaluation eval = new Evaluation(numLabels);\r\n testIterator.reset();\r\n while(testIterator.hasNext()) {\r\n testData = testIterator.next();\r\n normalizer.fit(testData);\r\n INDArray features = testData.getFeatures();\r\n INDArray labels = testData.getLabels();\r\n INDArray predicted = vgg16Transfer.outputSingle(features);\r\n eval.eval(labels, predicted);\r\n }\r\n System.out.println(String.format(\"Evaluation on test data - [Epoch %d] [Accuracy: %.3f, P: %.3f, R: %.3f, F1: %.3f] \",\r\n n + 1, eval.accuracy(), eval.precision(), eval.recall(), eval.f1()));\r\n System.out.println(eval.stats());\r\n System.out.println(eval.confusionToString());\r\n trainWriter.write(String.format(\"Evaluation on test data - [Epoch %d] [Accuracy: %.3f, P: %.3f, R: %.3f, F1: %.3f] \",\r\n n + 1, eval.accuracy(), eval.precision(), eval.recall(), eval.f1()));\r\n trainWriter.write(eval.stats());\r\n trainWriter.write(eval.confusionToString());\r\n }\r\n System.out.println(\"\\n *** Training finished! *** \");\r\n trainWriter.write(\"\\n *** Training finished! *** \");\r\n }", "public void train() throws Exception;", "public static void setModel(ClassifierModel model) {\n\t\tif(model.isIJUsed()) {\r\n\t\t\tpreprocess.setIJModel(model.getPreprocessModel());\r\n\t\t\tsvm.setIJModel(model.getSvmmodel());\r\n\t\t}\r\n\t\telse {\r\n\t\t\tpreprocess.setJFModel(model.getPreprocessModel());\r\n\t\t\tsvm.setJFModel(model.getSvmmodel());\r\n\t\t}\r\n\t}", "public void trainingPreprocessing() {\n neuralNetAndDataSet = new NeuralNetAndDataSet(neuralNetwork, trainingSet);\n trainingController = new TrainingController(neuralNetAndDataSet);\n neuralNetwork.getLearningRule().addListener(this);\n trainingController.setLmsParams(0.7, 0.01, 0);\n LMS learningRule = (LMS) this.neuralNetAndDataSet.getNetwork().getLearningRule();\n if (learningRule instanceof MomentumBackpropagation) {\n ((MomentumBackpropagation) learningRule).setMomentum(0.2);\n }\n }", "public void train() {\r\n // For each epoch, call setInputValue on input nodes\r\n for (int i = 0; i < maxEpoch; i++) {\r\n Collections.shuffle(trainingSet, random);\r\n\r\n // get each training instance\r\n for (int k = 0; k < trainingSet.size(); k++) {\r\n\r\n Instance instance = trainingSet.get(k);\r\n\r\n // set the input value in the input nodes from the training instance\r\n for (int j = 0; j < instance.attributes.size(); j++) {\r\n inputNodes.get(j).setInput(instance.attributes.get(j));\r\n }\r\n\r\n //set the target value in output nodes\r\n for (int j = 0; j < instance.classValues.size(); j++) {\r\n outputNodes.get(j).setTargetValue((double) instance.classValues.get(j));\r\n }\r\n\r\n // calculate values for hidden nodes\r\n for (int j = 0; j < hiddenNodes.size(); j++) {\r\n // for each hidden node\r\n Node hiddenNode = hiddenNodes.get(j);\r\n hiddenNode.calculateOutput();\r\n }\r\n\r\n //calculate values for output nodes\r\n double sumOfExponents = 0.0;\r\n for (int j = 0; j < outputNodes.size(); j++) {\r\n // for each output node\r\n Node outputNode = outputNodes.get(j);\r\n outputNode.calculateOutput();\r\n sumOfExponents += outputNode.getOutput();\r\n }\r\n\r\n //update output values of output nodes\r\n for (int j = 0; j < outputNodes.size(); j++) {\r\n Node outputNode = outputNodes.get(j);\r\n outputNode.updateOutputValue(sumOfExponents);\r\n }\r\n\r\n // calculate delta values for output nodes\r\n for (int j = 0; j < outputNodes.size(); j++) {\r\n Node outputNode = outputNodes.get(j);\r\n outputNode.calculateDelta();\r\n }\r\n\r\n // calculate delta values for hidden nodes\r\n for (int j = 0; j < hiddenNodes.size(); j++) {\r\n Node hiddenNode = hiddenNodes.get(j);\r\n hiddenNode.calculateDelta();\r\n hiddenNode.resetSumOfPartialDelta();\r\n }\r\n\r\n // update weights going from input layer to hidden layer\r\n for (int j = 0; j < hiddenNodes.size(); j++) {\r\n Node hiddenNode = hiddenNodes.get(j);\r\n hiddenNode.updateWeight(learningRate);\r\n }\r\n\r\n // update weights going from hidden layer to output layer\r\n for (int j = 0; j < outputNodes.size(); j++) {\r\n Node outputNode = outputNodes.get(j);\r\n outputNode.updateWeight(learningRate);\r\n }\r\n\r\n /*if (k == 0 && i==0) {\r\n for (int j = 0; j < outputNodes.size(); j++) {\r\n Node outputNode = outputNodes.get(j);\r\n for (NodeWeightPair pair : outputNode.parents) {\r\n System.out.println(pair.weight);\r\n }\r\n }\r\n }\r\n\r\n if (k == 0 && i == 0) {\r\n for (int j = 0; j < hiddenNodes.size(); j++) {\r\n Node hiddenNode = hiddenNodes.get(j);\r\n if (hiddenNode.parents != null) {\r\n for (NodeWeightPair pair : hiddenNode.parents) {\r\n System.out.println(pair.weight);\r\n }\r\n }\r\n }\r\n }*/\r\n }\r\n\r\n /* if (i==29) {\r\n for (int j = 0; j < outputNodes.size(); j++) {\r\n Node outputNode = outputNodes.get(j);\r\n for (NodeWeightPair pair : outputNode.parents) {\r\n System.out.println(pair.weight);\r\n }\r\n }\r\n }*/\r\n\r\n double totalLoss = 0.0;\r\n // Calculate loss and sum for each training instance, and then take average\r\n for (int k = 0; k < trainingSet.size(); k++) {\r\n Instance instance = trainingSet.get(k);\r\n totalLoss += loss(instance);\r\n }\r\n totalLoss /= trainingSet.size();\r\n System.out.println(\"Epoch: \" + i + \", \" + \"Loss: \" + String.format(\"%.3e\", totalLoss));\r\n }\r\n }", "@Test\n public void test01() throws Throwable {\n TestInstances testInstances0 = new TestInstances();\n Instances instances0 = testInstances0.generate((String) null);\n Evaluation evaluation0 = new Evaluation(instances0);\n evaluation0.addNumericTrainClass((-1459.149165489484), ',');\n assertEquals(0.0, evaluation0.SFPriorEntropy(), 0.01D);\n }", "@Override\n protected void initialize(){\n drivetrain.clearOldMotionProfiles();\n drivetrain.zeroEncoders();\n try{\n drivetrain.loadMotionProfile(name, isInverted);\n } catch (IOException e) {\n done = true;\n }\n drivetrain.startMotionProfile(name);\n }", "public void train()\n\t{\n\t\tdbiterator = DBInstanceIterator.getInstance();\n System.out.println(\"Start Training ..\");\n\n\t\ttry {\n\t\t\tSystem.out.println(\"Training Text %..\");\n\t\t\ttrainText();\n\n\t\t\tSystem.out.println(\"Training Complex %..\");\n\t\t\ttrainCombined();\n\n\t\t\tSystem.out.println(\"Training Feature %..\");\n\t\t\ttrainFeatures();\n\n\t\t\tSystem.out.println(\"Training Lexicon %..\");\n\t\t\t//trainLexicon();\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "public Training() {\n }", "TrainingTest createTrainingTest();", "public void train() {\n\n int w;\n double sum = 0, avg;\n double forecast;\n double[][] trainMatrix = new double[trainPoints][2];\n double[][] valMatrix = new double[validationPoints][2];\n actual = observations.toArray();\n\n for (int i = 0; i < step * slices; i++)\n sum += actual[i];\n\n avg = sum / slices;\n\n for (int pos = 0; pos < trainPoints; pos++) {\n sum = 0;\n w = 0;\n\n if (pos >= step * slices) {\n for (int k = pos - step * slices; k < pos; k += step)\n sum += actual[k] * weights[w++];\n forecast = sum / slices;\n } else forecast = avg;\n\n trainMatrix[pos][0] = actual[pos];\n trainMatrix[pos][1] = forecast;\n }\n\n for (int pos = actual.length - validationPoints, j = 0; pos < actual.length; pos++) {\n sum = 0;\n w = 0;\n for (int k = pos - step * slices; k < pos; k += step)\n sum += actual[k] * weights[w++];\n forecast = sum / slices;\n valMatrix[j][0] = actual[pos];\n valMatrix[j][1] = forecast;\n j++;\n }\n double biasness = BiasnessHandler.handleOffset(valMatrix);\n accuracyIndicators.setBias(biasness);\n ModelUtil.computeAccuracyIndicators(accuracyIndicators, trainMatrix, valMatrix, dof);\n errorBound = ErrorBoundsHandler.computeErrorBoundInterval(trainMatrix);\n }", "public Training() {\n\n }", "DataGenModel()\n {\n }", "public Train(){\n}", "public void train() {\n\t\tfor (int i = 0; i < numberOfIterations; i++) {\n\t\t\t// for each training record\n\t\t\tfor (int j = 0; j < numberOfRecords; j++) {\n\t\t\t\t// calculate inputs and outputs\n\t\t\t\tforwardCalculation(records.get(j).input);\n\t\t\t\t// compute errors, update weights and thetas\n\t\t\t\tbackwardCalculation(records.get(j).output);\n\t\t\t}\n//\t\t\tpostprocessOutputs();\n\t\t}\n\t}", "private void initializeGameModel() {\n mGameModel = new GameModel();\n mGameModel.setId(mGameWaitModel.getId());\n mGameModel.setGameMaster(getPlayerModel(true));\n mGameModel.setGameSlave(getPlayerModel(false));\n mGameModel.setGenerateNewQuestion(true);\n mGameModel.setDidGameEnd(false);\n LOGD(TAG, \"Game Model initialized\");\n }", "private static native boolean train_0(long nativeObj, long trainData_nativeObj, long responses_nativeObj, long varIdx_nativeObj, long sampleIdx_nativeObj, long params_nativeObj);", "@Override\n public void startup(Model model) {\n model.updateModelRep(stateID);\n }", "@Before\n public void setUp() {\n model = new ImportAttributeModel();\n }", "static void initialize() {\n model = new RatAppModel(\n );\n //Log.d(\"RatAppModel\", \"Initialized\");\n }", "public void prepareModel() {\n //Since many models have different scale amplitudes, we calculate a uniform scale factor for the model\n setScaleFactor();\n //Since the 3ds file does not provide normal values, we must calculate them ourselves\n calculateNormals();\n //Finally we need to setup the buffers for drawing\n setupBuffers();\n }", "public void fit(ArrayList trainData) {\n this.trainingData = trainData;\n }", "public void initModel() {\r\n this.stateEngine = new RocketStateEngine();\r\n }", "public AutoClassification(ClassificationModel classificationModel) {\r\n this.classificationModel = classificationModel;\r\n }", "public OpenGLModel() {\n\n\n\t}", "protected void initialize() {\r\n Robot.driveTrain.resetRangefinder();\r\n }", "public void Initialize()\n\t{ \n\t\t// avoid K=0 \n\t\tif(K == 0) \n\t\t\tK = 1;\n\t\t\n\t\tLogging.println(\"ITrain=\"+ITrain + \", ITest=\"+ITest + \", Q=\"+Q, LogLevel.DEBUGGING_LOG);\n\t\tLogging.println(\"K=\"+K + \", eta=\" + eta + \", maxIter=\"+ maxIter, LogLevel.DEBUGGING_LOG);\n\t\tLogging.println(\"lambdaW=\"+lambdaW + \", alpha=\"+ alpha, LogLevel.DEBUGGING_LOG);\n\t\t\n\t\t// set the labels to be binary 0 and 1, needed for the logistic loss\n\t\tCreateOneVsAllTargets();\n\t\t\n\t\tRandom rand = new Random();\n\t\t\n\t\tL = new int[K];\n\t\tfor(int k=0; k < K; k++)\n\t\t\tL[k] = rand.nextInt(Q);\n\t\t\n\t\t\n\t\tLogging.println(\"Classes=\"+C, LogLevel.DEBUGGING_LOG);\n\t\t\n\t\t// initialize shapelets\n\t\tInitializeShapeletsRandomly();\n\t\t\n\t\t// initialize weights\n\t\tW = new double[C][K];\n\t\tbiasW = new double[C];\n\t\t\n\t\t\n\t\t// initialize the terms for pre-computation\n\t\tD = new double[ITrain+ITest][K][];\n\t\tE = new double[ITrain+ITest][K][];\n\t\t\n\t\tfor(int i = 0; i < ITrain+ITest; i++)\n\t\t\t\tfor(int k = 0; k < K; k++)\n\t\t\t\t{\n\t\t\t\t\tD[i][k] = new double[Q-L[k]+1];\n\t\t\t\t\tE[i][k] = new double[Q-L[k]+1];\n\t\t\t\t}\n\t\t\n\t\tM = new double[ITrain+ITest][K];\n\t\tPsi = new double[ITrain+ITest][K];\t\t \n\t\tphi = new double[ITrain+ITest][C];\n\t\t\n\t\t\n\t\t// store all the index and class indexes\n\t\tidxPairs = new ArrayList<Integer>();\n\t\tfor(int i = 0; i < ITrain; i++)\n\t\t{\n\t\t\t\tidxPairs.add(i);\n\t\t\t\t\n\t\t\t\tPreCompute(i); \n\t\t}\n\t\t\n\t\n\t\t// shuffle the order\n\t\tCollections.shuffle(idxPairs);\n\t\t\n\t\t\t\t\n\t\tLogging.println(\"Initializations Completed!\", LogLevel.DEBUGGING_LOG);\n\t}", "public void initializeModel(SongModel songmodel)\n {\n this.sm = songmodel;\n }", "protected void init()\r\n\t{\n\t\tif (ConfigManager.getInstance().getIsCrossClassify() && WekaTool.dataStageOn)\r\n\t\t{\r\n\t\t\t//System.out.println(\"in init for data stage\");\r\n\t\t\tsrcDirUrl = ConfigManager.getInstance().getTrainPath();\r\n\t\t\tdestDirUrl = ConfigManager.getInstance().getTrainPath() +\r\n\t\t\t File.separator + \"output\";\r\n\t\t\t//System.out.println(\"srcDirUrl = \" + srcDirUrl);\r\n\t\t\t//System.out.println(\"destDirUrl = \" + destDirUrl);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//System.out.println(\"here, good\");\r\n\t\t\tsrcDirUrl = getSrcDirUrl();\r\n\t\t\tdestDirUrl = getDestDirUrl();\r\n\t\t}\r\n\t\tdatalibSVMUrl = getLibSVMDirUrl();\r\n\t\ttry {\r\n\t\t\tsrcDir = Utils.getDir(srcDirUrl);\r\n\t\t\tdestDir = Utils.getDir(destDirUrl);\r\n\t\t} catch (Exception e)\r\n\t\t{\r\n\t\t}\r\n\t}", "protected void initialize() {\n //drivetrain.initGyro();\n }", "protected void prepareModel() {\n model();\n }", "@org.junit.Before\n public void setUp() throws Exception {\n theModel = new Model();\n }", "@Before\n\tpublic void loadModel() {\n\t\tloader.unloadAll();\n\n\t\tmodel = loader\n\t\t\t\t.loadViaXslt(\"/net/meisen/dissertation/performance/implementations/similarity/tida/tida-model-timeSeriesSimilarityEvaluator.xml\");\n\t\tevaluator = new TimeSeriesSimilarityEvaluator(model);\n\t}", "public WeightingModel(){}", "public abstract void fit(BinaryData trainingData);", "@Override\n public void initialize() {\n\n drivetrain = Drivetrain.getInstance();\n \n \n\n }", "public SVM(final svm_model theModel) {\n this.model = theModel;\n this.params = model.param;\n this.inputCount = 0;\n\n // determine the input count\n for (final svm_node[] element : this.model.SV) {\n for (int col = 0; col < element.length; col++) {\n this.inputCount = Math.max(element[col].index, this.inputCount);\n }\n }\n\n //\n }", "@Override\n protected void initModel() {\n bannerModel = new BannerModel();\n// homeSousuoModel = new Home\n\n// bannerModel = new BannerModel();\n// homeSousuoModel = new HomeSousuoModel();\n// izxListModelBack = new\n }", "private void shared_init(Vec resp) {\n /* For reproducibility we can control the randomness in the computation of the\n confusion matrix. The default seed when deserializing is 42. */\n// _data = _model.test_frame == null ? _model.fr : _model.test_frame;\n if (_model.validation) _computeOOB = false;\n _modelDataMap = _model.colMap(_data);\n assert !_computeOOB || _model._dataKey.equals(_datakey) : !_computeOOB + \" || \" + _model._dataKey + \" equals \" + _datakey;\n Vec respModel = resp;\n Vec respData = _data.vecs()[_classcol];\n int model_max = (int)respModel.max();\n int model_min = (int)respModel.min();\n int data_max = (int)respData.max();\n int data_min = (int)respData.min();\n\n if (respModel._domain!=null) {\n assert respData._domain != null;\n _model_classes_mapping = new int[respModel._domain.length];\n _data_classes_mapping = new int[respData._domain.length];\n // compute mapping\n _N = alignEnumDomains(respModel._domain, respData._domain, _model_classes_mapping, _data_classes_mapping);\n } else {\n assert respData._domain == null;\n _model_classes_mapping = null;\n _data_classes_mapping = null;\n // compute mapping\n _cmin_model_mapping = model_min - Math.min(model_min, data_min);\n _cmin_data_mapping = data_min - Math.min(model_min, data_min);\n _N = Math.max(model_max, data_max) - Math.min(model_min, data_min) + 1;\n }\n assert _N > 0; // You know...it is good to be sure\n init();\n }", "public void reset() {\n\t\tmodelVertices.clear();\n\t\ttextureVertices.clear();\n\t\tnormalVertices.clear();\n\t\tgroups.clear();\n\t\tsegments.clear();\n\t\tDebug.info(\"Jay3dModel\",\"OBJModel is empty\");\n\t}", "public void initializeModelAndSettings(String modelName, IDataAccessObject dataAccessObject, String[] trainingSettings) throws TotalADSDBMSException, TotalADSGeneralException;", "public void trainTest() throws Exception\n\t{\n\t\tSystem.out.println(\"Preprocessing Testset ..\");\n\t\t//String[] dir = new String[]{ Test+\"negative\" , Test+\"positive\"};\n\t\t//FileIterator iterator = new FileIterator(dir,FileIterator.LAST_DIRECTORY);\n\t\tInstanceList instances = new InstanceList(getTextPipe());\n\t\t//instances.addThruPipe(iterator);\n\n\t\tCSVParser parser = new CSVParser(new FileReader(\n\t\t\t\t\"resources/datasets/sentimentanalysis/mallet_test/Sentiment140/sentiment140.csv\"),\n\t\t\t\tCSVFormat.EXCEL.withFirstRecordAsHeader());\n\n\t\tTextPreprocessor preprocessor = new TextPreprocessor(\"resources/datasets/sentimentanalysis/\");\n\t\tint count = 0;\n\t\tfor (CSVRecord record: parser.getRecords())\n\t\t{\n\t\t\tString target;\n\t\t\tif (record.get(\"target\").equals(\"0\"))\n\t\t\t\ttarget = \"negative\";\n\t\t\telse\n\t\t\t\ttarget = \"positive\";\n\t\t\tinstances.addThruPipe(new Instance(preprocessor.getProcessed(record.get(\"tweet\")),target,\n\t\t\t\t\t\"Instance\"+count++,null));\n\n\t\t\tSystem.out.println(count);\n\t\t}\n\n\t\tSystem.out.println(instances.targetLabelDistribution());\n\t\tSystem.out.println(\"Start Training Testset ..\");\n\t\tClassifier nb = new NaiveBayesTrainer().train(instances);\n\t\tSystem.out.println(\"Saving Test Model ..\");\n\t\tsaveModel(nb,Test+\"Model.bin\");\n\t\tsaveinstances(instances,Test+\"Model-Instances.bin\");\n\t\tinstances.getDataAlphabet().dump(new PrintWriter(new File(Test+\"Model-alphabet.dat\")));\n\t}", "protected void establishTransformationModel() {\r\n\t \r\n\t\tTransformationModel transformModel ;\r\n\t\tArrayList<TransformationStack> modelTransformStacks ;\r\n\t\t\r\n\t\t\r\n\t\t// the variables needed for the profile\r\n\t\t// targetStruc = getTargetVector();\r\n\t\tsomData = soappTransformer.getSomData() ; \r\n\t\t// soappTransformer.setSomData( somApplication.getSomData() );\r\n\t\tsomApplication.setSomData(somData) ;\r\n\t\t\r\n\t\tsomData.getVariablesLabels() ;\r\n\t\t \r\n\t\t\r\n\t\t// from here we transfer...\r\n\t\tmodelTransformStacks = soappTransformer.getTransformationModel().getVariableTransformations();\r\n\t\ttransformModel = soappTransformer.getTransformationModel() ;\r\n\t\t \r\n\t\t\r\n\t\ttransformationModelImported = true;\r\n\t}", "@Test\n public void test30() throws Throwable {\n TextDirectoryLoader textDirectoryLoader0 = new TextDirectoryLoader();\n Instances instances0 = textDirectoryLoader0.getDataSet();\n Evaluation evaluation0 = new Evaluation(instances0);\n boolean boolean0 = evaluation0.getDiscardPredictions();\n assertEquals(0.0, evaluation0.SFPriorEntropy(), 0.01D);\n assertFalse(boolean0);\n }", "private void buildAndRunNetwork() throws IOException {\n final int numRows = 28;\r\n final int numColumns = 28;\r\n int outputNum = 10; // number of output classes\r\n int batchSize = 128; // batch size for each epoch\r\n int rngSeed = 123; // random number seed for reproducibility\r\n int numEpochs = 15; // number of epochs to perform\r\n double rate = 0.0015; // learning rate\r\n\r\n //Get the DataSetIterators:\r\n DataSetIterator mnistTrain = new MnistDataSetIterator(batchSize, true, rngSeed);\r\n DataSetIterator mnistTest = new MnistDataSetIterator(batchSize, false, rngSeed);\r\n\r\n\r\n log.info(\"Build model....\");\r\n MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()\r\n .seed(rngSeed) //include a random seed for reproducibility\r\n .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) // use stochastic gradient descent as an optimization algorithm\r\n .iterations(1)\r\n .activation(Activation.RELU)\r\n .weightInit(WeightInit.XAVIER)\r\n .learningRate(rate) //specify the learning rate\r\n .updater(Updater.NESTEROVS).momentum(0.98) //specify the rate of change of the learning rate.\r\n .regularization(true).l2(rate * 0.005) // regularize learning model\r\n .list()\r\n .layer(0, new DenseLayer.Builder() //create the first input layer.\r\n .nIn(numRows * numColumns)\r\n .nOut(500)\r\n .build())\r\n .layer(1, new DenseLayer.Builder() //create the second input layer\r\n .nIn(500)\r\n .nOut(100)\r\n .build())\r\n .layer(2, new OutputLayer.Builder(LossFunction.NEGATIVELOGLIKELIHOOD) //create hidden layer\r\n .activation(Activation.SOFTMAX)\r\n .nIn(100)\r\n .nOut(outputNum)\r\n .build())\r\n .pretrain(false).backprop(true) //use backpropagation to adjust weights\r\n .build();\r\n\r\n MultiLayerNetwork model = new MultiLayerNetwork(conf);\r\n model.init();\r\n \r\n model.setListeners(new ScoreIterationListener(5)); //print the score with every iteration\r\n\r\n log.info(\"Train model....\");\r\n for( int i=0; i<numEpochs; i++ ){\r\n \tlog.info(\"Epoch \" + i);\r\n model.fit(mnistTrain);\r\n }\r\n\r\n\r\n log.info(\"Evaluate model....\");\r\n Evaluation eval = new Evaluation(outputNum); //create an evaluation object with 10 possible classes\r\n while(mnistTest.hasNext()){\r\n DataSet next = mnistTest.next();\r\n INDArray output = model.output(next.getFeatureMatrix()); //get the networks prediction\r\n eval.eval(next.getLabels(), output); //check the prediction against the true class\r\n }\r\n\r\n log.info(eval.stats());\r\n log.info(\"****************Example finished********************\");\r\n\t}", "public Factory() {\n\t\tnb_rounds = 0; \n\t\tnb_to_train = 0; \n\t\ttraining_queue = new LinkedList<Pair<Soldier, Integer>>(); \n\t\tcurrent = null;\n\t}", "public void drivetrainInitialization()\n\t{\n\t\tleftSRX.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, Constants.kTimeoutMs);\n\t\tleftSRX.setSensorPhase(true);\n\t\tleftSRX.configNominalOutputForward(0, Constants.kTimeoutMs);\n\t\tleftSRX.configNominalOutputReverse(0, Constants.kTimeoutMs);\n\t\tleftSRX.configPeakOutputForward(1, Constants.kTimeoutMs);\n\t\tleftSRX.configPeakOutputReverse(-1, Constants.kTimeoutMs);\n\n\t\t// // Config left side PID Values\n\t\t// leftSRX.selectProfileSlot(Constants.drivePIDIdx, 0);\n\t\t// leftSRX.config_kF(Constants.drivePIDIdx, Constants.lDrivekF, Constants.kTimeoutMs);\n\t\t// leftSRX.config_kP(Constants.drivePIDIdx, Constants.lDrivekP, Constants.kTimeoutMs);\n\t\t// leftSRX.config_kI(Constants.drivePIDIdx, Constants.lDrivekI, Constants.kTimeoutMs);\n\t\t// leftSRX.config_kD(Constants.drivePIDIdx, Constants.lDrivekD, Constants.kTimeoutMs);\n\n\t\t// Config right side PID settings\n\t\trightSRX.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, Constants.drivePIDIdx, Constants.kTimeoutMs);\n\t\trightSRX.setSensorPhase(true);\n\t\trightSRX.configNominalOutputForward(0, Constants.kTimeoutMs);\n\t\trightSRX.configNominalOutputReverse(0, Constants.kTimeoutMs);\n\t\trightSRX.configPeakOutputForward(1, Constants.kTimeoutMs);\n\t\trightSRX.configPeakOutputReverse(-1, Constants.kTimeoutMs);\n\n\t\t// // Config right side PID Values\n\t\t// rightSRX.selectProfileSlot(Constants.drivePIDIdx, 0);\n\t\t// rightSRX.config_kF(Constants.drivePIDIdx, Constants.rDrivekF, Constants.kTimeoutMs);\n\t\t// rightSRX.config_kP(Constants.drivePIDIdx, Constants.rDrivekP, Constants.kTimeoutMs);\n\t\t// rightSRX.config_kI(Constants.drivePIDIdx, Constants.rDrivekI, Constants.kTimeoutMs);\n\t\t// rightSRX.config_kD(Constants.drivePIDIdx, Constants.rDrivekD, Constants.kTimeoutMs);\n\n\t\t// Set up followers\n\t\tleftSPX1.follow(leftSRX);\n\t\tleftSPX2.follow(leftSRX);\n\n\t\trightSPX1.follow(rightSRX);\n\t\trightSPX2.follow(rightSRX);\n\t\t\n\t\trightSRX.setInverted(true);\n\t\trightSPX1.setInverted(true);\n\t\trightSPX2.setInverted(true);\n }", "private void train(float[] inputs, int desired) {\r\n int guess = feedforward(inputs);\r\n float error = desired - guess;\r\n for (int i = 0; i < weights.length; i++) {\r\n weights[i] += c * error * inputs[i];\r\n }\r\n }", "public void train()\r\n\t{\r\n\t\tfor(int i=0; i < this.maxEpoch; i++)\r\n\t\t{\r\n\t\t\tfor(Instance temp_example: this.trainingSet)\r\n\t\t\t{\r\n\t\t\t\tdouble O = calculateOutputForInstance(temp_example);\r\n\t\t\t\tdouble T = temp_example.output;\r\n\t\t\t\tdouble err = T - O;\r\n\r\n\t\t\t\t//w_jk (hidden to output)\r\n\t\t\t\tdouble g_p_out = (outputNode.getSum() <= 0) ? 0 : 1;\r\n\t\t\t\tfor(NodeWeightPair hiddenNode: outputNode.parents)\r\n\t\t\t\t{\r\n\t\t\t\t\thiddenNode.set_deltaw_pq(this.learningRate*\r\n\t\t\t\t\t\t\thiddenNode.node.getOutput()*err*g_p_out);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//w_ij (input to hidden)\r\n\t\t\t\tint hid_count =0;\r\n\t\t\t\tfor(Node hiddenNode: hiddenNodes){\r\n\t\t\t\t\tdouble g_p_hid = (hiddenNode.getSum() <= 0) ? 0 : 1;\r\n\t\t\t\t\tif(hiddenNode.getType()==2)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor(NodeWeightPair inputNode: hiddenNode.parents){\r\n\t\t\t\t\t\t\tdouble a_i = inputNode.node.getOutput();\r\n\t\t\t\t\t\t\tinputNode.set_deltaw_pq\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\tthis.learningRate*\r\n\t\t\t\t\t\t\t\t\ta_i*g_p_hid*(err*\r\n\t\t\t\t\t\t\t\t\toutputNode.parents.get(hid_count).weight*\r\n\t\t\t\t\t\t\t\t\tg_p_out)\r\n\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\thid_count++;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// for all w_pq, update weights\r\n\t\t\t\tfor(Node hiddenNode: hiddenNodes){\r\n\t\t\t\t\tif(hiddenNode.getType()==2){\r\n\t\t\t\t\t\tfor(NodeWeightPair inputNode: hiddenNode.parents){\r\n\t\t\t\t\t\t\tinputNode.weight += inputNode.get_deltaw_pq();\r\n\t\t\t\t\t\t\tinputNode.set_deltaw_pq(new Double (0.00));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfor(NodeWeightPair hiddenNode: outputNode.parents)\r\n\t\t\t\t{\r\n\t\t\t\t\thiddenNode.weight += hiddenNode.get_deltaw_pq();\r\n\t\t\t\t\thiddenNode.set_deltaw_pq(new Double (0.00));\r\n\t\t\t\t}\r\n\r\n\t\t\t} // end of an instance \r\n\t\t} // end of an epoch\r\n\t}", "@Test(timeout = 4000)\n public void test093() throws Throwable {\n TextDirectoryLoader textDirectoryLoader0 = new TextDirectoryLoader();\n Instances instances0 = textDirectoryLoader0.getDataSet();\n Evaluation evaluation0 = new Evaluation(instances0);\n Object[] objectArray0 = new Object[2];\n evaluation0.evaluateModel((Classifier) null, instances0, objectArray0);\n assertEquals(0.0, evaluation0.SFEntropyGain(), 0.01);\n }", "public void initialize(Model model){\r\n\t\tArrayList<String> elements = new ArrayList<String>();\r\n\t\tfor(int i = 0; i < model.getElements().size(); i++){\r\n\t\t\telements.add(model.getElements().get(i).getId());\r\n\t\t}\r\n\t\t\r\n\t\tFeature base = new Feature(\"base\", \"mandatory\", \"root\", elements);\r\n\t\tthis.mandatoryFeatures.add(base);\r\n\t\tFeatureGroup variants = new FeatureGroup(\"variants\", \"alternative\", \"root\");\r\n\t\tthis.alternativeFeatureGroup.add(variants);\r\n\t\t\r\n\t\t//New 02/12/201/\r\n\t\tFeature newVariant = new Feature(model.getId()+\"_Variant\", \"variant\", this.alternativeFeatureGroup.get(0).getId());\r\n\t\tthis.addVariant(newVariant);\r\n\t\t//-New 02/12/201/\r\n\t}", "public void initialize() {\n\t\tdrivetrain.resetGyro();\n\t\tdrivetrain.setAngleTarget(getTargetAngle());\n\t\tLog.debug(this.getClass().toString()+ \".initialize called drivetrain.setAngleTarget(\" + getTargetAngle() + \")\");\n\t\t\n\n\t}", "public void setStopTrainModel() {\n HwHidataJniAdapter hwHidataJniAdapter = HwHidataJniAdapter.getInstance();\n if (hwHidataJniAdapter != null) {\n hwHidataJniAdapter.nativeSetIsStop(true);\n }\n }", "@Override\r\n public void init(){\r\n System.out.println(\"Application inits\");\r\n try {\r\n\t\t// Create file for logging\r\n\t\ttrainFile = new File(trainFileName);\r\n\t\tif(!trainFile.exists()) {\r\n\t\t\tSystem.out.println(\"\\n\\nTrain Log file does not exist. Create...\");\r\n\t\t\ttrainFile.createNewFile();\r\n\t\t\tSystem.out.println(\"\\n\\nTrain Log file created in folder: \" + trainFile.getAbsolutePath());\r\n\t\t}\r\n\t\telse {\r\n\t\t\tSystem.out.println(\"\\n\\nTrain Log file created in folder: \" + trainFile.getAbsolutePath());\r\n\t\t}\r\n\t\ttestFile = new File(testFileName);\r\n\t\tif(!testFile.exists()) {\r\n\t\t\tSystem.out.println(\"\\n\\nTest Log file does not exist. Create...\");\r\n\t\t\ttestFile.createNewFile();\r\n\t\t\tSystem.out.println(\"\\n\\nTest Log file created in folder: \" + testFile.getAbsolutePath());\r\n\t\t}\r\n\t\telse {\r\n\t\t\tSystem.out.println(\"\\n\\nTest Log file created in folder: \" + testFile.getAbsolutePath());\r\n\t\t}\r\n\t\t// Create file for saving config and results \r\n\t\tstatsFile = new File(statsFileName);\r\n\t\tif(!statsFile.exists()) {\r\n\t\t\tSystem.out.println(\"\\n\\nStats file does not exist. Create...\");\r\n\t\t\tstatsFile.createNewFile();\r\n\t\t\tSystem.out.println(\"\\n\\nStats file created in folder: \" + statsFile.getAbsolutePath());\r\n\t\t}\r\n\t\telse {\r\n\t\t\tSystem.out.println(\"\\n\\nStats file created in folder: \" + statsFile.getAbsolutePath());\r\n\t\t}\r\n\t\t\r\n\t\t// Create FileWriters\r\n\t\ttrainWriter = new FileWriter(trainFile, false);\r\n\t\ttestWriter = new FileWriter(testFile, false);\r\n\t\tstatsWriter = new FileWriter(statsFile, false);\r\n\t\t\r\n\t\t\r\n } catch (Exception e) {\r\n System.err.println(\"Error in creating log files\");\r\n e.printStackTrace();\r\n }\r\n \r\n try {\r\n super.init();\r\n trainWriter.write(\"---Initialization of Application.--- \\nBuild model....\");\r\n this.vgg16Transfer = configurate();\r\n trainWriter.write(\"Configuration created successfully!\");\r\n System.out.println(\"Configuration created successfully!\");\r\n vgg16Transfer.init();\r\n trainWriter.write(\"Neural Network initialized successfully!\");\r\n trainWriter.write(vgg16Transfer.summary());\r\n System.out.println(vgg16Transfer.summary()); // Print changes config\r\n } catch (Exception e) {\r\n System.err.println(\"Error in configurating Neural Network\");\r\n e.printStackTrace();\r\n }\r\n\r\n // Load data for training\r\n try {\r\n \ttrainWriter.write(\"\\nStarted loading training data...\");\r\n loadDataTraining(trainDirAddr);\r\n } catch (IOException e) {\r\n System.err.println(\"Error while loading training dataset\");\r\n e.printStackTrace();\r\n }\r\n // Load data for testing\r\n try {\r\n \ttestWriter.write(\"Started loading training data...\");\r\n loadDataTesting(testDirAddr);\r\n } catch (IOException e) {\r\n System.err.println(\"Error while loading testing dataset\");\r\n e.printStackTrace();\r\n }\r\n\r\n /*\r\n * Check, if model is ready - then load it from file, then check it on test iterator.\r\n * Else - train it and save params to the specified file.\r\n */\r\n if(!collectStats) {\r\n try {\r\n \tSystem.out.println(\"\\n Model is already pre-trained. Loading...\");\r\n \ttestWriter.write(\"\\n Model is already pre-trained. Loading...\");\r\n \r\n // Load model\r\n vgg16Transfer = load();\r\n testWriter.write(\"\\n Model loaded successfully!\");\r\n } \r\n catch (IOException e) {\r\n System.err.println(\"Error while writing to log file\");\r\n e.printStackTrace();\r\n }\r\n catch (Exception e) {\r\n System.err.println(\"Error while loading Neural Network\");\r\n e.printStackTrace();\r\n }\r\n }\r\n else {\r\n \ttry {\r\n\t\t\t\ttrainWriter.write(\"\\n Model is not pre-trained.\");\r\n\t\t\t\tSystem.out.println(\"\\n Model is not pre-trained.\");\r\n\t // Train NN\r\n\t train();\r\n\t\t\t\t\r\n\t\t\t} \r\n catch (IOException e) {\r\n System.err.println(\"Error while writing to log file\");\r\n e.printStackTrace();\r\n }\r\n \tcatch (Exception e1) {\r\n\t\t\t\tSystem.err.println(\"Error while training Neural Network\");\r\n\t\t\t\te1.printStackTrace();\r\n\t\t\t}\r\n \r\n // Save NN to file\r\n try {\r\n System.out.println(\"\\n Model is trained. Saving...\");\r\n trainWriter.write(\"\\n Model is trained. Saving...\");\r\n save(vgg16Transfer);\r\n trainWriter.write(\"\\n Model saved successfully!\");\r\n } catch (Exception e) {\r\n System.err.println(\"Error while saving Neural Network\");\r\n e.printStackTrace();\r\n }\r\n }\r\n }", "@Test\n public void testTrain() {\n System.out.println(\"train\");\n TokenizedLine tokenizedLine = null;\n ArrayList<Words> expResult = null;\n ArrayList<Words> result = Training.train(tokenizedLine);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n \n }", "public void train() {\n\n\t\tint D = Os.length;\n\t\tint T_n = 0;\n\t\tdouble log_likelihood = 0;\n\t\tdouble log_likelihood_new = 0;\n\t\tdouble epsilon = this.epsilon;\n\t\tint maxIter = this.maxIter;\n\n\t\t// Initialization\n\n\t\tclearVector(pi);\n\t\tclearMatrix(A);\n\t\tclearMatrix(B);\n\n\t\tdouble[] a = allocateVector(N);\n\t\tdouble[] b = allocateVector(N);\n\n\t\tint[] Q_n = null;\n\t\tint[] O_n = null;\n\t\t\n\t\tif (Qs == null) {\n\t\t\t\n\t\t\tpi = initializePi();\n\t\t\tA = initializeA();\n\t\t\tB = initializeB();\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\tfor (int n = 0; n < D; n++) {\n\t\t\t\tQ_n = Qs[n];\n\t\t\t\tO_n = Os[n];\n\t\t\t\tT_n = Os[n].length;\n\t\t\t\tfor (int t = 0; t < T_n; t++) {\n\t\t\t\t\tif (t < T_n - 1) {\n\t\t\t\t\t\tA[Q_n[t]][Q_n[t + 1]] += 1;\n\t\t\t\t\t\ta[Q_n[t]] += 1;\n\t\t\t\t\t\tif (t == 0) {\n\t\t\t\t\t\t\tpi[Q_n[0]] += 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tB[Q_n[t]][O_n[t]] += 1;\n\t\t\t\t\tb[Q_n[t]] += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdivideAssign(pi, D);\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tdivideAssign(A[i], a[i]);\n\t\t\t\tdivideAssign(B[i], b[i]);\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\tint s = 0;\n\t\tdouble[] pi_new = allocateVector(N);\n\t\tdouble[][] A_new = allocateMatrix(N, N);\n\t\tdouble[][] B_new = allocateMatrix(N, M);\n\t\tdouble[] temp_pi = null;\n\t\tdouble[][] temp_A = null;\n\t\tdouble[][] temp_B = null;\n\t\tdouble[][] alpha_hat = null;\n\t\tdouble[][] beta_hat = null;\n\t\tdouble[] c_n = null;\n\t\tdouble[][] xi = allocateMatrix(N, N);\n\t\tdouble[] gamma = allocateVector(N);\n\t\tdo {\n\n\t\t\t// Clearance\n\t\t\tclearVector(pi_new);\n\t\t\tclearMatrix(A_new);\n\t\t\tclearMatrix(B_new);\n\t\t\tclearVector(a);\n\t\t\tclearVector(b);\n\t\t\t/*clearMatrix(xi);\n\t\t\tclearVector(gamma);*/\n\t\t\tlog_likelihood_new = 0;\n\n\t\t\tfor (int n = 0; n < D; n++) {\n\n\t\t\t\t// Q_n = Qs[n];\n\t\t\t\tO_n = Os[n];\n\t\t\t\tT_n = Os[n].length;\n\t\t\t\tc_n = allocateVector(T_n);\n\t\t\t\talpha_hat = allocateMatrix(T_n, N);\n\t\t\t\tbeta_hat = allocateMatrix(T_n, N);\n\n\t\t\t\t// Forward Recursion with Scaling\t\t\t\n\n\t\t\t\tfor (int t = 0; t <= T_n - 1; t++) {\n\t\t\t\t\tif (t == 0) {\n\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\talpha_hat[0][i] = pi[i] * B[i][O_n[0]];\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (int j = 0; j < N; j++) {\n\t\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\t\talpha_hat[t][j] += alpha_hat[t - 1][i] * A[i][j] * B[j][O_n[t]];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tc_n[t] = 1.0 / sum(alpha_hat[t]);\n\t\t\t\t\ttimesAssign(alpha_hat[t], c_n[t]);\n\t\t\t\t}\n\n\t\t\t\t// Backward Recursion with Scaling\n\n\t\t\t\tfor (int t = T_n + 1; t >= 2; t--) {\n\t\t\t\t\tif (t == T_n + 1) {\n\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\tbeta_hat[t - 2][i] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (t <= T_n) {\n\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\tfor (int j = 0; j < N; j++) {\n\t\t\t\t\t\t\t\tbeta_hat[t - 2][i] += A[i][j] * B[j][O_n[t - 1]] * beta_hat[t - 1][j];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttimesAssign(beta_hat[t - 2], c_n[t - 2]);\n\t\t\t\t}\n\n\t\t\t\t// Expectation Variables and Updating Model Parameters\n\n\t\t\t\tfor (int t = 0; t <= T_n - 1; t++) {\n\t\t\t\t\tif (t < T_n - 1) {\n\t\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\t\tfor (int j = 0; j < N; j++) {\n\t\t\t\t\t\t\t\txi[i][j] = alpha_hat[t][i] * A[i][j] * B[j][O_n[t + 1]] * beta_hat[t + 1][j];\n\t\t\t\t\t\t\t\t// A_new[i][j] += xi[i][j];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplusAssign(A_new[i], xi[i]);\n\t\t\t\t\t\t\tgamma[i] = sum(xi[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (t == 0) {\n\t\t\t\t\t\t\tplusAssign(pi_new, gamma);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tplusAssign(a, gamma);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassignVector(gamma, alpha_hat[t]);\n\t\t\t\t\t}\n\t\t\t\t\tfor (int j = 0; j < N; j++) {\n\t\t\t\t\t\tB_new[j][O_n[t]] += gamma[j];\n\t\t\t\t\t}\n\t\t\t\t\tplusAssign(b, gamma);\n\t\t\t\t\tlog_likelihood_new += -Math.log(c_n[t]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Normalization (Sum to One)\n\n\t\t\tsum2one(pi_new);\n\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tdivideAssign(A_new[i], a[i]);\n\t\t\t}\n\n\t\t\tfor (int j = 0; j < N; j++) {\n\t\t\t\tdivideAssign(B_new[j], b[j]);\n\t\t\t}\n\n\t\t\ttemp_pi = pi;\n\t\t\tpi = pi_new;\n\t\t\tpi_new = temp_pi;\n\n\t\t\ttemp_A = A;\n\t\t\tA = A_new;\n\t\t\tA_new = temp_A;\n\n\t\t\ttemp_B = B;\n\t\t\tB = B_new;\n\t\t\tB_new = temp_B;\n\t\t\t// display(B);\n\n\t\t\ts = s + 1;\n\n\t\t\tif (s > 1) {\n\t\t\t\tif (Math.abs((log_likelihood_new - log_likelihood) / log_likelihood) < epsilon) {\n\t\t\t\t\tfprintf(\"log[P(O|Theta)] does not increase.\\n\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlog_likelihood = log_likelihood_new;\n\t\t\tfprintf(\"Iter: %d, log[P(O|Theta)]: %f\\n\", s, log_likelihood);\n\n\t\t} while (s < maxIter);\n\n\t}", "public org.apache.spark.mllib.clustering.KMeansModel train (org.apache.spark.rdd.RDD<org.apache.spark.mllib.linalg.Vector> data, int k, int maxIterations, int runs, java.lang.String initializationMode) { throw new RuntimeException(); }", "private void initialize() {\r\n // init hidden layers\r\n for (int i = 0; i < neurons.length; i++) {\r\n for (int j = 0; j < neurons[i].length; j++) {\r\n // create neuron\r\n Neuron n = new Neuron(i, bias, this);\r\n neurons[i][j] = n;\r\n Log.log(Log.DEBUG, \"Adding Layer \" + (i + 1) + \" Neuron \" + (j + 1));\r\n }\r\n }\r\n }", "public void stopTrainingMode() {\n\t\t\r\n\t}", "@Test\n public void test23() throws Throwable {\n TextDirectoryLoader textDirectoryLoader0 = new TextDirectoryLoader();\n Instances instances0 = textDirectoryLoader0.getDataSet();\n Evaluation evaluation0 = new Evaluation(instances0);\n SerializedClassifier serializedClassifier0 = new SerializedClassifier();\n Object[] objectArray0 = new Object[25];\n double[] doubleArray0 = evaluation0.evaluateModel((Classifier) serializedClassifier0, instances0, objectArray0);\n assertEquals(0.0, evaluation0.SFEntropyGain(), 0.01D);\n }", "@Override\n\tpublic void train(DataSet data) {\n\t\tArrayList<Example> examples = data.getCopyWithBias().getData();\n\t\t// initialize both weight vectors with random values between -0.1 ad 0.1\n\t\tinitWeights(examples.size());\n\n\t\t// store outputs from forward calculation for each example\n\t\t// array will have size # examples.\n\t\tArrayList<Double> nodeOutputs = calculateForward(examples);\n\n\t\t// now take error and back-propagate from output to hidden nodes\n\n\t\tfor (int j = 0; j < examples.size(); j++) {\n\t\t\tExample ex = examples.get(j);\n\n\t\t\t// get hidden node outputs for single example\n\t\t\tfor (int num = 0; num < numHidden; num++) {\n\t\t\t\tArrayList<Double> h_outputs = hiddenOutputs.get(num);\n\t\t\t\tdouble vDotH = dotProduct(h_outputs, layerTwoWeights); // calculate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// v dot\n\t\t\t\t// h for\n\t\t\t\t// this node\n\n\t\t\t\tfor (int i = 0; i < numHidden - 1; i++) {\n\t\t\t\t\tdouble oldV = layerTwoWeights.get(i);\n\t\t\t\t\tdouble hk = h_outputs.get(i);\n\t\t\t\t\t// Equation describing line below:\n\t\t\t\t\t// v_k = v_k + eta*h_k(y-f(v dot h)) f'(v dot h)\n\t\t\t\t\tlayerTwoWeights.set(i, oldV + eta * hk * (ex.getLabel() - Math.tanh(vDotH)) * derivative(vDotH));\n\t\t\t\t}\n\n\t\t\t\tSet<Integer> features = ex.getFeatureSet();\n\t\t\t\tIterator<Integer> iter = features.iterator();\n\t\t\t\tArrayList<Double> featureVals = new ArrayList<Double>();\n\t\t\t\tfor (int f : features) {\n\t\t\t\t\tfeatureVals.add((double) f);\n\t\t\t\t}\n\n\t\t\t\t// take that error and back-propagate one more time\n\t\t\t\tfor (int x = 0; x < numHidden; x++) {\n\t\t\t\t\tArrayList<Double> initWeights = hiddenWeights.get(x);\n\t\t\t\t\t// List<Object> features =\n\t\t\t\t\t// Arrays.asList(ex.getFeatureSet().toArray());\n\n\t\t\t\t\t// for (int i = 0; i < featureVals.size()-1; i++) {\n\t\t\t\t\tdouble oldWeight = initWeights.get(j);\n\t\t\t\t\tdouble thisInput = ex.getFeature(featureVals.get(x).intValue());\n\t\t\t\t\t// w_kj = w_kj + eta*xj(input)*f'(w_k dot x)*v_k*f'(v dot\n\t\t\t\t\t// h)(y-f(v dot h))\n\t\t\t\t\tdouble updateWeight = oldWeight + eta * thisInput * derivative(dotProduct(featureVals, initWeights))\n\t\t\t\t\t\t\t* layerTwoWeights.get(x) * derivative(vDotH) * (ex.getLabel() - Math.tanh(vDotH));\n\t\t\t\t\tinitWeights.set(j, updateWeight);\n\t\t\t\t\t// }\n\t\t\t\t\thiddenWeights.set(x, initWeights); // update weights for\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// current\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// example\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}", "private void setWeight() {\n \tthis.trainWeight = (this.trainCars*TRAIN_WEIGHT) + (this.crew + this.numPassengers) * AVE_PASSENGER_WEIGHT;\n }", "public void checkTraining() {\r\n loadGenome();\r\n MLDataSet trainingSet;\r\n float sum = 0;\r\n try (Stream<Path> walk = Files.walk(Paths.get(\"check_train_data\"))) {\r\n\r\n List<String> result = walk.filter(Files::isRegularFile)\r\n .map(x -> x.toString()).collect(Collectors.toList());\r\n\r\n for (int i = 0; i < result.size(); i++) {\r\n trainingSet = new CSVNeuralDataSet(result.get(i), input, output, true);\r\n sum += network.calculateError(trainingSet);\r\n }\r\n System.out.println(\"Validation, Average error: \" + sum / result.size());\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n }", "@Test\n public void test22() throws Throwable {\n TextDirectoryLoader textDirectoryLoader0 = new TextDirectoryLoader();\n Instances instances0 = textDirectoryLoader0.getDataSet();\n Evaluation evaluation0 = new Evaluation(instances0);\n FastVector fastVector0 = evaluation0.predictions();\n assertEquals(0.0, evaluation0.SFEntropyGain(), 0.01D);\n }", "public void resetFactory() {\n\t\tcurrent = null;\n\t\tnb_rounds = 0;\n\t\tnb_to_train = 0;\n\t\twhile(!training_queue.isEmpty())\n\t\t\ttraining_queue.remove();\n\t}", "private void initKalman() {\n \tA = new Array2DRowRealMatrix(new double[] { 1d });\n \t// no control input\n \tRealMatrix B = null;\n \t// H = [ 1 ]\n \tH = new Array2DRowRealMatrix(new double[] { 1d });\n \t// Q = [ 0 ]\n \tRealMatrix Q = new Array2DRowRealMatrix(new double[] { 0 });\n \t// R = [ 0 ]\n \tRealMatrix R = new Array2DRowRealMatrix(new double[] { 0 });\n \t\n \tProcessModel pm\n \t = new DefaultProcessModel(A, B, Q, x, null);\n \tMeasurementModel mm = new DefaultMeasurementModel(H, R);\n \tfilter = new KalmanFilter(pm, mm);\n\t\t\n\t}", "public void reset() {\n this.predictor.reset();\n for(int i=0; i<this.predictedIntraday.length; i++) {\n this.predictedIntraday[i] = 0;\n }\n }", "public TargetGeneratorModel()\n {\n }", "@Test(timeout = 4000)\n public void test118() throws Throwable {\n TextDirectoryLoader textDirectoryLoader0 = new TextDirectoryLoader();\n Instances instances0 = textDirectoryLoader0.getStructure();\n Evaluation evaluation0 = new Evaluation(instances0);\n assertEquals(0.0, evaluation0.SFPriorEntropy(), 0.01);\n \n evaluation0.useNoPriors();\n assertEquals(Double.NaN, evaluation0.SFPriorEntropy(), 0.01);\n }", "private void setTrainingData() throws IOException {\r\n\t\ttrainIdBodyMap = readInIdBodiesMap(new File(TRAIN_BODIES_CSV_LOCATION));\r\n\t\ttrainStances = readStances(new File(TRAIN_STANCES_CSV_LOCATION));\r\n\r\n\t}" ]
[ "0.6923119", "0.6829311", "0.67274714", "0.6653585", "0.65485394", "0.65067893", "0.64625615", "0.644881", "0.6404668", "0.6317009", "0.63065046", "0.6293375", "0.61974907", "0.6167365", "0.61569905", "0.6144516", "0.604809", "0.603737", "0.60237736", "0.602343", "0.5999879", "0.5997981", "0.5994092", "0.59934026", "0.59882563", "0.59758127", "0.59732544", "0.5950061", "0.5941324", "0.59105104", "0.59032106", "0.5902504", "0.5897689", "0.58954287", "0.5889232", "0.5886922", "0.58710074", "0.5868269", "0.5859932", "0.5856134", "0.5839728", "0.5828191", "0.5811565", "0.5810793", "0.5791257", "0.57895935", "0.57893825", "0.5780603", "0.5761314", "0.57500523", "0.5739963", "0.5738932", "0.57373124", "0.5728926", "0.5727678", "0.5701777", "0.56973225", "0.5689807", "0.56721276", "0.5670624", "0.56665987", "0.56658775", "0.56503206", "0.5642539", "0.56233925", "0.5623006", "0.56162494", "0.5601402", "0.559583", "0.5595446", "0.55939174", "0.55812603", "0.558118", "0.55799437", "0.55765694", "0.5569064", "0.5563114", "0.55570275", "0.5547408", "0.55444986", "0.5542255", "0.5528967", "0.5522739", "0.5521044", "0.5518829", "0.55096763", "0.5501779", "0.54896754", "0.548388", "0.54725677", "0.54590744", "0.545236", "0.54372233", "0.54363674", "0.5435834", "0.5432073", "0.54269314", "0.5420389", "0.54181045", "0.54169697" ]
0.5813627
42
some utils Find the index which s_Ot > 0
public static int O_t(List<Integer> xs, List<double[]> L, TrainModel train_model) { int t = 0; for (int i = 0; i < L.size()-1; i++) { // Last element is the answer, so we can ignore that. if (train_model.s_Ot(xs, i, t, L) > 0) { t = i; } } return t; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int indexOf(Object o) {\n int current = 0;\n while (current < size && !(data[current].equals(o))) {\n ++current;\n }\n return current == size ? -1 : current;\n }", "protected int findNonEmptyPosition() {\n\t\t\twhile (!set.bv[++indice]) {\n\t\t\t}\n\t\t\treturn indice;\n\t\t}", "private int indexOf(SeqItem el)\n\t{\n\t\treturn indexOf((short)el.getIndex());\n\t}", "private int findIndexOfGivenObject(Object o) {\n\n for(int i = 0; i < size(); i++) {\n if(content[i].equals(o)) {\n return i;\n }\n }\n\n return -1;\n }", "int indexOfValue(java.lang.Object r7) {\n /*\n r6 = this;\n r0 = 1;\n r2 = com.google.android.gms.internal.zzkq.a;\n r1 = r6.mSize;\n r3 = r1 * 2;\n r4 = r6.mArray;\n if (r7 != 0) goto L_0x001d;\n L_0x000b:\n r1 = r0;\n L_0x000c:\n if (r1 >= r3) goto L_0x001b;\n L_0x000e:\n r5 = r4[r1];\t Catch:{ ClassCastException -> 0x0015 }\n if (r5 != 0) goto L_0x0017;\n L_0x0012:\n r0 = r1 >> 1;\n L_0x0014:\n return r0;\n L_0x0015:\n r0 = move-exception;\n throw r0;\n L_0x0017:\n r1 = r1 + 2;\n if (r2 == 0) goto L_0x000c;\n L_0x001b:\n if (r2 == 0) goto L_0x0030;\n L_0x001d:\n if (r0 >= r3) goto L_0x0030;\n L_0x001f:\n r1 = r4[r0];\t Catch:{ ClassCastException -> 0x002a }\n r1 = r7.equals(r1);\t Catch:{ ClassCastException -> 0x002a }\n if (r1 == 0) goto L_0x002c;\n L_0x0027:\n r0 = r0 >> 1;\n goto L_0x0014;\n L_0x002a:\n r0 = move-exception;\n throw r0;\n L_0x002c:\n r0 = r0 + 2;\n if (r2 == 0) goto L_0x001d;\n L_0x0030:\n r0 = -1;\n goto L_0x0014;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.google.android.gms.internal.zzlh.indexOfValue(java.lang.Object):int\");\n }", "@Override\n\t\tpublic int indexOf(Object o) {\n\t\t\treturn 0;\n\t\t}", "short get_OiListOffset(short oi, short type)\r\n {\r\n\r\n // Un qualifier\r\n if ((oi & COI.OIFLAG_QUALIFIER) != 0)\r\n {\r\n int q;\r\n for (q = 0; oi != qualifiers[q].qOi || type != qualifiers[q].qType; q++);\r\n return (short) (q | 0x8000);\r\n }\r\n // Un objet normal\r\n else\r\n {\r\n int n;\r\n for (n = 0; n < rhPtr.rhMaxOI && rhPtr.rhOiList[n].oilOi != oi; n++);\r\n return (short) n;\r\n }\r\n }", "protected int findIndex(A val) {\n int index = 0;\n boolean found = false;\n \n \n if (elems[0] == null || elems[0] == val){\n return index;\n }\n else{\n \n }\n \n \n\n return index; \n }", "@Override\n\t\tpublic int lastIndexOf(Object o) {\n\t\t\treturn 0;\n\t\t}", "@Override\n public int indexOf(Object o) {\n int result = -1;\n if (o == null) {\n for (int index = 0; index < this.size(); index++) {\n if (this.values[index] == null) {\n result = index;\n }\n }\n } else {\n for (int index = 0; index < this.size(); index++) {\n if (o.equals(this.values[index])) {\n result = index;\n }\n }\n }\n return result;\n }", "public int indexOf(O o)\r\n {\r\n VectorItem<O> vi = first;\r\n \r\n for (int i=0;i<=count-1;i++)\r\n {\r\n if (vi.getObject().equals(o)) return i;\r\n vi = vi.getNext();\r\n }\r\n return -1;\r\n }", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "private int getIndex(int u) {\n int ind = -1;\n for (int i = 0; i < getGraphRep().size(); i++) {\n ArrayList subList = getGraphRep().get(i);\n String temp = (String) subList.get(0);\n int vert = Integer.parseInt(temp);\n if (vert == u) {\n ind = i;\n }\n }\n return ind;\n }", "public int find(Object o) {\n int currentIndex = 0;\n int index = -1;\n ListNode current = start;\n while(current != null) {\n if (o.equals(current.data)) {\n index = currentIndex;\n break;\n }\n currentIndex++;\n current = current.next;\n }\n return index;\n }", "private int findPos( AnyType x )\n {\n int offset = 1;\n int currentPos = myhash( x );\n \n while( array[ currentPos ] != null &&\n !array[ currentPos ].key.equals( x ) )\n {\n currentPos += offset; // Linear probing.\n if( currentPos >= array.length )\n currentPos -= array.length;\n }\n \n return currentPos;\n }", "public int indexOf(K gesucht) {\r\n \r\n \t\tfor (int i=0;i<data.length;i++) {\r\n \t\t\tif(data[i] != null) { \r\n \t\t\t\tif(data[i].getKey().equals(gesucht)) { \r\n \t\t\t\t\treturn i;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\treturn -1;\r\n \r\n \t}", "public int indexOf(Object o) {\n\t\tfor(int i = 0; i < size; i++) {\r\n\t\t\tif(getNode(i).getData().equals(o))\r\n\t\t\t\treturn i;\r\n\t\t} return -1;\r\n\t}", "public int indexOf(klasse o) {\n if (EN > 0 && EN <= OLast && O[EN - 1].equals(o)) return EN - 1;\n if (Gap < 0) {\n for (int i = 0; i < OLast; i++) {\n if (O[i].equals(o)) return i;\n }\n return -1;\n }\n for (int i = 0; i < Gap; i++) {\n if (O[i].equals(o)) return i;\n }\n int k = Gap;\n for (int i = Gap; i < OLast; i++) {\n if (O[i] == null) continue;\n if (O[i].equals(o)) {\n Gap = k;\n return i;\n }\n O[k++] = O[i];\n O[i] = null;\n }\n ON = k;\n for (int i = k; i < OLast; i++) O[i] = null;\n Gap = -1;\n OLast = ON;\n return -1;\n }", "public int indexOf(Object o) {\r\n int index = 0;\r\n if (o == null) {\r\n for (Entry e = header.next; e != header; e = e.next) {\r\n if (e.element == null)\r\n return index;\r\n index++;\r\n }\r\n } else {\r\n for (Entry e = header.next; e != header; e = e.next) {\r\n if (o.equals(e.element))\r\n return index;\r\n index++;\r\n }\r\n }\r\n return -1;\r\n }", "public int findEmpty()\n\t{\n\t\temptyIndices.clear();\n\t\tfor (int i = 0; i < 20; i++)\n\t\t{\n\t\t\tif (river[i] == null)\n\t\t\t\temptyIndices.add(i);\n\t\t}\n\t\t\n\t\tif (emptyIndices.size() != 0){\n\t\t\treturn (int) emptyIndices.get(rng.nextInt(emptyIndices.size()));\n\t\t}\n\t\telse\n\t\t\treturn -1;\n\t}", "@Starts(\"nothing\")\r\n@Override\r\n public int lastIndexOf(Object o) {\r\n int i=0;\r\n int last = -1;\r\n for (ConsCell<T> p = head; p != null; p = p.cdr, ++i) {\r\n if (equals(o,p.car)) last = i;\r\n }\r\n return last;\r\n }", "@Override\n public int indexOf(Object o) {\n for (int i = 0; i < size; i++) {\n if (o.equals(data[i])) {\n return i;\n }\n }\n return -1;\n }", "private int findPos(String x) {\n\t int offset = 1;\n\t int currentPosition = myhash(x);\n\t \n\t while (array[currentPosition] != null && !array[currentPosition].element.getContent().equals(x)) {\n\t currentPosition += offset; // Compute ith probe\n\t offset += 2;\n\t if(currentPosition >= array.length)\n\t currentPosition -= array.length;\n\t }\n\t \n\t return currentPosition;\n\t }", "public int indexOf(Object o) {\n\t\treturn getFirstOccurrence(o).index;\n\t}", "@Override\n\tpublic int lastIndexOf(Object o) {\n\t\treturn 0;\n\t}", "private int getIndex(String rib){\n for (int i=0;i<ribSp.getCount();i++){\n if (ribSp.getItemAtPosition(i).toString().equalsIgnoreCase(rib)){\n return i;\n }\n }\n\n return 0;\n }", "public int indexOf(Object arg0) {\n\t\treturn 0;\n\t}", "protected int findPosKey(KeyType key) {\n int kthOddNumber = 1;\n int index = myHashKey(key);\n\n while ((mArray[index].state != EMPTY) &&\n (mArray[index].data.equals(key))) {\n index += kthOddNumber;\n kthOddNumber += 2;\n if (index >= mTableSize) {\n index -= mTableSize;\n }\n }\n return index;\n }", "private String findIndexOfI (Comparable<E> item) {\n String compareString = item.toString();\n for (int i = 0; i < data.length; i++) {\n if (data[i].toString().equals(item)) {\n return data[i].toString();\n } else {\n String compareSecond = compareString.substring(2, 3);\n if (data[i].toString().substring(2, 3).equals(compareSecond)) {\n return data[i].toString();\n }\n\n }\n }\n return (\"failed to find\");\n }", "private static <V> int buscarPosicion(V pValue, V[] pArray) {\n for (int x = 0; x < pArray.length; x++) {\n if (pArray[x].equals(pValue)) {\n return x;\n }\n }\n return -1;\n }", "public int lastIndexOf(Object o) {\n\t\tint index = -1;\r\n\t\tfor(int i = 0; i < size; i++) {\r\n\t\t\tif(getNode(i).getData().equals(o))\r\n\t\t\t\tindex = i;\r\n\t\t} return index;\r\n\t}", "@Override\r\n\tpublic int locsearch(FoodshopVO vo) {\n\t\treturn 0;\r\n\t}", "public int linSearch(Comparable c){\n\tfor (int i = 0; i < _size;i++){\n\t if (c.compareTo(_data[i]) == 0){\n\t\treturn i;\n\t }\n\t}\n\treturn -1;\n }", "@Override\n public int lastIndexOf(Object o) {\n for (int i = size - 1; i >= 0; i++) {\n if (o.equals(data[i])) {\n return i;\n }\n }\n return -1;\n }", "private Integer serialSearch() {\n int currentIndex = startIndex;\n for (int i = start; i < end; i++) {\n if (this.searchIndex == currentIndex) {\n return currentIndex;\n }\n currentIndex++;\n }\n return 0;\n }", "@Override\n\tpublic int findItemPosition(Object arg0) {\n\t\treturn 0;\n\t}", "public int getIndex();", "public int getIndex();", "public int getIndex();", "@Test\n public void testIndexOf_Overflow() {\n SegmentedOasisList<Integer> instance = new SegmentedOasisList<>(2, 2);\n Collection c = Arrays.asList(1, 1, 7, 7, 1, 1, 1);\n instance.addAll(c);\n Integer arg = 7;\n\n int result = instance.indexOf(arg);\n int expResult = 2;\n\n assertEquals(expResult, result);\n\n }", "int indexOf(GeometricalObject object);", "private static int getSlotIndex(int par0, int par1)\n {\n return par0 & par1 - 1;\n }", "protected int find_by_index(DateTime dt){\r\n int in = 0;\r\n int l = this.candles.length;\r\n for(int i=0; i < l; i++){\r\n if (this.candles[i].getDT().isLower(dt) || this.candles[i].getDT().isEqual(dt)){\r\n in++;\r\n }\r\n }\r\n if (this.candles[in-1].getDT().isLower(dt)){\r\n return in-1;\r\n } else {\r\n return in;\r\n }\r\n }", "private int getLine ( String toSearch , int elsegmento )\r\n\t{\r\n\t\tfor ( int i = 0 ; i < cont[elsegmento] ; i++ )\r\n\t\t{\r\n\t\t\tStringTokenizer st = new StringTokenizer ( segmento[elsegmento][i],\":\" );\r\n\t\t\tif ( st.countTokens() > 1 )\r\n\t\t\t{\r\n\t\t\t\tString label = st.nextToken().trim();\r\n\t\t\t\tif ( label.equalsIgnoreCase(toSearch) ) return i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}", "@Test\n public void testIndexOf() {\n SegmentedOasisList<Integer> instance = new SegmentedOasisList<>();\n Collection c = Arrays.asList(1, 1, 7, 7, 1, 1, 1);\n instance.addAll(c);\n Integer arg = 7;\n\n int result = instance.indexOf(arg);\n int expResult = 2;\n\n assertEquals(expResult, result);\n\n }", "@Override\n public int indexOf(T t) {\n Integer p = cells.get(t);\n return p == null ? -1 : p;\n }", "short qual_GetFirstOiList(short o)\r\n {\r\n if ((o & 0x8000) == 0)\r\n {\r\n qualOilPtr = -1;\r\n return (o);\r\n }\r\n if (o == -1)\r\n {\r\n return -1;\r\n }\r\n\r\n o &= 0x7FFF;\r\n qualOilPtr = o;\r\n qualOilPos = 0;\r\n return qual_GetNextOiList();\r\n }", "public int indexOf(Object o) {\r\n\t\tfor(int i=0; i < size();i++) {\r\n\t\t\tif(get(i).equals(o)) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t\t/*\r\n\t\t * Der Rückgabewert -1 bedeutet, dass das Object o nicht\r\n\t\t * im FancyArray enthalten ist :(\r\n\t\t */\r\n\t}", "private int findIndex(String value) {\n\tint index = 0;\n\tfor (int i = 0; i < getData().length && index == 0;) {\n\t if (value.compareTo(getData()[i]) <= 0) {\n\t\tindex = i;\n\t }\n\t else {\n\t\ti++;\n\t }\n\t}\n\treturn index;\n }", "@SuppressWarnings(\"unchecked\") // stops Java complaining about the call to compare\n private int findIndexOf(Comparable<E> item) {\n if (count == 0) { //this is where the binary search happens that reduces the time and computational power it takes to search the collection\n return count; // if count == 0 it returns the count variable to break the loop and show that the collection is empty\n }\n int low = 0; //Sets up three variables to keep track of the start and end values of index and the middle of the collection, this helps\n int high = count - 1; //the search algorithm becase the array always knows where the middle is and so the collection can contnually half using the three\n int mid; //variables to find a single value, while the low is less or equal to the high variable,\n while (low <= high) {\n\n mid = (low + high) / 2;\n\n int compareValue = item.compareTo(data[mid]); // the value we are trying to find\n if (compareValue == 0) return mid; //returns the middle value,\n if (compareValue > 0) low = mid + 1; //if greater than it changes low value to equal the middle, plus one(as mid is already checked)\n else high = mid - 1; //else it changes to the lower half of the collecton to search there.\n }\n return low; //Hopefully if found it will then return low,\n }", "public int lastIndexOf(Object o) {\r\n int index = size;\r\n if (o == null) {\r\n for (Entry e = header.previous; e != header; e = e.previous) {\r\n index--;\r\n if (e.element == null)\r\n return index;\r\n }\r\n } else {\r\n for (Entry e = header.previous; e != header; e = e.previous) {\r\n index--;\r\n if (o.equals(e.element))\r\n return index;\r\n }\r\n }\r\n return -1;\r\n }", "private int searchCurrentWord() {\n\n\n int tmpsize2;\n\n\n boolean sw2 = false;\n\n\n boolean retour = false;\n\n\n boolean sw = false;\n\n\n int sub_end = parent.getTextGrp_TField_affiche().length();\n\n\n int size = parent.data.size();\n\n\n int tmpsize = parent.position.size();\n\n\n int i = 0;\n\n\n String TfieldParse;\n\n\n int test = 0;\n\n\n String text = parent.getTextGrp_TField_affiche();\n\n\n System.out.println(\"size de parent.position :\" + tmpsize);\n\n\n String str;\n\n\n String tmpstring;\n\n\n Object[] obj;\n\n\n Object tmpobj;\n\n\n String transMaj1 = null;\n\n\n String transMaj2 = null;\n\n\n tmpobj = parent.position.get(tmpsize - 1);\n\n\n tmpstring = tmpobj.toString();\n\n\n i = Integer.parseInt(tmpstring);\n\n\n retour = verifBorne();\n\n\n if (retour == true) {\n\n\n do {\n\n\n str = getObjectInArray(i, 1, parent.data).toString();\n\n // obj = (Object[]) parent.data.get(i);\n\n //str = (String) obj[1];\n\n\n tmpsize2 = str.length();\n\n\n if (tmpsize2 < sub_end) {\n\n\n TfieldParse = str;\n\n\n i++;\n\n\n sw = false;\n\n\n } else\n\n\n {\n\n\n TfieldParse = str.substring(0, sub_end);\n\n\n }\n\n\n transMaj1 = TfieldParse.toUpperCase();\n\n\n transMaj2 = text.toUpperCase();\n\n\n test = transMaj2.compareTo(transMaj1);\n\n\n if (sw == true && test != 0) {\n\n\n i++;\n\n\n }\n\n\n sw = true;\n\n\n }\n\n\n while (i < size && test > 0);\n\n\n if (transMaj2.compareTo(transMaj1) == 0) {\n\n\n if (i != 0)\n\n\n parent.position.add(new Integer(i));\n\n\n parent.setRowSelectionIntervalGrp_Table_Affiche(i, i);\n\n\n parent.scrollRectToVisibleGrp_table_Affiche(new java.awt.Rectangle(0, parent.getGrp_Table_Affiche().getRowHeight() * i, 20, parent.getGrp_Table_Affiche().getRowHeight()));\n\n\n } else {\n\n\n parent.setTextGrp_TField_affiche(this.tmpText);\n\n\n }\n\n\n }\n\n\n return (i - 1);\n\n\n }", "Integer find(Object[] o){\n\t try {\n\t\t\n\t ResultSet rs = SQLBot.bot.query(\"SELECT ID FROM Contracts WHERE Start_Date='\"+o[sd]+\n\t\t\t\t\t \"' AND abs(\"+sqlCol+\"-\"+o[tc]+\") <= 0.001\");\n\t //System.out.println(\"SELECT Customer_ID FROM Contracts WHERE Start_Date='\"+o[sd]+\n\t //\t\t \"' AND abs(\"+sqlCol+\"-\"+o[tc]+\") <= 0.001\");\n\t //check if it matches name\n\t ArrayList<Integer> acc = new ArrayList<Integer>();\n\t while(rs.next()){\n\t\tacc.add(rs.getInt(1));}\n\n\t for (int val: acc) if (nameMatch(val, (String)o[fn], (String)o[ln])) return val;\n\n\t } catch (Exception e){e.printStackTrace();}\n\t return null;\n\t}", "String getFirstIndex();", "private int indexValue(String value) {\n int loc = openHashCode(value);\n //if the searchVal exist\n if (this.openHashSetArray[loc] == null||!this.openHashSetArray[loc].myList.contains(value))\n return -1;\n else\n return loc;\n\n }", "private int findIndexOfMax(){\n\t\tint value=0;\n\t\tint indexlocation=0;\n\t\tfor(int i=0; i<myFreqs.size();i++){\n\t\t\tif(myFreqs.get(i)>value){\n\t\t\t\tvalue = myFreqs.get(i);\n\t\t\t\tindexlocation =i;\n\t\t\t}\n\t\t}\n\t\treturn indexlocation;\n\t}", "@Test\n public void testSingleErrorDetectingOn0thPosition() {\n final int[] msgWithError = {1,0,1,0, 1,0,1,1, 1,0,0,0, 1,1,1,0};\n final int expectedErrorIndex = 0;\n\n // When executing error detection\n final int errorIndex = HammingAlgorithm.calculateErrorIndex(msgWithError);\n\n // Then check if errorIndex is as expected\n assertThat(errorIndex).isEqualTo(expectedErrorIndex);\n }", "@Override\n\tpublic int findIdPosition(Object arg0) {\n\t\treturn 0;\n\t}", "public int indexOf(Object otherData) {\r\n return -1; //returns -1 cause there are no indexes\r\n }", "public int indexOf(T e){\n for(int i = 0; i < size; i++){\n if(e.equals(data[i])){\n return i;\n }\n }\n return -1;\n }", "public int indexOf(Object o);", "int missingWatchpointIndexOf(Watch[] a)\n\t{\n\t\tint size = watchpointCount();\n\t\tint at = -1;\n\t\tfor(int i=0; i<size && at<0; i++)\n\t\t{\n\t\t\tWatchAction action = watchpointAt(i);\n\t\t\tWatch w = action.getWatch();\n\t\t\t\n\t\t\t// now scan the list of watches looking for a hit\n\t\t\tint hit = -1;\n\t\t\tfor(int j=0; j<a.length && hit<0; j++)\n\t\t\t{\n\t\t\t\tif (w == a[j])\n\t\t\t\t\thit = j;\n\t\t\t}\n\n\t\t\t// can't find the watch object corresponding to our\n\t\t\t// watchpoint in list of session watches.\n\t\t\tif (hit < 0)\n\t\t\t\tat = i;\n\t\t}\n\n\t\treturn at;\n\t}", "public int indexOf(Type t);", "public int indexOf(Fraction x)\r\n\t{\r\n\t\tfor(int i=0;i<n;i++)\r\n\t\t\tif(x.gettu()==a[i].gettu() && x.getmau()==a[i].getmau())\r\n\t\t\t\treturn i;\r\n\t\treturn -1;\r\n\t}", "public int getIndex0 () {\r\n\t\treturn _index0;\r\n\t}", "private int c(alq paramalq)\r\n/* 30: */ {\r\n/* 31: 52 */ for (int i = 0; i < this.a.length; i++) {\r\n/* 32: 53 */ if ((this.a[i] != null) && (this.a[i].b() == paramalq)) {\r\n/* 33: 54 */ return i;\r\n/* 34: */ }\r\n/* 35: */ }\r\n/* 36: 57 */ return -1;\r\n/* 37: */ }", "public int j()\r\n/* 60: */ {\r\n/* 61: 79 */ for (int i = 0; i < this.a.length; i++) {\r\n/* 62: 80 */ if (this.a[i] == null) {\r\n/* 63: 81 */ return i;\r\n/* 64: */ }\r\n/* 65: */ }\r\n/* 66: 84 */ return -1;\r\n/* 67: */ }", "private int searchPosition(int num, int index){\n\n\t\tif(getBoxs().get(index).getNumBoxInt() == num){\n return getBoxs().indexOf(getBoxs().get(index));\n\n }else{\n return searchPosition(num, index + 1);\n\n }\n\t\t\t\n\t\t\n\t}", "boolean hasIndex();", "boolean hasIndex();", "boolean hasIndex();", "boolean hasIndex();", "boolean hasIndex();", "boolean hasIndex();", "public int indexOf(Object o) {\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\t// if o is null we check against null else use equals\n\t\t\tif (o == null ? array[i] == null : o.equals(array[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int getIndex()\n/* */ {\n/* 46 */ return this.index;\n/* */ }", "protected final int internalFind(int paramInt)\n/* */ {\n/* 200 */ int i = computeSlot(paramInt);\n/* 201 */ while (this.m_flagTable[i] != false) {\n/* 202 */ if (paramInt == this.m_keyTable[i]) {\n/* 203 */ return i;\n/* */ }\n/* 205 */ i = stepSlot(i);\n/* */ }\n/* 207 */ return -i - 1;\n/* */ }", "public int lastIndexOf(Object o) {\n\t\tfor (int i = size - 1; i >= 0; i--) {\n\t\t\t// if o is null we check against null else use equals\n\t\t\tif (o == null ? array[i] == null : o.equals(array[i])) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "int index();", "public int getIndex() {\n\t\treturn 0;\n\t}", "@SuppressWarnings(\"unchecked\")\r\n\tprivate int retornaPosicaoCombo(MarcaEquipamento me){\r\n\t\tposicao = -1;\r\n\t\tArrayAdapter<MarcaEquipamento> comboAdapter = (ArrayAdapter<MarcaEquipamento>) comboMarca.getAdapter(); \r\n\t\tfor (int i = 0; i < comboAdapter.getCount(); i++) {\r\n\t\t\tif(comboAdapter.getItem(i).getCodigo() == me.getCodigo()){\r\n\t\t\t\tposicao = i;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn posicao;\r\n\t}", "public int indexOf()\n {\n\treturn indexOfValue(mValue);\n }", "short getFirstOpenIndexInArgument(UUID id);", "public abstract long getIndex();", "public int indexOf(GeometricalObject object);", "public int lastIndexOf(Object arg0) {\n\t\treturn 0;\n\t}", "public int indexOf(Object o) {\n int index = -1;\n for(int i = 0; i < size; i++) {\n if(list[i].equals(o)) {\n index = i; break;\n }\n }\n return index;\n }", "public abstract int indexOf(E e);", "static int evalPos(char[][] b) {\n\t\t\n\t\t// Check for rows X or O victory\n\n\t\tfor (int row = 0; row < 3; row++) {\n\n\t\t\tif (b[row][0] == b[row][1] && b[row][0] == b[row][2]) {\n\n\t\t\t\tif (b[row][0] == 'X') {\n\t\t\t\t\treturn +10;\n\t\t\t\t}\n\n\t\t\t\telse if (b[row][0] == 'O') {\n\t\t\t\t\treturn -10;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// check for columns X or O victory\n\n\t\tfor (int col = 0; col < 3; col++) {\n\n\t\t\tif (b[0][col] == b[1][col] && b[1][0] == b[2][col]) {\n\n\t\t\t\tif (b[0][col] == 'X') {\n\t\t\t\t\treturn +10;\n\t\t\t\t}\n\n\t\t\t\telse if (b[0][col] == 'O') {\n\t\t\t\t\treturn -10;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// check for diagonals of X or O victory\n\n\t\tif (b[0][0] == b[1][1] && b[1][1] == b[2][2]) {\n\n\t\t\tif (b[0][0] == 'X') {\n\t\t\t\treturn +10;\n\t\t\t}\n\n\t\t\telse if (b[0][0] == 'O') {\n\t\t\t\treturn -10;\n\t\t\t}\n\n\t\t\tif (b[0][2] == b[1][1] && b[1][1] == b[2][0]) {\n\n\t\t\t\tif (b[0][2] == 'X') {\n\t\t\t\t\treturn +10;\n\t\t\t\t}\n\n\t\t\t\telse if (b[0][2] == 'O') {\n\t\t\t\t\treturn -10;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}" ]
[ "0.649414", "0.6198929", "0.6190638", "0.61551946", "0.6124671", "0.60406655", "0.5995661", "0.58864284", "0.5830195", "0.58077395", "0.57995474", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.57970595", "0.5789995", "0.57764226", "0.57582426", "0.5714135", "0.568018", "0.56759256", "0.56677294", "0.5656457", "0.56534934", "0.56528634", "0.5648503", "0.5645724", "0.56397176", "0.56198984", "0.5599189", "0.5596075", "0.55895424", "0.5581271", "0.5577274", "0.5575778", "0.55721724", "0.5560236", "0.55558664", "0.55517507", "0.553643", "0.553643", "0.553643", "0.5497159", "0.54923403", "0.549232", "0.5482618", "0.5482575", "0.5473263", "0.5467581", "0.5466413", "0.5460426", "0.5459196", "0.5454724", "0.54537445", "0.54512376", "0.5439791", "0.5427062", "0.541908", "0.54179496", "0.5410448", "0.5405686", "0.5405451", "0.5399712", "0.5380517", "0.5373145", "0.5370964", "0.5369102", "0.53690046", "0.536708", "0.53598803", "0.53531885", "0.5347221", "0.5347221", "0.5347221", "0.5347221", "0.5347221", "0.5347221", "0.53447443", "0.53420323", "0.5341876", "0.5341499", "0.5336405", "0.5334152", "0.53248626", "0.5324058", "0.5321562", "0.531947", "0.53183633", "0.5314916", "0.5314185", "0.53127396", "0.5304566" ]
0.0
-1
Created by cheng on 2018/12/14.
@Transactional public interface OperationDaoI extends BaseDaoI<Operation> { void saveOperation(Operation operation); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "private stendhal() {\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "private static void cajas() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n protected void initialize() {\n\n \n }", "private void poetries() {\n\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "private void strin() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "private void init() {\n\n\t}", "@Override\n void init() {\n }", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\n public void init() {\n }", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "private void kk12() {\n\n\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\n protected void getExras() {\n }", "public void mo38117a() {\n }", "public void mo4359a() {\n }", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "private void init() {\n\n\n\n }", "private void m50366E() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n protected void init() {\n }", "@Override\n\tpublic void init()\n\t{\n\n\t}", "@Override\n public void init() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n public void initialize() { \n }", "protected boolean func_70814_o() { return true; }", "@Override\n public void settings() {\n // TODO Auto-generated method stub\n \n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void init() {\n\t}", "@Override\r\n\tpublic void init() {}", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "public void mo6081a() {\n }", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "@Override\n\tpublic void postInit() {\n\t\t\n\t}", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tprotected void doF8() {\n\t\t\r\n\t}" ]
[ "0.6085042", "0.587569", "0.5869949", "0.58669454", "0.58119386", "0.58119386", "0.5806678", "0.57741314", "0.5754362", "0.5690324", "0.56713986", "0.5665702", "0.56610036", "0.5651978", "0.56490844", "0.5643421", "0.5624007", "0.56164205", "0.5615466", "0.55998397", "0.559576", "0.5586844", "0.55442953", "0.55395305", "0.55395305", "0.55395305", "0.55395305", "0.55395305", "0.5525393", "0.55231315", "0.55205", "0.5512538", "0.5503442", "0.5498735", "0.5498735", "0.54984903", "0.54945314", "0.5486741", "0.5480953", "0.5480953", "0.54690945", "0.546538", "0.54611975", "0.54611975", "0.54611975", "0.5442087", "0.54369646", "0.5434144", "0.54340196", "0.5425545", "0.5425545", "0.5425545", "0.541242", "0.5411246", "0.5400945", "0.5400945", "0.5400945", "0.5400945", "0.5400945", "0.5400945", "0.5400755", "0.53991985", "0.53991985", "0.53991985", "0.539575", "0.539552", "0.53832436", "0.5375016", "0.5374423", "0.5374423", "0.5367632", "0.5363182", "0.53483707", "0.5344553", "0.53379864", "0.53372216", "0.5331113", "0.5325378", "0.53249073", "0.5320692", "0.5320692", "0.5320692", "0.5320692", "0.5320692", "0.5320692", "0.5320692", "0.531158", "0.5306351", "0.5300077", "0.5300077", "0.5295955", "0.52947825", "0.5293206", "0.5293068", "0.52890515", "0.5276138", "0.526998", "0.526559", "0.52644444", "0.52583694", "0.5257885" ]
0.0
-1
Constructor used by the decorator
public Vigenere(EncryptionDecorator encrypt) { algo = encrypt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Constructor(){\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "private Instantiation(){}", "public ContentDecorator() {\r\n super();\r\n }", "public Clade() {}", "private ChainingMethods() {\n // private constructor\n\n }", "public ProductDecorator() {}", "protected abstract void construct();", "private Infer() {\n\n }", "Reproducible newInstance();", "private void __sep__Constructors__() {}", "defaultConstructor(){}", "private TMCourse() {\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "private Solution() {\n /**.\n * { constructor }\n */\n }", "protected Doodler() {\n\t}", "@Override\n\t\tpublic void init() {\n\t\t}", "@Override\n public void init() {}", "protected Alias() {\n }", "private Cat() {\n\t\t\n\t}", "public PSRelation()\n {\n }", "@Override\r\n\tpublic void init() {}", "private LOCFacade() {\r\n\r\n\t}", "public CacheTracabilityFactoryImpl() {\n\t\tsuper();\n\t}", "public MethodEx2() {\n \n }", "public Function() {\r\n\r\n\t}", "public Scriptable construct(Context cx, Scriptable scope, Object[] args);", "protected IPCGCallDetailCreator()\r\n {\r\n // empty\r\n }", "public Lanceur() {\n\t}", "private FactoryCacheValet() {\n\t\tsuper();\n\t}", "@Override\n void init() {\n }", "public ParameterizedInstantiateFactory() {\r\n super();\r\n }", "public Aanbieder() {\r\n\t\t}", "public BStarTokenMaker() {\n\t\tsuper();\n\t}", "@Override\n protected void init() {\n }", "public Activator() {\r\n\t}", "private ClassProxy() {\n }", "public Identity()\n {\n super( Fields.ARGS );\n }", "public RequestAttribute() {\n }", "@Override\n public void init() {\n }", "private void translateConstructor( ) {\n \n Set<MethodInfoFlags> flags = EnumSet.noneOf( MethodInfoFlags.class );\n \n AVM2Method method = new AVM2Method( null, flags );\n avm2Class.avm2Class.constructor = method;\n \n AVM2MethodBody body = method.methodBody;\n body.maxStack = 1;\n body.maxRegisters = 1;\n body.maxScope = 11;\n body.scopeDepth = 10;\n \n InstructionList il = body.instructions;\n \n// il.append( OP_getlocal0 );\n// il.append( OP_pushscope );\n il.append( OP_getlocal0 );\n il.append( OP_constructsuper, 0 );\n \n// il.append( OP_findpropstrict, new AVM2QName( PUBLIC_NAMESPACE, \"drawTest\" ));\n il.append( OP_getlocal0 );\n \n il.append( OP_callpropvoid, new AVM2QName( EmptyPackage.namespace, \"drawTest\" ), 0 );\n\n il.append( OP_returnvoid );\n }", "private Supervisor() {\r\n\t}", "private Composite() {\n }", "private Notifier(){}", "@Override public void init()\n\t\t{\n\t\t}", "private BeanAnnotationUtils()\n\t{\n\t\tsuper();\n\t}", "private FlexOrderTransformer() {\n // constructor preventing instantiation.\n }", "private StrategyChainBuilder() {\n\t}", "@Override\n public void init() {\n }", "public TemplexTokenMaker() {\r\n\t\tsuper();\r\n\t}", "protected ModelAgent ()\n {\n this (\"ModelAgent\");\n\n }", "public Factory() {\n\t\tsuper();\n\t}", "private RegressionPrior() { \n /* empty constructor */\n }", "public ThisKeyword(){\n this(1.0);\n }", "@Override // opcional\n public void init(){\n\n }", "public Implementor(){}", "private DataClayMockObject() {\n\n\t}", "private Template() {\r\n\r\n }", "public SgaexpedbultoImpl()\n {\n }", "private TesteeAttributeIdentity() {\n }", "protected Depot() {\n\t\tthis(null);\n\t}", "public PipelineImpl() {\n }", "public Cohete() {\n\n\t}", "protected Approche() {\n }", "private Marinator() {\n }", "private Marinator() {\n }", "public CacheFIFO()\r\n/* 16: */ {\r\n/* 17: 95 */ this(20);\r\n/* 18: */ }", "public Climber(){\n\t\tinst = this;\n\t}", "public LambdaMART() {}", "private Rekenhulp()\n\t{\n\t}", "protected TaskChain() {\n\t}", "public Dependency() \r\n {\r\n }", "private SimpleRepository() {\n \t\t// private ct to disallow external object creation\n \t}", "private StickFactory() {\n\t}", "@Override\n public void init() {\n\n }", "protected IRFunctional() {\n _name = null;\n _params = null;\n _args = null;\n _fds = null;\n _vds = null;\n _body = null;\n }", "private EagerlySinleton()\n\t{\n\t}", "private Builder() {\n\t\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "private ServiceGenerator() {\n }", "private Converter()\n\t{\n\t\tsuper();\n\t}", "private Ex() {\n }", "public Generic(){\n\t\tthis(null);\n\t}", "@Override\n public void construct() throws IOException {\n \n }", "public Chick() {\n\t}", "private void addConstructors() {\n\t\tthis.rootBindingClass.getConstructor().body.line(\"super({}.class);\\n\", this.name.getTypeWithoutGenerics());\n\t\tGMethod constructor = this.rootBindingClass.getConstructor(this.name.get() + \" value\");\n\t\tconstructor.body.line(\"super({}.class);\", this.name.getTypeWithoutGenerics());\n\t\tconstructor.body.line(\"this.set(value);\");\n\t}", "private CustomerReader()\r\n\t{\r\n\t}", "private Processor()\n {\n super(providerName+\"ProxyProcessor\");\n }", "public CSSTidier() {\n\t}", "private ATCres() {\r\n // prevent to instantiate this class\r\n }", "private SingleObject()\r\n {\r\n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "public ClazzDslFactoryImpl()\n {\n super();\n }", "public AccessPoint() {\n }", "private Logistic() {\n }", "private MatterAgentClient() {}", "public ObjectFactory() {\n\t}", "public Parameters() {\n\t}" ]
[ "0.6830426", "0.6747362", "0.6682747", "0.6647739", "0.66349095", "0.66231567", "0.6621666", "0.6545452", "0.65358424", "0.6411604", "0.6404389", "0.63977295", "0.63750124", "0.6370328", "0.63470036", "0.6332848", "0.63085896", "0.6306608", "0.62855923", "0.62719053", "0.62662786", "0.62591547", "0.62458324", "0.62351936", "0.6212236", "0.6201811", "0.61941034", "0.61923885", "0.61830574", "0.6181628", "0.6180426", "0.61739266", "0.61718786", "0.6164965", "0.6161828", "0.61595464", "0.6157236", "0.61519474", "0.6148272", "0.6146859", "0.6144462", "0.61444336", "0.61429304", "0.6139647", "0.61383", "0.61374825", "0.6137409", "0.61292523", "0.6110956", "0.6108882", "0.6105372", "0.6102834", "0.6100596", "0.6098468", "0.6094156", "0.60908777", "0.60892785", "0.60871744", "0.6080616", "0.6072941", "0.6070408", "0.60672814", "0.6062376", "0.60545486", "0.6050866", "0.6050866", "0.6050619", "0.6048894", "0.6047637", "0.6044821", "0.60447073", "0.6041498", "0.6038914", "0.6034889", "0.6022856", "0.60216814", "0.6021223", "0.60191184", "0.60166717", "0.60166717", "0.60166717", "0.6014729", "0.6012374", "0.6011751", "0.6011493", "0.60102606", "0.6003702", "0.59997356", "0.5997839", "0.59967995", "0.5995403", "0.599475", "0.5994701", "0.5994481", "0.5994481", "0.5990858", "0.5990782", "0.59899616", "0.5987351", "0.5986349", "0.5985947" ]
0.0
-1
Encrypt the value using the key Decorator function
@Override public void encrypt() { algo.encrypt(); String cypher = vigenereAlgo(true); this.setValue(cypher); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void Encrypt(Object key) {\n\n\t}", "Encryption encryption();", "String encryption(Long key, String encryptionContent);", "public EncryptorReturn encrypt(String in) throws CustomizeEncryptorException;", "public String encrypt(final String value) {\n\t\treturn encryptor.encrypt(value);\n\t}", "public String encrypt(String value) throws Exception \n\t{\n\t\treturn value;\n\t}", "public String encrypt() {\n StringBuilder encryptedText = new StringBuilder();\n //Make sure the key is valid.\n if (key < 0 || key > 25) {\n Log.d(\"TAG\", \"encrypt: Error in Keu=y \");\n return \"Key Must be 0 : 25\";\n }\n if (plaintext.length() <= 0) {\n Log.d(\"TAG\", \"encrypt: Error in Plain\");\n return \"Error in Plaintext\";\n }\n //Eliminates any whitespace and non alpha char's.\n plaintext = plaintext.trim();\n plaintext = plaintext.replaceAll(\"\\\\W\", \"\");\n if (plaintext.contains(\" \")) {\n plaintext = plaintext.replaceAll(\" \", \"\");\n }\n //Makes sure that all the letters are uppercase.\n plaintext = plaintext.toUpperCase();\n Log.i(\"Caesar\", \"encrypt: plainis : \" + plaintext);\n for (int i = 0; i < plaintext.length(); i++) {\n char letter = plaintext.charAt(i);\n if (charMap.containsKey(letter) && charMap.get(letter) != null) {\n int lookUp = (charMap.get(letter) + key) % 26;\n encryptedText.append(encryptionArr[lookUp]);\n }\n }\n Log.d(\"Caesar.java\", \"encrypt: the Data is \" + encryptedText.toString());\n return encryptedText.toString();\n }", "private String encrypt(SecretKey key, String value) {\n\t\ttry {\n\n\t\t\tCipher cipher = Cipher.getInstance(\"AES\");\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, key);\n\n\t\t\tbyte[] encrypted = cipher.doFinal(value.getBytes());\n\t\t\treturn Base64.encodeBase64String(encrypted);\n\t\t} catch (InvalidKeyException | NoSuchAlgorithmException | BadPaddingException | IllegalBlockSizeException\n\t\t\t\t| NoSuchPaddingException ex) {\n\t\t\tSystem.out.println(ex.getMessage());\n\t\t}\n\n\t\treturn null;\n\t}", "public String encryptAsNeeded(final String value) {\n\t\ttry {\n\t\t\t// Try a decryption\n\t\t\tdecrypt(value);\n\n\t\t\t// Value is already encrypted\n\t\t\treturn value;\n\t\t} catch (final EncryptionOperationNotPossibleException ignored) {\n\t\t\t// This value could be encrypted, but was not\n\t\t\treturn encrypt(value);\n\t\t}\n\t}", "private static String getEncryptedKey(String key) {\r\n\t\ttry {\r\n\t\t\treturn SimpleCrypto.encrypt(SimpleCrypto.getDeviceSeed(ctx), key);\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\tthrow new AndroidRuntimeException(\"Could not encrypt preference key\");\r\n\t\t}\r\n\t}", "Update withEncryption(Encryption encryption);", "public String encrypt(String value) throws Exception\n {\n if ( key == null )\n {\n throw new Exception(\"CodecUtil must be initialised with the storeKey first.\");\n }\n try\n {\n Cipher pbeCipher = Cipher.getInstance(\"PBEWithMD5AndDES\");\n pbeCipher.init(Cipher.ENCRYPT_MODE, key, new PBEParameterSpec(salt, 20));\n return base64Encode(pbeCipher.doFinal(value.getBytes(\"UTF-8\")));\n }\n catch (Exception e)\n {\n throw new Exception(\"Encryption error :\" + e.getMessage());\n }\n }", "public CaesarCipherOne(int key) {this.key=key;}", "@Test\r\n public void testEncrypt()\r\n {\r\n System.out.println(\"encrypt\");\r\n String input = \"Hello how are you?\";\r\n KeyMaker km = new KeyMaker();\r\n SecretKeySpec sks = new SecretKeySpec(km.makeKeyDriver(\"myPassword\"), \"AES\");\r\n EncyptDecrypt instance = new EncyptDecrypt();\r\n String expResult = \"0fqylTncsgycZJQ+J5pS7v6/fj8M/fz4bavB/SnIBOQ=\";\r\n String result = instance.encrypt(input, sks);\r\n assertEquals(expResult, result);\r\n }", "public void testCaesar(){\n String msg = \"At noon be in the conference room with your hat on for a surprise party. YELL LOUD!\";\n \n /*String encrypted = encrypt(msg, key);\n System.out.println(\"encrypted \" +encrypted);\n \n String decrypted = encrypt(encrypted, 26-key);\n System.out.println(\"decrypted \" + decrypted);*/\n \n \n String encrypted = encrypt(msg, 15);\n System.out.println(\"encrypted \" +encrypted);\n \n }", "String encryptHiddenField(String value) throws EncryptionException;", "public interface EncryptionService {\n\n String decryptValue(String encrypted);\n String encryptValue(String value, String userName);\n}", "private String key() {\n return \"secret\";\n }", "public String encrypt() throws LRException\n\t{\n\t\treturn LUEncrypt.encrypt(getFields(),\n\t\t\t((DataHRecordData)getData()).encryptKey.getStringValue());\n\t}", "@Override\n public EncryptKey encryptKey(String tableName, String columnName) {\n return encryptKeyManager.getEncryptKey(tableName, columnName);\n }", "public void testCaesar(){\n int key1 = 23;\n int key2 = 17;\n String encrypted = encrypt(\"At noon be in the conference room with your hat on for a surprise party. YELL LOUD!\", 15);\n System.out.println(\"key is 15\" + \"\\n\" + encrypted);\n String encrypted2 = encryptTwoKeys(\"At noon be in the conference room with your hat on for a surprise party. YELL LOUD!\", 8, 21);\n System.out.println(\"key are 8 and 21\" + \"\\n\" + encrypted2);\n }", "String encrypt(String input) throws IllegalArgumentException, EncryptionException;", "@Component\npublic interface Crypto {\n // returns a new secret key\n String newKey();\n\n // encrypts a plain text\n byte[] encrypt(String plaintext);\n\n // decrypts a cipher\n byte[] decrypt(byte[] encryptedData, short keyIx);\n\n // gets the index of the encryption key to use - 0 = no key, 1 or 2 for the two available keys\n short getKeyIx();\n\n // gets the index of the default key\n short getDefaultKeyIx();\n\n // gets the date after which the default key is no longer valid\n String getDefaultKeyExpiry();\n}", "public static String encrypt(String input, String key){\n\t\treturn encrypt(input, key, shift);\n\t}", "public static String caesarCypherEncryptor(String str, int key) {\n /* StringBuilder cipher = new StringBuilder();\n for (char ch : str.toCharArray()) {\n char shiftedChar = (char) (((ch - 'a' + key) % 26) + 'a');\n cipher.append(shiftedChar);\n }\n return cipher.toString();*/\n\n return str.chars()\n .mapToObj(ch -> (char) (((ch - 'a' + key) % 26) + 'a'))\n .map(String::valueOf)\n .collect(Collectors.joining());\n }", "public interface Encryptor {\n void encrypt();\n\n}", "void encrypt(ChannelBuffer buffer, Channel c);", "public CryptObject reencrypt(Ciphertext ciphertext);", "public Vigenere(EncryptionDecorator encrypt) {\n algo = encrypt;\n }", "CaesarCipher(int key) {\n this.key = key;\n }", "private String vigenereAlgo(boolean encrypt){\n List<Integer> key = EncryptionUtils.stringToIntList(algo.getKey());\n List<Integer> value = EncryptionUtils.stringToIntList(algo.getValue());\n int keyLength = key.size();\n int valueLength = value.size();\n \n List<Integer> crypt = new ArrayList<>();\n \n for (int i = 0; i < valueLength; i++){\n crypt.add(Math.floorMod(value.get(i)-EncryptionUtils.FIRST+ mult(encrypt)*\n (key.get(i%keyLength)-EncryptionUtils.FIRST),EncryptionUtils.SIZE) +EncryptionUtils.FIRST);\n }\n \n return EncryptionUtils.intListToString(crypt);\n }", "public static String Encrypt(String inputText, String key) {\n String retVal = \"\";\n try {\n Cipher cipher = Cipher.getInstance(\"AES/CBC/PKCS5Padding\");\n byte[] keyBytes = new byte[16];\n byte[] b = key.getBytes();\n int len = b.length;\n if (len > keyBytes.length) {\n len = keyBytes.length;\n }\n System.arraycopy(b, 0, keyBytes, 0, len);\n SecretKeySpec keySpec = new SecretKeySpec(keyBytes, \"AES\");\n IvParameterSpec ivSpec = new IvParameterSpec(keyBytes);\n cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);\n BASE64Encoder _64e = new BASE64Encoder();\n byte[] encryptedData = cipher.doFinal(inputText.getBytes());\n retVal = _64e.encode(encryptedData);\n\n } catch (Exception ex) {\n ApiLog.One.WriteException(ex);\n }\n return retVal;\n }", "@NonNull\n @Override\n public byte[] encryptString(@NonNull final Key key, @NonNull final String value)\n throws GeneralSecurityException, IOException {\n\n return encryptString(key, value, IV.encrypt);\n }", "@GetMapping(\"/encrypt\")\n public String encrypt(String uid, String data) {\n return \"\";\n }", "@Test\n public void testAesEncryptForInputKey() throws Exception {\n byte[] key = Cryptos.generateAesKey();\n String input = \"foo message\";\n\n byte[] encryptResult = Cryptos.aesEncrypt(input.getBytes(\"UTF-8\"), key);\n String descryptResult = Cryptos.aesDecrypt(encryptResult, key);\n\n System.out.println(key);\n System.out.println(descryptResult);\n }", "public interface EncryptionAlgorithm {\n\n public String encrypt(String plaintext);\n\n}", "public String getSecretKey();", "public String encodePassword(String normalPassword, String key);", "String setKey(String newKey);", "public static byte[] encryptText(String plainText,SecretKey secKey) throws Exception{\n\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n\r\n aesCipher.init(Cipher.ENCRYPT_MODE, secKey);\r\n\r\n byte[] byteCipherText = aesCipher.doFinal(plainText.getBytes());\r\n\r\n return byteCipherText;\r\n\r\n}", "public String encrypt(String geheimtext);", "public abstract void setEncryptMode();", "String encryptString(String toEncrypt) throws NoUserSelectedException;", "public static String encryptKey(String key, String token) {\n try {\n IvParameterSpec iv = new IvParameterSpec(IV);\n SecretKeySpec spec = new SecretKeySpec(key.getBytes(UTF_8), \"AES\");\n Cipher cipher = Cipher.getInstance(\"AES/CBC/NoPADDING\");\n cipher.init(Cipher.ENCRYPT_MODE, spec, iv);\n byte[] encrypted = cipher.doFinal(token.getBytes(UTF_8));\n return Hex.encodeHexString(encrypted, false);\n } catch (GeneralSecurityException e) {\n // never happens\n throw new IllegalStateException(\"Exception during AES CBC encryption\", e);\n }\n }", "OpenSSLKey mo134201a();", "public String encodeKey() {\n byte[] keyByte = secretKey.getEncoded();\n return Base64.getEncoder().encodeToString(keyByte);\n }", "public String encrypt(String plainText);", "public String ebcEncrypt(String plaintext, String key) {\n\t\treturn AESEBC.AESEncrypt(plaintext, key);\n\t}", "@Override\n public byte[] encrypt(byte[] plaintext) {\n java.security.spec.ECPoint point = hashIntoTheCurveInternal(plaintext);\n return encrypt(convertECPoint(point));\n }", "public String encrypt (String input) {\n // parameter checks. If input has nothing, or both keys\n // are zero, we have no work to do.\n if (!hasValue(input)) return \"\";\n if (mainKey1 == 0 && mainKey2 == 0) return input;\n\n // Start with a StringBuilder we can update below.\n StringBuilder encrypted = new StringBuilder(input);\n\n // Walk the input string and transform each letter that exists in\n // our alphabet\n for (int i = 0; i < encrypted.length(); i++) {\n char currChar = encrypted.charAt(i);\n int idx = alphabet.indexOf(currChar);\n if (idx != -1) {\n // Which alphabet do I use? even i is key1, odd i is key2\n String shiftedAlphabet = (i % 2 == 0) ? shiftedAlphabet1: shiftedAlphabet2;\n char newChar = shiftedAlphabet.charAt(idx);\n encrypted.setCharAt(i, newChar);\n }\n }\n\n return encrypted.toString();\n }", "@Test\n\tpublic void doEncrypt() {\n\t\tString src = \"18903193260\";\n\t\tString des = \"9oytDznWiJfLkOQspiKRtQ==\";\n\t\tAssert.assertEquals(Encryptor.getEncryptedString(KEY, src), des);\n\n\t\t/* Encrypt some plain texts */\n\t\tList<String> list = new ArrayList<String>();\n\t\tlist.add(\"18963144219\");\n\t\tlist.add(\"13331673185\");\n\t\tlist.add(\"18914027730\");\n\t\tlist.add(\"13353260117\");\n\t\tlist.add(\"13370052053\");\n\t\tlist.add(\"18192080531\");\n\t\tlist.add(\"18066874640\");\n\t\tlist.add(\"15357963496\");\n\t\tlist.add(\"13337179174\");\n\t\tfor (String str : list) {\n\t\t\tSystem.out.println(Encryptor.getEncryptedString(KEY, str));\n\t\t}\n\t}", "@Override\n public String encryptMsg(String msg) {\n if (msg.length() == 0) {\n return msg;\n } else {\n char[] encMsg = new char[msg.length()];\n for (int ind = 0; ind < msg.length(); ++ind) {\n char letter = msg.charAt(ind);\n encMsg[ind] = (char) ((letter + key) % 65536);\n }\n return new String(encMsg);\n }\n }", "@Override\n public OutputStream createEncryptor(OutputStream out, EncryptionKey publicKey) throws IOException {\n KeyEncapsulationMechanism.KeyAndCiphertext<SymmetricKey> keyAndCiphertext = kem.encaps(publicKey);\n\n //Serialize the encapsulated key\n byte[] encapsulatedKey = new JSONConverter().serialize(keyAndCiphertext.encapsulatedKey.getRepresentation())\n .getBytes(StandardCharsets.UTF_8);\n\n //Prepare the encapsulated key length as the first four bytes of the ciphertext. That ought to be enough for\n // everybody.\n byte[] keyLenBytes = ByteBuffer.allocate(4).putInt(encapsulatedKey.length).array();\n\n //Write keyLenBytes || encapsulatedKey to stream\n out.write(keyLenBytes);\n out.write(encapsulatedKey);\n\n //Return resulting stream that symmetrically encrypts any input and writes the ciphertext to out\n return symmetricScheme.createEncryptor(out, keyAndCiphertext.key);\n }", "@Override\n public String encrypt(String s) throws NotInAlphabetException{ \n passwordPos = 0; //initialize to 0\n return super.encrypt(s); //invoke parent\n }", "String getSecretByKey(String key);", "public interface ICrypto\n{\n\t/**\n\t *\n\t * @return\ttrue for Public/Private key and false for password style encryption\n\t */\n\tboolean isPublic();\n\n\t/**\n\t * @param clearText\t\tClear text\n\t * @return\t\t\t\tStringized (BasicBase64) version of the cipher for the clear text\n\t */\n\tString encrypt(String clearText);\n\n\t/**\n\t * @param cipherText\tClear text\n\t * @return\t\t\t\tClear text from the stringized (BasicBase64) version of the cipherTetxt\n\t */\n\tString decrypt(String cipherText);\n\n\t/**\n\t * @return\tThe cryptography algorithm\n\t */\n\tString getAlgorithm();\n\n\t/**\n\t *\n\t * @return\tThe name by which this combination algorithm/key are known.\n\t */\n\tString getAliasName();\n}", "public void encrypt(LHStringHolder holder) throws LRException\n\t{\n\t\tholder.setValue(LUEncrypt.encrypt(getFields(),\n\t\t\t((DataHRecordData)getData()).encryptKey.getStringValue()));\n\t}", "public CryptoKey getMyKey() {\n return myKey;\n }", "WithCreate withEncryption(Encryption encryption);", "public CryptObject encrypt(BigIntegerMod message);", "private static Key generateKey() {\n return new SecretKeySpec(keyValue, ALGO);\n }", "@Override\n\tpublic boolean isNeedEncrypt() {\n\t\treturn false;\n\t}", "public String encrypt(String text) {\n\t\t\n\t\t//If key is shorter than the text, repeat keyword along length of text\n\t\tif(key.length() < text.length()) {\n\t\t\trepeatKey(text);\n\t\t}\n\t\t\n\t\ttext = text.toLowerCase();\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\t\n\t\tfor(int i = 0 ; i < text.length(); i++) {\n\t\t\tchar textLetter = text.charAt(i);\n\t\t\tchar keyLetter = key.charAt(i);\n\t\t\t\t\t\t\n\t\t\t//Char to encode's position in alphabet\n\t\t\tint textCharacterIndex = alphabet.indexOf(textLetter);\n\t\t\t\n\t\t\t//Only encrypt letters\n\t\t\tif(Character.isLetter(textLetter)) {\n\t\t\t\t\n\t\t\t\t//If character is in the second half of cipher A-M\n\t\t\t\tif(charMap.get(textLetter) > 12 && charMap.get(textLetter) <= 25) {\n\t\t\t\t\t\n\t\t\t\t\tint keyValue = charMapKey.get(keyLetter);\n\t\t\t\t\tString cipher = shiftLeft(baseCipherRHS, keyValue);\t\t\t\t\t\n\t\t\t\t\tsb.append(cipher.charAt(textCharacterIndex % 13));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tint keyValue = charMapKey.get(keyLetter);\n\t\t\t\t\tString cipher = shiftRight(baseCipherLHS, keyValue);\n\t\t\t\t\tsb.append(cipher.charAt(textCharacterIndex % 13));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsb.append(text.charAt(i));\n\t\t\t}\t\t\t\t\t\n\t\t}\n\t\t\n\t\treturn sb.toString();\n\t}", "public String encrypt(final PrivateKeyInterface key, final String data)\n {\n return this.encryptionCipher().encrypt(key, data);\n }", "@Override\n public void setKey(byte[] key) throws IllegalArgumentException{\n if ( key.length != keySize() ) throw new IllegalArgumentException(\"key not the right length.\");\n System.arraycopy(key,ciper.keySize(),nonce,0,8);\n System.arraycopy(key, 0, this.key, 0, ciper.keySize());\n ciper.setKey(this.key);\n ciper.encrypt(nonce);\n }", "public String encryptWithUser(String data){\n String userId = getUserService().getCurrentUser().getUid();\n Pair pair = new Pair(data, userId);\n\n //Encrypt pair\n String strData;\n try {\n strData = mapper.writeValueAsString(pair);\n SecureToken secureToken = new SecureToken(strData, System.currentTimeMillis());\n return getSecureTokenService().encryptData(secureToken);\n } catch (JsonProcessingException e) {\n LOG.error(e);\n }\n return null;\n }", "public interface Cipher {\n\n /*\n return key of the cipher\n */\n int getKey();\n\n /*\n set key of the cipher\n */\n void setKey(int key);\n\n /*\n cipher text/char based on the key\n */\n char cipher(int charToCipher);\n\n /*\n decipher text/char based on the key\n */\n char decipher(int charToDeCipher);\n}", "public void setEncryptionKey(LVValue encryptKey) throws LRException\n\t{\n\t\tDataHRecordData myData=(DataHRecordData)getData();\n\t\tmyData.encryptKey=encryptKey;\n\t}", "private byte[] encryptSymmetricKey(PublicKey receiverPublicKey, SecretKey semetricKey) throws Exception {\n\t\ttry {\n\t\t\tmyCipher = Cipher.getInstance(\"RSA\");\n\t\t\tmyCipher.init(Cipher.ENCRYPT_MODE, receiverPublicKey);\n\t\t\treturn myCipher.doFinal(semetricKey.getEncoded());\n\t\t} catch (Exception e) {\n\t\t\twriteToLog(\"Error While trying to encrypt the semetric-key: \" + e.getMessage());\n\t\t\tLogWriter.close();\n\t\t\tthrow new Exception();\n\t\t}\n\n\t}", "public java.lang.String getEncryptedKey() {\n\t\treturn encryptedKey;\n\t}", "public static String encrypt(String seed, String plain) throws Exception {\r\nbyte[] rawKey = getRawKey(seed.getBytes());\r\nbyte[] encrypted = encrypt(rawKey, plain.getBytes());\r\nreturn Base64.encodeToString(encrypted, Base64.DEFAULT);\r\n}", "public static String caesarCypherEncryptor(String str, int key) {\n\n key = key % 26;\n\n char[] array = str.toCharArray();\n\n for (int i = 0; i < array.length; i++) {\n int value = array[i] + key;\n if(value <= 122)\n array[i] = (char) value;\n else\n array[i] = (char) (96 + value - 122);\n }\n\n return new String(array);\n }", "public static byte [] encrypt(byte [] plainText, SecretKey key){\r\n\t\ttry {\r\n\t\t\tCipher cipher = Cipher.getInstance(symmetricKeyCryptoMode);\r\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, key);\r\n\t\t\tbyte [] initVector = cipher.getIV();\r\n\t\t\tbyte [] outputBuffer = new byte [cipher.getOutputSize(plainText.length)+initVector.length+2];\r\n\t\t\tint cursor = packToByteArray(initVector, outputBuffer, 0);\r\n\t\t\tcipher.doFinal(plainText, 0, plainText.length, outputBuffer,cursor);\r\n\t\t\treturn outputBuffer;\r\n\t\t} catch (Exception e){\r\n\t\t\tthrow new ModelException(\"Error encrypting plainText \"+plainText,e);\r\n\t\t}\r\n\t}", "public interface TextEncryptor {\n\n /**\n * Returns encrypted text.\n * @param text - text to be encrypted.\n * @return encrypted text.\n */\n String encrypt(String text);\n}", "public doEncryptNotifdeEncode() {\n\t}", "public static String encipher(String string, String key){\n key = key != null ? key : defaultKey;\n String newString = \"\";\n string = Enigma.handleStringOnInput(string);\n string = string.toUpperCase();\n for (int i = 0; i < string.length(); i++){\n int temp = alphabetL.indexOf(string.charAt(i));\n newString += key.charAt(temp);\n }\n return newString;\n }", "public EncryptedPrivateKey mo42978a(@NonNull Wallet izVar, String str) {\n SaplingEncryptedKey brt = new SaplingEncryptedKey();\n izVar.encryptPrivateKeyByPwd(getCopyBytes(), (EncryptedPrivateKey) brt, str);\n return brt;\n }", "@Override\n public String encryptMsg(String msg) {\n if (msg.length() == 0) {\n return msg;\n } else {\n char[] encMsg = new char[msg.length()];\n for (int ind = 0; ind < msg.length(); ++ind) {\n char letter = msg.charAt(ind);\n if (letter >= 'a' && letter <= 'z') {\n encMsg[ind] = (char) ('a' + ((letter - 'a' + key) % 26));\n } else if (letter >= 'A' && letter <= 'Z') {\n encMsg[ind] = (char) ('A' + ((letter - 'A' + key) % 26));\n } else {\n encMsg[ind] = letter;\n }\n }\n return new String(encMsg);\n }\n }", "public static byte [] encrypt(byte [] plainText, char [] password){\r\n\t\t// create a secret key using a random salt\r\n\t\tbyte [] salt = new byte[SEED_LENGTH];\r\n\t\tSecureRandom random = new SecureRandom();\r\n\t\trandom.nextBytes(salt);\r\n\t\tSecretKey key = generateSecretKey(salt, password);\r\n\t\ttry {\r\n\t\t\tCipher cipher = Cipher.getInstance(symmetricKeyCryptoMode);\r\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(salt));\r\n\t\t\tbyte [] encoded = cipher.doFinal(plainText);\r\n\t\t\tbyte [] cipherText = new byte[encoded.length+salt.length+4];\r\n\t\t\tint cursor = 0;\r\n\t\t\t// pack the salt dataValue and the encoded values to create the cipher text\r\n\t\t\tcursor = packToByteArray(salt, cipherText, cursor);\r\n\t\t\tpackToByteArray(encoded,cipherText,cursor);\r\n\t\t\treturn cipherText;\r\n\t\t} catch (Exception e){\r\n\t\t\tthrow new ModelException(\"Error encrypting plainText \"+plainText,e);\r\n\t\t}\r\n\t}", "private void setKey() {\n\t\t \n\t}", "public Decryption(int key)\n {\n // initialise instance variables\n shiftKey = key;\n generateCipher();\n }", "interface WithEncryption {\n /**\n * Specifies the encryption property: Encryption property can be used to encrypt data at rest with customer\n * managed keys or platform managed keys..\n *\n * @param encryption Encryption property can be used to encrypt data at rest with customer managed keys or\n * platform managed keys.\n * @return the next definition stage.\n */\n WithCreate withEncryption(Encryption encryption);\n }", "public static String encrypt(String input) {\n\t\tBase64.Encoder encoder = Base64.getMimeEncoder();\n String message = input;\n String key = encoder.encodeToString(message.getBytes());\n return key;\n\t}", "byte[] encrypt(String plaintext);", "public EncryptorReturn decrytp(String in) throws CustomizeEncryptorException;", "public Key generateKey2(int l) throws IOException{\n int b = l/32;\r\n int [] unos = new int[b];\r\n for(int i=0;i<b;i++){\r\n unos[i] = 1;\r\n }\r\n byte [] aB = int2byte(unos);\r\n\r\n return new SecretKeySpec(aB, \"AES\");\r\n }", "public interface SuperEncryption {\n String encrypt(String s);\n String decrypt(String s);\n}", "public String cipherText(String str, String key)\n{\n String cipher_text=\"\";\n \n for (int i = 0; i < str.length(); i++)\n {\n // converting in range 0-25\n if(str.charAt(i) == ' ' || str.charAt(i) == '\\n')\n cipher_text+= str.charAt(i);\n else{ \n int x = (str.charAt(i) + key.charAt(i)) %26;\n // convert into alphabets(ASCII)\n x += 'A';\n \n cipher_text+=(char)(x);}\n }\n return cipher_text;\n}", "@Override\n public byte[] reEncrypt(byte[] ciphertext) {\n ECPoint point = checkPointOnCurve(ciphertext);\n return encrypt(point);\n }", "private byte[] encrypt(ECPoint point) {\n return point.multiply(privateKey.getS()).getEncoded(true);\n }", "public void setEncryptionDescriptor(String descriptor) {\n encrypted = descriptor;\n }", "public byte[] Tencryption() {\n int[] ciphertext = new int[message.length];\n\n for (int j = 0, k = 1; j < message.length && k < message.length; j = j + 2, k = k + 2) {\n sum = 0;\n l = message[j];\n r = message[k];\n for (int i = 0; i < 32; i++) {\n sum = sum + delta;\n l = l + (((r << 4) + key[0]) ^ (r + sum) ^ ((r >> 5) + key[1]));\n r = r + (((l << 4) + key[2]) ^ (l + sum) ^ ((l >> 5) + key[3]));\n }\n ciphertext[j] = l;\n ciphertext[k] = r;\n }\n return this.Inttobyte(ciphertext);\n\n }", "PBEncryptStorage encrypt(String inputString, String password, byte[] salt);", "String key();", "private void encryptionAlgorithm() {\n\t\ttry {\n\t\t\t\n\t\t\tFileInputStream fileInputStream2=new FileInputStream(\"D:\\\\program\\\\key.txt\");\n\t\t\tchar key=(char)fileInputStream2.read();\n\t\t\tSystem.out.println(key);\n\t\t\tFileInputStream fileInputStream1=new FileInputStream(\"D:\\\\program\\\\message.txt\");\n\t\t\tint i=0;\n\t\t\t\n\t\t\tStringBuilder message=new StringBuilder();\n\t\t\twhile((i= fileInputStream1.read())!= -1 )\n\t\t\t{\n\t\t\t\tmessage.append((char)i);\n\t\t\t}\n\t\t\tString s=message.toString();\n\t\t\tchar[] letters=new char[s.length()];\n\t\t\tStringBuilder en=new StringBuilder();\n\t\t\tfor(int j = 0;j < letters.length;j++)\n\t\t\t{\n\t\t\t\ten.append((char)(byte)letters[j]+key);\n\t\t\t}\t\t\n\t\t\tFileOutputStream fileoutput=new FileOutputStream(\"D:\\\\program\\\\encryptedfile.txt\");\n\t\t\t\n\t\t\tfileInputStream1.close();\n\t\t\tfileInputStream2.close();\n\t\t\t\n\t\t}\n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t\n\t}", "public String Crypt(String s);", "@RequiresApi(api = Build.VERSION_CODES.KITKAT)\n private char encryptLetter(char keyLetter, char plaintextLetter) {\n\n //if not alpha, return unchanged\n if(!Character.isAlphabetic(plaintextLetter)){\n return plaintextLetter;\n }\n\n //convert to upper case for case-insensitivity while looking\n //up in the table\n keyLetter = Character.toUpperCase(keyLetter);\n char plaintextLetterToUpper = Character.toUpperCase(plaintextLetter);\n\n //to leave case unchanged\n if(Character.isUpperCase(plaintextLetter)) {\n return tabulaRecta[keyLetter-65][plaintextLetter-65];\n }\n\n return Character.toLowerCase(tabulaRecta[keyLetter-65][plaintextLetterToUpper-65]);\n }", "protected void setEncrypted() {\n content = this.aesKey.encrypt(this.content);\n }", "public interface ICryptoEngine \n{\n\t/**\n\t * Initialize the \n\t * \n\t * @param forEncryption should the engine be initialized for encryption (true) or decryption (false)\n\t * @param key - symmetric encryption key\n\t * \n\t * @throws IllegalStateException - if any initialization parameters are invalid\n\t */\n\tpublic void init(boolean forEncryption, byte[] key) throws IllegalStateException;\n\t\n\t/**\n\t * @return name of the encryption algorithm\n\t */\n\tpublic String getAlgorithmName();\n\t\n\t/**\n\t * @return block size of the encryption algorithm\n\t */\n\tpublic int getBlockSize();\n\t\n\t/**\n\t * Performs an encryption or decryption of a block.\n\t * The amount of processed data depends on the actual algorithm's block size \n\t * \n\t * @param in - buffer with the data to be processed\n\t * @param inOff - starting position of the data at 'in'\n\t * @param out - preallocated buffer to store the processed data\n\t * @param outOff - starting position at 'out'\n\t * \n\t * @return size of processed data (typically algorithm's block size)\n\t * \n\t * @throws IllegalStateException if engine was not initialized or buffers are invalid\n\t */\n\tpublic int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws IllegalStateException;\n\t\n\t/**\n\t * Resets the encryption engine (if required by the implementation)\n\t */\n\tpublic void reset();\n}", "public void setEncryptionKey(String encryptionKey) throws Exception\n {\n try\n {\n SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(\"PBEWithMD5AndDES\");\n key = keyFactory.generateSecret(new PBEKeySpec(encryptionKey.toCharArray()));\n }\n catch (Exception e)\n {\n throw new Exception(\"Problem unlocking the codec : \" + e.getMessage());\n }\n }" ]
[ "0.73767936", "0.730067", "0.7106536", "0.6592108", "0.65878123", "0.6470394", "0.64358056", "0.6336842", "0.6336185", "0.63164264", "0.61657596", "0.61622465", "0.61167985", "0.60954803", "0.60825986", "0.60262144", "0.6003058", "0.5995725", "0.5978597", "0.5919993", "0.58886516", "0.58862036", "0.5883", "0.58727837", "0.58715683", "0.5869548", "0.58644867", "0.58407325", "0.57962453", "0.5794527", "0.5782808", "0.57694024", "0.5711905", "0.5690808", "0.5678471", "0.56748015", "0.5668001", "0.5658818", "0.5640206", "0.5629809", "0.5618456", "0.5582476", "0.5575888", "0.55565006", "0.5547048", "0.5536585", "0.5531949", "0.5529893", "0.5521554", "0.5520204", "0.55146164", "0.55073756", "0.5506066", "0.5498823", "0.54967266", "0.54867774", "0.5477116", "0.54733264", "0.54695106", "0.54686266", "0.54658204", "0.54647195", "0.5464629", "0.54602736", "0.54580903", "0.54508406", "0.54500055", "0.5445542", "0.5444835", "0.5443253", "0.54366624", "0.54317605", "0.54179364", "0.54116064", "0.54067206", "0.54042745", "0.5402746", "0.54012525", "0.5386002", "0.5384929", "0.53775495", "0.5375424", "0.53743064", "0.53718793", "0.5369019", "0.5362704", "0.5351614", "0.5336175", "0.533542", "0.53342146", "0.5327045", "0.53103703", "0.5307601", "0.53012276", "0.53009206", "0.52962637", "0.52910405", "0.5286652", "0.5284198", "0.5283584" ]
0.63021195
10
Decrypt the value using the key Decorator function
@Override public void decrypt() { algo.decrypt(); String cypher = vigenereAlgo(false); this.setValue(cypher); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String decrypt(String key);", "@Override\n\tpublic void Decrypt(Object key) {\n\n\t}", "public String decrypt(final String value) {\n\t\treturn encryptor.decrypt(value);\n\t}", "private String decryptKey(String keyValue) {\n if (keyValue != null) {\n byte[] encryptedKey = Base64.decode(keyValue);\n AWSKMS client = AWSKMSClientBuilder.defaultClient();\n DecryptRequest request = new DecryptRequest()\n .withCiphertextBlob(ByteBuffer.wrap(encryptedKey));\n ByteBuffer plainTextKey = client.decrypt(request).getPlaintext();\n return new String(plainTextKey.array(), Charset.forName(\"UTF-8\"));\n }\n return null;\n }", "public String Decrypt(String s);", "@FunctionalInterface\npublic interface CipherDecryptor {\n\t//Used to decrypt with a provided key\n\tpublic String decrypt(String key);\n\t\n}", "@Test\r\n public void testDecrypt()\r\n {\r\n System.out.println(\"decrypt\");\r\n String input = \"0fqylTncsgycZJQ+J5pS7v6/fj8M/fz4bavB/SnIBOQ=\";\r\n KeyMaker km = new KeyMaker();\r\n SecretKeySpec sks = new SecretKeySpec(km.makeKeyDriver(\"myPassword\"), \"AES\");\r\n EncyptDecrypt instance = new EncyptDecrypt();\r\n String expResult = \"Hello how are you?\";\r\n String result = instance.decrypt(input, sks);\r\n assertEquals(expResult, result);\r\n }", "public Decryption(int key)\n {\n // initialise instance variables\n shiftKey = key;\n generateCipher();\n }", "public String decryptAsNeeded(final String value) {\n\t\ttry {\n\t\t\t// Try a decryption\n\t\t\treturn decrypt(value);\n\t\t} catch (final EncryptionOperationNotPossibleException ignored) {\n\t\t\t// This value could be encrypted, but was not\n\t\t\treturn value;\n\t\t}\n\t}", "String decryptHiddenField(String encrypted);", "String decryptString(String toDecrypt) throws NoUserSelectedException, IllegalValueException;", "public void decrypt(LVValue value) throws LRException\n\t{\n\t\tDataHRecordData myData=(DataHRecordData)getData();\n\t\tString key=myData.encryptKey.getStringValue();\n\t\tHashtable table=(Hashtable)LUEncrypt.decrypt(value.getStringValue(),key);\n\t\t// Rebuild the record from the fields in the table\n\t\tmyData.record=createRecord(myData.spec,table);\n\t}", "void decrypt(ChannelBuffer buffer, Channel c);", "public String decryptedOnly(final String value) {\n\t\tif (StringUtils.isAllBlank(value)) {\n\t\t\treturn value;\n\t\t}\n\t\ttry {\n\t\t\t// Try a decryption\n\t\t\tdecrypt(value);\n\t\t\treturn null;\n\t\t} catch (final EncryptionOperationNotPossibleException e) { // NOSONAR - Ignore raw value\n\t\t\t// Value could be encrypted, consider it as a safe value\n\t\t\treturn value;\n\t\t}\n\t}", "public EncryptorReturn decrytp(String in) throws CustomizeEncryptorException;", "public static String decrypt(String input) {\n\t\t Base64.Decoder decoder = Base64.getMimeDecoder();\n\t String key = new String(decoder.decode(input));\n\t return key;\n\t}", "public void dec(String key);", "public String decrypt(String input)\n {\n CaesarCipherTwo cipher = new CaesarCipherTwo(26 - mainKey1, 26 - mainKey2);\n return cipher.encrypt(input);\n }", "public DecryptionCipherInterface decryptionCipher()\n {\n return this.decryptionCipher;\n }", "public String getValueDecrypted ( String value, String keyValue ) throws Exception {\r\n Key key = generateKey( keyValue );\r\n Cipher c = Cipher.getInstance( ALGORITHM );\r\n c.init( Cipher.DECRYPT_MODE, key );\r\n \r\n String dValue = null;\r\n String valueToDecrypt = value;\r\n for ( int i = 0; i < ITERATIONS; i++ ) {\r\n byte[] decordedValue = new BASE64Decoder().decodeBuffer( valueToDecrypt );\r\n byte[] decValue = c.doFinal( decordedValue );\r\n dValue = new String( decValue ).substring( complement.length() );\r\n valueToDecrypt = dValue;\r\n }\r\n return dValue;\r\n }", "@Override\n public byte[] decrypt(byte[] ciphertext) {\n ECPoint point = checkPointOnCurve(ciphertext);\n BigInteger privateKeyInverse = privateKey.getS().modInverse(privateKey.getParams().getOrder());\n return point.multiply(privateKeyInverse).getEncoded(true);\n }", "public String decrypt(String cipherText);", "PGPPrivateKey decryptSecretKey(PGPSecretKey secretKey, String password);", "@Around(\"decryptPointCut()\")\n public Object aroundDecrypt(ProceedingJoinPoint joinPoint) throws Throwable {\n Object responseObj = joinPoint.proceed(); // 方法执行\n handleDecrypt(responseObj); // 解密CryptField注解字段\n return responseObj;\n\n }", "public static String decrypt(String text, int key) {\n return encrypt(text, -key);\n }", "public String Decrypt(String Message, int PrimeNo, String EncoderKeyPath) throws IOException\r\n {\r\n Scanner sc = new Scanner(System.in);\r\n Key key1 = new Key();\r\n char[] msg=new char[Message.length()];\r\n int s, x;\r\n System.out.println(\"Enter Your Secret Key To Decode \");\r\n x=sc.nextInt();\r\n int key = key1.Skey(PrimeNo, x, EncoderKeyPath);\r\n char s1;\r\n int len=Message.length();\r\n int res=0;\r\n\tfor(int i=0;i<len;i++)\r\n\t{\r\n res=i%key;\r\n s=Message.charAt(i);\r\n s-=res;\r\n s1= (char) s;\r\n msg[i]=s1;\t\r\n\t}\r\n String msg1 = new String(msg);\r\n return msg1; \r\n }", "public byte[] Tdecryption() {\n int[] plaintext = new int[message.length];\n\n for (int j = 0, k = 1; j < message.length && k < message.length; j = j + 2, k = k + 2) {\n sum = delta << 5;\n l = message[j];\n r = message[k];\n for (int i = 0; i < 32; i++) {\n r = r - (((l << 4) + key[2]) ^ (l + sum) ^ ((l >> 5) + key[3]));\n l = l - (((r << 4) + key[0]) ^ (r + sum) ^ ((r >> 5) + key[1]));\n sum = sum - delta;\n }\n plaintext[j] = l;\n plaintext[k] = r;\n }\n return this.Inttobyte(plaintext);\n }", "@GetMapping(\"/decrypt\")\n public String decrypt(String uid, String data) {\n return \"\";\n }", "void decryptMessage(String Password);", "public String decodePassword(String encodedPassword, String key);", "private static int decrypt(int index) {\n\t int k1_inv = 9; \n\t int k2 = 1;\n\t // add 26 to index to avoid error when (index - k2) <= 0\n\t index = (((index+26) - k2)*(k1_inv))%26;\n\t return index;\n }", "@Override\r\n\tpublic String decrypt(String cipher) {\n\t\treturn null;\r\n\t}", "public static SecretKey unwrap(byte [] wrappedKey, PrivateKey decryptionKey) {\r\n\t\ttry {\r\n\t\t\tCipher unwrapper = Cipher.getInstance(encryptionAlgorithm);\r\n\t\t\tunwrapper.init(Cipher.UNWRAP_MODE, decryptionKey);\r\n\t\t\treturn (SecretKey) unwrapper.unwrap(wrappedKey,symmetricKeyAlgorithm,Cipher.SECRET_KEY);\r\n\t\t} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) {\r\n\t\t\tthrow new ModelException(ExceptionReason.INVALID_PARAMETER, \"Unable to unwrap key \"+new String(Arrays.copyOf(wrappedKey, 10))+\"...\",e);\r\n\t\t}\r\n\t}", "@Override\n\tpublic double decrypt(String encryptedText) {\n\t\treturn cryptoProvider.decrypt(encryptedText);\n\t}", "public String decrypt(String value) throws Exception {\r\n\t\tif (value == null || value.equals(\"\"))\r\n\t\t\tthrow new Exception(\"The cipher string can not be null or an empty string.\");\r\n\r\n\t\t// Initialize the cryptography algorithm.\r\n\t\tthis.rijndael.init(Cipher.DECRYPT_MODE, this.key, this.initalVector);\r\n\r\n\t\t// Get an encrypted byte array from a base64 encoded string.\r\n\t\tbyte[] encryptedValue = Base64Encoder.decode(value);\r\n\r\n\t\t// Decrypt the byte array.\r\n\t\tbyte[] decryptedValue = this.rijndael.doFinal(encryptedValue);\r\n\r\n\t\t// Return a string converted from the UTF-8 byte array.\r\n\t\treturn new String(decryptedValue, \"UTF8\");\r\n\t}", "public String decrypt(final PrivateKeyInterface key, final String data)\n throws DecryptionFailedException\n {\n return this.decryptionCipher().decrypt(key, data);\n }", "public String ebcDecrypt(String ciphertext, String key) {\n\t\treturn AESEBC.AESDecrypt(ciphertext, key);\n\t}", "public static String decrypt(String seed, String encrypted)\r\nthrows Exception {\r\nbyte[] rawKey = getRawKey(seed.getBytes());\r\nbyte[] enc = Base64.decode(encrypted.getBytes(), Base64.DEFAULT);\r\nbyte[] result = decrypt(rawKey, enc);\r\nreturn new String(result);\r\n}", "private BigInteger decrypt(BigInteger encrypted, BigInteger privateKey, BigInteger modulus){\n return encrypted.modPow(privateKey, modulus);\n }", "String getSecretByKey(String key);", "public String tableDecrypt(String ciphertext, String key) {\n\t\treturn AESMain2.AESDecrypt(ciphertext, key);\n\t}", "com.google.cloud.video.livestream.v1.Encryption.Clearkey getClearkey();", "public String decrypt (String input) {\n return new CaesarCipherTwo(ALPHABET_LENGTH-mainKey1, ALPHABET_LENGTH-mainKey2).encrypt(input);\n }", "public String tselDecrypt(String key, String message)\n\t{\n\n\t\tif (key == null || key.equals(\"\")) \n\t\t{\n\t\t\treturn message;\n\t\t}\n\n\t\tif (message == null || message.equals(\"\")) \n\t\t{\n\t\t\treturn \"\";\n\t\t}\n\t\tCryptoUtils enc = new CryptoUtils(key, Cipher.DECRYPT_MODE);\n\t\tString messageEnc = enc.process(message);\n\n\t\treturn messageEnc;\n\t}", "public BigIntegerMod decrypt(Ciphertext ciphertext);", "public static String decryptCaesar(String encryptedText, int key) {\r\n\t\t// copying plaintext into char array.\r\n\t\tchar[] ipArr = encryptedText.toCharArray();\r\n\t\tchar[] opArr = new char[ipArr.length];\r\n\t\tint tmp = '0';\r\n\t\twhile(key > RANGE)\r\n\t\t{\r\n\t\t\tkey=key-RANGE;\r\n\t\t}\t\t\t\r\n\t\tfor (int i = 0; i < ipArr.length; i++) {\r\n\t\t\t\r\n\t\t\t\ttmp = (ipArr[i]+RANGE)-key;\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\r\n\t\t\t\tif(tmp>UPPER_BOUND) \r\n\t\t\t\t{\r\n\t\t\t\t\ttmp=tmp-RANGE;\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tif(tmp<LOWER_BOUND) \r\n\t\t\t\t{\r\n\t\t\t\t\ttmp=tmp+RANGE;\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\topArr[i]=(char)tmp;\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\treturn new String(opArr);\r\n\t}", "public PrivateKey getKey();", "public static String decipher(String ciphertext, String key) {\n\t\treturn encipher(ciphertext, key, -1);\n\t}", "public abstract void setDecryptMode();", "public static byte [] decrypt(byte [] cipherText, SecretKey key){\r\n\t\ttry {\r\n\t\t\tbyte [] initVector = unpackFromByteArray(cipherText, 0);\r\n\t\t\tint cursor = initVector.length+2;\t\t\t\r\n\t\t\tCipher cipher = Cipher.getInstance(symmetricKeyCryptoMode);\r\n\t\t\tcipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(initVector));\t\t\t\r\n\t\t\treturn cipher.doFinal(cipherText,cursor,cipherText.length-cursor);\r\n\t\t} catch (Exception e){\r\n\t\t\tthrow new ModelException(ExceptionReason.INVALID_PARAMETER, \"Error decrypting cipherText \"+cipherText,e);\r\n\t\t}\r\n\t}", "public static String decryptText(byte[] byteCipherText, SecretKey secKey) throws Exception {\n\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n\r\n aesCipher.init(Cipher.DECRYPT_MODE, secKey);\r\n\r\n byte[] bytePlainText = aesCipher.doFinal(byteCipherText);\r\n\r\n return new String(bytePlainText);\r\n\r\n}", "public String decryptFromPref(String prefKey) throws IOException, GeneralSecurityException {\n\t\treturn getEncryptedPrefs().getString(prefKey, null);\n\t}", "public static void main(String[] args) {\n System.out.println(decryptFunction());\n //decryptFunction();\n\n }", "@Override\n public String decrypt(String s) throws NotInAlphabetException{\n passwordPos = 0; //initialize to 0\n return super.decrypt(s); //invoke parent\n }", "Encryption encryption();", "@Override\n public String decryptMsg(String msg) {\n if (msg.length() == 0) {\n return msg;\n } else {\n char[] decMsg = new char[msg.length()];\n for (int ind = 0; ind < msg.length(); ++ind) {\n char letter = msg.charAt(ind);\n if (letter >= 'a' && letter <= 'z') {\n int temp = letter - 'a' - key;\n decMsg[ind] = (char) ('a' + (char) ((temp < 0) ? temp + 26 : temp));\n } else if (letter >= 'A' && letter <= 'Z') {\n int temp = letter - 'A' - key;\n decMsg[ind] = (char) ('A' + (char) ((temp < 0) ? temp + 26 : temp));\n } else {\n decMsg[ind] = letter;\n }\n }\n return new String(decMsg);\n }\n }", "@Test\n public void testDecrypt() throws Exception {\n System.out.println(\"decrypt\");\n String seed = \"\";\n String encrypted = \"\";\n String expResult = \"\";\n String result = Crypto.decrypt(seed, encrypted);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "String decrypt(PBEncryptStorage pbeStorage, String password, byte[] salt);", "String decrypt(String input) {\n\t\treturn new String(BaseEncoding.base64().decode(input));\n\t}", "public String decrypt(String input) throws Throwable {\n byte[] inputByteArray = Base64.getDecoder().decode(input);\n String keyString = \"\";\n\n // read the private key\n BufferedReader reader = null;\n try {\n reader = new BufferedReader(\n new InputStreamReader(context.getAssets().open(\"Put your private key in assets and Enter its name here\"), \"UTF-8\"));\n String line;\n while ((line = reader.readLine()) != null) {\n keyString += line;\n }\n reader.close();\n }catch (IOException e){\n Toast.makeText(context, \"Couldn't create file reader\", Toast.LENGTH_SHORT).show();\n }\n\n // fetching the key from public key\n keyString = keyString.replaceAll(NEW_LINE_CHARACTER, EMPTY_STRING)\n .replaceAll(PRIVATE_KEY_START_KEY_STRING, EMPTY_STRING)\n .replaceAll(PRIVATE_KEY_END_KEY_STRING, EMPTY_STRING);\n\n byte[] privateKey = keyString.getBytes();\n\n Key generatePrivate = KeyFactory.getInstance(\"RSA\").\n generatePrivate(new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey)));\n\n // create RSA Cipher instance\n Cipher cipherInstance = Cipher.getInstance(\"RSA/None/PKCS1Padding\");\n cipherInstance.init(Cipher.DECRYPT_MODE, generatePrivate);\n\n // encrypt string\n byte[] decryptedByteArray = cipherInstance.doFinal(inputByteArray);\n return new String(decryptedByteArray);\n }", "protected void engineInitDecrypt (Key key)\n throws KeyException {\n Key[] keys = splitKey(key);\n\n des1.initDecrypt(keys[2]);\n des2.initEncrypt(keys[1]);\n des3.initDecrypt(keys[0]);\n }", "@NonNull\n @Override\n protected String decryptBytes(@NonNull final Key key, @NonNull final byte[] bytes,\n @Nullable final DecryptBytesHandler handler)\n throws GeneralSecurityException, IOException {\n final Cipher cipher = getCachedInstance();\n\n try {\n // read the initialization vector from bytes array\n final IvParameterSpec iv = IV.readIv(bytes);\n cipher.init(Cipher.DECRYPT_MODE, key, iv);\n\n // decrypt the bytes using cipher.doFinal(). Using a CipherInputStream for decryption has historically led to issues\n // on the Pixel family of devices.\n // see https://github.com/oblador/react-native-keychain/issues/383\n byte[] decryptedBytes = cipher.doFinal(bytes, IV.IV_LENGTH, bytes.length - IV.IV_LENGTH);\n return new String(decryptedBytes, UTF8);\n } catch (Throwable fail) {\n Log.w(LOG_TAG, fail.getMessage(), fail);\n\n throw fail;\n }\n }", "char decipher(int charToDeCipher);", "@Override\n public String decryptMsg(String msg) {\n if (msg.length() == 0) {\n return msg;\n } else {\n char[] decMsg = new char[msg.length()];\n int actKey = key % 65536;\n for (int ind = 0; ind < msg.length(); ++ind) {\n char letter = msg.charAt(ind);\n decMsg[ind] = (char) ((letter - actKey < 0) ? letter - actKey + 65536 : letter - actKey);\n }\n return new String(decMsg);\n }\n }", "public byte[] decrypt(byte[] input, KeyPair keyPair) throws Exception {\n\t\treturn decrypt(input, keyPair.getPrivate());\t\n\t}", "private String decrypt(SecretKey key, String encrypted) {\n\t\ttry {\n\t\t\tCipher cipher = Cipher.getInstance(\"AES\");\n\t\t\tcipher.init(Cipher.DECRYPT_MODE, key);\n\n\t\t\tbyte[] original = cipher.doFinal(Base64.decodeBase64(encrypted));\n\n\t\t\treturn new String(original);\n\t\t} catch (InvalidKeyException | NoSuchAlgorithmException | BadPaddingException | IllegalBlockSizeException\n\t\t\t\t| NoSuchPaddingException ex) {\n\t\t\tSystem.out.println(ex.getMessage());\n\t\t}\n\n\t\treturn null;\n\t}", "public byte[] decrypt(final PrivateKeyInterface key, final byte[] data)\n throws DecryptionFailedException\n {\n return this.decryptionCipher().decrypt(key, data);\n }", "public static byte [] decrypt(byte [] cipherText, char [] password){\r\n\t\tint cursor = 0;\r\n\t\tbyte [] salt = unpackFromByteArray(cipherText,cursor);\r\n\t\tSecretKey key = generateSecretKey(salt, password);\r\n\t\tcursor += salt.length+2;\r\n\t\tbyte [] encoded = unpackFromByteArray(cipherText,cursor);\r\n\t\ttry {\r\n\t\t\tCipher cipher = Cipher.getInstance(symmetricKeyCryptoMode);\r\n\t\t\tcipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(salt) );\r\n\t\t\treturn cipher.doFinal(encoded);\r\n\t\t} catch (Exception e){\r\n\t\t\tthrow new ModelException(\"Error decrypting cipherText \"+cipherText,e);\r\n\t\t}\r\n\t}", "public static void dec(String cipherText, String key) {\n char msg[] = cipherText.toCharArray();\n int msglen = msg.length;\n int i,j;\n \n // Creating new char arrays\n char keygenerator[] = new char[msglen];\n char encMsg[] = new char[msglen];\n char decdMsg[] = new char[msglen];\n \n /* Generate key, using keyword in cyclic manner equal to the length of original message i.e plaintext */\n for(i = 0, j = 0; i <msglen; ++i, ++j)\n {\n if(j == key.length() - 1)\n {\n j = 0;\n }\n keygenerator[i] = key.charAt(j);\n }\n \n //Decryption\n for(i = 0; i < msglen; ++i) {\n decdMsg[i] = (char)((((encMsg[i] - keygenerator[i]) + 26) % 26) + 'A');\n }\n\n System.out.println(\"Decrypted Message: \" + String.valueOf(decdMsg));\n }", "public static byte[] aesDecrypt(byte[] ciphertext, SecretKey decryptionKey) {\n\t\t\n\t\tbyte[] result = null;\n\t\tCipher cipher;\n\t\ttry {\n\t\t\t// Using our custom-constant salt and iteration count\n\t\t\tcipher = Cipher.getInstance(\"PBEWithSHA256And256BitAES-CBC-BC\");\n\t\t\tbyte[] salt = \"Extr3m3lyS3cr3tSalt!\".getBytes();\n\t\t\tint count = 20;\n\t\t\tPBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, count);\n\t\t\tcipher.init(Cipher.DECRYPT_MODE, decryptionKey, pbeParamSpec);\n\t\t\tresult = cipher.doFinal(ciphertext);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\n\t\treturn result;\n\t}", "public byte[] decrypt(byte[] input, Key privKey) throws Exception {\n\t\tcipher.init(Cipher.DECRYPT_MODE, privKey);\n\t\treturn cipher.doFinal(input);\t\n\t}", "protected void setDecripted() {\n content = this.aesKey.decrypt(this.content);\n }", "public static String decrypt(String s, char key) {\n \treturn Utilities.decrypt(s, (byte) key);\n }", "@Component\npublic interface Crypto {\n // returns a new secret key\n String newKey();\n\n // encrypts a plain text\n byte[] encrypt(String plaintext);\n\n // decrypts a cipher\n byte[] decrypt(byte[] encryptedData, short keyIx);\n\n // gets the index of the encryption key to use - 0 = no key, 1 or 2 for the two available keys\n short getKeyIx();\n\n // gets the index of the default key\n short getDefaultKeyIx();\n\n // gets the date after which the default key is no longer valid\n String getDefaultKeyExpiry();\n}", "public Element Decrypt(CCA2KPABEpp pp, CCA2KPABEsk sk, CCA2KPABEct ct){\n\t\tif(!this.Audit(pp, ct)){\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\tElement key = CCA2KPABEPolicyNode.decrypt(pp, ct, sk.getPolicyTree());\n\t\tif (key == null){\n\t\t\tStdOut.println(\"Do not satisfy the access policy, decrypt fail...\");\n\t\t\treturn null;\n\t\t}\n\t\tStdOut.println(\"LLWCPABE Decrypt: Encapsulated key = \" + key);\n\t\treturn key;\n\t}", "public static String breakCipher(String input) {\n int key = getKey(input);\n System.out.println(\"Found key: \"+key);\n CaesarCipherOne cc = new CaesarCipherOne(key);\n return cc.decrypt(input);\n \n }", "public int decryptStorage(String password) throws RemoteException;", "private static String decryptAES() {\n\t\tString inFilename = \"7hex.txt\";\n\t\ttry {\n\t\t\tFileReader fr = new FileReader(inFilename);\n\t\t\tBufferedReader br = new BufferedReader(fr);\n\n\t\t\tfinal String keyHex = asciiToHex(\"YELLOW SUBMARINE\");\n\t\t\tfinal String cipherHex = br.readLine();\n\n\t\t\tSecretKey key = new SecretKeySpec(DatatypeConverter.parseHexBinary(keyHex), \"AES\");\n\t\t\tCipher cipher = Cipher.getInstance(\"AES/ECB/NoPadding\");\n\t\t\tcipher.init(Cipher.DECRYPT_MODE, key);\n\t\t\tbyte[] result = cipher.doFinal(DatatypeConverter.parseHexBinary(cipherHex));\n\n\t\t\tbr.close();\n\t\t\tfr.close();\n\n\t\t\treturn new String(result);\n\t\t} catch (Exception e) {\n\t\t\treturn null;\n\t\t}\n\t}", "public static String decrypt(String strToDecrypt)\n {\n try\n {\n Cipher cipher = Cipher.getInstance(\"AES/ECB/PKCS5PADDING\");\n final SecretKeySpec secretKey = new SecretKeySpec(key, \"AES\");\n cipher.init(Cipher.DECRYPT_MODE, secretKey);\n final String decryptedString = new String(cipher.doFinal(Base64.decodeBase64(strToDecrypt)));\n return decryptedString;\n }\n catch (Exception e)\n {\n e.printStackTrace();\n\n }\n return null;\n }", "public static byte[] decrypt(final byte[] input, final PrivateKey key) throws DattackSecurityException {\n return execEncryptionOperation(input, Cipher.DECRYPT_MODE, key);\n }", "private String key() {\n return \"secret\";\n }", "public String decryptAESKey(String encryptedAESKey, PrivateKey privateKey) throws Exception {\r\n Cipher cipher = Cipher.getInstance(\"RSA\");\r\n cipher.init(Cipher.DECRYPT_MODE, privateKey);\r\n return new String(cipher.doFinal(Base64.getDecoder().decode(encryptedAESKey)));\r\n }", "public String decode(String cipher)\n {\n \treturn null;\n }", "public abstract String decryptMsg(String msg);", "@Test\n\tpublic void testDecrypt() throws GeneralSecurityException, IOException {\n\t\tString cipher = \"4VGdDR9qJlq36bQGI+Sx3A==\";\n\t\tString key = \"io.github.odys-z\";\n\t\tString iv = \"DITVJZA2mSDAw496hBz6BA==\";\n\t\tString plain = AESHelper.decrypt(cipher, key,\n\t\t\t\t\t\t\tAESHelper.decode64(iv));\n\t\tassertEquals(\"Plain Text\", plain.trim());\n\n\t\tplain = \"-----------admin\";\n\t\tkey = \"----------123456\";\n\t\tiv = \"ZqlZsmoC3SNd2YeTTCkbVw==\";\n\t\t// PCKS7 Padding results not suitable for here - AES-128/CBC/NoPadding\n\t\tassertNotEquals(\"3A0hfZiaozpwMeYs3nXdAb8mGtVc1KyGTyad7GZI8oM=\",\n\t\t\t\tAESHelper.encrypt(plain, key, AESHelper.decode64(iv)));\n\t\t\n\t\tiv = \"CTpAnB/jSRQTvelFwmJnlA==\";\n\t\tassertEquals(\"WQiXlFCt5AGCabjSCkVh0Q==\",\n\t\t\t\tAESHelper.encrypt(plain, key, AESHelper.decode64(iv)));\n\t}", "public String decrypt(String text) {\n return content.decrypt(text);\n }", "public interface EncryptionService {\n\n String decryptValue(String encrypted);\n String encryptValue(String value, String userName);\n}", "private String decrypt(String encryptedData) throws Exception {\n Key key = generateKey();\n Cipher c = Cipher.getInstance(ALGO);\n c.init(Cipher.DECRYPT_MODE, key);\n byte[] decordedValue = Base64.getDecoder().decode(encryptedData);\n byte[] decValue = c.doFinal(decordedValue);\n String result = new String(decValue);\n return result;\n }", "public String decryptPassword(String encrypted) {\n Preconditions.checkArgument(this.encryptor.isPresent(),\n \"A master password needs to be provided for decrypting passwords.\");\n\n try {\n return this.encryptor.get().decrypt(encrypted);\n } catch (Exception e) {\n throw new RuntimeException(\"Failed to decrypt password \" + encrypted, e);\n }\n }", "public byte[] aesDecryptCipheredSecret(byte[] cipheredSecret) {\n return null;\n }", "public String getKeyPrivate() throws LibMCryptException {\n\t\t\r\n\t\tString privateK = priK.getModulus().toString(16);\r\n\t\treturn privateK;\r\n\t}", "public byte[] decrypt(byte[] data) throws Exception {\n // call overriden function with offset = 0\n return decrypt(data, 0);\n }", "@Override\n public InputStream decrypt(InputStream in, DecryptionKey privateKey) throws IOException {\n byte[] keyLenBytes = new byte[4];\n int triesLeft = 10;\n for (int i = 0; i < 4; i++) {\n while (in.read(keyLenBytes, i, 1) < 1 && --triesLeft > 0) {\n ;\n }\n }\n if (triesLeft == 0)\n throw new IOException(\"didn't get keylen data from ciphertext\");\n int keyLen = ByteBuffer.wrap(keyLenBytes).getInt();\n\n //Deserialize the encapsulated key\n byte[] encapsulatedKeyBytes = new byte[keyLen];\n triesLeft = 10;\n for (int i = 0; i < keyLen; i++) {\n while (in.read(encapsulatedKeyBytes, i, 1) < 1 && --triesLeft > 0) {\n ; //TODO: don't read byte by byte...\n }\n }\n if (triesLeft == 0)\n throw new IOException(\"couldn't read encapulated key from ciphertext\");\n CipherText encapsulatedKey =\n kem.restoreEncapsulatedKey(new JSONConverter().deserialize(new String(encapsulatedKeyBytes)));\n\n //decaps the encapsulated key\n SymmetricKey symmetricKey = kem.decaps(encapsulatedKey, privateKey);\n\n //Return a stream where caller can read the decrypted payload\n return symmetricScheme.decrypt(in, symmetricKey);\n }", "public String decrypt( String nonce, String ciphertext ) throws Exception\n\t{\n\t\t// read key from file\n\t\tBufferedReader buf = new BufferedReader( new FileReader(keyFile) );\n\t\tString keystr = buf.readLine();\n\t\tbuf.close();\n\n\t\t// create secret key\n\t\tString keyType = \"PBEWithMD5AndDES\";\n\t\tchar[] keyChars = keystr.toCharArray();\n\t\tbyte[] nonceBytes = nonce.getBytes();\n \tSecretKeyFactory factory = SecretKeyFactory.getInstance( keyType );\n \tPBEKeySpec spec = new PBEKeySpec( keyChars, nonceBytes, 1024, 128 );\n \tSecretKey raw = factory.generateSecret( spec );\n \tSecretKey key = new SecretKeySpec( raw.getEncoded(), \"AES\" );\n\n\t\t// decode and decrypt\n\t\tbyte[] decoded = Base64.decodeBase64( ciphertext );\n\t\tCipher cipher = Cipher.getInstance( \"AES/CBC/PKCS5Padding\" );\n\t\tIvParameterSpec params = new IvParameterSpec( nonceBytes );\n\t\tcipher.init( Cipher.DECRYPT_MODE, key, params );\n\t\treturn new String( cipher.doFinal(decoded) );\n\t}", "private char decrypt(char ch) {\n char chUC = Character.toUpperCase(ch);\n int cind = ALPHABET.indexOf(chUC);\n // do not decrypt non letters\n if (cind == -1) return ch;\n \n // index of decrypted character\n int dind = (cind - key) % 26;\n \n // java can return negative from modulo:\n if (dind <0) dind+=26;\n \n // decrypted uppercase character\n char dch = ALPHABET.charAt(dind);\n \n // check original case and return decrypted char\n if (Character.isUpperCase(ch)) return dch;\n else return Character.toLowerCase(dch);\n }", "void decryptCode() {\n StringBuilder temp = new StringBuilder(\"\");\n\n // go through entire phrase\n for (int i = 0; i < this.getText().length(); ++i) {\n\n // append char to temp if char at i is not a multiple of z\n if (!(i % Character.getNumericValue(this.secretKey.charAt(7)) == 0) || i == 0)\n temp.append(this.getText().charAt(i));\n }\n\n this.setText(temp);\n\n \n // Step 2:\n\n // split phrase up into words\n ArrayList<String> words = new ArrayList<>(Arrays.asList(this.text.toString().split(\" \")));\n\n for (int i = 0; i < words.size(); ++i) {\n\n // if y1x3x4 is at the end of the word, remove it from word\n \n if (words.get(i).substring(words.get(i).length() - 3, words.get(i).length())\n .equals(this.getSecretKey().substring(3, 6)))\n words.set(i, words.get(i).substring(0, words.get(i).length() - 3));\n\n // if x1x2 is at the end of the word\n else {\n // remove x1x2 from end\n words.set(i, words.get(i).substring(0, words.get(i).length() - 2));\n \n // move last char to beginning\n words.set(i, words.get(i).charAt(words.get(i).length() - 1) + words.get(i).substring(0, words.get(i).length() - 1));\n }\n }\n\n temp = new StringBuilder(\"\");\n\n for (String word : words)\n temp.append(word + \" \");\n\n this.setText(temp);\n }", "public String decrypt(String word){\n\tString result = \"\";\n\tString wordLower = word.toLowerCase(); \n\tfor(int i=0; i<wordLower.length(); i++){\n\t if(wordLower.charAt(i)<97 || wordLower.charAt(i)>122)\n\t\tthrow new IllegalArgumentException();\n\t int a = (wordLower.charAt(i)-97);\n\t int b = (int)Math.pow(a,privateD);\n\t int k = (b%26)+97;\n\t result += Character.toString((char)k);\n\t}\n\treturn result;\n }", "@Test\n public void testDesDecrypt() {\n\n }", "public byte[] decrypt(byte[] message, PrivateKey key) throws GeneralSecurityException {\n ByteBuffer buffer = ByteBuffer.wrap(message);\n int keyLength = buffer.getInt();\n byte[] encyptedPublicKey = new byte[keyLength];\n buffer.get(encyptedPublicKey);\n\n Cipher cipher = Cipher.getInstance(\"RSA\");\n cipher.init(Cipher.DECRYPT_MODE, key);\n\n byte[] encodedPublicKey = cipher.doFinal(encyptedPublicKey);\n\n aes.setKeyValue(new String(encodedPublicKey));\n byte[] encryptedMessage = new byte[buffer.remaining()];\n buffer.get(encryptedMessage);\n String decrypt_message = \"\";\n try {\n decrypt_message = aes.decrypt(new String(encryptedMessage));\n } catch (Exception e) {\n e.printStackTrace();\n }\n return decrypt_message.getBytes();\n }", "public static String decryptString(String text, int key) {\r\n String decryptedText = \"\";\r\n String alpha = shiftAlphabet(0);\r\n String newAlpha = shiftAlphabet(key);\r\n text = ungroupify(text);\r\n for (int i = 0; i < text.length(); i++) {\r\n String currentLetter = String.valueOf(text.charAt(i));\r\n int indexOfLetter = newAlpha.indexOf(currentLetter);\r\n String letterReplacement = String.valueOf(alpha.charAt(indexOfLetter));\r\n decryptedText += letterReplacement;\r\n\r\n }\r\n return decryptedText;\r\n }" ]
[ "0.7737744", "0.74817395", "0.66638833", "0.663611", "0.65996146", "0.65556294", "0.65026575", "0.64997405", "0.6492199", "0.6439102", "0.6390989", "0.6343245", "0.63043165", "0.62187696", "0.61664504", "0.61566824", "0.61553204", "0.6133659", "0.61090195", "0.60888684", "0.60882527", "0.60696393", "0.60527545", "0.6037876", "0.60258406", "0.6009561", "0.60085243", "0.60039026", "0.5973556", "0.5946968", "0.5920812", "0.59207946", "0.5896063", "0.5883319", "0.5879368", "0.58678854", "0.5850136", "0.5845191", "0.58109885", "0.5787848", "0.5776349", "0.57753444", "0.57612777", "0.57606965", "0.57561195", "0.57162845", "0.5715968", "0.5679054", "0.56731564", "0.56726694", "0.56719106", "0.5669033", "0.5650042", "0.56479615", "0.56467897", "0.5636851", "0.56260383", "0.562551", "0.5617429", "0.5617309", "0.5613374", "0.5595202", "0.559269", "0.5589619", "0.55857325", "0.5582603", "0.55802757", "0.5572241", "0.55647266", "0.5561911", "0.5548656", "0.55386084", "0.5536065", "0.55300856", "0.5526275", "0.5513078", "0.5510229", "0.550195", "0.55006015", "0.54920083", "0.5485639", "0.54779714", "0.5477124", "0.54645723", "0.54621565", "0.54617804", "0.5453779", "0.54344857", "0.5431143", "0.54286474", "0.5414217", "0.54124296", "0.54107535", "0.5409552", "0.54071337", "0.53970075", "0.53935057", "0.53920823", "0.5391568", "0.5388669" ]
0.6454952
9
Algorithm used to encrypt or decrypt
private String vigenereAlgo(boolean encrypt){ List<Integer> key = EncryptionUtils.stringToIntList(algo.getKey()); List<Integer> value = EncryptionUtils.stringToIntList(algo.getValue()); int keyLength = key.size(); int valueLength = value.size(); List<Integer> crypt = new ArrayList<>(); for (int i = 0; i < valueLength; i++){ crypt.add(Math.floorMod(value.get(i)-EncryptionUtils.FIRST+ mult(encrypt)* (key.get(i%keyLength)-EncryptionUtils.FIRST),EncryptionUtils.SIZE) +EncryptionUtils.FIRST); } return EncryptionUtils.intListToString(crypt); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Encryption encryption();", "public interface EncryptionAlgorithm {\n\n public String encrypt(String plaintext);\n\n}", "public String Crypt(String s);", "public interface ICryptoEngine \n{\n\t/**\n\t * Initialize the \n\t * \n\t * @param forEncryption should the engine be initialized for encryption (true) or decryption (false)\n\t * @param key - symmetric encryption key\n\t * \n\t * @throws IllegalStateException - if any initialization parameters are invalid\n\t */\n\tpublic void init(boolean forEncryption, byte[] key) throws IllegalStateException;\n\t\n\t/**\n\t * @return name of the encryption algorithm\n\t */\n\tpublic String getAlgorithmName();\n\t\n\t/**\n\t * @return block size of the encryption algorithm\n\t */\n\tpublic int getBlockSize();\n\t\n\t/**\n\t * Performs an encryption or decryption of a block.\n\t * The amount of processed data depends on the actual algorithm's block size \n\t * \n\t * @param in - buffer with the data to be processed\n\t * @param inOff - starting position of the data at 'in'\n\t * @param out - preallocated buffer to store the processed data\n\t * @param outOff - starting position at 'out'\n\t * \n\t * @return size of processed data (typically algorithm's block size)\n\t * \n\t * @throws IllegalStateException if engine was not initialized or buffers are invalid\n\t */\n\tpublic int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws IllegalStateException;\n\t\n\t/**\n\t * Resets the encryption engine (if required by the implementation)\n\t */\n\tpublic void reset();\n}", "public interface ICrypto\n{\n\t/**\n\t *\n\t * @return\ttrue for Public/Private key and false for password style encryption\n\t */\n\tboolean isPublic();\n\n\t/**\n\t * @param clearText\t\tClear text\n\t * @return\t\t\t\tStringized (BasicBase64) version of the cipher for the clear text\n\t */\n\tString encrypt(String clearText);\n\n\t/**\n\t * @param cipherText\tClear text\n\t * @return\t\t\t\tClear text from the stringized (BasicBase64) version of the cipherTetxt\n\t */\n\tString decrypt(String cipherText);\n\n\t/**\n\t * @return\tThe cryptography algorithm\n\t */\n\tString getAlgorithm();\n\n\t/**\n\t *\n\t * @return\tThe name by which this combination algorithm/key are known.\n\t */\n\tString getAliasName();\n}", "public CryptObject reencrypt(Ciphertext ciphertext);", "String encryption(Long key, String encryptionContent);", "byte[] encrypt(String plaintext);", "public String encrypt(String geheimtext);", "public interface AES {\n\n public String encrypt(String strToEncrypt);\n\n public String decrypt(String strToDecrypt);\n\n public String getSecretKeyWord();\n}", "public String Decrypt(String s);", "public int getAlgorithm()\n {\n return publicPk.getAlgorithm();\n }", "private void encryptionAlgorithm() {\n\t\ttry {\n\t\t\t\n\t\t\tFileInputStream fileInputStream2=new FileInputStream(\"D:\\\\program\\\\key.txt\");\n\t\t\tchar key=(char)fileInputStream2.read();\n\t\t\tSystem.out.println(key);\n\t\t\tFileInputStream fileInputStream1=new FileInputStream(\"D:\\\\program\\\\message.txt\");\n\t\t\tint i=0;\n\t\t\t\n\t\t\tStringBuilder message=new StringBuilder();\n\t\t\twhile((i= fileInputStream1.read())!= -1 )\n\t\t\t{\n\t\t\t\tmessage.append((char)i);\n\t\t\t}\n\t\t\tString s=message.toString();\n\t\t\tchar[] letters=new char[s.length()];\n\t\t\tStringBuilder en=new StringBuilder();\n\t\t\tfor(int j = 0;j < letters.length;j++)\n\t\t\t{\n\t\t\t\ten.append((char)(byte)letters[j]+key);\n\t\t\t}\t\t\n\t\t\tFileOutputStream fileoutput=new FileOutputStream(\"D:\\\\program\\\\encryptedfile.txt\");\n\t\t\t\n\t\t\tfileInputStream1.close();\n\t\t\tfileInputStream2.close();\n\t\t\t\n\t\t}\n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t\n\t}", "public String encrypt(String plainText);", "private static String m5297cj() {\n try {\n KeyGenerator instance = KeyGenerator.getInstance(\"AES\");\n instance.init(128);\n return Base64.encodeToString(instance.generateKey().getEncoded(), 0);\n } catch (Throwable unused) {\n return null;\n }\n }", "@Test\r\n public void testEncrypt()\r\n {\r\n System.out.println(\"encrypt\");\r\n String input = \"Hello how are you?\";\r\n KeyMaker km = new KeyMaker();\r\n SecretKeySpec sks = new SecretKeySpec(km.makeKeyDriver(\"myPassword\"), \"AES\");\r\n EncyptDecrypt instance = new EncyptDecrypt();\r\n String expResult = \"0fqylTncsgycZJQ+J5pS7v6/fj8M/fz4bavB/SnIBOQ=\";\r\n String result = instance.encrypt(input, sks);\r\n assertEquals(expResult, result);\r\n }", "public interface Cipher {\n\n /*\n return key of the cipher\n */\n int getKey();\n\n /*\n set key of the cipher\n */\n void setKey(int key);\n\n /*\n cipher text/char based on the key\n */\n char cipher(int charToCipher);\n\n /*\n decipher text/char based on the key\n */\n char decipher(int charToDeCipher);\n}", "String getHashAlgorithm();", "public String getEncryptionAlgOID()\n {\n return encryptionAlgorithm.getAlgorithm().getId();\n }", "public CaesarCipherOne(int key) {this.key=key;}", "public byte[] Tencryption() {\n int[] ciphertext = new int[message.length];\n\n for (int j = 0, k = 1; j < message.length && k < message.length; j = j + 2, k = k + 2) {\n sum = 0;\n l = message[j];\n r = message[k];\n for (int i = 0; i < 32; i++) {\n sum = sum + delta;\n l = l + (((r << 4) + key[0]) ^ (r + sum) ^ ((r >> 5) + key[1]));\n r = r + (((l << 4) + key[2]) ^ (l + sum) ^ ((l >> 5) + key[3]));\n }\n ciphertext[j] = l;\n ciphertext[k] = r;\n }\n return this.Inttobyte(ciphertext);\n\n }", "public String getJCEAlgorithmString() {\n/* 187 */ return this.signatureAlgorithm.engineGetJCEAlgorithmString();\n/* */ }", "public byte[] encrypto(String base) throws Exception {\n\t\tSecretKeyFactory keyFactory = SecretKeyFactory.getInstance(PBKDF2);\r\n\t\tKeySpec pbeKeySpec = new PBEKeySpec(\"password\".toCharArray(), \"salt\".getBytes(), 1023, 128);\r\n\t\tSecretKey pbeSecretKey = keyFactory.generateSecret(pbeKeySpec);\r\n\t\t// Create SecretKey for AES by KeyFactory-With-Hmac\r\n\t\tSecretKey aesSecretKey = new SecretKeySpec(pbeSecretKey.getEncoded(), AES);\r\n\t\t\r\n\t\tCipher cipher = Cipher.getInstance(AES_CBC_PKCS5PADDING);\r\n//\t\tcipher.init(Cipher.ENCRYPT_MODE, aesSecretKey, SecureRandom.getInstance(\"SHA1PRNG\"));\r\n\t\tcipher.init(Cipher.ENCRYPT_MODE, aesSecretKey);\r\n\t\tbyte[] encrypted = cipher.doFinal(base.getBytes());\r\n\r\n\t\tSystem.out.println(\"IV: \" + new String(cipher.getIV()));\r\n\t\tSystem.out.println(\"AlgorithmParameter: \" + cipher.getParameters().getEncoded());\r\n\t\tCipher decryptor = Cipher.getInstance(AES_CBC_PKCS5PADDING);\r\n\t\tdecryptor.init(Cipher.DECRYPT_MODE, aesSecretKey, new IvParameterSpec(cipher.getIV()));\r\n\t\tSystem.out.println(\"Decrypted: \" + new String(decryptor.doFinal(encrypted)));\r\n\t\t\r\n\t\treturn encrypted;\r\n\t}", "private native int native_crypt(long cookie, byte[] in, int inOffset,\n byte[] out, int outOffset, boolean encrypt);", "@org.junit.Test\n public void testCipher() {\n Assert.assertEquals(\"DITISGEHEIM\", Vigenere.cipher(\"DITISGEHEIM\", \"A\", true));\n Assert.assertEquals(\"DITISGEHEIM\", Vigenere.cipher(\"DITISGEHEIM\", \"A\", false));\n\n Assert.assertEquals(\"B\", Vigenere.cipher(\"A\", \"B\", true));\n Assert.assertEquals(\"A\", Vigenere.cipher(\"B\", \"B\", false));\n\n String plain = \"DUCOFIJMA\";\n String key = \"ABC\";\n String shouldEncryptTo = \"DVEOGKJNC\";\n String actualEncrypted = Vigenere.cipher(plain, key, true);\n Assert.assertEquals(shouldEncryptTo, actualEncrypted);\n String decrypted = Vigenere.cipher(shouldEncryptTo, key, false);\n Assert.assertEquals(plain, decrypted);\n }", "public void encrypt() {\n // JOptionPane.showMessageDialog(null, \"Encrypting ... Action-Type = \" + DES_action_type);\n int[] flipped_last2_cipher_rounds = new int[64];\n for (int i = 0; i < 32; i++) {\n flipped_last2_cipher_rounds[i] = DES_cipher_sequence[17][i];\n flipped_last2_cipher_rounds[32 + i] = DES_cipher_sequence[16][i];\n }\n DES_ciphertext = select(flipped_last2_cipher_rounds, FP);\n }", "public void testCaesar(){\n String msg = \"At noon be in the conference room with your hat on for a surprise party. YELL LOUD!\";\n \n /*String encrypted = encrypt(msg, key);\n System.out.println(\"encrypted \" +encrypted);\n \n String decrypted = encrypt(encrypted, 26-key);\n System.out.println(\"decrypted \" + decrypted);*/\n \n \n String encrypted = encrypt(msg, 15);\n System.out.println(\"encrypted \" +encrypted);\n \n }", "public Cipher()\n {\n CodecInterface base64UriCodec = new Base64UriCodec();\n AsymmetricBlockCipher rsaCipher = new OAEPEncoding(\n new RSAEngine(),\n new SHA1Digest()\n );\n BufferedBlockCipher aesCipher = new PaddedBufferedBlockCipher(\n new CBCBlockCipher(new AESEngine()),\n new PKCS7Padding()\n );\n Digest sha1Digest = new SHA1Digest();\n SecureRandom random = new SecureRandom();\n\n this.encryptionCipher = new EncryptionCipher(\n base64UriCodec,\n rsaCipher,\n aesCipher,\n sha1Digest,\n random\n );\n this.decryptionCipher = new DecryptionCipher(\n base64UriCodec,\n rsaCipher,\n aesCipher,\n sha1Digest\n );\n }", "String getMessageDigestAlgorithm();", "public EncryptorReturn decrytp(String in) throws CustomizeEncryptorException;", "public String cipher() {\n int[] r1taps = {13, 16, 17, 18};\n int[] r2taps = {20, 21};\n int[] r3taps = {7, 20, 21, 22};\n\n // Set register size and majority bits\n final int R1 = 19;\n final int R1M = 8;\n final int R2 = 22;\n final int R2M = 10;\n final int R3 = 23;\n final int R3M = 10;\n\n // Initialize variables\n String bs = \"\";\n byte[] key = HexStringToBytes(symKey);\n BitSet keySet = new BitSet();\n BitSet keyStream = new BitSet();\n BitSet messageSet = new BitSet();\n\n // Create a byte array length of sample message\n byte[] messageArray = new byte[message.length()];\n\n // Convert the sample message to a byte array\n try {\n messageArray = message.getBytes(\"ISO-8859-1\");\n } catch (Exception e) {\n System.out.println(\"Error: \" + e);\n }\n\n // Convert message sample byte array to string\n String as = \"\";\n for (int i = 0; i < messageArray.length; i++) {\n byte b1 = messageArray[i];\n String s = String.format(\"%8s\", Integer.toBinaryString(b1 & 0xFF))\n .replace(' ', '0');\n as += s;\n }\n\n // Convert string of bits to a BitSet\n messageSet = BitStringToBitSet(as);\n\n // Creates string from key byte array\n for (int i = 0; i < 8; i++) {\n byte b1 = key[i];\n String s = String.format(\"%8s\", Integer.toBinaryString(b1 & 0xFF))\n .replace(' ', '0');\n bs += s;\n }\n\n // Convert string of bits to a BitSet\n keySet = BitStringToBitSet(bs);\n\n // Initialize registers\n BitSet r1 = new BitSet();\n BitSet r2 = new BitSet();\n BitSet r3 = new BitSet();\n\n // Process key into registers\n for (int i = 0; i < 64; i++) {\n r1 = ShiftSet(r1, R1, keySet.get(i) ^ Tap(r1, r1taps));\n r2 = ShiftSet(r2, R2, keySet.get(i) ^ Tap(r2, r2taps));\n r3 = ShiftSet(r3, R3, keySet.get(i) ^ Tap(r3, r3taps));\n }\n\n // Clock additional 100 times for additional security (GSM standard)\n for (int i = 0; i < 100; i++) {\n int maj = 0;\n boolean[] ar = {false, false, false};\n if (r1.get(R1M) == true) {\n ar[0] = true;\n maj += 1;\n }\n if (r2.get(R2M) == true) {\n ar[1] = true;\n maj += 1;\n }\n if (r3.get(R3M) == true) {\n ar[2] = true;\n maj += 1;\n }\n // If majority is false (0 bit)\n if (maj <= 1) {\n if (ar[0] == false) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == false) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == false) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n // Else majority is true\n } else {\n if (ar[0] == true) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == true) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == true) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n }\n }\n\n // Create keystream as long as the sample message\n for (int i = 0; i < message.length() * 8; i++) {\n\n // Get keystream bit\n keyStream.set(i, r1.get(R1 - 1) ^ r2.get(R2 - 1) ^ r3.get(R3 - 1));\n\n // Shift majority registers\n int maj = 0;\n boolean[] ar = {false, false, false};\n if (r1.get(R1M) == true) {\n ar[0] = true;\n maj += 1;\n }\n if (r2.get(R2M) == true) {\n ar[1] = true;\n maj += 1;\n }\n if (r3.get(R3M) == true) {\n ar[2] = true;\n maj += 1;\n }\n // If majority is false (0 bit)\n if (maj <= 1) {\n if (ar[0] == false) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == false) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == false) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n // Else majority is true\n } else {\n if (ar[0] == true) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == true) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == true) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n }\n\n }\n\n // XOR the message with the created keystream and return as string\n messageSet.xor(keyStream);\n return BitStringToText(ReturnSet(messageSet, message.length() * 8));\n }", "public static byte[] encryptText(String plainText,SecretKey secKey) throws Exception{\n\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n\r\n aesCipher.init(Cipher.ENCRYPT_MODE, secKey);\r\n\r\n byte[] byteCipherText = aesCipher.doFinal(plainText.getBytes());\r\n\r\n return byteCipherText;\r\n\r\n}", "public doEncryptNotifdeEncode() {\n\t}", "public EncryptorReturn encrypt(String in) throws CustomizeEncryptorException;", "public interface EncryptionMethod {\n /**\n * Returns the algorithm applied to the cipher data.\n *\n * @return the encryption algorithm.\n */\n String getAlgorithm();\n\n /**\n * Returns the key size of the key of the algorithm applied to the cipher\n * data.\n *\n * @return the key size.\n */\n int getKeySize();\n\n /**\n * Sets the size of the key of the algorithm applied to the cipher data.\n *\n * @param size the key size.\n */\n void setKeySize(int size);\n\n /**\n * Returns the OAEP parameters of the algorithm applied applied to the\n * cipher data.\n *\n * @return the OAEP parameters.\n */\n byte[] getOAEPparams();\n\n /**\n * Sets the OAEP parameters.\n *\n * @param parameters the OAEP parameters.\n */\n void setOAEPparams(byte[] parameters);\n\n /**\n * Set the Digest Algorithm to use\n * @param digestAlgorithm the Digest Algorithm to use\n */\n void setDigestAlgorithm(String digestAlgorithm);\n\n /**\n * Get the Digest Algorithm to use\n * @return the Digest Algorithm to use\n */\n String getDigestAlgorithm();\n\n /**\n * Set the MGF Algorithm to use\n * @param mgfAlgorithm the MGF Algorithm to use\n */\n void setMGFAlgorithm(String mgfAlgorithm);\n\n /**\n * Get the MGF Algorithm to use\n * @return the MGF Algorithm to use\n */\n String getMGFAlgorithm();\n\n /**\n * Returns an iterator over all the additional elements contained in the\n * <code>EncryptionMethod</code>.\n *\n * @return an <code>Iterator</code> over all the additional information\n * about the <code>EncryptionMethod</code>.\n */\n Iterator<Element> getEncryptionMethodInformation();\n\n /**\n * Adds encryption method information.\n *\n * @param information additional encryption method information.\n */\n void addEncryptionMethodInformation(Element information);\n\n /**\n * Removes encryption method information.\n *\n * @param information the information to remove from the\n * <code>EncryptionMethod</code>.\n */\n void removeEncryptionMethodInformation(Element information);\n}", "java.lang.String getCryptProvider();", "public void stringcon()\n {\n int i,j,k;\n int temp[]=new int[8];\n int a[]=new int[32];\n i=0;\n j=0;\n for(i=0;i<10000;i++)\n bytes[i]=0;\n i=0;\n maxbinary1=0;\n for(i=0;i<24;i++)\n a[i]=binary[i];\n for(i=0;i<24;i++)\n maxbinary1+=a[i]*Math.pow(2,23-i);\n maxbinary2=maxbinary1*8;\n ivalue=0;\n for(i=24,j=0;i<32;i++,j++)\n {\n a[j]=binary[i];\n ivalue+=a[j]*Math.pow(2,7-j);\n }\n if(ivalue==73)\n {\n i=32;\n while(i<maxbinary2)\n {\n for(k=0;k<=7;k++)\n temp[k]=binary[i++];\n for(k=0;k<=7;k++)\n bytes[j]+=temp[k]*Math.pow(2,7-k);\n j++;\n }\n String s=JOptionPane.showInputDialog(this,\"Enter key with 16 letters\");\n char ch[]=new char[s.length()];\n ch=s.toCharArray();\n try\n {\n FileOutputStream f=new FileOutputStream(\"key1.txt\");\n for(i=0;i<ch.length;i++)\n f.write(ch[i]);\n f.close();\n FileOutputStream fout=new FileOutputStream(\"enc1.txt\");\n DataOutputStream d=new DataOutputStream(fout);\n \t\ti=8;\n while(i<(maxbinary1))\n \t\t {\n \t\t\td.write(bytes[i]);\n\t\t i++;\n \t\t }\n fout.close();\n }\n catch(Exception e)\n {\n System.out.println(e);\n }\n\n ideaalgo b=new ideaalgo();\n b.procedure();\n b.decryption(\"enc1.txt\");\n try\n {\n BufferedReader d;\n StringBuffer sb=new StringBuffer();\n d=new BufferedReader(new FileReader(\"dec.txt\"));\n String line;\n while((line=d.readLine())!=null)\n sb.append(line+\"\\n\");\n ta.setText(sb.toString());\n d.close();\n }\ncatch(Exception e)\n {\n System.out.println(e);\n }\n }\n}", "public CryptObject encrypt(BigIntegerMod message);", "@Override\n public void encrypt() {\n algo.encrypt();\n String cypher = vigenereAlgo(true);\n this.setValue(cypher);\n }", "public static void main(String[] args) \r\n {\r\n /*\r\n String data = \"This is a very important statement.\";\r\n String key = \"How old is my computer?\";\r\n KeyGenerator kGen = new KeyGenerator(key);\r\n String nK = kGen.getNumericKey();\r\n \r\n ArmstrongManager aMgr = new ArmstrongManager(nK);\r\n ColorManager cMgr = new ColorManager(nK);\r\n \r\n String encData =\"\";\r\n int temp;\r\n int i;\r\n for(i =0 ; i < data.length(); i++)\r\n {\r\n temp = aMgr.encrypt(data.charAt(i));\r\n temp = cMgr.encrypt(temp);\r\n encData = encData + (char)temp;\r\n }\r\n \r\n String decData= \"\";\r\n for(i =0 ; i < encData.length(); i++)\r\n {\r\n temp = cMgr.decrypt(encData.charAt(i));\r\n temp = aMgr.decrypt(temp);\r\n \r\n decData = decData + (char)temp;\r\n }\r\n \r\n \r\n System.out.println(\"data: \"+ data + \" \" + data.length());\r\n System.out.println(\"enc data: \"+ encData + \" \" + encData.length());\r\n System.out.println(\"dec data: \"+ decData + \" \" + decData.length());\r\n */\r\n \r\n try\r\n {\r\n //String src = \"d:/a.txt\";//images/kids.jpg\";\r\n //String enc = \"d:/e_a.txt\";//images/e_kids.jpg\";\r\n //String dec = \"d:/d_a.txt\";//images/d_kids.jpg\";\r\n String src = \"d:/images/kids.jpg\";\r\n String enc = \"d:/images/e_kids.jpg\";\r\n String dec = \"d:/images/d_kids.jpg\";\r\n\r\n String key = \"How old is my computer?\";\r\n\r\n Encryptor objEnc = new Encryptor(key);\r\n Decryptor objDec = new Decryptor(key);\r\n\r\n objEnc.encrypt(src, enc);\r\n System.out.println(\"Encryption Done\");\r\n \r\n objDec.decrypt(enc, dec);\r\n System.out.println(\"Decryption Done\");\r\n \r\n\r\n }\r\n catch(Exception ex)\r\n {\r\n System.out.println(\"Err: \" +ex.getMessage());\r\n }\r\n }", "public abstract String encryptMsg(String msg);", "private String teaEncrypt(String plaintext, String password) {\n if (plaintext.length() == 0) {\n return (\"\"); // nothing to encrypt\n }\n // 'escape' plaintext so chars outside ISO-8859-1 work in single-byte packing, but keep\n // spaces as spaces (not '%20') so encrypted text doesn't grow too long (quick & dirty)\n String asciitext = plaintext;\n int[] v = strToLongs(asciitext); // convert string to array of longs\n\n if (v.length <= 1) {\n int[] temp = new int[2];\n temp[0] = 0; // algorithm doesn't work for n<2 so fudge by adding a null\n temp[1] = v[0];\n v = temp;\n }\n int[] k = strToLongs(password.substring(0, 16).toLowerCase()); // simply convert first 16 chars of password as\n // key\n int n = v.length;\n\n // int z = v[n - 1], y = v[0], delta = 0x9E3779B9;\n // int mx, e, q = (int) Math.floor(6 + 52 / n), sum = 0;\n int z = v[n - 1];\n int y = v[0];\n int delta = 0x9E3779B9;\n int mx;\n int e;\n int q = (int) Math.floor(6 + 52 / n);\n int sum = 0;\n\n while (q-- > 0) { // 6 + 52/n operations gives between 6 & 32 mixes on each word\n sum += delta;\n e = sum >>> 2 & 3;\n for (int p = 0; p < n; p++) {\n y = v[(p + 1) % n];\n mx = (z >>> 5 ^ y << 2) + (y >>> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z);\n z = v[p] += mx;\n }\n }\n\n String ciphertext = longsToHexStr(v);\n\n return ciphertext;\n }", "public boolean isEncryptionKey()\n {\n int algorithm = publicPk.getAlgorithm();\n\n return ((algorithm == RSA_GENERAL) || (algorithm == RSA_ENCRYPT)\n || (algorithm == ELGAMAL_ENCRYPT) || (algorithm == ELGAMAL_GENERAL));\n }", "String encrypt(String input) throws IllegalArgumentException, EncryptionException;", "private native void dll_encrypt(String path_in, String path_out, byte[] npub, byte[] key, int alg);", "org.openxmlformats.schemas.presentationml.x2006.main.STAlgType.Enum getCryptAlgorithmType();", "public String encrypt() {\n StringBuilder encryptedText = new StringBuilder();\n //Make sure the key is valid.\n if (key < 0 || key > 25) {\n Log.d(\"TAG\", \"encrypt: Error in Keu=y \");\n return \"Key Must be 0 : 25\";\n }\n if (plaintext.length() <= 0) {\n Log.d(\"TAG\", \"encrypt: Error in Plain\");\n return \"Error in Plaintext\";\n }\n //Eliminates any whitespace and non alpha char's.\n plaintext = plaintext.trim();\n plaintext = plaintext.replaceAll(\"\\\\W\", \"\");\n if (plaintext.contains(\" \")) {\n plaintext = plaintext.replaceAll(\" \", \"\");\n }\n //Makes sure that all the letters are uppercase.\n plaintext = plaintext.toUpperCase();\n Log.i(\"Caesar\", \"encrypt: plainis : \" + plaintext);\n for (int i = 0; i < plaintext.length(); i++) {\n char letter = plaintext.charAt(i);\n if (charMap.containsKey(letter) && charMap.get(letter) != null) {\n int lookUp = (charMap.get(letter) + key) % 26;\n encryptedText.append(encryptionArr[lookUp]);\n }\n }\n Log.d(\"Caesar.java\", \"encrypt: the Data is \" + encryptedText.toString());\n return encryptedText.toString();\n }", "String getDigestAlgorithm();", "String getAlgorithm();", "public String encrypt(String plaintext) {\n\t\tCipher rsaCipher, aesCipher;\n\t\ttry {\n\t\t\t// Create AES key\n\t\t\tKeyGenerator keyGen = KeyGenerator.getInstance(\"AES\");\n\t\t\tkeyGen.init(AES_BITS);\n\t\t\tKey aesKey = keyGen.generateKey();\n\n\t\t\t// Create Random IV\n\t\t\tbyte[] iv = SecureRandom.getSeed(16);\n\t\t\tIvParameterSpec ivSpec = new IvParameterSpec(iv);\n\n\t\t\t// Encrypt data using AES\n\t\t\taesCipher = Cipher.getInstance(\"AES/CBC/PKCS5Padding\");\n\t\t\taesCipher.init(Cipher.ENCRYPT_MODE, aesKey, ivSpec);\n\t\t\tbyte[] data = aesCipher.doFinal(plaintext.getBytes());\n\n\t\t\t// Encrypt AES key using RSA public key\n\t\t\trsaCipher = Cipher.getInstance(\"RSA/NONE/PKCS1Padding\");\n\t\t\trsaCipher.init(Cipher.ENCRYPT_MODE, this.pubKey);\n\t\t\tbyte[] encKey = rsaCipher.doFinal(aesKey.getEncoded());\n\n\t\t\t// Create output\n\t\t\tString keyResult = new String(Base64.encodeBytes(encKey, 0));\n\t\t\tString ivResult = new String(Base64.encodeBytes(iv, 0));\n\t\t\tString dataResult = new String(Base64.encodeBytes(data, 0));\n\t\t\tString result = FORMAT_ID + \"|\" + VERSION + \"|\" + this.keyId + \"|\"\n\t\t\t\t\t+ keyResult + \"|\" + ivResult + \"|\" + dataResult;\n\t\t\treturn Base64.encodeBytes(result.getBytes(), Base64.URL_SAFE);\n\t\t} catch (InvalidKeyException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (NoSuchAlgorithmException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (NoSuchPaddingException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IllegalBlockSizeException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (BadPaddingException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\treturn \"Encryption_Failed\";\n\t}", "public static String encrypt(String seed, String plain) throws Exception {\r\nbyte[] rawKey = getRawKey(seed.getBytes());\r\nbyte[] encrypted = encrypt(rawKey, plain.getBytes());\r\nreturn Base64.encodeToString(encrypted, Base64.DEFAULT);\r\n}", "char decipher(int charToDeCipher);", "@Test\n\tpublic void testEncryptDecrypt() {\n\t\tfor (int i = 0; i < CONFIDENCE; ++i) {\n\t\t\tP plain = getRandomPlaintext();\n\t\t\tR rnd = getPK().getRandom(getRand());\n\t\t\tC cipher = getPK().encrypt(plain, rnd);\n\t\t\t\n\t\t\tP plain2 = getSK().decrypt(cipher);\n\t\t\t\n\t\t\tassertTrue(\"Decryption didn't work\", plain.equals(plain2));\n\t\t}\n\t}", "@Test\n\tpublic void doEncrypt() {\n\t\tString src = \"18903193260\";\n\t\tString des = \"9oytDznWiJfLkOQspiKRtQ==\";\n\t\tAssert.assertEquals(Encryptor.getEncryptedString(KEY, src), des);\n\n\t\t/* Encrypt some plain texts */\n\t\tList<String> list = new ArrayList<String>();\n\t\tlist.add(\"18963144219\");\n\t\tlist.add(\"13331673185\");\n\t\tlist.add(\"18914027730\");\n\t\tlist.add(\"13353260117\");\n\t\tlist.add(\"13370052053\");\n\t\tlist.add(\"18192080531\");\n\t\tlist.add(\"18066874640\");\n\t\tlist.add(\"15357963496\");\n\t\tlist.add(\"13337179174\");\n\t\tfor (String str : list) {\n\t\t\tSystem.out.println(Encryptor.getEncryptedString(KEY, str));\n\t\t}\n\t}", "public String decrypt(String cipherText);", "long getCryptAlgorithmSid();", "@Test\r\n\tpublic void testSimple() throws IOException, URISyntaxException, IllegalKeyException{\r\n\t\tbyte data [] = {97,98,99,100};\r\n\t\tbyte [] keys = {50};\r\n\t\tEncryptionDecryptionManager man = new AlgoritemManaging();\r\n\t\tCaesarEncryption ce = new CaesarEncryption(man);\r\n\t\tbyte[] encData = ce.Encrypt(keys,data);\r\n\t\t\r\n\t\tCaesarDecryption c = new CaesarDecryption(man);\r\n\t\tbyte[] decData = c.Decrypt(keys,encData);\r\n\t\tassert decData [0] == (byte)(97);\r\n\t\tassert decData [1] == (byte)(98);\r\n\t\tassert decData [2] == (byte)(99);\r\n\t\tassert decData [3] == (byte)(100);\r\n\t}", "public String initAesOperations() throws NoSuchAlgorithmException, NoSuchPaddingException, Base64DecodingException, DecoderException {\n byte[] aesKeyBytes = new byte[16];\n this.randomize.nextBytes(aesKeyBytes);\n this.aesKey = new SecretKeySpec(aesKeyBytes, \"AES\");\n this.aesCipher = Cipher.getInstance(\"AES/CBC/PKCS5Padding\");\n return Hex.encodeHexString(aesKeyBytes);\n }", "public interface Encryptor {\n void encrypt();\n\n}", "private String encStr(char[] sPlainText, long lNewCBCIV)\n\t{\n\t\tint nI, nPos, nStrLen;\n\t\tchar cActChar;\n\t\tbyte bPadVal;\n\t\tbyte[] buf;\n\t\tbyte[] newCBCIV;\n\t\tint nNumBytes;\n\t\tnStrLen = sPlainText.length;\n\t\tnNumBytes = ((nStrLen << 1) & ~7) + 8;\n\t\tbuf = new byte[nNumBytes];\n\t\tnPos = 0;\n\t\tfor (nI = 0; nI < nStrLen; nI++)\n\t\t{\n\t\t\tcActChar = sPlainText[nI];\n\t\t\tbuf[nPos++] = (byte) ((cActChar >> 8) & 0x0ff);\n\t\t\tbuf[nPos++] = (byte) (cActChar & 0x0ff);\n\t\t}\n\t\tbPadVal = (byte) (nNumBytes - (nStrLen << 1));\n\t\twhile (nPos < buf.length)\n\t\t{\n\t\t\tbuf[nPos++] = bPadVal;\n\t\t}\n\t\t// System.out.println(\"CBCIV = [\" + Long.toString(lNewCBCIV) + \"] hex = [\" + Long.toHexString(lNewCBCIV) + \"]\");\n\t\t// System.out.print(\"unencryp bytes=[\");\n\t\t// for (int i = 0; i < nNumBytes; i++){\n\t\t// System.out.print( (int)buf[i]);\n\t\t// System.out.print( \",\");\n\t\t// }\n\t\t// System.out.println(\"]\");\n\t\tm_bfc.setCBCIV(lNewCBCIV);\n\t\tm_bfc.encrypt(buf, 0, buf, 0, nNumBytes);\n\t\t// System.out.print(\" encryp bytes=[\");\n\t\t// for (int i = 0; i < nNumBytes; i++){\n\t\t// System.out.print( (int)buf[i]);\n\t\t// System.out.print( \",\");\n\t\t// }\n\t\t// System.out.println(\"]\");\n\t\tString strEncrypt = EQBinConverter.bytesToHexStr(buf, 0, nNumBytes);\n\t\tnewCBCIV = new byte[EQBlowfishECB.BLOCKSIZE];\n\t\tEQBinConverter.longToByteArray(lNewCBCIV, newCBCIV, 0);\n\t\tString strCBCIV = EQBinConverter.bytesToHexStr(newCBCIV, 0, EQBlowfishECB.BLOCKSIZE);\n\t\t// System.out.println(\"encrypt = [\" + strEncrypt + \"]\");\n\t\t// System.out.println(\"strCBCIV = [\" + strCBCIV + \"]\");\n\t\treturn strCBCIV + strEncrypt;\n\t}", "public String encrypt (String input) {\n // parameter checks. If input has nothing, or both keys\n // are zero, we have no work to do.\n if (!hasValue(input)) return \"\";\n if (mainKey1 == 0 && mainKey2 == 0) return input;\n\n // Start with a StringBuilder we can update below.\n StringBuilder encrypted = new StringBuilder(input);\n\n // Walk the input string and transform each letter that exists in\n // our alphabet\n for (int i = 0; i < encrypted.length(); i++) {\n char currChar = encrypted.charAt(i);\n int idx = alphabet.indexOf(currChar);\n if (idx != -1) {\n // Which alphabet do I use? even i is key1, odd i is key2\n String shiftedAlphabet = (i % 2 == 0) ? shiftedAlphabet1: shiftedAlphabet2;\n char newChar = shiftedAlphabet.charAt(idx);\n encrypted.setCharAt(i, newChar);\n }\n }\n\n return encrypted.toString();\n }", "public CryptObject encrypt(BigIntegerMod message, BigIntegerMod r);", "public interface SuperEncryption {\n String encrypt(String s);\n String decrypt(String s);\n}", "String encrypt(String input) {\n\t\treturn BaseEncoding.base64().encode(input.getBytes());\n\t}", "@Test\n public void testAesEncryptForInputKey() throws Exception {\n byte[] key = Cryptos.generateAesKey();\n String input = \"foo message\";\n\n byte[] encryptResult = Cryptos.aesEncrypt(input.getBytes(\"UTF-8\"), key);\n String descryptResult = Cryptos.aesDecrypt(encryptResult, key);\n\n System.out.println(key);\n System.out.println(descryptResult);\n }", "public CryptObject reencrypt(Ciphertext ciphertext, BigIntegerMod r);", "private static Map<CryptoAlgorithm, String> createExactCipherMapping() {\n HashMap<CryptoAlgorithm, String> map = new HashMap<>();\n map.put(CryptoAlgorithm.AES_CBC, \"AES/CBC/PKCS5PADDING\");\n return Collections.unmodifiableMap(map);\n }", "@Component\npublic interface Crypto {\n // returns a new secret key\n String newKey();\n\n // encrypts a plain text\n byte[] encrypt(String plaintext);\n\n // decrypts a cipher\n byte[] decrypt(byte[] encryptedData, short keyIx);\n\n // gets the index of the encryption key to use - 0 = no key, 1 or 2 for the two available keys\n short getKeyIx();\n\n // gets the index of the default key\n short getDefaultKeyIx();\n\n // gets the date after which the default key is no longer valid\n String getDefaultKeyExpiry();\n}", "public CryptographyKeysCreator() {\n Random random = new Random();\n BigInteger prime1 = BigInteger.probablePrime(256, random);\n BigInteger prime2 = BigInteger.probablePrime(256, random);\n primesMultiplied = prime1.multiply(prime2);\n BigInteger phi = prime1.subtract(BigInteger.ONE).multiply(prime2.subtract(BigInteger.ONE));\n encryptingBigInt = BigInteger.probablePrime(256, random);\n\n while (phi.gcd(encryptingBigInt).compareTo(BigInteger.ONE) > 0 && encryptingBigInt.compareTo(phi) < 0) {\n encryptingBigInt = encryptingBigInt.add(BigInteger.ONE);\n }\n\n decryptingBigInt = encryptingBigInt.modInverse(phi);\n }", "public BigInteger Encryption(String text){\n \tcypherText = BigInteger.valueOf(0);\n \tint bposition = 0;\n \t/*\n \t * Cursor move from 128 to 1 each time. Do & operation between chvalue\n \t * and cursor, if not 0, means in bit format this position is 1, add\n \t * the corresponding BigInteger in the b list to cypherText.\n \t */\n \tfor(byte ch: text.getBytes()){\n \t\tint cursor = 128;\n \t\tint chvalue = ch;\n \t\tfor(int i = 0;i < 8;i++){\n \t\t\tif((chvalue & cursor) != 0){\n \t\t\t\tcypherText = cypherText.add(b[bposition]);\n \t\t\t}\n \t\t\tcursor >>= 1;\n \t\t bposition ++;\n \t\t}\n \t}\n \treturn cypherText;\n }", "public static void main(String[] args) \r\n {\n String message1 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\r\n System.out.println(encrypt (message1, 3));\r\n System.out.println(decrypt (encrypt(message1,3) ,3));\r\n System.out.println(encrypt(message1.toLowerCase(),5));\r\n \r\n System.out.println(decrypt(encrypt(message1.toLowerCase() ,5 ) ,5));\r\n }", "String encryptString(String toEncrypt) throws NoUserSelectedException;", "public abstract void setEncryptMode();", "org.openxmlformats.schemas.presentationml.x2006.main.STAlgClass xgetCryptAlgorithmClass();", "public String encrypt(final String clearText)\n throws GeneralSecurityException, IOException {\n final String methodName = \":encrypt\";\n Logger.v(TAG + methodName, \"Starting encryption\");\n\n if (StringExtensions.isNullOrBlank(clearText)) {\n throw new IllegalArgumentException(\"Input is empty or null\");\n }\n\n // load key for encryption if not loaded\n mKey = loadSecretKeyForEncryption();\n mHMACKey = getHMacKey(mKey);\n\n Logger.i(TAG + methodName, \"\", \"Encrypt version:\" + mBlobVersion);\n final byte[] blobVersion = mBlobVersion.getBytes(AuthenticationConstants.ENCODING_UTF8);\n final byte[] bytes = clearText.getBytes(AuthenticationConstants.ENCODING_UTF8);\n\n // IV: Initialization vector that is needed to start CBC\n final byte[] iv = new byte[DATA_KEY_LENGTH];\n mRandom.nextBytes(iv);\n final IvParameterSpec ivSpec = new IvParameterSpec(iv);\n\n // Set to encrypt mode\n final Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);\n final Mac mac = Mac.getInstance(HMAC_ALGORITHM);\n cipher.init(Cipher.ENCRYPT_MODE, mKey, ivSpec);\n\n final byte[] encrypted = cipher.doFinal(bytes);\n\n // Mac output to sign encryptedData+IV. Keyversion is not included\n // in the digest. It defines what to use for Mac Key.\n mac.init(mHMACKey);\n mac.update(blobVersion);\n mac.update(encrypted);\n mac.update(iv);\n final byte[] macDigest = mac.doFinal();\n\n // Init array to store blobVersion, encrypted data, iv, macdigest\n final byte[] blobVerAndEncryptedDataAndIVAndMacDigest = new byte[blobVersion.length\n + encrypted.length + iv.length + macDigest.length];\n System.arraycopy(blobVersion, 0, blobVerAndEncryptedDataAndIVAndMacDigest, 0,\n blobVersion.length);\n System.arraycopy(encrypted, 0, blobVerAndEncryptedDataAndIVAndMacDigest,\n blobVersion.length, encrypted.length);\n System.arraycopy(iv, 0, blobVerAndEncryptedDataAndIVAndMacDigest, blobVersion.length\n + encrypted.length, iv.length);\n System.arraycopy(macDigest, 0, blobVerAndEncryptedDataAndIVAndMacDigest, blobVersion.length\n + encrypted.length + iv.length, macDigest.length);\n\n final String encryptedText = new String(Base64.encode(blobVerAndEncryptedDataAndIVAndMacDigest,\n Base64.NO_WRAP), AuthenticationConstants.ENCODING_UTF8);\n Logger.v(TAG + methodName, \"Finished encryption\");\n\n return getEncodeVersionLengthPrefix() + ENCODE_VERSION + encryptedText;\n }", "String algorithm();", "public static Cipher getCypher(int mode) throws NoSuchAlgorithmException, NoSuchPaddingException,\r\n InvalidKeyException {\n Key aesKey = new SecretKeySpec(ENC_KEY.getBytes(), \"AES\");\r\n Cipher cipher = Cipher.getInstance(\"AES\");\r\n // encrypt the text\r\n cipher.init(mode, aesKey);\r\n return cipher;\r\n }", "public String encrypt(String message) {\t\n\n\t\tchar [] letters = new char [message.length()];\n\t\tString newMessage = \"\";\n\n\t\t//create an array of characters from message\n\t\tfor(int i=0; i< message.length(); i++){\n\t\t\tletters[i]= message.charAt(i);\n\t\t}\n\n\t\tfor(int i=0; i<letters.length; i++){\n\t\t\tif(Character.isLetter(letters[i])){ //check to see if letter\n\t\t\t\tif(Character.isUpperCase(letters[i])){ //check to see if it is uppercase\n\t\t\t\t\tnewMessage += letters[i]; //add that character to new string\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\t//this creates an array with the numbers that are keys \n\t\tint [] numberOfLetters = new int[newMessage.length()];\n\t\tString alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\n\t\tfor(int i=0; i< newMessage.length(); i++){\n\t\t\tfor(int j=0; j< alphabet.length(); j++){\n\t\t\t\tif(newMessage.charAt(i) == alphabet.charAt(j)){ //if they have the same letter\n\t\t\t\t\tnumberOfLetters[i]=j+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\n\t\t//creates an array of the keys\n\t\tint [] key = new int[numberOfLetters.length];\n\t\tint keys;\n\t\tfor(int i=0; i< numberOfLetters.length; i++){\n\t\t\tkeys = getKey();\n\t\t\tkey[i] = keys;\n\t\t}\n\t\n\t\t//create an array for what we encrypted \n\t\tint [] encryptNum = new int[key.length];\n\t\tfor(int i=0; i< key.length; i++){\n\t\t\tint value = numberOfLetters[i] + key[i];\n\t\t\tif(value > 26){\n\t\t\t\tvalue = value-26;\n\t\t\t\tencryptNum[i]= value;\n\t\t\t}else{\n\t\t\t\tencryptNum[i]= value;\n\t\t\t}\n\t\t}\n\n\t\t//turn encryption into letters \n\t\tString encrypt = \"\";\n\t\tchar [] let = new char [encryptNum.length];\n\n\t\tfor(int i=0; i< encryptNum.length; i++){\n\t\t\tint x = encryptNum[i]-1;\n\t\t\tlet[i] = alphabet.charAt(x);\n\t\t}\n\n\t\tfor(int j=0; j< let.length; j++){\n\t\t\tencrypt += let[j];\n\t\t}\n\n\t\t// COMPLETE THIS METHOD\n\t\t// THE FOLLOWING LINE HAS BEEN ADDED TO MAKE THE METHOD COMPILE\n\n\t\treturn encrypt;\n\t}", "@Test\n public void testEncryptDecrypt3() throws InvalidCipherTextException {\n\n // password generation using KDF\n String password = \"Aa1234567890#\";\n byte[] kdf = Password.generateKeyDerivation(password.getBytes(), 32);\n\n byte[] plain = \"0123456789\".getBytes();\n byte[] plainBytes = new byte[100000000];\n for (int i = 0; i < plainBytes.length / plain.length; i++) {\n System.arraycopy(plain, 0, plainBytes, i * plain.length, plain.length);\n }\n\n byte[] encData = AESEncrypt.encrypt(plainBytes, kdf);\n byte[] plainData = AESEncrypt.decrypt(encData, kdf);\n\n assertArrayEquals(plainBytes, plainData);\n\n }", "public abstract String decryptMsg(String msg);", "Update withEncryption(Encryption encryption);", "public interface PasswordEncoder {\r\n\r\n public String encode(char password[]);\r\n\r\n public boolean compare(String encoded, char plain[]);\r\n\r\n}", "public void test() {\n\t\t// super.onCreate(savedInstanceState);\n\t\t// setContentView(R.layout.main);\n\t\tString masterPassword = \"abcdefghijklmn\";\n\t\tString originalText = \"i see qinhubao eat milk!\";\n\t\tbyte[] text = new byte[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };\n\t\tbyte[] password = new byte[] { 'a' };\n\t\ttry {\n\t\t\tString encryptingCode = encrypt(masterPassword, originalText);\n\t\t\t// System.out.println(\"加密结果为 \" + encryptingCode);\n\t\t\tLog.i(\"加密结果为 \", encryptingCode);\n\t\t\tString decryptingCode = decrypt(masterPassword, encryptingCode);\n\t\t\tSystem.out.println(\"解密结果为 \" + decryptingCode);\n\t\t\tLog.i(\"解密结果\", decryptingCode);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "org.openxmlformats.schemas.presentationml.x2006.main.STAlgType xgetCryptAlgorithmType();", "public String encrypt(String value) throws Exception\n {\n if ( key == null )\n {\n throw new Exception(\"CodecUtil must be initialised with the storeKey first.\");\n }\n try\n {\n Cipher pbeCipher = Cipher.getInstance(\"PBEWithMD5AndDES\");\n pbeCipher.init(Cipher.ENCRYPT_MODE, key, new PBEParameterSpec(salt, 20));\n return base64Encode(pbeCipher.doFinal(value.getBytes(\"UTF-8\")));\n }\n catch (Exception e)\n {\n throw new Exception(\"Encryption error :\" + e.getMessage());\n }\n }", "public EnScrypt() {}", "String publicKey();", "public interface Cipher<R, E> {\n\n /**\n * Encrypts a message.\n *\n * @param raw the message to be encrypted\n * @return the encrypted message\n */\n E encrypt(R raw);\n\n /**\n * Decrypts a message.\n *\n * @param encrypted the encrypted message\n * @return the decrypted message\n */\n R decrypt(E encrypted);\n}", "org.openxmlformats.schemas.presentationml.x2006.main.STAlgClass.Enum getCryptAlgorithmClass();", "private Cipher createCipher() throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException {\n\t\tif (algorithmProvider != null && !(algorithmProvider.equals(\"\")) && algorithm != null && !(algorithm.equals(\"\"))) {\n\t\t\t/* if there is an entered algorithm and its provider, \n\t\t\t * return the Cipher's instance of it\n\t\t\t */\n\t\t\treturn Cipher.getInstance(algorithm, algorithmProvider);\n\t\t} else if (algorithm != null && !(algorithm.equals(\"\"))) {\n\t\t\t/* if there is only algorithm entered,\n\t\t\t * return the Cipher's instance of it using default provider\n\t\t\t */\n\t\t\treturn Cipher.getInstance(algorithm);\n\t\t} else {\n\t\t\t/* if there is isn't an algorithm entered,\n\t\t\t * return an AES in CBC mode Cipher as default\n\t\t\t */\n\t\t\treturn Cipher.getInstance(\"AES//CBC//PKCS5Padding\");\n\t\t}\n\t}", "public static String Encrypt(String inputText, String key) {\n String retVal = \"\";\n try {\n Cipher cipher = Cipher.getInstance(\"AES/CBC/PKCS5Padding\");\n byte[] keyBytes = new byte[16];\n byte[] b = key.getBytes();\n int len = b.length;\n if (len > keyBytes.length) {\n len = keyBytes.length;\n }\n System.arraycopy(b, 0, keyBytes, 0, len);\n SecretKeySpec keySpec = new SecretKeySpec(keyBytes, \"AES\");\n IvParameterSpec ivSpec = new IvParameterSpec(keyBytes);\n cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);\n BASE64Encoder _64e = new BASE64Encoder();\n byte[] encryptedData = cipher.doFinal(inputText.getBytes());\n retVal = _64e.encode(encryptedData);\n\n } catch (Exception ex) {\n ApiLog.One.WriteException(ex);\n }\n return retVal;\n }", "@Override\n public void decrypt() {\n algo.decrypt();\n String cypher = vigenereAlgo(false);\n this.setValue(cypher);\n }", "public String rotationCipherCrack(String cipher, String alphabet);", "private void encode(){\r\n \r\n StringBuilder sb = new StringBuilder();\r\n \r\n /*\r\n *if a character code is >126 after adding the encryption key, subtract \r\n *95 to wrap\r\n */\r\n for(int i = 0; i < message.length(); i++){\r\n if(message.charAt(i) + key > 126){\r\n int wrappedKey = message.charAt(i) + key - 95;\r\n \r\n sb.append((char) wrappedKey);\r\n \r\n /*\r\n *if a character code ins't > 126 after adding the encryption key\r\n */\r\n } else{\r\n int wrappedKey = message.charAt(i) + key;\r\n sb.append( (char) wrappedKey);\r\n }\r\n }\r\n /*\r\n *case coded message to a string\r\n */\r\n codedMessage = sb.toString();\r\n }", "public BigIntegerMod decrypt(Ciphertext ciphertext);", "default Cipher cipher() {\n return null;\n }", "public interface EncryptionCommonBusiness\n{\n // ---------------------------------------------------------------------------||\n // Contracts -----------------------------------------------------------------||\n // ---------------------------------------------------------------------------||\n\n /**\n * Encrypts the specified String, returning the result \n * \n * @param input\n * @return\n * @throws IllegalArgumentException If no input was provided (null)\n * @throws EncryptionException If some problem occurred with encryption\n */\n String encrypt(String input) throws IllegalArgumentException, EncryptionException;\n\n /**\n * Decrypts the specified String, returning the result. The general\n * contract is that the result of decrypting a String encrypted with\n * {@link EncryptionCommonBusiness#encrypt(String)} will be equal \n * by value to the original input (round trip).\n * \n * @param input\n * @return\n * @throws IllegalArgumentException If no input was provided (null)\n * @throws EncryptionException If some problem occurred with decryption\n */\n String decrypt(String input) throws IllegalArgumentException, EncryptionException;\n\n /**\n * Returns a one-way hash of the specified argument. Useful\n * for safely storing passwords.\n * \n * @param input\n * @return\n * @throws IllegalArgumentException If no input was provided (null)\n * @throws EncryptionException If some problem occurred making the hash\n */\n String hash(String input) throws IllegalArgumentException, EncryptionException;\n\n /**\n * Returns whether or not the specified input matches the specified \n * hash. Useful for validating passwords against a \n * securely-stored hash. \n * \n * @param hash\n * @param input\n * @return\n * @throws IllegalArgumentException If either the hash or input is not provided (null)\n * @throws EncryptionException If some problem occurred making the hash\n */\n boolean compare(String hash, String input) throws IllegalArgumentException, EncryptionException;\n\n /*\n * This comment applies to all below this marker.\n * \n * In real life it's a security risk to expose these internals, \n * but they're in place here for testing and to show \n * functionality described by the examples.\n */\n\n /**\n * Obtains the passphrase to be used in the key for\n * the symmetric encryption/decryption ciphers\n * \n * @return\n */\n String getCiphersPassphrase();\n\n /**\n * Obtains the algorithm to be used in performing\n * one-way hashing\n * \n * @return\n */\n String getMessageDigestAlgorithm();\n\n}", "protected void doPadding(byte[] paramArrayOfByte, int paramInt)\r\n/* 107: */ {\r\n/* 108:172 */ int i = flush();\r\n/* 109:173 */ this.tmpBuf[i] = Byte.MIN_VALUE;\r\n/* 110:174 */ for (int j = i + 1; j < 32; j++) {\r\n/* 111:175 */ this.tmpBuf[j] = 0;\r\n/* 112: */ }\r\n/* 113:176 */ update(this.tmpBuf, i, 32 - i);\r\n/* 114:177 */ for (j = 0; j < i + 1; j++) {\r\n/* 115:178 */ this.tmpBuf[j] = 0;\r\n/* 116: */ }\r\n/* 117:179 */ update(this.tmpBuf, 0, 32);\r\n/* 118:180 */ encodeBEInt(this.V00 ^ this.V10 ^ this.V20, paramArrayOfByte, paramInt + 0);\r\n/* 119:181 */ encodeBEInt(this.V01 ^ this.V11 ^ this.V21, paramArrayOfByte, paramInt + 4);\r\n/* 120:182 */ encodeBEInt(this.V02 ^ this.V12 ^ this.V22, paramArrayOfByte, paramInt + 8);\r\n/* 121:183 */ encodeBEInt(this.V03 ^ this.V13 ^ this.V23, paramArrayOfByte, paramInt + 12);\r\n/* 122:184 */ encodeBEInt(this.V04 ^ this.V14 ^ this.V24, paramArrayOfByte, paramInt + 16);\r\n/* 123:185 */ encodeBEInt(this.V05 ^ this.V15 ^ this.V25, paramArrayOfByte, paramInt + 20);\r\n/* 124:186 */ encodeBEInt(this.V06 ^ this.V16 ^ this.V26, paramArrayOfByte, paramInt + 24);\r\n/* 125:187 */ if (getDigestLength() == 32) {\r\n/* 126:188 */ encodeBEInt(this.V07 ^ this.V17 ^ this.V27, paramArrayOfByte, paramInt + 28);\r\n/* 127: */ }\r\n/* 128: */ }", "public String getSecretKey();", "public final java.lang.String getAlgorithm() {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: java.security.AlgorithmParameterGenerator.getAlgorithm():java.lang.String, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: java.security.AlgorithmParameterGenerator.getAlgorithm():java.lang.String\");\n }" ]
[ "0.7827271", "0.7210363", "0.7020258", "0.6789162", "0.6687029", "0.6497599", "0.649306", "0.6462944", "0.6433752", "0.64334816", "0.6371008", "0.63382393", "0.63366824", "0.63121086", "0.6296068", "0.6293743", "0.6285546", "0.6281153", "0.62765956", "0.62660235", "0.62057126", "0.6204606", "0.6159952", "0.61556125", "0.6150791", "0.61284274", "0.61261326", "0.6124809", "0.6112426", "0.61121744", "0.6108746", "0.6098905", "0.6098489", "0.6092315", "0.60905445", "0.60690606", "0.6063852", "0.6054797", "0.60426885", "0.6033512", "0.6001871", "0.59985995", "0.59865695", "0.5979924", "0.597891", "0.5968039", "0.5966119", "0.59385884", "0.59316367", "0.59286857", "0.59206146", "0.59156954", "0.59148645", "0.5892273", "0.5892135", "0.58906895", "0.58783525", "0.5873122", "0.58650637", "0.58579475", "0.5853586", "0.58500034", "0.5844783", "0.5844029", "0.58409685", "0.5838537", "0.5838531", "0.58286524", "0.5812203", "0.5810273", "0.5808977", "0.58076066", "0.5801986", "0.57970905", "0.57969284", "0.5794218", "0.57938296", "0.5793287", "0.5783706", "0.57802194", "0.5772871", "0.5770497", "0.57678527", "0.5757103", "0.5753393", "0.57483745", "0.57404774", "0.57399607", "0.57383984", "0.57091933", "0.5704295", "0.5703397", "0.56970954", "0.5696053", "0.5694027", "0.5693131", "0.56929356", "0.5687858", "0.56872535", "0.56871825" ]
0.6495643
6
Validate if Dockerfile is created.
public void validateDockerfile() { File dockerFile = DOCKER_TARGET_PATH.resolve("Dockerfile").toFile(); Assert.assertTrue(dockerFile.exists()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testGetDockerfile() throws Exception {\n System.out.println(\"getDockerfile\");\n Path path = Paths.get(\"/tmp/test.txt\");\n Files.createDirectories(path.getParent());\n try {\n Files.createFile(path);\n } catch (FileAlreadyExistsException e) {\n System.err.println(\"already exists: \" + e.getMessage());\n }\n Docker instance = new Docker();\n instance.getDockerfile(\"TestFile\");\n File file = new File(path.toString());\n assertTrue(file.exists());\n Files.delete(path);\n }", "private static boolean isValidCreate(String pFilePath) {\n\t\tassert pFilePath != null;\n\t\tFile f = new File(pFilePath);\n\t\treturn f.exists();\n\t}", "@Test\n public void testBuildDockerfile() throws Exception {\n System.out.println(\"buildDockerfile\");\n //Create temp file to copy\n Path path = Paths.get(\"/tmp/dockerfiletest.txt\");\n Files.createDirectories(path.getParent());\n try {\n Files.createFile(path);\n } catch (FileAlreadyExistsException e) {\n System.err.println(\"already exists: \" + e.getMessage());\n }\n //Create list of files to add to constructor\n File file = new File(path.toString());\n ArrayList<File> files = new ArrayList<File>();\n files.add(file);\n //Create object\n Docker instance = new Docker(\"ubuntu\", \"git\", files, \"sh6791\", \"matrix\", \"v1\", \"saqhuss\", \"dockersh6791\", \"[email protected]\");\n instance.buildDockerfile();\n\n //Check if file was copied\n file = new File(\"dockerfiletest.txt\");\n assertTrue(file.exists());\n //Check if ssh-keys were generated\n file = new File(\"id_rsa\");\n assertTrue(file.exists());\n file = new File(\"id_rsa.pub\");\n assertTrue(file.exists());\n file = new File(\"authorized_keys\");\n assertTrue(file.exists());\n //Expected result of dockerfile\n String result = \"FROM ubuntu\\n\"\n + \"MAINTAINER saqhuss\\n\"\n + \"RUN apt-get update \\n\"\n + \"RUN apt-get install -y git\\n\"\n + \"RUN useradd -m -p password mpiuser\\n\"\n + \"RUN mkdir /home/mpiuser/.ssh\\n\"\n + \"ADD id_rsa /home/mpiuser/.ssh/id_rsa\\n\"\n + \"ADD id_rsa.pub /home/mpiuser/.ssh/id_rsa.pub\\n\"\n + \"ADD authorized_keys /home/mpiuser/.ssh/authorized_keys\\n\"\n + \"ADD hosts /home/mpiuser/hosts\\n\"\n + \"ADD dockerfiletest.txt /home/mpiuser/dockerfiletest.txt\\n\"\n + \"RUN sudo chown -R mpiuser:mpiuser /home/mpiuser/.ssh\\n\"\n + \"RUN echo 'mpiuser:password' | chpasswd\\n\"\n + \"RUN echo '/usr/sbin/sshd' >> /etc/bash.bashrc\";\n\n BufferedReader reader = new BufferedReader(new FileReader(\"Dockerfile\"));\n String line = null;\n StringBuilder sb = new StringBuilder();\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n //Check result and read in of Dockerfile are equal\n assertEquals(sb.toString().trim(), result);\n\n //Delete all created temp files\n Files.delete(path);\n Files.delete(Paths.get(\"dockerfiletest.txt\"));\n Files.delete(Paths.get(\"id_rsa\"));\n Files.delete(Paths.get(\"id_rsa.pub\"));\n Files.delete(Paths.get(\"authorized_keys\"));\n }", "private static void checkHasSomethingToBuild(ImageModule image)\n\t\t\tthrows ValidationException {\n\t\tif (image.isVirtual()) {\n\t\t\tthrow new ValidationException(\n\t\t\t\t\t\"This image doesn't need to be built since it doesn't contain a package list nor a pre-recipe or a recipe.\");\n\t\t}\n\t}", "public static boolean inDockerEnv() {\n\t\treturn DOCKER_ENV_FLAG_FILE.isFile();\n\t}", "public void validateDockerImage() throws DockerTestException, InterruptedException {\n List<String> ports = getExposedPorts(DOCKER_IMAGE);\n Assert.assertEquals(ports.size(), 1);\n Assert.assertEquals(ports.get(0), \"9099/tcp\");\n }", "static boolean isConfigValid(Path path) {\n Yaml yaml = new Yaml();\n InputStream inputStream = null;\n try {\n inputStream = Files.newInputStream(path);\n } catch (IOException e) {\n // System.err.println(e);\n return false;\n }\n try {\n yaml.load(inputStream);\n } catch (RuntimeException e) {\n // TODO: Good validation messages are available here. An example:\n /*\n while scanning a simple key\n in 'reader', line 7, column 1:\n xx\n ^\n could not find expected ':'\n in 'reader', line 7, column 3:\n xx\n ^\n */\n // System.err.println(e);\n return false;\n }\n\n return true;\n }", "private static void checkNotAlreadyBuilt(ImageModule image,\n\t\t\tString cloudServiceName) throws ValidationException {\n\t\tif (image.getCloudImageIdentifier(cloudServiceName) != null) {\n\t\t\tthrow new ValidationException(\n\t\t\t\t\t\"This image was already built for cloud: \"\n\t\t\t\t\t\t\t+ cloudServiceName);\n\t\t}\n\t}", "private static void isFileExistOrCreatIt(String fileName) {\n if (!fileName.endsWith(\".json\")){\n throw new IllegalArgumentException(\"Invalid file name\");\n }\n File file = new File(\"src//main//resources\"+\"//\"+fileName);\n if(!file.exists()){\n try{\n file.createNewFile();\n }catch (IOException e){\n e.printStackTrace();\n }\n\n }\n }", "public static boolean hasCustomDockerDB( final BioModule module ) {\n\t\ttry {\n\t\t\tLog.info( DockerUtil.class, Constants.LOG_SPACER );\n\t\t\tLog.info( DockerUtil.class, \"Check for Custom Docker DB\" );\n\t\t\tLog.info( DockerUtil.class, Constants.LOG_SPACER );\n\t\t\tif( inDockerEnv() ) \n\t\t\t\tLog.info( DockerUtil.class, \"Verified BLJ is running INSIDE the Docker biolockj_controller Container\" );\n\t\t\telse {\n\t\t\t\tLog.info( DockerUtil.class, \"LOOKS LIKE BLJ is <<< NOT >>> running INSIDE the Docker biolockj_controller Container - run extra tests!\" );\n\t\t\t\tfinal File testFile = new File( \"/.dockerenv\" );\n\t\t\t\tif( testFile.isFile() )\n\t\t\t\t\tLog.info( DockerUtil.class, \"testFile.isFile() == TRUE! --> WHY FAIL ON INIT ATTEMPT? BLJ is running INSIDE the Docker biolockj_controller Container\" );\n\t\t\t\telse if( testFile.exists() )\n\t\t\t\t\tLog.info( DockerUtil.class, \"testFile.exists() == TRUE! --> WHY FAIL ON INIT ATTEMPT? BLJ is running INSIDE the Docker biolockj_controller Container\" );\n\t\t\t}\n\t\t\t\n\t\t\tif( module instanceof DatabaseModule )\n\t\t\t\tLog.info( DockerUtil.class, module.getClass().getSimpleName() + \" is a DB Module!\" );\n\t\t\telse\n\t\t\t\tLog.info( DockerUtil.class, module.getClass().getSimpleName() + \" is NOT DB Module!\" );\n\t\t\t\n\t\t\tLog.info( DockerUtil.class, Constants.LOG_SPACER );\n\t\t\t\t\n\t\t\tif( inDockerEnv() && module instanceof DatabaseModule ) {\n\t\t\t\tfinal File db = ( (DatabaseModule) module ).getDB();\n\t\t\t\tif( db == null ) Log.info( DockerUtil.class, module.getClass().getSimpleName() + \" db ==> NULL \" );\n\t\t\t\tif( db != null ) Log.info( DockerUtil.class, module.getClass().getSimpleName() + \" db ==> \" + db.getAbsolutePath() );\n\t\t\t\tif( db != null ) return !db.getAbsolutePath().startsWith( DOCKER_DEFAULT_DB_DIR );\n\t\t\t}\n\t\t} catch( ConfigPathException | ConfigNotFoundException | DockerVolCreationException ex ) {\n\t\t\tLog.error( DockerUtil.class,\n\t\t\t\t\"Error occurred checking database path of module: \" + module.getClass().getName(), ex );\n\t\t} \n\t\treturn false;\n\t}", "public boolean create()\n\t{\n\t\ttry\n\t\t{\n\t\t\treturn file.createNewFile() ;\n\t\t}\n\t\tcatch( IOException ex )\n\t\t{\n\t\t\tex.printStackTrace() ;\n\t\t\treturn false ;\n\t\t}\n\t}", "public static boolean isImageBuildPushRequired(ServiceSpec serviceSpec) {\n if (serviceSpec == null) {\n return false;\n }\n Image image = null;\n try {\n image = serviceSpec.get(HyscaleSpecFields.image, Image.class);\n } catch (HyscaleException e) {\n logger.info(\"Error while fetching buildSpec and registryUrl from serviceSpec \");\n }\n\n if (image == null) {\n return false;\n }\n\n return image instanceof BuildSpecImage || image instanceof DockerBuildImage;\n }", "protected final boolean willUseDocker() {\n\t\treturn this.shouldUseDocker() && CodeExecutorDockerBase.DOCKER_CONTAINER_ID.get() != null;\n\t}", "public boolean create() {\n boolean operation = false;\n try {\n File file = new File( fileName );\n file.createNewFile();\n\n if ( this.open() == false ) {\n throw new Exception(\"File created but still has issues opening the file\");\n } else {\n writeFirstLine(\"\");\n }\n\n operation = true;\n } catch( Exception error ) {\n System.out.println(error.toString());\n operation = false;\n }\n\n return operation;\n }", "boolean checkSubProcessDefinitionValid(ProcessDefinition processDefinition);", "public void createImageFromDockerFile(String name,String content) throws IOException {\n\t\tPath dockerManagerDir = Files.createTempDirectory(\"dockerManagerDir\");\n\t\tFile dockerFile = new File(dockerManagerDir.toString(),\"Dockerfile\");\n\n\t\tSystem.out.println(dockerManagerDir.toString());\n\t\ttry {\n\t\t\tPrintWriter printWriter = new PrintWriter(dockerFile);\n\t\t\tprintWriter.print(content);\n\t\t\tprintWriter.close();\n\n\t\t\tdockerClient\n\t\t\t\t\t.buildImageCmd(new File(dockerManagerDir.toString() ) )\n\t\t\t\t\t.withNoCache()\n\t\t\t\t\t.withTag(name)\n\t\t\t\t\t.exec()\n\t\t\t\t\t.close();\n\t\t} finally {\n\t\t\tdockerFile.delete();\n\t\t\tnew File(dockerManagerDir.toString() ).delete();\n\t\t}\n\t}", "public boolean verifyEmptyToDoImage() {\n if (validateAttributeContain(imageEmptyToDo, \"src\", \"images/icons/clipboard.png\", \"Image Empty ToDo\")) {\n return true;\n }\n return false;\n }", "private boolean validateAttributes(ScanningContext context) {\n // We only need to check if it's a non-framework file (and an XML file; skip .png's)\n if (!isFramework() && SdkUtils.endsWith(getFile().getName(), DOT_XML)) {\n ValidatingResourceParser parser = new ValidatingResourceParser(context, false);\n try {\n IAbstractFile file = getFile();\n return parser.parse(file.getOsLocation(), file.getContents());\n } catch (Exception e) {\n context.needsFullAapt();\n }\n\n return false;\n }\n\n return true;\n }", "public boolean validImageContent() {\n\t\treturn input.validFile(list);\n\t}", "public boolean hasFailed() {\n return creationFailure;\n }", "@Test\n public void testBuildContainer() throws Exception {\n System.out.println(\"buildContainer\");\n JTextArea ta = new JTextArea();\n //Create temp host file\n try {\n //\"False\" in file writer for no append\n PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"hosts\", false)));\n out.println(\"[email protected]\");\n out.flush();\n } catch (Exception e) {\n\n }\n ArrayList<File> files = new ArrayList<File>();\n Docker instance = new Docker(\"ubuntu\", \"git\", files, \"sh6791\", \"matrix\", \"v1\", \"saqhuss\", \"dockersh6791\", \"[email protected]\");\n instance.buildDockerfile();\n instance.buildContainer(ta);\n Process p;\n String line = null;\n StringBuilder sb = new StringBuilder();\n try {\n p = Runtime.getRuntime().exec(new String[]{\"docker\", \"images\"});\n BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(\"\\n\");\n }\n } catch (Exception e) {\n\n }\n assertEquals(sb.toString().split(\"\\n\")[1].split(\" \")[0].trim(), \"saqhuss/matrix\");\n Files.delete(Paths.get(\"Dockerfile\"));\n Files.delete(Paths.get(\"hosts\"));\n Files.delete(Paths.get(\"id_rsa\"));\n Files.delete(Paths.get(\"id_rsa.pub\"));\n Files.delete(Paths.get(\"authorized_keys\"));\n }", "private File validateFile(String filename)\n {\n if (filename == null)\n {\n throw new IllegalArgumentException(\"Filename is null\");\n }\n File f = new File(filename);\n //if (!f.exists()) sometimes this throws false even if the program does exist.\n //{\n // throw new IllegalArgumentException(\"Path \"+filename+\" does not refer to a file\");\n //}\n return f;\n }", "public boolean isRunOnDocker() {\n return Mode.DOCKER == mode;\n }", "public void checkIfXslCreated() {\n final File extStore = Environment.getExternalStorageDirectory();\n File myFile = new File(extStore.getAbsolutePath() + \"/backup/\" + fileName);\n\n if (myFile.exists()) {\n Log.d(\"YES\", \"YES\");\n } else {\n Log.d(\"NO\", \"NO\");\n }\n }", "private void checkFileCreation(String name) throws IOException {\n byte[] buff = \"some bytes\".getBytes();\n writeFile(name, buff);\n assertTrue(Arrays.equals(buff, readFile(name, buff.length)));\n }", "boolean hasCreateTaskPack();", "private boolean IsCfgExisted()\n {\n File f = new File(strCfgPath);\n if(f.exists())\n return true;\n return false;\n }", "private static boolean validateFileExists(Map.Entry<String, CheckState> entry) {\n String prop = System.getProperty(entry.getKey());\n if (entry.getValue().isOptional && prop == null) {\n return true;\n }\n\n if (prop == null || \"\".equals(prop)) {\n return false;\n }\n\n return Files.exists(new File(prop).toPath());\n }", "@Test\n public void shouldNotParseCamundaFormDefinitionAndFormKey() {\n String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), \"shouldNotParseCamundaFormDefinitionAndFormKey\");\n\n // when/then expect parse exception\n assertThatThrownBy(() -> repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy())\n .isInstanceOf(ParseException.class)\n .hasMessageContaining(\"Invalid element definition: only one of the attributes formKey and formRef is allowed.\");\n }", "private void checkCreateParentDirs(Path file) throws IOException {\n if (!Files.exists(file.getParent())) {\n Files.createDirectories(file.getParent());\n }\n }", "public boolean validateAxis2ClientRepo(String input) throws AxisFault {\n try {\n ConfigurationContextFactory.createConfigurationContextFromFileSystem(input,\n DEFAULT_AXIS2_XML);\n return true;\n } catch (AxisFault e) {\n handleException(log, \"Error while validating the Axis2 Client Repository\", e);\n return false;\n }\n }", "protected void validateFile() {\r\n\t\tFile f = new File(FileUltil.joinPath(dOutputFolder, dFileName));\r\n\t\tif (f.exists() && !f.isDirectory()) {\r\n\t\t\tdFileName = \"Copy of \" + dFileName;\r\n\t\t\tvalidateFile();\r\n\t\t}\r\n\t}", "@Override\n public synchronized boolean create(Path file)\n {\n File f = file.toFile(root);\n if (file.isRoot()) {\n return false;\n }\n File parent = file.parent().toFile(root);\n parent.mkdirs();\n\n try {\n return f.createNewFile();\n } catch (IOException e) {\n \te.printStackTrace();\n return false;\n }\n }", "@Test\n public void testHasFileTrue() {\n FileTree myTree = new FileTree();\n String file = \"file1\";\n try {\n myTree.makeFile(file);\n } catch (NotDirectoryException | AlreadyExistException e) {\n fail(\"directory1 already exists or the path is invalid.\");\n }\n assertTrue(myTree.hasFile(file));\n }", "@Test\n public void testMakeFileFileExists() {\n FileTree myTree = new FileTree();\n String file = \"file1\";\n boolean result = false;\n try {\n myTree.makeFile(file);\n myTree.makeFile(file);\n } catch (NotDirectoryException | AlreadyExistException e) {\n result = true;\n }\n assertTrue(result);\n\n }", "private static boolean isValid(File dbFile) {\n Validate.notNull(dbFile);\n if (!dbFile.isFile()) {\n return false;\n }\n if (!isValidFileName(dbFile.getName())) {\n return false;\n }\n return Archiver.hasEntryName(dbFile, LIB_INFO_NAME);\n }", "private void validate() {\r\n if (cmtFileSetList.size() == 0) {\r\n throw new BuildException(\"Nested Element 'fileset' missing for task 'cmt'.\");\r\n }\r\n if (output == null) {\r\n throw new BuildException(\"Parameter 'output' missing for task 'cmt'.\");\r\n }\r\n }", "private boolean shouldAddDockerDaemon(String queue) {\n return true;\n }", "public static File checkDescriptorFileExist(File descriptor) throws IllegalArgumentException {\n if (!descriptor.exists()) {\n throw new IllegalArgumentException(descriptor.getAbsolutePath() + \" does not exist\");\n }\n if (!descriptor.isFile()) {\n throw new IllegalArgumentException(descriptor.getAbsolutePath() + \" is not a file\");\n }\n if (!descriptor.canRead()) {\n throw new IllegalArgumentException(descriptor.getAbsolutePath() + \" is not readable\");\n }\n \n return descriptor;\n }", "private boolean hostHasImage(String imageName, Host host) throws Exception {\n\t\tWebTarget dockerTarget = this.createDockerTarget(host);\n\t\tJsonNode response = null;\n\t\ttry {\n\t\t\tresponse = dockerTarget.path(\"images\").path(imageName).path(\"json\").request().buildGet().submit(JsonNode.class).get();\n\t\t} catch (Throwable t) {\n\t\t\t// 'Hacky' workaround...\n\t\t\tif (!t.getMessage().contains(\"404\")) {\n\t\t\t\tThrowables.propagate(t);\n\t\t\t}\n\t\t}\n\t\tif (response != null && response.size() > 0 && response.get(\"Container\") != null) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean validateEventMainImage(){\n if(imageUri == null){\n Toasty.error(CreateEventActivity.this, \"Please set the main image for the event\", Toast.LENGTH_SHORT, true).show();\n return false;\n }\n else{\n return true;\n }\n }", "public boolean createBuild(Build build);", "private static void checkFilePath(String filePath) {\n File file = new File(filePath);\n try {\n if (!file.getParentFile().exists()) {\n file.getParentFile().mkdirs();\n }\n if (!file.exists()) {\n file.createNewFile();\n }\n file.createNewFile();\n } catch (IOException e) {\n System.err.println(e.getMessage());\n }\n }", "private boolean canHaveAsPatientFile(PatientFile creator) {\n\n\t\treturn creator != null;\n\t}", "public void validate() throws BuildException {\n if (pack == null) {\n throw new BuildException(\"A package must be specified\");\n }\n }", "private boolean shouldBuild(IResource resource) {\n \t\treturn resource.getType() == IResource.FILE && resource.getFileExtension().equals(\"gf\");\n \t}", "boolean doesFileExist(String date)\n throws FlooringMasteryPersistenceException;", "private void check() {\n Path pathroot = getPath();\n // check the path is file or directory\n checkFileOrDirectory(pathroot);\n }", "public boolean canIssueCreateDatasetCommand(DvObject dvo) {\n return canIssueCommand(dvo, AbstractCreateDatasetCommand.class);\n }", "@Test\n public void filesValidateTest() throws ApiException {\n String owner = null;\n String repo = null;\n FilesValidate data = null;\n api.filesValidate(owner, repo, data);\n\n // TODO: test validations\n }", "@Test\n\t@Ignore\n\tpublic void createRoboconfImage() throws Exception {\n\t\tfinal String tag = \"roboconf-test-by-hand\";\n\t\tBuilder config = DefaultDockerClientConfig.createDefaultConfigBuilder();\n\t\tconfig.withDockerHost( \"tcp://localhost:\" + DockerTestUtils.DOCKER_TCP_PORT );\n\n\t\tDockerClient docker = DockerClientBuilder.getInstance( config.build()).build();\n\t\tImage img = DockerUtils.findImageByIdOrByTag( tag, docker );\n\t\tif( img != null ) {\n\t\t\tdocker.removeImageCmd( tag ).exec();\n\t\t\timg = DockerUtils.findImageByIdOrByTag( tag, docker );\n\t\t}\n\n\t\tAssert.assertNull( img );\n\n\t\t// Prepare the parameters\n\t\tFile baseDir = new File( Thread.currentThread().getContextClassLoader().getResource( \"./image/roboconf\" ).getFile());\n\t\tAssert.assertTrue( baseDir.exists());\n\n\t\tMap<String,String> targetProperties = new HashMap<> ();\n\t\ttargetProperties.put( DockerHandler.IMAGE_ID, tag );\n\t\ttargetProperties.put( DockerHandler.GENERATE_IMAGE_FROM, \".\" );\n\n\t\tTargetHandlerParameters parameters= new TargetHandlerParameters();\n\t\tparameters.setTargetProperties( targetProperties );\n\t\tparameters.setMessagingProperties( new HashMap<String,String>( 0 ));\n\t\tparameters.setApplicationName( \"applicationName\" );\n\t\tparameters.setScopedInstancePath( \"/vm\" );\n\t\tparameters.setScopedInstance( new Instance());\n\t\tparameters.setTargetPropertiesDirectory( baseDir );\n\n\t\tFile tmpFolder = this.folder.newFolder();\n\t\tMap<String,File> containerIdToVolume = new HashMap<> ();\n\t\tDockerMachineConfigurator configurator = new DockerMachineConfigurator(\n\t\t\t\tparameters,\n\t\t\t\t\"machineId\",\n\t\t\t\ttmpFolder,\n\t\t\t\tcontainerIdToVolume );\n\n\t\t// Test the creation\n\t\tContainer container = null;\n\t\ttry {\n\t\t\tconfigurator.configure();\n\t\t\timg = DockerUtils.findImageByIdOrByTag( tag, docker );\n\t\t\tAssert.assertNotNull( img );\n\n\t\t\tString containerName = DockerUtils.buildContainerNameFrom(\n\t\t\t\t\tparameters.getScopedInstancePath(),\n\t\t\t\t\tparameters.getApplicationName());\n\n\t\t\tcontainer = DockerUtils.findContainerByIdOrByName( containerName, docker );\n\t\t\tAssert.assertNotNull( container );\n\n\t\t} finally {\n\t\t\tif( img != null )\n\t\t\t\tdocker.removeImageCmd( tag ).exec();\n\n\t\t\timg = DockerUtils.findImageByIdOrByTag( tag, docker );\n\t\t\tAssert.assertNull( img );\n\n\t\t\tif( container != null ) {\n\t\t\t\tdocker.removeContainerCmd( container.getId()).withForce( true ).exec();\n\t\t\t\tcontainer = DockerUtils.findContainerByIdOrByName( container.getId(), docker );\n\t\t\t\tAssert.assertNull( container );\n\t\t\t}\n\n\t\t\tconfigurator.close();\n\t\t}\n\t}", "public static boolean isDockerRun() {\n if (\"DOCKER\".equalsIgnoreCase(System.getenv(\"WAGERPLAYER_RUN_MODE\"))) {\n return true;\n }\n return false;\n }", "public static boolean checkAppFileDirectory(Context context) {\n\t\ttry {\n\t\t\tfinal String imageDir = getAppFilesDirByData(context);\n\t\t\tfinal File imageFileDir = new File(imageDir);\n\t\t\tif (!imageFileDir.exists()) {\n\t\t\t\tfinal boolean isMkdirs = imageFileDir.mkdirs();\n\t\t\t\treturn isMkdirs;\n\t\t\t}\n\t\t\treturn true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn false;\n\n\t}", "public boolean checkFolderExistsOrMake(File folder) {\n\t\ttry {\n\t\t\tif(folder.exists()) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tfolder.mkdir();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t}", "public abstract boolean canCreate(FolderType type);", "public boolean hasCreateTaskPack() {\n return packCase_ == 3;\n }", "public boolean hasCreateTaskPack() {\n return packCase_ == 3;\n }", "private boolean isMetadataFileExist(String idpName, String metadata) {\n\n return StringUtils.isNotEmpty(idpName) && StringUtils.isNotEmpty(metadata);\n }", "@HandleBeforeCreate\n public void scriptValidating(Script script) {\n if (!script.compileScript(script.getBody(), getEngine())){\n logger.warn(\"Script \\\"\" + script.getBody() + \"\\\" compiled unsuccessful\");\n throw new InvalidScriptStateException(\"compiled unsuccessful\");\n } \n }", "protected void validateMcaDeployedToWorkingDir() {\n\t\tassertTrue(unitTestDir.exists());\n\t\tassertTrue(new File(unitTestDir, \"composition.groovy\").exists());\n\t\tassertTrue(new File(unitTestDir, \"MCA-INF/components/components.jar\").exists());\n\t\tassertTrue(new File(unitTestDir, \"MCA-INF/promoted/promoted.jar\").exists());\n\t\tassertTrue(new File(unitTestDir, \"MCA-INF/hidden/hidden.jar\").exists());\n\t}", "private boolean isPackValid() {\n\t\treturn (logData != null\n\t\t\t\t&& logData.entries != null\n\t\t\t\t&& logData.entries.size() > 1);\n\t}", "public void validateCreate(NocRequest nocRequest, Object mdmsData) {\n\t\tmdmsValidator.validateMdmsData(nocRequest, mdmsData);\n\t\tif (!ObjectUtils.isEmpty(nocRequest.getNoc().getDocuments())) {\n\t\t\tvalidateAttachedDocumentTypes(nocRequest.getNoc(), mdmsData);\n\t\t\tvalidateDuplicateDocuments(nocRequest.getNoc());\n\t\t}\n\t}", "private boolean isValid() throws BadInputException {\n try {\n if( ! br.ready() ) \t\t\t\t\t\t//Is the reader ready?\n throw new BadInputException();\t\t//Must be a problem with the file, throw exception\n }\n catch(java.io.IOException e) {\n System.out.println(\"Error validating readability of file: \" + e.toString() );\n }\n\n return true;\n }", "boolean hasCreationTime();", "private boolean touchFileExists() {\n File f = new File(touchFile);\n return f.exists();\n }", "@Test\n public void filesCreateTest() throws ApiException {\n String owner = null;\n String repo = null;\n FilesCreate data = null;\n PackageFileUpload response = api.filesCreate(owner, repo, data);\n\n // TODO: test validations\n }", "public void shouldCreate() {\n }", "void validateCreate(ClaudiaData claudiaData, EnvironmentDto environmentDto, String vdc) throws \r\n AlreadyExistEntityException, InvalidEntityException;", "private void createDockerImage(String dockerImageTag, String dockerDir) {\n DockerModel dockerModel = new DockerModel();\n dockerModel.setName(dockerImageTag);\n try {\n DockerArtifactHandler dockerArtifactHandler = new DockerArtifactHandler(dockerModel);\n dockerArtifactHandler.buildImage(dockerModel, Paths.get(dockerDir));\n } catch (DockerGenException | InterruptedException e) {\n String errMsg = \"Error occurred while building Docker image \";\n log.error(errMsg, e);\n throw new BallerinaException(errMsg + e.getMessage());\n }\n }", "@Path(\"/api/repo/create\")\n\t@POST\n\t@ApiOperation(value = \"Create the docker repository\", notes = \"User can create docker repository.User with role Customer Admin only allowed.\", response = ApiResponseDTO.class)\n\t@ApiResponses({ @ApiResponse(code = 200, message = \"The docker repository has been created successfully\") })\n\t@Transactional(rollbackFor = { NotAuthorizeException.class, JsonProcessingException.class, ValidationException.class,BaseException.class })\n\t@RequestMapping(value = \"/api/repo/create\", method = RequestMethod.POST)\n\t@PreAuthorize(\"hasAuthority('Customer Admin')\")\n\tpublic ApiResponseDTO createRepository(\n\t\t\t@ApiParam(name = \"Docker respository object\", value = \"Docker respository object that needs to be created\", required = true) @Valid @RequestBody DockerRepositoryDTO dockerRepositoryDTO,\n\t\t\tHttpServletRequest request) throws NotAuthorizeException, JsonProcessingException, ValidationException, BaseException {\n\t\tString message = null;\n\t\tString statusCode = HttpStatus.OK.toString();\n\t\tString loggedInEmail = getLoggedInUserEmail(SecurityContextHolder.getContext().getAuthentication());\n\t\tString roleName = getLoggedInUserRoleName(SecurityContextHolder.getContext().getAuthentication());\n\t\tlogger.debug(\"RoleName and loggedinemail are {}, {}\", roleName, loggedInEmail);\n\t\tUser loggedInUser = userService.findUserByEmail(loggedInEmail);\n\t\tString userQAuthToken = loggedInUser.getqAuthToken();\n\t\tif (userQAuthToken == null) {\n\t\t\tthrow new NotAuthorizeException(environment.getProperty(\"job.notauthorized\"));\n\t\t}\n\t\tif(StringUtils.containsWhitespace(dockerRepositoryDTO.getRepository()) == true){\n\t\t\tthrow new ValidationException(environment.getProperty(\"repository.name.notallow.space\"));\n\t\t}\n\t\ttry {\n\t\t\tString custName = customerService.findCustomer(loggedInUser).getName();\n\t\t\tString url = environment.getProperty(\"quay.url\");\n\n\t\t\tlogger.debug(\"Crreate Docker Repository with fallowing parmes url {} CustomerName {}\", url, custName);\n\n\t\t\tdockerRepositoryDTO.setNamespace(custName);\n\n\t\t\tDockerRepoResponseDTO dockerRepoResponse = JobsClient.createDockerRepository(url, BEARER + userQAuthToken,\n\t\t\t\t\tdockerRepositoryDTO);\n\t\t\tif (dockerRepoResponse != null) {\n\t\t\t\tmessage = dockerRepoResponse.getMessage();\n\t\t\t\tstatusCode = String.valueOf(dockerRepoResponse.getStatusCode());\n\t\t\t}\n\t\t\tlogger.info(environment.getProperty(\"job.repository.create.sucess\"),loggedInUser.getUserName(),custName,environment.getProperty(\"quay.url\"));\n\t\t} catch (MalformedURLException e) {\n\t\t\tlogger.error(e.getMessage());\n\t\t\tlogger.info(environment.getProperty(\"job.tomcat.failed\"),environment.getProperty(\"nvidia.host\"),environment.getProperty(\"quay.url\"));\n\t\t\tthrow new BaseException(\"error while creating docker repositories\" + e.getMessage());\n\t\t}\n\t\t\n\t\tApiResponseDTO response = new ApiResponseDTO(message, Integer.parseInt(statusCode));\n\t\treturn response;\n\t}", "boolean isExecutableValidationEnabled();", "public void check() throws XMLBuildException {\r\n\r\n\t}", "public void check() throws XMLBuildException {\r\n\r\n\t}", "public static boolean isValidCreationTime(Date date) {\r\n \treturn \t(date!=null) &&\r\n \t\t\t(date.getTime()<=System.currentTimeMillis());\r\n }", "ValidationResult isPackageConfigurationValid(PackageConfiguration packageConfiguration, RepositoryConfiguration repositoryConfiguration);", "@Override\n public boolean isContainer(String path) {\n return false;\n }", "@Test(expected = PipelineException.class)\n public void testValidateManifestWithMissingFiles() {\n KicIngester.validateManifest(new File(SCP_DATA_DIR),\n \"Manifest.missing-files\", KicIngester.getScpFiles(new File(\n SCP_DATA_DIR), SCP_FILENAME_PATTERN));\n }", "void createRecipe(Recipe recipe) throws ServiceFailureException;", "public boolean canCreatePatch() {\n try {\n getClass().getDeclaredMethod(\"createNewPatch\", null);\n return true;\n } catch (Exception ex) {\n return false;\n }\n }", "void btnValidateFile(File file);", "@java.lang.Override\n public boolean hasCreationDate() {\n return ((bitField0_ & 0x00000002) != 0);\n }", "public interface ValidationServiceInterface {\n /**\n * Check all changes for added or modified yaml files and validate them\n *\n * @param changes The changes to check\n * @param repository The repository to check in\n * @param currentHash The current hash of the repository to fetch the yaml files\n * @throws InvalidYamlFileException One YAML file had an invalid content\n */\n void areChangesValid(\n final Iterable<Change> changes,\n final Repository repository,\n final String currentHash\n ) throws InvalidYamlFileException;\n}", "@java.lang.Override\n public boolean hasCreationDate() {\n return ((bitField0_ & 0x00000002) != 0);\n }", "private boolean create(Plugin plugin, String name){\n\n if(!plugin.getDataFolder().exists())\n plugin.getDataFolder().mkdir();\n\n File folder = plugin.getDataFolder();\n\n// if(name.contains(\"/\")) {\n// folder = new File(plugin.getDataFolder(), name.substring(0, name.lastIndexOf(\"/\")));\n//\n// if(!folder.exists())\n// folder.mkdir();\n//\n// name = name.substring(name.lastIndexOf(\"/\") + 1);\n// }\n\n configFile = new File(folder, name+\".yml\");\n\n if(!configFile.exists()){\n try {\n if(!configFile.getParentFile().exists())\n configFile.getParentFile().mkdir();\n configFile.createNewFile();\n return true;\n } catch (IOException ignored) {\n ignored.printStackTrace();\n }\n }\n\n return false;\n }", "@Test\n public void testIsCreatingProjectIfMissing() throws Exception {\n assertThat(\"Expect true\", testling.isCreatingProjectIfMissing(), is(Boolean.TRUE));\n }", "private boolean validateFile(JTextField fileTF,\n Component parentComp) {\n if (fileTF.getText().trim().length() == 0)\n {\n JOptionPane.showMessageDialog(parentComp,\n \"Please enter a file name in the file field\",\n \"No File Name\", JOptionPane.ERROR_MESSAGE);\n return false;\n }\n String text = fileTF.getText().trim();\n File file = new File(text);\n if (!file.exists())\n {\n JOptionPane\n .showMessageDialog(\n parentComp,\n \"The file you entered does not exist. Please enter a valid file name\",\n \"Incorrect File Name\", JOptionPane.ERROR_MESSAGE);\n return false;\n }\n return true;\n }", "private boolean requiresCreate( EntityInstanceImpl ei )\n {\n // Can't create an entity that wasn't created...\n if ( !ei.isCreated() )\n return false;\n\n // Skip deleted entities; they've been created then deleted so no need to save them.\n if ( ei.isDeleted() )\n return false;\n\n // Check to see if this EI has already been inserted into the DB.\n if ( ei.dbhCreated )\n return false;\n\n EntityDef entityDef = ei.getEntityDef();\n if ( entityDef.isDerivedPath() )\n return false;\n\n // Skip the entity if we don't allow creates.\n if ( ! entityDef.isCreate() )\n return false;\n\n DataRecord dataRecord = entityDef.getDataRecord();\n if ( dataRecord == null )\n return false;\n\n return true;\n }", "@Override\n\tprotected boolean isFileValid(List<String> lines) {\n\t\treturn lines.size() == SAVE_FILE_LENGTH && lines.get(0).length() > 0 && lines.get(1).length() > 0; // id and first name is required\n\t}", "public void checkFile() {\n\t\tFile file = new File(\"src/Project11Problem1Alternative/names.txt\");\n\t\tSystem.out.println(file.exists() ? \"Exists!\" : \"Doesn't exist!\");\n\t\tSystem.out.println(file.canRead() ? \"Can read!\" : \"Can't read!\");\n\t\tSystem.out.println(file.canWrite() ? \"Can write!\" : \"Can't write!\");\n\t\tSystem.out.println(\"Name: \" + file.getName());\n\t\tSystem.out.println(\"Path: \" + file.getPath());\n\t\tSystem.out.println(\"Size: \" + file.length() + \" bytes\");\n\t}", "@Test\n public void testBuildingContainerWithBadFields() throws Exception {\n // test when required fields are null\n String name = refContainerNames.get(0);\n ContainerStatus status = refContainerStatuses.get(0);\n buildContainerWithBadFieldsAndFail(null, status, false, false, IllegalStateException.class);\n buildContainerWithBadFieldsAndFail(name, null, false, false, IllegalStateException.class);\n buildContainerWithBadFieldsAndFail(name, status, true, false, IllegalStateException.class);\n }", "private static boolean argsAreValid(String[] args) {\n try {\n if (args.length != NUM_OF_ARGS) {\n System.err.println(TypeTwoErrorException.TYPE_II_GENERAL_MSG +\n BAD_COMMAND_LINE_ARGUMENTS);\n return false;\n }\n File sourceDirectory = new File(args[0]);\n File commandFile = new File(args[1]);\n if ((!sourceDirectory.isDirectory()) || (!commandFile.isFile())) {\n System.err.println(TypeTwoErrorException.TYPE_II_GENERAL_MSG +\n BAD_COMMAND_LINE_ARGUMENTS);\n return false;\n }\n } catch (Exception e) {\n System.err.println(TypeTwoErrorException.TYPE_II_GENERAL_MSG +\n UNKNOWN_ERROR_COMMAND_LINE_ARGUMENTS);\n return false;\n }\n return true;\n }", "@Override\n public boolean isValid() {\n if(width < 0){\n return false;\n }\n\n if(height < 0){\n return false;\n }\n\n //no null objects\n if(origin == null){\n return false;\n }\n\n if(color == null){\n return false;\n }\n\n //if texture doesn't exist, sprite is not buildable\n if(!Gdx.files.internal(texture).exists()){\n Gdx.app.log(TAG, \"Texture cannot be found: \" + texture);\n return false;\n }\n\n return true;\n }", "@Test\n public final void testValidate() {\n final CmdConfiguration config = new CmdConfiguration();\n try {\n config.validate();\n fail();\n } catch (RuntimeException e) {\n // expected because configuration is incomplete\n assertNotNull(e);\n }\n }", "public boolean checkVaild() throws IOException;", "public void testCreateFileSuccess() throws Exception {\r\n assertNotNull(\"setup fails\", filePersistence);\r\n String fileCreationId = filePersistence.createFile(VALID_FILELOCATION, FILENAME);\r\n assertTrue(\"fileCreationId shouldn't be null or empty\", fileCreationId != null\r\n && fileCreationId.trim().length() != 0);\r\n filePersistence.closeFile(fileCreationId);\r\n filePersistence.deleteFile(VALID_FILELOCATION, FILENAME);\r\n }", "public boolean hasCreateDate() {\n return fieldSetFlags()[2];\n }", "public boolean isSetCreateDate() {\n return this.createDate != null;\n }", "public boolean isSetCreateDate() {\n return this.createDate != null;\n }", "private boolean checkValidity(String path) {\n File checkFile = new File(path);\n return checkFile.exists();\n }", "public static boolean createRootFile(String parentPath, String name) {\n File dir = new File(parentPath + File.separator + name);\n\n if (dir.exists())\n return false;\n\n try {\n if (!readReadWriteFile())\n RootTools.remount(parentPath, \"rw\");\n\n execute(\"touch \" + getCommandLineString(dir.getAbsolutePath()));\n return true;\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n return false;\n }" ]
[ "0.6379253", "0.58897793", "0.5786186", "0.55596805", "0.5513865", "0.53696334", "0.5225533", "0.5138156", "0.5128119", "0.5125257", "0.51155657", "0.5104756", "0.50488985", "0.5014007", "0.5013935", "0.5005256", "0.4995101", "0.49841878", "0.49830386", "0.49814624", "0.4968185", "0.4963123", "0.4953555", "0.49302393", "0.49291763", "0.49224982", "0.49029335", "0.49023637", "0.48933813", "0.48849806", "0.4874272", "0.486333", "0.485146", "0.48407874", "0.4829782", "0.4807351", "0.4796634", "0.47945002", "0.47859773", "0.47583804", "0.47573888", "0.47527727", "0.47480732", "0.4718348", "0.47124496", "0.47109357", "0.47089303", "0.47003844", "0.46984434", "0.46982843", "0.469779", "0.4684799", "0.46762145", "0.4674329", "0.4672202", "0.46679303", "0.4667694", "0.4659875", "0.46573994", "0.4653188", "0.46449095", "0.46396917", "0.4635125", "0.46214056", "0.4615827", "0.46155518", "0.46124762", "0.46101692", "0.45979768", "0.45962113", "0.45942798", "0.45909035", "0.45909035", "0.45905742", "0.4587832", "0.45803374", "0.4573314", "0.4568464", "0.45652735", "0.45615727", "0.4561338", "0.45600972", "0.4549458", "0.45483246", "0.45464584", "0.45377448", "0.45316243", "0.45304838", "0.4529972", "0.4528546", "0.4505455", "0.45002958", "0.44987127", "0.4495707", "0.44887665", "0.44884276", "0.44834867", "0.44834867", "0.44809255", "0.44802448" ]
0.8187172
0
Validate contents of the Dockerfile.
public void validateDockerImage() throws DockerTestException, InterruptedException { List<String> ports = getExposedPorts(DOCKER_IMAGE); Assert.assertEquals(ports.size(), 1); Assert.assertEquals(ports.get(0), "9099/tcp"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void validateDockerfile() {\n File dockerFile = DOCKER_TARGET_PATH.resolve(\"Dockerfile\").toFile();\n Assert.assertTrue(dockerFile.exists());\n }", "static boolean isConfigValid(Path path) {\n Yaml yaml = new Yaml();\n InputStream inputStream = null;\n try {\n inputStream = Files.newInputStream(path);\n } catch (IOException e) {\n // System.err.println(e);\n return false;\n }\n try {\n yaml.load(inputStream);\n } catch (RuntimeException e) {\n // TODO: Good validation messages are available here. An example:\n /*\n while scanning a simple key\n in 'reader', line 7, column 1:\n xx\n ^\n could not find expected ':'\n in 'reader', line 7, column 3:\n xx\n ^\n */\n // System.err.println(e);\n return false;\n }\n\n return true;\n }", "private boolean validateAttributes(ScanningContext context) {\n // We only need to check if it's a non-framework file (and an XML file; skip .png's)\n if (!isFramework() && SdkUtils.endsWith(getFile().getName(), DOT_XML)) {\n ValidatingResourceParser parser = new ValidatingResourceParser(context, false);\n try {\n IAbstractFile file = getFile();\n return parser.parse(file.getOsLocation(), file.getContents());\n } catch (Exception e) {\n context.needsFullAapt();\n }\n\n return false;\n }\n\n return true;\n }", "public boolean validImageContent() {\n\t\treturn input.validFile(list);\n\t}", "@Test\n public void testBuildDockerfile() throws Exception {\n System.out.println(\"buildDockerfile\");\n //Create temp file to copy\n Path path = Paths.get(\"/tmp/dockerfiletest.txt\");\n Files.createDirectories(path.getParent());\n try {\n Files.createFile(path);\n } catch (FileAlreadyExistsException e) {\n System.err.println(\"already exists: \" + e.getMessage());\n }\n //Create list of files to add to constructor\n File file = new File(path.toString());\n ArrayList<File> files = new ArrayList<File>();\n files.add(file);\n //Create object\n Docker instance = new Docker(\"ubuntu\", \"git\", files, \"sh6791\", \"matrix\", \"v1\", \"saqhuss\", \"dockersh6791\", \"[email protected]\");\n instance.buildDockerfile();\n\n //Check if file was copied\n file = new File(\"dockerfiletest.txt\");\n assertTrue(file.exists());\n //Check if ssh-keys were generated\n file = new File(\"id_rsa\");\n assertTrue(file.exists());\n file = new File(\"id_rsa.pub\");\n assertTrue(file.exists());\n file = new File(\"authorized_keys\");\n assertTrue(file.exists());\n //Expected result of dockerfile\n String result = \"FROM ubuntu\\n\"\n + \"MAINTAINER saqhuss\\n\"\n + \"RUN apt-get update \\n\"\n + \"RUN apt-get install -y git\\n\"\n + \"RUN useradd -m -p password mpiuser\\n\"\n + \"RUN mkdir /home/mpiuser/.ssh\\n\"\n + \"ADD id_rsa /home/mpiuser/.ssh/id_rsa\\n\"\n + \"ADD id_rsa.pub /home/mpiuser/.ssh/id_rsa.pub\\n\"\n + \"ADD authorized_keys /home/mpiuser/.ssh/authorized_keys\\n\"\n + \"ADD hosts /home/mpiuser/hosts\\n\"\n + \"ADD dockerfiletest.txt /home/mpiuser/dockerfiletest.txt\\n\"\n + \"RUN sudo chown -R mpiuser:mpiuser /home/mpiuser/.ssh\\n\"\n + \"RUN echo 'mpiuser:password' | chpasswd\\n\"\n + \"RUN echo '/usr/sbin/sshd' >> /etc/bash.bashrc\";\n\n BufferedReader reader = new BufferedReader(new FileReader(\"Dockerfile\"));\n String line = null;\n StringBuilder sb = new StringBuilder();\n while ((line = reader.readLine()) != null) {\n sb.append(line + \"\\n\");\n }\n //Check result and read in of Dockerfile are equal\n assertEquals(sb.toString().trim(), result);\n\n //Delete all created temp files\n Files.delete(path);\n Files.delete(Paths.get(\"dockerfiletest.txt\"));\n Files.delete(Paths.get(\"id_rsa\"));\n Files.delete(Paths.get(\"id_rsa.pub\"));\n Files.delete(Paths.get(\"authorized_keys\"));\n }", "@Override\n\tpublic boolean validateContent()\n\t{\n\t\treturn true;\n\t}", "public void validate() throws BuildException {\n if (pack == null) {\n throw new BuildException(\"A package must be specified\");\n }\n }", "@Test\n public void testGetDockerfile() throws Exception {\n System.out.println(\"getDockerfile\");\n Path path = Paths.get(\"/tmp/test.txt\");\n Files.createDirectories(path.getParent());\n try {\n Files.createFile(path);\n } catch (FileAlreadyExistsException e) {\n System.err.println(\"already exists: \" + e.getMessage());\n }\n Docker instance = new Docker();\n instance.getDockerfile(\"TestFile\");\n File file = new File(path.toString());\n assertTrue(file.exists());\n Files.delete(path);\n }", "private static void checkHasSomethingToBuild(ImageModule image)\n\t\t\tthrows ValidationException {\n\t\tif (image.isVirtual()) {\n\t\t\tthrow new ValidationException(\n\t\t\t\t\t\"This image doesn't need to be built since it doesn't contain a package list nor a pre-recipe or a recipe.\");\n\t\t}\n\t}", "@Override\n public boolean validate(Batch batch,\n InputStream contents,\n ResultCollector resultCollector) {\n Document document = DOM.streamToDOM(contents);\n return validate(batch,document,resultCollector);\n }", "private void validate() {\r\n if (cmtFileSetList.size() == 0) {\r\n throw new BuildException(\"Nested Element 'fileset' missing for task 'cmt'.\");\r\n }\r\n if (output == null) {\r\n throw new BuildException(\"Parameter 'output' missing for task 'cmt'.\");\r\n }\r\n }", "@Test\n public void shouldNotParseCamundaFormDefinitionAndFormKey() {\n String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), \"shouldNotParseCamundaFormDefinitionAndFormKey\");\n\n // when/then expect parse exception\n assertThatThrownBy(() -> repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy())\n .isInstanceOf(ParseException.class)\n .hasMessageContaining(\"Invalid element definition: only one of the attributes formKey and formRef is allowed.\");\n }", "@Test(expected = PipelineException.class)\n public void testValidateManifestWithMungedFiles() {\n KicIngester.validateManifest(new File(SCP_DATA_DIR),\n \"Manifest.munged-files\", KicIngester.getScpFiles(new File(\n SCP_DATA_DIR), SCP_FILENAME_PATTERN));\n }", "private boolean isValid() throws BadInputException {\n try {\n if( ! br.ready() ) \t\t\t\t\t\t//Is the reader ready?\n throw new BadInputException();\t\t//Must be a problem with the file, throw exception\n }\n catch(java.io.IOException e) {\n System.out.println(\"Error validating readability of file: \" + e.toString() );\n }\n\n return true;\n }", "private void verifyContent(String content) throws Exception {\n\t\t// try to read content into an XMLMemento\n\t\tXMLMemento.createReadRoot(new StringReader(content));\n\t}", "private void validateBagFile(File bagFile) throws IOException {\n\t\tZipFile zf = new ZipFile(bagFile);\n\t\t// Check files calculates the hashes and file sizes and reports on\n\t\t// whether hashes are correct\n\t\t// The file sizes are added to totalDataSize which is compared with the\n\t\t// stats sent in the request\n\t\tcheckFiles(sha1Map, zf);\n\n\t\tlog.info(\"Data Count: \" + dataCount);\n\t\tlog.info(\"Data Size: \" + totalDataSize);\n\t\t// Check stats\n\t\tif (pubRequest.getJSONObject(\"Aggregation Statistics\").getLong(\n\t\t\t\t\"Number of Datasets\") != dataCount) {\n\t\t\tlog.warn(\"Request contains incorrect data count: should be: \"\n\t\t\t\t\t+ dataCount);\n\t\t}\n\t\t// Total size is calced during checkFiles\n\t\tif (pubRequest.getJSONObject(\"Aggregation Statistics\").getLong(\n\t\t\t\t\"Total Size\") != totalDataSize) {\n\t\t\tlog.warn(\"Request contains incorrect Total Size: should be: \"\n\t\t\t\t\t+ totalDataSize);\n\t\t}\n\n\t\tzf.close();\n\t}", "@Test\n public final void testValidate() {\n final CmdConfiguration config = new CmdConfiguration();\n try {\n config.validate();\n fail();\n } catch (RuntimeException e) {\n // expected because configuration is incomplete\n assertNotNull(e);\n }\n }", "public boolean valid()\r\n\t{\r\n\t\treturn valid(getInputStream());\r\n\t}", "public void validate() {\n Validate.notEmpty(filePath, \"Configuration file path not specified\");\n Validate.notEmpty(fileEncoding, \"Configuration file encoding not specified\");\n Validate.notEmpty(syntaxCheckCommand, \"Syntax check command not specified\");\n Validate.notEmpty(restartCommand, \"Restart command not specified\");\n Validate.notNull(hostName, \"Host name not specified\");\n Validate.isTrue(port > 0, \"Port must be greater than zero\");\n Validate.isTrue(checkInterval > 0, \"Health check interval must be greater than zero\");\n Validate.isTrue(checkTimeout > 0, \"Health check timeout must be greater than zero\");\n }", "public interface ValidationServiceInterface {\n /**\n * Check all changes for added or modified yaml files and validate them\n *\n * @param changes The changes to check\n * @param repository The repository to check in\n * @param currentHash The current hash of the repository to fetch the yaml files\n * @throws InvalidYamlFileException One YAML file had an invalid content\n */\n void areChangesValid(\n final Iterable<Change> changes,\n final Repository repository,\n final String currentHash\n ) throws InvalidYamlFileException;\n}", "@Test\n public void filesValidateTest() throws ApiException {\n String owner = null;\n String repo = null;\n FilesValidate data = null;\n api.filesValidate(owner, repo, data);\n\n // TODO: test validations\n }", "void areChangesValid(\n final Iterable<Change> changes,\n final Repository repository,\n final String currentHash\n ) throws InvalidYamlFileException;", "public static boolean inDockerEnv() {\n\t\treturn DOCKER_ENV_FLAG_FILE.isFile();\n\t}", "private static boolean verifyXML(String fileName) throws IOException {\n\t\tSchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA);\n\t\tStreamSource xsdFile = new StreamSource(ResourceUtils.getResourceStream(XSD_FILE_PATH));\n\t\tStreamSource xmlFile = new StreamSource(new File(fileName));\n\t\tboolean validXML = false;\n\t\ttry {\n\t\t\tSchema schema = sf.newSchema(xsdFile);\n\t\t\tValidator validator = schema.newValidator();\n\t\t\ttry {\n\t\t\t\tvalidator.validate(xmlFile);\n\t\t\t\tvalidXML = true;\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (!validXML) {\n\t\t\t\tnew IOException(\"File isn't valid against the xsd\");\n\t\t\t}\n\t\t} catch (SAXException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\txsdFile.getInputStream().close();\n\t\t\t// When using a file, this may be null\n\t\t\tif (xmlFile.getInputStream() != null)\n\t\t\t\txmlFile.getInputStream().close();\n\t\t}\n\t\treturn validXML;\n\t}", "private void validateInput () throws IOException, Exception {\n\t\t\n\t\t// Check that the properties file exists\n\t\tFile propFile = new File(propertiesFile);\n\t\tif (!propFile.exists()) { \n\t\t\tthrow new IOException(\"Unable to open properties file \" + propertiesFile);\t\n\t\t}\n\t\t\n\t\t// Check that the list of register files is not empty\n\t\tif (inputFiles == null || inputFiles.isEmpty()) {\n\t\t\tthrow new Exception(\"No files to process\");\n\t\t}\n\t}", "@Test\n public void testBuildContainer() throws Exception {\n System.out.println(\"buildContainer\");\n JTextArea ta = new JTextArea();\n //Create temp host file\n try {\n //\"False\" in file writer for no append\n PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"hosts\", false)));\n out.println(\"[email protected]\");\n out.flush();\n } catch (Exception e) {\n\n }\n ArrayList<File> files = new ArrayList<File>();\n Docker instance = new Docker(\"ubuntu\", \"git\", files, \"sh6791\", \"matrix\", \"v1\", \"saqhuss\", \"dockersh6791\", \"[email protected]\");\n instance.buildDockerfile();\n instance.buildContainer(ta);\n Process p;\n String line = null;\n StringBuilder sb = new StringBuilder();\n try {\n p = Runtime.getRuntime().exec(new String[]{\"docker\", \"images\"});\n BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));\n while ((line = reader.readLine()) != null) {\n sb.append(line).append(\"\\n\");\n }\n } catch (Exception e) {\n\n }\n assertEquals(sb.toString().split(\"\\n\")[1].split(\" \")[0].trim(), \"saqhuss/matrix\");\n Files.delete(Paths.get(\"Dockerfile\"));\n Files.delete(Paths.get(\"hosts\"));\n Files.delete(Paths.get(\"id_rsa\"));\n Files.delete(Paths.get(\"id_rsa.pub\"));\n Files.delete(Paths.get(\"authorized_keys\"));\n }", "public void createImageFromDockerFile(String name,String content) throws IOException {\n\t\tPath dockerManagerDir = Files.createTempDirectory(\"dockerManagerDir\");\n\t\tFile dockerFile = new File(dockerManagerDir.toString(),\"Dockerfile\");\n\n\t\tSystem.out.println(dockerManagerDir.toString());\n\t\ttry {\n\t\t\tPrintWriter printWriter = new PrintWriter(dockerFile);\n\t\t\tprintWriter.print(content);\n\t\t\tprintWriter.close();\n\n\t\t\tdockerClient\n\t\t\t\t\t.buildImageCmd(new File(dockerManagerDir.toString() ) )\n\t\t\t\t\t.withNoCache()\n\t\t\t\t\t.withTag(name)\n\t\t\t\t\t.exec()\n\t\t\t\t\t.close();\n\t\t} finally {\n\t\t\tdockerFile.delete();\n\t\t\tnew File(dockerManagerDir.toString() ).delete();\n\t\t}\n\t}", "@Test(expected = PipelineException.class)\n public void testValidateManifestWithMissingFiles() {\n KicIngester.validateManifest(new File(SCP_DATA_DIR),\n \"Manifest.missing-files\", KicIngester.getScpFiles(new File(\n SCP_DATA_DIR), SCP_FILENAME_PATTERN));\n }", "protected void validateWikiFile(WikiFile wikiFile) throws WikiException {\r\n\t\tcheckLength(wikiFile.getFileName(), 200);\r\n\t\tcheckLength(wikiFile.getUrl(), 200);\r\n\t\tcheckLength(wikiFile.getMimeType(), 100);\r\n\t}", "@Override\r\n protected void runComponent() {\r\n\r\n File theFile = this.getAttachment(0, 0);\r\n\r\n try {\r\n \tif (theFile != null && theFile.exists()) {\r\n \t\tverifyInputFile(this.getAttachment(0, 0));\r\n \t} else {\r\n \t\taddErrorMessage(\"Could not read required input file.\");\r\n \t}\r\n\r\n } catch (Exception e) {\r\n logger.info(\"Verify of first \" + NUM_INPUT_LINES_TO_CHECK + \" failed: \" + e);\r\n this.addErrorMessage(e.toString());\r\n }\r\n\r\n System.out.println(this.getOutput());\r\n }", "@Test\n public void testValidateManifest() {\n KicIngester.validateManifest(new File(SCP_DATA_DIR), \"Manifest\",\n KicIngester.getScpFiles(new File(SCP_DATA_DIR),\n SCP_FILENAME_PATTERN));\n }", "public void check() throws XMLBuildException {\r\n\r\n\t}", "public void check() throws XMLBuildException {\r\n\r\n\t}", "public void validate() throws org.apache.thrift.TException {\n if (File != null) {\n File.validate();\n }\n }", "void btnValidateFile(File file);", "public static SourceError validateSynapseContent(String xmlContent) {\n\n xmlTagsQueue.clear();\n if (!xmlContent.trim().isEmpty()) {\n String[] lines = xmlContent.split(\"\\n\");\n int length = 0;\n\n for (int i = 0; i < lines.length; i++) {\n String line = lines[i];\n processTags(line, i, length);\n length += (line.length() + 1);\n }\n\n return synapseValidation();\n } else {\n return null;\n }\n\n }", "protected void validateConfiguration() {}", "private void checkFileContents(String name) throws IOException {\n byte[] buff = \"some bytes\".getBytes();\n assertTrue(Arrays.equals(buff, readFile(name, buff.length)));\n }", "private static boolean validate(JAXBContext jaxbCongtext, File file, URL xsdUrl) {\n SchemaFactory schemaFactory = null;\n Schema schema = null;\n Source xmlFile = new StreamSource(file);\n try {\n schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);\n schema = schemaFactory.newSchema(xsdUrl);\n Validator validator = schema.newValidator();\n DocumentBuilderFactory db = newSecuDocBuilderFactory();\n db.setNamespaceAware(true);\n\n DocumentBuilder builder = db.newDocumentBuilder();\n Document doc = builder.parse(file);\n\n DOMSource source = new DOMSource(doc);\n DOMResult result = new DOMResult();\n\n validator.validate(source, result);\n LOGGER.debug(xmlFile.getSystemId() + \" is valid\");\n } catch(Exception ex) {\n LOGGER.error(xmlFile.getSystemId() + \" is NOT valid\", ex);\n return false;\n }\n return true;\n }", "private void validateSource(SourcePointer.FileSource src) {\n File f = src.path.toFile();\n if (!f.exists() || !f.canRead()) {\n throw new SolrException(\n ErrorCode.BAD_REQUEST,\n String.format(\n Locale.US, \"File at %s either does not exist or cannot be read.\", src.path));\n }\n }", "@Test(expected = PipelineException.class)\n public void testValidateManifestWithMissingEntries() {\n KicIngester.validateManifest(new File(SCP_DATA_DIR),\n \"Manifest.missing-entries\", KicIngester.getScpFiles(new File(\n SCP_DATA_DIR), SCP_FILENAME_PATTERN));\n }", "boolean checkSubProcessDefinitionValid(ProcessDefinition processDefinition);", "public boolean verifyEmptyToDoImage() {\n if (validateAttributeContain(imageEmptyToDo, \"src\", \"images/icons/clipboard.png\", \"Image Empty ToDo\")) {\n return true;\n }\n return false;\n }", "private void validate(Path path) {\n }", "private static boolean argsAreValid(String[] args) {\n try {\n if (args.length != NUM_OF_ARGS) {\n System.err.println(TypeTwoErrorException.TYPE_II_GENERAL_MSG +\n BAD_COMMAND_LINE_ARGUMENTS);\n return false;\n }\n File sourceDirectory = new File(args[0]);\n File commandFile = new File(args[1]);\n if ((!sourceDirectory.isDirectory()) || (!commandFile.isFile())) {\n System.err.println(TypeTwoErrorException.TYPE_II_GENERAL_MSG +\n BAD_COMMAND_LINE_ARGUMENTS);\n return false;\n }\n } catch (Exception e) {\n System.err.println(TypeTwoErrorException.TYPE_II_GENERAL_MSG +\n UNKNOWN_ERROR_COMMAND_LINE_ARGUMENTS);\n return false;\n }\n return true;\n }", "private void validate(String source) throws InvalidConfiguration {\n\t\tString[] fragments = source.split(\",\");\n\t\tif (fragments.length != 3) {\n\t\t\tthrow new InvalidConfiguration(\n\t\t\t\t\t\"Invalid format of metadata file. Should have format - Column name, Length, Type \");\n\t\t}\n\n\t\tfor (String f : fragments) {\n\t\t\tif (f.trim().isEmpty()) {\n\t\t\t\tthrow new InvalidConfiguration(\n\t\t\t\t\t\t\"Invalid format of metadata file. Should valid content for the format - Column name, Length, Type \");\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tInteger.parseInt(fragments[INDEX_COLUMN_LENGTH]);\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new InvalidConfiguration(\"Invalid value in configuration\", e);\n\t\t}\n\n\t}", "public static SourceError validateXMLContent(String xmlContent) throws ValidationException {\n\n try {\n\n XMLReader r = XMLReaderFactory.createXMLReader(PARSER_CLASS);\n r.setFeature(VALIDATION_FEATURE, true);\n r.setFeature(SCHEMA_FEATURE, true);\n r.setErrorHandler(new MyErrorHandler());\n InputSource inputSource = new InputSource(new StringReader(xmlContent));\n r.parse(inputSource);\n\n } catch (SAXException e) {\n // ignore\n } catch (IOException e) {\n throw new ValidationException(\"Error while processing the xml content.\", e);\n }\n\n int start = calculateLength(xmlContent, sourceError.getStartChar(), sourceError.getLineNumber());\n sourceError.setStartChar(start);\n sourceError.setEndChar(start + 1);\n return sourceError;\n }", "private void validate() throws DomainXmlPreParserException {\n if (serverConfigRef == null)\n throw new DomainXmlPreParserException(\n Strings.get(\"dxpp.serverNotFound\", instanceName));\n // 2. config-ref of server matches config-ref of cluster\n if (!serverConfigRef.equals(cluster.configRef))\n throw new DomainXmlPreParserException(\n Strings.get(\"dxpp.configrefnotmatch\", instanceName, cluster.name));\n\n if(!configNames.contains(serverConfigRef))\n throw new DomainXmlPreParserException(\n Strings.get(\"dxpp.confignotfound\", instanceName, serverConfigRef));\n\n\n\n valid = true;\n }", "private void validate()\n throws TaskException\n {\n if( null == m_destfile )\n {\n final String message =\n REZ.getString( \"manifest.missing-file.error\" );\n throw new TaskException( message );\n }\n if( m_destfile.exists() && !m_destfile.isFile() )\n {\n final String message =\n REZ.getString( \"manifest.bad-file.error\", m_destfile );\n throw new TaskException( message );\n }\n }", "private void checkFile() {\n \ttry {\n \t\tdata = new BufferedReader(\n \t\t\t\t new FileReader(textFile));\n \t\t\n \t}\n \tcatch(FileNotFoundException e)\n \t{\n \t\tSystem.out.println(\"The mentioned File is not found.\");\n System.out.println(\"\");\n\t\t\tSystem.exit(1);\n\t\t} catch (Exception ex) {\n\t\t\tSystem.out.println(\"The following error occured while reading the file.\");\n\t\t\tex.printStackTrace();\n\t\t\tSystem.exit(2);\n\t\t}\n }", "private boolean isPackValid() {\n\t\treturn (logData != null\n\t\t\t\t&& logData.entries != null\n\t\t\t\t&& logData.entries.size() > 1);\n\t}", "public void validateAvroFile(File file) throws IOException {\n DatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>();\n DataFileReader<GenericRecord> fileReader =\n new DataFileReader<GenericRecord>(file, reader);\n GenericRecord record = new GenericData.Record(fileReader.getSchema());\n int numEvents = 0;\n while (fileReader.hasNext()) {\n fileReader.next(record);\n String bodyStr = record.get(\"message\").toString();\n System.out.println(bodyStr);\n numEvents++;\n }\n fileReader.close();\n Assert.assertEquals(\"Should have found a total of 3 events\", 3, numEvents);\n }", "public boolean validateAxis2ClientRepo(String input) throws AxisFault {\n try {\n ConfigurationContextFactory.createConfigurationContextFromFileSystem(input,\n DEFAULT_AXIS2_XML);\n return true;\n } catch (AxisFault e) {\n handleException(log, \"Error while validating the Axis2 Client Repository\", e);\n return false;\n }\n }", "ValidationResult isPackageConfigurationValid(PackageConfiguration packageConfiguration, RepositoryConfiguration repositoryConfiguration);", "private boolean validateFile(String path) {\n return !path.equals(AppStrings.NO_FILE_PATH);\n }", "@Test(priority = 5)\n\tpublic void validateContents() {\n\t\tlog = Logger.getLogger(HeroImageProducttestscripts.class);\n\t\tLogReport.getlogger();\n\t\tlogger = extent.startTest(\"Validating the content of the product\");\n\t\tHeroImageProductPageFlow.clickHeroImage(locator);\n\t\theroImg.validateDescriptionContent(locator, validate);\n\t\t;\n\t\tlog.info(\"Content validation is correct\");\n\t\tHeroImageProductPageFlow.clickProductSpecification(locator);\n\t\theroImg.validateSpecificationContent(locator, validate);\n\t\tlog.info(\"Content is present\");\n\t\tlog.info(\"Starting Sorting functionality testing\");\n\t}", "private boolean validateXmlFileWithSchema(String xmlFilePath, String xsdFilePath) { \n \tassert xmlFilePath != null && !xmlFilePath.isEmpty();\n \tassert xsdFilePath != null && !xsdFilePath.isEmpty();\n \tassert _schemaFactory != null;\n \tassert _loggerHelper != null;\n \t\n try {\n Schema schema = _schemaFactory.newSchema(new File(xsdFilePath));\n Validator validator = schema.newValidator();\n validator.validate(new StreamSource(new File(xmlFilePath)));\n } catch (IOException | SAXException e) {\n \t_loggerHelper.logError(e.getMessage());\n return false;\n }\n return true;\n }", "public void validate() throws org.apache.thrift.TException {\n if (dkFileConf != null) {\n dkFileConf.validate();\n }\n }", "public void validate() throws org.apache.thrift.TException {\n if (dkFileConf != null) {\n dkFileConf.validate();\n }\n }", "public void validate() throws org.apache.thrift.TException {\n if (dkFileConf != null) {\n dkFileConf.validate();\n }\n }", "private File validateFile(String filename)\n {\n if (filename == null)\n {\n throw new IllegalArgumentException(\"Filename is null\");\n }\n File f = new File(filename);\n //if (!f.exists()) sometimes this throws false even if the program does exist.\n //{\n // throw new IllegalArgumentException(\"Path \"+filename+\" does not refer to a file\");\n //}\n return f;\n }", "private void assertImageIsValid(Image img) throws ComparandumException {\n\t\tif (img.getWidth(null) == -1 || img.getHeight(null) == -1) {\n\t\t\tthrow new ComparandumException(\"Error loading image.\", null);\n\t\t}\n\t}", "protected void validateWikiFileVersion(WikiFileVersion wikiFileVersion) throws WikiException {\r\n\t\tcheckLength(wikiFileVersion.getUrl(), 200);\r\n\t\tcheckLength(wikiFileVersion.getMimeType(), 100);\r\n\t\tcheckLength(wikiFileVersion.getAuthorDisplay(), 100);\r\n\t\twikiFileVersion.setUploadComment(StringUtils.substring(wikiFileVersion.getUploadComment(), 0, 200));\r\n\t}", "protected void validateTag(AudioMetaData data) throws IOException { \n assertEquals(TITLE, data.getTitle());\n assertEquals(ARTIST, data.getArtist());\n assertEquals(ALBUM, data.getAlbum());\n assertEquals(COMMENT, data.getComment());\n assertEquals(TRACK, data.getTrack());\n assertEquals(YEAR, data.getYear());\n assertEquals(GENRE, data.getGenre());\n }", "protected void validate() throws ConfigurationException\n {\n\n }", "public boolean validateXmlFile(String xmlFilePath) {\n \tassert _xsdFilePath != null && !_xsdFilePath.isEmpty();\n \tassert _loggerHelper != null;\n \t\n \tif (xmlFilePath == null || xmlFilePath.isEmpty()) {\n \t\tthrow new IllegalArgumentException();\n \t}\n \t\n \tboolean result = validateXmlFileWithSchema(xmlFilePath, _xsdFilePath);\n \t_loggerHelper.logInfo(result ? xmlFilePath + \" validation passed\" : xmlFilePath + \" validation failed\");\n \treturn result;\n }", "private boolean isValid (DocFile file) {\n return file != null && Arrays.asList(Constants.VALIDDOCTYPES).contains(file.getFileType());\n }", "public boolean checkDocument(String fileName) throws IOException;", "private static boolean isValid(File dbFile) {\n Validate.notNull(dbFile);\n if (!dbFile.isFile()) {\n return false;\n }\n if (!isValidFileName(dbFile.getName())) {\n return false;\n }\n return Archiver.hasEntryName(dbFile, LIB_INFO_NAME);\n }", "protected void validateFile() {\r\n\t\tFile f = new File(FileUltil.joinPath(dOutputFolder, dFileName));\r\n\t\tif (f.exists() && !f.isDirectory()) {\r\n\t\t\tdFileName = \"Copy of \" + dFileName;\r\n\t\t\tvalidateFile();\r\n\t\t}\r\n\t}", "public interface SizeValidator {\n boolean isValidSize(FlagDataTypeConfig fc, Collection<InputFile> files);\n}", "@Override\n public void ensureValid() throws IOException {\n }", "protected void validateMcaDeployedToWorkingDir() {\n\t\tassertTrue(unitTestDir.exists());\n\t\tassertTrue(new File(unitTestDir, \"composition.groovy\").exists());\n\t\tassertTrue(new File(unitTestDir, \"MCA-INF/components/components.jar\").exists());\n\t\tassertTrue(new File(unitTestDir, \"MCA-INF/promoted/promoted.jar\").exists());\n\t\tassertTrue(new File(unitTestDir, \"MCA-INF/hidden/hidden.jar\").exists());\n\t}", "private void validateData() {\n }", "private static void verifyArgs()\r\n\t{\r\n\t\tif(goFile == null)\r\n\t\t{\r\n\t\t\tSystem.err.println(\"Error: you must specify an input GO file.\");\r\n\t\t\texitError();\r\n\t\t}\r\n\t\tif(annotFile == null)\r\n\t\t{\r\n\t\t\tSystem.err.println(\"Error: you must specify an input annotation file.\");\r\n\t\t\texitError();\r\n\t\t}\r\n\t\tif(goSlimFile == null)\r\n\t\t{\r\n\t\t\tSystem.err.println(\"Error: you must specify an input GOslim file.\");\r\n\t\t\texitError();\r\n\t\t}\r\n\t\tif(slimAnnotFile == null)\r\n\t\t{\r\n\t\t\tSystem.err.println(\"Error: you must specify an output file.\");\r\n\t\t\texitError();\r\n\t\t}\r\n\t}", "@Override\n\tprotected boolean isFileValid(List<String> lines) {\n\t\treturn lines.size() == SAVE_FILE_LENGTH && lines.get(0).length() > 0 && lines.get(1).length() > 0; // id and first name is required\n\t}", "public void validateRpd8s3()\n {\n // This guideline cannot be automatically tested.\n }", "public ValidationEntity validateYamlService(ValidationEntity validationEntity) {\n try {\n Yaml yaml = new Yaml();\n Map<String, Object> obj = yaml.load(validationEntity.getInputMessage().replace(\"---\", \"\"));\n log.debug(\"YAML Value obtained successfully: {}\", obj.toString());\n validationEntity.setValid(true);\n validationEntity.setValidationMessage(\"Valid YAML!!!\");\n } catch (Exception e) {\n validationEntity.setValidationMessage(e.getMessage());\n log.error(EXCEPTION_IN_VALIDATION_MESSAGE, e);\n if (e.getMessage().contains(LINE_WITH_SPACE)) {\n validationEntity.setLineNumber(getNumberFromRegexPattern(LINE_WITH_SPACE, \",\", e.getMessage()));\n validationEntity.setColumnNumber(getNumberFromRegexPattern(COLUMN_WITH_SPACE, \":\", e.getMessage()));\n }\n }\n return validationEntity;\n }", "public static boolean validateFile(final File f) throws IOException {\n if (f.exists() && f.isFile()) {\n DataInputStream in = null;\n try {\n in = new DataInputStream(new FileInputStream(f));\n int tupleLen = in.readInt();\n int tupleCount = in.readInt();\n long expectedFileLen = 8L * ((long) tupleLen) * tupleCount;\n return f.length() == expectedFileLen;\n } finally {\n if (in != null) {\n try {\n in.close();\n } catch (IOException e) {\n }\n }\n }\n }\n return false;\n }", "public boolean isValid() {\n\t\treturn !lines.isEmpty();\n\t}", "protected void validateDISEntity(Path file, ArrayList<String> errors) {\n\t\tPattern entityPattern = Pattern.compile(\"^(?<kind>\\\\d+)_(?<domain>\\\\d+)_(?<country>\\\\d+)_(?<category>\\\\d+)_(\\\\d+)_(\\\\d+)_(\\\\d+)$\");\n\t\tString filename = file.getFileName().toString();\n\t\tString kindCode = file.getParent().getParent().getParent().getParent().getFileName().toString().split(\"_\")[0];\n\t\tString domainCode = file.getParent().getParent().getParent().getFileName().toString().split(\"_\")[0];\n\t\tString countryCode = file.getParent().getParent().getFileName().toString().split(\"_\")[0];\n\t\tString categoryCode = file.getParent().getFileName().toString().split(\"_\")[0];\n\n\t\tMatcher match = entityPattern.matcher(filename);\n\t\tif (!match.find()) {\n\t\t\terrors.add(\"Invalid DIS entity directory name: \" + filename);\n\t\t} else {\n\t\t\tif (!match.group(\"kind\").equals(kindCode)) {\n\t\t\t\terrors.add(\"DIS Entity Code does not match parent directory: \"\n\t\t\t\t\t\t+ filename);\n\t\t\t}\n\n\t\t\tif (!match.group(\"domain\").equals(domainCode)) {\n\t\t\t\terrors.add(\"DIS Entity Domain does not match parent directory: \"\n\t\t\t\t\t\t+ filename);\n\t\t\t}\n\n\t\t\tif (!match.group(\"country\").equals(countryCode)) {\n\t\t\t\terrors.add(\"DIS Country Code does not match parent directory: \"\n\t\t\t\t\t\t+ filename);\n\t\t\t}\n\n\t\t\tif (!match.group(\"category\").equals(categoryCode)) {\n\t\t\t\terrors.add(\"DIS Entity Category does not match parent directory: \"\n\t\t\t\t\t\t+ filename);\n\t\t\t}\n\t\t}\n\t}", "public void validate() throws CruiseControlException {\n ValidationHelper.assertIsSet(getMailHost(), \"mailhost\", this.getClass());\n ValidationHelper.assertIsSet(getReturnAddress(), \"returnaddress\", this.getClass());\n ValidationHelper.assertFalse(getUsername() != null && getPassword() == null,\n \"'password' is required if 'username' is set for email.\");\n ValidationHelper.assertFalse(getPassword() != null && getUsername() == null,\n \"'username' is required if 'password' is set for email.\");\n \n for (int i = 0; i < alertAddresses.length; i++) {\n try {\n alertAddresses[i].fileFilter = new GlobFilenameFilter(alertAddresses[i].fileRegExpr);\n } catch (MalformedCachePatternException mcpe) {\n ValidationHelper.fail(\"invalid regexp '\" + alertAddresses[i].fileRegExpr + \"'\", mcpe);\n }\n }\n }", "public boolean validate(FileObject subject) {\n\t\t\r\n\t\treturn false;\r\n\t}", "private void process(final IFile file) throws CoreException {\n\t\ttry {\n\t\t\t// run\n\t\t\tfinal List<String> command = buildCommand(file);\n\t\t\tfinal IOExecutor executor = new IOExecutor();\n\t\t\tfinal int exitCode = executor.run(command);\n\n\t\t\t// output?\n\t\t\tfinal String output = executor.getOutput();\n\t\t\tif (!output.isEmpty()) {\n\t\t\t\t// convert\n\t\t\t\tfinal TwigFile result = parseResult(output);\n\t\t\t\tif (result != null && !result.isEmpty()) {\n\t\t\t\t\t// add violations\n\t\t\t\t\tfinal ResourceText text = new ResourceText(file);\n\t\t\t\t\tfor (final TwigViolation violation : result) {\n\t\t\t\t\t\taddMarker(file, text, violation);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (exitCode != 0) { // error?\n\t\t\t\tIOException e = executor.getErrorException();\n\t\t\t\tfinal String error = executor.getError();\n\t\t\t\tif (!error.isEmpty()) {\n\t\t\t\t\te = new IOException(error, e);\n\t\t\t\t}\n\t\t\t\tfinal String msg = NLS.bind(\n\t\t\t\t\t\tMessages.ValidationVisitor_Error_Validate_Code,\n\t\t\t\t\t\tfile.getName(), exitCode);\n\t\t\t\thandleStatus(createErrorStatus(msg, e));\n\t\t\t}\n\t\t} catch (final IOException e) {\n\t\t\tfinal String msg = NLS.bind(\n\t\t\t\t\tMessages.ValidationVisitor_Error_Validate_Name,\n\t\t\t\t\tfile.getName());\n\t\t\thandleStatus(createErrorStatus(msg, e));\n\t\t}\n\t}", "public void validate() throws Exception {\n }", "public void validateResource(boolean strictValidation) throws SentryConfigurationException;", "Optional<String> validate(String command, List<String> args);", "protected void checkInputFile(final String inputFile)\r\n\t{\r\n\t\tif(inputFile == null)\r\n\t\t{\r\n\t\t\tthrow new NullPointerException(\"Given input file is null\");\r\n\t\t}\r\n\t\t\r\n\t\tif(inputFile.trim().isEmpty())\r\n\t\t{\r\n\t\t\tthrow new IllegalArgumentException(\"Name of the input file is empty\");\r\n\t\t}\r\n\t\t\r\n\t\tfinal File in = new File(inputFile);\r\n\t\tif (!in.canRead())\r\n\t\t{\r\n\t\t\tthrow new IllegalArgumentException(\"File \" + \r\n\t\t\t\t\t\t\t\t\t\t\t\tinputFile + \r\n\t\t\t\t\t\t\t\t\t\t\t\t\" does not exist or is not readable.\");\r\n\t\t}\r\n\t}", "private void validate() throws JShellException {\r\n // cmd shud have no args\r\n if (!this.hasValidArgs()) {\r\n String msg = \"ERROR: popd: does not accept any arguments\\n\";\r\n throw new JShellException(msg);\r\n }\r\n // directory stack shudnt be empty\r\n if (this.getShell().getDirStack().size() < 1) {\r\n String msg = \"ERROR: popd: cannot popd on empty stack\\n\";\r\n throw new JShellException(msg);\r\n }\r\n }", "@Test\n public void testParseDOMToExistenceValidationWidgetOnlySucceeds()\n {\n FixtureProperties properties = parser.parse(DefaultConfigurationParserMockDOMs\n .createDOMToExistenceValidationWidgetOnly());\n verifyCommonPropertiesAssertions(properties);\n }", "public abstract boolean canDecodeInput(File file) throws IOException;", "public void validate() {}", "public void validate() throws ValidationException {\r\n\r\n // unmapped request and image dirs are only used by LC, no validation needed\r\n\r\n // mapped image dir validation\r\n\r\n File useDir = (mapImageDir != null) ? mapImageDir : imageDir;\r\n\r\n // expand file into ascending list of files\r\n LinkedList list = new LinkedList();\r\n while (useDir != null) {\r\n list.addFirst(useDir);\r\n useDir = useDir.getParentFile();\r\n }\r\n\r\n // the first must be the UNC marker; cf. FileMapper.getRoot\r\n if ( ! ((File) list.removeFirst()).getPath().equals(\"\\\\\\\\\") ) throw new ValidationException(Text.get(this,\"e6\"));\r\n\r\n // the second is the UNC share name\r\n if (list.isEmpty()) throw new ValidationException(Text.get(this,\"e7\"));\r\n list.removeFirst();\r\n // no validation here; it can contain at least IP dots, possibly more\r\n\r\n // the rest must satisfy the strict rule\r\n while ( ! list.isEmpty() ) {\r\n File file = (File) list.removeFirst();\r\n if (ruleStrict.matcher(file.getName()).find()) throw new ValidationException(Text.get(this,\"e8\"));\r\n }\r\n\r\n // other validations\r\n\r\n if (ruleAlpha.matcher(prefix).find()) throw new ValidationException(Text.get(this,\"e3\"));\r\n\r\n if (useDigits < NDIGIT_ORDER_MIN) throw new ValidationException(Text.get(this,\"e4\",new Object[] { Convert.fromInt(NDIGIT_ORDER_MIN) }));\r\n\r\n if (prefix.length() + useDigits > NDIGIT_TOTAL_MAX) throw new ValidationException(Text.get(this,\"e5\",new Object[] { Convert.fromInt(NDIGIT_TOTAL_MAX) }));\r\n\r\n MappingUtil.validate(mappings);\r\n }", "@Test\n\tpublic void testValidate_28()\n\t\tthrows Exception {\n\t\tDLLocalServiceImpl fixture = new DLLocalServiceImpl();\n\t\tfixture.groupLocalService = new GroupLocalServiceWrapper(new GroupLocalServiceImpl());\n\t\tfixture.hook = new CMISHook();\n\t\tfixture.dlFolderService = new DLFolderServiceWrapper(new DLFolderServiceImpl());\n\t\tString fileName = \"\";\n\t\tboolean validateFileExtension = true;\n\t\tInputStream is = new Base64InputStream(new UnsyncByteArrayInputStream(new byte[] {}));\n\n\t\tfixture.validate(fileName, validateFileExtension, is);\n\n\t\t// add additional test code here\n\t\t// An unexpected exception was thrown in user code while executing this test:\n\t\t// java.lang.ClassNotFoundException: com.liferay.documentlibrary.service.impl.DLLocalServiceImpl\n\t\t// at java.net.URLClassLoader.findClass(Unknown Source)\n\t\t// at java.lang.ClassLoader.loadClass(Unknown Source)\n\t\t// at com.instantiations.assist.eclipse.junit.execution.core.UserDefinedClassLoader.loadClass(UserDefinedClassLoader.java:62)\n\t\t// at java.lang.ClassLoader.loadClass(Unknown Source)\n\t\t// at com.instantiations.assist.eclipse.junit.execution.core.ExecutionContextImpl.getClass(ExecutionContextImpl.java:99)\n\t\t// at com.instantiations.eclipse.analysis.expression.model.SimpleTypeExpression.execute(SimpleTypeExpression.java:205)\n\t\t// at com.instantiations.eclipse.analysis.expression.model.MethodInvocationExpression.execute(MethodInvocationExpression.java:544)\n\t\t// at com.instantiations.assist.eclipse.junit.execution.core.ExecutionRequest.execute(ExecutionRequest.java:286)\n\t\t// at com.instantiations.assist.eclipse.junit.execution.communication.LocalExecutionClient$1.run(LocalExecutionClient.java:158)\n\t\t// at java.lang.Thread.run(Unknown Source)\n\t}", "private void validateParameters() {\r\n if (command == null) {\r\n throw new BuildException(\r\n \"'command' parameter should not be null for coverity task.\");\r\n }\r\n\r\n }", "protected void validateVirtualWiki(VirtualWiki virtualWiki) throws WikiException {\r\n\t\tcheckLength(virtualWiki.getName(), 100);\r\n\t\tcheckLength(virtualWiki.getRootTopicName(), 200);\r\n\t\tcheckLength(virtualWiki.getLogoImageUrl(), 200);\r\n\t\tcheckLength(virtualWiki.getMetaDescription(), 500);\r\n\t\tcheckLength(virtualWiki.getSiteName(), 200);\r\n\t}", "boolean isExecutableValidationEnabled();", "public boolean isValidFile(RandomAccessFile raf) throws IOException {\n // need a fast failure for non-GRADS files\n if (GradsDataDescriptorFile.failFast(raf))\n return false;\n raf.seek(0);\n\n // we think its a GRADS file, but we have lots of restrictions on what we can handle\n try {\n gradsDDF = new GradsDataDescriptorFile(raf.getLocation(), 5000);\n if (gradsDDF.error)\n return false;\n\n GradsDimension x = gradsDDF.getXDimension();\n GradsDimension y = gradsDDF.getYDimension();\n // J-\n\n return gradsDDF.getDataType() == null && // only handle raw binary\n gradsDDF.getDataFile() != null && !gradsDDF.hasProjection() && // can't handle projections\n !gradsDDF.getVariables().isEmpty() && // must have valid entries\n !gradsDDF.getDimensions().isEmpty() && (x.getSize() > 1) && (y.getSize() > 1); // can't handle cross sections\n // J+\n } catch (Exception ioe) {\n return false;\n }\n }", "public void validateRpd3s1()\n {\n // <b> and <i> are not allowed.\n assertFalse(Type.ERROR, \"rpd3s1.boldMarkup\", containsElement(\"b\"));\n assertFalse(Type.ERROR, \"rpd3s1.italicMarkup\", containsElement(\"i\"));\n }", "public boolean clineIsValid(String cmd) {\n\t\tString [] parsedCmd = RunCommand.stripAndSplit(cmd);\r\n\t\tString opName = \"\";\r\n\t\tboolean flag_out = false;\r\n\t\tfor (String element: parsedCmd) {\r\n\t\t\tif (flag_out) {\r\n\t\t\t\topName = FileInfo.fileName(element);\r\n\t\t\t\tflag_out = false;\r\n\t\t\t}\r\n\t\t\tflag_out = element.equals(\"--out\");\r\n\t\t}\r\n\t\treturn (opName != \"\");\r\n\t}" ]
[ "0.7667841", "0.5667907", "0.55348253", "0.5467585", "0.53200114", "0.5250387", "0.5235512", "0.51870674", "0.5166164", "0.5117301", "0.5099464", "0.5017855", "0.49427265", "0.49319807", "0.49313772", "0.4913751", "0.48637164", "0.48573434", "0.4846915", "0.48411384", "0.48390198", "0.48338908", "0.47852558", "0.47795823", "0.47377837", "0.47283006", "0.47165018", "0.4682394", "0.46687153", "0.46655008", "0.46624354", "0.46574268", "0.46574268", "0.46374968", "0.4634536", "0.46291044", "0.4628435", "0.46269155", "0.46057138", "0.46027297", "0.4599282", "0.45808157", "0.4555318", "0.45494205", "0.4536648", "0.4530379", "0.45235285", "0.4522797", "0.452103", "0.45015296", "0.44949317", "0.44947666", "0.4493651", "0.44910872", "0.44767046", "0.44720104", "0.44607306", "0.44559234", "0.44559234", "0.44559234", "0.44552583", "0.44525388", "0.44514924", "0.44488907", "0.4446773", "0.44374517", "0.4430996", "0.44145817", "0.4408018", "0.4403957", "0.43988305", "0.4374561", "0.43709695", "0.43680665", "0.43678504", "0.43671063", "0.43555406", "0.43539608", "0.43499503", "0.43463403", "0.43416023", "0.433885", "0.43291217", "0.43249926", "0.4324838", "0.43236223", "0.43186116", "0.43183452", "0.43171412", "0.4315143", "0.4311622", "0.42975762", "0.42938784", "0.4290259", "0.4287258", "0.4284376", "0.42828837", "0.42818752", "0.42817098", "0.4279127" ]
0.5531399
3
Test create room with OK response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testCreateRoomOkResponse() { // given final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest)) .willReturn(OK_RESPONSE); // when multiUserChatService.createRoom(TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsOkResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomBadResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\r\n\tpublic final void testAddRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\t// check if added successfully\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the id from database since it autoincrements\r\n\t\tRoom actual = roomServices.getRoomByName(expected2.getName());\r\n\t\texpected2.setId(actual.getId());\r\n\t\t// check content of data\r\n\t\tassertEquals(expected2, actual);\r\n\t\t// delete room on exit\r\n\t\troomServices.deleteRoom(actual);\r\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsBadResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@PostMapping(\"/rooms/create\")\n public ResponseEntity create(HttpServletRequest req, HttpServletResponse res,\n @RequestBody String roomDetails) throws JsonProcessingException {\n roomService.create(roomDetails);\n return ResponseEntity.status(200).build();\n }", "@PostMapping(\"/rooms\")\n public Room createRoom (\n @Valid\n @RequestBody Room room){\n return roomRepository.save(room);\n }", "public Room createRoom(Room room);", "@PostMapping(path = \"/rooms\")\n public ResponseEntity<Room> generateNewRoom() {\n Room newRoom = roomService.generateNewRoom();\n return new ResponseEntity<>(newRoom, HttpStatus.CREATED);\n }", "@Test\n public void shouldCreateAnValidRoomAndPersistIt() throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\twhen(dao.create(Arrays.asList(validRoomOfferValues))).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOffer createdRoomOffer = roomOfferService\n\t\t.createRoomOffer(command);\n\n\tverify(dao).create(Arrays.asList(validRoomOfferValues));\n\tassertThat(createdRoomOffer, is(equalTo(validRoomOffer)));\n }", "@Override\n public Room create(RoomResponseDTO roomResponseDTO) {\n return roomRepository.save(new Room(\n roomResponseDTO.getClassroomNumber()\n ));\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "public void makeTestRoom() {\r\n\t\tthis.boardData = new BoardData();\r\n\t\tthis.boardData.loadLevelOne();\r\n\r\n\t\tif (boardData.getAllRooms().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room list is empty\");\r\n\t\t} else if (boardData.getAllRooms().get(0).getRoomInventory().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room's inventory is empty\");\r\n\t\t}\r\n\t}", "@PostMapping(\"/chat-rooms\")\n public ResponseEntity<ChatRoom> createChatRoom(@RequestBody ChatRoom chatRoom) throws URISyntaxException {\n log.debug(\"REST request to save ChatRoom : {}\", chatRoom);\n if (chatRoom.getId() != null) {\n throw new BadRequestAlertException(\"A new chatRoom cannot already have an ID\", ENTITY_NAME, \"idexists\");\n }\n ChatRoom result = chatRoomRepository.save(chatRoom);\n return ResponseEntity.created(new URI(\"/api/chat-rooms/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "@Override\r\n\tpublic void OnCreateResult(cmdNotifyCreateResult createresult) {\n\t\tboolean isOK = createresult.getIsok();\r\n\t\tlong roomid = createresult.getRoomid();\r\n\t\tint roomtype = createresult.getType().ordinal();\r\n\t\tLog.d(TAG, \"OnCreateResult -------1\");\r\n\t\tCreateResult(isOK,String.valueOf(roomid),roomtype);\r\n\t}", "@Test\n\tpublic void testSaveRoomPositive() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player1\"); //The player knows the Shelter\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n\tpublic void testCreate() throws Exception {\n\t\tMockHttpServletRequestBuilder reqBuilder = MockMvcRequestBuilders.post(\"/createJourney\");\n\t\treqBuilder.contentType(MediaType.APPLICATION_JSON);\n\t\treqBuilder.accept(MediaType.APPLICATION_JSON);\n\t\treqBuilder.content(this.mapper.writeValueAsString(journey));\n\t\t\n\t\tResultMatcher matchStatus = MockMvcResultMatchers.status().isCreated();\n\t\tResultMatcher matchContent = MockMvcResultMatchers.content().json(this.mapper.writeValueAsString(savedJourney));\t\n\t\t\t\t\n\t\tthis.mockMVC.perform(reqBuilder).andExpect(matchStatus).andExpect(matchContent);\n\t}", "@PostMapping(\"/createNewGameRoom\")\n @ResponseStatus(HttpStatus.CREATED)\n public Game generateNewGameRoom() {\n String entrycode = service.generateEntryCode();\n currentGame.setEntrycode(entrycode);\n currentGame = gameDao.add(currentGame);\n return currentGame;\n }", "@Test\n\tpublic void testDeleteRoomPositive() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n public void createUser() {\n Response response = regressionClient.createUser();\n dbAssist.responseValidation(response);\n }", "public Result createRoom() {\n\n DynamicForm dynamicForm = Form.form().bindFromRequest();\n String roomType = dynamicForm.get(\"roomType\");\n Double price = Double.parseDouble(dynamicForm.get(\"price\"));\n int bedCount = Integer.parseInt(dynamicForm.get(\"beds\"));\n String wifi = dynamicForm.get(\"wifi\");\n String smoking = dynamicForm.get(\"smoking\");\n\n RoomType roomTypeObj = new RoomType(roomType, price, bedCount, wifi, smoking);\n\n if (dynamicForm.get(\"AddRoomType\") != null) {\n\n Ebean.save(roomTypeObj);\n String message = \"New Room type is created Successfully\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n } else{\n\n String message = \"Failed to create a new Room type\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n\n }\n\n\n\n }", "@Test\r\n\tpublic final void testDeleteRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\tassertTrue(success);\r\n\t\t// get room (id) due to autoincrement\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\t// remove room (thru id)+verify\r\n\t\tsuccess = roomServices.deleteRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// verify thru id search, verify null result\r\n\t\tRoom actual = roomServices.getRoomById(copy.getId());\r\n\t\tassertNull(actual);\r\n\t}", "public void testJoinGameResponseProcess() {\r\n\t\t\r\n\t\tString roomNumber = \"1\";\r\n\t\t\r\n\t\tString xmlString = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><response id=\\\"RandomUUID\\\" success=\\\"true\\\">\" + String.format(\"<joinGameResponse gameId=\\\"%s\\\">\" + \"</joinGameResponse></response>\", roomNumber);\r\n\t\t\r\n\t\tSystem.out.println(xmlString);\r\n\t\t\r\n\t\tMessage m = new Message(xmlString);\r\n\t\t\r\n\t\tassertTrue (new JoinGameResponseController(client, model).process(m));\r\n\t\tassertEquals (roomNumber, model.getGame().getRoomID());\r\n\t\t\r\n\t}", "@PostMapping(value=\"/insert/hotel\", consumes=MediaType.APPLICATION_JSON_VALUE)\r\n\tpublic ResponseClient insertNewRoom(@RequestBody Hotel hotel){\r\n\t\thotelSer.save(hotel);\r\n\t\tResponseClient res = new ResponseClient();\r\n\t\tres.setResponse(\"successfull hotel_id: \");\r\n\t\treturn res;\r\n\t}", "@Test\r\n\tpublic void testAjouterEtiquette() {\r\n\t\tassertEquals(true,this.client.ajouterEtiquette(\"Film\", \"lol\"));\r\n\t}", "public void createChatRoom(String name) throws RemoteException {\n\n\t\ttry {\n\t\t\tIChatServer chatStub;\n\t\t\t// make a new chatroom with supplied name\n\t\t\tIChatroom newRoom = new Chatroom(name);\n\t\t\tview.append(\"Make new ChatRoom: \" + newRoom.getName() + \"\\n\");\n\t\t\t// make a new chatserver stub for user in the newchatroom\n\t\t\tIChatServer newChatServer = new ChatServer(user, newRoom);\n\t\t\tview.append(\"Make new ChatServer: <User:\" + newChatServer.getUser().getName() + \", ChatServer: \"\n\t\t\t\t\t+ newChatServer.getChatroom().getName() + \">\\n\");\n\t\t\t//get a chatstub for new chatserver \n\t\t\tchatStub = (IChatServer) UnicastRemoteObject.exportObject(newChatServer, IChatServer.BOUND_PORT);\n\t\t\tregistry.rebind(IChatServer.BOUND_NAME + newRoom.hashCode(), chatStub);\n\t\t\tview.append(\"Make new ChatServer Stub for chatserver.\\n\");\n\t\t\t//add chatstub to newRoom\n\t\t\tnewRoom.addChatServer(chatStub);\n\t\t\tview.append(\"Add new ChatServer Stub to newRoom.\\n\");\n\t\t\t//add newchatroom to the user chatroom lists\n\t\t\tuser.addRoom(newRoom);\n\t\t\tview.append(\"Add new chatroom <\" + newRoom.getName() + \"> to user <\" + user.getName() + \">\\n\");\n\t\t\t//add all chatservers in that room to hashset\n\t\t\tHashSet<IChatServer> proxy = new HashSet<IChatServer>();\n\t\t\tfor (IChatServer item : newChatServer.getChatroom().getChatServers()) {\n\t\t\t\tIChatServer proxyChatServer = new ProxyIChatServer(item);\n\t\t\t\tproxy.add(proxyChatServer);\n\t\t\t}\n\t\t\tIMain2MiniAdpt miniMVCAdpt = view.makeMini(newChatServer, proxy);\n\t\t\tminiMVCAdpts.put(newRoom, miniMVCAdpt);\n\t\t\tcountRoom++;\n\t\t} catch (Exception e) {\n\t\t\tview.append(\"Error creating chatroom!\");\n\t\t}\n\n\t}", "@Test\n public void whenCreateCharacter_GettingSuccess() throws Exception {\n\n StudentRq studentRq = new StudentRq();\n studentRq.setName(\"Frank\");\n studentRq.setRole(\"student\");\n studentRq.setPatronus(\"stag\");\n studentRq.setHouse(\"1760529f-6d51-4cb1-bcb1-25087fce5bde\");\n\n mockito.perform(post(\"/api/characters/\", studentRq).contentType(MediaType.APPLICATION_JSON)\n .accept(MediaType.APPLICATION_JSON)\n .content(new Gson().toJson(studentRq)))\n .andExpect(status().isOk());\n }", "RoomModel createRoomModel(RoomModel roomModel);", "@Test\n public void createNewComputerBuildSuccess() {\n ComputerBuild computerBuild = createComputerBuild(SAMPLE_BUDGET_COMPUTER_BUILD_NAME, SAMPLE_BUDGET_COMPUTER_BUILD_DESCRIPTION);\n LoginRequest loginRequest = new LoginRequest(ANOTHER_USER_NAME_TO_CREATE_NEW_USER, USER_PASSWORD);\n\n loginAndCreateBuild(computerBuild, loginRequest, SAMPLE_BUDGET_COMPUTER_BUILD_NAME, SAMPLE_BUDGET_COMPUTER_BUILD_DESCRIPTION);\n }", "@Test\n public void testSuccess() throws Exception {\n\n client.makeBooking(\"Paul\", new Date(System.currentTimeMillis()), false);\n\n BookingStatus bookingStatus = client.getLastBookingStatus();\n Assert.assertTrue(\"Expected booking to be confirmed, but it wasn't: \" + bookingStatus, bookingStatus.equals(BookingStatus.CONFIRMED));\n }", "@Test\n public void whenCreateValidStudent_thenReceiveOKResponse() throws IOException {\n final HttpPost httpPost = new HttpPost(BASE_URL + \"2/students\");\n final InputStream resourceStream = this.getClass().getClassLoader()\n .getResourceAsStream(\"created_student.xml\");\n httpPost.setEntity(new InputStreamEntity(resourceStream));\n httpPost.setHeader(\"Content-Type\", \"text/xml\");\n \n //In this case the Student object does not exist in the Course \n //istance and should be succefully created\n final HttpResponse response = client.execute(httpPost);\n assertEquals(200, response.getStatusLine().getStatusCode());\n \n //We may confirm the new states of the web service resource\n final Student student = getStudent(2, 3);\n assertEquals(3, student.getId());\n assertEquals(\"Student C\", student.getName());\n }", "boolean create_user(String username, String password)\n {\n String input = \"{ \\\"name\\\": \\\"\" + username + \"\\\", \\\"password\\\": \\\"\" + password +\"\\\" }\";\n return request(\"POST\", input, \"players\").equals(\"1\");\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomOkResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "public void successfulCreation(String type) {\n switch (type) {\n case \"Attendee\":\n System.out.println(\"Attendee Created\");\n break;\n case \"Organizer\":\n System.out.println(\"Organizer Created\");\n break;\n case \"Speaker\":\n System.out.println(\"Speaker Created\");\n break;\n case \"VIP\":\n System.out.println(\"VIP Created\");\n break;\n }\n }", "@Test(\tdescription = \"Create a basic appointment\",\n\t\t\tgroups = { \"sanity\" }\n\t)\n\tpublic void CheckApptCreatedOnServer() throws HarnessException {\n\t\tAppointmentItem appt = new AppointmentItem();\n\t\tappt.setSubject(\"appointment\" + ZimbraSeleniumProperties.getUniqueString());\n\t\tappt.setContent(\"content\" + ZimbraSeleniumProperties.getUniqueString());\n\t\tappt.setStartTime(new ZDate(2014, 12, 25, 12, 0, 0));\n\t\tappt.setEndTime(new ZDate(2014, 12, 25, 14, 0, 0));\n\n\n\t\t// Open the new mail form\n\t\tFormApptNew apptForm = (FormApptNew) app.zPageCalendar.zToolbarPressButton(Button.B_NEW);\n\t\tZAssert.assertNotNull(apptForm, \"Verify the new form opened\");\n\n\t\t// Fill out the form with the data\n\t\tapptForm.zFill(appt);\n\n\t\t// Send the message\n\t\tapptForm.zSubmit();\n\t\t\t\n\t\t//verify toasted message 'group created' \n String expectedMsg =\"Appointment Created\";\n ZAssert.assertStringContains(app.zPageMain.zGetToaster().zGetToastMessage(),\n \t\t expectedMsg , \"Verify toast message '\" + expectedMsg + \"'\");\n \n\t\t\n\t\tverifyApptCreatedOnServer(appt);\n\t}", "@Test\n public void testCreaAlumno() {\n System.out.println(\"creaAlumno\");\n Alumno alumno = new Alumno();\n alumno.setNombre(\"Dulce\");\n alumno.setApellido(\"Alvarado\");\n Alumno result = instance.creaAlumno(alumno);\n assertNotNull(result.getId());\n }", "@Test\n public void testDemotivatorCreateSuccess() throws IOException{\n \tFixtures.deleteAllModels();\n \tFixtures.loadModels(\"data/user.yml\");\n \t\n \tauthenticate();\n \t\n \tMap<String, String> createDemoParams = new HashMap<String, String>();\n \tcreateDemoParams.put(\"title\", THIRTY_CHARS_TITLE);\n \tcreateDemoParams.put(\"text\", EIGHTY_CHARS_TEXT);\n \tcreateDemoParams.put(\"mode\", \"create\");\n \tMap<String, File> fileParams = new HashMap<String, File>();\n \tFile file = new File(\"test/data/image.jpg\");\n \tfileParams.put(\"image\", file);\n\n \tResponse response = POST(\"/create\", createDemoParams, fileParams);\n\n \tassertStatus(200, response);\n \tassertContentType(\"application/json; charset=utf-8\", response);\n \t\n \tList<Demotivator> demos = Demotivator.findAll();\n \tassertEquals(1, demos.size());\n \tassertEquals(THIRTY_CHARS_TITLE, demos.get(0).getTitle());\n \tassertEquals(EIGHTY_CHARS_TEXT, demos.get(0).getText());\n \tassertEquals(\"localhost\", demos.get(0).getDomain().getName());\n \tlong id = demos.get(0).getId().longValue();\n \t\n \tassertContentEquals(\"{\\\"fileName\\\":\\\"/image/thumb.test.file.name\\\",\\\"id\\\":\\\"\" + id + \"\\\",\\\"status\\\":\\\"success\\\"}\", response);\n }", "@Test\r\n\tpublic final void testGetRoomById() {\n\t\tRoom actual = roomServices.getRoomById(expected.getId());\r\n\t\tassertEquals(expected, actual);\r\n\t}", "@Test\n public void aTestRegister() {\n given()\n .param(\"username\", \"playlist\")\n .param(\"password\", \"playlist\")\n .post(\"/register\")\n .then()\n .statusCode(201);\n }", "@Test\n public void create_400() throws Exception {\n\n // PREPARE THE DATABASE\n // No data needed in database\n\n // PREPARE THE TEST\n // No preparation needed\n\n // DO THE TEST\n Response response = callAPI(VERB.POST, \"/mo/\", null);\n\n // CHECK RESULTS\n int status = response.getStatus();\n assertEquals(400, status);\n\n String body = response.readEntity(String.class);\n assertEquals(\"Wrong inputs\", body);\n\n }", "@Test\n\tpublic void test_create_new_user_success(){\n\t\tUser user = new User(null, \"create_user\", \"[email protected]\", \"12345678\");\n\t\tResponseEntity<User> response = template.postForEntity(REST_SERVICE_URI + ACCESS_TOKEN + token, user, User.class);\n\t\tUser newUser = response.getBody();\n\t\tassertThat(newUser.getName(), is(\"create_user\"));\n\t\tassertThat(response.getStatusCode(), is(HttpStatus.CREATED));\n\t\tvalidateCORSHttpHeaders(response.getHeaders());\n\t}", "private void POSTTest(Map<String, Object> inputBody, int expectedStatus, Map<String, Object> expectedResponse, boolean strict) throws Exception{\n CloseableHttpResponse response = createUser(inputBody);\n int status = response.getStatusLine().getStatusCode();\n\n if (status == expectedStatus) {\n HttpEntity entity = response.getEntity();\n String strResponse = EntityUtils.toString(entity);\n System.out.println(\"*** String response \" + strResponse + \" (\" + response.getStatusLine().getStatusCode() + \") ***\");\n if (expectedStatus == 201) {\n expectedResponse.put(\"id\", Long.parseLong(getIdFromStringResponse(strResponse)));\n JSONObject json = new JSONObject(expectedResponse);\n JSONAssert.assertEquals(json.toString() ,strResponse, strict);\n } else {\n // // shouldnt be comaring response for an invalid request\n // if (!\"\".equals(strResponse)){\n // throw new ClientProtocolException(\"Unexpected response body: \" + strResponse);\n // }\n } \n\n } else {\n throw new ClientProtocolException(\"Unexpected response status: \" + status);\n }\n\n EntityUtils.consume(response.getEntity());\n response.close();\n }", "public void createRooms()//Method was given\n { \n \n // create the rooms, format is name = new Room(\"description of the situation\"); ex. desc = 'in a small house' would print 'you are in a small house.'\n outside = new Room(\"outside\", \"outside of a small building with a door straight ahead. There is a welcome mat, a mailbox, and a man standing in front of the door.\", false);\n kitchen = new Room(\"kitchen\", \"in what appears to be a kitchen. There is a sink and some counters with an easter egg on top of the counter. There is a locked door straight ahead, and a man standing next to a potted plant. There is also a delicious looking chocolate bar sitting on the counter... how tempting\", true);\n poolRoom = new Room(\"pool room\", \"in a new room that appears much larger than the first room.You see a table with a flashlight, towel, and scissors on it. There is also a large swimming pool with what looks like a snorkel deep in the bottom of the pool. Straight ahead of you stands the same man as before.\", true);\n library = new Room(\"library\", \"facing east in a new, much smaller room than before. There are endless rows of bookshelves filling the room. All of the books have a black cover excpet for two: one red book and one blue book. The man stands in front of you, next to the first row of bookshelves\", true);\n exitRoom = new Room(\"exit\", \"outside of the building again. You have successfully escaped, congratulations! Celebrate with a non-poisonous chocolate bar\",true);\n \n // initialise room exits, goes (north, east, south, west)\n outside.setExits(kitchen, null, null, null);\n kitchen.setExits(poolRoom, null, outside, null);\n poolRoom.setExits(null, library, kitchen, null);\n library.setExits(null, null, exitRoom, poolRoom);\n exitRoom.setExits(null, null, null, null); \n \n currentRoom = outside; // start game outside\n }", "@Test\r\n\tpublic final void testUpdateRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\t// check if added successfully\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the id from database since it autoincrements\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\texpected3.setId(copy.getId());\r\n\t\t// set new data\r\n\t\tcopy.setName(expected3.getName());\r\n\t\tcopy.setLocation(expected3.getLocation());\r\n\t\t// update database\r\n\t\tsuccess = roomServices.updateRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the current version from database\r\n\t\tRoom actual = roomServices.getRoomById(expected2.getId());\r\n\t\t// check content of data\r\n\t\tassertEquals(expected3, actual);\r\n\t\t// delete room on exit\r\n\t\troomServices.deleteRoom(actual);\r\n\t}", "@Test\n final void testCreateDevice() {\n when(deviceDao.save(user, deviceDTO)).thenReturn(deviceDTO);\n when(request.getRemoteAddr()).thenReturn(DeviceFixture.PUBLIC_IP_ADDRESS);\n when(deviceDao.createDevice(user, createDeviceRequest, DeviceFixture.PUBLIC_IP_ADDRESS))\n .thenReturn(deviceDTO);\n when(deviceMapper.toModel(deviceDTO)).thenReturn(deviceModel);\n\n ResponseEntity<DeviceModel> response = deviceController.createDevice(createDeviceRequest);\n\n assertEquals(200, response.getStatusCodeValue());\n assertNotNull(response.getBody());\n DeviceModel device = response.getBody();\n assertEquals(deviceModel, device);\n }", "@Test\n\tpublic void testAdminCreate() {\n\t\tAccount acc1 = new Account(00000, \"ADMIN\", true, 1000.00, 0, false);\n\t\taccounts.add(acc1);\n\n\t\ttransactions.add(0, new Transaction(10, \"ADMIN\", 00000, 0, \"A\"));\n\t\ttransactions.add(1, new Transaction(05, \"new acc\", 00001, 100.00, \"A\"));\n\t\ttransactions.add(2, new Transaction(00, \"ADMIN\", 00000, 0, \"A\"));\n\n\t\ttransHandler = new TransactionHandler(accounts, transactions);\n\t\toutput = transHandler.HandleTransactions();\n\n\t\tif (outContent.toString().contains(\"Account Created\")) {\n\t\t\ttestResult = true;\n\t\t} else {\n\t\t\ttestResult = false;\n\t\t}\n\n\t\tassertTrue(\"unable to create account as admin\", testResult);\n\t}", "@Test\n public void shouldBookAnValidRoomAndPersistTheChanges() throws Exception {\n\n\tfinal String customerId = \"1234\";\n\tfinal UrlyBirdRoomOffer expectedRoomOffer = new UrlyBirdRoomOffer(\n\t\tvalidRoomOffer.getHotel(), validRoomOffer.getCity(),\n\t\tvalidRoomOffer.getRoomSize(), false, validRoomOffer.getPrice(),\n\t\tvalidRoomOffer.getBookableDate(), customerId,\n\t\tvalidRoomOffer.getIndex());\n\tfinal BookRoomCommand bookRoomCommand = new BookRoomCommand(\n\t\tvalidRoomOffer, customerId);\n\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\twhen(builder.copyRoomOfferWithNewCustomer(validRoomOffer, customerId))\n\t\t.thenReturn(expectedRoomOffer);\n\twhen(dao.read(bookRoomCommand.getRoomToBook().getIndex())).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\tfinal UrlyBirdRoomOffer bookedRoom = roomOfferService\n\t\t.bookRoomOffer(bookRoomCommand);\n\n\tverify(isRoomBookable).isSatisfiedBy(validRoomOffer);\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).read(validRoomOffer.getIndex());\n\tverify(dao).update(eq(expectedRoomOffer), anyLong());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tassertThat(bookedRoom, is(equalTo(expectedRoomOffer)));\n }", "@Test\n public void createUnassignedGame() throws Exception {\n final GameResource resource = TestUtils.newGameResource();\n resource.setStartsAt(\"2014-03-21T16:00:00.000\");\n\n mockMvc.perform(post(BASE_REQUEST_URL).with(superadmin)\n .header(AUTH_HEADER_NAME, createTokenForUser())\n .contentType(contentType)\n .content(TestUtils.convertObjectToJson(resource)))\n .andExpect(status().isCreated())\n .andExpect(content().contentType(contentType))\n .andExpect(jsonPath(\"$.site\", is(resource.getSite())))\n .andExpect(jsonPath(\"$.startsAt\", is(resource.getStartsAt())));\n }", "@Test\n public void testReservationFactoryCreate() {\n ReservationController reservationController = reservationFactory.getReservationController();\n Customer customer = new Customer(CUSTOMER_NAME, CUSTOMER_CONTACT, false);\n Calendar date = Calendar.getInstance();\n // create a 2 seater table // default is vacant\n tableFactory.getTableController().addTable(2);\n Table table = tableFactory.getTableController().getTable(1);\n reservationController.addReservation(date, customer, 2, table);\n assertEquals(1, reservationController.getReservationList().size());\n }", "@Test @Ignore(\"Only to run on test vertec instance\")\n public void canCreateOrganisation() {\n Organisation org = new Organisation();\n org.setActive(true);\n org.setBuildingName(\"building name\");\n org.setBusinessDomain(\"business domain\");\n org.setCategory(\"category\");\n org.setCity(\"city\");\n org.setCountry(\"country\");\n org.setName(\"GEBO test org\");\n org.setOwnedOnVertecBy(\"Sales Team\");\n org.setOwnerId(5295L);\n org.setStreet(\"street\");\n org.setStreet_no(\"street_no\");\n org.setWebsite(\"website\");\n org.setZip(\"zip\");\n org.setParentOrganisation(TESTVertecOrganisation2); //TODO figure out what to do here\n\n String uri = baseURI + \"/organisation\";\n ResponseEntity<String> res = postToVertec(org, uri, String.class);\n assertEquals(HttpStatus.CREATED, res.getStatusCode());\n\n }", "@Test\n\tpublic void testCreate() {\n\t\tApp app = new App();\n\t\tapp.setId(1L);\n\t\tRole role = new Role();\n\t\trole.setApp(app);\n\t\trole.setName(\"admin中国\");\n\t\troleService.create(role);\n\t}", "public void sendCreateTest( MessageReceivedEvent event ) {\n\n final StringBuilder message = new StringBuilder();\n message.append( \"!poll create \\\"NoArgs\\\" \\n\" );\n message.append( \"!poll create \\\"\\\" \\\"\\\" \\n\" );\n message.append( \"!poll create NoQuotes Ans1 \\n\" );\n message.append( \"!poll create \\n\" );\n message.append( \"!poll \\n\" );\n message.append( \"!poll create \\\"PassPoll\\\" \\\"Ans1\\\" \\\"Ans2\\\" \\n\" );\n message.append(\"-----\");\n event.getChannel().sendMessage( message ).queue();\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<Response<CommunicationRoom>> createRoomWithResponse(CreateRoomOptions createRoomOptions) {\n return createRoomWithResponse(createRoomOptions, null);\n }", "@Test\r\n\tpublic final void testGetRoomByName() {\n\t\tRoom actual = roomServices.getRoomByName(expected.getName());\r\n\t\tassertEquals(expected, actual);\r\n\t}", "@Test\n public void a_create() {\n String url = baseUrl + \"create\";\n System.out.println();\n System.out.println(\"volunteerProvince being posted: \"+volunteerProvince);\n ResponseEntity<VolunteerProvince> postResponse = testRestTemplate\n .withBasicAuth(SECURITY_USERNAME, SECURITY_PASSWORD)\n .postForEntity(url, volunteerProvince, VolunteerProvince.class);\n volunteerProvince = postResponse.getBody();\n assertNotNull(postResponse.getBody());\n assertEquals(volunteerProvince.getVolunteerNum(), postResponse.getBody().getVolunteerNum());\n System.out.println(\"Volunteer Province saved on the data structure: \"+postResponse.getBody());\n\n }", "@Test\n\tpublic void createTicketTest() {\n\t\tService.createTicket(new TicketCreation(), \"username\");\n\t\tMockito.verify(TicketDao, times(1)).createTicket(Mockito.any(TicketCreation.class), Mockito.anyString());\n\t}", "@RequestMapping(value=\"/room/form\", method=RequestMethod.POST)\r\n\tpublic String postRoom(@Valid @ModelAttribute(\"room\") Room room,\r\n\t\t\tBindingResult bindingResult, Model model) {\r\n\t\tthis.roomValidator.validate(room, bindingResult);\r\n\t\tif(!bindingResult.hasErrors()) {\r\n\t\t\tmodel.addAttribute(\"room\", this.roomService.save(room));\r\n\t\t\treturn \"roomCreated\";\r\n\t\t}\r\n\t\treturn \"roomForm\";\r\n\t}", "@Test(expected = Exception.class)\n public void shouldNotCreateTheRoomIfTheGivenRoomIsInvalidAndThrowAnException()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, null);\n\n\tdoThrow(new ConstraintViolationException(\"\")).when(dao).create(\n\t\tArrays.asList(validRoomOfferValues));\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "@Test\n\tpublic void testBook() throws Exception {\n\t\tString createdReservationID = bookingManagement.book(USER_ID, Arrays.asList(room1.getId()),\n\t\t\t\tvalidStartDate, validEndDate);\n\t\t// a reservation must be returned\n\t\tassertNotNull(\"Reservation id is null\", createdReservationID);\n\t\tassertFalse(\"Reservation id is emtpy\", createdReservationID.isEmpty());\n\t\t// check if returned reservation is correct\n\t\tReservation createdReservation = bookingManagement.getReservation(createdReservationID);\n\t\tassertNotNull(\"Reservation of returned id was not found\", createdReservation);\n\n\t\tassertEquals(USER_ID, createdReservation.getBookingUserId());\n\n\t\tassertEquals(1, createdReservation.getBookedFacilityIds().size());\n\t\tassertTrue(createdReservation.getBookedFacilityIds().contains(room1.getId()));\n\t\tassertEquals(validStartDate, createdReservation.getStartTime());\n\t\tassertEquals(validEndDate, createdReservation.getEndTime());\n\t}", "public void createRoom() {\n int hp = LabyrinthFactory.HP_PLAYER;\n if (hero != null) hp = hero.getHp();\n try {\n labyrinth = labyrinthLoader.createLabyrinth(level, room);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try {\n characterLoader.createCharacter(level, room);\n hero = characterLoader.getPlayer();\n if (room > 1) hero.setHp(hp);\n createMonsters();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@Test\n public void usuarioPreguntaEnPublicacion() {\n Mensaje mp = new Mensaje();\n mp.setPublicacionId(2);\n mp.setPregunta(\"Es jugueton??\");\n mp.guardarPregunta(usuario.getToken());\n assertTrue(mp.getId() > 0);\n\n }", "Boolean deleteRoom(String roomId);", "@Override\n public void onClickCreateRoom(String code) {\n\n boolean status = networkControl.checkDialogPresence(getApplicationContext(),MultiplayerActivity.this);\n if(status){\n loadingDialog = new LoadingDialog(MultiplayerActivity.this);\n loadingDialog.startDialog(getResources().getString(R.string.wait_access_room));\n loadingDialog.setDataToCancel(code);\n loadingDialog.setVisibleClick(true);\n\n HashMap<String,String> data = new HashMap<>();\n data.putAll((Map<String,String>) preferences.getAll());\n String nickname = data.get(KEY_NICKNAME_PREFERENCES);\n\n addRoomsEventListener(loadingDialog,code,nickname);\n }\n\n\n }", "@Override\n public void onSuccess() {\n Toast.makeText(context, \"Created\", Toast.LENGTH_SHORT).show();\n //realm.close();\n }", "public ChatRoom createRoom(String room) {\r\n ChatRoom chatRoom = new ChatRoom(serviceAddress.withLocal(room), null, xmppSession, serviceDiscoveryManager, multiUserChatManager);\r\n chatRoom.initialize();\r\n return chatRoom;\r\n }", "private void createRooms()//refactored\n {\n currentRoom = RoomCreator.buildCurrentRooms();//new\n }", "public void shouldCreate() {\n }", "@Test\n\tpublic void givenCreateItem_whenValidRecord_ThenSuccess() {\n\t\tHashMap<String, Object> newRecord = getRecordHashMap(20, \"Steak\", \"Meats\", 15.5f);\n\n\t\t// create a new record and extract the ID from the response\n\t\tInteger newId = given().\n\t\t\tcontentType(ContentType.JSON).\n\t\t\tbody(newRecord).\n\t\twhen().\n\t\t\tpost(\"/\").\n\t\tthen().\n\t\t\tstatusCode(HttpStatus.CREATED.value()).\n\t\t\tcontentType(ContentType.JSON).\n\t\t\textract().\n\t\t\tpath(\"id\");\n\n\t\tnewRecord = setRecordId(newRecord, newId);\n\n\t\t// verify that the new record is created\n\t\tHashMap<String, Object> actual = given().\n\t\t\tpathParam(\"id\", newId).\n\t\twhen().\n\t\t\tget(\"/{id}\").\n\t\tthen().\n\t\t\tstatusCode(HttpStatus.OK.value()).\n\t\t\tcontentType(ContentType.JSON).\n\t\t\textract().path(\"$\");\n\n\t\tassertThat(newRecord).isEqualTo(actual);\n\n\t}", "@Test\n\tpublic void testSaveDoctor() {\n\t\tfinal Doctor doctor = new Doctor();\n\t\tdoctor.setDoctorid(5);\n\t\tResponseEntity<String> responseEntity = this.restTemplate.postForEntity(getRootUrl() + \"/save-doctor?doctorid=5\", doctor , String.class);\n\t\tassertEquals(200,responseEntity.getStatusCodeValue());\n\t}", "@Test\n\tpublic void testCreateTicketOk() {\n\t\tArrayList<Object> p = new ArrayList<Object>();\n\t\tp.add(new TGame(\"FORTNITE\", 6, 20.0, 1, 2, \"descripcion\", \"Shooter\"));\n\t\tTTicket tt = new TTicket(1, p);\n\t\tassertEquals();\n\t}", "@Test\n public void shouldFindAllMatchingRoomsWithTheDaoAndReturnItToTheClient()\n\t throws Exception {\n\n\tfinal ArrayList<String> criteria = Lists.newArrayList(null, null, null,\n\t\tnull, null, null, null);\n\tfinal FindRoomCommand command = new FindRoomCommand(criteria.get(0),\n\t\tcriteria.get(1), true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, null, null, null);\n\n\tfinal List<UrlyBirdRoomOffer> result = Lists\n\t\t.newArrayList(validRoomOffer);\n\twhen(dao.find(criteria)).thenReturn(result);\n\n\tfinal List<RoomOffer> foundRooms = roomOfferService\n\t\t.findRoomOffer(command);\n\n\tassertEquals(result, foundRooms);\n }", "@Test(enabled=false)\n\tpublic void createPostCheckBodyContents() {\n\t\tPosts posts = new Posts(\"4\", \"Packers\", \"Favre\");\n\t\t\n\t\tgiven().\n\t\twhen().contentType(ContentType.JSON).\n\t\tbody(posts).\n\t\tpost(\"http://localhost:3000/posts/\").\n\t\tthen().\n\t\tstatusCode(201).\n\t\tbody(\"id\", is(posts.getId())).\n\t\tbody(\"title\",is(posts.getTitle())).\n\t\tbody(\"author\",is(posts.getAuthor()));\n\t}", "private boolean checkRoomValid(String room) {\n\treturn true;\r\n}", "@Test\n public void testChatPost() throws Exception {\n long count = chatRepo.count();\n chatRepo.save(new Chat());\n\n // see if it correctly saves the chat room\n assertThat(count + 1).isEqualTo(chatRepo.count());\n count = chatRepo.count();\n\n MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>();\n map.add(\"contet\", \"hey there\");\n template.postForObject(\"http://localhost:\" + port + \"/chat/compose/6\", map, String.class);\n assertThat(count).isEqualTo(chatRepo.count());\n }", "@Test\n public void shouldUpdateTheSpezifiedValidRoomAndPersistTheChanges()\n\t throws Exception {\n\n\tfinal ArrayList<String> newValidValues = Lists.newArrayList(\"Hilton\",\n\t\t\"Hamburg\", \"2\", \"N\", \"12\", \"12.02.2007\", \"\");\n\n\tfinal UpdateRoomCommand command = new UpdateRoomCommand(newValidValues,\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\twhen(builder.createRoomOffer(newValidValues, validRoomOffer.getIndex()))\n\t\t.thenReturn(validRoomOffer);\n\n\tfinal UrlyBirdRoomOffer updatedRoomOffer = roomOfferService\n\t\t.updateRoomOffer(command);\n\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tverify(dao).update(eq(validRoomOffer), anyLong());\n\tassertThat(updatedRoomOffer, is(equalTo(validRoomOffer)));\n }", "@Test\n public void testRegisterSuccessfully() {\n SignUpRequest request = new SignUpRequest(UNIQUE, \"Secret\");\n\n dao.register(request);\n\n verify(controller).registered();\n }", "public void createLevel() {\n room = 1;\n currentLevelFinish = false;\n createRoom();\n }", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<CommunicationRoom> createRoom(CreateRoomOptions createRoomOptions) {\n return createRoom(createRoomOptions, null);\n }", "@Test\n @InSequence(1)\n public void testRegister(){\n Customer customer = createCustomerInstance(\"Jane Doe\", \"[email protected]\", \"07744754955\");\n //Customer customer = storeCustomer(customer0);\n Taxi taxi0 = createTaxiInstance(\"JK66AKB\",6);\n Taxi taxi = storeTaxi(taxi0);\n //create a GuestBooking with a future date.\n GuestBooking guestBooking = createGuestBookingInstance(customer, taxi.getId(), futureDate1);\n Response response = guestBookingRestService.createBooking(guestBooking);\n\n assertEquals(\"Unexpected response status\", 201, response.getStatus());\n log.info(\" New booking via GuestBookingService.createBooking was persisted and returned status \" + response.getStatus());\n }", "@Test(enabled = true)\n public void createPerson() {\n List <Account> accounts = new ArrayList<>();\n List<Subscription> sub = new ArrayList<>();\n \n Contact contact = new Contact.Builder().emailaddress(\"[email protected]\").phoneNumber(\"021345685\").build();\n Address address = new Address.Builder().location(\"Daveyton\").streetName(\"Phaswane Street\").houseNumber(45).build();\n \n repo = ctx.getBean(PersonsRepository.class);\n Person p = new Person.Builder()\n .firstname(\"Nobu\")\n .lastname(\"Tyokz\")\n .age(25)\n .account(accounts)\n .sub(sub)\n .contact(contact)\n .address(address)\n .build();\n repo.save(p);\n id = p.getId();\n Assert.assertNotNull(p);\n\n }", "@Test\n public void destiny2InsertSocketPlugTest() {\n InlineResponse20045 response = api.destiny2InsertSocketPlug();\n\n // TODO: test validations\n }", "@Test\n public void testAddRent() {\n System.out.println(\"addRent\");\n ReserveInfo reserveInfo = new ReserveInfo();\n reserveInfo.setGuestIDnumber(\"test\");\n reserveInfo.setGuestName(\"test\");\n reserveInfo.setRentType(\"test\");\n reserveInfo.setRoomType(\"test\");\n reserveInfo.setRentDays(1);\n reserveInfo.setRemark(\"test\");\n reserveInfo.setResult(true); \n BookingController instance = new BookingController();\n boolean expResult = true;\n boolean result = instance.addRent(reserveInfo);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n }", "@RequestMapping(value = \"/Reservation/{reservation_reservationId}/room\", method = RequestMethod.POST)\n\t@ResponseBody\n\tpublic Room newReservationRoom(@PathVariable Integer reservation_reservationId, @RequestBody Room room) {\n\t\treservationService.saveReservationRoom(reservation_reservationId, room);\n\t\treturn roomDAO.findRoomByPrimaryKey(room.getRoomId());\n\t}", "@Test(expected = Exception.class)\n public void shouldNotBookAnAlreadyBookedRoomAndInformTheClientWithTheAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\t\"12\");\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(false);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n public void publicadorPreguntaEnPublicacionAPostulante() {\n Mensaje mp = new Mensaje();\n mp.setPublicacionId(7);\n mp.setPregunta(\"Tenes jardin?\");\n mp.setUsuarioPreguntaId(usuario.getId());\n mp.setUsuarioRespuestaId(3);\n mp.guardarPregunta(usuario.getToken());\n assertTrue(mp.getId() > 0);\n\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@RequestMapping(method = RequestMethod.POST)\n public ResponseEntity<?> addGameRoom(@RequestBody Game gameRoom) {\n try {\n ls.addGameRoom(gameRoom);\n return new ResponseEntity<>(HttpStatus.CREATED);\n } catch (LacmanPersistenceException ex) {\n Logger.getLogger(LacmanController.class.getName()).log(Level.SEVERE, null, ex);\n return new ResponseEntity<>(ex.getMessage(), HttpStatus.FORBIDDEN);\n }\n }", "@Test\n public void testCreateValidUser() {\n LocalUserManager ua = new LocalUserManager();\n\n try {\n ua.createUser(\"gburdell1\", \"buzz\", \"[email protected]\", \"George\", \"Burdell\", \"MANAGER\");\n } catch (Exception e) {\n Assert.fail();\n }\n Assert.assertEquals(1, ua.getUsers().size());\n Assert.assertEquals(\"gburdell1\", ua.getUsers().get(0).getUsername());\n Assert.assertEquals(\"[email protected]\", ua.getUsers().get(0).getEmail());\n Assert.assertEquals(UserClass.MANAGER, ua.getUsers().get(0).getUserClass());\n }", "@Transactional\n @PostMapping(path = \"/create/{name}\")\n public Player createPlayer(@PathVariable String name,\n @RequestParam(name = \"room\", defaultValue = \"\") String room,\n @RequestParam(name = \"rid\", defaultValue = \"\") String roomId,\n @RequestParam(name = \"photo\", defaultValue = \"\") String photo) {\n Player player = null;\n try {\n if (photo.equals(\"\")) {\n player = playerService.create(name);\n } else {\n player = playerService.create(name, photo);\n }\n log.info(\"Created player \" + player.getName());\n if (!roomId.equals(\"\") && Integer.valueOf(roomId) > 0) {\n log.info(\"Processing optional parameter room id: \" + roomId);\n player.setRoom(Integer.valueOf(roomId));\n }\n if (!room.equals(\"\")) {\n log.info(\"Processing optional parameter room: \" + room);\n Optional<Room> r = roomService.get(room);\n if (r.isPresent()) {\n log.info(\"Room \" + room + \" was found. Joining player \" + name);\n player.setRoom(r.get().getId());\n }\n }\n } catch (Exception e) {\n log.error(\"Error creating player: \" + e.getMessage());\n }\n // log.info(\"Player created!\");\n return player;\n }", "@Test\n public void shouldCreateCase() {\n assertThat(DatabaseHelper.getCaseDao().queryForAll().size(), is(0));\n\n TestEntityCreator.createCase();\n\n // Assure that the case has been successfully created\n assertThat(DatabaseHelper.getCaseDao().queryForAll().size(), is(1));\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n void createNullTest() {\n reservationService.create(null);\n }", "@Test\n public void testNewFolder() {\n boolean result = instance.newFolder(mailboxID + File.separator + \"newFolder\");\n assertEquals(true, result);\n }", "public int creatRoom(String boardId) {\n\t\tConnection conn = getConnection();\n\t\tint result = cd.creatRoom(conn, boardId);\n\t\tif (result > 0) {\n\t\t\tcommit(conn);\n\t\t} else {\n\t\t\trollback(conn);\n\t\t}\n\t\tclose(conn);\n\t\treturn result;\n\t}", "@Test\n public void createTest() {\n reservationService.create(reservation1);\n Mockito.verify(reservationDao).create(reservation1);\n }", "@PostMapping(\"/new\")\n @ResponseStatus(HttpStatus.CREATED)\n public Boolean newChat(@RequestBody NewChatEvent event) {\n notificationService.notifyAboutNewChat(event.getChatId(), event.getDepartmentId());\n scheduleService.scheduleReassignment(event.getChatId());\n return Boolean.TRUE;\n }", "private static void performRoomManagement() {\n\t\t\r\n\t\t\r\n\r\n\t}", "public interface CreateRoomInteractor {\n interface OnFinishedListener{\n void createSuccess();\n void createFailure();\n void uploadThumbnailSuccess(String returnedUrl);\n }\n void createRoom(String name,String thumbnailUrl,OnFinishedListener callback );\n void uploadThumbnail(Uri uri,OnFinishedListener callback);\n}", "@Test\n public void create1Test1() throws SQLException {\n manager = new TableServizioManager(mockDb);\n manager.create1(false,false,false,false,false,false,false);\n Servizio servizio = manager.retriveById(5);\n assertNotNull(servizio,\"Should return true if create Servizio\");\n }" ]
[ "0.79625946", "0.7361861", "0.72645134", "0.6996082", "0.6762875", "0.6760224", "0.6675829", "0.660688", "0.65562135", "0.65498567", "0.6435905", "0.6367765", "0.6224084", "0.6160081", "0.6138431", "0.61356175", "0.61067736", "0.61005604", "0.60368985", "0.59903574", "0.5918648", "0.59046423", "0.5884826", "0.5831349", "0.58280355", "0.57973725", "0.5786397", "0.5776735", "0.57700235", "0.57690984", "0.5762006", "0.5701755", "0.5699682", "0.56905204", "0.5674966", "0.5656785", "0.5654179", "0.56336564", "0.56258273", "0.5617272", "0.55914646", "0.55837244", "0.55718607", "0.5549463", "0.5541913", "0.5539479", "0.55258316", "0.55253506", "0.5493585", "0.5483612", "0.54809576", "0.54743296", "0.5472041", "0.547141", "0.543285", "0.54242635", "0.5414404", "0.54072064", "0.540629", "0.5404692", "0.54013443", "0.53999066", "0.5383678", "0.5378334", "0.53602004", "0.5347941", "0.5342875", "0.5340937", "0.53402185", "0.533431", "0.53327405", "0.5329629", "0.5321866", "0.53197587", "0.53063637", "0.52974164", "0.5294752", "0.5293072", "0.5282367", "0.52815723", "0.5279979", "0.5277883", "0.526943", "0.52667093", "0.5262351", "0.52620614", "0.5261", "0.5247413", "0.5236006", "0.52326316", "0.52312595", "0.5227302", "0.52144235", "0.5214006", "0.5209631", "0.52044344", "0.52022785", "0.52004945", "0.5194094", "0.51900375" ]
0.8588965
0
Test create room with BAD response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testCreateRoomBadResponse() { // given final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest)) .willReturn(BAD_RESPONSE); // when multiUserChatService.createRoom(TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsBadResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test(expected = Exception.class)\n public void shouldNotCreateTheRoomIfTheGivenRoomIsInvalidAndThrowAnException()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, null);\n\n\tdoThrow(new ConstraintViolationException(\"\")).when(dao).create(\n\t\tArrays.asList(validRoomOfferValues));\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsOkResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test\n public void create_400() throws Exception {\n\n // PREPARE THE DATABASE\n // No data needed in database\n\n // PREPARE THE TEST\n // No preparation needed\n\n // DO THE TEST\n Response response = callAPI(VERB.POST, \"/mo/\", null);\n\n // CHECK RESULTS\n int status = response.getStatus();\n assertEquals(400, status);\n\n String body = response.readEntity(String.class);\n assertEquals(\"Wrong inputs\", body);\n\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnAlreadyBookedRoomAndInformTheClientWithTheAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\t\"12\");\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(false);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n public void shouldCreateAnValidRoomAndPersistIt() throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\twhen(dao.create(Arrays.asList(validRoomOfferValues))).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOffer createdRoomOffer = roomOfferService\n\t\t.createRoomOffer(command);\n\n\tverify(dao).create(Arrays.asList(validRoomOfferValues));\n\tassertThat(createdRoomOffer, is(equalTo(validRoomOffer)));\n }", "@PostMapping(\"/rooms\")\n public Room createRoom (\n @Valid\n @RequestBody Room room){\n return roomRepository.save(room);\n }", "@Test\r\n\tpublic final void testAddRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\t// check if added successfully\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the id from database since it autoincrements\r\n\t\tRoom actual = roomServices.getRoomByName(expected2.getName());\r\n\t\texpected2.setId(actual.getId());\r\n\t\t// check content of data\r\n\t\tassertEquals(expected2, actual);\r\n\t\t// delete room on exit\r\n\t\troomServices.deleteRoom(actual);\r\n\t}", "public Room createRoom(Room room);", "@PostMapping(\"/chat-rooms\")\n public ResponseEntity<ChatRoom> createChatRoom(@RequestBody ChatRoom chatRoom) throws URISyntaxException {\n log.debug(\"REST request to save ChatRoom : {}\", chatRoom);\n if (chatRoom.getId() != null) {\n throw new BadRequestAlertException(\"A new chatRoom cannot already have an ID\", ENTITY_NAME, \"idexists\");\n }\n ChatRoom result = chatRoomRepository.save(chatRoom);\n return ResponseEntity.created(new URI(\"/api/chat-rooms/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "@Test\n public void testInvalidInput() {\n LocalUserManager ua = new LocalUserManager();\n try {\n ua.createUser(\"gburdell1\", \"buzz\", \"[email protected]\", \"George\", \"Burdell\", \"SUPERHUMAN\");\n } catch (Exception e) {\n Assert.assertEquals(0, ua.getUsers().size());\n return;\n }\n Assert.fail();\n }", "@PostMapping(\"/rooms/create\")\n public ResponseEntity create(HttpServletRequest req, HttpServletResponse res,\n @RequestBody String roomDetails) throws JsonProcessingException {\n roomService.create(roomDetails);\n return ResponseEntity.status(200).build();\n }", "@Test(expected = Exception.class)\n public void shouldThrowAnExceptionIfTheOccupanyIsNotIn48Hours()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any()))\n\t\t.thenReturn(false);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testSaveRoomNotLoggedNegative() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.unauthenticate();\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t}", "@Test\n public void createUnassignedGame() throws Exception {\n final GameResource resource = TestUtils.newGameResource();\n resource.setStartsAt(\"2014-03-21T16:00:00.000\");\n\n mockMvc.perform(post(BASE_REQUEST_URL).with(superadmin)\n .header(AUTH_HEADER_NAME, createTokenForUser())\n .contentType(contentType)\n .content(TestUtils.convertObjectToJson(resource)))\n .andExpect(status().isCreated())\n .andExpect(content().contentType(contentType))\n .andExpect(jsonPath(\"$.site\", is(resource.getSite())))\n .andExpect(jsonPath(\"$.startsAt\", is(resource.getStartsAt())));\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomBadResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test(expectedExceptions = DataAccessLayerException.class)\n void createThrowsTest() {\n Mockito.doThrow(IllegalArgumentException.class).when(reservationDao).create(reservation2);\n reservationService.create(reservation2);\n }", "@Override\n public Room create(RoomResponseDTO roomResponseDTO) {\n return roomRepository.save(new Room(\n roomResponseDTO.getClassroomNumber()\n ));\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n void createNullTest() {\n reservationService.create(null);\n }", "@Test\n public void create_NotAnAssignment_ShouldReturn400Error() throws Exception {\n final String invalidRequestJSON = \"{\\\"not\\\": \\\"an assignment\\\"}\";\n\n // When we post an invalid request\n // then we get a Bad Request error\n mockMvc.perform(post(ENDPOINT)\n .contentType(MediaType.APPLICATION_JSON)\n .content(invalidRequestJSON))\n .andExpect(status().isBadRequest());\n }", "public void makeTestRoom() {\r\n\t\tthis.boardData = new BoardData();\r\n\t\tthis.boardData.loadLevelOne();\r\n\r\n\t\tif (boardData.getAllRooms().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room list is empty\");\r\n\t\t} else if (boardData.getAllRooms().get(0).getRoomInventory().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room's inventory is empty\");\r\n\t\t}\r\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotOwnerNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player2\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotLoggedNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t}", "@Test(expectedExceptions = DataAccessLayerException.class)\n void createThrows2Test() {\n Mockito.doThrow(IllegalArgumentException.class).when(reservationDao).create(reservation2);\n reservationService.create(reservation2);\n }", "private boolean checkRoomValid(String room) {\n\treturn true;\r\n}", "@Test\n void createInvalidSystemLoinc() throws IOException {\n Exception exception = executeMappingException(\"create-history-of-travel-invalid-system-loinc.json\");\n assertEquals(\"The system is not correct. It should be 'http://loinc.org', but it was 'http://snomed.info/sct'.\", exception.getMessage());\n }", "public void createFailure() {\n\t\tgetController().changeFree(true);\t\t\n\t\tdisplayAdvertisement(\"opponent failure\");\n\t\tvalidate();\n\t}", "@Test\n\tpublic void testCreateIncorrectParam() {\n\t\tStickyPolicy sPolicy = PolicyGenerator.buildStickyPolicy();\n\t\tfinal String owner = \"\"+1;\n\t\t\n\t\tResponse response = piiController.createPii(null, null, sPolicy, owner);\n\t\t\n\t\tverifyZeroInteractions(mPiiService);\n\t\tverifyZeroInteractions(mPuidDao);\n\t\tassertEquals(400, response.getStatus());\n\t\t\n\t\tObject entity = response.getEntity();\n\t\tassertNull(entity);\n\t}", "@PostMapping(path = \"/rooms\")\n public ResponseEntity<Room> generateNewRoom() {\n Room newRoom = roomService.generateNewRoom();\n return new ResponseEntity<>(newRoom, HttpStatus.CREATED);\n }", "@Test\n void createInvalidCodeLoinc() throws IOException {\n Exception exception = executeMappingException(\"create-history-of-travel-invalid-code.json\");\n assertEquals(\"Expected loinc-code for history of travel, but got 'http://loinc.org:94653-9' instead\", exception.getMessage());\n }", "@Test\r\n\tpublic final void testDeleteRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\tassertTrue(success);\r\n\t\t// get room (id) due to autoincrement\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\t// remove room (thru id)+verify\r\n\t\tsuccess = roomServices.deleteRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// verify thru id search, verify null result\r\n\t\tRoom actual = roomServices.getRoomById(copy.getId());\r\n\t\tassertNull(actual);\r\n\t}", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "@PostMapping(\"/createNewGameRoom\")\n @ResponseStatus(HttpStatus.CREATED)\n public Game generateNewGameRoom() {\n String entrycode = service.generateEntryCode();\n currentGame.setEntrycode(entrycode);\n currentGame = gameDao.add(currentGame);\n return currentGame;\n }", "@Test(expected = Exception.class)\n public void shouldNotDeleteTheRoomIfTheIndexIsNotFoundInTheDatabaseAndThorwAnException()\n\t throws Exception {\n\n\tfinal DeleteRoomCommand command = new DeleteRoomCommand(validRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\tdoThrow(new RecordNotFoundException(\"Test\")).when(dao).delete(anyInt(),\n\t\tanyLong());\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\n\troomOfferService.deleteRoomOffer(command);\n\n\tverify(dao).lock(anyInt());\n\tverify(dao).unlock(anyInt(), anyLong());\n\tverify(dao).delete(eq(validRoomOffer.getIndex()), anyLong());\n }", "public void testNewEntity_Boom() throws DataBaseNotReadyException {\n // Verify that our test database is set-up as expected.\n // Access test-person , test-event and test-job.\n // Verify that such items exist in the database\n // and that the test-person has yet no allocations.\n Person p = Manager.getPersonCollection().findEntity(3);\n assertNotNull(\"Bad test data?\", p);\n Event e = Manager.getEventCollection().findEntity(4);\n assertNotNull(\"Bad test data?\", e);\n Job j1 = Manager.getJobCollection().findEntity(1);\n assertNotNull(\"Bad test data?\", j1);\n Job j2 = Manager.getJobCollection().findEntity(2);\n assertNotNull(\"Bad test data?\", j2);\n\n Allocation testItem1 = allocationCollection.newEntity(p, e, j1, \"USER\");\n\n // Here is the statement that should throw the exception:\n System.out.println(\"### testNewEntity_Boom() Exception is expected!\");\n Allocation testItem2 = allocationCollection.newEntity(p, e, j2, \"USER\");\n\n }", "@Test\n public void createUser() {\n Response response = regressionClient.createUser();\n dbAssist.responseValidation(response);\n }", "@Override\n public void onFailure(int code, String msg) {\n Log.d(\"haha\", \"创建数据失败:\" + msg);\n }", "@Test(expected = UsernameNotFoundException.class)\n public void createNewComputerBuildFailure() {\n ComputerBuild computerBuild = createComputerBuild(SAMPLE_BUDGET_COMPUTER_BUILD_NAME, SAMPLE_GAMING_COMPUTER_BUILD_DESCRIPTION);\n computerBuildService.createNewComputerBuild(computerBuild);\n }", "@Test\n\tpublic void testDeleteRoomPositive() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test(expected = BookingNotAllowedException.class)\n\tpublic void testBookNotAllowed() throws Exception {\n\t\tdataHelper.createPersistedReservation(USER_ID, new ArrayList<String>(), validStartDate, validEndDate);\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "@Test\n final void testCreateDeviceAlreadyExists() {\n when(deviceDao.findDevice(DeviceFixture.SERIAL_NUMBER)).thenReturn(Optional.of(deviceDTO));\n\n assertThrows(\n ExceptionType.DeviceAlreadyExistsException.class,\n () -> deviceController.createDevice(createDeviceRequest));\n }", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative2() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tauthenticate(\"admin\");\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\r\n\t\tunauthenticate();\r\n\t}", "@Test \n public void bookHotelTestError1() throws DatatypeConfigurationException, BookHotelFault { \n BookHotelInputType input = CreateBookHotelInputType(\"Hello you\", \"Tick Joachim\", \"50408824\", 2, 11);\n try {\n assertTrue(bookHotel(input));\n } catch (BookHotelFault e) {\n assertEquals(\"The booking number you provided was not linked to any hotel\", e.getMessage());\n } \n }", "public void createRoom() {\n int hp = LabyrinthFactory.HP_PLAYER;\n if (hero != null) hp = hero.getHp();\n try {\n labyrinth = labyrinthLoader.createLabyrinth(level, room);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try {\n characterLoader.createCharacter(level, room);\n hero = characterLoader.getPlayer();\n if (room > 1) hero.setHp(hp);\n createMonsters();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative1() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tauthenticate(\"brother5\");\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\r\n\t\tunauthenticate();\r\n\t}", "@Test(expected = IllegalArgumentException.class)\r\n public void creacionIncorrecta() throws IllegalArgumentException {\r\n P = new Partido(\"Camp Nou\",\"28-04-2010\");\r\n }", "@Test\n public void shouldBookAnValidRoomAndPersistTheChanges() throws Exception {\n\n\tfinal String customerId = \"1234\";\n\tfinal UrlyBirdRoomOffer expectedRoomOffer = new UrlyBirdRoomOffer(\n\t\tvalidRoomOffer.getHotel(), validRoomOffer.getCity(),\n\t\tvalidRoomOffer.getRoomSize(), false, validRoomOffer.getPrice(),\n\t\tvalidRoomOffer.getBookableDate(), customerId,\n\t\tvalidRoomOffer.getIndex());\n\tfinal BookRoomCommand bookRoomCommand = new BookRoomCommand(\n\t\tvalidRoomOffer, customerId);\n\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\twhen(builder.copyRoomOfferWithNewCustomer(validRoomOffer, customerId))\n\t\t.thenReturn(expectedRoomOffer);\n\twhen(dao.read(bookRoomCommand.getRoomToBook().getIndex())).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\tfinal UrlyBirdRoomOffer bookedRoom = roomOfferService\n\t\t.bookRoomOffer(bookRoomCommand);\n\n\tverify(isRoomBookable).isSatisfiedBy(validRoomOffer);\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).read(validRoomOffer.getIndex());\n\tverify(dao).update(eq(expectedRoomOffer), anyLong());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tassertThat(bookedRoom, is(equalTo(expectedRoomOffer)));\n }", "@Test\n\tpublic void testSaveRoomPositive() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player1\"); //The player knows the Shelter\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative3() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tauthenticate(\"viewer\");\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\r\n\t\tunauthenticate();\r\n\t}", "@Test\n\tpublic void testBook() throws Exception {\n\t\tString createdReservationID = bookingManagement.book(USER_ID, Arrays.asList(room1.getId()),\n\t\t\t\tvalidStartDate, validEndDate);\n\t\t// a reservation must be returned\n\t\tassertNotNull(\"Reservation id is null\", createdReservationID);\n\t\tassertFalse(\"Reservation id is emtpy\", createdReservationID.isEmpty());\n\t\t// check if returned reservation is correct\n\t\tReservation createdReservation = bookingManagement.getReservation(createdReservationID);\n\t\tassertNotNull(\"Reservation of returned id was not found\", createdReservation);\n\n\t\tassertEquals(USER_ID, createdReservation.getBookingUserId());\n\n\t\tassertEquals(1, createdReservation.getBookedFacilityIds().size());\n\t\tassertTrue(createdReservation.getBookedFacilityIds().contains(room1.getId()));\n\t\tassertEquals(validStartDate, createdReservation.getStartTime());\n\t\tassertEquals(validEndDate, createdReservation.getEndTime());\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testSaveRoomNotShelterNegative() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player2\");\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test(expected = IllegalArgumentException.class)\n public void testFailInit() {\n uut=new ChatMessageRequest(\"test\",\"test\",\"test\",MessageTypes.MATCH);\n }", "@Test(expected = InvalidDataAccessResourceUsageException.class)\n\tpublic void testError()\n\t\tthrows IOException\n\t{\n\t\tCqpQuery query = engine.createQuery(\"type\", \"TUEBADZ5\", \"\\\"Drachen\");\n\t\tquery.setContext(1, 1, ContextUnit.SENTENCE);\n\t\tquery.execute();\n\t}", "@Test(expected = FacilityNotFoundException.class)\n\tpublic void testBookFacilityIDDoesNotExist() throws Exception {\n\t\tbookingManagement\n\t\t\t\t.book(USER_ID, Arrays.asList(\"some id that does not exist\"), validStartDate, validEndDate);\n\t}", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative4() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tunauthenticate();\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\t}", "@Test\n public void create_EmptyAssignmentName_ShouldReturn400Error() throws Exception {\n final String invalidAssignmentJSON = \"{\\\"name\\\": \\\"\\\"}\";\n\n // When we post an invalid Assignment\n // then we get a Bad Request error\n mockMvc.perform(post(ENDPOINT)\n .contentType(MediaType.APPLICATION_JSON)\n .content(invalidAssignmentJSON))\n .andExpect(status().isBadRequest());\n }", "public ChatRoom createRoom(String room) {\r\n ChatRoom chatRoom = new ChatRoom(serviceAddress.withLocal(room), null, xmppSession, serviceDiscoveryManager, multiUserChatManager);\r\n chatRoom.initialize();\r\n return chatRoom;\r\n }", "public void createChatRoom(String name) throws RemoteException {\n\n\t\ttry {\n\t\t\tIChatServer chatStub;\n\t\t\t// make a new chatroom with supplied name\n\t\t\tIChatroom newRoom = new Chatroom(name);\n\t\t\tview.append(\"Make new ChatRoom: \" + newRoom.getName() + \"\\n\");\n\t\t\t// make a new chatserver stub for user in the newchatroom\n\t\t\tIChatServer newChatServer = new ChatServer(user, newRoom);\n\t\t\tview.append(\"Make new ChatServer: <User:\" + newChatServer.getUser().getName() + \", ChatServer: \"\n\t\t\t\t\t+ newChatServer.getChatroom().getName() + \">\\n\");\n\t\t\t//get a chatstub for new chatserver \n\t\t\tchatStub = (IChatServer) UnicastRemoteObject.exportObject(newChatServer, IChatServer.BOUND_PORT);\n\t\t\tregistry.rebind(IChatServer.BOUND_NAME + newRoom.hashCode(), chatStub);\n\t\t\tview.append(\"Make new ChatServer Stub for chatserver.\\n\");\n\t\t\t//add chatstub to newRoom\n\t\t\tnewRoom.addChatServer(chatStub);\n\t\t\tview.append(\"Add new ChatServer Stub to newRoom.\\n\");\n\t\t\t//add newchatroom to the user chatroom lists\n\t\t\tuser.addRoom(newRoom);\n\t\t\tview.append(\"Add new chatroom <\" + newRoom.getName() + \"> to user <\" + user.getName() + \">\\n\");\n\t\t\t//add all chatservers in that room to hashset\n\t\t\tHashSet<IChatServer> proxy = new HashSet<IChatServer>();\n\t\t\tfor (IChatServer item : newChatServer.getChatroom().getChatServers()) {\n\t\t\t\tIChatServer proxyChatServer = new ProxyIChatServer(item);\n\t\t\t\tproxy.add(proxyChatServer);\n\t\t\t}\n\t\t\tIMain2MiniAdpt miniMVCAdpt = view.makeMini(newChatServer, proxy);\n\t\t\tminiMVCAdpts.put(newRoom, miniMVCAdpt);\n\t\t\tcountRoom++;\n\t\t} catch (Exception e) {\n\t\t\tview.append(\"Error creating chatroom!\");\n\t\t}\n\n\t}", "RoomModel createRoomModel(RoomModel roomModel);", "@RequestMapping(method = RequestMethod.POST)\n public ResponseEntity<?> addGameRoom(@RequestBody Game gameRoom) {\n try {\n ls.addGameRoom(gameRoom);\n return new ResponseEntity<>(HttpStatus.CREATED);\n } catch (LacmanPersistenceException ex) {\n Logger.getLogger(LacmanController.class.getName()).log(Level.SEVERE, null, ex);\n return new ResponseEntity<>(ex.getMessage(), HttpStatus.FORBIDDEN);\n }\n }", "@Test\n public void shouldNotCreateANullBook() throws JAXBException {\n Response response = target(\"/books\").request().post(Entity.entity(null, MediaType.APPLICATION_XML));\n assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusInfo().getStatusCode());\n }", "public GenericResponse<Booking> reserveRoom(Booking booking) {\n GenericResponse genericResponse = HotelBookingValidation.validateBookingInfo(logger, hotel, booking);\n if (genericResponse != null) {\n return genericResponse;\n }\n\n logger.info(booking.toString());\n\n if (hotel.getBookings().putIfAbsent(booking.getBookingRoom(), booking.getUser()) == null) {\n return GenericResponseUtils.generateFromSuccessfulData(booking);\n }\n\n logger.info(\"Oops. Please try again.\");\n return GenericResponseUtils.generateFromErrorMessage(\"Oops. Please try again.\");\n }", "Booking createBooking(Booking newBooking) throws Exception;", "@Order(1)\n\t\t@Test\n\t\tpublic void sendMessageInvalidFromAndTo() throws IOException, ParseException {\n\t\t\t boolean response = Requests.createMessageBoolReturn(JSONUtils.createMessageObject(INVALID_USER_ID, INVALID_USER_ID, \"Test message\"));\n\t\t\t assertFalse(response);\n\t\t\t \n\t\t\t \n\t\t}", "@Test\r\n public void testCreateInvalid() throws PAException {\r\n thrown.expect(PAException.class);\r\n thrown.expectMessage(\"Missing Disease/Condition. \");\r\n StudyProtocol studyProtocol = TestSchema.createStudyProtocolObj();\r\n Ii spIi = IiConverter.convertToStudyProtocolIi(studyProtocol.getId());\r\n StudyDiseaseDTO studyDiseaseDTO = new StudyDiseaseDTO();\r\n studyDiseaseDTO.setStudyProtocolIdentifier(spIi);\r\n studyDiseaseDTO.setCtGovXmlIndicator(BlConverter.convertToBl(true));\r\n bean.create(studyDiseaseDTO);\r\n }", "public String createCourse(String message)// throws SQLException\r\n{\t\r\n\tString[] inputString=getCourseParameter(message);\r\n\tint j=0;\r\n\tString reply=\"\";\r\n\tString requestID=inputString[0];\r\n\tboolean room_booked_exception_flag=false;\r\n\tString courseName=inputString[1];\r\n\tSystem.out.println(\"Course Name: \"+courseName);\r\n\tString courseSection=inputString[2];\r\n\tString instructorID=inputString[3];\r\n\tString[] location=getLocationString(inputString[4]);\r\n\ttry{\r\n\tif(location[0]==null){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\r\n\t\treturn reply;\r\n\t\t}\r\n\tString units=inputString[5];\r\n\tString building=location[0];\r\n\tString room=location[1];\r\n\t\r\n\tboolean checkIDFlag=(new InstructorServant()).validateInstructorID(instructorID);\r\n\tif(!checkIDFlag){\r\n\t\t//Exception \r\n\t\treturn requestID+\"\\n\"+Exceptions.malformed_id;\r\n\t}\r\n\t\r\n if((building.equalsIgnoreCase(\"TBA\")) && !room.equalsIgnoreCase(\"TBA\")){\r\n\t\tSystem.out.println(\"Invalid TBA with location:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t}\r\n\tif((!building.equalsIgnoreCase(\"TBA\")) && room.equalsIgnoreCase(\"TBA\")){\r\n\t\tSystem.out.println(\"Invalid TBA with location:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\t\r\n\tif(building.equalsIgnoreCase(\"TBA\") && room.equalsIgnoreCase(\"TBA\"))\r\n\t{\r\n\t\troom_booked_exception_flag=true;\r\n\t}\r\n\t\r\n\t\r\n\t\r\n\t//Exception for course exist\r\n\tint count=Course_DB.getNumberOfCourse(courseName,courseSection);\r\n\tSystem.out.println(\"COUNT :\"+count);\r\n\tif(count!=0)\r\n\t{\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.course_exists);\r\n\t return reply;\r\n\t}\r\n\t//Exception for course unit\r\n\ttry{\r\n\t\tint noOfUnits=Integer.parseInt(inputString[5]);\r\n\tif (noOfUnits<0)\r\n\t{\r\n\t\tSystem.out.println(\"Invalid Units:\");\r\n\t reply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_units);\r\n\t return reply;\r\n\t}\r\n\t}\r\n\tcatch(Exception e){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_units);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\t//System.out.println(\"OFFICE HOURS: __________\"+location[3].substring(4,5)+\"\");\r\n\tif(!location[3].substring(4,5).equalsIgnoreCase(\"-\")){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\tif(location[2].equalsIgnoreCase(\"TBA\") && location[3].equalsIgnoreCase(\"TBA\")){\r\n\t\t\r\n\t\tint error=Course_DB.writeCreateCourse(courseName,courseSection,instructorID,building,room,-1,\"-1\",\"-1\",units);\r\n\t\tif(error!=0){\r\n\t\t\treply=requestID+\"\\n\"+Exceptions.create_exception;\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treply=requestID+\"\\n\"+0;\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n\tint noOfDays=location[2].length();\r\n\tif(noOfDays>7 || noOfDays<1){\r\n\t\t//Exception\r\n\t\tSystem.out.println(\"Exception: No Of days\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t\t\r\n\t}\r\n\tString[][] days=getDays(location[2],noOfDays);\r\n\tif(days[0][0]==null){\r\n\t\t//Exception\r\n\t\tSystem.out.println(\"Days are not proper:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t\t\r\n\t\t}\r\n\tboolean checkOrderOfDays=validateOrderOfDays(days,noOfDays);\r\n\tif(!checkOrderOfDays){\r\n\t\t//Exception\r\n\t\tSystem.out.println(\"Days are not ordered in proper way:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t\t// Raise Malformed_LOCATION Exception\r\n\t\t//return Exceptions.malformed_hours;\r\n\t}\r\n\tString[] validHours=validateHours(location[3]);\r\n\tString stime=location[3].substring(0,location[3].indexOf(\"-\"));\r\n\tString etime=location[3].substring(location[3].indexOf(\"-\")+1,location[3].length());\r\n\r\n\tif(validHours[0]==null){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\treturn reply;\r\n\t\t}\r\n\r\n\t\r\n\tboolean finalValidation=true;\t\r\n\t//Check for Room_Booked Exception\r\n\tif(!room_booked_exception_flag)\r\n\t{\r\n\t\tCourseServant courseServant=new CourseServant();\r\n\t\tString[][][] officeHours=Course_DB.loadRoomCourseHours(building,(room));\r\n\t\t\r\n\ttry{\r\n\t\tfor(int i=0;i<noOfDays;i++){\r\n\t\tfinalValidation=loadRoomOfficeHour(officeHours,Integer.parseInt(days[i][1]),validHours[0],validHours[1]);\r\n\t\tif(!finalValidation)\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tcatch(Exception e){\r\n\t\tSystem.out.println(\"Exception at room booked\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.room_booked);\r\n\t\treturn reply;\r\n\t\t}\r\n\t}\r\n\t\r\n\tint officeHourExceptionFlag=-1;\r\n\ttry{\r\n\t\tSystem.out.println(\"Office Hours Course Servant:\");\r\n\t\tString[][][] officeHours=Instructor_DB.loadOfficeHour(instructorID);\r\n\t\tInstructorServant instructor=loadOfficeHour(officeHours);\r\n\t\tinstructor.setInstructorID(instructorID);\r\n\t\tfor(int i=0;i<noOfDays;i++){\r\n\t\tofficeHourExceptionFlag=instructor.validateOfficeHourConflict(Integer.parseInt(days[i][1]),validHours[0],validHours[1]);\r\n\t\tif(officeHourExceptionFlag!=-1){break;}\r\n\t}\r\n\t}\r\n\tcatch(Exception e){\r\n\t\tSystem.out.println(\"Office Hours are invalid: 2\"+e);\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.schedule_conflict);\r\n\t\treturn reply;\r\n\t}\r\n\tif(officeHourExceptionFlag!=-1){\r\n\t\tif(officeHourExceptionFlag==0){\r\n\t\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.schedule_conflict);\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(!finalValidation){\r\n\t\tSystem.out.println(\"Exception at room booked 2\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.room_booked);\r\n\t\treturn reply;\r\n\t\t}\r\n\r\n\tif(!checkMidNightExtension(stime,etime)){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\tSystem.out.println(\"I am midnight:\"+reply);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\ttry{\r\n\t\t//insert values into AS_COurse also..********************************88\r\n\t\tfor(int i=0;i<noOfDays;i++){\r\n\t\t\tint error=Course_DB.writeCreateCourse(courseName,courseSection,instructorID,building,room,Integer.parseInt(days[i][1]),stime,etime,units);\r\n\t\t\tif(error!=0){\r\n\t\t\t\treply=requestID+\"\\n\"+Exceptions.create_exception;\r\n\t\t\t\treturn reply;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}\r\n\tcatch(Exception e){}\r\n\treply=requestID+\"\\n\"+0+\"\\n\"+0;\r\n\treturn reply;\r\n\t}\r\n\tcatch(Exception e){\r\n\t\treturn requestID+\"\\n\"+Exceptions.malformed_location;\r\n\t}\r\n}", "@Test\n public final void testCreateUserInJSONUserAlreadyExists() {\n \n try {\n \tUserAPI fixture = new UserAPI();\n String input = \"{\\\"userName\\\":\\\"Txuso\\\", \\\"password\\\": \\\"213\\\"}\";\n \tfixture.createUserInJSON(input);\n } catch (WebApplicationException e) {\n \tassertNotNull(Response.Status.NOT_ACCEPTABLE.getStatusCode());\n }\n }", "@Test\r\n\tpublic final void testGetRoomById() {\n\t\tRoom actual = roomServices.getRoomById(expected.getId());\r\n\t\tassertEquals(expected, actual);\r\n\t}", "@Test\n\tpublic void testCreateTicketFail() {\n\t}", "@Test\n public void create_NullAssignmentName_ShouldReturn400Error() throws Exception {\n final String invalidAssignmentJSON = \"{\\\"name\\\": null}\";\n\n // When we post an invalid Assignment\n // then we get a Bad Request error\n mockMvc.perform(post(ENDPOINT)\n .contentType(MediaType.APPLICATION_JSON)\n .content(invalidAssignmentJSON))\n .andExpect(status().isBadRequest());\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testSaveRoomNotOwnShelterNegative() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\t\tsuper.unauthenticate();\n\n\t\tsuper.authenticate(\"Player3\");\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n void testFailure_illegalStatus() {\n assertThrows(\n IllegalArgumentException.class,\n () ->\n runCommandForced(\n \"--client=NewRegistrar\",\n \"--registrar_request=true\",\n \"--reason=Test\",\n \"--domain_name=example.tld\",\n \"--apply=clientRenewProhibited\"));\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n public void testCreateSecretGroupNoOptions() throws Throwable {\n // construct the service\n constructClientService();\n\n server.enqueue(new MockResponse());\n\n // Invoke operation with null options model (negative test)\n secretsManagerService.createSecretGroup(null).execute();\n }", "@Test\n\tpublic void testInvalidEmailId() {\n\t\tString emailId = \"InvalidPerson\";\n\t\tClient client = Client.create();\n\t\tWebResource webResource2 = client\n\t\t\t\t.resource(\"http://localhost:8080/MeetingSchedulerProject/meeting/personservice/\"\n\t\t\t\t\t\t+ emailId);\n\t\tClientResponse response2 = webResource2.accept(\n\t\t\t\tMediaType.APPLICATION_JSON).get(ClientResponse.class);\n\n\t\t// not found status code\n\t\tassertEquals(response2.getStatus(), 404);\n\t}", "@Test\n public void bookHotelTestError3() throws BookHotelFault, DatatypeConfigurationException{ \n BookHotelInputType input = CreateBookHotelInputType(\"booking_Hotel_1\", \"Tobiasen Inge\", \"50408823\", 9, 10);\n try {\n assertTrue(bookHotel(input));\n } catch (BookHotelFault e) {\n assertEquals(\"The account has not enough money\",e.getMessage());\n } \n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "public void createRooms()//Method was given\n { \n \n // create the rooms, format is name = new Room(\"description of the situation\"); ex. desc = 'in a small house' would print 'you are in a small house.'\n outside = new Room(\"outside\", \"outside of a small building with a door straight ahead. There is a welcome mat, a mailbox, and a man standing in front of the door.\", false);\n kitchen = new Room(\"kitchen\", \"in what appears to be a kitchen. There is a sink and some counters with an easter egg on top of the counter. There is a locked door straight ahead, and a man standing next to a potted plant. There is also a delicious looking chocolate bar sitting on the counter... how tempting\", true);\n poolRoom = new Room(\"pool room\", \"in a new room that appears much larger than the first room.You see a table with a flashlight, towel, and scissors on it. There is also a large swimming pool with what looks like a snorkel deep in the bottom of the pool. Straight ahead of you stands the same man as before.\", true);\n library = new Room(\"library\", \"facing east in a new, much smaller room than before. There are endless rows of bookshelves filling the room. All of the books have a black cover excpet for two: one red book and one blue book. The man stands in front of you, next to the first row of bookshelves\", true);\n exitRoom = new Room(\"exit\", \"outside of the building again. You have successfully escaped, congratulations! Celebrate with a non-poisonous chocolate bar\",true);\n \n // initialise room exits, goes (north, east, south, west)\n outside.setExits(kitchen, null, null, null);\n kitchen.setExits(poolRoom, null, outside, null);\n poolRoom.setExits(null, library, kitchen, null);\n library.setExits(null, null, exitRoom, poolRoom);\n exitRoom.setExits(null, null, null, null); \n \n currentRoom = outside; // start game outside\n }", "@Test\n void createInvalidSystemSnomed() throws IOException {\n Exception exception = executeMappingException(\"create-history-of-travel-invalid-system-snomed.json\");\n assertEquals(\"The system is not correct. It should be 'http://snomed.info/sct', but it was 'http://loinc.org'.\", exception.getMessage());\n }", "@RequestMapping(value = \"/Reservation/{reservation_reservationId}/room\", method = RequestMethod.POST)\n\t@ResponseBody\n\tpublic Room newReservationRoom(@PathVariable Integer reservation_reservationId, @RequestBody Room room) {\n\t\treservationService.saveReservationRoom(reservation_reservationId, room);\n\t\treturn roomDAO.findRoomByPrimaryKey(room.getRoomId());\n\t}", "public void test1_0Room() throws Exception {\n getReverb(0);\n try {\n short level = mReverb.getRoomLevel();\n level = (short)((level == 0) ? -1000 : 0);\n mReverb.setRoomLevel(level);\n short level2 = mReverb.getRoomLevel();\n assertTrue(\"got incorrect room level\",\n (level2 > (level - MILLIBEL_TOLERANCE)) &&\n (level2 < (level + MILLIBEL_TOLERANCE)));\n\n level = mReverb.getRoomHFLevel();\n level = (short)((level == 0) ? -1000 : 0);\n mReverb.setRoomHFLevel(level);\n level2 = mReverb.getRoomHFLevel();\n assertTrue(\"got incorrect room HF level\",\n (level2 > (level - MILLIBEL_TOLERANCE)) &&\n (level2 < (level + MILLIBEL_TOLERANCE)));\n\n } catch (IllegalArgumentException e) {\n fail(\"Bad parameter value\");\n } catch (UnsupportedOperationException e) {\n fail(\"get parameter() rejected\");\n } catch (IllegalStateException e) {\n fail(\"get parameter() called in wrong state\");\n } finally {\n releaseReverb();\n }\n }", "@Test\n @WithMockUser(username=\"supervisor_admin\",roles={\"PM\",\"ADMIN\"})\n public void shouldBadRequestCreateAssessmentRubricEmptyTitle() throws Exception {\n String rubricTitle = \"\";\n int rubricRank = 4;\n boolean rubricIsEnabled = true;\n\n AssessmentRubric rubricObject = new AssessmentRubric();\n rubricObject.setTitle(rubricTitle);\n rubricObject.setStarting_date_time(LocalDateTime.now());\n rubricObject.setEnd_date_time(LocalDateTime.now());\n rubricObject.setEnabled(rubricIsEnabled);\n rubricObject.setRank(rubricRank);\n\n rubricObject.setRubricType(getMockTestRubricType());\n rubricObject.setLearningProcess(getMockTestLearningProcess());\n\n // Creating process JSON\n byte[] rubricJSON = this.mapper.writeValueAsString(rubricObject).getBytes();\n\n // invoke Create\n MvcResult results = mvc.perform(post(BASE_URL).content(rubricJSON)\n .contentType(MediaType.APPLICATION_JSON)\n .accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isBadRequest())\n .andReturn();\n }", "@Test(expected = Exception.class)\n public void shouldInformTheClientWithAnExceptionIfTheUpdateCausesAnException()\n\t throws Exception {\n\n\tfinal ArrayList<String> newValidValues = Lists.newArrayList(\"Hilton\",\n\t\t\"Hamburg\", \"2\", \"N\", \"12\", \"12.02.2007\", \"\");\n\n\tfinal UpdateRoomCommand command = new UpdateRoomCommand(newValidValues,\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\twhen(builder.createRoomOffer(newValidValues, validRoomOffer.getIndex()))\n\t\t.thenReturn(validRoomOffer);\n\tdoThrow(new RuntimeException()).when(dao).update(eq(validRoomOffer),\n\t\tanyLong());\n\n\troomOfferService.updateRoomOffer(command);\n\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tverify(dao).update(eq(validRoomOffer), anyLong());\n }", "@Test\n public void bookHotelTestError() throws BookHotelFault{\n try {\n assertTrue(bookHotel(null));\n } catch (BookHotelFault e) {\n assertEquals(\"Empty\", e.getMessage());\n } \n }", "@PostMapping(value=\"/insert/hotel\", consumes=MediaType.APPLICATION_JSON_VALUE)\r\n\tpublic ResponseClient insertNewRoom(@RequestBody Hotel hotel){\r\n\t\thotelSer.save(hotel);\r\n\t\tResponseClient res = new ResponseClient();\r\n\t\tres.setResponse(\"successfull hotel_id: \");\r\n\t\treturn res;\r\n\t}", "public Result createRoom() {\n\n DynamicForm dynamicForm = Form.form().bindFromRequest();\n String roomType = dynamicForm.get(\"roomType\");\n Double price = Double.parseDouble(dynamicForm.get(\"price\"));\n int bedCount = Integer.parseInt(dynamicForm.get(\"beds\"));\n String wifi = dynamicForm.get(\"wifi\");\n String smoking = dynamicForm.get(\"smoking\");\n\n RoomType roomTypeObj = new RoomType(roomType, price, bedCount, wifi, smoking);\n\n if (dynamicForm.get(\"AddRoomType\") != null) {\n\n Ebean.save(roomTypeObj);\n String message = \"New Room type is created Successfully\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n } else{\n\n String message = \"Failed to create a new Room type\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n\n }\n\n\n\n }", "@Test\n public void testFailureWithoutObjectId() throws URISyntaxException, IOException {\n testCantView(adminLogin, \"\", 400);\n }", "@Test(expected=Exception.class)\n\tpublic void testPostNewElementWithUserBadPermission() throws Exception{\n\n\t\t\t\tMap<String, Object> details = new HashMap<>();\n\t\t\t\tdetails.put(\"val1\", \"20\");\n\t\t\t\tdetails.put(\"val2\", 20.0);\n\n\t\t\t\tElementBoundary newElement = new ElementBoundary();\n\t\t\t\tnewElement.setKey(new Key(\"1\", \"Smartspace\"));\n\t\t\t\tnewElement.setElementType(\"Type\");\n\t\t\t\tnewElement.setName(\"Name\");\n\t\t\t\tnewElement.setElementProperties(details);\n\t\t\t\tnewElement.setExpired(false);\n\t\t\t\tnewElement.setCreated(new Date());\n\t\t\t\tnewElement.setCreator(new UserForBoundary(this.userEntityPlayer.getUserEmail(), \"bla\"));\n\t\t\t\tnewElement.setLatlng(new LocationForBoundary(31.11, 77.11));\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\tElementBoundary[] elements = { newElement };\n\t\t\t\n\t\t\t\tthis.restTemplate.postForObject(\n\t\t\t\t\t\tthis.baseUrl, \n\t\t\t\t\t\telements, \n\t\t\t\t\t\tElementBoundary[].class, \n\t\t\t\t\t\tthis.userEntityPlayer.getUserSmartspace(),\n\t\t\t\t\t\tthis.userEntityPlayer.getUserEmail());\n\t\t\n\t\t// THEN the test end with exception\n\t}", "@Override\r\n\tpublic void testInvalidId() throws Exception {\n\t\tif (JavastravaApplicationConfig.STRAVA_ALLOWS_CHALLENGES_ENDPOINT) {\r\n\t\t\tsuper.testInvalidId();\r\n\t\t}\r\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testBookWithEmptyUserID() throws Exception {\n\t\tbookingManagement.book(\"\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public static Room newRoom(int random){\n String nameRoom = \"\";\n int monsterAmount = 0;\n\t\tMonster monster;\n MonsterFactory monsterFac = new MonsterFactory();\n\t\tmonster= monsterFac.buildMonster((int)(Math.random() * 3) + 1);\n boolean createHealingPot = false;\n boolean createPitRoom = false;\n boolean createPillar = false;\n boolean createEntrance = false;\n boolean createExit = false;\n boolean createVisionPot = false;\n\n switch (random){\n case 1:\n \tnameRoom = \"The Entrance room\";\n \tmonsterAmount = 0;\n createEntrance = true;\n break;\n\n case 2:\n \tnameRoom = \"The Exit room\";\n \tmonsterAmount = 0;\n createExit = true;\n break;\n\n case 3:\n \tnameRoom = \"The room\";\n \tmonsterAmount = 1; //THIS ROOM WILL HAVE 1 MONSTER\n break;\n \n case 4:\n \tnameRoom = \"The Healing Potion room\";\n \tmonsterAmount=(int)(Math.random() * 1) + 0;\n createHealingPot = true;\n break;\n \n case 5:\n \tnameRoom = \"The Pit room\";\n \tmonsterAmount = 0;\n createPitRoom = true;\n break;\n\n case 6:\n \tnameRoom = \"The Pillar room\";\n \tmonsterAmount=(int)(Math.random() * 1) + 0;\n \tcreatePillar = true;\n break;\n \n case 7:\n \tnameRoom = \"The Vision Potion room\";\n \tmonsterAmount=0;\n createVisionPot=true;\n break;\n }\n \n if(monsterAmount <= 0 ) \n return new Room(nameRoom,createHealingPot, createPitRoom, createEntrance, createExit, createPillar, monsterAmount,createVisionPot);\n else\n return new Room(nameRoom,createHealingPot, createPitRoom, createEntrance, createExit, createPillar, monster, monsterAmount,createVisionPot);\n\n }", "@Test\n public void shouldUpdateTheSpezifiedValidRoomAndPersistTheChanges()\n\t throws Exception {\n\n\tfinal ArrayList<String> newValidValues = Lists.newArrayList(\"Hilton\",\n\t\t\"Hamburg\", \"2\", \"N\", \"12\", \"12.02.2007\", \"\");\n\n\tfinal UpdateRoomCommand command = new UpdateRoomCommand(newValidValues,\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\twhen(builder.createRoomOffer(newValidValues, validRoomOffer.getIndex()))\n\t\t.thenReturn(validRoomOffer);\n\n\tfinal UrlyBirdRoomOffer updatedRoomOffer = roomOfferService\n\t\t.updateRoomOffer(command);\n\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tverify(dao).update(eq(validRoomOffer), anyLong());\n\tassertThat(updatedRoomOffer, is(equalTo(validRoomOffer)));\n }", "@Test(expected = SystemObjectIdException.class)\n public void shouldThrowExceptionIfFailToIdentifyDevice() throws IOException {\n\n expect(configuration.createPDU(PDU.GET)).andReturn(new PDU());\n\n expect(snmpInterface.send(isA(PDU.class), same(target))).andReturn(createErrorResponseEvent());\n replayAll();\n\n try {\n session.identifyDevice();\n assert false : \"Should not reach\";\n } finally {\n verifyAll();\n }\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n public void testCreateSecretNoOptions() throws Throwable {\n // construct the service\n constructClientService();\n\n server.enqueue(new MockResponse());\n\n // Invoke operation with null options model (negative test)\n secretsManagerService.createSecret(null).execute();\n }", "@Test\n final void testCreateDevice() {\n when(deviceDao.save(user, deviceDTO)).thenReturn(deviceDTO);\n when(request.getRemoteAddr()).thenReturn(DeviceFixture.PUBLIC_IP_ADDRESS);\n when(deviceDao.createDevice(user, createDeviceRequest, DeviceFixture.PUBLIC_IP_ADDRESS))\n .thenReturn(deviceDTO);\n when(deviceMapper.toModel(deviceDTO)).thenReturn(deviceModel);\n\n ResponseEntity<DeviceModel> response = deviceController.createDevice(createDeviceRequest);\n\n assertEquals(200, response.getStatusCodeValue());\n assertNotNull(response.getBody());\n DeviceModel device = response.getBody();\n assertEquals(deviceModel, device);\n }", "public void insertReservation(TestDto testDto) throws Exception;" ]
[ "0.79857576", "0.76745355", "0.7527585", "0.69724554", "0.67604774", "0.6736078", "0.6667345", "0.65308297", "0.6465973", "0.6400262", "0.6352011", "0.62984204", "0.62977517", "0.62482107", "0.6108074", "0.6105664", "0.60738117", "0.6038059", "0.6023685", "0.60232633", "0.59659374", "0.595103", "0.5939017", "0.5908599", "0.58670515", "0.5801449", "0.5771439", "0.57520926", "0.57472676", "0.5737097", "0.5733708", "0.5726482", "0.57259387", "0.5725367", "0.5692828", "0.5679578", "0.5674491", "0.56697613", "0.56649786", "0.5644962", "0.5637648", "0.5628126", "0.56238866", "0.5606795", "0.56003165", "0.55928355", "0.5592524", "0.55891085", "0.55871", "0.55824906", "0.5575675", "0.55738324", "0.5560249", "0.5554602", "0.555429", "0.5544078", "0.55377275", "0.55310404", "0.55180377", "0.5504146", "0.5477384", "0.5476832", "0.5469706", "0.545329", "0.54447234", "0.5440206", "0.54249966", "0.54197633", "0.54147625", "0.540796", "0.54039", "0.539071", "0.5385116", "0.53751993", "0.5369368", "0.53541106", "0.5348334", "0.53456545", "0.5339", "0.53249496", "0.53243726", "0.53158", "0.5313625", "0.5302939", "0.53016585", "0.52936906", "0.52896047", "0.5286169", "0.5276636", "0.5245987", "0.524063", "0.52365845", "0.523366", "0.5221371", "0.5215655", "0.5211384", "0.5208945", "0.5207765", "0.52062684", "0.51957804" ]
0.86359787
0
Test subscribe to room with OK response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testSubscribeToRoomOkResponse() { // given final SubscribeRequest subscribeRequest = SubscribeRequest.builder() .user(TEST_USER + "/" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + "@null").build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest)) .willReturn(OK_RESPONSE); // when multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomOkResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n public void startPollingAuthStatusSuccess() throws Exception {\n // Arrange\n TestSubscriber<String> subscriber = new TestSubscriber<>();\n when(mAccess.getSessionId(anyString())).thenReturn(STRING_TO_RETURN);\n when(mAccess.getEncryptedPayload(anyString(), anyString())).thenReturn(STRING_TO_RETURN);\n // Act\n mSubject.startPollingAuthStatus(\"1234567890\").toBlocking().subscribe(subscriber);\n // Assert\n verify(mAccess).getSessionId(anyString());\n verify(mAccess).getEncryptedPayload(anyString(), anyString());\n subscriber.assertCompleted();\n subscriber.onNext(STRING_TO_RETURN);\n subscriber.assertNoErrors();\n }", "@Test\r\n\tpublic void test() {\r\n\t\tassertEquals(subscribe.getTopic() , \"room1\");\r\n\t\tassertEquals(subscribe.getTypeMap() , \"Galilei\");\r\n\t\tassertTrue(subscribe.isPossible(server));\r\n\t\tassertTrue(!subscribe2.isPossible(server));\r\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\r\n\tpublic void aTestValidSubscribe() {\r\n\t\tbroker.subscribe(intSub);\r\n\t\tbroker.subscribe(unreadSub);\r\n\t\tbroker.subscribe(pIntSub);\r\n\t}", "@Test\n public void startPollingAuthStatusAccessRequired() throws Exception {\n // Arrange\n TestSubscriber<String> subscriber = new TestSubscriber<>();\n when(mAccess.getSessionId(anyString())).thenReturn(STRING_TO_RETURN);\n when(mAccess.getEncryptedPayload(anyString(), anyString())).thenReturn(Access.KEY_AUTH_REQUIRED);\n // Act\n mSubject.startPollingAuthStatus(\"1234567890\").take(1, TimeUnit.SECONDS).toBlocking().subscribe(subscriber);\n // Assert\n subscriber.assertCompleted();\n subscriber.assertNoValues();\n subscriber.assertNoErrors();\n }", "@Test\n public void testRepositoryGotResponseOkForUser() throws InterruptedException {\n // Preconditions\n TestSubscriber<User> subscriber = new TestSubscriber<>();\n\n // Attaches the subscriber and executes the Observable.\n repository.get(1).subscribe(subscriber);\n RecordedRequest request = server.takeRequest();\n\n // Checks whether these methods from inner objects are called.\n verify(retrofitFactory).setBaseUrl(anyString());\n verify(retrofitFactory).create(UserService.class);\n verify(retrofitFactory).getClient();\n\n // Ensures there aren't new changes on the Rest adapter structure\n verifyNoMoreInteractions(retrofitFactory);\n\n // Ensures Observer and Requests are working as expected\n List<User> events = subscriber.getOnNextEvents();\n subscriber.assertNoErrors();\n subscriber.assertValueCount(1);\n subscriber.assertCompleted();\n subscriber.assertUnsubscribed();\n Assert.assertEquals(1, server.getRequestCount());\n Assert.assertEquals(\"/users/1\", request.getPath());\n Assert.assertNotNull(events);\n Assert.assertEquals(1, events.size());\n Assert.assertEquals(\"[email protected]\", events.get(0).email);\n }", "@Test\n public void initiatePayloadSuccess() throws Exception {\n // Arrange\n TestSubscriber<Void> subscriber = new TestSubscriber<>();\n doAnswer(invocation -> {\n ((PayloadManager.InitiatePayloadListener) invocation.getArguments()[3]).onInitSuccess();\n return null;\n }).when(mPayloadManager).initiatePayload(\n anyString(), anyString(), any(CharSequenceX.class), any(PayloadManager.InitiatePayloadListener.class));\n // Act\n mSubject.updatePayload(\"1234567890\", \"1234567890\", new CharSequenceX(\"1234567890\")).toBlocking().subscribe(subscriber);\n // Assert\n verify(mPayloadManager).setTempPassword(any(CharSequenceX.class));\n subscriber.assertCompleted();\n subscriber.assertNoErrors();\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "private void subscribe() {\n Log.i(TAG, \"Subscribing\");\n mNearbyDevicesArrayAdapter.clear();\n SubscribeOptions options = new SubscribeOptions.Builder()\n .setStrategy(PUB_SUB_STRATEGY)\n .setCallback(new SubscribeCallback() {\n @Override\n public void onExpired() {\n super.onExpired();\n Log.i(TAG, \"No longer subscribing\");\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mSubscribeSwitch.setChecked(false);\n }\n });\n }\n }).build();\n\n Nearby.Messages.subscribe(mGoogleApiClient, mMessageListener, options)\n .setResultCallback(new ResultCallback<Status>() {\n @Override\n public void onResult(@NonNull Status status) {\n if (status.isSuccess()) {\n Log.i(TAG, \"Subscribed successfully.\");\n } else {\n logAndShowSnackbar(\"Could not subscribe, status = \" + status);\n mSubscribeSwitch.setChecked(false);\n }\n }\n });\n }", "@Test\n public void testClient(){\n received=false;\n uut=new ChatMessageRequest(\"test\",\"test2\",\"test\",MessageTypes.MATCH);\n uut.clientHandle(null,new TestUtilizer());\n assertTrue(received);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomBadResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsOkResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n public void testRegister(TestContext context) {\n NetClient client = vertx.createNetClient();\n final Async async = context.async();\n\n client.connect(7000, \"localhost\").onComplete(context.asyncAssertSuccess(socket -> {\n\n // 1 reply will arrive\n // MESSAGE for echo\n final FrameParser parser = new FrameParser(parse -> {\n context.assertTrue(parse.succeeded());\n JsonObject frame = parse.result();\n\n context.assertNotEquals(\"err\", frame.getString(\"type\"));\n context.assertEquals(false, frame.getBoolean(\"send\"));\n context.assertEquals(\"Vert.x\", frame.getJsonObject(\"body\").getString(\"value\"));\n client.close();\n async.complete();\n });\n\n socket.handler(parser);\n\n FrameHelper.sendFrame(\"register\", \"echo\", null, socket);\n\n // now try to publish a message so it gets delivered both to the consumer registred on the startup and to this\n // remote consumer\n\n FrameHelper.sendFrame(\"publish\", \"echo\", new JsonObject().put(\"value\", \"Vert.x\"), socket);\n }));\n\n }", "@Test\n public void testSearchUserByQuerySuccess() throws Exception {\n TestSubscriber testSubscriber = new TestSubscriber();\n Observable<ApiSearchUser> searchUserObservable = githubApi.getSearchUser(testedString, null);\n searchUserObservable.subscribe(testSubscriber);\n testSubscriber.awaitTerminalEvent();\n testSubscriber.assertCompleted();\n }", "@Test\n public void subscribe_unsubscribe() {\n String channelName = \"subscribe_unsubscribe_\" + testParams.name;\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[0].keyStr);\n ably = new AblyRealtime(opts);\n\n /* create a channel and attach */\n final Channel channel = ably.channels.get(channelName);\n channel.attach();\n (new ChannelWaiter(channel)).waitFor(ChannelState.attached);\n assertEquals(\"Verify attached state reached\", channel.state, ChannelState.attached);\n\n /* subscribe */\n MessageListener testListener = new MessageListener() {\n @Override\n public void onMessage(Message message) {\n }};\n channel.subscribe(\"test_event\", testListener);\n /* unsubscribe */\n channel.unsubscribe(\"test_event\", testListener);\n } catch (AblyException e) {\n e.printStackTrace();\n fail(\"init0: Unexpected exception instantiating library\");\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "static void confirmSubscribe_C(Messenger messenger, Response_e response)\n {\n sendToClient( messenger, Request_e.Request_Subscribe_Event_C_en.valueOf(), response, null );\n }", "void subscribe();", "@Test\n public void testSearchRepositoryByQuerySuccess() throws Exception {\n TestSubscriber testSubscriber = new TestSubscriber();\n Observable<ApiSearchRepository> searchRepositoryObservable = githubApi.getSearchRepository(testedString, null);\n searchRepositoryObservable.subscribe(testSubscriber);\n testSubscriber.awaitTerminalEvent();\n testSubscriber.assertCompleted();\n }", "SubscriptionDetails subscribeToMessage(SubscribeToMessage cmd);", "public void testSendMessageEventRequest() {\n // Create a chat for each connection\n Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);\n\n // Create the message to send with the roster\n Message msg = new Message();\n msg.setSubject(\"Any subject you want\");\n msg.setBody(\"An interesting body comes here...\");\n // Add to the message all the notifications requests (offline, delivered, displayed,\n // composing)\n MessageEventManager.addNotificationsRequests(msg, true, true, true, true);\n\n // Send the message that contains the notifications request\n try {\n chat1.sendMessage(msg);\n } catch (Exception e) {\n fail(\"An error occured sending the message\");\n }\n }", "boolean hasSubscribe();", "private void subscribe() {\r\n\r\n OnUpdatePlayerSubscription subscription = OnUpdatePlayerSubscription.builder().build();\r\n subscriptionWatcher = awsAppSyncClient.subscribe(subscription);\r\n subscriptionWatcher.execute(subCallback);\r\n }", "@Test\n public void getPetByIdTest() {\n Long petId = null;\n // rx.Observable<Pet> apiObservable = api.getPetById(petId);\n // Subscriber<Pet> apiSubscriber = new Subscriber<Pet>() {\n // @Override\n // public void onNext(Pet dtoResponse) {\n // // TODO: test validations\n // Assert.assertNotNull(\"DTO Response should not be Null\", dtoResponse);\n // }\n\n // @Override\n // public void onCompleted() {\n // // TODO: test any post-processing\n // System.out.println(\"Api Call Complete\");\n // }\n\n // @Override\n // public void onError(Throwable e) {\n // // TODO: handle error scenario\n // System.out.println(e.getMessage());\n // }\n // };\n // apiObservable.subscribe(apiSubscriber);\n }", "void startChecking()\n {\n UnitModel model = new UnitModel();\n model.UNIT_ID = Globals.unitId;\n Observable<RoomMeetingsResponse> data = retrofitInterface.roomreservations(model);\n\n subscription = data\n .subscribeOn(Schedulers.newThread())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Subscriber<RoomMeetingsResponse>() {\n @Override\n public void onCompleted() {\n\n }\n\n @Override\n public void onError(Throwable e) {\n e.printStackTrace();\n\n }\n\n @Override\n public void onNext(RoomMeetingsResponse serviceResponse) {\n //sweetAlertDialog.hide();\n progress_rel.setVisibility(View.GONE);\n OngoingReactAsync(serviceResponse);\n }\n });\n }", "@Test\r\n\tpublic void t01_GetMessageAfterChange() throws Exception {\r\n\t\tSCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);\r\n\r\n\t\tsubscribeCall.setSessionInfo(TestConstants.publishMsgWithDelayCmd);\r\n\t\tsubscribeCall.setNoDataIntervalSeconds(10);\r\n\t\t// mask does not match\r\n\t\tsubscribeCall.setMask(TestConstants.mask1);\r\n\t\t// publish 10 messages, wait 11 second after publish each message\r\n\t\tsubscribeCall.setRequestBody(\"10|11000\");\r\n\t\tTestCallback cbk = new TestCallback(true);\r\n\t\tsubscribeCall.invoke(cbk, 3000);\r\n\t\tSCMPMessage reply = cbk.getMessageSync(2000);\r\n\t\tTestUtil.checkReply(reply);\r\n\t\tString sessionId = reply.getSessionId();\r\n\r\n\t\t// receive publication - no data\r\n\t\tSCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester, TestConstants.pubServerName1, sessionId);\r\n\t\treceivePublicationCall.invoke(cbk, 30000);\r\n\t\treply = cbk.getMessageSync(30000);\r\n\t\tAssert.assertTrue(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));\r\n\r\n\t\tSCMPClnChangeSubscriptionCall changeSubscriptionCall = new SCMPClnChangeSubscriptionCall(this.requester, TestConstants.pubServerName1, sessionId);\r\n\t\t// mask matches now\r\n\t\tchangeSubscriptionCall.setMask(TestConstants.mask);\r\n\t\tchangeSubscriptionCall.invoke(cbk, 3000);\r\n\t\tTestUtil.checkReply(cbk.getMessageSync(1000));\r\n\r\n\t\t// receive publication first message\r\n\t\treceivePublicationCall = new SCMPReceivePublicationCall(this.requester, TestConstants.pubServerName1, sessionId);\r\n\t\treceivePublicationCall.invoke(cbk, 10000);\r\n\t\treply = cbk.getMessageSync(10000);\r\n\t\tAssert.assertFalse(reply.getHeaderFlag(SCMPHeaderAttributeKey.NO_DATA));\r\n\r\n\t\tSCMPClnUnsubscribeCall unSubscribeCall = new SCMPClnUnsubscribeCall(this.requester, TestConstants.pubServerName1, sessionId);\r\n\t\tunSubscribeCall.invoke(cbk, 3000);\r\n\t\treply = cbk.getMessageSync(1000);\r\n\t\tTestUtil.checkReply(reply);\r\n\t}", "public boolean testConnection() {\r\n boolean toReturn = true;\r\n\r\n String[] paramFields = {};\r\n SocketMessage request = new SocketMessage(\"admin\", \"ping\", SocketMessage.PriorityType.EMERGENCY, SocketMessage.TransferType.BI_WAY, \"\", paramFields);\r\n SocketMessage response = handleMessage(request);\r\n if (isSuccessful(response)) {\r\n toReturn = true;\r\n } else {\r\n toReturn = false;\r\n }\r\n\r\n return toReturn;\r\n }", "@Test\n public void testSend200OkResponseWithoutBody() {\n String expected = \"RTSP/1.0 200 OK\\r\\n\" + (((\"server: Testserver\\r\\n\" + \"cseq: 1\\r\\n\") + \"session: 2547019973447939919\\r\\n\") + \"\\r\\n\");\n HttpResponse response = new io.netty.handler.codec.http.DefaultHttpResponse(RTSP_1_0, OK);\n response.headers().add(SERVER, \"Testserver\");\n response.headers().add(CSEQ, \"1\");\n response.headers().add(SESSION, \"2547019973447939919\");\n EmbeddedChannel ch = new EmbeddedChannel(new RtspEncoder());\n ch.writeOutbound(response);\n ByteBuf buf = ch.readOutbound();\n String actual = buf.toString(UTF_8);\n buf.release();\n Assert.assertEquals(expected, actual);\n }", "@Test\n public void attach_implicit_subscribe_fail() throws AblyException {\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[1].keyStr);\n ably = new AblyRealtime(opts);\n\n /* wait until connected */\n new ConnectionWaiter(ably.connection).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", ably.connection.state, ConnectionState.connected);\n\n /* create a channel and subscribe */\n final Channel channel = ably.channels.get(\"subscribe_fail\");\n channel.subscribe(null);\n assertEquals(\"Verify attaching state reached\", channel.state, ChannelState.attaching);\n\n ErrorInfo fail = new ChannelWaiter(channel).waitFor(ChannelState.failed);\n assertEquals(\"Verify failed state reached\", channel.state, ChannelState.failed);\n assertEquals(\"Verify reason code gives correct failure reason\", fail.statusCode, 401);\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "@Test\n public void addPetTest() {\n Pet body = null;\n // rx.Observable<Object> apiObservable = api.addPet(body);\n // Subscriber<Object> apiSubscriber = new Subscriber<Object>() {\n // @Override\n // public void onNext(Object dtoResponse) {\n // // TODO: test validations\n // Assert.assertNotNull(\"DTO Response should not be Null\", dtoResponse);\n // }\n\n // @Override\n // public void onCompleted() {\n // // TODO: test any post-processing\n // System.out.println(\"Api Call Complete\");\n // }\n\n // @Override\n // public void onError(Throwable e) {\n // // TODO: handle error scenario\n // System.out.println(e.getMessage());\n // }\n // };\n // apiObservable.subscribe(apiSubscriber);\n }", "private void itCanPubAndSubToBroker(final String brokerUrl)\n throws Throwable {\n final MqttAsyncClient pubClient = new MqttAsyncClient(brokerUrl,\n CLIENT_ID + \"-pub\");\n AsyncPahoUtils.connect(pubClient);\n final MqttAsyncClient subClient = new MqttAsyncClient(brokerUrl,\n CLIENT_ID + \"-sub\");\n AsyncPahoUtils.connect(subClient);\n\n final CountDownLatch latch = new CountDownLatch(1);\n final AtomicReference<MqttMessage> msg = new AtomicReference<MqttMessage>();\n\n // Subscribe\n final IMqttMessageListener messageListener = new IMqttMessageListener() {\n\n @Override\n public void messageArrived(final String topic,\n final MqttMessage message) throws Exception {\n msg.set(message);\n latch.countDown();\n }\n };\n AsyncPahoUtils.subscribe(subClient, TOPIC, messageListener);\n\n // Publish the sensor data\n final byte[] expectedPayload = new byte[] { 'a', 'b', 'c' };\n AsyncPahoUtils.publish(pubClient, TOPIC, expectedPayload);\n\n // Await message publish and receipt\n latch.await();\n\n // Get the message received by the callback\n final MqttMessage receivedMessage = msg.get();\n Assert.assertNotNull(receivedMessage);\n Assert.assertNotNull(receivedMessage.getPayload());\n Assert.assertArrayEquals(expectedPayload, receivedMessage.getPayload());\n\n // Close the clients\n AsyncPahoUtils.disconnect(pubClient);\n AsyncPahoUtils.disconnect(subClient);\n\n }", "@Test\n public void findPetsByStatusTest() {\n List<String> status = null;\n // rx.Observable<List<Pet>> apiObservable = api.findPetsByStatus(status);\n // Subscriber<List<Pet>> apiSubscriber = new Subscriber<List<Pet>>() {\n // @Override\n // public void onNext(List<Pet> dtoResponse) {\n // // TODO: test validations\n // Assert.assertNotNull(\"DTO Response should not be Null\", dtoResponse);\n // }\n\n // @Override\n // public void onCompleted() {\n // // TODO: test any post-processing\n // System.out.println(\"Api Call Complete\");\n // }\n\n // @Override\n // public void onError(Throwable e) {\n // // TODO: handle error scenario\n // System.out.println(e.getMessage());\n // }\n // };\n // apiObservable.subscribe(apiSubscriber);\n }", "@Test\n void awaitMessage() {\n\n Message message = null;\n TempBroadcast b = new TempBroadcast(\"broadcastSender2\");\n\n broadcastReceiver.subscribeBroadcast(TempBroadcast.class, c -> {\n });\n broadcastSender.sendBroadcast(b);\n\n // here we will check the method\n try {\n message = messageBus.awaitMessage(broadcastReceiver);\n\n } catch (InterruptedException e) {\n e.printStackTrace();\n //due to the assumption above, an exception is not supposed to be thrown\n }\n assertEquals(b, message);\n }", "@Test\n public void channelTest() {\n // TODO: test channel\n }", "@Test\n public void subscribe_all() throws AblyException {\n /* Ably instance that will emit channel messages */\n AblyRealtime ably1 = null;\n /* Ably instance that will receive channel messages */\n AblyRealtime ably2 = null;\n\n String channelName = \"test.channel.subscribe.all\" + System.currentTimeMillis();\n Message[] messages = new Message[]{\n new Message(\"name1\", \"Lorem ipsum dolor sit amet,\"),\n new Message(\"name2\", \"Consectetur adipiscing elit.\"),\n new Message(\"name3\", \"Pellentesque nulla lorem.\")\n };\n\n try {\n ClientOptions option1 = createOptions(testVars.keys[0].keyStr);\n option1.clientId = \"emitter client\";\n ClientOptions option2 = createOptions(testVars.keys[0].keyStr);\n option2.clientId = \"receiver client\";\n\n ably1 = new AblyRealtime(option1);\n ably2 = new AblyRealtime(option2);\n\n Channel channel1 = ably1.channels.get(channelName);\n channel1.attach();\n new ChannelWaiter(channel1).waitFor(ChannelState.attached);\n\n Channel channel2 = ably2.channels.get(channelName);\n channel2.attach();\n new ChannelWaiter(channel2).waitFor(ChannelState.attached);\n\n /* Create a listener that collects received messages */\n ArrayList<Message> receivedMessageStack = new ArrayList<>();\n MessageListener listener = new MessageListener() {\n List<Message> messageStack;\n\n @Override\n public void onMessage(Message message) {\n messageStack.add(message);\n }\n\n public MessageListener setMessageStack(List<Message> messageStack) {\n this.messageStack = messageStack;\n return this;\n }\n }.setMessageStack(receivedMessageStack);\n\n channel2.subscribe(listener);\n\n /* Start emitting channel with ably client 1 (emitter) */\n channel1.publish(messages, null);\n\n /* Wait until receiver client (ably2) observes {@code }\n * is emitted from emitter client (ably1)\n */\n new Helpers.MessageWaiter(channel2).waitFor(messages.length);\n\n /* Validate that,\n * - we received every message that has been published\n */\n assertThat(receivedMessageStack.size(), is(equalTo(messages.length)));\n\n Collections.sort(receivedMessageStack, messageComparator);\n for (int i = 0; i < messages.length; i++) {\n Message message = messages[i];\n if(Collections.binarySearch(receivedMessageStack, message, messageComparator) < 0) {\n fail(\"Unable to find expected message: \" + message);\n }\n }\n } finally {\n if (ably1 != null) ably1.close();\n if (ably2 != null) ably2.close();\n }\n }", "@Test\n\tpublic void testPublisherAndSubscriber() throws Exception {\n\t\tString address = \"kafka://[localhost:9092]&topic=junk\";\n\n\t\tZPublisher z = new ZPublisher(address);\n CountDownLatch latch = new CountDownLatch(2);\n\n List list = new ArrayList();\n\n com.jacamars.dsp.rtb.jmq.RTopic channel = new com.jacamars.dsp.rtb.jmq.RTopic(\"kafka://[localhost:9092]&topic=junk\");\n channel.addListener(new com.jacamars.dsp.rtb.jmq.MessageListener<String>() {\n @Override\n public void onMessage(String channel, String data) {\n System.out.println(\"<<<<<<<<<<<<<<<<<\" + data);\n list.add(data);\n // latch.countDown();\n }\n });\n\n com.jacamars.dsp.rtb.jmq.RTopic channel2= new com.jacamars.dsp.rtb.jmq.RTopic(\"kafka://[localhost:9092]&topic=junk\");\n channel2.addListener(new com.jacamars.dsp.rtb.jmq.MessageListener<String>() {\n @Override\n public void onMessage(String channel, String data) {\n System.out.println(\"================\" + data);\n list.add(data);\n\n }\n });\n\n\n z.add(\"Hello world\");\n z.add(\"Another Hello world\");\n\n Thread.sleep(15000);\n\t}", "void subscribe(String id);", "@Test\n public void testHttpForNotConnected() throws Exception {\n \n final CountDownLatch unsubscribed = new CountDownLatch(1);\n \n final TestChannelCreator creator = new TestChannelCreator();\n final DefaultHttpClient client = new DefaultHttpClient(creator, ENABLE_LOGGING);\n // NOT setup server for local channel\n final TestSubscriber<HttpObject> testSubscriber = new TestSubscriber<HttpObject>();\n final OnNextSensor<HttpObject> nextSensor = new OnNextSensor<HttpObject>();\n try {\n client.defineInteraction(new LocalAddress(\"test\"), \n Observable.<HttpObject>just(fullHttpRequest()).doOnNext(nextSensor))\n .compose(RxFunctions.<HttpObject>countDownOnUnsubscribe(unsubscribed))\n .subscribe(testSubscriber);\n \n unsubscribed.await();\n \n testSubscriber.awaitTerminalEvent();\n assertEquals(1, creator.getChannels().size());\n creator.getChannels().get(0).assertClosed(1);\n } finally {\n client.close();\n assertEquals(0, testSubscriber.getOnNextEvents().size());\n assertEquals(0, testSubscriber.getCompletions());\n assertEquals(1, testSubscriber.getOnErrorEvents().size());\n nextSensor.assertNotCalled();\n }\n }", "private void doSubscribe(IoSession session, MessageProtocol request) throws Exception {\n \tbyte[] msg = request.getMessage();\n \t\n \tif (msg == null) {\n \t\t// 用户名不能为空: 06 ff 01 00 01 00 00\n \t\tLOGGER.warn(\"username required.\");\n \t\tdoResponse(session, new MessageProtocol((byte) 0x06, MessageConstants.MESSAGE_VERSION, MessageConstants.MESSAGE_SUBSCRIBE, (byte) 0, new byte[]{1}, (short) 0));\n \t\treturn;\n \t} \n\n\t\tString user = new String(msg, MessageConstants.CHARSET_UTF8);\n\t\t\n\t\t// step 2\n\t\tint channel = request.getChannel();\n\t\tSet<IoSession> receivers = channels.get(channel);\n\t\t\n\t\tif (receivers == null) {\n\t\t\t// 订阅频道不存在: 06 ff 01 00 02 00 00\n\t\t\tLOGGER.warn(\"channel not found: \" + channel);\n\t\t\tdoResponse(session, new MessageProtocol((byte) 0x06, MessageConstants.MESSAGE_VERSION, MessageConstants.MESSAGE_SUBSCRIBE, (byte) 0, new byte[]{2}, (short) 0));\n\t\t\treturn;\n\t\t}\n \t\n\t\t// step 3\n\t\tsynchronized (users) {\n \tif (users.contains(user)) {\n \t\t// 用户名已存在: 06 ff 01 00 03 00 00\n \t\tLOGGER.warn(\"user found: \" + user);\n \t\tdoResponse(session, new MessageProtocol((byte) 0x06, MessageConstants.MESSAGE_VERSION, MessageConstants.MESSAGE_SUBSCRIBE, (byte) 0, new byte[]{3}, (short) 0));\n \t\treturn;\n \t} else {\n \t\tusers.add(user);\n \t}\n\t\t}\n\t\t\n\t\t// step 4\n\t\tsession.setAttribute(MessageConstants.KEY_USERNAME, user);\n\t\tsession.setAttribute(MessageConstants.KEY_CHANNEL, channel);\n\t\treceivers.add(session);\n\t\t\n\t\tLOGGER.info(\"doSubscribe: user = \" + user + \", users = \"+ users.size() + \", channel = \" + channel + \", receivers = \" + receivers.size());\n\t\t// 返回订阅成功命令: 06 ff 01 00 00 00 00\n\t\tdoResponse(session, new MessageProtocol((byte) 0x06, MessageConstants.MESSAGE_VERSION, MessageConstants.MESSAGE_SUBSCRIBE, (byte) 0, new byte[]{0}, (short) 0));\n }", "boolean shouldAutoSubscribe();", "@Test\n public void updatePetTest() {\n Pet body = null;\n // rx.Observable<Object> apiObservable = api.updatePet(body);\n // Subscriber<Object> apiSubscriber = new Subscriber<Object>() {\n // @Override\n // public void onNext(Object dtoResponse) {\n // // TODO: test validations\n // Assert.assertNotNull(\"DTO Response should not be Null\", dtoResponse);\n // }\n\n // @Override\n // public void onCompleted() {\n // // TODO: test any post-processing\n // System.out.println(\"Api Call Complete\");\n // }\n\n // @Override\n // public void onError(Throwable e) {\n // // TODO: handle error scenario\n // System.out.println(e.getMessage());\n // }\n // };\n // apiObservable.subscribe(apiSubscriber);\n }", "public synchronized void sendResponseIfReady() throws IOException {\n getConnection().channel.write(response).addListener(new CallWriteListener(this));\n }", "@Test(expected = SubscriberTypeMismatchException.class)\r\n\tpublic void aTestInvalidSubscribe() {\r\n\t\tbroker.subscribe(new IntegerSubscriber(), Boolean.class);\r\n\t}", "@Test\n public void testProcessNoResponse() {\n // NOTE: this json file is a RESPONSE, not a request\n String request = ResourceUtils.getResourceAsString(\"org/onap/policy/simulators/appclcm/appc.lcm.success.json\");\n assertNotNull(request);\n\n server.onTopicEvent(CommInfrastructure.NOOP, MY_TOPIC, request);\n\n verify(sink, never()).send(any());\n }", "@Test\n public void testControlResponses() throws Exception {\n createTethering(\"xyz\", NAMESPACES, REQUEST_TIME, DESCRIPTION);\n acceptTethering();\n TetheringControlResponseV2 expectedResponse =\n new TetheringControlResponseV2(Collections.emptyList(), TetheringStatus.ACCEPTED);\n\n expectTetheringControlResponse(\"xyz\", HttpResponseStatus.OK, GSON.toJson(expectedResponse));\n\n // Queue up a couple of messages for the peer\n MessagePublisher publisher =\n new MultiThreadMessagingContext(messagingService).getMessagePublisher();\n String topicPrefix = cConf.get(Constants.Tethering.CLIENT_TOPIC_PREFIX);\n String topic = topicPrefix + \"xyz\";\n TetheringLaunchMessage launchMessage =\n new TetheringLaunchMessage.Builder()\n .addFileNames(DistributedProgramRunner.LOGBACK_FILE_NAME)\n .addFileNames(DistributedProgramRunner.PROGRAM_OPTIONS_FILE_NAME)\n .addFileNames(DistributedProgramRunner.APP_SPEC_FILE_NAME)\n .addRuntimeNamespace(\"default\")\n .build();\n TetheringControlMessage message1 =\n new TetheringControlMessage(\n TetheringControlMessage.Type.START_PROGRAM, Bytes.toBytes(GSON.toJson(launchMessage)));\n publisher.publish(NamespaceId.SYSTEM.getNamespace(), topic, GSON.toJson(message1));\n ProgramRunInfo programRunInfo =\n new ProgramRunInfo.Builder()\n .setNamespace(\"ns\")\n .setApplication(\"app\")\n .setVersion(\"1.0\")\n .setProgramType(\"workflow\")\n .setProgram(\"program\")\n .setRun(\"runId\")\n .build();\n TetheringControlMessage message2 =\n new TetheringControlMessage(\n TetheringControlMessage.Type.STOP_PROGRAM, Bytes.toBytes(GSON.toJson(programRunInfo)));\n publisher.publish(NamespaceId.SYSTEM.getNamespace(), topic, GSON.toJson(message2));\n\n // Poll the server\n HttpRequest.Builder builder =\n HttpRequest.builder(HttpMethod.POST, config.resolveURL(\"tethering/channels/xyz\"))\n .withBody(GSON.toJson(new TetheringControlChannelRequest(null, null)));\n\n // Response should contain 2 messages\n HttpResponse response = HttpRequests.execute(builder.build());\n TetheringControlResponseV2 controlResponse =\n GSON.fromJson(response.getResponseBodyAsString(), TetheringControlResponseV2.class);\n List<TetheringControlMessageWithId> controlMessages = controlResponse.getControlMessages();\n\n Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode());\n Assert.assertEquals(2, controlMessages.size());\n Assert.assertEquals(message1, controlMessages.get(0).getControlMessage());\n Assert.assertEquals(message2, controlMessages.get(1).getControlMessage());\n\n // Poll again with lastMessageId set to id of last message received from the server\n String lastMessageId = controlMessages.get(1).getMessageId();\n builder =\n HttpRequest.builder(HttpMethod.POST, config.resolveURL(\"tethering/channels/xyz\"))\n .withBody(GSON.toJson(new TetheringControlChannelRequest(lastMessageId, null)));\n\n // There should be no more messages queued up for this client\n response = HttpRequests.execute(builder.build());\n controlResponse =\n GSON.fromJson(response.getResponseBodyAsString(), TetheringControlResponseV2.class);\n Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode());\n Assert.assertEquals(0, controlResponse.getControlMessages().size());\n }", "private void test1() {\n Observable observable = Observable.create(new ObservableOnSubscribe<QuoteBean>() {\n @Override\n public void subscribe(ObservableEmitter<QuoteBean> e) throws Exception {\n e.onNext(Request.stringRequest(url, com.android.volley.Request.Method.GET, HomeActivity.class.getSimpleName()));\n }\n }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());\n\n Observer<QuoteBean> observer = new Observer<QuoteBean>() {\n @Override\n public void onSubscribe(Disposable d) {\n Log.d(TAG, \"test1 onSubscribe\");\n }\n\n @Override\n public void onNext(QuoteBean s) {\n Log.d(TAG, \"onNext:\" + s.toString());\n }\n\n @Override\n public void onError(Throwable e) {\n Log.d(TAG, \"onError\");\n }\n\n @Override\n public void onComplete() {\n Log.d(TAG, \"onComplete\");\n }\n };\n observable.subscribe(observer);\n }", "@Override\n public boolean subscribe(Task data) {\n return true;\n }", "@Override\n public void onSubscribe(String channel, int subscribedChannels) {\n System.out.println(\"Client is Subscribed to channel : \"+ channel);\n }", "private void subscribeMqttTopic(String t){\n\n String topic = \"secureIoT\" + t;\n\n int qos = 1;\n try {\n IMqttToken subToken = mqttClient.subscribe(topic, qos);\n subToken.setActionCallback(new IMqttActionListener() {\n @Override\n public void onSuccess(IMqttToken asyncActionToken) {\n // subscription successful\n\n mqttClient.setCallback(new MqttCallback() {\n @Override\n public void connectionLost(Throwable cause) {\n Log.d(LOG_TAG, \"Connection Lost\");\n }\n\n @Override\n public void messageArrived(String topic, MqttMessage message) throws Exception {\n\n Log.d(LOG_TAG, message.toString());\n handleMessage(message);\n }\n\n @Override\n public void deliveryComplete(IMqttDeliveryToken token) {\n Log.d(LOG_TAG, \"Delivery Complete\");\n }\n });\n\n }\n\n @Override\n public void onFailure(IMqttToken asyncActionToken,\n Throwable exception) {\n // The subscription could not be performed, maybe the user was not\n // authorized to subscribe on the specified topic e.g. using wildcards\n }\n\n\n });\n } catch (MqttException e) {\n e.printStackTrace();\n }\n\n }", "public void onSubscribe() {\n\n }", "void subscribe(Player player);", "private void test() {\n Observable<String> observable = Observable.create(new ObservableOnSubscribe<String>() {\n\n @Override\n public void subscribe(ObservableEmitter<String> e) throws Exception {\n e.onNext(\"hello\");\n e.onNext(\"RXJAVA\");\n e.onComplete();\n }\n }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());\n\n Observer<String> observer = new Observer<String>() {\n @Override\n public void onSubscribe(Disposable d) {\n Log.d(TAG, \"onSubscribe\");\n }\n\n @Override\n public void onNext(String s) {\n Log.d(TAG, \"onNext:\" + s);\n }\n\n @Override\n public void onError(Throwable e) {\n Log.d(TAG, \"onError\");\n }\n\n @Override\n public void onComplete() {\n Log.d(TAG, \"onComplete\");\n }\n };\n observable.subscribe(observer);\n }", "@Ignore(\"FIXME: fix exception\")\n @Test\n public void transient_publish_connected() throws AblyException {\n AblyRealtime pubAbly = null, subAbly = null;\n String channelName = \"transient_publish_connected_\" + testParams.name;\n try {\n ClientOptions opts = createOptions(testVars.keys[0].keyStr);\n subAbly = new AblyRealtime(opts);\n\n /* wait until connected */\n new ConnectionWaiter(subAbly.connection).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", subAbly.connection.state, ConnectionState.connected);\n\n /* create a channel and subscribe */\n final Channel subChannel = subAbly.channels.get(channelName);\n Helpers.MessageWaiter messageWaiter = new Helpers.MessageWaiter(subChannel);\n new ChannelWaiter(subChannel).waitFor(ChannelState.attached);\n\n pubAbly = new AblyRealtime(opts);\n new ConnectionWaiter(pubAbly.connection).waitFor(ConnectionState.connected);\n Helpers.CompletionWaiter completionWaiter = new Helpers.CompletionWaiter();\n final Channel pubChannel = pubAbly.channels.get(channelName);\n pubChannel.publish(\"Lorem\", \"Ipsum!\", completionWaiter);\n assertEquals(\"Verify channel remains in initialized state\", pubChannel.state, ChannelState.initialized);\n\n ErrorInfo errorInfo = completionWaiter.waitFor();\n assertEquals(\"Verify channel remains in initialized state\", pubChannel.state, ChannelState.initialized);\n\n messageWaiter.waitFor(1);\n assertEquals(\"Verify expected message received\", messageWaiter.receivedMessages.get(0).name, \"Lorem\");\n } finally {\n if(pubAbly != null) {\n pubAbly.close();\n }\n if(subAbly != null) {\n subAbly.close();\n }\n }\n }", "@Test\n public void shouldEmitEvents() {\n Observable.just('A', 'B', 'C')\n .subscribeOn(scheduler)\n .subscribe(subscriber);\n\n scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);\n subscriber.assertCompleted();\n subscriber.assertValueCount(3);\n subscriber.assertValues('A', 'B', 'C');\n\n TimeDelayer.sleepForOneSecond();\n }", "@Test\n public void testBroadcastedTransactionDeserializer(){\n try{\n mMessagesHub = new SubscriptionMessagesHub(\"\", \"\", mErrorListener);\n mMessagesHub.addSubscriptionListener(new SubscriptionListener() {\n private int MAX_MESSAGES = 15;\n private int messageCounter = 0;\n\n @Override\n public ObjectType getInterestObjectType() {\n return ObjectType.TRANSACTION_OBJECT;\n }\n\n @Override\n public void onSubscriptionUpdate(SubscriptionResponse response) {\n if(response.params.size() == 2){\n List<Serializable> payload = (List) response.params.get(1);\n if(payload.size() > 0){\n for(Serializable item : payload){\n if(item instanceof BroadcastedTransaction){\n BroadcastedTransaction broadcastedTransaction = (BroadcastedTransaction) item;\n Transaction tx = broadcastedTransaction.getTransaction();\n System.out.println(String.format(\"Got %d operations\", tx.getOperations().size()));\n }\n }\n }\n }\n\n // Waiting for MAX_MESSAGES messages before releasing the wait lock\n messageCounter++;\n if(messageCounter > MAX_MESSAGES){\n synchronized (SubscriptionMessagesHubTest.this){\n SubscriptionMessagesHubTest.this.notifyAll();\n }\n }\n }\n });\n\n mWebSocket.addListener(mMessagesHub);\n mWebSocket.connect();\n\n // Holding this thread while we get update notifications\n synchronized (this){\n wait();\n }\n } catch (WebSocketException e) {\n System.out.println(\"WebSocketException. Msg: \" + e.getMessage());\n } catch (InterruptedException e) {\n System.out.println(\"InterruptedException. Msg: \"+e.getMessage());\n }\n }", "@Test\n public void testSuccess() throws Exception {\n\n client.makeBooking(\"Paul\", new Date(System.currentTimeMillis()), false);\n\n BookingStatus bookingStatus = client.getLastBookingStatus();\n Assert.assertTrue(\"Expected booking to be confirmed, but it wasn't: \" + bookingStatus, bookingStatus.equals(BookingStatus.CONFIRMED));\n }", "@Test\n public void testSendMessage()\n {\n System.out.println(\"sendMessage\");\n Account sender = new Account(\"Henk\");\n String message = \"Test\";\n Party instance = new Party(sender);\n boolean expResult = true;\n boolean result = instance.sendMessage(sender, message);\n assertEquals(\"The message gave a 'not send' answer.\", expResult, result);\n ArrayList<Message> chat = instance.getChat();\n boolean result2 = false;\n for (Message chatMessage : chat)\n {\n if (chatMessage.getText().equals(message))\n {\n result2 = true;\n break;\n }\n }\n assertEquals(\"The message isn't in the chat.\", expResult, result2);\n }", "void subscribe(Long subscriptionId, ApplicationProperties.VendorConfiguration configuration);", "public void testSendMessageEventRequestAndDisplayNotifications() {\n // Create a chat for each connection\n Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);\n\n MessageEventManager messageEventManager = new MessageEventManager(getConnection(0));\n messageEventManager\n .addMessageEventNotificationListener(new MessageEventNotificationListener() {\n public void deliveredNotification(String from, String packetID) {\n System.out.println(\"From: \" + from + \" PacketID: \" + packetID + \"(delivered)\");\n }\n\n public void displayedNotification(String from, String packetID) {\n System.out.println(\"From: \" + from + \" PacketID: \" + packetID + \"(displayed)\");\n }\n\n public void composingNotification(String from, String packetID) {\n System.out.println(\"From: \" + from + \" PacketID: \" + packetID + \"(composing)\");\n }\n\n public void offlineNotification(String from, String packetID) {\n System.out.println(\"From: \" + from + \" PacketID: \" + packetID + \"(offline)\");\n }\n\n public void cancelledNotification(String from, String packetID) {\n System.out.println(\"From: \" + from + \" PacketID: \" + packetID + \"(cancelled)\");\n }\n });\n\n // Create the message to send with the roster\n Message msg = new Message();\n msg.setSubject(\"Any subject you want\");\n msg.setBody(\"An interesting body comes here...\");\n // Add to the message all the notifications requests (offline, delivered, displayed,\n // composing)\n MessageEventManager.addNotificationsRequests(msg, true, true, true, true);\n\n // Send the message that contains the notifications request\n try {\n chat1.sendMessage(msg);\n // Wait a few seconds so that the XMPP client can send any event\n Thread.sleep(200);\n } catch (Exception e) {\n fail(\"An error occured sending the message\");\n }\n }", "@Override\n public void onSuccess(IMqttToken asyncActionToken) {\n String topic = uniqueId+\"/\"+chipid+\"/addCommand\";\n int qos = 1;\n try {\n IMqttToken subToken = client.subscribe(topic, qos);\n subToken.setActionCallback(new IMqttActionListener() {\n @Override\n public void onSuccess(IMqttToken asyncActionToken) {\n MqttCallback mqttCallback = new MqttCallback() {\n\n @Override\n public void connectionLost(Throwable cause) {\n //COMMAND FAIL\n imgCommandPopup.setVisibility(View.INVISIBLE);\n textWaiting.setVisibility(View.INVISIBLE);\n // failed.setVisibility(View.VISIBLE);\n // commandStatus(textCommandPopup,getResources().getString(R.string.command_add_failed),fadePopup,CommandPopup);\n }\n\n @Override\n public void messageArrived(String topic, MqttMessage message) throws Exception {\n espResponse = message.toString();\n // Toast.makeText(TempCom.this, espResponse, Toast.LENGTH_SHORT).show();\n client.disconnect();\n }\n\n @Override\n public void deliveryComplete(IMqttDeliveryToken token) {}\n };\n client.setCallback(mqttCallback);\n }\n\n @Override\n public void onFailure(IMqttToken asyncActionToken, Throwable exception) {\n //COMMAND FAIL\n imgCommandPopup.setVisibility(View.INVISIBLE);\n textWaiting.setVisibility(View.INVISIBLE);\n failed.setVisibility(View.VISIBLE);\n commandStatus(textCommandPopup,getResources().getString(R.string.command_add_failed),fadePopup,CommandPopup);\n }\n });\n } catch (MqttException e) {\n e.printStackTrace();\n }\n }", "private void subscribeHandler(MqttSubscribeMessage subscribe) {\n\n final int messageId = subscribe.messageId();\n LOG.info(\"SUBSCRIBE [{}] from MQTT client {}\", messageId, this.mqttEndpoint.clientIdentifier());\n\n // sending AMQP_SUBSCRIBE\n\n List<AmqpTopicSubscription> topicSubscriptions =\n subscribe.topicSubscriptions().stream().map(topicSubscription -> {\n return new AmqpTopicSubscription(topicSubscription.topicName(), topicSubscription.qualityOfService());\n }).collect(Collectors.toList());\n\n AmqpSubscribeMessage amqpSubscribeMessage =\n new AmqpSubscribeMessage(this.mqttEndpoint.clientIdentifier(),\n topicSubscriptions);\n\n this.ssEndpoint.sendSubscribe(amqpSubscribeMessage, done -> {\n\n if (done.succeeded()) {\n\n ProtonDelivery delivery = done.result();\n\n List<MqttQoS> grantedQoSLevels = null;\n if (delivery.getRemoteState() == Accepted.getInstance()) {\n\n // QoS levels requested are granted\n grantedQoSLevels = amqpSubscribeMessage.topicSubscriptions().stream().map(topicSubscription -> {\n return topicSubscription.qos();\n }).collect(Collectors.toList());\n\n // add accepted topic subscriptions to the local collection\n amqpSubscribeMessage.topicSubscriptions().stream().forEach(amqpTopicSubscription -> {\n this.grantedQoSLevels.put(amqpTopicSubscription.topic(), amqpTopicSubscription.qos());\n });\n\n } else {\n\n // failure for all QoS levels requested\n grantedQoSLevels = new ArrayList<>(Collections.nCopies(amqpSubscribeMessage.topicSubscriptions().size(), MqttQoS.FAILURE));\n }\n\n this.mqttEndpoint.subscribeAcknowledge(messageId, grantedQoSLevels);\n\n LOG.info(\"SUBACK [{}] to MQTT client {}\", messageId, this.mqttEndpoint.clientIdentifier());\n }\n });\n }", "public void expect() throws IOException\n\t{\n\t\tString response = mClient.rx();\n\t\t\n\t\tif(mListener != null)\n\t\t\tmListener.onResponse(this, response);\n\t}", "boolean add(Client client, Subscription subscription);", "@Test\n public void addition_isCorrect() throws Exception {\n\n\n DeviceConfigIdentity identity = new DeviceConfigIdentity(\"bo5aph\",\"typedevice\",\"pidevice\");\n DeviceConfigAuth auth = new DeviceConfigAuth(\"123456789\");\n DeviceConfigOptions options = new DeviceConfigOptions();\n options.mqtt.port = 8883;\n options.mqtt.keepAlive = 1;\n DeviceConfig config = new DeviceConfig(identity, auth,options);\n DeviceClient deviceClient2 = new DeviceClient(config);\n deviceClient2.registerCodec(new JsonCodec());\n deviceClient2.connect();\n JsonObject data = new JsonObject();\n data.addProperty(\"mode\", \"manual\");\n data.addProperty(\"dir\", \"F\");\n data.addProperty(\"speed\", \"100\");\n deviceClient2.publishEvent(\"data\", data);\n\n deviceClient2.disconnect();\n }", "public void testRequestsAndNotifications() {\n final ArrayList<String> results = new ArrayList<String>();\n ArrayList<String> resultsExpected = new ArrayList<String>();\n resultsExpected.add(\"deliveredNotificationRequested\");\n resultsExpected.add(\"composingNotificationRequested\");\n resultsExpected.add(\"displayedNotificationRequested\");\n resultsExpected.add(\"offlineNotificationRequested\");\n resultsExpected.add(\"deliveredNotification\");\n resultsExpected.add(\"displayedNotification\");\n resultsExpected.add(\"composingNotification\");\n resultsExpected.add(\"cancelledNotification\");\n\n // Create a chat for each connection\n Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);\n\n MessageEventManager messageEventManager1 = new MessageEventManager(getConnection(0));\n messageEventManager1\n .addMessageEventNotificationListener(new MessageEventNotificationListener() {\n public void deliveredNotification(String from, String packetID) {\n results.add(\"deliveredNotification\");\n }\n\n public void displayedNotification(String from, String packetID) {\n results.add(\"displayedNotification\");\n }\n\n public void composingNotification(String from, String packetID) {\n results.add(\"composingNotification\");\n }\n\n public void offlineNotification(String from, String packetID) {\n results.add(\"offlineNotification\");\n }\n\n public void cancelledNotification(String from, String packetID) {\n results.add(\"cancelledNotification\");\n }\n });\n\n MessageEventManager messageEventManager2 = new MessageEventManager(getConnection(1));\n messageEventManager2\n .addMessageEventRequestListener(new DefaultMessageEventRequestListener() {\n public void deliveredNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.deliveredNotificationRequested(from, packetID, messageEventManager);\n results.add(\"deliveredNotificationRequested\");\n }\n\n public void displayedNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.displayedNotificationRequested(from, packetID, messageEventManager);\n results.add(\"displayedNotificationRequested\");\n }\n\n public void composingNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.composingNotificationRequested(from, packetID, messageEventManager);\n results.add(\"composingNotificationRequested\");\n }\n\n public void offlineNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.offlineNotificationRequested(from, packetID, messageEventManager);\n results.add(\"offlineNotificationRequested\");\n }\n });\n\n // Create the message to send with the roster\n Message msg = new Message();\n msg.setSubject(\"Any subject you want\");\n msg.setBody(\"An interesting body comes here...\");\n // Add to the message all the notifications requests (offline, delivered, displayed,\n // composing)\n MessageEventManager.addNotificationsRequests(msg, true, true, true, true);\n\n // Send the message that contains the notifications request\n try {\n chat1.sendMessage(msg);\n messageEventManager2.sendDisplayedNotification(getBareJID(0), msg.getPacketID());\n messageEventManager2.sendComposingNotification(getBareJID(0), msg.getPacketID());\n messageEventManager2.sendCancelledNotification(getBareJID(0), msg.getPacketID());\n // Wait up to 2 seconds\n long initial = System.currentTimeMillis();\n while (System.currentTimeMillis() - initial < 2000 &&\n (!results.containsAll(resultsExpected))) {\n Thread.sleep(100);\n }\n assertTrue(\n \"Test failed due to bad results (1)\" + resultsExpected,\n resultsExpected.containsAll(results));\n assertTrue(\n \"Test failed due to bad results (2)\" + results,\n results.containsAll(resultsExpected));\n\n } catch (Exception e) {\n fail(\"An error occured sending the message\");\n }\n }", "void responseReady(String response);", "public synchronized void alertOK() {\n\t\ttry {\n\t\t\tvListen.sendOK();\n\t\t} catch (IOException exc) {\n\t\t\terrorIOError();\n\t\t}\n\t}", "@Test\n\tpublic void testSayMessageOnRequest(){\n\t\tSystem.out.println(\"\\nMensajes aleatorios al aparecer el Meesek:\\n\");\n\t\tMrMe.sayMessageOnRequest();\n\t\tMrMe.sayMessageOnRequest();\n\t\tMrMe.sayMessageOnRequest();\n\t}", "@Test\n public void testGetChat()\n {\n System.out.println(\"getChat\");\n Account account = new Account(\"Bob\");\n Party instance = new Party(account);\n instance.sendMessage(account, \"Test\");\n boolean expResult = true;\n boolean result = false;\n for (Message chatMessage : instance.getChat())\n {\n if (chatMessage.getText().equals(\"Test\"))\n {\n result = true;\n break;\n }\n }\n assertEquals(\"There are no messages in the chat.\", expResult, result);\n }", "messages.Facademessages.Subscribe getSubscribe();", "public void subscribe(SubscriberInterface subscriber, UUID clientId) throws RemoteException;", "public void receivedOkayMessage();", "@Override\n public void onSubscribe(Subscription s) {\n s.request(10);\n\n // Should not produce anymore data\n s.request(10);\n }", "@Test\n public void testLocalClient()\n {\n generateEvents(\"local-client\");\n checkEvents(true, false);\n }", "@Test\n public void testReplyFromClient(TestContext context) {\n NetClient client = vertx.createNetClient();\n final Async async = context.async();\n final String address = \"test\";\n client.connect(7000, \"localhost\").onComplete(context.asyncAssertSuccess(socket -> {\n\n final FrameParser parser = new FrameParser(parse -> {\n context.assertTrue(parse.succeeded());\n JsonObject frame = parse.result();\n if (\"message\".equals(frame.getString(\"type\"))) {\n context.assertEquals(true, frame.getBoolean(\"send\"));\n context.assertEquals(\"Vert.x\", frame.getJsonObject(\"body\").getString(\"value\"));\n FrameHelper.sendFrame(\"send\", frame.getString(\"replyAddress\"), new JsonObject().put(\"value\", \"You got it\"), socket);\n }\n });\n\n socket.handler(parser);\n\n FrameHelper.sendFrame(\"register\", address, null, socket);\n\n // There is now way to know that the register actually happened, wait a bit before sending.\n vertx.setTimer( 500L, timerId -> {\n vertx.eventBus().<JsonObject>request(address, new JsonObject().put(\"value\", \"Vert.x\")).onComplete(respMessage -> {\n context.assertTrue(respMessage.succeeded());\n context.assertEquals(\"You got it\", respMessage.result().body().getString(\"value\"));\n client.close();\n async.complete();\n });\n });\n\n }));\n\n }", "@Test\n public void testForumSubscribe() {\n try {\n ForumDTO forumDTO = forumService.subscribeTo(FORUM_ID, USER_ID_2);\n assertTrue(forumDTO.getSubscribers().stream()\n .map(UserDTO::getUsername)\n .collect(Collectors.toSet())\n .contains(USER_NAME)\n );\n assertTrue(forumDTO.getSubscribers().stream()\n .map(UserDTO::getUsername)\n .collect(Collectors.toSet())\n .contains(USER_NAME_2)\n );\n } catch (Exception e) {\n fail(e.getMessage());\n }\n }", "@Test\n\tpublic void testReadTicketOk() {\n\t}", "@Test\n void callWithWebTestClient() {\n webClient.get().uri(\"/\").exchange().expectStatus().isOk().expectBody(String.class)\n .isEqualTo(OK_RESPONSE);\n }", "@Override\r\n public void onCompleted() {\n Log.i(TAG, \"subscribed to buyable items\");\r\n }", "@Override // com.oculus.deviceconfigclient.DeviceConfigCallback\n public void onSuccess() {\n DeviceConfigHelper.sHasSubscribed.set(true);\n DeviceConfigHelper.sDidSubscribeComplete.set(true);\n while (DeviceConfigHelper.sOnSubscribeCompleteCallbacks.peek() != null) {\n ((DeviceConfigHelperSubscribeCompletedCallback) DeviceConfigHelper.sOnSubscribeCompleteCallbacks.remove()).call();\n }\n }", "public String receiveResponse()\n\t{\n\t\t\n\t}", "public void testSendSimpleMessage() {\n\n resetCounter();\n\n try {\n FixedResolver tr0 = new FixedResolver(\"127.0.0.1\", 54222);\n FixedTransportManager ftm0 = new FixedTransportManager(tr0);\n TestMediaManager tmm0 = new TestMediaManager(ftm0);\n tmm0.setPayloads(getTestPayloads1());\n List<JingleMediaManager> trl0 = new ArrayList<JingleMediaManager>();\n trl0.add(tmm0);\n\n FixedResolver tr1 = new FixedResolver(\"127.0.0.1\", 54567);\n FixedTransportManager ftm1 = new FixedTransportManager(tr1);\n TestMediaManager tmm1 = new TestMediaManager(ftm1);\n tmm1.setPayloads(getTestPayloads1());\n List<JingleMediaManager> trl1 = new ArrayList<JingleMediaManager>();\n trl1.add(tmm1);\n\n JingleManager man0 = new JingleManager(getConnection(0), trl0);\n JingleManager man1 = new JingleManager(getConnection(1), trl1);\n\n // Session 1 waits for connections\n man1.addJingleSessionRequestListener(new JingleSessionRequestListener() {\n /**\n * Called when a new session request is detected\n */\n public void sessionRequested(final JingleSessionRequest request) {\n incCounter();\n System.out.println(\"Session request detected, from \" + request.getFrom());\n }\n });\n\n // Session 0 starts a request\n System.out.println(\"Starting session request, to \" + getFullJID(1) + \"...\");\n JingleSession session0 = man0.createOutgoingJingleSession(getFullJID(1));\n session0.startOutgoing();\n\n Thread.sleep(5000);\n\n assertTrue(valCounter() > 0);\n\n } catch (Exception e) {\n e.printStackTrace();\n fail(\"An error occured with Jingle\");\n }\n }", "private void sendFirebaseLoginSubscribeSuccess() {\n String SUBSCRIPTION_SUBSCRIBED = \"subscribed\";\n mFireBaseAnalytics.setUserProperty(SUBSCRIPTION_STATUS_KEY, SUBSCRIPTION_SUBSCRIBED);\n mFireBaseAnalytics.setUserProperty(LOGIN_STATUS_KEY, LOGIN_STATUS_LOGGED_IN);\n mFireBaseAnalytics.setUserProperty(SUBSCRIPTION_PLAN_ID, getActiveSubscriptionId());\n mFireBaseAnalytics.setUserProperty(SUBSCRIPTION_PLAN_NAME, getActiveSubscriptionPlanName());\n }", "public void testHello() {\n FakeEngineManagerListener engineManagerListener = new FakeEngineManagerListener();\n try {\n EngineManager engineManager =\n new EngineManager(engineManagerListener, TEST_MAIN_SC_XML);\n\n // EngineManager.Event event = EngineManager.Event.HELLO;\n Node utterance = makeDoc(\"hello\");\n\n engineManager.fireEvent(\"user_input\", utterance);\n Thread.sleep(1000); // give the async trigger a chance\n\n // now we should have some output (the reply, \"hello\").\n\n assertEquals(1, engineManagerListener.getTargets().size());\n assertNull(engineManagerListener.getTargets().get(0));\n\n assertEquals(1, engineManagerListener.getTargetTypes().size());\n assertEquals(\"x-java\", engineManagerListener.getTargetTypes().get(0));\n\n assertEquals(1, engineManagerListener.getDatas().size());\n if (engineManagerListener.getDatas().get(0) != null) {\n Map<String, Node> data = engineManagerListener.getDatas().get(0);\n assertEquals(1, data.size());\n assertTrue(data.keySet().contains(\"speak0\"));\n Node outputNode = data.values().iterator().next();\n assertEquals(\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-16\\\"?>\" //\n + \"<data xmlns=\\\"http://www.w3.org/2005/07/scxml\\\" name=\\\"speak0\\\">\\n\" //\n + \" <messageId xmlns=\\\"http://www.joelsgarage.com/callcenter\\\">hello</messageId>\\n\" //\n + \"</data>\\n\", //\n XMLUtil.writeXML(outputNode));\n }\n } catch (InitializationException e) {\n e.printStackTrace();\n fail();\n } catch (InterruptedException e) {\n e.printStackTrace();\n fail();\n }\n }", "@Test\r\n public void testDummyMsg() throws Exception {\r\n given()\r\n .contentType(\"application/json\")\r\n .get(\"/cars/\").then()\r\n .assertThat()\r\n .statusCode(HttpStatus.OK_200.getStatusCode())\r\n .body(\"msg\", equalTo(\"Hello World\")); \r\n }", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n @Test\n public void registerParticipantSuccess() throws IntegrationException, SOAPFaultException, MalformedURLException,\n JAXBException {\n final Date stTime = new Date(new java.util.Date().getTime());\n\n xsltTransformer.transform(null, null, null);\n EasyMock.expectLastCall().andAnswer(new IAnswer() {\n\n public Object answer() {\n // return the value to be returned by the method (null for void)\n return getParticipantXMLString();\n }\n }).anyTimes();\n\n final CaaersServiceResponse caaersServiceResponse = getRegisterParticipantResponse(SUCCESS);\n EasyMock.expect(wsClient.createParticipant((String) EasyMock.anyObject())).andReturn(caaersServiceResponse);\n EasyMock.replay(wsClient);\n\n final ServiceInvocationMessage serviceInvocationMessage = prepareServiceInvocationMessage(REFMSGID,\n getParticipantInterimMessage(), stTime,\n caAERSRegistrationServiceInvocationStrategy.getStrategyIdentifier());\n\n final ServiceInvocationResult result = caAERSRegistrationServiceInvocationStrategy\n .invoke(serviceInvocationMessage);\n\n Assert.assertNotNull(result);\n }", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n @Test\n public void updateParticipantRegistrationSuccess() throws IntegrationException, SOAPFaultException,\n MalformedURLException, JAXBException, DatatypeConfigurationException {\n final Date stTime = new Date(new java.util.Date().getTime()); \n\n xsltTransformer.transform(null, null, null);\n EasyMock.expectLastCall().andAnswer(new IAnswer() {\n\n public Object answer() {\n return getParticipantXMLString();\n }\n }).anyTimes();\n\n final CaaersServiceResponse updateParticipantResponse = getUpdateParticipantResponse(SUCCESS);\n final CaaersServiceResponse getParticipantResponse = getParticipantResponse(SUCCESS);\n EasyMock.expect(wsClient.updateParticipant((String) EasyMock.anyObject())).andReturn(updateParticipantResponse)\n .anyTimes();\n EasyMock.expect(wsClient.getParticipant((String) EasyMock.anyObject())).andReturn(getParticipantResponse);\n EasyMock.replay(wsClient);\n\n final ServiceInvocationMessage serviceInvocationMessage = prepareServiceInvocationMessage(REFMSGID,\n getParticipantInterimMessage(), stTime,\n caAERSUpdateRegistrationServiceInvocationStrategy.getStrategyIdentifier());\n\n final ServiceInvocationResult result = caAERSUpdateRegistrationServiceInvocationStrategy\n .invoke(serviceInvocationMessage);\n\n Assert.assertNotNull(result);\n }", "@Test\n\tpublic void testMessageInMicroserivce() throws Exception {\n\t\tthis.mvc.perform(get(\"/first-api\"))\n\t\t.andDo(print())\n\t\t.andExpect(status().isOk())\n\t\t.andExpect(content().string(containsString(\"Welcome\")));\n\t}", "@Test\n public void shouldFindAllMatchingRoomsWithTheDaoAndReturnItToTheClient()\n\t throws Exception {\n\n\tfinal ArrayList<String> criteria = Lists.newArrayList(null, null, null,\n\t\tnull, null, null, null);\n\tfinal FindRoomCommand command = new FindRoomCommand(criteria.get(0),\n\t\tcriteria.get(1), true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, null, null, null);\n\n\tfinal List<UrlyBirdRoomOffer> result = Lists\n\t\t.newArrayList(validRoomOffer);\n\twhen(dao.find(criteria)).thenReturn(result);\n\n\tfinal List<RoomOffer> foundRooms = roomOfferService\n\t\t.findRoomOffer(command);\n\n\tassertEquals(result, foundRooms);\n }", "@Test\n public void testSendMessageWithDuplicateReplyID(TestContext context) {\n\n NetClient client = vertx.createNetClient();\n final Async async = context.async();\n\n client.connect(7000, \"localhost\").onComplete(context.asyncAssertSuccess(socket -> {\n\n vertx.eventBus().consumer(\"third-party-receiver\", msg -> context.fail());\n\n final FrameParser parser = new FrameParser(parse -> {\n context.assertTrue(parse.succeeded());\n client.close();\n async.complete();\n });\n\n socket.handler(parser);\n\n\n FrameHelper.sendFrame(\"send\", \"hello\", \"third-party-receiver\", new JsonObject().put(\"value\", \"vert.x\"), socket);\n }));\n }", "@Test\n public void updatePetWithFormTest() {\n Long petId = null;\n String name = null;\n String status = null;\n // rx.Observable<Object> apiObservable = api.updatePetWithForm(petId, name, status);\n // Subscriber<Object> apiSubscriber = new Subscriber<Object>() {\n // @Override\n // public void onNext(Object dtoResponse) {\n // // TODO: test validations\n // Assert.assertNotNull(\"DTO Response should not be Null\", dtoResponse);\n // }\n\n // @Override\n // public void onCompleted() {\n // // TODO: test any post-processing\n // System.out.println(\"Api Call Complete\");\n // }\n\n // @Override\n // public void onError(Throwable e) {\n // // TODO: handle error scenario\n // System.out.println(e.getMessage());\n // }\n // };\n // apiObservable.subscribe(apiSubscriber);\n }", "@Test\n public void testSend200OkResponseWithBody() {\n String expected = \"RTSP/1.0 200 OK\\r\\n\" + ((((((((\"server: Testserver\\r\\n\" + \"session: 2547019973447939919\\r\\n\") + \"content-type: text/parameters\\r\\n\") + \"content-length: 50\\r\\n\") + \"cseq: 3\\r\\n\") + \"\\r\\n\") + \"position: 24\\r\\n\") + \"stream_state: playing\\r\\n\") + \"scale: 1.00\\r\\n\");\n byte[] content = (\"position: 24\\r\\n\" + (\"stream_state: playing\\r\\n\" + \"scale: 1.00\\r\\n\")).getBytes(UTF_8);\n FullHttpResponse response = new io.netty.handler.codec.http.DefaultFullHttpResponse(RTSP_1_0, OK);\n response.headers().add(SERVER, \"Testserver\");\n response.headers().add(SESSION, \"2547019973447939919\");\n response.headers().add(CONTENT_TYPE, \"text/parameters\");\n response.headers().add(CONTENT_LENGTH, (\"\" + (content.length)));\n response.headers().add(CSEQ, \"3\");\n response.content().writeBytes(content);\n EmbeddedChannel ch = new EmbeddedChannel(new RtspEncoder());\n ch.writeOutbound(response);\n ByteBuf buf = ch.readOutbound();\n String actual = buf.toString(UTF_8);\n buf.release();\n Assert.assertEquals(expected, actual);\n }", "@Test\n public void subscribe_single() throws AblyException {\n /* Ably instance that will emit channel messages */\n AblyRealtime ably1 = null;\n /* Ably instance that will receive channel messages */\n AblyRealtime ably2 = null;\n\n String channelName = \"test.channel.subscribe.single\" + System.currentTimeMillis();\n String messageName = \"name\";\n Message[] messages = new Message[] {\n new Message(messageName, \"Lorem ipsum dolor sit amet,\"),\n new Message(messageName, \"Consectetur adipiscing elit.\"),\n new Message(messageName, \"Pellentesque nulla lorem.\")\n };\n\n try {\n ClientOptions option1 = createOptions(testVars.keys[0].keyStr);\n option1.clientId = \"emitter client\";\n ClientOptions option2 = createOptions(testVars.keys[0].keyStr);\n option2.clientId = \"receiver client\";\n\n ably1 = new AblyRealtime(option1);\n ably2 = new AblyRealtime(option2);\n\n Channel channel1 = ably1.channels.get(channelName);\n channel1.attach();\n new ChannelWaiter(channel1).waitFor(ChannelState.attached);\n\n Channel channel2 = ably2.channels.get(channelName);\n channel2.attach();\n new ChannelWaiter(channel2).waitFor(ChannelState.attached);\n\n ArrayList<Message> receivedMessageStack = new ArrayList<>();\n MessageListener listener = new MessageListener() {\n List<Message> messageStack;\n\n @Override\n public void onMessage(Message message) {\n messageStack.add(message);\n }\n\n public MessageListener setMessageStack(List<Message> messageStack) {\n this.messageStack = messageStack;\n return this;\n }\n }.setMessageStack(receivedMessageStack);\n channel2.subscribe(messageName, listener);\n\n /* Start emitting channel with ably client 1 (emitter) */\n channel1.publish(\"nonTrackedMessageName\", \"This message should be ignore by second client (ably2).\", null);\n channel1.publish(messages, null);\n channel1.publish(\"nonTrackedMessageName\", \"This message should be ignore by second client (ably2).\", null);\n\n /* Wait until receiver client (ably2) observes {@code Message}\n * on subscribed channel (channel2) emitted by emitter client (ably1)\n */\n new Helpers.MessageWaiter(channel2).waitFor(messages.length + 2);\n\n /* Validate that,\n * - received same amount of emitted specific message\n * - received messages are the ones we emitted\n */\n assertThat(receivedMessageStack.size(), is(equalTo(messages.length)));\n\n Collections.sort(receivedMessageStack, messageComparator);\n for (int i = 0; i < messages.length; i++) {\n Message message = messages[i];\n if(Collections.binarySearch(receivedMessageStack, message, messageComparator) < 0) {\n fail(\"Unable to find expected message: \" + message);\n }\n }\n } finally {\n if (ably1 != null) ably1.close();\n if (ably2 != null) ably2.close();\n }\n }", "@Test\n public void testReplicatedClient()\n {\n generateEvents(\"repl-client-test\");\n checkEvents(true, false);\n }", "@Override\r\n\t\t\tpublic void onSuccess() {\n\t\t\t\tLog.d(TAG, \"onSucess()\");\r\n\t\t\t\tToast.makeText(getApplicationContext(), \"Peers Avaliable!\", Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\r\n\t\t\t}", "public boolean isOK() {\r\n return getPayload().getString(\"status\").equals(\"ok\");\r\n }", "@Test\r\n public void testAdminSaveSubscriptionAuthorized() throws Exception {\r\n saveJoePublisher();\r\n saveSamSyndicator();\r\n DatatypeFactory fac = DatatypeFactory.newInstance();\r\n List<Subscription> subs = new ArrayList<Subscription>();\r\n Subscription s = new Subscription();\r\n\r\n s.setMaxEntities(10);\r\n s.setBrief(false);\r\n GregorianCalendar gcal = new GregorianCalendar();\r\n gcal.setTimeInMillis(System.currentTimeMillis());\r\n gcal.add(Calendar.HOUR, 1);\r\n s.setExpiresAfter(fac.newXMLGregorianCalendar(gcal));\r\n s.setSubscriptionFilter(new SubscriptionFilter());\r\n s.getSubscriptionFilter().setFindBusiness(new FindBusiness());\r\n s.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers());\r\n s.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);\r\n s.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD, null));\r\n subs.add(s);\r\n Holder<List<Subscription>> items = new Holder<List<Subscription>>();\r\n items.value = subs;\r\n publisher.adminSaveSubscription(authInfoJoe(), TckPublisher.getSamPublisherId(), items);\r\n for (int i = 0; i < items.value.size(); i++) {\r\n tckSubscription.deleteSubscription(authInfoSam(), items.value.get(i).getSubscriptionKey());\r\n }\r\n\r\n deleteJoePublisher();\r\n deleteSamSyndicator();\r\n\r\n }", "@Test\n\t@Ignore\n\tpublic void testResponse() throws UnsupportedEncodingException {\n\t\tws = resource().path(\"omxdata\");\n\t\tClientResponse response = ws.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);\n\t\tassertEquals(200, response.getStatus());\n\t\tSystem.out.println(response.getStatus());\n\t}", "public void testReceiveFeedback() {\n\n\t}" ]
[ "0.75163984", "0.6885466", "0.67642814", "0.6709303", "0.6421001", "0.63598406", "0.63168687", "0.6214526", "0.61838335", "0.6080401", "0.60476655", "0.6038078", "0.6036763", "0.5878041", "0.58552504", "0.5830859", "0.5807378", "0.5763003", "0.5740165", "0.569473", "0.5685599", "0.5678266", "0.56779295", "0.5676615", "0.56594497", "0.5624621", "0.56229234", "0.5618582", "0.56058884", "0.5591964", "0.5558176", "0.5552951", "0.55222595", "0.55194974", "0.549978", "0.54767746", "0.5442462", "0.54316676", "0.5425947", "0.542074", "0.5420262", "0.53964573", "0.5391543", "0.5381478", "0.5374262", "0.5366374", "0.5361091", "0.53584427", "0.53575885", "0.53449494", "0.5327116", "0.53245574", "0.53166157", "0.5316295", "0.5316014", "0.53114194", "0.53019816", "0.5295685", "0.5293213", "0.5292142", "0.5291607", "0.52773434", "0.5268667", "0.5235023", "0.5233307", "0.523307", "0.523242", "0.52119005", "0.5199063", "0.51963717", "0.51962626", "0.51931965", "0.51929665", "0.51869124", "0.5184335", "0.5184328", "0.51823765", "0.51797885", "0.5171721", "0.5165439", "0.5162307", "0.5158165", "0.51500064", "0.51396805", "0.51351684", "0.5135062", "0.51328546", "0.51295877", "0.5129473", "0.5127511", "0.5122214", "0.51129204", "0.5111732", "0.51098627", "0.5105687", "0.51040375", "0.5102014", "0.50992966", "0.50951546", "0.5093898" ]
0.82825357
0
Test subscribe to room with BAD response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testSubscribeToRoomBadResponse() { // given final SubscribeRequest subscribeRequest = SubscribeRequest.builder() .user(TEST_USER + "/" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + "@null").build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest)) .willReturn(BAD_RESPONSE); // when multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomBadResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomOkResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test(expected = SubscriberTypeMismatchException.class)\r\n\tpublic void aTestInvalidSubscribe() {\r\n\t\tbroker.subscribe(new IntegerSubscriber(), Boolean.class);\r\n\t}", "@Test\n public void attach_implicit_subscribe_fail() throws AblyException {\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[1].keyStr);\n ably = new AblyRealtime(opts);\n\n /* wait until connected */\n new ConnectionWaiter(ably.connection).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", ably.connection.state, ConnectionState.connected);\n\n /* create a channel and subscribe */\n final Channel channel = ably.channels.get(\"subscribe_fail\");\n channel.subscribe(null);\n assertEquals(\"Verify attaching state reached\", channel.state, ChannelState.attaching);\n\n ErrorInfo fail = new ChannelWaiter(channel).waitFor(ChannelState.failed);\n assertEquals(\"Verify failed state reached\", channel.state, ChannelState.failed);\n assertEquals(\"Verify reason code gives correct failure reason\", fail.statusCode, 401);\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomBadResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\r\n\tpublic void aTestValidSubscribe() {\r\n\t\tbroker.subscribe(intSub);\r\n\t\tbroker.subscribe(unreadSub);\r\n\t\tbroker.subscribe(pIntSub);\r\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Override\n\tpublic void brokenSubscription() {\n\t\t\n\t}", "@Test\n public void transient_publish_connection_failed() {\n AblyRealtime pubAbly = null;\n String channelName = \"transient_publish_connection_failed_\" + testParams.name;\n try {\n ClientOptions opts = createOptions(\"not:a.key\");\n pubAbly = new AblyRealtime(opts);\n new ConnectionWaiter(pubAbly.connection).waitFor(ConnectionState.failed);\n assertEquals(\"Verify failed state reached\", pubAbly.connection.state, ConnectionState.failed);\n\n final Channel pubChannel = pubAbly.channels.get(channelName);\n Helpers.CompletionWaiter completionWaiter = new Helpers.CompletionWaiter();\n try {\n pubChannel.publish(\"Lorem\", \"Ipsum!\", completionWaiter);\n fail(\"failed to raise expected exception\");\n } catch(AblyException e) {\n }\n } catch(AblyException e) {\n fail(\"unexpected exception\");\n } finally {\n if(pubAbly != null) {\n pubAbly.close();\n }\n }\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnAlreadyBookedRoomAndInformTheClientWithTheAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\t\"12\");\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(false);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsBadResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n public void testSearchUserByQueryError() throws Exception {\n TestSubscriber testSubscriber = new TestSubscriber();\n Observable<ApiSearchUser> searchUserObservable = githubApi.getSearchUser(\"\", null);\n searchUserObservable.subscribe(testSubscriber);\n testSubscriber.awaitTerminalEvent();\n testSubscriber.assertError(HttpException.class);\n }", "@Test\n public void testHttpForNotConnected() throws Exception {\n \n final CountDownLatch unsubscribed = new CountDownLatch(1);\n \n final TestChannelCreator creator = new TestChannelCreator();\n final DefaultHttpClient client = new DefaultHttpClient(creator, ENABLE_LOGGING);\n // NOT setup server for local channel\n final TestSubscriber<HttpObject> testSubscriber = new TestSubscriber<HttpObject>();\n final OnNextSensor<HttpObject> nextSensor = new OnNextSensor<HttpObject>();\n try {\n client.defineInteraction(new LocalAddress(\"test\"), \n Observable.<HttpObject>just(fullHttpRequest()).doOnNext(nextSensor))\n .compose(RxFunctions.<HttpObject>countDownOnUnsubscribe(unsubscribed))\n .subscribe(testSubscriber);\n \n unsubscribed.await();\n \n testSubscriber.awaitTerminalEvent();\n assertEquals(1, creator.getChannels().size());\n creator.getChannels().get(0).assertClosed(1);\n } finally {\n client.close();\n assertEquals(0, testSubscriber.getOnNextEvents().size());\n assertEquals(0, testSubscriber.getCompletions());\n assertEquals(1, testSubscriber.getOnErrorEvents().size());\n nextSensor.assertNotCalled();\n }\n }", "@Test\r\n\tpublic void test() {\r\n\t\tassertEquals(subscribe.getTopic() , \"room1\");\r\n\t\tassertEquals(subscribe.getTypeMap() , \"Galilei\");\r\n\t\tassertTrue(subscribe.isPossible(server));\r\n\t\tassertTrue(!subscribe2.isPossible(server));\r\n\t}", "@Override\n public void failure(RetrofitError error) {\n Log.d(TAG, String.valueOf(error));\n WearSocket.getInstance().sendMessage(Values.MESSAGE_PATH, \"Error: \" + phrase + \" didn't work\");\n }", "@Test\n public void transient_publish_channel_failed() {\n AblyRealtime pubAbly = null;\n String channelName = \"transient_publish_channel_failed_\" + testParams.name;\n try {\n ClientOptions opts = createOptions(testVars.keys[1].keyStr);\n pubAbly = new AblyRealtime(opts);\n new ConnectionWaiter(pubAbly.connection).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", pubAbly.connection.state, ConnectionState.connected);\n\n final Channel pubChannel = pubAbly.channels.get(channelName);\n Helpers.ChannelWaiter channelWaiter = new Helpers.ChannelWaiter(pubChannel);\n pubChannel.attach();\n channelWaiter.waitFor(ChannelState.failed);\n\n Helpers.CompletionWaiter completionWaiter = new Helpers.CompletionWaiter();\n try {\n pubChannel.publish(\"Lorem\", \"Ipsum!\", completionWaiter);\n fail(\"failed to raise expected exception\");\n } catch(AblyException e) {\n assertEquals(pubChannel.state, ChannelState.failed);\n }\n } catch(AblyException e) {\n fail(\"unexpected exception\");\n } finally {\n if(pubAbly != null) {\n pubAbly.close();\n }\n }\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n public void testProcessNoResponse() {\n // NOTE: this json file is a RESPONSE, not a request\n String request = ResourceUtils.getResourceAsString(\"org/onap/policy/simulators/appclcm/appc.lcm.success.json\");\n assertNotNull(request);\n\n server.onTopicEvent(CommInfrastructure.NOOP, MY_TOPIC, request);\n\n verify(sink, never()).send(any());\n }", "@Test\n public void startPollingAuthStatusAccessRequired() throws Exception {\n // Arrange\n TestSubscriber<String> subscriber = new TestSubscriber<>();\n when(mAccess.getSessionId(anyString())).thenReturn(STRING_TO_RETURN);\n when(mAccess.getEncryptedPayload(anyString(), anyString())).thenReturn(Access.KEY_AUTH_REQUIRED);\n // Act\n mSubject.startPollingAuthStatus(\"1234567890\").take(1, TimeUnit.SECONDS).toBlocking().subscribe(subscriber);\n // Assert\n subscriber.assertCompleted();\n subscriber.assertNoValues();\n subscriber.assertNoErrors();\n }", "private void onUnavailable() {\n // TODO: broadcast\n }", "@Test\n public void testRepositoryGot404Response() {\n // Preconditions\n TestSubscriber<User> subscriber = new TestSubscriber<>();\n\n // Attaches the subscriber and executes the Observable.\n repository.get(2).subscribe(subscriber);\n\n // We ensure we've got 404 Not Found in the onError method of the Subscriber.\n subscriber.assertError(HttpException.class);\n subscriber.assertNoValues();\n subscriber.assertUnsubscribed();\n List<Throwable> exceptions = subscriber.getOnErrorEvents();\n //noinspection all\n Assert.assertEquals(404, ((HttpException) exceptions.get(0)).code());\n }", "protected void onDiscoveryFailed() {\n logAndShowSnackbar(\"Could not subscribe.\");\n }", "@SmallTest\n @Test\n public void testNegotiationFailedInvalidResponse() {\n testStartNegotiation();\n\n // Received something other than the probe; it should be ignored\n mDtmfTransport.onDtmfReceived('1');\n // Super short message.\n mDtmfTransport.onDtmfReceived('A');\n mDtmfTransport.onDtmfReceived('D');\n\n verify(mCallback).onNegotiationFailed(eq(mDtmfTransport));\n }", "@Test\n public void testSearchRepositoryByQueryError() throws Exception {\n TestSubscriber testSubscriber = new TestSubscriber();\n Observable<ApiSearchRepository> searchRepositoryObservable = githubApi.getSearchRepository(\"\", null);\n searchRepositoryObservable.subscribe(testSubscriber);\n testSubscriber.awaitTerminalEvent();\n testSubscriber.assertError(HttpException.class);\n }", "@Test\n public void testConnectToInvalidService()\n throws IOException\n {\n final boolean availability = ConnectionChecker.checkServiceAvailability(\"localhost\", 65534, 3000);\n\n assertFalse(availability);\n }", "@Test\n public void testMissingForumSubscribe() {\n ForumException thrown = assertThrows(ForumException.class,\n () -> forumService.subscribeTo(0, USER_ID_2));\n assertTrue(thrown.getMessage().contains(\"No such forum thread.\"));\n }", "private void failTheWebSocketConnection() {\n failed = true;\n }", "@Test\n public void testForumSubscribeMissingUser() {\n ForumException thrown = assertThrows(ForumException.class,\n () -> forumService.subscribeTo(FORUM_ID, 0));\n assertTrue(thrown.getMessage().contains(\"No such user.\"));\n }", "@Test\n public void publishWithBadHostShouldNotRethrowExceptions() {\n StandardChatService service = new StandardChatService(\"token\", \"room\", \"from\");\n service.setHost(\"hostvaluethatwillcausepublishtofail\");\n service.publish(\"message\");\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\n public void startPollingAuthStatusSuccess() throws Exception {\n // Arrange\n TestSubscriber<String> subscriber = new TestSubscriber<>();\n when(mAccess.getSessionId(anyString())).thenReturn(STRING_TO_RETURN);\n when(mAccess.getEncryptedPayload(anyString(), anyString())).thenReturn(STRING_TO_RETURN);\n // Act\n mSubject.startPollingAuthStatus(\"1234567890\").toBlocking().subscribe(subscriber);\n // Assert\n verify(mAccess).getSessionId(anyString());\n verify(mAccess).getEncryptedPayload(anyString(), anyString());\n subscriber.assertCompleted();\n subscriber.onNext(STRING_TO_RETURN);\n subscriber.assertNoErrors();\n }", "@SuppressWarnings(\"unchecked\")\n @Test\n public void testBackenStatusUpdateError() throws Exception {\n RequestBodyEntity bodyEntityRegister = mock(RequestBodyEntity.class);\n \n HttpResponse<String> stringResponseRegister = (HttpResponse<String>) mock(HttpResponse.class);\n when(stringResponseRegister.getStatus())\n .thenReturn(400); \n when(bodyEntityRegister.asString())\n .thenReturn(stringResponseRegister); \n\n HttpRequestWithBody registerBodyMock = mock(HttpRequestWithBody.class);\n \n when(registerBodyMock.routeParam(anyString(), anyString()))\n .thenReturn(registerBodyMock);\n when(registerBodyMock.header(anyString(), anyString()))\n .thenReturn(registerBodyMock);\n when(registerBodyMock.body(anyString()))\n .thenReturn(bodyEntityRegister);\n\n // PUT mock\n when(Unirest.put(contains(\"/event/status\")))\n .thenReturn(registerBodyMock); \n \n TestWorker testWorker = new TestWorker();\n worker = getWrappedWorker(testWorker);\n worker.run();\n \n // let worker throw CommunicationException\n Envelope envelope = new Envelope(new Long(34343), false, \"graviton\", \"documents.core.app.update\");\n URL jsonFile = this.getClass().getClassLoader().getResource(\"json/queueEvent.json\");\n String message = FileUtils.readFileToString(new File(jsonFile.getFile()));\n workerConsumer.handleDelivery(\"documents.core.app.update\", envelope, new AMQP.BasicProperties(), message.getBytes()); \n }", "@Test\n\tpublic void testInvalidEmailId() {\n\t\tString emailId = \"InvalidPerson\";\n\t\tClient client = Client.create();\n\t\tWebResource webResource2 = client\n\t\t\t\t.resource(\"http://localhost:8080/MeetingSchedulerProject/meeting/personservice/\"\n\t\t\t\t\t\t+ emailId);\n\t\tClientResponse response2 = webResource2.accept(\n\t\t\t\tMediaType.APPLICATION_JSON).get(ClientResponse.class);\n\n\t\t// not found status code\n\t\tassertEquals(response2.getStatus(), 404);\n\t}", "@Order(2)\n\t\t@Test\n\t\tpublic void getInvalidMessage() throws IOException, ParseException {\n\t\t\tboolean response = Requests.sendGETBoolReturn(Requests.MESSAGE_URL, INVALID_MESSAGE_ID);\n\t\t\t\n\t\t\t//expect that response == false :: Request should not return a 200\n\t\t\tassertFalse(response);\n\t\t}", "@Test\n void awaitMessage() {\n\n Message message = null;\n TempBroadcast b = new TempBroadcast(\"broadcastSender2\");\n\n broadcastReceiver.subscribeBroadcast(TempBroadcast.class, c -> {\n });\n broadcastSender.sendBroadcast(b);\n\n // here we will check the method\n try {\n message = messageBus.awaitMessage(broadcastReceiver);\n\n } catch (InterruptedException e) {\n e.printStackTrace();\n //due to the assumption above, an exception is not supposed to be thrown\n }\n assertEquals(b, message);\n }", "@Test\n public void subscribe_unsubscribe() {\n String channelName = \"subscribe_unsubscribe_\" + testParams.name;\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[0].keyStr);\n ably = new AblyRealtime(opts);\n\n /* create a channel and attach */\n final Channel channel = ably.channels.get(channelName);\n channel.attach();\n (new ChannelWaiter(channel)).waitFor(ChannelState.attached);\n assertEquals(\"Verify attached state reached\", channel.state, ChannelState.attached);\n\n /* subscribe */\n MessageListener testListener = new MessageListener() {\n @Override\n public void onMessage(Message message) {\n }};\n channel.subscribe(\"test_event\", testListener);\n /* unsubscribe */\n channel.unsubscribe(\"test_event\", testListener);\n } catch (AblyException e) {\n e.printStackTrace();\n fail(\"init0: Unexpected exception instantiating library\");\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "@Test(expected = UserMismatchException.class)\r\n public void testAdminSaveSubscriptionNotAuthorized() throws Exception {\r\n saveJoePublisher();\r\n saveSamSyndicator();\r\n DatatypeFactory fac = DatatypeFactory.newInstance();\r\n List<Subscription> subs = new ArrayList<Subscription>();\r\n Subscription s = new Subscription();\r\n\r\n s.setMaxEntities(10);\r\n s.setBrief(false);\r\n GregorianCalendar gcal = new GregorianCalendar();\r\n gcal.setTimeInMillis(System.currentTimeMillis());\r\n gcal.add(Calendar.HOUR, 1);\r\n s.setExpiresAfter(fac.newXMLGregorianCalendar(gcal));\r\n s.setSubscriptionFilter(new SubscriptionFilter());\r\n s.getSubscriptionFilter().setFindBusiness(new FindBusiness());\r\n s.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers());\r\n s.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);\r\n s.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD, null));\r\n subs.add(s);\r\n Holder<List<Subscription>> items = new Holder<List<Subscription>>();\r\n items.value = subs;\r\n publisher.adminSaveSubscription(authInfoSam(), TckPublisher.getJoePublisherId(), items);\r\n deleteJoePublisher();\r\n deleteSamSyndicator();\r\n\r\n }", "@Override\r\n\tpublic void testInvalidId() throws Exception {\n\t\tif (JavastravaApplicationConfig.STRAVA_ALLOWS_CHALLENGES_ENDPOINT) {\r\n\t\t\tsuper.testInvalidId();\r\n\t\t}\r\n\t}", "private void subscribe() {\n Log.i(TAG, \"Subscribing\");\n mNearbyDevicesArrayAdapter.clear();\n SubscribeOptions options = new SubscribeOptions.Builder()\n .setStrategy(PUB_SUB_STRATEGY)\n .setCallback(new SubscribeCallback() {\n @Override\n public void onExpired() {\n super.onExpired();\n Log.i(TAG, \"No longer subscribing\");\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mSubscribeSwitch.setChecked(false);\n }\n });\n }\n }).build();\n\n Nearby.Messages.subscribe(mGoogleApiClient, mMessageListener, options)\n .setResultCallback(new ResultCallback<Status>() {\n @Override\n public void onResult(@NonNull Status status) {\n if (status.isSuccess()) {\n Log.i(TAG, \"Subscribed successfully.\");\n } else {\n logAndShowSnackbar(\"Could not subscribe, status = \" + status);\n mSubscribeSwitch.setChecked(false);\n }\n }\n });\n }", "public static void test009()\r\n {\r\n System.out.println(\"RxJavaTest04::test009\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket)\r\n .subscribeOn(Schedulers.io())\r\n )\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "private void tryToConsumeEvent() {\n if (subscriber == null || storedEvent == null) {\n return;\n }\n sendMessageToJs(storedEvent, subscriber);\n\n }", "@Test\n public void cancelHotelTestError() throws CancelHotelFault, DatatypeConfigurationException{ \n try {\n cancelHotel(null);\n } catch (CancelHotelFault e) {\n assertEquals(\"Empty\",e.getMessage());\n } \n }", "@Test\n\tpublic void rejectedOfferCanNotBeAccepted() {\n\t}", "@Test\n public void testFailFromClient(TestContext context) {\n NetClient client = vertx.createNetClient();\n final Async async = context.async();\n final String address = \"test\";\n client.connect(7000, \"localhost\").onComplete(context.asyncAssertSuccess(socket -> {\n\n final FrameParser parser = new FrameParser(parse -> {\n context.assertTrue(parse.succeeded());\n JsonObject frame = parse.result();\n if (\"message\".equals(frame.getString(\"type\"))) {\n context.assertEquals(true, frame.getBoolean(\"send\"));\n context.assertEquals(\"Vert.x\", frame.getJsonObject(\"body\").getString(\"value\"));\n FrameHelper.writeFrame(new JsonObject().put(\"type\",\"send\").put(\"address\",frame.getString(\"replyAddress\")).put(\"failureCode\", 1234).put(\"message\", \"ooops!\"), socket);\n }\n });\n\n socket.handler(parser);\n\n FrameHelper.sendFrame(\"register\", address, null, socket);\n\n // There is now way to know that the register actually happened, wait a bit before sending.\n vertx.setTimer( 500L, timerId -> {\n vertx.eventBus().request(address, new JsonObject().put(\"value\", \"Vert.x\")).onComplete(respMessage -> {\n context.assertTrue(respMessage.failed());\n context.assertEquals(\"ooops!\", respMessage.cause().getMessage());\n client.close();\n async.complete();\n });\n });\n\n }));\n\n }", "void startChecking()\n {\n UnitModel model = new UnitModel();\n model.UNIT_ID = Globals.unitId;\n Observable<RoomMeetingsResponse> data = retrofitInterface.roomreservations(model);\n\n subscription = data\n .subscribeOn(Schedulers.newThread())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Subscriber<RoomMeetingsResponse>() {\n @Override\n public void onCompleted() {\n\n }\n\n @Override\n public void onError(Throwable e) {\n e.printStackTrace();\n\n }\n\n @Override\n public void onNext(RoomMeetingsResponse serviceResponse) {\n //sweetAlertDialog.hide();\n progress_rel.setVisibility(View.GONE);\n OngoingReactAsync(serviceResponse);\n }\n });\n }", "@Order(1)\n\t\t@Test\n\t\tpublic void sendMessageInvalidFromAndTo() throws IOException, ParseException {\n\t\t\t boolean response = Requests.createMessageBoolReturn(JSONUtils.createMessageObject(INVALID_USER_ID, INVALID_USER_ID, \"Test message\"));\n\t\t\t assertFalse(response);\n\t\t\t \n\t\t\t \n\t\t}", "public void testReceiver() throws Exception\n {\n }", "public static void test008()\r\n {\r\n System.out.println(\"RxJavaTest04::test008\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket))\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "@Test(expected = IllegalArgumentException.class)\n public void testFailInit() {\n uut=new ChatMessageRequest(\"test\",\"test\",\"test\",MessageTypes.MATCH);\n }", "@Test\n public void testCancel() throws Exception {\n\n try {\n client.makeBooking(\"Paul\", new Date(System.currentTimeMillis()), true);\n Assert.fail(\"Should have thrown a TransactionCompensatedException\");\n } catch (TransactionCompensatedException e) {\n //expected\n }\n\n Assert.assertTrue(\"Expected booking to be cancelled, but it wasn't\", client.getLastBookingStatus().equals(BookingStatus.CANCELLED));\n\n }", "@Test\n public void testTransportNegotiationFailureForClientLongPollingServerWebSocket() throws Exception {\n bayeuxServer.setAllowedTransports(\"websocket\");\n evaluateScript(\"keep_only_long_polling_transport\",\n \"cometd.unregisterTransports();\" +\n \"cometd.registerTransport('long-polling', originalTransports['long-polling']);\");\n\n defineClass(Latch.class);\n evaluateScript(\"var failureLatch = new Latch(1);\");\n Latch failureLatch = get(\"failureLatch\");\n evaluateScript(\"cometd.onTransportException = function(failure, oldTransport, newTransport)\" +\n \"{\" +\n \" failureLatch.countDown();\" +\n \"}\");\n evaluateScript(\"cometd.init({url: '\" + cometdURL + \"', logLevel: '\" + getLogLevel() + \"'});\");\n\n Assert.assertTrue(failureLatch.await(5000));\n\n evaluateScript(\"cometd.disconnect(true);\");\n }", "boolean isBadCommunication();", "@Test\n\tpublic void acceptedOfferCanNotBeRejected() {\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n public void ResourceRequirementError() {\n MSG_ACTION_ACTIVATE_LEADERCARD message = new MSG_ACTION_ACTIVATE_LEADERCARD(1);\n assertFalse(am.activateLeaderCard(p, message));\n assertEquals(MessageType.MSG_ERROR, c.messages.get(0).getMessageType());\n assertEquals(1, c.messages.size());\n }", "@org.junit.Test\n\tpublic void invalidAudioFormat() {\n\t\tAudioFormat format = new AudioFormat(8000, 24, 3, true, true);\n\n\t\tMicrophoneListener listener = new MicrophoneListener() {\n\t\t\t@Override\n\t\t\tpublic void onReceive(byte[] data) {\n\t\t\t}\n\t\t};\n\n\t\tMicrophone mic = new Microphone(format, listener);\n\t\tmic.start();\n\t\ttry {\n\t\t\tThread.sleep(500);\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t\tfail();\n\t\t}\n\n\t\tif (mic.isRunning()) {\n\t\t\tfail();\n\t\t}\n\t\tmic.interrupt();\n\t}", "@Test\n public void attach_fail() {\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[1].keyStr);\n ably = new AblyRealtime(opts);\n\n /* wait until connected */\n (new ConnectionWaiter(ably.connection)).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", ably.connection.state, ConnectionState.connected);\n\n /* create a channel and attach */\n final Channel channel = ably.channels.get(\"attach_fail\");\n channel.attach();\n ErrorInfo fail = (new ChannelWaiter(channel)).waitFor(ChannelState.failed);\n assertEquals(\"Verify failed state reached\", channel.state, ChannelState.failed);\n assertEquals(\"Verify reason code gives correct failure reason\", fail.statusCode, 401);\n\n } catch (AblyException e) {\n e.printStackTrace();\n fail(\"init0: Unexpected exception instantiating library\");\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "@Override\n public void onFailure(@NonNull Exception e) {\n Discoverer.this.eventListener.trigger(EVENT_LOG, \"Fail to request connection: \" + e.getMessage());\n }", "@Test\n public void testBroadcastedTransactionDeserializer(){\n try{\n mMessagesHub = new SubscriptionMessagesHub(\"\", \"\", mErrorListener);\n mMessagesHub.addSubscriptionListener(new SubscriptionListener() {\n private int MAX_MESSAGES = 15;\n private int messageCounter = 0;\n\n @Override\n public ObjectType getInterestObjectType() {\n return ObjectType.TRANSACTION_OBJECT;\n }\n\n @Override\n public void onSubscriptionUpdate(SubscriptionResponse response) {\n if(response.params.size() == 2){\n List<Serializable> payload = (List) response.params.get(1);\n if(payload.size() > 0){\n for(Serializable item : payload){\n if(item instanceof BroadcastedTransaction){\n BroadcastedTransaction broadcastedTransaction = (BroadcastedTransaction) item;\n Transaction tx = broadcastedTransaction.getTransaction();\n System.out.println(String.format(\"Got %d operations\", tx.getOperations().size()));\n }\n }\n }\n }\n\n // Waiting for MAX_MESSAGES messages before releasing the wait lock\n messageCounter++;\n if(messageCounter > MAX_MESSAGES){\n synchronized (SubscriptionMessagesHubTest.this){\n SubscriptionMessagesHubTest.this.notifyAll();\n }\n }\n }\n });\n\n mWebSocket.addListener(mMessagesHub);\n mWebSocket.connect();\n\n // Holding this thread while we get update notifications\n synchronized (this){\n wait();\n }\n } catch (WebSocketException e) {\n System.out.println(\"WebSocketException. Msg: \" + e.getMessage());\n } catch (InterruptedException e) {\n System.out.println(\"InterruptedException. Msg: \"+e.getMessage());\n }\n }", "@Test\n public void testClient(){\n received=false;\n uut=new ChatMessageRequest(\"test\",\"test2\",\"test\",MessageTypes.MATCH);\n uut.clientHandle(null,new TestUtilizer());\n assertTrue(received);\n }", "@Override\n\t\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t\ttopicStateChanged.publish(State.OFFLINE);\n\t\t\t\t}", "@Test\n public void testTransportNegotiationFailureForClientWebSocketServerLongPolling() throws Exception {\n bayeuxServer.setAllowedTransports(\"long-polling\");\n evaluateScript(\"keep_only_websocket_transport\",\n \"cometd.unregisterTransports();\" +\n \"cometd.registerTransport('websocket', originalTransports['websocket']);\");\n\n defineClass(Latch.class);\n evaluateScript(\"var failureLatch = new Latch(1);\");\n Latch failureLatch = get(\"failureLatch\");\n evaluateScript(\"cometd.onTransportException = function(failure, oldTransport, newTransport)\" +\n \"{\" +\n \" failureLatch.countDown();\" +\n \"}\");\n evaluateScript(\"cometd.init({url: '\" + cometdURL + \"', logLevel: '\" + getLogLevel() + \"'});\");\n\n Assert.assertTrue(failureLatch.await(5000));\n Assert.assertTrue((Boolean)evaluateScript(\"cometd.isDisconnected();\"));\n }", "@Test\n public void testIAEForAddListener() {\n try {\n final Registrar<Object> testSubject = onCreateTestSubject();\n testSubject.addListener(null);\n fail(\"IAE was not thrown\");\n } catch (IllegalArgumentException e) {\n // okay\n }\n }", "@Order(2)\n\t\t@Test\n\t\tpublic void listExistingMessagesBetweenNonExistentUsers() throws IOException {\n\t\t\tboolean result = Requests.listMessagesBoolReturn(INVALID_USER_ID, INVALID_USER_ID);\n\t\t\tassertTrue(result);\n\t\t}", "@Test\n\tpublic void testReadTicketFail() {\n\t}", "public void testReceiveFeedback() {\n\n\t}", "@Test\n public void getPetByIdTest() {\n Long petId = null;\n // rx.Observable<Pet> apiObservable = api.getPetById(petId);\n // Subscriber<Pet> apiSubscriber = new Subscriber<Pet>() {\n // @Override\n // public void onNext(Pet dtoResponse) {\n // // TODO: test validations\n // Assert.assertNotNull(\"DTO Response should not be Null\", dtoResponse);\n // }\n\n // @Override\n // public void onCompleted() {\n // // TODO: test any post-processing\n // System.out.println(\"Api Call Complete\");\n // }\n\n // @Override\n // public void onError(Throwable e) {\n // // TODO: handle error scenario\n // System.out.println(e.getMessage());\n // }\n // };\n // apiObservable.subscribe(apiSubscriber);\n }", "@Test\n public void test_invalid() throws Exception {\n matchInvoke(serviceURL, \"PWDDIC_testSearch_invalid_req.xml\",\n \"PWDDIC_testSearch_invalid_res.xml\");\n }", "public void test_GetAllContestChannels_Failure1() throws Exception {\r\n try {\r\n initContext();\r\n\r\n entityManager.close();\r\n\r\n beanUnderTest.getAllContestChannels();\r\n fail(\"ContestManagementException is expected.\");\r\n } catch (ContestManagementException e) {\r\n // success\r\n }\r\n }", "@Test\n public void testNotifySingleDeviceInterruptionDeviceNotFound() {\n ControllerEntity controller = new ControllerEntity(1L, \"EUI\", \"KEY\", ControllerCommunicationChannel.LORA);\n\n DeviceEntity device = new DeviceEntity(1L, \"Device\", null, controller);\n\n InterruptionGroupEntity group = new InterruptionGroupEntity(\n 1L,\n OffsetDateTime.ofInstant(Instant.ofEpochSecond(0), ZoneOffset.UTC),\n OffsetDateTime.ofInstant(Instant.ofEpochSecond(100), ZoneOffset.UTC));\n\n InterruptionEntity interruption = new InterruptionEntity(1L, device, group, false, null);\n\n Mockito.when(deviceController.listByInterruption(Mockito.any()))\n .thenReturn(Arrays.asList());\n\n subject.notifyInterruption(interruption);\n\n Assert.assertEquals(0, postResults.size());\n }", "@Test\n public void testRepositoryGot500Response() {\n // Preconditions\n TestSubscriber<User> subscriber = new TestSubscriber<>();\n MockResponseDispatcher.RETURN_500 = true;\n\n // Attaches the subscriber and executes the Observable.\n repository.get(1).subscribe(subscriber);\n\n // We ensure we've got 500 Server Error in the onError method of the Subscriber.\n subscriber.assertError(HttpException.class);\n subscriber.assertNoValues();\n subscriber.assertUnsubscribed();\n List<Throwable> exceptions = subscriber.getOnErrorEvents();\n //noinspection all\n Assert.assertEquals(500, ((HttpException) exceptions.get(0)).code());\n }", "@SmallTest\n @Test\n public void testReceiveInvalidMessageStart() {\n testNegotiationSuccess();\n\n // Receive message with invalid start digit; it should be ignored.\n mDtmfTransport.onDtmfReceived('B');\n mTestExecutorService.advanceTime(DIGIT_INTERVAL_MILLIS);\n mDtmfTransport.onDtmfReceived('A');\n mTestExecutorService.advanceTime(DIGIT_INTERVAL_MILLIS);\n mDtmfTransport.onDtmfReceived('B');\n // Receive random 0-9 digits user might have typed; should be ignored.\n mTestExecutorService.advanceTime(DIGIT_INTERVAL_MILLIS);\n mDtmfTransport.onDtmfReceived('1');\n mTestExecutorService.advanceTime(DIGIT_INTERVAL_MILLIS);\n mDtmfTransport.onDtmfReceived('2');\n\n // Back to regularly scheduled message.\n mTestExecutorService.advanceTime(DIGIT_INTERVAL_MILLIS);\n mDtmfTransport.onDtmfReceived('D');\n mTestExecutorService.advanceTime(DIGIT_INTERVAL_MILLIS);\n mDtmfTransport.onDtmfReceived('C');\n mTestExecutorService.advanceTime(DIGIT_INTERVAL_MILLIS);\n mDtmfTransport.onDtmfReceived('D');\n mTestExecutorService.advanceTime(MSG_TIMEOUT_MILLIS);\n\n verify(mCallback, times(1)).onMessagesReceived(mMessagesCaptor.capture());\n assertEquals(1, mMessagesCaptor.getAllValues().get(0).size());\n assertTrue(mMessagesCaptor.getAllValues().get(0).contains(\n new Communicator.Message(Communicator.MESSAGE_CALL_AUDIO_CODEC,\n Communicator.AUDIO_CODEC_AMR_NB)));\n }", "@Override\r\n @Test(expected = UnsupportedOperationException.class)\r\n public void testPutWithFailingEventPublisher() {\n super.testPutWithFailingEventPublisher();\r\n }", "@Test\n public void cancelHotelTestError1() throws CancelHotelFault, DatatypeConfigurationException{ \n String input = \"hello you\";\n try {\n cancelHotel(input);\n } catch (CancelHotelFault e) {\n assertEquals(\"ERROR\",e.getMessage());\n } \n }", "public void communicationChannelBroken() {\n\n }", "@Override\n public void onFailure(IMqttToken asyncActionToken, Throwable exception) {\n mqttOnline = false;\n }", "public void testNonDuplicateMessage() throws Exception {\n sendMessage(187286123);\n\n mServiceIntentToVerify = null;\n\n Intent intent = new Intent(mContext, CellBroadcastAlertService.class);\n intent.setAction(Telephony.Sms.Intents.SMS_EMERGENCY_CB_RECEIVED_ACTION);\n\n SmsCbMessage m = createMessage(129487394);\n intent.putExtra(\"message\", m);\n\n startService(intent);\n waitForMs(200);\n\n assertEquals(SHOW_NEW_ALERT_ACTION, mServiceIntentToVerify.getAction());\n assertEquals(CellBroadcastAlertService.class.getName(),\n intent.getComponent().getClassName());\n\n CellBroadcastMessage cbmTest =\n (CellBroadcastMessage) mServiceIntentToVerify.getExtras().get(\"message\");\n CellBroadcastMessage cbm = new CellBroadcastMessage(m);\n\n compareCellBroadCastMessage(cbm, cbmTest);\n }", "@Test\n public void bookHotelTestError() throws BookHotelFault{\n try {\n assertTrue(bookHotel(null));\n } catch (BookHotelFault e) {\n assertEquals(\"Empty\", e.getMessage());\n } \n }", "@Test\n public void smartIdInvalidFormat() throws Exception {\n String errorMessage = authenticateWithSmartIdInvalidInputPollError(\"12akl2\", 2000);\n assertEquals(\"Isikukood on ebakorrektses formaadis.Intsidendi number:\", errorMessage);\n }", "@Override\n public void onFailure(Call call, IOException e) {\n emitter.onNext(e+\"\");\n }", "@Test\n public void testSearchUserByQueryUsersNotNull() throws Exception {\n TestSubscriber testSubscriber = new TestSubscriber();\n Observable<ApiSearchUser> searchUserObservable = githubApi.getSearchUser(testedString, null);\n searchUserObservable.subscribe(testSubscriber);\n testSubscriber.awaitTerminalEvent();\n ApiSearchUser apiSearchUser = (ApiSearchUser) testSubscriber.getOnNextEvents().get(0);\n assertTrue(apiSearchUser.getItems().size() > 0);\n }", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "@Test\n public void smartIdEmptyCode() throws Exception {\n String errorMessage = authenticateWithSmartIdInvalidInputPollError(\"\", 2000);\n assertEquals(\"Isikukood puuduIntsidendi number:\", errorMessage);\n }", "@Test\n public void channel_reattach_failed_error() {\n AblyRealtime ably = null;\n final String channelName = \"channel_reattach_failed_error_\" + testParams.name;\n final int errorCode = 12345;\n long oldRealtimeTimeout = Defaults.realtimeRequestTimeout;\n try {\n DebugOptions opts = new DebugOptions(testVars.keys[0].keyStr);\n fillInOptions(opts);\n opts.channelRetryTimeout = 1000;\n\n /* Mock transport to block send */\n final MockWebsocketFactory mockTransport = new MockWebsocketFactory();\n opts.transportFactory = mockTransport;\n mockTransport.allowSend();\n\n /* Reduce timeout for test to run faster */\n Defaults.realtimeRequestTimeout = 5000;\n\n ably = new AblyRealtime(opts);\n ConnectionWaiter connectionWaiter = new ConnectionWaiter(ably.connection);\n connectionWaiter.waitFor(ConnectionState.connected);\n\n Channel channel = ably.channels.get(channelName);\n ChannelWaiter channelWaiter = new ChannelWaiter(channel);\n channel.attach();\n\n channelWaiter.waitFor(ChannelState.attached);\n\n /* Block send() */\n mockTransport.blockSend();\n\n /* Inject detached message as if from the server */\n ProtocolMessage detachedMessage = new ProtocolMessage() {{\n action = Action.detached;\n channel = channelName;\n error = new ErrorInfo(\"Test error\", errorCode);\n }};\n ably.connection.connectionManager.onMessage(null, detachedMessage);\n\n /* wait for the client reattempt attachment */\n channelWaiter.waitFor(ChannelState.attaching);\n\n /* Inject detached+error message as if from the server */\n ProtocolMessage errorMessage = new ProtocolMessage() {{\n action = Action.detached;\n channel = channelName;\n error = new ErrorInfo(\"Test error\", errorCode);\n }};\n ably.connection.connectionManager.onMessage(null, errorMessage);\n\n /* Should get to suspended soon because there was an error response to the attach attempt */\n ErrorInfo suspendReason = channelWaiter.waitFor(ChannelState.suspended);\n assertEquals(\"Verify the suspended event contains the detach reason\", errorCode, suspendReason.code);\n\n /* Unblock send(), and expect a transition to attached */\n mockTransport.allowSend();\n channelWaiter.waitFor(ChannelState.attached);\n\n } catch(AblyException e) {\n e.printStackTrace();\n fail(\"Unexpected exception\");\n } finally {\n if (ably != null)\n ably.close();\n /* Restore default values to run other tests */\n Defaults.realtimeRequestTimeout = oldRealtimeTimeout;\n }\n }", "private void notEnoughResources(WebSocketSession session) {\n\t\tJsonObject response = new JsonObject();\n\t\tresponse.addProperty(\"id\", \"notEnoughResources\");\n\t\tsendMessage(session, new TextMessage(response.toString()));\n\n\t\t// Release media session\n\t\trelease(session);\n\t}", "@Override\r\n\tpublic void onFail() {\n\t\tif(bSendStatus)\r\n\t\t\tnativeadstatus(E_ONFAIL);\r\n\t}", "@Test \nvoid testFillPrescripNoRefills() {\n\tprescrip.setRefills(0);\n\t testPharm.receivePrescription(prescrip);\n\tBoolean success = testPharm.fillPrescription(prescrip.getId()); //doesn't exist\n assertFalse(success);\n}", "@Test\n void testFailure_illegalStatus() {\n assertThrows(\n IllegalArgumentException.class,\n () ->\n runCommandForced(\n \"--client=NewRegistrar\",\n \"--registrar_request=true\",\n \"--reason=Test\",\n \"--domain_name=example.tld\",\n \"--apply=clientRenewProhibited\"));\n }", "public void testSendMessageEventRequest() {\n // Create a chat for each connection\n Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);\n\n // Create the message to send with the roster\n Message msg = new Message();\n msg.setSubject(\"Any subject you want\");\n msg.setBody(\"An interesting body comes here...\");\n // Add to the message all the notifications requests (offline, delivered, displayed,\n // composing)\n MessageEventManager.addNotificationsRequests(msg, true, true, true, true);\n\n // Send the message that contains the notifications request\n try {\n chat1.sendMessage(msg);\n } catch (Exception e) {\n fail(\"An error occured sending the message\");\n }\n }", "@Test\n\tpublic void testWithInvalidID(){\n\t\tString invalidID = \"not a valid ID\";\n\t\ttry{\n\t\t\tclient.viewTransport(invalidID);\n\t\t\tfail();\n\t\t} catch(UnknownTransportFault_Exception e) {\n\t\t\tassertEquals(\"No transports match the given transport identifier.\",e.getMessage());\n\t\t}\n\t}", "@Test\n public void testNotifySingleDeviceInterruptionCancellation() {\n ControllerEntity controller = new ControllerEntity(1L, \"EUI\", \"KEY\", ControllerCommunicationChannel.LORA);\n\n DeviceEntity device = new DeviceEntity(1L, \"Device\", null, controller);\n\n InterruptionGroupEntity group = new InterruptionGroupEntity(\n 1L,\n OffsetDateTime.ofInstant(Instant.ofEpochSecond(0), ZoneOffset.UTC),\n OffsetDateTime.ofInstant(Instant.ofEpochSecond(100), ZoneOffset.UTC));\n\n InterruptionEntity interruption = new InterruptionEntity(1l, device, group, false, null);\n\n Mockito.when(deviceController.listByInterruption(Mockito.any()))\n .thenReturn(Arrays.asList(device));\n\n subject.notifyInterruptionCancellation(interruption);\n\n String expectedPost = \"http://jouko.test/?DevEUI=EUI\"\n + \"&FPort=1\"\n + \"&Payload=7b4567514b416767427d\"\n + \"&AS_ID=as\"\n + \"&Time=1970-01-01T00:00:00Z\"\n + \"&Token=31c171ca123ce8cf905ab83e4a9aad2f6190f3cdcb73b63714ea18eae2402d5f\";\n\n Assert.assertEquals(1, postResults.size());\n Assert.assertEquals(expectedPost, postResults.get(0));\n }", "@Test\n public void initiatePayloadSuccess() throws Exception {\n // Arrange\n TestSubscriber<Void> subscriber = new TestSubscriber<>();\n doAnswer(invocation -> {\n ((PayloadManager.InitiatePayloadListener) invocation.getArguments()[3]).onInitSuccess();\n return null;\n }).when(mPayloadManager).initiatePayload(\n anyString(), anyString(), any(CharSequenceX.class), any(PayloadManager.InitiatePayloadListener.class));\n // Act\n mSubject.updatePayload(\"1234567890\", \"1234567890\", new CharSequenceX(\"1234567890\")).toBlocking().subscribe(subscriber);\n // Assert\n verify(mPayloadManager).setTempPassword(any(CharSequenceX.class));\n subscriber.assertCompleted();\n subscriber.assertNoErrors();\n }", "@Test\n public void testSearchUserByQueryNotNull() throws Exception {\n TestSubscriber testSubscriber = new TestSubscriber();\n Observable<ApiSearchUser> searchUserObservable = githubApi.getSearchUser(testedString, null);\n searchUserObservable.subscribe(testSubscriber);\n testSubscriber.awaitTerminalEvent();\n ApiSearchUser apiSearchUser = (ApiSearchUser) testSubscriber.getOnNextEvents().get(0);\n assertNotNull(apiSearchUser.getItems());\n }", "@Test\n public void testRollbackBroadcastRestrictions() throws Exception {\n RollbackBroadcastReceiver broadcastReceiver = new RollbackBroadcastReceiver();\n Intent broadcast = new Intent(Intent.ACTION_ROLLBACK_COMMITTED);\n try {\n InstrumentationRegistry.getContext().sendBroadcast(broadcast);\n fail(\"Succeeded in sending restricted broadcast from app context.\");\n } catch (SecurityException se) {\n // Expected behavior.\n }\n\n // Confirm that we really haven't received the broadcast.\n // TODO: How long to wait for the expected timeout?\n assertNull(broadcastReceiver.poll(5, TimeUnit.SECONDS));\n\n // TODO: Do we need to do this? Do we need to ensure this is always\n // called, even when the test fails?\n broadcastReceiver.unregister();\n }", "@Test\n public void attach_exception_listener_called() {\n try {\n final String channelName = \"attach_exception_listener_called_\" + testParams.name;\n\n /* init Ably */\n ClientOptions opts = createOptions(testVars.keys[0].keyStr);\n AblyRealtime ably = new AblyRealtime(opts);\n\n /* wait until connected */\n (new ConnectionWaiter(ably.connection)).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", ably.connection.state, ConnectionState.connected);\n\n /* create a channel; put into failed state */\n ably.connection.connectionManager.requestState(new ConnectionManager.StateIndication(ConnectionState.failed, new ErrorInfo(\"Test error\", 400, 12345)));\n (new ConnectionWaiter(ably.connection)).waitFor(ConnectionState.failed);\n assertEquals(\"Verify failed state reached\", ably.connection.state, ConnectionState.failed);\n\n /* attempt to attach */\n Channel channel = ably.channels.get(channelName);\n final ErrorInfo[] listenerError = new ErrorInfo[1];\n synchronized(listenerError) {\n channel.attach(new CompletionListener() {\n @Override\n public void onSuccess() {\n synchronized (listenerError) {\n listenerError.notify();\n }\n fail(\"Unexpected attach success\");\n }\n\n @Override\n public void onError(ErrorInfo reason) {\n synchronized (listenerError) {\n listenerError[0] = reason;\n listenerError.notify();\n }\n }\n });\n\n /* wait until the listener is called */\n while(listenerError[0] == null) {\n try { listenerError.wait(); } catch(InterruptedException e) {}\n }\n }\n\n /* verify that the listener was called with an error */\n assertNotNull(\"Verify the error callback was called\", listenerError[0]);\n assertEquals(\"Verify the given error is indicated\", listenerError[0].code, 12345);\n\n /* tidy */\n ably.close();\n } catch(AblyException e) {\n fail(e.getMessage());\n }\n\n }", "@Test\n public void testAreUiccApplicationsEnabled_nullRadioProxy() throws Exception {\n doReturn(null).when(mRILUnderTest).getRadioProxy(any());\n Message message = obtainMessage();\n mRILUnderTest.areUiccApplicationsEnabled(message);\n processAllMessages();\n verify(mRadioProxy, never()).areUiccApplicationsEnabled(mSerialNumberCaptor.capture());\n // Sending message is handled by getRadioProxy when proxy is null.\n // areUiccApplicationsEnabled shouldn't explicitly send another callback.\n assertEquals(null, message.obj);\n }", "public void test_GetAllContestChannels_Failure2() throws Exception {\r\n try {\r\n initContext();\r\n\r\n entityManager.enablePersistenceException(true);\r\n\r\n beanUnderTest.getAllContestChannels();\r\n fail(\"ContestManagementException is expected.\");\r\n } catch (ContestManagementException e) {\r\n // success\r\n }\r\n }", "@Override\r\n protected void invalidMessage(RemoteGENASubscription sub,\r\n UnsupportedDataException ex) {\n }", "@Test\n public void given_noDeliveriesAndDeliveryHourNotPassed_when_getDailySubscriptionsToDeliver_then_returnSubscription() {\n }" ]
[ "0.7844186", "0.7087127", "0.7008085", "0.6679671", "0.65952456", "0.657602", "0.63337326", "0.6216939", "0.61093724", "0.60050124", "0.5946579", "0.5920542", "0.5867388", "0.58327854", "0.58285385", "0.580471", "0.57998747", "0.57867354", "0.5759776", "0.57557046", "0.5744573", "0.57045317", "0.5687381", "0.5682294", "0.56805575", "0.5657314", "0.5655469", "0.5653713", "0.5626583", "0.56127447", "0.55923384", "0.55750734", "0.55514264", "0.5525506", "0.54764897", "0.5440747", "0.5428966", "0.54148316", "0.54129004", "0.5410024", "0.5398098", "0.5385196", "0.537129", "0.536927", "0.53634256", "0.53487957", "0.534299", "0.5335233", "0.5326168", "0.53210884", "0.5316228", "0.53145087", "0.53139275", "0.5279419", "0.52691215", "0.5267652", "0.52615345", "0.5255112", "0.5235752", "0.5231608", "0.52217096", "0.5216097", "0.52141815", "0.52049315", "0.5203541", "0.5195706", "0.51890963", "0.51786894", "0.51706934", "0.5167705", "0.516077", "0.5160026", "0.51578355", "0.5146708", "0.51438105", "0.5142185", "0.51421833", "0.51295376", "0.51292104", "0.5122974", "0.51149863", "0.5104341", "0.5103871", "0.5095811", "0.5086019", "0.5080481", "0.50788885", "0.5077189", "0.5069689", "0.50663203", "0.5063434", "0.5057403", "0.50556844", "0.50463355", "0.50453997", "0.50437784", "0.504275", "0.5025555", "0.50223404", "0.5021187" ]
0.8425102
0
Test unsubscribe from room with OK response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testUnsubsribeFromRoomOkResponse() { // given final UnsubscribeRequest unsubscribeRequest = UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest)) .willReturn(OK_RESPONSE); // when multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomBadResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n public void subscribe_unsubscribe() {\n String channelName = \"subscribe_unsubscribe_\" + testParams.name;\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[0].keyStr);\n ably = new AblyRealtime(opts);\n\n /* create a channel and attach */\n final Channel channel = ably.channels.get(channelName);\n channel.attach();\n (new ChannelWaiter(channel)).waitFor(ChannelState.attached);\n assertEquals(\"Verify attached state reached\", channel.state, ChannelState.attached);\n\n /* subscribe */\n MessageListener testListener = new MessageListener() {\n @Override\n public void onMessage(Message message) {\n }};\n channel.subscribe(\"test_event\", testListener);\n /* unsubscribe */\n channel.unsubscribe(\"test_event\", testListener);\n } catch (AblyException e) {\n e.printStackTrace();\n fail(\"init0: Unexpected exception instantiating library\");\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "static void confirmUnSubscribe_C(Messenger messenger, Response_e response)\n {\n sendToClient( messenger, Request_e.Request_UnSubscribe_Event_C_en.valueOf(), response, null );\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "public void onUnsubscribe() {\n\n }", "void delete(UnsubscribeRequest request, ResultCapture<Void> extractor);", "private void doUnsubscribe(IoSession session, MessageProtocol request) throws Exception {\n \t\n \tdoExit(session);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "void delete(UnsubscribeRequest request);", "@Override\n\tpublic void onUnsubscribe(String arg0, int arg1) {\n\t\t\n\t}", "public void unsubscribe(ClientAddress address, ChannelAddress channelAddress);", "void unsubscribe(String id);", "public void unsubscribeToCovRequest() {\n try {\n DeviceService.localDevice.send(bacnetDevice, new SubscribeCOVRequest(new UnsignedInteger(1), getObjectIdentifier(), null, null)).get();\n LOG.info(\"Unsubscription @: '\" + getObjectIdentifier() + \"' on: \" + bacnetDevice.getObjectIdentifier());\n } catch (BACnetException e) {\n LOG.warn(\"Can't unsubscribe : '\" + getObjectIdentifier() + \"' on: \" + bacnetDevice.getObjectIdentifier());\n }\n\n }", "void unsubscribe(){}", "public abstract void unsubscribeImpl(String str, Resolver<Void> resolver);", "@Test\n public void unsubscribe_all() throws AblyException {\n /* Ably instance that will emit messages */\n AblyRealtime ably1 = null;\n /* Ably instance that will receive messages */\n AblyRealtime ably2 = null;\n\n String channelName = \"test.channel.unsubscribe.all\" + System.currentTimeMillis();\n Message[] messages = new Message[] {\n new Message(\"name1\", \"Lorem ipsum dolor sit amet\"),\n new Message(\"name2\", \"Consectetur adipiscing elit.\"),\n new Message(\"name3\", \"Pellentesque nulla lorem\"),\n new Message(\"name4\", \"Efficitur ac consequat a, commodo ut orci.\"),\n };\n\n try {\n ClientOptions option1 = createOptions(testVars.keys[0].keyStr);\n option1.clientId = \"emitter client\";\n ClientOptions option2 = createOptions(testVars.keys[0].keyStr);\n option2.clientId = \"receiver client\";\n\n ably1 = new AblyRealtime(option1);\n ably2 = new AblyRealtime(option2);\n\n Channel channel1 = ably1.channels.get(channelName);\n channel1.attach();\n new ChannelWaiter(channel1).waitFor(ChannelState.attached);\n\n Channel channel2 = ably2.channels.get(channelName);\n channel2.attach();\n new ChannelWaiter(channel2).waitFor(ChannelState.attached);\n\n /* Create a listener that collect received messages */\n ArrayList<Message> receivedMessageStack = new ArrayList<>();\n MessageListener listener = new MessageListener() {\n List<Message> messageStack;\n\n @Override\n public void onMessage(Message message) {\n messageStack.add(message);\n }\n\n public MessageListener setMessageStack(List<Message> messageStack) {\n this.messageStack = messageStack;\n return this;\n }\n }.setMessageStack(receivedMessageStack);\n\n /* Subscribe using various alternatives of {@code Channel#subscribe()} */\n channel2.subscribe(listener);\n channel2.subscribe(messages[0].name, listener);\n channel2.subscribe(new String[] {messages[1].name, messages[2].name}, listener);\n\n /* Unsubscribe */\n channel2.unsubscribe();\n\n /* Start emitting channel with ably client 1 (emitter) */\n Helpers.CompletionWaiter waiter = new Helpers.CompletionWaiter();\n channel1.publish(messages, waiter);\n waiter.waitFor();\n\n /* Validate that we didn't received anything\n */\n assertThat(receivedMessageStack, Matchers.is(Matchers.emptyCollectionOf(Message.class)));\n } finally {\n if (ably1 != null) ably1.close();\n if (ably2 != null) ably2.close();\n }\n }", "private void unsubscribeHandler(MqttUnsubscribeMessage unsubscribe) {\n\n final int messageId = unsubscribe.messageId();\n LOG.info(\"UNSUBSCRIBE [{}] from MQTT client {}\", messageId, this.mqttEndpoint.clientIdentifier());\n\n // sending AMQP_UNSUBSCRIBE\n\n AmqpUnsubscribeMessage amqpUnsubscribeMessage =\n new AmqpUnsubscribeMessage(this.mqttEndpoint.clientIdentifier(), unsubscribe.topics());\n\n this.ssEndpoint.sendUnsubscribe(amqpUnsubscribeMessage, done -> {\n\n if (done.succeeded()) {\n\n this.mqttEndpoint.unsubscribeAcknowledge(messageId);\n\n // removing topics from local collection\n unsubscribe.topics().stream().forEach(topic -> {\n\n this.grantedQoSLevels.remove(topic);\n });\n\n LOG.info(\"UNSUBACK [{}] to MQTT client {}\", messageId, this.mqttEndpoint.clientIdentifier());\n }\n });\n }", "void unsubscribe();", "@Override\n public void onUnsubscribe(String s, int i) {\n }", "@Test\n public void testForumUnsubscribe() {\n try {\n ForumDTO forumDTO = forumService.unsubscribeFrom(FORUM_ID, USER_ID);\n assertFalse(forumDTO.getSubscribers().stream()\n .map(UserDTO::getUsername)\n .collect(Collectors.toSet())\n .contains(USER_NAME)\n );\n } catch (Exception e) {\n fail(e.getMessage());\n }\n }", "public void unsubscribe() {\r\n new Thread(new Runnable() {\r\n public void run() {\r\n int attempts = 0;\r\n while(++attempts < 20) {\r\n try {\r\n if (server.removeSubscriber(PubSubAgent.this.agentID)) {\r\n subscriberKeywords.clear();\r\n subscriberTopics.clear();\r\n }\r\n System.out.print(\"Unsubscribed from all Topics.\");\r\n return;\r\n } catch(RemoteException e) {\r\n System.err.println(\"Could not connect to server. Retrying...\");\r\n try {\r\n Thread.sleep(800);\r\n } catch(Exception ex) {\r\n ex.printStackTrace();\r\n }\r\n }\r\n }\r\n System.err.println(\"Couldn't Unsubscribe from all the topics...\");\r\n }\r\n }).start();\r\n }", "void unsubscribe(Subscription subscription);", "public void unsubscribe(String name, String clientId) throws RemoteException;", "private void unsubscribe() {\n Log.i(TAG, \"Unsubscribing.\");\n Nearby.Messages.unsubscribe(mGoogleApiClient, mMessageListener);\n }", "protected void testUncancelReal() {\n\n log.info(\"Starting testUncancel\");\n\n try {\n\n String prod = \"Shotgun\";\n BillingPeriod term = BillingPeriod.MONTHLY;\n String planSet = IPriceListSet.DEFAULT_PRICELIST_NAME;\n\n // CREATE\n Subscription subscription = createSubscription(prod, term, planSet);\n IPlanPhase trialPhase = subscription.getCurrentPhase();\n assertEquals(trialPhase.getPhaseType(), PhaseType.TRIAL);\n\n // NEXT PHASE\n DateTime expectedPhaseTrialChange = Clock.addDuration(subscription.getStartDate(), trialPhase.getDuration());\n checkNextPhaseChange(subscription, 1, expectedPhaseTrialChange);\n\n // MOVE TO NEXT PHASE\n testListener.pushExpectedEvent(NextEvent.PHASE);\n clock.setDeltaFromReality(trialPhase.getDuration(), DAY_IN_MS);\n assertTrue(testListener.isCompleted(2000));\n IPlanPhase currentPhase = subscription.getCurrentPhase();\n assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);\n\n // SET CTD + RE READ SUBSCRIPTION + CHANGE PLAN\n IDuration ctd = getDurationMonth(1);\n DateTime newChargedThroughDate = Clock.addDuration(expectedPhaseTrialChange, ctd);\n billingApi.setChargedThroughDate(subscription.getId(), newChargedThroughDate);\n subscription = (Subscription) entitlementApi.getSubscriptionFromId(subscription.getId());\n\n testListener.pushExpectedEvent(NextEvent.CANCEL);\n\n // CANCEL\n subscription.cancel(clock.getUTCNow(), false);\n assertFalse(testListener.isCompleted(2000));\n\n subscription.uncancel();\n\n // MOVE TO EOT + RECHECK\n clock.addDeltaFromReality(ctd);\n DateTime future = clock.getUTCNow();\n assertFalse(testListener.isCompleted(2000));\n\n IPlan currentPlan = subscription.getCurrentPlan();\n assertEquals(currentPlan.getProduct().getName(), prod);\n currentPhase = subscription.getCurrentPhase();\n assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);\n\n } catch (EntitlementUserApiException e) {\n Assert.fail(e.getMessage());\n }\n }", "@Override\n\tpublic void onPUnsubscribe(String arg0, int arg1) {\n\t\t\n\t}", "public void unsubscribe(String subscriptionId) {\n \n \t\tWebTarget wt = subscriptionsTarget.path(subscriptionId);\n \t\t\n \t\tResponse response = wt.request()\n \t\t\t .header(\"Authorization\", \"Bearer \" + playPlatformApiToken)\n \t\t\t .buildDelete()\n \t\t\t .invoke();\n \t\t\n \t\tlogger.debug(\"Unsubscribe response status : \"+response.getStatus());\n\t\tif (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {\n \t\t\tlogger.error(\"Unsubscription failed. HTTP Status Code: \"+response.getStatus());\n \t\t}\n\t\telse {\n \t\t\tsubscriptions.remove(subscriptionId);\n \t\t}\n \t\tresponse.close();\n \t}", "private void doUnsubscribe(JSONArray args, CallbackContext callbackContext,\n\t\t\tMqttAndroidClient client) throws JSONException {\n\t\tString topicFilter = args.getString(1);\n\t\tfinal JSONObject invocationContext = args.optJSONObject(2);\n\t\ttry {\n\t\t\tclient.unsubscribe(topicFilter, null,\n\t\t\t\t\tnew GeneralCallback(invocationContext, callbackContext));\n\t\t\n\t\t} catch (MqttException exception) {\n\t\t\tcallbackContext.error(createError(exception, invocationContext));\n\t\t}\n\t}", "private void unsubscribeSent(AsyncResult<Integer> result, List<String> topics) {\n if (result.failed() || result.result() == null) {\n closeConnection(String.format(\"Failed to send unsubscribe request: %s\", result.cause()));\n } else {\n this.pendingUnsubscribes.put(result.result(), topics);\n }\n }", "private void unsubscribe() {\n subscriber=null;\n }", "void unsubscribe(Player player);", "@Override\n public void onUnsubscribe(String channel, int subscribedChannels) {\n super.onUnsubscribe(channel, subscribedChannels);\n System.out.println(\"Channel unsubscribed at : \" + channel);\n }", "@Override\n\tpublic void unsubscribe(Strategy strategy) {\n\t\t\n\t}", "@Override\n public void onPUnsubscribe(String s, int i) {\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n public void testHttpDisconnectFromServerAfterConnected() throws Exception {\n final String testAddr = UUID.randomUUID().toString();\n final Subscription server = TestHttpUtil.createTestServerWith(testAddr, \n new Action1<HttpTrade>() {\n @Override\n public void call(final HttpTrade trade) {\n trade.abort();\n }},\n ENABLE_LOGGING);\n \n// final HttpTestServer server = createTestServerWith(false, \"test\",\n// new Func0<ChannelInboundHandler> () {\n// @Override\n// public ChannelInboundHandler call() {\n// return new HttpTestServerHandler() {\n// @Override\n// protected void channelRead0(final ChannelHandlerContext ctx, final HttpObject msg) \n// throws Exception {\n// if (msg instanceof HttpRequest) {\n// ctx.close();\n// }\n// }\n// };\n// }});\n \n final TestChannelCreator creator = new TestChannelCreator();\n final TestChannelPool pool = new TestChannelPool(1);\n final DefaultHttpClient client = new DefaultHttpClient(creator, pool,\n ENABLE_LOGGING);\n final TestSubscriber<HttpObject> testSubscriber = new TestSubscriber<HttpObject>();\n final OnNextSensor<HttpObject> nextSensor = new OnNextSensor<HttpObject>();\n try {\n final CountDownLatch unsubscribed = new CountDownLatch(1);\n client.defineInteraction(\n// new LocalAddress(\"test\"),\n new LocalAddress(testAddr),\n Observable.just(fullHttpRequest()).doOnNext(nextSensor))\n .compose(RxFunctions.<HttpObject>countDownOnUnsubscribe(unsubscribed))\n .subscribe(testSubscriber);\n unsubscribed.await();\n testSubscriber.awaitTerminalEvent();\n \n // await for 1 second\n pool.awaitRecycleChannels(1);\n assertEquals(1, creator.getChannels().size());\n creator.getChannels().get(0).assertClosed(1);\n } finally {\n client.close();\n// server.stop();\n server.unsubscribe();\n testSubscriber.assertTerminalEvent();\n assertEquals(1, testSubscriber.getOnErrorEvents().size());\n// assertEquals(RuntimeException.class, \n// testSubscriber.getOnErrorEvents().get(0).getClass());\n assertEquals(0, testSubscriber.getCompletions());\n assertEquals(0, testSubscriber.getOnNextEvents().size());\n // channel connected, so message has been send\n nextSensor.assertCalled();\n }\n }", "@Test\n public void testUnRegister(TestContext context) {\n NetClient client = vertx.createNetClient();\n final Async async = context.async();\n\n final String address = \"test\";\n client.connect(7000, \"localhost\").onComplete(context.asyncAssertSuccess(socket -> {\n\n // 2 replies will arrive:\n // 1). message published to test\n // 2). err of NO_HANDLERS because of consumer for 'test' is unregistered.\n final AtomicBoolean unregistered = new AtomicBoolean(false);\n final FrameParser parser = new FrameParser(parse -> {\n context.assertTrue(parse.succeeded());\n JsonObject frame = parse.result();\n if (unregistered.get()) {\n // consumer on 'test' has been unregistered, send message will fail.\n context.assertEquals(\"err\", frame.getString(\"type\"));\n context.assertEquals(\"#backtrack\", frame.getString(\"address\"));\n context.assertEquals(\"NO_HANDLERS\", frame.getString(\"failureType\"));\n context.assertEquals(\"No handlers for address test\", frame.getString(\"message\"));\n client.close();\n async.complete();\n } else {\n // got message, then unregister the handler\n context.assertNotEquals(\"err\", frame.getString(\"type\"));\n context.assertEquals(false, frame.getBoolean(\"send\"));\n context.assertEquals(\"Vert.x\", frame.getJsonObject(\"body\").getString(\"value\"));\n unregistered.compareAndSet(false, true);\n FrameHelper.sendFrame(\"unregister\", address, null, socket);\n FrameHelper.sendFrame(\"send\", address, \"#backtrack\", new JsonObject().put(\"value\", \"This will fail anyway!\"), socket);\n }\n });\n\n socket.handler(parser);\n\n FrameHelper.sendFrame(\"register\", address, null, socket);\n FrameHelper.sendFrame(\"publish\", address, new JsonObject().put(\"value\", \"Vert.x\"), socket);\n }));\n\n }", "@Test\n public void testLogoutResponse() {\n LogoutDelegate delegate = new LogoutDelegate() {\n @Override\n public void logoutPassed() {\n\n }\n\n @Override\n public void logoutFailed(String message) {\n\n fail(message);\n }\n };\n\n\n // Call the method\n testConnector.logout(delegate);\n\n\n // Make sure the data was unset\n assertNull(DataStore.sharedInstance().getCurrentUser());\n assertNull(DataStore.sharedInstance().getToken());\n assertEquals(0, DataStore.sharedInstance().getProducts().size());\n assertEquals(0, DataStore.sharedInstance().getRewards().size());\n }", "private void deleteSubscription(RoutingContext routingContext) {\n LOGGER.debug(\"Info: deleteSubscription method started;\");\n HttpServerRequest request = routingContext.request();\n HttpServerResponse response = routingContext.response();\n String domain = request.getParam(JSON_DOMAIN);\n String usersha = request.getParam(JSON_USERSHA);\n String alias = request.getParam(JSON_ALIAS);\n String subsId = domain + \"/\" + usersha + \"/\" + alias;\n JsonObject requestJson = new JsonObject();\n String instanceID = request.getHeader(HEADER_HOST);\n requestJson.put(SUBSCRIPTION_ID, subsId);\n requestJson.put(JSON_INSTANCEID, instanceID);\n String subHeader = request.getHeader(HEADER_OPTIONS);\n String subscrtiptionType =\n subHeader != null && subHeader.contains(SubsType.STREAMING.getMessage())\n ? SubsType.STREAMING.getMessage()\n : SubsType.CALLBACK.getMessage();\n requestJson.put(SUB_TYPE, subscrtiptionType);\n JsonObject authInfo = (JsonObject) routingContext.data().get(\"authInfo\");\n if (requestJson.containsKey(SUB_TYPE)) {\n JsonObject jsonObj = requestJson.copy();\n jsonObj.put(JSON_CONSUMER, authInfo.getString(JSON_CONSUMER));\n Future<JsonObject> subsReq = subsService.deleteSubscription(jsonObj, databroker, database);\n subsReq.onComplete(subHandler -> {\n if (subHandler.succeeded()) {\n handleSuccessResponse(response, ResponseType.Ok.getCode(),\n subHandler.result().toString());\n } else {\n processBackendResponse(response, subHandler.cause().getMessage());\n }\n });\n } else {\n handleResponse(response, ResponseType.BadRequestData, MSG_SUB_TYPE_NOT_FOUND);\n }\n }", "void unsubscribe(Player player, boolean fast);", "private void playUnsubscriptionConfirmationPromptAndUnsubscribeUser(String callerId) throws AgiException, DAOException\n\t{\n\t\tstreamFile(Constants.PROMPT_FOR_SUCCESSFUL_UNSUBSCRIPTION);\n\n\t\tUserBean user = UserManagerImpl.getInstance().loadByPrimaryKey(callerId);\n\n\t\tuser.setSubscriptionStatus(Constants.SUBSCRIPTION_STATUS_UNSUBSCRIBED);\n\n\t\tuser.update();\n\t}", "private void unsubscribeCompleted(Integer messageId) {\n List<String> request = this.pendingUnsubscribes.remove(messageId);\n if (request != null) {\n for (String topic : request) {\n notifySubscriptionState(topic, SubscriptionState.UNSUBSCRIBED, null);\n }\n }\n }", "@Test\n public void unregister() {\n BaseEventBus eventBus = new SynchronousEventBus(LOG);\n\n Object object1 = new Object() {\n @Subscriber\n public void onIntEvent(Integer event) {\n LOG.debug(\"handled event: {}\", event);\n }\n };\n\n Object object2 = new Object() {\n @Subscriber\n public void onStringEvent(String event) {\n LOG.debug(\"handled event: {}\", event);\n }\n };\n\n eventBus.register(object1);\n eventBus.register(object2);\n assertThat(eventBus.objectSubscriberMethods.size(), is(2));\n assertThat(eventBus.eventTypeToSubscriberMethods.size(), is(2));\n assertThat(eventBus.eventTypeToSubscriberMethods.get(String.class).size(), is(1));\n assertThat(eventBus.eventTypeToSubscriberMethods.get(Integer.class).size(), is(1));\n\n eventBus.unregister(object2);\n assertThat(eventBus.objectSubscriberMethods.size(), is(1));\n assertThat(eventBus.eventTypeToSubscriberMethods.size(), is(1));\n assertThat(eventBus.eventTypeToSubscriberMethods.containsKey(String.class), is(false));\n assertThat(eventBus.eventTypeToSubscriberMethods.get(Integer.class).size(), is(1));\n\n eventBus.unregister(object1);\n assertThat(eventBus.objectSubscriberMethods.size(), is(0));\n assertThat(eventBus.eventTypeToSubscriberMethods.size(), is(0));\n }", "@Test\n public void testRemoveConference() throws Exception {\n EventData deltaEvent = prepareDeltaEvent(createdEvent);\n deltaEvent.setConferences(Collections.emptyList());\n updateEventAsOrganizer(deltaEvent);\n\n EventData updatedEvent = eventManager.getEvent(defaultFolderId, createdEvent.getId());\n assertThat(\"Should be no conferences!\", updatedEvent.getConferences(), empty());\n\n /*\n * Check that mails has been send\n */\n AnalyzeResponse analyzeResponse = receiveUpdateAsAttendee(PartStat.ACCEPTED, CustomConsumers.ALL, 1);\n AnalysisChange change = assertSingleChange(analyzeResponse);\n assertSingleDescription(change, \"access information was removed\");\n }", "public void syncUnsubscribe(String aSid)\n {\n SyncUnsubscribeOpenhomeOrgSubscriptionLongPoll1 sync = new SyncUnsubscribeOpenhomeOrgSubscriptionLongPoll1(this);\n beginUnsubscribe(aSid, sync.getListener());\n sync.waitToComplete();\n sync.reportError();\n }", "@Test\n void awaitMessage() {\n\n Message message = null;\n TempBroadcast b = new TempBroadcast(\"broadcastSender2\");\n\n broadcastReceiver.subscribeBroadcast(TempBroadcast.class, c -> {\n });\n broadcastSender.sendBroadcast(b);\n\n // here we will check the method\n try {\n message = messageBus.awaitMessage(broadcastReceiver);\n\n } catch (InterruptedException e) {\n e.printStackTrace();\n //due to the assumption above, an exception is not supposed to be thrown\n }\n assertEquals(b, message);\n }", "@Test\n public void testBroadcastedTransactionDeserializer(){\n try{\n mMessagesHub = new SubscriptionMessagesHub(\"\", \"\", mErrorListener);\n mMessagesHub.addSubscriptionListener(new SubscriptionListener() {\n private int MAX_MESSAGES = 15;\n private int messageCounter = 0;\n\n @Override\n public ObjectType getInterestObjectType() {\n return ObjectType.TRANSACTION_OBJECT;\n }\n\n @Override\n public void onSubscriptionUpdate(SubscriptionResponse response) {\n if(response.params.size() == 2){\n List<Serializable> payload = (List) response.params.get(1);\n if(payload.size() > 0){\n for(Serializable item : payload){\n if(item instanceof BroadcastedTransaction){\n BroadcastedTransaction broadcastedTransaction = (BroadcastedTransaction) item;\n Transaction tx = broadcastedTransaction.getTransaction();\n System.out.println(String.format(\"Got %d operations\", tx.getOperations().size()));\n }\n }\n }\n }\n\n // Waiting for MAX_MESSAGES messages before releasing the wait lock\n messageCounter++;\n if(messageCounter > MAX_MESSAGES){\n synchronized (SubscriptionMessagesHubTest.this){\n SubscriptionMessagesHubTest.this.notifyAll();\n }\n }\n }\n });\n\n mWebSocket.addListener(mMessagesHub);\n mWebSocket.connect();\n\n // Holding this thread while we get update notifications\n synchronized (this){\n wait();\n }\n } catch (WebSocketException e) {\n System.out.println(\"WebSocketException. Msg: \" + e.getMessage());\n } catch (InterruptedException e) {\n System.out.println(\"InterruptedException. Msg: \"+e.getMessage());\n }\n }", "public void removeOrDisconnectClient(String mqttClientChannelID, String unSubscribedTopic, String username,\n SubscriptionEvent action) throws MQTTException {\n\n log.info(\"Disconnecting channel for clientID: \" + mqttClientChannelID);\n\n Collection<MQTTSubscription> topicSubscriptionList;\n MQTTopics mqtTopics = topicSubscriptions.get(mqttClientChannelID);\n\n if (null != mqtTopics) {\n if (null == unSubscribedTopic) {\n //this means we need to remove all subscriptions relevant for the channel\n topicSubscriptionList = mqtTopics.getAllSubscriptionsForChannel();\n } else {\n topicSubscriptionList = new ArrayList<>();\n topicSubscriptionList.add(mqtTopics.getSubscription(unSubscribedTopic));\n }\n\n for (MQTTSubscription subscription : topicSubscriptionList) {\n //Will get the topic name bound for subscription\n String topic = subscription.getTopicName();\n //Will remove the subscriber off the list\n mqtTopics.removeSubscriber(topic);\n String subscriberChannelID = subscription.getSubscriberChannelID();\n UUID subscriberChannel = subscription.getSubscriptionChannel();\n boolean isCleanSession = subscription.isCleanSession();\n QOSLevel qos = subscription.getQOSLevel();\n //The corresponding subscription created cluster wide will be topic name and the local channel id\n //Will remove the subscriber cluster wide\n try {\n //Will indicate the disconnection of the topic\n if (action == SubscriptionEvent.DISCONNECT && MQTTUtils.isDurable(isCleanSession, qos.getValue())) {\n connector.disconnectSubscriber(this, topic, username, subscriberChannelID, subscriberChannel,\n isCleanSession, mqttClientChannelID, qos);\n } else {\n //If un-subscribed we need to remove the subscription off\n connector.removeSubscriber(this, topic, username, subscriberChannelID, subscriberChannel,\n isCleanSession, mqttClientChannelID, qos);\n }\n if (log.isDebugEnabled()) {\n final String message = \"Subscription with cluster id \" + subscriberChannelID + \" disconnected \" +\n \"from topic \" + topic;\n log.debug(message);\n }\n\n } catch (MQTTException ex) {\n //Should re state the connection of the subscriber back to the map\n mqtTopics.addSubscriber(unSubscribedTopic, subscription);\n final String error = \"Error occurred while removing the subscription \" + mqttClientChannelID;\n log.error(error, ex);\n throw ex;\n }\n }\n\n //Finally will check if there're any relevant subscriptions for the topic\n //If there arn't we could remove the entry\n if(mqtTopics.getAllSubscriptionsForChannel().isEmpty()){\n topicSubscriptions.remove(mqttClientChannelID);\n }\n } else {\n //If the connection is publisher based\n UUID publisherID = connector.removePublisher(mqttClientChannelID);\n if (null == publisherID) {\n log.warn(\"A subscriber or a publisher with Connection with id \" + mqttClientChannelID + \" cannot be \" +\n \"found to disconnect.\");\n }\n }\n }", "@Teardown\n public void tearDown() {\n if (channel != null) {\n channel.shutdownNow();\n channel = null;\n }\n }", "static void confirmSubscribe_C(Messenger messenger, Response_e response)\n {\n sendToClient( messenger, Request_e.Request_Subscribe_Event_C_en.valueOf(), response, null );\n }", "@Test\n public void testClient(){\n received=false;\n uut=new ChatMessageRequest(\"test\",\"test2\",\"test\",MessageTypes.MATCH);\n uut.clientHandle(null,new TestUtilizer());\n assertTrue(received);\n }", "@Test\n public void testCloseConnection() {\n String responseMsg = target.path(\"myresource/quit\").request().get(String.class);\n assertEquals(\"<h1>connection is closed</h1>\", responseMsg);\n }", "void unsubscribe(Contact contact)\n throws IllegalArgumentException, IllegalStateException, OperationFailedException;", "@Test\n public void testStopListening() {\n System.out.println(\"stopListening\");\n instance.stopListening();\n }", "@Override\n public void unsubscribe(Entity e) {\n unsub_queue.add(e);\n }", "@Test\n public void testRemoveRequest() throws Exception {\n System.out.println(\"removeRequest\");\n Sendable s = sendAMessage();\n\n String a = s.getMessageId();\n String comment = \"\";\n instance.removeRequest(a, comment);\n }", "default void unsubscribe()\n throws TopicReceiverException\n {\n try {\n close();\n } catch ( Exception e ) {\n throw new TopicReceiverException(getTopic(), e);\n }\n }", "@Test\n public void testHttpForNotConnected() throws Exception {\n \n final CountDownLatch unsubscribed = new CountDownLatch(1);\n \n final TestChannelCreator creator = new TestChannelCreator();\n final DefaultHttpClient client = new DefaultHttpClient(creator, ENABLE_LOGGING);\n // NOT setup server for local channel\n final TestSubscriber<HttpObject> testSubscriber = new TestSubscriber<HttpObject>();\n final OnNextSensor<HttpObject> nextSensor = new OnNextSensor<HttpObject>();\n try {\n client.defineInteraction(new LocalAddress(\"test\"), \n Observable.<HttpObject>just(fullHttpRequest()).doOnNext(nextSensor))\n .compose(RxFunctions.<HttpObject>countDownOnUnsubscribe(unsubscribed))\n .subscribe(testSubscriber);\n \n unsubscribed.await();\n \n testSubscriber.awaitTerminalEvent();\n assertEquals(1, creator.getChannels().size());\n creator.getChannels().get(0).assertClosed(1);\n } finally {\n client.close();\n assertEquals(0, testSubscriber.getOnNextEvents().size());\n assertEquals(0, testSubscriber.getCompletions());\n assertEquals(1, testSubscriber.getOnErrorEvents().size());\n nextSensor.assertNotCalled();\n }\n }", "@SneakyThrows\n private void unsubscribe(String name) {\n call(\"unsubscribe\", new Subscription(name)).toFuture().get(UNSUBSCRIBE_DELAY_S, TimeUnit.SECONDS);\n }", "@Override\n\t\t\tpublic void onPUnsubscribe(String pattern, int subscribedChannels) {\n\t\t\t\tlog.debug(\"====== onPUnsubscribe(): pattern = {}, subscribedChannels = {}\", pattern, subscribedChannels);\n\t\t\t}", "@Test\r\n\tpublic void test() {\r\n\t\tassertEquals(subscribe.getTopic() , \"room1\");\r\n\t\tassertEquals(subscribe.getTypeMap() , \"Galilei\");\r\n\t\tassertTrue(subscribe.isPossible(server));\r\n\t\tassertTrue(!subscribe2.isPossible(server));\r\n\t}", "public void receiveResultdelEquipment(\n org.apache.ws.axis2.MySQLServiceEquipmentStub.DelEquipmentResponse result) {\n }", "void unsubscribeAll();", "@Test\n public void testSend200OkResponseWithoutBody() {\n String expected = \"RTSP/1.0 200 OK\\r\\n\" + (((\"server: Testserver\\r\\n\" + \"cseq: 1\\r\\n\") + \"session: 2547019973447939919\\r\\n\") + \"\\r\\n\");\n HttpResponse response = new io.netty.handler.codec.http.DefaultHttpResponse(RTSP_1_0, OK);\n response.headers().add(SERVER, \"Testserver\");\n response.headers().add(CSEQ, \"1\");\n response.headers().add(SESSION, \"2547019973447939919\");\n EmbeddedChannel ch = new EmbeddedChannel(new RtspEncoder());\n ch.writeOutbound(response);\n ByteBuf buf = ch.readOutbound();\n String actual = buf.toString(UTF_8);\n buf.release();\n Assert.assertEquals(expected, actual);\n }", "private void genericUnsubscribeFactory(String request, BandInfo band) {\n if (bandStreams.containsKey(band) && bandStreams.get(band).contains(request)) {\n if (bandStreams.get(band).size() == 1) {\n // Only stream open for this band, remove from bandStreams\n bandStreams.remove(band);\n } else {\n // Other streams open, remove from list\n bandStreams.get(band).remove(request);\n }\n\n // Remove stream from preferences\n SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());\n Set<String> streams = prefs.getStringSet(Preferences.getDeviceKey(band.getMacAddress()), new HashSet<String>());\n if (streams.contains(request)) {\n Log.v(TAG, \"Removing stream \" + request);\n streams.remove(request);\n Log.v(TAG, \"Streams after removing \" + request + \": \" + streams);\n prefs.edit().putStringSet(Preferences.getDeviceKey(band.getMacAddress()), streams).apply();\n }\n\n // Unsubscribe from the appropriate stream\n switch (request) {\n case ACCEL_REQ_EXTRA:\n if (accManager != null)\n accManager.unSubscribe(band);\n break;\n case ALT_REQ_EXTRA:\n if (altManager != null)\n altManager.unSubscribe(band);\n break;\n case AMBIENT_REQ_EXTRA:\n if (ambManager != null)\n ambManager.unSubscribe(band);\n break;\n case BAROMETER_REQ_EXTRA:\n if (barometerManager != null)\n barometerManager.unSubscribe(band);\n break;\n case CALORIES_REQ_EXTRA:\n if (calManager != null)\n calManager.unSubscribe(band);\n break;\n case CONTACT_REQ_EXTRA:\n if (conManager != null)\n conManager.unSubscribe(band);\n break;\n case DISTANCE_REQ_EXTRA:\n if (distManager != null)\n distManager.unSubscribe(band);\n break;\n case GSR_REQ_EXTRA:\n if (gsrManager != null)\n gsrManager.unSubscribe(band);\n break;\n case GYRO_REQ_EXTRA:\n if (gyroManager != null)\n gyroManager.unSubscribe(band);\n break;\n case HEART_RATE_REQ_EXTRA:\n if (heartManager != null)\n heartManager.unSubscribe(band);\n break;\n case PEDOMETER_REQ_EXTRA:\n if (pedoManager != null)\n pedoManager.unSubscribe(band);\n break;\n case SKIN_TEMP_REQ_EXTRA:\n if (skinTempManager != null)\n skinTempManager.unSubscribe(band);\n break;\n case UV_REQ_EXTRA:\n if (uvManager != null)\n uvManager.unSubscribe(band);\n break;\n default:\n Log.e(TAG, \"Unknown subscription requested \" + request);\n }\n } else {\n if (!bandStreams.containsKey(band)) {\n Log.e(TAG, \"Error: unsubscribe request for a band that isnt stored\");\n Log.v(TAG, \"Band: \" + band.toString());\n for (BandInfo info :\n bandStreams.keySet()) {\n Log.v(TAG, \"Key: \" + info.toString());\n }\n } else {\n if (!bandStreams.get(band).contains(request)) {\n Log.e(TAG, \"Error: unsubscribe request for unregistered request\");\n }\n }\n }\n }", "@Test\r\n\tpublic final void testDeleteRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\tassertTrue(success);\r\n\t\t// get room (id) due to autoincrement\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\t// remove room (thru id)+verify\r\n\t\tsuccess = roomServices.deleteRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// verify thru id search, verify null result\r\n\t\tRoom actual = roomServices.getRoomById(copy.getId());\r\n\t\tassertNull(actual);\r\n\t}", "public void sendUnbindResponse(Pdu packet);", "void wipeSubscriptions(String sessionID);", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<Response<Void>> deleteRoomWithResponse(String roomId) {\n return deleteRoomWithResponse(roomId, null);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "public void disconnectFromAudio() {\n String json = new Gson().toJson(new TelevisionModel(TelevisionModel.Action.DISCONNECT));\n String a = sendMessage(json);\n TelevisionModel teleM = new Gson().fromJson(a, TelevisionModel.class);\n System.out.println(\"Client Received \" + json);\n\n if (teleM.getAction() == TelevisionModel.Action.DISCONNECT) {\n isDisconnecting = teleM.getValue();\n ui.updateArea(teleM.getMessage());\n };\n }", "@Override\n\tpublic void onUnSubscribeLobbyDone(LobbyEvent arg0) {\n\t\tMain.log(getClass(), \"onUnSubscribeLobbyDone\");\n\t}", "public interface aps {\n boolean isUnsubscribed();\n\n void unsubscribe();\n}", "@Test\n public void testRepositoryGotResponseOkForUser() throws InterruptedException {\n // Preconditions\n TestSubscriber<User> subscriber = new TestSubscriber<>();\n\n // Attaches the subscriber and executes the Observable.\n repository.get(1).subscribe(subscriber);\n RecordedRequest request = server.takeRequest();\n\n // Checks whether these methods from inner objects are called.\n verify(retrofitFactory).setBaseUrl(anyString());\n verify(retrofitFactory).create(UserService.class);\n verify(retrofitFactory).getClient();\n\n // Ensures there aren't new changes on the Rest adapter structure\n verifyNoMoreInteractions(retrofitFactory);\n\n // Ensures Observer and Requests are working as expected\n List<User> events = subscriber.getOnNextEvents();\n subscriber.assertNoErrors();\n subscriber.assertValueCount(1);\n subscriber.assertCompleted();\n subscriber.assertUnsubscribed();\n Assert.assertEquals(1, server.getRequestCount());\n Assert.assertEquals(\"/users/1\", request.getPath());\n Assert.assertNotNull(events);\n Assert.assertEquals(1, events.size());\n Assert.assertEquals(\"[email protected]\", events.get(0).email);\n }", "@Test\n public void successful_resign() {\n Player p1 = new Player(\"Player\");\n playerLobby.getGameCenter().newGame(p1, new Player(\"Opp\"));\n\n Map<String, Object> vm = new HashMap<String, Object>();\n vm.put(\"isGameOver\", true);\n vm.put(\"gameOverMessage\", p1.getName() + \" has resigned from the game. You are the winner!\");\n\n when(session.attribute(\"player\")).thenReturn(new Player(\"Player\"));\n\n CuT.handle(request, response);\n assertTrue(playerLobby.getGameCenter().justEnded(p1));\n assertEquals(new Gson().toJson(vm), playerLobby.getGame(p1).getMap().get(\"modeOptionsAsJSON\"));\n\n ResponseMessage message = new ResponseMessage();\n message.setType(ResponseMessage.MessageType.INFO);\n message.setText(\"You can not resign in the state you are in.\");\n }", "@Override\r\n public void unsubscribe() {\n t.interrupt();\r\n }", "@Override\r\n protected void onSocketApiResult(int requestCode, Object... args) {\r\n Log.e(\"response\", args[0].toString());\r\n switch (requestCode) {\r\n case NetworkSocketConstant.TEST_RESPONSE:\r\n TestMessageResponseBean deleteMessageResponse = SocketResponseParser.parseTestMessage(args[0].toString(), this);\r\n break;\r\n\r\n }\r\n }", "@Test\n public void startPollingAuthStatusSuccess() throws Exception {\n // Arrange\n TestSubscriber<String> subscriber = new TestSubscriber<>();\n when(mAccess.getSessionId(anyString())).thenReturn(STRING_TO_RETURN);\n when(mAccess.getEncryptedPayload(anyString(), anyString())).thenReturn(STRING_TO_RETURN);\n // Act\n mSubject.startPollingAuthStatus(\"1234567890\").toBlocking().subscribe(subscriber);\n // Assert\n verify(mAccess).getSessionId(anyString());\n verify(mAccess).getEncryptedPayload(anyString(), anyString());\n subscriber.assertCompleted();\n subscriber.onNext(STRING_TO_RETURN);\n subscriber.assertNoErrors();\n }", "public void Unsubscribe(Integer busLineID, final ConfigurationActivity configurationActivity) { //unsubscribe antoistoixi gia ena buslineid\n subscribedLists.remove(busLineID);\n Client client = subscribedThreads.get(busLineID);\n\n Message message = MapsActivity.mainHandler.obtainMessage();\n message.what = 6;\n message.obj = busLineID;\n MapsActivity.mainHandler.sendMessage(message);\n\n configurationActivity.runOnUiThread(new Runnable() {\n @Override\n public void run() {\n configurationActivity.updateGUI();\n }\n });\n\n Socket socket = subscribedSockets.get(busLineID);\n try {\n socket.close();\n } catch (IOException e) {\n }\n }", "public void unsubscribe(final Topic topic) {\r\n\r\n new Thread(new Runnable() {\r\n public void run() {\r\n int attempts = 0;\r\n while(++attempts < 20) {\r\n try {\r\n if (server.removeSubscriber(PubSubAgent.this.agentID, topic))\r\n subscriberTopics.remove(topic);\r\n System.out.println(\"Unsubscribed from the Topic: \" + topic.getTopicID() + \" - \" + topic.getTopicName());\r\n return;\r\n } catch(RemoteException e) {\r\n System.err.println(\"Could not connect to server. Retrying...\");\r\n try {\r\n Thread.sleep(800);\r\n } catch(Exception ex) {\r\n ex.printStackTrace();\r\n }\r\n }\r\n }\r\n System.err.println(\"Couldn't Unsubscribe from \" + topic.getTopicID() + \" - \" + topic.getTopicName());\r\n }\r\n }).start();\r\n }", "@Override\n public void unregister(Object subscriber) {\n }", "public final void unsubscribe() throws InvalidSubscriptionException {\r\n WritableSession session = (WritableSession) WebsocketActionSupport.getInstance().getSession();\r\n if (!sessions.contains(session)) {\r\n throw new InvalidSubscriptionException(\"Current session is not subscribed to this topic\");\r\n }\r\n sessions.remove(session);\r\n afterUnsubscribe(session);\r\n }", "public void unsubscribeAll() {\n \t\tint failCount = 0;\n \t\t// Make a copy of the collection because it will be modified in #unsubscribe()\n \t\tSet<String> removal = new HashSet<String>(subscriptions.keySet());\n \t\tfor (String subscriptionID : removal) {\n \t\t\tunsubscribe(subscriptionID);\n \t\t}\n \t\tif (failCount > 0) {\n \t\t\tlogger.warn(\n \t\t\t\t\t\"Problem while unsubcribing from all subscriptions: \"\n \t\t\t\t\t\t\t+ failCount\n \t\t\t\t\t\t\t+ \" unsubscriptions failed at DSB endpoint '\"\n \t\t\t\t\t\t\t+ subscriptionsTarget.getUri() + \"'\");\n \t\t} else {\n \t\t\tlogger.info(\n \t\t\t\t\t\"Successfully unsubcribed from all subscriptions at DSB endpoint '\"\n \t\t\t\t\t\t\t+ subscriptionsTarget.getUri() + \"'\");\n \t\t}\n \t}", "public void receiveResultdelResponsible(\n org.apache.ws.axis2.MySQLServiceEquipmentStub.DelResponsibleResponse result) {\n }", "@Override\n public void receive(SubscriptionDeletion event) {\n logger.info(\"###Received subscription deletion event with id:\" + event.getSubscription().getId());\n }", "@Test\n public void attach_implicit_subscribe_fail() throws AblyException {\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[1].keyStr);\n ably = new AblyRealtime(opts);\n\n /* wait until connected */\n new ConnectionWaiter(ably.connection).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", ably.connection.state, ConnectionState.connected);\n\n /* create a channel and subscribe */\n final Channel channel = ably.channels.get(\"subscribe_fail\");\n channel.subscribe(null);\n assertEquals(\"Verify attaching state reached\", channel.state, ChannelState.attaching);\n\n ErrorInfo fail = new ChannelWaiter(channel).waitFor(ChannelState.failed);\n assertEquals(\"Verify failed state reached\", channel.state, ChannelState.failed);\n assertEquals(\"Verify reason code gives correct failure reason\", fail.statusCode, 401);\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "public void onUaCallCancelled(UserAgent ua)\n { readyToReceive();\n }", "private void signOut() {\n MailboxServer.removeClient(this);\n clientResponse(\"GoodyBye!\");\n }", "@Test\n public void testRemovePeerDetailsSuccess() {\n participantsConfig.removePeer(IpAddress.valueOf(PEER_IP));\n expectLastCall().once();\n replay(participantsConfig);\n\n peerManager.activate();\n\n peerManager.removePeerDetails(IpAddress.valueOf(PEER_IP));\n verify(participantsConfig);\n }", "@Test\n public void testProcessNoResponse() {\n // NOTE: this json file is a RESPONSE, not a request\n String request = ResourceUtils.getResourceAsString(\"org/onap/policy/simulators/appclcm/appc.lcm.success.json\");\n assertNotNull(request);\n\n server.onTopicEvent(CommInfrastructure.NOOP, MY_TOPIC, request);\n\n verify(sink, never()).send(any());\n }", "@Test\n\tpublic void testDeleteRoomPositive() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "public void deleteMessageTest(){\n\t\tint messageId = 102;\n\t\tgiven()\n\t\t\t.pathParam(\"messageId\", messageId)\n\t\t.when()\n\t\t\t.delete(\"/message/{messageId}\")\n\t\t.then()\n\t\t\t.statusCode(200)\n\t\t\t.body(\"message\", is(\"Message Deleted \"+messageId));\n\t}", "public void testUnlinkLogMessagesFromService() {\n\n\t}", "@Override\n public CompletableFuture<Void> doUnsubscribe(Consumer consumer) {\n CompletableFuture<Void> future = new CompletableFuture<>();\n try {\n if (dispatcher.canUnsubscribe(consumer)) {\n consumer.close();\n return delete();\n }\n future.completeExceptionally(\n new ServerMetadataException(\"Unconnected or shared consumer attempting to unsubscribe\"));\n } catch (BrokerServiceException e) {\n log.warn(\"Error removing consumer {}\", consumer);\n future.completeExceptionally(e);\n }\n return future;\n }", "public Single<Void> whenComplete() {\n return mockSubscriber.completed();\n }", "@Test\r\n\tpublic void aTestValidSubscribe() {\r\n\t\tbroker.subscribe(intSub);\r\n\t\tbroker.subscribe(unreadSub);\r\n\t\tbroker.subscribe(pIntSub);\r\n\t}", "@Test\n public void testEventStreamClosed() throws Exception {\n CountDownLatch latch = new CountDownLatch(1);\n EventStreamClosedClient eventListener = new EventStreamClosedClient(latch);\n\n try (EventStream streamEvents = new WebSocketEventStream(uri, new Token(\"token\"), 0, 0, 0, eventListener)) {\n latch.await(30, TimeUnit.SECONDS);\n Assert.assertFalse(streamEvents.isEventStreamClosed());\n }\n }", "private void taskDone(HttpServletResponse resp, Long multicastId) {\n MessageStore.deleteMulticast(multicastId);\n resp.setStatus(200);\n }", "@Override\n public void rxUnsubscribe() {\n if (placesSubscriber != null) {\n if (!placesSubscriber.isDisposed()) {\n placesSubscriber.dispose();\n }\n }\n }" ]
[ "0.74956673", "0.67848885", "0.6698345", "0.6517849", "0.6343124", "0.6255932", "0.6255238", "0.6233202", "0.62093586", "0.62048733", "0.6142961", "0.61196", "0.6049487", "0.5994707", "0.59774095", "0.59432876", "0.587371", "0.585649", "0.5827028", "0.5824708", "0.5795557", "0.57892966", "0.57884216", "0.57774436", "0.57353956", "0.5705979", "0.5700055", "0.56724006", "0.56576884", "0.56193453", "0.5607609", "0.56016934", "0.5588136", "0.55849755", "0.55538553", "0.5503387", "0.545667", "0.5455952", "0.5453583", "0.53909", "0.53833073", "0.5351116", "0.5303627", "0.5303392", "0.5289691", "0.52639014", "0.52517545", "0.5243892", "0.5243456", "0.5242494", "0.5227394", "0.5216985", "0.5178119", "0.5175596", "0.5148408", "0.51460457", "0.5140567", "0.51276475", "0.51165557", "0.5115801", "0.51152277", "0.5104911", "0.510435", "0.51033425", "0.51010084", "0.50998557", "0.509235", "0.50737655", "0.5060153", "0.50402904", "0.50371337", "0.50366807", "0.5033004", "0.5012109", "0.5006535", "0.5004474", "0.5002749", "0.5001559", "0.4994644", "0.49893907", "0.49872226", "0.49784443", "0.49675918", "0.49638236", "0.49603856", "0.4958081", "0.49564546", "0.4955473", "0.49526927", "0.4943175", "0.49028844", "0.48986217", "0.48945946", "0.4892114", "0.4884563", "0.4882971", "0.48812068", "0.48693466", "0.4859034", "0.48557496" ]
0.85158426
0
Test unsubscribe from room with BAD response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testUnsubsribeFromRoomBadResponse() { // given final UnsubscribeRequest unsubscribeRequest = UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest)) .willReturn(BAD_RESPONSE); // when multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomOkResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "private void doUnsubscribe(IoSession session, MessageProtocol request) throws Exception {\n \t\n \tdoExit(session);\n }", "@Test\n public void subscribe_unsubscribe() {\n String channelName = \"subscribe_unsubscribe_\" + testParams.name;\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[0].keyStr);\n ably = new AblyRealtime(opts);\n\n /* create a channel and attach */\n final Channel channel = ably.channels.get(channelName);\n channel.attach();\n (new ChannelWaiter(channel)).waitFor(ChannelState.attached);\n assertEquals(\"Verify attached state reached\", channel.state, ChannelState.attached);\n\n /* subscribe */\n MessageListener testListener = new MessageListener() {\n @Override\n public void onMessage(Message message) {\n }};\n channel.subscribe(\"test_event\", testListener);\n /* unsubscribe */\n channel.unsubscribe(\"test_event\", testListener);\n } catch (AblyException e) {\n e.printStackTrace();\n fail(\"init0: Unexpected exception instantiating library\");\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "public void onUnsubscribe() {\n\n }", "static void confirmUnSubscribe_C(Messenger messenger, Response_e response)\n {\n sendToClient( messenger, Request_e.Request_UnSubscribe_Event_C_en.valueOf(), response, null );\n }", "@Override\n\tpublic void onUnsubscribe(String arg0, int arg1) {\n\t\t\n\t}", "public void unsubscribe(ClientAddress address, ChannelAddress channelAddress);", "void delete(UnsubscribeRequest request);", "@Override\n public void onUnsubscribe(String s, int i) {\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomBadResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "public void unsubscribeToCovRequest() {\n try {\n DeviceService.localDevice.send(bacnetDevice, new SubscribeCOVRequest(new UnsignedInteger(1), getObjectIdentifier(), null, null)).get();\n LOG.info(\"Unsubscription @: '\" + getObjectIdentifier() + \"' on: \" + bacnetDevice.getObjectIdentifier());\n } catch (BACnetException e) {\n LOG.warn(\"Can't unsubscribe : '\" + getObjectIdentifier() + \"' on: \" + bacnetDevice.getObjectIdentifier());\n }\n\n }", "private void unsubscribe() {\n Log.i(TAG, \"Unsubscribing.\");\n Nearby.Messages.unsubscribe(mGoogleApiClient, mMessageListener);\n }", "@Test\n public void testMissingForumUnsubscribe() {\n ForumException thrown = assertThrows(ForumException.class,\n () -> forumService.unsubscribeFrom(0, USER_ID));\n assertTrue(thrown.getMessage().contains(\"No such forum thread.\"));\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Override\n public void onUnsubscribe(String channel, int subscribedChannels) {\n super.onUnsubscribe(channel, subscribedChannels);\n System.out.println(\"Channel unsubscribed at : \" + channel);\n }", "void unsubscribe(String id);", "@Test\n public void testForumUnsubscribe() {\n try {\n ForumDTO forumDTO = forumService.unsubscribeFrom(FORUM_ID, USER_ID);\n assertFalse(forumDTO.getSubscribers().stream()\n .map(UserDTO::getUsername)\n .collect(Collectors.toSet())\n .contains(USER_NAME)\n );\n } catch (Exception e) {\n fail(e.getMessage());\n }\n }", "private void unsubscribeHandler(MqttUnsubscribeMessage unsubscribe) {\n\n final int messageId = unsubscribe.messageId();\n LOG.info(\"UNSUBSCRIBE [{}] from MQTT client {}\", messageId, this.mqttEndpoint.clientIdentifier());\n\n // sending AMQP_UNSUBSCRIBE\n\n AmqpUnsubscribeMessage amqpUnsubscribeMessage =\n new AmqpUnsubscribeMessage(this.mqttEndpoint.clientIdentifier(), unsubscribe.topics());\n\n this.ssEndpoint.sendUnsubscribe(amqpUnsubscribeMessage, done -> {\n\n if (done.succeeded()) {\n\n this.mqttEndpoint.unsubscribeAcknowledge(messageId);\n\n // removing topics from local collection\n unsubscribe.topics().stream().forEach(topic -> {\n\n this.grantedQoSLevels.remove(topic);\n });\n\n LOG.info(\"UNSUBACK [{}] to MQTT client {}\", messageId, this.mqttEndpoint.clientIdentifier());\n }\n });\n }", "@Override\n\tpublic void onPUnsubscribe(String arg0, int arg1) {\n\t\t\n\t}", "void unsubscribe(){}", "void delete(UnsubscribeRequest request, ResultCapture<Void> extractor);", "protected void testUncancelReal() {\n\n log.info(\"Starting testUncancel\");\n\n try {\n\n String prod = \"Shotgun\";\n BillingPeriod term = BillingPeriod.MONTHLY;\n String planSet = IPriceListSet.DEFAULT_PRICELIST_NAME;\n\n // CREATE\n Subscription subscription = createSubscription(prod, term, planSet);\n IPlanPhase trialPhase = subscription.getCurrentPhase();\n assertEquals(trialPhase.getPhaseType(), PhaseType.TRIAL);\n\n // NEXT PHASE\n DateTime expectedPhaseTrialChange = Clock.addDuration(subscription.getStartDate(), trialPhase.getDuration());\n checkNextPhaseChange(subscription, 1, expectedPhaseTrialChange);\n\n // MOVE TO NEXT PHASE\n testListener.pushExpectedEvent(NextEvent.PHASE);\n clock.setDeltaFromReality(trialPhase.getDuration(), DAY_IN_MS);\n assertTrue(testListener.isCompleted(2000));\n IPlanPhase currentPhase = subscription.getCurrentPhase();\n assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);\n\n // SET CTD + RE READ SUBSCRIPTION + CHANGE PLAN\n IDuration ctd = getDurationMonth(1);\n DateTime newChargedThroughDate = Clock.addDuration(expectedPhaseTrialChange, ctd);\n billingApi.setChargedThroughDate(subscription.getId(), newChargedThroughDate);\n subscription = (Subscription) entitlementApi.getSubscriptionFromId(subscription.getId());\n\n testListener.pushExpectedEvent(NextEvent.CANCEL);\n\n // CANCEL\n subscription.cancel(clock.getUTCNow(), false);\n assertFalse(testListener.isCompleted(2000));\n\n subscription.uncancel();\n\n // MOVE TO EOT + RECHECK\n clock.addDeltaFromReality(ctd);\n DateTime future = clock.getUTCNow();\n assertFalse(testListener.isCompleted(2000));\n\n IPlan currentPlan = subscription.getCurrentPlan();\n assertEquals(currentPlan.getProduct().getName(), prod);\n currentPhase = subscription.getCurrentPhase();\n assertEquals(currentPhase.getPhaseType(), PhaseType.EVERGREEN);\n\n } catch (EntitlementUserApiException e) {\n Assert.fail(e.getMessage());\n }\n }", "@Override\n\tpublic void brokenSubscription() {\n\t\t\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "void unsubscribe(Subscription subscription);", "@Override\n public void onPUnsubscribe(String s, int i) {\n }", "public final void unsubscribe() throws InvalidSubscriptionException {\r\n WritableSession session = (WritableSession) WebsocketActionSupport.getInstance().getSession();\r\n if (!sessions.contains(session)) {\r\n throw new InvalidSubscriptionException(\"Current session is not subscribed to this topic\");\r\n }\r\n sessions.remove(session);\r\n afterUnsubscribe(session);\r\n }", "void unsubscribe();", "public void unsubscribe(String subscriptionId) {\n \n \t\tWebTarget wt = subscriptionsTarget.path(subscriptionId);\n \t\t\n \t\tResponse response = wt.request()\n \t\t\t .header(\"Authorization\", \"Bearer \" + playPlatformApiToken)\n \t\t\t .buildDelete()\n \t\t\t .invoke();\n \t\t\n \t\tlogger.debug(\"Unsubscribe response status : \"+response.getStatus());\n\t\tif (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {\n \t\t\tlogger.error(\"Unsubscription failed. HTTP Status Code: \"+response.getStatus());\n \t\t}\n\t\telse {\n \t\t\tsubscriptions.remove(subscriptionId);\n \t\t}\n \t\tresponse.close();\n \t}", "public void unsubscribe(String name, String clientId) throws RemoteException;", "private void playUnsubscriptionConfirmationPromptAndUnsubscribeUser(String callerId) throws AgiException, DAOException\n\t{\n\t\tstreamFile(Constants.PROMPT_FOR_SUCCESSFUL_UNSUBSCRIPTION);\n\n\t\tUserBean user = UserManagerImpl.getInstance().loadByPrimaryKey(callerId);\n\n\t\tuser.setSubscriptionStatus(Constants.SUBSCRIPTION_STATUS_UNSUBSCRIBED);\n\n\t\tuser.update();\n\t}", "public void unsubscribe() {\r\n new Thread(new Runnable() {\r\n public void run() {\r\n int attempts = 0;\r\n while(++attempts < 20) {\r\n try {\r\n if (server.removeSubscriber(PubSubAgent.this.agentID)) {\r\n subscriberKeywords.clear();\r\n subscriberTopics.clear();\r\n }\r\n System.out.print(\"Unsubscribed from all Topics.\");\r\n return;\r\n } catch(RemoteException e) {\r\n System.err.println(\"Could not connect to server. Retrying...\");\r\n try {\r\n Thread.sleep(800);\r\n } catch(Exception ex) {\r\n ex.printStackTrace();\r\n }\r\n }\r\n }\r\n System.err.println(\"Couldn't Unsubscribe from all the topics...\");\r\n }\r\n }).start();\r\n }", "@Test\n public void attach_implicit_subscribe_fail() throws AblyException {\n AblyRealtime ably = null;\n try {\n ClientOptions opts = createOptions(testVars.keys[1].keyStr);\n ably = new AblyRealtime(opts);\n\n /* wait until connected */\n new ConnectionWaiter(ably.connection).waitFor(ConnectionState.connected);\n assertEquals(\"Verify connected state reached\", ably.connection.state, ConnectionState.connected);\n\n /* create a channel and subscribe */\n final Channel channel = ably.channels.get(\"subscribe_fail\");\n channel.subscribe(null);\n assertEquals(\"Verify attaching state reached\", channel.state, ChannelState.attaching);\n\n ErrorInfo fail = new ChannelWaiter(channel).waitFor(ChannelState.failed);\n assertEquals(\"Verify failed state reached\", channel.state, ChannelState.failed);\n assertEquals(\"Verify reason code gives correct failure reason\", fail.statusCode, 401);\n } finally {\n if(ably != null)\n ably.close();\n }\n }", "default void unsubscribe()\n throws TopicReceiverException\n {\n try {\n close();\n } catch ( Exception e ) {\n throw new TopicReceiverException(getTopic(), e);\n }\n }", "public abstract void unsubscribeImpl(String str, Resolver<Void> resolver);", "private void onUnavailable() {\n // TODO: broadcast\n }", "@Test(expected = SubscriberTypeMismatchException.class)\r\n\tpublic void aTestInvalidSubscribe() {\r\n\t\tbroker.subscribe(new IntegerSubscriber(), Boolean.class);\r\n\t}", "@Override\n\tpublic void unsubscribe(Strategy strategy) {\n\t\t\n\t}", "private void unsubscribe() {\n subscriber=null;\n }", "@Test\n public void unsubscribe_all() throws AblyException {\n /* Ably instance that will emit messages */\n AblyRealtime ably1 = null;\n /* Ably instance that will receive messages */\n AblyRealtime ably2 = null;\n\n String channelName = \"test.channel.unsubscribe.all\" + System.currentTimeMillis();\n Message[] messages = new Message[] {\n new Message(\"name1\", \"Lorem ipsum dolor sit amet\"),\n new Message(\"name2\", \"Consectetur adipiscing elit.\"),\n new Message(\"name3\", \"Pellentesque nulla lorem\"),\n new Message(\"name4\", \"Efficitur ac consequat a, commodo ut orci.\"),\n };\n\n try {\n ClientOptions option1 = createOptions(testVars.keys[0].keyStr);\n option1.clientId = \"emitter client\";\n ClientOptions option2 = createOptions(testVars.keys[0].keyStr);\n option2.clientId = \"receiver client\";\n\n ably1 = new AblyRealtime(option1);\n ably2 = new AblyRealtime(option2);\n\n Channel channel1 = ably1.channels.get(channelName);\n channel1.attach();\n new ChannelWaiter(channel1).waitFor(ChannelState.attached);\n\n Channel channel2 = ably2.channels.get(channelName);\n channel2.attach();\n new ChannelWaiter(channel2).waitFor(ChannelState.attached);\n\n /* Create a listener that collect received messages */\n ArrayList<Message> receivedMessageStack = new ArrayList<>();\n MessageListener listener = new MessageListener() {\n List<Message> messageStack;\n\n @Override\n public void onMessage(Message message) {\n messageStack.add(message);\n }\n\n public MessageListener setMessageStack(List<Message> messageStack) {\n this.messageStack = messageStack;\n return this;\n }\n }.setMessageStack(receivedMessageStack);\n\n /* Subscribe using various alternatives of {@code Channel#subscribe()} */\n channel2.subscribe(listener);\n channel2.subscribe(messages[0].name, listener);\n channel2.subscribe(new String[] {messages[1].name, messages[2].name}, listener);\n\n /* Unsubscribe */\n channel2.unsubscribe();\n\n /* Start emitting channel with ably client 1 (emitter) */\n Helpers.CompletionWaiter waiter = new Helpers.CompletionWaiter();\n channel1.publish(messages, waiter);\n waiter.waitFor();\n\n /* Validate that we didn't received anything\n */\n assertThat(receivedMessageStack, Matchers.is(Matchers.emptyCollectionOf(Message.class)));\n } finally {\n if (ably1 != null) ably1.close();\n if (ably2 != null) ably2.close();\n }\n }", "private void unsubscribeSent(AsyncResult<Integer> result, List<String> topics) {\n if (result.failed() || result.result() == null) {\n closeConnection(String.format(\"Failed to send unsubscribe request: %s\", result.cause()));\n } else {\n this.pendingUnsubscribes.put(result.result(), topics);\n }\n }", "@Override\n\tpublic SuccessMessage unsubscribe(Integer themeId, Integer userId) {\n\t\tthrow new I18nMessageException(\"502\");\n\t}", "@Test(groups = {\"wso2.esb\"}, description = \"Test de-activation of Message Processor when exception is thrown \" +\n \"inside deactivate sequence.\")\n public void testMPGettingDeactivatedIfDeactivateSeqFails() throws Exception {\n SimpleHttpClient simpleHttpClient = new SimpleHttpClient();\n simpleHttpClient.doGet(proxyURL, null);\n Thread.sleep(10000);\n checkMessageProcessorState();\n }", "public void removeUnavailableRooms(){\n\t}", "@Test\n public void testUnRegister(TestContext context) {\n NetClient client = vertx.createNetClient();\n final Async async = context.async();\n\n final String address = \"test\";\n client.connect(7000, \"localhost\").onComplete(context.asyncAssertSuccess(socket -> {\n\n // 2 replies will arrive:\n // 1). message published to test\n // 2). err of NO_HANDLERS because of consumer for 'test' is unregistered.\n final AtomicBoolean unregistered = new AtomicBoolean(false);\n final FrameParser parser = new FrameParser(parse -> {\n context.assertTrue(parse.succeeded());\n JsonObject frame = parse.result();\n if (unregistered.get()) {\n // consumer on 'test' has been unregistered, send message will fail.\n context.assertEquals(\"err\", frame.getString(\"type\"));\n context.assertEquals(\"#backtrack\", frame.getString(\"address\"));\n context.assertEquals(\"NO_HANDLERS\", frame.getString(\"failureType\"));\n context.assertEquals(\"No handlers for address test\", frame.getString(\"message\"));\n client.close();\n async.complete();\n } else {\n // got message, then unregister the handler\n context.assertNotEquals(\"err\", frame.getString(\"type\"));\n context.assertEquals(false, frame.getBoolean(\"send\"));\n context.assertEquals(\"Vert.x\", frame.getJsonObject(\"body\").getString(\"value\"));\n unregistered.compareAndSet(false, true);\n FrameHelper.sendFrame(\"unregister\", address, null, socket);\n FrameHelper.sendFrame(\"send\", address, \"#backtrack\", new JsonObject().put(\"value\", \"This will fail anyway!\"), socket);\n }\n });\n\n socket.handler(parser);\n\n FrameHelper.sendFrame(\"register\", address, null, socket);\n FrameHelper.sendFrame(\"publish\", address, new JsonObject().put(\"value\", \"Vert.x\"), socket);\n }));\n\n }", "@Test\n public void testRemoveConference() throws Exception {\n EventData deltaEvent = prepareDeltaEvent(createdEvent);\n deltaEvent.setConferences(Collections.emptyList());\n updateEventAsOrganizer(deltaEvent);\n\n EventData updatedEvent = eventManager.getEvent(defaultFolderId, createdEvent.getId());\n assertThat(\"Should be no conferences!\", updatedEvent.getConferences(), empty());\n\n /*\n * Check that mails has been send\n */\n AnalyzeResponse analyzeResponse = receiveUpdateAsAttendee(PartStat.ACCEPTED, CustomConsumers.ALL, 1);\n AnalysisChange change = assertSingleChange(analyzeResponse);\n assertSingleDescription(change, \"access information was removed\");\n }", "private void doUnsubscribe(JSONArray args, CallbackContext callbackContext,\n\t\t\tMqttAndroidClient client) throws JSONException {\n\t\tString topicFilter = args.getString(1);\n\t\tfinal JSONObject invocationContext = args.optJSONObject(2);\n\t\ttry {\n\t\t\tclient.unsubscribe(topicFilter, null,\n\t\t\t\t\tnew GeneralCallback(invocationContext, callbackContext));\n\t\t\n\t\t} catch (MqttException exception) {\n\t\t\tcallbackContext.error(createError(exception, invocationContext));\n\t\t}\n\t}", "void unsubscribe(Contact contact)\n throws IllegalArgumentException, IllegalStateException, OperationFailedException;", "public void sendUnbindResponse(Pdu packet);", "@Test\n public void detach_message_to_released_channel_is_dropped() throws AblyException {\n AblyRealtime ably = null;\n long oldRealtimeTimeout = Defaults.realtimeRequestTimeout;\n final String channelName = \"detach_message_to_released_channel_is_dropped\";\n\n try {\n DebugOptions opts = createOptions(testVars.keys[0].keyStr);\n Helpers.RawProtocolMonitor monitor = Helpers.RawProtocolMonitor.createReceiver(ProtocolMessage.Action.detached);\n opts.protocolListener = monitor;\n\n /* Make test faster */\n Defaults.realtimeRequestTimeout = 1000;\n opts.channelRetryTimeout = 1000;\n\n ably = new AblyRealtime(opts);\n Channel channel = ably.channels.get(channelName);\n channel.attach();\n (new ChannelWaiter(channel)).waitFor(ChannelState.attached);\n\n // Listen for detach messages and release the channel\n ably.channels.release(channelName);\n monitor.waitForRecv(1, 10000);\n\n assertFalse(ably.channels.containsKey(\"messages_to_non_existent_channels_are_dropped\"));\n } finally {\n if (ably != null)\n ably.close();\n Defaults.realtimeRequestTimeout = oldRealtimeTimeout;\n }\n }", "@Override\n\t\t\tpublic void onPUnsubscribe(String pattern, int subscribedChannels) {\n\t\t\t\tlog.debug(\"====== onPUnsubscribe(): pattern = {}, subscribedChannels = {}\", pattern, subscribedChannels);\n\t\t\t}", "void unsubscribe(Player player);", "@SmallTest\n @Test\n public void testNegotiationFailedInvalidResponse() {\n testStartNegotiation();\n\n // Received something other than the probe; it should be ignored\n mDtmfTransport.onDtmfReceived('1');\n // Super short message.\n mDtmfTransport.onDtmfReceived('A');\n mDtmfTransport.onDtmfReceived('D');\n\n verify(mCallback).onNegotiationFailed(eq(mDtmfTransport));\n }", "private void unregisterForBatteryStatus()\n\t{\n\t\tif(isReceiverRegistered && statusResult == null && batteryView != null && !batteryView.isShown())\n\t\t{\n\t\t\tActivity activity = RhodesActivity.safeGetInstance();\n\t\t\tif(activity != null)\n\t\t\t{\n\t\t\t\tactivity.unregisterReceiver(this);\n\t\t\t\tisReceiverRegistered = false;\n\t\t\t}\n\t\t}\n\t}", "private void genericUnsubscribeFactory(String request, BandInfo band) {\n if (bandStreams.containsKey(band) && bandStreams.get(band).contains(request)) {\n if (bandStreams.get(band).size() == 1) {\n // Only stream open for this band, remove from bandStreams\n bandStreams.remove(band);\n } else {\n // Other streams open, remove from list\n bandStreams.get(band).remove(request);\n }\n\n // Remove stream from preferences\n SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());\n Set<String> streams = prefs.getStringSet(Preferences.getDeviceKey(band.getMacAddress()), new HashSet<String>());\n if (streams.contains(request)) {\n Log.v(TAG, \"Removing stream \" + request);\n streams.remove(request);\n Log.v(TAG, \"Streams after removing \" + request + \": \" + streams);\n prefs.edit().putStringSet(Preferences.getDeviceKey(band.getMacAddress()), streams).apply();\n }\n\n // Unsubscribe from the appropriate stream\n switch (request) {\n case ACCEL_REQ_EXTRA:\n if (accManager != null)\n accManager.unSubscribe(band);\n break;\n case ALT_REQ_EXTRA:\n if (altManager != null)\n altManager.unSubscribe(band);\n break;\n case AMBIENT_REQ_EXTRA:\n if (ambManager != null)\n ambManager.unSubscribe(band);\n break;\n case BAROMETER_REQ_EXTRA:\n if (barometerManager != null)\n barometerManager.unSubscribe(band);\n break;\n case CALORIES_REQ_EXTRA:\n if (calManager != null)\n calManager.unSubscribe(band);\n break;\n case CONTACT_REQ_EXTRA:\n if (conManager != null)\n conManager.unSubscribe(band);\n break;\n case DISTANCE_REQ_EXTRA:\n if (distManager != null)\n distManager.unSubscribe(band);\n break;\n case GSR_REQ_EXTRA:\n if (gsrManager != null)\n gsrManager.unSubscribe(band);\n break;\n case GYRO_REQ_EXTRA:\n if (gyroManager != null)\n gyroManager.unSubscribe(band);\n break;\n case HEART_RATE_REQ_EXTRA:\n if (heartManager != null)\n heartManager.unSubscribe(band);\n break;\n case PEDOMETER_REQ_EXTRA:\n if (pedoManager != null)\n pedoManager.unSubscribe(band);\n break;\n case SKIN_TEMP_REQ_EXTRA:\n if (skinTempManager != null)\n skinTempManager.unSubscribe(band);\n break;\n case UV_REQ_EXTRA:\n if (uvManager != null)\n uvManager.unSubscribe(band);\n break;\n default:\n Log.e(TAG, \"Unknown subscription requested \" + request);\n }\n } else {\n if (!bandStreams.containsKey(band)) {\n Log.e(TAG, \"Error: unsubscribe request for a band that isnt stored\");\n Log.v(TAG, \"Band: \" + band.toString());\n for (BandInfo info :\n bandStreams.keySet()) {\n Log.v(TAG, \"Key: \" + info.toString());\n }\n } else {\n if (!bandStreams.get(band).contains(request)) {\n Log.e(TAG, \"Error: unsubscribe request for unregistered request\");\n }\n }\n }\n }", "@Override\r\n public void unsubscribe() {\n t.interrupt();\r\n }", "public void testUnlinkLogMessagesFromService() {\n\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsBadResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n public void testHttpForNotConnected() throws Exception {\n \n final CountDownLatch unsubscribed = new CountDownLatch(1);\n \n final TestChannelCreator creator = new TestChannelCreator();\n final DefaultHttpClient client = new DefaultHttpClient(creator, ENABLE_LOGGING);\n // NOT setup server for local channel\n final TestSubscriber<HttpObject> testSubscriber = new TestSubscriber<HttpObject>();\n final OnNextSensor<HttpObject> nextSensor = new OnNextSensor<HttpObject>();\n try {\n client.defineInteraction(new LocalAddress(\"test\"), \n Observable.<HttpObject>just(fullHttpRequest()).doOnNext(nextSensor))\n .compose(RxFunctions.<HttpObject>countDownOnUnsubscribe(unsubscribed))\n .subscribe(testSubscriber);\n \n unsubscribed.await();\n \n testSubscriber.awaitTerminalEvent();\n assertEquals(1, creator.getChannels().size());\n creator.getChannels().get(0).assertClosed(1);\n } finally {\n client.close();\n assertEquals(0, testSubscriber.getOnNextEvents().size());\n assertEquals(0, testSubscriber.getCompletions());\n assertEquals(1, testSubscriber.getOnErrorEvents().size());\n nextSensor.assertNotCalled();\n }\n }", "protected void responseFail(){\n\t\tqueue.clear();\n\t}", "@Test\n\tpublic void testRemoveFacilityFromReservation() throws Exception {\n\t\tReservation res1 = dataHelper.createPersistedReservation(USER_ID,\n\t\t\t\tArrays.asList(infoBuilding.getId(), room1.getId()), validStartDate, validEndDate);\n\n\t\tbookingManagement.removeFacilityFromReservation(res1.getId(), room1.getId());\n\n\t\tres1 = bookingManagement.getReservation(res1.getId());\n\t\tassertNotNull(res1);\n\t\tassertEquals(1, res1.getBookedFacilityIds().size());\n\t\tassertTrue(res1.getBookedFacilityIds().contains(infoBuilding.getId()));\n\t}", "@Test\n public void testEventStreamClosed() throws Exception {\n CountDownLatch latch = new CountDownLatch(1);\n EventStreamClosedClient eventListener = new EventStreamClosedClient(latch);\n\n try (EventStream streamEvents = new WebSocketEventStream(uri, new Token(\"token\"), 0, 0, 0, eventListener)) {\n latch.await(30, TimeUnit.SECONDS);\n Assert.assertFalse(streamEvents.isEventStreamClosed());\n }\n }", "public void Unsubscribe(Integer busLineID, final ConfigurationActivity configurationActivity) { //unsubscribe antoistoixi gia ena buslineid\n subscribedLists.remove(busLineID);\n Client client = subscribedThreads.get(busLineID);\n\n Message message = MapsActivity.mainHandler.obtainMessage();\n message.what = 6;\n message.obj = busLineID;\n MapsActivity.mainHandler.sendMessage(message);\n\n configurationActivity.runOnUiThread(new Runnable() {\n @Override\n public void run() {\n configurationActivity.updateGUI();\n }\n });\n\n Socket socket = subscribedSockets.get(busLineID);\n try {\n socket.close();\n } catch (IOException e) {\n }\n }", "void unsubscribe(Player player, boolean fast);", "public void cancelingHotelScenarioTest() throws BookHotelFault, DatatypeConfigurationException, CancelHotelFault{\n \n // There are two hotels available in Paris, we book one of them \n BookHotelInputType input = CreateBookHotelInputType(\"booking_Hotel_4\", \"Tick Joachim\", \"50408824\", 2, 11);\n boolean result = bookHotel(input);\n assertEquals(true, result);\n \n // We are now doing a get request, there should be so only one hotel available in Paris\n if(result == true){\n // Trying to get the list of hotel from Paris and we should have only one hotel because the NY hotel is already booked\n GetHotelInputType getInput = CreateGetHotelInputType(\"Paris\");\n GetHotelsOutputType getOutput = getHotels(getInput);\n int expectedNbHotels = 1;\n int resultNbHotels = 0;\n if (getOutput.getHotelInformations().isEmpty() == false){\n resultNbHotels = getOutput.getHotelInformations().size();\n } \n assertEquals(expectedNbHotels, resultNbHotels); \n } \n else {\n assertEquals(true, false);\n }\n \n // We cancel the hotel we had and try to get the list of hotel from Paris. We should have two hotels again.\n cancelHotel(\"booking_Hotel_4\"); \n GetHotelInputType getInput = CreateGetHotelInputType(\"Paris\");\n GetHotelsOutputType getOutput = getHotels(getInput);\n int expectedNbHotels = 2;\n int resultNbHotels = 0;\n if (getOutput.getHotelInformations().isEmpty() == false){\n resultNbHotels = getOutput.getHotelInformations().size();\n } \n assertEquals(expectedNbHotels, resultNbHotels); \n }", "@Test\n public void testHttpDisconnectFromServerAfterConnected() throws Exception {\n final String testAddr = UUID.randomUUID().toString();\n final Subscription server = TestHttpUtil.createTestServerWith(testAddr, \n new Action1<HttpTrade>() {\n @Override\n public void call(final HttpTrade trade) {\n trade.abort();\n }},\n ENABLE_LOGGING);\n \n// final HttpTestServer server = createTestServerWith(false, \"test\",\n// new Func0<ChannelInboundHandler> () {\n// @Override\n// public ChannelInboundHandler call() {\n// return new HttpTestServerHandler() {\n// @Override\n// protected void channelRead0(final ChannelHandlerContext ctx, final HttpObject msg) \n// throws Exception {\n// if (msg instanceof HttpRequest) {\n// ctx.close();\n// }\n// }\n// };\n// }});\n \n final TestChannelCreator creator = new TestChannelCreator();\n final TestChannelPool pool = new TestChannelPool(1);\n final DefaultHttpClient client = new DefaultHttpClient(creator, pool,\n ENABLE_LOGGING);\n final TestSubscriber<HttpObject> testSubscriber = new TestSubscriber<HttpObject>();\n final OnNextSensor<HttpObject> nextSensor = new OnNextSensor<HttpObject>();\n try {\n final CountDownLatch unsubscribed = new CountDownLatch(1);\n client.defineInteraction(\n// new LocalAddress(\"test\"),\n new LocalAddress(testAddr),\n Observable.just(fullHttpRequest()).doOnNext(nextSensor))\n .compose(RxFunctions.<HttpObject>countDownOnUnsubscribe(unsubscribed))\n .subscribe(testSubscriber);\n unsubscribed.await();\n testSubscriber.awaitTerminalEvent();\n \n // await for 1 second\n pool.awaitRecycleChannels(1);\n assertEquals(1, creator.getChannels().size());\n creator.getChannels().get(0).assertClosed(1);\n } finally {\n client.close();\n// server.stop();\n server.unsubscribe();\n testSubscriber.assertTerminalEvent();\n assertEquals(1, testSubscriber.getOnErrorEvents().size());\n// assertEquals(RuntimeException.class, \n// testSubscriber.getOnErrorEvents().get(0).getClass());\n assertEquals(0, testSubscriber.getCompletions());\n assertEquals(0, testSubscriber.getOnNextEvents().size());\n // channel connected, so message has been send\n nextSensor.assertCalled();\n }\n }", "@Override\n public void unsubscribe(Entity e) {\n unsub_queue.add(e);\n }", "public void syncUnsubscribe(String aSid)\n {\n SyncUnsubscribeOpenhomeOrgSubscriptionLongPoll1 sync = new SyncUnsubscribeOpenhomeOrgSubscriptionLongPoll1(this);\n beginUnsubscribe(aSid, sync.getListener());\n sync.waitToComplete();\n sync.reportError();\n }", "@Test\n public void testRemoveRequest() throws Exception {\n System.out.println(\"removeRequest\");\n Sendable s = sendAMessage();\n\n String a = s.getMessageId();\n String comment = \"\";\n instance.removeRequest(a, comment);\n }", "public void onUaCallCancelled(UserAgent ua)\n { readyToReceive();\n }", "@SuppressWarnings(\"unchecked\")\n @Test\n public void testBackenStatusUpdateError() throws Exception {\n RequestBodyEntity bodyEntityRegister = mock(RequestBodyEntity.class);\n \n HttpResponse<String> stringResponseRegister = (HttpResponse<String>) mock(HttpResponse.class);\n when(stringResponseRegister.getStatus())\n .thenReturn(400); \n when(bodyEntityRegister.asString())\n .thenReturn(stringResponseRegister); \n\n HttpRequestWithBody registerBodyMock = mock(HttpRequestWithBody.class);\n \n when(registerBodyMock.routeParam(anyString(), anyString()))\n .thenReturn(registerBodyMock);\n when(registerBodyMock.header(anyString(), anyString()))\n .thenReturn(registerBodyMock);\n when(registerBodyMock.body(anyString()))\n .thenReturn(bodyEntityRegister);\n\n // PUT mock\n when(Unirest.put(contains(\"/event/status\")))\n .thenReturn(registerBodyMock); \n \n TestWorker testWorker = new TestWorker();\n worker = getWrappedWorker(testWorker);\n worker.run();\n \n // let worker throw CommunicationException\n Envelope envelope = new Envelope(new Long(34343), false, \"graviton\", \"documents.core.app.update\");\n URL jsonFile = this.getClass().getClassLoader().getResource(\"json/queueEvent.json\");\n String message = FileUtils.readFileToString(new File(jsonFile.getFile()));\n workerConsumer.handleDelivery(\"documents.core.app.update\", envelope, new AMQP.BasicProperties(), message.getBytes()); \n }", "public void testServerDown() throws Exception {\n\n final boolean sent = uploadAndWait();\n assertTrue(sent);\n assertEquals(0, reportManager.findReports().size());\n\n verifyZeroInteractions(mockCall);\n }", "@Test\n public void testBroadcastedTransactionDeserializer(){\n try{\n mMessagesHub = new SubscriptionMessagesHub(\"\", \"\", mErrorListener);\n mMessagesHub.addSubscriptionListener(new SubscriptionListener() {\n private int MAX_MESSAGES = 15;\n private int messageCounter = 0;\n\n @Override\n public ObjectType getInterestObjectType() {\n return ObjectType.TRANSACTION_OBJECT;\n }\n\n @Override\n public void onSubscriptionUpdate(SubscriptionResponse response) {\n if(response.params.size() == 2){\n List<Serializable> payload = (List) response.params.get(1);\n if(payload.size() > 0){\n for(Serializable item : payload){\n if(item instanceof BroadcastedTransaction){\n BroadcastedTransaction broadcastedTransaction = (BroadcastedTransaction) item;\n Transaction tx = broadcastedTransaction.getTransaction();\n System.out.println(String.format(\"Got %d operations\", tx.getOperations().size()));\n }\n }\n }\n }\n\n // Waiting for MAX_MESSAGES messages before releasing the wait lock\n messageCounter++;\n if(messageCounter > MAX_MESSAGES){\n synchronized (SubscriptionMessagesHubTest.this){\n SubscriptionMessagesHubTest.this.notifyAll();\n }\n }\n }\n });\n\n mWebSocket.addListener(mMessagesHub);\n mWebSocket.connect();\n\n // Holding this thread while we get update notifications\n synchronized (this){\n wait();\n }\n } catch (WebSocketException e) {\n System.out.println(\"WebSocketException. Msg: \" + e.getMessage());\n } catch (InterruptedException e) {\n System.out.println(\"InterruptedException. Msg: \"+e.getMessage());\n }\n }", "@Test\n void awaitMessage() {\n\n Message message = null;\n TempBroadcast b = new TempBroadcast(\"broadcastSender2\");\n\n broadcastReceiver.subscribeBroadcast(TempBroadcast.class, c -> {\n });\n broadcastSender.sendBroadcast(b);\n\n // here we will check the method\n try {\n message = messageBus.awaitMessage(broadcastReceiver);\n\n } catch (InterruptedException e) {\n e.printStackTrace();\n //due to the assumption above, an exception is not supposed to be thrown\n }\n assertEquals(b, message);\n }", "@Override\n\t\tpublic void onUserListUnsubscription(User arg0, User arg1, UserList arg2) {\n\t\t\t\n\t\t}", "@Test\n\tpublic void testDisconnection() throws IOException, InvalidHeaderException, InterruptedException, ExecutionException {\n\t\tFuture<Boolean> result = service.submit(new Runnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\tassertFalse(client.Disconnect());\n\t\t\t\t\tassertTrue(client.Disconnect());\n\t\t\t\t} catch (Exception e){ \n\t\t\t\t\tfail(\"Exception should not be thrown\"); \n\t\t\t\t}\n\t\t\t}\n\t\t}, Boolean.TRUE);\n\t\t\n\t\t// Get the connection request\n\t\tConnectionRequest conRequest = (ConnectionRequest) this.getMessage(channel);\n\t\tassertEquals(conRequest.isConnection(), false);\n\t\tassertEquals(conRequest.getUsername(), null);\n\t\t\n\t\tthis.sendMessage(new RequestResponse(Status.EXCEPTION), channel);\n\t\t\n\t\t// Get the connection request\n\t\tconRequest = (ConnectionRequest) this.getMessage(channel);\n\t\tassertEquals(conRequest.isConnection(), false);\n\t\tassertEquals(conRequest.getUsername(), null);\n\n\t\tthis.sendMessage(new RequestResponse(Status.SUCCESS), channel);\n\t\t\n\t\tresult.get();\t\t\n\t}", "@Override\n public CompletableFuture<Void> doUnsubscribe(Consumer consumer) {\n CompletableFuture<Void> future = new CompletableFuture<>();\n try {\n if (dispatcher.canUnsubscribe(consumer)) {\n consumer.close();\n return delete();\n }\n future.completeExceptionally(\n new ServerMetadataException(\"Unconnected or shared consumer attempting to unsubscribe\"));\n } catch (BrokerServiceException e) {\n log.warn(\"Error removing consumer {}\", consumer);\n future.completeExceptionally(e);\n }\n return future;\n }", "@SneakyThrows\n private void unsubscribe(String name) {\n call(\"unsubscribe\", new Subscription(name)).toFuture().get(UNSUBSCRIBE_DELAY_S, TimeUnit.SECONDS);\n }", "@Test\n public void deregisterScanListener() throws Exception {\n WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,\n 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);\n WifiNative.ScanSettings nativeSettings = computeSingleScanNativeSettings(requestSettings);\n ScanResults results = ScanResults.create(0, 2400, 5150, 5175);\n\n int requestId = 12;\n int listenerRequestId = 13;\n\n startServiceAndLoadDriver();\n\n Handler handler = mock(Handler.class);\n BidirectionalAsyncChannel controlChannel = connectChannel(handler);\n InOrder order = inOrder(handler, mWifiScannerImpl);\n\n when(mWifiScannerImpl.startSingleScan(any(WifiNative.ScanSettings.class),\n any(WifiNative.ScanEventHandler.class))).thenReturn(true);\n\n registerScanListener(controlChannel, listenerRequestId);\n mLooper.dispatchAll();\n verifySuccessfulResponse(order, handler, listenerRequestId);\n\n sendSingleScanRequest(controlChannel, requestId, requestSettings, null);\n\n mLooper.dispatchAll();\n WifiNative.ScanEventHandler eventHandler = verifyStartSingleScan(order, nativeSettings);\n verifySuccessfulResponse(order, handler, requestId);\n\n deregisterScanListener(controlChannel, listenerRequestId);\n mLooper.dispatchAll();\n\n when(mWifiScannerImpl.getLatestSingleScanResults())\n .thenReturn(results.getRawScanData());\n eventHandler.onScanStatus(WifiNative.WIFI_SCAN_RESULTS_AVAILABLE);\n\n mLooper.dispatchAll();\n verifyScanResultsReceived(order, handler, requestId, results.getScanData());\n verifySingleScanCompletedReceived(order, handler, requestId);\n verify(mContext).sendBroadcastAsUser(any(Intent.class), eq(UserHandle.ALL));\n verifyNoMoreInteractions(handler);\n\n assertDumpContainsRequestLog(\"registerScanListener\", listenerRequestId);\n assertDumpContainsRequestLog(\"deregisterScanListener\", listenerRequestId);\n }", "@Override\n\t\t\tpublic void onError(Throwable t) {\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Got Error in writing the ticket\");\n\t\t\t\tconnected_clients.remove(responseObserver);\n\t\t\t}", "@Test\n public void cancelHotelTestError() throws CancelHotelFault, DatatypeConfigurationException{ \n try {\n cancelHotel(null);\n } catch (CancelHotelFault e) {\n assertEquals(\"Empty\",e.getMessage());\n } \n }", "@Override\r\n\tprotected void onDestroy() {\n\t\tsuper.onDestroy();\r\n\t\ttry {\r\n\t\t\tunregisterReceiver(newReceiver);\r\n\t\t} catch (Exception e) {\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tunregisterReceiver(userReceiver);\r\n\t\t} catch (Exception e) {\r\n\t\t}\r\n\t\tBmobChat.getInstance(this).stopPollService();\r\n\t}", "public void unsubscribeAll() {\n \t\tint failCount = 0;\n \t\t// Make a copy of the collection because it will be modified in #unsubscribe()\n \t\tSet<String> removal = new HashSet<String>(subscriptions.keySet());\n \t\tfor (String subscriptionID : removal) {\n \t\t\tunsubscribe(subscriptionID);\n \t\t}\n \t\tif (failCount > 0) {\n \t\t\tlogger.warn(\n \t\t\t\t\t\"Problem while unsubcribing from all subscriptions: \"\n \t\t\t\t\t\t\t+ failCount\n \t\t\t\t\t\t\t+ \" unsubscriptions failed at DSB endpoint '\"\n \t\t\t\t\t\t\t+ subscriptionsTarget.getUri() + \"'\");\n \t\t} else {\n \t\t\tlogger.info(\n \t\t\t\t\t\"Successfully unsubcribed from all subscriptions at DSB endpoint '\"\n \t\t\t\t\t\t\t+ subscriptionsTarget.getUri() + \"'\");\n \t\t}\n \t}", "@Test\n public void unregister() {\n BaseEventBus eventBus = new SynchronousEventBus(LOG);\n\n Object object1 = new Object() {\n @Subscriber\n public void onIntEvent(Integer event) {\n LOG.debug(\"handled event: {}\", event);\n }\n };\n\n Object object2 = new Object() {\n @Subscriber\n public void onStringEvent(String event) {\n LOG.debug(\"handled event: {}\", event);\n }\n };\n\n eventBus.register(object1);\n eventBus.register(object2);\n assertThat(eventBus.objectSubscriberMethods.size(), is(2));\n assertThat(eventBus.eventTypeToSubscriberMethods.size(), is(2));\n assertThat(eventBus.eventTypeToSubscriberMethods.get(String.class).size(), is(1));\n assertThat(eventBus.eventTypeToSubscriberMethods.get(Integer.class).size(), is(1));\n\n eventBus.unregister(object2);\n assertThat(eventBus.objectSubscriberMethods.size(), is(1));\n assertThat(eventBus.eventTypeToSubscriberMethods.size(), is(1));\n assertThat(eventBus.eventTypeToSubscriberMethods.containsKey(String.class), is(false));\n assertThat(eventBus.eventTypeToSubscriberMethods.get(Integer.class).size(), is(1));\n\n eventBus.unregister(object1);\n assertThat(eventBus.objectSubscriberMethods.size(), is(0));\n assertThat(eventBus.eventTypeToSubscriberMethods.size(), is(0));\n }", "private void unsubscribeCompleted(Integer messageId) {\n List<String> request = this.pendingUnsubscribes.remove(messageId);\n if (request != null) {\n for (String topic : request) {\n notifySubscriptionState(topic, SubscriptionState.UNSUBSCRIBED, null);\n }\n }\n }", "public void onUaCallFailed(UserAgent ua, String reason)\n { if (ua.ua_profile.call_to!=null) exit();\n else readyToReceive();\n }", "@Override\n\tpublic void onUserListUnsubscription(User subscriber, User listOwner, UserList list) {\n\n\t}", "@Test(expected = UserMismatchException.class)\r\n public void testAdminSaveSubscriptionNotAuthorized() throws Exception {\r\n saveJoePublisher();\r\n saveSamSyndicator();\r\n DatatypeFactory fac = DatatypeFactory.newInstance();\r\n List<Subscription> subs = new ArrayList<Subscription>();\r\n Subscription s = new Subscription();\r\n\r\n s.setMaxEntities(10);\r\n s.setBrief(false);\r\n GregorianCalendar gcal = new GregorianCalendar();\r\n gcal.setTimeInMillis(System.currentTimeMillis());\r\n gcal.add(Calendar.HOUR, 1);\r\n s.setExpiresAfter(fac.newXMLGregorianCalendar(gcal));\r\n s.setSubscriptionFilter(new SubscriptionFilter());\r\n s.getSubscriptionFilter().setFindBusiness(new FindBusiness());\r\n s.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers());\r\n s.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);\r\n s.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD, null));\r\n subs.add(s);\r\n Holder<List<Subscription>> items = new Holder<List<Subscription>>();\r\n items.value = subs;\r\n publisher.adminSaveSubscription(authInfoSam(), TckPublisher.getJoePublisherId(), items);\r\n deleteJoePublisher();\r\n deleteSamSyndicator();\r\n\r\n }", "public void Verify_UnfortunatelyMessage() throws InterruptedException\r\n\t{\r\n\t\tExplicitWait(Checkavailability);\r\n\t\tThread.sleep(3000);\r\n\t\tif(showRoomInfo.getText().contains(\"Unfortunately, there are no available rooms.\")||(showRoomInfo.getText().contains(\"Or try our partner hotels below.\"))||(showRoomInfo.getText().contains(\"Please try adjusting your search criteria.\")))\r\n\t\t{\r\n\t\t\t//System.out.println(\"After Closing the room/rate using House Control ,rooms are not showing in Booking Engine \");\r\n\t\t\tlogger.info(\"After Closing the room/rate using House Control ,rooms are not showing in Booking Engine \");\r\n\t\t\ttest.log(Status.PASS, \"After Closing the room/rate using House Control ,rooms are not showing in Booking Engine \");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tlogger.error(\"Room/rate are not closed properly in Admin\");\r\n\t\t\ttest.log(Status.FAIL, \"Room/rate are not closed properly in Admin\");\r\n\t\t}\r\n\t}", "@Test\n public void removeBusyCatch() {\n Date date = new Date(2017-11-12);\n\n userDAO.createUser(new User(\"dummy\", \"dummy\", 1));\n busyDAO.createBusy(new Busy(\"dummy\", 1, date));\n\n assertFalse(busyResource.removeBusy(date, 1,\"notdummy\"));\n\n //clean up\n busyResource.removeBusy(date, 1, \"dummy\");\n userDAO.removeUser(\"dummy\");\n }", "void wipeSubscriptions(String sessionID);", "@Override\n public void failure(RetrofitError error) {\n Log.d(TAG, String.valueOf(error));\n WearSocket.getInstance().sendMessage(Values.MESSAGE_PATH, \"Error: \" + phrase + \" didn't work\");\n }", "public void disconnectFromAudio() {\n String json = new Gson().toJson(new TelevisionModel(TelevisionModel.Action.DISCONNECT));\n String a = sendMessage(json);\n TelevisionModel teleM = new Gson().fromJson(a, TelevisionModel.class);\n System.out.println(\"Client Received \" + json);\n\n if (teleM.getAction() == TelevisionModel.Action.DISCONNECT) {\n isDisconnecting = teleM.getValue();\n ui.updateArea(teleM.getMessage());\n };\n }", "@Order(2)\n\t\t@Test\n\t\tpublic void getInvalidMessage() throws IOException, ParseException {\n\t\t\tboolean response = Requests.sendGETBoolReturn(Requests.MESSAGE_URL, INVALID_MESSAGE_ID);\n\t\t\t\n\t\t\t//expect that response == false :: Request should not return a 200\n\t\t\tassertFalse(response);\n\t\t}", "@Test(expected = ObjectNotRegisteredException.class)\n public void unregisterObjectThatIsNotRegistered() {\n BaseEventBus eventBus = new SynchronousEventBus(LOG);\n\n Object object1 = new Object() {\n @Subscriber\n public void onIntEvent(Integer event) {\n LOG.debug(\"handled event: {}\", event);\n }\n };\n\n eventBus.unregister(object1);\n }", "public void unsubscribe(final Topic topic) {\r\n\r\n new Thread(new Runnable() {\r\n public void run() {\r\n int attempts = 0;\r\n while(++attempts < 20) {\r\n try {\r\n if (server.removeSubscriber(PubSubAgent.this.agentID, topic))\r\n subscriberTopics.remove(topic);\r\n System.out.println(\"Unsubscribed from the Topic: \" + topic.getTopicID() + \" - \" + topic.getTopicName());\r\n return;\r\n } catch(RemoteException e) {\r\n System.err.println(\"Could not connect to server. Retrying...\");\r\n try {\r\n Thread.sleep(800);\r\n } catch(Exception ex) {\r\n ex.printStackTrace();\r\n }\r\n }\r\n }\r\n System.err.println(\"Couldn't Unsubscribe from \" + topic.getTopicID() + \" - \" + topic.getTopicName());\r\n }\r\n }).start();\r\n }", "@Teardown\n public void tearDown() {\n if (channel != null) {\n channel.shutdownNow();\n channel = null;\n }\n }", "public void test_RemoveContestChannel_Failure1() throws Exception {\r\n try {\r\n initContext();\r\n\r\n entityManager.close();\r\n beanUnderTest.removeContestChannel(1);\r\n\r\n fail(\"ContestManagementException is expected.\");\r\n } catch (ContestManagementException e) {\r\n // success\r\n }\r\n }" ]
[ "0.78261435", "0.7283425", "0.67501706", "0.6220154", "0.62011075", "0.60809314", "0.6073964", "0.6025553", "0.5895785", "0.5868265", "0.58272797", "0.5812657", "0.5811339", "0.57979643", "0.575231", "0.57479936", "0.57424235", "0.5712644", "0.5702734", "0.5688584", "0.56673765", "0.56462693", "0.5645478", "0.5640878", "0.5637917", "0.5637516", "0.5615446", "0.56013894", "0.55561596", "0.5533999", "0.5512642", "0.5497647", "0.54957086", "0.54836255", "0.54694766", "0.5463068", "0.5459987", "0.5450447", "0.5437585", "0.5433621", "0.54222786", "0.54213", "0.53978103", "0.5373906", "0.53412867", "0.5310575", "0.5280737", "0.5275902", "0.527135", "0.5245903", "0.52435774", "0.5226702", "0.52186424", "0.5211923", "0.5211016", "0.52073497", "0.5206595", "0.5200544", "0.51895", "0.51809454", "0.51537526", "0.5139996", "0.5135426", "0.5125774", "0.51224464", "0.511282", "0.5106708", "0.5098278", "0.5094997", "0.50948596", "0.50870574", "0.5086851", "0.50864434", "0.5069054", "0.5066689", "0.50595593", "0.5058082", "0.5052289", "0.5051041", "0.5045302", "0.50411046", "0.50295776", "0.5021591", "0.50183016", "0.50147057", "0.5008553", "0.5003362", "0.49975222", "0.49810293", "0.49797046", "0.497911", "0.4978426", "0.49722636", "0.49694693", "0.49682572", "0.49650022", "0.4963404", "0.49617687", "0.49505326", "0.49462798" ]
0.8494272
0
Test create room with OK response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testCreateRoomWithOptionsOkResponse() { // given Map<String, String> options = new HashMap<>(); final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).options(options).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest)) .willReturn(OK_RESPONSE); // when multiUserChatService.createRoomWithOptions(TEST_ROOM, options); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomBadResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\r\n\tpublic final void testAddRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\t// check if added successfully\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the id from database since it autoincrements\r\n\t\tRoom actual = roomServices.getRoomByName(expected2.getName());\r\n\t\texpected2.setId(actual.getId());\r\n\t\t// check content of data\r\n\t\tassertEquals(expected2, actual);\r\n\t\t// delete room on exit\r\n\t\troomServices.deleteRoom(actual);\r\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsBadResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@PostMapping(\"/rooms/create\")\n public ResponseEntity create(HttpServletRequest req, HttpServletResponse res,\n @RequestBody String roomDetails) throws JsonProcessingException {\n roomService.create(roomDetails);\n return ResponseEntity.status(200).build();\n }", "@PostMapping(\"/rooms\")\n public Room createRoom (\n @Valid\n @RequestBody Room room){\n return roomRepository.save(room);\n }", "public Room createRoom(Room room);", "@PostMapping(path = \"/rooms\")\n public ResponseEntity<Room> generateNewRoom() {\n Room newRoom = roomService.generateNewRoom();\n return new ResponseEntity<>(newRoom, HttpStatus.CREATED);\n }", "@Test\n public void shouldCreateAnValidRoomAndPersistIt() throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\twhen(dao.create(Arrays.asList(validRoomOfferValues))).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOffer createdRoomOffer = roomOfferService\n\t\t.createRoomOffer(command);\n\n\tverify(dao).create(Arrays.asList(validRoomOfferValues));\n\tassertThat(createdRoomOffer, is(equalTo(validRoomOffer)));\n }", "@Override\n public Room create(RoomResponseDTO roomResponseDTO) {\n return roomRepository.save(new Room(\n roomResponseDTO.getClassroomNumber()\n ));\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "public void makeTestRoom() {\r\n\t\tthis.boardData = new BoardData();\r\n\t\tthis.boardData.loadLevelOne();\r\n\r\n\t\tif (boardData.getAllRooms().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room list is empty\");\r\n\t\t} else if (boardData.getAllRooms().get(0).getRoomInventory().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room's inventory is empty\");\r\n\t\t}\r\n\t}", "@PostMapping(\"/chat-rooms\")\n public ResponseEntity<ChatRoom> createChatRoom(@RequestBody ChatRoom chatRoom) throws URISyntaxException {\n log.debug(\"REST request to save ChatRoom : {}\", chatRoom);\n if (chatRoom.getId() != null) {\n throw new BadRequestAlertException(\"A new chatRoom cannot already have an ID\", ENTITY_NAME, \"idexists\");\n }\n ChatRoom result = chatRoomRepository.save(chatRoom);\n return ResponseEntity.created(new URI(\"/api/chat-rooms/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "@Override\r\n\tpublic void OnCreateResult(cmdNotifyCreateResult createresult) {\n\t\tboolean isOK = createresult.getIsok();\r\n\t\tlong roomid = createresult.getRoomid();\r\n\t\tint roomtype = createresult.getType().ordinal();\r\n\t\tLog.d(TAG, \"OnCreateResult -------1\");\r\n\t\tCreateResult(isOK,String.valueOf(roomid),roomtype);\r\n\t}", "@Test\n\tpublic void testSaveRoomPositive() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player1\"); //The player knows the Shelter\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n\tpublic void testCreate() throws Exception {\n\t\tMockHttpServletRequestBuilder reqBuilder = MockMvcRequestBuilders.post(\"/createJourney\");\n\t\treqBuilder.contentType(MediaType.APPLICATION_JSON);\n\t\treqBuilder.accept(MediaType.APPLICATION_JSON);\n\t\treqBuilder.content(this.mapper.writeValueAsString(journey));\n\t\t\n\t\tResultMatcher matchStatus = MockMvcResultMatchers.status().isCreated();\n\t\tResultMatcher matchContent = MockMvcResultMatchers.content().json(this.mapper.writeValueAsString(savedJourney));\t\n\t\t\t\t\n\t\tthis.mockMVC.perform(reqBuilder).andExpect(matchStatus).andExpect(matchContent);\n\t}", "@PostMapping(\"/createNewGameRoom\")\n @ResponseStatus(HttpStatus.CREATED)\n public Game generateNewGameRoom() {\n String entrycode = service.generateEntryCode();\n currentGame.setEntrycode(entrycode);\n currentGame = gameDao.add(currentGame);\n return currentGame;\n }", "@Test\n\tpublic void testDeleteRoomPositive() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n public void createUser() {\n Response response = regressionClient.createUser();\n dbAssist.responseValidation(response);\n }", "public Result createRoom() {\n\n DynamicForm dynamicForm = Form.form().bindFromRequest();\n String roomType = dynamicForm.get(\"roomType\");\n Double price = Double.parseDouble(dynamicForm.get(\"price\"));\n int bedCount = Integer.parseInt(dynamicForm.get(\"beds\"));\n String wifi = dynamicForm.get(\"wifi\");\n String smoking = dynamicForm.get(\"smoking\");\n\n RoomType roomTypeObj = new RoomType(roomType, price, bedCount, wifi, smoking);\n\n if (dynamicForm.get(\"AddRoomType\") != null) {\n\n Ebean.save(roomTypeObj);\n String message = \"New Room type is created Successfully\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n } else{\n\n String message = \"Failed to create a new Room type\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n\n }\n\n\n\n }", "@Test\r\n\tpublic final void testDeleteRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\tassertTrue(success);\r\n\t\t// get room (id) due to autoincrement\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\t// remove room (thru id)+verify\r\n\t\tsuccess = roomServices.deleteRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// verify thru id search, verify null result\r\n\t\tRoom actual = roomServices.getRoomById(copy.getId());\r\n\t\tassertNull(actual);\r\n\t}", "public void testJoinGameResponseProcess() {\r\n\t\t\r\n\t\tString roomNumber = \"1\";\r\n\t\t\r\n\t\tString xmlString = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><response id=\\\"RandomUUID\\\" success=\\\"true\\\">\" + String.format(\"<joinGameResponse gameId=\\\"%s\\\">\" + \"</joinGameResponse></response>\", roomNumber);\r\n\t\t\r\n\t\tSystem.out.println(xmlString);\r\n\t\t\r\n\t\tMessage m = new Message(xmlString);\r\n\t\t\r\n\t\tassertTrue (new JoinGameResponseController(client, model).process(m));\r\n\t\tassertEquals (roomNumber, model.getGame().getRoomID());\r\n\t\t\r\n\t}", "@PostMapping(value=\"/insert/hotel\", consumes=MediaType.APPLICATION_JSON_VALUE)\r\n\tpublic ResponseClient insertNewRoom(@RequestBody Hotel hotel){\r\n\t\thotelSer.save(hotel);\r\n\t\tResponseClient res = new ResponseClient();\r\n\t\tres.setResponse(\"successfull hotel_id: \");\r\n\t\treturn res;\r\n\t}", "@Test\r\n\tpublic void testAjouterEtiquette() {\r\n\t\tassertEquals(true,this.client.ajouterEtiquette(\"Film\", \"lol\"));\r\n\t}", "public void createChatRoom(String name) throws RemoteException {\n\n\t\ttry {\n\t\t\tIChatServer chatStub;\n\t\t\t// make a new chatroom with supplied name\n\t\t\tIChatroom newRoom = new Chatroom(name);\n\t\t\tview.append(\"Make new ChatRoom: \" + newRoom.getName() + \"\\n\");\n\t\t\t// make a new chatserver stub for user in the newchatroom\n\t\t\tIChatServer newChatServer = new ChatServer(user, newRoom);\n\t\t\tview.append(\"Make new ChatServer: <User:\" + newChatServer.getUser().getName() + \", ChatServer: \"\n\t\t\t\t\t+ newChatServer.getChatroom().getName() + \">\\n\");\n\t\t\t//get a chatstub for new chatserver \n\t\t\tchatStub = (IChatServer) UnicastRemoteObject.exportObject(newChatServer, IChatServer.BOUND_PORT);\n\t\t\tregistry.rebind(IChatServer.BOUND_NAME + newRoom.hashCode(), chatStub);\n\t\t\tview.append(\"Make new ChatServer Stub for chatserver.\\n\");\n\t\t\t//add chatstub to newRoom\n\t\t\tnewRoom.addChatServer(chatStub);\n\t\t\tview.append(\"Add new ChatServer Stub to newRoom.\\n\");\n\t\t\t//add newchatroom to the user chatroom lists\n\t\t\tuser.addRoom(newRoom);\n\t\t\tview.append(\"Add new chatroom <\" + newRoom.getName() + \"> to user <\" + user.getName() + \">\\n\");\n\t\t\t//add all chatservers in that room to hashset\n\t\t\tHashSet<IChatServer> proxy = new HashSet<IChatServer>();\n\t\t\tfor (IChatServer item : newChatServer.getChatroom().getChatServers()) {\n\t\t\t\tIChatServer proxyChatServer = new ProxyIChatServer(item);\n\t\t\t\tproxy.add(proxyChatServer);\n\t\t\t}\n\t\t\tIMain2MiniAdpt miniMVCAdpt = view.makeMini(newChatServer, proxy);\n\t\t\tminiMVCAdpts.put(newRoom, miniMVCAdpt);\n\t\t\tcountRoom++;\n\t\t} catch (Exception e) {\n\t\t\tview.append(\"Error creating chatroom!\");\n\t\t}\n\n\t}", "@Test\n public void whenCreateCharacter_GettingSuccess() throws Exception {\n\n StudentRq studentRq = new StudentRq();\n studentRq.setName(\"Frank\");\n studentRq.setRole(\"student\");\n studentRq.setPatronus(\"stag\");\n studentRq.setHouse(\"1760529f-6d51-4cb1-bcb1-25087fce5bde\");\n\n mockito.perform(post(\"/api/characters/\", studentRq).contentType(MediaType.APPLICATION_JSON)\n .accept(MediaType.APPLICATION_JSON)\n .content(new Gson().toJson(studentRq)))\n .andExpect(status().isOk());\n }", "RoomModel createRoomModel(RoomModel roomModel);", "@Test\n public void createNewComputerBuildSuccess() {\n ComputerBuild computerBuild = createComputerBuild(SAMPLE_BUDGET_COMPUTER_BUILD_NAME, SAMPLE_BUDGET_COMPUTER_BUILD_DESCRIPTION);\n LoginRequest loginRequest = new LoginRequest(ANOTHER_USER_NAME_TO_CREATE_NEW_USER, USER_PASSWORD);\n\n loginAndCreateBuild(computerBuild, loginRequest, SAMPLE_BUDGET_COMPUTER_BUILD_NAME, SAMPLE_BUDGET_COMPUTER_BUILD_DESCRIPTION);\n }", "@Test\n public void testSuccess() throws Exception {\n\n client.makeBooking(\"Paul\", new Date(System.currentTimeMillis()), false);\n\n BookingStatus bookingStatus = client.getLastBookingStatus();\n Assert.assertTrue(\"Expected booking to be confirmed, but it wasn't: \" + bookingStatus, bookingStatus.equals(BookingStatus.CONFIRMED));\n }", "@Test\n public void whenCreateValidStudent_thenReceiveOKResponse() throws IOException {\n final HttpPost httpPost = new HttpPost(BASE_URL + \"2/students\");\n final InputStream resourceStream = this.getClass().getClassLoader()\n .getResourceAsStream(\"created_student.xml\");\n httpPost.setEntity(new InputStreamEntity(resourceStream));\n httpPost.setHeader(\"Content-Type\", \"text/xml\");\n \n //In this case the Student object does not exist in the Course \n //istance and should be succefully created\n final HttpResponse response = client.execute(httpPost);\n assertEquals(200, response.getStatusLine().getStatusCode());\n \n //We may confirm the new states of the web service resource\n final Student student = getStudent(2, 3);\n assertEquals(3, student.getId());\n assertEquals(\"Student C\", student.getName());\n }", "boolean create_user(String username, String password)\n {\n String input = \"{ \\\"name\\\": \\\"\" + username + \"\\\", \\\"password\\\": \\\"\" + password +\"\\\" }\";\n return request(\"POST\", input, \"players\").equals(\"1\");\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomOkResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "public void successfulCreation(String type) {\n switch (type) {\n case \"Attendee\":\n System.out.println(\"Attendee Created\");\n break;\n case \"Organizer\":\n System.out.println(\"Organizer Created\");\n break;\n case \"Speaker\":\n System.out.println(\"Speaker Created\");\n break;\n case \"VIP\":\n System.out.println(\"VIP Created\");\n break;\n }\n }", "@Test(\tdescription = \"Create a basic appointment\",\n\t\t\tgroups = { \"sanity\" }\n\t)\n\tpublic void CheckApptCreatedOnServer() throws HarnessException {\n\t\tAppointmentItem appt = new AppointmentItem();\n\t\tappt.setSubject(\"appointment\" + ZimbraSeleniumProperties.getUniqueString());\n\t\tappt.setContent(\"content\" + ZimbraSeleniumProperties.getUniqueString());\n\t\tappt.setStartTime(new ZDate(2014, 12, 25, 12, 0, 0));\n\t\tappt.setEndTime(new ZDate(2014, 12, 25, 14, 0, 0));\n\n\n\t\t// Open the new mail form\n\t\tFormApptNew apptForm = (FormApptNew) app.zPageCalendar.zToolbarPressButton(Button.B_NEW);\n\t\tZAssert.assertNotNull(apptForm, \"Verify the new form opened\");\n\n\t\t// Fill out the form with the data\n\t\tapptForm.zFill(appt);\n\n\t\t// Send the message\n\t\tapptForm.zSubmit();\n\t\t\t\n\t\t//verify toasted message 'group created' \n String expectedMsg =\"Appointment Created\";\n ZAssert.assertStringContains(app.zPageMain.zGetToaster().zGetToastMessage(),\n \t\t expectedMsg , \"Verify toast message '\" + expectedMsg + \"'\");\n \n\t\t\n\t\tverifyApptCreatedOnServer(appt);\n\t}", "@Test\n public void testCreaAlumno() {\n System.out.println(\"creaAlumno\");\n Alumno alumno = new Alumno();\n alumno.setNombre(\"Dulce\");\n alumno.setApellido(\"Alvarado\");\n Alumno result = instance.creaAlumno(alumno);\n assertNotNull(result.getId());\n }", "@Test\n public void testDemotivatorCreateSuccess() throws IOException{\n \tFixtures.deleteAllModels();\n \tFixtures.loadModels(\"data/user.yml\");\n \t\n \tauthenticate();\n \t\n \tMap<String, String> createDemoParams = new HashMap<String, String>();\n \tcreateDemoParams.put(\"title\", THIRTY_CHARS_TITLE);\n \tcreateDemoParams.put(\"text\", EIGHTY_CHARS_TEXT);\n \tcreateDemoParams.put(\"mode\", \"create\");\n \tMap<String, File> fileParams = new HashMap<String, File>();\n \tFile file = new File(\"test/data/image.jpg\");\n \tfileParams.put(\"image\", file);\n\n \tResponse response = POST(\"/create\", createDemoParams, fileParams);\n\n \tassertStatus(200, response);\n \tassertContentType(\"application/json; charset=utf-8\", response);\n \t\n \tList<Demotivator> demos = Demotivator.findAll();\n \tassertEquals(1, demos.size());\n \tassertEquals(THIRTY_CHARS_TITLE, demos.get(0).getTitle());\n \tassertEquals(EIGHTY_CHARS_TEXT, demos.get(0).getText());\n \tassertEquals(\"localhost\", demos.get(0).getDomain().getName());\n \tlong id = demos.get(0).getId().longValue();\n \t\n \tassertContentEquals(\"{\\\"fileName\\\":\\\"/image/thumb.test.file.name\\\",\\\"id\\\":\\\"\" + id + \"\\\",\\\"status\\\":\\\"success\\\"}\", response);\n }", "@Test\r\n\tpublic final void testGetRoomById() {\n\t\tRoom actual = roomServices.getRoomById(expected.getId());\r\n\t\tassertEquals(expected, actual);\r\n\t}", "@Test\n public void aTestRegister() {\n given()\n .param(\"username\", \"playlist\")\n .param(\"password\", \"playlist\")\n .post(\"/register\")\n .then()\n .statusCode(201);\n }", "@Test\n public void create_400() throws Exception {\n\n // PREPARE THE DATABASE\n // No data needed in database\n\n // PREPARE THE TEST\n // No preparation needed\n\n // DO THE TEST\n Response response = callAPI(VERB.POST, \"/mo/\", null);\n\n // CHECK RESULTS\n int status = response.getStatus();\n assertEquals(400, status);\n\n String body = response.readEntity(String.class);\n assertEquals(\"Wrong inputs\", body);\n\n }", "@Test\n\tpublic void test_create_new_user_success(){\n\t\tUser user = new User(null, \"create_user\", \"[email protected]\", \"12345678\");\n\t\tResponseEntity<User> response = template.postForEntity(REST_SERVICE_URI + ACCESS_TOKEN + token, user, User.class);\n\t\tUser newUser = response.getBody();\n\t\tassertThat(newUser.getName(), is(\"create_user\"));\n\t\tassertThat(response.getStatusCode(), is(HttpStatus.CREATED));\n\t\tvalidateCORSHttpHeaders(response.getHeaders());\n\t}", "private void POSTTest(Map<String, Object> inputBody, int expectedStatus, Map<String, Object> expectedResponse, boolean strict) throws Exception{\n CloseableHttpResponse response = createUser(inputBody);\n int status = response.getStatusLine().getStatusCode();\n\n if (status == expectedStatus) {\n HttpEntity entity = response.getEntity();\n String strResponse = EntityUtils.toString(entity);\n System.out.println(\"*** String response \" + strResponse + \" (\" + response.getStatusLine().getStatusCode() + \") ***\");\n if (expectedStatus == 201) {\n expectedResponse.put(\"id\", Long.parseLong(getIdFromStringResponse(strResponse)));\n JSONObject json = new JSONObject(expectedResponse);\n JSONAssert.assertEquals(json.toString() ,strResponse, strict);\n } else {\n // // shouldnt be comaring response for an invalid request\n // if (!\"\".equals(strResponse)){\n // throw new ClientProtocolException(\"Unexpected response body: \" + strResponse);\n // }\n } \n\n } else {\n throw new ClientProtocolException(\"Unexpected response status: \" + status);\n }\n\n EntityUtils.consume(response.getEntity());\n response.close();\n }", "public void createRooms()//Method was given\n { \n \n // create the rooms, format is name = new Room(\"description of the situation\"); ex. desc = 'in a small house' would print 'you are in a small house.'\n outside = new Room(\"outside\", \"outside of a small building with a door straight ahead. There is a welcome mat, a mailbox, and a man standing in front of the door.\", false);\n kitchen = new Room(\"kitchen\", \"in what appears to be a kitchen. There is a sink and some counters with an easter egg on top of the counter. There is a locked door straight ahead, and a man standing next to a potted plant. There is also a delicious looking chocolate bar sitting on the counter... how tempting\", true);\n poolRoom = new Room(\"pool room\", \"in a new room that appears much larger than the first room.You see a table with a flashlight, towel, and scissors on it. There is also a large swimming pool with what looks like a snorkel deep in the bottom of the pool. Straight ahead of you stands the same man as before.\", true);\n library = new Room(\"library\", \"facing east in a new, much smaller room than before. There are endless rows of bookshelves filling the room. All of the books have a black cover excpet for two: one red book and one blue book. The man stands in front of you, next to the first row of bookshelves\", true);\n exitRoom = new Room(\"exit\", \"outside of the building again. You have successfully escaped, congratulations! Celebrate with a non-poisonous chocolate bar\",true);\n \n // initialise room exits, goes (north, east, south, west)\n outside.setExits(kitchen, null, null, null);\n kitchen.setExits(poolRoom, null, outside, null);\n poolRoom.setExits(null, library, kitchen, null);\n library.setExits(null, null, exitRoom, poolRoom);\n exitRoom.setExits(null, null, null, null); \n \n currentRoom = outside; // start game outside\n }", "@Test\r\n\tpublic final void testUpdateRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\t// check if added successfully\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the id from database since it autoincrements\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\texpected3.setId(copy.getId());\r\n\t\t// set new data\r\n\t\tcopy.setName(expected3.getName());\r\n\t\tcopy.setLocation(expected3.getLocation());\r\n\t\t// update database\r\n\t\tsuccess = roomServices.updateRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the current version from database\r\n\t\tRoom actual = roomServices.getRoomById(expected2.getId());\r\n\t\t// check content of data\r\n\t\tassertEquals(expected3, actual);\r\n\t\t// delete room on exit\r\n\t\troomServices.deleteRoom(actual);\r\n\t}", "@Test\n final void testCreateDevice() {\n when(deviceDao.save(user, deviceDTO)).thenReturn(deviceDTO);\n when(request.getRemoteAddr()).thenReturn(DeviceFixture.PUBLIC_IP_ADDRESS);\n when(deviceDao.createDevice(user, createDeviceRequest, DeviceFixture.PUBLIC_IP_ADDRESS))\n .thenReturn(deviceDTO);\n when(deviceMapper.toModel(deviceDTO)).thenReturn(deviceModel);\n\n ResponseEntity<DeviceModel> response = deviceController.createDevice(createDeviceRequest);\n\n assertEquals(200, response.getStatusCodeValue());\n assertNotNull(response.getBody());\n DeviceModel device = response.getBody();\n assertEquals(deviceModel, device);\n }", "@Test\n\tpublic void testAdminCreate() {\n\t\tAccount acc1 = new Account(00000, \"ADMIN\", true, 1000.00, 0, false);\n\t\taccounts.add(acc1);\n\n\t\ttransactions.add(0, new Transaction(10, \"ADMIN\", 00000, 0, \"A\"));\n\t\ttransactions.add(1, new Transaction(05, \"new acc\", 00001, 100.00, \"A\"));\n\t\ttransactions.add(2, new Transaction(00, \"ADMIN\", 00000, 0, \"A\"));\n\n\t\ttransHandler = new TransactionHandler(accounts, transactions);\n\t\toutput = transHandler.HandleTransactions();\n\n\t\tif (outContent.toString().contains(\"Account Created\")) {\n\t\t\ttestResult = true;\n\t\t} else {\n\t\t\ttestResult = false;\n\t\t}\n\n\t\tassertTrue(\"unable to create account as admin\", testResult);\n\t}", "@Test\n public void shouldBookAnValidRoomAndPersistTheChanges() throws Exception {\n\n\tfinal String customerId = \"1234\";\n\tfinal UrlyBirdRoomOffer expectedRoomOffer = new UrlyBirdRoomOffer(\n\t\tvalidRoomOffer.getHotel(), validRoomOffer.getCity(),\n\t\tvalidRoomOffer.getRoomSize(), false, validRoomOffer.getPrice(),\n\t\tvalidRoomOffer.getBookableDate(), customerId,\n\t\tvalidRoomOffer.getIndex());\n\tfinal BookRoomCommand bookRoomCommand = new BookRoomCommand(\n\t\tvalidRoomOffer, customerId);\n\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\twhen(builder.copyRoomOfferWithNewCustomer(validRoomOffer, customerId))\n\t\t.thenReturn(expectedRoomOffer);\n\twhen(dao.read(bookRoomCommand.getRoomToBook().getIndex())).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\tfinal UrlyBirdRoomOffer bookedRoom = roomOfferService\n\t\t.bookRoomOffer(bookRoomCommand);\n\n\tverify(isRoomBookable).isSatisfiedBy(validRoomOffer);\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).read(validRoomOffer.getIndex());\n\tverify(dao).update(eq(expectedRoomOffer), anyLong());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tassertThat(bookedRoom, is(equalTo(expectedRoomOffer)));\n }", "@Test\n public void createUnassignedGame() throws Exception {\n final GameResource resource = TestUtils.newGameResource();\n resource.setStartsAt(\"2014-03-21T16:00:00.000\");\n\n mockMvc.perform(post(BASE_REQUEST_URL).with(superadmin)\n .header(AUTH_HEADER_NAME, createTokenForUser())\n .contentType(contentType)\n .content(TestUtils.convertObjectToJson(resource)))\n .andExpect(status().isCreated())\n .andExpect(content().contentType(contentType))\n .andExpect(jsonPath(\"$.site\", is(resource.getSite())))\n .andExpect(jsonPath(\"$.startsAt\", is(resource.getStartsAt())));\n }", "@Test\n public void testReservationFactoryCreate() {\n ReservationController reservationController = reservationFactory.getReservationController();\n Customer customer = new Customer(CUSTOMER_NAME, CUSTOMER_CONTACT, false);\n Calendar date = Calendar.getInstance();\n // create a 2 seater table // default is vacant\n tableFactory.getTableController().addTable(2);\n Table table = tableFactory.getTableController().getTable(1);\n reservationController.addReservation(date, customer, 2, table);\n assertEquals(1, reservationController.getReservationList().size());\n }", "@Test @Ignore(\"Only to run on test vertec instance\")\n public void canCreateOrganisation() {\n Organisation org = new Organisation();\n org.setActive(true);\n org.setBuildingName(\"building name\");\n org.setBusinessDomain(\"business domain\");\n org.setCategory(\"category\");\n org.setCity(\"city\");\n org.setCountry(\"country\");\n org.setName(\"GEBO test org\");\n org.setOwnedOnVertecBy(\"Sales Team\");\n org.setOwnerId(5295L);\n org.setStreet(\"street\");\n org.setStreet_no(\"street_no\");\n org.setWebsite(\"website\");\n org.setZip(\"zip\");\n org.setParentOrganisation(TESTVertecOrganisation2); //TODO figure out what to do here\n\n String uri = baseURI + \"/organisation\";\n ResponseEntity<String> res = postToVertec(org, uri, String.class);\n assertEquals(HttpStatus.CREATED, res.getStatusCode());\n\n }", "@Test\n\tpublic void testCreate() {\n\t\tApp app = new App();\n\t\tapp.setId(1L);\n\t\tRole role = new Role();\n\t\trole.setApp(app);\n\t\trole.setName(\"admin中国\");\n\t\troleService.create(role);\n\t}", "public void sendCreateTest( MessageReceivedEvent event ) {\n\n final StringBuilder message = new StringBuilder();\n message.append( \"!poll create \\\"NoArgs\\\" \\n\" );\n message.append( \"!poll create \\\"\\\" \\\"\\\" \\n\" );\n message.append( \"!poll create NoQuotes Ans1 \\n\" );\n message.append( \"!poll create \\n\" );\n message.append( \"!poll \\n\" );\n message.append( \"!poll create \\\"PassPoll\\\" \\\"Ans1\\\" \\\"Ans2\\\" \\n\" );\n message.append(\"-----\");\n event.getChannel().sendMessage( message ).queue();\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<Response<CommunicationRoom>> createRoomWithResponse(CreateRoomOptions createRoomOptions) {\n return createRoomWithResponse(createRoomOptions, null);\n }", "@Test\r\n\tpublic final void testGetRoomByName() {\n\t\tRoom actual = roomServices.getRoomByName(expected.getName());\r\n\t\tassertEquals(expected, actual);\r\n\t}", "@Test\n public void a_create() {\n String url = baseUrl + \"create\";\n System.out.println();\n System.out.println(\"volunteerProvince being posted: \"+volunteerProvince);\n ResponseEntity<VolunteerProvince> postResponse = testRestTemplate\n .withBasicAuth(SECURITY_USERNAME, SECURITY_PASSWORD)\n .postForEntity(url, volunteerProvince, VolunteerProvince.class);\n volunteerProvince = postResponse.getBody();\n assertNotNull(postResponse.getBody());\n assertEquals(volunteerProvince.getVolunteerNum(), postResponse.getBody().getVolunteerNum());\n System.out.println(\"Volunteer Province saved on the data structure: \"+postResponse.getBody());\n\n }", "@Test\n\tpublic void createTicketTest() {\n\t\tService.createTicket(new TicketCreation(), \"username\");\n\t\tMockito.verify(TicketDao, times(1)).createTicket(Mockito.any(TicketCreation.class), Mockito.anyString());\n\t}", "@RequestMapping(value=\"/room/form\", method=RequestMethod.POST)\r\n\tpublic String postRoom(@Valid @ModelAttribute(\"room\") Room room,\r\n\t\t\tBindingResult bindingResult, Model model) {\r\n\t\tthis.roomValidator.validate(room, bindingResult);\r\n\t\tif(!bindingResult.hasErrors()) {\r\n\t\t\tmodel.addAttribute(\"room\", this.roomService.save(room));\r\n\t\t\treturn \"roomCreated\";\r\n\t\t}\r\n\t\treturn \"roomForm\";\r\n\t}", "@Test(expected = Exception.class)\n public void shouldNotCreateTheRoomIfTheGivenRoomIsInvalidAndThrowAnException()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, null);\n\n\tdoThrow(new ConstraintViolationException(\"\")).when(dao).create(\n\t\tArrays.asList(validRoomOfferValues));\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "@Test\n\tpublic void testBook() throws Exception {\n\t\tString createdReservationID = bookingManagement.book(USER_ID, Arrays.asList(room1.getId()),\n\t\t\t\tvalidStartDate, validEndDate);\n\t\t// a reservation must be returned\n\t\tassertNotNull(\"Reservation id is null\", createdReservationID);\n\t\tassertFalse(\"Reservation id is emtpy\", createdReservationID.isEmpty());\n\t\t// check if returned reservation is correct\n\t\tReservation createdReservation = bookingManagement.getReservation(createdReservationID);\n\t\tassertNotNull(\"Reservation of returned id was not found\", createdReservation);\n\n\t\tassertEquals(USER_ID, createdReservation.getBookingUserId());\n\n\t\tassertEquals(1, createdReservation.getBookedFacilityIds().size());\n\t\tassertTrue(createdReservation.getBookedFacilityIds().contains(room1.getId()));\n\t\tassertEquals(validStartDate, createdReservation.getStartTime());\n\t\tassertEquals(validEndDate, createdReservation.getEndTime());\n\t}", "public void createRoom() {\n int hp = LabyrinthFactory.HP_PLAYER;\n if (hero != null) hp = hero.getHp();\n try {\n labyrinth = labyrinthLoader.createLabyrinth(level, room);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try {\n characterLoader.createCharacter(level, room);\n hero = characterLoader.getPlayer();\n if (room > 1) hero.setHp(hp);\n createMonsters();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@Test\n public void usuarioPreguntaEnPublicacion() {\n Mensaje mp = new Mensaje();\n mp.setPublicacionId(2);\n mp.setPregunta(\"Es jugueton??\");\n mp.guardarPregunta(usuario.getToken());\n assertTrue(mp.getId() > 0);\n\n }", "Boolean deleteRoom(String roomId);", "@Override\n public void onClickCreateRoom(String code) {\n\n boolean status = networkControl.checkDialogPresence(getApplicationContext(),MultiplayerActivity.this);\n if(status){\n loadingDialog = new LoadingDialog(MultiplayerActivity.this);\n loadingDialog.startDialog(getResources().getString(R.string.wait_access_room));\n loadingDialog.setDataToCancel(code);\n loadingDialog.setVisibleClick(true);\n\n HashMap<String,String> data = new HashMap<>();\n data.putAll((Map<String,String>) preferences.getAll());\n String nickname = data.get(KEY_NICKNAME_PREFERENCES);\n\n addRoomsEventListener(loadingDialog,code,nickname);\n }\n\n\n }", "@Override\n public void onSuccess() {\n Toast.makeText(context, \"Created\", Toast.LENGTH_SHORT).show();\n //realm.close();\n }", "public ChatRoom createRoom(String room) {\r\n ChatRoom chatRoom = new ChatRoom(serviceAddress.withLocal(room), null, xmppSession, serviceDiscoveryManager, multiUserChatManager);\r\n chatRoom.initialize();\r\n return chatRoom;\r\n }", "private void createRooms()//refactored\n {\n currentRoom = RoomCreator.buildCurrentRooms();//new\n }", "public void shouldCreate() {\n }", "@Test\n\tpublic void givenCreateItem_whenValidRecord_ThenSuccess() {\n\t\tHashMap<String, Object> newRecord = getRecordHashMap(20, \"Steak\", \"Meats\", 15.5f);\n\n\t\t// create a new record and extract the ID from the response\n\t\tInteger newId = given().\n\t\t\tcontentType(ContentType.JSON).\n\t\t\tbody(newRecord).\n\t\twhen().\n\t\t\tpost(\"/\").\n\t\tthen().\n\t\t\tstatusCode(HttpStatus.CREATED.value()).\n\t\t\tcontentType(ContentType.JSON).\n\t\t\textract().\n\t\t\tpath(\"id\");\n\n\t\tnewRecord = setRecordId(newRecord, newId);\n\n\t\t// verify that the new record is created\n\t\tHashMap<String, Object> actual = given().\n\t\t\tpathParam(\"id\", newId).\n\t\twhen().\n\t\t\tget(\"/{id}\").\n\t\tthen().\n\t\t\tstatusCode(HttpStatus.OK.value()).\n\t\t\tcontentType(ContentType.JSON).\n\t\t\textract().path(\"$\");\n\n\t\tassertThat(newRecord).isEqualTo(actual);\n\n\t}", "@Test\n\tpublic void testSaveDoctor() {\n\t\tfinal Doctor doctor = new Doctor();\n\t\tdoctor.setDoctorid(5);\n\t\tResponseEntity<String> responseEntity = this.restTemplate.postForEntity(getRootUrl() + \"/save-doctor?doctorid=5\", doctor , String.class);\n\t\tassertEquals(200,responseEntity.getStatusCodeValue());\n\t}", "@Test\n\tpublic void testCreateTicketOk() {\n\t\tArrayList<Object> p = new ArrayList<Object>();\n\t\tp.add(new TGame(\"FORTNITE\", 6, 20.0, 1, 2, \"descripcion\", \"Shooter\"));\n\t\tTTicket tt = new TTicket(1, p);\n\t\tassertEquals();\n\t}", "@Test\n public void shouldFindAllMatchingRoomsWithTheDaoAndReturnItToTheClient()\n\t throws Exception {\n\n\tfinal ArrayList<String> criteria = Lists.newArrayList(null, null, null,\n\t\tnull, null, null, null);\n\tfinal FindRoomCommand command = new FindRoomCommand(criteria.get(0),\n\t\tcriteria.get(1), true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, null, null, null);\n\n\tfinal List<UrlyBirdRoomOffer> result = Lists\n\t\t.newArrayList(validRoomOffer);\n\twhen(dao.find(criteria)).thenReturn(result);\n\n\tfinal List<RoomOffer> foundRooms = roomOfferService\n\t\t.findRoomOffer(command);\n\n\tassertEquals(result, foundRooms);\n }", "@Test(enabled=false)\n\tpublic void createPostCheckBodyContents() {\n\t\tPosts posts = new Posts(\"4\", \"Packers\", \"Favre\");\n\t\t\n\t\tgiven().\n\t\twhen().contentType(ContentType.JSON).\n\t\tbody(posts).\n\t\tpost(\"http://localhost:3000/posts/\").\n\t\tthen().\n\t\tstatusCode(201).\n\t\tbody(\"id\", is(posts.getId())).\n\t\tbody(\"title\",is(posts.getTitle())).\n\t\tbody(\"author\",is(posts.getAuthor()));\n\t}", "private boolean checkRoomValid(String room) {\n\treturn true;\r\n}", "@Test\n public void testChatPost() throws Exception {\n long count = chatRepo.count();\n chatRepo.save(new Chat());\n\n // see if it correctly saves the chat room\n assertThat(count + 1).isEqualTo(chatRepo.count());\n count = chatRepo.count();\n\n MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>();\n map.add(\"contet\", \"hey there\");\n template.postForObject(\"http://localhost:\" + port + \"/chat/compose/6\", map, String.class);\n assertThat(count).isEqualTo(chatRepo.count());\n }", "@Test\n public void shouldUpdateTheSpezifiedValidRoomAndPersistTheChanges()\n\t throws Exception {\n\n\tfinal ArrayList<String> newValidValues = Lists.newArrayList(\"Hilton\",\n\t\t\"Hamburg\", \"2\", \"N\", \"12\", \"12.02.2007\", \"\");\n\n\tfinal UpdateRoomCommand command = new UpdateRoomCommand(newValidValues,\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\twhen(builder.createRoomOffer(newValidValues, validRoomOffer.getIndex()))\n\t\t.thenReturn(validRoomOffer);\n\n\tfinal UrlyBirdRoomOffer updatedRoomOffer = roomOfferService\n\t\t.updateRoomOffer(command);\n\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tverify(dao).update(eq(validRoomOffer), anyLong());\n\tassertThat(updatedRoomOffer, is(equalTo(validRoomOffer)));\n }", "@Test\n public void testRegisterSuccessfully() {\n SignUpRequest request = new SignUpRequest(UNIQUE, \"Secret\");\n\n dao.register(request);\n\n verify(controller).registered();\n }", "public void createLevel() {\n room = 1;\n currentLevelFinish = false;\n createRoom();\n }", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<CommunicationRoom> createRoom(CreateRoomOptions createRoomOptions) {\n return createRoom(createRoomOptions, null);\n }", "@Test\n @InSequence(1)\n public void testRegister(){\n Customer customer = createCustomerInstance(\"Jane Doe\", \"[email protected]\", \"07744754955\");\n //Customer customer = storeCustomer(customer0);\n Taxi taxi0 = createTaxiInstance(\"JK66AKB\",6);\n Taxi taxi = storeTaxi(taxi0);\n //create a GuestBooking with a future date.\n GuestBooking guestBooking = createGuestBookingInstance(customer, taxi.getId(), futureDate1);\n Response response = guestBookingRestService.createBooking(guestBooking);\n\n assertEquals(\"Unexpected response status\", 201, response.getStatus());\n log.info(\" New booking via GuestBookingService.createBooking was persisted and returned status \" + response.getStatus());\n }", "@Test(enabled = true)\n public void createPerson() {\n List <Account> accounts = new ArrayList<>();\n List<Subscription> sub = new ArrayList<>();\n \n Contact contact = new Contact.Builder().emailaddress(\"[email protected]\").phoneNumber(\"021345685\").build();\n Address address = new Address.Builder().location(\"Daveyton\").streetName(\"Phaswane Street\").houseNumber(45).build();\n \n repo = ctx.getBean(PersonsRepository.class);\n Person p = new Person.Builder()\n .firstname(\"Nobu\")\n .lastname(\"Tyokz\")\n .age(25)\n .account(accounts)\n .sub(sub)\n .contact(contact)\n .address(address)\n .build();\n repo.save(p);\n id = p.getId();\n Assert.assertNotNull(p);\n\n }", "@Test\n public void destiny2InsertSocketPlugTest() {\n InlineResponse20045 response = api.destiny2InsertSocketPlug();\n\n // TODO: test validations\n }", "@Test\n public void testAddRent() {\n System.out.println(\"addRent\");\n ReserveInfo reserveInfo = new ReserveInfo();\n reserveInfo.setGuestIDnumber(\"test\");\n reserveInfo.setGuestName(\"test\");\n reserveInfo.setRentType(\"test\");\n reserveInfo.setRoomType(\"test\");\n reserveInfo.setRentDays(1);\n reserveInfo.setRemark(\"test\");\n reserveInfo.setResult(true); \n BookingController instance = new BookingController();\n boolean expResult = true;\n boolean result = instance.addRent(reserveInfo);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n }", "@RequestMapping(value = \"/Reservation/{reservation_reservationId}/room\", method = RequestMethod.POST)\n\t@ResponseBody\n\tpublic Room newReservationRoom(@PathVariable Integer reservation_reservationId, @RequestBody Room room) {\n\t\treservationService.saveReservationRoom(reservation_reservationId, room);\n\t\treturn roomDAO.findRoomByPrimaryKey(room.getRoomId());\n\t}", "@Test(expected = Exception.class)\n public void shouldNotBookAnAlreadyBookedRoomAndInformTheClientWithTheAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\t\"12\");\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(false);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n public void publicadorPreguntaEnPublicacionAPostulante() {\n Mensaje mp = new Mensaje();\n mp.setPublicacionId(7);\n mp.setPregunta(\"Tenes jardin?\");\n mp.setUsuarioPreguntaId(usuario.getId());\n mp.setUsuarioRespuestaId(3);\n mp.guardarPregunta(usuario.getToken());\n assertTrue(mp.getId() > 0);\n\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@RequestMapping(method = RequestMethod.POST)\n public ResponseEntity<?> addGameRoom(@RequestBody Game gameRoom) {\n try {\n ls.addGameRoom(gameRoom);\n return new ResponseEntity<>(HttpStatus.CREATED);\n } catch (LacmanPersistenceException ex) {\n Logger.getLogger(LacmanController.class.getName()).log(Level.SEVERE, null, ex);\n return new ResponseEntity<>(ex.getMessage(), HttpStatus.FORBIDDEN);\n }\n }", "@Test\n public void testCreateValidUser() {\n LocalUserManager ua = new LocalUserManager();\n\n try {\n ua.createUser(\"gburdell1\", \"buzz\", \"[email protected]\", \"George\", \"Burdell\", \"MANAGER\");\n } catch (Exception e) {\n Assert.fail();\n }\n Assert.assertEquals(1, ua.getUsers().size());\n Assert.assertEquals(\"gburdell1\", ua.getUsers().get(0).getUsername());\n Assert.assertEquals(\"[email protected]\", ua.getUsers().get(0).getEmail());\n Assert.assertEquals(UserClass.MANAGER, ua.getUsers().get(0).getUserClass());\n }", "@Transactional\n @PostMapping(path = \"/create/{name}\")\n public Player createPlayer(@PathVariable String name,\n @RequestParam(name = \"room\", defaultValue = \"\") String room,\n @RequestParam(name = \"rid\", defaultValue = \"\") String roomId,\n @RequestParam(name = \"photo\", defaultValue = \"\") String photo) {\n Player player = null;\n try {\n if (photo.equals(\"\")) {\n player = playerService.create(name);\n } else {\n player = playerService.create(name, photo);\n }\n log.info(\"Created player \" + player.getName());\n if (!roomId.equals(\"\") && Integer.valueOf(roomId) > 0) {\n log.info(\"Processing optional parameter room id: \" + roomId);\n player.setRoom(Integer.valueOf(roomId));\n }\n if (!room.equals(\"\")) {\n log.info(\"Processing optional parameter room: \" + room);\n Optional<Room> r = roomService.get(room);\n if (r.isPresent()) {\n log.info(\"Room \" + room + \" was found. Joining player \" + name);\n player.setRoom(r.get().getId());\n }\n }\n } catch (Exception e) {\n log.error(\"Error creating player: \" + e.getMessage());\n }\n // log.info(\"Player created!\");\n return player;\n }", "@Test\n public void shouldCreateCase() {\n assertThat(DatabaseHelper.getCaseDao().queryForAll().size(), is(0));\n\n TestEntityCreator.createCase();\n\n // Assure that the case has been successfully created\n assertThat(DatabaseHelper.getCaseDao().queryForAll().size(), is(1));\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n void createNullTest() {\n reservationService.create(null);\n }", "@Test\n public void testNewFolder() {\n boolean result = instance.newFolder(mailboxID + File.separator + \"newFolder\");\n assertEquals(true, result);\n }", "public int creatRoom(String boardId) {\n\t\tConnection conn = getConnection();\n\t\tint result = cd.creatRoom(conn, boardId);\n\t\tif (result > 0) {\n\t\t\tcommit(conn);\n\t\t} else {\n\t\t\trollback(conn);\n\t\t}\n\t\tclose(conn);\n\t\treturn result;\n\t}", "@Test\n public void createTest() {\n reservationService.create(reservation1);\n Mockito.verify(reservationDao).create(reservation1);\n }", "@PostMapping(\"/new\")\n @ResponseStatus(HttpStatus.CREATED)\n public Boolean newChat(@RequestBody NewChatEvent event) {\n notificationService.notifyAboutNewChat(event.getChatId(), event.getDepartmentId());\n scheduleService.scheduleReassignment(event.getChatId());\n return Boolean.TRUE;\n }", "private static void performRoomManagement() {\n\t\t\r\n\t\t\r\n\r\n\t}", "public interface CreateRoomInteractor {\n interface OnFinishedListener{\n void createSuccess();\n void createFailure();\n void uploadThumbnailSuccess(String returnedUrl);\n }\n void createRoom(String name,String thumbnailUrl,OnFinishedListener callback );\n void uploadThumbnail(Uri uri,OnFinishedListener callback);\n}", "@Test\n public void create1Test1() throws SQLException {\n manager = new TableServizioManager(mockDb);\n manager.create1(false,false,false,false,false,false,false);\n Servizio servizio = manager.retriveById(5);\n assertNotNull(servizio,\"Should return true if create Servizio\");\n }" ]
[ "0.8588965", "0.7361861", "0.72645134", "0.6996082", "0.6762875", "0.6760224", "0.6675829", "0.660688", "0.65562135", "0.65498567", "0.6435905", "0.6367765", "0.6224084", "0.6160081", "0.6138431", "0.61356175", "0.61067736", "0.61005604", "0.60368985", "0.59903574", "0.5918648", "0.59046423", "0.5884826", "0.5831349", "0.58280355", "0.57973725", "0.5786397", "0.5776735", "0.57700235", "0.57690984", "0.5762006", "0.5701755", "0.5699682", "0.56905204", "0.5674966", "0.5656785", "0.5654179", "0.56336564", "0.56258273", "0.5617272", "0.55914646", "0.55837244", "0.55718607", "0.5549463", "0.5541913", "0.5539479", "0.55258316", "0.55253506", "0.5493585", "0.5483612", "0.54809576", "0.54743296", "0.5472041", "0.547141", "0.543285", "0.54242635", "0.5414404", "0.54072064", "0.540629", "0.5404692", "0.54013443", "0.53999066", "0.5383678", "0.5378334", "0.53602004", "0.5347941", "0.5342875", "0.5340937", "0.53402185", "0.533431", "0.53327405", "0.5329629", "0.5321866", "0.53197587", "0.53063637", "0.52974164", "0.5294752", "0.5293072", "0.5282367", "0.52815723", "0.5279979", "0.5277883", "0.526943", "0.52667093", "0.5262351", "0.52620614", "0.5261", "0.5247413", "0.5236006", "0.52326316", "0.52312595", "0.5227302", "0.52144235", "0.5214006", "0.5209631", "0.52044344", "0.52022785", "0.52004945", "0.5194094", "0.51900375" ]
0.79625946
1
Test create room with BAD response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testCreateRoomWithOptionsBadResponse() { // given Map<String, String> options = new HashMap<>(); final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).options(options).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest)) .willReturn(BAD_RESPONSE); // when multiUserChatService.createRoomWithOptions(TEST_ROOM, options); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomBadResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test(expected = Exception.class)\n public void shouldNotCreateTheRoomIfTheGivenRoomIsInvalidAndThrowAnException()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, null);\n\n\tdoThrow(new ConstraintViolationException(\"\")).when(dao).create(\n\t\tArrays.asList(validRoomOfferValues));\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsOkResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test\n public void create_400() throws Exception {\n\n // PREPARE THE DATABASE\n // No data needed in database\n\n // PREPARE THE TEST\n // No preparation needed\n\n // DO THE TEST\n Response response = callAPI(VERB.POST, \"/mo/\", null);\n\n // CHECK RESULTS\n int status = response.getStatus();\n assertEquals(400, status);\n\n String body = response.readEntity(String.class);\n assertEquals(\"Wrong inputs\", body);\n\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnAlreadyBookedRoomAndInformTheClientWithTheAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\t\"12\");\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(false);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n public void shouldCreateAnValidRoomAndPersistIt() throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\twhen(dao.create(Arrays.asList(validRoomOfferValues))).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOffer createdRoomOffer = roomOfferService\n\t\t.createRoomOffer(command);\n\n\tverify(dao).create(Arrays.asList(validRoomOfferValues));\n\tassertThat(createdRoomOffer, is(equalTo(validRoomOffer)));\n }", "@PostMapping(\"/rooms\")\n public Room createRoom (\n @Valid\n @RequestBody Room room){\n return roomRepository.save(room);\n }", "@Test\r\n\tpublic final void testAddRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\t// check if added successfully\r\n\t\tassertTrue(success);\r\n\t\t// need to copy the id from database since it autoincrements\r\n\t\tRoom actual = roomServices.getRoomByName(expected2.getName());\r\n\t\texpected2.setId(actual.getId());\r\n\t\t// check content of data\r\n\t\tassertEquals(expected2, actual);\r\n\t\t// delete room on exit\r\n\t\troomServices.deleteRoom(actual);\r\n\t}", "public Room createRoom(Room room);", "@PostMapping(\"/chat-rooms\")\n public ResponseEntity<ChatRoom> createChatRoom(@RequestBody ChatRoom chatRoom) throws URISyntaxException {\n log.debug(\"REST request to save ChatRoom : {}\", chatRoom);\n if (chatRoom.getId() != null) {\n throw new BadRequestAlertException(\"A new chatRoom cannot already have an ID\", ENTITY_NAME, \"idexists\");\n }\n ChatRoom result = chatRoomRepository.save(chatRoom);\n return ResponseEntity.created(new URI(\"/api/chat-rooms/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "@Test\n public void testInvalidInput() {\n LocalUserManager ua = new LocalUserManager();\n try {\n ua.createUser(\"gburdell1\", \"buzz\", \"[email protected]\", \"George\", \"Burdell\", \"SUPERHUMAN\");\n } catch (Exception e) {\n Assert.assertEquals(0, ua.getUsers().size());\n return;\n }\n Assert.fail();\n }", "@PostMapping(\"/rooms/create\")\n public ResponseEntity create(HttpServletRequest req, HttpServletResponse res,\n @RequestBody String roomDetails) throws JsonProcessingException {\n roomService.create(roomDetails);\n return ResponseEntity.status(200).build();\n }", "@Test(expected = Exception.class)\n public void shouldThrowAnExceptionIfTheOccupanyIsNotIn48Hours()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any()))\n\t\t.thenReturn(false);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testSaveRoomNotLoggedNegative() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.unauthenticate();\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t}", "@Test\n public void createUnassignedGame() throws Exception {\n final GameResource resource = TestUtils.newGameResource();\n resource.setStartsAt(\"2014-03-21T16:00:00.000\");\n\n mockMvc.perform(post(BASE_REQUEST_URL).with(superadmin)\n .header(AUTH_HEADER_NAME, createTokenForUser())\n .contentType(contentType)\n .content(TestUtils.convertObjectToJson(resource)))\n .andExpect(status().isCreated())\n .andExpect(content().contentType(contentType))\n .andExpect(jsonPath(\"$.site\", is(resource.getSite())))\n .andExpect(jsonPath(\"$.startsAt\", is(resource.getStartsAt())));\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomBadResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test(expectedExceptions = DataAccessLayerException.class)\n void createThrowsTest() {\n Mockito.doThrow(IllegalArgumentException.class).when(reservationDao).create(reservation2);\n reservationService.create(reservation2);\n }", "@Override\n public Room create(RoomResponseDTO roomResponseDTO) {\n return roomRepository.save(new Room(\n roomResponseDTO.getClassroomNumber()\n ));\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n void createNullTest() {\n reservationService.create(null);\n }", "@Test\n public void create_NotAnAssignment_ShouldReturn400Error() throws Exception {\n final String invalidRequestJSON = \"{\\\"not\\\": \\\"an assignment\\\"}\";\n\n // When we post an invalid request\n // then we get a Bad Request error\n mockMvc.perform(post(ENDPOINT)\n .contentType(MediaType.APPLICATION_JSON)\n .content(invalidRequestJSON))\n .andExpect(status().isBadRequest());\n }", "public void makeTestRoom() {\r\n\t\tthis.boardData = new BoardData();\r\n\t\tthis.boardData.loadLevelOne();\r\n\r\n\t\tif (boardData.getAllRooms().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room list is empty\");\r\n\t\t} else if (boardData.getAllRooms().get(0).getRoomInventory().isEmpty()) {\r\n\t\t\tSystem.out.println(\"room's inventory is empty\");\r\n\t\t}\r\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotOwnerNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player2\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotLoggedNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t}", "@Test(expectedExceptions = DataAccessLayerException.class)\n void createThrows2Test() {\n Mockito.doThrow(IllegalArgumentException.class).when(reservationDao).create(reservation2);\n reservationService.create(reservation2);\n }", "private boolean checkRoomValid(String room) {\n\treturn true;\r\n}", "@Test\n void createInvalidSystemLoinc() throws IOException {\n Exception exception = executeMappingException(\"create-history-of-travel-invalid-system-loinc.json\");\n assertEquals(\"The system is not correct. It should be 'http://loinc.org', but it was 'http://snomed.info/sct'.\", exception.getMessage());\n }", "@PostMapping(path = \"/rooms\")\n public ResponseEntity<Room> generateNewRoom() {\n Room newRoom = roomService.generateNewRoom();\n return new ResponseEntity<>(newRoom, HttpStatus.CREATED);\n }", "public void createFailure() {\n\t\tgetController().changeFree(true);\t\t\n\t\tdisplayAdvertisement(\"opponent failure\");\n\t\tvalidate();\n\t}", "@Test\n\tpublic void testCreateIncorrectParam() {\n\t\tStickyPolicy sPolicy = PolicyGenerator.buildStickyPolicy();\n\t\tfinal String owner = \"\"+1;\n\t\t\n\t\tResponse response = piiController.createPii(null, null, sPolicy, owner);\n\t\t\n\t\tverifyZeroInteractions(mPiiService);\n\t\tverifyZeroInteractions(mPuidDao);\n\t\tassertEquals(400, response.getStatus());\n\t\t\n\t\tObject entity = response.getEntity();\n\t\tassertNull(entity);\n\t}", "@Test\n void createInvalidCodeLoinc() throws IOException {\n Exception exception = executeMappingException(\"create-history-of-travel-invalid-code.json\");\n assertEquals(\"Expected loinc-code for history of travel, but got 'http://loinc.org:94653-9' instead\", exception.getMessage());\n }", "@Test\r\n\tpublic final void testDeleteRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\tassertTrue(success);\r\n\t\t// get room (id) due to autoincrement\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\t// remove room (thru id)+verify\r\n\t\tsuccess = roomServices.deleteRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// verify thru id search, verify null result\r\n\t\tRoom actual = roomServices.getRoomById(copy.getId());\r\n\t\tassertNull(actual);\r\n\t}", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "@PostMapping(\"/createNewGameRoom\")\n @ResponseStatus(HttpStatus.CREATED)\n public Game generateNewGameRoom() {\n String entrycode = service.generateEntryCode();\n currentGame.setEntrycode(entrycode);\n currentGame = gameDao.add(currentGame);\n return currentGame;\n }", "@Test(expected = Exception.class)\n public void shouldNotDeleteTheRoomIfTheIndexIsNotFoundInTheDatabaseAndThorwAnException()\n\t throws Exception {\n\n\tfinal DeleteRoomCommand command = new DeleteRoomCommand(validRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\tdoThrow(new RecordNotFoundException(\"Test\")).when(dao).delete(anyInt(),\n\t\tanyLong());\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\n\troomOfferService.deleteRoomOffer(command);\n\n\tverify(dao).lock(anyInt());\n\tverify(dao).unlock(anyInt(), anyLong());\n\tverify(dao).delete(eq(validRoomOffer.getIndex()), anyLong());\n }", "public void testNewEntity_Boom() throws DataBaseNotReadyException {\n // Verify that our test database is set-up as expected.\n // Access test-person , test-event and test-job.\n // Verify that such items exist in the database\n // and that the test-person has yet no allocations.\n Person p = Manager.getPersonCollection().findEntity(3);\n assertNotNull(\"Bad test data?\", p);\n Event e = Manager.getEventCollection().findEntity(4);\n assertNotNull(\"Bad test data?\", e);\n Job j1 = Manager.getJobCollection().findEntity(1);\n assertNotNull(\"Bad test data?\", j1);\n Job j2 = Manager.getJobCollection().findEntity(2);\n assertNotNull(\"Bad test data?\", j2);\n\n Allocation testItem1 = allocationCollection.newEntity(p, e, j1, \"USER\");\n\n // Here is the statement that should throw the exception:\n System.out.println(\"### testNewEntity_Boom() Exception is expected!\");\n Allocation testItem2 = allocationCollection.newEntity(p, e, j2, \"USER\");\n\n }", "@Test\n public void createUser() {\n Response response = regressionClient.createUser();\n dbAssist.responseValidation(response);\n }", "@Override\n public void onFailure(int code, String msg) {\n Log.d(\"haha\", \"创建数据失败:\" + msg);\n }", "@Test(expected = UsernameNotFoundException.class)\n public void createNewComputerBuildFailure() {\n ComputerBuild computerBuild = createComputerBuild(SAMPLE_BUDGET_COMPUTER_BUILD_NAME, SAMPLE_GAMING_COMPUTER_BUILD_DESCRIPTION);\n computerBuildService.createNewComputerBuild(computerBuild);\n }", "@Test\n\tpublic void testDeleteRoomPositive() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test(expected = BookingNotAllowedException.class)\n\tpublic void testBookNotAllowed() throws Exception {\n\t\tdataHelper.createPersistedReservation(USER_ID, new ArrayList<String>(), validStartDate, validEndDate);\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "@Test\n final void testCreateDeviceAlreadyExists() {\n when(deviceDao.findDevice(DeviceFixture.SERIAL_NUMBER)).thenReturn(Optional.of(deviceDTO));\n\n assertThrows(\n ExceptionType.DeviceAlreadyExistsException.class,\n () -> deviceController.createDevice(createDeviceRequest));\n }", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative2() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tauthenticate(\"admin\");\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\r\n\t\tunauthenticate();\r\n\t}", "public void createRoom() {\n int hp = LabyrinthFactory.HP_PLAYER;\n if (hero != null) hp = hero.getHp();\n try {\n labyrinth = labyrinthLoader.createLabyrinth(level, room);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try {\n characterLoader.createCharacter(level, room);\n hero = characterLoader.getPlayer();\n if (room > 1) hero.setHp(hp);\n createMonsters();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@Test \n public void bookHotelTestError1() throws DatatypeConfigurationException, BookHotelFault { \n BookHotelInputType input = CreateBookHotelInputType(\"Hello you\", \"Tick Joachim\", \"50408824\", 2, 11);\n try {\n assertTrue(bookHotel(input));\n } catch (BookHotelFault e) {\n assertEquals(\"The booking number you provided was not linked to any hotel\", e.getMessage());\n } \n }", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative1() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tauthenticate(\"brother5\");\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\r\n\t\tunauthenticate();\r\n\t}", "@Test(expected = IllegalArgumentException.class)\r\n public void creacionIncorrecta() throws IllegalArgumentException {\r\n P = new Partido(\"Camp Nou\",\"28-04-2010\");\r\n }", "@Test\n public void shouldBookAnValidRoomAndPersistTheChanges() throws Exception {\n\n\tfinal String customerId = \"1234\";\n\tfinal UrlyBirdRoomOffer expectedRoomOffer = new UrlyBirdRoomOffer(\n\t\tvalidRoomOffer.getHotel(), validRoomOffer.getCity(),\n\t\tvalidRoomOffer.getRoomSize(), false, validRoomOffer.getPrice(),\n\t\tvalidRoomOffer.getBookableDate(), customerId,\n\t\tvalidRoomOffer.getIndex());\n\tfinal BookRoomCommand bookRoomCommand = new BookRoomCommand(\n\t\tvalidRoomOffer, customerId);\n\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\twhen(builder.copyRoomOfferWithNewCustomer(validRoomOffer, customerId))\n\t\t.thenReturn(expectedRoomOffer);\n\twhen(dao.read(bookRoomCommand.getRoomToBook().getIndex())).thenReturn(\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\tfinal UrlyBirdRoomOffer bookedRoom = roomOfferService\n\t\t.bookRoomOffer(bookRoomCommand);\n\n\tverify(isRoomBookable).isSatisfiedBy(validRoomOffer);\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).read(validRoomOffer.getIndex());\n\tverify(dao).update(eq(expectedRoomOffer), anyLong());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tassertThat(bookedRoom, is(equalTo(expectedRoomOffer)));\n }", "@Test\n\tpublic void testSaveRoomPositive() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player1\"); //The player knows the Shelter\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n\tpublic void testBook() throws Exception {\n\t\tString createdReservationID = bookingManagement.book(USER_ID, Arrays.asList(room1.getId()),\n\t\t\t\tvalidStartDate, validEndDate);\n\t\t// a reservation must be returned\n\t\tassertNotNull(\"Reservation id is null\", createdReservationID);\n\t\tassertFalse(\"Reservation id is emtpy\", createdReservationID.isEmpty());\n\t\t// check if returned reservation is correct\n\t\tReservation createdReservation = bookingManagement.getReservation(createdReservationID);\n\t\tassertNotNull(\"Reservation of returned id was not found\", createdReservation);\n\n\t\tassertEquals(USER_ID, createdReservation.getBookingUserId());\n\n\t\tassertEquals(1, createdReservation.getBookedFacilityIds().size());\n\t\tassertTrue(createdReservation.getBookedFacilityIds().contains(room1.getId()));\n\t\tassertEquals(validStartDate, createdReservation.getStartTime());\n\t\tassertEquals(validEndDate, createdReservation.getEndTime());\n\t}", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative3() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tauthenticate(\"viewer\");\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\r\n\t\tunauthenticate();\r\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testSaveRoomNotShelterNegative() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player2\");\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test(expected = IllegalArgumentException.class)\n public void testFailInit() {\n uut=new ChatMessageRequest(\"test\",\"test\",\"test\",MessageTypes.MATCH);\n }", "@Test(expected = InvalidDataAccessResourceUsageException.class)\n\tpublic void testError()\n\t\tthrows IOException\n\t{\n\t\tCqpQuery query = engine.createQuery(\"type\", \"TUEBADZ5\", \"\\\"Drachen\");\n\t\tquery.setContext(1, 1, ContextUnit.SENTENCE);\n\t\tquery.execute();\n\t}", "@Test(expected = FacilityNotFoundException.class)\n\tpublic void testBookFacilityIDDoesNotExist() throws Exception {\n\t\tbookingManagement\n\t\t\t\t.book(USER_ID, Arrays.asList(\"some id that does not exist\"), validStartDate, validEndDate);\n\t}", "@Test(expected = IllegalArgumentException.class)\r\n\tpublic void testCreateAndSaveNegative4() {\r\n\t\tBrotherhood brotherhood;\r\n\r\n\t\tunauthenticate();\r\n\r\n\t\tbrotherhood = brotherhoodService.create();\r\n\r\n\t\tbrotherhood.setName(\"Test\");\r\n\t\tbrotherhood.setFoundationYear(1900);\r\n\t\tbrotherhood.setHistory(\"Test\");\r\n\r\n\t\tbrotherhoodService.save(brotherhood);\r\n\t}", "public ChatRoom createRoom(String room) {\r\n ChatRoom chatRoom = new ChatRoom(serviceAddress.withLocal(room), null, xmppSession, serviceDiscoveryManager, multiUserChatManager);\r\n chatRoom.initialize();\r\n return chatRoom;\r\n }", "@Test\n public void create_EmptyAssignmentName_ShouldReturn400Error() throws Exception {\n final String invalidAssignmentJSON = \"{\\\"name\\\": \\\"\\\"}\";\n\n // When we post an invalid Assignment\n // then we get a Bad Request error\n mockMvc.perform(post(ENDPOINT)\n .contentType(MediaType.APPLICATION_JSON)\n .content(invalidAssignmentJSON))\n .andExpect(status().isBadRequest());\n }", "public void createChatRoom(String name) throws RemoteException {\n\n\t\ttry {\n\t\t\tIChatServer chatStub;\n\t\t\t// make a new chatroom with supplied name\n\t\t\tIChatroom newRoom = new Chatroom(name);\n\t\t\tview.append(\"Make new ChatRoom: \" + newRoom.getName() + \"\\n\");\n\t\t\t// make a new chatserver stub for user in the newchatroom\n\t\t\tIChatServer newChatServer = new ChatServer(user, newRoom);\n\t\t\tview.append(\"Make new ChatServer: <User:\" + newChatServer.getUser().getName() + \", ChatServer: \"\n\t\t\t\t\t+ newChatServer.getChatroom().getName() + \">\\n\");\n\t\t\t//get a chatstub for new chatserver \n\t\t\tchatStub = (IChatServer) UnicastRemoteObject.exportObject(newChatServer, IChatServer.BOUND_PORT);\n\t\t\tregistry.rebind(IChatServer.BOUND_NAME + newRoom.hashCode(), chatStub);\n\t\t\tview.append(\"Make new ChatServer Stub for chatserver.\\n\");\n\t\t\t//add chatstub to newRoom\n\t\t\tnewRoom.addChatServer(chatStub);\n\t\t\tview.append(\"Add new ChatServer Stub to newRoom.\\n\");\n\t\t\t//add newchatroom to the user chatroom lists\n\t\t\tuser.addRoom(newRoom);\n\t\t\tview.append(\"Add new chatroom <\" + newRoom.getName() + \"> to user <\" + user.getName() + \">\\n\");\n\t\t\t//add all chatservers in that room to hashset\n\t\t\tHashSet<IChatServer> proxy = new HashSet<IChatServer>();\n\t\t\tfor (IChatServer item : newChatServer.getChatroom().getChatServers()) {\n\t\t\t\tIChatServer proxyChatServer = new ProxyIChatServer(item);\n\t\t\t\tproxy.add(proxyChatServer);\n\t\t\t}\n\t\t\tIMain2MiniAdpt miniMVCAdpt = view.makeMini(newChatServer, proxy);\n\t\t\tminiMVCAdpts.put(newRoom, miniMVCAdpt);\n\t\t\tcountRoom++;\n\t\t} catch (Exception e) {\n\t\t\tview.append(\"Error creating chatroom!\");\n\t\t}\n\n\t}", "RoomModel createRoomModel(RoomModel roomModel);", "@RequestMapping(method = RequestMethod.POST)\n public ResponseEntity<?> addGameRoom(@RequestBody Game gameRoom) {\n try {\n ls.addGameRoom(gameRoom);\n return new ResponseEntity<>(HttpStatus.CREATED);\n } catch (LacmanPersistenceException ex) {\n Logger.getLogger(LacmanController.class.getName()).log(Level.SEVERE, null, ex);\n return new ResponseEntity<>(ex.getMessage(), HttpStatus.FORBIDDEN);\n }\n }", "@Test\n public void shouldNotCreateANullBook() throws JAXBException {\n Response response = target(\"/books\").request().post(Entity.entity(null, MediaType.APPLICATION_XML));\n assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusInfo().getStatusCode());\n }", "public GenericResponse<Booking> reserveRoom(Booking booking) {\n GenericResponse genericResponse = HotelBookingValidation.validateBookingInfo(logger, hotel, booking);\n if (genericResponse != null) {\n return genericResponse;\n }\n\n logger.info(booking.toString());\n\n if (hotel.getBookings().putIfAbsent(booking.getBookingRoom(), booking.getUser()) == null) {\n return GenericResponseUtils.generateFromSuccessfulData(booking);\n }\n\n logger.info(\"Oops. Please try again.\");\n return GenericResponseUtils.generateFromErrorMessage(\"Oops. Please try again.\");\n }", "Booking createBooking(Booking newBooking) throws Exception;", "@Order(1)\n\t\t@Test\n\t\tpublic void sendMessageInvalidFromAndTo() throws IOException, ParseException {\n\t\t\t boolean response = Requests.createMessageBoolReturn(JSONUtils.createMessageObject(INVALID_USER_ID, INVALID_USER_ID, \"Test message\"));\n\t\t\t assertFalse(response);\n\t\t\t \n\t\t\t \n\t\t}", "@Test\r\n public void testCreateInvalid() throws PAException {\r\n thrown.expect(PAException.class);\r\n thrown.expectMessage(\"Missing Disease/Condition. \");\r\n StudyProtocol studyProtocol = TestSchema.createStudyProtocolObj();\r\n Ii spIi = IiConverter.convertToStudyProtocolIi(studyProtocol.getId());\r\n StudyDiseaseDTO studyDiseaseDTO = new StudyDiseaseDTO();\r\n studyDiseaseDTO.setStudyProtocolIdentifier(spIi);\r\n studyDiseaseDTO.setCtGovXmlIndicator(BlConverter.convertToBl(true));\r\n bean.create(studyDiseaseDTO);\r\n }", "public String createCourse(String message)// throws SQLException\r\n{\t\r\n\tString[] inputString=getCourseParameter(message);\r\n\tint j=0;\r\n\tString reply=\"\";\r\n\tString requestID=inputString[0];\r\n\tboolean room_booked_exception_flag=false;\r\n\tString courseName=inputString[1];\r\n\tSystem.out.println(\"Course Name: \"+courseName);\r\n\tString courseSection=inputString[2];\r\n\tString instructorID=inputString[3];\r\n\tString[] location=getLocationString(inputString[4]);\r\n\ttry{\r\n\tif(location[0]==null){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\r\n\t\treturn reply;\r\n\t\t}\r\n\tString units=inputString[5];\r\n\tString building=location[0];\r\n\tString room=location[1];\r\n\t\r\n\tboolean checkIDFlag=(new InstructorServant()).validateInstructorID(instructorID);\r\n\tif(!checkIDFlag){\r\n\t\t//Exception \r\n\t\treturn requestID+\"\\n\"+Exceptions.malformed_id;\r\n\t}\r\n\t\r\n if((building.equalsIgnoreCase(\"TBA\")) && !room.equalsIgnoreCase(\"TBA\")){\r\n\t\tSystem.out.println(\"Invalid TBA with location:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t}\r\n\tif((!building.equalsIgnoreCase(\"TBA\")) && room.equalsIgnoreCase(\"TBA\")){\r\n\t\tSystem.out.println(\"Invalid TBA with location:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\t\r\n\tif(building.equalsIgnoreCase(\"TBA\") && room.equalsIgnoreCase(\"TBA\"))\r\n\t{\r\n\t\troom_booked_exception_flag=true;\r\n\t}\r\n\t\r\n\t\r\n\t\r\n\t//Exception for course exist\r\n\tint count=Course_DB.getNumberOfCourse(courseName,courseSection);\r\n\tSystem.out.println(\"COUNT :\"+count);\r\n\tif(count!=0)\r\n\t{\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.course_exists);\r\n\t return reply;\r\n\t}\r\n\t//Exception for course unit\r\n\ttry{\r\n\t\tint noOfUnits=Integer.parseInt(inputString[5]);\r\n\tif (noOfUnits<0)\r\n\t{\r\n\t\tSystem.out.println(\"Invalid Units:\");\r\n\t reply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_units);\r\n\t return reply;\r\n\t}\r\n\t}\r\n\tcatch(Exception e){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_units);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\t//System.out.println(\"OFFICE HOURS: __________\"+location[3].substring(4,5)+\"\");\r\n\tif(!location[3].substring(4,5).equalsIgnoreCase(\"-\")){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\tif(location[2].equalsIgnoreCase(\"TBA\") && location[3].equalsIgnoreCase(\"TBA\")){\r\n\t\t\r\n\t\tint error=Course_DB.writeCreateCourse(courseName,courseSection,instructorID,building,room,-1,\"-1\",\"-1\",units);\r\n\t\tif(error!=0){\r\n\t\t\treply=requestID+\"\\n\"+Exceptions.create_exception;\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treply=requestID+\"\\n\"+0;\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n\tint noOfDays=location[2].length();\r\n\tif(noOfDays>7 || noOfDays<1){\r\n\t\t//Exception\r\n\t\tSystem.out.println(\"Exception: No Of days\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t\t\r\n\t}\r\n\tString[][] days=getDays(location[2],noOfDays);\r\n\tif(days[0][0]==null){\r\n\t\t//Exception\r\n\t\tSystem.out.println(\"Days are not proper:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t\t\r\n\t\t}\r\n\tboolean checkOrderOfDays=validateOrderOfDays(days,noOfDays);\r\n\tif(!checkOrderOfDays){\r\n\t\t//Exception\r\n\t\tSystem.out.println(\"Days are not ordered in proper way:\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_location);\r\n\t\treturn reply;\r\n\t\t// Raise Malformed_LOCATION Exception\r\n\t\t//return Exceptions.malformed_hours;\r\n\t}\r\n\tString[] validHours=validateHours(location[3]);\r\n\tString stime=location[3].substring(0,location[3].indexOf(\"-\"));\r\n\tString etime=location[3].substring(location[3].indexOf(\"-\")+1,location[3].length());\r\n\r\n\tif(validHours[0]==null){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\treturn reply;\r\n\t\t}\r\n\r\n\t\r\n\tboolean finalValidation=true;\t\r\n\t//Check for Room_Booked Exception\r\n\tif(!room_booked_exception_flag)\r\n\t{\r\n\t\tCourseServant courseServant=new CourseServant();\r\n\t\tString[][][] officeHours=Course_DB.loadRoomCourseHours(building,(room));\r\n\t\t\r\n\ttry{\r\n\t\tfor(int i=0;i<noOfDays;i++){\r\n\t\tfinalValidation=loadRoomOfficeHour(officeHours,Integer.parseInt(days[i][1]),validHours[0],validHours[1]);\r\n\t\tif(!finalValidation)\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tcatch(Exception e){\r\n\t\tSystem.out.println(\"Exception at room booked\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.room_booked);\r\n\t\treturn reply;\r\n\t\t}\r\n\t}\r\n\t\r\n\tint officeHourExceptionFlag=-1;\r\n\ttry{\r\n\t\tSystem.out.println(\"Office Hours Course Servant:\");\r\n\t\tString[][][] officeHours=Instructor_DB.loadOfficeHour(instructorID);\r\n\t\tInstructorServant instructor=loadOfficeHour(officeHours);\r\n\t\tinstructor.setInstructorID(instructorID);\r\n\t\tfor(int i=0;i<noOfDays;i++){\r\n\t\tofficeHourExceptionFlag=instructor.validateOfficeHourConflict(Integer.parseInt(days[i][1]),validHours[0],validHours[1]);\r\n\t\tif(officeHourExceptionFlag!=-1){break;}\r\n\t}\r\n\t}\r\n\tcatch(Exception e){\r\n\t\tSystem.out.println(\"Office Hours are invalid: 2\"+e);\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.schedule_conflict);\r\n\t\treturn reply;\r\n\t}\r\n\tif(officeHourExceptionFlag!=-1){\r\n\t\tif(officeHourExceptionFlag==0){\r\n\t\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.schedule_conflict);\r\n\t\t\treturn reply;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(!finalValidation){\r\n\t\tSystem.out.println(\"Exception at room booked 2\");\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.room_booked);\r\n\t\treturn reply;\r\n\t\t}\r\n\r\n\tif(!checkMidNightExtension(stime,etime)){\r\n\t\treply=requestID+\"\\n\"+Integer.toString(Exceptions.malformed_hours);\r\n\t\tSystem.out.println(\"I am midnight:\"+reply);\r\n\t\treturn reply;\r\n\t}\r\n\t\r\n\ttry{\r\n\t\t//insert values into AS_COurse also..********************************88\r\n\t\tfor(int i=0;i<noOfDays;i++){\r\n\t\t\tint error=Course_DB.writeCreateCourse(courseName,courseSection,instructorID,building,room,Integer.parseInt(days[i][1]),stime,etime,units);\r\n\t\t\tif(error!=0){\r\n\t\t\t\treply=requestID+\"\\n\"+Exceptions.create_exception;\r\n\t\t\t\treturn reply;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}\r\n\tcatch(Exception e){}\r\n\treply=requestID+\"\\n\"+0+\"\\n\"+0;\r\n\treturn reply;\r\n\t}\r\n\tcatch(Exception e){\r\n\t\treturn requestID+\"\\n\"+Exceptions.malformed_location;\r\n\t}\r\n}", "@Test\n public final void testCreateUserInJSONUserAlreadyExists() {\n \n try {\n \tUserAPI fixture = new UserAPI();\n String input = \"{\\\"userName\\\":\\\"Txuso\\\", \\\"password\\\": \\\"213\\\"}\";\n \tfixture.createUserInJSON(input);\n } catch (WebApplicationException e) {\n \tassertNotNull(Response.Status.NOT_ACCEPTABLE.getStatusCode());\n }\n }", "@Test\r\n\tpublic final void testGetRoomById() {\n\t\tRoom actual = roomServices.getRoomById(expected.getId());\r\n\t\tassertEquals(expected, actual);\r\n\t}", "@Test\n\tpublic void testCreateTicketFail() {\n\t}", "@Test\n public void create_NullAssignmentName_ShouldReturn400Error() throws Exception {\n final String invalidAssignmentJSON = \"{\\\"name\\\": null}\";\n\n // When we post an invalid Assignment\n // then we get a Bad Request error\n mockMvc.perform(post(ENDPOINT)\n .contentType(MediaType.APPLICATION_JSON)\n .content(invalidAssignmentJSON))\n .andExpect(status().isBadRequest());\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testSaveRoomNotOwnShelterNegative() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\t\tsuper.unauthenticate();\n\n\t\tsuper.authenticate(\"Player3\");\n\t\tthis.roomService.save(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n void testFailure_illegalStatus() {\n assertThrows(\n IllegalArgumentException.class,\n () ->\n runCommandForced(\n \"--client=NewRegistrar\",\n \"--registrar_request=true\",\n \"--reason=Test\",\n \"--domain_name=example.tld\",\n \"--apply=clientRenewProhibited\"));\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n public void testCreateSecretGroupNoOptions() throws Throwable {\n // construct the service\n constructClientService();\n\n server.enqueue(new MockResponse());\n\n // Invoke operation with null options model (negative test)\n secretsManagerService.createSecretGroup(null).execute();\n }", "@Test\n\tpublic void testInvalidEmailId() {\n\t\tString emailId = \"InvalidPerson\";\n\t\tClient client = Client.create();\n\t\tWebResource webResource2 = client\n\t\t\t\t.resource(\"http://localhost:8080/MeetingSchedulerProject/meeting/personservice/\"\n\t\t\t\t\t\t+ emailId);\n\t\tClientResponse response2 = webResource2.accept(\n\t\t\t\tMediaType.APPLICATION_JSON).get(ClientResponse.class);\n\n\t\t// not found status code\n\t\tassertEquals(response2.getStatus(), 404);\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test\n public void bookHotelTestError3() throws BookHotelFault, DatatypeConfigurationException{ \n BookHotelInputType input = CreateBookHotelInputType(\"booking_Hotel_1\", \"Tobiasen Inge\", \"50408823\", 9, 10);\n try {\n assertTrue(bookHotel(input));\n } catch (BookHotelFault e) {\n assertEquals(\"The account has not enough money\",e.getMessage());\n } \n }", "public void createRooms()//Method was given\n { \n \n // create the rooms, format is name = new Room(\"description of the situation\"); ex. desc = 'in a small house' would print 'you are in a small house.'\n outside = new Room(\"outside\", \"outside of a small building with a door straight ahead. There is a welcome mat, a mailbox, and a man standing in front of the door.\", false);\n kitchen = new Room(\"kitchen\", \"in what appears to be a kitchen. There is a sink and some counters with an easter egg on top of the counter. There is a locked door straight ahead, and a man standing next to a potted plant. There is also a delicious looking chocolate bar sitting on the counter... how tempting\", true);\n poolRoom = new Room(\"pool room\", \"in a new room that appears much larger than the first room.You see a table with a flashlight, towel, and scissors on it. There is also a large swimming pool with what looks like a snorkel deep in the bottom of the pool. Straight ahead of you stands the same man as before.\", true);\n library = new Room(\"library\", \"facing east in a new, much smaller room than before. There are endless rows of bookshelves filling the room. All of the books have a black cover excpet for two: one red book and one blue book. The man stands in front of you, next to the first row of bookshelves\", true);\n exitRoom = new Room(\"exit\", \"outside of the building again. You have successfully escaped, congratulations! Celebrate with a non-poisonous chocolate bar\",true);\n \n // initialise room exits, goes (north, east, south, west)\n outside.setExits(kitchen, null, null, null);\n kitchen.setExits(poolRoom, null, outside, null);\n poolRoom.setExits(null, library, kitchen, null);\n library.setExits(null, null, exitRoom, poolRoom);\n exitRoom.setExits(null, null, null, null); \n \n currentRoom = outside; // start game outside\n }", "@Test\n void createInvalidSystemSnomed() throws IOException {\n Exception exception = executeMappingException(\"create-history-of-travel-invalid-system-snomed.json\");\n assertEquals(\"The system is not correct. It should be 'http://snomed.info/sct', but it was 'http://loinc.org'.\", exception.getMessage());\n }", "@RequestMapping(value = \"/Reservation/{reservation_reservationId}/room\", method = RequestMethod.POST)\n\t@ResponseBody\n\tpublic Room newReservationRoom(@PathVariable Integer reservation_reservationId, @RequestBody Room room) {\n\t\treservationService.saveReservationRoom(reservation_reservationId, room);\n\t\treturn roomDAO.findRoomByPrimaryKey(room.getRoomId());\n\t}", "public void test1_0Room() throws Exception {\n getReverb(0);\n try {\n short level = mReverb.getRoomLevel();\n level = (short)((level == 0) ? -1000 : 0);\n mReverb.setRoomLevel(level);\n short level2 = mReverb.getRoomLevel();\n assertTrue(\"got incorrect room level\",\n (level2 > (level - MILLIBEL_TOLERANCE)) &&\n (level2 < (level + MILLIBEL_TOLERANCE)));\n\n level = mReverb.getRoomHFLevel();\n level = (short)((level == 0) ? -1000 : 0);\n mReverb.setRoomHFLevel(level);\n level2 = mReverb.getRoomHFLevel();\n assertTrue(\"got incorrect room HF level\",\n (level2 > (level - MILLIBEL_TOLERANCE)) &&\n (level2 < (level + MILLIBEL_TOLERANCE)));\n\n } catch (IllegalArgumentException e) {\n fail(\"Bad parameter value\");\n } catch (UnsupportedOperationException e) {\n fail(\"get parameter() rejected\");\n } catch (IllegalStateException e) {\n fail(\"get parameter() called in wrong state\");\n } finally {\n releaseReverb();\n }\n }", "@Test\n @WithMockUser(username=\"supervisor_admin\",roles={\"PM\",\"ADMIN\"})\n public void shouldBadRequestCreateAssessmentRubricEmptyTitle() throws Exception {\n String rubricTitle = \"\";\n int rubricRank = 4;\n boolean rubricIsEnabled = true;\n\n AssessmentRubric rubricObject = new AssessmentRubric();\n rubricObject.setTitle(rubricTitle);\n rubricObject.setStarting_date_time(LocalDateTime.now());\n rubricObject.setEnd_date_time(LocalDateTime.now());\n rubricObject.setEnabled(rubricIsEnabled);\n rubricObject.setRank(rubricRank);\n\n rubricObject.setRubricType(getMockTestRubricType());\n rubricObject.setLearningProcess(getMockTestLearningProcess());\n\n // Creating process JSON\n byte[] rubricJSON = this.mapper.writeValueAsString(rubricObject).getBytes();\n\n // invoke Create\n MvcResult results = mvc.perform(post(BASE_URL).content(rubricJSON)\n .contentType(MediaType.APPLICATION_JSON)\n .accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isBadRequest())\n .andReturn();\n }", "@Test(expected = Exception.class)\n public void shouldInformTheClientWithAnExceptionIfTheUpdateCausesAnException()\n\t throws Exception {\n\n\tfinal ArrayList<String> newValidValues = Lists.newArrayList(\"Hilton\",\n\t\t\"Hamburg\", \"2\", \"N\", \"12\", \"12.02.2007\", \"\");\n\n\tfinal UpdateRoomCommand command = new UpdateRoomCommand(newValidValues,\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\twhen(builder.createRoomOffer(newValidValues, validRoomOffer.getIndex()))\n\t\t.thenReturn(validRoomOffer);\n\tdoThrow(new RuntimeException()).when(dao).update(eq(validRoomOffer),\n\t\tanyLong());\n\n\troomOfferService.updateRoomOffer(command);\n\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tverify(dao).update(eq(validRoomOffer), anyLong());\n }", "@Test\n public void bookHotelTestError() throws BookHotelFault{\n try {\n assertTrue(bookHotel(null));\n } catch (BookHotelFault e) {\n assertEquals(\"Empty\", e.getMessage());\n } \n }", "@PostMapping(value=\"/insert/hotel\", consumes=MediaType.APPLICATION_JSON_VALUE)\r\n\tpublic ResponseClient insertNewRoom(@RequestBody Hotel hotel){\r\n\t\thotelSer.save(hotel);\r\n\t\tResponseClient res = new ResponseClient();\r\n\t\tres.setResponse(\"successfull hotel_id: \");\r\n\t\treturn res;\r\n\t}", "public Result createRoom() {\n\n DynamicForm dynamicForm = Form.form().bindFromRequest();\n String roomType = dynamicForm.get(\"roomType\");\n Double price = Double.parseDouble(dynamicForm.get(\"price\"));\n int bedCount = Integer.parseInt(dynamicForm.get(\"beds\"));\n String wifi = dynamicForm.get(\"wifi\");\n String smoking = dynamicForm.get(\"smoking\");\n\n RoomType roomTypeObj = new RoomType(roomType, price, bedCount, wifi, smoking);\n\n if (dynamicForm.get(\"AddRoomType\") != null) {\n\n Ebean.save(roomTypeObj);\n String message = \"New Room type is created Successfully\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n } else{\n\n String message = \"Failed to create a new Room type\";\n\n return ok(views.html.RoomTypeUpdateSuccess.render(message));\n\n }\n\n\n\n }", "@Test\n public void testFailureWithoutObjectId() throws URISyntaxException, IOException {\n testCantView(adminLogin, \"\", 400);\n }", "@Test(expected=Exception.class)\n\tpublic void testPostNewElementWithUserBadPermission() throws Exception{\n\n\t\t\t\tMap<String, Object> details = new HashMap<>();\n\t\t\t\tdetails.put(\"val1\", \"20\");\n\t\t\t\tdetails.put(\"val2\", 20.0);\n\n\t\t\t\tElementBoundary newElement = new ElementBoundary();\n\t\t\t\tnewElement.setKey(new Key(\"1\", \"Smartspace\"));\n\t\t\t\tnewElement.setElementType(\"Type\");\n\t\t\t\tnewElement.setName(\"Name\");\n\t\t\t\tnewElement.setElementProperties(details);\n\t\t\t\tnewElement.setExpired(false);\n\t\t\t\tnewElement.setCreated(new Date());\n\t\t\t\tnewElement.setCreator(new UserForBoundary(this.userEntityPlayer.getUserEmail(), \"bla\"));\n\t\t\t\tnewElement.setLatlng(new LocationForBoundary(31.11, 77.11));\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\tElementBoundary[] elements = { newElement };\n\t\t\t\n\t\t\t\tthis.restTemplate.postForObject(\n\t\t\t\t\t\tthis.baseUrl, \n\t\t\t\t\t\telements, \n\t\t\t\t\t\tElementBoundary[].class, \n\t\t\t\t\t\tthis.userEntityPlayer.getUserSmartspace(),\n\t\t\t\t\t\tthis.userEntityPlayer.getUserEmail());\n\t\t\n\t\t// THEN the test end with exception\n\t}", "@Override\r\n\tpublic void testInvalidId() throws Exception {\n\t\tif (JavastravaApplicationConfig.STRAVA_ALLOWS_CHALLENGES_ENDPOINT) {\r\n\t\t\tsuper.testInvalidId();\r\n\t\t}\r\n\t}", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testBookWithEmptyUserID() throws Exception {\n\t\tbookingManagement.book(\"\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public static Room newRoom(int random){\n String nameRoom = \"\";\n int monsterAmount = 0;\n\t\tMonster monster;\n MonsterFactory monsterFac = new MonsterFactory();\n\t\tmonster= monsterFac.buildMonster((int)(Math.random() * 3) + 1);\n boolean createHealingPot = false;\n boolean createPitRoom = false;\n boolean createPillar = false;\n boolean createEntrance = false;\n boolean createExit = false;\n boolean createVisionPot = false;\n\n switch (random){\n case 1:\n \tnameRoom = \"The Entrance room\";\n \tmonsterAmount = 0;\n createEntrance = true;\n break;\n\n case 2:\n \tnameRoom = \"The Exit room\";\n \tmonsterAmount = 0;\n createExit = true;\n break;\n\n case 3:\n \tnameRoom = \"The room\";\n \tmonsterAmount = 1; //THIS ROOM WILL HAVE 1 MONSTER\n break;\n \n case 4:\n \tnameRoom = \"The Healing Potion room\";\n \tmonsterAmount=(int)(Math.random() * 1) + 0;\n createHealingPot = true;\n break;\n \n case 5:\n \tnameRoom = \"The Pit room\";\n \tmonsterAmount = 0;\n createPitRoom = true;\n break;\n\n case 6:\n \tnameRoom = \"The Pillar room\";\n \tmonsterAmount=(int)(Math.random() * 1) + 0;\n \tcreatePillar = true;\n break;\n \n case 7:\n \tnameRoom = \"The Vision Potion room\";\n \tmonsterAmount=0;\n createVisionPot=true;\n break;\n }\n \n if(monsterAmount <= 0 ) \n return new Room(nameRoom,createHealingPot, createPitRoom, createEntrance, createExit, createPillar, monsterAmount,createVisionPot);\n else\n return new Room(nameRoom,createHealingPot, createPitRoom, createEntrance, createExit, createPillar, monster, monsterAmount,createVisionPot);\n\n }", "@Test\n public void shouldUpdateTheSpezifiedValidRoomAndPersistTheChanges()\n\t throws Exception {\n\n\tfinal ArrayList<String> newValidValues = Lists.newArrayList(\"Hilton\",\n\t\t\"Hamburg\", \"2\", \"N\", \"12\", \"12.02.2007\", \"\");\n\n\tfinal UpdateRoomCommand command = new UpdateRoomCommand(newValidValues,\n\t\tvalidRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\twhen(builder.createRoomOffer(newValidValues, validRoomOffer.getIndex()))\n\t\t.thenReturn(validRoomOffer);\n\n\tfinal UrlyBirdRoomOffer updatedRoomOffer = roomOfferService\n\t\t.updateRoomOffer(command);\n\n\tverify(dao).lock(validRoomOffer.getIndex());\n\tverify(dao).unlock(eq(validRoomOffer.getIndex()), anyLong());\n\tverify(dao).update(eq(validRoomOffer), anyLong());\n\tassertThat(updatedRoomOffer, is(equalTo(validRoomOffer)));\n }", "@Test(expected = SystemObjectIdException.class)\n public void shouldThrowExceptionIfFailToIdentifyDevice() throws IOException {\n\n expect(configuration.createPDU(PDU.GET)).andReturn(new PDU());\n\n expect(snmpInterface.send(isA(PDU.class), same(target))).andReturn(createErrorResponseEvent());\n replayAll();\n\n try {\n session.identifyDevice();\n assert false : \"Should not reach\";\n } finally {\n verifyAll();\n }\n }", "@Test\n final void testCreateDevice() {\n when(deviceDao.save(user, deviceDTO)).thenReturn(deviceDTO);\n when(request.getRemoteAddr()).thenReturn(DeviceFixture.PUBLIC_IP_ADDRESS);\n when(deviceDao.createDevice(user, createDeviceRequest, DeviceFixture.PUBLIC_IP_ADDRESS))\n .thenReturn(deviceDTO);\n when(deviceMapper.toModel(deviceDTO)).thenReturn(deviceModel);\n\n ResponseEntity<DeviceModel> response = deviceController.createDevice(createDeviceRequest);\n\n assertEquals(200, response.getStatusCodeValue());\n assertNotNull(response.getBody());\n DeviceModel device = response.getBody();\n assertEquals(deviceModel, device);\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n public void testCreateSecretNoOptions() throws Throwable {\n // construct the service\n constructClientService();\n\n server.enqueue(new MockResponse());\n\n // Invoke operation with null options model (negative test)\n secretsManagerService.createSecret(null).execute();\n }", "public void insertReservation(TestDto testDto) throws Exception;" ]
[ "0.86370623", "0.76741", "0.7530209", "0.69732565", "0.6760679", "0.6738321", "0.66673696", "0.6529695", "0.6466491", "0.640136", "0.6353072", "0.63016254", "0.630025", "0.62503874", "0.6111346", "0.6103968", "0.60770583", "0.6037773", "0.60232913", "0.60230696", "0.59647685", "0.59506077", "0.5942346", "0.59082747", "0.58655417", "0.5803482", "0.57697666", "0.57510656", "0.57467765", "0.5736605", "0.5732906", "0.5728444", "0.57255286", "0.57230794", "0.569193", "0.56798905", "0.5673613", "0.5671938", "0.5664359", "0.5643934", "0.5637199", "0.56274813", "0.5623612", "0.56066513", "0.5599588", "0.55928963", "0.5590689", "0.5589524", "0.55878586", "0.5580729", "0.55745995", "0.55745786", "0.5560926", "0.5554542", "0.5552696", "0.55431014", "0.55366695", "0.552909", "0.5517323", "0.55019695", "0.5479875", "0.54759145", "0.54720825", "0.5454739", "0.54476506", "0.5439122", "0.54252934", "0.54191256", "0.541363", "0.54068685", "0.54035324", "0.5390016", "0.5385275", "0.5374625", "0.53679043", "0.5353017", "0.5345765", "0.53448635", "0.5336947", "0.5326037", "0.5323468", "0.53178304", "0.5312534", "0.53056425", "0.5301719", "0.52919215", "0.5289321", "0.5284403", "0.52786726", "0.52483886", "0.5237082", "0.52350026", "0.5230632", "0.5219794", "0.52174973", "0.5211504", "0.520785", "0.5207016", "0.52064365", "0.5195644" ]
0.7986307
1
Test destroy room with OK response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testDestroyRoomOkResponse() { // given final DestroyRoomRequest destroyRoomRequest = DestroyRoomRequest.builder().name(TEST_ROOM).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest)) .willReturn(OK_RESPONSE); // when multiUserChatService.destroyRoom(TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void testDeleteRoomPositive() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomBadResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\r\n\tpublic final void testDeleteRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\tassertTrue(success);\r\n\t\t// get room (id) due to autoincrement\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\t// remove room (thru id)+verify\r\n\t\tsuccess = roomServices.deleteRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// verify thru id search, verify null result\r\n\t\tRoom actual = roomServices.getRoomById(copy.getId());\r\n\t\tassertNull(actual);\r\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomOkResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "Boolean deleteRoom(String roomId);", "public void deleteRoom(Room room);", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsOkResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Override\n\tpublic void delete(Room t) {\n\t\t\n\t}", "@Test\n void deleteTest() {\n URI uri = URI.create(endBody + \"/delete\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.delete(uri);\n\n assertEquals(200, response.statusCode());\n }", "@Test\n public void shouldDeleteTheRoomIfTheIndexIsFoundInTheDatabase()\n\t throws Exception {\n\n\tfinal DeleteRoomCommand command = new DeleteRoomCommand(validRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\n\tfinal int deletedRoomIndex = roomOfferService.deleteRoomOffer(command);\n\n\tverify(dao).lock(anyInt());\n\tverify(dao).unlock(anyInt(), anyLong());\n\tverify(dao).delete(eq(validRoomOffer.getIndex()), anyLong());\n\tassertThat(deletedRoomIndex, is(equalTo(deletedRoomIndex)));\n }", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<Response<Void>> deleteRoomWithResponse(String roomId) {\n return deleteRoomWithResponse(roomId, null);\n }", "@Override\n\tpublic void onDeleteRoomDone(RoomEvent arg0) {\n\t\t\n\t}", "@Test\n @DisplayName(\"delete removes anime when successful\")\n void delete_RemovesAnime_WhenSuccessful() {\n Anime savedAnime = animeRepository.save(AnimeCreator.createAnimeToBeSaved());\n devDojoRepository.save(ADMIN);\n \n // using testRestTemplateRoleAdmin to perform request\n ResponseEntity<Void> animeResponseEntity = testRestTemplateRoleAdmin.exchange(\n \"/animes/admin/{id}\",\n HttpMethod.DELETE,\n null,\n Void.class,\n savedAnime.getId()\n );\n\n Assertions.assertThat(animeResponseEntity).isNotNull();\n \n Assertions.assertThat(animeResponseEntity.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotOwnerNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player2\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomBadResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomOkResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test\n final void testDeleteDevice() {\n when(deviceDao.deleteDevice(user, DeviceFixture.SERIAL_NUMBER)).thenReturn(Long.valueOf(1));\n ResponseEntity<String> response = deviceController.deleteDevice(DeviceFixture.SERIAL_NUMBER);\n assertEquals(200, response.getStatusCodeValue());\n assertEquals(\"Device with serial number 1 deleted\", response.getBody());\n }", "public void test_03() {\n\n\t\tResponse reponse = given().\n\t\t\t\twhen().\n\t\t\t\tdelete(\"http://localhost:3000/posts/_3cYk0W\");\n\n\t\tSystem.out.println(\"updated response data \"+ reponse.asString());\t\t\n\t}", "public void deleteChatRoom(ChatRoom cr);", "@Test\n public void delete() {\n System.out.println(\"\\n--- delete Singer by id=2 ---\");\n\n restTemplate.delete(\"http://localhost:9082/restful-ws/singer/{id}\", 2);\n\n printAllSingers();\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotLoggedNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t}", "public void deleteMessageTest(){\n\t\tint messageId = 102;\n\t\tgiven()\n\t\t\t.pathParam(\"messageId\", messageId)\n\t\t.when()\n\t\t\t.delete(\"/message/{messageId}\")\n\t\t.then()\n\t\t\t.statusCode(200)\n\t\t\t.body(\"message\", is(\"Message Deleted \"+messageId));\n\t}", "@Test\n\tpublic void test_delete_user_success(){\n template.delete(REST_SERVICE_URI + \"/\" + getLastUser().getId() + ACCESS_TOKEN + token);\n }", "private void deleteRoomClicked() {\n postRequestDelete();\n sessionManager.removeRoom(sessionManager.getRoom(), sessionManager.getID());\n sessionManager.leaveRoom();\n }", "@Test\n public void testDestroy_Integer() {\n System.out.println(\"destroy\");\n Integer id = null;\n Resource.destroy(id);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Test\n public void deleteId() throws Exception {\n Role role = create(new Role(\"roleName\"));\n\n //Attempt to remove from the database with delete request\n try {\n mvc.perform(MockMvcRequestBuilders.delete(\"/auth/roles/{id}\", UUIDUtil.UUIDToNumberString(role.getUuid()))\n .header(\"Authorization\", authPair[0])\n .header(\"Function\", authPair[1])\n )\n .andExpect(status().isOk());\n } catch (Exception e) {\n remove(role.getUuid());\n throw e;\n }\n\n //Check if successfully removed from database\n try {\n //Remove from database (above get function should have thrown an error if the object was no longer in the database)\n remove(role.getUuid());\n fail(\"DELETE request did not succesfully delete the object from the database\");\n } catch (ObjectNotFoundException e) {\n //Nothing because the object is no longer present in the database which is expected\n }\n }", "@DeleteMapping(\"/chat-rooms/{id}\")\n public ResponseEntity<Void> deleteChatRoom(@PathVariable String id) {\n log.debug(\"REST request to delete ChatRoom : {}\", id);\n chatRoomRepository.deleteById(id);\n return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id)).build();\n }", "@Test\n public void testDelete() {\n System.out.println(\"delete\");\n String guestIDnumber = \"test\";\n BookingController instance = new BookingController();\n boolean expResult = true;\n boolean result = instance.delete(guestIDnumber);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n }", "@Test\n public void hTestDeletePlaylist() {\n given()\n .header(\"X-Authorization\", token)\n .delete(\"/playlists/\" + playlistId)\n .then()\n .statusCode(200);\n }", "private void postRequestDelete() {\n String url = \"http://coms-309-sb-4.misc.iastate.edu:8080/room/delete\";\n url = url + \"/\" + sessionManager.getID();\n\n Map<String, String> params = new HashMap<>();\n params.put(\"RoomId\", sessionManager.getRoomid());\n JSONObject toPost = new JSONObject(params);\n JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST,\n url, toPost,\n new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n Log.d(TAG, response.toString());\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n VolleyLog.d(TAG, \"Error: \" + error.getMessage());\n }\n }) {\n @Override\n public Map<String, String> getHeaders() {\n HashMap<String, String> headers = new HashMap<>();\n headers.put(\"Content-Type\", \"application/json\");\n return headers;\n }\n\n @Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<>();\n params.put(\"Title\", \"ye\");\n params.put(\"Description\", \"if u see this i messed up\");\n return params;\n }\n };\n AppController.getInstance().addToRequestQueue(jsonObjReq, tag_json_obj);\n }", "@Test\n\t@Override\n\tpublic void testDeleteObjectOKJson() throws Exception {\n\t}", "@Test\n\tpublic void deleteBook() {\n\t\tRestAssured.baseURI = \"http://216.10.245.166\";\n\t\t given().log().all().queryParam(\"ID\", \"321wergt\")\n\t\t\t\t.header(\"Content-Type\", \"application/json\").when()\n\t\t\t\t.delete(\"/Library/DeleteBook.php\").then().log().all()\n\t\t\t\t.assertThat().statusCode(200);\n\n\t\n\t /*JsonPath js = new JsonPath(response); \n\t String id = js.get(\"ID\");\n\t System.out.println(id);*/\n\t \n\t }", "void deleteRoom(int id) throws DataAccessException;", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomBadResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n @DisplayName(\"Testataan tilausten poisto tietokannasta\")\n void deleteReservation() {\n TablesEntity table = new TablesEntity();\n table.setSeats(2);\n tablesDao.createTable(table);\n\n ReservationsEntity reservation = new ReservationsEntity(\"Antero\", \"10073819\", new Date(System.currentTimeMillis()), table.getId(), new Time(1000), new Time(2000));\n reservationsDao.createReservation(reservation);\n\n // Confirm that the reservation is in DB\n ReservationsEntity reservationFromDb = reservationsDao.getReservation(reservation.getId());\n assertEquals(reservation, reservationFromDb);\n\n // Delete reservation and confirm that it's not in the DB\n reservationsDao.deleteReservation(reservation);\n\n reservationFromDb = reservationsDao.getReservation(reservation.getId());\n assertEquals(null, reservationFromDb);\n\n }", "@Test\n void deleteSuccess() {\n carDao.delete(carDao.getById(1));\n assertNull(carDao.getById(1));\n\n //Delete repairs\n GenericDao<Repair> repairDao = new GenericDao(Repair.class);\n Repair repair = repairDao.getById(2);\n assertNull(carDao.getById(2));\n\n //Delete part\n GenericDao<Part> partDao = new GenericDao(Part.class);\n Role part = partDao.getById(2);\n assertNull(partDao.getById(2));\n }", "@Test\n public void delete01(){\n Response responseGet=given().\n spec(spec03).\n when().\n get(\"/198\");\n responseGet.prettyPrint();\n //delete islemi\n Response responseDel =given().\n spec(spec03).\n when().\n delete(\"/198\");\n responseDel.prettyPrint();\n //responseDel yazdirildiginda \"Not Found\" cevabi gelirse status code 404 ile test edilir. Eger bos bir\n // satir donerse Ststus code 200 ile test edilir.\n responseDel.then().assertThat().statusCode(200);\n // Hard assert\n assertTrue(responseDel.getBody().asString().contains(\"\"));\n //softAssertion\n SoftAssert softAssert = new SoftAssert();\n softAssert.assertTrue(responseDel.getBody().asString().contains(\"\"));\n softAssert.assertAll();\n\n\n }", "@Test\n public void testAccountDelete() {\n Response response = webTarget\n .path(\"account/1\")\n .request(APPLICATION_JSON)\n .delete();\n assertThat(response.getStatus(), anyOf(is(200), is(202), is(204)));\n }", "@Override\n\tpublic void onRoomDestroyed(RoomData arg0) {\n\t\t\n\t}", "@Test\n public void testDeleteJobType_request_Ok()\n { \n String successMessage = \"Successfully Deleted!\";\n \n doReturn(true).when(jobTypesService).deleteJobType(anyInt());\n\n try {\n mockMvc.perform(MockMvcRequestBuilders.delete(\"/job_types/delete/{id}\", \"1\")\n .content(asJsonString(successMessage))\n .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isOk())\n .andExpect(content().contentType(\"application/json\"));\n } catch (Exception ex) {\n Logger.getLogger(JobTypesControllerTest.class.getName()).log(Level.SEVERE, null, ex);\n fail();\n }\n }", "@Test public void delete_card_check_status_test() throws ClientProtocolException, IOException\n\t{\t\t\n\t\tSystem.out.println(\"\\n--------------------------------------------------\");\n\t\tSystem.out.println(\"Start test: \" + testName.getMethodName());\n\t\t\n\t\t//Given\n\t\t//Create a card first\n\t\tString idList = testSuite.listId;\n\t\tString due = \"null\";\n\t\tString name = \"Card need to delete\";\n\t\tString desc = \"API test - create this card and need to delete\";\n\t\t\n\t\tString createQuery = String.format(\"idList=%s&due=%s&name=%s&desc=%s&key=%s&token=%s\", \n\t\t\t\t\t\t\t\t\t\tURLEncoder.encode(idList, charset), \n\t\t\t\t\t\t\t\t\t\tURLEncoder.encode(due, charset),\n\t\t\t\t\t\t\t\t\t\tURLEncoder.encode(name, charset), \n\t\t\t\t\t\t\t\t\t\tURLEncoder.encode(desc, charset), \n\t\t\t\t\t\t\t\t\t\tURLEncoder.encode(key, charset), \n\t\t\t\t\t\t\t\t\t\tURLEncoder.encode(token, charset));\n\t\tCloseableHttpClient httpClient = HttpClients.createDefault();\n\t\tHttpPost postRequest = new HttpPost(cardUrl + \"?\" + createQuery);\n\t\tHttpResponse response = httpClient.execute(postRequest);\n\t\tif(response.getStatusLine().getStatusCode() == 200) \t\t\t\t\t\t\t\t//Add test card successfully \n\t\t{\n\t\t\tJsonReader jsonReader = Json.createReader(response.getEntity().getContent());\n\t\t\tJsonObject cardJson = jsonReader.readObject();\n\t\t\tString cardId = cardJson.getString(\"id\");\n\t\t\tjsonReader.close();\n\t\t\tString query = String.format(\"key=%s&token=%s\", \n\t\t\t\t\tURLEncoder.encode(key, charset), \n\t\t\t\t\tURLEncoder.encode(token, charset));\n\t\t\t//When\n\t\t\tHttpDelete deleteRequest = new HttpDelete(cardUrl + cardId + \"?\" + query);\n\t\t\tHttpResponse delResponse = httpClient.execute(deleteRequest);\n\t\t\t//Then\n\t\t\t/*\n\t\t\t * Expect: 200 - Status code\n\t\t\t * */\n\t\t\tassertEquals(delResponse.getStatusLine().getStatusCode(), 200);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfail(\"Adding card is wrong, cannot delete card\");\n\t\t}\n\n\t\t//Tear down\n\t\thttpClient.close();\n\t\t\n\t\tSystem.out.println(\"Finish test: \" + testName.getMethodName());\n\t\tSystem.out.println(\"--------------------------------------------------\\n\");\n\t}", "@Test\n public void delete01() {\n Response responseGet = given().\n spec(spec03).\n when().\n get(\"/3\");\n responseGet.prettyPrint();\n\n Response responseDel = given().\n spec(spec03).\n when().\n delete(\"/3\");\n responseDel.prettyPrint();\n\n\n // responseDel yazdirildiginda not found cevabi gelirse status code 404 ile test edilir.\n // Eger bos bir satir donerse status code 200 ile test edilir.\n\n responseDel.\n then().\n statusCode(200);\n\n\n // hard assert\n\n assertTrue(responseDel.getBody().asString().contains(\" \"));\n\n // soft assertion\n\n SoftAssert softAssert = new SoftAssert();\n softAssert.assertTrue(responseDel.getBody().asString().contains(\" \"));\n softAssert.assertAll();\n }", "@Test (groups = \"create_post\")\n public void LTest_Delete_Post_success(){\n\n System.out.println(\"Delete PostID# \"+ createdPost);\n System.out.println(\"Request to: \" + resourcePath + \"/\" + createdPost);\n\n given()\n .spec(RequestSpecs.generateToken())\n //.body(testPost)\n .when()\n .delete(resourcePath + \"/\" + createdPost)\n .then()\n .body(\"message\", equalTo(\"Post deleted\"))\n .and()\n .statusCode(200)\n .spec(ResponseSpecs.defaultSpec());\n }", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<Void> deleteRoom(String roomId) {\n return deleteRoom(roomId, null);\n }", "@Override\n\tpublic void delete(Room ob) {\n\t\tConnection cn = ConnectionPool.getInstance().getConnection();\n\t\ttry {\n\t\t\tPreparedStatement ps = cn.prepareStatement(\"DELETE FROM room WHERE id_room = ?\");\n\t\t\tps.setInt(1, ob.getIdRoom());\n\n\t\t\tps.execute();\n\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\tConnectionPool.getInstance().closeConnection(cn);\n\t\t}\n\t}", "@Test\n public void iTestDeleteUser() {\n given()\n .header(\"X-Authorization\", token)\n .delete(\"/users\")\n .then()\n .statusCode(200);\n }", "@Test\r\n\tpublic void deleteGame() {\r\n\t\t// DO: JUnit - Populate test inputs for operation: deleteGame \r\n\t\tGame game_1 = new tsw.domain.Game();\r\n\t\tservice.deleteGame(game_1);\r\n\t}", "@Request(id = 8, retryable = false, response = ResponseMessageConst.VOID)\n void destroy(String name);", "@Test\n public void test_checkin_delete() throws OAuthUnauthorizedException {\n Response response1 = getTrakt().checkin().deleteActiveCheckin();\n assertThat(response1.getStatus()).isEqualTo(204);\n }", "@Test\n public void testDestroy_0args() {\n System.out.println(\"destroy\");\n Resource instance = new ResourceImpl();\n instance.destroy();\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsBadResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n public void testUserDelete() {\n Response response = webTarget\n .path(\"user/1\")\n .request(APPLICATION_JSON)\n .delete();\n assertThat(response.getStatus(), anyOf(is(200), is(202), is(204)));\n }", "@Test\n public void testDeleteUser() {\n User testUser = new User();\n testUser.setUserEmail(TEST_EMAIL);\n testUser.setUserPassword(TEST_PASSWORD);\n \n Mockito.doNothing().when(userService).deleteUser((User) Matchers.anyObject());\n \n given().body(testUser).contentType(ContentType.JSON).when()\n .delete(URLPREFIX + \"delete\").then()\n .statusCode(HttpServletResponse.SC_OK)\n .contentType(ContentType.JSON).body(equalTo(\"true\"));\n }", "@Test\n public void deleteTest(){\n given().pathParam(\"id\",1)\n .when().delete(\"/posts/{id}\")\n .then().statusCode(200);\n }", "int deleteByExample(SrHotelRoomInfoExample example);", "@Override\n public void onSuccess() {\n Toast.makeText(context, \"Successfully deleted\", Toast.LENGTH_SHORT).show();\n //realm.close();\n }", "@Override\n public void onSuccess() {\n Toast.makeText(context, \"Successfully deleted\", Toast.LENGTH_SHORT).show();\n //realm.close();\n }", "@Test\r\n\tpublic void deleteTeam() {\r\n\t\t// TODO: JUnit - Populate test inputs for operation: deleteTeam \r\n\t\tTeam team_1 = new wsdm.domain.Team();\r\n\t\tservice.deleteTeam(team_1);\r\n\t}", "@Override\n\tpublic int deleteRoom(int room_id) {\n\t\treturn roomDao.deleteRoom(room_id);\n\t}", "@Test\n void deleteSuccess() {\n dao.delete(dao.getById(2));\n assertNull(dao.getById(2));\n }", "public boolean deleteRoom(int roomId) {\r\n try {\r\n SQL = \"DELETE from ROOMS where ID = \" + roomId + \";\";\r\n stmt.executeUpdate(SQL);\r\n return true;\r\n } catch (SQLException err) {\r\n // Find a way to print out the error or not.\r\n return false;\r\n }\r\n\r\n }", "@org.junit.Test\r\n public void testDelete() {\r\n System.out.println(\"delete\");\r\n String emailid = \"[email protected]\";\r\n ContactDao instance = new ContactDao();\r\n List<ContactResponse> expResult = new ArrayList<ContactResponse>();\r\n ContactResponse c = new ContactResponse(\"Contact Deleted\");\r\n expResult.add(c);\r\n List<ContactResponse> result = instance.delete(emailid);\r\n String s=\"No such contact ID found\";\r\n if(!result.get(0).getMessage().equals(s))\r\n assertEquals(expResult.get(0).getMessage(), result.get(0).getMessage());\r\n // TODO review the generated test code and remove the default call to fail.\r\n }", "@Test\n public void testDelete() throws Exception {\n // pretend the entity was deleted\n doNothing().when(Service).deleteCitation(any(String.class));\n\n // call delete\n ModelAndView mav = Controller.delete(\"\");\n\n // test to see that the correct view is returned\n Assert.assertEquals(\"result\", mav.getViewName());\n\n // test to see that Json is formated properly\n Map<String, Object> map = mav.getModel();\n String result = (String) map.get(\"message\");\n\n Assert.assertEquals(\"{\\\"result\\\":\\\"deleted\\\"}\", result);\n }", "@Test\n public void successful_resign() {\n Player p1 = new Player(\"Player\");\n playerLobby.getGameCenter().newGame(p1, new Player(\"Opp\"));\n\n Map<String, Object> vm = new HashMap<String, Object>();\n vm.put(\"isGameOver\", true);\n vm.put(\"gameOverMessage\", p1.getName() + \" has resigned from the game. You are the winner!\");\n\n when(session.attribute(\"player\")).thenReturn(new Player(\"Player\"));\n\n CuT.handle(request, response);\n assertTrue(playerLobby.getGameCenter().justEnded(p1));\n assertEquals(new Gson().toJson(vm), playerLobby.getGame(p1).getMap().get(\"modeOptionsAsJSON\"));\n\n ResponseMessage message = new ResponseMessage();\n message.setType(ResponseMessage.MessageType.INFO);\n message.setText(\"You can not resign in the state you are in.\");\n }", "@Test\r\n\tpublic void deleteProductDetails() {\r\n\t\tRestAssured.baseURI = \"http://localhost:9000/products\";\r\n\t\tRequestSpecification request = RestAssured.given();\r\n\t\tJSONObject requestParams = new JSONObject();\r\n\t\trequestParams.put(\"name\", \"Almond\");\r\n\t\trequest.header(\"Content-Type\", \"application/json\");\r\n\t\trequest.body(requestParams.toString());\r\n\t\tResponse response = request.delete(\"/7\");\r\n\t\tSystem.out.println(\"DELETE Responce Body ----->\" + response.asString());\r\n\t\tint statusCode = response.getStatusCode();\r\n\t\tAssert.assertEquals(statusCode, 200);\r\n\r\n\t}", "public void testJoinGameResponseProcess() {\r\n\t\t\r\n\t\tString roomNumber = \"1\";\r\n\t\t\r\n\t\tString xmlString = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><response id=\\\"RandomUUID\\\" success=\\\"true\\\">\" + String.format(\"<joinGameResponse gameId=\\\"%s\\\">\" + \"</joinGameResponse></response>\", roomNumber);\r\n\t\t\r\n\t\tSystem.out.println(xmlString);\r\n\t\t\r\n\t\tMessage m = new Message(xmlString);\r\n\t\t\r\n\t\tassertTrue (new JoinGameResponseController(client, model).process(m));\r\n\t\tassertEquals (roomNumber, model.getGame().getRoomID());\r\n\t\t\r\n\t}", "@Test\n void deleteSuccess() {\n dao.delete(dao.getById(3));\n assertNull(dao.getById(3));\n }", "@Test\n public void delete() {\n auctionService.restTemplate = mockRestTemplate;\n auctionService.delete(1);\n verify(mockRestTemplate).delete(testOneUrl);\n }", "public void deleteRequest() {\n assertTrue(true);\n }", "@Test\n public void testDeletePlaylist(){\n Playlist playlist = new Playlist();\n playlist.setId(ID);\n playlist.setGenre(GENRE);\n playlist.setDescription(DESCRIPTION);\n ReturnValue ret = Solution.deletePlaylist(playlist);\n assertEquals(NOT_EXISTS, ret);\n ret = Solution.addPlaylist(playlist);\n assertEquals(OK, ret);\n Playlist retrieved = Solution.getPlaylist(ID);\n assertEquals(playlist, retrieved);\n ret = Solution.deletePlaylist(playlist);\n assertEquals(OK, ret);\n retrieved = Solution.getPlaylist(ID);\n assertEquals(Playlist.badPlaylist(), retrieved);\n }", "@Test\n public void testAuthorizedRemoveGroup() throws IOException {\n testUserId2 = createTestUser();\n grantUserManagementRights(testUserId2);\n\n String groupId = createTestGroup();\n\n Credentials creds = new UsernamePasswordCredentials(testUserId2, \"testPwd\");\n\n String getUrl = String.format(\"%s/system/userManager/group/%s.json\", baseServerUri, groupId);\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_OK, null); //make sure the profile request returns some data\n\n String postUrl = String.format(\"%s/system/userManager/group/%s.delete.html\", baseServerUri, groupId);\n List<NameValuePair> postParams = new ArrayList<>();\n assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_OK, postParams, null);\n\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_NOT_FOUND, null); //make sure the profile request returns some data\n }", "@Test\n\tpublic void testDeleteCorrectParamDeletePb() {\n\t\tfinal String owner = \"1\";\n\t\tfinal Long piiUniqueId = (long) 12345789;\n\t\t\n\t\tPiiDeleteRequest piiRequest = new PiiDeleteRequest();\n\t\tpiiRequest.setOwner(owner);\n\t\tpiiRequest.setPiiUniqueId(piiUniqueId);\n\t\t\n\t\tPiiDeleteResponse piiDeleteResponse = new PiiDeleteResponse();\n\t\tpiiDeleteResponse.setDeleted(false);\n\t\twhen(mPiiService.delete(piiRequest)).thenReturn(piiDeleteResponse);\n\t\t\n\t\tResponse response = piiController.delete(piiRequest);\n\t\t\n\t\tverify(mPiiService).delete(piiRequest);\n\t\tverifyZeroInteractions(mPuidDao);\n\t\tassertEquals(200, response.getStatus());\n\t\t\n\t\tPiiDeleteResponse returnedResponse = (PiiDeleteResponse) response.getEntity();\n\t\tassertFalse(returnedResponse.isDeleted());\n\t}", "@Test\n public void deleteVideogame() throws Exception {\n Mockito.when(userRepository2.findById(1)).thenReturn(Optional.of(user));\n Mockito.when(videogameRepository.findById(1)).thenReturn(Optional.of(vg), Optional.of(vg), Optional.empty());\n mockMvc.perform(\n delete(\"/api/videogame/delete/1\")\n ).andExpect(status().isOk());\n }", "@Test\r\n\tpublic void deleteGameGamestatses() {\r\n\t\t// DO: JUnit - Populate test inputs for operation: deleteGameGamestatses \r\n\t\tInteger game_gameId_2 = 0;\r\n\t\tInteger related_gamestatses_gameStatsId = 0;\r\n\t\t@SuppressWarnings(\"unused\")\r\n\t\tGame response = null;\r\n\t\tresponse = service.deleteGameGamestatses(game_gameId_2, related_gamestatses_gameStatsId);\r\n\t\t// DO: JUnit - Add assertions to test outputs of operation: deleteGameGamestatses\r\n\t}", "@DeleteMapping(path = \"/rooms/{roomId}\")\n public ResponseEntity<?> deleteRoom(@PathVariable String roomId) {\n try {\n Room room = roomService.findRoomById(roomId);\n roomService.deleteRoom(room.getRoomId());\n return new ResponseEntity<>(HttpStatus.OK);\n } catch (RoomNotFoundException e) {\n throw new NotFoundException(e.getMessage());\n }\n }", "@Test\n\tpublic void testDeleteCorrectParamNoDeletePb() {\n\t\tfinal String owner = \"1\";\n\t\tfinal Long piiUniqueId = (long) 12345789;\n\t\t\n\t\tPiiDeleteRequest piiRequest = new PiiDeleteRequest();\n\t\tpiiRequest.setOwner(owner);\n\t\tpiiRequest.setPiiUniqueId(piiUniqueId);\n\t\t\n\t\tPiiDeleteResponse piiDeleteResponse = new PiiDeleteResponse();\n\t\tpiiDeleteResponse.setDeleted(true);\n\t\twhen(mPiiService.delete(piiRequest)).thenReturn(piiDeleteResponse);\n\t\t\n\t\tResponse response = piiController.delete(piiRequest);\n\t\t\n\t\tverify(mPiiService).delete(piiRequest);\n\t\tverifyZeroInteractions(mPuidDao);\n\t\tassertEquals(200, response.getStatus());\n\t\t\n\t\tPiiDeleteResponse returnedResponse = (PiiDeleteResponse) response.getEntity();\n\t\tassertTrue(returnedResponse.isDeleted());\n\t}", "@After\n public void tearDown() throws IOException {\n HttpRequest.Builder builder =\n HttpRequest.builder(HttpMethod.DELETE, config.resolveURL(\"tethering/connections/xyz\"));\n\n HttpResponse response = HttpRequests.execute(builder.build());\n int responseCode = response.getResponseCode();\n Assert.assertTrue(\n responseCode == HttpResponseStatus.OK.code()\n || responseCode == HttpResponseStatus.NOT_FOUND.code());\n }", "@Test\n void deletePet_API_TEST() throws Exception {\n mvc.perform(delete(\"/owners/1/pets/2\").accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isOk());\n verify(petService, times(1)).deletePet(2, 1);\n }", "@Test\n public void deleteContact() {\n }", "@Test\n @WithMockUser(username = \"employee\", roles = {\"EMPLOYEE\"})\n public void deleteTransactionById() throws Exception {\n\n when(transactionService.getTransactionById(99)).thenReturn(transaction);\n this.mvc.perform(delete(\"/transactions/99\").contentType(MediaType.APPLICATION_JSON)\n .accept(MediaType.APPLICATION_JSON))\n .andExpect(status().is(200));\n }", "@Test\n public void testDeleteTravel() throws Exception{\n \n doNothing().when(databaseMock).deleteTravel(anyInt());\n \n mockMVC.perform(delete(\"/user/1/travel/1\")\n .header(\"Authorization\", \"1\"))\n .andExpect(status().isNoContent());\n \n verify(databaseMock, times(1)).getUser(1);\n verify(databaseMock, times(1)).deleteTravel(1);\n verifyNoMoreInteractions(databaseMock);\n }", "@Test(dataProvider = \"DataForDelete\")\n public void testDelete(int id) throws JsonProcessingException {\n\n JSONObject jsonResult = new JSONObject();\n jsonResult.put(\"id\", id);\n\n given()\n .header(\"Content-Type\", \"application/json\")\n .contentType(ContentType.JSON)\n .accept(ContentType.JSON)\n .body(jsonResult)\n .when()\n .delete(\"https://reqres.in/api/users/2\")\n .then()\n .statusCode(204);\n }", "@RequestMapping(value = \"/deleteBook/{id}\", method = RequestMethod.DELETE)\r\n public ResponseEntity<?> delete(@PathVariable(\"id\") long id) throws Exception{\r\n\t ProducerTemplate pt = camelContext.createProducerTemplate();\r\n\t String destination = \"direct:cm.delete\";\r\n\t\tSystem.out.println(\"Send message to \" + destination);\r\n\t\tpt.sendBody(destination, id);\r\n\t\t\r\n return ResponseEntity.ok().body(\"Book has been deleted successfully.\");\r\n }", "@Test\n void deleteSuccess() {\n genericDao.delete(genericDao.getById(3));\n assertNull(genericDao.getById(3));\n }", "@Test\n public void testremovePlayer() {\n session.removePlayer(playerRemco);\n // There already was 1 player, so now there should be 0\n assertEquals(0, session.getPlayers().size());\n }", "void end(String roomId);", "@Override\n public HotelResponseDTO deleteRoom(String hotelId, String roomId) {\n Optional<Hotel> optionalHotel = hotelRepository.findByHotelId(hotelId);\n Hotel hotel = optionalHotel.orElseThrow(() -> {\n logger.error(\"Hotel information not found | hotelId:{}\", hotelId);\n return new BookingServiceException(\"Hotel information not found | hotelId:\" + hotelId);\n });\n if (hotel.isDeleted()) {\n logger.info(\"Hotel is inactive | hotelId:{}\", hotelId);\n throw new BookingServiceException(\"Hotel is inactive | hotelId:\" + hotelId);\n }\n Optional<Room> optionalRoom = roomRepository.findByRoomIdAndHotel(roomId, hotel);\n Room room = optionalRoom.orElseThrow(() -> {\n logger.error(\"Hotel room information not found | hotelId:{},roomId:{}\", hotelId, roomId);\n return new BookingServiceException(\"Hotel room information not found | hotelId:\" + hotelId + \",roomId:\" + roomId);\n });\n if (room.isDeleted()) {\n logger.info(\"Hotel room is inactive | hotelId:{}\", hotelId);\n throw new BookingServiceException(\"Hotel room is inactive | hotelId:\" + hotelId);\n }\n room.setDeleted(true);\n Date lastModifiedDate = new Date();\n room.setLastModifiedDate(lastModifiedDate);\n roomRepository.save(room);\n logger.info(\"Deleted hotel room information successfully | hotelId:{},roomId:{}\", hotelId, roomId);\n return makeHotelResponseDTO(hotel);\n }", "@Test\n public void givenStatus_whenDeleteByEntity_ThenReturnStatus() {\n ThreeEntity entity = new ThreeEntity(1,1,1);\n\n given(threeDao.delete(entity)).willReturn(Status.OK);\n\n StatusEntity status = threeService.delete(entity);\n\n assertEquals(Status.OK.getName(), status.getStatus());\n }", "@Test\n public void testAuthorizedRemoveUser() throws IOException {\n testUserId2 = createTestUser();\n grantUserManagementRights(testUserId2);\n\n String userId = createTestUser();\n\n Credentials creds = new UsernamePasswordCredentials(testUserId2, \"testPwd\");\n\n String getUrl = String.format(\"%s/system/userManager/user/%s.json\", baseServerUri, userId);\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_OK, null); //make sure the profile request returns some data\n\n String postUrl = String.format(\"%s/system/userManager/user/%s.delete.html\", baseServerUri, userId);\n List<NameValuePair> postParams = new ArrayList<>();\n assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_OK, postParams, null);\n\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_NOT_FOUND, null); //make sure the profile request returns some data\n }", "@DELETE\n\tResponse delete();", "@Test\n void deleteMovieById_whenExist() throws Exception {\n // Setup\n when(movieService.deleteMovieById(ArgumentMatchers.any(Long.class))).thenReturn(true);\n\n // Exercise\n mockMvc.perform(delete(baseUrl+ \"/1\").accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isOk())\n .andExpect(jsonPath(\"$\").doesNotExist());\n }", "void onDELETEFinish(String result, int requestCode, boolean isSuccess);", "public void delete(Room room) {\n\t\tSession session = sessionFactory.getCurrentSession();\n\t\tsession.delete(room);\n\t\tsession.flush();\n\t}", "public boolean onDelete(Session s) throws CallbackException;", "public abstract Response delete(Request request, Response response);", "@Override\n\tpublic void checkOutRoom() {\n\t\t\n\t}", "@Test\n public void deleteTest() throws SQLException {\n manager = new TableServizioManager(mockDb);\n manager.delete(1);\n Servizio servizio= manager.retriveById(1);\n assertNull(servizio,\"Should return true if delete Servizio\");\n }", "@Test\n\t@Override\n\tpublic void testDeleteObjectOKXml() throws Exception {\n\t}", "@Test\n public void deleteOrderTest() {\n Long orderId = 10L;\n api.deleteOrder(orderId);\n\n verify(exactly(1), deleteRequestedFor(urlEqualTo(\"/store/order/10\")));\n }" ]
[ "0.7293854", "0.72705877", "0.6966079", "0.69004834", "0.6858897", "0.6783929", "0.6501883", "0.62563545", "0.6065838", "0.6037401", "0.6034127", "0.600715", "0.5993144", "0.5991298", "0.5987442", "0.59838367", "0.5974232", "0.59319663", "0.5902847", "0.58904654", "0.5882242", "0.58779573", "0.58665097", "0.5840048", "0.58390576", "0.58000594", "0.57995933", "0.57968277", "0.57779646", "0.5754788", "0.57416373", "0.57357866", "0.57038116", "0.5699481", "0.56806326", "0.56672317", "0.5663925", "0.56531924", "0.5652741", "0.56509477", "0.564929", "0.5645568", "0.5636834", "0.55853397", "0.5582859", "0.558101", "0.55800176", "0.5572455", "0.55585176", "0.5556835", "0.55557406", "0.5537585", "0.5522316", "0.5512372", "0.5503212", "0.5498504", "0.5497023", "0.5497023", "0.54739916", "0.5467582", "0.54397523", "0.5438522", "0.54356724", "0.54317904", "0.54230136", "0.54209906", "0.5420019", "0.54125655", "0.54107827", "0.53954816", "0.53818876", "0.5377732", "0.537675", "0.5374358", "0.53681165", "0.5360434", "0.5359361", "0.5349536", "0.5343766", "0.5342731", "0.5338673", "0.5328767", "0.53250897", "0.5319903", "0.5316326", "0.53134847", "0.53056884", "0.530239", "0.5301181", "0.5296634", "0.52900314", "0.5284394", "0.5277821", "0.5270462", "0.5267055", "0.5258063", "0.52548003", "0.52543414", "0.5243864", "0.52378035" ]
0.8395029
0
Test destroy room with BAD response.
@Test @SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"}) public void testDestroyRoomBadResponse() { // given final DestroyRoomRequest destroyRoomRequest = DestroyRoomRequest.builder().name(TEST_ROOM).build(); given(clientResponseProvider.sendPostRequest( MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest)) .willReturn(BAD_RESPONSE); // when multiUserChatService.destroyRoom(TEST_ROOM); // then }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testDestroyRoomOkResponse() {\n // given\n final DestroyRoomRequest destroyRoomRequest =\n DestroyRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_DESTROY_ROOM_COMMAND, destroyRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.destroyRoom(TEST_ROOM);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomBadResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotOwnerNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player2\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n\tpublic void testDeleteRoomPositive() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\tsuper.authenticate(\"player1\");\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t\tsuper.unauthenticate();\n\t}", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsBadResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomBadResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteRoomNotLoggedNegative() {\n\t\tRoom room;\n\t\tint roomId;\n\n\t\troomId = super.getEntityId(\"Room1\");\n\t\troom = this.roomService.findOne(roomId);\n\n\t\tthis.roomService.delete(room);\n\n\t}", "@Test\r\n\tpublic final void testDeleteRoom() {\n\t\tboolean success = roomServices.addRoom(expected2);\r\n\t\tassertTrue(success);\r\n\t\t// get room (id) due to autoincrement\r\n\t\tRoom copy = roomServices.getRoomByName(expected2.getName());\r\n\t\t// remove room (thru id)+verify\r\n\t\tsuccess = roomServices.deleteRoom(copy);\r\n\t\tassertTrue(success);\r\n\t\t// verify thru id search, verify null result\r\n\t\tRoom actual = roomServices.getRoomById(copy.getId());\r\n\t\tassertNull(actual);\r\n\t}", "Boolean deleteRoom(String roomId);", "@Test(expected = Exception.class)\n public void shouldNotDeleteTheRoomIfTheIndexIsNotFoundInTheDatabaseAndThorwAnException()\n\t throws Exception {\n\n\tfinal DeleteRoomCommand command = new DeleteRoomCommand(validRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\tdoThrow(new RecordNotFoundException(\"Test\")).when(dao).delete(anyInt(),\n\t\tanyLong());\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\n\troomOfferService.deleteRoomOffer(command);\n\n\tverify(dao).lock(anyInt());\n\tverify(dao).unlock(anyInt(), anyLong());\n\tverify(dao).delete(eq(validRoomOffer.getIndex()), anyLong());\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomOkResponse() {\n // given\n final CreateRoomRequest createRoomRequest = CreateRoomRequest.builder().name(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoom(TEST_ROOM);\n\n // then\n\n }", "public void deleteRoom(Room room);", "void deleteRoom(int id) throws DataAccessException;", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testSubscribeToRoomBadResponse() {\n // given\n final SubscribeRequest subscribeRequest = SubscribeRequest.builder()\n .user(TEST_USER + \"/\" + TEST_USER).nick(TEST_NICK).room(TEST_ROOM + \"@null\").build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_SUBSCRIBE_COMMAND, subscribeRequest))\n .willReturn(BAD_RESPONSE);\n\n // when\n multiUserChatService.subscribeToRoom(TEST_USER, TEST_NICK, TEST_ROOM);\n\n // then\n }", "@Test\n public void shouldDeleteTheRoomIfTheIndexIsFoundInTheDatabase()\n\t throws Exception {\n\n\tfinal DeleteRoomCommand command = new DeleteRoomCommand(validRoomOffer);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, null);\n\n\twhen(dao.read(validRoomOffer.getIndex())).thenReturn(validRoomOffer);\n\n\tfinal int deletedRoomIndex = roomOfferService.deleteRoomOffer(command);\n\n\tverify(dao).lock(anyInt());\n\tverify(dao).unlock(anyInt(), anyLong());\n\tverify(dao).delete(eq(validRoomOffer.getIndex()), anyLong());\n\tassertThat(deletedRoomIndex, is(equalTo(deletedRoomIndex)));\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testUnsubsribeFromRoomOkResponse() {\n // given\n final UnsubscribeRequest unsubscribeRequest =\n UnsubscribeRequest.builder().user(TEST_USER).room(TEST_ROOM).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_UNSUBSCRIBE_COMMAND, unsubscribeRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.unsubsribeFromRoom(TEST_USER, TEST_ROOM);\n\n // then\n }", "@Test\n public void testDestroy_Integer() {\n System.out.println(\"destroy\");\n Integer id = null;\n Resource.destroy(id);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Test()\n public void testDeleteInvalidResource() throws Exception {\n if (!deleteSupported) {\n return;\n }\n\n FHIRResponse response = client.delete(MedicationAdministration.class.getSimpleName(), \"invalid-resource-id-testDeleteInvalidResource\");\n assertNotNull(response);\n assertResponse(response.getResponse(), Response.Status.OK.getStatusCode());\n }", "void leaveRoom(int roomId) throws IOException;", "@Override\n\tpublic void onRoomDestroyed(RoomData arg0) {\n\t\t\n\t}", "@Test(expected = ReservationNotFoundException.class)\n\tpublic void testDeleteReservation() throws ReservationNotFoundException {\n\t\t// TODO: add a second res that sould be let untouched\n\t\tReservation res1 = dataHelper.createPersistedReservation(USER_ID, new ArrayList<String>(), validStartDate,\n\t\t\t\tvalidEndDate);\n\t\tassertNotNull(res1.getId());\n\t\tString id = res1.getId();\n\t\tbookingManagement.deleteReservation(res1.getId());\n\n\t\tres1 = bookingManagement.getReservation(id);\n\t\tassertTrue(res1 == null);\n\t}", "@Test\n final void testDeleteDevice() {\n when(deviceDao.deleteDevice(user, DeviceFixture.SERIAL_NUMBER)).thenReturn(Long.valueOf(1));\n ResponseEntity<String> response = deviceController.deleteDevice(DeviceFixture.SERIAL_NUMBER);\n assertEquals(200, response.getStatusCodeValue());\n assertEquals(\"Device with serial number 1 deleted\", response.getBody());\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n\tpublic void testDeleteIncorrectParam() {\n\n\t\tResponse response = piiController.delete(null);\n\t\t\n\t\tverifyZeroInteractions(mPiiService);\n\t\tverifyZeroInteractions(mPuidDao);\n\t\tassertEquals(400, response.getStatus());\n\t\t\n\t\tObject entity = response.getEntity();\n\t\tassertNull(entity);\n\t}", "@Test(expected = Exception.class)\n public void shouldNotCreateTheRoomIfTheGivenRoomIsInvalidAndThrowAnException()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, null);\n\n\tdoThrow(new ConstraintViolationException(\"\")).when(dao).create(\n\t\tArrays.asList(validRoomOfferValues));\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any())).thenReturn(true);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "public void deleteChatRoom(ChatRoom cr);", "@Override\n\tpublic void delete(Room t) {\n\t\t\n\t}", "@Test\n @DisplayName(\"Testataan tilausten poisto tietokannasta\")\n void deleteReservation() {\n TablesEntity table = new TablesEntity();\n table.setSeats(2);\n tablesDao.createTable(table);\n\n ReservationsEntity reservation = new ReservationsEntity(\"Antero\", \"10073819\", new Date(System.currentTimeMillis()), table.getId(), new Time(1000), new Time(2000));\n reservationsDao.createReservation(reservation);\n\n // Confirm that the reservation is in DB\n ReservationsEntity reservationFromDb = reservationsDao.getReservation(reservation.getId());\n assertEquals(reservation, reservationFromDb);\n\n // Delete reservation and confirm that it's not in the DB\n reservationsDao.deleteReservation(reservation);\n\n reservationFromDb = reservationsDao.getReservation(reservation.getId());\n assertEquals(null, reservationFromDb);\n\n }", "@Test\n @OperateOnDeployment(\"server\")\n public void shouldFailToGetResourceWhenIncorrectScopeForEndpoint() {\n given().header(\"Authorization\", \"Bearer access_token\").expect().statusCode(403).when().delete(\n getBaseTestUrl() + \"/1/category/delete/json/1\");\n }", "@Override\n\tpublic void delete(Room ob) {\n\t\tConnection cn = ConnectionPool.getInstance().getConnection();\n\t\ttry {\n\t\t\tPreparedStatement ps = cn.prepareStatement(\"DELETE FROM room WHERE id_room = ?\");\n\t\t\tps.setInt(1, ob.getIdRoom());\n\n\t\t\tps.execute();\n\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\tConnectionPool.getInstance().closeConnection(cn);\n\t\t}\n\t}", "@Test\n public void deleteId() throws Exception {\n Role role = create(new Role(\"roleName\"));\n\n //Attempt to remove from the database with delete request\n try {\n mvc.perform(MockMvcRequestBuilders.delete(\"/auth/roles/{id}\", UUIDUtil.UUIDToNumberString(role.getUuid()))\n .header(\"Authorization\", authPair[0])\n .header(\"Function\", authPair[1])\n )\n .andExpect(status().isOk());\n } catch (Exception e) {\n remove(role.getUuid());\n throw e;\n }\n\n //Check if successfully removed from database\n try {\n //Remove from database (above get function should have thrown an error if the object was no longer in the database)\n remove(role.getUuid());\n fail(\"DELETE request did not succesfully delete the object from the database\");\n } catch (ObjectNotFoundException e) {\n //Nothing because the object is no longer present in the database which is expected\n }\n }", "@Test\n @SuppressWarnings({\"PMD.JUnitTestsShouldIncludeAssert\"})\n public void testCreateRoomWithOptionsOkResponse() {\n // given\n Map<String, String> options = new HashMap<>();\n final CreateRoomRequest createRoomRequest =\n CreateRoomRequest.builder().name(TEST_ROOM).options(options).build();\n given(clientResponseProvider.sendPostRequest(\n MultiUserChatConstants.MULTI_USER_CHAT_CREATE_ROOM_WITH_OPT_COMMAND, createRoomRequest))\n .willReturn(OK_RESPONSE);\n\n // when\n multiUserChatService.createRoomWithOptions(TEST_ROOM, options);\n\n // then\n }", "@Transactional\n @Test(expected = GenericRequestException.class)\n public void deleteComputerBuildWithIncorrectIdentifier() {\n ComputerBuild computerBuild = createComputerBuild(SAMPLE_GAMING_COMPUTER_BUILD_NAME, SAMPLE_GAMING_COMPUTER_BUILD_DESCRIPTION);\n LoginRequest loginRequest = new LoginRequest(ANOTHER_USER_NAME_TO_CREATE_NEW_USER, USER_PASSWORD);\n\n ComputerBuild newComputerBuild = loginAndCreateBuild(computerBuild, loginRequest,\n SAMPLE_GAMING_COMPUTER_BUILD_NAME, SAMPLE_GAMING_COMPUTER_BUILD_DESCRIPTION);\n\n computerBuildService.deleteComputerBuild(newComputerBuild.getBuildIdentifier() + INVALID_IDENTIFIER_SUFFIX);\n }", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testDeleteReservationWithNullID() throws Exception {\n\t\tbookingManagement.deleteReservation(null);\n\t}", "@Test\n public void deleteByHealthCodeSilentlyFails() {\n dao.deleteUploadsForHealthCode(\"nonexistentHealthCode\");\n }", "@Test\n\tpublic void deleteBook_Nonexistent() {\n\t\tsystem.deleteBook(\"asdfasdfasdfaslkjdfasd\");\n\t}", "@Test\n public void testDeleteTravel_NumberFormatExceptionTravelId() throws Exception {\n \n mockMVC.perform(delete(\"/user/1/travel/a\")\n .header(\"Authorization\", \"1\"))\n .andExpect(status().isInternalServerError());\n \n verifyNoMoreInteractions(databaseMock);\n }", "@Test\n public void givenResourceDoesNotExist_whenDeleteIsTriggered_thenNoExceptions() {\n final long randomId = IDUtil.randomPositiveLong();\n givenEntityExists(randomId);\n\n // When\n getApi().delete(randomId);\n\n // Then\n }", "@Override\n\tpublic void onDeleteRoomDone(RoomEvent arg0) {\n\t\t\n\t}", "private void postRequestDelete() {\n String url = \"http://coms-309-sb-4.misc.iastate.edu:8080/room/delete\";\n url = url + \"/\" + sessionManager.getID();\n\n Map<String, String> params = new HashMap<>();\n params.put(\"RoomId\", sessionManager.getRoomid());\n JSONObject toPost = new JSONObject(params);\n JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST,\n url, toPost,\n new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n Log.d(TAG, response.toString());\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n VolleyLog.d(TAG, \"Error: \" + error.getMessage());\n }\n }) {\n @Override\n public Map<String, String> getHeaders() {\n HashMap<String, String> headers = new HashMap<>();\n headers.put(\"Content-Type\", \"application/json\");\n return headers;\n }\n\n @Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<>();\n params.put(\"Title\", \"ye\");\n params.put(\"Description\", \"if u see this i messed up\");\n return params;\n }\n };\n AppController.getInstance().addToRequestQueue(jsonObjReq, tag_json_obj);\n }", "@Test\n final void testDeleteDeviceNotExisting() {\n assertThrows(\n ExceptionType.DeviceNotFoundException.class,\n () -> deviceController.deleteDevice(\"Not Available device\"));\n }", "@Test\n public void testDeleteException() {\n when(client.receiveFromServer()).thenThrow(new RuntimeException(\"connection timeout\", new SocketException()));\n\n service.delete(1L);\n\n verify(client).sendToServer(\"delete#PlantedPlant\");\n verify(client).sendToServer(1L);\n }", "@DeleteMapping(\"/chat-rooms/{id}\")\n public ResponseEntity<Void> deleteChatRoom(@PathVariable String id) {\n log.debug(\"REST request to delete ChatRoom : {}\", id);\n chatRoomRepository.deleteById(id);\n return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id)).build();\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnAlreadyBookedRoomAndInformTheClientWithTheAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\t\"12\");\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(false);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "@Test\n public void removeWorkflow_400() throws Exception {\n\n // PREPARE THE DATABASE\n // Fill in the workflow db\n addMOToDb(1);\n addMOToDb(2);\n addMOToDb(3);\n\n // PREPARE THE TEST\n String badId = \"bad_id\";\n\n // DO THE TEST\n Response response = callAPI(VERB.DELETE, \"/mo/\" + badId, null);\n\n // CHECK RESULTS\n int status = response.getStatus();\n assertEquals(400, status);\n\n String body = response.readEntity(String.class);\n assertEquals(\"\", body);\n }", "@Override\n public HotelResponseDTO deleteRoom(String hotelId, String roomId) {\n Optional<Hotel> optionalHotel = hotelRepository.findByHotelId(hotelId);\n Hotel hotel = optionalHotel.orElseThrow(() -> {\n logger.error(\"Hotel information not found | hotelId:{}\", hotelId);\n return new BookingServiceException(\"Hotel information not found | hotelId:\" + hotelId);\n });\n if (hotel.isDeleted()) {\n logger.info(\"Hotel is inactive | hotelId:{}\", hotelId);\n throw new BookingServiceException(\"Hotel is inactive | hotelId:\" + hotelId);\n }\n Optional<Room> optionalRoom = roomRepository.findByRoomIdAndHotel(roomId, hotel);\n Room room = optionalRoom.orElseThrow(() -> {\n logger.error(\"Hotel room information not found | hotelId:{},roomId:{}\", hotelId, roomId);\n return new BookingServiceException(\"Hotel room information not found | hotelId:\" + hotelId + \",roomId:\" + roomId);\n });\n if (room.isDeleted()) {\n logger.info(\"Hotel room is inactive | hotelId:{}\", hotelId);\n throw new BookingServiceException(\"Hotel room is inactive | hotelId:\" + hotelId);\n }\n room.setDeleted(true);\n Date lastModifiedDate = new Date();\n room.setLastModifiedDate(lastModifiedDate);\n roomRepository.save(room);\n logger.info(\"Deleted hotel room information successfully | hotelId:{},roomId:{}\", hotelId, roomId);\n return makeHotelResponseDTO(hotel);\n }", "@Test\n public void testDestroy_0args() {\n System.out.println(\"destroy\");\n Resource instance = new ResourceImpl();\n instance.destroy();\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Override\n\tpublic int deleteRoom(int room_id) {\n\t\treturn roomDao.deleteRoom(room_id);\n\t}", "@Test\n\tpublic void deleteUserWhichDoesNotExistInTheSystem() throws Exception {\n\t\tmockMvc.perform(\n\t\t\t\tdelete(\"/secure/user/deleteUser/username2\").accept(\n\t\t\t\t\t\tMediaType.APPLICATION_JSON)).andDo(print())\n\t\t\t\t.andExpect(status().isOk())\n\t\t\t\t.andExpect(content().contentType(\"application/json\"))\n\t\t\t\t.andExpect(jsonPath(\"message\").value(\"Fail\"));\n\n\t}", "@Order(3)\n\t\t@Test\n\t\tpublic void deleteInvalidMessageId() throws IOException, ParseException {\n\t\t\t\n\t\t\tboolean result = Requests.sendDELETEBoolReturn(Requests.MESSAGE_URL, INVALID_MESSAGE_ID);\n\t\t\tassertFalse(result);\n\t\t}", "@Test\n void accountDoesntExist() {\n writableAccountStore = newWritableStoreWithAccounts();\n writableTokenStore = newWritableStoreWithTokens();\n final var txn = newWipeTxn(ACCOUNT_4680, TOKEN_531, 1);\n final var context = mockContext(txn);\n\n assertThatThrownBy(() -> subject.handle(context))\n .isInstanceOf(HandleException.class)\n .has(responseCode(INVALID_ACCOUNT_ID));\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n public void testDeleteSecretNoOptions() throws Throwable {\n // construct the service\n constructClientService();\n\n server.enqueue(new MockResponse());\n\n // Invoke operation with null options model (negative test)\n secretsManagerService.deleteSecret(null).execute();\n }", "public boolean deleteRoom(int roomId) {\r\n try {\r\n SQL = \"DELETE from ROOMS where ID = \" + roomId + \";\";\r\n stmt.executeUpdate(SQL);\r\n return true;\r\n } catch (SQLException err) {\r\n // Find a way to print out the error or not.\r\n return false;\r\n }\r\n\r\n }", "@Test\n\tpublic void testDeleteAdminAccountWithInvalidToken() {\n\t\tassertEquals(2, adminAccountService.getAllAdminAccounts().size());\n\n\t\tString error = null;\n\t\tAdminAccount user = null; \n\t\ttry {\n\t\t\tuser = adminAccountService.deleteAdminAccount(USERNAME2);\n\t\t} catch (InvalidInputException e) {\n\t\t\terror = e.getMessage();\n\t\t}\n\t\tassertNull(user);\n\t\t// check error\n\t\tassertEquals(\"You do not have permission to delete this account.\", error);\n\t}", "public void removeUnavailableRooms(){\n\t}", "@Test(expectedExceptions = IllegalArgumentException.class)\n public void testDeleteSecretGroupNoOptions() throws Throwable {\n // construct the service\n constructClientService();\n\n server.enqueue(new MockResponse());\n\n // Invoke operation with null options model (negative test)\n secretsManagerService.deleteSecretGroup(null).execute();\n }", "public void deleteMessageTest(){\n\t\tint messageId = 102;\n\t\tgiven()\n\t\t\t.pathParam(\"messageId\", messageId)\n\t\t.when()\n\t\t\t.delete(\"/message/{messageId}\")\n\t\t.then()\n\t\t\t.statusCode(200)\n\t\t\t.body(\"message\", is(\"Message Deleted \"+messageId));\n\t}", "@Test\n public void testNotAuthorizedRemoveGroup() throws IOException {\n testUserId2 = createTestUser();\n\n String groupId = createTestGroup();\n\n Credentials creds = new UsernamePasswordCredentials(\"admin\", \"admin\");\n\n String getUrl = String.format(\"%s/system/userManager/group/%s.json\", baseServerUri, groupId);\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_OK, null); //make sure the profile request returns some data\n\n Credentials creds2 = new UsernamePasswordCredentials(testUserId2, \"testPwd\");\n String postUrl = String.format(\"%s/system/userManager/group/%s.delete.html\", baseServerUri, groupId);\n List<NameValuePair> postParams = new ArrayList<>();\n assertAuthenticatedPostStatus(creds2, postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);\n\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_OK, null); //make sure the profile request returns some data\n }", "public void destroy() throws Exception;", "public abstract void destroy() throws Exception;", "@Test\n\t@Override\n\tpublic void testDeleteObjectOKJson() throws Exception {\n\t}", "@Test\n public void testDeleteJobType_request_Internal_Server_Error()\n { \n String failMessage = \"Failure Deleting\";\n \n doReturn(false).when(jobTypesService).deleteJobType(anyInt());\n\n try {\n mockMvc.perform(MockMvcRequestBuilders.delete(\"/job_types/delete/{id}\", \"1\")\n .content(asJsonString(failMessage))\n .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isInternalServerError())\n .andExpect(content().contentType(\"application/json\"));\n } catch (Exception ex) {\n Logger.getLogger(JobTypesControllerTest.class.getName()).log(Level.SEVERE, null, ex);\n fail();\n }\n }", "@Test\n\tpublic void deleteBook() {\n\t\tRestAssured.baseURI = \"http://216.10.245.166\";\n\t\t given().log().all().queryParam(\"ID\", \"321wergt\")\n\t\t\t\t.header(\"Content-Type\", \"application/json\").when()\n\t\t\t\t.delete(\"/Library/DeleteBook.php\").then().log().all()\n\t\t\t\t.assertThat().statusCode(200);\n\n\t\n\t /*JsonPath js = new JsonPath(response); \n\t String id = js.get(\"ID\");\n\t System.out.println(id);*/\n\t \n\t }", "private void deleteRoomClicked() {\n postRequestDelete();\n sessionManager.removeRoom(sessionManager.getRoom(), sessionManager.getID());\n sessionManager.leaveRoom();\n }", "@Test\n\tpublic void withInvalidType() {\n\t\t\n\t\tboolean delete = false;\n\t\ttry {\n\t\t\tdelete = FlowerManager.deleteFlower(\"natural\", \"rose\");\n\t\t} catch (ServiceException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tassertFalse(delete);\n\t}", "@Test\n public void delete01(){\n Response responseGet=given().\n spec(spec03).\n when().\n get(\"/198\");\n responseGet.prettyPrint();\n //delete islemi\n Response responseDel =given().\n spec(spec03).\n when().\n delete(\"/198\");\n responseDel.prettyPrint();\n //responseDel yazdirildiginda \"Not Found\" cevabi gelirse status code 404 ile test edilir. Eger bos bir\n // satir donerse Ststus code 200 ile test edilir.\n responseDel.then().assertThat().statusCode(200);\n // Hard assert\n assertTrue(responseDel.getBody().asString().contains(\"\"));\n //softAssertion\n SoftAssert softAssert = new SoftAssert();\n softAssert.assertTrue(responseDel.getBody().asString().contains(\"\"));\n softAssert.assertAll();\n\n\n }", "@Test\n public void testDeleteTravel_NumberFormatExceptionUserId() throws Exception {\n \n mockMVC.perform(delete(\"/user/a/travel/1\")\n .header(\"Authorization\", \"1\"))\n .andExpect(status().isInternalServerError());\n \n verifyNoMoreInteractions(databaseMock);\n }", "@Test\n void deleteTest() {\n URI uri = URI.create(endBody + \"/delete\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.delete(uri);\n\n assertEquals(200, response.statusCode());\n }", "public void destroy() throws ResourceException {\n if (destroyed)\n return;\n\n logger.fine(\" 9.- (\" + myId + \") ManagedConnection::destroy called\");\n destroyed = true;\n\n testCounter--;\n\n invalidateJavaMailConnections();\n\n try {\n store.closeStore();\n } catch (Exception e) {\n logger.warning(\"ManagedConnectionImpl::destroy threw exception: \"\n + e);\n throw new ResourceException(e.getMessage());\n }\n\n }", "@DeleteMapping(path = \"/rooms/{roomId}\")\n public ResponseEntity<?> deleteRoom(@PathVariable String roomId) {\n try {\n Room room = roomService.findRoomById(roomId);\n roomService.deleteRoom(room.getRoomId());\n return new ResponseEntity<>(HttpStatus.OK);\n } catch (RoomNotFoundException e) {\n throw new NotFoundException(e.getMessage());\n }\n }", "@Test(expectedExceptions = DataAccessLayerException.class)\n void removeThrowsTest() {\n reservation1.setId(24L);\n Mockito.doThrow(IllegalArgumentException.class).when(reservationDao).remove(reservation1);\n reservationService.remove(reservation1);\n }", "@Test(expectedExceptions = IllegalArgumentException.class)\n public void removeNoIdTest() {\n try {\n reservationService.update(reservation2);\n } finally {\n Mockito.verify(reservationDao, Mockito.never()).update(Mockito.any());\n }\n }", "@Test\n public void testNotAuthorizedRemoveUser() throws IOException {\n testUserId2 = createTestUser();\n\n String userId = createTestUser();\n\n Credentials creds = new UsernamePasswordCredentials(\"admin\", \"admin\");\n\n String getUrl = String.format(\"%s/system/userManager/user/%s.json\", baseServerUri, userId);\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_OK, null); //make sure the profile request returns some data\n\n Credentials creds2 = new UsernamePasswordCredentials(testUserId2, \"testPwd\");\n String postUrl = String.format(\"%s/system/userManager/user/%s.delete.html\", baseServerUri, userId);\n List<NameValuePair> postParams = new ArrayList<>();\n assertAuthenticatedPostStatus(creds2, postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);\n\n assertAuthenticatedHttpStatus(creds, getUrl, HttpServletResponse.SC_OK, null); //make sure the profile request returns some data\n }", "boolean deleteMessage(int roomId, long messageId) throws RoomNotFoundException, RoomPermissionException, IOException;", "void end(String roomId);", "@Test(expected = IllegalArgumentException.class)\n\tpublic void testSaveRoomNotLoggedNegative() {\n\t\tRoom room;\n\t\tShelter shelter;\n\t\tRoomDesign roomDesign;\n\t\tPlayer player;\n\t\tint roomDesignId;\n\n\t\tsuper.unauthenticate();\n\n\t\troomDesignId = super.getEntityId(\"RoomDesign1\");\n\n\t\troom = this.roomService.create();\n\t\troomDesign = this.roomDesignService.findOne(roomDesignId);\n\t\tplayer = (Player) this.actorService.findActorByPrincipal();\n\n\t\tshelter = this.shelterService.findShelterByPlayer(player.getId());\n\n\t\troom.setShelter(shelter);\n\t\troom.setRoomDesign(roomDesign);\n\n\t\tthis.roomService.save(room);\n\n\t}", "@Test\n void incorrectDeletePathTest() {\n URI uri = URI.create(endBody + \"/dummy\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.delete(uri);\n\n // it should receive 404\n assertNotEquals(200, response.statusCode());\n assertEquals(404, response.statusCode());\n }", "@Test\n @ExpectedDatabase(value = \"classpath:data.xml\", assertionMode = DatabaseAssertionMode.NON_STRICT)\n public void delete_WithUnauthorisedUser_Test_OK() throws Exception {\n mockMvc.perform(delete(\"/client-journal-resource/clients/{id}\", 1))\n .andExpect(status().is(401));\n }", "int deleteByExample(SrHotelRoomInfoExample example);", "@Test\n\tpublic void testWithInvalidType2() {\n\t\tboolean delete = false;\n\t\ttry {\n\t\t\tdelete = FlowerManager.deleteFlower(\"Artificial\", \"rose\");\n\t\t} catch (ServiceException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tassertFalse(delete);\n\t}", "@Test\n public void testDelete() {\n System.out.println(\"delete\");\n String guestIDnumber = \"test\";\n BookingController instance = new BookingController();\n boolean expResult = true;\n boolean result = instance.delete(guestIDnumber);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n }", "@Transactional\n @Test(expected = GenericRequestException.class)\n public void deleteComputerBuildAsNonOwner() {\n ComputerBuild computerBuild = createComputerBuild(SAMPLE_GAMING_COMPUTER_BUILD_NAME, SAMPLE_GAMING_COMPUTER_BUILD_DESCRIPTION);\n LoginRequest loginRequest = new LoginRequest(ANOTHER_USER_NAME_TO_CREATE_NEW_USER, USER_PASSWORD);\n\n ComputerBuild newComputerBuild = loginAndCreateBuild(computerBuild, loginRequest,\n SAMPLE_GAMING_COMPUTER_BUILD_NAME, SAMPLE_GAMING_COMPUTER_BUILD_DESCRIPTION);\n\n // log in as a different user, this is expected to cause the delete to fail.\n LoginRequest newLoginRequest = new LoginRequest(USER_NAME_ONE, USER_PASSWORD);\n WebUtility.logUserIn(applicationUserAuthenticationService, authenticationManager, jwtTokenProvider, newLoginRequest);\n\n computerBuildService.deleteComputerBuild(newComputerBuild.getBuildIdentifier());\n }", "@Test\n\tpublic void testWithInvalidInput() {\n\t\t\n\t\tboolean delete=false;\n\t\ttry {\n\t\t\tdelete = FlowerManager.deleteFlower(\" \", \"rose\");\n\t\t} catch (ServiceException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tassertFalse(delete);\n\t}", "@Test\n public void delete01() {\n Response responseGet = given().\n spec(spec03).\n when().\n get(\"/3\");\n responseGet.prettyPrint();\n\n Response responseDel = given().\n spec(spec03).\n when().\n delete(\"/3\");\n responseDel.prettyPrint();\n\n\n // responseDel yazdirildiginda not found cevabi gelirse status code 404 ile test edilir.\n // Eger bos bir satir donerse status code 200 ile test edilir.\n\n responseDel.\n then().\n statusCode(200);\n\n\n // hard assert\n\n assertTrue(responseDel.getBody().asString().contains(\" \"));\n\n // soft assertion\n\n SoftAssert softAssert = new SoftAssert();\n softAssert.assertTrue(responseDel.getBody().asString().contains(\" \"));\n softAssert.assertAll();\n }", "@Test(expected = VendingMachineException.class)\r\n\tpublic void testRemoveItem_invalid_code() {\r\n\t\tvendMachine.removeItem(\"F\");\r\n\t}", "@Test\n\tpublic void testDeleteCorrectParamNoDeletePb() {\n\t\tfinal String owner = \"1\";\n\t\tfinal Long piiUniqueId = (long) 12345789;\n\t\t\n\t\tPiiDeleteRequest piiRequest = new PiiDeleteRequest();\n\t\tpiiRequest.setOwner(owner);\n\t\tpiiRequest.setPiiUniqueId(piiUniqueId);\n\t\t\n\t\tPiiDeleteResponse piiDeleteResponse = new PiiDeleteResponse();\n\t\tpiiDeleteResponse.setDeleted(true);\n\t\twhen(mPiiService.delete(piiRequest)).thenReturn(piiDeleteResponse);\n\t\t\n\t\tResponse response = piiController.delete(piiRequest);\n\t\t\n\t\tverify(mPiiService).delete(piiRequest);\n\t\tverifyZeroInteractions(mPuidDao);\n\t\tassertEquals(200, response.getStatus());\n\t\t\n\t\tPiiDeleteResponse returnedResponse = (PiiDeleteResponse) response.getEntity();\n\t\tassertTrue(returnedResponse.isDeleted());\n\t}", "public void test_03() {\n\n\t\tResponse reponse = given().\n\t\t\t\twhen().\n\t\t\t\tdelete(\"http://localhost:3000/posts/_3cYk0W\");\n\n\t\tSystem.out.println(\"updated response data \"+ reponse.asString());\t\t\n\t}", "@Test\n void testDelete_incorrectId() {\n assertThrows(NotFoundException.class, () -> propertyInfoDao.delete(\"randomString\"));\n }", "@Test \n public void testReperimentoNumeroInesistente() {\n Response rDelete = rubrica.path(nome+cognome).path(nome+cognome).request().delete();\n \n // Verifica che la risposta sia 404 Not Found\n assertEquals(Response.Status.NOT_FOUND.getStatusCode(),rDelete.getStatus());\n }", "@After\n public void tearDown() throws IOException {\n HttpRequest.Builder builder =\n HttpRequest.builder(HttpMethod.DELETE, config.resolveURL(\"tethering/connections/xyz\"));\n\n HttpResponse response = HttpRequests.execute(builder.build());\n int responseCode = response.getResponseCode();\n Assert.assertTrue(\n responseCode == HttpResponseStatus.OK.code()\n || responseCode == HttpResponseStatus.NOT_FOUND.code());\n }", "@Test\n public void testDeleteTravel_RecordNotFoundExceptionDeleteTravel() throws Exception {\n doThrow(new RecordNotFoundException()).when(databaseMock).deleteTravel(anyInt());\n \n mockMVC.perform(delete(\"/user/1/travel/1\")\n .header(\"Authorization\", \"1\"))\n .andExpect(status().isNotFound());\n \n verify(databaseMock, times(1)).getUser(anyInt());\n verify(databaseMock, times(1)).deleteTravel(anyInt());\n verifyNoMoreInteractions(databaseMock);\n }", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "@Test\n public void testDeleteUser() {\n User testUser = new User();\n testUser.setUserEmail(TEST_EMAIL);\n testUser.setUserPassword(TEST_PASSWORD);\n \n Mockito.doNothing().when(userService).deleteUser((User) Matchers.anyObject());\n \n given().body(testUser).contentType(ContentType.JSON).when()\n .delete(URLPREFIX + \"delete\").then()\n .statusCode(HttpServletResponse.SC_OK)\n .contentType(ContentType.JSON).body(equalTo(\"true\"));\n }", "@ServiceMethod(returns = ReturnType.SINGLE)\n public Mono<Response<Void>> deleteRoomWithResponse(String roomId) {\n return deleteRoomWithResponse(roomId, null);\n }", "@Test\n @DisplayName(\"delete removes anime when successful\")\n void delete_RemovesAnime_WhenSuccessful() {\n Anime savedAnime = animeRepository.save(AnimeCreator.createAnimeToBeSaved());\n devDojoRepository.save(ADMIN);\n \n // using testRestTemplateRoleAdmin to perform request\n ResponseEntity<Void> animeResponseEntity = testRestTemplateRoleAdmin.exchange(\n \"/animes/admin/{id}\",\n HttpMethod.DELETE,\n null,\n Void.class,\n savedAnime.getId()\n );\n\n Assertions.assertThat(animeResponseEntity).isNotNull();\n \n Assertions.assertThat(animeResponseEntity.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);\n }", "public void destroy() throws BridgeException, BrokerException;", "@Test\n public void hTestDeletePlaylist() {\n given()\n .header(\"X-Authorization\", token)\n .delete(\"/playlists/\" + playlistId)\n .then()\n .statusCode(200);\n }", "@Test\n public void iTestDeleteUser() {\n given()\n .header(\"X-Authorization\", token)\n .delete(\"/users\")\n .then()\n .statusCode(200);\n }", "@Test\n public void testRemoveNegativeNonExistingId() throws Exception{\n Assert.assertFalse(itemDao.delete(\"non existing item\"));\n }", "@Test\n public void delete() {\n System.out.println(\"\\n--- delete Singer by id=2 ---\");\n\n restTemplate.delete(\"http://localhost:9082/restful-ws/singer/{id}\", 2);\n\n printAllSingers();\n }" ]
[ "0.7337161", "0.72573996", "0.6758563", "0.6737609", "0.6671037", "0.6646778", "0.6629924", "0.6585239", "0.6200904", "0.6169643", "0.6158415", "0.6121971", "0.61148363", "0.6025938", "0.5992489", "0.5980116", "0.5871064", "0.5857336", "0.57794917", "0.5735285", "0.5687424", "0.56664336", "0.5643804", "0.560615", "0.558339", "0.55446166", "0.5542211", "0.55338985", "0.5460471", "0.5458586", "0.5440394", "0.54314274", "0.5424218", "0.542145", "0.5408908", "0.5406435", "0.5405431", "0.5400118", "0.539162", "0.53803736", "0.5368811", "0.5363368", "0.5338463", "0.5331225", "0.53242326", "0.53181213", "0.5315795", "0.5314181", "0.5307896", "0.5292098", "0.52912444", "0.52798766", "0.5279284", "0.5267155", "0.5258155", "0.52563155", "0.52527344", "0.5229059", "0.52223074", "0.5222065", "0.5216621", "0.52079237", "0.5205762", "0.5202297", "0.51955354", "0.5188114", "0.51774186", "0.517358", "0.51626897", "0.51592666", "0.51509786", "0.5140503", "0.51316077", "0.5118186", "0.5117645", "0.5116545", "0.5113522", "0.5105739", "0.51023185", "0.5102161", "0.50973636", "0.5094401", "0.5088347", "0.50877964", "0.5087228", "0.5084679", "0.50825304", "0.50756836", "0.5072994", "0.5066543", "0.50639623", "0.5061253", "0.5057217", "0.505598", "0.50501037", "0.50493175", "0.5048809", "0.5046298", "0.50378054", "0.50375783" ]
0.85044307
0
Created by Gyandeep on 13/11/17.
public interface SearchFilterAPIListener { public void getFilterAttributeDataFromNetwork(Map<String, List<AttrValSpinnerModel>> data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "private stendhal() {\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "private void poetries() {\n\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "private void m50366E() {\n }", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n public void init() {\n\n }", "private static void cajas() {\n\t\t\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "private void kk12() {\n\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "public void mo38117a() {\n }", "private void init() {\n\n\t}", "private void strin() {\n\n\t}", "@Override\n protected void initialize() {\n\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n public int describeContents() { return 0; }", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n public void init() {\n }", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "public void mo4359a() {\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "public void method_4270() {}", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tprotected void doF8() {\n\t\t\r\n\t}", "@Override\n\tpublic void init()\n\t{\n\n\t}", "@Override\n\tpublic void init() {\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public abstract void mo70713b();", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public int retroceder() {\n return 0;\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "private void init() {\n\n\n\n }", "private Rekenhulp()\n\t{\n\t}", "public void m23075a() {\n }", "public void mo6081a() {\n }", "public void mo12628c() {\n }", "@Override\n public void initialize() { \n }", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tprotected void initialize() {\n\t}" ]
[ "0.5903571", "0.57782894", "0.57602715", "0.5702929", "0.56978756", "0.56542087", "0.5637721", "0.5637721", "0.5601682", "0.5594641", "0.55865383", "0.5580202", "0.5547378", "0.55460036", "0.55385154", "0.55102944", "0.55023026", "0.54984444", "0.54984444", "0.54984444", "0.54984444", "0.54984444", "0.54901606", "0.5486773", "0.5484313", "0.5480847", "0.5468122", "0.5454814", "0.5447596", "0.54433227", "0.5435022", "0.5419352", "0.5415781", "0.5404645", "0.5400009", "0.5398373", "0.5398373", "0.53977984", "0.5393503", "0.53880805", "0.53785694", "0.53753966", "0.5359837", "0.5356214", "0.53525245", "0.5339994", "0.5339994", "0.5339994", "0.53373367", "0.53373367", "0.53373367", "0.5328375", "0.532521", "0.532521", "0.532521", "0.532521", "0.532521", "0.532521", "0.53241014", "0.53241014", "0.53241014", "0.531856", "0.53154355", "0.5314978", "0.5314978", "0.5308591", "0.53052884", "0.5304728", "0.52996993", "0.5293783", "0.52899474", "0.52869093", "0.52804846", "0.5278374", "0.5278374", "0.5278374", "0.5278374", "0.5278374", "0.5278374", "0.5278374", "0.5266741", "0.526189", "0.5260833", "0.52603126", "0.5260205", "0.5249322", "0.5249322", "0.52346903", "0.52216923", "0.5216361", "0.5209339", "0.51982933", "0.5195936", "0.5192209", "0.51899385", "0.5184677", "0.51818323", "0.51788706", "0.51761085", "0.51599234", "0.5158299" ]
0.0
-1
/ renamed from: a
static boolean m6825a(Context context) { return context.getResources().getConfiguration().orientation == 2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public interface C4521a {\n /* renamed from: a */\n void mo12348a();\n }", "public interface C1423a {\n /* renamed from: a */\n void mo6888a(int i);\n }", "interface bxc {\n /* renamed from: a */\n void mo2508a(bxb bxb);\n}", "interface C33292a {\n /* renamed from: a */\n void mo85415a(String str);\n }", "interface C10331b {\n /* renamed from: a */\n void mo26876a(int i);\n }", "public interface C0779a {\n /* renamed from: a */\n void mo2311a();\n}", "public interface C6788a {\n /* renamed from: a */\n void mo20141a();\n }", "public interface C0237a {\n /* renamed from: a */\n void mo1791a(String str);\n }", "public interface C35013b {\n /* renamed from: a */\n void mo88773a(int i);\n}", "public interface C11112n {\n /* renamed from: a */\n void mo38026a();\n }", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "public interface C23407b {\n /* renamed from: a */\n void mo60892a();\n\n /* renamed from: b */\n void mo60893b();\n }", "interface C0312e {\n /* renamed from: a */\n void mo4671a(View view, int i, int i2, int i3, int i4);\n }", "public interface C34379a {\n /* renamed from: a */\n void mo46242a(bmc bmc);\n }", "public interface C32456b<T> {\n /* renamed from: a */\n void mo83696a(T t);\n }", "private String convertir(String a) {\n StringBuilder atributo = new StringBuilder(a);\n atributo.insert(0, Character.toUpperCase(atributo.charAt(0)));\n return atributo.deleteCharAt(1).toString();\n }", "protected m a(String name) {\n/* 42 */ return this.a.get(name);\n/* */ }", "public interface AbstractC23925a {\n /* renamed from: a */\n void mo105476a();\n }", "private interface C0257a {\n /* renamed from: a */\n float mo196a(ViewGroup viewGroup, View view);\n\n /* renamed from: b */\n float mo195b(ViewGroup viewGroup, View view);\n }", "public interface C3598a {\n /* renamed from: a */\n void mo11024a(int i, int i2, String str);\n }", "public interface C2459d {\n /* renamed from: a */\n C2451d mo3408a(C2457e c2457e);\n}", "public interface am extends ak {\r\n /* renamed from: a */\r\n void mo194a(int i) throws RemoteException;\r\n\r\n /* renamed from: a */\r\n void mo195a(List<LatLng> list) throws RemoteException;\r\n\r\n /* renamed from: b */\r\n void mo196b(float f) throws RemoteException;\r\n\r\n /* renamed from: b */\r\n void mo197b(boolean z);\r\n\r\n /* renamed from: c */\r\n void mo198c(boolean z) throws RemoteException;\r\n\r\n /* renamed from: g */\r\n float mo199g() throws RemoteException;\r\n\r\n /* renamed from: h */\r\n int mo200h() throws RemoteException;\r\n\r\n /* renamed from: i */\r\n List<LatLng> mo201i() throws RemoteException;\r\n\r\n /* renamed from: j */\r\n boolean mo202j();\r\n\r\n /* renamed from: k */\r\n boolean mo203k();\r\n}", "public interface C32459e<T> {\n /* renamed from: a */\n void mo83698a(T t);\n }", "public interface C32458d<T> {\n /* renamed from: a */\n void mo83695a(T t);\n }", "public interface C5482b {\n /* renamed from: a */\n void mo27575a();\n\n /* renamed from: a */\n void mo27576a(int i);\n }", "public interface C27084a {\n /* renamed from: a */\n void mo69874a();\n\n /* renamed from: a */\n void mo69875a(List<Aweme> list, boolean z);\n }", "public void a() {\n ((a) this.a).a();\n }", "public interface C1153a {\n /* renamed from: a */\n void mo4520a(byte[] bArr);\n }", "public interface C13373b {\n /* renamed from: a */\n void mo32681a(String str, int i, boolean z);\n}", "public interface C40453c {\n /* renamed from: a */\n void mo100442a(C40429b bVar);\n\n /* renamed from: a */\n void mo100443a(List<String> list);\n\n /* renamed from: b */\n void mo100444b(List<C40429b> list);\n}", "public interface AbstractC17367b {\n /* renamed from: a */\n void mo84655a();\n }", "@Override\r\n\tpublic void a() {\n\t\t\r\n\t}", "public interface C43270a {\n /* renamed from: a */\n void mo64942a(String str, long j, long j2);\n}", "public interface C18928d {\n /* renamed from: a */\n void mo50320a(C18924b bVar);\n\n /* renamed from: b */\n void mo50321b(C18924b bVar);\n}", "public interface C0087c {\n /* renamed from: a */\n String mo150a(String str);\n}", "public interface C1529m {\n /* renamed from: a */\n void mo3767a(int i);\n\n /* renamed from: a */\n void mo3768a(String str);\n}", "interface C4483e {\n /* renamed from: a */\n boolean mo34114a();\n}", "public interface C1234b {\r\n /* renamed from: a */\r\n void m8367a();\r\n\r\n /* renamed from: b */\r\n void m8368b();\r\n}", "public interface C10965j<T> {\n /* renamed from: a */\n T mo26439a();\n}", "public interface C28772a {\n /* renamed from: a */\n View mo73990a(View view);\n }", "@Override\n\tpublic void a() {\n\t\t\n\t}", "public interface C8326b {\n /* renamed from: a */\n C8325a mo21498a(String str);\n\n /* renamed from: a */\n void mo21499a(C8325a aVar);\n}", "void metodo1(int a, int[] b) {\r\n\t\ta += 5;//Par\\u00e1metro con el mismo nombre que el campo de la clase.\r\n\t\tb[0] += 7;//se produce un env\\u00edo por referencia, apunta a una copia de un objeto, que se asigna aqu\\u00ed.\r\n\t}", "public interface C2367a {\n /* renamed from: a */\n C2368d mo1698a();\n }", "interface C30585a {\n /* renamed from: b */\n void mo27952b(C5379a c5379a, int i, C46650a c46650a, C7620bi c7620bi);\n }", "public interface C4211a {\n\n /* renamed from: com.iab.omid.library.oguryco.c.a$a */\n public interface C4212a {\n /* renamed from: a */\n void mo28760a(View view, C4211a aVar, JSONObject jSONObject);\n }\n\n /* renamed from: a */\n JSONObject mo28758a(View view);\n\n /* renamed from: a */\n void mo28759a(View view, JSONObject jSONObject, C4212a aVar, boolean z);\n}", "public interface C4697a extends C5595at {\n /* renamed from: a */\n void mo12634a();\n\n /* renamed from: a */\n void mo12635a(String str);\n\n /* renamed from: a */\n void mo12636a(boolean z);\n\n /* renamed from: b */\n void mo12637b();\n\n /* renamed from: c */\n void mo12638c();\n }", "public interface C4773c {\n /* renamed from: a */\n void m15858a(int i);\n\n /* renamed from: a */\n void m15859a(int i, int i2);\n\n /* renamed from: a */\n void m15860a(int i, int i2, int i3);\n\n /* renamed from: b */\n void m15861b(int i, int i2);\n}", "public interface C4869f {\n /* renamed from: a */\n C4865b mo6249a();\n}", "public interface C1799a {\n /* renamed from: b */\n void mo3314b(String str);\n }", "public interface C43499b {\n /* renamed from: a */\n void mo8445a(int i, String str, int i2, byte[] bArr);\n}", "public interface C0601aq {\n /* renamed from: a */\n void mo9148a(int i, ArrayList<C0889x> arrayList);\n}", "public interface C45101e {\n /* renamed from: b */\n void mo3796b(int i);\n}", "public interface AbstractC6461g {\n /* renamed from: a */\n String mo42332a();\n}", "public interface AbstractC1645a {\n /* renamed from: a */\n String mo17375a();\n }", "public interface C6178c {\n /* renamed from: a */\n Map<String, String> mo14888a();\n}", "public interface C5101b {\n /* renamed from: a */\n void mo5289a(C5102c c5102c);\n\n /* renamed from: b */\n void mo5290b(C5102c c5102c);\n}", "public interface C19045k {\n /* renamed from: a */\n void mo50368a(int i, Object obj);\n\n /* renamed from: b */\n void mo50369b(int i, Object obj);\n}", "public b a()\r\n/* 12: */ {\r\n/* 13:13 */ return this.a;\r\n/* 14: */ }", "public interface C7720a {\n /* renamed from: a */\n long mo20406a();\n}", "public String a()\r\n/* 25: */ {\r\n/* 26:171 */ return \"dig.\" + this.a;\r\n/* 27: */ }", "public interface ayt {\n /* renamed from: a */\n int mo1635a(long j, List list);\n\n /* renamed from: a */\n long mo1636a(long j, alb alb);\n\n /* renamed from: a */\n void mo1637a();\n\n /* renamed from: a */\n void mo1638a(long j, long j2, List list, ayp ayp);\n\n /* renamed from: a */\n void mo1639a(ayl ayl);\n\n /* renamed from: a */\n boolean mo1640a(ayl ayl, boolean z, Exception exc, long j);\n}", "public interface C24221b extends C28343z<C28318an> {\n /* renamed from: a */\n void mo62991a(int i);\n\n String aw_();\n\n /* renamed from: e */\n Aweme mo62993e();\n}", "public interface C4051c {\n /* renamed from: a */\n boolean mo23707a();\n}", "public interface C45112b {\n /* renamed from: a */\n List<C45111a> mo107674a(Integer num);\n\n /* renamed from: a */\n List<C45111a> mo107675a(Integer num, Integer num2);\n\n /* renamed from: a */\n void mo107676a(C45111a aVar);\n\n /* renamed from: b */\n void mo107677b(Integer num);\n\n /* renamed from: c */\n long mo107678c(Integer num);\n}", "public void acionou(int a){\n\t\t\tb=a;\n\t\t}", "public interface C44963i {\n /* renamed from: a */\n void mo63037a(int i, int i2);\n\n void aA_();\n\n /* renamed from: b */\n void mo63039b(int i, int i2);\n}", "public interface C32457c<T> {\n /* renamed from: a */\n void mo83699a(T t, int i, int i2, String str);\n }", "public interface C5861g {\n /* renamed from: a */\n void mo18320a(C7251a aVar);\n\n @Deprecated\n /* renamed from: a */\n void mo18321a(C7251a aVar, String str);\n\n /* renamed from: a */\n void mo18322a(C7252b bVar);\n\n /* renamed from: a */\n void mo18323a(C7253c cVar);\n\n /* renamed from: a */\n void mo18324a(C7260j jVar);\n}", "public interface C0937a {\n /* renamed from: a */\n void mo3807a(C0985po[] poVarArr);\n }", "public interface C8466a {\n /* renamed from: a */\n void mo25956a(int i);\n\n /* renamed from: a */\n void mo25957a(long j, long j2);\n }", "public interface C39684b {\n /* renamed from: a */\n void mo98969a();\n\n /* renamed from: a */\n void mo98970a(C29296g gVar);\n\n /* renamed from: a */\n void mo98971a(C29296g gVar, int i);\n }", "public interface C43470b {\n /* renamed from: a */\n void mo61496a(C43469a aVar, C43471c cVar);\n }", "public interface AbstractC18255a {\n /* renamed from: a */\n void mo88521a();\n\n /* renamed from: a */\n void mo88522a(String str);\n\n /* renamed from: b */\n void mo88523b();\n\n /* renamed from: c */\n void mo88524c();\n }", "public interface C1436d {\n /* renamed from: a */\n C1435c mo1754a(C1433a c1433a, C1434b c1434b);\n}", "public interface C4150sl {\n /* renamed from: a */\n void mo15005a(C4143se seVar);\n}", "public void a(nm paramnm)\r\n/* 28: */ {\r\n/* 29:45 */ paramnm.a(this);\r\n/* 30: */ }", "public interface C19351a {\n /* renamed from: b */\n void mo30633b(int i, String str, byte[] bArr);\n }", "public interface C11113o {\n /* renamed from: a */\n void mo37759a(String str);\n }", "public interface C39504az {\n /* renamed from: a */\n int mo98207a();\n\n /* renamed from: a */\n void mo98208a(boolean z);\n\n /* renamed from: b */\n int mo98209b();\n\n /* renamed from: c */\n int mo98355c();\n\n /* renamed from: d */\n int mo98356d();\n\n /* renamed from: e */\n int mo98357e();\n\n /* renamed from: f */\n int mo98358f();\n}", "protected a<T> a(Tag.e<T> var0) {\n/* 80 */ Tag.a var1 = b(var0);\n/* 81 */ return new a<>(var1, this.c, \"vanilla\");\n/* */ }", "public interface C35565a {\n /* renamed from: a */\n C45321i mo90380a();\n }", "public interface C21298a {\n /* renamed from: a */\n void mo57275a();\n\n /* renamed from: a */\n void mo57276a(Exception exc);\n\n /* renamed from: b */\n void mo57277b();\n\n /* renamed from: c */\n void mo57278c();\n }", "public interface C40108b {\n /* renamed from: a */\n void mo99838a(boolean z);\n }", "public interface C0456a {\n /* renamed from: a */\n void mo2090a(C0455b bVar);\n\n /* renamed from: a */\n boolean mo2091a(C0455b bVar, Menu menu);\n\n /* renamed from: a */\n boolean mo2092a(C0455b bVar, MenuItem menuItem);\n\n /* renamed from: b */\n boolean mo2093b(C0455b bVar, Menu menu);\n }", "public interface C4724o {\n /* renamed from: a */\n void mo4872a(int i, String str);\n\n /* renamed from: a */\n void mo4873a(C4718l c4718l);\n\n /* renamed from: b */\n void mo4874b(C4718l c4718l);\n}", "public interface C7654b {\n /* renamed from: a */\n C7904c mo24084a();\n\n /* renamed from: b */\n C7716a mo24085b();\n }", "public interface C2603a {\n /* renamed from: a */\n String mo1889a(String str, String str2, String str3, String str4);\n }", "public interface afp {\n /* renamed from: a */\n C0512sx mo169a(C0497si siVar, afj afj, afr afr, Context context);\n}", "public interface C0615ja extends b<HomeFragment> {\n\n /* renamed from: c.c.a.h.b.ja$a */\n /* compiled from: FragmentModule_HomeFragment$app_bazaarRelease */\n public static abstract class a extends b.a<HomeFragment> {\n }\n}", "public interface a {\n\n /* renamed from: c.b.a.c.b.b.a$a reason: collision with other inner class name */\n /* compiled from: DiskCache */\n public interface C0054a {\n a build();\n }\n\n /* compiled from: DiskCache */\n public interface b {\n boolean a(File file);\n }\n\n File a(c cVar);\n\n void a(c cVar, b bVar);\n}", "public interface C0940d {\n /* renamed from: a */\n void mo3305a(boolean z);\n }", "public interface AbstractC17368c {\n /* renamed from: a */\n void mo84656a(float f);\n }", "interface C0932a {\n /* renamed from: a */\n void mo7438a(int i, int i2);\n\n /* renamed from: b */\n void mo7439b(C0933b bVar);\n\n /* renamed from: c */\n void mo7440c(int i, int i2, Object obj);\n\n /* renamed from: d */\n void mo7441d(C0933b bVar);\n\n /* renamed from: e */\n RecyclerView.ViewHolder mo7442e(int i);\n\n /* renamed from: f */\n void mo7443f(int i, int i2);\n\n /* renamed from: g */\n void mo7444g(int i, int i2);\n\n /* renamed from: h */\n void mo7445h(int i, int i2);\n }", "public interface C10330c {\n /* renamed from: a */\n C7562b<C10403b, C10328a> mo25041a();\n}", "public interface C3819a {\n /* renamed from: a */\n void mo23214a(Message message);\n }", "private Proof atoAImpl(Expression a) {\n Proof where = axm2(a, arrow(a, a), a); //a->(a->a) -> (a->(a->a)->a) -> (a -> a)\n Proof one = axm1(a, a); //a->a->a\n Proof two = axm1(a, arrow(a, a)); //a->(a->a)->A\n return mpTwice(where, one, two);\n }", "interface C1939a {\n /* renamed from: a */\n Bitmap mo1406a(Bitmap bitmap, float f);\n}", "public interface a extends com.bankeen.d.b.b.a {\n void a();\n\n void b();\n }", "public b[] a() {\n/* 95 */ return this.a;\n/* */ }", "interface C8361a {\n /* renamed from: b */\n float mo18284b(ViewGroup viewGroup, View view);\n\n /* renamed from: c */\n float mo18281c(ViewGroup viewGroup, View view);\n }" ]
[ "0.62497115", "0.6242887", "0.61394435", "0.61176854", "0.6114027", "0.60893", "0.6046901", "0.6024682", "0.60201293", "0.5975212", "0.59482527", "0.59121317", "0.5883635", "0.587841", "0.58703005", "0.5868436", "0.5864884", "0.5857492", "0.58306104", "0.5827752", "0.58272064", "0.5794689", "0.57890314", "0.57838726", "0.5775679", "0.57694733", "0.5769128", "0.57526815", "0.56907034", "0.5677874", "0.5670547", "0.56666386", "0.56592244", "0.5658682", "0.56574154", "0.5654324", "0.5644676", "0.56399715", "0.5638734", "0.5630582", "0.56183887", "0.5615435", "0.56069666", "0.5605207", "0.56005067", "0.559501", "0.55910283", "0.5590222", "0.55736613", "0.5556682", "0.5554544", "0.5550076", "0.55493855", "0.55446684", "0.5538079", "0.5529058", "0.5528109", "0.552641", "0.5525864", "0.552186", "0.5519972", "0.5509587", "0.5507195", "0.54881203", "0.5485328", "0.54826045", "0.5482066", "0.5481586", "0.5479751", "0.54776895", "0.54671466", "0.5463307", "0.54505056", "0.54436916", "0.5440517", "0.5439747", "0.5431944", "0.5422869", "0.54217863", "0.5417556", "0.5403905", "0.5400223", "0.53998446", "0.5394735", "0.5388649", "0.5388258", "0.5374842", "0.5368887", "0.53591394", "0.5357029", "0.5355688", "0.535506", "0.5355034", "0.53494394", "0.5341044", "0.5326166", "0.53236824", "0.53199095", "0.53177035", "0.53112453", "0.5298229" ]
0.0
-1
/ renamed from: a
public final void mo309a() { throw new NoSuchMethodError(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public interface C4521a {\n /* renamed from: a */\n void mo12348a();\n }", "public interface C1423a {\n /* renamed from: a */\n void mo6888a(int i);\n }", "interface bxc {\n /* renamed from: a */\n void mo2508a(bxb bxb);\n}", "interface C33292a {\n /* renamed from: a */\n void mo85415a(String str);\n }", "interface C10331b {\n /* renamed from: a */\n void mo26876a(int i);\n }", "public interface C0779a {\n /* renamed from: a */\n void mo2311a();\n}", "public interface C6788a {\n /* renamed from: a */\n void mo20141a();\n }", "public interface C0237a {\n /* renamed from: a */\n void mo1791a(String str);\n }", "public interface C35013b {\n /* renamed from: a */\n void mo88773a(int i);\n}", "public interface C11112n {\n /* renamed from: a */\n void mo38026a();\n }", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "public interface C23407b {\n /* renamed from: a */\n void mo60892a();\n\n /* renamed from: b */\n void mo60893b();\n }", "interface C0312e {\n /* renamed from: a */\n void mo4671a(View view, int i, int i2, int i3, int i4);\n }", "public interface C34379a {\n /* renamed from: a */\n void mo46242a(bmc bmc);\n }", "public interface C32456b<T> {\n /* renamed from: a */\n void mo83696a(T t);\n }", "private String convertir(String a) {\n StringBuilder atributo = new StringBuilder(a);\n atributo.insert(0, Character.toUpperCase(atributo.charAt(0)));\n return atributo.deleteCharAt(1).toString();\n }", "protected m a(String name) {\n/* 42 */ return this.a.get(name);\n/* */ }", "public interface AbstractC23925a {\n /* renamed from: a */\n void mo105476a();\n }", "private interface C0257a {\n /* renamed from: a */\n float mo196a(ViewGroup viewGroup, View view);\n\n /* renamed from: b */\n float mo195b(ViewGroup viewGroup, View view);\n }", "public interface C3598a {\n /* renamed from: a */\n void mo11024a(int i, int i2, String str);\n }", "public interface C2459d {\n /* renamed from: a */\n C2451d mo3408a(C2457e c2457e);\n}", "public interface am extends ak {\r\n /* renamed from: a */\r\n void mo194a(int i) throws RemoteException;\r\n\r\n /* renamed from: a */\r\n void mo195a(List<LatLng> list) throws RemoteException;\r\n\r\n /* renamed from: b */\r\n void mo196b(float f) throws RemoteException;\r\n\r\n /* renamed from: b */\r\n void mo197b(boolean z);\r\n\r\n /* renamed from: c */\r\n void mo198c(boolean z) throws RemoteException;\r\n\r\n /* renamed from: g */\r\n float mo199g() throws RemoteException;\r\n\r\n /* renamed from: h */\r\n int mo200h() throws RemoteException;\r\n\r\n /* renamed from: i */\r\n List<LatLng> mo201i() throws RemoteException;\r\n\r\n /* renamed from: j */\r\n boolean mo202j();\r\n\r\n /* renamed from: k */\r\n boolean mo203k();\r\n}", "public interface C32459e<T> {\n /* renamed from: a */\n void mo83698a(T t);\n }", "public interface C32458d<T> {\n /* renamed from: a */\n void mo83695a(T t);\n }", "public interface C5482b {\n /* renamed from: a */\n void mo27575a();\n\n /* renamed from: a */\n void mo27576a(int i);\n }", "public interface C27084a {\n /* renamed from: a */\n void mo69874a();\n\n /* renamed from: a */\n void mo69875a(List<Aweme> list, boolean z);\n }", "public void a() {\n ((a) this.a).a();\n }", "public interface C1153a {\n /* renamed from: a */\n void mo4520a(byte[] bArr);\n }", "public interface C13373b {\n /* renamed from: a */\n void mo32681a(String str, int i, boolean z);\n}", "public interface C40453c {\n /* renamed from: a */\n void mo100442a(C40429b bVar);\n\n /* renamed from: a */\n void mo100443a(List<String> list);\n\n /* renamed from: b */\n void mo100444b(List<C40429b> list);\n}", "public interface AbstractC17367b {\n /* renamed from: a */\n void mo84655a();\n }", "@Override\r\n\tpublic void a() {\n\t\t\r\n\t}", "public interface C43270a {\n /* renamed from: a */\n void mo64942a(String str, long j, long j2);\n}", "public interface C18928d {\n /* renamed from: a */\n void mo50320a(C18924b bVar);\n\n /* renamed from: b */\n void mo50321b(C18924b bVar);\n}", "public interface C0087c {\n /* renamed from: a */\n String mo150a(String str);\n}", "public interface C1529m {\n /* renamed from: a */\n void mo3767a(int i);\n\n /* renamed from: a */\n void mo3768a(String str);\n}", "interface C4483e {\n /* renamed from: a */\n boolean mo34114a();\n}", "public interface C1234b {\r\n /* renamed from: a */\r\n void m8367a();\r\n\r\n /* renamed from: b */\r\n void m8368b();\r\n}", "public interface C10965j<T> {\n /* renamed from: a */\n T mo26439a();\n}", "public interface C28772a {\n /* renamed from: a */\n View mo73990a(View view);\n }", "@Override\n\tpublic void a() {\n\t\t\n\t}", "public interface C8326b {\n /* renamed from: a */\n C8325a mo21498a(String str);\n\n /* renamed from: a */\n void mo21499a(C8325a aVar);\n}", "void metodo1(int a, int[] b) {\r\n\t\ta += 5;//Par\\u00e1metro con el mismo nombre que el campo de la clase.\r\n\t\tb[0] += 7;//se produce un env\\u00edo por referencia, apunta a una copia de un objeto, que se asigna aqu\\u00ed.\r\n\t}", "public interface C2367a {\n /* renamed from: a */\n C2368d mo1698a();\n }", "interface C30585a {\n /* renamed from: b */\n void mo27952b(C5379a c5379a, int i, C46650a c46650a, C7620bi c7620bi);\n }", "public interface C4211a {\n\n /* renamed from: com.iab.omid.library.oguryco.c.a$a */\n public interface C4212a {\n /* renamed from: a */\n void mo28760a(View view, C4211a aVar, JSONObject jSONObject);\n }\n\n /* renamed from: a */\n JSONObject mo28758a(View view);\n\n /* renamed from: a */\n void mo28759a(View view, JSONObject jSONObject, C4212a aVar, boolean z);\n}", "public interface C4697a extends C5595at {\n /* renamed from: a */\n void mo12634a();\n\n /* renamed from: a */\n void mo12635a(String str);\n\n /* renamed from: a */\n void mo12636a(boolean z);\n\n /* renamed from: b */\n void mo12637b();\n\n /* renamed from: c */\n void mo12638c();\n }", "public interface C4773c {\n /* renamed from: a */\n void m15858a(int i);\n\n /* renamed from: a */\n void m15859a(int i, int i2);\n\n /* renamed from: a */\n void m15860a(int i, int i2, int i3);\n\n /* renamed from: b */\n void m15861b(int i, int i2);\n}", "public interface C4869f {\n /* renamed from: a */\n C4865b mo6249a();\n}", "public interface C1799a {\n /* renamed from: b */\n void mo3314b(String str);\n }", "public interface C43499b {\n /* renamed from: a */\n void mo8445a(int i, String str, int i2, byte[] bArr);\n}", "public interface C0601aq {\n /* renamed from: a */\n void mo9148a(int i, ArrayList<C0889x> arrayList);\n}", "public interface C45101e {\n /* renamed from: b */\n void mo3796b(int i);\n}", "public interface AbstractC6461g {\n /* renamed from: a */\n String mo42332a();\n}", "public interface AbstractC1645a {\n /* renamed from: a */\n String mo17375a();\n }", "public interface C6178c {\n /* renamed from: a */\n Map<String, String> mo14888a();\n}", "public interface C5101b {\n /* renamed from: a */\n void mo5289a(C5102c c5102c);\n\n /* renamed from: b */\n void mo5290b(C5102c c5102c);\n}", "public interface C19045k {\n /* renamed from: a */\n void mo50368a(int i, Object obj);\n\n /* renamed from: b */\n void mo50369b(int i, Object obj);\n}", "public b a()\r\n/* 12: */ {\r\n/* 13:13 */ return this.a;\r\n/* 14: */ }", "public interface C7720a {\n /* renamed from: a */\n long mo20406a();\n}", "public String a()\r\n/* 25: */ {\r\n/* 26:171 */ return \"dig.\" + this.a;\r\n/* 27: */ }", "public interface ayt {\n /* renamed from: a */\n int mo1635a(long j, List list);\n\n /* renamed from: a */\n long mo1636a(long j, alb alb);\n\n /* renamed from: a */\n void mo1637a();\n\n /* renamed from: a */\n void mo1638a(long j, long j2, List list, ayp ayp);\n\n /* renamed from: a */\n void mo1639a(ayl ayl);\n\n /* renamed from: a */\n boolean mo1640a(ayl ayl, boolean z, Exception exc, long j);\n}", "public interface C24221b extends C28343z<C28318an> {\n /* renamed from: a */\n void mo62991a(int i);\n\n String aw_();\n\n /* renamed from: e */\n Aweme mo62993e();\n}", "public interface C4051c {\n /* renamed from: a */\n boolean mo23707a();\n}", "public interface C45112b {\n /* renamed from: a */\n List<C45111a> mo107674a(Integer num);\n\n /* renamed from: a */\n List<C45111a> mo107675a(Integer num, Integer num2);\n\n /* renamed from: a */\n void mo107676a(C45111a aVar);\n\n /* renamed from: b */\n void mo107677b(Integer num);\n\n /* renamed from: c */\n long mo107678c(Integer num);\n}", "public void acionou(int a){\n\t\t\tb=a;\n\t\t}", "public interface C44963i {\n /* renamed from: a */\n void mo63037a(int i, int i2);\n\n void aA_();\n\n /* renamed from: b */\n void mo63039b(int i, int i2);\n}", "public interface C32457c<T> {\n /* renamed from: a */\n void mo83699a(T t, int i, int i2, String str);\n }", "public interface C5861g {\n /* renamed from: a */\n void mo18320a(C7251a aVar);\n\n @Deprecated\n /* renamed from: a */\n void mo18321a(C7251a aVar, String str);\n\n /* renamed from: a */\n void mo18322a(C7252b bVar);\n\n /* renamed from: a */\n void mo18323a(C7253c cVar);\n\n /* renamed from: a */\n void mo18324a(C7260j jVar);\n}", "public interface C0937a {\n /* renamed from: a */\n void mo3807a(C0985po[] poVarArr);\n }", "public interface C8466a {\n /* renamed from: a */\n void mo25956a(int i);\n\n /* renamed from: a */\n void mo25957a(long j, long j2);\n }", "public interface C39684b {\n /* renamed from: a */\n void mo98969a();\n\n /* renamed from: a */\n void mo98970a(C29296g gVar);\n\n /* renamed from: a */\n void mo98971a(C29296g gVar, int i);\n }", "public interface C43470b {\n /* renamed from: a */\n void mo61496a(C43469a aVar, C43471c cVar);\n }", "public interface AbstractC18255a {\n /* renamed from: a */\n void mo88521a();\n\n /* renamed from: a */\n void mo88522a(String str);\n\n /* renamed from: b */\n void mo88523b();\n\n /* renamed from: c */\n void mo88524c();\n }", "public interface C1436d {\n /* renamed from: a */\n C1435c mo1754a(C1433a c1433a, C1434b c1434b);\n}", "public interface C4150sl {\n /* renamed from: a */\n void mo15005a(C4143se seVar);\n}", "public void a(nm paramnm)\r\n/* 28: */ {\r\n/* 29:45 */ paramnm.a(this);\r\n/* 30: */ }", "public interface C19351a {\n /* renamed from: b */\n void mo30633b(int i, String str, byte[] bArr);\n }", "public interface C11113o {\n /* renamed from: a */\n void mo37759a(String str);\n }", "public interface C39504az {\n /* renamed from: a */\n int mo98207a();\n\n /* renamed from: a */\n void mo98208a(boolean z);\n\n /* renamed from: b */\n int mo98209b();\n\n /* renamed from: c */\n int mo98355c();\n\n /* renamed from: d */\n int mo98356d();\n\n /* renamed from: e */\n int mo98357e();\n\n /* renamed from: f */\n int mo98358f();\n}", "protected a<T> a(Tag.e<T> var0) {\n/* 80 */ Tag.a var1 = b(var0);\n/* 81 */ return new a<>(var1, this.c, \"vanilla\");\n/* */ }", "public interface C35565a {\n /* renamed from: a */\n C45321i mo90380a();\n }", "public interface C21298a {\n /* renamed from: a */\n void mo57275a();\n\n /* renamed from: a */\n void mo57276a(Exception exc);\n\n /* renamed from: b */\n void mo57277b();\n\n /* renamed from: c */\n void mo57278c();\n }", "public interface C40108b {\n /* renamed from: a */\n void mo99838a(boolean z);\n }", "public interface C0456a {\n /* renamed from: a */\n void mo2090a(C0455b bVar);\n\n /* renamed from: a */\n boolean mo2091a(C0455b bVar, Menu menu);\n\n /* renamed from: a */\n boolean mo2092a(C0455b bVar, MenuItem menuItem);\n\n /* renamed from: b */\n boolean mo2093b(C0455b bVar, Menu menu);\n }", "public interface C4724o {\n /* renamed from: a */\n void mo4872a(int i, String str);\n\n /* renamed from: a */\n void mo4873a(C4718l c4718l);\n\n /* renamed from: b */\n void mo4874b(C4718l c4718l);\n}", "public interface C7654b {\n /* renamed from: a */\n C7904c mo24084a();\n\n /* renamed from: b */\n C7716a mo24085b();\n }", "public interface C2603a {\n /* renamed from: a */\n String mo1889a(String str, String str2, String str3, String str4);\n }", "public interface afp {\n /* renamed from: a */\n C0512sx mo169a(C0497si siVar, afj afj, afr afr, Context context);\n}", "public interface C0615ja extends b<HomeFragment> {\n\n /* renamed from: c.c.a.h.b.ja$a */\n /* compiled from: FragmentModule_HomeFragment$app_bazaarRelease */\n public static abstract class a extends b.a<HomeFragment> {\n }\n}", "public interface a {\n\n /* renamed from: c.b.a.c.b.b.a$a reason: collision with other inner class name */\n /* compiled from: DiskCache */\n public interface C0054a {\n a build();\n }\n\n /* compiled from: DiskCache */\n public interface b {\n boolean a(File file);\n }\n\n File a(c cVar);\n\n void a(c cVar, b bVar);\n}", "public interface C0940d {\n /* renamed from: a */\n void mo3305a(boolean z);\n }", "public interface AbstractC17368c {\n /* renamed from: a */\n void mo84656a(float f);\n }", "interface C0932a {\n /* renamed from: a */\n void mo7438a(int i, int i2);\n\n /* renamed from: b */\n void mo7439b(C0933b bVar);\n\n /* renamed from: c */\n void mo7440c(int i, int i2, Object obj);\n\n /* renamed from: d */\n void mo7441d(C0933b bVar);\n\n /* renamed from: e */\n RecyclerView.ViewHolder mo7442e(int i);\n\n /* renamed from: f */\n void mo7443f(int i, int i2);\n\n /* renamed from: g */\n void mo7444g(int i, int i2);\n\n /* renamed from: h */\n void mo7445h(int i, int i2);\n }", "public interface C10330c {\n /* renamed from: a */\n C7562b<C10403b, C10328a> mo25041a();\n}", "public interface C3819a {\n /* renamed from: a */\n void mo23214a(Message message);\n }", "private Proof atoAImpl(Expression a) {\n Proof where = axm2(a, arrow(a, a), a); //a->(a->a) -> (a->(a->a)->a) -> (a -> a)\n Proof one = axm1(a, a); //a->a->a\n Proof two = axm1(a, arrow(a, a)); //a->(a->a)->A\n return mpTwice(where, one, two);\n }", "interface C1939a {\n /* renamed from: a */\n Bitmap mo1406a(Bitmap bitmap, float f);\n}", "public interface a extends com.bankeen.d.b.b.a {\n void a();\n\n void b();\n }", "public b[] a() {\n/* 95 */ return this.a;\n/* */ }", "interface C8361a {\n /* renamed from: b */\n float mo18284b(ViewGroup viewGroup, View view);\n\n /* renamed from: c */\n float mo18281c(ViewGroup viewGroup, View view);\n }" ]
[ "0.62497115", "0.6242887", "0.61394435", "0.61176854", "0.6114027", "0.60893", "0.6046901", "0.6024682", "0.60201293", "0.5975212", "0.59482527", "0.59121317", "0.5883635", "0.587841", "0.58703005", "0.5868436", "0.5864884", "0.5857492", "0.58306104", "0.5827752", "0.58272064", "0.5794689", "0.57890314", "0.57838726", "0.5775679", "0.57694733", "0.5769128", "0.57526815", "0.56907034", "0.5677874", "0.5670547", "0.56666386", "0.56592244", "0.5658682", "0.56574154", "0.5654324", "0.5644676", "0.56399715", "0.5638734", "0.5630582", "0.56183887", "0.5615435", "0.56069666", "0.5605207", "0.56005067", "0.559501", "0.55910283", "0.5590222", "0.55736613", "0.5556682", "0.5554544", "0.5550076", "0.55493855", "0.55446684", "0.5538079", "0.5529058", "0.5528109", "0.552641", "0.5525864", "0.552186", "0.5519972", "0.5509587", "0.5507195", "0.54881203", "0.5485328", "0.54826045", "0.5482066", "0.5481586", "0.5479751", "0.54776895", "0.54671466", "0.5463307", "0.54505056", "0.54436916", "0.5440517", "0.5439747", "0.5431944", "0.5422869", "0.54217863", "0.5417556", "0.5403905", "0.5400223", "0.53998446", "0.5394735", "0.5388649", "0.5388258", "0.5374842", "0.5368887", "0.53591394", "0.5357029", "0.5355688", "0.535506", "0.5355034", "0.53494394", "0.5341044", "0.5326166", "0.53236824", "0.53199095", "0.53177035", "0.53112453", "0.5298229" ]
0.0
-1
/ renamed from: b
public final void mo310b() { throw new NoSuchMethodError(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void mo2508a(bxb bxb);", "@Override\n public void func_104112_b() {\n \n }", "@Override\n public void b() {\n }", "public interface C19351a {\n /* renamed from: b */\n void mo30633b(int i, String str, byte[] bArr);\n }", "@Override\n\tpublic void b2() {\n\t\t\n\t}", "void metodo1(int a, int[] b) {\r\n\t\ta += 5;//Par\\u00e1metro con el mismo nombre que el campo de la clase.\r\n\t\tb[0] += 7;//se produce un env\\u00edo por referencia, apunta a una copia de un objeto, que se asigna aqu\\u00ed.\r\n\t}", "interface bxc {\n /* renamed from: a */\n void mo2508a(bxb bxb);\n}", "@Override\n\tpublic void b() {\n\n\t}", "interface C30585a {\n /* renamed from: b */\n void mo27952b(C5379a c5379a, int i, C46650a c46650a, C7620bi c7620bi);\n }", "public bb b() {\n return a(this.a);\n }", "@Override\n\tpublic void b1() {\n\t\t\n\t}", "public void b() {\r\n }", "@Override\n\tpublic void bbb() {\n\t\t\n\t}", "public interface C34379a {\n /* renamed from: a */\n void mo46242a(bmc bmc);\n }", "public abstract void b(StringBuilder sb);", "public void b() {\n }", "public void b() {\n }", "protected b(int mb) {\n/* 87 */ this.b = mb;\n/* */ }", "public u(b paramb)\r\n/* 7: */ {\r\n/* 8: 9 */ this.a = paramb;\r\n/* 9: */ }", "public interface b {\n void H_();\n\n void I_();\n\n void J_();\n\n void a(C0063d dVar);\n\n void a(byte[] bArr);\n\n void b(boolean z);\n }", "public b[] a() {\n/* 95 */ return this.a;\n/* */ }", "public interface C7654b {\n /* renamed from: a */\n C7904c mo24084a();\n\n /* renamed from: b */\n C7716a mo24085b();\n }", "public interface C1153a {\n /* renamed from: a */\n void mo4520a(byte[] bArr);\n }", "public interface C43499b {\n /* renamed from: a */\n void mo8445a(int i, String str, int i2, byte[] bArr);\n}", "public void b() {\n ((a) this.a).b();\n }", "public np a()\r\n/* 33: */ {\r\n/* 34:49 */ return this.b;\r\n/* 35: */ }", "b(a aVar) {\n super(0);\n this.this$0 = aVar;\n }", "public t b() {\n return a(this.a);\n }", "public interface C32456b<T> {\n /* renamed from: a */\n void mo83696a(T t);\n }", "public static String a(int c) {\n/* 89 */ return b.a(c);\n/* */ }", "private void m678b(byte b) {\n byte[] bArr = this.f523r;\n bArr[0] = b;\n this.f552g.mo502b(bArr);\n }", "public interface C23407b {\n /* renamed from: a */\n void mo60892a();\n\n /* renamed from: b */\n void mo60893b();\n }", "public abstract T zzm(B b);", "public b a()\r\n/* 12: */ {\r\n/* 13:13 */ return this.a;\r\n/* 14: */ }", "public void b(World paramaqu, BlockPosition paramdt, Block parambec)\r\n/* 27: */ {\r\n/* 28: 47 */ bcm localbcm = paramaqu.s(paramdt);\r\n/* 29: 48 */ if ((localbcm instanceof bdv)) {\r\n/* 30: 49 */ ((bdv)localbcm).h();\r\n/* 31: */ } else {\r\n/* 32: 51 */ super.b(paramaqu, paramdt, parambec);\r\n/* 33: */ }\r\n/* 34: */ }", "public abstract void zzc(B b, int i, int i2);", "public interface b {\n}", "public interface b {\n}", "private void m10263b(byte b) throws cf {\r\n this.f6483r[0] = b;\r\n this.g.m10347b(this.f6483r);\r\n }", "BSubstitution createBSubstitution();", "public void b(ahd paramahd) {}", "void b();", "public interface C18928d {\n /* renamed from: a */\n void mo50320a(C18924b bVar);\n\n /* renamed from: b */\n void mo50321b(C18924b bVar);\n}", "B database(S database);", "public interface C0615ja extends b<HomeFragment> {\n\n /* renamed from: c.c.a.h.b.ja$a */\n /* compiled from: FragmentModule_HomeFragment$app_bazaarRelease */\n public static abstract class a extends b.a<HomeFragment> {\n }\n}", "public abstract C0631bt mo9227aB();", "public an b() {\n return a(this.a);\n }", "protected abstract void a(bru parambru);", "static void go(Base b) {\n\t\tb.add(8);\n\t}", "void mo46242a(bmc bmc);", "public interface b extends c {\n void a(Float f);\n\n void a(Integer num);\n\n void b(Float f);\n\n void c(Float f);\n\n String d();\n\n void d(Float f);\n\n void d(String str);\n\n void e(Float f);\n\n void e(String str);\n\n void f(String str);\n\n void g(String str);\n\n Long j();\n\n LineChart k();\n }", "public interface bca extends bbn {\n bca a();\n\n bca a(String str);\n\n bca b(String str);\n\n bca c(String str);\n}", "public interface a extends com.bankeen.d.b.b.a {\n void a();\n\n void b();\n }", "public abstract BoundType b();", "public void b(amj paramamj)\r\n/* 538: */ {\r\n/* 539:579 */ this.f = paramamj;\r\n/* 540: */ }", "b(a aVar, com.bytedance.jedi.model.h.a aVar2) {\n super(aVar2);\n this.f21531a = aVar;\n this.f21532b = new com.bytedance.jedi.model.h.f(aVar);\n }", "private void b(int paramInt)\r\n/* 193: */ {\r\n/* 194:203 */ this.h.a(a(paramInt));\r\n/* 195: */ }", "public void b(ahb paramahb)\r\n/* 583: */ {\r\n/* 584:625 */ for (int i = 0; i < this.a.length; i++) {\r\n/* 585:626 */ this.a[i] = amj.b(paramahb.a[i]);\r\n/* 586: */ }\r\n/* 587:628 */ for (i = 0; i < this.b.length; i++) {\r\n/* 588:629 */ this.b[i] = amj.b(paramahb.b[i]);\r\n/* 589: */ }\r\n/* 590:631 */ this.c = paramahb.c;\r\n/* 591: */ }", "interface b {\n\n /* compiled from: CreditAccountContract */\n public interface a extends com.bankeen.d.b.b.a {\n void a();\n\n void b();\n }\n\n /* compiled from: CreditAccountContract */\n public interface b extends c {\n void a(Float f);\n\n void a(Integer num);\n\n void b(Float f);\n\n void c(Float f);\n\n String d();\n\n void d(Float f);\n\n void d(String str);\n\n void e(Float f);\n\n void e(String str);\n\n void f(String str);\n\n void g(String str);\n\n Long j();\n\n LineChart k();\n }\n}", "@Override\n\tpublic void visit(PartB partB) {\n\n\t}", "public abstract void zzb(B b, int i, long j);", "public abstract void zza(B b, int i, zzeh zzeh);", "int metodo2(int a, int b) {\r\n\r\n\t\tthis.a += 5; // se modifica el campo del objeto, el uso de la palabra reservada this se utiliza para referenciar al campo.\r\n\t\tb += 7;\r\n\t\treturn a; // modifica en la asignaci\\u00f3n\r\n\t}", "private void internalCopy(Board b) {\n for (int i = 0; i < SIDE * SIDE; i += 1) {\n set(i, b.get(i));\n }\n\n _directions = b._directions;\n _whoseMove = b._whoseMove;\n _history = b._history;\n }", "public int b()\r\n/* 69: */ {\r\n/* 70:74 */ return this.b;\r\n/* 71: */ }", "public void b(StringBuilder sb) {\n sb.append(this.a);\n sb.append(')');\n }", "public void b() {\n e$a e$a;\n try {\n e$a = this.b;\n }\n catch (IOException iOException) {\n return;\n }\n Object object = this.c;\n e$a.b(object);\n }", "public abstract void a(StringBuilder sb);", "public interface C45101e {\n /* renamed from: b */\n void mo3796b(int i);\n}", "public abstract void zzf(Object obj, B b);", "public interface bdp {\n\n /* renamed from: a */\n public static final bdp f3422a = new bdo();\n\n /* renamed from: a */\n bdm mo1784a(akh akh);\n}", "@Override\n\tpublic void parse(Buffer b) {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "public abstract void a(b paramb, int paramInt1, int paramInt2);", "public void mo1945a(byte b) throws cf {\r\n m10263b(b);\r\n }", "void mo83703a(C32456b<T> bVar);", "public void a(String str) {\n ((b.b) this.b).d(str);\n }", "public void selectB() { }", "BOperation createBOperation();", "void metodo1(int a, int b) {\r\n\t\ta += 5;//par\\u00e1metro con el mismo nombre que el campo.\r\n\t\tb += 7;\r\n\t}", "private static void m2196a(StringBuffer stringBuffer, byte b) {\n stringBuffer.append(\"0123456789ABCDEF\".charAt((b >> 4) & 15)).append(\"0123456789ABCDEF\".charAt(b & 15));\n }", "public interface C1799a {\n /* renamed from: b */\n void mo3314b(String str);\n }", "public void b(fv paramfv)\r\n/* 408: */ {\r\n/* 409:423 */ this.a = new amj[36];\r\n/* 410:424 */ this.b = new amj[4];\r\n/* 411:425 */ for (int i = 0; i < paramfv.c(); i++)\r\n/* 412: */ {\r\n/* 413:426 */ fn localfn = paramfv.b(i);\r\n/* 414:427 */ int j = localfn.d(\"Slot\") & 0xFF;\r\n/* 415:428 */ amj localamj = amj.a(localfn);\r\n/* 416:429 */ if (localamj != null)\r\n/* 417: */ {\r\n/* 418:430 */ if ((j >= 0) && (j < this.a.length)) {\r\n/* 419:431 */ this.a[j] = localamj;\r\n/* 420: */ }\r\n/* 421:433 */ if ((j >= 100) && (j < this.b.length + 100)) {\r\n/* 422:434 */ this.b[(j - 100)] = localamj;\r\n/* 423: */ }\r\n/* 424: */ }\r\n/* 425: */ }\r\n/* 426: */ }", "public void b(String str) {\n ((b.b) this.b).e(str);\n }", "public String b()\r\n/* 35: */ {\r\n/* 36:179 */ return a();\r\n/* 37: */ }", "public abstract void zza(B b, int i, T t);", "public Item b(World paramaqu, BlockPosition paramdt)\r\n/* 189: */ {\r\n/* 190:220 */ return null;\r\n/* 191: */ }", "public abstract void zza(B b, int i, long j);", "public interface C5101b {\n /* renamed from: a */\n void mo5289a(C5102c c5102c);\n\n /* renamed from: b */\n void mo5290b(C5102c c5102c);\n}", "private interface C0257a {\n /* renamed from: a */\n float mo196a(ViewGroup viewGroup, View view);\n\n /* renamed from: b */\n float mo195b(ViewGroup viewGroup, View view);\n }", "public abstract void mo9798a(byte b);", "public void mo9798a(byte b) {\n if (this.f9108f == this.f9107e) {\n mo9827i();\n }\n byte[] bArr = this.f9106d;\n int i = this.f9108f;\n this.f9108f = i + 1;\n bArr[i] = b;\n this.f9109g++;\n }", "public interface C1234b {\r\n /* renamed from: a */\r\n void m8367a();\r\n\r\n /* renamed from: b */\r\n void m8368b();\r\n}", "private void m676a(TField bkVar, byte b) {\n if (b == -1) {\n b = m687e(bkVar.f538b);\n }\n short s = bkVar.f539c;\n short s2 = this.f519n;\n if (s <= s2 || s - s2 > 15) {\n m678b(b);\n mo446a(bkVar.f539c);\n } else {\n m686d(b | ((s - s2) << 4));\n }\n this.f519n = bkVar.f539c;\n }", "private static void m831a(C0741g<?> gVar, C0747b bVar) {\n gVar.mo9477a(C0743i.f718b, (C0739e<? super Object>) bVar);\n gVar.mo9476a(C0743i.f718b, (C0738d) bVar);\n gVar.mo9474a(C0743i.f718b, (C0736b) bVar);\n }", "public interface C40453c {\n /* renamed from: a */\n void mo100442a(C40429b bVar);\n\n /* renamed from: a */\n void mo100443a(List<String> list);\n\n /* renamed from: b */\n void mo100444b(List<C40429b> list);\n}", "private void j()\n/* */ {\n/* 223 */ c localc = this.b;\n/* 224 */ this.b = this.c;\n/* 225 */ this.c = localc;\n/* 226 */ this.c.b();\n/* */ }", "public lj ar(byte b) {\n throw new Runtime(\"d2j fail translate: java.lang.RuntimeException: can not merge I and Z\\r\\n\\tat com.googlecode.dex2jar.ir.TypeClass.merge(TypeClass.java:100)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeRef.updateTypeClass(TypeTransformer.java:174)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.provideAs(TypeTransformer.java:780)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.e1expr(TypeTransformer.java:496)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:713)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:703)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.enexpr(TypeTransformer.java:698)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:719)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:703)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.s1stmt(TypeTransformer.java:810)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.sxStmt(TypeTransformer.java:840)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.analyze(TypeTransformer.java:206)\\r\\n\\tat com.googlecode.dex2jar.ir.ts.TypeTransformer.transform(TypeTransformer.java:44)\\r\\n\\tat com.googlecode.d2j.dex.Dex2jar$2.optimize(Dex2jar.java:162)\\r\\n\\tat com.googlecode.d2j.dex.Dex2Asm.convertCode(Dex2Asm.java:414)\\r\\n\\tat com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:42)\\r\\n\\tat com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:128)\\r\\n\\tat com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:509)\\r\\n\\tat com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:406)\\r\\n\\tat com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:422)\\r\\n\\tat com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:172)\\r\\n\\tat com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:272)\\r\\n\\tat com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:108)\\r\\n\\tat com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288)\\r\\n\\tat com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)\\r\\n\");\n }", "public interface AbstractC10485b {\n /* renamed from: a */\n void mo64153a(boolean z);\n }", "public interface C40108b {\n /* renamed from: a */\n void mo99838a(boolean z);\n }", "interface C8361a {\n /* renamed from: b */\n float mo18284b(ViewGroup viewGroup, View view);\n\n /* renamed from: c */\n float mo18281c(ViewGroup viewGroup, View view);\n }" ]
[ "0.64558864", "0.6283203", "0.6252635", "0.6250949", "0.6244743", "0.6216273", "0.6194491", "0.6193556", "0.61641675", "0.6140157", "0.60993093", "0.60974354", "0.6077849", "0.6001867", "0.5997364", "0.59737104", "0.59737104", "0.5905105", "0.5904295", "0.58908087", "0.5886636", "0.58828026", "0.5855491", "0.584618", "0.5842517", "0.5824137", "0.5824071", "0.58097327", "0.5802052", "0.58012927", "0.579443", "0.5792392", "0.57902914", "0.5785124", "0.57718205", "0.57589084", "0.5735892", "0.5735892", "0.5734873", "0.5727929", "0.5720821", "0.5712531", "0.5706813", "0.56896514", "0.56543154", "0.5651059", "0.5649904", "0.56496733", "0.5647035", "0.5640965", "0.5640109", "0.563993", "0.5631903", "0.5597427", "0.55843794", "0.5583287", "0.557783", "0.55734867", "0.55733293", "0.5572254", "0.55683887", "0.55624336", "0.55540246", "0.5553985", "0.55480546", "0.554261", "0.5535739", "0.5529958", "0.5519634", "0.5517503", "0.55160624", "0.5511545", "0.5505353", "0.5500533", "0.5491741", "0.5486198", "0.5481978", "0.547701", "0.54725856", "0.5471632", "0.5463497", "0.5460805", "0.5454913", "0.5454885", "0.54519916", "0.5441594", "0.5436747", "0.5432453", "0.5425923", "0.5424724", "0.54189867", "0.54162544", "0.54051477", "0.53998184", "0.53945845", "0.53887725", "0.5388146", "0.5387678", "0.53858143", "0.53850687", "0.5384439" ]
0.0
-1
/ renamed from: d
static void m6826d() { throw new NoSuchMethodError(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void d() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "public int d()\r\n/* 79: */ {\r\n/* 80:82 */ return this.d;\r\n/* 81: */ }", "public String d_()\r\n/* 445: */ {\r\n/* 446:459 */ return \"container.inventory\";\r\n/* 447: */ }", "public abstract int d();", "private void m2248a(double d, String str) {\n this.f2954c = d;\n this.f2955d = (long) d;\n this.f2953b = str;\n this.f2952a = ValueType.doubleValue;\n }", "public int d()\n {\n return 1;\n }", "public interface C19512d {\n /* renamed from: dd */\n void mo34676dd(int i, int i2);\n }", "void mo21073d();", "@Override\n public boolean d() {\n return false;\n }", "int getD();", "public void dor(){\n }", "public int getD() {\n\t\treturn d;\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public String getD() {\n return d;\n }", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "public final void mo91715d() {\n }", "public D() {}", "void mo17013d();", "public int getD() {\n return d_;\n }", "void mo83705a(C32458d<T> dVar);", "public void d() {\n\t\tSystem.out.println(\"d method\");\n\t}", "public float d()\r\n/* 15: */ {\r\n/* 16:163 */ return this.b;\r\n/* 17: */ }", "double d();", "protected DNA(Population pop, DNA d) {\n\t\t// TODO: implement this\n\t}", "public ahb(ahd paramahd)\r\n/* 12: */ {\r\n/* 13: 36 */ this.d = paramahd;\r\n/* 14: */ }", "public abstract C17954dh<E> mo45842a();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\tpublic void visitTdetree(Tdetree p) {\n\n\t}", "public abstract void mo56925d();", "void mo54435d();", "public void mo21779D() {\n }", "public void d() {\n this.f20599d.a(this.f20598c);\n this.f20598c.a(this);\n this.f20601f = new a(new d());\n d.a(this.f20596a, this.f20597b, this.f20601f);\n this.f20596a.setLayoutManager(new NPALinearLayoutManager(getContext()));\n ((s) this.f20596a.getItemAnimator()).setSupportsChangeAnimations(false);\n this.f20596a.setAdapter(this.f20601f);\n this.f20598c.a(this.f20602g);\n }", "@Override\r\n public String getStringRepresentation()\r\n {\r\n return \"D\";\r\n }", "void mo28307a(zzgd zzgd);", "List<String> d();", "d(l lVar, m mVar, b bVar) {\n super(mVar);\n this.f11484d = lVar;\n this.f11483c = bVar;\n }", "public void addDField(String d){\n\t\tdfield.add(d);\n\t}", "public int getD() {\n return d_;\n }", "public void mo3749d() {\n }", "public a dD() {\n return new a(this.HG);\n }", "public String amd_to_dma(java.sql.Date d)\n {\n String resp = \"\";\n if (d!=null)\n {\n String sdat = d.toString();\n String sano = sdat.substring(0,4);\n String smes = sdat.substring(5,7);\n String sdia = sdat.substring(8,10);\n resp = sdia+\"/\"+smes+\"/\"+sano;\n }\n return resp;\n }", "public void mo130970a(double d) {\n SinkDefaults.m149818a(this, d);\n }", "public abstract int getDx();", "public void mo97908d() {\n }", "public com.c.a.d.d d() {\n return this.k;\n }", "private static String toPsString(double d) {\n return \"(\" + d + \")\";\n }", "public boolean d() {\n return false;\n }", "void mo17023d();", "String dibujar();", "@Override\n\tpublic void setDurchmesser(int d) {\n\n\t}", "public void mo2470d() {\n }", "public abstract VH mo102583a(ViewGroup viewGroup, D d);", "public abstract String mo41079d();", "public void setD ( boolean d ) {\n\n\tthis.d = d;\n }", "public Dx getDx() {\n/* 32 */ return this.dx;\n/* */ }", "DoubleNode(int d) {\n\t data = d; }", "DD createDD();", "@java.lang.Override\n public float getD() {\n return d_;\n }", "public void setD(String d) {\n this.d = d == null ? null : d.trim();\n }", "public int d()\r\n {\r\n return 20;\r\n }", "public static int m22546b(double d) {\n return 8;\n }", "float getD();", "void mo12650d();", "String mo20732d();", "static void feladat4() {\n\t}", "@Override\n public void d(String TAG, String msg) {\n }", "void mo130799a(double d);", "public void mo2198g(C0317d dVar) {\n }", "private double convert(double d){\n\t\tDecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance();\n\t\tsymbols.setDecimalSeparator('.');\n\t\tDecimalFormat df = new DecimalFormat(\"#.##\",symbols); \n\t\treturn Double.valueOf(df.format(d));\n\t}", "public void d(String str) {\n ((b.b) this.b).g(str);\n }", "public abstract void mo42329d();", "public abstract long mo9229aD();", "public abstract String getDnForPerson(String inum);", "public interface ddd {\n public String dan();\n\n}", "@Override\n public void func_104112_b() {\n \n }", "public Nodo (String d){\n\t\tthis.dato = d;\n\t\tthis.siguiente = null; //para que apunte el nodo creado a nulo\n\t}", "public void mo5117a(C0371d c0371d, double d) {\n new C0369b(this, c0371d, d).start();\n }", "public interface C27442s {\n /* renamed from: d */\n List<EffectPointModel> mo70331d();\n}", "public final void m22595a(double d) {\n mo4383c(Double.doubleToRawLongBits(d));\n }", "public void d() {\n this.f23522d.a(this.f23521c);\n this.f23521c.a(this);\n this.i = new a();\n this.i.a(new ae(this.f23519a));\n this.f23519a.setAdapter(this.i);\n this.f23519a.setOnItemClickListener(this);\n this.f23521c.e();\n this.h.a(hashCode(), this.f23520b);\n }", "public Vector2d(double d) {\n\t\tthis.x = d;\n\t\tthis.y = d;\n\t}", "DomainHelper dh();", "static double DEG_to_RAD(double d) {\n return d * Math.PI / 180.0;\n }", "private Pares(PLoc p, PLoc s, int d){\n\t\t\tprimero=p;\n\t\t\tsegundo=s;\n\t\t\tdistancia=d;\n\t\t}", "@java.lang.Override\n public float getD() {\n return d_;\n }", "private final VH m112826b(ViewGroup viewGroup, D d) {\n return mo102583a(viewGroup, d);\n }", "public void m25658a(double d) {\n if (d <= 0.0d) {\n d = 1.0d;\n }\n this.f19276f = (float) (50.0d / d);\n this.f19277g = new C4658a(this, this.f19273c);\n }", "public Double getDx();", "boolean hasD();", "public abstract void mo27386d();", "MergedMDD() {\n }", "@ReflectiveMethod(name = \"d\", types = {})\n public void d(){\n NMSWrapper.getInstance().exec(nmsObject);\n }", "@Override\n public Chunk d(int i0, int i1) {\n return null;\n }", "public void d(World paramaqu, BlockPosition paramdt, Block parambec)\r\n/* 47: */ {\r\n/* 48: 68 */ BlockPosition localdt = paramdt.offset(((EnumDirection)parambec.getData(a)).opposite());\r\n/* 49: 69 */ Block localbec = paramaqu.getBlock(localdt);\r\n/* 50: 70 */ if (((localbec.getType() instanceof bdq)) && (((Boolean)localbec.getData(bdq.b)).booleanValue())) {\r\n/* 51: 71 */ paramaqu.g(localdt);\r\n/* 52: */ }\r\n/* 53: */ }", "double defendre();", "public static int setDimension( int d ) {\n int temp = DPoint.d;\n DPoint.d = d;\n return temp;\n }", "public Datum(Datum d) {\n this.dan = d.dan;\n this.mesec = d.mesec;\n this.godina = d.godina;\n }", "public Nodo (String d, Nodo n){\n\t\tdato = d;\n\t\tsiguiente=n;\n\t}" ]
[ "0.63814974", "0.6161482", "0.6071298", "0.59962976", "0.58773404", "0.58716977", "0.58259004", "0.5758642", "0.5701838", "0.5660324", "0.56520164", "0.56360936", "0.5623887", "0.56160694", "0.5611214", "0.5611214", "0.5606199", "0.5599611", "0.5588785", "0.5571922", "0.55582964", "0.55423015", "0.55344766", "0.5533354", "0.55043095", "0.5504303", "0.5501346", "0.5494267", "0.5475417", "0.5466324", "0.5449285", "0.54475653", "0.54453534", "0.5438683", "0.5437", "0.5430767", "0.5427588", "0.54237705", "0.54230636", "0.5418128", "0.5418011", "0.5408366", "0.5393063", "0.5391241", "0.5380766", "0.53726333", "0.5368622", "0.536752", "0.5353385", "0.53531873", "0.5339773", "0.53326386", "0.5326814", "0.5324123", "0.53218675", "0.53191435", "0.5317969", "0.53118885", "0.52981716", "0.52759254", "0.5271429", "0.5261579", "0.52474463", "0.52447283", "0.5244465", "0.524065", "0.52404076", "0.5233004", "0.5231902", "0.52317077", "0.52313095", "0.52206594", "0.52147377", "0.5212631", "0.520846", "0.5204979", "0.51949364", "0.5192334", "0.5187471", "0.5181762", "0.5178257", "0.51717854", "0.5165535", "0.516073", "0.5158238", "0.515774", "0.5157613", "0.51567996", "0.51565725", "0.51556337", "0.51544553", "0.51538175", "0.5150055", "0.5143673", "0.5142951", "0.5139338", "0.51383114", "0.5132878", "0.51298827", "0.5126112", "0.51213324" ]
0.0
-1
/ return true if there is a win
public static boolean craps() { int dice1 = rollDice(); int dice2 = rollDice(); int sum = dice1 + dice2; if(sum == 2 || sum == 3 || sum == 12) { return false; } else if(sum == 7 || sum == 11) { return true; } else { int points = sum; do { dice1 = rollDice(); dice2 = rollDice(); sum = dice1 + dice2; } while( sum != 7 && sum != points); if(sum == points) return true; else return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean hasWin();", "public boolean CheckWin(){\n\t return false;\n\t }", "public boolean isWin() {\n return win;\n }", "public final boolean checkForWin() {\r\n boolean result = false;\r\n String player = \"\";\r\n \r\n for (Rail rail : rails) {\r\n if (rail.isWinner()) {\r\n result = true;\r\n for(Tile tile : rail.getTiles()) {\r\n tile.setBackground(Color.GREEN);\r\n player = tile.getText();\r\n }\r\n if (player.equals(\"X\")) {\r\n winningPlayer = \"X\";\r\n this.xWins++;\r\n } else if (player.equals(\"0\")) {\r\n winningPlayer = \"0\";\r\n this.oWins++;\r\n }\r\n break;\r\n }\r\n }\r\n \r\n return result;\r\n }", "protected boolean checkForWin() {\r\n \t\r\n if (squaresRevealed == this.width * this.height - this.mines) {\r\n finishFlags();\r\n finish(GameStateModel.WON);\r\n return true;\r\n } \t\r\n \t\r\n return false;\r\n \t\r\n }", "public final boolean isWin() {\n\t\treturn isWin;\n\t}", "private boolean winGame() {\n if (model.isCompleted()) {\n win.message(\"Winner\");\n return true;\n }\n return false;\n }", "public boolean checkForWin(){\n\t\t\n\t\tPlayer p = Game.getCurrPlayer();\n\t\t// if player made it to win area, player won\n\t\tif(p.won()){\n\t\t\tGame.gameWon = true;\n\t\t\tthis.network.sendWin();\n\t\t\treturn true;\n\t\t}\n\t\t// if player is the last player on the board, player won\n\t\tif(numPlayers == 1 && !p.hasBeenKicked()){\n\t\t\tGame.gameWon = true;\n\t\t\tthis.network.sendWin();\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public boolean checkWin() {\r\n\t\tif (checkAcross() || checkDiagonal() || checkUpDown()) {\r\n\t\t\t//win = true;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "boolean checkWin(Tile initialTile);", "private void checkWin() {\n // Check if a dialog is already displayed\n if (!this.gameOverDisplayed) {\n // Check left paddle\n if (Objects.equals(this.scoreL.currentScore, this.winCount) && (this.scoreL.currentScore != 0)) {\n if (twoUser) {\n gameOver(GeneralFunctions.TWO_1_WIN);\n } else {\n gameOver(GeneralFunctions.ONE_LOSE);\n }\n // Right paddle\n } else if (Objects.equals(this.scoreR.currentScore, this.winCount) && (this.scoreR.currentScore != 0)) {\n if (twoUser) {\n gameOver(GeneralFunctions.TWO_2_WIN);\n } else {\n gameOver(GeneralFunctions.ONE_WIN);\n }\n }\n }\n }", "public void checkWin(){\n boolean result = false;\n if(game.getTurn() > 3){\n Player currentPlayer = game.getPlayerTurn();\n int playernumber = currentPlayer.getPlayericon();\n result = game.winChecker(game.getBored(),playernumber);\n if(result == true) {\n setWinMsgBox(currentPlayer.getPlayerName() + \" Is victorious :)\",\"WIN\");\n }else if(game.getTurn() == 8 && result == false){\n setWinMsgBox(\"Too bad it is a draw, No one out smarted the other -_-\",\"DRAW\");\n }else{}\n }else{\n result = false;\n }\n }", "public boolean didWin(){\n\t\tswitch(winCondition){\n\t\tcase \"catchEmAll\":\n\t\t\treturn caughtEmAll();\n\t\tdefault:\n\t\t\treturn caughtTwenty();\n\t\t}\n\t}", "public boolean winState() {\n\t\treturn this.numTargets == this.onTargets;\n\t}", "public static void checkWinCondition() {\n\t\twin = false;\n\t\tif (curPlayer == 1 && arrContains(2, 4))\n\t\t\twin = true;\n\t\telse if (curPlayer == 2 && arrContains(1, 3))\n\t\t\twin = true;\n\t\tif (curPlayer == 2 && !gameLogic.Logic.arrContains(2, 4))\n\t\t\tP2P.gameLost = true;\n\t\telse if (gameLogic.Logic.curPlayer == 1 && !gameLogic.Logic.arrContains(1, 3))\n\t\t\tP2P.gameLost = true;\n\t\tif (P2P.gameLost == true) {\n\t\t\tif (gameLogic.Logic.curPlayer == 1)\n\t\t\t\tEndScreen.infoWindow.setText(\"<html><center><b><font size=25 color=black> Black player won! </font></b></center></html>\");\n\t\t\telse\n\t\t\t\tEndScreen.infoWindow.setText(\"<html><center><b><font size=25 color=black> Red player won! </font></b></center></html>\");\n\t\t}\n\t\telse\n\t\t\twin = false;\n\t}", "public boolean hasWin() {\n return ((bitField0_ & 0x00000004) == 0x00000004);\n }", "public boolean isWin() {\n\t\t\n\t\tboolean win = true;\n\t\t\n\t\tfor(int i = 0; i < numTiles - 2; i++) {\n\t\t\twin = win && (boardConfig[i] < boardConfig[i+1]);\n\t\t}\n\t\t\n\t\twin = win && (boardConfig[numTiles - 1] == 0);\n\t\t\n\t\treturn win;\n\t}", "public boolean didLastMoveWin(){\n\t\tboolean flag=false;\n\t\tif(horizontalWin()){\n\t\t\tSystem.out.println(\"You Won\");\n\t\t\tflag=true;\n\t\t}\n\t\tif(verticalWin()){\n\t\t\tSystem.out.println(\"You Won\");\n\t\t\tflag=true;\n\t\t}\n\t\tif(diagonalWin()){\n\t\t\tSystem.out.println(\"You Won\");\n\t\t\tflag=true;\n\t\t}\n\t\treturn flag;\n\t}", "public boolean hasWin() {\n return ((bitField0_ & 0x00000004) == 0x00000004);\n }", "public boolean checkWin() {\n for (int i = 0; i <= 7; i++) {\n for (int j = 0; j <= 4; j++) {\n if (grid[i][j].equals(\"X\") && grid[i][j + 1].equals(\"X\") && grid[i][j + 2].equals(\"X\") && grid[i][j + 3].equals(\"X\")) {\n return true;\n }\n\n\n }\n\n }\n return false;\n }", "public boolean getWin() {\n if (targetDistance == 25) {\n if (missDistance <= 1 && missDistance >= -1) { //checks 25m win\n return true;\n }\n else {\n return false;\n }\n }\n else if (targetDistance == 50) { //checks 50m win\n if (missDistance <= 2 && missDistance >= -2) {\n return true;\n }\n else {\n return false;\n }\n }\n else { //checks 100m win\n if (missDistance <= 3 && missDistance >= -3) {\n return true;\n }\n else {\n return false;\n }\n }\n }", "public boolean meWin(){\n return whitePieces.size() > blackPieces.size() && isWhitePlayer;\n }", "private static boolean checkWin() {\n\t\tfor (int i = 0; i < nRows; i++)\n\t\t\tfor (int j = 0; j < nColumns; j++) {\n\t\t\t\tCell cell = field.getCellAt(i, j);\n\t\t\t\tif (cell.hasMine() && !cell.hasSign())\t // if the cell has a mine\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// but has no flag\n\t\t\t\t\treturn false;\n\t\t\t\tif (cell.getFlag() >= 0 && !cell.getVisiblity()) // if the cell has no\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// mine in it but\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// it is not visible\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\twin = gameOver = true;\n\t\treturn true;\n\t}", "public boolean isWin() {\n if (chosen_door.getContains() == Contains.CAR) {\n return true;\n }\n return false;\n }", "public boolean win() {\n for (int i = 0; i < getBoard().length; i++) {\n for (int j = 0; j < getBoard()[i].length; j++) {\n if (!getBoard(i, j).getClicked() && !getBoard(i, j).getMine()) {\n return false;\n }\n }\n }\n for (int i = 0; i < getBoard().length; i++) {\n for (int j = 0; j < getBoard()[i].length; j++) {\n if (getBoard(i, j).getMine()) {\n getBoard(i, j).setFlagged();\n getBoard(i, j).repaint();\n }\n }\n }\n return true;\n }", "public boolean isWin() {\n int counter = 0;\n\n for (int num : maskResultArray) {\n if (num == 1) counter++;\n }\n\n if (counter == 4) return true;\n return false;\n }", "private static boolean isWin()\n {\n boolean win = true;\n for(Ship[] k:map)\n {\n for(Ship o:k)\n {\n if(o.getState()==1)\n win=false;\n }\n }\n return win;\n }", "public boolean checkWin()\n {\n boolean won = false;\n\n // Checks for the wining condition, if true end game. Else keep running.\n if((getPerson(PLAYER).getInventory().getItems().contains(winItem) && getPerson(PLAYER).getLocation().getName().equals(STARTROOM))||(moves > MOVELIMIT)){\n won = true;\n\n // Checks if the player won, then print a player winning statement.\n if (moves > MOVELIMIT){\n System.out.println(\"Princess Peach: \"+ getPerson(PLAYER).getName() + \", you have run out of time, Rover has ran away.\");\n }\n else{\n System.out.println(\"Princess Peach:\"+ getPerson(PLAYER).getName() + \", You've found the \" + winItem.getName() + \"!\");\n printEndingStory();\n }\n\n } \n return won;\n }", "public boolean isWinTurn() {\n for (int col = 0; col < mColsCount; col++) {\n if (isFourConnected(getCurrentPlayer(), 0, 1, 0, col, 0)\n || isFourConnected(getCurrentPlayer(), 1, 1, 0, col, 0)\n || isFourConnected(getCurrentPlayer(), -1, 1, 0, col, 0)) {\n hasWinner = true;\n return true;\n }\n }\n\n for (int row = 0; row < mRowsCount; row++) {\n if (isFourConnected(getCurrentPlayer(), 1, 0, row, 0, 0)\n || isFourConnected(getCurrentPlayer(), 1, 1, row, 0, 0)\n || isFourConnected(getCurrentPlayer(), -1, 1, row, mColsCount - 1, 0)) {\n hasWinner = true;\n return true;\n }\n }\n\n return false;\n }", "private boolean checkWinner() {\n\t\tboolean frontDiagWin = !myBoard.isEmpty(0, 0);\n\t\tchar frontDiagToken = myBoard.getCell(0, 0);\n\t\tboolean backDiagWin = !myBoard.isEmpty(0, Board.BOARD_SIZE - 1);\n\t\tchar backDiagToken = myBoard.getCell(0, Board.BOARD_SIZE - 1);\n\t\tfor (int i = 0; i < Board.BOARD_SIZE; i++) {\n\t\t\t// check Diagonals\n\t\t\tfrontDiagWin = myBoard.getCell(i, i) == frontDiagToken ? frontDiagWin\n\t\t\t\t\t: false;\n\t\t\tbackDiagWin = myBoard.getCell(i, (Board.BOARD_SIZE - 1) - i) == backDiagToken ? backDiagWin\n\t\t\t\t\t: false;\n\t\t\t// check Rows and Columns\n\t\t\tboolean rowWin = !myBoard.isEmpty(i, 0);\n\t\t\tchar startRowToken = myBoard.getCell(i, 0);\n\t\t\tboolean colWin = !myBoard.isEmpty(0, i);\n\t\t\tchar startColToken = myBoard.getCell(0, i);\n\t\t\tfor (int j = 0; j < Board.BOARD_SIZE; j++) {\n\t\t\t\trowWin = myBoard.getCell(i, j) == startRowToken ? rowWin\n\t\t\t\t\t\t: false;\n\t\t\t\tcolWin = myBoard.getCell(j, i) == startColToken ? colWin\n\t\t\t\t\t\t: false;\n\t\t\t}\n\t\t\tif (rowWin || colWin) {\n\t\t\t\tSystem.out.println(\"\\\"\"\n\t\t\t\t\t\t+ (rowWin ? startRowToken : startColToken)\n\t\t\t\t\t\t+ \"\\\" wins the game!\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tif (frontDiagWin || backDiagWin) {\n\t\t\tSystem.out.println(\"\\\"\"\n\t\t\t\t\t+ (frontDiagWin ? frontDiagToken : backDiagToken)\n\t\t\t\t\t+ \"\\\" wins the game!\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean checkGameStatus() {\n int res = model.getWinner();\n if (res == Model.DRAW) {\n draw();\n return false;\n } else if (res == Model.WHITE) {\n whiteScore++;\n view.getPrompt().setText(whiteName + \" win!\");\n prepareRestart();\n return false;\n } else if (res == Model.BLACK) {\n blackScore++;\n view.getPrompt().setText(blackName + \" win!\");\n prepareRestart();\n return false;\n }\n return true;\n }", "public boolean checkWin() throws Exception {\r\n\t\treturn getOcean().checkWin();\r\n\t}", "public boolean win(){\r\n for(int row = 0; row<map.length; row++){\r\n for(int col = 0; col<map[0].length; col++){\r\n if(map[row][col].getSafe() == false && (map[row][col].getVisual().equals(square) || map[row][col].getVisual().equals(bomb))){\r\n return false;\r\n }\r\n if(map[row][col].getSafe() == true && map[row][col].getVisual().equals(flag)){\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }", "boolean isWinner() {\n boolean win = true;\n // first method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if ((state[i][j] == 'X' && stateGame[i][j] != '*') || (state[i][j] != 'X' && stateGame[i][j] == '*'))\n win = false;\n }\n }\n if (win)\n return true;\n\n win = true;\n // second method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if (state[i][j] == '.' && stateGame[i][j] == '.')\n win = false;\n }\n }\n return win;\n }", "private boolean gameOver()\n {\n \t//lose case\n \tif (guess_number == 0)\n \t{\n \t\twin = false;\n \t\treturn true;\n \t}\n \t//win case\n \tif (mask.compareTo(word) == 0)\n \t{\n \t\twin = true;\n \t\treturn true;\n \t}\n \t\n \treturn false;\n }", "private boolean checkIfGameIsWon() {\n\t\t//loop through rows\n\t\tfor (int i = 0; i < NUMBER_OF_ROWS; i++) {\n\t\t\t//gameIsWon = this.quartoBoard.checkRow(i);\n\t\t\tif (this.quartoBoard.checkRow(i)) {\n\t\t\t\tSystem.out.println(\"Win via row: \" + (i) + \" (zero-indexed)\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//loop through columns\n\t\tfor (int i = 0; i < NUMBER_OF_COLUMNS; i++) {\n\t\t\t//gameIsWon = this.quartoBoard.checkColumn(i);\n\t\t\tif (this.quartoBoard.checkColumn(i)) {\n\t\t\t\tSystem.out.println(\"Win via column: \" + (i) + \" (zero-indexed)\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//check Diagonals\n\t\tif (this.quartoBoard.checkDiagonals()) {\n\t\t\tSystem.out.println(\"Win via diagonal\");\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "@Override\n public boolean isWin() {\n for (Observer winner : winners) {\n if (winner.getName().equals(chosenHorse.getName())) {\n return true;\n }\n }\n return false;\n }", "private boolean playerWin(Board board)\n {\n return check(board, PLAYER);\n }", "public boolean oWins() {\n\t\tif (checkWinner(LETTER_O) == 1)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t}", "public boolean xWins() {\n\t\tif (checkWinner(LETTER_X) == 1)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t}", "public void checkWin() \n {\n if (lWin ==8)\n {\n Greenfoot.playSound(\"finalWin.wav\");\n setLocation(getWorld().getWidth() / 2, getWorld().getHeight() / 2);\n setImage(win);\n Greenfoot.stop();\n \n \n }\n \n if (rWin ==8)\n {\n \n \n Greenfoot.playSound(\"finalWin.wav\");\n setLocation(getWorld().getWidth() / 2, getWorld().getHeight() / 2);\n setImage(win);\n \n Greenfoot.stop();\n \n \n \n \n \n }\n \n }", "private boolean checkForBigGameWin(){\n boolean truth = false;\n if (checkGameWin(getLettersOfAllGames())){\n truth = true;\n }\n return truth;\n }", "boolean checkWin() {\n Iterator<Integer> seq = sequence.iterator();\n Iterator<Integer> in = input.iterator();\n\n while (seq.hasNext() && in.hasNext()) {\n seq.next();\n in.next();\n if (!seq.hasNext() && !in.hasNext()) {\n return true;\n }\n }\n return false;\n }", "private boolean checkIfGameIsWon() {\n\n //loop through rows\n for(int i = 0; i < NUMBER_OF_ROWS; i++) {\n //gameIsWon = this.quartoBoard.checkRow(i);\n if (this.quartoBoard.checkRow(i)) {\n System.out.println(\"Win via row: \" + (i) + \" (zero-indexed)\");\n return true;\n }\n\n }\n //loop through columns\n for(int i = 0; i < NUMBER_OF_COLUMNS; i++) {\n //gameIsWon = this.quartoBoard.checkColumn(i);\n if (this.quartoBoard.checkColumn(i)) {\n System.out.println(\"Win via column: \" + (i) + \" (zero-indexed)\");\n return true;\n }\n\n }\n\n //check Diagonals\n if (this.quartoBoard.checkDiagonals()) {\n System.out.println(\"Win via diagonal\");\n return true;\n }\n\n return false;\n }", "public void winGame() {\n this.isWinner = true;\n }", "public boolean amIWinning(){\n if (playerScore > oppoScore) {\n return true;\n } else {\n return false;\n }\n }", "public boolean gameOver() {\n return winner() != null;\n }", "boolean winGame();", "public void win()\r\n\t{\r\n\t\tmWon = true;\r\n\t}", "private boolean computerWin(Board board)\n {\n return check(board, COMPUTER);\n }", "public void checkIfWinOrDraw() {\r\n\t\tif (theModel.getIsDraw() == true) {\r\n\t\t\tDrawNum++;\r\n\t\t\tactivePlayer = winningPlayer;\r\n\t\t\t// cards go to communalPile\r\n\r\n\t\t} else {\r\n\t\t\ttheModel.winningCard(winningPlayer);\r\n\t\t\ttheModel.transferWinnerCards(winningPlayer);\r\n\t\t}\r\n\r\n\t}", "private void winConditionCheck()\r\n {\r\n boolean win;\r\n char mark;\r\n for(int row = 0; row < 3; row++)\r\n {\r\n win = true;\r\n mark = buttons[row][0].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int column = 0; column < 3; column++)\r\n {\r\n if(mark != buttons[row][column].getText().charAt(0))\r\n {\r\n win = false;\r\n break;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n }\r\n for(int column = 0; column < 3; column++)\r\n {\r\n win = true;\r\n mark = buttons[0][column].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int row = 0; row < 3; row++)\r\n {\r\n if(mark != buttons[row][column].getText().charAt(0))\r\n {\r\n win = false;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n }\r\n win = false;\r\n mark = buttons[0][0].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int i = 0; i < 3; i++)\r\n {\r\n if(buttons[i][i].getText().charAt(0) != mark)\r\n {\r\n win = false;\r\n break;\r\n }\r\n else\r\n {\r\n win = true;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n mark = buttons[1][1].getText().charAt(0);\r\n if((buttons[0][2].getText().charAt(0) == buttons[1][1].getText().charAt(0)) && (buttons[1][1].getText().charAt(0) == buttons[2][0].getText().charAt(0)) && (buttons[1][1].getText().charAt(0) != ' '))\r\n {\r\n gameEnd(mark);\r\n }\r\n }", "protected boolean checkWin(int pno) {\n\t\tint[] pos = playerPosition.get(pno);\n\t\tif (collectedGold.get(pno) >= map.getWin() && \n\t\t\t\tmap.lookAtTile(pos[0], pos[1]) == 'E') {\n\t\t\tremovePlayer(pno);\n\t\t\tSystem.out.println(\"Client \" + pno + \" has escaped!\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean winGame() {\n\t\tfor(int i = 0; i < board[0].length; i++) {\n\t\t\tfor(int j = 0; j < board[1].length; j++) {\n\t\t\t\tif(board[i][j] == \"-\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "private boolean didPlayerWin() {\r\n for (int i = 0; i < targets.length; i++) {\r\n if (targets[i].getHitPoints() != 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "private void checkVictory() {\n\t\tboolean currentWin = true;\n\t\t\n\t\t//Vertical win\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][yGuess] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Horizontal win\n\t\tcurrentWin = true;\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[xGuess][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Top left bottom right diagonal win\n\t\tcurrentWin = true;\n\t\tif (xGuess == yGuess){\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t}\n\t\t\n\t\t//Bottom left top right diagonal win\n\t\tcurrentWin = true;\n\t\tif (yGuess + xGuess == DIVISIONS - 1){\n\t\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\t\tif (gameArray[i][(DIVISIONS - 1) -i] != currentPlayer){\n\t\t\t\t\tcurrentWin = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (currentWin){\n\t\t\t\tgameWon = true;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public final boolean checkForDraw() {\r\n boolean result = false;\r\n String player = \"\";\r\n \r\n for (Rail rail : rails) {\r\n if (rail.isWinner()) {\r\n return false;\r\n }\r\n }\r\n \r\n if (tilesPlayed == 9) {\r\n draws++;\r\n // window.getStatusMsg().setText(DRAW_MSG); \r\n result = true;\r\n }\r\n \r\n return result;\r\n }", "private boolean rowWin (){ \r\n\t\tfor (int i=0; i<3; i++){ \r\n\t\t\tif (checkValue (board[i][0], board[i][1], board[i][2])){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false; \r\n\t}", "public boolean wins (char symbol){\n if (winsByRow(symbol) || winsByCol(symbol) || winsByDiagonalTopRightToBottomLeft(symbol) || winsByDiagonalTopLeftToBottomRight(symbol)){\n return true;\n }\n else {\n return false;\n }\n\n }", "public boolean checkWin (int totalPieces){\n\t\treturn isFull();\n\t}", "boolean horizontalWin(){\n\t\tint match_counter=1;\n\t\tboolean flag=false;\n\t\tfor(int row=0;row<9;row++){\n\t\t\tfor(int column=0;column<25;column++){\n\t\t\t\tif(Board[row][column]!='\\u0000'){\n\t\t\t\t\tif(Board[row][column]!='O'){\n\t\t\t\t\t\tif (Board[row][column]==Board[row][column+1]){\n\t\t\t\t\t\t\tmatch_counter++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(match_counter==4){\n\t\t\t\t\tflag=true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (flag == true)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn flag;\n\t}", "public boolean winner(){ \r\n\t\tif (rowWin() || colWin() || diagWin()){ \r\n\t\t\tchangeTurn(); \r\n\t\t\tSystem.out.println(\"Winner: \" + playerToString(currentTurn) + \"!\"); \r\n\t\t\treturn true; \r\n\t\t}\r\n\t\telse if (tie()){\r\n\t\t\tSystem.out.println(\"There is a tie.\");\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse{ \r\n\t\t\tSystem.out.println(\"No winner yet.\\n\"); \r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t}", "public boolean isWon() {\r\n\t\tif (winner(CROSS) || winner(NOUGHT))\r\n\t\t\treturn true;\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}", "public boolean checkWin(int move)\n\t{\n\t\tif (checkHorizontal(move) || checkVertical(move) || checkDiagonal(move))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean topPlayerWon() {\n return winner == 2;\n }", "private boolean isInGameWindow(){\n if (currPos.x > Window.getWidth() || currPos.y > Window.getHeight()){\n return false;\n }\n return true;\n }", "public boolean wonGame() {\n for (int x = 0; x < maxX; x++) {\n for (int y = 0; y < maxY; y++) {\n if (snakeSquares[x][y] == NOT_A_SEGMENT) {\n //there is still empty space on the screen, so haven't won\n return false;\n }\n }\n }\n //But if we get here, the snake has filled the screen. win!\n SnakeGame.setGameStage(SnakeGame.GAME_WON);\n\n return true;\n }", "private Boolean win(int counter) {\n \n winner = false;\n //if the counter is greater than 8, recognizes that it is a draw\n if (counter >= 8) {\n announce.setText(\"Draw\");\n turn.setText(\"\"); //game ends and is no ones turn\n }\n //list of all of the winning options\n if ((tBoard[0] == tBoard[1] && tBoard[1] == tBoard[2] && tBoard[0] != 2)\n || (tBoard[0] == tBoard[3] && tBoard[3] == tBoard[6] && tBoard[0] != 2)\n || (tBoard[3] == tBoard[4] && tBoard[4] == tBoard[5] && tBoard[3] != 2)\n || (tBoard[6] == tBoard[7] && tBoard[7] == tBoard[8] && tBoard[6] != 2)\n || (tBoard[1] == tBoard[4] && tBoard[4] == tBoard[7] && tBoard[1] != 2)\n || (tBoard[2] == tBoard[5] && tBoard[5] == tBoard[8] && tBoard[2] != 2)\n || (tBoard[0] == tBoard[4] && tBoard[4] == tBoard[8] && tBoard[0] != 2)\n || (tBoard[2] == tBoard[4] && tBoard[4] == tBoard[6] && tBoard[2] != 2)) {\n //if counter is even then recognizes that it is the person who has the X symbol and knows that X won \n if (counter % 2 == 0) {\n announce.setText(\"X is the Winner\"); //announces that X has won\n turn.setText(\"\"); //no ones turn anymore\n } //if it is not X, O has won the game and recognizes\n else {\n announce.setText(\"O is the Winner\"); //announces that O has won\n turn.setText(\"\"); //no ones turn anymore\n\n }\n //winner is set to true and stops allowing user to press other squares through pressed method\n winner = true;\n\n }\n //returns winner\n return winner;\n\n }", "public boolean isWon() {\n return getWinningScenario() != null;\n }", "boolean isWinner() {\n if(checkTopLeftDownDiag('X') || checkTopLeftDownDiag('O')) {\n return true;\n } else if (checkBottomLeftUpDiag('X') || checkBottomLeftUpDiag('O')) {\n return true;\n } else if (checkRows('X') || checkRows('O')){\n return true;\n }\n else if (checkColumns('X') || checkColumns('O')){\n return true;\n }\n\n return false;\n }", "@Override\n\tpublic boolean playerWon() {\n\t\treturn lastPlayerWin;\n\t}", "public void win() {\n if (turn == 1) {\n p1.incrementLegs();\n if (p1.getLegs() == 5) {\n p1.incrementSets();\n p1.setLegs(0);\n p2.setSets(0);\n\n }\n if (p1LastScore > p1.getHighout()) {\n p1.setHighout(p1LastScore);\n\n }\n\n if (p1.getHighout() > OVERALL_HIGH_OUT) {\n OVERALL_HIGH_OUT = p1.getHighout();\n }\n } else if (turn == 2) {\n p2.incrementLegs();\n if (p2.getLegs() == 5) {\n p2.incrementSets();\n p2.setLegs(0);\n p1.setSets(0);\n\n }\n if (p2LastScore > p2.getHighout()) {\n p2.setHighout(p2LastScore);\n }\n\n if (p2.getHighout() > OVERALL_HIGH_OUT) {\n OVERALL_HIGH_OUT = p2.getHighout();\n }\n\n\n\n }\n changeFirstTurn();\n win = true;\n\n\n\n }", "private boolean winningBoard(char[][] board){\n for(int i = 0; i < boardHeight; i++ ){\n for(int j = 0; j < boardWidth; j++) {\n\n //if white was made it to the other side\n if(board[i][j] == 'P' && i == 0){\n return true;\n }\n\n //if black has made it to the other side\n if(board[i][j] == 'p' && i == boardHeight -1){\n return true;\n }\n }\n }\n //no winners\n return false;\n }", "private boolean isWin() {\n int continueCount = 1; // number of continue ticTacToees\n \t// west direction\n for (int x = xIndex - 1; x >= 0; x--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, yIndex, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// east direction\n for (int x = xIndex + 1; x <= ROWS; x++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, yIndex, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n \t\n \t// north direction\n for (int y = yIndex - 1; y >= 0; y--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(xIndex, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// south direction\n for (int y = yIndex + 1; y <= ROWS; y++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(xIndex, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n \t// northeast direction\n for (int x = xIndex + 1, y = yIndex - 1; y >= 0 && x <= COLS; x++, y--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// southeast direction\n for (int x = xIndex - 1, y = yIndex + 1; y <= ROWS && x >= 0; x--, y++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n \t// northwest direction\n for (int x = xIndex - 1, y = yIndex - 1; y >= 0 && x >= 0; x--, y--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// southwest direction\n for (int x = xIndex + 1, y = yIndex + 1; y <= ROWS && x <= COLS; x++, y++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n return false;\n }", "private boolean isOver() {\n for (Player player : players) {\n if (player.getHand().length == 0) {\n System.out.println(\"Player '\" + player.getName() + \"' won!\");\n winner = player.getID();\n return true;\n }\n }\n\n return false;\n }", "public boolean miniWin()\n {\n\treturn (jackpot()\n\t\t||( (! _fruits[0].equals(_fruits[1]))\n\t\t && (! _fruits[1].equals(_fruits[2]))\n\t\t && (! _fruits[0].equals(_fruits[2]))));\n }", "public boolean playerWins(){\n return playerFoundTreasure(curPlayerRow, curPlayerCol);\n }", "private void winCondition(){\n if(cleared==(int)grid.clearedToWin){\n winGame();\n }\n }", "static boolean canWin() throws GameActionException {\n\t\tfloat difference = 1000 - rc.getTeamVictoryPoints();\n\t\tif ((rc.getTeamBullets() / 10) >= difference) {\n\t\t\trc.donate(rc.getTeamBullets());\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}", "private boolean winner() {\n\t\t\n\t\tif(( gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_LEFT] + gameBoard[BTM_LEFT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_CENTER] + gameBoard[CTR_CENTER] + gameBoard[BTM_CENTER]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_CENTER] + gameBoard[BTM_RIGHT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_CENTER] + gameBoard[BTM_LEFT]) == P1_WINNER){\n\t\t\t//player 1 winner\n\t\t\twinner = P1_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_LEFT] + gameBoard[BTM_LEFT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_CENTER] + gameBoard[CTR_CENTER] + gameBoard[BTM_CENTER]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_CENTER] + gameBoard[BTM_RIGHT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_CENTER] + gameBoard[BTM_LEFT]) == P2_WINNER){\n\t\t\t//player 2 winner\n\t\t\twinner = P2_WINNER;\n\t\t}else if(gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT] + \n\t\t\t\t gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT] +\n\t\t\t\t gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT] == CAT){\n\t\t\t//cat winner player_1 goes first\n\t\t\twinner = CAT;\n\t\t}else if(gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT] + \n\t\t\t\t gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT] +\n\t\t\t\t gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT] == (CAT + 3)){\n\t\t\t//cat winner player_2 goes first\n\t\t\twinner = CAT;\n\t\t} \n\t\t\n\t\tif(winner > 0){\n\t\t\treturn true;//there is a winner\n\t\t}else{\n\t\t\treturn false;//still no winner yet\n\t\t}\t\n\t}", "public boolean checkForWin()\n {\n //Horizontal win\n for (int r = 0; r <= 5; r++)\n {\n for (int c = 0; c <= 3; c++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r] == player_turn &&\n current_board[c+2][r] == player_turn &&\n current_board[c+3][r] == player_turn)\n return true;\n }\n }\n //Vertical win\n for (int c = 0; c <= 6; c++)\n {\n for (int r = 0; r <= 2; r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c][r+1] == player_turn &&\n current_board[c][r+2] == player_turn &&\n current_board[c][r+3] == player_turn)\n return true;\n }\n }\n //Shortest diagonals/anti diagonals (cell length == 4)\n //postive slope\n if (current_board[0][2] == player_turn && current_board[1][3] == player_turn && current_board[2][4] == player_turn && current_board[3][5] == player_turn)\n return true;\n if (current_board[3][0] == player_turn && current_board[4][1] == player_turn && current_board[5][2] == player_turn && current_board[6][3] == player_turn)\n return true;\n //negative slope\n if (current_board[0][3] == player_turn && current_board[1][2] == player_turn && current_board[2][1] == player_turn && current_board[3][0] == player_turn)\n return true;\n if (current_board[3][5] == player_turn && current_board[4][4] == player_turn && current_board[5][3] == player_turn && current_board[6][2] == player_turn)\n return true;\n\n //Medium-length diagonals/anti diagonals (cell length == 5)\n //positive slope\n if (current_board[0][1] == player_turn && current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn)\n return true;\n if (current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn && current_board[4][5] == player_turn)\n return true;\n if (current_board[2][0] == player_turn && current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn)\n return true;\n if (current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn && current_board[6][4] == player_turn)\n return true;\n //negative slope\n if (current_board[0][4] == player_turn && current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn)\n return true;\n if (current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn && current_board[4][0] == player_turn)\n return true;\n if (current_board[2][5] == player_turn && current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn)\n return true;\n if (current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn && current_board[6][1] == player_turn)\n return true;\n\n //Longest diagonals/anti diagonals (cell length == 6)\n //positive slope\n for (int c=0, r=0; c <= 2 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n for (int c=1, r=0; c <= 3 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n //negative slope\n for (int c=0, r=5; c <= 2 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n for (int c=1, r=5; c <= 3 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n\n return false;\n }", "public boolean win(){\n\t\tint num=0;//number of the boxes are in the areas\n\t\tfor(int i=0;i<boxes.size();i++){\n\t\t\tbox a =boxes.get(i);\n\t\t\tfor(int j=0;j<areas.size();j++){\n\t\t\t\tarea b = areas.get(j);\n\t\t\t\tif(a.getX()==b.getX()&&a.getY()==b.getY()){//check whether all the boxes have been in the certain areas\n\t\t\t\t\t//System.out.println(j);\n\t\t\t\t\t//System.out.println(\"area: \"+j);\n\t\t\t\t\tb.emptyImage();//clear the original image of boxes\n\t\t\t\t a.setImage();//change to the colorful one\n\t\t\t\t\tnum++;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t//\t b.setImage(); \t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(num==areas.size()){//whether their number are same \n\t\t\tnum=0;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean hasWinner() {\n\t\tint[][] board = myGameBoard.getBoard();\n\t\t\n\t\t// check for vertical win\n\t\tfor(int i = 0; i < board[0].length; i++) {\n\t\t\tfor(int j = 0; j < board.length - 3; j++) {\n\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\tif(thisSlot == GameBoard.EMPTY) continue;\n\t\t\t\t\n\t\t\t\tif(thisSlot == board[j+1][i]) {\n\t\t\t\t\tif(thisSlot == board[j+2][i]) {\n\t\t\t\t\t\tif(thisSlot == board[j+3][i]) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for horizontal win\n\t\tfor(int i = 0; i < board[0].length - 3; i++) {\n\t\t\tfor(int j = 0; j < board.length; j++) {\n\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\tif(thisSlot == GameBoard.EMPTY) continue;\n\t\t\t\t\n\t\t\t\tif(thisSlot == board[j][i+1]) {\n\t\t\t\t\tif(thisSlot == board[j][i+2]) {\n\t\t\t\t\t\tif(thisSlot == board[j][i+3]) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for diagonal win left to right, upwards\n\t\tfor(int i = 0; i < board[0].length - 3; i++) {\n\t\t\tfor(int j = 3; j < board.length; j++) {\n\t\t\t\tif(board[j][i] != GameBoard.EMPTY) {\n\t\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\t\t\n\t\t\t\t\tif(board[j-1][i+1] == thisSlot) {\n\t\t\t\t\t\tif(board[j-2][i+2] == thisSlot) {\n\t\t\t\t\t\t\tif(board[j-3][i+3] == thisSlot) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for diagonal win right to left, upwards\n\t\tfor(int i = 3; i < board[0].length; i++) {\n\t\t\tfor(int j = 3; j < board.length; j++) {\n\t\t\t\tif(board[j][i] != GameBoard.EMPTY) {\n\t\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\t\t\n\t\t\t\t\tif(board[j-1][i-1] == thisSlot) {\n\t\t\t\t\t\tif(board[j-2][i-2] == thisSlot) {\n\t\t\t\t\t\t\tif(board[j-3][i-3] == thisSlot) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "private void CheckWin() throws VictoryException {\n if (!isMiddleSquareEmpty()) {\n checkDiagonalTopRightToBottomLeft();\n checkDiagonalTopLeftToBottomRight();\n }\n\n checkHorozontalWin();\n checkVercticalWin();\n\n if (didAnyoneWin) {resetBoard(myGame);\n throw (new VictoryException());\n }\n }", "boolean gameOver() {\n return piecesContiguous(BP) || piecesContiguous(WP);\n }", "boolean isGameFinished() {\n if (tiles.takenTilesNumber() < 3)\n return false;\n Symbol winningSymbol = tiles.getTile(1);\n if (!winningSymbol.equals(Symbol.EMPTY)) {\n if (tiles.getTile(5).equals(winningSymbol)) {\n if (tiles.getTile(9).equals(winningSymbol)) {\n return true;\n }\n }\n if(tiles.getTile(2).equals(winningSymbol)) {\n if(tiles.getTile(3).equals(winningSymbol)) return true;\n }\n if(tiles.getTile(4).equals(winningSymbol)) {\n if(tiles.getTile(7).equals(winningSymbol)) return true;\n }\n }\n winningSymbol = tiles.getTile(2);\n if (!winningSymbol.equals(Symbol.EMPTY)) {\n if (tiles.getTile(5).equals(winningSymbol)) {\n if (tiles.getTile(8).equals(winningSymbol)) return true;\n }\n }\n\n winningSymbol = tiles.getTile(3);\n if (!winningSymbol.equals(Symbol.EMPTY)) {\n if (tiles.getTile(5).equals(winningSymbol)) {\n if (tiles.getTile(7).equals(winningSymbol)) return true;\n }\n if (tiles.getTile(6).equals(winningSymbol)) {\n if (tiles.getTile(9).equals(winningSymbol)) return true;\n }\n }\n\n\n winningSymbol = tiles.getTile(4);\n if (!winningSymbol.equals(Symbol.EMPTY)) {\n if (tiles.getTile(5).equals(winningSymbol)) {\n if (tiles.getTile(7).equals(winningSymbol)) return true;\n }\n }\n\n winningSymbol = tiles.getTile(7);\n if (!winningSymbol.equals(Symbol.EMPTY)) {\n if (tiles.getTile(8).equals(winningSymbol)) {\n if (tiles.getTile(9).equals(winningSymbol)) return true;\n }\n }\n return false;\n }", "public static boolean isGameWon() {\r\n\t\tboolean gameWon = false;\r\n\t\t\r\n\t\t//Game won for three handed game.\r\n\t\tif (Main.isThreeHanded){\r\n\t\t\tif (Utils.stringToInt(Main.player1Score) >= Main.winScoreNumb ||\r\n\t\t\t\t\tUtils.stringToInt(Main.player2Score) >= Main.winScoreNumb ||\r\n\t\t\t\t\tUtils.stringToInt(Main.player3Score) >= Main.winScoreNumb) {\r\n\t\t\t\tgameWon = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Game won for four handed single player game.\r\n\t\tif (Main.isFourHandedSingle){\r\n\t\t\tif (Utils.stringToInt(Main.player1Score) >= Main.winScoreNumb ||\r\n\t\t\t\t\tUtils.stringToInt(Main.player2Score) >= Main.winScoreNumb ||\r\n\t\t\t\t\tUtils.stringToInt(Main.player3Score) >= Main.winScoreNumb ||\r\n\t\t\t\t\tUtils.stringToInt(Main.player4Score) >= Main.winScoreNumb) {\r\n\t\t\t\tgameWon = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Game won for four handed team game.\r\n\t\tif (Main.isFourHandedTeams){\r\n\t\t\tif (Utils.stringToInt(Main.team1Score) >= Main.winScoreNumb ||\r\n\t\t\t\t\tUtils.stringToInt(Main.team2Score) >= Main.winScoreNumb) {\r\n\t\t\t\tgameWon = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//Set Main variable.\r\n\t\tMain.isGameWon = gameWon;\r\n\t\t\r\n\t\treturn gameWon;\r\n\t}", "public boolean winner() {\n String result = winType();\n if (result == null || result.equals(\"\"))\n return false;\n if (result.equals(\"horizontal\") || result.equals(\"vertical\") || result.equals(\"diagonal\") || result.equals(\"diagonal2\"))\n return true;\n return false;\n }", "public boolean win() {\r\n\t\tfor (int n = 0; n < 3; n++) {\r\n\t\t\tfor (int m = 0; m < 7; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n + 1][m] == board[n][m] && board[n + 2][m] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n + 3][m] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 1][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 2][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 3][m].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 0; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n][m + 1] == board[n][m] && board[n][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 3].setText(\"X\");\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 0; n < 3; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n + 1][m + 1] == board[n][m] && board[n + 2][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n + 3][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 1][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 2][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 3][m + 3].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 3; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n - 1][m + 1] == board[n][m] && board[n - 2][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n - 3][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 1][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 2][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 3][m + 3].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\r\n\t}", "public boolean winner(){\n\t\treturn goals1 > goals2;\n\t}", "public boolean hasWon(){\n boolean winStatus = false;\n if(balance >= 3000){\n winStatus = true;\n }\n return winStatus;\n }", "public boolean won()\n {\n if (currentScore >= PigGame.GOAL)\n {\n return true;\n }\n \n else\n {\n return false;\n }\n }", "public boolean isOver() {\n \treturn status == GameStatus.victory || status == GameStatus.draw || status == GameStatus.quit;\n }", "private boolean getWinner(String mark,int buttonId)\n {\n \tint rows =3;\n \tint columns = 3;\n \tint rowNumber = buttonId/rows;\n \tboolean winStatus = false;\n \tif(movesPlayed.length == 0)\n \t{\n \t\treturn winStatus;\n \t}\n \t//1) check row\n \tboolean isRowWin = checkRowForWinner(mark,buttonId);\n \tif(isRowWin==true)\n \t{\n \t\twinStatus = true;\n \t\treturn winStatus;\n \t}\n \tboolean isColumnWin = checkColumnForWinner(mark,buttonId);\n \tif(isColumnWin == true)\n \t{\n \t\twinStatus = true;\n \t\treturn winStatus;\n \t}\n \t\n \tboolean isDiagonalWin = checkDiagonalForWinner(mark,buttonId);\n \tif(isDiagonalWin == true)\n \t{\n \t\twinStatus = true;\n \t\treturn winStatus;\n \t}\n \treturn winStatus;\n }", "private boolean hasRowWin() {\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n if (getBoard()[i][j] != null) {\n boolean rowWin = rowHasFour(i, j);\n if (rowWin) {\n return true;\n }\n\n }\n }\n }\n return false;\n }", "private boolean draw(Board board)\n {\n return full(board) && !computerWin(board) && playerWin(board);\n }", "public boolean lookAtWinCard(){\n boolean winCard = false;\n for(Card cards: playerHand){\n if(cards.getCardName().equals(\"Magnetite\")){\n winCard = true;\n }\n }\n return winCard;\n }", "private void checkForWin()\n\t\t\t{\n\t\t\t\tfor (j = 0; j < 8; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (win[j] == 3)\n\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbugflag = true;\n\t\t\t\t\t\t\t\tresult = j;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tIntent it1 = new Intent(Main.this, Result.class);\n\t\t\t\t\t\t\t\tBundle b = new Bundle();\n\t\t\t\t\t\t\t\tb.putString(\"result\",\n\t\t\t\t\t\t\t\t\t\t\"You were lucky this time \" + name\n\t\t\t\t\t\t\t\t\t\t\t\t+ \". You won!\");\n\t\t\t\t\t\t\t\tit1.putExtras(b);\n\t\t\t\t\t\t\t\tfinish();\n\t\t\t\t\t\t\t\tstartActivity(it1);\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t}", "@Override\n public boolean gameOver() {\n //true if the board full or a winner has been found\n return getWinner() != EMPTY || isBoardFull();\n }", "private boolean checkHorizontalWin(BoardPosition lastPos) {\r\n int i, col, count;\r\n int check = 9;\r\n int row = lastPos.getRow();\r\n\r\n for(i = (xMax-xMax)+2; i < (xMax / 2); i += 2){\r\n count = 0;\r\n for(col = i; col < (i + check); col++){\r\n if(grid[row][col] == lastPos.getPlayer())\r\n count++;\r\n }\r\n if (count == win)\r\n return true;\r\n }\r\n return false;\r\n }", "@Override\r\n\tboolean isFinished() {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tif(checkForWin() != -1)\r\n\t\t\treturn true;\r\n\t\telse if(!(hasValidMove(0) || hasValidMove(1)))\r\n\t\t\treturn true; //game draw both are stuck\r\n\t\telse return false;\r\n\t}" ]
[ "0.90526736", "0.8285967", "0.81781214", "0.81520545", "0.810769", "0.7992573", "0.796918", "0.79594505", "0.7933491", "0.789095", "0.77996135", "0.77853554", "0.77625567", "0.77472997", "0.7741481", "0.7740096", "0.7685745", "0.7685504", "0.76686156", "0.765922", "0.76454806", "0.7619458", "0.7617715", "0.7608345", "0.75863725", "0.7572141", "0.75575715", "0.7549672", "0.7523557", "0.7512107", "0.75096387", "0.7507453", "0.7469101", "0.7463898", "0.7462705", "0.7439199", "0.7427312", "0.7386056", "0.7378013", "0.73692036", "0.7367587", "0.7356229", "0.7354204", "0.7337302", "0.7299113", "0.7282811", "0.727448", "0.7268611", "0.72615063", "0.72539634", "0.72381604", "0.7224926", "0.7210556", "0.7203247", "0.7194358", "0.7154646", "0.71448874", "0.71369195", "0.7128152", "0.71209514", "0.7112386", "0.7110398", "0.7108458", "0.70896626", "0.7082369", "0.7061142", "0.7042231", "0.7041043", "0.70324326", "0.70288026", "0.70066005", "0.6994671", "0.69942254", "0.6988641", "0.69843376", "0.6977571", "0.6952607", "0.6950932", "0.69508475", "0.6946315", "0.69376177", "0.6933929", "0.6927153", "0.692606", "0.6916105", "0.6915188", "0.6911304", "0.6906575", "0.6898994", "0.6898473", "0.68896633", "0.6881823", "0.68772686", "0.68731505", "0.6871012", "0.6865513", "0.6851376", "0.6848404", "0.6845273", "0.68364125", "0.6835701" ]
0.0
-1
Constructor that takes a diagnostic message as argument.
public UnableToFindSolutionException(String message) { super(message); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Message(){\n this(\"Not Specified\",\"Not Specified\");\n }", "public Error(String message) {\r\n \tsuper(message);\r\n \t}", "public SMSLibException(String errorMessage)\n/* 10: */ {\n/* 11:34 */ super(errorMessage);\n\n/* 12: */ }", "public MessageParseException() {\n }", "public MessageParseException(String message) {\n super(message);\n }", "public ParseException(String message) {\n super(message);\n }", "@Test\n public void testConstructorWithMessage()\n {\n final LoaderException e = new LoaderException(\"Custom message\");\n assertEquals(\"Custom message\", e.getMessage());\n }", "public MyException(String message)\n { super(message); }", "public void testConstructorWithMessage() {\r\n RejectReasonNotFoundException exception = new RejectReasonNotFoundException(message);\r\n\r\n assertNotNull(\"Unable to instantiate RejectReasonNotFoundException\", exception);\r\n assertTrue(\"Message is not initialized correctly\", exception.getMessage().matches(message + \".*\"));\r\n assertEquals(\"Cause is not initialized correctly\", null, exception.getCause());\r\n assertEquals(\"ProblemRejectReason is not initialized correctly\", null, exception.getProblemRejectReason());\r\n }", "public ValidationFailure(String message) {\n this.message = message;\n }", "public InvalidRequestMsg() {\n\n this(\"\");\n\n }", "public Exception(String message) {\n\t\t\tsuper(message);\n\t\t}", "public SystemMessage() {\r\n\t}", "private DiagnosticMessageUtilities()\n {\n }", "public Message(){}", "public CompilationException(String message) {\n\t\tsuper(message);\n\t}", "public JDBFException (String message){\r\n super(Messages.message(message));\r\n }", "public LCAmsg2 () { }", "public MyCustomException( String message )\n {\n\n\t// Why are we doing this??\n super( message );\n }", "private StatusMessage() {\n\n\t}", "private StatusMessage() {\n\n\t}", "public MyException() {\n super(\"This is my message. There are many like it but this one is mine.\");\n }", "public VocabularioIOException(String msg)\n {\n message = msg;\n }", "public notHumanBeingException(String message){// Message parameted created\n super(message);\n \n }", "public CanyonException( String message )\r\n {\r\n super( message );\r\n }", "public CRLException(String message) {\n super(message);\n }", "public StatusMessage(int code, String message) {\n _code = code;\n _message = message;\n }", "public BadRequestException(String message) {\n super(message);\n if(!message.equals(\"\")){errorText = errorText.concat(\": \" + message);}\n }", "public ErrorMessage() {\n\t}", "public Message() {\n }", "public ValidationMessage() {\n }", "public InstrumenterException(String message) {\r\n super(message);\r\n }", "public Message(String message){\n\t\tthis(message, 5000);\n\t}", "public CompilerMessage(MessageKind messageKind_, Exception exception_) {\r\n this((SourceRange)null, messageKind_, exception_); \r\n }", "public Message() {\n }", "public Message() {\n }", "public ParseException(String msg) {\n this(msg, -1, -1, -1);\n }", "public OLMSException(String message) {\r\n super(message);\r\n }", "public BadMessageException(final String message) {\r\n\t\tsuper(message);\r\n\t}", "public MyException(String message) {\r\n\t\tsuper(message);\r\n\t\t// TODO Auto-generated constructor stub\r\n\t}", "public Message() {}", "public Message() {}", "public ParsingException(String message) {\n super(message);\n }", "public MessageInfo() { }", "public SmartScriptParserException(String message) {super(message);}", "public InvalidInputException(String errMessage)\n\t{\n\t\tthis.errMessage = errMessage;\n\t}", "public Message() {\n\t\tsuper();\n\t}", "public CompilerMessage(MessageKind messageKind_) {\r\n this((SourceRange)null, messageKind_, null);\r\n }", "public JavaException(@Nullable String message)\r\n\t{\r\n\t\tsuper(message);\r\n\t}", "public VerifyException(String message) {\n\t\tsuper(message);\n\t}", "public SMSLibException() {}", "public User(Message message) {\n\t\tthis.message = message;\n\t\tlogger.info(\"Error has occured :(\");\n\t}", "public SensorException(String message) {\r\n super(message);\r\n }", "public Neo4jException(String message) {\n this(\"N/A\", message);\n }", "public DependencyReportConfigurationException(String message) {\r\n super(message);\r\n }", "private Message(){\n // default constructor\n }", "CompilerMessage(SourceRange sourceRange_, MessageKind messageKind_, Exception exception_) {\r\n this(sourceRange_, null, messageKind_, exception_);\r\n }", "public FlowMonMessage(){}", "public PDUStringException(String message, StringParameter parameter) {\n super(message);\n this.parameter = parameter;\n }", "public BaseException(String message) {\n super(message);\n setErrorCode();\n }", "public void testCtor2() {\n instance = new LogMessage(type, id, operator, message);\n\n assertEquals(\"'type' should be correct.\", type, instance.getType());\n assertEquals(\"'id' should be correct.\", id, instance.getId());\n assertEquals(\"'message' should be correct.\", message, instance.getMessage());\n assertNull(\"'error' should be correct.\", instance.getError());\n }", "private ParseException(String msg, long offset, int line, int column) {\n super(msg);\n this.offset = offset;\n this.line = line;\n this.column = column;\n }", "public CommunicationException(String message) {\r\n\t\tsuper(message);\r\n\t}", "public CassetteException(String message) {\r\n super(message);\r\n }", "public TechnicalException(final String message) {\n super(message);\n }", "public NotValidException(String message) {\r\n super(message);\r\n }", "public ValidationException(String userMessage, String logMessage) {\r\n super(userMessage, logMessage);\r\n }", "public SysAccessCodeException(int code, String businessMessage)\n/* */ {\n/* 21 */ this(businessMessage);\n/* */ }", "public ReportException(String message) {\n\t\tsuper(message);\n\t}", "public DemoMessage(String message) {\n\t\tthis.message = message;\n\t}", "public LexerException(String message) {\n\t\tsuper(message);\n\t}", "public Message newMessage(String message, Object... params) {\n/* 61 */ return new SimpleMessage(message);\n/* */ }", "public NotFoundException(final String message) {\r\n super(Response.status(Responses.NOT_FOUND).\r\n entity(message).type(\"text/plain\").build());\r\n myDetailMessage = message;\r\n }", "public ErrorAlert(String message) {\r\n\r\n JOptionPane.showMessageDialog(MainWindow.getInstance(), message);\r\n\r\n }", "public SMSLibException(String errorMessage, Throwable originalE)\n/* 22: */ {\n/* 23:50 */ super(errorMessage);\n/* 24:51 */ this.originalE = originalE;\n/* 25: */ }", "public PreprocessorException(String message) {\r\n super(message);\r\n }", "public TwoDAReadException(String message) { super(message); }", "public OperatorException(final Operator operator, final String message) {\n super(message);\n this.operator = operator;\n }", "public OperationException(String message) {\n super(message);\n }", "public TDLProException(String message)\n {\n super(message);\n }", "public CallMessage() {\n\t}", "public TechnicalException(String message) {\r\n super(message);\r\n }", "public MessageRecord() {\n super(Message.MESSAGE);\n }", "public Alarm_Msg(){ }", "public RDISException(String msg) {\n\t\tthis(msg, null);\n\t}", "public ParseException(String msg, int line, int column) {\n this(msg, -1, line, column);\n }", "public CIMException() {\n\t\tthis((String) null, (Object[]) null);\n\t}", "public Error(int code, String msg) {\r\n\tthis.code = code;\r\n\tthis.msg = msg;\r\n }", "public FullCarException(String message) {\r\n super(message);\r\n }", "public Error() {\n }", "public void testConstructorWithMessageAndCause() {\r\n RejectReasonNotFoundException exception = new RejectReasonNotFoundException(message, cause);\r\n\r\n assertNotNull(\"Unable to instantiate RejectReasonNotFoundException\", exception);\r\n assertTrue(\"Message is not initialized correctly\", exception.getMessage().matches(message + \".*\"));\r\n assertEquals(\"Cause is not initialized correctly\", cause, exception.getCause());\r\n assertEquals(\"ProblemRejectReason is not initialized correctly\", null, exception.getProblemRejectReason());\r\n }", "public Message newMessage(String message, Object p0, Object p1, Object p2) {\n/* 85 */ return new SimpleMessage(message);\n/* */ }", "public VelocityEmailException(String msg)\n {\n super(msg);\n }", "public RecoverableException(final String message) {\n super(message);\n }", "public TimException(String message) {\n\t\tsuper(message);\n\t}", "public ValidationException(String msg) {\n\t\tsuper(msg);\n\t}", "public ConnectionException(String pMessage) {\n super(pMessage);\n }", "@ParametersAreNonnullByDefault\n\tpublic ApplicationException(String message) {\n\t\tsuper(message);\n\t}", "public SysException(String message) {\r\n super(message);\r\n\r\n }", "public EventMessage(Event event)\r\n {\r\n //super(\"EventMessage\");\r\n super(TYPE_IDENT, event);\r\n }", "public InvalidCommand(String errorMessage) {\n this.errorMessage = errorMessage;\n }" ]
[ "0.6786409", "0.67841625", "0.66440445", "0.65473354", "0.6539955", "0.6522354", "0.65056425", "0.6503153", "0.6481866", "0.6481197", "0.64660424", "0.64589685", "0.6449692", "0.6439881", "0.63993824", "0.63847315", "0.636358", "0.6346419", "0.6335967", "0.6318208", "0.6318208", "0.631655", "0.63096344", "0.62969345", "0.6275193", "0.62610644", "0.6215629", "0.6215345", "0.62151974", "0.6212438", "0.6211026", "0.61906743", "0.61813664", "0.618082", "0.6176579", "0.6176579", "0.6173881", "0.61565", "0.61515105", "0.6148032", "0.6143631", "0.6143631", "0.6124456", "0.611993", "0.6117034", "0.6103451", "0.60976577", "0.60830593", "0.607888", "0.60768574", "0.6069029", "0.60479987", "0.60331506", "0.60303754", "0.6018869", "0.6016257", "0.6015089", "0.6015025", "0.6004561", "0.5998501", "0.59926736", "0.598189", "0.5973145", "0.5965347", "0.5949161", "0.5947415", "0.5940918", "0.5938284", "0.59349203", "0.5930133", "0.5928205", "0.5926526", "0.59182554", "0.5901435", "0.5895433", "0.58930117", "0.5890619", "0.5888623", "0.5877847", "0.5872117", "0.58653665", "0.5864823", "0.5863601", "0.5859954", "0.5841898", "0.5837579", "0.5837044", "0.5837025", "0.58298856", "0.5826929", "0.5825017", "0.5824106", "0.5819134", "0.58163315", "0.5814784", "0.5814183", "0.5811503", "0.58072096", "0.5800919", "0.5777987", "0.5776399" ]
0.0
-1
Method to get the string value of content type
@Override public String toString() { return type; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@java.lang.Override\n public java.lang.String getStringValue() {\n java.lang.Object ref = \"\";\n if (typeCase_ == 5) {\n ref = type_;\n }\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (typeCase_ == 5) {\n type_ = s;\n }\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getStringValue() {\n java.lang.Object ref = \"\";\n if (typeCase_ == 5) {\n ref = type_;\n }\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (typeCase_ == 5) {\n type_ = s;\n }\n return s;\n }\n }", "int getContentTypeValue();", "@java.lang.Override\n public com.google.protobuf.ByteString\n getStringValueBytes() {\n java.lang.Object ref = \"\";\n if (typeCase_ == 5) {\n ref = type_;\n }\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n if (typeCase_ == 5) {\n type_ = b;\n }\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "String getTypeAsString();", "String getContentType();", "String getContentType();", "String getContentType();", "public com.google.protobuf.ByteString\n getStringValueBytes() {\n java.lang.Object ref = \"\";\n if (typeCase_ == 5) {\n ref = type_;\n }\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n if (typeCase_ == 5) {\n type_ = b;\n }\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public String getContentType() {\r\n try {\r\n ContentType newCtype = new ContentType(super.getContentType());\r\n ContentType retCtype = new ContentType(cType.toString());\r\n retCtype.setParameter(\"boundary\", newCtype.getParameter(\"boundary\"));\r\n return retCtype.toString();\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n\r\n return \"null\";\r\n }", "public String getContenttype() {\n return contenttype;\n }", "public String getContenttype() {\n return contenttype;\n }", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();", "public String getMime_type()\r\n {\r\n return getSemanticObject().getProperty(data_mime_type);\r\n }", "public String getType() {\n return (String) getObject(\"type\");\n }", "public String getContenttype() {\n\t\treturn contenttype;\n\t}", "public String getTypeString() {\r\n return Prediction.getTypeString(type);\r\n }", "java.lang.String getStringValue();", "java.lang.String getStringValue();", "public java.lang.String getContentType() {\n java.lang.Object ref = contentType_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n contentType_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "String getStringValue();", "String getStringValue();", "public String getContentType();", "public String getContentType();", "public String getTypeText() {\r\n\t\t\r\n\t\treturn getTypeText(this.type);\r\n\r\n\t}", "public CharSequence getContentType() {\n return contentType;\n }", "public java.lang.String getContentType() {\n java.lang.Object ref = contentType_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n contentType_ = s;\n return s;\n }\n }", "String value();", "String value();", "public java.lang.String getType()\n {\n return m_type;\n }", "@java.lang.Override public int getContentTypeValue() {\n return contentType_;\n }", "public String getStringValue();", "@Override\n public StringType asString() {\n return TypeFactory.getStringType(this.getValue());\n }", "public final String type() {\n return type;\n }", "public static String stringType(Obj type) {\n\t\tString str = ObjStr.get(type);\n\t\t\treturn str != null ? str : \"\";\n\t}", "public abstract String getContentString();", "org.hl7.fhir.String getValueString();", "com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType getContentType();", "String getType() {\n return type;\n }", "public String getContentType() {\n return getProperty(Property.CONTENT_TYPE);\n }", "@java.lang.Override public int getContentTypeValue() {\n return contentType_;\n }", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "public java.lang.String getType() {\n java.lang.Object ref = type_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n type_ = s;\n }\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "String getValueAsString();", "private String getType(){\r\n return type;\r\n }", "String getType() {\r\n return this.type;\r\n }", "public String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();", "String type();" ]
[ "0.7586277", "0.7503437", "0.75026906", "0.7401955", "0.7332279", "0.7255922", "0.7255922", "0.7255922", "0.7010507", "0.6992102", "0.69909644", "0.69909644", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.69583935", "0.6930106", "0.6917654", "0.6909641", "0.6900905", "0.6898351", "0.6898351", "0.6887111", "0.6867148", "0.6867148", "0.68661696", "0.68661696", "0.68465364", "0.67669034", "0.6756017", "0.6720747", "0.6720747", "0.66959155", "0.66948473", "0.6690045", "0.6673956", "0.6665471", "0.66550916", "0.6648531", "0.66406405", "0.6624061", "0.6618297", "0.6612705", "0.6611078", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.66068435", "0.65824175", "0.65822726", "0.6582106", "0.65684175", "0.65627646", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365", "0.655365" ]
0.0
-1
Method to retrieve the corresponding content type for the given format
public static String getContentType(String format) { if (StringUtils.hasText(format)) { if (format.equalsIgnoreCase(XML.name())) { return ContentTypes.XML.toString(); } else if (format.equalsIgnoreCase(JSON.name())) { return ContentTypes.JSON.toString(); } else if (format.equalsIgnoreCase(PDF.name())) { return ContentTypes.PDF.toString(); } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getMIMEType(String format)\n\t{\n\t\treturn engine.getMIMEType(format);\n\t}", "String getContentType();", "String getContentType();", "String getContentType();", "public MediaType getContentType()\r\n/* 193: */ {\r\n/* 194:289 */ String value = getFirst(\"Content-Type\");\r\n/* 195:290 */ return value != null ? MediaType.parseMediaType(value) : null;\r\n/* 196: */ }", "public String getContentType();", "public String getContentType();", "public String getReadMimeType(int formatIndex);", "int getContentTypeValue();", "abstract ContentType getContnentType();", "MimeType mediaType();", "com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType getContentType();", "public int getEntityType(){\n\t\tIterator<ArrayList<String>> i = headerLines.iterator();\n\t\twhile(i.hasNext()){\n\t\t\tArrayList<String> headerLines = i.next();\n\t\t\tString headerName = headerLines.get(0);\n\t\t\tif (headerName.matches(\"Content-Type:\")){\n\t\t\t\tString headerData = headerLines.get(1);\n\t\t\t\tif(headerData.contains(\"text\")){\n\t\t\t\t\treturn TEXT;\n\t\t\t\t} else if (headerData.contains(\"pdf\")){\n\t\t\t\t\treturn PDF;\n\t\t\t\t} else if (headerData.contains(\"gif\")){\n\t\t\t\t\treturn GIF;\n\t\t\t\t} else if (headerData.contains(\"jpeg\")){\n\t\t\t\t\treturn JPEG;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "String getContentType(String fileExtension);", "String getContentFormat();", "Object getFormat();", "public String getContenttype() {\n return contenttype;\n }", "public String getContenttype() {\n return contenttype;\n }", "protected String getContentType()\n {\n if (fullAttachmentFilename == null)\n {\n return null;\n }\n String ext = FilenameUtils.getExtension(fullAttachmentFilename);\n if (ext == null)\n {\n return null;\n }\n if (ext.equalsIgnoreCase(\"pdf\"))\n {\n return \"application/pdf\";\n } else if (ext.equalsIgnoreCase(\"zip\"))\n {\n return \"application/zip\";\n } else if (ext.equalsIgnoreCase(\"jpg\"))\n {\n return \"image/jpeg\";\n\n } else if (ext.equalsIgnoreCase(\"jpeg\"))\n {\n return \"image/jpeg\";\n\n } else if (ext.equalsIgnoreCase(\"html\"))\n {\n return \"text/html\";\n\n } else if (ext.equalsIgnoreCase(\"png\"))\n {\n return \"image/png\";\n\n } else if (ext.equalsIgnoreCase(\"gif\"))\n {\n return \"image/gif\";\n\n }\n log.warn(\"Content type not found for file extension: \" + ext);\n return null;\n }", "public String getMimeType ()\n {\n final String METHOD_NAME = \"getMimeType\";\n this.logDebug(METHOD_NAME + \"1/2: Started\");\n\n String mimeType = null;\n try\n {\n\tint contentType = this.document.getContentType();\n\tif ( contentType >= 0 ) mimeType = MediaType.nameFor[contentType];\n }\n catch (Exception exception)\n {\n\tthis.logWarn(METHOD_NAME + \"Failed to retrieve mime type\", exception);\n }\n\n this.logDebug(METHOD_NAME + \" 2/2: Done. mimeType = \" + mimeType);\n return mimeType;\n }", "public String getWriteMimeType(int formatIndex);", "public java.lang.Object getContentType() {\r\n return contentType;\r\n }", "public String getContentType() {\r\n try {\r\n ContentType newCtype = new ContentType(super.getContentType());\r\n ContentType retCtype = new ContentType(cType.toString());\r\n retCtype.setParameter(\"boundary\", newCtype.getParameter(\"boundary\"));\r\n return retCtype.toString();\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n\r\n return \"null\";\r\n }", "FileFormat getFormat();", "public String getContenttype() {\n\t\treturn contenttype;\n\t}", "public Long getFiletypeForFileFormat(String fileformat)\r\n\t\t\tthrows ProcessingException;", "public String getContentType() {\n return this.contentType;\n }", "public String getContentType() {\n return contentType;\n }", "@Override\n\tpublic String getContentType()\n\t{\n\t\treturn contentType;\n\t}", "@Override\n public String getType(Uri uri) {\n List<String> segments = uri.getPathSegments();\n String accountId = segments.get(0);\n String id = segments.get(1);\n String format = segments.get(2);\n if (FORMAT_THUMBNAIL.equals(format)) {\n return \"image/png\";\n } else {\n uri = ContentUris.withAppendedId(Attachment.CONTENT_URI, Long.parseLong(id));\n Cursor c = getContext().getContentResolver().query(uri, MIME_TYPE_PROJECTION,\n null, null, null);\n try {\n if (c.moveToFirst()) {\n String mimeType = c.getString(MIME_TYPE_COLUMN_MIME_TYPE);\n String fileName = c.getString(MIME_TYPE_COLUMN_FILENAME);\n mimeType = inferMimeType(fileName, mimeType);\n return mimeType;\n }\n } finally {\n c.close();\n }\n return null;\n }\n }", "public IIOMetadataFormat getMetadataFormat(String formatName) {\n\t\tif (formatName.equals(nativeMetadataFormatName)) {\n\t\t\treturn null;\n\t\t\t// return (IIOMetadataFormat) nativeDoc;\n\t\t} else if (formatName.equals(commonMetadataFormatName)) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\tthrow new IllegalArgumentException(\"Not a recognized format!\");\n\t\t}\n\t}", "protected String getContentType(Resource resource, @SuppressWarnings(\"unused\") SlingHttpServletRequest request) {\n String mimeType = JcrBinary.getMimeType(resource);\n if (StringUtils.isEmpty(mimeType)) {\n mimeType = ContentType.OCTET_STREAM;\n }\n return mimeType;\n }", "public Class<? extends FormatFeature> getFormatReadFeatureType()\n/* */ {\n/* 415 */ return null;\n/* */ }", "public String getContentType() {\n\t\tString ct = header.getContentType();\n\t\treturn Strings.substringBefore(ct, ';');\n\t}", "public String getContentType() {\n return this.contentType;\n }", "public String getContentType() {\n return this.contentType;\n }", "public String getContentType() {\n return this.contentType;\n }", "public static String getContentType(String name){\n\t\tString contentType = \"\";\n\t\tif(name.endsWith(\".html\")){\n\t\t\tcontentType = \"text/html\";\n\t\t}else if(name.endsWith(\".txt\")){\n\t\t\tcontentType = \"text/plain\";\n\t\t}else if(name.endsWith(\".gif\")){\n\t\t\tcontentType = \"image/gif\";\n\t\t}else if(name.endsWith(\".jpg\")){\n\t\t\tcontentType = \"image/jpeg\";\n\t\t}else if(name.endsWith(\".png\")){\n\t\t\tcontentType = \"image/png\";\n\t\t}\n\t\treturn contentType;\n\t}", "public CharSequence getContentType() {\n return contentType;\n }", "public String getContentType() {\n return contentType;\n }", "public String getContentType() {\n return contentType;\n }", "public String getContentType() {\n return contentType;\n }", "public String getContentType() {\n return contentType;\n }", "public String getContentType() {\n return contentType;\n }", "public Class getReadClass(int formatIndex);", "public String getContentType(String arg0) {\n\t\treturn null;\n\t}", "public String getContentType() {\n return getHeader(\"Content-Type\");\n }", "public String getContentType() {\n return getProperty(Property.CONTENT_TYPE);\n }", "public String getMime_type()\r\n {\r\n return getSemanticObject().getProperty(data_mime_type);\r\n }", "public Class<F> getFormatType() {\n\t\treturn formatType;\n\t}", "public static ContentType extensionContentType(String fileExt) {\r\n\r\n\t\tfileExt = fileExt.toLowerCase();\r\n\r\n\t\tif (\"tiff\".equals(fileExt) || \"tif\".equals(fileExt)) {\r\n\t\t\t// return MIMEConstants.\r\n\t\t} else if (\"zip\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_ZIP;\r\n\t\t} else if (\"pdf\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_PDF;\r\n\t\t} else if (\"wmv\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_VIDEO_WMV;\r\n\t\t} else if (\"rar\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_RAR;\r\n\t\t} else if (\"swf\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_SWF;\r\n\t\t} else if (\"exe\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_WINDOWSEXEC;\r\n\t\t} else if (\"avi\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_VIDEO_AVI;\r\n\t\t} else if (\"doc\".equals(fileExt) || \"dot\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_WORD;\r\n\t\t} else if (\"ico\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_IMAGE_ICO;\r\n\t\t} else if (\"mp2\".equals(fileExt) || \"mp3\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_AUDIO_MPEG;\r\n\t\t} else if (\"rtf\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_TEXT_RTF;\r\n\t\t} else if (\"xls\".equals(fileExt) || \"xla\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_EXCEL;\r\n\t\t} else if (\"jpg\".equals(fileExt) || \"jpeg\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_IMAGE_JPEG;\r\n\t\t} else if (\"gif\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_IMAGE_GIF;\r\n\t\t} else if (\"svg\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_IMAGE_SVG;\r\n\t\t} else if (\"png\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_IMAGE_PNG;\r\n\t\t} else if (\"csv\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_TEXT_CSV;\r\n\t\t} else if (\"ps\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_POSTSCRIPT;\r\n\t\t} else if (\"html\".equals(fileExt) || \"htm\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_TEXT_HTML;\r\n\t\t} else if (\"css\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_TEXT_CSS;\r\n\t\t} else if (\"xml\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_TEXT_XML;\r\n\t\t} else if (\"js\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_APPLICATION_JAVASCRIPT;\r\n\t\t} else if (\"wma\".equals(fileExt)) {\r\n\t\t\treturn MIMEConstants.CONTENT_TYPE_AUDIO_WMA;\r\n\t\t}\r\n\r\n\t\treturn MIMEConstants.CONTENT_TYPE_TEXT_PLAIN;\r\n\t}", "MediaType getMediaType();", "public MimeType mimetype() {\r\n return getContent().mimetype();\r\n }", "public static String getContentType(InputStream is) throws IOException {\n\n String encoding = \"UTF-8\"; //default\n\n\n // cerca se il documento specifica un altro encoding\n if (is != null) {\n StringBuilder sb = new StringBuilder();\n String line;\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));//\"UTF-8\"));\n while ((line = reader.readLine()) != null) { //CRASHA\n sb.append(line).append(\"\\n\");\n if ((sb.toString().contains(\"<?\") && sb.toString().contains(\"?>\")) && sb.toString().contains(\"encoding=\")) {\n\n Pattern p = Pattern.compile(\".*<\\\\?.*encoding=.(.*).\\\\?>.*\", Pattern.DOTALL);\n\n Matcher matcher = p.matcher(sb.toString());\n\n if (matcher.matches()) {\n encoding = matcher.group(1);\n }\n\n break;\n }\n }\n\n }\n\n return encoding;\n }", "@Override\n\tpublic String getContentType() {\n\t\treturn CONTENT_TYPE;\n\t}", "@ApiModelProperty(required = true, value = \"The file type of the file.\")\n public String getFormat() {\n return format;\n }", "public\t ContentType getContentTypeHeader()\n { return (ContentType) this.getHeader(ContentTypeHeader.NAME);}", "public static String getContentType(String filename) {\n return getTika().detect(filename);\n }", "String getMimeType();", "public java.lang.String getContentType() {\n return contentType;\n }", "@Override\n\tpublic String getContentType(String filename) {\n\t\treturn null;\n\t}", "public String getLBR_MDFeDocType();", "@SuppressWarnings(\"unchecked\")\n public <F> ConverterFormat<F> getFormat(Class<F> formatType) {\n ConverterFormat<F> format = (ConverterFormat<F>) formats.get(formatType);\n\n if (format == null) {\n throw new UnsupportedOperationException(\"The format \" + formatType + \" is not supported.\");\n }\n\n return format;\n }", "@java.lang.Override public int getContentTypeValue() {\n return contentType_;\n }", "public int lookupReadMimeType(String mimeType);", "public String getContentType() {\n\t\treturn contentType;\n\t}", "public String getContentType() {\n\t\treturn contentType;\n\t}", "public String getContentType() {\n return this.response.getContentType();\n }", "public boolean handles(String contentType, String packaging);", "public int getTypeFormatId()\n {\n if ( formatId != 0 ) { return formatId; }\n else\n {\n //\n // If you serialize this class outside the formatable machinery, you\n // will lose the format id. This can happen if you pass one of these\n // objects across the network. Here we recover the format id.\n //\n if ( TypeId.BOOLEAN_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.BOOLEAN_TYPE_ID_IMPL; }\n else if ( TypeId.BIGINT_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.BIGINT_TYPE_ID_IMPL; }\n else if ( TypeId.INTEGER_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.INT_TYPE_ID_IMPL; }\n else if ( TypeId.SMALLINT_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.SMALLINT_TYPE_ID_IMPL; }\n else if ( TypeId.TINYINT_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.TINYINT_TYPE_ID_IMPL; }\n else if ( TypeId.DECIMAL_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.DECIMAL_TYPE_ID_IMPL; }\n else if ( TypeId.NUMERIC_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.DECIMAL_TYPE_ID_IMPL; }\n else if ( TypeId.DOUBLE_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.DOUBLE_TYPE_ID_IMPL; }\n else if ( TypeId.REAL_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.REAL_TYPE_ID_IMPL; }\n else if ( TypeId.REF_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.REF_TYPE_ID_IMPL; }\n else if ( TypeId.CHAR_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.CHAR_TYPE_ID_IMPL; }\n else if ( TypeId.VARCHAR_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.VARCHAR_TYPE_ID_IMPL; }\n else if ( TypeId.LONGVARCHAR_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.LONGVARCHAR_TYPE_ID_IMPL; }\n else if ( TypeId.CLOB_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.CLOB_TYPE_ID_IMPL; }\n //DERBY-5407 Network Server on wire sends CHAR () FOR BIT DATA \n // not CHAR FOR BIT DATA. Keeping the check for CHAR FOR BIT\n // DATA just in case if there is any dependency on that check\n else if ( TypeId.BIT_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.BIT_TYPE_ID_IMPL; }\n else if ( \"CHAR FOR BIT DATA\".equals( unqualifiedName ) ) {\n return StoredFormatIds.BIT_TYPE_ID_IMPL; }\n //DERBY-5407 Network Server on wire sends VARCHAR () FOR BIT DATA \n // not VARCHAR FOR BIT DATA. Keeping the check for VARCHAR FOR BIT\n // DATA just in case if there is any dependency on that check\n else if ( TypeId.VARBIT_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.VARBIT_TYPE_ID_IMPL; }\n else if ( \"VARCHAR FOR BIT DATA\".equals( unqualifiedName ) ) {\n return StoredFormatIds.VARBIT_TYPE_ID_IMPL; }\n else if ( TypeId.LONGVARBIT_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.LONGVARBIT_TYPE_ID_IMPL; }\n else if ( TypeId.BLOB_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.BLOB_TYPE_ID_IMPL; }\n else if ( TypeId.DATE_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.DATE_TYPE_ID_IMPL; }\n else if ( TypeId.TIME_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.TIME_TYPE_ID_IMPL; }\n else if ( TypeId.TIMESTAMP_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.TIMESTAMP_TYPE_ID_IMPL; }\n else if ( TypeId.XML_NAME.equals( unqualifiedName ) ) {\n return StoredFormatIds.XML_TYPE_ID_IMPL; }\n else { return 0; }\n }\n }", "private int evaluateType(byte[] header) {\n if (ArchiveUtils.matchAsciiBuffer(MAGIC_UNIX, header, MAGIC_OFFSET, MAGICLEN)) {\n return UNIX_FORMAT;\n }\n if (ArchiveUtils.matchAsciiBuffer(MAGIC_POSIX, header, MAGIC_OFFSET, MAGICLEN)) {\n return POSIX_FORMAT;\n }\n if (ArchiveUtils.matchAsciiBuffer(MAGIC_GNU, header, MAGIC_OFFSET, MAGICLEN)) {\n return GNU_FORMAT;\n }\n return 0;\n }", "public edu.umich.icpsr.ddi.FormatType getFormat()\n {\n synchronized (monitor())\n {\n check_orphaned();\n edu.umich.icpsr.ddi.FormatType target = null;\n target = (edu.umich.icpsr.ddi.FormatType)get_store().find_element_user(FORMAT$10, 0);\n if (target == null)\n {\n return null;\n }\n return target;\n }\n }", "@java.lang.Override public com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType getContentType() {\n @SuppressWarnings(\"deprecation\")\n com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType result = com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType.valueOf(contentType_);\n return result == null ? com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType.UNRECOGNIZED : result;\n }", "public String getFormatByExtension(String fileExtenstion) throws DataServiceException{\r\n\t\tString format = \"\";\r\n\t\tformat = (String)queryForObject(\"document.query_format\",fileExtenstion);\r\n\t\treturn format;\r\n\t}", "private String getTypeFromExtension()\n {\n String filename = getFileName();\n String ext = \"\";\n\n if (filename != null && filename.length() > 0)\n {\n int index = filename.lastIndexOf('.');\n if (index >= 0)\n {\n ext = filename.substring(index + 1);\n }\n }\n\n return ext;\n }", "@Override\n public String getType(Uri uri) {\n ensureUriMatcherInitialized();\n int match = mUriMatcher.match(uri);\n switch (match) {\n case URI_MATCH_BOOKMARKS:\n case URL_MATCH_API_BOOKMARK:\n return BROWSER_CONTRACT_BOOKMARK_CONTENT_TYPE;\n case URI_MATCH_BOOKMARKS_ID:\n case URL_MATCH_API_BOOKMARK_ID:\n return BROWSER_CONTRACT_BOOKMARK_CONTENT_ITEM_TYPE;\n case URL_MATCH_API_SEARCHES:\n return BROWSER_CONTRACT_SEARCH_CONTENT_TYPE;\n case URL_MATCH_API_SEARCHES_ID:\n return BROWSER_CONTRACT_SEARCH_CONTENT_ITEM_TYPE;\n case URL_MATCH_API_HISTORY_CONTENT:\n return BROWSER_CONTRACT_HISTORY_CONTENT_TYPE;\n case URL_MATCH_API_HISTORY_CONTENT_ID:\n return BROWSER_CONTRACT_HISTORY_CONTENT_ITEM_TYPE;\n default:\n throw new IllegalArgumentException(TAG + \": getType - unknown URL \" + uri);\n }\n }", "public String getContentType() {\r\n return mFile.getContentType();\r\n }", "@java.lang.Override public int getContentTypeValue() {\n return contentType_;\n }", "@java.lang.Override\n public com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType getContentType() {\n @SuppressWarnings(\"deprecation\")\n com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType result = com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType.valueOf(contentType_);\n return result == null ? com.yoti.api.client.spi.remote.proto.ContentTypeProto.ContentType.UNRECOGNIZED : result;\n }", "java.lang.String getMimeType();", "java.lang.String getMimeType();", "@Override\n\tpublic String getType(Uri uri) {\n\t\tfinal int match = sUriMatcher.match(uri);\n\t\tswitch (match) {\n\t\tcase ROUTE_ENTRIES:\n\t\t\treturn CONTENT_TYPE;\n\t\tcase ROUTE_ENTRIES_ID:\n\t\t\treturn CONTENT_ITEM_TYPE;\n\t\tdefault:\n\t\t\tthrow new UnsupportedOperationException(\"Unknown uri: \" + uri);\n\t\t}\n\t}", "private String getContentType(String sHTTPRequest) {\n String sContentType = \"Content-Type: \";\n\n // update based on file extension or if response starts with HTML/URL\n String sFileExtension = getFileExtension(sHTTPRequest);\n if (sFileExtension.equalsIgnoreCase(\".html\") || sFileExtension.equalsIgnoreCase(\".htm\")) {\n sContentType += \"text/html\";\n } else if (sFileExtension.equalsIgnoreCase(\".txt\")) {\n sContentType += \"text/plain\";\n } else if (sFileExtension.equalsIgnoreCase(\".pdf\")) {\n sContentType += \"application/pdf\";\n } else if (sFileExtension.equalsIgnoreCase(\".png\")) {\n sContentType += \"image/png\";\n } else if (sFileExtension.equalsIgnoreCase(\".jpeg\") || sFileExtension.equalsIgnoreCase(\".jpg\")) {\n sContentType += \"image/jpeg\";\n } else {\n sContentType += \"text/html\"; // default response\n }\n\n // return final content type\n return sContentType;\n }", "public String getContentTypeFor(String fileName)\r\n {\r\n String ret_val = null;\r\n\r\n if(fileName.toUpperCase().endsWith(\".PNG\"))\r\n ret_val = \"image/png\";\r\n else if(fileName.toUpperCase().endsWith(\".TIF\"))\r\n ret_val = \"image/tiff\";\r\n else if(fileName.toUpperCase().endsWith(\".TIFF\"))\r\n ret_val = \"image/tiff\";\r\n else if(fileName.toUpperCase().endsWith(\".TGA\"))\r\n ret_val = \"image/targa\";\r\n else if(fileName.toUpperCase().endsWith(\".BMP\"))\r\n ret_val = \"image/bmp\";\r\n else if(fileName.toUpperCase().endsWith(\".PPM\"))\r\n ret_val = \"image/x-portable-pixmap\";\r\n else if(fileName.toUpperCase().endsWith(\".PGM\"))\r\n ret_val = \"image/x-portable-graymap\";\r\n\r\n // handle previous filename maps\r\n if(ret_val == null && prevMap != null)\r\n return prevMap.getContentTypeFor(fileName);\r\n\r\n // return null if unsure.\r\n return ret_val;\r\n }", "public static ContentType estimateContentType(String filename) {\r\n\t\tint last = 0;\r\n\t\tlast = filename.lastIndexOf('.');\r\n\r\n\t\tString fileExt = filename.substring(last + 1);\r\n\t\treturn extensionContentType(fileExt);\r\n\t}", "public Integer getOptContentType() { return(content_type); }", "public String getMediaType() {\r\n return mediaType;\r\n }", "public String getContentType() {\n\t\treturn null;\n\t}", "protected abstract MediaType getSupportedMediaType();", "String getChunkType();", "public String getFilecontentContentType() {\n return filecontentContentType;\n }", "public java.lang.String getContentType() {\n java.lang.Object ref = contentType_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n contentType_ = s;\n return s;\n }\n }", "@Override\r\n\tpublic String getContentType() {\r\n\t\treturn attachmentType;\r\n\t}", "public String getMimeType();", "public MediaType getType() {\n return type;\n }", "@Override\n public int getContentType() {\n return 0;\n }", "@Override\n public String getType(Uri uri) {\n // Return a string that identifies the MIME type\n // for a Content Provider URI\n switch (uriMatcher.match(uri)) {\n case ALLROWS: \n return \"vnd.android.cursor.dir/vnd.paad.elemental\";\n case SINGLE_ROW: \n return \"vnd.android.cursor.item/vnd.paad.elemental\";\n case SEARCH : \n return SearchManager.SUGGEST_MIME_TYPE;\n default: \n throw new IllegalArgumentException(\"Unsupported URI: \" + uri);\n }\n }", "public Format getBestFormat() {\n\t\tif (formats.contains(Format.JSON)) {\n\t\t\treturn Format.JSON;\n\t\t}\n\t\tif (formats.contains(Format.XML)) {\n\t\t\treturn Format.XML;\n\t\t}\n\t\treturn null;\n\t}", "public static String contentToFileExtension(String mediatype, String subtype) {\r\n\t\tif (StringUtil.equalsIgnoreCase(mediatype, MIMEConstants.MEDIATYPE_IMAGE)) {\r\n\t\t\tif (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_GIF)) {\r\n\t\t\t\treturn \"gif\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_JPEG)) {\r\n\t\t\t\treturn \"jpg\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_PNG)) {\r\n\t\t\t\treturn \"png\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_TIFF)) {\r\n\t\t\t\treturn \"tiff\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_ICON)) {\r\n\t\t\t\treturn \"ico\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_SVG)) {\r\n\t\t\t\treturn \"svg\";\r\n\t\t\t}\r\n\t\t} else if (StringUtil.equalsIgnoreCase(mediatype, MIMEConstants.MEDIATYPE_TEXT)) {\r\n\t\t\tif (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_CSS)) {\r\n\t\t\t\treturn \"css\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_HTML)) {\r\n\t\t\t\treturn \"html\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_JAVASCRIPT)) {\r\n\t\t\t\treturn \"js\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_PLAIN)) {\r\n\t\t\t\treturn \"txt\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_RICHTEXT)) {\r\n\t\t\t\treturn \"rtf\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_SOAPXML)) {\r\n\t\t\t\treturn \"xml\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_CSV)) {\r\n\t\t\t\treturn \"csv\";\r\n\t\t\t}\r\n\r\n\t\t} else if (StringUtil.equalsIgnoreCase(mediatype, MIMEConstants.MEDIATYPE_APPLICATION)) {\r\n\t\t\tif (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_MSEXCEL)) {\r\n\t\t\t\treturn \"xls\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_MSWORD)) {\r\n\t\t\t\treturn \"doc\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_RAR)) {\r\n\t\t\t\treturn \"rar\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_PDF)) {\r\n\t\t\t\treturn \"pdf\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_SHOCKWAVEFLASH)) {\r\n\t\t\t\treturn \"swf\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_WINDOWSEXECUTEABLE)) {\r\n\t\t\t\treturn \"exe\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_ZIP)) {\r\n\t\t\t\treturn \"zip\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_POSTSCRIPT)) {\r\n\t\t\t\treturn \"ps\";\r\n\t\t\t}\r\n\t\t} else if (StringUtil.equalsIgnoreCase(mediatype, MIMEConstants.MEDIATYPE_VIDEO)) {\r\n\t\t\tif (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_WINDOWSMEDIA)) {\r\n\t\t\t\treturn \"wmv\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_AVI)) {\r\n\t\t\t\treturn \"avi\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_MP4)) {\r\n\t\t\t\treturn \"mp4\";\r\n\t\t\t}\r\n\t\t} else if (StringUtil.equalsIgnoreCase(mediatype, MIMEConstants.MEDIATYPE_AUDIO)) {\r\n\t\t\tif (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_MPEG3) || StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_MPEG)) {\r\n\t\t\t\treturn \"mp3\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_WINDOWSAUDIO)) {\r\n\t\t\t\treturn \"wma\";\r\n\t\t\t} else if (StringUtil.equalsIgnoreCase(subtype, MIMEConstants.SUBTYPE_MP4)) {\r\n\t\t\t\treturn \"mp4\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t}", "@JsonProperty(\"contentType\")\n public String getContentType() {\n return contentType;\n }" ]
[ "0.7422548", "0.6961255", "0.6961255", "0.6961255", "0.6863672", "0.672557", "0.672557", "0.67227024", "0.6677401", "0.66054666", "0.65568143", "0.6495747", "0.6475821", "0.64708287", "0.6399924", "0.6324717", "0.62385404", "0.62385404", "0.6229523", "0.61074954", "0.61065316", "0.60804224", "0.60741913", "0.6069575", "0.6060236", "0.60296315", "0.60096604", "0.5998048", "0.59914243", "0.5980999", "0.59674793", "0.5930489", "0.5924524", "0.591665", "0.58981395", "0.58981395", "0.58981395", "0.58937037", "0.5892738", "0.58657503", "0.58657503", "0.58657503", "0.58657503", "0.58657503", "0.5849565", "0.5849356", "0.5849176", "0.5847511", "0.58403105", "0.5839426", "0.583754", "0.5833141", "0.58329386", "0.5814871", "0.57666606", "0.57632685", "0.5757777", "0.5752987", "0.574569", "0.57456326", "0.5732457", "0.57224303", "0.57125926", "0.57049406", "0.5703099", "0.56982446", "0.56982446", "0.5687751", "0.56871676", "0.56815344", "0.5673854", "0.56677914", "0.56674653", "0.5666948", "0.56596303", "0.5658725", "0.5657554", "0.5640435", "0.5638462", "0.56212366", "0.56212366", "0.56167144", "0.5594055", "0.55927277", "0.55757964", "0.55702704", "0.55571437", "0.55564487", "0.55481017", "0.5528351", "0.5525303", "0.5522462", "0.55216604", "0.55130726", "0.5510988", "0.5510072", "0.5504578", "0.5494996", "0.5478145", "0.5476006" ]
0.79831785
0