Skip to content

Instantly share code, notes, and snippets.

@renanreyc
Created August 23, 2021 02:18
Show Gist options
  • Save renanreyc/968b1cb3489810bd8f8eefea36f49c0f to your computer and use it in GitHub Desktop.
Save renanreyc/968b1cb3489810bd8f8eefea36f49c0f to your computer and use it in GitHub Desktop.
Projeto-Estrutura-de-Dados
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="15" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ProjetoCovid.iml" filepath="$PROJECT_DIR$/ProjetoCovid.iml" />
</modules>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7511c955-9c5b-455f-8d21-747c72546218" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="ProjectId" id="1wSMOAnRn39LSXHWc6LxMtEKtvg" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
</component>
<component name="RunManager">
<configuration name="ProjetoCovid" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="ProjetoCovid" />
<module name="ProjetoCovid" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.ProjetoCovid" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="7511c955-9c5b-455f-8d21-747c72546218" name="Default Changelist" comment="" />
<created>1628447503951</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1628447503951</updated>
</task>
<servers />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
package algoritmos;
import dataBase.CovidBase;
import java.util.Vector;
public class SelectionSort {
public static void ordenarCrescentePorOrbito(Vector<CovidBase> vector, int typeSort){
for (int i = 0; i < vector.size();i++){
}
}
}
package CSV;
import dataBase.CovidBase;
import java.io.*;
import java.util.Vector;
public class CSVReader {
public static Vector<CovidBase> readerData(String caminho) {
String linha = "";
boolean primeiraLinha = true;
Vector<CovidBase> data = new Vector<CovidBase>(1);
try {
FileReader fileReader = new FileReader(caminho);
BufferedReader bufferReader = new BufferedReader(fileReader);
while ((linha = bufferReader.readLine()) != null) {
if (primeiraLinha == true){
primeiraLinha = false;
continue;
}
// System.out.println(linha);
data.add(new CovidBase(linha));
}
bufferReader.close();
fileReader.close();
} catch (FileNotFoundException e) {
System.err.println("Arquivo não encontrado: \n"+e.getMessage());
} catch (IOException e) {
System.err.println("IO Erro: \n" + e.getMessage());
}
return data;
}
}
package dataBase;
public class CovidBase {
private String yearWeek;
private String date;
private String state;
private String orderForPlace;
private String city;
private String ibgeCode;
private String placeType;
private int availableConfirmed;
private double availableConfirmedPer100K;
private int newConfirmed;
private int availableDeaths;
private int newDeaths;
private double lastAvailableDeathRate;
private int estimatedPopulation;
private boolean isLast;
private boolean isRepeated;
private final int yearWeekId = 0;
private final int dateId = 1;
private final int orderForPlaceId = 2;
private final int stateId = 3;
private final int cityId = 4;
private final int ibgeCodeId = 5;
private final int placeTypeId = 6;
private final int availableConfirmedId = 7;
private final int availableConfirmedPer100KId = 8;
private final int newConfirmedId = 9;
private final int availableDeathsId = 10;
private final int newDeathsId = 11;
private final int lastAvailableDeathRateId = 12;
private final int estimatedPopulationId = 13;
private final int isLastId = 14;
private final int isRepeatedId = 15;
public CovidBase() {
}
public CovidBase(String CSVLine){
this.setData(CSVLine);
}
private void setData(String CSVLine) {
String[] columns = separarColunas(CSVLine);
this.yearWeek = columns[yearWeekId];
this.date = columns[dateId];
this.orderForPlace = columns[orderForPlaceId];
this.state = columns[stateId];
this.city = columns[cityId];
this.ibgeCode = columns[ibgeCodeId];
this.placeType = columns[placeTypeId];
this.availableConfirmed = convertToInt(columns[availableConfirmedId]);
this.availableConfirmedPer100K = convertToDouble(columns[availableConfirmedPer100KId]);
this.newConfirmed = convertToInt(columns[newConfirmedId]);
this.availableDeaths = convertToInt(columns[availableDeaths]);
this.newDeaths = convertToInt(columns[newDeathsId]);
this.lastAvailableDeathRate = convertToDouble(columns[lastAvailableDeathRateId]);
this.estimatedPopulation = convertToInt(columns[estimatedPopulationId]);
}
private int convertToInt(String text){
if (text == ""){
return 0;
}else {
return Integer.parseInt(text);
}
}
private double convertToDouble(String text){
if (text == ""){
return 0;
}else {
return Double.parseDouble(text);
}
}
private String[] separarColunas(String CSVLine){
return CSVLine.split(",");
}
@Override
public String toString() {
return "CovidBase{" +
"" +
"}";
}
}
import CSV.CSVReader;
import dataBase.CovidBase;
import tools.Paths;
import java.util.Vector;
public class ProjetoCovid {
public static void main(String[] args) {
String pathDataBase = "C:\\DOWNLOAD\\dataBase";
String pathNewFiles = "C:\\DOWNLOAD\\newFiles";
Vector<CovidBase> dados;
dados = CSVReader.readerData(Paths.path_data.replace("{0}",pathDataBase));
analiseSelectionSort(dados,pathDataBase,pathNewFiles);
}
public static void analiseSelectionSort(Vector dados,String pathDataBase, String pathNewFiles){
System.out.println("SelectionSort");
//Ordenação crescente por quantidade acumulada de óbitos;
long tempoInicial = System.currentTimeMillis();
System.out.println("o método executou em: " + (System.currentTimeMillis() - tempoInicial));
//Ordenação crescente por quantidade acumulada de casos;
//Ordenação crescente por ordem alfabética pelo nome das cidades.
}
}
public class ProjetoCovidBase {
private int weekId;
private String data;
private String cidade;
private String cep;
private String tipoDeLugar;
private int casosConfirmados;
private int casosConfirmadosPor100KHabitantes;
private int novosCasosConfirmados;
private int mortesConfirmadas;
private int novasMortesConfirmadas;
private int taxaDeMortalidade;
private int populacaoEstimada;
private boolean ultimaAtualizacao;
private boolean eRepetido;
private static final int weekIdIndex = 0;
private static final int dataIndex = 1;
private static final int cidadeIndex = 2;
private static final int cepIndex = 3;
private static final int tipoDeLugarIndex = 4;
private static final int casosConfirmadosIndex = 5;
private static final int casosConfirmadosPor100KHabitantesIndex = 6;
private static final int novosCasosConfirmadosIndex = 7;
private static final int mortesConfirmadasIndex = 8;
private static final int novasMortesConfirmadasIndex = 9;
private static final int taxaDeMortalidadeIndex = 10;
private static final int populacaoEstimadaIndex = 11;
private static final int ultimaAtualizacaoIndex = 12;
private static final int eRepetidoIndex = 13;
}
package tools;
public class Paths {
public static final String fisrtLine = "epidemiological_week,date,order_for_place,state,city," +
"city_ibge_code,place_type,last_available_confirmed,last_available_confirmed_per_100k_inhabitants," +
"new_confirmed,last_available_deaths,new_deaths,last_available_death_rate,estimated_population,is_last," +
"is_repeated";
public static final String path_data = "{0}/caso.csv";
}
@renanreyc
Copy link
Author

Projeto de Estrutura de Dados e Laboratório de Estrutura de Dados
Criação e análise dos algoritmos de ordenação aprendidos em sala de aula aplicado no DataSet do COVID-19 disponível no brasil.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment