file_id
stringlengths
4
10
content
stringlengths
91
42.8k
repo
stringlengths
7
108
path
stringlengths
7
251
token_length
int64
34
8.19k
original_comment
stringlengths
11
11.5k
comment_type
stringclasses
2 values
detected_lang
stringclasses
1 value
prompt
stringlengths
34
42.8k
213808_2
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.AANTALDOC; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.zaken.documenten.DocumentRecord; import nl.procura.vaadin.component.container.ArrayListContainer; public class DocumentMapForm extends GbaForm<DocumentMapBean> { public DocumentMapForm(List<DocumentRecord> docList) { setOrder(AANTALDOC, MAP); initFields(docList); } @Override public void attach() { setDocumentmapContainer(); super.attach(); } void setDocumentmapContainer() { ComboBox map = (ComboBox) getField(DocumentMapBean.MAP); map.setContainerDataSource(new DocumentmapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijk of er een gemeenschappelijke map voor de documenten te vinden is. */ private String getCommonDocPath(List<DocumentRecord> doclList) { String path = doclList.get(0).getPad(); // we nemen het eerste pad als referentie for (DocumentRecord doc : doclList) { String docPath = doc.getPad(); if (path.startsWith(docPath)) { path = docPath; } else if (!docPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<DocumentRecord> docList) { DocumentMapBean bean = new DocumentMapBean(); bean.setAantalDocumenten(docList.size()); String path = getCommonDocPath(docList); bean.setMap(path); setBean(bean); } private class DocumentmapContainer extends ArrayListContainer { private DocumentmapContainer() { List<DocumentRecord> documentList = getApplication().getServices().getDocumentService().getDocumenten( false); List<String> pathList = new ArrayList<>(); for (DocumentRecord doc : documentList) { String cleanedPath = cleanPath(doc.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/beheer/documenten/page1/tab1/page2/DocumentMapForm.java
1,012
// we nemen het eerste pad als referentie
line_comment
nl
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.AANTALDOC; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.zaken.documenten.DocumentRecord; import nl.procura.vaadin.component.container.ArrayListContainer; public class DocumentMapForm extends GbaForm<DocumentMapBean> { public DocumentMapForm(List<DocumentRecord> docList) { setOrder(AANTALDOC, MAP); initFields(docList); } @Override public void attach() { setDocumentmapContainer(); super.attach(); } void setDocumentmapContainer() { ComboBox map = (ComboBox) getField(DocumentMapBean.MAP); map.setContainerDataSource(new DocumentmapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijk of er een gemeenschappelijke map voor de documenten te vinden is. */ private String getCommonDocPath(List<DocumentRecord> doclList) { String path = doclList.get(0).getPad(); // we nemen<SUF> for (DocumentRecord doc : doclList) { String docPath = doc.getPad(); if (path.startsWith(docPath)) { path = docPath; } else if (!docPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<DocumentRecord> docList) { DocumentMapBean bean = new DocumentMapBean(); bean.setAantalDocumenten(docList.size()); String path = getCommonDocPath(docList); bean.setMap(path); setBean(bean); } private class DocumentmapContainer extends ArrayListContainer { private DocumentmapContainer() { List<DocumentRecord> documentList = getApplication().getServices().getDocumentService().getDocumenten( false); List<String> pathList = new ArrayList<>(); for (DocumentRecord doc : documentList) { String cleanedPath = cleanPath(doc.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
213808_3
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.AANTALDOC; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.zaken.documenten.DocumentRecord; import nl.procura.vaadin.component.container.ArrayListContainer; public class DocumentMapForm extends GbaForm<DocumentMapBean> { public DocumentMapForm(List<DocumentRecord> docList) { setOrder(AANTALDOC, MAP); initFields(docList); } @Override public void attach() { setDocumentmapContainer(); super.attach(); } void setDocumentmapContainer() { ComboBox map = (ComboBox) getField(DocumentMapBean.MAP); map.setContainerDataSource(new DocumentmapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijk of er een gemeenschappelijke map voor de documenten te vinden is. */ private String getCommonDocPath(List<DocumentRecord> doclList) { String path = doclList.get(0).getPad(); // we nemen het eerste pad als referentie for (DocumentRecord doc : doclList) { String docPath = doc.getPad(); if (path.startsWith(docPath)) { path = docPath; } else if (!docPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<DocumentRecord> docList) { DocumentMapBean bean = new DocumentMapBean(); bean.setAantalDocumenten(docList.size()); String path = getCommonDocPath(docList); bean.setMap(path); setBean(bean); } private class DocumentmapContainer extends ArrayListContainer { private DocumentmapContainer() { List<DocumentRecord> documentList = getApplication().getServices().getDocumentService().getDocumenten( false); List<String> pathList = new ArrayList<>(); for (DocumentRecord doc : documentList) { String cleanedPath = cleanPath(doc.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/beheer/documenten/page1/tab1/page2/DocumentMapForm.java
1,012
// geen gemeenschappelijk pad!
line_comment
nl
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.AANTALDOC; import static nl.procura.gba.web.modules.beheer.documenten.page1.tab1.page2.DocumentMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.zaken.documenten.DocumentRecord; import nl.procura.vaadin.component.container.ArrayListContainer; public class DocumentMapForm extends GbaForm<DocumentMapBean> { public DocumentMapForm(List<DocumentRecord> docList) { setOrder(AANTALDOC, MAP); initFields(docList); } @Override public void attach() { setDocumentmapContainer(); super.attach(); } void setDocumentmapContainer() { ComboBox map = (ComboBox) getField(DocumentMapBean.MAP); map.setContainerDataSource(new DocumentmapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijk of er een gemeenschappelijke map voor de documenten te vinden is. */ private String getCommonDocPath(List<DocumentRecord> doclList) { String path = doclList.get(0).getPad(); // we nemen het eerste pad als referentie for (DocumentRecord doc : doclList) { String docPath = doc.getPad(); if (path.startsWith(docPath)) { path = docPath; } else if (!docPath.startsWith(path)) { // geen gemeenschappelijk<SUF> return ""; } } return path; } private void initFields(List<DocumentRecord> docList) { DocumentMapBean bean = new DocumentMapBean(); bean.setAantalDocumenten(docList.size()); String path = getCommonDocPath(docList); bean.setMap(path); setBean(bean); } private class DocumentmapContainer extends ArrayListContainer { private DocumentmapContainer() { List<DocumentRecord> documentList = getApplication().getServices().getDocumentService().getDocumenten( false); List<String> pathList = new ArrayList<>(); for (DocumentRecord doc : documentList) { String cleanedPath = cleanPath(doc.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
213810_0
package be.vlaanderen.vip.mock.magdaservice.controller; import be.vlaanderen.vip.magda.client.MagdaDocument; import be.vlaanderen.vip.magda.client.connection.MagdaConnection; import be.vlaanderen.vip.magda.exception.MagdaConnectionException; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.MediaType.APPLICATION_XML; import static org.springframework.util.MimeTypeUtils.APPLICATION_XML_VALUE; import static org.springframework.util.MimeTypeUtils.TEXT_XML_VALUE; @RestController @Slf4j public class MagdaMockController { // Gemeenschappelijk endpoint voor alle MAGDA SOAP 2.0 webservices private static final String MAGDA_SOAP_02_00 = "Magda-02.00/soap/WebService"; private final MagdaConnection mockConnection; public MagdaMockController(MagdaConnection mockConnection) { this.mockConnection = mockConnection; } @PostMapping(value = {MAGDA_SOAP_02_00, "api/" + MAGDA_SOAP_02_00}, produces = {TEXT_XML_VALUE}, consumes = {APPLICATION_XML_VALUE, TEXT_XML_VALUE}) public ResponseEntity<String> magdaSoap0200WebService(@RequestBody String request) throws MagdaConnectionException { return processMagdaMockRequest(request); } private ResponseEntity<String> processMagdaMockRequest(String request) throws MagdaConnectionException { //TODO: handle request parsing errors and return Magda Uitzondering error var requestDocument = MagdaDocument.fromString(request); var magdaResponse = mockConnection.sendDocument(requestDocument.getXml()); if (magdaResponse != null) { return parseInputstream(MagdaDocument.fromDocument(magdaResponse)); } else { return ResponseEntity.notFound().build(); } } private ResponseEntity<String> parseInputstream(MagdaDocument magdaDocument) { if (magdaDocument != null) { return ResponseEntity.ok().contentType(APPLICATION_XML).body(magdaDocument.toString()); } else { log.error("Could not find XML"); // TODO: maak en return MAGDA Uitzondering antwoord return ResponseEntity.notFound().build(); } } }
Informatievlaanderen/MAGDA-Mock
magdaservice/src/main/java/be/vlaanderen/vip/mock/magdaservice/controller/MagdaMockController.java
607
// Gemeenschappelijk endpoint voor alle MAGDA SOAP 2.0 webservices
line_comment
nl
package be.vlaanderen.vip.mock.magdaservice.controller; import be.vlaanderen.vip.magda.client.MagdaDocument; import be.vlaanderen.vip.magda.client.connection.MagdaConnection; import be.vlaanderen.vip.magda.exception.MagdaConnectionException; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.MediaType.APPLICATION_XML; import static org.springframework.util.MimeTypeUtils.APPLICATION_XML_VALUE; import static org.springframework.util.MimeTypeUtils.TEXT_XML_VALUE; @RestController @Slf4j public class MagdaMockController { // Gemeenschappelijk endpoint<SUF> private static final String MAGDA_SOAP_02_00 = "Magda-02.00/soap/WebService"; private final MagdaConnection mockConnection; public MagdaMockController(MagdaConnection mockConnection) { this.mockConnection = mockConnection; } @PostMapping(value = {MAGDA_SOAP_02_00, "api/" + MAGDA_SOAP_02_00}, produces = {TEXT_XML_VALUE}, consumes = {APPLICATION_XML_VALUE, TEXT_XML_VALUE}) public ResponseEntity<String> magdaSoap0200WebService(@RequestBody String request) throws MagdaConnectionException { return processMagdaMockRequest(request); } private ResponseEntity<String> processMagdaMockRequest(String request) throws MagdaConnectionException { //TODO: handle request parsing errors and return Magda Uitzondering error var requestDocument = MagdaDocument.fromString(request); var magdaResponse = mockConnection.sendDocument(requestDocument.getXml()); if (magdaResponse != null) { return parseInputstream(MagdaDocument.fromDocument(magdaResponse)); } else { return ResponseEntity.notFound().build(); } } private ResponseEntity<String> parseInputstream(MagdaDocument magdaDocument) { if (magdaDocument != null) { return ResponseEntity.ok().contentType(APPLICATION_XML).body(magdaDocument.toString()); } else { log.error("Could not find XML"); // TODO: maak en return MAGDA Uitzondering antwoord return ResponseEntity.notFound().build(); } } }
213810_2
package be.vlaanderen.vip.mock.magdaservice.controller; import be.vlaanderen.vip.magda.client.MagdaDocument; import be.vlaanderen.vip.magda.client.connection.MagdaConnection; import be.vlaanderen.vip.magda.exception.MagdaConnectionException; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.MediaType.APPLICATION_XML; import static org.springframework.util.MimeTypeUtils.APPLICATION_XML_VALUE; import static org.springframework.util.MimeTypeUtils.TEXT_XML_VALUE; @RestController @Slf4j public class MagdaMockController { // Gemeenschappelijk endpoint voor alle MAGDA SOAP 2.0 webservices private static final String MAGDA_SOAP_02_00 = "Magda-02.00/soap/WebService"; private final MagdaConnection mockConnection; public MagdaMockController(MagdaConnection mockConnection) { this.mockConnection = mockConnection; } @PostMapping(value = {MAGDA_SOAP_02_00, "api/" + MAGDA_SOAP_02_00}, produces = {TEXT_XML_VALUE}, consumes = {APPLICATION_XML_VALUE, TEXT_XML_VALUE}) public ResponseEntity<String> magdaSoap0200WebService(@RequestBody String request) throws MagdaConnectionException { return processMagdaMockRequest(request); } private ResponseEntity<String> processMagdaMockRequest(String request) throws MagdaConnectionException { //TODO: handle request parsing errors and return Magda Uitzondering error var requestDocument = MagdaDocument.fromString(request); var magdaResponse = mockConnection.sendDocument(requestDocument.getXml()); if (magdaResponse != null) { return parseInputstream(MagdaDocument.fromDocument(magdaResponse)); } else { return ResponseEntity.notFound().build(); } } private ResponseEntity<String> parseInputstream(MagdaDocument magdaDocument) { if (magdaDocument != null) { return ResponseEntity.ok().contentType(APPLICATION_XML).body(magdaDocument.toString()); } else { log.error("Could not find XML"); // TODO: maak en return MAGDA Uitzondering antwoord return ResponseEntity.notFound().build(); } } }
Informatievlaanderen/MAGDA-Mock
magdaservice/src/main/java/be/vlaanderen/vip/mock/magdaservice/controller/MagdaMockController.java
607
// TODO: maak en return MAGDA Uitzondering antwoord
line_comment
nl
package be.vlaanderen.vip.mock.magdaservice.controller; import be.vlaanderen.vip.magda.client.MagdaDocument; import be.vlaanderen.vip.magda.client.connection.MagdaConnection; import be.vlaanderen.vip.magda.exception.MagdaConnectionException; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.MediaType.APPLICATION_XML; import static org.springframework.util.MimeTypeUtils.APPLICATION_XML_VALUE; import static org.springframework.util.MimeTypeUtils.TEXT_XML_VALUE; @RestController @Slf4j public class MagdaMockController { // Gemeenschappelijk endpoint voor alle MAGDA SOAP 2.0 webservices private static final String MAGDA_SOAP_02_00 = "Magda-02.00/soap/WebService"; private final MagdaConnection mockConnection; public MagdaMockController(MagdaConnection mockConnection) { this.mockConnection = mockConnection; } @PostMapping(value = {MAGDA_SOAP_02_00, "api/" + MAGDA_SOAP_02_00}, produces = {TEXT_XML_VALUE}, consumes = {APPLICATION_XML_VALUE, TEXT_XML_VALUE}) public ResponseEntity<String> magdaSoap0200WebService(@RequestBody String request) throws MagdaConnectionException { return processMagdaMockRequest(request); } private ResponseEntity<String> processMagdaMockRequest(String request) throws MagdaConnectionException { //TODO: handle request parsing errors and return Magda Uitzondering error var requestDocument = MagdaDocument.fromString(request); var magdaResponse = mockConnection.sendDocument(requestDocument.getXml()); if (magdaResponse != null) { return parseInputstream(MagdaDocument.fromDocument(magdaResponse)); } else { return ResponseEntity.notFound().build(); } } private ResponseEntity<String> parseInputstream(MagdaDocument magdaDocument) { if (magdaDocument != null) { return ResponseEntity.ok().contentType(APPLICATION_XML).body(magdaDocument.toString()); } else { log.error("Could not find XML"); // TODO: maak<SUF> return ResponseEntity.notFound().build(); } } }
213812_0
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen het eerste pad als referentie for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/beheer/gebruikers/page7/MakeMapForm.java
1,026
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */
block_comment
nl
/* * Copyright 2021 -<SUF>*/ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen het eerste pad als referentie for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
213812_1
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen het eerste pad als referentie for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/beheer/gebruikers/page7/MakeMapForm.java
1,026
/** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */
block_comment
nl
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er<SUF>*/ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen het eerste pad als referentie for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
213812_2
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen het eerste pad als referentie for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/beheer/gebruikers/page7/MakeMapForm.java
1,026
// we nemen het eerste pad als referentie
line_comment
nl
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen<SUF> for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
213812_3
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen het eerste pad als referentie for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk pad! return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/beheer/gebruikers/page7/MakeMapForm.java
1,026
// geen gemeenschappelijk pad!
line_comment
nl
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.beheer.gebruikers.page7; import static nl.procura.gba.common.MiscUtils.cleanPath; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.AANTALGEBR; import static nl.procura.gba.web.modules.beheer.gebruikers.page7.MakeMapBean.MAP; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.vaadin.ui.ComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.beheer.gebruiker.Gebruiker; import nl.procura.vaadin.component.container.ArrayListContainer; public class MakeMapForm extends GbaForm<MakeMapBean> { public MakeMapForm(List<Gebruiker> selectedUserList) { setOrder(AANTALGEBR, MAP); initFields(selectedUserList); } @Override public void attach() { setGebruikermapContainer(); super.attach(); } protected void setGebruikermapContainer() { ComboBox map = (ComboBox) getField(MakeMapBean.MAP); map.setContainerDataSource(new GebruikermapContainer()); map.setNewItemsAllowed(true); map.setValue(cleanPath(getBean().getMap())); } /** * Kijkt of er een gemeenschappelijke map te vinden is voor de geselecteerde gebruikers. */ private String getCommonUserPath(List<Gebruiker> userList) { String path = userList.get(0).getPad(); // we nemen het eerste pad als referentie for (Gebruiker gebruiker : userList) { String userPath = gebruiker.getPad(); if (path.startsWith(userPath)) { path = userPath; } else if (!userPath.startsWith(path)) { // geen gemeenschappelijk<SUF> return ""; } } return path; } private void initFields(List<Gebruiker> gebrList) { String commonUserPath = getCommonUserPath(gebrList); MakeMapBean bean = new MakeMapBean(); bean.setAantalGebruikers(gebrList.size()); bean.setMap(commonUserPath); setBean(bean); } private final class GebruikermapContainer extends ArrayListContainer { private GebruikermapContainer() { List<Gebruiker> usrList = getApplication().getServices().getGebruikerService().getGebruikers(false); List<String> pathList = new ArrayList<>(); for (Gebruiker g : usrList) { String cleanedPath = cleanPath(g.getPad()); if (!pathList.contains(cleanedPath)) { pathList.add(cleanedPath); } } Collections.sort(pathList); for (String map : pathList) { addItem(map); } } } }
213813_0
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.bs.geboorte.page60; import java.io.Serializable; import java.lang.annotation.ElementType; import nl.procura.gba.web.components.fields.GbaNativeSelect; import nl.procura.gba.web.components.layouts.BeanHandler; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.bs.geboorte.DossierGeboorte; import nl.procura.vaadin.annotation.field.Field; import nl.procura.vaadin.annotation.field.Field.FieldType; import nl.procura.vaadin.annotation.field.FormFieldFactoryBean; import nl.procura.vaadin.annotation.field.Immediate; import nl.procura.vaadin.annotation.field.Select; import nl.procura.vaadin.component.container.NLBooleanContainer; import lombok.Data; public class Page60GeboorteFormStap2 extends GbaForm<Page60GeboorteFormStap2.Page60GeboorteBean3> { public static final String STAP2 = "stap2"; public static final String VB1 = "vb1"; public static final String VB2 = "vb2"; public Page60GeboorteFormStap2() { setCaptionAndOrder(); } public Page60GeboorteFormStap2(DossierGeboorte geboorte) { this(); Page60GeboorteBean3 bean = new Page60GeboorteBean3(); bean.setVb1(geboorte.getMoeder().getLand().getDescription()); bean.setVb2(geboorte.getVader().getLand().getDescription()); BeanHandler.trim(bean); setBean(bean); } @Override public Page60GeboorteBean3 getNewBean() { return new Page60GeboorteBean3(); } public void setCaptionAndOrder() { } @Data @FormFieldFactoryBean(accessType = ElementType.FIELD) public static class Page60GeboorteBean3 implements Serializable { @Field(customTypeClass = GbaNativeSelect.class, caption = "Gemeenschappelijke verblijfplaats (land) ouders?", required = true) @Select(containerDataSource = NLBooleanContainer.class, itemCaptionPropertyId = NLBooleanContainer.JA_NEE) @Immediate private Boolean stap2 = null; @Field(type = FieldType.LABEL, caption = "Verblijfplaats moeder in") private String vb1 = ""; @Field(type = FieldType.LABEL, caption = "Verblijfplaats vader / duo-moeder in") private String vb2 = ""; } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/bs/geboorte/page60/Page60GeboorteFormStap2.java
889
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */
block_comment
nl
/* * Copyright 2021 -<SUF>*/ package nl.procura.gba.web.modules.bs.geboorte.page60; import java.io.Serializable; import java.lang.annotation.ElementType; import nl.procura.gba.web.components.fields.GbaNativeSelect; import nl.procura.gba.web.components.layouts.BeanHandler; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.services.bs.geboorte.DossierGeboorte; import nl.procura.vaadin.annotation.field.Field; import nl.procura.vaadin.annotation.field.Field.FieldType; import nl.procura.vaadin.annotation.field.FormFieldFactoryBean; import nl.procura.vaadin.annotation.field.Immediate; import nl.procura.vaadin.annotation.field.Select; import nl.procura.vaadin.component.container.NLBooleanContainer; import lombok.Data; public class Page60GeboorteFormStap2 extends GbaForm<Page60GeboorteFormStap2.Page60GeboorteBean3> { public static final String STAP2 = "stap2"; public static final String VB1 = "vb1"; public static final String VB2 = "vb2"; public Page60GeboorteFormStap2() { setCaptionAndOrder(); } public Page60GeboorteFormStap2(DossierGeboorte geboorte) { this(); Page60GeboorteBean3 bean = new Page60GeboorteBean3(); bean.setVb1(geboorte.getMoeder().getLand().getDescription()); bean.setVb2(geboorte.getVader().getLand().getDescription()); BeanHandler.trim(bean); setBean(bean); } @Override public Page60GeboorteBean3 getNewBean() { return new Page60GeboorteBean3(); } public void setCaptionAndOrder() { } @Data @FormFieldFactoryBean(accessType = ElementType.FIELD) public static class Page60GeboorteBean3 implements Serializable { @Field(customTypeClass = GbaNativeSelect.class, caption = "Gemeenschappelijke verblijfplaats (land) ouders?", required = true) @Select(containerDataSource = NLBooleanContainer.class, itemCaptionPropertyId = NLBooleanContainer.JA_NEE) @Immediate private Boolean stap2 = null; @Field(type = FieldType.LABEL, caption = "Verblijfplaats moeder in") private String vb1 = ""; @Field(type = FieldType.LABEL, caption = "Verblijfplaats vader / duo-moeder in") private String vb2 = ""; } }
213815_1
/* * Copyright (c) 2007, Topicus B.V. * All rights reserved. */ package nl.topicus.eduarte.dao.hibernate; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import nl.topicus.cobra.dao.DataAccessRegistry; import nl.topicus.cobra.dao.hibernate.AbstractZoekFilterDataAccessHelper; import nl.topicus.cobra.dao.hibernate.CriteriaBuilder; import nl.topicus.cobra.dao.hibernate.QueryInterceptor; import nl.topicus.cobra.dao.hibernate.DetachedCriteriaBuilder; import nl.topicus.cobra.dao.hibernate.HibernateSessionProvider; import nl.topicus.cobra.util.Asserts; import nl.topicus.cobra.util.StringUtil; import nl.topicus.cobra.util.TimeUtil; import nl.topicus.eduarte.app.EduArteContext; import nl.topicus.eduarte.app.signalering.EventAbonnementType; import nl.topicus.eduarte.app.signalering.EventReceiver; import nl.topicus.eduarte.dao.helpers.DBSMedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.LocatieDataAccessHelper; import nl.topicus.eduarte.dao.helpers.MedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.OrganisatieEenheidDataAccessHelper; import nl.topicus.eduarte.entities.groep.GroepDocent; import nl.topicus.eduarte.entities.groep.GroepMentor; import nl.topicus.eduarte.entities.organisatie.Locatie; import nl.topicus.eduarte.entities.organisatie.OrganisatieEenheid; import nl.topicus.eduarte.entities.personen.Deelnemer; import nl.topicus.eduarte.entities.personen.Medewerker; import nl.topicus.eduarte.entities.personen.OrganisatieMedewerker; import nl.topicus.eduarte.entities.personen.Persoon; import nl.topicus.eduarte.entities.security.authentication.MedewerkerAccount; import nl.topicus.eduarte.entities.security.authorization.Rol; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerDeelnemerAbonnering; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerGroepAbonnering; import nl.topicus.eduarte.zoekfilters.MedewerkerZoekFilter; import org.hibernate.Criteria; import org.hibernate.criterion.*; public class MedewerkerHibernateDataAccessHelper extends AbstractZoekFilterDataAccessHelper<Medewerker, MedewerkerZoekFilter> implements MedewerkerDataAccessHelper { public MedewerkerHibernateDataAccessHelper(HibernateSessionProvider provider, QueryInterceptor interceptor) { super(provider, interceptor); } @Override protected Criteria createCriteria(MedewerkerZoekFilter filter) { Criteria criteria = createCriteria(Medewerker.class); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.createAlias("persoon", "persoon"); if (filter.getHeeftAccount() != null) { DetachedCriteria dcAccount = createDetachedCriteria(MedewerkerAccount.class); dcAccount.setProjection(Projections.property("medewerker")); DetachedCriteriaBuilder dcAccountBuilder = new DetachedCriteriaBuilder(dcAccount); dcAccountBuilder.addIsNull("medewerker", false); if (filter.getHeeftAccount()) criteria.add(Subqueries.propertyIn("id", dcAccount)); else criteria.add(Subqueries.propertyNotIn("id", dcAccount)); filter.setResultCacheable(false); } if (!filter.addOrganisatieEenheidLocatieDetachedCriteria(this, criteria, OrganisatieMedewerker.class, "medewerker")) return null; builder.addLessOrEquals("begindatum", filter.getPeildatum()); builder.addGreaterOrEquals("einddatumNotNull", filter.getPeildatum()); builder.addILikeCheckWildcard("afkorting", filter.getAfkorting(), MatchMode.START); builder.addILikeCheckWildcard("persoon.achternaam", filter.getAchternaam(), MatchMode.ANYWHERE); builder.addILikeCheckWildcard("persoon.voorvoegsel", filter.getVoorvoegsel(), MatchMode.START); builder .addILikeCheckWildcard("persoon.voornamen", filter.getVoornaam(), MatchMode.ANYWHERE); builder.addEquals("persoon.geslacht", filter.getGeslacht()); builder.addEquals("persoon.bsn", filter.getBsn()); builder.addEquals("functie", filter.getFunctie()); if (filter.getMultizoek() != null) { Criterion volledigeNaam = builder.getVolledigeNaamILike("persoon.berekendeZoeknaam", filter.getMultizoek()); builder.addOrs(volledigeNaam, Restrictions.ilike("afkorting", filter.getMultizoek(), MatchMode.START)); } if (filter.getRollen() != null && !filter.getRollen().isEmpty()) { DetachedCriteria dc = createDetachedCriteria(MedewerkerAccount.class); DetachedCriteriaBuilder dcBuilder = new DetachedCriteriaBuilder(dc); List<Long> rolIds = new ArrayList<Long>(); for (Rol rol : filter.getRollen()) rolIds.add(rol.getId()); dcBuilder.createAlias("roles", "rol"); dc.add(Restrictions.in("rol.id", rolIds)); dc.add(Restrictions.isNotNull("medewerker")); dc.setProjection(Projections.property("medewerker")); builder.getCriteria().add(Subqueries.propertyIn("id", dc)); } filter.addQuickSearchCriteria(builder, "afkorting", "persoon.achternaam", "persoon.officieleAchternaam", "persoon.roepnaam", "persoon.berekendeZoeknaam"); if (filter.getSnelZoekenString() != null) { builder.addOrs(getSnelZoekCriteria(filter.getSnelZoekenString(), "persoon")); } return criteria; } public List<Criterion> getSnelZoekCriteria(String snelZoekenString, String persoonAlias) { List<Criterion> whereList = new ArrayList<Criterion>(); whereList.add(Restrictions.ilike(persoonAlias + ".achternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".officieleAchternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".roepnaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".berekendeZoeknaam", snelZoekenString, MatchMode.ANYWHERE)); Date geboorteDatum = TimeUtil.getInstance().parseDateString(snelZoekenString); if (geboorteDatum != null) whereList.add(Restrictions.eq(persoonAlias + ".geboortedatum", geboorteDatum)); return whereList; } @Override public Conjunction addMultiZoekCriteria(String multiZoek) { boolean addedCheck = false; String[] zoekwaardes = multiZoek.split(","); Conjunction zoekwaardesTotaal = Restrictions.conjunction(); Disjunction zoekwaardesIteratie = Restrictions.disjunction(); Date geboorteDatum = null; for (int i = 0; i < zoekwaardes.length; i++) { if (StringUtil.isEmpty(zoekwaardes[i])) continue; if (!StringUtil.isNumeric(zoekwaardes[i])) { addedCheck = true; zoekwaardesIteratie.add(Restrictions.ilike("persoon.roepnaam", zoekwaardes[i], MatchMode.ANYWHERE)); zoekwaardesIteratie.add(Restrictions.ilike("persoon.achternaam", zoekwaardes[i], MatchMode.ANYWHERE)); } // geboortedatum kan zowel numeriek als niet numeriek zijn (streepjes e.d) geboorteDatum = TimeUtil.getInstance().parseDateString(zoekwaardes[i]); if (geboorteDatum != null) { zoekwaardesIteratie.add(Restrictions.eq("persoon.geboortedatum", geboorteDatum)); addedCheck = true; } zoekwaardesTotaal.add(zoekwaardesIteratie); zoekwaardesIteratie = Restrictions.disjunction(); } return addedCheck ? zoekwaardesTotaal : null; } @Override public Medewerker get(Long id) { return get(Medewerker.class, id); } @Override public Medewerker get(Persoon persoon) { Asserts.assertNotNull("persoon", persoon); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("persoon", persoon))); } @Override public boolean isDocentVan(Medewerker docent, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(docent, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public boolean isBegeleiderVan(Medewerker begeleider, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(begeleider, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public List<Medewerker> getDocentenVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } @Override public List<Medewerker> getBegeleidersVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } /** * Het gemeenschappelijke deel van de query of iemand docent of begeleider is van een * deelnemer. */ private void createDocentBegeleiderCriteria(Medewerker medewerker, Deelnemer deelnemer, Date peilDatum, Criteria criteria) { CriteriaBuilder builder = new CriteriaBuilder(criteria); if (medewerker == null) { criteria.createAlias("medewerker", "medewerker"); builder.addLessOrEquals("medewerker.begindatum", peilDatum); builder.addGreaterOrEquals("medewerker.einddatumNotNull", peilDatum); } else builder.addEquals("medewerker", medewerker); if (deelnemer != null) { criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnemers", "deelname"); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peilDatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peilDatum); builder.addLessOrEquals("groep.begindatum", peilDatum); builder.addGreaterOrEquals("groep.einddatumNotNull", peilDatum); } } @Override public Medewerker batchGetByAfkorting(String afkorting) { Asserts.assertNotEmpty("afkorting", afkorting); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("afkorting", afkorting))); } @Override public List<OrganisatieMedewerker> getOrganisatieMedewerkers(Medewerker medewerker, boolean instellingAuthorized, boolean orgEhdAuthorized) { OrganisatieEenheidDataAccessHelper helper = DataAccessRegistry.getHelper(OrganisatieEenheidDataAccessHelper.class); LocatieDataAccessHelper locatieHelper = DataAccessRegistry.getHelper(LocatieDataAccessHelper.class); if (instellingAuthorized) { List<OrganisatieEenheid> orgEhds = helper.list(); List<Locatie> locaties = locatieHelper.list(EduArteContext.get().getPeildatum()); List<OrganisatieMedewerker> res = new ArrayList<OrganisatieMedewerker>(); for (OrganisatieEenheid ehd : orgEhds) { for (Locatie loc : locaties) { res.add(new OrganisatieMedewerker(ehd, loc)); } } return res; } else { if (orgEhdAuthorized && medewerker != null) { return medewerker.getOrganisatieMedewerkers(); } } return Collections.emptyList(); } @Override public Map<EventAbonnementType, List< ? extends EventReceiver>> getEventReceivers( Deelnemer deelnemer) { Map<EventAbonnementType, List< ? extends EventReceiver>> ret = new HashMap<EventAbonnementType, List< ? extends EventReceiver>>(); Date nu = TimeUtil.getInstance().currentDate(); ret.put(EventAbonnementType.GeselecteerdeDeelnemers, getDeelnemerMedewerkers(deelnemer)); ret.put(EventAbonnementType.GeselecteerdeGroepen, getGroepMedewerkers(deelnemer, nu)); ret.put(EventAbonnementType.Docent, getDocentenVan(deelnemer, nu)); ret.put(EventAbonnementType.Mentor, getBegeleidersVan(deelnemer, nu)); ret.put( EventAbonnementType.Uitvoerende, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class).getUitvoerendenVan( deelnemer, nu)); ret.put(EventAbonnementType.Verantwoordelijke, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class) .getVerantwoordelijkenVan(deelnemer, nu)); return ret; } private List<Medewerker> getDeelnemerMedewerkers(Deelnemer deelnemer) { Criteria criteria = createCriteria(MedewerkerDeelnemerAbonnering.class); criteria.add(Restrictions.eq("deelnemer", deelnemer)); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } private List<Medewerker> getGroepMedewerkers(Deelnemer deelnemer, Date peildatum) { Criteria criteria = createCriteria(MedewerkerGroepAbonnering.class); criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnamesUnordered", "deelname"); // criteria.createAlias("deelname.deelnemer", "deelnemer"); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peildatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peildatum); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } }
topicusonderwijs/tribe-krd-opensource
eduarte/core/src/main/java/nl/topicus/eduarte/dao/hibernate/MedewerkerHibernateDataAccessHelper.java
3,954
// geboortedatum kan zowel numeriek als niet numeriek zijn (streepjes e.d)
line_comment
nl
/* * Copyright (c) 2007, Topicus B.V. * All rights reserved. */ package nl.topicus.eduarte.dao.hibernate; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import nl.topicus.cobra.dao.DataAccessRegistry; import nl.topicus.cobra.dao.hibernate.AbstractZoekFilterDataAccessHelper; import nl.topicus.cobra.dao.hibernate.CriteriaBuilder; import nl.topicus.cobra.dao.hibernate.QueryInterceptor; import nl.topicus.cobra.dao.hibernate.DetachedCriteriaBuilder; import nl.topicus.cobra.dao.hibernate.HibernateSessionProvider; import nl.topicus.cobra.util.Asserts; import nl.topicus.cobra.util.StringUtil; import nl.topicus.cobra.util.TimeUtil; import nl.topicus.eduarte.app.EduArteContext; import nl.topicus.eduarte.app.signalering.EventAbonnementType; import nl.topicus.eduarte.app.signalering.EventReceiver; import nl.topicus.eduarte.dao.helpers.DBSMedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.LocatieDataAccessHelper; import nl.topicus.eduarte.dao.helpers.MedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.OrganisatieEenheidDataAccessHelper; import nl.topicus.eduarte.entities.groep.GroepDocent; import nl.topicus.eduarte.entities.groep.GroepMentor; import nl.topicus.eduarte.entities.organisatie.Locatie; import nl.topicus.eduarte.entities.organisatie.OrganisatieEenheid; import nl.topicus.eduarte.entities.personen.Deelnemer; import nl.topicus.eduarte.entities.personen.Medewerker; import nl.topicus.eduarte.entities.personen.OrganisatieMedewerker; import nl.topicus.eduarte.entities.personen.Persoon; import nl.topicus.eduarte.entities.security.authentication.MedewerkerAccount; import nl.topicus.eduarte.entities.security.authorization.Rol; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerDeelnemerAbonnering; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerGroepAbonnering; import nl.topicus.eduarte.zoekfilters.MedewerkerZoekFilter; import org.hibernate.Criteria; import org.hibernate.criterion.*; public class MedewerkerHibernateDataAccessHelper extends AbstractZoekFilterDataAccessHelper<Medewerker, MedewerkerZoekFilter> implements MedewerkerDataAccessHelper { public MedewerkerHibernateDataAccessHelper(HibernateSessionProvider provider, QueryInterceptor interceptor) { super(provider, interceptor); } @Override protected Criteria createCriteria(MedewerkerZoekFilter filter) { Criteria criteria = createCriteria(Medewerker.class); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.createAlias("persoon", "persoon"); if (filter.getHeeftAccount() != null) { DetachedCriteria dcAccount = createDetachedCriteria(MedewerkerAccount.class); dcAccount.setProjection(Projections.property("medewerker")); DetachedCriteriaBuilder dcAccountBuilder = new DetachedCriteriaBuilder(dcAccount); dcAccountBuilder.addIsNull("medewerker", false); if (filter.getHeeftAccount()) criteria.add(Subqueries.propertyIn("id", dcAccount)); else criteria.add(Subqueries.propertyNotIn("id", dcAccount)); filter.setResultCacheable(false); } if (!filter.addOrganisatieEenheidLocatieDetachedCriteria(this, criteria, OrganisatieMedewerker.class, "medewerker")) return null; builder.addLessOrEquals("begindatum", filter.getPeildatum()); builder.addGreaterOrEquals("einddatumNotNull", filter.getPeildatum()); builder.addILikeCheckWildcard("afkorting", filter.getAfkorting(), MatchMode.START); builder.addILikeCheckWildcard("persoon.achternaam", filter.getAchternaam(), MatchMode.ANYWHERE); builder.addILikeCheckWildcard("persoon.voorvoegsel", filter.getVoorvoegsel(), MatchMode.START); builder .addILikeCheckWildcard("persoon.voornamen", filter.getVoornaam(), MatchMode.ANYWHERE); builder.addEquals("persoon.geslacht", filter.getGeslacht()); builder.addEquals("persoon.bsn", filter.getBsn()); builder.addEquals("functie", filter.getFunctie()); if (filter.getMultizoek() != null) { Criterion volledigeNaam = builder.getVolledigeNaamILike("persoon.berekendeZoeknaam", filter.getMultizoek()); builder.addOrs(volledigeNaam, Restrictions.ilike("afkorting", filter.getMultizoek(), MatchMode.START)); } if (filter.getRollen() != null && !filter.getRollen().isEmpty()) { DetachedCriteria dc = createDetachedCriteria(MedewerkerAccount.class); DetachedCriteriaBuilder dcBuilder = new DetachedCriteriaBuilder(dc); List<Long> rolIds = new ArrayList<Long>(); for (Rol rol : filter.getRollen()) rolIds.add(rol.getId()); dcBuilder.createAlias("roles", "rol"); dc.add(Restrictions.in("rol.id", rolIds)); dc.add(Restrictions.isNotNull("medewerker")); dc.setProjection(Projections.property("medewerker")); builder.getCriteria().add(Subqueries.propertyIn("id", dc)); } filter.addQuickSearchCriteria(builder, "afkorting", "persoon.achternaam", "persoon.officieleAchternaam", "persoon.roepnaam", "persoon.berekendeZoeknaam"); if (filter.getSnelZoekenString() != null) { builder.addOrs(getSnelZoekCriteria(filter.getSnelZoekenString(), "persoon")); } return criteria; } public List<Criterion> getSnelZoekCriteria(String snelZoekenString, String persoonAlias) { List<Criterion> whereList = new ArrayList<Criterion>(); whereList.add(Restrictions.ilike(persoonAlias + ".achternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".officieleAchternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".roepnaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".berekendeZoeknaam", snelZoekenString, MatchMode.ANYWHERE)); Date geboorteDatum = TimeUtil.getInstance().parseDateString(snelZoekenString); if (geboorteDatum != null) whereList.add(Restrictions.eq(persoonAlias + ".geboortedatum", geboorteDatum)); return whereList; } @Override public Conjunction addMultiZoekCriteria(String multiZoek) { boolean addedCheck = false; String[] zoekwaardes = multiZoek.split(","); Conjunction zoekwaardesTotaal = Restrictions.conjunction(); Disjunction zoekwaardesIteratie = Restrictions.disjunction(); Date geboorteDatum = null; for (int i = 0; i < zoekwaardes.length; i++) { if (StringUtil.isEmpty(zoekwaardes[i])) continue; if (!StringUtil.isNumeric(zoekwaardes[i])) { addedCheck = true; zoekwaardesIteratie.add(Restrictions.ilike("persoon.roepnaam", zoekwaardes[i], MatchMode.ANYWHERE)); zoekwaardesIteratie.add(Restrictions.ilike("persoon.achternaam", zoekwaardes[i], MatchMode.ANYWHERE)); } // geboortedatum kan<SUF> geboorteDatum = TimeUtil.getInstance().parseDateString(zoekwaardes[i]); if (geboorteDatum != null) { zoekwaardesIteratie.add(Restrictions.eq("persoon.geboortedatum", geboorteDatum)); addedCheck = true; } zoekwaardesTotaal.add(zoekwaardesIteratie); zoekwaardesIteratie = Restrictions.disjunction(); } return addedCheck ? zoekwaardesTotaal : null; } @Override public Medewerker get(Long id) { return get(Medewerker.class, id); } @Override public Medewerker get(Persoon persoon) { Asserts.assertNotNull("persoon", persoon); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("persoon", persoon))); } @Override public boolean isDocentVan(Medewerker docent, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(docent, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public boolean isBegeleiderVan(Medewerker begeleider, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(begeleider, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public List<Medewerker> getDocentenVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } @Override public List<Medewerker> getBegeleidersVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } /** * Het gemeenschappelijke deel van de query of iemand docent of begeleider is van een * deelnemer. */ private void createDocentBegeleiderCriteria(Medewerker medewerker, Deelnemer deelnemer, Date peilDatum, Criteria criteria) { CriteriaBuilder builder = new CriteriaBuilder(criteria); if (medewerker == null) { criteria.createAlias("medewerker", "medewerker"); builder.addLessOrEquals("medewerker.begindatum", peilDatum); builder.addGreaterOrEquals("medewerker.einddatumNotNull", peilDatum); } else builder.addEquals("medewerker", medewerker); if (deelnemer != null) { criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnemers", "deelname"); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peilDatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peilDatum); builder.addLessOrEquals("groep.begindatum", peilDatum); builder.addGreaterOrEquals("groep.einddatumNotNull", peilDatum); } } @Override public Medewerker batchGetByAfkorting(String afkorting) { Asserts.assertNotEmpty("afkorting", afkorting); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("afkorting", afkorting))); } @Override public List<OrganisatieMedewerker> getOrganisatieMedewerkers(Medewerker medewerker, boolean instellingAuthorized, boolean orgEhdAuthorized) { OrganisatieEenheidDataAccessHelper helper = DataAccessRegistry.getHelper(OrganisatieEenheidDataAccessHelper.class); LocatieDataAccessHelper locatieHelper = DataAccessRegistry.getHelper(LocatieDataAccessHelper.class); if (instellingAuthorized) { List<OrganisatieEenheid> orgEhds = helper.list(); List<Locatie> locaties = locatieHelper.list(EduArteContext.get().getPeildatum()); List<OrganisatieMedewerker> res = new ArrayList<OrganisatieMedewerker>(); for (OrganisatieEenheid ehd : orgEhds) { for (Locatie loc : locaties) { res.add(new OrganisatieMedewerker(ehd, loc)); } } return res; } else { if (orgEhdAuthorized && medewerker != null) { return medewerker.getOrganisatieMedewerkers(); } } return Collections.emptyList(); } @Override public Map<EventAbonnementType, List< ? extends EventReceiver>> getEventReceivers( Deelnemer deelnemer) { Map<EventAbonnementType, List< ? extends EventReceiver>> ret = new HashMap<EventAbonnementType, List< ? extends EventReceiver>>(); Date nu = TimeUtil.getInstance().currentDate(); ret.put(EventAbonnementType.GeselecteerdeDeelnemers, getDeelnemerMedewerkers(deelnemer)); ret.put(EventAbonnementType.GeselecteerdeGroepen, getGroepMedewerkers(deelnemer, nu)); ret.put(EventAbonnementType.Docent, getDocentenVan(deelnemer, nu)); ret.put(EventAbonnementType.Mentor, getBegeleidersVan(deelnemer, nu)); ret.put( EventAbonnementType.Uitvoerende, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class).getUitvoerendenVan( deelnemer, nu)); ret.put(EventAbonnementType.Verantwoordelijke, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class) .getVerantwoordelijkenVan(deelnemer, nu)); return ret; } private List<Medewerker> getDeelnemerMedewerkers(Deelnemer deelnemer) { Criteria criteria = createCriteria(MedewerkerDeelnemerAbonnering.class); criteria.add(Restrictions.eq("deelnemer", deelnemer)); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } private List<Medewerker> getGroepMedewerkers(Deelnemer deelnemer, Date peildatum) { Criteria criteria = createCriteria(MedewerkerGroepAbonnering.class); criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnamesUnordered", "deelname"); // criteria.createAlias("deelname.deelnemer", "deelnemer"); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peildatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peildatum); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } }
213815_2
/* * Copyright (c) 2007, Topicus B.V. * All rights reserved. */ package nl.topicus.eduarte.dao.hibernate; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import nl.topicus.cobra.dao.DataAccessRegistry; import nl.topicus.cobra.dao.hibernate.AbstractZoekFilterDataAccessHelper; import nl.topicus.cobra.dao.hibernate.CriteriaBuilder; import nl.topicus.cobra.dao.hibernate.QueryInterceptor; import nl.topicus.cobra.dao.hibernate.DetachedCriteriaBuilder; import nl.topicus.cobra.dao.hibernate.HibernateSessionProvider; import nl.topicus.cobra.util.Asserts; import nl.topicus.cobra.util.StringUtil; import nl.topicus.cobra.util.TimeUtil; import nl.topicus.eduarte.app.EduArteContext; import nl.topicus.eduarte.app.signalering.EventAbonnementType; import nl.topicus.eduarte.app.signalering.EventReceiver; import nl.topicus.eduarte.dao.helpers.DBSMedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.LocatieDataAccessHelper; import nl.topicus.eduarte.dao.helpers.MedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.OrganisatieEenheidDataAccessHelper; import nl.topicus.eduarte.entities.groep.GroepDocent; import nl.topicus.eduarte.entities.groep.GroepMentor; import nl.topicus.eduarte.entities.organisatie.Locatie; import nl.topicus.eduarte.entities.organisatie.OrganisatieEenheid; import nl.topicus.eduarte.entities.personen.Deelnemer; import nl.topicus.eduarte.entities.personen.Medewerker; import nl.topicus.eduarte.entities.personen.OrganisatieMedewerker; import nl.topicus.eduarte.entities.personen.Persoon; import nl.topicus.eduarte.entities.security.authentication.MedewerkerAccount; import nl.topicus.eduarte.entities.security.authorization.Rol; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerDeelnemerAbonnering; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerGroepAbonnering; import nl.topicus.eduarte.zoekfilters.MedewerkerZoekFilter; import org.hibernate.Criteria; import org.hibernate.criterion.*; public class MedewerkerHibernateDataAccessHelper extends AbstractZoekFilterDataAccessHelper<Medewerker, MedewerkerZoekFilter> implements MedewerkerDataAccessHelper { public MedewerkerHibernateDataAccessHelper(HibernateSessionProvider provider, QueryInterceptor interceptor) { super(provider, interceptor); } @Override protected Criteria createCriteria(MedewerkerZoekFilter filter) { Criteria criteria = createCriteria(Medewerker.class); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.createAlias("persoon", "persoon"); if (filter.getHeeftAccount() != null) { DetachedCriteria dcAccount = createDetachedCriteria(MedewerkerAccount.class); dcAccount.setProjection(Projections.property("medewerker")); DetachedCriteriaBuilder dcAccountBuilder = new DetachedCriteriaBuilder(dcAccount); dcAccountBuilder.addIsNull("medewerker", false); if (filter.getHeeftAccount()) criteria.add(Subqueries.propertyIn("id", dcAccount)); else criteria.add(Subqueries.propertyNotIn("id", dcAccount)); filter.setResultCacheable(false); } if (!filter.addOrganisatieEenheidLocatieDetachedCriteria(this, criteria, OrganisatieMedewerker.class, "medewerker")) return null; builder.addLessOrEquals("begindatum", filter.getPeildatum()); builder.addGreaterOrEquals("einddatumNotNull", filter.getPeildatum()); builder.addILikeCheckWildcard("afkorting", filter.getAfkorting(), MatchMode.START); builder.addILikeCheckWildcard("persoon.achternaam", filter.getAchternaam(), MatchMode.ANYWHERE); builder.addILikeCheckWildcard("persoon.voorvoegsel", filter.getVoorvoegsel(), MatchMode.START); builder .addILikeCheckWildcard("persoon.voornamen", filter.getVoornaam(), MatchMode.ANYWHERE); builder.addEquals("persoon.geslacht", filter.getGeslacht()); builder.addEquals("persoon.bsn", filter.getBsn()); builder.addEquals("functie", filter.getFunctie()); if (filter.getMultizoek() != null) { Criterion volledigeNaam = builder.getVolledigeNaamILike("persoon.berekendeZoeknaam", filter.getMultizoek()); builder.addOrs(volledigeNaam, Restrictions.ilike("afkorting", filter.getMultizoek(), MatchMode.START)); } if (filter.getRollen() != null && !filter.getRollen().isEmpty()) { DetachedCriteria dc = createDetachedCriteria(MedewerkerAccount.class); DetachedCriteriaBuilder dcBuilder = new DetachedCriteriaBuilder(dc); List<Long> rolIds = new ArrayList<Long>(); for (Rol rol : filter.getRollen()) rolIds.add(rol.getId()); dcBuilder.createAlias("roles", "rol"); dc.add(Restrictions.in("rol.id", rolIds)); dc.add(Restrictions.isNotNull("medewerker")); dc.setProjection(Projections.property("medewerker")); builder.getCriteria().add(Subqueries.propertyIn("id", dc)); } filter.addQuickSearchCriteria(builder, "afkorting", "persoon.achternaam", "persoon.officieleAchternaam", "persoon.roepnaam", "persoon.berekendeZoeknaam"); if (filter.getSnelZoekenString() != null) { builder.addOrs(getSnelZoekCriteria(filter.getSnelZoekenString(), "persoon")); } return criteria; } public List<Criterion> getSnelZoekCriteria(String snelZoekenString, String persoonAlias) { List<Criterion> whereList = new ArrayList<Criterion>(); whereList.add(Restrictions.ilike(persoonAlias + ".achternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".officieleAchternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".roepnaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".berekendeZoeknaam", snelZoekenString, MatchMode.ANYWHERE)); Date geboorteDatum = TimeUtil.getInstance().parseDateString(snelZoekenString); if (geboorteDatum != null) whereList.add(Restrictions.eq(persoonAlias + ".geboortedatum", geboorteDatum)); return whereList; } @Override public Conjunction addMultiZoekCriteria(String multiZoek) { boolean addedCheck = false; String[] zoekwaardes = multiZoek.split(","); Conjunction zoekwaardesTotaal = Restrictions.conjunction(); Disjunction zoekwaardesIteratie = Restrictions.disjunction(); Date geboorteDatum = null; for (int i = 0; i < zoekwaardes.length; i++) { if (StringUtil.isEmpty(zoekwaardes[i])) continue; if (!StringUtil.isNumeric(zoekwaardes[i])) { addedCheck = true; zoekwaardesIteratie.add(Restrictions.ilike("persoon.roepnaam", zoekwaardes[i], MatchMode.ANYWHERE)); zoekwaardesIteratie.add(Restrictions.ilike("persoon.achternaam", zoekwaardes[i], MatchMode.ANYWHERE)); } // geboortedatum kan zowel numeriek als niet numeriek zijn (streepjes e.d) geboorteDatum = TimeUtil.getInstance().parseDateString(zoekwaardes[i]); if (geboorteDatum != null) { zoekwaardesIteratie.add(Restrictions.eq("persoon.geboortedatum", geboorteDatum)); addedCheck = true; } zoekwaardesTotaal.add(zoekwaardesIteratie); zoekwaardesIteratie = Restrictions.disjunction(); } return addedCheck ? zoekwaardesTotaal : null; } @Override public Medewerker get(Long id) { return get(Medewerker.class, id); } @Override public Medewerker get(Persoon persoon) { Asserts.assertNotNull("persoon", persoon); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("persoon", persoon))); } @Override public boolean isDocentVan(Medewerker docent, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(docent, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public boolean isBegeleiderVan(Medewerker begeleider, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(begeleider, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public List<Medewerker> getDocentenVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } @Override public List<Medewerker> getBegeleidersVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } /** * Het gemeenschappelijke deel van de query of iemand docent of begeleider is van een * deelnemer. */ private void createDocentBegeleiderCriteria(Medewerker medewerker, Deelnemer deelnemer, Date peilDatum, Criteria criteria) { CriteriaBuilder builder = new CriteriaBuilder(criteria); if (medewerker == null) { criteria.createAlias("medewerker", "medewerker"); builder.addLessOrEquals("medewerker.begindatum", peilDatum); builder.addGreaterOrEquals("medewerker.einddatumNotNull", peilDatum); } else builder.addEquals("medewerker", medewerker); if (deelnemer != null) { criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnemers", "deelname"); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peilDatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peilDatum); builder.addLessOrEquals("groep.begindatum", peilDatum); builder.addGreaterOrEquals("groep.einddatumNotNull", peilDatum); } } @Override public Medewerker batchGetByAfkorting(String afkorting) { Asserts.assertNotEmpty("afkorting", afkorting); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("afkorting", afkorting))); } @Override public List<OrganisatieMedewerker> getOrganisatieMedewerkers(Medewerker medewerker, boolean instellingAuthorized, boolean orgEhdAuthorized) { OrganisatieEenheidDataAccessHelper helper = DataAccessRegistry.getHelper(OrganisatieEenheidDataAccessHelper.class); LocatieDataAccessHelper locatieHelper = DataAccessRegistry.getHelper(LocatieDataAccessHelper.class); if (instellingAuthorized) { List<OrganisatieEenheid> orgEhds = helper.list(); List<Locatie> locaties = locatieHelper.list(EduArteContext.get().getPeildatum()); List<OrganisatieMedewerker> res = new ArrayList<OrganisatieMedewerker>(); for (OrganisatieEenheid ehd : orgEhds) { for (Locatie loc : locaties) { res.add(new OrganisatieMedewerker(ehd, loc)); } } return res; } else { if (orgEhdAuthorized && medewerker != null) { return medewerker.getOrganisatieMedewerkers(); } } return Collections.emptyList(); } @Override public Map<EventAbonnementType, List< ? extends EventReceiver>> getEventReceivers( Deelnemer deelnemer) { Map<EventAbonnementType, List< ? extends EventReceiver>> ret = new HashMap<EventAbonnementType, List< ? extends EventReceiver>>(); Date nu = TimeUtil.getInstance().currentDate(); ret.put(EventAbonnementType.GeselecteerdeDeelnemers, getDeelnemerMedewerkers(deelnemer)); ret.put(EventAbonnementType.GeselecteerdeGroepen, getGroepMedewerkers(deelnemer, nu)); ret.put(EventAbonnementType.Docent, getDocentenVan(deelnemer, nu)); ret.put(EventAbonnementType.Mentor, getBegeleidersVan(deelnemer, nu)); ret.put( EventAbonnementType.Uitvoerende, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class).getUitvoerendenVan( deelnemer, nu)); ret.put(EventAbonnementType.Verantwoordelijke, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class) .getVerantwoordelijkenVan(deelnemer, nu)); return ret; } private List<Medewerker> getDeelnemerMedewerkers(Deelnemer deelnemer) { Criteria criteria = createCriteria(MedewerkerDeelnemerAbonnering.class); criteria.add(Restrictions.eq("deelnemer", deelnemer)); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } private List<Medewerker> getGroepMedewerkers(Deelnemer deelnemer, Date peildatum) { Criteria criteria = createCriteria(MedewerkerGroepAbonnering.class); criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnamesUnordered", "deelname"); // criteria.createAlias("deelname.deelnemer", "deelnemer"); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peildatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peildatum); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } }
topicusonderwijs/tribe-krd-opensource
eduarte/core/src/main/java/nl/topicus/eduarte/dao/hibernate/MedewerkerHibernateDataAccessHelper.java
3,954
/** * Het gemeenschappelijke deel van de query of iemand docent of begeleider is van een * deelnemer. */
block_comment
nl
/* * Copyright (c) 2007, Topicus B.V. * All rights reserved. */ package nl.topicus.eduarte.dao.hibernate; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import nl.topicus.cobra.dao.DataAccessRegistry; import nl.topicus.cobra.dao.hibernate.AbstractZoekFilterDataAccessHelper; import nl.topicus.cobra.dao.hibernate.CriteriaBuilder; import nl.topicus.cobra.dao.hibernate.QueryInterceptor; import nl.topicus.cobra.dao.hibernate.DetachedCriteriaBuilder; import nl.topicus.cobra.dao.hibernate.HibernateSessionProvider; import nl.topicus.cobra.util.Asserts; import nl.topicus.cobra.util.StringUtil; import nl.topicus.cobra.util.TimeUtil; import nl.topicus.eduarte.app.EduArteContext; import nl.topicus.eduarte.app.signalering.EventAbonnementType; import nl.topicus.eduarte.app.signalering.EventReceiver; import nl.topicus.eduarte.dao.helpers.DBSMedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.LocatieDataAccessHelper; import nl.topicus.eduarte.dao.helpers.MedewerkerDataAccessHelper; import nl.topicus.eduarte.dao.helpers.OrganisatieEenheidDataAccessHelper; import nl.topicus.eduarte.entities.groep.GroepDocent; import nl.topicus.eduarte.entities.groep.GroepMentor; import nl.topicus.eduarte.entities.organisatie.Locatie; import nl.topicus.eduarte.entities.organisatie.OrganisatieEenheid; import nl.topicus.eduarte.entities.personen.Deelnemer; import nl.topicus.eduarte.entities.personen.Medewerker; import nl.topicus.eduarte.entities.personen.OrganisatieMedewerker; import nl.topicus.eduarte.entities.personen.Persoon; import nl.topicus.eduarte.entities.security.authentication.MedewerkerAccount; import nl.topicus.eduarte.entities.security.authorization.Rol; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerDeelnemerAbonnering; import nl.topicus.eduarte.entities.signalering.settings.MedewerkerGroepAbonnering; import nl.topicus.eduarte.zoekfilters.MedewerkerZoekFilter; import org.hibernate.Criteria; import org.hibernate.criterion.*; public class MedewerkerHibernateDataAccessHelper extends AbstractZoekFilterDataAccessHelper<Medewerker, MedewerkerZoekFilter> implements MedewerkerDataAccessHelper { public MedewerkerHibernateDataAccessHelper(HibernateSessionProvider provider, QueryInterceptor interceptor) { super(provider, interceptor); } @Override protected Criteria createCriteria(MedewerkerZoekFilter filter) { Criteria criteria = createCriteria(Medewerker.class); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.createAlias("persoon", "persoon"); if (filter.getHeeftAccount() != null) { DetachedCriteria dcAccount = createDetachedCriteria(MedewerkerAccount.class); dcAccount.setProjection(Projections.property("medewerker")); DetachedCriteriaBuilder dcAccountBuilder = new DetachedCriteriaBuilder(dcAccount); dcAccountBuilder.addIsNull("medewerker", false); if (filter.getHeeftAccount()) criteria.add(Subqueries.propertyIn("id", dcAccount)); else criteria.add(Subqueries.propertyNotIn("id", dcAccount)); filter.setResultCacheable(false); } if (!filter.addOrganisatieEenheidLocatieDetachedCriteria(this, criteria, OrganisatieMedewerker.class, "medewerker")) return null; builder.addLessOrEquals("begindatum", filter.getPeildatum()); builder.addGreaterOrEquals("einddatumNotNull", filter.getPeildatum()); builder.addILikeCheckWildcard("afkorting", filter.getAfkorting(), MatchMode.START); builder.addILikeCheckWildcard("persoon.achternaam", filter.getAchternaam(), MatchMode.ANYWHERE); builder.addILikeCheckWildcard("persoon.voorvoegsel", filter.getVoorvoegsel(), MatchMode.START); builder .addILikeCheckWildcard("persoon.voornamen", filter.getVoornaam(), MatchMode.ANYWHERE); builder.addEquals("persoon.geslacht", filter.getGeslacht()); builder.addEquals("persoon.bsn", filter.getBsn()); builder.addEquals("functie", filter.getFunctie()); if (filter.getMultizoek() != null) { Criterion volledigeNaam = builder.getVolledigeNaamILike("persoon.berekendeZoeknaam", filter.getMultizoek()); builder.addOrs(volledigeNaam, Restrictions.ilike("afkorting", filter.getMultizoek(), MatchMode.START)); } if (filter.getRollen() != null && !filter.getRollen().isEmpty()) { DetachedCriteria dc = createDetachedCriteria(MedewerkerAccount.class); DetachedCriteriaBuilder dcBuilder = new DetachedCriteriaBuilder(dc); List<Long> rolIds = new ArrayList<Long>(); for (Rol rol : filter.getRollen()) rolIds.add(rol.getId()); dcBuilder.createAlias("roles", "rol"); dc.add(Restrictions.in("rol.id", rolIds)); dc.add(Restrictions.isNotNull("medewerker")); dc.setProjection(Projections.property("medewerker")); builder.getCriteria().add(Subqueries.propertyIn("id", dc)); } filter.addQuickSearchCriteria(builder, "afkorting", "persoon.achternaam", "persoon.officieleAchternaam", "persoon.roepnaam", "persoon.berekendeZoeknaam"); if (filter.getSnelZoekenString() != null) { builder.addOrs(getSnelZoekCriteria(filter.getSnelZoekenString(), "persoon")); } return criteria; } public List<Criterion> getSnelZoekCriteria(String snelZoekenString, String persoonAlias) { List<Criterion> whereList = new ArrayList<Criterion>(); whereList.add(Restrictions.ilike(persoonAlias + ".achternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".officieleAchternaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".roepnaam", snelZoekenString, MatchMode.ANYWHERE)); whereList.add(Restrictions.ilike(persoonAlias + ".berekendeZoeknaam", snelZoekenString, MatchMode.ANYWHERE)); Date geboorteDatum = TimeUtil.getInstance().parseDateString(snelZoekenString); if (geboorteDatum != null) whereList.add(Restrictions.eq(persoonAlias + ".geboortedatum", geboorteDatum)); return whereList; } @Override public Conjunction addMultiZoekCriteria(String multiZoek) { boolean addedCheck = false; String[] zoekwaardes = multiZoek.split(","); Conjunction zoekwaardesTotaal = Restrictions.conjunction(); Disjunction zoekwaardesIteratie = Restrictions.disjunction(); Date geboorteDatum = null; for (int i = 0; i < zoekwaardes.length; i++) { if (StringUtil.isEmpty(zoekwaardes[i])) continue; if (!StringUtil.isNumeric(zoekwaardes[i])) { addedCheck = true; zoekwaardesIteratie.add(Restrictions.ilike("persoon.roepnaam", zoekwaardes[i], MatchMode.ANYWHERE)); zoekwaardesIteratie.add(Restrictions.ilike("persoon.achternaam", zoekwaardes[i], MatchMode.ANYWHERE)); } // geboortedatum kan zowel numeriek als niet numeriek zijn (streepjes e.d) geboorteDatum = TimeUtil.getInstance().parseDateString(zoekwaardes[i]); if (geboorteDatum != null) { zoekwaardesIteratie.add(Restrictions.eq("persoon.geboortedatum", geboorteDatum)); addedCheck = true; } zoekwaardesTotaal.add(zoekwaardesIteratie); zoekwaardesIteratie = Restrictions.disjunction(); } return addedCheck ? zoekwaardesTotaal : null; } @Override public Medewerker get(Long id) { return get(Medewerker.class, id); } @Override public Medewerker get(Persoon persoon) { Asserts.assertNotNull("persoon", persoon); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("persoon", persoon))); } @Override public boolean isDocentVan(Medewerker docent, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(docent, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public boolean isBegeleiderVan(Medewerker begeleider, Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(begeleider, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.rowCount()); return (Long) unique(criteria, true) > 0; } @Override public List<Medewerker> getDocentenVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepDocent.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } @Override public List<Medewerker> getBegeleidersVan(Deelnemer deelnemer, Date peilDatum) { Criteria criteria = createCriteria(GroepMentor.class); createDocentBegeleiderCriteria(null, deelnemer, peilDatum, criteria); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } /** * Het gemeenschappelijke deel<SUF>*/ private void createDocentBegeleiderCriteria(Medewerker medewerker, Deelnemer deelnemer, Date peilDatum, Criteria criteria) { CriteriaBuilder builder = new CriteriaBuilder(criteria); if (medewerker == null) { criteria.createAlias("medewerker", "medewerker"); builder.addLessOrEquals("medewerker.begindatum", peilDatum); builder.addGreaterOrEquals("medewerker.einddatumNotNull", peilDatum); } else builder.addEquals("medewerker", medewerker); if (deelnemer != null) { criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnemers", "deelname"); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peilDatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peilDatum); builder.addLessOrEquals("groep.begindatum", peilDatum); builder.addGreaterOrEquals("groep.einddatumNotNull", peilDatum); } } @Override public Medewerker batchGetByAfkorting(String afkorting) { Asserts.assertNotEmpty("afkorting", afkorting); return cachedTypedUnique(createCriteria(Medewerker.class).add( Restrictions.eq("afkorting", afkorting))); } @Override public List<OrganisatieMedewerker> getOrganisatieMedewerkers(Medewerker medewerker, boolean instellingAuthorized, boolean orgEhdAuthorized) { OrganisatieEenheidDataAccessHelper helper = DataAccessRegistry.getHelper(OrganisatieEenheidDataAccessHelper.class); LocatieDataAccessHelper locatieHelper = DataAccessRegistry.getHelper(LocatieDataAccessHelper.class); if (instellingAuthorized) { List<OrganisatieEenheid> orgEhds = helper.list(); List<Locatie> locaties = locatieHelper.list(EduArteContext.get().getPeildatum()); List<OrganisatieMedewerker> res = new ArrayList<OrganisatieMedewerker>(); for (OrganisatieEenheid ehd : orgEhds) { for (Locatie loc : locaties) { res.add(new OrganisatieMedewerker(ehd, loc)); } } return res; } else { if (orgEhdAuthorized && medewerker != null) { return medewerker.getOrganisatieMedewerkers(); } } return Collections.emptyList(); } @Override public Map<EventAbonnementType, List< ? extends EventReceiver>> getEventReceivers( Deelnemer deelnemer) { Map<EventAbonnementType, List< ? extends EventReceiver>> ret = new HashMap<EventAbonnementType, List< ? extends EventReceiver>>(); Date nu = TimeUtil.getInstance().currentDate(); ret.put(EventAbonnementType.GeselecteerdeDeelnemers, getDeelnemerMedewerkers(deelnemer)); ret.put(EventAbonnementType.GeselecteerdeGroepen, getGroepMedewerkers(deelnemer, nu)); ret.put(EventAbonnementType.Docent, getDocentenVan(deelnemer, nu)); ret.put(EventAbonnementType.Mentor, getBegeleidersVan(deelnemer, nu)); ret.put( EventAbonnementType.Uitvoerende, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class).getUitvoerendenVan( deelnemer, nu)); ret.put(EventAbonnementType.Verantwoordelijke, DataAccessRegistry.getHelper(DBSMedewerkerDataAccessHelper.class) .getVerantwoordelijkenVan(deelnemer, nu)); return ret; } private List<Medewerker> getDeelnemerMedewerkers(Deelnemer deelnemer) { Criteria criteria = createCriteria(MedewerkerDeelnemerAbonnering.class); criteria.add(Restrictions.eq("deelnemer", deelnemer)); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } private List<Medewerker> getGroepMedewerkers(Deelnemer deelnemer, Date peildatum) { Criteria criteria = createCriteria(MedewerkerGroepAbonnering.class); criteria.createAlias("groep", "groep"); criteria.createAlias("groep.deelnamesUnordered", "deelname"); // criteria.createAlias("deelname.deelnemer", "deelnemer"); CriteriaBuilder builder = new CriteriaBuilder(criteria); builder.addEquals("deelname.deelnemer", deelnemer); builder.addLessOrEquals("deelname.begindatum", peildatum); builder.addGreaterOrEquals("deelname.einddatumNotNull", peildatum); criteria.setProjection(Projections.property("medewerker")); return cachedTypedList(criteria); } }
213819_1
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
franz1981/tribe-krd-quarkus
src/main/java/nl/topicus/eduarte/model/entities/productregel/SoortProductregel.java
819
/** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */
block_comment
nl
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd<SUF>*/ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
213819_2
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
franz1981/tribe-krd-quarkus
src/main/java/nl/topicus/eduarte/model/entities/productregel/SoortProductregel.java
819
/** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */
block_comment
nl
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels<SUF>*/ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
213821_0
package cui; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class OefFruit1_opgave { public static void main(String args[]) { String arX[] = { "appel", "peer", "citroen", "kiwi" }, arY[] = { "banaan", "mango", "citroen", "kiwi", "zespri" }; /* * Behandel arX en arY als collections en maak gebruik van de bulkoperaties om * volgende output te leveren: In y zit extra [banaan, mango, zespri] In x zit * extra [appel, peer] x en y hebben gemeenschappelijk [citroen, kiwi] */ List<String> x, y; x = Arrays.asList(arX); y = Arrays.asList(arY); List<String> extraX, extraY, gemeenschappelijk; extraX = new ArrayList<>(x); extraX.removeAll(y); System.out.printf("In x zit extra %s%n", extraX); extraY = new ArrayList<>(y); extraY.removeAll(x); System.out.printf("In y zit extra %s%n", extraY); gemeenschappelijk = new ArrayList<>(x); gemeenschappelijk.retainAll(y); System.out.printf("x en y hebben gemeenschappelijk %s%n", gemeenschappelijk); } }
Swesje/OO-Software-Development-II
H6 - Collections /Werkcollege/Werkcollege_Oefeningen/src/cui/OefFruit1_opgave.java
366
/* * Behandel arX en arY als collections en maak gebruik van de bulkoperaties om * volgende output te leveren: In y zit extra [banaan, mango, zespri] In x zit * extra [appel, peer] x en y hebben gemeenschappelijk [citroen, kiwi] */
block_comment
nl
package cui; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class OefFruit1_opgave { public static void main(String args[]) { String arX[] = { "appel", "peer", "citroen", "kiwi" }, arY[] = { "banaan", "mango", "citroen", "kiwi", "zespri" }; /* * Behandel arX en<SUF>*/ List<String> x, y; x = Arrays.asList(arX); y = Arrays.asList(arY); List<String> extraX, extraY, gemeenschappelijk; extraX = new ArrayList<>(x); extraX.removeAll(y); System.out.printf("In x zit extra %s%n", extraX); extraY = new ArrayList<>(y); extraY.removeAll(x); System.out.printf("In y zit extra %s%n", extraY); gemeenschappelijk = new ArrayList<>(x); gemeenschappelijk.retainAll(y); System.out.printf("x en y hebben gemeenschappelijk %s%n", gemeenschappelijk); } }
213824_1
/** * This file is copyright 2017 State of the Netherlands (Ministry of Interior Affairs and Kingdom Relations). * It is made available under the terms of the GNU Affero General Public License, version 3 as published by the Free Software Foundation. * The project of which this file is part, may be found at www.github.com/MinBZK/operatieBRP. */ /** * Bevat DTO en util klassen voor welke voor alle leveringsdiensten gemeenschappelijk zijn. */ package nl.bzk.brp.service.algemeen.request;
DDDNL/OperatieBRP
Broncode/operatiebrp-code-145.3/brp/brp-leveren/brp-leveren-service/brp-service-algemeen/src/main/java/nl/bzk/brp/service/algemeen/request/package-info.java
130
/** * Bevat DTO en util klassen voor welke voor alle leveringsdiensten gemeenschappelijk zijn. */
block_comment
nl
/** * This file is copyright 2017 State of the Netherlands (Ministry of Interior Affairs and Kingdom Relations). * It is made available under the terms of the GNU Affero General Public License, version 3 as published by the Free Software Foundation. * The project of which this file is part, may be found at www.github.com/MinBZK/operatieBRP. */ /** * Bevat DTO en<SUF>*/ package nl.bzk.brp.service.algemeen.request;
213828_1
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @jakarta.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
topicusonderwijs/tribe-krd-quarkus
src/main/java/nl/topicus/eduarte/model/entities/productregel/SoortProductregel.java
819
/** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */
block_comment
nl
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd<SUF>*/ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @jakarta.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
213828_2
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @jakarta.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
topicusonderwijs/tribe-krd-quarkus
src/main/java/nl/topicus/eduarte/model/entities/productregel/SoortProductregel.java
819
/** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */
block_comment
nl
/* * Copyright 2022 Topicus Onderwijs Eduarte B.V.. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.topicus.eduarte.model.entities.productregel; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.persistence.UniqueConstraint; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import nl.topicus.eduarte.model.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.model.entities.taxonomie.Taxonomie; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld * Gemeenschappelijk, Profiel, Keuze. * */ @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @jakarta.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "naam", "taxonomie", "organisatie" }), @UniqueConstraint(columnNames = { "volgnummer", "taxonomie", "organisatie" }) }) public class SoortProductregel extends LandelijkOfInstellingEntiteit { @Column(nullable = false, length = 30) private String naam; /** * Volgorde van productregels<SUF>*/ @Column(nullable = false) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) private String diplomanaam; public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } }
213829_0
/* * Dit bestand is een onderdeel van AWV DistrictCenter. * Copyright (c) AWV Agentschap Wegen en Verkeer, Vlaamse Gemeenschap */ package consulting.cochez.accounting.importing.expenses; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import java.io.IOException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; /** * Jackson serializer for LocalDate. */ public class ExpensesLocalDateSerializer extends JsonSerializer<LocalDate> { @Override public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider arg2) throws IOException { gen.writeString(DateTimeFormatter.ofPattern("dd/MM/yyyy").format(value)); } }
benc/accounting
server/src/main/java/consulting/cochez/accounting/importing/expenses/ExpensesLocalDateSerializer.java
192
/* * Dit bestand is een onderdeel van AWV DistrictCenter. * Copyright (c) AWV Agentschap Wegen en Verkeer, Vlaamse Gemeenschap */
block_comment
nl
/* * Dit bestand is<SUF>*/ package consulting.cochez.accounting.importing.expenses; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import java.io.IOException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; /** * Jackson serializer for LocalDate. */ public class ExpensesLocalDateSerializer extends JsonSerializer<LocalDate> { @Override public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider arg2) throws IOException { gen.writeString(DateTimeFormatter.ofPattern("dd/MM/yyyy").format(value)); } }
213830_0
package composite; import java.time.LocalDate; /** * De leaf-klasse ProjectTask implementeert de gemeenschappelijke interface ProjectComponent */ public class ProjectTask implements ProjectComponent{ private String responsible; private String description; private LocalDate start; private int hours; public ProjectTask(String responsible, String description, LocalDate start, int hours) { this.responsible = responsible; this.description = description; this.start = start; this.hours = hours; } public int getTime() { return hours; } @Override public String toString() { return String.format("%s (%s) --> %d hrs", description, responsible, hours); } }
gvdhaege/KdG
Java Programming 2/module 06 - Patterns/demo/Voorbeelden_06_Patterns_2/04_CompositeVoorbeeld/src/composite/ProjectTask.java
174
/** * De leaf-klasse ProjectTask implementeert de gemeenschappelijke interface ProjectComponent */
block_comment
nl
package composite; import java.time.LocalDate; /** * De leaf-klasse ProjectTask<SUF>*/ public class ProjectTask implements ProjectComponent{ private String responsible; private String description; private LocalDate start; private int hours; public ProjectTask(String responsible, String description, LocalDate start, int hours) { this.responsible = responsible; this.description = description; this.start = start; this.hours = hours; } public int getTime() { return hours; } @Override public String toString() { return String.format("%s (%s) --> %d hrs", description, responsible, hours); } }
213833_1
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
// Klasse overgenomen van de cursus Programmeren 2
line_comment
nl
// Naam: Tom Naessens // Klasse overgenomen<SUF> /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213833_2
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
/* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */
block_comment
nl
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java *<SUF>*/ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213833_3
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
/** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */
block_comment
nl
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van<SUF>*/ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213833_4
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
/** * Lijst van geregistreerde luisteraars. */
block_comment
nl
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde<SUF>*/ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213833_5
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
/** * Registreer een luisteraar. */
block_comment
nl
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar.<SUF>*/ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213833_6
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
/** * Maak registratie ongedaan. */
block_comment
nl
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan.<SUF>*/ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213833_7
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
/** * Uniek gebeurtenisobject met dit model als bron. */
block_comment
nl
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met<SUF>*/ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213833_8
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
TomNaessens/UGent-stuff
Prog2--Project--Elektrobank/src/elektrobank/utils/Model.java
451
/** * Behandel een ChangeEvent-gebeurtenis die van het model * afkomstig is door een nieuwe gebeurtenis aan alle luisteraars * door te geven. De nieuwe gebeurtenis heeft dit model als bron. */
block_comment
nl
// Naam: Tom Naessens // Klasse overgenomen van de cursus Programmeren 2 /* Model.java * ============================================================ * Copyright (C) 2001-2011 Universiteit Gent * * Bijlage bij de cursus 'Programmeren 2'. * * Auteur: Kris Coolsaet */ package elektrobank.utils; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; /** * Gemeenschappelijke bovenklasse van alle modellen die gebruik maken van * luisteraars van het type {@link ChangeListener}. */ public class Model { /** * Lijst van geregistreerde luisteraars. */ private EventListenerList listenerList = new EventListenerList (); /** * Registreer een luisteraar. */ public void addChangeListener (ChangeListener l) { listenerList.add (ChangeListener.class, l); } /** * Maak registratie ongedaan. */ public void removeChangeListener (ChangeListener l) { listenerList.remove (ChangeListener.class, l); } /** * Uniek gebeurtenisobject met dit model als bron. */ private final ChangeEvent changeEvent = new ChangeEvent (this); /** * Behandel een ChangeEvent-gebeurtenis<SUF>*/ protected void fireStateChanged () { Object[] listeners = listenerList.getListenerList (); for (int i=listeners.length-2; i >= 0; i-=2) { if (listeners[i] == ChangeListener.class) ((ChangeListener)listeners[i+1]).stateChanged (changeEvent); } } }
213842_0
package nl.topicus.eduarte.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import nl.topicus.cobra.entities.IActiefEntiteit; import nl.topicus.cobra.templates.annotations.Exportable; import nl.topicus.cobra.web.components.form.AutoForm; import nl.topicus.eduarte.entities.organisatie.EntiteitContext; import nl.topicus.eduarte.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.entities.taxonomie.Taxonomie; import nl.topicus.eduarte.web.components.choice.TaxonomieCombobox; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Index; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld Gemeenschappelijk, * Profiel, Keuze. * * @author loite */ @Exportable @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = {"naam", "taxonomie", "organisatie"}), @UniqueConstraint(columnNames = {"volgnummer", "taxonomie", "organisatie"})}) public class SoortProductregel extends LandelijkOfInstellingEntiteit implements Comparable<SoortProductregel>, IActiefEntiteit { private static final long serialVersionUID = 1L; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) @AutoForm(htmlClasses = {"unit_40"}) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") @AutoForm(editorClass = TaxonomieCombobox.class) @Index(name = "idx_SoortProduct_taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String diplomanaam; protected SoortProductregel() { } public SoortProductregel(EntiteitContext context) { super(context); } @Exportable public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } @Exportable public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } @Override public int compareTo(SoortProductregel o) { return getVolgnummer() - o.getVolgnummer(); } @Override public String toString() { return getNaam(); } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } }
topicusonderwijs/tribe-krd-opensource
eduarte/core/src/main/java/nl/topicus/eduarte/entities/productregel/SoortProductregel.java
1,026
/** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld Gemeenschappelijk, * Profiel, Keuze. * * @author loite */
block_comment
nl
package nl.topicus.eduarte.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import nl.topicus.cobra.entities.IActiefEntiteit; import nl.topicus.cobra.templates.annotations.Exportable; import nl.topicus.cobra.web.components.form.AutoForm; import nl.topicus.eduarte.entities.organisatie.EntiteitContext; import nl.topicus.eduarte.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.entities.taxonomie.Taxonomie; import nl.topicus.eduarte.web.components.choice.TaxonomieCombobox; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Index; /** * Productregels kunnen gegroepeerd<SUF>*/ @Exportable @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = {"naam", "taxonomie", "organisatie"}), @UniqueConstraint(columnNames = {"volgnummer", "taxonomie", "organisatie"})}) public class SoortProductregel extends LandelijkOfInstellingEntiteit implements Comparable<SoortProductregel>, IActiefEntiteit { private static final long serialVersionUID = 1L; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) @AutoForm(htmlClasses = {"unit_40"}) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") @AutoForm(editorClass = TaxonomieCombobox.class) @Index(name = "idx_SoortProduct_taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String diplomanaam; protected SoortProductregel() { } public SoortProductregel(EntiteitContext context) { super(context); } @Exportable public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } @Exportable public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } @Override public int compareTo(SoortProductregel o) { return getVolgnummer() - o.getVolgnummer(); } @Override public String toString() { return getNaam(); } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } }
213842_1
package nl.topicus.eduarte.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import nl.topicus.cobra.entities.IActiefEntiteit; import nl.topicus.cobra.templates.annotations.Exportable; import nl.topicus.cobra.web.components.form.AutoForm; import nl.topicus.eduarte.entities.organisatie.EntiteitContext; import nl.topicus.eduarte.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.entities.taxonomie.Taxonomie; import nl.topicus.eduarte.web.components.choice.TaxonomieCombobox; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Index; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld Gemeenschappelijk, * Profiel, Keuze. * * @author loite */ @Exportable @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = {"naam", "taxonomie", "organisatie"}), @UniqueConstraint(columnNames = {"volgnummer", "taxonomie", "organisatie"})}) public class SoortProductregel extends LandelijkOfInstellingEntiteit implements Comparable<SoortProductregel>, IActiefEntiteit { private static final long serialVersionUID = 1L; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String naam; /** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */ @Column(nullable = false) @AutoForm(htmlClasses = {"unit_40"}) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") @AutoForm(editorClass = TaxonomieCombobox.class) @Index(name = "idx_SoortProduct_taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String diplomanaam; protected SoortProductregel() { } public SoortProductregel(EntiteitContext context) { super(context); } @Exportable public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } @Exportable public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } @Override public int compareTo(SoortProductregel o) { return getVolgnummer() - o.getVolgnummer(); } @Override public String toString() { return getNaam(); } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } }
topicusonderwijs/tribe-krd-opensource
eduarte/core/src/main/java/nl/topicus/eduarte/entities/productregel/SoortProductregel.java
1,026
/** * Volgorde van productregels (Gemeenschappelijk komt voor Profiel). */
block_comment
nl
package nl.topicus.eduarte.entities.productregel; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.UniqueConstraint; import nl.topicus.cobra.entities.IActiefEntiteit; import nl.topicus.cobra.templates.annotations.Exportable; import nl.topicus.cobra.web.components.form.AutoForm; import nl.topicus.eduarte.entities.organisatie.EntiteitContext; import nl.topicus.eduarte.entities.organisatie.LandelijkOfInstellingEntiteit; import nl.topicus.eduarte.entities.taxonomie.Taxonomie; import nl.topicus.eduarte.web.components.choice.TaxonomieCombobox; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Index; /** * Productregels kunnen gegroepeerd worden per soort, bijvoorbeeld Gemeenschappelijk, * Profiel, Keuze. * * @author loite */ @Exportable @Entity() @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Instelling") @javax.persistence.Table(uniqueConstraints = { @UniqueConstraint(columnNames = {"naam", "taxonomie", "organisatie"}), @UniqueConstraint(columnNames = {"volgnummer", "taxonomie", "organisatie"})}) public class SoortProductregel extends LandelijkOfInstellingEntiteit implements Comparable<SoortProductregel>, IActiefEntiteit { private static final long serialVersionUID = 1L; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String naam; /** * Volgorde van productregels<SUF>*/ @Column(nullable = false) @AutoForm(htmlClasses = {"unit_40"}) private int volgnummer; @Column(nullable = false) private boolean actief; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false, name = "taxonomie") @AutoForm(editorClass = TaxonomieCombobox.class) @Index(name = "idx_SoortProduct_taxonomie") private Taxonomie taxonomie; @Column(nullable = false, length = 30) @AutoForm(htmlClasses = {"unit_max"}) private String diplomanaam; protected SoortProductregel() { } public SoortProductregel(EntiteitContext context) { super(context); } @Exportable public String getNaam() { return naam; } public void setNaam(String naam) { this.naam = naam; } @Exportable public String getDiplomanaam() { return diplomanaam; } public void setDiplomanaam(String diplomanaam) { this.diplomanaam = diplomanaam; } public boolean isActief() { return actief; } public void setActief(boolean actief) { this.actief = actief; } public int getVolgnummer() { return volgnummer; } public void setVolgnummer(int volgnummer) { this.volgnummer = volgnummer; } @Override public int compareTo(SoortProductregel o) { return getVolgnummer() - o.getVolgnummer(); } @Override public String toString() { return getNaam(); } public Taxonomie getTaxonomie() { return taxonomie; } public void setTaxonomie(Taxonomie taxonomie) { this.taxonomie = taxonomie; } }
213843_1
/* * Copyright 2007 Pieter De Rycke * * This file is part of JMTP. * * JTMP is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or any later version. * * JMTP is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU LesserGeneral Public * License along with JMTP. If not, see <http://www.gnu.org/licenses/>. */ package jmtp; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.math.BigInteger; import java.util.Date; import be.derycke.pieter.com.COMException; import be.derycke.pieter.com.OleDate; //gemeenschappelijke klasse voor storage en folder abstract class AbstractPortableDeviceContainerImplWin32 extends PortableDeviceObjectImplWin32 { AbstractPortableDeviceContainerImplWin32(String objectID, PortableDeviceContentImplWin32 content, PortableDevicePropertiesImplWin32 properties) { super(objectID, content, properties); } public PortableDeviceObject[] getChildObjects() { try { String[] childIDs = content.listChildObjects(objectID); PortableDeviceObject[] objects = new PortableDeviceObject[childIDs.length]; for(int i = 0; i < childIDs.length; i++) objects[i] = WPDImplWin32.convertToPortableDeviceObject(childIDs[i], this.content, this.properties); return objects; } catch (COMException e) { return new PortableDeviceObject[0]; } } public PortableDeviceFolderObject createFolderObject(String name) { try { PortableDeviceValuesImplWin32 values = new PortableDeviceValuesImplWin32(); values.setStringValue(Win32WPDDefines.WPD_OBJECT_PARENT_ID, this.objectID); values.setStringValue(Win32WPDDefines.WPD_OBJECT_ORIGINAL_FILE_NAME, name); values.setStringValue(Win32WPDDefines.WPD_OBJECT_NAME, name); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_CONTENT_TYPE, Win32WPDDefines.WPD_CONTENT_TYPE_FOLDER); return new PortableDeviceFolderObjectImplWin32(content.createObjectWithPropertiesOnly(values), this.content, this.properties); } catch (COMException e) { e.printStackTrace(); return null; } } //TODO references ondersteuning nog toevoegen public PortableDevicePlaylistObject createPlaylistObject(String name, PortableDeviceObject[] references) { try { PortableDeviceValuesImplWin32 values = new PortableDeviceValuesImplWin32(); values.setStringValue(Win32WPDDefines.WPD_OBJECT_PARENT_ID, this.objectID); values.setStringValue(Win32WPDDefines.WPD_OBJECT_ORIGINAL_FILE_NAME, name + ".pla"); values.setStringValue(Win32WPDDefines.WPD_OBJECT_NAME, name); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_FORMAT, Win32WPDDefines.WPD_OBJECT_FORMAT_PLA); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_CONTENT_TYPE, Win32WPDDefines.WPD_CONTENT_TYPE_PLAYLIST); if(references != null) { PortableDevicePropVariantCollectionImplWin32 propVariantCollection = new PortableDevicePropVariantCollectionImplWin32(); for(PortableDeviceObject reference : references) propVariantCollection.add(new PropVariant(reference.getID())); values.setPortableDeviceValuesCollectionValue(Win32WPDDefines.WPD_OBJECT_REFERENCES, propVariantCollection); } return new PortableDevicePlaylistObjectImplWin32(content.createObjectWithPropertiesOnly(values), this.content, this.properties); } catch(COMException e) { e.printStackTrace(); return null; } } public PortableDeviceAudioObject addAudioObject(File file, String artist, String title, BigInteger duration) throws FileNotFoundException, IOException { return addAudioObject(file, artist, title, duration, null, null, null, -1); } public PortableDeviceAudioObject addAudioObject(File file, String artist, String title, BigInteger duration, String genre, String album, Date releaseDate, int track) throws FileNotFoundException, IOException { try { PortableDeviceValuesImplWin32 values = new PortableDeviceValuesImplWin32(); values.setStringValue(Win32WPDDefines.WPD_OBJECT_PARENT_ID, this.objectID); values.setStringValue(Win32WPDDefines.WPD_OBJECT_ORIGINAL_FILE_NAME, file.getName()); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_FORMAT, Win32WPDDefines.WPD_OBJECT_FORMAT_MP3); //TODO nog manier vinden om type te detecteren values.setGuidValue(Win32WPDDefines.WPD_OBJECT_CONTENT_TYPE, Win32WPDDefines.WPD_CONTENT_TYPE_AUDIO); values.setStringValue(Win32WPDDefines.WPD_OBJECT_NAME, title); if(artist != null) values.setStringValue(Win32WPDDefines.WPD_MEDIA_ARTIST, artist); values.setUnsignedLargeIntegerValue(Win32WPDDefines.WPD_MEDIA_DURATION, duration); if(genre != null) values.setStringValue(Win32WPDDefines.WPD_MEDIA_GENRE, genre); if(album != null) values.setStringValue(Win32WPDDefines.WPD_MUSIC_ALBUM, album); if(releaseDate != null) values.setFloateValue(Win32WPDDefines.WPD_MEDIA_RELEASE_DATE, (float)new OleDate(releaseDate).toDouble()); if(track >= 0) values.setUnsignedIntegerValue(Win32WPDDefines.WPD_MUSIC_TRACK, track); return new PortableDeviceAudioObjectImplWin32(content.createObjectWithPropertiesAndData(values, file), this.content, this.properties); } catch(COMException e) { if(e.getHresult() == Win32WPDDefines.E_FILENOTFOUND) throw new FileNotFoundException("File " + file + " was not found."); else { throw new IOException(e); } } } }
lmckeon/jmtp
java/src/jmtp/AbstractPortableDeviceContainerImplWin32.java
1,744
//gemeenschappelijke klasse voor storage en folder
line_comment
nl
/* * Copyright 2007 Pieter De Rycke * * This file is part of JMTP. * * JTMP is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or any later version. * * JMTP is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU LesserGeneral Public * License along with JMTP. If not, see <http://www.gnu.org/licenses/>. */ package jmtp; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.math.BigInteger; import java.util.Date; import be.derycke.pieter.com.COMException; import be.derycke.pieter.com.OleDate; //gemeenschappelijke klasse<SUF> abstract class AbstractPortableDeviceContainerImplWin32 extends PortableDeviceObjectImplWin32 { AbstractPortableDeviceContainerImplWin32(String objectID, PortableDeviceContentImplWin32 content, PortableDevicePropertiesImplWin32 properties) { super(objectID, content, properties); } public PortableDeviceObject[] getChildObjects() { try { String[] childIDs = content.listChildObjects(objectID); PortableDeviceObject[] objects = new PortableDeviceObject[childIDs.length]; for(int i = 0; i < childIDs.length; i++) objects[i] = WPDImplWin32.convertToPortableDeviceObject(childIDs[i], this.content, this.properties); return objects; } catch (COMException e) { return new PortableDeviceObject[0]; } } public PortableDeviceFolderObject createFolderObject(String name) { try { PortableDeviceValuesImplWin32 values = new PortableDeviceValuesImplWin32(); values.setStringValue(Win32WPDDefines.WPD_OBJECT_PARENT_ID, this.objectID); values.setStringValue(Win32WPDDefines.WPD_OBJECT_ORIGINAL_FILE_NAME, name); values.setStringValue(Win32WPDDefines.WPD_OBJECT_NAME, name); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_CONTENT_TYPE, Win32WPDDefines.WPD_CONTENT_TYPE_FOLDER); return new PortableDeviceFolderObjectImplWin32(content.createObjectWithPropertiesOnly(values), this.content, this.properties); } catch (COMException e) { e.printStackTrace(); return null; } } //TODO references ondersteuning nog toevoegen public PortableDevicePlaylistObject createPlaylistObject(String name, PortableDeviceObject[] references) { try { PortableDeviceValuesImplWin32 values = new PortableDeviceValuesImplWin32(); values.setStringValue(Win32WPDDefines.WPD_OBJECT_PARENT_ID, this.objectID); values.setStringValue(Win32WPDDefines.WPD_OBJECT_ORIGINAL_FILE_NAME, name + ".pla"); values.setStringValue(Win32WPDDefines.WPD_OBJECT_NAME, name); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_FORMAT, Win32WPDDefines.WPD_OBJECT_FORMAT_PLA); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_CONTENT_TYPE, Win32WPDDefines.WPD_CONTENT_TYPE_PLAYLIST); if(references != null) { PortableDevicePropVariantCollectionImplWin32 propVariantCollection = new PortableDevicePropVariantCollectionImplWin32(); for(PortableDeviceObject reference : references) propVariantCollection.add(new PropVariant(reference.getID())); values.setPortableDeviceValuesCollectionValue(Win32WPDDefines.WPD_OBJECT_REFERENCES, propVariantCollection); } return new PortableDevicePlaylistObjectImplWin32(content.createObjectWithPropertiesOnly(values), this.content, this.properties); } catch(COMException e) { e.printStackTrace(); return null; } } public PortableDeviceAudioObject addAudioObject(File file, String artist, String title, BigInteger duration) throws FileNotFoundException, IOException { return addAudioObject(file, artist, title, duration, null, null, null, -1); } public PortableDeviceAudioObject addAudioObject(File file, String artist, String title, BigInteger duration, String genre, String album, Date releaseDate, int track) throws FileNotFoundException, IOException { try { PortableDeviceValuesImplWin32 values = new PortableDeviceValuesImplWin32(); values.setStringValue(Win32WPDDefines.WPD_OBJECT_PARENT_ID, this.objectID); values.setStringValue(Win32WPDDefines.WPD_OBJECT_ORIGINAL_FILE_NAME, file.getName()); values.setGuidValue(Win32WPDDefines.WPD_OBJECT_FORMAT, Win32WPDDefines.WPD_OBJECT_FORMAT_MP3); //TODO nog manier vinden om type te detecteren values.setGuidValue(Win32WPDDefines.WPD_OBJECT_CONTENT_TYPE, Win32WPDDefines.WPD_CONTENT_TYPE_AUDIO); values.setStringValue(Win32WPDDefines.WPD_OBJECT_NAME, title); if(artist != null) values.setStringValue(Win32WPDDefines.WPD_MEDIA_ARTIST, artist); values.setUnsignedLargeIntegerValue(Win32WPDDefines.WPD_MEDIA_DURATION, duration); if(genre != null) values.setStringValue(Win32WPDDefines.WPD_MEDIA_GENRE, genre); if(album != null) values.setStringValue(Win32WPDDefines.WPD_MUSIC_ALBUM, album); if(releaseDate != null) values.setFloateValue(Win32WPDDefines.WPD_MEDIA_RELEASE_DATE, (float)new OleDate(releaseDate).toDouble()); if(track >= 0) values.setUnsignedIntegerValue(Win32WPDDefines.WPD_MUSIC_TRACK, track); return new PortableDeviceAudioObjectImplWin32(content.createObjectWithPropertiesAndData(values, file), this.content, this.properties); } catch(COMException e) { if(e.getHresult() == Win32WPDDefines.E_FILENOTFOUND) throw new FileNotFoundException("File " + file + " was not found."); else { throw new IOException(e); } } } }
213849_1
/* * This file is part of wegenenverkeer common-resteasy. * Copyright (c) AWV Agentschap Wegen en Verkeer, Vlaamse Gemeenschap * The program is available in open source according to the Apache License, Version 2.0. * For full licensing details, see LICENSE.txt in the project root. */ package be.wegenenverkeer.common.resteasy.exception; /** * Overkoepelende exception die gegooid wordt telkens er een fout optreedt in een rest service methode. */ public abstract class AbstractRestException extends RuntimeException { /** * No-arguments constructor. */ protected AbstractRestException() { } /** * Constructor with message. * * @param message message */ protected AbstractRestException(String message) { super(message); } /** * Constructor with message and cause. * * @param message message * @param cause cause */ protected AbstractRestException(String message, Throwable cause) { super(message, cause); } /** * Constructor with cause. * * @param cause cause */ protected AbstractRestException(Throwable cause) { super(cause); } }
WegenenVerkeer/common-resteasy
resteasy/src/main/java/be/wegenenverkeer/common/resteasy/exception/AbstractRestException.java
304
/** * Overkoepelende exception die gegooid wordt telkens er een fout optreedt in een rest service methode. */
block_comment
nl
/* * This file is part of wegenenverkeer common-resteasy. * Copyright (c) AWV Agentschap Wegen en Verkeer, Vlaamse Gemeenschap * The program is available in open source according to the Apache License, Version 2.0. * For full licensing details, see LICENSE.txt in the project root. */ package be.wegenenverkeer.common.resteasy.exception; /** * Overkoepelende exception die<SUF>*/ public abstract class AbstractRestException extends RuntimeException { /** * No-arguments constructor. */ protected AbstractRestException() { } /** * Constructor with message. * * @param message message */ protected AbstractRestException(String message) { super(message); } /** * Constructor with message and cause. * * @param message message * @param cause cause */ protected AbstractRestException(String message, Throwable cause) { super(message, cause); } /** * Constructor with cause. * * @param cause cause */ protected AbstractRestException(Throwable cause) { super(cause); } }
213859_0
/* * This file is part of wegenenverkeer common-resteasy. * Copyright (c) AWV Agentschap Wegen en Verkeer, Vlaamse Gemeenschap * The program is available in open source according to the Apache License, Version 2.0. * For full licensing details, see LICENSE.txt in the project root. */ package be.wegenenverkeer.common.resteasy.mapper; import be.wegenenverkeer.common.resteasy.exception.ExceptionUtil; import be.wegenenverkeer.common.resteasy.logging.PreProcessLoggingInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; /** * Exception mapper for AuthenticationException. */ @Provider @Component public class AuthenticationExceptionMapper implements ExceptionMapper<AuthenticationException> { @Autowired private PreProcessLoggingInterceptor preProcessLoggingInterceptor; @Context private HttpServletRequest request; @Override public Response toResponse(AuthenticationException exception) { preProcessLoggingInterceptor.postProcessError(exception, "Onvoldoende rechten:"); ExceptionUtil eu = new ExceptionUtil(exception); return Response.status(Response.Status.UNAUTHORIZED) .entity("{ \"error\" : {\"authenticatie\":[\"" + eu.getEscapedConcatenatedMessage() + "\"]}}") .header("Access-Control-Allow-Origin", request.getHeader("Origin")) .header("Access-Control-Allow-Credentials", true) .build(); } }
WegenenVerkeer/common-resteasy
resteasy/src/main/java/be/wegenenverkeer/common/resteasy/mapper/AuthenticationExceptionMapper.java
427
/* * This file is part of wegenenverkeer common-resteasy. * Copyright (c) AWV Agentschap Wegen en Verkeer, Vlaamse Gemeenschap * The program is available in open source according to the Apache License, Version 2.0. * For full licensing details, see LICENSE.txt in the project root. */
block_comment
nl
/* * This file is<SUF>*/ package be.wegenenverkeer.common.resteasy.mapper; import be.wegenenverkeer.common.resteasy.exception.ExceptionUtil; import be.wegenenverkeer.common.resteasy.logging.PreProcessLoggingInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; /** * Exception mapper for AuthenticationException. */ @Provider @Component public class AuthenticationExceptionMapper implements ExceptionMapper<AuthenticationException> { @Autowired private PreProcessLoggingInterceptor preProcessLoggingInterceptor; @Context private HttpServletRequest request; @Override public Response toResponse(AuthenticationException exception) { preProcessLoggingInterceptor.postProcessError(exception, "Onvoldoende rechten:"); ExceptionUtil eu = new ExceptionUtil(exception); return Response.status(Response.Status.UNAUTHORIZED) .entity("{ \"error\" : {\"authenticatie\":[\"" + eu.getEscapedConcatenatedMessage() + "\"]}}") .header("Access-Control-Allow-Origin", request.getHeader("Origin")) .header("Access-Control-Allow-Credentials", true) .build(); } }
213893_2
package com.makemoji.mojilib; import android.content.Context; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.support.annotation.IntDef; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.makemoji.mojilib.gif.GifImageView; import com.makemoji.mojilib.model.MojiModel; import com.makemoji.mojilib.model.SpaceMojiModel; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; /** * Created by Scott Baar on 2/5/2016. */ public class MojiGridAdapter extends RecyclerView.Adapter<MojiGridAdapter.Holder> { List<MojiModel> mojiModels = new ArrayList<>(); boolean vertical; int spanSize; Drawable phraseBg; boolean enablePulse = true; boolean imaagesSizedToSpan = true; boolean useKbLifecycle; public static final int ITEM_NORMAL = 0; public static final int ITEM_GIF = 1; public static final int ITEM_PHRASE = 2; public static final int ITEM_VIDEO = 3; public static final int ITEM_HSPACE = 4; @Retention(RetentionPolicy.SOURCE) @IntDef({ITEM_NORMAL,ITEM_GIF,ITEM_PHRASE,ITEM_VIDEO}) public @interface ItemType {} IMojiSelected iMojiSelected; public void setEnablePulse(boolean enable){ enablePulse = enable; } //force gif image views to have the mmkb hash and NOT the open activity's. public void useKbLifecycle(){ useKbLifecycle = true; } public MojiGridAdapter (List<MojiModel> models, IMojiSelected iMojiSelected,boolean vertical, int spanSize) { mojiModels = models; this.iMojiSelected = iMojiSelected; this.spanSize = spanSize; this.vertical =vertical; phraseBg = ContextCompat.getDrawable(Moji.context,R.drawable.mm_phrase_bg); } public void setMojiModels(List<MojiModel> models){ mojiModels = new ArrayList<>(models); notifyDataSetChanged(); } public List<MojiModel> getMojiModels(){ return mojiModels; } public void setImagesSizedtoSpan(boolean enable){ imaagesSizedToSpan = enable; } @Override public int getItemCount() { return mojiModels.size(); } @Override public int getItemViewType(int position){ if (mojiModels.get(position) instanceof SpaceMojiModel) return ITEM_HSPACE; if (mojiModels.get(position).gif==1)return ITEM_GIF; if (mojiModels.get(position).isPhrase()) return ITEM_PHRASE; if (mojiModels.get(position).isVideo()) return ITEM_VIDEO; return 0; } @Override public Holder onCreateViewHolder(ViewGroup parent, int viewType) { View v; if (viewType==ITEM_NORMAL) v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.mm_rv_moji_item, parent, false); else if (viewType==ITEM_GIF){ v = LayoutInflater.from(parent.getContext()) .inflate(vertical?R.layout.mm_gif_iv_vertical:R.layout.mm_gif_iv,parent,false); } else if (viewType==ITEM_PHRASE){ v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.mm_rv_phrase_item, parent, false); v.setBackgroundDrawable(phraseBg); } else if (viewType == ITEM_HSPACE){ v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.mm_item_hspace, parent, false); } else{ v = LayoutInflater.from(parent.getContext()) .inflate(vertical?R.layout.mm_video_moji_item_vertical:R.layout.mm_video_moji_item, parent, false); } //v.getLayoutParams().height = parent.getHeight()/2; return new Holder(v,parent); } @Override public void onBindViewHolder(final Holder holder, int position) { final MojiModel model = mojiModels.get(position); Mojilytics.trackView(model.id); if (getItemViewType(position)==ITEM_NORMAL) { holder.imageView.setPulseEnabled(enablePulse); holder.imageView.forceDimen(holder.dimen); holder.imageView.sizeImagesToSpanSize(imaagesSizedToSpan); holder.imageView.setModel(model); holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { iMojiSelected.mojiSelected(model, null); } }); } else if (getItemViewType(position)==ITEM_GIF){ holder.gifImageView.getFromUrl(model.image_url); holder.gifImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { iMojiSelected.mojiSelected(model, null); } }); } else if (getItemViewType(position)==ITEM_VIDEO){ holder.imageView.setModel(model); holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { iMojiSelected.mojiSelected(model, null); } }); holder.title.setText(model.name); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) holder.overlay.getLayoutParams(); lp.width = holder.dimen/2; lp.height = holder.dimen/2; holder.overlay.setLayoutParams(lp); } else if (getItemViewType(position)==ITEM_PHRASE) { LinearLayout ll = (LinearLayout) holder.itemView; ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { for (MojiModel emoji : model.emoji) iMojiSelected.mojiSelected(model, null); } }); while (holder.mojiImageViews.size()<model.emoji.size()) { MojiImageView v = (MojiImageView)LayoutInflater.from(holder.itemView.getContext()) .inflate(R.layout.mm_rv_moji_item, ll, false); v.setPulseEnabled(enablePulse); v.sizeImagesToSpanSize(false); //v.setPadding(0,(int)(2*Moji.density),(int)(-5*Moji.density),(int)(2*Moji.density)); ll.addView(v); holder.mojiImageViews.add((MojiImageView)v); } for (int i = 0; i < ll.getChildCount(); i++) { MojiImageView mojiImageView = (MojiImageView) ll.getChildAt(i); MojiModel sequence = model.emoji.size()>i?model.emoji.get(i):null; if (sequence!=null) { mojiImageView.forceDimen(holder.dimen); mojiImageView.setModel(sequence); mojiImageView.setVisibility(View.VISIBLE); } else mojiImageView.setVisibility(View.GONE); } } } class Holder extends RecyclerView.ViewHolder { MojiImageView imageView; int dimen; List<MojiImageView> mojiImageViews = new ArrayList<>(); GifImageView gifImageView; TextView title; ImageView overlay; ViewGroup parent; public Holder(View v, ViewGroup parent) { super(v); this.parent = parent; if (v instanceof MojiImageView)imageView = (MojiImageView) v; else if (v instanceof GifImageView) { gifImageView = (GifImageView) v; if (useKbLifecycle) gifImageView.useKbLifecycle = true; } else{ imageView = (MojiImageView)v.findViewById(R.id._mm_moji_iv); title = (TextView) v.findViewById(R.id.mm_item_title); overlay = (ImageView) v.findViewById(R.id._mm_play_overlay); } dimen = spanSize; } } }
makemoji/MakemojiSDK-Android
makemoji-sdk-android/src/main/java/com/makemoji/mojilib/MojiGridAdapter.java
2,145
//v.getLayoutParams().height = parent.getHeight()/2;
line_comment
nl
package com.makemoji.mojilib; import android.content.Context; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.support.annotation.IntDef; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.makemoji.mojilib.gif.GifImageView; import com.makemoji.mojilib.model.MojiModel; import com.makemoji.mojilib.model.SpaceMojiModel; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; /** * Created by Scott Baar on 2/5/2016. */ public class MojiGridAdapter extends RecyclerView.Adapter<MojiGridAdapter.Holder> { List<MojiModel> mojiModels = new ArrayList<>(); boolean vertical; int spanSize; Drawable phraseBg; boolean enablePulse = true; boolean imaagesSizedToSpan = true; boolean useKbLifecycle; public static final int ITEM_NORMAL = 0; public static final int ITEM_GIF = 1; public static final int ITEM_PHRASE = 2; public static final int ITEM_VIDEO = 3; public static final int ITEM_HSPACE = 4; @Retention(RetentionPolicy.SOURCE) @IntDef({ITEM_NORMAL,ITEM_GIF,ITEM_PHRASE,ITEM_VIDEO}) public @interface ItemType {} IMojiSelected iMojiSelected; public void setEnablePulse(boolean enable){ enablePulse = enable; } //force gif image views to have the mmkb hash and NOT the open activity's. public void useKbLifecycle(){ useKbLifecycle = true; } public MojiGridAdapter (List<MojiModel> models, IMojiSelected iMojiSelected,boolean vertical, int spanSize) { mojiModels = models; this.iMojiSelected = iMojiSelected; this.spanSize = spanSize; this.vertical =vertical; phraseBg = ContextCompat.getDrawable(Moji.context,R.drawable.mm_phrase_bg); } public void setMojiModels(List<MojiModel> models){ mojiModels = new ArrayList<>(models); notifyDataSetChanged(); } public List<MojiModel> getMojiModels(){ return mojiModels; } public void setImagesSizedtoSpan(boolean enable){ imaagesSizedToSpan = enable; } @Override public int getItemCount() { return mojiModels.size(); } @Override public int getItemViewType(int position){ if (mojiModels.get(position) instanceof SpaceMojiModel) return ITEM_HSPACE; if (mojiModels.get(position).gif==1)return ITEM_GIF; if (mojiModels.get(position).isPhrase()) return ITEM_PHRASE; if (mojiModels.get(position).isVideo()) return ITEM_VIDEO; return 0; } @Override public Holder onCreateViewHolder(ViewGroup parent, int viewType) { View v; if (viewType==ITEM_NORMAL) v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.mm_rv_moji_item, parent, false); else if (viewType==ITEM_GIF){ v = LayoutInflater.from(parent.getContext()) .inflate(vertical?R.layout.mm_gif_iv_vertical:R.layout.mm_gif_iv,parent,false); } else if (viewType==ITEM_PHRASE){ v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.mm_rv_phrase_item, parent, false); v.setBackgroundDrawable(phraseBg); } else if (viewType == ITEM_HSPACE){ v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.mm_item_hspace, parent, false); } else{ v = LayoutInflater.from(parent.getContext()) .inflate(vertical?R.layout.mm_video_moji_item_vertical:R.layout.mm_video_moji_item, parent, false); } //v.getLayoutParams().height =<SUF> return new Holder(v,parent); } @Override public void onBindViewHolder(final Holder holder, int position) { final MojiModel model = mojiModels.get(position); Mojilytics.trackView(model.id); if (getItemViewType(position)==ITEM_NORMAL) { holder.imageView.setPulseEnabled(enablePulse); holder.imageView.forceDimen(holder.dimen); holder.imageView.sizeImagesToSpanSize(imaagesSizedToSpan); holder.imageView.setModel(model); holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { iMojiSelected.mojiSelected(model, null); } }); } else if (getItemViewType(position)==ITEM_GIF){ holder.gifImageView.getFromUrl(model.image_url); holder.gifImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { iMojiSelected.mojiSelected(model, null); } }); } else if (getItemViewType(position)==ITEM_VIDEO){ holder.imageView.setModel(model); holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { iMojiSelected.mojiSelected(model, null); } }); holder.title.setText(model.name); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) holder.overlay.getLayoutParams(); lp.width = holder.dimen/2; lp.height = holder.dimen/2; holder.overlay.setLayoutParams(lp); } else if (getItemViewType(position)==ITEM_PHRASE) { LinearLayout ll = (LinearLayout) holder.itemView; ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { for (MojiModel emoji : model.emoji) iMojiSelected.mojiSelected(model, null); } }); while (holder.mojiImageViews.size()<model.emoji.size()) { MojiImageView v = (MojiImageView)LayoutInflater.from(holder.itemView.getContext()) .inflate(R.layout.mm_rv_moji_item, ll, false); v.setPulseEnabled(enablePulse); v.sizeImagesToSpanSize(false); //v.setPadding(0,(int)(2*Moji.density),(int)(-5*Moji.density),(int)(2*Moji.density)); ll.addView(v); holder.mojiImageViews.add((MojiImageView)v); } for (int i = 0; i < ll.getChildCount(); i++) { MojiImageView mojiImageView = (MojiImageView) ll.getChildAt(i); MojiModel sequence = model.emoji.size()>i?model.emoji.get(i):null; if (sequence!=null) { mojiImageView.forceDimen(holder.dimen); mojiImageView.setModel(sequence); mojiImageView.setVisibility(View.VISIBLE); } else mojiImageView.setVisibility(View.GONE); } } } class Holder extends RecyclerView.ViewHolder { MojiImageView imageView; int dimen; List<MojiImageView> mojiImageViews = new ArrayList<>(); GifImageView gifImageView; TextView title; ImageView overlay; ViewGroup parent; public Holder(View v, ViewGroup parent) { super(v); this.parent = parent; if (v instanceof MojiImageView)imageView = (MojiImageView) v; else if (v instanceof GifImageView) { gifImageView = (GifImageView) v; if (useKbLifecycle) gifImageView.useKbLifecycle = true; } else{ imageView = (MojiImageView)v.findViewById(R.id._mm_moji_iv); title = (TextView) v.findViewById(R.id.mm_item_title); overlay = (ImageView) v.findViewById(R.id._mm_play_overlay); } dimen = spanSize; } } }
213903_1
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.rus.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>KS1285mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>KS1285mmAAGun.createInstance()</code> or <code>new KS1285mmAAGun()</code>. </p> * <ul> * <li> Country: Russia (RUS) = <code>222</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense / Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>13</code>; </li> * <li> Specific: KS1285mmAAGun = <code>3</code>; </li> * <li> Entity type uid: 13130; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$SpecificElem@79d9214d. </p> * @see Country#RUSSIA_RUS * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class KS1285mmAAGun extends EntityType { /** Default constructor */ public KS1285mmAAGun() { setCountry(Country.RUSSIA_RUS); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 13034, Air Defense / Missile Defense Unit Equipment setSubCategory((byte)13); // uid 13127, Towed VSHORAD Gun/Missile System setSpecific((byte)3); // uid 13130, KS-12 85mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static KS1285mmAAGun createInstance() { return new KS1285mmAAGun(); } }
open-dis/opendis7-java
src-generated/edu/nps/moves/dis7/entities/rus/platform/land/KS1285mmAAGun.java
870
// header autogenerated using string template dis7javalicense.txt
line_comment
nl
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated<SUF> // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.rus.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>KS1285mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>KS1285mmAAGun.createInstance()</code> or <code>new KS1285mmAAGun()</code>. </p> * <ul> * <li> Country: Russia (RUS) = <code>222</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense / Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>13</code>; </li> * <li> Specific: KS1285mmAAGun = <code>3</code>; </li> * <li> Entity type uid: 13130; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$SpecificElem@79d9214d. </p> * @see Country#RUSSIA_RUS * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class KS1285mmAAGun extends EntityType { /** Default constructor */ public KS1285mmAAGun() { setCountry(Country.RUSSIA_RUS); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 13034, Air Defense / Missile Defense Unit Equipment setSubCategory((byte)13); // uid 13127, Towed VSHORAD Gun/Missile System setSpecific((byte)3); // uid 13130, KS-12 85mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static KS1285mmAAGun createInstance() { return new KS1285mmAAGun(); } }
213903_4
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.rus.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>KS1285mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>KS1285mmAAGun.createInstance()</code> or <code>new KS1285mmAAGun()</code>. </p> * <ul> * <li> Country: Russia (RUS) = <code>222</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense / Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>13</code>; </li> * <li> Specific: KS1285mmAAGun = <code>3</code>; </li> * <li> Entity type uid: 13130; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$SpecificElem@79d9214d. </p> * @see Country#RUSSIA_RUS * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class KS1285mmAAGun extends EntityType { /** Default constructor */ public KS1285mmAAGun() { setCountry(Country.RUSSIA_RUS); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 13034, Air Defense / Missile Defense Unit Equipment setSubCategory((byte)13); // uid 13127, Towed VSHORAD Gun/Missile System setSpecific((byte)3); // uid 13130, KS-12 85mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static KS1285mmAAGun createInstance() { return new KS1285mmAAGun(); } }
open-dis/opendis7-java
src-generated/edu/nps/moves/dis7/entities/rus/platform/land/KS1285mmAAGun.java
870
// uid 13034, Air Defense / Missile Defense Unit Equipment
line_comment
nl
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.rus.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>KS1285mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>KS1285mmAAGun.createInstance()</code> or <code>new KS1285mmAAGun()</code>. </p> * <ul> * <li> Country: Russia (RUS) = <code>222</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense / Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>13</code>; </li> * <li> Specific: KS1285mmAAGun = <code>3</code>; </li> * <li> Entity type uid: 13130; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$SpecificElem@79d9214d. </p> * @see Country#RUSSIA_RUS * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class KS1285mmAAGun extends EntityType { /** Default constructor */ public KS1285mmAAGun() { setCountry(Country.RUSSIA_RUS); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 13034,<SUF> setSubCategory((byte)13); // uid 13127, Towed VSHORAD Gun/Missile System setSpecific((byte)3); // uid 13130, KS-12 85mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static KS1285mmAAGun createInstance() { return new KS1285mmAAGun(); } }
213903_6
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.rus.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>KS1285mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>KS1285mmAAGun.createInstance()</code> or <code>new KS1285mmAAGun()</code>. </p> * <ul> * <li> Country: Russia (RUS) = <code>222</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense / Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>13</code>; </li> * <li> Specific: KS1285mmAAGun = <code>3</code>; </li> * <li> Entity type uid: 13130; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$SpecificElem@79d9214d. </p> * @see Country#RUSSIA_RUS * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class KS1285mmAAGun extends EntityType { /** Default constructor */ public KS1285mmAAGun() { setCountry(Country.RUSSIA_RUS); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 13034, Air Defense / Missile Defense Unit Equipment setSubCategory((byte)13); // uid 13127, Towed VSHORAD Gun/Missile System setSpecific((byte)3); // uid 13130, KS-12 85mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static KS1285mmAAGun createInstance() { return new KS1285mmAAGun(); } }
open-dis/opendis7-java
src-generated/edu/nps/moves/dis7/entities/rus/platform/land/KS1285mmAAGun.java
870
// uid 13130, KS-12 85mm AA Gun
line_comment
nl
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.rus.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>KS1285mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>KS1285mmAAGun.createInstance()</code> or <code>new KS1285mmAAGun()</code>. </p> * <ul> * <li> Country: Russia (RUS) = <code>222</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense / Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>13</code>; </li> * <li> Specific: KS1285mmAAGun = <code>3</code>; </li> * <li> Entity type uid: 13130; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$SpecificElem@79d9214d. </p> * @see Country#RUSSIA_RUS * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class KS1285mmAAGun extends EntityType { /** Default constructor */ public KS1285mmAAGun() { setCountry(Country.RUSSIA_RUS); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 13034, Air Defense / Missile Defense Unit Equipment setSubCategory((byte)13); // uid 13127, Towed VSHORAD Gun/Missile System setSpecific((byte)3); // uid 13130,<SUF> } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static KS1285mmAAGun createInstance() { return new KS1285mmAAGun(); } }
213906_1
package experiments; import org.scify.jedai.datamodel.EntityProfile; import org.scify.jedai.datamodel.IdDuplicates; import java.util.*; import minhash.LocalitySensitiveHashing; import minhash.MinHash; import minhash.Pair; import minhash.Reader; import minhash.ShinglingModel; import minhash.Utilities; public class schemaAgnostic { static int ITERATIONS = 10; public static void main(String[] args) { boolean[] preprocessed = {false, false, false, true, false, true, false, false, false, false}; int[] bands = {4, 32, 16, 4, 32, 32, 16, 32, 16, 32}; int[] buckets = {64, 8, 8, 128, 16, 8, 16, 16, 16, 8}; int[] k = {2, 2, 2, 2, 2, 5, 2, 2, 2, 2}; String[] mainDirs = {"/home/gap2/Documents/blockingNN/data/schemaAgnostic/", "/home/gap2/Documents/blockingNN/data/preprocessedSA/" }; String[] datasetsD1 = {"restaurant1Profiles", "abtProfiles", "amazonProfiles", "dblpProfiles", "imdbProfilesNEW", "imdbProfilesNEW", "tmdbProfiles", "walmartProfiles", "dblpProfiles2", "imdbProfiles"}; String[] datasetsD2 = {"restaurant2Profiles", "buyProfiles", "gpProfiles", "acmProfiles", "tmdbProfiles", "tvdbProfiles", "tvdbProfiles", "amazonProfiles2", "scholarProfiles", "dbpediaProfiles"}; String[] groundtruthDirs = {"restaurantsIdDuplicates", "abtBuyIdDuplicates", "amazonGpIdDuplicates", "dblpAcmIdDuplicates", "imdbTmdbIdDuplicates", "imdbTvdbIdDuplicates", "tmdbTvdbIdDuplicates", "amazonWalmartIdDuplicates", "dblpScholarIdDuplicates", "moviesIdDuplicates"}; for (int datasetId = 0; datasetId < groundtruthDirs.length; datasetId++) { // read source entities int dirId = preprocessed[datasetId] ? 1 : 0; String sourcePath = mainDirs[dirId] + datasetsD1[datasetId]; List<EntityProfile> sourceEntities = Reader.readSerialized(sourcePath); System.out.println("Source Entities: " + sourceEntities.size()); // read target entities String targetPath = mainDirs[dirId] + datasetsD2[datasetId]; List<EntityProfile> targetEntities = Reader.readSerialized(targetPath); System.out.println("Target Entities: " + targetEntities.size()); // read ground-truth file String groundTruthPath = mainDirs[dirId] + groundtruthDirs[datasetId]; Set<IdDuplicates> gtDuplicates = Reader.readSerializedGT(groundTruthPath, sourceEntities, targetEntities); System.out.println("GT Duplicates Entities: " + gtDuplicates.size()); System.out.println(); double averageIndexingTime = 0; double averageQueryingTime = 0; double averageRecall = 0; double averagePrecision = 0; double averageCandidates = 0; for (int iteration = 0; iteration < ITERATIONS; iteration++) { long time1 = System.currentTimeMillis(); List<String> sourceSTR = Utilities.entities2String(sourceEntities); ShinglingModel model = new ShinglingModel(sourceSTR, k[datasetId]); int[][] sourceVectorsInt = model.vectorization(sourceSTR); float[][] sVectors = new float[sourceVectorsInt.length][]; for (int row = 0; row < sourceVectorsInt.length; row++) { double[] tempArray = Arrays.stream(sourceVectorsInt[row]).asDoubleStream().toArray(); sVectors[row] = new float[tempArray.length]; for (int i = 0; i < tempArray.length; i++) { sVectors[row][i] = (float) tempArray[i]; } } // initialize LSH LocalitySensitiveHashing lsh = new MinHash(sVectors, bands[datasetId], buckets[datasetId], model.getVectorSize()); long time2 = System.currentTimeMillis(); List<String> targetSTR = Utilities.entities2String(targetEntities); int[][] targetVectorsInt = model.vectorization(targetSTR); float[][] tVectors = new float[targetVectorsInt.length][]; for (int row = 0; row < targetVectorsInt.length; row++) { double[] tempArray = Arrays.stream(targetVectorsInt[row]).asDoubleStream().toArray(); tVectors[row] = new float[tempArray.length]; for (int i = 0; i < tempArray.length; i++) { tVectors[row][i] = (float) tempArray[i]; } } // for each target entity, find its candidates (query) // find TP by searching the pairs in GT final List<Pair> candidatePairs = new ArrayList<>(); for (int j = 0; j < targetEntities.size(); j++) { float[] vector = tVectors[j]; Set<Integer> candidates = lsh.query(vector); for (Integer c : candidates) { candidatePairs.add(new Pair(j, c)); } } long time3 = System.currentTimeMillis(); averageIndexingTime += time2 - time1; averageQueryingTime += time3 - time2; // true positive long tp_ = 0; // total verifications long verifications_ = 0; for (int j = 0; j < targetEntities.size(); j++) { float[] vector = tVectors[j]; Set<Integer> candidates = lsh.query(vector); for (Integer c : candidates) { IdDuplicates pair = new IdDuplicates(c, j); if (gtDuplicates.contains(pair)) { tp_ += 1; } verifications_ += 1; } } float recall_ = (float) tp_ / (float) gtDuplicates.size(); float precision_ = (float) tp_ / (float) verifications_; averageRecall += recall_; averagePrecision += precision_; averageCandidates += candidatePairs.size(); } System.out.println("Average indexing time\t:\t" + averageIndexingTime / ITERATIONS); System.out.println("Average querying time\t:\t" + averageQueryingTime / ITERATIONS); System.out.println("Recall\t:\t" + averageRecall / ITERATIONS); System.out.println("Precision\t:\t" + averagePrecision / ITERATIONS); System.out.println("Candidates\t:\t" + averageCandidates / ITERATIONS); } } }
gpapadis/ContinuousFilteringBenchmark
nnmethods/minhashLSH/src/experiments/schemaAgnostic.java
1,687
// read target entities
line_comment
nl
package experiments; import org.scify.jedai.datamodel.EntityProfile; import org.scify.jedai.datamodel.IdDuplicates; import java.util.*; import minhash.LocalitySensitiveHashing; import minhash.MinHash; import minhash.Pair; import minhash.Reader; import minhash.ShinglingModel; import minhash.Utilities; public class schemaAgnostic { static int ITERATIONS = 10; public static void main(String[] args) { boolean[] preprocessed = {false, false, false, true, false, true, false, false, false, false}; int[] bands = {4, 32, 16, 4, 32, 32, 16, 32, 16, 32}; int[] buckets = {64, 8, 8, 128, 16, 8, 16, 16, 16, 8}; int[] k = {2, 2, 2, 2, 2, 5, 2, 2, 2, 2}; String[] mainDirs = {"/home/gap2/Documents/blockingNN/data/schemaAgnostic/", "/home/gap2/Documents/blockingNN/data/preprocessedSA/" }; String[] datasetsD1 = {"restaurant1Profiles", "abtProfiles", "amazonProfiles", "dblpProfiles", "imdbProfilesNEW", "imdbProfilesNEW", "tmdbProfiles", "walmartProfiles", "dblpProfiles2", "imdbProfiles"}; String[] datasetsD2 = {"restaurant2Profiles", "buyProfiles", "gpProfiles", "acmProfiles", "tmdbProfiles", "tvdbProfiles", "tvdbProfiles", "amazonProfiles2", "scholarProfiles", "dbpediaProfiles"}; String[] groundtruthDirs = {"restaurantsIdDuplicates", "abtBuyIdDuplicates", "amazonGpIdDuplicates", "dblpAcmIdDuplicates", "imdbTmdbIdDuplicates", "imdbTvdbIdDuplicates", "tmdbTvdbIdDuplicates", "amazonWalmartIdDuplicates", "dblpScholarIdDuplicates", "moviesIdDuplicates"}; for (int datasetId = 0; datasetId < groundtruthDirs.length; datasetId++) { // read source entities int dirId = preprocessed[datasetId] ? 1 : 0; String sourcePath = mainDirs[dirId] + datasetsD1[datasetId]; List<EntityProfile> sourceEntities = Reader.readSerialized(sourcePath); System.out.println("Source Entities: " + sourceEntities.size()); // read target<SUF> String targetPath = mainDirs[dirId] + datasetsD2[datasetId]; List<EntityProfile> targetEntities = Reader.readSerialized(targetPath); System.out.println("Target Entities: " + targetEntities.size()); // read ground-truth file String groundTruthPath = mainDirs[dirId] + groundtruthDirs[datasetId]; Set<IdDuplicates> gtDuplicates = Reader.readSerializedGT(groundTruthPath, sourceEntities, targetEntities); System.out.println("GT Duplicates Entities: " + gtDuplicates.size()); System.out.println(); double averageIndexingTime = 0; double averageQueryingTime = 0; double averageRecall = 0; double averagePrecision = 0; double averageCandidates = 0; for (int iteration = 0; iteration < ITERATIONS; iteration++) { long time1 = System.currentTimeMillis(); List<String> sourceSTR = Utilities.entities2String(sourceEntities); ShinglingModel model = new ShinglingModel(sourceSTR, k[datasetId]); int[][] sourceVectorsInt = model.vectorization(sourceSTR); float[][] sVectors = new float[sourceVectorsInt.length][]; for (int row = 0; row < sourceVectorsInt.length; row++) { double[] tempArray = Arrays.stream(sourceVectorsInt[row]).asDoubleStream().toArray(); sVectors[row] = new float[tempArray.length]; for (int i = 0; i < tempArray.length; i++) { sVectors[row][i] = (float) tempArray[i]; } } // initialize LSH LocalitySensitiveHashing lsh = new MinHash(sVectors, bands[datasetId], buckets[datasetId], model.getVectorSize()); long time2 = System.currentTimeMillis(); List<String> targetSTR = Utilities.entities2String(targetEntities); int[][] targetVectorsInt = model.vectorization(targetSTR); float[][] tVectors = new float[targetVectorsInt.length][]; for (int row = 0; row < targetVectorsInt.length; row++) { double[] tempArray = Arrays.stream(targetVectorsInt[row]).asDoubleStream().toArray(); tVectors[row] = new float[tempArray.length]; for (int i = 0; i < tempArray.length; i++) { tVectors[row][i] = (float) tempArray[i]; } } // for each target entity, find its candidates (query) // find TP by searching the pairs in GT final List<Pair> candidatePairs = new ArrayList<>(); for (int j = 0; j < targetEntities.size(); j++) { float[] vector = tVectors[j]; Set<Integer> candidates = lsh.query(vector); for (Integer c : candidates) { candidatePairs.add(new Pair(j, c)); } } long time3 = System.currentTimeMillis(); averageIndexingTime += time2 - time1; averageQueryingTime += time3 - time2; // true positive long tp_ = 0; // total verifications long verifications_ = 0; for (int j = 0; j < targetEntities.size(); j++) { float[] vector = tVectors[j]; Set<Integer> candidates = lsh.query(vector); for (Integer c : candidates) { IdDuplicates pair = new IdDuplicates(c, j); if (gtDuplicates.contains(pair)) { tp_ += 1; } verifications_ += 1; } } float recall_ = (float) tp_ / (float) gtDuplicates.size(); float precision_ = (float) tp_ / (float) verifications_; averageRecall += recall_; averagePrecision += precision_; averageCandidates += candidatePairs.size(); } System.out.println("Average indexing time\t:\t" + averageIndexingTime / ITERATIONS); System.out.println("Average querying time\t:\t" + averageQueryingTime / ITERATIONS); System.out.println("Recall\t:\t" + averageRecall / ITERATIONS); System.out.println("Precision\t:\t" + averagePrecision / ITERATIONS); System.out.println("Candidates\t:\t" + averageCandidates / ITERATIONS); } } }
213913_4
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.chn.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>Type74Twin37mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>Type74Twin37mmAAGun.createInstance()</code> or <code>new Type74Twin37mmAAGun()</code>. </p> * <ul> * <li> Country: China, People's Republic of (CHN) = <code>45</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense/Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>5</code>; </li> * <li> Specific: NORINCO37mmAAGuns = <code>2</code>; </li> * <li> Entity type uid: 16963; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$ExtraElem@5ccddd20. </p> * @see Country#CHINA_PEOPLES_REPUBLIC_OF_CHN * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class Type74Twin37mmAAGun extends EntityType { /** Default constructor */ public Type74Twin37mmAAGun() { setCountry(Country.CHINA_PEOPLES_REPUBLIC_OF_CHN); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 16937, Air Defense/Missile Defense Unit Equipment setSubCategory((byte)5); // uid 16958, Towed VSHORAD Gun/Missile System setSpecific((byte)2); // uid 16960, NORINCO 37mm AA Guns setExtra((byte)3); // uid 16963, Type 74 Twin 37mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static Type74Twin37mmAAGun createInstance() { return new Type74Twin37mmAAGun(); } }
open-dis/opendis7-java
src-generated/edu/nps/moves/dis7/entities/chn/platform/land/Type74Twin37mmAAGun.java
921
// uid 16937, Air Defense/Missile Defense Unit Equipment
line_comment
nl
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.chn.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>Type74Twin37mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>Type74Twin37mmAAGun.createInstance()</code> or <code>new Type74Twin37mmAAGun()</code>. </p> * <ul> * <li> Country: China, People's Republic of (CHN) = <code>45</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense/Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>5</code>; </li> * <li> Specific: NORINCO37mmAAGuns = <code>2</code>; </li> * <li> Entity type uid: 16963; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$ExtraElem@5ccddd20. </p> * @see Country#CHINA_PEOPLES_REPUBLIC_OF_CHN * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class Type74Twin37mmAAGun extends EntityType { /** Default constructor */ public Type74Twin37mmAAGun() { setCountry(Country.CHINA_PEOPLES_REPUBLIC_OF_CHN); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 16937,<SUF> setSubCategory((byte)5); // uid 16958, Towed VSHORAD Gun/Missile System setSpecific((byte)2); // uid 16960, NORINCO 37mm AA Guns setExtra((byte)3); // uid 16963, Type 74 Twin 37mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static Type74Twin37mmAAGun createInstance() { return new Type74Twin37mmAAGun(); } }
213913_6
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.chn.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>Type74Twin37mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>Type74Twin37mmAAGun.createInstance()</code> or <code>new Type74Twin37mmAAGun()</code>. </p> * <ul> * <li> Country: China, People's Republic of (CHN) = <code>45</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense/Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>5</code>; </li> * <li> Specific: NORINCO37mmAAGuns = <code>2</code>; </li> * <li> Entity type uid: 16963; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$ExtraElem@5ccddd20. </p> * @see Country#CHINA_PEOPLES_REPUBLIC_OF_CHN * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class Type74Twin37mmAAGun extends EntityType { /** Default constructor */ public Type74Twin37mmAAGun() { setCountry(Country.CHINA_PEOPLES_REPUBLIC_OF_CHN); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 16937, Air Defense/Missile Defense Unit Equipment setSubCategory((byte)5); // uid 16958, Towed VSHORAD Gun/Missile System setSpecific((byte)2); // uid 16960, NORINCO 37mm AA Guns setExtra((byte)3); // uid 16963, Type 74 Twin 37mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static Type74Twin37mmAAGun createInstance() { return new Type74Twin37mmAAGun(); } }
open-dis/opendis7-java
src-generated/edu/nps/moves/dis7/entities/chn/platform/land/Type74Twin37mmAAGun.java
921
// uid 16960, NORINCO 37mm AA Guns
line_comment
nl
/** * Copyright (c) 2008-2023, MOVES Institute, Naval Postgraduate School (NPS). All rights reserved. * This work is provided under a BSD-style open-source license, see project * <a href="https://savage.nps.edu/opendis7-java/license.html" target="_blank">license.html</a> and <a href="https://savage.nps.edu/opendis7-java/license.txt" target="_blank">license.txt</a> */ // header autogenerated using string template dis7javalicense.txt // autogenerated using string template entitytypecommon.txt package edu.nps.moves.dis7.entities.chn.platform.land; import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** * <p> Entity class <b><code>Type74Twin37mmAAGun</code></b> collects multiple enumeration values together to uniquely define this entity. </p> * <p> <i>Usage:</i> create an instance of this class with <code>Type74Twin37mmAAGun.createInstance()</code> or <code>new Type74Twin37mmAAGun()</code>. </p> * <ul> * <li> Country: China, People's Republic of (CHN) = <code>45</code>; </li> * <li> Entity kind: PlatformDomain = <code>LAND</code>; </li> * <li> Domain: Platform = <code>1</code>; </li> * <li> Category: Air Defense/Missile Defense Unit Equipment = <code>28</code>; </li> * <li> SubCategory: TowedVSHORADGunMissileSystem = <code>5</code>; </li> * <li> Specific: NORINCO37mmAAGuns = <code>2</code>; </li> * <li> Entity type uid: 16963; </li> * <li> Online document reference: <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/specifications/README.md" target="_blank">SISO-REF-010-v33-DRAFT-20231217-d10 (2023-12-17)</a>. </li> * </ul> * <p> Full name: edu.nps.moves.dis7.source.generator.entityTypes.GenerateEntityTypes$ExtraElem@5ccddd20. </p> * @see Country#CHINA_PEOPLES_REPUBLIC_OF_CHN * @see EntityKind#PLATFORM * @see Domain * @see PlatformDomain * @see Category * @see AirDefenseMissileDefenseUnitEquipment * @see SubCategory */ public final class Type74Twin37mmAAGun extends EntityType { /** Default constructor */ public Type74Twin37mmAAGun() { setCountry(Country.CHINA_PEOPLES_REPUBLIC_OF_CHN); setEntityKind(EntityKind.PLATFORM); setDomain(Domain.inst(PlatformDomain.LAND)); setCategory((byte)28); // uid 16937, Air Defense/Missile Defense Unit Equipment setSubCategory((byte)5); // uid 16958, Towed VSHORAD Gun/Missile System setSpecific((byte)2); // uid 16960,<SUF> setExtra((byte)3); // uid 16963, Type 74 Twin 37mm AA Gun } /** Create a new instance of this final (unmodifiable) class * @return copy of class for use as data */ public static Type74Twin37mmAAGun createInstance() { return new Type74Twin37mmAAGun(); } }
213970_11
package chapter4.section4; import chapter3.section4.SeparateChainingHashTable; import chapter3.section5.HashSet; import edu.princeton.cs.algs4.StdOut; import java.util.*; /** * Created by Rene Argento on 30/12/17. */ // Runtime: O((E + V) * (C + 1), where C is the number of cycles in the graph. // The number of cycles in a graph can be exponential. // Space complexity: O(E + V + S) where S is the sum of the number of vertices in all cycles. // Based on Johnson's original paper http://www.cs.tufts.edu/comp/150GA/homeworks/hw1/Johnson%2075.PDF and // Tushar Roy's excellent video https://www.youtube.com/watch?v=johyrWospv0 and // https://github.com/mission-peace/interview/blob/master/src/com/interview/graph/AllCyclesInDirectedGraphJohnson.java public class JohnsonAllCycles { private HashSet<Integer> blockedVerticesSet; private SeparateChainingHashTable<Integer, HashSet<Integer>> blockedVerticesMap; private Deque<Integer> stack; private List<List<Integer>> allCyclesByVertices; private Deque<DirectedEdge> stackOfEdges; private List<List<DirectedEdge>> allCyclesByEdges; private int verticesCount; public void findAllCycles(EdgeWeightedDigraphInterface edgeWeightedDigraph) { blockedVerticesSet = new HashSet<>(); blockedVerticesMap = new SeparateChainingHashTable<>(); stack = new ArrayDeque<>(); allCyclesByVertices = new ArrayList<>(); stackOfEdges = new ArrayDeque<>(); allCyclesByEdges = new ArrayList<>(); verticesCount = edgeWeightedDigraph.vertices(); KosarajuSharirSCCWeighted kosarajuSharirSCCWeighted = new KosarajuSharirSCCWeighted(edgeWeightedDigraph); List<Integer>[] stronglyConnectedComponents = kosarajuSharirSCCWeighted.getSCCs(); for (List<Integer> stronglyConnectedComponent : stronglyConnectedComponents) { if (stronglyConnectedComponent.size() == 1) { continue; } EdgeWeightedDigraphInterface sccSubGraph = createSubGraphFromSCC(edgeWeightedDigraph, stronglyConnectedComponent); for (int vertexToProcess : stronglyConnectedComponent) { if (sccSubGraph.outdegree(vertexToProcess) == 0) { continue; } // Clear blockedVerticesSet and blockedVerticesMap blockedVerticesSet = new HashSet<>(); blockedVerticesMap = new SeparateChainingHashTable<>(); findCycles(sccSubGraph, vertexToProcess, vertexToProcess, null); sccSubGraph = createSubGraphByRemovingVertex(sccSubGraph, vertexToProcess); } } } private boolean findCycles(EdgeWeightedDigraphInterface edgeWeightedDigraph, int startVertex, int currentVertex, DirectedEdge currentEdge) { boolean foundCycle = false; stack.push(currentVertex); blockedVerticesSet.add(currentVertex); if (currentEdge != null) { stackOfEdges.push(currentEdge); } for (DirectedEdge edge : edgeWeightedDigraph.adjacent(currentVertex)) { int neighbor = edge.to(); // If neighbor is the same as the start vertex, a cycle was found. if (neighbor == startVertex) { // Add cycle with vertices to the cycles list List<Integer> cycle = new ArrayList<>(); stack.push(startVertex); cycle.addAll(stack); Collections.reverse(cycle); stack.pop(); allCyclesByVertices.add(cycle); // Add cycle with edges to the cycles list List<DirectedEdge> cycleByEdges = new ArrayList<>(); stackOfEdges.push(edge); cycleByEdges.addAll(stackOfEdges); Collections.reverse(cycleByEdges); stackOfEdges.pop(); allCyclesByEdges.add(cycleByEdges); foundCycle = true; } else if (!blockedVerticesSet.contains(neighbor)) { boolean foundCycleThroughNeighbor = findCycles(edgeWeightedDigraph, startVertex, neighbor, edge); foundCycle = foundCycle || foundCycleThroughNeighbor; } } // If a cycle was found with the current vertex, then recursively unblock it and all vertices which are // dependent on it if (foundCycle) { unblock(currentVertex); } else { // If no cycle was found, add the current vertex to its neighbors blockedVerticesMap. // If any of those neighbors ever get unblocked, then unblock the current vertex as well. for (DirectedEdge edge : edgeWeightedDigraph.adjacent(currentVertex)) { int neighbor = edge.to(); HashSet<Integer> dependentVerticesFromNeighbor = blockedVerticesMap.get(neighbor); if (dependentVerticesFromNeighbor == null) { dependentVerticesFromNeighbor = new HashSet<>(); dependentVerticesFromNeighbor.add(currentVertex); blockedVerticesMap.put(neighbor, dependentVerticesFromNeighbor); } else { dependentVerticesFromNeighbor.add(currentVertex); } } } stack.pop(); if (!stackOfEdges.isEmpty()) { stackOfEdges.pop(); } return foundCycle; } private void unblock(int vertex) { blockedVerticesSet.delete(vertex); HashSet<Integer> dependentVertices = blockedVerticesMap.get(vertex); if (dependentVertices != null) { for (int dependentVertex : dependentVertices.keys()) { if (blockedVerticesSet.contains(dependentVertex)) { unblock(dependentVertex); } } blockedVerticesMap.delete(vertex); } } private EdgeWeightedDigraphInterface createSubGraphFromSCC(EdgeWeightedDigraphInterface edgeWeightedDigraph, List<Integer> stronglyConnectedComponent) { HashSet<Integer> verticesInSCC = new HashSet<>(); for (int vertex : stronglyConnectedComponent) { verticesInSCC.add(vertex); } EdgeWeightedDigraphInterface subGraph = new EdgeWeightedDigraph(edgeWeightedDigraph.vertices()); for (int vertex = 0; vertex < edgeWeightedDigraph.vertices(); vertex++) { for (DirectedEdge edge : edgeWeightedDigraph.adjacent(vertex)) { int neighbor = edge.to(); if (!verticesInSCC.contains(vertex) || !verticesInSCC.contains(neighbor)) { continue; } subGraph.addEdge(new DirectedEdge(vertex, edge.to(), edge.weight())); } } return subGraph; } // Creates a subgraph with vertexToRemove removed private EdgeWeightedDigraphInterface createSubGraphByRemovingVertex(EdgeWeightedDigraphInterface edgeWeightedDigraph, int vertexToRemove) { EdgeWeightedDigraphInterface subGraph = new EdgeWeightedDigraph(edgeWeightedDigraph.vertices()); for (int vertex = 0; vertex < edgeWeightedDigraph.vertices(); vertex++) { for (DirectedEdge edge : edgeWeightedDigraph.adjacent(vertex)) { int neighbor = edge.to(); if (vertex == vertexToRemove || neighbor == vertexToRemove) { continue; } subGraph.addEdge(new DirectedEdge(vertex, edge.to(), edge.weight())); } } return subGraph; } public List<List<Integer>> getAllCyclesByVertices() { return allCyclesByVertices; } @SuppressWarnings("unchecked") public List<List<Integer>> getAllCyclesByVerticesInOrder() { List<List<Integer>>[] cyclesByInitialVertex = (List<List<Integer>>[]) new ArrayList[verticesCount]; for (int cycles = 0; cycles < cyclesByInitialVertex.length; cycles++) { cyclesByInitialVertex[cycles] = new ArrayList<>(); } for (List<Integer> cycle : allCyclesByVertices) { int initialVertex = cycle.get(0); cyclesByInitialVertex[initialVertex].add(cycle); } List<List<Integer>> allCyclesInOrder = new ArrayList<>(); for (List<List<Integer>> cycles : cyclesByInitialVertex) { allCyclesInOrder.addAll(cycles); } return allCyclesInOrder; } public List<List<DirectedEdge>> getAllCyclesByEdges() { return allCyclesByEdges; } public static void main(String[] args) { JohnsonAllCycles johnsonAllCycles = new JohnsonAllCycles(); EdgeWeightedDigraphInterface edgeWeightedDigraph = new EdgeWeightedDigraph(9); edgeWeightedDigraph.addEdge(new DirectedEdge(0, 1, 2)); edgeWeightedDigraph.addEdge(new DirectedEdge(0, 7, -1)); edgeWeightedDigraph.addEdge(new DirectedEdge(0, 4, 1)); edgeWeightedDigraph.addEdge(new DirectedEdge(1, 8, 4)); edgeWeightedDigraph.addEdge(new DirectedEdge(1, 6, 2)); edgeWeightedDigraph.addEdge(new DirectedEdge(1, 2, 1)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 0, -3)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 1, 6)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 5, 2)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 3, 1)); edgeWeightedDigraph.addEdge(new DirectedEdge(5, 3, -2)); edgeWeightedDigraph.addEdge(new DirectedEdge(3, 4, 3)); edgeWeightedDigraph.addEdge(new DirectedEdge(4, 1, -2)); edgeWeightedDigraph.addEdge(new DirectedEdge(7, 8, 4)); edgeWeightedDigraph.addEdge(new DirectedEdge(8, 7, 4)); johnsonAllCycles.findAllCycles(edgeWeightedDigraph); List<List<Integer>> allCycles = johnsonAllCycles.getAllCyclesByVerticesInOrder(); StdOut.println("All cycles"); allCycles.forEach(cycle -> { StringJoiner joiner = new StringJoiner("->"); cycle.forEach(vertex -> joiner.add(String.valueOf(vertex))); StdOut.println(joiner); }); StdOut.println("\nExpected:"); StdOut.println("0->1->2->0\n" + "0->4->1->2->0\n" + "1->2->3->4->1\n" + "1->2->5->3->4->1\n" + "1->2->1\n" + "7->8->7"); List<List<DirectedEdge>> allCyclesByEdges = johnsonAllCycles.getAllCyclesByEdges(); StdOut.println("\nAll cycles (and edge weights)"); allCyclesByEdges.forEach(cycle -> { StringJoiner joiner = new StringJoiner(" "); cycle.forEach(edge -> joiner.add(String.valueOf(edge))); StdOut.println(joiner); }); StdOut.println("\nExpected:"); StdOut.println("7->8 4.00 8->7 4.00\n" + "0->1 2.00 1->2 1.00 2->0 -3.00\n" + "0->4 1.00 4->1 -2.00 1->2 1.00 2->0 -3.00\n" + "1->2 1.00 2->3 1.00 3->4 3.00 4->1 -2.00\n" + "1->2 1.00 2->5 2.00 5->3 -2.00 3->4 3.00 4->1 -2.00\n" + "1->2 1.00 2->1 6.00"); } }
reneargento/algorithms-sedgewick-wayne
src/chapter4/section4/JohnsonAllCycles.java
2,896
// dependent on it
line_comment
nl
package chapter4.section4; import chapter3.section4.SeparateChainingHashTable; import chapter3.section5.HashSet; import edu.princeton.cs.algs4.StdOut; import java.util.*; /** * Created by Rene Argento on 30/12/17. */ // Runtime: O((E + V) * (C + 1), where C is the number of cycles in the graph. // The number of cycles in a graph can be exponential. // Space complexity: O(E + V + S) where S is the sum of the number of vertices in all cycles. // Based on Johnson's original paper http://www.cs.tufts.edu/comp/150GA/homeworks/hw1/Johnson%2075.PDF and // Tushar Roy's excellent video https://www.youtube.com/watch?v=johyrWospv0 and // https://github.com/mission-peace/interview/blob/master/src/com/interview/graph/AllCyclesInDirectedGraphJohnson.java public class JohnsonAllCycles { private HashSet<Integer> blockedVerticesSet; private SeparateChainingHashTable<Integer, HashSet<Integer>> blockedVerticesMap; private Deque<Integer> stack; private List<List<Integer>> allCyclesByVertices; private Deque<DirectedEdge> stackOfEdges; private List<List<DirectedEdge>> allCyclesByEdges; private int verticesCount; public void findAllCycles(EdgeWeightedDigraphInterface edgeWeightedDigraph) { blockedVerticesSet = new HashSet<>(); blockedVerticesMap = new SeparateChainingHashTable<>(); stack = new ArrayDeque<>(); allCyclesByVertices = new ArrayList<>(); stackOfEdges = new ArrayDeque<>(); allCyclesByEdges = new ArrayList<>(); verticesCount = edgeWeightedDigraph.vertices(); KosarajuSharirSCCWeighted kosarajuSharirSCCWeighted = new KosarajuSharirSCCWeighted(edgeWeightedDigraph); List<Integer>[] stronglyConnectedComponents = kosarajuSharirSCCWeighted.getSCCs(); for (List<Integer> stronglyConnectedComponent : stronglyConnectedComponents) { if (stronglyConnectedComponent.size() == 1) { continue; } EdgeWeightedDigraphInterface sccSubGraph = createSubGraphFromSCC(edgeWeightedDigraph, stronglyConnectedComponent); for (int vertexToProcess : stronglyConnectedComponent) { if (sccSubGraph.outdegree(vertexToProcess) == 0) { continue; } // Clear blockedVerticesSet and blockedVerticesMap blockedVerticesSet = new HashSet<>(); blockedVerticesMap = new SeparateChainingHashTable<>(); findCycles(sccSubGraph, vertexToProcess, vertexToProcess, null); sccSubGraph = createSubGraphByRemovingVertex(sccSubGraph, vertexToProcess); } } } private boolean findCycles(EdgeWeightedDigraphInterface edgeWeightedDigraph, int startVertex, int currentVertex, DirectedEdge currentEdge) { boolean foundCycle = false; stack.push(currentVertex); blockedVerticesSet.add(currentVertex); if (currentEdge != null) { stackOfEdges.push(currentEdge); } for (DirectedEdge edge : edgeWeightedDigraph.adjacent(currentVertex)) { int neighbor = edge.to(); // If neighbor is the same as the start vertex, a cycle was found. if (neighbor == startVertex) { // Add cycle with vertices to the cycles list List<Integer> cycle = new ArrayList<>(); stack.push(startVertex); cycle.addAll(stack); Collections.reverse(cycle); stack.pop(); allCyclesByVertices.add(cycle); // Add cycle with edges to the cycles list List<DirectedEdge> cycleByEdges = new ArrayList<>(); stackOfEdges.push(edge); cycleByEdges.addAll(stackOfEdges); Collections.reverse(cycleByEdges); stackOfEdges.pop(); allCyclesByEdges.add(cycleByEdges); foundCycle = true; } else if (!blockedVerticesSet.contains(neighbor)) { boolean foundCycleThroughNeighbor = findCycles(edgeWeightedDigraph, startVertex, neighbor, edge); foundCycle = foundCycle || foundCycleThroughNeighbor; } } // If a cycle was found with the current vertex, then recursively unblock it and all vertices which are // dependent on<SUF> if (foundCycle) { unblock(currentVertex); } else { // If no cycle was found, add the current vertex to its neighbors blockedVerticesMap. // If any of those neighbors ever get unblocked, then unblock the current vertex as well. for (DirectedEdge edge : edgeWeightedDigraph.adjacent(currentVertex)) { int neighbor = edge.to(); HashSet<Integer> dependentVerticesFromNeighbor = blockedVerticesMap.get(neighbor); if (dependentVerticesFromNeighbor == null) { dependentVerticesFromNeighbor = new HashSet<>(); dependentVerticesFromNeighbor.add(currentVertex); blockedVerticesMap.put(neighbor, dependentVerticesFromNeighbor); } else { dependentVerticesFromNeighbor.add(currentVertex); } } } stack.pop(); if (!stackOfEdges.isEmpty()) { stackOfEdges.pop(); } return foundCycle; } private void unblock(int vertex) { blockedVerticesSet.delete(vertex); HashSet<Integer> dependentVertices = blockedVerticesMap.get(vertex); if (dependentVertices != null) { for (int dependentVertex : dependentVertices.keys()) { if (blockedVerticesSet.contains(dependentVertex)) { unblock(dependentVertex); } } blockedVerticesMap.delete(vertex); } } private EdgeWeightedDigraphInterface createSubGraphFromSCC(EdgeWeightedDigraphInterface edgeWeightedDigraph, List<Integer> stronglyConnectedComponent) { HashSet<Integer> verticesInSCC = new HashSet<>(); for (int vertex : stronglyConnectedComponent) { verticesInSCC.add(vertex); } EdgeWeightedDigraphInterface subGraph = new EdgeWeightedDigraph(edgeWeightedDigraph.vertices()); for (int vertex = 0; vertex < edgeWeightedDigraph.vertices(); vertex++) { for (DirectedEdge edge : edgeWeightedDigraph.adjacent(vertex)) { int neighbor = edge.to(); if (!verticesInSCC.contains(vertex) || !verticesInSCC.contains(neighbor)) { continue; } subGraph.addEdge(new DirectedEdge(vertex, edge.to(), edge.weight())); } } return subGraph; } // Creates a subgraph with vertexToRemove removed private EdgeWeightedDigraphInterface createSubGraphByRemovingVertex(EdgeWeightedDigraphInterface edgeWeightedDigraph, int vertexToRemove) { EdgeWeightedDigraphInterface subGraph = new EdgeWeightedDigraph(edgeWeightedDigraph.vertices()); for (int vertex = 0; vertex < edgeWeightedDigraph.vertices(); vertex++) { for (DirectedEdge edge : edgeWeightedDigraph.adjacent(vertex)) { int neighbor = edge.to(); if (vertex == vertexToRemove || neighbor == vertexToRemove) { continue; } subGraph.addEdge(new DirectedEdge(vertex, edge.to(), edge.weight())); } } return subGraph; } public List<List<Integer>> getAllCyclesByVertices() { return allCyclesByVertices; } @SuppressWarnings("unchecked") public List<List<Integer>> getAllCyclesByVerticesInOrder() { List<List<Integer>>[] cyclesByInitialVertex = (List<List<Integer>>[]) new ArrayList[verticesCount]; for (int cycles = 0; cycles < cyclesByInitialVertex.length; cycles++) { cyclesByInitialVertex[cycles] = new ArrayList<>(); } for (List<Integer> cycle : allCyclesByVertices) { int initialVertex = cycle.get(0); cyclesByInitialVertex[initialVertex].add(cycle); } List<List<Integer>> allCyclesInOrder = new ArrayList<>(); for (List<List<Integer>> cycles : cyclesByInitialVertex) { allCyclesInOrder.addAll(cycles); } return allCyclesInOrder; } public List<List<DirectedEdge>> getAllCyclesByEdges() { return allCyclesByEdges; } public static void main(String[] args) { JohnsonAllCycles johnsonAllCycles = new JohnsonAllCycles(); EdgeWeightedDigraphInterface edgeWeightedDigraph = new EdgeWeightedDigraph(9); edgeWeightedDigraph.addEdge(new DirectedEdge(0, 1, 2)); edgeWeightedDigraph.addEdge(new DirectedEdge(0, 7, -1)); edgeWeightedDigraph.addEdge(new DirectedEdge(0, 4, 1)); edgeWeightedDigraph.addEdge(new DirectedEdge(1, 8, 4)); edgeWeightedDigraph.addEdge(new DirectedEdge(1, 6, 2)); edgeWeightedDigraph.addEdge(new DirectedEdge(1, 2, 1)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 0, -3)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 1, 6)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 5, 2)); edgeWeightedDigraph.addEdge(new DirectedEdge(2, 3, 1)); edgeWeightedDigraph.addEdge(new DirectedEdge(5, 3, -2)); edgeWeightedDigraph.addEdge(new DirectedEdge(3, 4, 3)); edgeWeightedDigraph.addEdge(new DirectedEdge(4, 1, -2)); edgeWeightedDigraph.addEdge(new DirectedEdge(7, 8, 4)); edgeWeightedDigraph.addEdge(new DirectedEdge(8, 7, 4)); johnsonAllCycles.findAllCycles(edgeWeightedDigraph); List<List<Integer>> allCycles = johnsonAllCycles.getAllCyclesByVerticesInOrder(); StdOut.println("All cycles"); allCycles.forEach(cycle -> { StringJoiner joiner = new StringJoiner("->"); cycle.forEach(vertex -> joiner.add(String.valueOf(vertex))); StdOut.println(joiner); }); StdOut.println("\nExpected:"); StdOut.println("0->1->2->0\n" + "0->4->1->2->0\n" + "1->2->3->4->1\n" + "1->2->5->3->4->1\n" + "1->2->1\n" + "7->8->7"); List<List<DirectedEdge>> allCyclesByEdges = johnsonAllCycles.getAllCyclesByEdges(); StdOut.println("\nAll cycles (and edge weights)"); allCyclesByEdges.forEach(cycle -> { StringJoiner joiner = new StringJoiner(" "); cycle.forEach(edge -> joiner.add(String.valueOf(edge))); StdOut.println(joiner); }); StdOut.println("\nExpected:"); StdOut.println("7->8 4.00 8->7 4.00\n" + "0->1 2.00 1->2 1.00 2->0 -3.00\n" + "0->4 1.00 4->1 -2.00 1->2 1.00 2->0 -3.00\n" + "1->2 1.00 2->3 1.00 3->4 3.00 4->1 -2.00\n" + "1->2 1.00 2->5 2.00 5->3 -2.00 3->4 3.00 4->1 -2.00\n" + "1->2 1.00 2->1 6.00"); } }
213998_32
// Copyright 2002-2007, FreeHEP. package org.freehep.xml.util; import java.awt.Color; import java.io.IOException; import java.io.Writer; import java.util.Enumeration; import java.util.Hashtable; import java.util.Stack; import org.freehep.util.io.IndentPrintWriter; /** * A class that makes it easy to write XML documents. * * @author Tony Johnson * @author Mark Donszelmann * @version $Id: XMLWriter.java,v 1.3 2008-05-04 12:20:34 murkle Exp $ */ public class XMLWriter implements XMLTagWriter { public XMLWriter(Writer w, String indentString, String defaultNameSpace) { writer = new IndentPrintWriter(w); writer.setIndentString(indentString); this.defaultNameSpace = defaultNameSpace; } public XMLWriter(Writer w, String indentString) { this(w, indentString, ""); } public XMLWriter(Writer w) { this(w, " "); // By popular demand of Babar } /** * closes the writer */ @Override public void close() throws IOException { closeDoc(); writer.close(); } /** * Opens the document with an xml header */ @Override public void openDoc() { openDoc("1.0", "", false); } /** * Opens the document with an xml header */ @Override public void openDoc(String version, String encoding, boolean standalone) { String indentString = writer.getIndentString(); writer.setIndentString(indentString); closed = false; if (!XMLCharacterProperties.validVersionNum(version)) { throw new RuntimeException("Invalid version number: " + version); } writer.print("<?xml version=\""); writer.print(version); writer.print("\" "); if ((encoding != null) && (!encoding.equals(""))) { if (!XMLCharacterProperties.validEncName(encoding)) { throw new RuntimeException( "Invalid encoding name: " + encoding); } writer.print("encoding=\""); writer.print(encoding); writer.print("\" "); } if (standalone) { writer.print("standalone=\"yes\" "); } writer.println("?>"); writer.setIndentString(indentString); } /** * Writes a reference to a DTD */ @Override public void referToDTD(String name, String pid, String ref) { if (dtdName != null) { throw new RuntimeException("ReferToDTD cannot be called twice"); } dtdName = name; writer.println("<!DOCTYPE " + name + " PUBLIC \"" + pid + "\" \"" + ref + "\">"); } /** * Writes a reference to a DTD */ @Override public void referToDTD(String name, String system) { if (dtdName != null) { throw new RuntimeException("ReferToDTD cannot be called twice"); } dtdName = name; writer.println("<!DOCTYPE " + name + " SYSTEM \"" + system + "\">"); } /** * Closes the document, and checks if you closed all the tags */ @Override public void closeDoc() { if (!closed) { if (!openTags.isEmpty()) { StringBuffer sb = new StringBuffer( "Not all tags were closed before closing XML document:\n"); while (!openTags.isEmpty()) { sb.append(" </"); sb.append((String) openTags.pop()); sb.append(">\n"); } throw new RuntimeException(sb.toString()); } closed = true; } writer.flush(); } /** * Print a comment */ @Override public void printComment(String comment) { if (comment.indexOf("--") >= 0) { throw new RuntimeException("'--' sequence not allowed in comment"); } writer.print("<!--"); writer.print(normalizeText(comment)); writer.println("-->"); } /** * Prints character data, while escaping &lt; and &gt; */ @Override public void print(String text) { writer.print(normalizeText(text)); } /** * Prints character data, while escaping &lt; and &gt; */ public void println(String text) { print(text); writer.println(); } /** * Prints a new XML tag and increases the identation level */ @Override public void openTag(String namespace, String name) { if (namespace.equals(defaultNameSpace)) { openTag(name); } else { openTag(namespace + ":" + name); } } /** * Prints a new XML tag and increases the identation level */ @Override public void openTag(String name) { checkNameValid(name); if (openTags.isEmpty() && dtdName != null && !dtdName.equals(name)) { throw new RuntimeException("First tag: '" + name + "' not equal to DTD id: '" + dtdName + "'"); } writer.print("<" + name); printAttributes(name.length()); writer.println(">"); writer.indent(); openTags.push(name); } /** * Closes the current XML tag and decreases the indentation level */ @Override public void closeTag() { if (openTags.isEmpty()) { writer.close(); throw new RuntimeException("No open tags"); } Object name = openTags.pop(); writer.outdent(); writer.print("</"); writer.print(name); writer.println(">"); } /** * Prints an empty XML tag. */ @Override public void printTag(String namespace, String name) { if (namespace.equals(defaultNameSpace)) { printTag(name); } else { printTag(namespace + ":" + name); } } /** * Prints an empty XML tag. */ @Override public void printTag(String name) { checkNameValid(name); writer.print("<" + name); printAttributes(name.length()); writer.println("/>"); } /** * Sets an attribute which will be included in the next tag printed by * openTag or printTag */ @Override public void setAttribute(String name, String value) { if ((name != null) && (value != null)) { attributes.put(name, value); } } @Override public void setAttribute(String namespace, String name, String value) { if ((namespace != null) && (name != null)) { attributes.put(namespace + ":" + name, value); } } @Override public void setAttribute(String name, byte value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, char value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, long value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, int value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, short value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, boolean value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, float value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, double value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, Color value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, byte value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, char value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, long value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, int value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, short value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, boolean value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, float value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, double value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, Color value) { setAttribute(ns + ":" + name, String.valueOf(value)); } protected void printAttributes(int tagLength) { int width = tagLength + 1; boolean extraIndent = false; Enumeration e = attributes.keys(); while (e.hasMoreElements()) { String key = e.nextElement().toString(); checkNameValid(key); String value = normalize(attributes.get(key).toString()); int length = key.length() + value.length() + 3; if (width > 0 && width + length + 2 * writer.getIndent() > 60) { width = 0; writer.println(); if (!extraIndent) { writer.indent(); extraIndent = true; } } else { width += length; writer.print(' '); } writer.print(key); writer.print("=\""); writer.print(value); writer.print("\""); } attributes.clear(); if (extraIndent) { writer.outdent(); } } // /** // * Prints a DOM node, recursively. // * No support for a document node // */ // public void print(Node node) // { // if ( node == null ) return; // // int type = node.getNodeType(); // switch ( type ) { // // print document // case Node.DOCUMENT_NODE: // throw new RuntimeException("No support for printing nodes of type // Document"); // // // print element with attributes // case Node.ELEMENT_NODE: // NamedNodeMap attributes = node.getAttributes(); // for ( int i = 0; i < attributes.getLength(); i++ ) { // Node attr = attributes.item(i); // setAttribute(attr.getNodeName(), attr.getNodeValue()); // } // NodeList children = node.getChildNodes(); // if ( children == null ) { // printTag(node.getNodeName()); // } else { // openTag(node.getNodeName()); // int len = children.getLength(); // for ( int i = 0; i < len; i++ ) { // print(children.item(i)); // } // closeTag(); // } // break; // // // handle entity reference nodes // case Node.ENTITY_REFERENCE_NODE: // writer.print('&'); // writer.print(node.getNodeName()); // writer.print(';'); // break; // // // print cdata sections // case Node.CDATA_SECTION_NODE: // writer.print("<![CDATA["); // writer.print(node.getNodeValue()); // writer.print("]]>"); // break; // // // print text // case Node.TEXT_NODE: // print(node.getNodeValue()); // break; // // // print processing instruction // case Node.PROCESSING_INSTRUCTION_NODE: // writer.print("<?"); // writer.print(node.getNodeName()); // String data = node.getNodeValue(); // if ( data != null && data.length() > 0 ) { // writer.print(' '); // writer.print(data); // } // writer.print("?>"); // break; // } // } // print(Node) /** Normalizes the given string for an Attribute value */ public static String normalize(String s) { StringBuffer str = new StringBuffer(); int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '<': { str.append("&lt;"); break; } case '>': { str.append("&gt;"); break; } case '&': { str.append("&amp;"); break; } case '"': { str.append("&quot;"); break; } case '\r': case '\n': { str.append("&#"); str.append(Integer.toString(ch)); str.append(';'); break; } default: { if (ch > 0x00FF) { String hex = "0000" + Integer.toHexString(ch); str.append("&#x"); str.append(hex.substring(hex.length() - 4)); str.append(';'); } else { str.append(ch); } } } } return str.toString(); } // normalize(String):String /** Normalizes the given string for Text */ public static String normalizeText(String s) { StringBuffer str = new StringBuffer(); int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '<': { str.append("&lt;"); break; } case '>': { str.append("&gt;"); break; } case '&': { str.append("&amp;"); break; } default: { if (ch > 0x007f) { String hex = "0000" + Integer.toHexString(ch); str.append("&#x"); str.append(hex.substring(hex.length() - 4)); str.append(';'); } else { str.append(ch); } } } } return str.toString(); } protected void checkNameValid(String s) { if (!XMLCharacterProperties.validName(s)) { throw new RuntimeException("Invalid name: " + s); } } protected boolean closed = true; private String dtdName = null; private Hashtable attributes = new Hashtable(); private Stack openTags = new Stack(); protected IndentPrintWriter writer; protected String defaultNameSpace; }
mstfelg/geosquared
desktop/src/main/java/org/freehep/xml/util/XMLWriter.java
3,922
// int len = children.getLength();
line_comment
nl
// Copyright 2002-2007, FreeHEP. package org.freehep.xml.util; import java.awt.Color; import java.io.IOException; import java.io.Writer; import java.util.Enumeration; import java.util.Hashtable; import java.util.Stack; import org.freehep.util.io.IndentPrintWriter; /** * A class that makes it easy to write XML documents. * * @author Tony Johnson * @author Mark Donszelmann * @version $Id: XMLWriter.java,v 1.3 2008-05-04 12:20:34 murkle Exp $ */ public class XMLWriter implements XMLTagWriter { public XMLWriter(Writer w, String indentString, String defaultNameSpace) { writer = new IndentPrintWriter(w); writer.setIndentString(indentString); this.defaultNameSpace = defaultNameSpace; } public XMLWriter(Writer w, String indentString) { this(w, indentString, ""); } public XMLWriter(Writer w) { this(w, " "); // By popular demand of Babar } /** * closes the writer */ @Override public void close() throws IOException { closeDoc(); writer.close(); } /** * Opens the document with an xml header */ @Override public void openDoc() { openDoc("1.0", "", false); } /** * Opens the document with an xml header */ @Override public void openDoc(String version, String encoding, boolean standalone) { String indentString = writer.getIndentString(); writer.setIndentString(indentString); closed = false; if (!XMLCharacterProperties.validVersionNum(version)) { throw new RuntimeException("Invalid version number: " + version); } writer.print("<?xml version=\""); writer.print(version); writer.print("\" "); if ((encoding != null) && (!encoding.equals(""))) { if (!XMLCharacterProperties.validEncName(encoding)) { throw new RuntimeException( "Invalid encoding name: " + encoding); } writer.print("encoding=\""); writer.print(encoding); writer.print("\" "); } if (standalone) { writer.print("standalone=\"yes\" "); } writer.println("?>"); writer.setIndentString(indentString); } /** * Writes a reference to a DTD */ @Override public void referToDTD(String name, String pid, String ref) { if (dtdName != null) { throw new RuntimeException("ReferToDTD cannot be called twice"); } dtdName = name; writer.println("<!DOCTYPE " + name + " PUBLIC \"" + pid + "\" \"" + ref + "\">"); } /** * Writes a reference to a DTD */ @Override public void referToDTD(String name, String system) { if (dtdName != null) { throw new RuntimeException("ReferToDTD cannot be called twice"); } dtdName = name; writer.println("<!DOCTYPE " + name + " SYSTEM \"" + system + "\">"); } /** * Closes the document, and checks if you closed all the tags */ @Override public void closeDoc() { if (!closed) { if (!openTags.isEmpty()) { StringBuffer sb = new StringBuffer( "Not all tags were closed before closing XML document:\n"); while (!openTags.isEmpty()) { sb.append(" </"); sb.append((String) openTags.pop()); sb.append(">\n"); } throw new RuntimeException(sb.toString()); } closed = true; } writer.flush(); } /** * Print a comment */ @Override public void printComment(String comment) { if (comment.indexOf("--") >= 0) { throw new RuntimeException("'--' sequence not allowed in comment"); } writer.print("<!--"); writer.print(normalizeText(comment)); writer.println("-->"); } /** * Prints character data, while escaping &lt; and &gt; */ @Override public void print(String text) { writer.print(normalizeText(text)); } /** * Prints character data, while escaping &lt; and &gt; */ public void println(String text) { print(text); writer.println(); } /** * Prints a new XML tag and increases the identation level */ @Override public void openTag(String namespace, String name) { if (namespace.equals(defaultNameSpace)) { openTag(name); } else { openTag(namespace + ":" + name); } } /** * Prints a new XML tag and increases the identation level */ @Override public void openTag(String name) { checkNameValid(name); if (openTags.isEmpty() && dtdName != null && !dtdName.equals(name)) { throw new RuntimeException("First tag: '" + name + "' not equal to DTD id: '" + dtdName + "'"); } writer.print("<" + name); printAttributes(name.length()); writer.println(">"); writer.indent(); openTags.push(name); } /** * Closes the current XML tag and decreases the indentation level */ @Override public void closeTag() { if (openTags.isEmpty()) { writer.close(); throw new RuntimeException("No open tags"); } Object name = openTags.pop(); writer.outdent(); writer.print("</"); writer.print(name); writer.println(">"); } /** * Prints an empty XML tag. */ @Override public void printTag(String namespace, String name) { if (namespace.equals(defaultNameSpace)) { printTag(name); } else { printTag(namespace + ":" + name); } } /** * Prints an empty XML tag. */ @Override public void printTag(String name) { checkNameValid(name); writer.print("<" + name); printAttributes(name.length()); writer.println("/>"); } /** * Sets an attribute which will be included in the next tag printed by * openTag or printTag */ @Override public void setAttribute(String name, String value) { if ((name != null) && (value != null)) { attributes.put(name, value); } } @Override public void setAttribute(String namespace, String name, String value) { if ((namespace != null) && (name != null)) { attributes.put(namespace + ":" + name, value); } } @Override public void setAttribute(String name, byte value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, char value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, long value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, int value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, short value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, boolean value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, float value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, double value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String name, Color value) { setAttribute(name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, byte value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, char value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, long value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, int value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, short value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, boolean value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, float value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, double value) { setAttribute(ns + ":" + name, String.valueOf(value)); } @Override public void setAttribute(String ns, String name, Color value) { setAttribute(ns + ":" + name, String.valueOf(value)); } protected void printAttributes(int tagLength) { int width = tagLength + 1; boolean extraIndent = false; Enumeration e = attributes.keys(); while (e.hasMoreElements()) { String key = e.nextElement().toString(); checkNameValid(key); String value = normalize(attributes.get(key).toString()); int length = key.length() + value.length() + 3; if (width > 0 && width + length + 2 * writer.getIndent() > 60) { width = 0; writer.println(); if (!extraIndent) { writer.indent(); extraIndent = true; } } else { width += length; writer.print(' '); } writer.print(key); writer.print("=\""); writer.print(value); writer.print("\""); } attributes.clear(); if (extraIndent) { writer.outdent(); } } // /** // * Prints a DOM node, recursively. // * No support for a document node // */ // public void print(Node node) // { // if ( node == null ) return; // // int type = node.getNodeType(); // switch ( type ) { // // print document // case Node.DOCUMENT_NODE: // throw new RuntimeException("No support for printing nodes of type // Document"); // // // print element with attributes // case Node.ELEMENT_NODE: // NamedNodeMap attributes = node.getAttributes(); // for ( int i = 0; i < attributes.getLength(); i++ ) { // Node attr = attributes.item(i); // setAttribute(attr.getNodeName(), attr.getNodeValue()); // } // NodeList children = node.getChildNodes(); // if ( children == null ) { // printTag(node.getNodeName()); // } else { // openTag(node.getNodeName()); // int len<SUF> // for ( int i = 0; i < len; i++ ) { // print(children.item(i)); // } // closeTag(); // } // break; // // // handle entity reference nodes // case Node.ENTITY_REFERENCE_NODE: // writer.print('&'); // writer.print(node.getNodeName()); // writer.print(';'); // break; // // // print cdata sections // case Node.CDATA_SECTION_NODE: // writer.print("<![CDATA["); // writer.print(node.getNodeValue()); // writer.print("]]>"); // break; // // // print text // case Node.TEXT_NODE: // print(node.getNodeValue()); // break; // // // print processing instruction // case Node.PROCESSING_INSTRUCTION_NODE: // writer.print("<?"); // writer.print(node.getNodeName()); // String data = node.getNodeValue(); // if ( data != null && data.length() > 0 ) { // writer.print(' '); // writer.print(data); // } // writer.print("?>"); // break; // } // } // print(Node) /** Normalizes the given string for an Attribute value */ public static String normalize(String s) { StringBuffer str = new StringBuffer(); int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '<': { str.append("&lt;"); break; } case '>': { str.append("&gt;"); break; } case '&': { str.append("&amp;"); break; } case '"': { str.append("&quot;"); break; } case '\r': case '\n': { str.append("&#"); str.append(Integer.toString(ch)); str.append(';'); break; } default: { if (ch > 0x00FF) { String hex = "0000" + Integer.toHexString(ch); str.append("&#x"); str.append(hex.substring(hex.length() - 4)); str.append(';'); } else { str.append(ch); } } } } return str.toString(); } // normalize(String):String /** Normalizes the given string for Text */ public static String normalizeText(String s) { StringBuffer str = new StringBuffer(); int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '<': { str.append("&lt;"); break; } case '>': { str.append("&gt;"); break; } case '&': { str.append("&amp;"); break; } default: { if (ch > 0x007f) { String hex = "0000" + Integer.toHexString(ch); str.append("&#x"); str.append(hex.substring(hex.length() - 4)); str.append(';'); } else { str.append(ch); } } } } return str.toString(); } protected void checkNameValid(String s) { if (!XMLCharacterProperties.validName(s)) { throw new RuntimeException("Invalid name: " + s); } } protected boolean closed = true; private String dtdName = null; private Hashtable attributes = new Hashtable(); private Stack openTags = new Stack(); protected IndentPrintWriter writer; protected String defaultNameSpace; }
214011_0
// ======================================================================== // $Id: DateCache.java,v 1.15 2004/05/09 20:32:49 gregwilkins Exp $ // Copyright 1996-2004 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ======================================================================== package net.lightbody.bmp.proxy.jetty.util; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; /* ------------------------------------------------------------ */ /** Date Format Cache. * Computes String representations of Dates and caches * the results so that subsequent requests within the same minute * will be fast. * * Only format strings that contain either "ss" or "ss.SSS" are * handled. * * The timezone of the date may be included as an ID with the "zzz" * format string or as an offset with the "ZZZ" format string. * * If consecutive calls are frequently very different, then this * may be a little slower than a normal DateFormat. * * @version $Id: DateCache.java,v 1.15 2004/05/09 20:32:49 gregwilkins Exp $ * @author Kent Johnson <[email protected]> * @author Greg Wilkins (gregw) */ public class DateCache { private static long __hitWindow=60*60; private static long __MaxMisses=10; private String _formatString; private String _tzFormatString; private SimpleDateFormat _tzFormat; private String _minFormatString; private SimpleDateFormat _minFormat; private String _secFormatString; private String _secFormatString0; private String _secFormatString1; private boolean _millis=false; private long _misses = 0; private long _lastMinutes = -1; private long _lastSeconds = -1; private String _lastResult = null; private Locale _locale = null; private DateFormatSymbols _dfs = null; /* ------------------------------------------------------------ */ /** Constructor. * Make a DateCache that will use a default format. The default format * generates the same results as Date.toString(). */ public DateCache() { this("EEE MMM dd HH:mm:ss zzz yyyy"); getFormat().setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ /** Constructor. * Make a DateCache that will use the given format */ public DateCache(String format) { _formatString=format; setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ public DateCache(String format,Locale l) { _formatString=format; _locale = l; setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ public DateCache(String format,DateFormatSymbols s) { _formatString=format; _dfs = s; setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ /** Set the timezone. * @param tz TimeZone */ public void setTimeZone(TimeZone tz) { setTzFormatString(tz); if( _locale != null ) { _tzFormat=new SimpleDateFormat(_tzFormatString,_locale); _minFormat=new SimpleDateFormat(_minFormatString,_locale); } else if( _dfs != null ) { _tzFormat=new SimpleDateFormat(_tzFormatString,_dfs); _minFormat=new SimpleDateFormat(_minFormatString,_dfs); } else { _tzFormat=new SimpleDateFormat(_tzFormatString); _minFormat=new SimpleDateFormat(_minFormatString); } _tzFormat.setTimeZone(tz); _minFormat.setTimeZone(tz); _lastSeconds=-1; _lastMinutes=-1; } /* ------------------------------------------------------------ */ public TimeZone getTimeZone() { return _tzFormat.getTimeZone(); } /* ------------------------------------------------------------ */ /** Set the timezone. * @param timeZoneId TimeZoneId the ID of the zone as used by * TimeZone.getTimeZone(id) */ public void setTimeZoneID(String timeZoneId) { setTimeZone(TimeZone.getTimeZone(timeZoneId)); } /* ------------------------------------------------------------ */ private void setTzFormatString(final TimeZone tz ) { int zIndex = _formatString.indexOf( "ZZZ" ); if( zIndex >= 0 ) { String ss1 = _formatString.substring( 0, zIndex ); String ss2 = _formatString.substring( zIndex+3 ); int tzOffset = tz.getRawOffset(); StringBuffer sb = new StringBuffer(_formatString.length()+10); sb.append(ss1); sb.append("'"); if( tzOffset >= 0 ) sb.append( '+' ); else { tzOffset = -tzOffset; sb.append( '-' ); } int raw = tzOffset / (1000*60); // Convert to seconds int hr = raw / 60; int min = raw % 60; if( hr < 10 ) sb.append( '0' ); sb.append( hr ); if( min < 10 ) sb.append( '0' ); sb.append( min ); sb.append( '\'' ); sb.append(ss2); _tzFormatString=sb.toString(); } else _tzFormatString=_formatString; setMinFormatString(); } /* ------------------------------------------------------------ */ private void setMinFormatString() { int i = _tzFormatString.indexOf("ss.SSS"); int l = 6; if (i>=0) _millis=true; else { i = _tzFormatString.indexOf("ss"); l=2; } // Build a formatter that formats a second format string // Have to replace @ with ' later due to bug in SimpleDateFormat String ss1=_tzFormatString.substring(0,i); String ss2=_tzFormatString.substring(i+l); _minFormatString =ss1+(_millis?"'ss.SSS'":"'ss'")+ss2; } /* ------------------------------------------------------------ */ /** Format a date according to our stored formatter. * @param inDate * @return Formatted date */ public synchronized String format(Date inDate) { return format(inDate.getTime()); } /* ------------------------------------------------------------ */ /** Format a date according to our stored formatter. * @param inDate * @return Formatted date */ public synchronized String format(long inDate) { long seconds = inDate / 1000; // Is it not suitable to cache? if (seconds<_lastSeconds || _lastSeconds>0 && seconds>_lastSeconds+__hitWindow) { // It's a cache miss _misses++; if (_misses<__MaxMisses) { Date d = new Date(inDate); return _tzFormat.format(d); } } else if (_misses>0) _misses--; // Check if we are in the same second // and don't care about millis if (_lastSeconds==seconds && !_millis) return _lastResult; Date d = new Date(inDate); // Check if we need a new format string long minutes = seconds/60; if (_lastMinutes != minutes) { _lastMinutes = minutes; _secFormatString=_minFormat.format(d); int i; int l; if (_millis) { i=_secFormatString.indexOf("ss.SSS"); l=6; } else { i=_secFormatString.indexOf("ss"); l=2; } _secFormatString0=_secFormatString.substring(0,i); _secFormatString1=_secFormatString.substring(i+l); } // Always format if we get here _lastSeconds = seconds; StringBuffer sb=new StringBuffer(_secFormatString.length()); synchronized(sb) { sb.append(_secFormatString0); int s=(int)(seconds%60); if (s<10) sb.append('0'); sb.append(s); if (_millis) { long millis = inDate%1000; if (millis<10) sb.append(".00"); else if (millis<100) sb.append(".0"); else sb.append('.'); sb.append(millis); } sb.append(_secFormatString1); _lastResult=sb.toString(); } return _lastResult; } /* ------------------------------------------------------------ */ /** Format to string buffer. * @param inDate Date the format * @param buffer StringBuffer */ public void format(long inDate, StringBuffer buffer) { buffer.append(format(inDate)); } /* ------------------------------------------------------------ */ /** Get the format. */ public SimpleDateFormat getFormat() { return _minFormat; } /* ------------------------------------------------------------ */ public String getFormatString() { return _formatString; } }
lightbody/browsermob-proxy
browsermob-legacy/src/main/java/net/lightbody/bmp/proxy/jetty/util/DateCache.java
2,595
// $Id: DateCache.java,v 1.15 2004/05/09 20:32:49 gregwilkins Exp $
line_comment
nl
// ======================================================================== // $Id: DateCache.java,v<SUF> // Copyright 1996-2004 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ======================================================================== package net.lightbody.bmp.proxy.jetty.util; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; /* ------------------------------------------------------------ */ /** Date Format Cache. * Computes String representations of Dates and caches * the results so that subsequent requests within the same minute * will be fast. * * Only format strings that contain either "ss" or "ss.SSS" are * handled. * * The timezone of the date may be included as an ID with the "zzz" * format string or as an offset with the "ZZZ" format string. * * If consecutive calls are frequently very different, then this * may be a little slower than a normal DateFormat. * * @version $Id: DateCache.java,v 1.15 2004/05/09 20:32:49 gregwilkins Exp $ * @author Kent Johnson <[email protected]> * @author Greg Wilkins (gregw) */ public class DateCache { private static long __hitWindow=60*60; private static long __MaxMisses=10; private String _formatString; private String _tzFormatString; private SimpleDateFormat _tzFormat; private String _minFormatString; private SimpleDateFormat _minFormat; private String _secFormatString; private String _secFormatString0; private String _secFormatString1; private boolean _millis=false; private long _misses = 0; private long _lastMinutes = -1; private long _lastSeconds = -1; private String _lastResult = null; private Locale _locale = null; private DateFormatSymbols _dfs = null; /* ------------------------------------------------------------ */ /** Constructor. * Make a DateCache that will use a default format. The default format * generates the same results as Date.toString(). */ public DateCache() { this("EEE MMM dd HH:mm:ss zzz yyyy"); getFormat().setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ /** Constructor. * Make a DateCache that will use the given format */ public DateCache(String format) { _formatString=format; setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ public DateCache(String format,Locale l) { _formatString=format; _locale = l; setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ public DateCache(String format,DateFormatSymbols s) { _formatString=format; _dfs = s; setTimeZone(TimeZone.getDefault()); } /* ------------------------------------------------------------ */ /** Set the timezone. * @param tz TimeZone */ public void setTimeZone(TimeZone tz) { setTzFormatString(tz); if( _locale != null ) { _tzFormat=new SimpleDateFormat(_tzFormatString,_locale); _minFormat=new SimpleDateFormat(_minFormatString,_locale); } else if( _dfs != null ) { _tzFormat=new SimpleDateFormat(_tzFormatString,_dfs); _minFormat=new SimpleDateFormat(_minFormatString,_dfs); } else { _tzFormat=new SimpleDateFormat(_tzFormatString); _minFormat=new SimpleDateFormat(_minFormatString); } _tzFormat.setTimeZone(tz); _minFormat.setTimeZone(tz); _lastSeconds=-1; _lastMinutes=-1; } /* ------------------------------------------------------------ */ public TimeZone getTimeZone() { return _tzFormat.getTimeZone(); } /* ------------------------------------------------------------ */ /** Set the timezone. * @param timeZoneId TimeZoneId the ID of the zone as used by * TimeZone.getTimeZone(id) */ public void setTimeZoneID(String timeZoneId) { setTimeZone(TimeZone.getTimeZone(timeZoneId)); } /* ------------------------------------------------------------ */ private void setTzFormatString(final TimeZone tz ) { int zIndex = _formatString.indexOf( "ZZZ" ); if( zIndex >= 0 ) { String ss1 = _formatString.substring( 0, zIndex ); String ss2 = _formatString.substring( zIndex+3 ); int tzOffset = tz.getRawOffset(); StringBuffer sb = new StringBuffer(_formatString.length()+10); sb.append(ss1); sb.append("'"); if( tzOffset >= 0 ) sb.append( '+' ); else { tzOffset = -tzOffset; sb.append( '-' ); } int raw = tzOffset / (1000*60); // Convert to seconds int hr = raw / 60; int min = raw % 60; if( hr < 10 ) sb.append( '0' ); sb.append( hr ); if( min < 10 ) sb.append( '0' ); sb.append( min ); sb.append( '\'' ); sb.append(ss2); _tzFormatString=sb.toString(); } else _tzFormatString=_formatString; setMinFormatString(); } /* ------------------------------------------------------------ */ private void setMinFormatString() { int i = _tzFormatString.indexOf("ss.SSS"); int l = 6; if (i>=0) _millis=true; else { i = _tzFormatString.indexOf("ss"); l=2; } // Build a formatter that formats a second format string // Have to replace @ with ' later due to bug in SimpleDateFormat String ss1=_tzFormatString.substring(0,i); String ss2=_tzFormatString.substring(i+l); _minFormatString =ss1+(_millis?"'ss.SSS'":"'ss'")+ss2; } /* ------------------------------------------------------------ */ /** Format a date according to our stored formatter. * @param inDate * @return Formatted date */ public synchronized String format(Date inDate) { return format(inDate.getTime()); } /* ------------------------------------------------------------ */ /** Format a date according to our stored formatter. * @param inDate * @return Formatted date */ public synchronized String format(long inDate) { long seconds = inDate / 1000; // Is it not suitable to cache? if (seconds<_lastSeconds || _lastSeconds>0 && seconds>_lastSeconds+__hitWindow) { // It's a cache miss _misses++; if (_misses<__MaxMisses) { Date d = new Date(inDate); return _tzFormat.format(d); } } else if (_misses>0) _misses--; // Check if we are in the same second // and don't care about millis if (_lastSeconds==seconds && !_millis) return _lastResult; Date d = new Date(inDate); // Check if we need a new format string long minutes = seconds/60; if (_lastMinutes != minutes) { _lastMinutes = minutes; _secFormatString=_minFormat.format(d); int i; int l; if (_millis) { i=_secFormatString.indexOf("ss.SSS"); l=6; } else { i=_secFormatString.indexOf("ss"); l=2; } _secFormatString0=_secFormatString.substring(0,i); _secFormatString1=_secFormatString.substring(i+l); } // Always format if we get here _lastSeconds = seconds; StringBuffer sb=new StringBuffer(_secFormatString.length()); synchronized(sb) { sb.append(_secFormatString0); int s=(int)(seconds%60); if (s<10) sb.append('0'); sb.append(s); if (_millis) { long millis = inDate%1000; if (millis<10) sb.append(".00"); else if (millis<100) sb.append(".0"); else sb.append('.'); sb.append(millis); } sb.append(_secFormatString1); _lastResult=sb.toString(); } return _lastResult; } /* ------------------------------------------------------------ */ /** Format to string buffer. * @param inDate Date the format * @param buffer StringBuffer */ public void format(long inDate, StringBuffer buffer) { buffer.append(format(inDate)); } /* ------------------------------------------------------------ */ /** Get the format. */ public SimpleDateFormat getFormat() { return _minFormat; } /* ------------------------------------------------------------ */ public String getFormatString() { return _formatString; } }
214042_2
package org.apereo.cas.authentication.surrogate; import org.apereo.cas.authentication.principal.Principal; import org.apereo.cas.authentication.principal.Service; import lombok.val; import java.util.Collection; import java.util.Optional; /** * This is {@link SurrogateAuthenticationService}. * It defines operations to note whether one can substitute as another during authentication. * * @author Jonathan Johnson * @author Misagh Moayyed * @since 5.1.0 */ @FunctionalInterface public interface SurrogateAuthenticationService { /** * An authorized account may be tagged as a wildcard, meaning * that the account has special permissions to impersonate anyone. */ String WILDCARD_ACCOUNT = "*"; /** * Default bean name. */ String BEAN_NAME = "surrogateAuthenticationService"; /** * Surrogate username attribute in the authentication payload. */ String AUTHENTICATION_ATTR_SURROGATE_USER = "surrogateUser"; /** * Original credential attribute in the authentication payload. */ String AUTHENTICATION_ATTR_SURROGATE_PRINCIPAL = "surrogatePrincipal"; /** * Indicates that surrogate authn is enabled and activated. */ String AUTHENTICATION_ATTR_SURROGATE_ENABLED = "surrogateEnabled"; /** * Checks whether a principal can authenticate as a surrogate user. * * @param surrogate The username of the surrogate * @param principal the principal * @param service the service * @return true if the given surrogate can authenticate as the user * @throws Throwable the throwable */ default boolean canImpersonate(final String surrogate, final Principal principal, final Optional<? extends Service> service) throws Throwable { return false; } /** * Gets a collection of account names a surrogate can authenticate as. * * @param username The username of the surrogate * @param service the service * @return collection of usernames * @throws Throwable the throwable */ Collection<String> getImpersonationAccounts(String username, Optional<? extends Service> service) throws Throwable; /** * Is wildcarded account authorized?. * * @param surrogate the surrogate * @param principal the principal * @param service the service * @return true /false * @throws Throwable the throwable */ default boolean isWildcardedAccount(final String surrogate, final Principal principal, final Optional<? extends Service> service) throws Throwable{ val accounts = getImpersonationAccounts(principal.getId(), service); return isWildcardedAccount(accounts, service); } /** * Is wildcarded account acepted and found in the given accounts?. * * @param accounts the accounts * @param service the service * @return true /false */ default boolean isWildcardedAccount(final Collection<String> accounts, final Optional<? extends Service> service) { return accounts.size() == 1 && accounts.contains(SurrogateAuthenticationService.WILDCARD_ACCOUNT); } }
leleuj/cas
support/cas-server-support-surrogate-api/src/main/java/org/apereo/cas/authentication/surrogate/SurrogateAuthenticationService.java
740
/** * Default bean name. */
block_comment
nl
package org.apereo.cas.authentication.surrogate; import org.apereo.cas.authentication.principal.Principal; import org.apereo.cas.authentication.principal.Service; import lombok.val; import java.util.Collection; import java.util.Optional; /** * This is {@link SurrogateAuthenticationService}. * It defines operations to note whether one can substitute as another during authentication. * * @author Jonathan Johnson * @author Misagh Moayyed * @since 5.1.0 */ @FunctionalInterface public interface SurrogateAuthenticationService { /** * An authorized account may be tagged as a wildcard, meaning * that the account has special permissions to impersonate anyone. */ String WILDCARD_ACCOUNT = "*"; /** * Default bean name.<SUF>*/ String BEAN_NAME = "surrogateAuthenticationService"; /** * Surrogate username attribute in the authentication payload. */ String AUTHENTICATION_ATTR_SURROGATE_USER = "surrogateUser"; /** * Original credential attribute in the authentication payload. */ String AUTHENTICATION_ATTR_SURROGATE_PRINCIPAL = "surrogatePrincipal"; /** * Indicates that surrogate authn is enabled and activated. */ String AUTHENTICATION_ATTR_SURROGATE_ENABLED = "surrogateEnabled"; /** * Checks whether a principal can authenticate as a surrogate user. * * @param surrogate The username of the surrogate * @param principal the principal * @param service the service * @return true if the given surrogate can authenticate as the user * @throws Throwable the throwable */ default boolean canImpersonate(final String surrogate, final Principal principal, final Optional<? extends Service> service) throws Throwable { return false; } /** * Gets a collection of account names a surrogate can authenticate as. * * @param username The username of the surrogate * @param service the service * @return collection of usernames * @throws Throwable the throwable */ Collection<String> getImpersonationAccounts(String username, Optional<? extends Service> service) throws Throwable; /** * Is wildcarded account authorized?. * * @param surrogate the surrogate * @param principal the principal * @param service the service * @return true /false * @throws Throwable the throwable */ default boolean isWildcardedAccount(final String surrogate, final Principal principal, final Optional<? extends Service> service) throws Throwable{ val accounts = getImpersonationAccounts(principal.getId(), service); return isWildcardedAccount(accounts, service); } /** * Is wildcarded account acepted and found in the given accounts?. * * @param accounts the accounts * @param service the service * @return true /false */ default boolean isWildcardedAccount(final Collection<String> accounts, final Optional<? extends Service> service) { return accounts.size() == 1 && accounts.contains(SurrogateAuthenticationService.WILDCARD_ACCOUNT); } }
214090_21
/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ /* * Copyright (C) 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ package org.opensearch.common.inject; import org.opensearch.common.inject.binder.AnnotatedBindingBuilder; import org.opensearch.common.inject.binder.AnnotatedElementBuilder; import org.opensearch.common.inject.binder.LinkedBindingBuilder; import org.opensearch.common.inject.spi.Message; /** * A module whose configuration information is hidden from its environment by default. Only bindings * that are explicitly exposed will be available to other modules and to the users of the injector. * This module may expose the bindings it creates and the bindings of the modules it installs. * <p> * A private module can be nested within a regular module or within another private module using * {@link Binder#install install()}. Its bindings live in a new environment that inherits bindings, * type converters, scopes, and interceptors from the surrounding ("parent") environment. When you * nest multiple private modules, the result is a tree of environments where the injector's * environment is the root. * <p> * Guice EDSL bindings can be exposed with {@link #expose(Class) expose()}. {@literal @}{@link * org.opensearch.common.inject.Provides Provides} bindings can be exposed with the {@literal @}{@link * Exposed} annotation: * <pre> * public class FooBarBazModule extends PrivateModule { * protected void configure() { * bind(Foo.class).to(RealFoo.class); * expose(Foo.class); * * install(new TransactionalBarModule()); * expose(Bar.class).annotatedWith(Transactional.class); * * bind(SomeImplementationDetail.class); * install(new MoreImplementationDetailsModule()); * } * * {@literal @}Provides {@literal @}Exposed * public Baz provideBaz() { * return new SuperBaz(); * } * } * </pre> * <p> * The scope of a binding is constrained to its environment. A singleton bound in a private * module will be unique to its environment. But a binding for the same type in a different private * module will yield a different instance. * <p> * A shared binding that injects the {@code Injector} gets the root injector, which only has * access to bindings in the root environment. An explicit binding that injects the {@code Injector} * gets access to all bindings in the child environment. * <p> * To promote a just-in-time binding to an explicit binding, bind it: * <pre> * bind(FooImpl.class); * </pre> * * @author [email protected] (Jesse Wilson) * @since 2.0 * * @opensearch.internal */ public abstract class PrivateModule implements Module { /** * Like abstract module, the binder of the current private module */ private PrivateBinder binder; @Override public final synchronized void configure(Binder binder) { if (this.binder != null) { throw new IllegalStateException("Re-entry is not allowed."); } // Guice treats PrivateModules specially and passes in a PrivateBinder automatically. this.binder = (PrivateBinder) binder.skipSources(PrivateModule.class); try { configure(); } finally { this.binder = null; } } /** * Creates bindings and other configurations private to this module. Use {@link #expose(Class) * expose()} to make the bindings in this module available externally. */ protected abstract void configure(); /** * Makes the binding for {@code key} available to other modules and the injector. */ protected final <T> void expose(Key<T> key) { binder.expose(key); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(Class<?> type) { return binder.expose(type); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(TypeLiteral<?> type) { return binder.expose(type); } // everything below is copied from AbstractModule /** * Returns the current binder. */ protected final PrivateBinder binder() { return binder; } /** * @see Binder#bind(Key) */ protected final <T> LinkedBindingBuilder<T> bind(Key<T> key) { return binder.bind(key); } /** * @see Binder#bind(TypeLiteral) */ protected final <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral) { return binder.bind(typeLiteral); } /** * @see Binder#bind(Class) */ protected final <T> AnnotatedBindingBuilder<T> bind(Class<T> clazz) { return binder.bind(clazz); } /** * @see Binder#install(Module) */ protected final void install(Module module) { binder.install(module); } /** * @see Binder#addError(String, Object[]) */ protected final void addError(String message, Object... arguments) { binder.addError(message, arguments); } /** * @see Binder#addError(Throwable) */ protected final void addError(Throwable t) { binder.addError(t); } /** * @see Binder#addError(Message) */ protected final void addError(Message message) { binder.addError(message); } /** * @see Binder#getProvider(Key) */ protected final <T> Provider<T> getProvider(Key<T> key) { return binder.getProvider(key); } /** * @see Binder#getProvider(Class) */ protected final <T> Provider<T> getProvider(Class<T> type) { return binder.getProvider(type); } /** * @see Binder#getMembersInjector(Class) */ protected <T> MembersInjector<T> getMembersInjector(Class<T> type) { return binder.getMembersInjector(type); } /** * @see Binder#getMembersInjector(TypeLiteral) */ protected <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> type) { return binder.getMembersInjector(type); } }
opensearch-project/OpenSearch
server/src/main/java/org/opensearch/common/inject/PrivateModule.java
1,859
/** * @see Binder#getMembersInjector(Class) */
block_comment
nl
/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ /* * Copyright (C) 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ package org.opensearch.common.inject; import org.opensearch.common.inject.binder.AnnotatedBindingBuilder; import org.opensearch.common.inject.binder.AnnotatedElementBuilder; import org.opensearch.common.inject.binder.LinkedBindingBuilder; import org.opensearch.common.inject.spi.Message; /** * A module whose configuration information is hidden from its environment by default. Only bindings * that are explicitly exposed will be available to other modules and to the users of the injector. * This module may expose the bindings it creates and the bindings of the modules it installs. * <p> * A private module can be nested within a regular module or within another private module using * {@link Binder#install install()}. Its bindings live in a new environment that inherits bindings, * type converters, scopes, and interceptors from the surrounding ("parent") environment. When you * nest multiple private modules, the result is a tree of environments where the injector's * environment is the root. * <p> * Guice EDSL bindings can be exposed with {@link #expose(Class) expose()}. {@literal @}{@link * org.opensearch.common.inject.Provides Provides} bindings can be exposed with the {@literal @}{@link * Exposed} annotation: * <pre> * public class FooBarBazModule extends PrivateModule { * protected void configure() { * bind(Foo.class).to(RealFoo.class); * expose(Foo.class); * * install(new TransactionalBarModule()); * expose(Bar.class).annotatedWith(Transactional.class); * * bind(SomeImplementationDetail.class); * install(new MoreImplementationDetailsModule()); * } * * {@literal @}Provides {@literal @}Exposed * public Baz provideBaz() { * return new SuperBaz(); * } * } * </pre> * <p> * The scope of a binding is constrained to its environment. A singleton bound in a private * module will be unique to its environment. But a binding for the same type in a different private * module will yield a different instance. * <p> * A shared binding that injects the {@code Injector} gets the root injector, which only has * access to bindings in the root environment. An explicit binding that injects the {@code Injector} * gets access to all bindings in the child environment. * <p> * To promote a just-in-time binding to an explicit binding, bind it: * <pre> * bind(FooImpl.class); * </pre> * * @author [email protected] (Jesse Wilson) * @since 2.0 * * @opensearch.internal */ public abstract class PrivateModule implements Module { /** * Like abstract module, the binder of the current private module */ private PrivateBinder binder; @Override public final synchronized void configure(Binder binder) { if (this.binder != null) { throw new IllegalStateException("Re-entry is not allowed."); } // Guice treats PrivateModules specially and passes in a PrivateBinder automatically. this.binder = (PrivateBinder) binder.skipSources(PrivateModule.class); try { configure(); } finally { this.binder = null; } } /** * Creates bindings and other configurations private to this module. Use {@link #expose(Class) * expose()} to make the bindings in this module available externally. */ protected abstract void configure(); /** * Makes the binding for {@code key} available to other modules and the injector. */ protected final <T> void expose(Key<T> key) { binder.expose(key); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(Class<?> type) { return binder.expose(type); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(TypeLiteral<?> type) { return binder.expose(type); } // everything below is copied from AbstractModule /** * Returns the current binder. */ protected final PrivateBinder binder() { return binder; } /** * @see Binder#bind(Key) */ protected final <T> LinkedBindingBuilder<T> bind(Key<T> key) { return binder.bind(key); } /** * @see Binder#bind(TypeLiteral) */ protected final <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral) { return binder.bind(typeLiteral); } /** * @see Binder#bind(Class) */ protected final <T> AnnotatedBindingBuilder<T> bind(Class<T> clazz) { return binder.bind(clazz); } /** * @see Binder#install(Module) */ protected final void install(Module module) { binder.install(module); } /** * @see Binder#addError(String, Object[]) */ protected final void addError(String message, Object... arguments) { binder.addError(message, arguments); } /** * @see Binder#addError(Throwable) */ protected final void addError(Throwable t) { binder.addError(t); } /** * @see Binder#addError(Message) */ protected final void addError(Message message) { binder.addError(message); } /** * @see Binder#getProvider(Key) */ protected final <T> Provider<T> getProvider(Key<T> key) { return binder.getProvider(key); } /** * @see Binder#getProvider(Class) */ protected final <T> Provider<T> getProvider(Class<T> type) { return binder.getProvider(type); } /** * @see Binder#getMembersInjector(Class) <SUF>*/ protected <T> MembersInjector<T> getMembersInjector(Class<T> type) { return binder.getMembersInjector(type); } /** * @see Binder#getMembersInjector(TypeLiteral) */ protected <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> type) { return binder.getMembersInjector(type); } }
214090_22
/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ /* * Copyright (C) 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ package org.opensearch.common.inject; import org.opensearch.common.inject.binder.AnnotatedBindingBuilder; import org.opensearch.common.inject.binder.AnnotatedElementBuilder; import org.opensearch.common.inject.binder.LinkedBindingBuilder; import org.opensearch.common.inject.spi.Message; /** * A module whose configuration information is hidden from its environment by default. Only bindings * that are explicitly exposed will be available to other modules and to the users of the injector. * This module may expose the bindings it creates and the bindings of the modules it installs. * <p> * A private module can be nested within a regular module or within another private module using * {@link Binder#install install()}. Its bindings live in a new environment that inherits bindings, * type converters, scopes, and interceptors from the surrounding ("parent") environment. When you * nest multiple private modules, the result is a tree of environments where the injector's * environment is the root. * <p> * Guice EDSL bindings can be exposed with {@link #expose(Class) expose()}. {@literal @}{@link * org.opensearch.common.inject.Provides Provides} bindings can be exposed with the {@literal @}{@link * Exposed} annotation: * <pre> * public class FooBarBazModule extends PrivateModule { * protected void configure() { * bind(Foo.class).to(RealFoo.class); * expose(Foo.class); * * install(new TransactionalBarModule()); * expose(Bar.class).annotatedWith(Transactional.class); * * bind(SomeImplementationDetail.class); * install(new MoreImplementationDetailsModule()); * } * * {@literal @}Provides {@literal @}Exposed * public Baz provideBaz() { * return new SuperBaz(); * } * } * </pre> * <p> * The scope of a binding is constrained to its environment. A singleton bound in a private * module will be unique to its environment. But a binding for the same type in a different private * module will yield a different instance. * <p> * A shared binding that injects the {@code Injector} gets the root injector, which only has * access to bindings in the root environment. An explicit binding that injects the {@code Injector} * gets access to all bindings in the child environment. * <p> * To promote a just-in-time binding to an explicit binding, bind it: * <pre> * bind(FooImpl.class); * </pre> * * @author [email protected] (Jesse Wilson) * @since 2.0 * * @opensearch.internal */ public abstract class PrivateModule implements Module { /** * Like abstract module, the binder of the current private module */ private PrivateBinder binder; @Override public final synchronized void configure(Binder binder) { if (this.binder != null) { throw new IllegalStateException("Re-entry is not allowed."); } // Guice treats PrivateModules specially and passes in a PrivateBinder automatically. this.binder = (PrivateBinder) binder.skipSources(PrivateModule.class); try { configure(); } finally { this.binder = null; } } /** * Creates bindings and other configurations private to this module. Use {@link #expose(Class) * expose()} to make the bindings in this module available externally. */ protected abstract void configure(); /** * Makes the binding for {@code key} available to other modules and the injector. */ protected final <T> void expose(Key<T> key) { binder.expose(key); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(Class<?> type) { return binder.expose(type); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(TypeLiteral<?> type) { return binder.expose(type); } // everything below is copied from AbstractModule /** * Returns the current binder. */ protected final PrivateBinder binder() { return binder; } /** * @see Binder#bind(Key) */ protected final <T> LinkedBindingBuilder<T> bind(Key<T> key) { return binder.bind(key); } /** * @see Binder#bind(TypeLiteral) */ protected final <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral) { return binder.bind(typeLiteral); } /** * @see Binder#bind(Class) */ protected final <T> AnnotatedBindingBuilder<T> bind(Class<T> clazz) { return binder.bind(clazz); } /** * @see Binder#install(Module) */ protected final void install(Module module) { binder.install(module); } /** * @see Binder#addError(String, Object[]) */ protected final void addError(String message, Object... arguments) { binder.addError(message, arguments); } /** * @see Binder#addError(Throwable) */ protected final void addError(Throwable t) { binder.addError(t); } /** * @see Binder#addError(Message) */ protected final void addError(Message message) { binder.addError(message); } /** * @see Binder#getProvider(Key) */ protected final <T> Provider<T> getProvider(Key<T> key) { return binder.getProvider(key); } /** * @see Binder#getProvider(Class) */ protected final <T> Provider<T> getProvider(Class<T> type) { return binder.getProvider(type); } /** * @see Binder#getMembersInjector(Class) */ protected <T> MembersInjector<T> getMembersInjector(Class<T> type) { return binder.getMembersInjector(type); } /** * @see Binder#getMembersInjector(TypeLiteral) */ protected <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> type) { return binder.getMembersInjector(type); } }
opensearch-project/OpenSearch
server/src/main/java/org/opensearch/common/inject/PrivateModule.java
1,859
/** * @see Binder#getMembersInjector(TypeLiteral) */
block_comment
nl
/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ /* * Copyright (C) 2008 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ package org.opensearch.common.inject; import org.opensearch.common.inject.binder.AnnotatedBindingBuilder; import org.opensearch.common.inject.binder.AnnotatedElementBuilder; import org.opensearch.common.inject.binder.LinkedBindingBuilder; import org.opensearch.common.inject.spi.Message; /** * A module whose configuration information is hidden from its environment by default. Only bindings * that are explicitly exposed will be available to other modules and to the users of the injector. * This module may expose the bindings it creates and the bindings of the modules it installs. * <p> * A private module can be nested within a regular module or within another private module using * {@link Binder#install install()}. Its bindings live in a new environment that inherits bindings, * type converters, scopes, and interceptors from the surrounding ("parent") environment. When you * nest multiple private modules, the result is a tree of environments where the injector's * environment is the root. * <p> * Guice EDSL bindings can be exposed with {@link #expose(Class) expose()}. {@literal @}{@link * org.opensearch.common.inject.Provides Provides} bindings can be exposed with the {@literal @}{@link * Exposed} annotation: * <pre> * public class FooBarBazModule extends PrivateModule { * protected void configure() { * bind(Foo.class).to(RealFoo.class); * expose(Foo.class); * * install(new TransactionalBarModule()); * expose(Bar.class).annotatedWith(Transactional.class); * * bind(SomeImplementationDetail.class); * install(new MoreImplementationDetailsModule()); * } * * {@literal @}Provides {@literal @}Exposed * public Baz provideBaz() { * return new SuperBaz(); * } * } * </pre> * <p> * The scope of a binding is constrained to its environment. A singleton bound in a private * module will be unique to its environment. But a binding for the same type in a different private * module will yield a different instance. * <p> * A shared binding that injects the {@code Injector} gets the root injector, which only has * access to bindings in the root environment. An explicit binding that injects the {@code Injector} * gets access to all bindings in the child environment. * <p> * To promote a just-in-time binding to an explicit binding, bind it: * <pre> * bind(FooImpl.class); * </pre> * * @author [email protected] (Jesse Wilson) * @since 2.0 * * @opensearch.internal */ public abstract class PrivateModule implements Module { /** * Like abstract module, the binder of the current private module */ private PrivateBinder binder; @Override public final synchronized void configure(Binder binder) { if (this.binder != null) { throw new IllegalStateException("Re-entry is not allowed."); } // Guice treats PrivateModules specially and passes in a PrivateBinder automatically. this.binder = (PrivateBinder) binder.skipSources(PrivateModule.class); try { configure(); } finally { this.binder = null; } } /** * Creates bindings and other configurations private to this module. Use {@link #expose(Class) * expose()} to make the bindings in this module available externally. */ protected abstract void configure(); /** * Makes the binding for {@code key} available to other modules and the injector. */ protected final <T> void expose(Key<T> key) { binder.expose(key); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(Class<?> type) { return binder.expose(type); } /** * Makes a binding for {@code type} available to other modules and the injector. Use {@link * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ protected final AnnotatedElementBuilder expose(TypeLiteral<?> type) { return binder.expose(type); } // everything below is copied from AbstractModule /** * Returns the current binder. */ protected final PrivateBinder binder() { return binder; } /** * @see Binder#bind(Key) */ protected final <T> LinkedBindingBuilder<T> bind(Key<T> key) { return binder.bind(key); } /** * @see Binder#bind(TypeLiteral) */ protected final <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral) { return binder.bind(typeLiteral); } /** * @see Binder#bind(Class) */ protected final <T> AnnotatedBindingBuilder<T> bind(Class<T> clazz) { return binder.bind(clazz); } /** * @see Binder#install(Module) */ protected final void install(Module module) { binder.install(module); } /** * @see Binder#addError(String, Object[]) */ protected final void addError(String message, Object... arguments) { binder.addError(message, arguments); } /** * @see Binder#addError(Throwable) */ protected final void addError(Throwable t) { binder.addError(t); } /** * @see Binder#addError(Message) */ protected final void addError(Message message) { binder.addError(message); } /** * @see Binder#getProvider(Key) */ protected final <T> Provider<T> getProvider(Key<T> key) { return binder.getProvider(key); } /** * @see Binder#getProvider(Class) */ protected final <T> Provider<T> getProvider(Class<T> type) { return binder.getProvider(type); } /** * @see Binder#getMembersInjector(Class) */ protected <T> MembersInjector<T> getMembersInjector(Class<T> type) { return binder.getMembersInjector(type); } /** * @see Binder#getMembersInjector(TypeLiteral) <SUF>*/ protected <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> type) { return binder.getMembersInjector(type); } }
214109_40
/* * The MIT License * * Copyright 2014 Jesse Glick. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package jenkins.model.lazy; import static java.util.logging.Level.FINER; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.Extension; import hudson.model.AbstractItem; import hudson.model.Item; import hudson.model.ItemGroup; import hudson.model.Job; import hudson.model.Queue; import hudson.model.Result; import hudson.model.Run; import hudson.model.RunMap; import hudson.model.listeners.ItemListener; import hudson.model.queue.SubTask; import hudson.widgets.BuildHistoryWidget; import hudson.widgets.HistoryWidget; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; import jenkins.model.RunIdMigrator; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.DoNotUse; /** * Makes it easier to use a lazy {@link RunMap} from a {@link Job} implementation. * Provides method implementations for some abstract {@link Job} methods, * as well as some methods which are not abstract but which you should override. * <p>Should be kept in a {@code transient} field in the job. * @since 1.556 */ @SuppressWarnings({"unchecked", "rawtypes"}) // BuildHistoryWidget, and AbstractItem.getParent public abstract class LazyBuildMixIn<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyBuildMixIn.LazyLoadingRun<JobT, RunT>> { private static final Logger LOGGER = Logger.getLogger(LazyBuildMixIn.class.getName()); // [JENKINS-15156] builds accessed before onLoad or onCreatedFromScratch called private @NonNull RunMap<RunT> builds = new RunMap<>(asJob()); /** * Initializes this mixin. * Call this from a constructor and {@link AbstractItem#onLoad} to make sure it is always initialized. */ protected LazyBuildMixIn() {} protected abstract JobT asJob(); /** * Gets the raw model. * Normally should not be called as such. * Note that the initial value is replaced during {@link #onCreatedFromScratch} or {@link #onLoad}. */ public final @NonNull RunMap<RunT> getRunMap() { return builds; } /** * Same as {@link #getRunMap} but suitable for {@link Job#_getRuns}. */ public final RunMap<RunT> _getRuns() { assert builds.baseDirInitialized() : "neither onCreatedFromScratch nor onLoad called on " + asJob() + " yet"; return builds; } /** * Something to be called from {@link Job#onCreatedFromScratch}. */ public final void onCreatedFromScratch() { builds = createBuildRunMap(); } /** * Something to be called from {@link Job#onLoad}. */ @SuppressWarnings("unchecked") public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { RunMap<RunT> _builds = createBuildRunMap(); int max = _builds.maxNumberOnDisk(); int next = asJob().getNextBuildNumber(); if (next <= max) { LOGGER.log(Level.WARNING, "JENKINS-27530: improper nextBuildNumber {0} detected in {1} with highest build number {2}; adjusting", new Object[] {next, asJob(), max}); asJob().updateNextBuildNumber(max + 1); } RunMap<RunT> currentBuilds = this.builds; if (parent != null) { // are we overwriting what currently exist? // this is primarily when Jenkins is getting reloaded Item current; try { current = parent.getItem(name); } catch (RuntimeException x) { LOGGER.log(Level.WARNING, "failed to look up " + name + " in " + parent, x); current = null; } if (current != null && current.getClass() == asJob().getClass()) { currentBuilds = (RunMap<RunT>) ((LazyLoadingJob) current).getLazyBuildMixIn().builds; } } if (currentBuilds != null) { // if we are reloading, keep all those that are still building intact for (RunT r : currentBuilds.getLoadedBuilds().values()) { if (r.isBuilding()) { // Do not use RunMap.put(Run): _builds.put(r.getNumber(), r); LOGGER.log(Level.FINE, "keeping reloaded {0}", r); } } } this.builds = _builds; } private RunMap<RunT> createBuildRunMap() { RunMap<RunT> r = new RunMap<>(asJob(), new RunMap.Constructor<RunT>() { @Override public RunT create(File dir) throws IOException { return loadBuild(dir); } }); RunIdMigrator runIdMigrator = asJob().runIdMigrator; assert runIdMigrator != null; r.runIdMigrator = runIdMigrator; return r; } /** * Type token for the build type. * The build class must have two constructors: * one taking the project type ({@code P}); * and one taking {@code P}, then {@link File}. */ protected abstract Class<RunT> getBuildClass(); /** * Loads an existing build record from disk. * The default implementation just calls the ({@link Job}, {@link File}) constructor of {@link #getBuildClass}, * which will call {@link Run#Run(Job, File)}. */ public RunT loadBuild(File dir) throws IOException { try { return getBuildClass().getConstructor(asJob().getClass(), File.class).newInstance(asJob(), dir); } catch (InstantiationException | NoSuchMethodException | IllegalAccessException e) { throw new LinkageError(e.getMessage(), e); } catch (InvocationTargetException e) { throw handleInvocationTargetException(e); } } /** * Creates a new build of this project for immediate execution. * Calls the ({@link Job}) constructor of {@link #getBuildClass}, which will call {@link Run#Run(Job)}. * Suitable for {@link SubTask#createExecutable}. */ public final synchronized RunT newBuild() throws IOException { try { RunT lastBuild = getBuildClass().getConstructor(asJob().getClass()).newInstance(asJob()); var rootDir = lastBuild.getRootDir().toPath(); if (Files.isDirectory(rootDir)) { LOGGER.warning(() -> "JENKINS-23152: " + rootDir + " already existed; will not overwrite with " + lastBuild + " but will create a fresh build #" + asJob().getNextBuildNumber()); return newBuild(); } builds.put(lastBuild); lastBuild.getPreviousBuild(); // JENKINS-20662: create connection to previous build return lastBuild; } catch (InvocationTargetException e) { LOGGER.log(Level.WARNING, String.format("A new build could not be created in job %s", asJob().getFullName()), e); throw handleInvocationTargetException(e); } catch (ReflectiveOperationException e) { throw new LinkageError("A new build could not be created in " + asJob().getFullName() + ": " + e, e); } catch (IllegalStateException e) { throw new IOException("A new build could not be created in " + asJob().getFullName() + ": " + e, e); } } private IOException handleInvocationTargetException(InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof Error) { throw (Error) t; } if (t instanceof RuntimeException) { throw (RuntimeException) t; } if (t instanceof IOException) { return (IOException) t; } throw new Error(t); } /** * Suitable for {@link Job#removeRun}. */ public final void removeRun(RunT run) { if (!builds.remove(run)) { LOGGER.log(Level.WARNING, "{0} did not contain {1} to begin with", new Object[] {asJob(), run}); } } /** * Suitable for {@link Job#getBuild}. */ public final RunT getBuild(String id) { return builds.getById(id); } /** * Suitable for {@link Job#getBuildByNumber}. */ public final RunT getBuildByNumber(int n) { return builds.getByNumber(n); } /** * Suitable for {@link Job#getFirstBuild}. */ public final RunT getFirstBuild() { return builds.oldestBuild(); } /** * Suitable for {@link Job#getLastBuild}. */ public final @CheckForNull RunT getLastBuild() { return builds.newestBuild(); } /** * Suitable for {@link Job#getNearestBuild}. */ public final RunT getNearestBuild(int n) { return builds.search(n, AbstractLazyLoadRunMap.Direction.ASC); } /** * Suitable for {@link Job#getNearestOldBuild}. */ public final RunT getNearestOldBuild(int n) { return builds.search(n, AbstractLazyLoadRunMap.Direction.DESC); } /** * Suitable for {@link Job#getEstimatedDurationCandidates}. * @since 2.407 */ public List<RunT> getEstimatedDurationCandidates() { var loadedBuilds = builds.getLoadedBuilds().values(); // reverse chronological order List<RunT> candidates = new ArrayList<>(3); for (Result threshold : List.of(Result.UNSTABLE, Result.FAILURE)) { for (RunT build : loadedBuilds) { if (candidates.contains(build)) { continue; } if (!build.isBuilding()) { Result result = build.getResult(); if (result != null && result.isBetterOrEqualTo(threshold)) { candidates.add(build); if (candidates.size() == 3) { LOGGER.fine(() -> "Candidates: " + candidates); return candidates; } } } } } LOGGER.fine(() -> "Candidates: " + candidates); return candidates; } /** * Suitable for {@link Job#createHistoryWidget}. */ public final HistoryWidget createHistoryWidget() { return new BuildHistoryWidget(asJob(), builds, Job.HISTORY_ADAPTER); } /** * Marker for a {@link Job} which uses this mixin. */ public interface LazyLoadingJob<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyLoadingRun<JobT, RunT>> { LazyBuildMixIn<JobT, RunT> getLazyBuildMixIn(); // not offering default implementation for _getRuns(), removeRun(R), getBuild(String), getBuildByNumber(int), getFirstBuild(), getLastBuild(), getNearestBuild(int), getNearestOldBuild(int), or createHistoryWidget() // since they are defined in Job // (could allow implementations to call LazyLoadingJob.super.theMethod()) } /** * Marker for a {@link Run} which uses this mixin. */ public interface LazyLoadingRun<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyLoadingRun<JobT, RunT>> { RunMixIn<JobT, RunT> getRunMixIn(); // not offering default implementations for createReference() or dropLinks() since they are protected // (though could use @Restricted(ProtectedExternally.class)) // nor for getPreviousBuild() or getNextBuild() since they are defined in Run // (though could allow implementations to call LazyLoadingRun.super.theMethod()) } /** * Accompanying helper for the run type. * Stateful but should be held in a {@code final transient} field. */ public abstract static class RunMixIn<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyLoadingRun<JobT, RunT>> { /** * Pointers to form bi-directional link between adjacent runs using * {@link LazyBuildMixIn}. * * <p> * Some {@link Run}s do lazy-loading, so we don't use * {@link #previousBuildR} and {@link #nextBuildR}, and instead use these * fields and point to {@link #selfReference} (or {@link #none}) of * adjacent builds. */ private volatile BuildReference<RunT> previousBuildR, nextBuildR; /** * Used in {@link #previousBuildR} and {@link #nextBuildR} to indicate * that we know there is no next/previous build (as opposed to {@code null}, * which is used to indicate we haven't determined if there is a next/previous * build.) */ @SuppressWarnings({"unchecked", "rawtypes"}) private static final BuildReference NONE = new BuildReference("NONE", null); @SuppressWarnings("unchecked") private BuildReference<RunT> none() { return NONE; } private BuildReference<RunT> selfReference; protected RunMixIn() {} protected abstract RunT asRun(); /** * To implement {@link Run#createReference}. */ public final synchronized BuildReference<RunT> createReference() { if (selfReference == null) { selfReference = new BuildReference<>(asRun().getId(), asRun()); } return selfReference; } /** * To implement {@link Run#dropLinks}. */ public final void dropLinks() { if (nextBuildR != null) { RunT nb = nextBuildR.get(); if (nb != null) { nb.getRunMixIn().previousBuildR = previousBuildR; } } if (previousBuildR != null) { RunT pb = previousBuildR.get(); if (pb != null) { pb.getRunMixIn().nextBuildR = nextBuildR; } } // make this build object unreachable by other Runs createReference().clear(); } /** * To implement {@link Run#getPreviousBuild}. */ public final RunT getPreviousBuild() { while (true) { BuildReference<RunT> r = previousBuildR; // capture the value once if (r == null) { // having two neighbors pointing to each other is important to make RunMap.removeValue work JobT _parent = Objects.requireNonNull(asRun().getParent(), "no parent for " + asRun().number); RunT pb = _parent.getLazyBuildMixIn()._getRuns().search(asRun().number - 1, AbstractLazyLoadRunMap.Direction.DESC); if (pb != null) { pb.getRunMixIn().nextBuildR = createReference(); // establish bi-di link this.previousBuildR = pb.getRunMixIn().createReference(); LOGGER.log(FINER, "Linked {0}<->{1} in getPreviousBuild()", new Object[]{this, pb}); return pb; } else { this.previousBuildR = none(); return null; } } if (r == none()) { return null; } RunT referent = r.get(); if (referent != null) { return referent; } // the reference points to a GC-ed object, drop the reference and do it again this.previousBuildR = null; } } /** * To implement {@link Run#getNextBuild}. */ public final RunT getNextBuild() { while (true) { BuildReference<RunT> r = nextBuildR; // capture the value once if (r == null) { // having two neighbors pointing to each other is important to make RunMap.removeValue work RunT nb = asRun().getParent().getLazyBuildMixIn()._getRuns().search(asRun().number + 1, AbstractLazyLoadRunMap.Direction.ASC); if (nb != null) { nb.getRunMixIn().previousBuildR = createReference(); // establish bi-di link this.nextBuildR = nb.getRunMixIn().createReference(); LOGGER.log(FINER, "Linked {0}<->{1} in getNextBuild()", new Object[]{this, nb}); return nb; } else { this.nextBuildR = none(); return null; } } if (r == none()) { return null; } RunT referent = r.get(); if (referent != null) { return referent; } // the reference points to a GC-ed object, drop the reference and do it again this.nextBuildR = null; } } } @Restricted(DoNotUse.class) @Extension public static final class ItemListenerImpl extends ItemListener { @Override public void onLocationChanged(Item item, String oldFullName, String newFullName) { if (item instanceof LazyLoadingJob) { RunMap<?> builds = ((LazyLoadingJob) item).getLazyBuildMixIn().builds; builds.updateBaseDir(((Job) item).getBuildDir()); } } } }
Dohbedoh/jenkins
core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java
4,713
/** * To implement {@link Run#dropLinks}. */
block_comment
nl
/* * The MIT License * * Copyright 2014 Jesse Glick. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package jenkins.model.lazy; import static java.util.logging.Level.FINER; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.Extension; import hudson.model.AbstractItem; import hudson.model.Item; import hudson.model.ItemGroup; import hudson.model.Job; import hudson.model.Queue; import hudson.model.Result; import hudson.model.Run; import hudson.model.RunMap; import hudson.model.listeners.ItemListener; import hudson.model.queue.SubTask; import hudson.widgets.BuildHistoryWidget; import hudson.widgets.HistoryWidget; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; import jenkins.model.RunIdMigrator; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.DoNotUse; /** * Makes it easier to use a lazy {@link RunMap} from a {@link Job} implementation. * Provides method implementations for some abstract {@link Job} methods, * as well as some methods which are not abstract but which you should override. * <p>Should be kept in a {@code transient} field in the job. * @since 1.556 */ @SuppressWarnings({"unchecked", "rawtypes"}) // BuildHistoryWidget, and AbstractItem.getParent public abstract class LazyBuildMixIn<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyBuildMixIn.LazyLoadingRun<JobT, RunT>> { private static final Logger LOGGER = Logger.getLogger(LazyBuildMixIn.class.getName()); // [JENKINS-15156] builds accessed before onLoad or onCreatedFromScratch called private @NonNull RunMap<RunT> builds = new RunMap<>(asJob()); /** * Initializes this mixin. * Call this from a constructor and {@link AbstractItem#onLoad} to make sure it is always initialized. */ protected LazyBuildMixIn() {} protected abstract JobT asJob(); /** * Gets the raw model. * Normally should not be called as such. * Note that the initial value is replaced during {@link #onCreatedFromScratch} or {@link #onLoad}. */ public final @NonNull RunMap<RunT> getRunMap() { return builds; } /** * Same as {@link #getRunMap} but suitable for {@link Job#_getRuns}. */ public final RunMap<RunT> _getRuns() { assert builds.baseDirInitialized() : "neither onCreatedFromScratch nor onLoad called on " + asJob() + " yet"; return builds; } /** * Something to be called from {@link Job#onCreatedFromScratch}. */ public final void onCreatedFromScratch() { builds = createBuildRunMap(); } /** * Something to be called from {@link Job#onLoad}. */ @SuppressWarnings("unchecked") public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { RunMap<RunT> _builds = createBuildRunMap(); int max = _builds.maxNumberOnDisk(); int next = asJob().getNextBuildNumber(); if (next <= max) { LOGGER.log(Level.WARNING, "JENKINS-27530: improper nextBuildNumber {0} detected in {1} with highest build number {2}; adjusting", new Object[] {next, asJob(), max}); asJob().updateNextBuildNumber(max + 1); } RunMap<RunT> currentBuilds = this.builds; if (parent != null) { // are we overwriting what currently exist? // this is primarily when Jenkins is getting reloaded Item current; try { current = parent.getItem(name); } catch (RuntimeException x) { LOGGER.log(Level.WARNING, "failed to look up " + name + " in " + parent, x); current = null; } if (current != null && current.getClass() == asJob().getClass()) { currentBuilds = (RunMap<RunT>) ((LazyLoadingJob) current).getLazyBuildMixIn().builds; } } if (currentBuilds != null) { // if we are reloading, keep all those that are still building intact for (RunT r : currentBuilds.getLoadedBuilds().values()) { if (r.isBuilding()) { // Do not use RunMap.put(Run): _builds.put(r.getNumber(), r); LOGGER.log(Level.FINE, "keeping reloaded {0}", r); } } } this.builds = _builds; } private RunMap<RunT> createBuildRunMap() { RunMap<RunT> r = new RunMap<>(asJob(), new RunMap.Constructor<RunT>() { @Override public RunT create(File dir) throws IOException { return loadBuild(dir); } }); RunIdMigrator runIdMigrator = asJob().runIdMigrator; assert runIdMigrator != null; r.runIdMigrator = runIdMigrator; return r; } /** * Type token for the build type. * The build class must have two constructors: * one taking the project type ({@code P}); * and one taking {@code P}, then {@link File}. */ protected abstract Class<RunT> getBuildClass(); /** * Loads an existing build record from disk. * The default implementation just calls the ({@link Job}, {@link File}) constructor of {@link #getBuildClass}, * which will call {@link Run#Run(Job, File)}. */ public RunT loadBuild(File dir) throws IOException { try { return getBuildClass().getConstructor(asJob().getClass(), File.class).newInstance(asJob(), dir); } catch (InstantiationException | NoSuchMethodException | IllegalAccessException e) { throw new LinkageError(e.getMessage(), e); } catch (InvocationTargetException e) { throw handleInvocationTargetException(e); } } /** * Creates a new build of this project for immediate execution. * Calls the ({@link Job}) constructor of {@link #getBuildClass}, which will call {@link Run#Run(Job)}. * Suitable for {@link SubTask#createExecutable}. */ public final synchronized RunT newBuild() throws IOException { try { RunT lastBuild = getBuildClass().getConstructor(asJob().getClass()).newInstance(asJob()); var rootDir = lastBuild.getRootDir().toPath(); if (Files.isDirectory(rootDir)) { LOGGER.warning(() -> "JENKINS-23152: " + rootDir + " already existed; will not overwrite with " + lastBuild + " but will create a fresh build #" + asJob().getNextBuildNumber()); return newBuild(); } builds.put(lastBuild); lastBuild.getPreviousBuild(); // JENKINS-20662: create connection to previous build return lastBuild; } catch (InvocationTargetException e) { LOGGER.log(Level.WARNING, String.format("A new build could not be created in job %s", asJob().getFullName()), e); throw handleInvocationTargetException(e); } catch (ReflectiveOperationException e) { throw new LinkageError("A new build could not be created in " + asJob().getFullName() + ": " + e, e); } catch (IllegalStateException e) { throw new IOException("A new build could not be created in " + asJob().getFullName() + ": " + e, e); } } private IOException handleInvocationTargetException(InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof Error) { throw (Error) t; } if (t instanceof RuntimeException) { throw (RuntimeException) t; } if (t instanceof IOException) { return (IOException) t; } throw new Error(t); } /** * Suitable for {@link Job#removeRun}. */ public final void removeRun(RunT run) { if (!builds.remove(run)) { LOGGER.log(Level.WARNING, "{0} did not contain {1} to begin with", new Object[] {asJob(), run}); } } /** * Suitable for {@link Job#getBuild}. */ public final RunT getBuild(String id) { return builds.getById(id); } /** * Suitable for {@link Job#getBuildByNumber}. */ public final RunT getBuildByNumber(int n) { return builds.getByNumber(n); } /** * Suitable for {@link Job#getFirstBuild}. */ public final RunT getFirstBuild() { return builds.oldestBuild(); } /** * Suitable for {@link Job#getLastBuild}. */ public final @CheckForNull RunT getLastBuild() { return builds.newestBuild(); } /** * Suitable for {@link Job#getNearestBuild}. */ public final RunT getNearestBuild(int n) { return builds.search(n, AbstractLazyLoadRunMap.Direction.ASC); } /** * Suitable for {@link Job#getNearestOldBuild}. */ public final RunT getNearestOldBuild(int n) { return builds.search(n, AbstractLazyLoadRunMap.Direction.DESC); } /** * Suitable for {@link Job#getEstimatedDurationCandidates}. * @since 2.407 */ public List<RunT> getEstimatedDurationCandidates() { var loadedBuilds = builds.getLoadedBuilds().values(); // reverse chronological order List<RunT> candidates = new ArrayList<>(3); for (Result threshold : List.of(Result.UNSTABLE, Result.FAILURE)) { for (RunT build : loadedBuilds) { if (candidates.contains(build)) { continue; } if (!build.isBuilding()) { Result result = build.getResult(); if (result != null && result.isBetterOrEqualTo(threshold)) { candidates.add(build); if (candidates.size() == 3) { LOGGER.fine(() -> "Candidates: " + candidates); return candidates; } } } } } LOGGER.fine(() -> "Candidates: " + candidates); return candidates; } /** * Suitable for {@link Job#createHistoryWidget}. */ public final HistoryWidget createHistoryWidget() { return new BuildHistoryWidget(asJob(), builds, Job.HISTORY_ADAPTER); } /** * Marker for a {@link Job} which uses this mixin. */ public interface LazyLoadingJob<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyLoadingRun<JobT, RunT>> { LazyBuildMixIn<JobT, RunT> getLazyBuildMixIn(); // not offering default implementation for _getRuns(), removeRun(R), getBuild(String), getBuildByNumber(int), getFirstBuild(), getLastBuild(), getNearestBuild(int), getNearestOldBuild(int), or createHistoryWidget() // since they are defined in Job // (could allow implementations to call LazyLoadingJob.super.theMethod()) } /** * Marker for a {@link Run} which uses this mixin. */ public interface LazyLoadingRun<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyLoadingRun<JobT, RunT>> { RunMixIn<JobT, RunT> getRunMixIn(); // not offering default implementations for createReference() or dropLinks() since they are protected // (though could use @Restricted(ProtectedExternally.class)) // nor for getPreviousBuild() or getNextBuild() since they are defined in Run // (though could allow implementations to call LazyLoadingRun.super.theMethod()) } /** * Accompanying helper for the run type. * Stateful but should be held in a {@code final transient} field. */ public abstract static class RunMixIn<JobT extends Job<JobT, RunT> & Queue.Task & LazyBuildMixIn.LazyLoadingJob<JobT, RunT>, RunT extends Run<JobT, RunT> & LazyLoadingRun<JobT, RunT>> { /** * Pointers to form bi-directional link between adjacent runs using * {@link LazyBuildMixIn}. * * <p> * Some {@link Run}s do lazy-loading, so we don't use * {@link #previousBuildR} and {@link #nextBuildR}, and instead use these * fields and point to {@link #selfReference} (or {@link #none}) of * adjacent builds. */ private volatile BuildReference<RunT> previousBuildR, nextBuildR; /** * Used in {@link #previousBuildR} and {@link #nextBuildR} to indicate * that we know there is no next/previous build (as opposed to {@code null}, * which is used to indicate we haven't determined if there is a next/previous * build.) */ @SuppressWarnings({"unchecked", "rawtypes"}) private static final BuildReference NONE = new BuildReference("NONE", null); @SuppressWarnings("unchecked") private BuildReference<RunT> none() { return NONE; } private BuildReference<RunT> selfReference; protected RunMixIn() {} protected abstract RunT asRun(); /** * To implement {@link Run#createReference}. */ public final synchronized BuildReference<RunT> createReference() { if (selfReference == null) { selfReference = new BuildReference<>(asRun().getId(), asRun()); } return selfReference; } /** * To implement {@link<SUF>*/ public final void dropLinks() { if (nextBuildR != null) { RunT nb = nextBuildR.get(); if (nb != null) { nb.getRunMixIn().previousBuildR = previousBuildR; } } if (previousBuildR != null) { RunT pb = previousBuildR.get(); if (pb != null) { pb.getRunMixIn().nextBuildR = nextBuildR; } } // make this build object unreachable by other Runs createReference().clear(); } /** * To implement {@link Run#getPreviousBuild}. */ public final RunT getPreviousBuild() { while (true) { BuildReference<RunT> r = previousBuildR; // capture the value once if (r == null) { // having two neighbors pointing to each other is important to make RunMap.removeValue work JobT _parent = Objects.requireNonNull(asRun().getParent(), "no parent for " + asRun().number); RunT pb = _parent.getLazyBuildMixIn()._getRuns().search(asRun().number - 1, AbstractLazyLoadRunMap.Direction.DESC); if (pb != null) { pb.getRunMixIn().nextBuildR = createReference(); // establish bi-di link this.previousBuildR = pb.getRunMixIn().createReference(); LOGGER.log(FINER, "Linked {0}<->{1} in getPreviousBuild()", new Object[]{this, pb}); return pb; } else { this.previousBuildR = none(); return null; } } if (r == none()) { return null; } RunT referent = r.get(); if (referent != null) { return referent; } // the reference points to a GC-ed object, drop the reference and do it again this.previousBuildR = null; } } /** * To implement {@link Run#getNextBuild}. */ public final RunT getNextBuild() { while (true) { BuildReference<RunT> r = nextBuildR; // capture the value once if (r == null) { // having two neighbors pointing to each other is important to make RunMap.removeValue work RunT nb = asRun().getParent().getLazyBuildMixIn()._getRuns().search(asRun().number + 1, AbstractLazyLoadRunMap.Direction.ASC); if (nb != null) { nb.getRunMixIn().previousBuildR = createReference(); // establish bi-di link this.nextBuildR = nb.getRunMixIn().createReference(); LOGGER.log(FINER, "Linked {0}<->{1} in getNextBuild()", new Object[]{this, nb}); return nb; } else { this.nextBuildR = none(); return null; } } if (r == none()) { return null; } RunT referent = r.get(); if (referent != null) { return referent; } // the reference points to a GC-ed object, drop the reference and do it again this.nextBuildR = null; } } } @Restricted(DoNotUse.class) @Extension public static final class ItemListenerImpl extends ItemListener { @Override public void onLocationChanged(Item item, String oldFullName, String newFullName) { if (item instanceof LazyLoadingJob) { RunMap<?> builds = ((LazyLoadingJob) item).getLazyBuildMixIn().builds; builds.updateBaseDir(((Job) item).getBuildDir()); } } } }
214157_6
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryUtil.*; /** * This extension adds some more dynamic state to support applications that need to reduce the number of pipeline state objects they compile and bind. * * <h5>Promotion to Vulkan 1.3</h5> * * <p>This extension has been partially promoted. All dynamic state enumerants and entry points in this extension are included in core Vulkan 1.3, with the EXT suffix omitted. The feature structure is not promoted. Extension interfaces that were promoted remain available as aliases of the core functionality.</p> * * <dl> * <dt><b>Name String</b></dt> * <dd>{@code VK_EXT_extended_dynamic_state}</dd> * <dt><b>Extension Type</b></dt> * <dd>Device extension</dd> * <dt><b>Registered Extension Number</b></dt> * <dd>268</dd> * <dt><b>Revision</b></dt> * <dd>1</dd> * <dt><b>Extension and Version Dependencies</b></dt> * <dd>{@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2} or <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.1">Version 1.1</a></dd> * <dt><b>Deprecation State</b></dt> * <dd><ul> * <li><em>Promoted</em> to <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.3-promotions">Vulkan 1.3</a></li> * </ul></dd> * <dt><b>Contact</b></dt> * <dd><ul> * <li>Piers Daniell <a href="https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_extended_dynamic_state]%20@pdaniell-nv%250A*Here%20describe%20the%20issue%20or%20question%20you%20have%20about%20the%20VK_EXT_extended_dynamic_state%20extension*">pdaniell-nv</a></li> * </ul></dd> * </dl> * * <h5>Other Extension Metadata</h5> * * <dl> * <dt><b>Last Modified Date</b></dt> * <dd>2019-12-09</dd> * <dt><b>IP Status</b></dt> * <dd>No known IP claims.</dd> * <dt><b>Contributors</b></dt> * <dd><ul> * <li>Dan Ginsburg, Valve Corporation</li> * <li>Graeme Leese, Broadcom</li> * <li>Hans-Kristian Arntzen, Valve Corporation</li> * <li>Jan-Harald Fredriksen, Arm Limited</li> * <li>Faith Ekstrand, Intel</li> * <li>Jeff Bolz, NVIDIA</li> * <li>Jesse Hall, Google</li> * <li>Philip Rebohle, Valve Corporation</li> * <li>Stuart Smith, Imagination Technologies</li> * <li>Tobias Hector, AMD</li> * </ul></dd> * </dl> */ public class EXTExtendedDynamicState { /** The extension specification version. */ public static final int VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME = "VK_EXT_extended_dynamic_state"; /** Extends {@code VkStructureType}. */ public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000; /** * Extends {@code VkDynamicState}. * * <h5>Enum values:</h5> * * <ul> * <li>{@link #VK_DYNAMIC_STATE_CULL_MODE_EXT DYNAMIC_STATE_CULL_MODE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_FRONT_FACE_EXT DYNAMIC_STATE_FRONT_FACE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_OP_EXT DYNAMIC_STATE_STENCIL_OP_EXT}</li> * </ul> */ public static final int VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011; protected EXTExtendedDynamicState() { throw new UnsupportedOperationException(); } // --- [ vkCmdSetCullModeEXT ] --- /** * See {@link VK13#vkCmdSetCullMode CmdSetCullMode}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param cullMode specifies the cull mode property to use for drawing. */ public static void vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, @NativeType("VkCullModeFlags") int cullMode) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetCullModeEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), cullMode, __functionAddress); } // --- [ vkCmdSetFrontFaceEXT ] --- /** * See {@link VK13#vkCmdSetFrontFace CmdSetFrontFace}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param frontFace a {@code VkFrontFace} value specifying the front-facing triangle orientation to be used for culling. */ public static void vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, @NativeType("VkFrontFace") int frontFace) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetFrontFaceEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), frontFace, __functionAddress); } // --- [ vkCmdSetPrimitiveTopologyEXT ] --- /** * See {@link VK13#vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param primitiveTopology specifies the primitive topology to use for drawing. */ public static void vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, @NativeType("VkPrimitiveTopology") int primitiveTopology) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetPrimitiveTopologyEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), primitiveTopology, __functionAddress); } // --- [ vkCmdSetViewportWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetViewportWithCountEXT CmdSetViewportWithCountEXT} * * @param viewportCount specifies the viewport count. */ public static void nvkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, int viewportCount, long pViewports) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetViewportWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), viewportCount, pViewports, __functionAddress); } /** * See {@link VK13#vkCmdSetViewportWithCount CmdSetViewportWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pViewports specifies the viewports to use for drawing. */ public static void vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkViewport const *") VkViewport.Buffer pViewports) { nvkCmdSetViewportWithCountEXT(commandBuffer, pViewports.remaining(), pViewports.address()); } // --- [ vkCmdSetScissorWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetScissorWithCountEXT CmdSetScissorWithCountEXT} * * @param scissorCount specifies the scissor count. */ public static void nvkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, int scissorCount, long pScissors) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetScissorWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), scissorCount, pScissors, __functionAddress); } /** * See {@link VK13#vkCmdSetScissorWithCount CmdSetScissorWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pScissors specifies the scissors to use for drawing. */ public static void vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkRect2D const *") VkRect2D.Buffer pScissors) { nvkCmdSetScissorWithCountEXT(commandBuffer, pScissors.remaining(), pScissors.address()); } // --- [ vkCmdBindVertexBuffers2EXT ] --- /** * Unsafe version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} * * @param bindingCount the number of vertex input bindings whose state is updated by the command. */ public static void nvkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, int firstBinding, int bindingCount, long pBuffers, long pOffsets, long pSizes, long pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); } callPPPPPV(commandBuffer.address(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } /** * See {@link VK13#vkCmdBindVertexBuffers2 CmdBindVertexBuffers2}. * * @param commandBuffer the command buffer into which the command is recorded. * @param firstBinding the index of the first vertex input binding whose state is updated by the command. * @param pBuffers a pointer to an array of buffer handles. * @param pOffsets a pointer to an array of buffer offsets. * @param pSizes {@code NULL} or a pointer to an array of the size in bytes of vertex data bound from {@code pBuffers}. * @param pStrides {@code NULL} or a pointer to an array of buffer strides. */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") LongBuffer pBuffers, @NativeType("VkDeviceSize const *") LongBuffer pOffsets, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pSizes, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pStrides) { if (CHECKS) { check(pOffsets, pBuffers.remaining()); checkSafe(pSizes, pBuffers.remaining()); checkSafe(pStrides, pBuffers.remaining()); } nvkCmdBindVertexBuffers2EXT(commandBuffer, firstBinding, pBuffers.remaining(), memAddress(pBuffers), memAddress(pOffsets), memAddressSafe(pSizes), memAddressSafe(pStrides)); } // --- [ vkCmdSetDepthTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthTestEnable CmdSetDepthTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthTestEnable specifies if the depth test is enabled. */ public static void vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthWriteEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthWriteEnable specifies if depth writes are enabled. */ public static void vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthWriteEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthWriteEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthWriteEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthCompareOpEXT ] --- /** * See {@link VK13#vkCmdSetDepthCompareOp CmdSetDepthCompareOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthCompareOp a {@code VkCompareOp} value specifying the comparison operator used for the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth-comparison">Depth Comparison</a> step of the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth">depth test</a>. */ public static void vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkCompareOp") int depthCompareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthCompareOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthCompareOp, __functionAddress); } // --- [ vkCmdSetDepthBoundsTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthBoundsTestEnable CmdSetDepthBoundsTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthBoundsTestEnable specifies if the depth bounds test is enabled. */ public static void vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthBoundsTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthBoundsTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthBoundsTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetStencilTestEnable CmdSetStencilTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param stencilTestEnable specifies if the stencil test is enabled. */ public static void vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean stencilTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), stencilTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilOpEXT ] --- /** * See {@link VK13#vkCmdSetStencilOp CmdSetStencilOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param faceMask a bitmask of {@code VkStencilFaceFlagBits} specifying the set of stencil state for which to update the stencil operation. * @param failOp a {@code VkStencilOp} value specifying the action performed on samples that fail the stencil test. * @param passOp a {@code VkStencilOp} value specifying the action performed on samples that pass both the depth and stencil tests. * @param depthFailOp a {@code VkStencilOp} value specifying the action performed on samples that pass the stencil test and fail the depth test. * @param compareOp a {@code VkCompareOp} value specifying the comparison operator used in the stencil test. */ public static void vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkStencilFaceFlags") int faceMask, @NativeType("VkStencilOp") int failOp, @NativeType("VkStencilOp") int passOp, @NativeType("VkStencilOp") int depthFailOp, @NativeType("VkCompareOp") int compareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), faceMask, failOp, passOp, depthFailOp, compareOp, __functionAddress); } /** Array version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") long[] pBuffers, @NativeType("VkDeviceSize const *") long[] pOffsets, @Nullable @NativeType("VkDeviceSize const *") long[] pSizes, @Nullable @NativeType("VkDeviceSize const *") long[] pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); check(pOffsets, pBuffers.length); checkSafe(pSizes, pBuffers.length); checkSafe(pStrides, pBuffers.length); } callPPPPPV(commandBuffer.address(), firstBinding, pBuffers.length, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } }
LWJGL/lwjgl3
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/EXTExtendedDynamicState.java
5,137
// --- [ vkCmdSetCullModeEXT ] ---
line_comment
nl
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryUtil.*; /** * This extension adds some more dynamic state to support applications that need to reduce the number of pipeline state objects they compile and bind. * * <h5>Promotion to Vulkan 1.3</h5> * * <p>This extension has been partially promoted. All dynamic state enumerants and entry points in this extension are included in core Vulkan 1.3, with the EXT suffix omitted. The feature structure is not promoted. Extension interfaces that were promoted remain available as aliases of the core functionality.</p> * * <dl> * <dt><b>Name String</b></dt> * <dd>{@code VK_EXT_extended_dynamic_state}</dd> * <dt><b>Extension Type</b></dt> * <dd>Device extension</dd> * <dt><b>Registered Extension Number</b></dt> * <dd>268</dd> * <dt><b>Revision</b></dt> * <dd>1</dd> * <dt><b>Extension and Version Dependencies</b></dt> * <dd>{@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2} or <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.1">Version 1.1</a></dd> * <dt><b>Deprecation State</b></dt> * <dd><ul> * <li><em>Promoted</em> to <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.3-promotions">Vulkan 1.3</a></li> * </ul></dd> * <dt><b>Contact</b></dt> * <dd><ul> * <li>Piers Daniell <a href="https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_extended_dynamic_state]%20@pdaniell-nv%250A*Here%20describe%20the%20issue%20or%20question%20you%20have%20about%20the%20VK_EXT_extended_dynamic_state%20extension*">pdaniell-nv</a></li> * </ul></dd> * </dl> * * <h5>Other Extension Metadata</h5> * * <dl> * <dt><b>Last Modified Date</b></dt> * <dd>2019-12-09</dd> * <dt><b>IP Status</b></dt> * <dd>No known IP claims.</dd> * <dt><b>Contributors</b></dt> * <dd><ul> * <li>Dan Ginsburg, Valve Corporation</li> * <li>Graeme Leese, Broadcom</li> * <li>Hans-Kristian Arntzen, Valve Corporation</li> * <li>Jan-Harald Fredriksen, Arm Limited</li> * <li>Faith Ekstrand, Intel</li> * <li>Jeff Bolz, NVIDIA</li> * <li>Jesse Hall, Google</li> * <li>Philip Rebohle, Valve Corporation</li> * <li>Stuart Smith, Imagination Technologies</li> * <li>Tobias Hector, AMD</li> * </ul></dd> * </dl> */ public class EXTExtendedDynamicState { /** The extension specification version. */ public static final int VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME = "VK_EXT_extended_dynamic_state"; /** Extends {@code VkStructureType}. */ public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000; /** * Extends {@code VkDynamicState}. * * <h5>Enum values:</h5> * * <ul> * <li>{@link #VK_DYNAMIC_STATE_CULL_MODE_EXT DYNAMIC_STATE_CULL_MODE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_FRONT_FACE_EXT DYNAMIC_STATE_FRONT_FACE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_OP_EXT DYNAMIC_STATE_STENCIL_OP_EXT}</li> * </ul> */ public static final int VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011; protected EXTExtendedDynamicState() { throw new UnsupportedOperationException(); } // --- [<SUF> /** * See {@link VK13#vkCmdSetCullMode CmdSetCullMode}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param cullMode specifies the cull mode property to use for drawing. */ public static void vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, @NativeType("VkCullModeFlags") int cullMode) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetCullModeEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), cullMode, __functionAddress); } // --- [ vkCmdSetFrontFaceEXT ] --- /** * See {@link VK13#vkCmdSetFrontFace CmdSetFrontFace}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param frontFace a {@code VkFrontFace} value specifying the front-facing triangle orientation to be used for culling. */ public static void vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, @NativeType("VkFrontFace") int frontFace) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetFrontFaceEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), frontFace, __functionAddress); } // --- [ vkCmdSetPrimitiveTopologyEXT ] --- /** * See {@link VK13#vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param primitiveTopology specifies the primitive topology to use for drawing. */ public static void vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, @NativeType("VkPrimitiveTopology") int primitiveTopology) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetPrimitiveTopologyEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), primitiveTopology, __functionAddress); } // --- [ vkCmdSetViewportWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetViewportWithCountEXT CmdSetViewportWithCountEXT} * * @param viewportCount specifies the viewport count. */ public static void nvkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, int viewportCount, long pViewports) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetViewportWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), viewportCount, pViewports, __functionAddress); } /** * See {@link VK13#vkCmdSetViewportWithCount CmdSetViewportWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pViewports specifies the viewports to use for drawing. */ public static void vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkViewport const *") VkViewport.Buffer pViewports) { nvkCmdSetViewportWithCountEXT(commandBuffer, pViewports.remaining(), pViewports.address()); } // --- [ vkCmdSetScissorWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetScissorWithCountEXT CmdSetScissorWithCountEXT} * * @param scissorCount specifies the scissor count. */ public static void nvkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, int scissorCount, long pScissors) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetScissorWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), scissorCount, pScissors, __functionAddress); } /** * See {@link VK13#vkCmdSetScissorWithCount CmdSetScissorWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pScissors specifies the scissors to use for drawing. */ public static void vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkRect2D const *") VkRect2D.Buffer pScissors) { nvkCmdSetScissorWithCountEXT(commandBuffer, pScissors.remaining(), pScissors.address()); } // --- [ vkCmdBindVertexBuffers2EXT ] --- /** * Unsafe version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} * * @param bindingCount the number of vertex input bindings whose state is updated by the command. */ public static void nvkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, int firstBinding, int bindingCount, long pBuffers, long pOffsets, long pSizes, long pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); } callPPPPPV(commandBuffer.address(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } /** * See {@link VK13#vkCmdBindVertexBuffers2 CmdBindVertexBuffers2}. * * @param commandBuffer the command buffer into which the command is recorded. * @param firstBinding the index of the first vertex input binding whose state is updated by the command. * @param pBuffers a pointer to an array of buffer handles. * @param pOffsets a pointer to an array of buffer offsets. * @param pSizes {@code NULL} or a pointer to an array of the size in bytes of vertex data bound from {@code pBuffers}. * @param pStrides {@code NULL} or a pointer to an array of buffer strides. */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") LongBuffer pBuffers, @NativeType("VkDeviceSize const *") LongBuffer pOffsets, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pSizes, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pStrides) { if (CHECKS) { check(pOffsets, pBuffers.remaining()); checkSafe(pSizes, pBuffers.remaining()); checkSafe(pStrides, pBuffers.remaining()); } nvkCmdBindVertexBuffers2EXT(commandBuffer, firstBinding, pBuffers.remaining(), memAddress(pBuffers), memAddress(pOffsets), memAddressSafe(pSizes), memAddressSafe(pStrides)); } // --- [ vkCmdSetDepthTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthTestEnable CmdSetDepthTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthTestEnable specifies if the depth test is enabled. */ public static void vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthWriteEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthWriteEnable specifies if depth writes are enabled. */ public static void vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthWriteEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthWriteEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthWriteEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthCompareOpEXT ] --- /** * See {@link VK13#vkCmdSetDepthCompareOp CmdSetDepthCompareOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthCompareOp a {@code VkCompareOp} value specifying the comparison operator used for the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth-comparison">Depth Comparison</a> step of the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth">depth test</a>. */ public static void vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkCompareOp") int depthCompareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthCompareOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthCompareOp, __functionAddress); } // --- [ vkCmdSetDepthBoundsTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthBoundsTestEnable CmdSetDepthBoundsTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthBoundsTestEnable specifies if the depth bounds test is enabled. */ public static void vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthBoundsTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthBoundsTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthBoundsTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetStencilTestEnable CmdSetStencilTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param stencilTestEnable specifies if the stencil test is enabled. */ public static void vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean stencilTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), stencilTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilOpEXT ] --- /** * See {@link VK13#vkCmdSetStencilOp CmdSetStencilOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param faceMask a bitmask of {@code VkStencilFaceFlagBits} specifying the set of stencil state for which to update the stencil operation. * @param failOp a {@code VkStencilOp} value specifying the action performed on samples that fail the stencil test. * @param passOp a {@code VkStencilOp} value specifying the action performed on samples that pass both the depth and stencil tests. * @param depthFailOp a {@code VkStencilOp} value specifying the action performed on samples that pass the stencil test and fail the depth test. * @param compareOp a {@code VkCompareOp} value specifying the comparison operator used in the stencil test. */ public static void vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkStencilFaceFlags") int faceMask, @NativeType("VkStencilOp") int failOp, @NativeType("VkStencilOp") int passOp, @NativeType("VkStencilOp") int depthFailOp, @NativeType("VkCompareOp") int compareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), faceMask, failOp, passOp, depthFailOp, compareOp, __functionAddress); } /** Array version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") long[] pBuffers, @NativeType("VkDeviceSize const *") long[] pOffsets, @Nullable @NativeType("VkDeviceSize const *") long[] pSizes, @Nullable @NativeType("VkDeviceSize const *") long[] pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); check(pOffsets, pBuffers.length); checkSafe(pSizes, pBuffers.length); checkSafe(pStrides, pBuffers.length); } callPPPPPV(commandBuffer.address(), firstBinding, pBuffers.length, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } }
214157_8
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryUtil.*; /** * This extension adds some more dynamic state to support applications that need to reduce the number of pipeline state objects they compile and bind. * * <h5>Promotion to Vulkan 1.3</h5> * * <p>This extension has been partially promoted. All dynamic state enumerants and entry points in this extension are included in core Vulkan 1.3, with the EXT suffix omitted. The feature structure is not promoted. Extension interfaces that were promoted remain available as aliases of the core functionality.</p> * * <dl> * <dt><b>Name String</b></dt> * <dd>{@code VK_EXT_extended_dynamic_state}</dd> * <dt><b>Extension Type</b></dt> * <dd>Device extension</dd> * <dt><b>Registered Extension Number</b></dt> * <dd>268</dd> * <dt><b>Revision</b></dt> * <dd>1</dd> * <dt><b>Extension and Version Dependencies</b></dt> * <dd>{@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2} or <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.1">Version 1.1</a></dd> * <dt><b>Deprecation State</b></dt> * <dd><ul> * <li><em>Promoted</em> to <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.3-promotions">Vulkan 1.3</a></li> * </ul></dd> * <dt><b>Contact</b></dt> * <dd><ul> * <li>Piers Daniell <a href="https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_extended_dynamic_state]%20@pdaniell-nv%250A*Here%20describe%20the%20issue%20or%20question%20you%20have%20about%20the%20VK_EXT_extended_dynamic_state%20extension*">pdaniell-nv</a></li> * </ul></dd> * </dl> * * <h5>Other Extension Metadata</h5> * * <dl> * <dt><b>Last Modified Date</b></dt> * <dd>2019-12-09</dd> * <dt><b>IP Status</b></dt> * <dd>No known IP claims.</dd> * <dt><b>Contributors</b></dt> * <dd><ul> * <li>Dan Ginsburg, Valve Corporation</li> * <li>Graeme Leese, Broadcom</li> * <li>Hans-Kristian Arntzen, Valve Corporation</li> * <li>Jan-Harald Fredriksen, Arm Limited</li> * <li>Faith Ekstrand, Intel</li> * <li>Jeff Bolz, NVIDIA</li> * <li>Jesse Hall, Google</li> * <li>Philip Rebohle, Valve Corporation</li> * <li>Stuart Smith, Imagination Technologies</li> * <li>Tobias Hector, AMD</li> * </ul></dd> * </dl> */ public class EXTExtendedDynamicState { /** The extension specification version. */ public static final int VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME = "VK_EXT_extended_dynamic_state"; /** Extends {@code VkStructureType}. */ public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000; /** * Extends {@code VkDynamicState}. * * <h5>Enum values:</h5> * * <ul> * <li>{@link #VK_DYNAMIC_STATE_CULL_MODE_EXT DYNAMIC_STATE_CULL_MODE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_FRONT_FACE_EXT DYNAMIC_STATE_FRONT_FACE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_OP_EXT DYNAMIC_STATE_STENCIL_OP_EXT}</li> * </ul> */ public static final int VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011; protected EXTExtendedDynamicState() { throw new UnsupportedOperationException(); } // --- [ vkCmdSetCullModeEXT ] --- /** * See {@link VK13#vkCmdSetCullMode CmdSetCullMode}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param cullMode specifies the cull mode property to use for drawing. */ public static void vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, @NativeType("VkCullModeFlags") int cullMode) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetCullModeEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), cullMode, __functionAddress); } // --- [ vkCmdSetFrontFaceEXT ] --- /** * See {@link VK13#vkCmdSetFrontFace CmdSetFrontFace}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param frontFace a {@code VkFrontFace} value specifying the front-facing triangle orientation to be used for culling. */ public static void vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, @NativeType("VkFrontFace") int frontFace) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetFrontFaceEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), frontFace, __functionAddress); } // --- [ vkCmdSetPrimitiveTopologyEXT ] --- /** * See {@link VK13#vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param primitiveTopology specifies the primitive topology to use for drawing. */ public static void vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, @NativeType("VkPrimitiveTopology") int primitiveTopology) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetPrimitiveTopologyEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), primitiveTopology, __functionAddress); } // --- [ vkCmdSetViewportWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetViewportWithCountEXT CmdSetViewportWithCountEXT} * * @param viewportCount specifies the viewport count. */ public static void nvkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, int viewportCount, long pViewports) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetViewportWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), viewportCount, pViewports, __functionAddress); } /** * See {@link VK13#vkCmdSetViewportWithCount CmdSetViewportWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pViewports specifies the viewports to use for drawing. */ public static void vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkViewport const *") VkViewport.Buffer pViewports) { nvkCmdSetViewportWithCountEXT(commandBuffer, pViewports.remaining(), pViewports.address()); } // --- [ vkCmdSetScissorWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetScissorWithCountEXT CmdSetScissorWithCountEXT} * * @param scissorCount specifies the scissor count. */ public static void nvkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, int scissorCount, long pScissors) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetScissorWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), scissorCount, pScissors, __functionAddress); } /** * See {@link VK13#vkCmdSetScissorWithCount CmdSetScissorWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pScissors specifies the scissors to use for drawing. */ public static void vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkRect2D const *") VkRect2D.Buffer pScissors) { nvkCmdSetScissorWithCountEXT(commandBuffer, pScissors.remaining(), pScissors.address()); } // --- [ vkCmdBindVertexBuffers2EXT ] --- /** * Unsafe version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} * * @param bindingCount the number of vertex input bindings whose state is updated by the command. */ public static void nvkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, int firstBinding, int bindingCount, long pBuffers, long pOffsets, long pSizes, long pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); } callPPPPPV(commandBuffer.address(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } /** * See {@link VK13#vkCmdBindVertexBuffers2 CmdBindVertexBuffers2}. * * @param commandBuffer the command buffer into which the command is recorded. * @param firstBinding the index of the first vertex input binding whose state is updated by the command. * @param pBuffers a pointer to an array of buffer handles. * @param pOffsets a pointer to an array of buffer offsets. * @param pSizes {@code NULL} or a pointer to an array of the size in bytes of vertex data bound from {@code pBuffers}. * @param pStrides {@code NULL} or a pointer to an array of buffer strides. */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") LongBuffer pBuffers, @NativeType("VkDeviceSize const *") LongBuffer pOffsets, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pSizes, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pStrides) { if (CHECKS) { check(pOffsets, pBuffers.remaining()); checkSafe(pSizes, pBuffers.remaining()); checkSafe(pStrides, pBuffers.remaining()); } nvkCmdBindVertexBuffers2EXT(commandBuffer, firstBinding, pBuffers.remaining(), memAddress(pBuffers), memAddress(pOffsets), memAddressSafe(pSizes), memAddressSafe(pStrides)); } // --- [ vkCmdSetDepthTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthTestEnable CmdSetDepthTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthTestEnable specifies if the depth test is enabled. */ public static void vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthWriteEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthWriteEnable specifies if depth writes are enabled. */ public static void vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthWriteEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthWriteEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthWriteEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthCompareOpEXT ] --- /** * See {@link VK13#vkCmdSetDepthCompareOp CmdSetDepthCompareOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthCompareOp a {@code VkCompareOp} value specifying the comparison operator used for the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth-comparison">Depth Comparison</a> step of the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth">depth test</a>. */ public static void vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkCompareOp") int depthCompareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthCompareOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthCompareOp, __functionAddress); } // --- [ vkCmdSetDepthBoundsTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthBoundsTestEnable CmdSetDepthBoundsTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthBoundsTestEnable specifies if the depth bounds test is enabled. */ public static void vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthBoundsTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthBoundsTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthBoundsTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetStencilTestEnable CmdSetStencilTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param stencilTestEnable specifies if the stencil test is enabled. */ public static void vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean stencilTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), stencilTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilOpEXT ] --- /** * See {@link VK13#vkCmdSetStencilOp CmdSetStencilOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param faceMask a bitmask of {@code VkStencilFaceFlagBits} specifying the set of stencil state for which to update the stencil operation. * @param failOp a {@code VkStencilOp} value specifying the action performed on samples that fail the stencil test. * @param passOp a {@code VkStencilOp} value specifying the action performed on samples that pass both the depth and stencil tests. * @param depthFailOp a {@code VkStencilOp} value specifying the action performed on samples that pass the stencil test and fail the depth test. * @param compareOp a {@code VkCompareOp} value specifying the comparison operator used in the stencil test. */ public static void vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkStencilFaceFlags") int faceMask, @NativeType("VkStencilOp") int failOp, @NativeType("VkStencilOp") int passOp, @NativeType("VkStencilOp") int depthFailOp, @NativeType("VkCompareOp") int compareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), faceMask, failOp, passOp, depthFailOp, compareOp, __functionAddress); } /** Array version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") long[] pBuffers, @NativeType("VkDeviceSize const *") long[] pOffsets, @Nullable @NativeType("VkDeviceSize const *") long[] pSizes, @Nullable @NativeType("VkDeviceSize const *") long[] pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); check(pOffsets, pBuffers.length); checkSafe(pSizes, pBuffers.length); checkSafe(pStrides, pBuffers.length); } callPPPPPV(commandBuffer.address(), firstBinding, pBuffers.length, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } }
LWJGL/lwjgl3
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/EXTExtendedDynamicState.java
5,137
// --- [ vkCmdSetFrontFaceEXT ] ---
line_comment
nl
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryUtil.*; /** * This extension adds some more dynamic state to support applications that need to reduce the number of pipeline state objects they compile and bind. * * <h5>Promotion to Vulkan 1.3</h5> * * <p>This extension has been partially promoted. All dynamic state enumerants and entry points in this extension are included in core Vulkan 1.3, with the EXT suffix omitted. The feature structure is not promoted. Extension interfaces that were promoted remain available as aliases of the core functionality.</p> * * <dl> * <dt><b>Name String</b></dt> * <dd>{@code VK_EXT_extended_dynamic_state}</dd> * <dt><b>Extension Type</b></dt> * <dd>Device extension</dd> * <dt><b>Registered Extension Number</b></dt> * <dd>268</dd> * <dt><b>Revision</b></dt> * <dd>1</dd> * <dt><b>Extension and Version Dependencies</b></dt> * <dd>{@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2} or <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.1">Version 1.1</a></dd> * <dt><b>Deprecation State</b></dt> * <dd><ul> * <li><em>Promoted</em> to <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.3-promotions">Vulkan 1.3</a></li> * </ul></dd> * <dt><b>Contact</b></dt> * <dd><ul> * <li>Piers Daniell <a href="https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_extended_dynamic_state]%20@pdaniell-nv%250A*Here%20describe%20the%20issue%20or%20question%20you%20have%20about%20the%20VK_EXT_extended_dynamic_state%20extension*">pdaniell-nv</a></li> * </ul></dd> * </dl> * * <h5>Other Extension Metadata</h5> * * <dl> * <dt><b>Last Modified Date</b></dt> * <dd>2019-12-09</dd> * <dt><b>IP Status</b></dt> * <dd>No known IP claims.</dd> * <dt><b>Contributors</b></dt> * <dd><ul> * <li>Dan Ginsburg, Valve Corporation</li> * <li>Graeme Leese, Broadcom</li> * <li>Hans-Kristian Arntzen, Valve Corporation</li> * <li>Jan-Harald Fredriksen, Arm Limited</li> * <li>Faith Ekstrand, Intel</li> * <li>Jeff Bolz, NVIDIA</li> * <li>Jesse Hall, Google</li> * <li>Philip Rebohle, Valve Corporation</li> * <li>Stuart Smith, Imagination Technologies</li> * <li>Tobias Hector, AMD</li> * </ul></dd> * </dl> */ public class EXTExtendedDynamicState { /** The extension specification version. */ public static final int VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME = "VK_EXT_extended_dynamic_state"; /** Extends {@code VkStructureType}. */ public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000; /** * Extends {@code VkDynamicState}. * * <h5>Enum values:</h5> * * <ul> * <li>{@link #VK_DYNAMIC_STATE_CULL_MODE_EXT DYNAMIC_STATE_CULL_MODE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_FRONT_FACE_EXT DYNAMIC_STATE_FRONT_FACE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_OP_EXT DYNAMIC_STATE_STENCIL_OP_EXT}</li> * </ul> */ public static final int VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011; protected EXTExtendedDynamicState() { throw new UnsupportedOperationException(); } // --- [ vkCmdSetCullModeEXT ] --- /** * See {@link VK13#vkCmdSetCullMode CmdSetCullMode}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param cullMode specifies the cull mode property to use for drawing. */ public static void vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, @NativeType("VkCullModeFlags") int cullMode) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetCullModeEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), cullMode, __functionAddress); } // --- [<SUF> /** * See {@link VK13#vkCmdSetFrontFace CmdSetFrontFace}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param frontFace a {@code VkFrontFace} value specifying the front-facing triangle orientation to be used for culling. */ public static void vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, @NativeType("VkFrontFace") int frontFace) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetFrontFaceEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), frontFace, __functionAddress); } // --- [ vkCmdSetPrimitiveTopologyEXT ] --- /** * See {@link VK13#vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param primitiveTopology specifies the primitive topology to use for drawing. */ public static void vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, @NativeType("VkPrimitiveTopology") int primitiveTopology) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetPrimitiveTopologyEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), primitiveTopology, __functionAddress); } // --- [ vkCmdSetViewportWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetViewportWithCountEXT CmdSetViewportWithCountEXT} * * @param viewportCount specifies the viewport count. */ public static void nvkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, int viewportCount, long pViewports) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetViewportWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), viewportCount, pViewports, __functionAddress); } /** * See {@link VK13#vkCmdSetViewportWithCount CmdSetViewportWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pViewports specifies the viewports to use for drawing. */ public static void vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkViewport const *") VkViewport.Buffer pViewports) { nvkCmdSetViewportWithCountEXT(commandBuffer, pViewports.remaining(), pViewports.address()); } // --- [ vkCmdSetScissorWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetScissorWithCountEXT CmdSetScissorWithCountEXT} * * @param scissorCount specifies the scissor count. */ public static void nvkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, int scissorCount, long pScissors) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetScissorWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), scissorCount, pScissors, __functionAddress); } /** * See {@link VK13#vkCmdSetScissorWithCount CmdSetScissorWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pScissors specifies the scissors to use for drawing. */ public static void vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkRect2D const *") VkRect2D.Buffer pScissors) { nvkCmdSetScissorWithCountEXT(commandBuffer, pScissors.remaining(), pScissors.address()); } // --- [ vkCmdBindVertexBuffers2EXT ] --- /** * Unsafe version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} * * @param bindingCount the number of vertex input bindings whose state is updated by the command. */ public static void nvkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, int firstBinding, int bindingCount, long pBuffers, long pOffsets, long pSizes, long pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); } callPPPPPV(commandBuffer.address(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } /** * See {@link VK13#vkCmdBindVertexBuffers2 CmdBindVertexBuffers2}. * * @param commandBuffer the command buffer into which the command is recorded. * @param firstBinding the index of the first vertex input binding whose state is updated by the command. * @param pBuffers a pointer to an array of buffer handles. * @param pOffsets a pointer to an array of buffer offsets. * @param pSizes {@code NULL} or a pointer to an array of the size in bytes of vertex data bound from {@code pBuffers}. * @param pStrides {@code NULL} or a pointer to an array of buffer strides. */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") LongBuffer pBuffers, @NativeType("VkDeviceSize const *") LongBuffer pOffsets, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pSizes, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pStrides) { if (CHECKS) { check(pOffsets, pBuffers.remaining()); checkSafe(pSizes, pBuffers.remaining()); checkSafe(pStrides, pBuffers.remaining()); } nvkCmdBindVertexBuffers2EXT(commandBuffer, firstBinding, pBuffers.remaining(), memAddress(pBuffers), memAddress(pOffsets), memAddressSafe(pSizes), memAddressSafe(pStrides)); } // --- [ vkCmdSetDepthTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthTestEnable CmdSetDepthTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthTestEnable specifies if the depth test is enabled. */ public static void vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthWriteEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthWriteEnable specifies if depth writes are enabled. */ public static void vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthWriteEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthWriteEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthWriteEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthCompareOpEXT ] --- /** * See {@link VK13#vkCmdSetDepthCompareOp CmdSetDepthCompareOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthCompareOp a {@code VkCompareOp} value specifying the comparison operator used for the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth-comparison">Depth Comparison</a> step of the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth">depth test</a>. */ public static void vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkCompareOp") int depthCompareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthCompareOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthCompareOp, __functionAddress); } // --- [ vkCmdSetDepthBoundsTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthBoundsTestEnable CmdSetDepthBoundsTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthBoundsTestEnable specifies if the depth bounds test is enabled. */ public static void vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthBoundsTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthBoundsTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthBoundsTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetStencilTestEnable CmdSetStencilTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param stencilTestEnable specifies if the stencil test is enabled. */ public static void vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean stencilTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), stencilTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilOpEXT ] --- /** * See {@link VK13#vkCmdSetStencilOp CmdSetStencilOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param faceMask a bitmask of {@code VkStencilFaceFlagBits} specifying the set of stencil state for which to update the stencil operation. * @param failOp a {@code VkStencilOp} value specifying the action performed on samples that fail the stencil test. * @param passOp a {@code VkStencilOp} value specifying the action performed on samples that pass both the depth and stencil tests. * @param depthFailOp a {@code VkStencilOp} value specifying the action performed on samples that pass the stencil test and fail the depth test. * @param compareOp a {@code VkCompareOp} value specifying the comparison operator used in the stencil test. */ public static void vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkStencilFaceFlags") int faceMask, @NativeType("VkStencilOp") int failOp, @NativeType("VkStencilOp") int passOp, @NativeType("VkStencilOp") int depthFailOp, @NativeType("VkCompareOp") int compareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), faceMask, failOp, passOp, depthFailOp, compareOp, __functionAddress); } /** Array version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") long[] pBuffers, @NativeType("VkDeviceSize const *") long[] pOffsets, @Nullable @NativeType("VkDeviceSize const *") long[] pSizes, @Nullable @NativeType("VkDeviceSize const *") long[] pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); check(pOffsets, pBuffers.length); checkSafe(pSizes, pBuffers.length); checkSafe(pStrides, pBuffers.length); } callPPPPPV(commandBuffer.address(), firstBinding, pBuffers.length, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } }
214157_31
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryUtil.*; /** * This extension adds some more dynamic state to support applications that need to reduce the number of pipeline state objects they compile and bind. * * <h5>Promotion to Vulkan 1.3</h5> * * <p>This extension has been partially promoted. All dynamic state enumerants and entry points in this extension are included in core Vulkan 1.3, with the EXT suffix omitted. The feature structure is not promoted. Extension interfaces that were promoted remain available as aliases of the core functionality.</p> * * <dl> * <dt><b>Name String</b></dt> * <dd>{@code VK_EXT_extended_dynamic_state}</dd> * <dt><b>Extension Type</b></dt> * <dd>Device extension</dd> * <dt><b>Registered Extension Number</b></dt> * <dd>268</dd> * <dt><b>Revision</b></dt> * <dd>1</dd> * <dt><b>Extension and Version Dependencies</b></dt> * <dd>{@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2} or <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.1">Version 1.1</a></dd> * <dt><b>Deprecation State</b></dt> * <dd><ul> * <li><em>Promoted</em> to <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.3-promotions">Vulkan 1.3</a></li> * </ul></dd> * <dt><b>Contact</b></dt> * <dd><ul> * <li>Piers Daniell <a href="https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_extended_dynamic_state]%20@pdaniell-nv%250A*Here%20describe%20the%20issue%20or%20question%20you%20have%20about%20the%20VK_EXT_extended_dynamic_state%20extension*">pdaniell-nv</a></li> * </ul></dd> * </dl> * * <h5>Other Extension Metadata</h5> * * <dl> * <dt><b>Last Modified Date</b></dt> * <dd>2019-12-09</dd> * <dt><b>IP Status</b></dt> * <dd>No known IP claims.</dd> * <dt><b>Contributors</b></dt> * <dd><ul> * <li>Dan Ginsburg, Valve Corporation</li> * <li>Graeme Leese, Broadcom</li> * <li>Hans-Kristian Arntzen, Valve Corporation</li> * <li>Jan-Harald Fredriksen, Arm Limited</li> * <li>Faith Ekstrand, Intel</li> * <li>Jeff Bolz, NVIDIA</li> * <li>Jesse Hall, Google</li> * <li>Philip Rebohle, Valve Corporation</li> * <li>Stuart Smith, Imagination Technologies</li> * <li>Tobias Hector, AMD</li> * </ul></dd> * </dl> */ public class EXTExtendedDynamicState { /** The extension specification version. */ public static final int VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME = "VK_EXT_extended_dynamic_state"; /** Extends {@code VkStructureType}. */ public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000; /** * Extends {@code VkDynamicState}. * * <h5>Enum values:</h5> * * <ul> * <li>{@link #VK_DYNAMIC_STATE_CULL_MODE_EXT DYNAMIC_STATE_CULL_MODE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_FRONT_FACE_EXT DYNAMIC_STATE_FRONT_FACE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_OP_EXT DYNAMIC_STATE_STENCIL_OP_EXT}</li> * </ul> */ public static final int VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011; protected EXTExtendedDynamicState() { throw new UnsupportedOperationException(); } // --- [ vkCmdSetCullModeEXT ] --- /** * See {@link VK13#vkCmdSetCullMode CmdSetCullMode}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param cullMode specifies the cull mode property to use for drawing. */ public static void vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, @NativeType("VkCullModeFlags") int cullMode) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetCullModeEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), cullMode, __functionAddress); } // --- [ vkCmdSetFrontFaceEXT ] --- /** * See {@link VK13#vkCmdSetFrontFace CmdSetFrontFace}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param frontFace a {@code VkFrontFace} value specifying the front-facing triangle orientation to be used for culling. */ public static void vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, @NativeType("VkFrontFace") int frontFace) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetFrontFaceEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), frontFace, __functionAddress); } // --- [ vkCmdSetPrimitiveTopologyEXT ] --- /** * See {@link VK13#vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param primitiveTopology specifies the primitive topology to use for drawing. */ public static void vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, @NativeType("VkPrimitiveTopology") int primitiveTopology) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetPrimitiveTopologyEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), primitiveTopology, __functionAddress); } // --- [ vkCmdSetViewportWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetViewportWithCountEXT CmdSetViewportWithCountEXT} * * @param viewportCount specifies the viewport count. */ public static void nvkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, int viewportCount, long pViewports) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetViewportWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), viewportCount, pViewports, __functionAddress); } /** * See {@link VK13#vkCmdSetViewportWithCount CmdSetViewportWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pViewports specifies the viewports to use for drawing. */ public static void vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkViewport const *") VkViewport.Buffer pViewports) { nvkCmdSetViewportWithCountEXT(commandBuffer, pViewports.remaining(), pViewports.address()); } // --- [ vkCmdSetScissorWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetScissorWithCountEXT CmdSetScissorWithCountEXT} * * @param scissorCount specifies the scissor count. */ public static void nvkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, int scissorCount, long pScissors) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetScissorWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), scissorCount, pScissors, __functionAddress); } /** * See {@link VK13#vkCmdSetScissorWithCount CmdSetScissorWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pScissors specifies the scissors to use for drawing. */ public static void vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkRect2D const *") VkRect2D.Buffer pScissors) { nvkCmdSetScissorWithCountEXT(commandBuffer, pScissors.remaining(), pScissors.address()); } // --- [ vkCmdBindVertexBuffers2EXT ] --- /** * Unsafe version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} * * @param bindingCount the number of vertex input bindings whose state is updated by the command. */ public static void nvkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, int firstBinding, int bindingCount, long pBuffers, long pOffsets, long pSizes, long pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); } callPPPPPV(commandBuffer.address(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } /** * See {@link VK13#vkCmdBindVertexBuffers2 CmdBindVertexBuffers2}. * * @param commandBuffer the command buffer into which the command is recorded. * @param firstBinding the index of the first vertex input binding whose state is updated by the command. * @param pBuffers a pointer to an array of buffer handles. * @param pOffsets a pointer to an array of buffer offsets. * @param pSizes {@code NULL} or a pointer to an array of the size in bytes of vertex data bound from {@code pBuffers}. * @param pStrides {@code NULL} or a pointer to an array of buffer strides. */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") LongBuffer pBuffers, @NativeType("VkDeviceSize const *") LongBuffer pOffsets, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pSizes, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pStrides) { if (CHECKS) { check(pOffsets, pBuffers.remaining()); checkSafe(pSizes, pBuffers.remaining()); checkSafe(pStrides, pBuffers.remaining()); } nvkCmdBindVertexBuffers2EXT(commandBuffer, firstBinding, pBuffers.remaining(), memAddress(pBuffers), memAddress(pOffsets), memAddressSafe(pSizes), memAddressSafe(pStrides)); } // --- [ vkCmdSetDepthTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthTestEnable CmdSetDepthTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthTestEnable specifies if the depth test is enabled. */ public static void vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthWriteEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthWriteEnable specifies if depth writes are enabled. */ public static void vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthWriteEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthWriteEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthWriteEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthCompareOpEXT ] --- /** * See {@link VK13#vkCmdSetDepthCompareOp CmdSetDepthCompareOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthCompareOp a {@code VkCompareOp} value specifying the comparison operator used for the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth-comparison">Depth Comparison</a> step of the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth">depth test</a>. */ public static void vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkCompareOp") int depthCompareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthCompareOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthCompareOp, __functionAddress); } // --- [ vkCmdSetDepthBoundsTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthBoundsTestEnable CmdSetDepthBoundsTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthBoundsTestEnable specifies if the depth bounds test is enabled. */ public static void vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthBoundsTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthBoundsTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthBoundsTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetStencilTestEnable CmdSetStencilTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param stencilTestEnable specifies if the stencil test is enabled. */ public static void vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean stencilTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), stencilTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilOpEXT ] --- /** * See {@link VK13#vkCmdSetStencilOp CmdSetStencilOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param faceMask a bitmask of {@code VkStencilFaceFlagBits} specifying the set of stencil state for which to update the stencil operation. * @param failOp a {@code VkStencilOp} value specifying the action performed on samples that fail the stencil test. * @param passOp a {@code VkStencilOp} value specifying the action performed on samples that pass both the depth and stencil tests. * @param depthFailOp a {@code VkStencilOp} value specifying the action performed on samples that pass the stencil test and fail the depth test. * @param compareOp a {@code VkCompareOp} value specifying the comparison operator used in the stencil test. */ public static void vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkStencilFaceFlags") int faceMask, @NativeType("VkStencilOp") int failOp, @NativeType("VkStencilOp") int passOp, @NativeType("VkStencilOp") int depthFailOp, @NativeType("VkCompareOp") int compareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), faceMask, failOp, passOp, depthFailOp, compareOp, __functionAddress); } /** Array version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") long[] pBuffers, @NativeType("VkDeviceSize const *") long[] pOffsets, @Nullable @NativeType("VkDeviceSize const *") long[] pSizes, @Nullable @NativeType("VkDeviceSize const *") long[] pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); check(pOffsets, pBuffers.length); checkSafe(pSizes, pBuffers.length); checkSafe(pStrides, pBuffers.length); } callPPPPPV(commandBuffer.address(), firstBinding, pBuffers.length, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } }
LWJGL/lwjgl3
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/EXTExtendedDynamicState.java
5,137
// --- [ vkCmdSetStencilOpEXT ] ---
line_comment
nl
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryUtil.*; /** * This extension adds some more dynamic state to support applications that need to reduce the number of pipeline state objects they compile and bind. * * <h5>Promotion to Vulkan 1.3</h5> * * <p>This extension has been partially promoted. All dynamic state enumerants and entry points in this extension are included in core Vulkan 1.3, with the EXT suffix omitted. The feature structure is not promoted. Extension interfaces that were promoted remain available as aliases of the core functionality.</p> * * <dl> * <dt><b>Name String</b></dt> * <dd>{@code VK_EXT_extended_dynamic_state}</dd> * <dt><b>Extension Type</b></dt> * <dd>Device extension</dd> * <dt><b>Registered Extension Number</b></dt> * <dd>268</dd> * <dt><b>Revision</b></dt> * <dd>1</dd> * <dt><b>Extension and Version Dependencies</b></dt> * <dd>{@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2} or <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.1">Version 1.1</a></dd> * <dt><b>Deprecation State</b></dt> * <dd><ul> * <li><em>Promoted</em> to <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#versions-1.3-promotions">Vulkan 1.3</a></li> * </ul></dd> * <dt><b>Contact</b></dt> * <dd><ul> * <li>Piers Daniell <a href="https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_extended_dynamic_state]%20@pdaniell-nv%250A*Here%20describe%20the%20issue%20or%20question%20you%20have%20about%20the%20VK_EXT_extended_dynamic_state%20extension*">pdaniell-nv</a></li> * </ul></dd> * </dl> * * <h5>Other Extension Metadata</h5> * * <dl> * <dt><b>Last Modified Date</b></dt> * <dd>2019-12-09</dd> * <dt><b>IP Status</b></dt> * <dd>No known IP claims.</dd> * <dt><b>Contributors</b></dt> * <dd><ul> * <li>Dan Ginsburg, Valve Corporation</li> * <li>Graeme Leese, Broadcom</li> * <li>Hans-Kristian Arntzen, Valve Corporation</li> * <li>Jan-Harald Fredriksen, Arm Limited</li> * <li>Faith Ekstrand, Intel</li> * <li>Jeff Bolz, NVIDIA</li> * <li>Jesse Hall, Google</li> * <li>Philip Rebohle, Valve Corporation</li> * <li>Stuart Smith, Imagination Technologies</li> * <li>Tobias Hector, AMD</li> * </ul></dd> * </dl> */ public class EXTExtendedDynamicState { /** The extension specification version. */ public static final int VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME = "VK_EXT_extended_dynamic_state"; /** Extends {@code VkStructureType}. */ public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000; /** * Extends {@code VkDynamicState}. * * <h5>Enum values:</h5> * * <ul> * <li>{@link #VK_DYNAMIC_STATE_CULL_MODE_EXT DYNAMIC_STATE_CULL_MODE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_FRONT_FACE_EXT DYNAMIC_STATE_FRONT_FACE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT}</li> * <li>{@link #VK_DYNAMIC_STATE_STENCIL_OP_EXT DYNAMIC_STATE_STENCIL_OP_EXT}</li> * </ul> */ public static final int VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011; protected EXTExtendedDynamicState() { throw new UnsupportedOperationException(); } // --- [ vkCmdSetCullModeEXT ] --- /** * See {@link VK13#vkCmdSetCullMode CmdSetCullMode}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param cullMode specifies the cull mode property to use for drawing. */ public static void vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, @NativeType("VkCullModeFlags") int cullMode) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetCullModeEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), cullMode, __functionAddress); } // --- [ vkCmdSetFrontFaceEXT ] --- /** * See {@link VK13#vkCmdSetFrontFace CmdSetFrontFace}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param frontFace a {@code VkFrontFace} value specifying the front-facing triangle orientation to be used for culling. */ public static void vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, @NativeType("VkFrontFace") int frontFace) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetFrontFaceEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), frontFace, __functionAddress); } // --- [ vkCmdSetPrimitiveTopologyEXT ] --- /** * See {@link VK13#vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param primitiveTopology specifies the primitive topology to use for drawing. */ public static void vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, @NativeType("VkPrimitiveTopology") int primitiveTopology) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetPrimitiveTopologyEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), primitiveTopology, __functionAddress); } // --- [ vkCmdSetViewportWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetViewportWithCountEXT CmdSetViewportWithCountEXT} * * @param viewportCount specifies the viewport count. */ public static void nvkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, int viewportCount, long pViewports) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetViewportWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), viewportCount, pViewports, __functionAddress); } /** * See {@link VK13#vkCmdSetViewportWithCount CmdSetViewportWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pViewports specifies the viewports to use for drawing. */ public static void vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkViewport const *") VkViewport.Buffer pViewports) { nvkCmdSetViewportWithCountEXT(commandBuffer, pViewports.remaining(), pViewports.address()); } // --- [ vkCmdSetScissorWithCountEXT ] --- /** * Unsafe version of: {@link #vkCmdSetScissorWithCountEXT CmdSetScissorWithCountEXT} * * @param scissorCount specifies the scissor count. */ public static void nvkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, int scissorCount, long pScissors) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetScissorWithCountEXT; if (CHECKS) { check(__functionAddress); } callPPV(commandBuffer.address(), scissorCount, pScissors, __functionAddress); } /** * See {@link VK13#vkCmdSetScissorWithCount CmdSetScissorWithCount}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param pScissors specifies the scissors to use for drawing. */ public static void vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, @NativeType("VkRect2D const *") VkRect2D.Buffer pScissors) { nvkCmdSetScissorWithCountEXT(commandBuffer, pScissors.remaining(), pScissors.address()); } // --- [ vkCmdBindVertexBuffers2EXT ] --- /** * Unsafe version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} * * @param bindingCount the number of vertex input bindings whose state is updated by the command. */ public static void nvkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, int firstBinding, int bindingCount, long pBuffers, long pOffsets, long pSizes, long pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); } callPPPPPV(commandBuffer.address(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } /** * See {@link VK13#vkCmdBindVertexBuffers2 CmdBindVertexBuffers2}. * * @param commandBuffer the command buffer into which the command is recorded. * @param firstBinding the index of the first vertex input binding whose state is updated by the command. * @param pBuffers a pointer to an array of buffer handles. * @param pOffsets a pointer to an array of buffer offsets. * @param pSizes {@code NULL} or a pointer to an array of the size in bytes of vertex data bound from {@code pBuffers}. * @param pStrides {@code NULL} or a pointer to an array of buffer strides. */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") LongBuffer pBuffers, @NativeType("VkDeviceSize const *") LongBuffer pOffsets, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pSizes, @Nullable @NativeType("VkDeviceSize const *") LongBuffer pStrides) { if (CHECKS) { check(pOffsets, pBuffers.remaining()); checkSafe(pSizes, pBuffers.remaining()); checkSafe(pStrides, pBuffers.remaining()); } nvkCmdBindVertexBuffers2EXT(commandBuffer, firstBinding, pBuffers.remaining(), memAddress(pBuffers), memAddress(pOffsets), memAddressSafe(pSizes), memAddressSafe(pStrides)); } // --- [ vkCmdSetDepthTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthTestEnable CmdSetDepthTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthTestEnable specifies if the depth test is enabled. */ public static void vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthWriteEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthWriteEnable specifies if depth writes are enabled. */ public static void vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthWriteEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthWriteEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthWriteEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetDepthCompareOpEXT ] --- /** * See {@link VK13#vkCmdSetDepthCompareOp CmdSetDepthCompareOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthCompareOp a {@code VkCompareOp} value specifying the comparison operator used for the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth-comparison">Depth Comparison</a> step of the <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-depth">depth test</a>. */ public static void vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkCompareOp") int depthCompareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthCompareOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthCompareOp, __functionAddress); } // --- [ vkCmdSetDepthBoundsTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetDepthBoundsTestEnable CmdSetDepthBoundsTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param depthBoundsTestEnable specifies if the depth bounds test is enabled. */ public static void vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean depthBoundsTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetDepthBoundsTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), depthBoundsTestEnable ? 1 : 0, __functionAddress); } // --- [ vkCmdSetStencilTestEnableEXT ] --- /** * See {@link VK13#vkCmdSetStencilTestEnable CmdSetStencilTestEnable}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param stencilTestEnable specifies if the stencil test is enabled. */ public static void vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, @NativeType("VkBool32") boolean stencilTestEnable) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilTestEnableEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), stencilTestEnable ? 1 : 0, __functionAddress); } // --- [<SUF> /** * See {@link VK13#vkCmdSetStencilOp CmdSetStencilOp}. * * @param commandBuffer the command buffer into which the command will be recorded. * @param faceMask a bitmask of {@code VkStencilFaceFlagBits} specifying the set of stencil state for which to update the stencil operation. * @param failOp a {@code VkStencilOp} value specifying the action performed on samples that fail the stencil test. * @param passOp a {@code VkStencilOp} value specifying the action performed on samples that pass both the depth and stencil tests. * @param depthFailOp a {@code VkStencilOp} value specifying the action performed on samples that pass the stencil test and fail the depth test. * @param compareOp a {@code VkCompareOp} value specifying the comparison operator used in the stencil test. */ public static void vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, @NativeType("VkStencilFaceFlags") int faceMask, @NativeType("VkStencilOp") int failOp, @NativeType("VkStencilOp") int passOp, @NativeType("VkStencilOp") int depthFailOp, @NativeType("VkCompareOp") int compareOp) { long __functionAddress = commandBuffer.getCapabilities().vkCmdSetStencilOpEXT; if (CHECKS) { check(__functionAddress); } callPV(commandBuffer.address(), faceMask, failOp, passOp, depthFailOp, compareOp, __functionAddress); } /** Array version of: {@link #vkCmdBindVertexBuffers2EXT CmdBindVertexBuffers2EXT} */ public static void vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, @NativeType("uint32_t") int firstBinding, @NativeType("VkBuffer const *") long[] pBuffers, @NativeType("VkDeviceSize const *") long[] pOffsets, @Nullable @NativeType("VkDeviceSize const *") long[] pSizes, @Nullable @NativeType("VkDeviceSize const *") long[] pStrides) { long __functionAddress = commandBuffer.getCapabilities().vkCmdBindVertexBuffers2EXT; if (CHECKS) { check(__functionAddress); check(pOffsets, pBuffers.length); checkSafe(pSizes, pBuffers.length); checkSafe(pStrides, pBuffers.length); } callPPPPPV(commandBuffer.address(), firstBinding, pBuffers.length, pBuffers, pOffsets, pSizes, pStrides, __functionAddress); } }
214161_2
/* * Copyright (C) 2008 The Guava Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.common.collect; import static com.google.common.base.Preconditions.checkPositionIndex; import static com.google.common.collect.CollectPreconditions.checkEntryNotNull; import static com.google.common.collect.ImmutableMapEntry.createEntryArray; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableMapEntry.NonTerminalImmutableMapEntry; import javax.annotation.Nullable; /** * Implementation of {@link ImmutableMap} with two or more entries. * * @author Jesse Wilson * @author Kevin Bourrillion * @author Gregory Kick */ @GwtCompatible(serializable = true, emulated = true) final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { // entries in insertion order private final transient Entry<K, V>[] entries; // array of linked lists of entries private final transient ImmutableMapEntry<K, V>[] table; // 'and' with an int to get a table index private final transient int mask; static <K, V> RegularImmutableMap<K, V> fromEntries(Entry<K, V>... entries) { return fromEntryArray(entries.length, entries); } /** * Creates a RegularImmutableMap from the first n entries in entryArray. This implementation * may replace the entries in entryArray with its own entry objects (though they will have the * same key/value contents), and may take ownership of entryArray. */ static <K, V> RegularImmutableMap<K, V> fromEntryArray(int n, Entry<K, V>[] entryArray) { checkPositionIndex(n, entryArray.length); Entry<K, V>[] entries; if (n == entryArray.length) { entries = entryArray; } else { entries = createEntryArray(n); } int tableSize = Hashing.closedTableSize(n, MAX_LOAD_FACTOR); ImmutableMapEntry<K, V>[] table = createEntryArray(tableSize); int mask = tableSize - 1; for (int entryIndex = 0; entryIndex < n; entryIndex++) { Entry<K, V> entry = entryArray[entryIndex]; K key = entry.getKey(); V value = entry.getValue(); checkEntryNotNull(key, value); int tableIndex = Hashing.smear(key.hashCode()) & mask; @Nullable ImmutableMapEntry<K, V> existing = table[tableIndex]; // prepend, not append, so the entries can be immutable ImmutableMapEntry<K, V> newEntry; if (existing == null) { boolean reusable = entry instanceof ImmutableMapEntry && ((ImmutableMapEntry<K, V>) entry).isReusable(); newEntry = reusable ? (ImmutableMapEntry<K, V>) entry : new ImmutableMapEntry<K, V>(key, value); } else { newEntry = new NonTerminalImmutableMapEntry<K, V>(key, value, existing); } table[tableIndex] = newEntry; entries[entryIndex] = newEntry; checkNoConflictInKeyBucket(key, newEntry, existing); } return new RegularImmutableMap<K, V>(entries, table, mask); } private RegularImmutableMap(Entry<K, V>[] entries, ImmutableMapEntry<K, V>[] table, int mask) { this.entries = entries; this.table = table; this.mask = mask; } static void checkNoConflictInKeyBucket(Object key, Entry<?, ?> entry, @Nullable ImmutableMapEntry<?, ?> keyBucketHead) { for (; keyBucketHead != null; keyBucketHead = keyBucketHead.getNextInKeyBucket()) { checkNoConflict(!key.equals(keyBucketHead.getKey()), "key", entry, keyBucketHead); } } /** * Closed addressing tends to perform well even with high load factors. * Being conservative here ensures that the table is still likely to be * relatively sparse (hence it misses fast) while saving space. */ private static final double MAX_LOAD_FACTOR = 1.2; @Override public V get(@Nullable Object key) { return get(key, table, mask); } @Nullable static <V> V get(@Nullable Object key, ImmutableMapEntry<?, V>[] keyTable, int mask) { if (key == null) { return null; } int index = Hashing.smear(key.hashCode()) & mask; for (ImmutableMapEntry<?, V> entry = keyTable[index]; entry != null; entry = entry.getNextInKeyBucket()) { Object candidateKey = entry.getKey(); /* * Assume that equals uses the == optimization when appropriate, and that * it would check hash codes as an optimization when appropriate. If we * did these things, it would just make things worse for the most * performance-conscious users. */ if (key.equals(candidateKey)) { return entry.getValue(); } } return null; } @Override public int size() { return entries.length; } @Override boolean isPartialView() { return false; } @Override ImmutableSet<Entry<K, V>> createEntrySet() { return new ImmutableMapEntrySet.RegularEntrySet<K, V>(this, entries); } // This class is never actually serialized directly, but we have to make the // warning go away (and suppressing would suppress for all nested classes too) private static final long serialVersionUID = 0; }
antlr/codebuff
output/java_guava/1.4.18/RegularImmutableMap.java
1,515
// entries in insertion order
line_comment
nl
/* * Copyright (C) 2008 The Guava Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.common.collect; import static com.google.common.base.Preconditions.checkPositionIndex; import static com.google.common.collect.CollectPreconditions.checkEntryNotNull; import static com.google.common.collect.ImmutableMapEntry.createEntryArray; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableMapEntry.NonTerminalImmutableMapEntry; import javax.annotation.Nullable; /** * Implementation of {@link ImmutableMap} with two or more entries. * * @author Jesse Wilson * @author Kevin Bourrillion * @author Gregory Kick */ @GwtCompatible(serializable = true, emulated = true) final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { // entries in<SUF> private final transient Entry<K, V>[] entries; // array of linked lists of entries private final transient ImmutableMapEntry<K, V>[] table; // 'and' with an int to get a table index private final transient int mask; static <K, V> RegularImmutableMap<K, V> fromEntries(Entry<K, V>... entries) { return fromEntryArray(entries.length, entries); } /** * Creates a RegularImmutableMap from the first n entries in entryArray. This implementation * may replace the entries in entryArray with its own entry objects (though they will have the * same key/value contents), and may take ownership of entryArray. */ static <K, V> RegularImmutableMap<K, V> fromEntryArray(int n, Entry<K, V>[] entryArray) { checkPositionIndex(n, entryArray.length); Entry<K, V>[] entries; if (n == entryArray.length) { entries = entryArray; } else { entries = createEntryArray(n); } int tableSize = Hashing.closedTableSize(n, MAX_LOAD_FACTOR); ImmutableMapEntry<K, V>[] table = createEntryArray(tableSize); int mask = tableSize - 1; for (int entryIndex = 0; entryIndex < n; entryIndex++) { Entry<K, V> entry = entryArray[entryIndex]; K key = entry.getKey(); V value = entry.getValue(); checkEntryNotNull(key, value); int tableIndex = Hashing.smear(key.hashCode()) & mask; @Nullable ImmutableMapEntry<K, V> existing = table[tableIndex]; // prepend, not append, so the entries can be immutable ImmutableMapEntry<K, V> newEntry; if (existing == null) { boolean reusable = entry instanceof ImmutableMapEntry && ((ImmutableMapEntry<K, V>) entry).isReusable(); newEntry = reusable ? (ImmutableMapEntry<K, V>) entry : new ImmutableMapEntry<K, V>(key, value); } else { newEntry = new NonTerminalImmutableMapEntry<K, V>(key, value, existing); } table[tableIndex] = newEntry; entries[entryIndex] = newEntry; checkNoConflictInKeyBucket(key, newEntry, existing); } return new RegularImmutableMap<K, V>(entries, table, mask); } private RegularImmutableMap(Entry<K, V>[] entries, ImmutableMapEntry<K, V>[] table, int mask) { this.entries = entries; this.table = table; this.mask = mask; } static void checkNoConflictInKeyBucket(Object key, Entry<?, ?> entry, @Nullable ImmutableMapEntry<?, ?> keyBucketHead) { for (; keyBucketHead != null; keyBucketHead = keyBucketHead.getNextInKeyBucket()) { checkNoConflict(!key.equals(keyBucketHead.getKey()), "key", entry, keyBucketHead); } } /** * Closed addressing tends to perform well even with high load factors. * Being conservative here ensures that the table is still likely to be * relatively sparse (hence it misses fast) while saving space. */ private static final double MAX_LOAD_FACTOR = 1.2; @Override public V get(@Nullable Object key) { return get(key, table, mask); } @Nullable static <V> V get(@Nullable Object key, ImmutableMapEntry<?, V>[] keyTable, int mask) { if (key == null) { return null; } int index = Hashing.smear(key.hashCode()) & mask; for (ImmutableMapEntry<?, V> entry = keyTable[index]; entry != null; entry = entry.getNextInKeyBucket()) { Object candidateKey = entry.getKey(); /* * Assume that equals uses the == optimization when appropriate, and that * it would check hash codes as an optimization when appropriate. If we * did these things, it would just make things worse for the most * performance-conscious users. */ if (key.equals(candidateKey)) { return entry.getValue(); } } return null; } @Override public int size() { return entries.length; } @Override boolean isPartialView() { return false; } @Override ImmutableSet<Entry<K, V>> createEntrySet() { return new ImmutableMapEntrySet.RegularEntrySet<K, V>(this, entries); } // This class is never actually serialized directly, but we have to make the // warning go away (and suppressing would suppress for all nested classes too) private static final long serialVersionUID = 0; }
214198_1
import be.kdg.seizoenen.*; import java.util.Random; /** * @author Kristiaan Behiels * @version 1.0 21/10/13 */ public class TestSeizoenen { public static void main(String[] args) { Seizoen[] seizoenen = { new Lente(), new Zomer(), new Herfst(), new Winter() }; for (Seizoen seizoen : seizoenen) { System.out.println(seizoen.getBegin()); } System.out.println(); System.out.println("Random:"); Random random = new Random(); for (Seizoen seizoen : seizoenen) { int index = random.nextInt(4); System.out.println(seizoenen[index].getBegin()); } } } /* In 2014 begint de lente op 20 maart In 2014 begint de zomer op 21 juni In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december Random: In 2014 begint de lente op 20 maart In 2014 begint de herfst op 23 september In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december */
gvdhaege/KdG
Java Programming/Deel 2/W1 - Overerving/Oefeningen/Oplossingen/Seizoenen/src/TestSeizoenen.java
334
/* In 2014 begint de lente op 20 maart In 2014 begint de zomer op 21 juni In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december Random: In 2014 begint de lente op 20 maart In 2014 begint de herfst op 23 september In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december */
block_comment
nl
import be.kdg.seizoenen.*; import java.util.Random; /** * @author Kristiaan Behiels * @version 1.0 21/10/13 */ public class TestSeizoenen { public static void main(String[] args) { Seizoen[] seizoenen = { new Lente(), new Zomer(), new Herfst(), new Winter() }; for (Seizoen seizoen : seizoenen) { System.out.println(seizoen.getBegin()); } System.out.println(); System.out.println("Random:"); Random random = new Random(); for (Seizoen seizoen : seizoenen) { int index = random.nextInt(4); System.out.println(seizoenen[index].getBegin()); } } } /* In 2014 begint<SUF>*/
214200_1
package be.kdg; import be.kdg.seizoenen.*; import java.util.Random; /** * @author Kristiaan Behiels * @version 1.0 21/10/13 */ public class TestSeizoenen { public static void main(String[] args) { Seizoen[] seizoenen = { new Lente(), new Zomer(), new Herfst(), new Winter() }; for (Seizoen seizoen : seizoenen) { System.out.println(seizoen.getBegin()); } System.out.println(); System.out.println("Random:"); Random random = new Random(); for (Seizoen seizoen : seizoenen) { int index = random.nextInt(4); System.out.println(seizoenen[index].getBegin()); } } } /* In 2014 begint de lente op 20 maart In 2014 begint de zomer op 21 juni In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december Random: In 2014 begint de lente op 20 maart In 2014 begint de herfst op 23 september In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december */
gvdhaege/KdG
Java Programming/Deel 2/W1 - Overerving/Oefeningen/Oplossingen/Seizoenen/src/be/kdg/TestSeizoenen.java
341
/* In 2014 begint de lente op 20 maart In 2014 begint de zomer op 21 juni In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december Random: In 2014 begint de lente op 20 maart In 2014 begint de herfst op 23 september In 2014 begint de herfst op 23 september In 2014 begint de winter op 21 december */
block_comment
nl
package be.kdg; import be.kdg.seizoenen.*; import java.util.Random; /** * @author Kristiaan Behiels * @version 1.0 21/10/13 */ public class TestSeizoenen { public static void main(String[] args) { Seizoen[] seizoenen = { new Lente(), new Zomer(), new Herfst(), new Winter() }; for (Seizoen seizoen : seizoenen) { System.out.println(seizoen.getBegin()); } System.out.println(); System.out.println("Random:"); Random random = new Random(); for (Seizoen seizoen : seizoenen) { int index = random.nextInt(4); System.out.println(seizoenen[index].getBegin()); } } } /* In 2014 begint<SUF>*/
214217_0
package com.lijf.bigdata; import com.lijf.bigdata.common.combine.CombineFile; import com.lijf.bigdata.common.combine.dto.FileCombineDto; import com.lijf.bigdata.common.combine.factory.FileCombineFactory; import org.apache.spark.sql.SparkSession; import java.io.IOException; /** * @author lijf * @date 2019/8/21 16:03 * @desc */ public class Main { public static void main(String[] args) throws IOException { SparkSession spark = getSparkSession(); FileCombineDto fileCombineDto = new FileCombineDto(); //最终的合并文件数 fileCombineDto.setPartNum(8); // 要合并的目录 fileCombineDto.setFileDir("/apps/hive/warehouse/mlg.db/tb_browser_user_action_20190823/dt=2019-08-21"); // 文件格式 fileCombineDto.setType("text"); CombineFile combine = FileCombineFactory.getCombine(fileCombineDto); combine.combine(fileCombineDto, spark); } private static SparkSession getSparkSession() { return SparkSession .builder() .master("local[2]") .appName(Main.class.getSimpleName()) .enableHiveSupport() .getOrCreate(); } }
lijufeng2016/bigdata-tools
src/main/java/com/lijf/bigdata/Main.java
345
/** * @author lijf * @date 2019/8/21 16:03 * @desc */
block_comment
nl
package com.lijf.bigdata; import com.lijf.bigdata.common.combine.CombineFile; import com.lijf.bigdata.common.combine.dto.FileCombineDto; import com.lijf.bigdata.common.combine.factory.FileCombineFactory; import org.apache.spark.sql.SparkSession; import java.io.IOException; /** * @author lijf <SUF>*/ public class Main { public static void main(String[] args) throws IOException { SparkSession spark = getSparkSession(); FileCombineDto fileCombineDto = new FileCombineDto(); //最终的合并文件数 fileCombineDto.setPartNum(8); // 要合并的目录 fileCombineDto.setFileDir("/apps/hive/warehouse/mlg.db/tb_browser_user_action_20190823/dt=2019-08-21"); // 文件格式 fileCombineDto.setType("text"); CombineFile combine = FileCombineFactory.getCombine(fileCombineDto); combine.combine(fileCombineDto, spark); } private static SparkSession getSparkSession() { return SparkSession .builder() .master("local[2]") .appName(Main.class.getSimpleName()) .enableHiveSupport() .getOrCreate(); } }
214248_0
package nl.topicus.eduarte.web.components.panels.datapanel.table; import nl.topicus.cobra.web.components.datapanel.CustomDataPanelContentDescription; import nl.topicus.cobra.web.components.datapanel.columns.CustomPropertyColumn; import nl.topicus.eduarte.entities.landelijk.Verblijfsvergunning; /** * Tabel met de mogelijke kolommen voor verblijfsvergunningen. * * @author schimmel */ public class VerblijfsvergunningTable extends CustomDataPanelContentDescription<Verblijfsvergunning> { private static final long serialVersionUID = 1L; public VerblijfsvergunningTable() { super("Verblijfsvergunningen"); createColumns(); } private void createColumns() { addColumn(new CustomPropertyColumn<Verblijfsvergunning>("Code", "Code", "code", "code")); addColumn(new CustomPropertyColumn<Verblijfsvergunning>("Naam", "Naam", "naam", "naam")); } }
topicusonderwijs/tribe-krd-opensource
eduarte/core/src/main/java/nl/topicus/eduarte/web/components/panels/datapanel/table/VerblijfsvergunningTable.java
275
/** * Tabel met de mogelijke kolommen voor verblijfsvergunningen. * * @author schimmel */
block_comment
nl
package nl.topicus.eduarte.web.components.panels.datapanel.table; import nl.topicus.cobra.web.components.datapanel.CustomDataPanelContentDescription; import nl.topicus.cobra.web.components.datapanel.columns.CustomPropertyColumn; import nl.topicus.eduarte.entities.landelijk.Verblijfsvergunning; /** * Tabel met de<SUF>*/ public class VerblijfsvergunningTable extends CustomDataPanelContentDescription<Verblijfsvergunning> { private static final long serialVersionUID = 1L; public VerblijfsvergunningTable() { super("Verblijfsvergunningen"); createColumns(); } private void createColumns() { addColumn(new CustomPropertyColumn<Verblijfsvergunning>("Code", "Code", "code", "code")); addColumn(new CustomPropertyColumn<Verblijfsvergunning>("Naam", "Naam", "naam", "naam")); } }
214257_1
/* * SPDX-FileCopyrightText: 2022 Atos * SPDX-License-Identifier: EUPL-1.2+ */ package net.atos.zac.app.klanten.converter; import static net.atos.zac.app.klanten.model.personen.RESTPersonenParameters.Cardinaliteit.NON; import static net.atos.zac.app.klanten.model.personen.RESTPersonenParameters.Cardinaliteit.OPT; import static net.atos.zac.app.klanten.model.personen.RESTPersonenParameters.Cardinaliteit.REQ; import static net.atos.zac.util.StringUtil.NON_BREAKING_SPACE; import static net.atos.zac.util.StringUtil.ONBEKEND; import static net.atos.zac.util.StringUtil.joinNonBlankWith; import static org.apache.commons.lang3.StringUtils.SPACE; import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.replace; import java.util.Collections; import java.util.List; import java.util.Objects; import net.atos.client.brp.model.AbstractDatum; import net.atos.client.brp.model.AbstractVerblijfplaats; import net.atos.client.brp.model.Adres; import net.atos.client.brp.model.AdresseringBeperkt; import net.atos.client.brp.model.DatumOnbekend; import net.atos.client.brp.model.JaarDatum; import net.atos.client.brp.model.JaarMaandDatum; import net.atos.client.brp.model.PersonenQuery; import net.atos.client.brp.model.PersonenQueryResponse; import net.atos.client.brp.model.Persoon; import net.atos.client.brp.model.PersoonBeperkt; import net.atos.client.brp.model.RaadpleegMetBurgerservicenummer; import net.atos.client.brp.model.RaadpleegMetBurgerservicenummerResponse; import net.atos.client.brp.model.VerblijfadresBinnenland; import net.atos.client.brp.model.VerblijfadresBuitenland; import net.atos.client.brp.model.VerblijfplaatsBuitenland; import net.atos.client.brp.model.VerblijfplaatsOnbekend; import net.atos.client.brp.model.VolledigeDatum; import net.atos.client.brp.model.Waardetabel; import net.atos.client.brp.model.ZoekMetGeslachtsnaamEnGeboortedatum; import net.atos.client.brp.model.ZoekMetGeslachtsnaamEnGeboortedatumResponse; import net.atos.client.brp.model.ZoekMetNaamEnGemeenteVanInschrijving; import net.atos.client.brp.model.ZoekMetNaamEnGemeenteVanInschrijvingResponse; import net.atos.client.brp.model.ZoekMetNummeraanduidingIdentificatieResponse; import net.atos.client.brp.model.ZoekMetPostcodeEnHuisnummer; import net.atos.client.brp.model.ZoekMetPostcodeEnHuisnummerResponse; import net.atos.client.brp.model.ZoekMetStraatHuisnummerEnGemeenteVanInschrijving; import net.atos.client.brp.model.ZoekMetStraatHuisnummerEnGemeenteVanInschrijvingResponse; import net.atos.zac.app.klanten.model.personen.RESTListPersonenParameters; import net.atos.zac.app.klanten.model.personen.RESTPersonenParameters; import net.atos.zac.app.klanten.model.personen.RESTPersoon; public class RESTPersoonConverter { // Moet overeenkomen met wat er in convertToPersonenQuery gebeurt. public static final List<RESTPersonenParameters> VALID_PERSONEN_QUERIES = List.of( new RESTPersonenParameters(REQ, NON, NON, NON, NON, NON, NON, NON, NON), new RESTPersonenParameters(NON, REQ, OPT, OPT, REQ, NON, NON, NON, NON), new RESTPersonenParameters(NON, REQ, REQ, OPT, NON, REQ, NON, NON, NON), new RESTPersonenParameters(NON, NON, NON, NON, NON, NON, REQ, REQ, NON), new RESTPersonenParameters(NON, NON, NON, NON, NON, REQ, NON, REQ, REQ) ); public List<RESTPersoon> convertPersonen(final List<Persoon> personen) { return personen.stream().map(this::convertPersoon).toList(); } public List<RESTPersoon> convertPersonenBeperkt(final List<PersoonBeperkt> personen) { return personen.stream().map(this::convertPersoonBeperkt).toList(); } public RESTPersoon convertPersoon(final Persoon persoon) { final RESTPersoon restPersoon = new RESTPersoon(); restPersoon.bsn = persoon.getBurgerservicenummer(); if (persoon.getGeslacht() != null) { restPersoon.geslacht = convertGeslacht(persoon.getGeslacht()); } if (persoon.getNaam() != null) { restPersoon.naam = persoon.getNaam().getVolledigeNaam(); } if (persoon.getGeboorte() != null) { restPersoon.geboortedatum = convertGeboortedatum(persoon.getGeboorte().getDatum()); } if (persoon.getVerblijfplaats() != null) { restPersoon.verblijfplaats = convertVerblijfplaats(persoon.getVerblijfplaats()); } return restPersoon; } public RESTPersoon convertPersoonBeperkt(final PersoonBeperkt persoon) { final RESTPersoon restPersoon = new RESTPersoon(); restPersoon.bsn = persoon.getBurgerservicenummer(); if (persoon.getGeslacht() != null) { restPersoon.geslacht = convertGeslacht(persoon.getGeslacht()); } if (persoon.getNaam() != null) { restPersoon.naam = persoon.getNaam().getVolledigeNaam(); } if (persoon.getGeboorte() != null) { restPersoon.geboortedatum = convertGeboortedatum(persoon.getGeboorte().getDatum()); } if (persoon.getAdressering() != null) { final AdresseringBeperkt adressering = persoon.getAdressering(); restPersoon.verblijfplaats = joinNonBlankWith(", ", adressering.getAdresregel1(), adressering.getAdresregel2(), adressering.getAdresregel3()); } return restPersoon; } public PersonenQuery convertToPersonenQuery(final RESTListPersonenParameters parameters) { if (isNotBlank(parameters.bsn)) { final var query = new RaadpleegMetBurgerservicenummer(); query.addBurgerservicenummerItem(parameters.bsn); return query; } if (isNotBlank(parameters.geslachtsnaam) && parameters.geboortedatum != null) { final var query = new ZoekMetGeslachtsnaamEnGeboortedatum(); query.setGeslachtsnaam(parameters.geslachtsnaam); query.setGeboortedatum(parameters.geboortedatum); query.setVoornamen(parameters.voornamen); query.setVoorvoegsel(parameters.voorvoegsel); return query; } if (isNotBlank(parameters.geslachtsnaam) && isNotBlank(parameters.voornamen) && isNotBlank(parameters.gemeenteVanInschrijving)) { final var query = new ZoekMetNaamEnGemeenteVanInschrijving(); query.setGeslachtsnaam(parameters.geslachtsnaam); query.setVoornamen(parameters.voornamen); query.setGemeenteVanInschrijving(parameters.gemeenteVanInschrijving); query.setVoorvoegsel(parameters.voorvoegsel); return query; } if (isNotBlank(parameters.postcode) && parameters.huisnummer != null) { final var query = new ZoekMetPostcodeEnHuisnummer(); query.setPostcode(parameters.postcode); query.setHuisnummer(parameters.huisnummer); return query; } if (isNotBlank(parameters.straat) && parameters.huisnummer != null && isNotBlank(parameters.gemeenteVanInschrijving)) { final var query = new ZoekMetStraatHuisnummerEnGemeenteVanInschrijving(); query.setStraat(parameters.straat); query.setHuisnummer(parameters.huisnummer); query.setGemeenteVanInschrijving(parameters.gemeenteVanInschrijving); return query; } throw new IllegalArgumentException("Ongeldige combinatie van zoek parameters"); } public List<RESTPersoon> convertFromPersonenQueryResponse(final PersonenQueryResponse personenQueryResponse) { return switch (personenQueryResponse) { case RaadpleegMetBurgerservicenummerResponse response -> convertPersonen(response.getPersonen()); case ZoekMetGeslachtsnaamEnGeboortedatumResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetNaamEnGemeenteVanInschrijvingResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetNummeraanduidingIdentificatieResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetPostcodeEnHuisnummerResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetStraatHuisnummerEnGemeenteVanInschrijvingResponse response -> convertPersonenBeperkt(response.getPersonen()); default -> Collections.emptyList(); }; } private String convertGeslacht(final Waardetabel geslacht) { return isNotBlank(geslacht.getOmschrijving()) ? geslacht.getOmschrijving() : geslacht.getCode(); } private String convertGeboortedatum(final AbstractDatum abstractDatum) { return switch (abstractDatum) { case VolledigeDatum volledigeDatum -> volledigeDatum.getDatum().toString(); case JaarMaandDatum jaarMaandDatum -> "%d2-%d4".formatted(jaarMaandDatum.getMaand(), jaarMaandDatum.getJaar()); case JaarDatum jaarDatum -> "%d4".formatted(jaarDatum.getJaar()); case DatumOnbekend datumOnbekend -> ONBEKEND; default -> null; }; } private String convertVerblijfplaats(final AbstractVerblijfplaats abstractVerblijfplaats) { return switch (abstractVerblijfplaats) { case Adres adres && adres.getVerblijfadres() != null -> convertVerblijfadresBinnenland(adres.getVerblijfadres()); case VerblijfplaatsBuitenland verblijfplaatsBuitenland && verblijfplaatsBuitenland.getVerblijfadres() != null -> convertVerblijfadresBuitenland(verblijfplaatsBuitenland.getVerblijfadres()); case VerblijfplaatsOnbekend verblijfplaatsOnbekend -> ONBEKEND; default -> null; }; } private String convertVerblijfadresBinnenland(final VerblijfadresBinnenland verblijfadresBinnenland) { final String adres = replace(joinNonBlankWith(NON_BREAKING_SPACE, verblijfadresBinnenland.getOfficieleStraatnaam(), Objects.toString(verblijfadresBinnenland.getHuisnummer(), null), verblijfadresBinnenland.getHuisnummertoevoeging(), verblijfadresBinnenland.getHuisletter()), SPACE, NON_BREAKING_SPACE); final String postcode = replace(verblijfadresBinnenland.getPostcode(), SPACE, NON_BREAKING_SPACE); final String woonplaats = replace(verblijfadresBinnenland.getWoonplaats(), SPACE, NON_BREAKING_SPACE); return joinNonBlankWith(", ", adres, postcode, woonplaats); } private String convertVerblijfadresBuitenland(VerblijfadresBuitenland verblijfadresBuitenland) { return joinNonBlankWith(", ", verblijfadresBuitenland.getRegel1(), verblijfadresBuitenland.getRegel2(), verblijfadresBuitenland.getRegel3()); } }
NL-AMS-LOCGOV/zaakafhandelcomponent
src/main/java/net/atos/zac/app/klanten/converter/RESTPersoonConverter.java
3,107
// Moet overeenkomen met wat er in convertToPersonenQuery gebeurt.
line_comment
nl
/* * SPDX-FileCopyrightText: 2022 Atos * SPDX-License-Identifier: EUPL-1.2+ */ package net.atos.zac.app.klanten.converter; import static net.atos.zac.app.klanten.model.personen.RESTPersonenParameters.Cardinaliteit.NON; import static net.atos.zac.app.klanten.model.personen.RESTPersonenParameters.Cardinaliteit.OPT; import static net.atos.zac.app.klanten.model.personen.RESTPersonenParameters.Cardinaliteit.REQ; import static net.atos.zac.util.StringUtil.NON_BREAKING_SPACE; import static net.atos.zac.util.StringUtil.ONBEKEND; import static net.atos.zac.util.StringUtil.joinNonBlankWith; import static org.apache.commons.lang3.StringUtils.SPACE; import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.replace; import java.util.Collections; import java.util.List; import java.util.Objects; import net.atos.client.brp.model.AbstractDatum; import net.atos.client.brp.model.AbstractVerblijfplaats; import net.atos.client.brp.model.Adres; import net.atos.client.brp.model.AdresseringBeperkt; import net.atos.client.brp.model.DatumOnbekend; import net.atos.client.brp.model.JaarDatum; import net.atos.client.brp.model.JaarMaandDatum; import net.atos.client.brp.model.PersonenQuery; import net.atos.client.brp.model.PersonenQueryResponse; import net.atos.client.brp.model.Persoon; import net.atos.client.brp.model.PersoonBeperkt; import net.atos.client.brp.model.RaadpleegMetBurgerservicenummer; import net.atos.client.brp.model.RaadpleegMetBurgerservicenummerResponse; import net.atos.client.brp.model.VerblijfadresBinnenland; import net.atos.client.brp.model.VerblijfadresBuitenland; import net.atos.client.brp.model.VerblijfplaatsBuitenland; import net.atos.client.brp.model.VerblijfplaatsOnbekend; import net.atos.client.brp.model.VolledigeDatum; import net.atos.client.brp.model.Waardetabel; import net.atos.client.brp.model.ZoekMetGeslachtsnaamEnGeboortedatum; import net.atos.client.brp.model.ZoekMetGeslachtsnaamEnGeboortedatumResponse; import net.atos.client.brp.model.ZoekMetNaamEnGemeenteVanInschrijving; import net.atos.client.brp.model.ZoekMetNaamEnGemeenteVanInschrijvingResponse; import net.atos.client.brp.model.ZoekMetNummeraanduidingIdentificatieResponse; import net.atos.client.brp.model.ZoekMetPostcodeEnHuisnummer; import net.atos.client.brp.model.ZoekMetPostcodeEnHuisnummerResponse; import net.atos.client.brp.model.ZoekMetStraatHuisnummerEnGemeenteVanInschrijving; import net.atos.client.brp.model.ZoekMetStraatHuisnummerEnGemeenteVanInschrijvingResponse; import net.atos.zac.app.klanten.model.personen.RESTListPersonenParameters; import net.atos.zac.app.klanten.model.personen.RESTPersonenParameters; import net.atos.zac.app.klanten.model.personen.RESTPersoon; public class RESTPersoonConverter { // Moet overeenkomen<SUF> public static final List<RESTPersonenParameters> VALID_PERSONEN_QUERIES = List.of( new RESTPersonenParameters(REQ, NON, NON, NON, NON, NON, NON, NON, NON), new RESTPersonenParameters(NON, REQ, OPT, OPT, REQ, NON, NON, NON, NON), new RESTPersonenParameters(NON, REQ, REQ, OPT, NON, REQ, NON, NON, NON), new RESTPersonenParameters(NON, NON, NON, NON, NON, NON, REQ, REQ, NON), new RESTPersonenParameters(NON, NON, NON, NON, NON, REQ, NON, REQ, REQ) ); public List<RESTPersoon> convertPersonen(final List<Persoon> personen) { return personen.stream().map(this::convertPersoon).toList(); } public List<RESTPersoon> convertPersonenBeperkt(final List<PersoonBeperkt> personen) { return personen.stream().map(this::convertPersoonBeperkt).toList(); } public RESTPersoon convertPersoon(final Persoon persoon) { final RESTPersoon restPersoon = new RESTPersoon(); restPersoon.bsn = persoon.getBurgerservicenummer(); if (persoon.getGeslacht() != null) { restPersoon.geslacht = convertGeslacht(persoon.getGeslacht()); } if (persoon.getNaam() != null) { restPersoon.naam = persoon.getNaam().getVolledigeNaam(); } if (persoon.getGeboorte() != null) { restPersoon.geboortedatum = convertGeboortedatum(persoon.getGeboorte().getDatum()); } if (persoon.getVerblijfplaats() != null) { restPersoon.verblijfplaats = convertVerblijfplaats(persoon.getVerblijfplaats()); } return restPersoon; } public RESTPersoon convertPersoonBeperkt(final PersoonBeperkt persoon) { final RESTPersoon restPersoon = new RESTPersoon(); restPersoon.bsn = persoon.getBurgerservicenummer(); if (persoon.getGeslacht() != null) { restPersoon.geslacht = convertGeslacht(persoon.getGeslacht()); } if (persoon.getNaam() != null) { restPersoon.naam = persoon.getNaam().getVolledigeNaam(); } if (persoon.getGeboorte() != null) { restPersoon.geboortedatum = convertGeboortedatum(persoon.getGeboorte().getDatum()); } if (persoon.getAdressering() != null) { final AdresseringBeperkt adressering = persoon.getAdressering(); restPersoon.verblijfplaats = joinNonBlankWith(", ", adressering.getAdresregel1(), adressering.getAdresregel2(), adressering.getAdresregel3()); } return restPersoon; } public PersonenQuery convertToPersonenQuery(final RESTListPersonenParameters parameters) { if (isNotBlank(parameters.bsn)) { final var query = new RaadpleegMetBurgerservicenummer(); query.addBurgerservicenummerItem(parameters.bsn); return query; } if (isNotBlank(parameters.geslachtsnaam) && parameters.geboortedatum != null) { final var query = new ZoekMetGeslachtsnaamEnGeboortedatum(); query.setGeslachtsnaam(parameters.geslachtsnaam); query.setGeboortedatum(parameters.geboortedatum); query.setVoornamen(parameters.voornamen); query.setVoorvoegsel(parameters.voorvoegsel); return query; } if (isNotBlank(parameters.geslachtsnaam) && isNotBlank(parameters.voornamen) && isNotBlank(parameters.gemeenteVanInschrijving)) { final var query = new ZoekMetNaamEnGemeenteVanInschrijving(); query.setGeslachtsnaam(parameters.geslachtsnaam); query.setVoornamen(parameters.voornamen); query.setGemeenteVanInschrijving(parameters.gemeenteVanInschrijving); query.setVoorvoegsel(parameters.voorvoegsel); return query; } if (isNotBlank(parameters.postcode) && parameters.huisnummer != null) { final var query = new ZoekMetPostcodeEnHuisnummer(); query.setPostcode(parameters.postcode); query.setHuisnummer(parameters.huisnummer); return query; } if (isNotBlank(parameters.straat) && parameters.huisnummer != null && isNotBlank(parameters.gemeenteVanInschrijving)) { final var query = new ZoekMetStraatHuisnummerEnGemeenteVanInschrijving(); query.setStraat(parameters.straat); query.setHuisnummer(parameters.huisnummer); query.setGemeenteVanInschrijving(parameters.gemeenteVanInschrijving); return query; } throw new IllegalArgumentException("Ongeldige combinatie van zoek parameters"); } public List<RESTPersoon> convertFromPersonenQueryResponse(final PersonenQueryResponse personenQueryResponse) { return switch (personenQueryResponse) { case RaadpleegMetBurgerservicenummerResponse response -> convertPersonen(response.getPersonen()); case ZoekMetGeslachtsnaamEnGeboortedatumResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetNaamEnGemeenteVanInschrijvingResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetNummeraanduidingIdentificatieResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetPostcodeEnHuisnummerResponse response -> convertPersonenBeperkt(response.getPersonen()); case ZoekMetStraatHuisnummerEnGemeenteVanInschrijvingResponse response -> convertPersonenBeperkt(response.getPersonen()); default -> Collections.emptyList(); }; } private String convertGeslacht(final Waardetabel geslacht) { return isNotBlank(geslacht.getOmschrijving()) ? geslacht.getOmschrijving() : geslacht.getCode(); } private String convertGeboortedatum(final AbstractDatum abstractDatum) { return switch (abstractDatum) { case VolledigeDatum volledigeDatum -> volledigeDatum.getDatum().toString(); case JaarMaandDatum jaarMaandDatum -> "%d2-%d4".formatted(jaarMaandDatum.getMaand(), jaarMaandDatum.getJaar()); case JaarDatum jaarDatum -> "%d4".formatted(jaarDatum.getJaar()); case DatumOnbekend datumOnbekend -> ONBEKEND; default -> null; }; } private String convertVerblijfplaats(final AbstractVerblijfplaats abstractVerblijfplaats) { return switch (abstractVerblijfplaats) { case Adres adres && adres.getVerblijfadres() != null -> convertVerblijfadresBinnenland(adres.getVerblijfadres()); case VerblijfplaatsBuitenland verblijfplaatsBuitenland && verblijfplaatsBuitenland.getVerblijfadres() != null -> convertVerblijfadresBuitenland(verblijfplaatsBuitenland.getVerblijfadres()); case VerblijfplaatsOnbekend verblijfplaatsOnbekend -> ONBEKEND; default -> null; }; } private String convertVerblijfadresBinnenland(final VerblijfadresBinnenland verblijfadresBinnenland) { final String adres = replace(joinNonBlankWith(NON_BREAKING_SPACE, verblijfadresBinnenland.getOfficieleStraatnaam(), Objects.toString(verblijfadresBinnenland.getHuisnummer(), null), verblijfadresBinnenland.getHuisnummertoevoeging(), verblijfadresBinnenland.getHuisletter()), SPACE, NON_BREAKING_SPACE); final String postcode = replace(verblijfadresBinnenland.getPostcode(), SPACE, NON_BREAKING_SPACE); final String woonplaats = replace(verblijfadresBinnenland.getWoonplaats(), SPACE, NON_BREAKING_SPACE); return joinNonBlankWith(", ", adres, postcode, woonplaats); } private String convertVerblijfadresBuitenland(VerblijfadresBuitenland verblijfadresBuitenland) { return joinNonBlankWith(", ", verblijfadresBuitenland.getRegel1(), verblijfadresBuitenland.getRegel2(), verblijfadresBuitenland.getRegel3()); } }
214258_1
package com.xkj.mlrc.fsimage; import com.jcraft.jsch.*; import com.xkj.mlrc.clean.util.PropsUtil; import com.xkj.mlrc.common.shell.Shell; import lombok.extern.slf4j.Slf4j; import java.io.File; import java.io.IOException; import java.util.ArrayList; /** * 远程ssh解析fsimage文件 * * @author [email protected] * @date 2020/4/23 12:38 * @desc */ @Slf4j public class GenerateFsimageTable { public static Shell shell; public static void main(String[] args) throws IOException, JSchException { // ssh远程登录NameNode所在的机器 sshLoginNameNodeHost(); // 解析fsimage文件并上传到hive表对应的路径 generateFsimageCsv2Hive(); } private static void generateFsimageCsv2Hive() throws IOException, JSchException { //获取存放fsimage文件的目录 String cmd1 = "hdfs getconf -confKey dfs.namenode.name.dir"; shell.execute(cmd1); ArrayList<String> list1 = shell.getStandardOutput(); String fsimageDir = list1.get(list1.size() - 1).split(",")[0]; //获取最新的fsimage文件的路径 String cmd2 = "find ${fsimageDir}/current -type f -name 'fsimage_*' | grep -v '.md5' | sort -n | tail -n1"; shell.execute(cmd2.replace("${fsimageDir}", fsimageDir)); ArrayList<String> list2 = shell.getStandardOutput(); String fsimageFile = list2.get(list2.size() - 1); //拷贝fsimage文件到ssh登录的HOME目录,并加上时间戳后缀 String userHomeDir = "/home/" + shell.username; long timestamp = System.currentTimeMillis(); String fsimageFileName = new File(fsimageFile).getName() + "_" + timestamp; String cmd3 = "cp ${fsimageFile} ${userhome}/${fsimageFileName}"; cmd3 = cmd3.replace("${fsimageFile}", fsimageFile).replace("${userhome}", userHomeDir).replace("${fsimageFileName}", fsimageFileName); shell.execute(cmd3); //解析fsimage成csv文件 String cmd4 = "hdfs oiv -p Delimited -delimiter ',' -i ${userhome}/${fsimageFileName} -o ${userhome}/fsimage.csv"; cmd4 = cmd4.replace("${userhome}", userHomeDir).replace("${fsimageFileName}", fsimageFileName); shell.execute(cmd4); // 创建fsimage表 String cmd5 = "hive -S -e \"CREATE TABLE IF NOT EXISTS fsimage( " + "path string, " + "replication int, " + "modificationtime string, " + "accesstime string, " + "preferredblocksize bigint, " + "blockscount int, " + "filesize bigint, " + "nsquota int, " + "dsquota int, " + "permission string, " + "username string, " + "groupname string) " + "ROW FORMAT DELIMITED " + "FIELDS TERMINATED BY ',' " + "STORED AS INPUTFORMAT " + "'org.apache.hadoop.mapred.TextInputFormat' " + "OUTPUTFORMAT " + "'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' " + "location '/tmp/fsimage'\""; shell.execute(cmd5); // 上传fsimage.csv文件到hive表,为后面统计分析做准备 String cmd6 = "hadoop fs -put -f ${userhome}/fsimage.csv /tmp/fsimage/"; cmd6 = cmd6.replace("${userhome}", userHomeDir); shell.execute(cmd6); // 删除无用的数据 String cmd7 = "rm -rf ${userhome}/fsimage*"; cmd7 = cmd7.replace("${userhome}", userHomeDir); shell.execute(cmd7); } /** * ssh登录namenode host */ private static void sshLoginNameNodeHost() throws IOException, JSchException { String host = PropsUtil.getProp("ssh.namenode.host"); String user = PropsUtil.getProp("ssh.namenode.user"); String password = PropsUtil.getProp("ssh.namenode.password"); shell = new Shell(host, user, password); int code = shell.execute("ls"); System.out.println(code); if (code == 0) { log.info("用户:{} 登录host:{}成功!!", user, host); } else { log.error("用户:{} 登录host:{}失败!!", user, host); System.exit(-1); } } }
lijufeng2016/data-manager
src/main/java/com/xkj/mlrc/fsimage/GenerateFsimageTable.java
1,203
/** * ssh登录namenode host */
block_comment
nl
package com.xkj.mlrc.fsimage; import com.jcraft.jsch.*; import com.xkj.mlrc.clean.util.PropsUtil; import com.xkj.mlrc.common.shell.Shell; import lombok.extern.slf4j.Slf4j; import java.io.File; import java.io.IOException; import java.util.ArrayList; /** * 远程ssh解析fsimage文件 * * @author [email protected] * @date 2020/4/23 12:38 * @desc */ @Slf4j public class GenerateFsimageTable { public static Shell shell; public static void main(String[] args) throws IOException, JSchException { // ssh远程登录NameNode所在的机器 sshLoginNameNodeHost(); // 解析fsimage文件并上传到hive表对应的路径 generateFsimageCsv2Hive(); } private static void generateFsimageCsv2Hive() throws IOException, JSchException { //获取存放fsimage文件的目录 String cmd1 = "hdfs getconf -confKey dfs.namenode.name.dir"; shell.execute(cmd1); ArrayList<String> list1 = shell.getStandardOutput(); String fsimageDir = list1.get(list1.size() - 1).split(",")[0]; //获取最新的fsimage文件的路径 String cmd2 = "find ${fsimageDir}/current -type f -name 'fsimage_*' | grep -v '.md5' | sort -n | tail -n1"; shell.execute(cmd2.replace("${fsimageDir}", fsimageDir)); ArrayList<String> list2 = shell.getStandardOutput(); String fsimageFile = list2.get(list2.size() - 1); //拷贝fsimage文件到ssh登录的HOME目录,并加上时间戳后缀 String userHomeDir = "/home/" + shell.username; long timestamp = System.currentTimeMillis(); String fsimageFileName = new File(fsimageFile).getName() + "_" + timestamp; String cmd3 = "cp ${fsimageFile} ${userhome}/${fsimageFileName}"; cmd3 = cmd3.replace("${fsimageFile}", fsimageFile).replace("${userhome}", userHomeDir).replace("${fsimageFileName}", fsimageFileName); shell.execute(cmd3); //解析fsimage成csv文件 String cmd4 = "hdfs oiv -p Delimited -delimiter ',' -i ${userhome}/${fsimageFileName} -o ${userhome}/fsimage.csv"; cmd4 = cmd4.replace("${userhome}", userHomeDir).replace("${fsimageFileName}", fsimageFileName); shell.execute(cmd4); // 创建fsimage表 String cmd5 = "hive -S -e \"CREATE TABLE IF NOT EXISTS fsimage( " + "path string, " + "replication int, " + "modificationtime string, " + "accesstime string, " + "preferredblocksize bigint, " + "blockscount int, " + "filesize bigint, " + "nsquota int, " + "dsquota int, " + "permission string, " + "username string, " + "groupname string) " + "ROW FORMAT DELIMITED " + "FIELDS TERMINATED BY ',' " + "STORED AS INPUTFORMAT " + "'org.apache.hadoop.mapred.TextInputFormat' " + "OUTPUTFORMAT " + "'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' " + "location '/tmp/fsimage'\""; shell.execute(cmd5); // 上传fsimage.csv文件到hive表,为后面统计分析做准备 String cmd6 = "hadoop fs -put -f ${userhome}/fsimage.csv /tmp/fsimage/"; cmd6 = cmd6.replace("${userhome}", userHomeDir); shell.execute(cmd6); // 删除无用的数据 String cmd7 = "rm -rf ${userhome}/fsimage*"; cmd7 = cmd7.replace("${userhome}", userHomeDir); shell.execute(cmd7); } /** * ssh登录namenode host <SUF>*/ private static void sshLoginNameNodeHost() throws IOException, JSchException { String host = PropsUtil.getProp("ssh.namenode.host"); String user = PropsUtil.getProp("ssh.namenode.user"); String password = PropsUtil.getProp("ssh.namenode.password"); shell = new Shell(host, user, password); int code = shell.execute("ls"); System.out.println(code); if (code == 0) { log.info("用户:{} 登录host:{}成功!!", user, host); } else { log.error("用户:{} 登录host:{}失败!!", user, host); System.exit(-1); } } }
214266_0
package com.collect.algorithm; //演示FIFO、LRU两种算法及其数据结构 public class TestQueue { public static void main(String[] args) { testFifo(); // 测试FIFO算法用到的数据结构 testLru(); // 测试LRU算法用到的数据结构 } // 测试FIFO算法(先进先出)用到的数据结构 private static void testFifo() { // 声明一个容量为5的先进先出队列 FifoList<Character> fifoList = new FifoList<Character>(5); //String str = "abcdefghijklfghlijf"; String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { fifoList.add(str.charAt(i)); // 把字符加入先进先出队列 } System.out.println("先进先出队列的大小为" + fifoList.size()); System.out.println("先进先出队列的当前元素包括:" + fifoList); } // 测试LRU算法(最久未使用)用到的数据结构 private static void testLru() { // 声明一个容量为5的最久未使用队列 LruMap<Character, Integer> lruMap = new LruMap<Character, Integer>(5); //String str = "abcdefghijklfghlijf"; String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { // 把字符加入最久未使用队列。其中键名为该字符,键值为序号 lruMap.put(str.charAt(i), i); } System.out.println("最久未使用队列的大小为" + lruMap.size()); System.out.println("最久未使用队列的当前元素包括:" + lruMap); } }
aqi00/java
chapter09/src/com/collect/algorithm/TestQueue.java
456
//String str = "abcdefghijklfghlijf";
line_comment
nl
package com.collect.algorithm; //演示FIFO、LRU两种算法及其数据结构 public class TestQueue { public static void main(String[] args) { testFifo(); // 测试FIFO算法用到的数据结构 testLru(); // 测试LRU算法用到的数据结构 } // 测试FIFO算法(先进先出)用到的数据结构 private static void testFifo() { // 声明一个容量为5的先进先出队列 FifoList<Character> fifoList = new FifoList<Character>(5); //String str<SUF> String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { fifoList.add(str.charAt(i)); // 把字符加入先进先出队列 } System.out.println("先进先出队列的大小为" + fifoList.size()); System.out.println("先进先出队列的当前元素包括:" + fifoList); } // 测试LRU算法(最久未使用)用到的数据结构 private static void testLru() { // 声明一个容量为5的最久未使用队列 LruMap<Character, Integer> lruMap = new LruMap<Character, Integer>(5); //String str = "abcdefghijklfghlijf"; String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { // 把字符加入最久未使用队列。其中键名为该字符,键值为序号 lruMap.put(str.charAt(i), i); } System.out.println("最久未使用队列的大小为" + lruMap.size()); System.out.println("最久未使用队列的当前元素包括:" + lruMap); } }
214266_1
package com.collect.algorithm; //演示FIFO、LRU两种算法及其数据结构 public class TestQueue { public static void main(String[] args) { testFifo(); // 测试FIFO算法用到的数据结构 testLru(); // 测试LRU算法用到的数据结构 } // 测试FIFO算法(先进先出)用到的数据结构 private static void testFifo() { // 声明一个容量为5的先进先出队列 FifoList<Character> fifoList = new FifoList<Character>(5); //String str = "abcdefghijklfghlijf"; String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { fifoList.add(str.charAt(i)); // 把字符加入先进先出队列 } System.out.println("先进先出队列的大小为" + fifoList.size()); System.out.println("先进先出队列的当前元素包括:" + fifoList); } // 测试LRU算法(最久未使用)用到的数据结构 private static void testLru() { // 声明一个容量为5的最久未使用队列 LruMap<Character, Integer> lruMap = new LruMap<Character, Integer>(5); //String str = "abcdefghijklfghlijf"; String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { // 把字符加入最久未使用队列。其中键名为该字符,键值为序号 lruMap.put(str.charAt(i), i); } System.out.println("最久未使用队列的大小为" + lruMap.size()); System.out.println("最久未使用队列的当前元素包括:" + lruMap); } }
aqi00/java
chapter09/src/com/collect/algorithm/TestQueue.java
456
//String str = "abcdefghijklfghlijf";
line_comment
nl
package com.collect.algorithm; //演示FIFO、LRU两种算法及其数据结构 public class TestQueue { public static void main(String[] args) { testFifo(); // 测试FIFO算法用到的数据结构 testLru(); // 测试LRU算法用到的数据结构 } // 测试FIFO算法(先进先出)用到的数据结构 private static void testFifo() { // 声明一个容量为5的先进先出队列 FifoList<Character> fifoList = new FifoList<Character>(5); //String str = "abcdefghijklfghlijf"; String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { fifoList.add(str.charAt(i)); // 把字符加入先进先出队列 } System.out.println("先进先出队列的大小为" + fifoList.size()); System.out.println("先进先出队列的当前元素包括:" + fifoList); } // 测试LRU算法(最久未使用)用到的数据结构 private static void testLru() { // 声明一个容量为5的最久未使用队列 LruMap<Character, Integer> lruMap = new LruMap<Character, Integer>(5); //String str<SUF> String str = "先天下之忧而忧后天下之乐而乐天天快乐"; for (int i = 0; i < str.length(); i++) { // 把字符加入最久未使用队列。其中键名为该字符,键值为序号 lruMap.put(str.charAt(i), i); } System.out.println("最久未使用队列的大小为" + lruMap.size()); System.out.println("最久未使用队列的当前元素包括:" + lruMap); } }
214267_0
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.components.containers; import com.vaadin.data.Item; import nl.procura.burgerzaken.gba.core.enums.GBATable; import nl.procura.vaadin.component.field.fieldvalues.FieldValue; import nl.procura.vaadin.component.field.fieldvalues.TabelFieldValue; public class VerblijfstitelContainer extends TabelContainer { public VerblijfstitelContainer() { this(false); } private VerblijfstitelContainer(boolean isCurrent) { super(GBATable.VERBLIJFSTITEL, isCurrent); } @Override public Item addItem(Object itemId) { if (itemId instanceof FieldValue) { TabelFieldValue fd = (TabelFieldValue) itemId; return super.addItem(new TabelFieldValue(fd.getValue(), fd.getValue() + ": " + fd.getDescription())); } return super.addItem(itemId); } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/components/containers/VerblijfstitelContainer.java
448
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */
block_comment
nl
/* * Copyright 2021 -<SUF>*/ package nl.procura.gba.web.components.containers; import com.vaadin.data.Item; import nl.procura.burgerzaken.gba.core.enums.GBATable; import nl.procura.vaadin.component.field.fieldvalues.FieldValue; import nl.procura.vaadin.component.field.fieldvalues.TabelFieldValue; public class VerblijfstitelContainer extends TabelContainer { public VerblijfstitelContainer() { this(false); } private VerblijfstitelContainer(boolean isCurrent) { super(GBATable.VERBLIJFSTITEL, isCurrent); } @Override public Item addItem(Object itemId) { if (itemId instanceof FieldValue) { TabelFieldValue fd = (TabelFieldValue) itemId; return super.addItem(new TabelFieldValue(fd.getValue(), fd.getValue() + ": " + fd.getDescription())); } return super.addItem(itemId); } }
214278_0
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.modules.bs.geboorte.page60; import static nl.procura.standard.Globalfunctions.pos; import java.io.Serializable; import java.lang.annotation.ElementType; import nl.procura.gba.web.components.containers.LandContainer; import nl.procura.gba.web.components.fields.GbaComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.components.listeners.FieldChangeListener; import nl.procura.gba.web.services.bs.geboorte.DossierGeboorte; import nl.procura.vaadin.annotation.field.Field; import nl.procura.vaadin.annotation.field.FormFieldFactoryBean; import nl.procura.vaadin.annotation.field.Immediate; import nl.procura.vaadin.annotation.field.Select; import nl.procura.vaadin.component.field.fieldvalues.FieldValue; import lombok.Data; public class Page60GeboorteStap3 extends GbaForm<Page60GeboorteStap3.Page60GeboorteBean4> { public static final String VERBLIJFSLAND = "verblijfsLand"; public Page60GeboorteStap3(DossierGeboorte geboorte) { setCaption("Stap 3"); setReadThrough(true); setColumnWidths("200px", ""); setOrder(VERBLIJFSLAND); Page60GeboorteBean4 bean = new Page60GeboorteBean4(); if (pos(geboorte.getVerblijfsLandAfstamming().getValue())) { bean.setVerblijfsLand(geboorte.getVerblijfsLandAfstamming()); } setBean(bean); } @Override public void setBean(Object bean) { super.setBean(bean); getField(VERBLIJFSLAND).addListener(new FieldChangeListener<FieldValue>() { @Override public void onChange(FieldValue value) { onWijzigingVerblijfsland(value); } }); } @Override public Page60GeboorteBean4 getNewBean() { return new Page60GeboorteBean4(); } public FieldValue getVerblijfsLand() { return getBean().getVerblijfsLand(); } public void setVerblijfsLand(FieldValue land) { getBean().setVerblijfsLand(land); if (getField(VERBLIJFSLAND) != null) { getField(VERBLIJFSLAND).setValue(land); } } @SuppressWarnings("unused") protected void onWijzigingVerblijfsland(FieldValue land) { } @Data @FormFieldFactoryBean(accessType = ElementType.FIELD) public class Page60GeboorteBean4 implements Serializable { @Field(customTypeClass = GbaComboBox.class, caption = "Verblijfplaats (land) kind in?", required = true, width = "300px") @Select(containerDataSource = LandContainer.class) @Immediate private FieldValue verblijfsLand = new FieldValue(); } }
vrijBRP/vrijBRP-Balie
gba-web/src/main/java/nl/procura/gba/web/modules/bs/geboorte/page60/Page60GeboorteStap3.java
1,003
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */
block_comment
nl
/* * Copyright 2021 -<SUF>*/ package nl.procura.gba.web.modules.bs.geboorte.page60; import static nl.procura.standard.Globalfunctions.pos; import java.io.Serializable; import java.lang.annotation.ElementType; import nl.procura.gba.web.components.containers.LandContainer; import nl.procura.gba.web.components.fields.GbaComboBox; import nl.procura.gba.web.components.layouts.form.GbaForm; import nl.procura.gba.web.components.listeners.FieldChangeListener; import nl.procura.gba.web.services.bs.geboorte.DossierGeboorte; import nl.procura.vaadin.annotation.field.Field; import nl.procura.vaadin.annotation.field.FormFieldFactoryBean; import nl.procura.vaadin.annotation.field.Immediate; import nl.procura.vaadin.annotation.field.Select; import nl.procura.vaadin.component.field.fieldvalues.FieldValue; import lombok.Data; public class Page60GeboorteStap3 extends GbaForm<Page60GeboorteStap3.Page60GeboorteBean4> { public static final String VERBLIJFSLAND = "verblijfsLand"; public Page60GeboorteStap3(DossierGeboorte geboorte) { setCaption("Stap 3"); setReadThrough(true); setColumnWidths("200px", ""); setOrder(VERBLIJFSLAND); Page60GeboorteBean4 bean = new Page60GeboorteBean4(); if (pos(geboorte.getVerblijfsLandAfstamming().getValue())) { bean.setVerblijfsLand(geboorte.getVerblijfsLandAfstamming()); } setBean(bean); } @Override public void setBean(Object bean) { super.setBean(bean); getField(VERBLIJFSLAND).addListener(new FieldChangeListener<FieldValue>() { @Override public void onChange(FieldValue value) { onWijzigingVerblijfsland(value); } }); } @Override public Page60GeboorteBean4 getNewBean() { return new Page60GeboorteBean4(); } public FieldValue getVerblijfsLand() { return getBean().getVerblijfsLand(); } public void setVerblijfsLand(FieldValue land) { getBean().setVerblijfsLand(land); if (getField(VERBLIJFSLAND) != null) { getField(VERBLIJFSLAND).setValue(land); } } @SuppressWarnings("unused") protected void onWijzigingVerblijfsland(FieldValue land) { } @Data @FormFieldFactoryBean(accessType = ElementType.FIELD) public class Page60GeboorteBean4 implements Serializable { @Field(customTypeClass = GbaComboBox.class, caption = "Verblijfplaats (land) kind in?", required = true, width = "300px") @Select(containerDataSource = LandContainer.class) @Immediate private FieldValue verblijfsLand = new FieldValue(); } }
214288_0
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */ package nl.procura.gba.web.services.zaken.rijbewijs; import static nl.procura.standard.Globalfunctions.*; import nl.procura.diensten.gba.ple.extensions.BasePLExt; import nl.procura.diensten.gba.ple.openoffice.DocumentPL; import nl.procura.gba.common.DateTime; import nl.procura.gba.common.ZaakStatusType; import nl.procura.gba.common.ZaakType; import nl.procura.gba.jpa.personen.db.Location; import nl.procura.gba.jpa.personen.db.Nrd; import nl.procura.gba.jpa.personen.db.Usr; import nl.procura.gba.web.components.fields.values.UsrFieldValue; import nl.procura.gba.web.services.beheer.locatie.Locatie; import nl.procura.gba.web.services.gba.basistabellen.gemeente.Gemeente; import nl.procura.gba.web.services.zaken.algemeen.GenericZaak; import nl.procura.gba.web.services.zaken.algemeen.ZaakAfhaalbaar; import nl.procura.gba.web.services.zaken.algemeen.ZaakHistorie; import nl.procura.gba.web.services.zaken.algemeen.contact.ContactZaak; import nl.procura.gba.web.services.zaken.algemeen.contact.ZaakContact; import nl.procura.gba.web.services.zaken.identiteit.Identificatie; import nl.procura.gba.web.services.zaken.reisdocumenten.clausule.VermeldTitelType; import nl.procura.java.reflection.ReflectionUtil; import nl.procura.vaadin.component.field.fieldvalues.AnrFieldValue; import nl.procura.vaadin.component.field.fieldvalues.BsnFieldValue; import nl.procura.vaadin.component.field.fieldvalues.FieldValue; public class RijbewijsAanvraag extends Nrd implements ContactZaak, ZaakAfhaalbaar { private static final long serialVersionUID = -3468735287544148942L; private final GenericZaak zaak = new GenericZaak(); private Contactgegevens contactgegevens = new Contactgegevens(this); private RijbewijsAanvraagStatussen statussen = new RijbewijsAanvraagStatussen(); public RijbewijsAanvraag() { setStatus(ZaakStatusType.OPGENOMEN); } public String getAanvraagNummer() { return getAanvrNr(); } public void setAanvraagNummer(String aanvraagNummer) { setAanvrNr(aanvraagNummer); } @Override public AnrFieldValue getAnummer() { return new AnrFieldValue(getAnr()); } @Override public void setAnummer(AnrFieldValue anr) { setAnr(FieldValue.from(anr).getStringValue()); } @Override public BasePLExt getBasisPersoon() { return zaak.getBasisPersoon(); } @Override public void setBasisPersoon(BasePLExt basisPersoon) { zaak.setBasisPersoon(basisPersoon); } @Override public BsnFieldValue getBurgerServiceNummer() { return new BsnFieldValue(astr(getBsn())); } @Override public void setBurgerServiceNummer(BsnFieldValue bsn) { setBsn(FieldValue.from(bsn).getBigDecimalValue()); } public int getCodeRas() { return aval(getCRaas()); } public void setCodeRas(int codeRas) { setCRaas(toBigDecimal(codeRas)); } public long getCodeVerblijfstitel() { return along(getCVbt()); } public void setCodeVerblijfstitel(long cvbt) { setCVbt(toBigDecimal(cvbt)); } @Override public ZaakContact getContact() { return zaak.getContact(); } @Override public void setContact(ZaakContact contact) { zaak.setContact(contact); } public Contactgegevens getContactgegevens() { return contactgegevens; } public void setContactgegevens(Contactgegevens contactgegevens) { this.contactgegevens = contactgegevens; } @Override public DateTime getDatumIngang() { return new DateTime(getDatumTijdInvoer().getLongDate()); } @Override public void setDatumIngang(DateTime dt) { setDAanvr(toBigDecimal(dt.getLongDate())); } @Override public DateTime getDatumTijdInvoer() { return new DateTime(getDAanvr(), getTAanvr()); } @Override public void setDatumTijdInvoer(DateTime dt) { setDAanvr(toBigDecimal(dt.getLongDate())); setTAanvr(toBigDecimal(dt.getLongTime())); } public DateTime getDatumVertrek() { return new DateTime(getDVertrek()); } public void setDatumVertrek(DateTime date) { setDVertrek(toBigDecimal(date.getLongDate())); } public DateTime getDatumVestiging() { return new DateTime(getDVestiging()); } public void setDatumVestiging(DateTime date) { setDVestiging(toBigDecimal(date.getLongDate())); } public UsrFieldValue getGebruikerAanvraag() { return new UsrFieldValue(getUsr().getCUsr(), getUsr().getUsrfullname()); } public void setGebruikerAanvraag(UsrFieldValue gebruiker) { setUsr(new Usr(along(gebruiker.getValue()), gebruiker.getDescription())); } public UsrFieldValue getGebruikerUitgifte() { return new UsrFieldValue(getUsrUitgifte().getCUsr(), getUsrUitgifte().getUsrfullname()); } public void setGebruikerUitgifte(UsrFieldValue gebruiker) { setUsrUitgifte(new Usr(along(gebruiker.getValue()), gebruiker.getDescription())); } @Override public Gemeente getGemeente() { return zaak.getGemeente(); } @Override public void setGemeente(Gemeente gemeente) { zaak.setGemeente(gemeente); } @Override public Identificatie getIdentificatie() { return zaak.getIdentificatie(); } @Override public void setIdentificatie(Identificatie identificatie) { zaak.setIdentificatie(identificatie); } @Override public UsrFieldValue getIngevoerdDoor() { return new UsrFieldValue(getUsr().getCUsr(), getUsr().getUsrfullname()); } @Override public void setIngevoerdDoor(UsrFieldValue ingevoerdDoor) { setUsr(new Usr(along(ingevoerdDoor.getValue()), ingevoerdDoor.getDescription())); } public long getLandVertrek() { return along(getLVertrek()); } public void setLandVertrek(long cLand) { setLVertrek(toBigDecimal(cLand)); } public long getLandVestiging() { return along(getLVestiging()); } public void setLandVestiging(long cLand) { setLVestiging(toBigDecimal(cLand)); } @Override public Locatie getLocatieAfhaal() { return zaak.getLocatieAfhaal(getAfhaalLocation()); } @Override public void setLocatieAfhaal(Locatie locatieAfhaal) { zaak.setLocatieAfhaal(locatieAfhaal); setAfhaalLocation(ReflectionUtil.deepCopyBean(Location.class, locatieAfhaal)); } @Override public Locatie getLocatieInvoer() { return zaak.getLocatieInvoer(getLocation()); } @Override public void setLocatieInvoer(Locatie locatieInvoer) { zaak.setLocatieInvoer(locatieInvoer); setLocation(ReflectionUtil.deepCopyBean(Location.class, locatieInvoer)); } public NaamgebruikType getNaamgebruik() { return NaamgebruikType.getByRdwCode(along(getCNaamgebruik())); } public void setNaamgebruik(NaamgebruikType naamgebruik) { setCNaamgebruik(astr(naamgebruik.getRdwCode())); } public DocumentPL getPersoon() { return zaak.getPersoon(); } public String getProcesVerbaalVerlies() { return getPvVerlies(); } public void setProcesVerbaalVerlies(String procesVerbaalVerlies) { setPvVerlies(procesVerbaalVerlies); } public RijbewijsAanvraagReden getRedenAanvraag() { return RijbewijsAanvraagReden.get(along(getRdnAanvr())); } public void setRedenAanvraag(RijbewijsAanvraagReden redenAanvraag) { setRdnAanvr(toBigDecimal(redenAanvraag.getCode())); } public String getRijbewijsnummer() { String nieuwNr = astr(getRbwNr()); String oudNr = astr(getVervangingsRbwNr()); return (fil(nieuwNr) && nieuwNr.equals(oudNr)) ? "" : getRbwNr(); } public void setRijbewijsnummer(String rijbewijsnummer) { setRbwNr(rijbewijsnummer); } @Override public String getSoort() { return getSoortAanvraag().getOms(); } public RijbewijsAanvraagSoort getSoortAanvraag() { return RijbewijsAanvraagSoort.get(along(getSrtAanvr())); } // Algemene methodes public void setSoortAanvraag(RijbewijsAanvraagSoort soortAanvraag) { setSrtAanvr(toBigDecimal(soortAanvraag.getCode())); } @Override public ZaakStatusType getStatus() { return ZaakStatusType.get(along(getIndVerwerkt())); } @Override public void setStatus(ZaakStatusType status) { setIndVerwerkt(toBigDecimal(status.getCode())); } public RijbewijsAanvraagStatussen getStatussen() { return statussen; } public void setStatussen(RijbewijsAanvraagStatussen statussen) { this.statussen = statussen; } @Override public ZaakType getType() { return ZaakType.RIJBEWIJS; } public String getVervangingsRbwNr() { return getRbwNrVerv(); } public void setVervangingsRbwNr(String vervangingsRbwNr) { setRbwNrVerv(vervangingsRbwNr); } @Override public ZaakHistorie getZaakHistorie() { return zaak.getZaakHistorie(); } public boolean isGbaBestendig() { return isTru(getGbaBest()); } public void setGbaBestendig(boolean gbaBestendig) { setGbaBest(gbaBestendig ? "J" : "N"); } public boolean isIndicatie185() { return isTru(getInd185dagen()); } public void setIndicatie185(boolean indicatie185) { setInd185dagen(indicatie185 ? "J" : "N"); } public boolean isSpoed() { return isTru(getSpoedAfh()); } public void setSpoed(boolean spoed) { setSpoedAfh(spoed ? "J" : "N"); } public VermeldTitelType getVermeldingTitel() { return VermeldTitelType.get(getVermeldTp().intValue()); } public void setVermeldingTitel(VermeldTitelType type) { setVermeldTp(toBigDecimal(type.getCode())); } }
vrijBRP/vrijBRP-Balie
gba-services/src/main/java/nl/procura/gba/web/services/zaken/rijbewijs/RijbewijsAanvraag.java
3,185
/* * Copyright 2021 - 2022 Procura B.V. * * In licentie gegeven krachtens de EUPL, versie 1.2 * U mag dit werk niet gebruiken, behalve onder de voorwaarden van de licentie. * U kunt een kopie van de licentie vinden op: * * https://github.com/vrijBRP/vrijBRP/blob/master/LICENSE.md * * Deze bevat zowel de Nederlandse als de Engelse tekst * * Tenzij dit op grond van toepasselijk recht vereist is of schriftelijk * is overeengekomen, wordt software krachtens deze licentie verspreid * "zoals deze is", ZONDER ENIGE GARANTIES OF VOORWAARDEN, noch expliciet * noch impliciet. * Zie de licentie voor de specifieke bepalingen voor toestemmingen en * beperkingen op grond van de licentie. */
block_comment
nl
/* * Copyright 2021 -<SUF>*/ package nl.procura.gba.web.services.zaken.rijbewijs; import static nl.procura.standard.Globalfunctions.*; import nl.procura.diensten.gba.ple.extensions.BasePLExt; import nl.procura.diensten.gba.ple.openoffice.DocumentPL; import nl.procura.gba.common.DateTime; import nl.procura.gba.common.ZaakStatusType; import nl.procura.gba.common.ZaakType; import nl.procura.gba.jpa.personen.db.Location; import nl.procura.gba.jpa.personen.db.Nrd; import nl.procura.gba.jpa.personen.db.Usr; import nl.procura.gba.web.components.fields.values.UsrFieldValue; import nl.procura.gba.web.services.beheer.locatie.Locatie; import nl.procura.gba.web.services.gba.basistabellen.gemeente.Gemeente; import nl.procura.gba.web.services.zaken.algemeen.GenericZaak; import nl.procura.gba.web.services.zaken.algemeen.ZaakAfhaalbaar; import nl.procura.gba.web.services.zaken.algemeen.ZaakHistorie; import nl.procura.gba.web.services.zaken.algemeen.contact.ContactZaak; import nl.procura.gba.web.services.zaken.algemeen.contact.ZaakContact; import nl.procura.gba.web.services.zaken.identiteit.Identificatie; import nl.procura.gba.web.services.zaken.reisdocumenten.clausule.VermeldTitelType; import nl.procura.java.reflection.ReflectionUtil; import nl.procura.vaadin.component.field.fieldvalues.AnrFieldValue; import nl.procura.vaadin.component.field.fieldvalues.BsnFieldValue; import nl.procura.vaadin.component.field.fieldvalues.FieldValue; public class RijbewijsAanvraag extends Nrd implements ContactZaak, ZaakAfhaalbaar { private static final long serialVersionUID = -3468735287544148942L; private final GenericZaak zaak = new GenericZaak(); private Contactgegevens contactgegevens = new Contactgegevens(this); private RijbewijsAanvraagStatussen statussen = new RijbewijsAanvraagStatussen(); public RijbewijsAanvraag() { setStatus(ZaakStatusType.OPGENOMEN); } public String getAanvraagNummer() { return getAanvrNr(); } public void setAanvraagNummer(String aanvraagNummer) { setAanvrNr(aanvraagNummer); } @Override public AnrFieldValue getAnummer() { return new AnrFieldValue(getAnr()); } @Override public void setAnummer(AnrFieldValue anr) { setAnr(FieldValue.from(anr).getStringValue()); } @Override public BasePLExt getBasisPersoon() { return zaak.getBasisPersoon(); } @Override public void setBasisPersoon(BasePLExt basisPersoon) { zaak.setBasisPersoon(basisPersoon); } @Override public BsnFieldValue getBurgerServiceNummer() { return new BsnFieldValue(astr(getBsn())); } @Override public void setBurgerServiceNummer(BsnFieldValue bsn) { setBsn(FieldValue.from(bsn).getBigDecimalValue()); } public int getCodeRas() { return aval(getCRaas()); } public void setCodeRas(int codeRas) { setCRaas(toBigDecimal(codeRas)); } public long getCodeVerblijfstitel() { return along(getCVbt()); } public void setCodeVerblijfstitel(long cvbt) { setCVbt(toBigDecimal(cvbt)); } @Override public ZaakContact getContact() { return zaak.getContact(); } @Override public void setContact(ZaakContact contact) { zaak.setContact(contact); } public Contactgegevens getContactgegevens() { return contactgegevens; } public void setContactgegevens(Contactgegevens contactgegevens) { this.contactgegevens = contactgegevens; } @Override public DateTime getDatumIngang() { return new DateTime(getDatumTijdInvoer().getLongDate()); } @Override public void setDatumIngang(DateTime dt) { setDAanvr(toBigDecimal(dt.getLongDate())); } @Override public DateTime getDatumTijdInvoer() { return new DateTime(getDAanvr(), getTAanvr()); } @Override public void setDatumTijdInvoer(DateTime dt) { setDAanvr(toBigDecimal(dt.getLongDate())); setTAanvr(toBigDecimal(dt.getLongTime())); } public DateTime getDatumVertrek() { return new DateTime(getDVertrek()); } public void setDatumVertrek(DateTime date) { setDVertrek(toBigDecimal(date.getLongDate())); } public DateTime getDatumVestiging() { return new DateTime(getDVestiging()); } public void setDatumVestiging(DateTime date) { setDVestiging(toBigDecimal(date.getLongDate())); } public UsrFieldValue getGebruikerAanvraag() { return new UsrFieldValue(getUsr().getCUsr(), getUsr().getUsrfullname()); } public void setGebruikerAanvraag(UsrFieldValue gebruiker) { setUsr(new Usr(along(gebruiker.getValue()), gebruiker.getDescription())); } public UsrFieldValue getGebruikerUitgifte() { return new UsrFieldValue(getUsrUitgifte().getCUsr(), getUsrUitgifte().getUsrfullname()); } public void setGebruikerUitgifte(UsrFieldValue gebruiker) { setUsrUitgifte(new Usr(along(gebruiker.getValue()), gebruiker.getDescription())); } @Override public Gemeente getGemeente() { return zaak.getGemeente(); } @Override public void setGemeente(Gemeente gemeente) { zaak.setGemeente(gemeente); } @Override public Identificatie getIdentificatie() { return zaak.getIdentificatie(); } @Override public void setIdentificatie(Identificatie identificatie) { zaak.setIdentificatie(identificatie); } @Override public UsrFieldValue getIngevoerdDoor() { return new UsrFieldValue(getUsr().getCUsr(), getUsr().getUsrfullname()); } @Override public void setIngevoerdDoor(UsrFieldValue ingevoerdDoor) { setUsr(new Usr(along(ingevoerdDoor.getValue()), ingevoerdDoor.getDescription())); } public long getLandVertrek() { return along(getLVertrek()); } public void setLandVertrek(long cLand) { setLVertrek(toBigDecimal(cLand)); } public long getLandVestiging() { return along(getLVestiging()); } public void setLandVestiging(long cLand) { setLVestiging(toBigDecimal(cLand)); } @Override public Locatie getLocatieAfhaal() { return zaak.getLocatieAfhaal(getAfhaalLocation()); } @Override public void setLocatieAfhaal(Locatie locatieAfhaal) { zaak.setLocatieAfhaal(locatieAfhaal); setAfhaalLocation(ReflectionUtil.deepCopyBean(Location.class, locatieAfhaal)); } @Override public Locatie getLocatieInvoer() { return zaak.getLocatieInvoer(getLocation()); } @Override public void setLocatieInvoer(Locatie locatieInvoer) { zaak.setLocatieInvoer(locatieInvoer); setLocation(ReflectionUtil.deepCopyBean(Location.class, locatieInvoer)); } public NaamgebruikType getNaamgebruik() { return NaamgebruikType.getByRdwCode(along(getCNaamgebruik())); } public void setNaamgebruik(NaamgebruikType naamgebruik) { setCNaamgebruik(astr(naamgebruik.getRdwCode())); } public DocumentPL getPersoon() { return zaak.getPersoon(); } public String getProcesVerbaalVerlies() { return getPvVerlies(); } public void setProcesVerbaalVerlies(String procesVerbaalVerlies) { setPvVerlies(procesVerbaalVerlies); } public RijbewijsAanvraagReden getRedenAanvraag() { return RijbewijsAanvraagReden.get(along(getRdnAanvr())); } public void setRedenAanvraag(RijbewijsAanvraagReden redenAanvraag) { setRdnAanvr(toBigDecimal(redenAanvraag.getCode())); } public String getRijbewijsnummer() { String nieuwNr = astr(getRbwNr()); String oudNr = astr(getVervangingsRbwNr()); return (fil(nieuwNr) && nieuwNr.equals(oudNr)) ? "" : getRbwNr(); } public void setRijbewijsnummer(String rijbewijsnummer) { setRbwNr(rijbewijsnummer); } @Override public String getSoort() { return getSoortAanvraag().getOms(); } public RijbewijsAanvraagSoort getSoortAanvraag() { return RijbewijsAanvraagSoort.get(along(getSrtAanvr())); } // Algemene methodes public void setSoortAanvraag(RijbewijsAanvraagSoort soortAanvraag) { setSrtAanvr(toBigDecimal(soortAanvraag.getCode())); } @Override public ZaakStatusType getStatus() { return ZaakStatusType.get(along(getIndVerwerkt())); } @Override public void setStatus(ZaakStatusType status) { setIndVerwerkt(toBigDecimal(status.getCode())); } public RijbewijsAanvraagStatussen getStatussen() { return statussen; } public void setStatussen(RijbewijsAanvraagStatussen statussen) { this.statussen = statussen; } @Override public ZaakType getType() { return ZaakType.RIJBEWIJS; } public String getVervangingsRbwNr() { return getRbwNrVerv(); } public void setVervangingsRbwNr(String vervangingsRbwNr) { setRbwNrVerv(vervangingsRbwNr); } @Override public ZaakHistorie getZaakHistorie() { return zaak.getZaakHistorie(); } public boolean isGbaBestendig() { return isTru(getGbaBest()); } public void setGbaBestendig(boolean gbaBestendig) { setGbaBest(gbaBestendig ? "J" : "N"); } public boolean isIndicatie185() { return isTru(getInd185dagen()); } public void setIndicatie185(boolean indicatie185) { setInd185dagen(indicatie185 ? "J" : "N"); } public boolean isSpoed() { return isTru(getSpoedAfh()); } public void setSpoed(boolean spoed) { setSpoedAfh(spoed ? "J" : "N"); } public VermeldTitelType getVermeldingTitel() { return VermeldTitelType.get(getVermeldTp().intValue()); } public void setVermeldingTitel(VermeldTitelType type) { setVermeldTp(toBigDecimal(type.getCode())); } }
214306_0
package com.magictool.web.util; import io.jsonwebtoken.Claims; import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import java.util.Date; import java.util.Map; /** * 用于生成和验证 token 的工具类 * @author lijf */ public class JwtUtils { /** * token 过期时间 */ public static final long TOKEN_EXPIRED_TIME = 1000 * 60 * 60 * 24L; /** * 签发ID */ public static final String ISSUE_ID = "admin"; /** * userId 标识 */ public static final String USER_ID = "userId"; /** * 加密/解密 密钥 */ private static final String JWT_SECRET = "HS256/MD5"; /** * 创建token * @param claims 载荷 * @param time token时长 * @return String */ public static String createJwt(Map<String, Object> claims, Long time) { // 指定签名的时候使用的签名算法 SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; Date now = new Date(System.currentTimeMillis()); long nowMillis = System.currentTimeMillis(); JwtBuilder builder = Jwts.builder() .setClaims(claims) .setId(ISSUE_ID) .setIssuedAt(now) .signWith(signatureAlgorithm, JWT_SECRET); if (time >= 0) { long expMillis = nowMillis + time; Date exp = new Date(expMillis); builder.setExpiration(exp); } return builder.compact(); } /** * 通过 token 获取 userId * * @param token token * @return userId */ public static String getUserId(String token){ Claims claims = verifyJwt(token); return claims.get(USER_ID) + ""; } /** * 验证Token,如果返回null说明token无效或过期 * * @param token token令牌 * @return Claims */ public static Claims verifyJwt(String token) { Claims claims; try { claims = Jwts.parser() .setSigningKey(JWT_SECRET) .parseClaimsJws(token).getBody(); } catch (Exception e) { claims = null; } return claims; } /** * 生成token * * @param data 载荷 * @return String */ public static String generateToken(Map<String, Object> data) { return createJwt(data, TOKEN_EXPIRED_TIME); } }
james-ljf/magic-tool
src/main/java/com/magictool/web/util/JwtUtils.java
678
/** * 用于生成和验证 token 的工具类 * @author lijf */
block_comment
nl
package com.magictool.web.util; import io.jsonwebtoken.Claims; import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import java.util.Date; import java.util.Map; /** * 用于生成和验证 token 的工具类<SUF>*/ public class JwtUtils { /** * token 过期时间 */ public static final long TOKEN_EXPIRED_TIME = 1000 * 60 * 60 * 24L; /** * 签发ID */ public static final String ISSUE_ID = "admin"; /** * userId 标识 */ public static final String USER_ID = "userId"; /** * 加密/解密 密钥 */ private static final String JWT_SECRET = "HS256/MD5"; /** * 创建token * @param claims 载荷 * @param time token时长 * @return String */ public static String createJwt(Map<String, Object> claims, Long time) { // 指定签名的时候使用的签名算法 SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; Date now = new Date(System.currentTimeMillis()); long nowMillis = System.currentTimeMillis(); JwtBuilder builder = Jwts.builder() .setClaims(claims) .setId(ISSUE_ID) .setIssuedAt(now) .signWith(signatureAlgorithm, JWT_SECRET); if (time >= 0) { long expMillis = nowMillis + time; Date exp = new Date(expMillis); builder.setExpiration(exp); } return builder.compact(); } /** * 通过 token 获取 userId * * @param token token * @return userId */ public static String getUserId(String token){ Claims claims = verifyJwt(token); return claims.get(USER_ID) + ""; } /** * 验证Token,如果返回null说明token无效或过期 * * @param token token令牌 * @return Claims */ public static Claims verifyJwt(String token) { Claims claims; try { claims = Jwts.parser() .setSigningKey(JWT_SECRET) .parseClaimsJws(token).getBody(); } catch (Exception e) { claims = null; } return claims; } /** * 生成token * * @param data 载荷 * @return String */ public static String generateToken(Map<String, Object> data) { return createJwt(data, TOKEN_EXPIRED_TIME); } }
214310_1
/* * SPDX-FileCopyrightText: 2021 Atos * SPDX-License-Identifier: EUPL-1.2+ */ package net.atos.client.zgw.zrc.model; public class VerblijfsAdres { /** * De unieke identificatie van het OBJECT * - required * -maxLength: 100 */ private String aoaIdentificatie; /** * - required * - maxLength: 80 */ private String wplWoonplaatsNaam; /** * Een door het bevoegde gemeentelijke orgaan aan een OPENBARE RUIMTE toegekende benaming * - required * - maxLength: 80 */ private String gorOpenbareRuimteNaam; /** * - maxLength: 7 */ private String aoaPostcode; /** * - required * - maximum: 99999 * - minimum: 0 */ private Integer aoaHuisnummer; /** * - maxLength: 1 */ private String aoaHuisletter; /** * - maxLength: 4 */ private String aoaHuisnummertoevoeging; /** * maxLength: 1000 */ private String inpLocatiebeschrijving; public String getAoaIdentificatie() { return aoaIdentificatie; } public void setAoaIdentificatie(final String aoaIdentificatie) { this.aoaIdentificatie = aoaIdentificatie; } public String getWplWoonplaatsNaam() { return wplWoonplaatsNaam; } public void setWplWoonplaatsNaam(final String wplWoonplaatsNaam) { this.wplWoonplaatsNaam = wplWoonplaatsNaam; } public String getGorOpenbareRuimteNaam() { return gorOpenbareRuimteNaam; } public void setGorOpenbareRuimteNaam(final String gorOpenbareRuimteNaam) { this.gorOpenbareRuimteNaam = gorOpenbareRuimteNaam; } public String getAoaPostcode() { return aoaPostcode; } public void setAoaPostcode(final String aoaPostcode) { this.aoaPostcode = aoaPostcode; } public Integer getAoaHuisnummer() { return aoaHuisnummer; } public void setAoaHuisnummer(final Integer aoaHuisnummer) { this.aoaHuisnummer = aoaHuisnummer; } public String getAoaHuisletter() { return aoaHuisletter; } public void setAoaHuisletter(final String aoaHuisletter) { this.aoaHuisletter = aoaHuisletter; } public String getAoaHuisnummertoevoeging() { return aoaHuisnummertoevoeging; } public void setAoaHuisnummertoevoeging(final String aoaHuisnummertoevoeging) { this.aoaHuisnummertoevoeging = aoaHuisnummertoevoeging; } public String getInpLocatiebeschrijving() { return inpLocatiebeschrijving; } public void setInpLocatiebeschrijving(final String inpLocatiebeschrijving) { this.inpLocatiebeschrijving = inpLocatiebeschrijving; } }
NL-AMS-LOCGOV/zaakafhandelcomponent
src/main/java/net/atos/client/zgw/zrc/model/VerblijfsAdres.java
838
/** * De unieke identificatie van het OBJECT * - required * -maxLength: 100 */
block_comment
nl
/* * SPDX-FileCopyrightText: 2021 Atos * SPDX-License-Identifier: EUPL-1.2+ */ package net.atos.client.zgw.zrc.model; public class VerblijfsAdres { /** * De unieke identificatie<SUF>*/ private String aoaIdentificatie; /** * - required * - maxLength: 80 */ private String wplWoonplaatsNaam; /** * Een door het bevoegde gemeentelijke orgaan aan een OPENBARE RUIMTE toegekende benaming * - required * - maxLength: 80 */ private String gorOpenbareRuimteNaam; /** * - maxLength: 7 */ private String aoaPostcode; /** * - required * - maximum: 99999 * - minimum: 0 */ private Integer aoaHuisnummer; /** * - maxLength: 1 */ private String aoaHuisletter; /** * - maxLength: 4 */ private String aoaHuisnummertoevoeging; /** * maxLength: 1000 */ private String inpLocatiebeschrijving; public String getAoaIdentificatie() { return aoaIdentificatie; } public void setAoaIdentificatie(final String aoaIdentificatie) { this.aoaIdentificatie = aoaIdentificatie; } public String getWplWoonplaatsNaam() { return wplWoonplaatsNaam; } public void setWplWoonplaatsNaam(final String wplWoonplaatsNaam) { this.wplWoonplaatsNaam = wplWoonplaatsNaam; } public String getGorOpenbareRuimteNaam() { return gorOpenbareRuimteNaam; } public void setGorOpenbareRuimteNaam(final String gorOpenbareRuimteNaam) { this.gorOpenbareRuimteNaam = gorOpenbareRuimteNaam; } public String getAoaPostcode() { return aoaPostcode; } public void setAoaPostcode(final String aoaPostcode) { this.aoaPostcode = aoaPostcode; } public Integer getAoaHuisnummer() { return aoaHuisnummer; } public void setAoaHuisnummer(final Integer aoaHuisnummer) { this.aoaHuisnummer = aoaHuisnummer; } public String getAoaHuisletter() { return aoaHuisletter; } public void setAoaHuisletter(final String aoaHuisletter) { this.aoaHuisletter = aoaHuisletter; } public String getAoaHuisnummertoevoeging() { return aoaHuisnummertoevoeging; } public void setAoaHuisnummertoevoeging(final String aoaHuisnummertoevoeging) { this.aoaHuisnummertoevoeging = aoaHuisnummertoevoeging; } public String getInpLocatiebeschrijving() { return inpLocatiebeschrijving; } public void setInpLocatiebeschrijving(final String inpLocatiebeschrijving) { this.inpLocatiebeschrijving = inpLocatiebeschrijving; } }
214310_3
/* * SPDX-FileCopyrightText: 2021 Atos * SPDX-License-Identifier: EUPL-1.2+ */ package net.atos.client.zgw.zrc.model; public class VerblijfsAdres { /** * De unieke identificatie van het OBJECT * - required * -maxLength: 100 */ private String aoaIdentificatie; /** * - required * - maxLength: 80 */ private String wplWoonplaatsNaam; /** * Een door het bevoegde gemeentelijke orgaan aan een OPENBARE RUIMTE toegekende benaming * - required * - maxLength: 80 */ private String gorOpenbareRuimteNaam; /** * - maxLength: 7 */ private String aoaPostcode; /** * - required * - maximum: 99999 * - minimum: 0 */ private Integer aoaHuisnummer; /** * - maxLength: 1 */ private String aoaHuisletter; /** * - maxLength: 4 */ private String aoaHuisnummertoevoeging; /** * maxLength: 1000 */ private String inpLocatiebeschrijving; public String getAoaIdentificatie() { return aoaIdentificatie; } public void setAoaIdentificatie(final String aoaIdentificatie) { this.aoaIdentificatie = aoaIdentificatie; } public String getWplWoonplaatsNaam() { return wplWoonplaatsNaam; } public void setWplWoonplaatsNaam(final String wplWoonplaatsNaam) { this.wplWoonplaatsNaam = wplWoonplaatsNaam; } public String getGorOpenbareRuimteNaam() { return gorOpenbareRuimteNaam; } public void setGorOpenbareRuimteNaam(final String gorOpenbareRuimteNaam) { this.gorOpenbareRuimteNaam = gorOpenbareRuimteNaam; } public String getAoaPostcode() { return aoaPostcode; } public void setAoaPostcode(final String aoaPostcode) { this.aoaPostcode = aoaPostcode; } public Integer getAoaHuisnummer() { return aoaHuisnummer; } public void setAoaHuisnummer(final Integer aoaHuisnummer) { this.aoaHuisnummer = aoaHuisnummer; } public String getAoaHuisletter() { return aoaHuisletter; } public void setAoaHuisletter(final String aoaHuisletter) { this.aoaHuisletter = aoaHuisletter; } public String getAoaHuisnummertoevoeging() { return aoaHuisnummertoevoeging; } public void setAoaHuisnummertoevoeging(final String aoaHuisnummertoevoeging) { this.aoaHuisnummertoevoeging = aoaHuisnummertoevoeging; } public String getInpLocatiebeschrijving() { return inpLocatiebeschrijving; } public void setInpLocatiebeschrijving(final String inpLocatiebeschrijving) { this.inpLocatiebeschrijving = inpLocatiebeschrijving; } }
NL-AMS-LOCGOV/zaakafhandelcomponent
src/main/java/net/atos/client/zgw/zrc/model/VerblijfsAdres.java
838
/** * Een door het bevoegde gemeentelijke orgaan aan een OPENBARE RUIMTE toegekende benaming * - required * - maxLength: 80 */
block_comment
nl
/* * SPDX-FileCopyrightText: 2021 Atos * SPDX-License-Identifier: EUPL-1.2+ */ package net.atos.client.zgw.zrc.model; public class VerblijfsAdres { /** * De unieke identificatie van het OBJECT * - required * -maxLength: 100 */ private String aoaIdentificatie; /** * - required * - maxLength: 80 */ private String wplWoonplaatsNaam; /** * Een door het<SUF>*/ private String gorOpenbareRuimteNaam; /** * - maxLength: 7 */ private String aoaPostcode; /** * - required * - maximum: 99999 * - minimum: 0 */ private Integer aoaHuisnummer; /** * - maxLength: 1 */ private String aoaHuisletter; /** * - maxLength: 4 */ private String aoaHuisnummertoevoeging; /** * maxLength: 1000 */ private String inpLocatiebeschrijving; public String getAoaIdentificatie() { return aoaIdentificatie; } public void setAoaIdentificatie(final String aoaIdentificatie) { this.aoaIdentificatie = aoaIdentificatie; } public String getWplWoonplaatsNaam() { return wplWoonplaatsNaam; } public void setWplWoonplaatsNaam(final String wplWoonplaatsNaam) { this.wplWoonplaatsNaam = wplWoonplaatsNaam; } public String getGorOpenbareRuimteNaam() { return gorOpenbareRuimteNaam; } public void setGorOpenbareRuimteNaam(final String gorOpenbareRuimteNaam) { this.gorOpenbareRuimteNaam = gorOpenbareRuimteNaam; } public String getAoaPostcode() { return aoaPostcode; } public void setAoaPostcode(final String aoaPostcode) { this.aoaPostcode = aoaPostcode; } public Integer getAoaHuisnummer() { return aoaHuisnummer; } public void setAoaHuisnummer(final Integer aoaHuisnummer) { this.aoaHuisnummer = aoaHuisnummer; } public String getAoaHuisletter() { return aoaHuisletter; } public void setAoaHuisletter(final String aoaHuisletter) { this.aoaHuisletter = aoaHuisletter; } public String getAoaHuisnummertoevoeging() { return aoaHuisnummertoevoeging; } public void setAoaHuisnummertoevoeging(final String aoaHuisnummertoevoeging) { this.aoaHuisnummertoevoeging = aoaHuisnummertoevoeging; } public String getInpLocatiebeschrijving() { return inpLocatiebeschrijving; } public void setInpLocatiebeschrijving(final String inpLocatiebeschrijving) { this.inpLocatiebeschrijving = inpLocatiebeschrijving; } }
214355_2
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/ZauberDauer.java
1,766
/** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal<SUF>*/ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
214355_12
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/ZauberDauer.java
1,766
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --><SUF>*/ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
214355_13
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/ZauberDauer.java
1,766
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --><SUF>*/ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
214355_14
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/ZauberDauer.java
1,766
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --><SUF>*/ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
214355_16
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/ZauberDauer.java
1,766
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --><SUF>*/ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
214355_17
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/ZauberDauer.java
1,766
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --><SUF>*/ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
214355_18
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/ZauberDauer.java
1,766
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Zauber Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getZauberDauer() * @model * @generated */ public enum ZauberDauer implements Enumerator { /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(0, "Sofort", "Sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(1, "Aufrechterhalten", "Aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(2, "Permanent", "Permanent"); /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="Sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 0; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="Aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 1; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="Permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 2; /** * An array of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final ZauberDauer[] VALUES_ARRAY = new ZauberDauer[] { SOFORT, AUFRECHTERHALTEN, PERMANENT, }; /** * A public read-only list of all the '<em><b>Zauber Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<ZauberDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ZauberDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Zauber Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ZauberDauer get(int value) { switch (value) { case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private ZauberDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --><SUF>*/ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //ZauberDauer
214356_2
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal<SUF>*/ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_3
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal<SUF>*/ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_5
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal<SUF>*/ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_16
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --><SUF>*/ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_17
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --><SUF>*/ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_18
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --><SUF>*/ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_20
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --><SUF>*/ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_21
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --><SUF>*/ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214356_22
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
UrsZeidler/shr5rcp
de.urszeidler.shr5.model/src/de/urszeidler/eclipse/shr5/CritterDauer.java
2,216
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
block_comment
nl
/** */ package de.urszeidler.eclipse.shr5; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Critter Dauer</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see de.urszeidler.eclipse.shr5.Shr5Package#getCritterDauer() * @model * @generated */ public enum CritterDauer implements Enumerator { /** * The '<em><b>Immer</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #IMMER_VALUE * @generated * @ordered */ IMMER(0, "immer", "immer"), /** * The '<em><b>Sofort</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SOFORT_VALUE * @generated * @ordered */ SOFORT(1, "sofort", "sofort"), /** * The '<em><b>Aufrechterhalten</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN_VALUE * @generated * @ordered */ AUFRECHTERHALTEN(2, "aufrechterhalten", "aufrechterhalten"), /** * The '<em><b>Permanent</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #PERMANENT_VALUE * @generated * @ordered */ PERMANENT(3, "permanent", "permanent"), /** * The '<em><b>Speziell</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SPEZIELL_VALUE * @generated * @ordered */ SPEZIELL(4, "speziell", "speziell"); /** * The '<em><b>Immer</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Immer</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #IMMER * @model name="immer" * @generated * @ordered */ public static final int IMMER_VALUE = 0; /** * The '<em><b>Sofort</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Sofort</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SOFORT * @model name="sofort" * @generated * @ordered */ public static final int SOFORT_VALUE = 1; /** * The '<em><b>Aufrechterhalten</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Aufrechterhalten</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #AUFRECHTERHALTEN * @model name="aufrechterhalten" * @generated * @ordered */ public static final int AUFRECHTERHALTEN_VALUE = 2; /** * The '<em><b>Permanent</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Permanent</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #PERMANENT * @model name="permanent" * @generated * @ordered */ public static final int PERMANENT_VALUE = 3; /** * The '<em><b>Speziell</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>Speziell</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SPEZIELL * @model name="speziell" * @generated * @ordered */ public static final int SPEZIELL_VALUE = 4; /** * An array of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final CritterDauer[] VALUES_ARRAY = new CritterDauer[] { IMMER, SOFORT, AUFRECHTERHALTEN, PERMANENT, SPEZIELL, }; /** * A public read-only list of all the '<em><b>Critter Dauer</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<CritterDauer> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CritterDauer result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Critter Dauer</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static CritterDauer get(int value) { switch (value) { case IMMER_VALUE: return IMMER; case SOFORT_VALUE: return SOFORT; case AUFRECHTERHALTEN_VALUE: return AUFRECHTERHALTEN; case PERMANENT_VALUE: return PERMANENT; case SPEZIELL_VALUE: return SPEZIELL; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private CritterDauer(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --><SUF>*/ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //CritterDauer
214364_6
package de.kekru.struktogrammeditor.struktogrammelemente; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.ArrayList; import org.jdom.Element; import de.kekru.struktogrammeditor.other.JTextAreaEasy; public class StruktogrammElementListe extends ArrayList<StruktogrammElement> {//erbt von generischer ArrayList private static final long serialVersionUID = -122818269830027765L; private Rectangle bereich; private Graphics2D g; private String beschreibung = ""; //hier wird bei einer Fallauswahl und bei einer Verzweigung gespeichert, was über der jeweiligen Spalte stehen soll public StruktogrammElementListe(Graphics2D g){ super(); bereich = new Rectangle(); this.g = g; add(new LeerElement(g)); //Am Anfang kommt ein Leerelement in die Liste } public void setzeBeschreibung(String beschr){ beschreibung = beschr; } public String gibBeschreibung(){ return beschreibung; } public int gibAnzahlUnterelemente(){ return size(); } public void quellcodeAllerUnterelementeGenerieren(int typ, int anzahlEingerueckt, int anzahlEinzuruecken, boolean alsKommentar, JTextAreaEasy textarea){ for (int i=0; i < size(); i++){ get(i).quellcodeGenerieren(typ, anzahlEingerueckt, anzahlEinzuruecken, alsKommentar, textarea); } } public void schreibeXMLDatenAllerUnterElemente(Element parent){ //if (!(get(0) instanceof LeerElement)){//alle Struktogrammelemente, außer LeerElement, müssen XML-Daten schreiben for (int i=0; i < size(); i++){ get(i).schreibeXMLDaten(parent); } //} } private int gibTextbreite(String s){ return g != null ? (int) g.getFontMetrics().getStringBounds(s, g).getBounds().getWidth() : s.length() * 4;//http://www.tutorials.de/java/288641-textlaenge-pixel.html } public void alleZeichnen(){ for (int i=0; i < size(); i++){ get(i).zeichne(); } } public void graphicsAllerUnterlementeSetzen(Graphics2D g){ this.g = g; for (int i=0; i < size(); i++){ get(i).setzeGraphics(g); } } public boolean istUnterelement(StruktogrammElement eventuellesUnterelement){ for (int i=0; i < size(); i++){ if((get(i) == eventuellesUnterelement) || (get(i).istUnterelement(eventuellesUnterelement))){//wenn get(i) das Gesuchte ist, oder wenn get(i) das gesuchte Unterelement beinhaltet, wird true zurückgegeben return true; } } return false; } public void hinzufuegen(StruktogrammElement neues){//am Ende einfügen hinzufuegen(neues,null,true); } public void hinzufuegen(StruktogrammElement neues, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ ArrayList<StruktogrammElement> list = new ArrayList<StruktogrammElement>(); list.add(neues); hinzufuegen(list, naechstesOderVorheriges, vorDemAltenEinfuegen); } public void hinzufuegen(ArrayList<StruktogrammElement> neue, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ Object leeres = null; if (!isEmpty() && (get(0) instanceof LeerElement)){ leeres = get(0); //das LeerElement merken } if (naechstesOderVorheriges != null){ int position = indexOf(naechstesOderVorheriges); //Position des Elementes hinter oder vor dem das Neue eingefügt werden soll if (!vorDemAltenEinfuegen){//wenn nach dem alten Element eingefügt werden soll, wird die Position um 1 inkrementiert position++; } for(StruktogrammElement strElem : neue){ add(position, strElem);//Einfügen an der Stelle position; das Element, das vorher an dieser Position war, wird um eine Stelle weiter geschoben position++; } }else{ for(StruktogrammElement strElem : neue){ add(strElem); //Am Ende einfügen } } if (leeres != null){ remove(indexOf(leeres)); //das LeerElement entfernen } } public void entfernen(StruktogrammElement zuLoeschen){ remove(indexOf(zuLoeschen)); if (size() == 0){ add(new LeerElement(g)); //wenn die Liste jetzt leer ist, ein LeerElement einfügen } } public void alleEntfernen(){ clear(); add(new LeerElement(g)); } public Object gibElementAnPos(int x, int y, boolean nurListe){ if (bereich.contains(x,y)){ //Punkt ist innerhalb dieser Liste Object tmp; for (int i=0; i < size(); i++){ tmp = get(i).gibElementAnPos(x,y,nurListe); if (tmp != null){ return tmp; //das Listen-Element mit dem Index i beinhaltet den Punkt, dieses oder eines seiner Unterelemente wird zurückgegeben } } if (nurListe){ //es wurde noch kein Element zurückgegeben (auch keine weiter innere Liste), wenn also nach einer Liste gefragt ist... return this; //...wird diese zurückgeliefert } } return null; //Punkt ist nicht innerhalb dieser Liste } public StruktogrammElementListe gibListeDieDasElementHat(StruktogrammElement element){ StruktogrammElementListe tmp; for (int i=0; i < size(); i++){ if(get(i) == element){ return this; //ich habe das Element }else{ tmp = get(i).gibListeDieDasElementHat(element); if (tmp != null){ return tmp; //eine der Listen meiner Unterelemente hat das Element } } } return null; //ich und auch keine meiner Unterelemente hat das gesucht Element } //gibt die Breite des breitesten Unterelementes und die addierte Höhe aller Unterelemente an public Dimension gibDimensionDerUnterelemente(){ int breite = 0; int hoehe = 0; Rectangle rect; for (int i=0; i < size(); i++){ rect = get(i).gibRectangle(); if (rect.width > breite){ breite = rect.width; } hoehe += rect.height; } return new Dimension(breite, hoehe); } public void xPosAllerUnterelementeSetzen(int x){ for (int i=0; i < size(); i++){ get(i).setzeXPos(x); } bereich.x = x; } public void breiteDerUnterelementeSetzen(int neueBreite){ for (int i=0; i < size(); i++){ get(i).setzeBreite(neueBreite); } bereich.width = neueBreite; } public void gesamtHoeheSetzen(int neueHoehe){//Höhe des letzten Elementes wird verändert if(size() > 0){ int hoeheVorher = get(size() -1).gibHoehe(); //Höhe des letzten Elementes ermitteln get(size() -1).setzeHoehe(neueHoehe - (bereich.height - hoeheVorher)); //neue Höhe des letzten Elementes setzen } bereich.height = neueHoehe; } public Rectangle zeichenbereichAllerElementeAktualisieren(int x, int y){ int neueYPos = y; for (int i = 0; i < size(); i++){ neueYPos += get(i).zeichenbereichAktualisieren(x,neueYPos).getHeight();//Zeichenbereich von Element get(i) wird aktualisiert mit den Koordinaten x und neueYPos; neueYPos wird dabei für das nächste Element um die Höhe des aktuellen Elementes vergrößert } Dimension dim = gibDimensionDerUnterelemente();//größte Breite eines Unterlementes und Gesamthöhe aller Unterelemente if (dim.width < gibTextbreite(gibBeschreibung() +8)){//Beschreibung ist bei Verzweigung und Fallauswahl kein leerer String (wird gesetzt in setzeFaelle(...) durch den EingabeDialog) dim.width = gibTextbreite(gibBeschreibung()) +8; } breiteDerUnterelementeSetzen(dim.width);//alle Unterelemente auf die gleiche Breite bringen bereich.setSize(dim); bereich.setLocation(x,y); return bereich; } public int gibBreite(){ return bereich.width; } public int gibHoehe(){ return bereich.height; } public int gibRechterRand(){ return bereich.x + bereich.width; } public int gibX(){ return bereich.x; } public void zoomsAllerElementeZuruecksetzen(){ for(int i=0; i < size(); i++){ get(i).zoomsZuruecksetzen(); } } }
kekru/struktogrammeditor
src/main/java/de/kekru/struktogrammeditor/struktogrammelemente/StruktogrammElementListe.java
2,612
//das LeerElement merken
line_comment
nl
package de.kekru.struktogrammeditor.struktogrammelemente; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.ArrayList; import org.jdom.Element; import de.kekru.struktogrammeditor.other.JTextAreaEasy; public class StruktogrammElementListe extends ArrayList<StruktogrammElement> {//erbt von generischer ArrayList private static final long serialVersionUID = -122818269830027765L; private Rectangle bereich; private Graphics2D g; private String beschreibung = ""; //hier wird bei einer Fallauswahl und bei einer Verzweigung gespeichert, was über der jeweiligen Spalte stehen soll public StruktogrammElementListe(Graphics2D g){ super(); bereich = new Rectangle(); this.g = g; add(new LeerElement(g)); //Am Anfang kommt ein Leerelement in die Liste } public void setzeBeschreibung(String beschr){ beschreibung = beschr; } public String gibBeschreibung(){ return beschreibung; } public int gibAnzahlUnterelemente(){ return size(); } public void quellcodeAllerUnterelementeGenerieren(int typ, int anzahlEingerueckt, int anzahlEinzuruecken, boolean alsKommentar, JTextAreaEasy textarea){ for (int i=0; i < size(); i++){ get(i).quellcodeGenerieren(typ, anzahlEingerueckt, anzahlEinzuruecken, alsKommentar, textarea); } } public void schreibeXMLDatenAllerUnterElemente(Element parent){ //if (!(get(0) instanceof LeerElement)){//alle Struktogrammelemente, außer LeerElement, müssen XML-Daten schreiben for (int i=0; i < size(); i++){ get(i).schreibeXMLDaten(parent); } //} } private int gibTextbreite(String s){ return g != null ? (int) g.getFontMetrics().getStringBounds(s, g).getBounds().getWidth() : s.length() * 4;//http://www.tutorials.de/java/288641-textlaenge-pixel.html } public void alleZeichnen(){ for (int i=0; i < size(); i++){ get(i).zeichne(); } } public void graphicsAllerUnterlementeSetzen(Graphics2D g){ this.g = g; for (int i=0; i < size(); i++){ get(i).setzeGraphics(g); } } public boolean istUnterelement(StruktogrammElement eventuellesUnterelement){ for (int i=0; i < size(); i++){ if((get(i) == eventuellesUnterelement) || (get(i).istUnterelement(eventuellesUnterelement))){//wenn get(i) das Gesuchte ist, oder wenn get(i) das gesuchte Unterelement beinhaltet, wird true zurückgegeben return true; } } return false; } public void hinzufuegen(StruktogrammElement neues){//am Ende einfügen hinzufuegen(neues,null,true); } public void hinzufuegen(StruktogrammElement neues, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ ArrayList<StruktogrammElement> list = new ArrayList<StruktogrammElement>(); list.add(neues); hinzufuegen(list, naechstesOderVorheriges, vorDemAltenEinfuegen); } public void hinzufuegen(ArrayList<StruktogrammElement> neue, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ Object leeres = null; if (!isEmpty() && (get(0) instanceof LeerElement)){ leeres = get(0); //das LeerElement<SUF> } if (naechstesOderVorheriges != null){ int position = indexOf(naechstesOderVorheriges); //Position des Elementes hinter oder vor dem das Neue eingefügt werden soll if (!vorDemAltenEinfuegen){//wenn nach dem alten Element eingefügt werden soll, wird die Position um 1 inkrementiert position++; } for(StruktogrammElement strElem : neue){ add(position, strElem);//Einfügen an der Stelle position; das Element, das vorher an dieser Position war, wird um eine Stelle weiter geschoben position++; } }else{ for(StruktogrammElement strElem : neue){ add(strElem); //Am Ende einfügen } } if (leeres != null){ remove(indexOf(leeres)); //das LeerElement entfernen } } public void entfernen(StruktogrammElement zuLoeschen){ remove(indexOf(zuLoeschen)); if (size() == 0){ add(new LeerElement(g)); //wenn die Liste jetzt leer ist, ein LeerElement einfügen } } public void alleEntfernen(){ clear(); add(new LeerElement(g)); } public Object gibElementAnPos(int x, int y, boolean nurListe){ if (bereich.contains(x,y)){ //Punkt ist innerhalb dieser Liste Object tmp; for (int i=0; i < size(); i++){ tmp = get(i).gibElementAnPos(x,y,nurListe); if (tmp != null){ return tmp; //das Listen-Element mit dem Index i beinhaltet den Punkt, dieses oder eines seiner Unterelemente wird zurückgegeben } } if (nurListe){ //es wurde noch kein Element zurückgegeben (auch keine weiter innere Liste), wenn also nach einer Liste gefragt ist... return this; //...wird diese zurückgeliefert } } return null; //Punkt ist nicht innerhalb dieser Liste } public StruktogrammElementListe gibListeDieDasElementHat(StruktogrammElement element){ StruktogrammElementListe tmp; for (int i=0; i < size(); i++){ if(get(i) == element){ return this; //ich habe das Element }else{ tmp = get(i).gibListeDieDasElementHat(element); if (tmp != null){ return tmp; //eine der Listen meiner Unterelemente hat das Element } } } return null; //ich und auch keine meiner Unterelemente hat das gesucht Element } //gibt die Breite des breitesten Unterelementes und die addierte Höhe aller Unterelemente an public Dimension gibDimensionDerUnterelemente(){ int breite = 0; int hoehe = 0; Rectangle rect; for (int i=0; i < size(); i++){ rect = get(i).gibRectangle(); if (rect.width > breite){ breite = rect.width; } hoehe += rect.height; } return new Dimension(breite, hoehe); } public void xPosAllerUnterelementeSetzen(int x){ for (int i=0; i < size(); i++){ get(i).setzeXPos(x); } bereich.x = x; } public void breiteDerUnterelementeSetzen(int neueBreite){ for (int i=0; i < size(); i++){ get(i).setzeBreite(neueBreite); } bereich.width = neueBreite; } public void gesamtHoeheSetzen(int neueHoehe){//Höhe des letzten Elementes wird verändert if(size() > 0){ int hoeheVorher = get(size() -1).gibHoehe(); //Höhe des letzten Elementes ermitteln get(size() -1).setzeHoehe(neueHoehe - (bereich.height - hoeheVorher)); //neue Höhe des letzten Elementes setzen } bereich.height = neueHoehe; } public Rectangle zeichenbereichAllerElementeAktualisieren(int x, int y){ int neueYPos = y; for (int i = 0; i < size(); i++){ neueYPos += get(i).zeichenbereichAktualisieren(x,neueYPos).getHeight();//Zeichenbereich von Element get(i) wird aktualisiert mit den Koordinaten x und neueYPos; neueYPos wird dabei für das nächste Element um die Höhe des aktuellen Elementes vergrößert } Dimension dim = gibDimensionDerUnterelemente();//größte Breite eines Unterlementes und Gesamthöhe aller Unterelemente if (dim.width < gibTextbreite(gibBeschreibung() +8)){//Beschreibung ist bei Verzweigung und Fallauswahl kein leerer String (wird gesetzt in setzeFaelle(...) durch den EingabeDialog) dim.width = gibTextbreite(gibBeschreibung()) +8; } breiteDerUnterelementeSetzen(dim.width);//alle Unterelemente auf die gleiche Breite bringen bereich.setSize(dim); bereich.setLocation(x,y); return bereich; } public int gibBreite(){ return bereich.width; } public int gibHoehe(){ return bereich.height; } public int gibRechterRand(){ return bereich.x + bereich.width; } public int gibX(){ return bereich.x; } public void zoomsAllerElementeZuruecksetzen(){ for(int i=0; i < size(); i++){ get(i).zoomsZuruecksetzen(); } } }
214364_11
package de.kekru.struktogrammeditor.struktogrammelemente; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.ArrayList; import org.jdom.Element; import de.kekru.struktogrammeditor.other.JTextAreaEasy; public class StruktogrammElementListe extends ArrayList<StruktogrammElement> {//erbt von generischer ArrayList private static final long serialVersionUID = -122818269830027765L; private Rectangle bereich; private Graphics2D g; private String beschreibung = ""; //hier wird bei einer Fallauswahl und bei einer Verzweigung gespeichert, was über der jeweiligen Spalte stehen soll public StruktogrammElementListe(Graphics2D g){ super(); bereich = new Rectangle(); this.g = g; add(new LeerElement(g)); //Am Anfang kommt ein Leerelement in die Liste } public void setzeBeschreibung(String beschr){ beschreibung = beschr; } public String gibBeschreibung(){ return beschreibung; } public int gibAnzahlUnterelemente(){ return size(); } public void quellcodeAllerUnterelementeGenerieren(int typ, int anzahlEingerueckt, int anzahlEinzuruecken, boolean alsKommentar, JTextAreaEasy textarea){ for (int i=0; i < size(); i++){ get(i).quellcodeGenerieren(typ, anzahlEingerueckt, anzahlEinzuruecken, alsKommentar, textarea); } } public void schreibeXMLDatenAllerUnterElemente(Element parent){ //if (!(get(0) instanceof LeerElement)){//alle Struktogrammelemente, außer LeerElement, müssen XML-Daten schreiben for (int i=0; i < size(); i++){ get(i).schreibeXMLDaten(parent); } //} } private int gibTextbreite(String s){ return g != null ? (int) g.getFontMetrics().getStringBounds(s, g).getBounds().getWidth() : s.length() * 4;//http://www.tutorials.de/java/288641-textlaenge-pixel.html } public void alleZeichnen(){ for (int i=0; i < size(); i++){ get(i).zeichne(); } } public void graphicsAllerUnterlementeSetzen(Graphics2D g){ this.g = g; for (int i=0; i < size(); i++){ get(i).setzeGraphics(g); } } public boolean istUnterelement(StruktogrammElement eventuellesUnterelement){ for (int i=0; i < size(); i++){ if((get(i) == eventuellesUnterelement) || (get(i).istUnterelement(eventuellesUnterelement))){//wenn get(i) das Gesuchte ist, oder wenn get(i) das gesuchte Unterelement beinhaltet, wird true zurückgegeben return true; } } return false; } public void hinzufuegen(StruktogrammElement neues){//am Ende einfügen hinzufuegen(neues,null,true); } public void hinzufuegen(StruktogrammElement neues, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ ArrayList<StruktogrammElement> list = new ArrayList<StruktogrammElement>(); list.add(neues); hinzufuegen(list, naechstesOderVorheriges, vorDemAltenEinfuegen); } public void hinzufuegen(ArrayList<StruktogrammElement> neue, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ Object leeres = null; if (!isEmpty() && (get(0) instanceof LeerElement)){ leeres = get(0); //das LeerElement merken } if (naechstesOderVorheriges != null){ int position = indexOf(naechstesOderVorheriges); //Position des Elementes hinter oder vor dem das Neue eingefügt werden soll if (!vorDemAltenEinfuegen){//wenn nach dem alten Element eingefügt werden soll, wird die Position um 1 inkrementiert position++; } for(StruktogrammElement strElem : neue){ add(position, strElem);//Einfügen an der Stelle position; das Element, das vorher an dieser Position war, wird um eine Stelle weiter geschoben position++; } }else{ for(StruktogrammElement strElem : neue){ add(strElem); //Am Ende einfügen } } if (leeres != null){ remove(indexOf(leeres)); //das LeerElement entfernen } } public void entfernen(StruktogrammElement zuLoeschen){ remove(indexOf(zuLoeschen)); if (size() == 0){ add(new LeerElement(g)); //wenn die Liste jetzt leer ist, ein LeerElement einfügen } } public void alleEntfernen(){ clear(); add(new LeerElement(g)); } public Object gibElementAnPos(int x, int y, boolean nurListe){ if (bereich.contains(x,y)){ //Punkt ist innerhalb dieser Liste Object tmp; for (int i=0; i < size(); i++){ tmp = get(i).gibElementAnPos(x,y,nurListe); if (tmp != null){ return tmp; //das Listen-Element mit dem Index i beinhaltet den Punkt, dieses oder eines seiner Unterelemente wird zurückgegeben } } if (nurListe){ //es wurde noch kein Element zurückgegeben (auch keine weiter innere Liste), wenn also nach einer Liste gefragt ist... return this; //...wird diese zurückgeliefert } } return null; //Punkt ist nicht innerhalb dieser Liste } public StruktogrammElementListe gibListeDieDasElementHat(StruktogrammElement element){ StruktogrammElementListe tmp; for (int i=0; i < size(); i++){ if(get(i) == element){ return this; //ich habe das Element }else{ tmp = get(i).gibListeDieDasElementHat(element); if (tmp != null){ return tmp; //eine der Listen meiner Unterelemente hat das Element } } } return null; //ich und auch keine meiner Unterelemente hat das gesucht Element } //gibt die Breite des breitesten Unterelementes und die addierte Höhe aller Unterelemente an public Dimension gibDimensionDerUnterelemente(){ int breite = 0; int hoehe = 0; Rectangle rect; for (int i=0; i < size(); i++){ rect = get(i).gibRectangle(); if (rect.width > breite){ breite = rect.width; } hoehe += rect.height; } return new Dimension(breite, hoehe); } public void xPosAllerUnterelementeSetzen(int x){ for (int i=0; i < size(); i++){ get(i).setzeXPos(x); } bereich.x = x; } public void breiteDerUnterelementeSetzen(int neueBreite){ for (int i=0; i < size(); i++){ get(i).setzeBreite(neueBreite); } bereich.width = neueBreite; } public void gesamtHoeheSetzen(int neueHoehe){//Höhe des letzten Elementes wird verändert if(size() > 0){ int hoeheVorher = get(size() -1).gibHoehe(); //Höhe des letzten Elementes ermitteln get(size() -1).setzeHoehe(neueHoehe - (bereich.height - hoeheVorher)); //neue Höhe des letzten Elementes setzen } bereich.height = neueHoehe; } public Rectangle zeichenbereichAllerElementeAktualisieren(int x, int y){ int neueYPos = y; for (int i = 0; i < size(); i++){ neueYPos += get(i).zeichenbereichAktualisieren(x,neueYPos).getHeight();//Zeichenbereich von Element get(i) wird aktualisiert mit den Koordinaten x und neueYPos; neueYPos wird dabei für das nächste Element um die Höhe des aktuellen Elementes vergrößert } Dimension dim = gibDimensionDerUnterelemente();//größte Breite eines Unterlementes und Gesamthöhe aller Unterelemente if (dim.width < gibTextbreite(gibBeschreibung() +8)){//Beschreibung ist bei Verzweigung und Fallauswahl kein leerer String (wird gesetzt in setzeFaelle(...) durch den EingabeDialog) dim.width = gibTextbreite(gibBeschreibung()) +8; } breiteDerUnterelementeSetzen(dim.width);//alle Unterelemente auf die gleiche Breite bringen bereich.setSize(dim); bereich.setLocation(x,y); return bereich; } public int gibBreite(){ return bereich.width; } public int gibHoehe(){ return bereich.height; } public int gibRechterRand(){ return bereich.x + bereich.width; } public int gibX(){ return bereich.x; } public void zoomsAllerElementeZuruecksetzen(){ for(int i=0; i < size(); i++){ get(i).zoomsZuruecksetzen(); } } }
kekru/struktogrammeditor
src/main/java/de/kekru/struktogrammeditor/struktogrammelemente/StruktogrammElementListe.java
2,612
//das LeerElement entfernen
line_comment
nl
package de.kekru.struktogrammeditor.struktogrammelemente; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.ArrayList; import org.jdom.Element; import de.kekru.struktogrammeditor.other.JTextAreaEasy; public class StruktogrammElementListe extends ArrayList<StruktogrammElement> {//erbt von generischer ArrayList private static final long serialVersionUID = -122818269830027765L; private Rectangle bereich; private Graphics2D g; private String beschreibung = ""; //hier wird bei einer Fallauswahl und bei einer Verzweigung gespeichert, was über der jeweiligen Spalte stehen soll public StruktogrammElementListe(Graphics2D g){ super(); bereich = new Rectangle(); this.g = g; add(new LeerElement(g)); //Am Anfang kommt ein Leerelement in die Liste } public void setzeBeschreibung(String beschr){ beschreibung = beschr; } public String gibBeschreibung(){ return beschreibung; } public int gibAnzahlUnterelemente(){ return size(); } public void quellcodeAllerUnterelementeGenerieren(int typ, int anzahlEingerueckt, int anzahlEinzuruecken, boolean alsKommentar, JTextAreaEasy textarea){ for (int i=0; i < size(); i++){ get(i).quellcodeGenerieren(typ, anzahlEingerueckt, anzahlEinzuruecken, alsKommentar, textarea); } } public void schreibeXMLDatenAllerUnterElemente(Element parent){ //if (!(get(0) instanceof LeerElement)){//alle Struktogrammelemente, außer LeerElement, müssen XML-Daten schreiben for (int i=0; i < size(); i++){ get(i).schreibeXMLDaten(parent); } //} } private int gibTextbreite(String s){ return g != null ? (int) g.getFontMetrics().getStringBounds(s, g).getBounds().getWidth() : s.length() * 4;//http://www.tutorials.de/java/288641-textlaenge-pixel.html } public void alleZeichnen(){ for (int i=0; i < size(); i++){ get(i).zeichne(); } } public void graphicsAllerUnterlementeSetzen(Graphics2D g){ this.g = g; for (int i=0; i < size(); i++){ get(i).setzeGraphics(g); } } public boolean istUnterelement(StruktogrammElement eventuellesUnterelement){ for (int i=0; i < size(); i++){ if((get(i) == eventuellesUnterelement) || (get(i).istUnterelement(eventuellesUnterelement))){//wenn get(i) das Gesuchte ist, oder wenn get(i) das gesuchte Unterelement beinhaltet, wird true zurückgegeben return true; } } return false; } public void hinzufuegen(StruktogrammElement neues){//am Ende einfügen hinzufuegen(neues,null,true); } public void hinzufuegen(StruktogrammElement neues, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ ArrayList<StruktogrammElement> list = new ArrayList<StruktogrammElement>(); list.add(neues); hinzufuegen(list, naechstesOderVorheriges, vorDemAltenEinfuegen); } public void hinzufuegen(ArrayList<StruktogrammElement> neue, StruktogrammElement naechstesOderVorheriges, boolean vorDemAltenEinfuegen){ Object leeres = null; if (!isEmpty() && (get(0) instanceof LeerElement)){ leeres = get(0); //das LeerElement merken } if (naechstesOderVorheriges != null){ int position = indexOf(naechstesOderVorheriges); //Position des Elementes hinter oder vor dem das Neue eingefügt werden soll if (!vorDemAltenEinfuegen){//wenn nach dem alten Element eingefügt werden soll, wird die Position um 1 inkrementiert position++; } for(StruktogrammElement strElem : neue){ add(position, strElem);//Einfügen an der Stelle position; das Element, das vorher an dieser Position war, wird um eine Stelle weiter geschoben position++; } }else{ for(StruktogrammElement strElem : neue){ add(strElem); //Am Ende einfügen } } if (leeres != null){ remove(indexOf(leeres)); //das LeerElement<SUF> } } public void entfernen(StruktogrammElement zuLoeschen){ remove(indexOf(zuLoeschen)); if (size() == 0){ add(new LeerElement(g)); //wenn die Liste jetzt leer ist, ein LeerElement einfügen } } public void alleEntfernen(){ clear(); add(new LeerElement(g)); } public Object gibElementAnPos(int x, int y, boolean nurListe){ if (bereich.contains(x,y)){ //Punkt ist innerhalb dieser Liste Object tmp; for (int i=0; i < size(); i++){ tmp = get(i).gibElementAnPos(x,y,nurListe); if (tmp != null){ return tmp; //das Listen-Element mit dem Index i beinhaltet den Punkt, dieses oder eines seiner Unterelemente wird zurückgegeben } } if (nurListe){ //es wurde noch kein Element zurückgegeben (auch keine weiter innere Liste), wenn also nach einer Liste gefragt ist... return this; //...wird diese zurückgeliefert } } return null; //Punkt ist nicht innerhalb dieser Liste } public StruktogrammElementListe gibListeDieDasElementHat(StruktogrammElement element){ StruktogrammElementListe tmp; for (int i=0; i < size(); i++){ if(get(i) == element){ return this; //ich habe das Element }else{ tmp = get(i).gibListeDieDasElementHat(element); if (tmp != null){ return tmp; //eine der Listen meiner Unterelemente hat das Element } } } return null; //ich und auch keine meiner Unterelemente hat das gesucht Element } //gibt die Breite des breitesten Unterelementes und die addierte Höhe aller Unterelemente an public Dimension gibDimensionDerUnterelemente(){ int breite = 0; int hoehe = 0; Rectangle rect; for (int i=0; i < size(); i++){ rect = get(i).gibRectangle(); if (rect.width > breite){ breite = rect.width; } hoehe += rect.height; } return new Dimension(breite, hoehe); } public void xPosAllerUnterelementeSetzen(int x){ for (int i=0; i < size(); i++){ get(i).setzeXPos(x); } bereich.x = x; } public void breiteDerUnterelementeSetzen(int neueBreite){ for (int i=0; i < size(); i++){ get(i).setzeBreite(neueBreite); } bereich.width = neueBreite; } public void gesamtHoeheSetzen(int neueHoehe){//Höhe des letzten Elementes wird verändert if(size() > 0){ int hoeheVorher = get(size() -1).gibHoehe(); //Höhe des letzten Elementes ermitteln get(size() -1).setzeHoehe(neueHoehe - (bereich.height - hoeheVorher)); //neue Höhe des letzten Elementes setzen } bereich.height = neueHoehe; } public Rectangle zeichenbereichAllerElementeAktualisieren(int x, int y){ int neueYPos = y; for (int i = 0; i < size(); i++){ neueYPos += get(i).zeichenbereichAktualisieren(x,neueYPos).getHeight();//Zeichenbereich von Element get(i) wird aktualisiert mit den Koordinaten x und neueYPos; neueYPos wird dabei für das nächste Element um die Höhe des aktuellen Elementes vergrößert } Dimension dim = gibDimensionDerUnterelemente();//größte Breite eines Unterlementes und Gesamthöhe aller Unterelemente if (dim.width < gibTextbreite(gibBeschreibung() +8)){//Beschreibung ist bei Verzweigung und Fallauswahl kein leerer String (wird gesetzt in setzeFaelle(...) durch den EingabeDialog) dim.width = gibTextbreite(gibBeschreibung()) +8; } breiteDerUnterelementeSetzen(dim.width);//alle Unterelemente auf die gleiche Breite bringen bereich.setSize(dim); bereich.setLocation(x,y); return bereich; } public int gibBreite(){ return bereich.width; } public int gibHoehe(){ return bereich.height; } public int gibRechterRand(){ return bereich.x + bereich.width; } public int gibX(){ return bereich.x; } public void zoomsAllerElementeZuruecksetzen(){ for(int i=0; i < size(); i++){ get(i).zoomsZuruecksetzen(); } } }
214383_25
/***************************** AVLBaum.java *********************************/ //import AlgoTools.IO; /** Ein AVLBaum ist ein SuchBaum, bei dem alle Knoten ausgeglichen * sind. Das heisst, die Hoehe aller Teilbaeume unterscheidet sich * maximal um eins. */ package db.avltree; public class AVLBaum extends SuchBaum { private int balance; // Balance public AVLBaum() { // erzeugt leeren AVLBaum balance = 0; } private static class Status { // Innere Klasse zur Uebergabe eines // Status in der Rekursion boolean unbal; // unbal ist true, wenn beim Einfue- // gen ein Sohn groesser geworden ist Status () { // Konstruktor der inneren Klasse unbal = false; // Element noch nicht eingefuegt => } // noch keine Unausgeglichenheit } public String toString() { // fuer Ausgabe: Inhalt(Balance) return inhalt + "(" + balance + ")"; } public boolean insert(Comparable x) throws Exception {// fuegt x in den AVLBaum ein: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion insertAVL return insertAVL(x, new Status()); } private boolean insertAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode zum // Einfuegen (rekursiv) boolean eingefuegt; if (empty()) { // Blatt: Hier kann eingefuegt werden inhalt = x; // Inhalt setzen links = new AVLBaum(); // Neuer leerer AVLBaum links rechts = new AVLBaum(); // Neuer leerer AVLBaum rechts s.unbal = true; // Dieser Teilbaum wurde groesser return true; // Einfuegen erfolgreich und } // dieser Teilbaum groesser else if (((Comparable) value()).compareTo(x) == 0) // Element schon im AVLBaum return false; else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => eingefuegt = ((AVLBaum) left()).insertAVL(x, s); // linker Teilbaum if (s.unbal) { // Linker Teilbaum wurde groesser switch (balance) { case 1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = -1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) links).balance == -1) rotateLL(); else rotateLR(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } else { // Element ist groesser => eingefuegt = ((AVLBaum) right()).insertAVL(x, s);// rechter Teilbaum if (s.unbal) { // Rechter Teilbaum wurde groesser switch (balance) { case -1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = 1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) rechts).balance == 1) rotateRR(); else rotateRL(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } return eingefuegt; // Keine Rotation => Ergebnis zurueck } public void rotateLL() { //IO.println("LL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) rechts; // und rechten Teilbaum // Idee: Inhalt von a1 in die Wurzel links = a1.links; // Setze neuen linken Sohn rechts = a1; // Setze neuen rechten Sohn a1.links = a1.rechts; // Setze dessen linken a1.rechts = a2; // und rechten Sohn Object tmp = a1.inhalt; // Inhalt von rechts (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) rechts).balance = 0; // rechter Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateLR() { //IO.println("LR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) a1.rechts; // und dessen rechten Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.rechts = a2.links; // Setze Soehne von a2 a2.links = a2.rechts; a2.rechts = rechts; rechts = a2; // a2 wird neuer rechter Sohn Object tmp = inhalt; // Inhalt von rechts (==a2) inhalt = rechts.inhalt; // wird mit Wurzel rechts.inhalt = tmp; // getauscht if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; balance = 0; // Wurzel balanciert } public void rotateRR() { //IO.println("RR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten AVLBaum a2 = (AVLBaum) links; // und linken Teilbaum // Idee: Inhalt von a1 in die Wurzel rechts = a1.rechts; // Setze neuen rechten Sohn links = a1; // Setze neuen linken Sohn a1.rechts = a1.links; // Setze dessen rechten a1.links = a2; // und linken Sohn Object tmp = a1.inhalt; // Inhalt von links (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) links).balance = 0; // linker Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateRL() { //IO.println("RL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten Sohn AVLBaum a2 = (AVLBaum) a1.links; // und dessen linken Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.links = a2.rechts; a2.rechts = a2.links; // Setze Soehne von a2 a2.links = links; links = a2; // a2 wird neuer linker Sohn Object tmp = inhalt; // Inhalt von links (==a2) inhalt = links.inhalt; // wird mit Wurzel links.inhalt = tmp; // getauscht if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; balance = 0; // Wurzel balanciert } @Override public boolean delete(Comparable x) throws Exception {// loescht x im AVLBaum: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion deleteAVL return deleteAVL(x, new Status()); } private boolean deleteAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode // zum Loeschen (rekursiv); true, wenn erfolgreich boolean geloescht; // true, wenn geloescht wurde if (empty()) { // Blatt: Element nicht gefunden return false; // => Einfuegen erfolglos } else if (((Comparable) value()).compareTo(x) < 0) { // Element x ist groesser => // Suche rechts weiter geloescht = ((AVLBaum) rechts).deleteAVL(x, s); if (s.unbal == true) balance2(s); // Gleiche ggf. aus return geloescht; } else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => // Suche links weiter geloescht = ((AVLBaum) links).deleteAVL(x, s); if (s.unbal == true) balance1(s); // Gleiche ggf. aus return geloescht; } else { // Element gefunden if (rechts.empty()) { // Kein rechter Sohn inhalt = links.inhalt; // ersetze Knoten durch linken Sohn links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else if (links.empty()) { // Kein linker Sohn inhalt = rechts.inhalt; // ersetze Knoten durch rechten Sohn rechts = rechts.rechts; // Kein rechter Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else { // Beide Soehne vorhanden inhalt = ((AVLBaum) links).del(s); // Rufe del() auf if (s.unbal) { // Gleiche Unbalance aus balance1(s); } } return true; // Loeschen erfolgreich } } private Object del(Status s) { // Sucht Ersatz fuer gel. Objekt Object ersatz; // Das Ersatz-Objekt if (!rechts.empty()) { // Suche groessten Sohn im Teilbaum ersatz = ((AVLBaum) rechts).del(s); if (s.unbal) // Gleicht ggf. Unbalance aus balance2(s); } else { // Tausche mit geloeschtem Knoten ersatz = inhalt; // Merke Ersatz und inhalt = links.inhalt; // ersetze Knoten durch linken Sohn. links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Teilbaum wurde kuerzer } return ersatz; // Gib Ersatz-Objekt zurueck } private void balance1(Status s) { // Unbalance, weil linker Ast kuerzer switch (balance) { case -1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = 1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) rechts).balance; //Merke Balance des rechten Sohns if (b >= 0) { rotateRR(); if (b == 0) { // Gleiche neue Balancen an balance = -1; ((AVLBaum) links).balance = 1; s.unbal = false; } } else rotateRL(); break; } } private void balance2(Status s) { // Unbalance, weil recht. Ast kuerzer switch (balance) { case 1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = -1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) links).balance; // Merke Balance des linken Sohns if (b <= 0) { rotateLL(); if (b == 0) { // Gleiche neue Balancen an balance = 1; ((AVLBaum) rechts).balance = -1; s.unbal = false; } } else rotateLR(); break; } } }
sPyOpenSource/os
src/db/avltree/AVLBaum.java
3,404
// Hier noch kein Rotieren noetig
line_comment
nl
/***************************** AVLBaum.java *********************************/ //import AlgoTools.IO; /** Ein AVLBaum ist ein SuchBaum, bei dem alle Knoten ausgeglichen * sind. Das heisst, die Hoehe aller Teilbaeume unterscheidet sich * maximal um eins. */ package db.avltree; public class AVLBaum extends SuchBaum { private int balance; // Balance public AVLBaum() { // erzeugt leeren AVLBaum balance = 0; } private static class Status { // Innere Klasse zur Uebergabe eines // Status in der Rekursion boolean unbal; // unbal ist true, wenn beim Einfue- // gen ein Sohn groesser geworden ist Status () { // Konstruktor der inneren Klasse unbal = false; // Element noch nicht eingefuegt => } // noch keine Unausgeglichenheit } public String toString() { // fuer Ausgabe: Inhalt(Balance) return inhalt + "(" + balance + ")"; } public boolean insert(Comparable x) throws Exception {// fuegt x in den AVLBaum ein: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion insertAVL return insertAVL(x, new Status()); } private boolean insertAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode zum // Einfuegen (rekursiv) boolean eingefuegt; if (empty()) { // Blatt: Hier kann eingefuegt werden inhalt = x; // Inhalt setzen links = new AVLBaum(); // Neuer leerer AVLBaum links rechts = new AVLBaum(); // Neuer leerer AVLBaum rechts s.unbal = true; // Dieser Teilbaum wurde groesser return true; // Einfuegen erfolgreich und } // dieser Teilbaum groesser else if (((Comparable) value()).compareTo(x) == 0) // Element schon im AVLBaum return false; else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => eingefuegt = ((AVLBaum) left()).insertAVL(x, s); // linker Teilbaum if (s.unbal) { // Linker Teilbaum wurde groesser switch (balance) { case 1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch<SUF> balance = -1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) links).balance == -1) rotateLL(); else rotateLR(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } else { // Element ist groesser => eingefuegt = ((AVLBaum) right()).insertAVL(x, s);// rechter Teilbaum if (s.unbal) { // Rechter Teilbaum wurde groesser switch (balance) { case -1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = 1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) rechts).balance == 1) rotateRR(); else rotateRL(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } return eingefuegt; // Keine Rotation => Ergebnis zurueck } public void rotateLL() { //IO.println("LL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) rechts; // und rechten Teilbaum // Idee: Inhalt von a1 in die Wurzel links = a1.links; // Setze neuen linken Sohn rechts = a1; // Setze neuen rechten Sohn a1.links = a1.rechts; // Setze dessen linken a1.rechts = a2; // und rechten Sohn Object tmp = a1.inhalt; // Inhalt von rechts (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) rechts).balance = 0; // rechter Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateLR() { //IO.println("LR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) a1.rechts; // und dessen rechten Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.rechts = a2.links; // Setze Soehne von a2 a2.links = a2.rechts; a2.rechts = rechts; rechts = a2; // a2 wird neuer rechter Sohn Object tmp = inhalt; // Inhalt von rechts (==a2) inhalt = rechts.inhalt; // wird mit Wurzel rechts.inhalt = tmp; // getauscht if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; balance = 0; // Wurzel balanciert } public void rotateRR() { //IO.println("RR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten AVLBaum a2 = (AVLBaum) links; // und linken Teilbaum // Idee: Inhalt von a1 in die Wurzel rechts = a1.rechts; // Setze neuen rechten Sohn links = a1; // Setze neuen linken Sohn a1.rechts = a1.links; // Setze dessen rechten a1.links = a2; // und linken Sohn Object tmp = a1.inhalt; // Inhalt von links (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) links).balance = 0; // linker Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateRL() { //IO.println("RL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten Sohn AVLBaum a2 = (AVLBaum) a1.links; // und dessen linken Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.links = a2.rechts; a2.rechts = a2.links; // Setze Soehne von a2 a2.links = links; links = a2; // a2 wird neuer linker Sohn Object tmp = inhalt; // Inhalt von links (==a2) inhalt = links.inhalt; // wird mit Wurzel links.inhalt = tmp; // getauscht if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; balance = 0; // Wurzel balanciert } @Override public boolean delete(Comparable x) throws Exception {// loescht x im AVLBaum: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion deleteAVL return deleteAVL(x, new Status()); } private boolean deleteAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode // zum Loeschen (rekursiv); true, wenn erfolgreich boolean geloescht; // true, wenn geloescht wurde if (empty()) { // Blatt: Element nicht gefunden return false; // => Einfuegen erfolglos } else if (((Comparable) value()).compareTo(x) < 0) { // Element x ist groesser => // Suche rechts weiter geloescht = ((AVLBaum) rechts).deleteAVL(x, s); if (s.unbal == true) balance2(s); // Gleiche ggf. aus return geloescht; } else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => // Suche links weiter geloescht = ((AVLBaum) links).deleteAVL(x, s); if (s.unbal == true) balance1(s); // Gleiche ggf. aus return geloescht; } else { // Element gefunden if (rechts.empty()) { // Kein rechter Sohn inhalt = links.inhalt; // ersetze Knoten durch linken Sohn links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else if (links.empty()) { // Kein linker Sohn inhalt = rechts.inhalt; // ersetze Knoten durch rechten Sohn rechts = rechts.rechts; // Kein rechter Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else { // Beide Soehne vorhanden inhalt = ((AVLBaum) links).del(s); // Rufe del() auf if (s.unbal) { // Gleiche Unbalance aus balance1(s); } } return true; // Loeschen erfolgreich } } private Object del(Status s) { // Sucht Ersatz fuer gel. Objekt Object ersatz; // Das Ersatz-Objekt if (!rechts.empty()) { // Suche groessten Sohn im Teilbaum ersatz = ((AVLBaum) rechts).del(s); if (s.unbal) // Gleicht ggf. Unbalance aus balance2(s); } else { // Tausche mit geloeschtem Knoten ersatz = inhalt; // Merke Ersatz und inhalt = links.inhalt; // ersetze Knoten durch linken Sohn. links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Teilbaum wurde kuerzer } return ersatz; // Gib Ersatz-Objekt zurueck } private void balance1(Status s) { // Unbalance, weil linker Ast kuerzer switch (balance) { case -1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = 1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) rechts).balance; //Merke Balance des rechten Sohns if (b >= 0) { rotateRR(); if (b == 0) { // Gleiche neue Balancen an balance = -1; ((AVLBaum) links).balance = 1; s.unbal = false; } } else rotateRL(); break; } } private void balance2(Status s) { // Unbalance, weil recht. Ast kuerzer switch (balance) { case 1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = -1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) links).balance; // Merke Balance des linken Sohns if (b <= 0) { rotateLL(); if (b == 0) { // Gleiche neue Balancen an balance = 1; ((AVLBaum) rechts).balance = -1; s.unbal = false; } } else rotateLR(); break; } } }
214383_27
/***************************** AVLBaum.java *********************************/ //import AlgoTools.IO; /** Ein AVLBaum ist ein SuchBaum, bei dem alle Knoten ausgeglichen * sind. Das heisst, die Hoehe aller Teilbaeume unterscheidet sich * maximal um eins. */ package db.avltree; public class AVLBaum extends SuchBaum { private int balance; // Balance public AVLBaum() { // erzeugt leeren AVLBaum balance = 0; } private static class Status { // Innere Klasse zur Uebergabe eines // Status in der Rekursion boolean unbal; // unbal ist true, wenn beim Einfue- // gen ein Sohn groesser geworden ist Status () { // Konstruktor der inneren Klasse unbal = false; // Element noch nicht eingefuegt => } // noch keine Unausgeglichenheit } public String toString() { // fuer Ausgabe: Inhalt(Balance) return inhalt + "(" + balance + ")"; } public boolean insert(Comparable x) throws Exception {// fuegt x in den AVLBaum ein: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion insertAVL return insertAVL(x, new Status()); } private boolean insertAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode zum // Einfuegen (rekursiv) boolean eingefuegt; if (empty()) { // Blatt: Hier kann eingefuegt werden inhalt = x; // Inhalt setzen links = new AVLBaum(); // Neuer leerer AVLBaum links rechts = new AVLBaum(); // Neuer leerer AVLBaum rechts s.unbal = true; // Dieser Teilbaum wurde groesser return true; // Einfuegen erfolgreich und } // dieser Teilbaum groesser else if (((Comparable) value()).compareTo(x) == 0) // Element schon im AVLBaum return false; else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => eingefuegt = ((AVLBaum) left()).insertAVL(x, s); // linker Teilbaum if (s.unbal) { // Linker Teilbaum wurde groesser switch (balance) { case 1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = -1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) links).balance == -1) rotateLL(); else rotateLR(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } else { // Element ist groesser => eingefuegt = ((AVLBaum) right()).insertAVL(x, s);// rechter Teilbaum if (s.unbal) { // Rechter Teilbaum wurde groesser switch (balance) { case -1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = 1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) rechts).balance == 1) rotateRR(); else rotateRL(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } return eingefuegt; // Keine Rotation => Ergebnis zurueck } public void rotateLL() { //IO.println("LL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) rechts; // und rechten Teilbaum // Idee: Inhalt von a1 in die Wurzel links = a1.links; // Setze neuen linken Sohn rechts = a1; // Setze neuen rechten Sohn a1.links = a1.rechts; // Setze dessen linken a1.rechts = a2; // und rechten Sohn Object tmp = a1.inhalt; // Inhalt von rechts (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) rechts).balance = 0; // rechter Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateLR() { //IO.println("LR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) a1.rechts; // und dessen rechten Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.rechts = a2.links; // Setze Soehne von a2 a2.links = a2.rechts; a2.rechts = rechts; rechts = a2; // a2 wird neuer rechter Sohn Object tmp = inhalt; // Inhalt von rechts (==a2) inhalt = rechts.inhalt; // wird mit Wurzel rechts.inhalt = tmp; // getauscht if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; balance = 0; // Wurzel balanciert } public void rotateRR() { //IO.println("RR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten AVLBaum a2 = (AVLBaum) links; // und linken Teilbaum // Idee: Inhalt von a1 in die Wurzel rechts = a1.rechts; // Setze neuen rechten Sohn links = a1; // Setze neuen linken Sohn a1.rechts = a1.links; // Setze dessen rechten a1.links = a2; // und linken Sohn Object tmp = a1.inhalt; // Inhalt von links (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) links).balance = 0; // linker Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateRL() { //IO.println("RL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten Sohn AVLBaum a2 = (AVLBaum) a1.links; // und dessen linken Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.links = a2.rechts; a2.rechts = a2.links; // Setze Soehne von a2 a2.links = links; links = a2; // a2 wird neuer linker Sohn Object tmp = inhalt; // Inhalt von links (==a2) inhalt = links.inhalt; // wird mit Wurzel links.inhalt = tmp; // getauscht if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; balance = 0; // Wurzel balanciert } @Override public boolean delete(Comparable x) throws Exception {// loescht x im AVLBaum: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion deleteAVL return deleteAVL(x, new Status()); } private boolean deleteAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode // zum Loeschen (rekursiv); true, wenn erfolgreich boolean geloescht; // true, wenn geloescht wurde if (empty()) { // Blatt: Element nicht gefunden return false; // => Einfuegen erfolglos } else if (((Comparable) value()).compareTo(x) < 0) { // Element x ist groesser => // Suche rechts weiter geloescht = ((AVLBaum) rechts).deleteAVL(x, s); if (s.unbal == true) balance2(s); // Gleiche ggf. aus return geloescht; } else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => // Suche links weiter geloescht = ((AVLBaum) links).deleteAVL(x, s); if (s.unbal == true) balance1(s); // Gleiche ggf. aus return geloescht; } else { // Element gefunden if (rechts.empty()) { // Kein rechter Sohn inhalt = links.inhalt; // ersetze Knoten durch linken Sohn links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else if (links.empty()) { // Kein linker Sohn inhalt = rechts.inhalt; // ersetze Knoten durch rechten Sohn rechts = rechts.rechts; // Kein rechter Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else { // Beide Soehne vorhanden inhalt = ((AVLBaum) links).del(s); // Rufe del() auf if (s.unbal) { // Gleiche Unbalance aus balance1(s); } } return true; // Loeschen erfolgreich } } private Object del(Status s) { // Sucht Ersatz fuer gel. Objekt Object ersatz; // Das Ersatz-Objekt if (!rechts.empty()) { // Suche groessten Sohn im Teilbaum ersatz = ((AVLBaum) rechts).del(s); if (s.unbal) // Gleicht ggf. Unbalance aus balance2(s); } else { // Tausche mit geloeschtem Knoten ersatz = inhalt; // Merke Ersatz und inhalt = links.inhalt; // ersetze Knoten durch linken Sohn. links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Teilbaum wurde kuerzer } return ersatz; // Gib Ersatz-Objekt zurueck } private void balance1(Status s) { // Unbalance, weil linker Ast kuerzer switch (balance) { case -1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = 1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) rechts).balance; //Merke Balance des rechten Sohns if (b >= 0) { rotateRR(); if (b == 0) { // Gleiche neue Balancen an balance = -1; ((AVLBaum) links).balance = 1; s.unbal = false; } } else rotateRL(); break; } } private void balance2(Status s) { // Unbalance, weil recht. Ast kuerzer switch (balance) { case 1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = -1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) links).balance; // Merke Balance des linken Sohns if (b <= 0) { rotateLL(); if (b == 0) { // Gleiche neue Balancen an balance = 1; ((AVLBaum) rechts).balance = -1; s.unbal = false; } } else rotateLR(); break; } } }
sPyOpenSource/os
src/db/avltree/AVLBaum.java
3,404
// Element ist groesser =>
line_comment
nl
/***************************** AVLBaum.java *********************************/ //import AlgoTools.IO; /** Ein AVLBaum ist ein SuchBaum, bei dem alle Knoten ausgeglichen * sind. Das heisst, die Hoehe aller Teilbaeume unterscheidet sich * maximal um eins. */ package db.avltree; public class AVLBaum extends SuchBaum { private int balance; // Balance public AVLBaum() { // erzeugt leeren AVLBaum balance = 0; } private static class Status { // Innere Klasse zur Uebergabe eines // Status in der Rekursion boolean unbal; // unbal ist true, wenn beim Einfue- // gen ein Sohn groesser geworden ist Status () { // Konstruktor der inneren Klasse unbal = false; // Element noch nicht eingefuegt => } // noch keine Unausgeglichenheit } public String toString() { // fuer Ausgabe: Inhalt(Balance) return inhalt + "(" + balance + ")"; } public boolean insert(Comparable x) throws Exception {// fuegt x in den AVLBaum ein: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion insertAVL return insertAVL(x, new Status()); } private boolean insertAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode zum // Einfuegen (rekursiv) boolean eingefuegt; if (empty()) { // Blatt: Hier kann eingefuegt werden inhalt = x; // Inhalt setzen links = new AVLBaum(); // Neuer leerer AVLBaum links rechts = new AVLBaum(); // Neuer leerer AVLBaum rechts s.unbal = true; // Dieser Teilbaum wurde groesser return true; // Einfuegen erfolgreich und } // dieser Teilbaum groesser else if (((Comparable) value()).compareTo(x) == 0) // Element schon im AVLBaum return false; else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => eingefuegt = ((AVLBaum) left()).insertAVL(x, s); // linker Teilbaum if (s.unbal) { // Linker Teilbaum wurde groesser switch (balance) { case 1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = -1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) links).balance == -1) rotateLL(); else rotateLR(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } else { // Element ist<SUF> eingefuegt = ((AVLBaum) right()).insertAVL(x, s);// rechter Teilbaum if (s.unbal) { // Rechter Teilbaum wurde groesser switch (balance) { case -1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = 1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) rechts).balance == 1) rotateRR(); else rotateRL(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } return eingefuegt; // Keine Rotation => Ergebnis zurueck } public void rotateLL() { //IO.println("LL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) rechts; // und rechten Teilbaum // Idee: Inhalt von a1 in die Wurzel links = a1.links; // Setze neuen linken Sohn rechts = a1; // Setze neuen rechten Sohn a1.links = a1.rechts; // Setze dessen linken a1.rechts = a2; // und rechten Sohn Object tmp = a1.inhalt; // Inhalt von rechts (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) rechts).balance = 0; // rechter Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateLR() { //IO.println("LR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) a1.rechts; // und dessen rechten Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.rechts = a2.links; // Setze Soehne von a2 a2.links = a2.rechts; a2.rechts = rechts; rechts = a2; // a2 wird neuer rechter Sohn Object tmp = inhalt; // Inhalt von rechts (==a2) inhalt = rechts.inhalt; // wird mit Wurzel rechts.inhalt = tmp; // getauscht if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; balance = 0; // Wurzel balanciert } public void rotateRR() { //IO.println("RR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten AVLBaum a2 = (AVLBaum) links; // und linken Teilbaum // Idee: Inhalt von a1 in die Wurzel rechts = a1.rechts; // Setze neuen rechten Sohn links = a1; // Setze neuen linken Sohn a1.rechts = a1.links; // Setze dessen rechten a1.links = a2; // und linken Sohn Object tmp = a1.inhalt; // Inhalt von links (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) links).balance = 0; // linker Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateRL() { //IO.println("RL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten Sohn AVLBaum a2 = (AVLBaum) a1.links; // und dessen linken Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.links = a2.rechts; a2.rechts = a2.links; // Setze Soehne von a2 a2.links = links; links = a2; // a2 wird neuer linker Sohn Object tmp = inhalt; // Inhalt von links (==a2) inhalt = links.inhalt; // wird mit Wurzel links.inhalt = tmp; // getauscht if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; balance = 0; // Wurzel balanciert } @Override public boolean delete(Comparable x) throws Exception {// loescht x im AVLBaum: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion deleteAVL return deleteAVL(x, new Status()); } private boolean deleteAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode // zum Loeschen (rekursiv); true, wenn erfolgreich boolean geloescht; // true, wenn geloescht wurde if (empty()) { // Blatt: Element nicht gefunden return false; // => Einfuegen erfolglos } else if (((Comparable) value()).compareTo(x) < 0) { // Element x ist groesser => // Suche rechts weiter geloescht = ((AVLBaum) rechts).deleteAVL(x, s); if (s.unbal == true) balance2(s); // Gleiche ggf. aus return geloescht; } else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => // Suche links weiter geloescht = ((AVLBaum) links).deleteAVL(x, s); if (s.unbal == true) balance1(s); // Gleiche ggf. aus return geloescht; } else { // Element gefunden if (rechts.empty()) { // Kein rechter Sohn inhalt = links.inhalt; // ersetze Knoten durch linken Sohn links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else if (links.empty()) { // Kein linker Sohn inhalt = rechts.inhalt; // ersetze Knoten durch rechten Sohn rechts = rechts.rechts; // Kein rechter Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else { // Beide Soehne vorhanden inhalt = ((AVLBaum) links).del(s); // Rufe del() auf if (s.unbal) { // Gleiche Unbalance aus balance1(s); } } return true; // Loeschen erfolgreich } } private Object del(Status s) { // Sucht Ersatz fuer gel. Objekt Object ersatz; // Das Ersatz-Objekt if (!rechts.empty()) { // Suche groessten Sohn im Teilbaum ersatz = ((AVLBaum) rechts).del(s); if (s.unbal) // Gleicht ggf. Unbalance aus balance2(s); } else { // Tausche mit geloeschtem Knoten ersatz = inhalt; // Merke Ersatz und inhalt = links.inhalt; // ersetze Knoten durch linken Sohn. links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Teilbaum wurde kuerzer } return ersatz; // Gib Ersatz-Objekt zurueck } private void balance1(Status s) { // Unbalance, weil linker Ast kuerzer switch (balance) { case -1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = 1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) rechts).balance; //Merke Balance des rechten Sohns if (b >= 0) { rotateRR(); if (b == 0) { // Gleiche neue Balancen an balance = -1; ((AVLBaum) links).balance = 1; s.unbal = false; } } else rotateRL(); break; } } private void balance2(Status s) { // Unbalance, weil recht. Ast kuerzer switch (balance) { case 1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = -1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) links).balance; // Merke Balance des linken Sohns if (b <= 0) { rotateLL(); if (b == 0) { // Gleiche neue Balancen an balance = 1; ((AVLBaum) rechts).balance = -1; s.unbal = false; } } else rotateLR(); break; } } }
214383_80
/***************************** AVLBaum.java *********************************/ //import AlgoTools.IO; /** Ein AVLBaum ist ein SuchBaum, bei dem alle Knoten ausgeglichen * sind. Das heisst, die Hoehe aller Teilbaeume unterscheidet sich * maximal um eins. */ package db.avltree; public class AVLBaum extends SuchBaum { private int balance; // Balance public AVLBaum() { // erzeugt leeren AVLBaum balance = 0; } private static class Status { // Innere Klasse zur Uebergabe eines // Status in der Rekursion boolean unbal; // unbal ist true, wenn beim Einfue- // gen ein Sohn groesser geworden ist Status () { // Konstruktor der inneren Klasse unbal = false; // Element noch nicht eingefuegt => } // noch keine Unausgeglichenheit } public String toString() { // fuer Ausgabe: Inhalt(Balance) return inhalt + "(" + balance + ")"; } public boolean insert(Comparable x) throws Exception {// fuegt x in den AVLBaum ein: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion insertAVL return insertAVL(x, new Status()); } private boolean insertAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode zum // Einfuegen (rekursiv) boolean eingefuegt; if (empty()) { // Blatt: Hier kann eingefuegt werden inhalt = x; // Inhalt setzen links = new AVLBaum(); // Neuer leerer AVLBaum links rechts = new AVLBaum(); // Neuer leerer AVLBaum rechts s.unbal = true; // Dieser Teilbaum wurde groesser return true; // Einfuegen erfolgreich und } // dieser Teilbaum groesser else if (((Comparable) value()).compareTo(x) == 0) // Element schon im AVLBaum return false; else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => eingefuegt = ((AVLBaum) left()).insertAVL(x, s); // linker Teilbaum if (s.unbal) { // Linker Teilbaum wurde groesser switch (balance) { case 1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = -1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) links).balance == -1) rotateLL(); else rotateLR(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } else { // Element ist groesser => eingefuegt = ((AVLBaum) right()).insertAVL(x, s);// rechter Teilbaum if (s.unbal) { // Rechter Teilbaum wurde groesser switch (balance) { case -1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = 1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) rechts).balance == 1) rotateRR(); else rotateRL(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } return eingefuegt; // Keine Rotation => Ergebnis zurueck } public void rotateLL() { //IO.println("LL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) rechts; // und rechten Teilbaum // Idee: Inhalt von a1 in die Wurzel links = a1.links; // Setze neuen linken Sohn rechts = a1; // Setze neuen rechten Sohn a1.links = a1.rechts; // Setze dessen linken a1.rechts = a2; // und rechten Sohn Object tmp = a1.inhalt; // Inhalt von rechts (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) rechts).balance = 0; // rechter Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateLR() { //IO.println("LR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) a1.rechts; // und dessen rechten Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.rechts = a2.links; // Setze Soehne von a2 a2.links = a2.rechts; a2.rechts = rechts; rechts = a2; // a2 wird neuer rechter Sohn Object tmp = inhalt; // Inhalt von rechts (==a2) inhalt = rechts.inhalt; // wird mit Wurzel rechts.inhalt = tmp; // getauscht if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; balance = 0; // Wurzel balanciert } public void rotateRR() { //IO.println("RR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten AVLBaum a2 = (AVLBaum) links; // und linken Teilbaum // Idee: Inhalt von a1 in die Wurzel rechts = a1.rechts; // Setze neuen rechten Sohn links = a1; // Setze neuen linken Sohn a1.rechts = a1.links; // Setze dessen rechten a1.links = a2; // und linken Sohn Object tmp = a1.inhalt; // Inhalt von links (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) links).balance = 0; // linker Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateRL() { //IO.println("RL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten Sohn AVLBaum a2 = (AVLBaum) a1.links; // und dessen linken Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.links = a2.rechts; a2.rechts = a2.links; // Setze Soehne von a2 a2.links = links; links = a2; // a2 wird neuer linker Sohn Object tmp = inhalt; // Inhalt von links (==a2) inhalt = links.inhalt; // wird mit Wurzel links.inhalt = tmp; // getauscht if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; balance = 0; // Wurzel balanciert } @Override public boolean delete(Comparable x) throws Exception {// loescht x im AVLBaum: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion deleteAVL return deleteAVL(x, new Status()); } private boolean deleteAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode // zum Loeschen (rekursiv); true, wenn erfolgreich boolean geloescht; // true, wenn geloescht wurde if (empty()) { // Blatt: Element nicht gefunden return false; // => Einfuegen erfolglos } else if (((Comparable) value()).compareTo(x) < 0) { // Element x ist groesser => // Suche rechts weiter geloescht = ((AVLBaum) rechts).deleteAVL(x, s); if (s.unbal == true) balance2(s); // Gleiche ggf. aus return geloescht; } else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => // Suche links weiter geloescht = ((AVLBaum) links).deleteAVL(x, s); if (s.unbal == true) balance1(s); // Gleiche ggf. aus return geloescht; } else { // Element gefunden if (rechts.empty()) { // Kein rechter Sohn inhalt = links.inhalt; // ersetze Knoten durch linken Sohn links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else if (links.empty()) { // Kein linker Sohn inhalt = rechts.inhalt; // ersetze Knoten durch rechten Sohn rechts = rechts.rechts; // Kein rechter Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else { // Beide Soehne vorhanden inhalt = ((AVLBaum) links).del(s); // Rufe del() auf if (s.unbal) { // Gleiche Unbalance aus balance1(s); } } return true; // Loeschen erfolgreich } } private Object del(Status s) { // Sucht Ersatz fuer gel. Objekt Object ersatz; // Das Ersatz-Objekt if (!rechts.empty()) { // Suche groessten Sohn im Teilbaum ersatz = ((AVLBaum) rechts).del(s); if (s.unbal) // Gleicht ggf. Unbalance aus balance2(s); } else { // Tausche mit geloeschtem Knoten ersatz = inhalt; // Merke Ersatz und inhalt = links.inhalt; // ersetze Knoten durch linken Sohn. links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Teilbaum wurde kuerzer } return ersatz; // Gib Ersatz-Objekt zurueck } private void balance1(Status s) { // Unbalance, weil linker Ast kuerzer switch (balance) { case -1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = 1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) rechts).balance; //Merke Balance des rechten Sohns if (b >= 0) { rotateRR(); if (b == 0) { // Gleiche neue Balancen an balance = -1; ((AVLBaum) links).balance = 1; s.unbal = false; } } else rotateRL(); break; } } private void balance2(Status s) { // Unbalance, weil recht. Ast kuerzer switch (balance) { case 1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = -1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) links).balance; // Merke Balance des linken Sohns if (b <= 0) { rotateLL(); if (b == 0) { // Gleiche neue Balancen an balance = 1; ((AVLBaum) rechts).balance = -1; s.unbal = false; } } else rotateLR(); break; } } }
sPyOpenSource/os
src/db/avltree/AVLBaum.java
3,404
// Element x ist groesser =>
line_comment
nl
/***************************** AVLBaum.java *********************************/ //import AlgoTools.IO; /** Ein AVLBaum ist ein SuchBaum, bei dem alle Knoten ausgeglichen * sind. Das heisst, die Hoehe aller Teilbaeume unterscheidet sich * maximal um eins. */ package db.avltree; public class AVLBaum extends SuchBaum { private int balance; // Balance public AVLBaum() { // erzeugt leeren AVLBaum balance = 0; } private static class Status { // Innere Klasse zur Uebergabe eines // Status in der Rekursion boolean unbal; // unbal ist true, wenn beim Einfue- // gen ein Sohn groesser geworden ist Status () { // Konstruktor der inneren Klasse unbal = false; // Element noch nicht eingefuegt => } // noch keine Unausgeglichenheit } public String toString() { // fuer Ausgabe: Inhalt(Balance) return inhalt + "(" + balance + ")"; } public boolean insert(Comparable x) throws Exception {// fuegt x in den AVLBaum ein: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion insertAVL return insertAVL(x, new Status()); } private boolean insertAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode zum // Einfuegen (rekursiv) boolean eingefuegt; if (empty()) { // Blatt: Hier kann eingefuegt werden inhalt = x; // Inhalt setzen links = new AVLBaum(); // Neuer leerer AVLBaum links rechts = new AVLBaum(); // Neuer leerer AVLBaum rechts s.unbal = true; // Dieser Teilbaum wurde groesser return true; // Einfuegen erfolgreich und } // dieser Teilbaum groesser else if (((Comparable) value()).compareTo(x) == 0) // Element schon im AVLBaum return false; else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => eingefuegt = ((AVLBaum) left()).insertAVL(x, s); // linker Teilbaum if (s.unbal) { // Linker Teilbaum wurde groesser switch (balance) { case 1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = -1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) links).balance == -1) rotateLL(); else rotateLR(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } else { // Element ist groesser => eingefuegt = ((AVLBaum) right()).insertAVL(x, s);// rechter Teilbaum if (s.unbal) { // Rechter Teilbaum wurde groesser switch (balance) { case -1: // Alte Unausgeglichenheit ausgegl. balance = 0; // => neue Balance = 0 s.unbal = false; // Unausgeglichenheit ausgeglichen return true; case 0: // Hier noch kein Rotieren noetig balance = 1; // Balance wird angeglichen return true; default: // Rotieren notwendig if (((AVLBaum) rechts).balance == 1) rotateRR(); else rotateRL(); s.unbal = false; // Unausgeglichenheit ausgeglichen return true; // => Rueckgabewert // angleichen } } } return eingefuegt; // Keine Rotation => Ergebnis zurueck } public void rotateLL() { //IO.println("LL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) rechts; // und rechten Teilbaum // Idee: Inhalt von a1 in die Wurzel links = a1.links; // Setze neuen linken Sohn rechts = a1; // Setze neuen rechten Sohn a1.links = a1.rechts; // Setze dessen linken a1.rechts = a2; // und rechten Sohn Object tmp = a1.inhalt; // Inhalt von rechts (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) rechts).balance = 0; // rechter Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateLR() { //IO.println("LR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) links; // Merke linken AVLBaum a2 = (AVLBaum) a1.rechts; // und dessen rechten Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.rechts = a2.links; // Setze Soehne von a2 a2.links = a2.rechts; a2.rechts = rechts; rechts = a2; // a2 wird neuer rechter Sohn Object tmp = inhalt; // Inhalt von rechts (==a2) inhalt = rechts.inhalt; // wird mit Wurzel rechts.inhalt = tmp; // getauscht if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; balance = 0; // Wurzel balanciert } public void rotateRR() { //IO.println("RR-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten AVLBaum a2 = (AVLBaum) links; // und linken Teilbaum // Idee: Inhalt von a1 in die Wurzel rechts = a1.rechts; // Setze neuen rechten Sohn links = a1; // Setze neuen linken Sohn a1.rechts = a1.links; // Setze dessen rechten a1.links = a2; // und linken Sohn Object tmp = a1.inhalt; // Inhalt von links (==a1) a1.inhalt = inhalt; // wird mit Wurzel inhalt = tmp; // getauscht ((AVLBaum) links).balance = 0; // linker Teilbaum balanciert balance = 0; // Wurzel balanciert } public void rotateRL() { //IO.println("RL-Rotation im Teilbaum mit Wurzel "+ inhalt); AVLBaum a1 = (AVLBaum) rechts; // Merke rechten Sohn AVLBaum a2 = (AVLBaum) a1.links; // und dessen linken Teilbaum // Idee: Inhalt von a2 in die Wurzel a1.links = a2.rechts; a2.rechts = a2.links; // Setze Soehne von a2 a2.links = links; links = a2; // a2 wird neuer linker Sohn Object tmp = inhalt; // Inhalt von links (==a2) inhalt = links.inhalt; // wird mit Wurzel links.inhalt = tmp; // getauscht if (a2.balance == -1) // Neue Bal. fuer rechten Sohn ((AVLBaum) rechts).balance = 1; else ((AVLBaum) rechts).balance = 0; if (a2.balance == 1) // Neue Bal. fuer linken Sohn ((AVLBaum) links).balance = -1; else ((AVLBaum) links).balance = 0; balance = 0; // Wurzel balanciert } @Override public boolean delete(Comparable x) throws Exception {// loescht x im AVLBaum: true, // wenn erfolgreich, sonst false. // Kapselt die Funktion deleteAVL return deleteAVL(x, new Status()); } private boolean deleteAVL(Comparable x, Status s) throws Exception { // Tatsaechliche Methode // zum Loeschen (rekursiv); true, wenn erfolgreich boolean geloescht; // true, wenn geloescht wurde if (empty()) { // Blatt: Element nicht gefunden return false; // => Einfuegen erfolglos } else if (((Comparable) value()).compareTo(x) < 0) { // Element x<SUF> // Suche rechts weiter geloescht = ((AVLBaum) rechts).deleteAVL(x, s); if (s.unbal == true) balance2(s); // Gleiche ggf. aus return geloescht; } else if (((Comparable) value()).compareTo(x) > 0) { // Element x ist kleiner => // Suche links weiter geloescht = ((AVLBaum) links).deleteAVL(x, s); if (s.unbal == true) balance1(s); // Gleiche ggf. aus return geloescht; } else { // Element gefunden if (rechts.empty()) { // Kein rechter Sohn inhalt = links.inhalt; // ersetze Knoten durch linken Sohn links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else if (links.empty()) { // Kein linker Sohn inhalt = rechts.inhalt; // ersetze Knoten durch rechten Sohn rechts = rechts.rechts; // Kein rechter Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Hoehe hat sich geaendert } else { // Beide Soehne vorhanden inhalt = ((AVLBaum) links).del(s); // Rufe del() auf if (s.unbal) { // Gleiche Unbalance aus balance1(s); } } return true; // Loeschen erfolgreich } } private Object del(Status s) { // Sucht Ersatz fuer gel. Objekt Object ersatz; // Das Ersatz-Objekt if (!rechts.empty()) { // Suche groessten Sohn im Teilbaum ersatz = ((AVLBaum) rechts).del(s); if (s.unbal) // Gleicht ggf. Unbalance aus balance2(s); } else { // Tausche mit geloeschtem Knoten ersatz = inhalt; // Merke Ersatz und inhalt = links.inhalt; // ersetze Knoten durch linken Sohn. links = links.links; // Kein linker Sohn mehr balance = 0; // Knoten ist Blatt s.unbal = true; // Teilbaum wurde kuerzer } return ersatz; // Gib Ersatz-Objekt zurueck } private void balance1(Status s) { // Unbalance, weil linker Ast kuerzer switch (balance) { case -1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = 1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) rechts).balance; //Merke Balance des rechten Sohns if (b >= 0) { rotateRR(); if (b == 0) { // Gleiche neue Balancen an balance = -1; ((AVLBaum) links).balance = 1; s.unbal = false; } } else rotateRL(); break; } } private void balance2(Status s) { // Unbalance, weil recht. Ast kuerzer switch (balance) { case 1: balance = 0; // Balance geaendert, nicht ausgegl. break; case 0: balance = -1; // Ausgeglichen s.unbal = false; break; default: // Ausgleichen (Rotation) notwendig int b = ((AVLBaum) links).balance; // Merke Balance des linken Sohns if (b <= 0) { rotateLL(); if (b == 0) { // Gleiche neue Balancen an balance = 1; ((AVLBaum) rechts).balance = -1; s.unbal = false; } } else rotateLR(); break; } } }
214495_22
/* * Polynomial.java * * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard * * This file is part of BEAST. * See the NOTICE file distributed with this work for additional * information regarding copyright ownership and licensing. * * BEAST is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * BEAST is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with BEAST; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ package dr.math; //import org.apfloat.Apfloat; //import org.apfloat.ApfloatMath; import java.math.BigDecimal; import java.math.MathContext; import java.util.Arrays; /** * @author Marc A. Suchard */ public interface Polynomial extends Cloneable { public int getDegree(); public Polynomial multiply(Polynomial b); public Polynomial integrate(); public double evaluate(double x); public double logEvaluate(double x); public double logEvaluateHorner(double x); public void expand(double x); public Polynomial integrateWithLowerBound(double bound); public double getCoefficient(int n); public String getCoefficientString(int n); public void setCoefficient(int n, double x); public Polynomial getPolynomial(); public Polynomial copy(); public abstract class Abstract implements Polynomial { public abstract int getDegree(); public abstract Polynomial multiply(Polynomial b); public abstract Polynomial integrate(); public abstract double evaluate(double x); public abstract double getCoefficient(int n); public abstract void setCoefficient(int n, double x); public abstract Polynomial integrateWithLowerBound(double bound); public Polynomial getPolynomial() { return this; } public abstract double logEvaluate(double x); public abstract double logEvaluateHorner(double x); public abstract void expand(double x); public String toString() { StringBuffer bf = new StringBuffer(); for (int n = getDegree(); n >= 0; n--) { bf.append(getCoefficientString(n)); bf.append(X); bf.append(n); if (n > 0) bf.append(" + "); } return bf.toString(); } public abstract String getCoefficientString(int n); protected static final String FORMAT = "%3.2e"; private static final String X = " x^"; } public class LogDouble extends Abstract { public LogDouble(double[] coefficient) { this.logCoefficient = new double[coefficient.length]; this.positiveCoefficient = new boolean[coefficient.length]; for(int i=0; i<coefficient.length; i++) { if(coefficient[i] < 0) { this.logCoefficient[i] = Math.log(-coefficient[i]); this.positiveCoefficient[i] = false; } else { this.logCoefficient[i] = Math.log(coefficient[i]); this.positiveCoefficient[i] = true; } } } public double getLogCoefficient(int n) { return logCoefficient[n]; } public void expand(double x) { final int degree = getDegree(); for(int i=0; i<=degree; i++) logCoefficient[i] = x + logCoefficient[i]; } public String getCoefficientString(int n) { return String.format(FORMAT, getCoefficient(n)); } public LogDouble(double[] logCoefficient, boolean[] positiveCoefficient) { this.logCoefficient = logCoefficient; if (positiveCoefficient != null) this.positiveCoefficient = positiveCoefficient; else { this.positiveCoefficient = new boolean[logCoefficient.length]; Arrays.fill(this.positiveCoefficient,true); } } public LogDouble copy() { return new LogDouble(logCoefficient.clone(), positiveCoefficient.clone()); } public int getDegree() { return logCoefficient.length - 1; } public LogDouble multiply(Polynomial inB) { if (!(inB.getPolynomial() instanceof LogDouble)) throw new RuntimeException("yuck!"); LogDouble b = (LogDouble) inB.getPolynomial(); final int degreeA = getDegree(); final int degreeB = b.getDegree(); double[] newLogCoefficient = new double[degreeA + degreeB + 1]; boolean[] newPositiveCoefficient = new boolean[degreeA + degreeB + 1]; Arrays.fill(newLogCoefficient, java.lang.Double.NEGATIVE_INFINITY); Arrays.fill(newPositiveCoefficient, true); for (int n = 0; n <= degreeA; n++) { for (int m = 0; m <= degreeB; m++) { final double change = logCoefficient[n] + b.logCoefficient[m]; final int nm = n + m; final boolean positiveChange = !(positiveCoefficient[n] ^ b.positiveCoefficient[m]); if (newLogCoefficient[nm] == java.lang.Double.NEGATIVE_INFINITY) { newLogCoefficient[nm] = change; newPositiveCoefficient[nm] = positiveChange; } else { if (change != 0.0) { if (newPositiveCoefficient[nm] ^ positiveChange) { // Sign difference, must subtract if (newLogCoefficient[nm] > change) newLogCoefficient[nm] = LogTricks.logDiff(newLogCoefficient[nm], change); else { newLogCoefficient[nm] = LogTricks.logDiff(change, newLogCoefficient[nm]); newPositiveCoefficient[nm] = !newPositiveCoefficient[nm]; // Switch signs } } else { // Same signs, just add newLogCoefficient[nm] = LogTricks.logSum(newLogCoefficient[nm], change); } } } } } return new LogDouble(newLogCoefficient,newPositiveCoefficient); } public LogDouble integrate() { final int degree = getDegree(); double[] newLogCoefficient = new double[degree + 2]; boolean[] newPositiveCoefficient = new boolean[degree + 2]; for (int n=0; n<=degree; n++) { newLogCoefficient[n+1] = logCoefficient[n] - Math.log(n+1); newPositiveCoefficient[n+1] = positiveCoefficient[n]; } newLogCoefficient[0] = java.lang.Double.NEGATIVE_INFINITY; newPositiveCoefficient[0] = true; return new LogDouble(newLogCoefficient,newPositiveCoefficient); } public double evaluate(double x) { SignedLogDouble result = signedLogEvaluate(x); double value = Math.exp(result.value); if (!result.positive) value = -value; return value; } public double evaluateAsReal(double x) { double result = 0; double xn = 1; for (int n = 0; n <= getDegree(); n++) { result += xn * getCoefficient(n); xn *= x; } return result; } public double logEvaluate(double x) { if (x < 0) throw new RuntimeException("Negative arguments not yet implemented in Polynomial.LogDouble"); SignedLogDouble result = signedLogEvaluate(x); if (result.positive) return result.value; return java.lang.Double.NaN; // return -result.value; } public double logEvaluateHorner(double x) { if (x < 0) throw new RuntimeException("Negative arguments not yet implemented in Polynomial.LogDouble"); SignedLogDouble result = signedLogEvaluateHorners(x); if (result.positive) return result.value; return java.lang.Double.NaN; // return -result.value; } public SignedLogDouble signedLogEvaluateHorners(double x) { // Using Horner's Rule final double logX = Math.log(x); final int degree = getDegree(); double logResult = logCoefficient[degree]; boolean positive = positiveCoefficient[degree]; for(int n=degree-1; n>=0; n--) { logResult += logX; if (!(positiveCoefficient[n] ^ positive)) // Same sign logResult = LogTricks.logSum(logResult,logCoefficient[n]); else { // Different signs if (logResult > logCoefficient[n]) logResult = LogTricks.logDiff(logResult,logCoefficient[n]); else { logResult = LogTricks.logDiff(logCoefficient[n],logResult); positive = !positive; } } } return new SignedLogDouble(logResult,positive); } private SignedLogDouble signedLogEvaluate(double x) { final double logX = Math.log(x); final int degree = getDegree(); double logResult = logCoefficient[0]; boolean positive = positiveCoefficient[0]; for(int n=1; n<=degree; n++) { // logResult += logX; final double value = n*logX + logCoefficient[n]; if (!(positiveCoefficient[n] ^ positive)) // Same sign logResult = LogTricks.logSum(logResult,value); else { // Different signs if (logResult > value) logResult = LogTricks.logDiff(logResult,value); else { logResult = LogTricks.logDiff(value,logResult); positive = !positive; } } } return new SignedLogDouble(logResult,positive); } public double getCoefficient(int n) { double coef = Math.exp(logCoefficient[n]); if (!positiveCoefficient[n]) coef *= -1; return coef; } public void setCoefficient(int n, double x) { if (x < 0) { positiveCoefficient[n] = false; x = -x; } else positiveCoefficient[n] = true; logCoefficient[n] = Math.log(x); } public Polynomial integrateWithLowerBound(double bound) { LogDouble integrand = integrate(); SignedLogDouble signedLogDouble = integrand.signedLogEvaluate(bound); integrand.logCoefficient[0] = signedLogDouble.value; integrand.positiveCoefficient[0] = !signedLogDouble.positive; return integrand; } double[] logCoefficient; boolean[] positiveCoefficient; class SignedLogDouble { double value; boolean positive; SignedLogDouble(double value, boolean positive) { this.value = value; this.positive = positive; } } } public class BigDouble extends Abstract { private static MathContext precision = new MathContext(1000); public BigDouble(double[] doubleCoefficient) { this.coefficient = new BigDecimal[doubleCoefficient.length]; for(int i=0; i<doubleCoefficient.length; i++) coefficient[i] = new BigDecimal(doubleCoefficient[i]); } public BigDouble copy() { return new BigDouble(coefficient.clone()); } public String getCoefficientString(int n) { return coefficient[n].toString(); } public void expand(double x) { throw new RuntimeException("Not yet implement: Polynomial.BigDouble.expand()"); } public BigDouble(BigDecimal[] coefficient) { this.coefficient = coefficient; } public int getDegree() { return coefficient.length - 1; } public BigDouble multiply(Polynomial b) { if (!(b.getPolynomial() instanceof BigDouble)) throw new RuntimeException("Incompatiable polynomial types"); BigDouble bd = (BigDouble) b.getPolynomial(); BigDecimal[] newCoefficient = new BigDecimal[getDegree() + bd.getDegree()+1]; for(int i=0; i<newCoefficient.length; i++) newCoefficient[i] = new BigDecimal(0.0); for(int n=0; n<=getDegree(); n++) { for(int m=0; m<=bd.getDegree(); m++) newCoefficient[n+m] = newCoefficient[n+m].add(coefficient[n].multiply(bd.coefficient[m])); } return new BigDouble(newCoefficient); } public BigDouble integrate() { BigDecimal[] newCoefficient = new BigDecimal[getDegree()+2]; for(int n=0; n<=getDegree(); n++) { newCoefficient[n+1] = coefficient[n].divide(new BigDecimal(n+1),precision); } newCoefficient[0] = new BigDecimal(0.0); return new BigDouble(newCoefficient); } public double evaluate(double x) { return evaluateBigDecimal(new BigDecimal(x)).doubleValue(); } public double logEvaluate(double x) { return BigDecimalUtils.ln(evaluateBigDecimal(new BigDecimal(x)),10).doubleValue(); } public double logEvaluateHorner(double x) { return logEvaluate(x); } protected BigDecimal evaluateBigDecimal(BigDecimal x) { BigDecimal result = new BigDecimal(0.0); BigDecimal xn = new BigDecimal(1.0); for(int n=0; n<=getDegree(); n++) { result = result.add(coefficient[n].multiply(xn)); xn = xn.multiply(x); } return result; } public double getCoefficient(int n) { return coefficient[n].doubleValue(); } public void setCoefficient(int n, double x) { coefficient[n] = new BigDecimal(x); } public Polynomial integrateWithLowerBound(double bound) { BigDouble integrand = integrate(); final BigDecimal x0 = integrand.evaluateBigDecimal(new BigDecimal(bound)); integrand.coefficient[0] = x0.multiply(new BigDecimal(-1.0)); return integrand; } public void setCoefficient(int n, BigDecimal x) { coefficient[n] = x; } BigDecimal[] coefficient; } // public class APDouble extends Abstract { // // public String getCoefficientString(int n) { // return coefficient[n].toString(); // } // // public APDouble copy() { // return new APDouble(coefficient.clone()); // } // // public APDouble(double[] doubleCoefficient) { // this.coefficient = new Apfloat[doubleCoefficient.length]; // for(int i=0; i<doubleCoefficient.length; i++) // coefficient[i] = new Apfloat(doubleCoefficient[i]); // } // // public APDouble(Apfloat[] coefficient) { // this.coefficient = coefficient; // } // // public int getDegree() { // return coefficient.length - 1; // } // // public APDouble multiply(Polynomial b) { // if (!(b.getPolynomial() instanceof APDouble)) // throw new RuntimeException("Incompatiable polynomial types"); // APDouble bd = (APDouble) b.getPolynomial(); // Apfloat[] newCoefficient = new Apfloat[getDegree() + bd.getDegree()+1]; // for(int i=0; i<newCoefficient.length; i++) // newCoefficient[i] = new Apfloat(0.0); // for(int n=0; n<=getDegree(); n++) { // for(int m=0; m<=bd.getDegree(); m++) // newCoefficient[n+m] = newCoefficient[n+m].add(coefficient[n].multiply(bd.coefficient[m])); // } // return new APDouble(newCoefficient); // } // // public APDouble integrate() { // Apfloat[] newCoefficient = new Apfloat[getDegree()+2]; // for(int n=0; n<=getDegree(); n++) { // newCoefficient[n+1] = coefficient[n].divide(new Apfloat(n+1)); // } // newCoefficient[0] = new Apfloat(0.0); // return new APDouble(newCoefficient); // } // // public double evaluate(double x) { // return evaluateAPDouble(new Apfloat(x)).doubleValue(); // } // // public double logEvaluate(double x) { // Apfloat result = evaluateAPDouble(new Apfloat((x))); // if (result.doubleValue() == 0) // return java.lang.Double.NEGATIVE_INFINITY; // return ApfloatMath.log(result).doubleValue(); // } // // public double logEvaluateHorner(double x) { // return logEvaluateInLogSpace(x); // } // // private static double log(Apfloat x) { // double log = ApfloatMath.log(x).doubleValue(); // if (java.lang.Double.isInfinite(log)) // throw new RuntimeException("Still infinite"); // return log; // } // // private static boolean positive(Apfloat x) { // return x.signum() != -1; // } // // public double logEvaluateInLogSpace(double x) { // // Using Horner's Rule // final double logX = Math.log(x); // final int degree = getDegree(); // boolean positive = positive(coefficient[degree]); // double logResult; // if (positive) // logResult = log(coefficient[degree]); // else // logResult = log(coefficient[degree].negate()); // for(int n=degree-1; n>=0; n--) { // logResult += logX; // if (coefficient[n].signum() != 0) { // final boolean nextPositive = positive(coefficient[n]); // double logNextValue; // if (nextPositive) // logNextValue = log(coefficient[n]); // else // logNextValue = log(coefficient[n].negate()); // if(!(nextPositive ^ positive)) // Same sign // logResult = LogTricks.logSum(logResult,logNextValue); // else { // Different signs // if (logResult > logNextValue) // logResult = LogTricks.logDiff(logResult,logNextValue); // else { // logResult = LogTricks.logDiff(logNextValue,logResult); // positive = !positive; // } // } // } // } // if (!positive) // logResult = -logResult; // return logResult; // } // // protected Apfloat evaluateAPDouble(Apfloat x) { // Apfloat result = new Apfloat(0.0); // Apfloat xn = new Apfloat(1.0); // for(int n=0; n<=getDegree(); n++) { // result = result.add(coefficient[n].multiply(xn)); // xn = xn.multiply(x); // } // // TODO Rewrite using Horner's Rule // return result; // } // // public double getCoefficient(int n) { // return coefficient[n].doubleValue(); // } // // public void setCoefficient(int n, double x) { // coefficient[n] = new Apfloat(x); // } // // public Polynomial integrateWithLowerBound(double bound) { // APDouble integrand = integrate(); // final Apfloat x0 = integrand.evaluateAPDouble(new Apfloat(bound)); // integrand.coefficient[0] = x0.multiply(new Apfloat(-1.0)); // return integrand; // } // // public void setCoefficient(int n, Apfloat x) { // coefficient[n] = x; // } // // Apfloat[] coefficient; // } public class Double extends Abstract { public Double(double[] coefficient) { this.coefficient = coefficient; } public Double copy() { return new Double(coefficient.clone()); } public Double(Polynomial polynomial) { this.coefficient = new double[polynomial.getDegree() + 1]; for (int n = 0; n <= polynomial.getDegree(); n++) coefficient[n] = polynomial.getCoefficient(n); } public void expand(double x) { final int degree = getDegree(); for(int i=0; i<=degree; i++) coefficient[i] = x * coefficient[i]; } public String getCoefficientString(int n) { return String.format(FORMAT, getCoefficient(n)); } public int getDegree() { return coefficient.length - 1; } public double getCoefficient(int n) { return coefficient[n]; } public double logEvaluate(double x) { return Math.log(evaluate(x)); } public double logEvaluateQuick(double x, int n) { return Math.log(evaluateQuick(x,n)); } public double logEvaluateHorner(double x) { // Uses Horner's Rule in log scale final int degree = getDegree(); final double logX = Math.log(x); boolean positive = coefficient[degree] > 0; double logResult; if (positive) logResult = Math.log(coefficient[degree]); else logResult = Math.log(-coefficient[degree]); for(int n=degree-1; n>=0; n--) { logResult += logX; boolean positiveCoefficient = coefficient[n] > 0; double logCoefficient; if (positiveCoefficient) logCoefficient = Math.log(coefficient[n]); else logCoefficient = Math.log(-coefficient[n]); if (!(positiveCoefficient ^ positive)) // Same sign logResult = LogTricks.logSum(logResult,logCoefficient); else { // Different signs if (logResult > logCoefficient) logResult = LogTricks.logDiff(logResult,logCoefficient); else { logResult = LogTricks.logDiff(logCoefficient,logResult); positive = !positive; } } } if (!positive) return java.lang.Double.NaN; return logResult; } public Polynomial.Double multiply(Polynomial b) { double[] newCoefficient = new double[getDegree() + b.getDegree() + 1]; for (int n = 0; n <= getDegree(); n++) { for (int m = 0; m <= b.getDegree(); m++) { newCoefficient[n + m] += coefficient[n] * b.getCoefficient(m); } } return new Double(newCoefficient); } public Polynomial.Double integrate() { double[] newCoefficient = new double[getDegree() + 2]; for (int n = 0; n <= getDegree(); n++) { newCoefficient[n + 1] = coefficient[n] / (n + 1); } return new Double(newCoefficient); } public double evaluateHorners(double x) { // Uses Horner's Rule final int degree = getDegree(); double result = coefficient[degree]; for (int n=degree-1; n>=0; n--) result = result*x + coefficient[n]; return result; } public double evaluateQuick(double x, int n) { int m = getDegree(); double xm = Math.pow(x,m); double result = xm * coefficient[m]; for (int i=n-1; i>0; i--) { xm /= x; m--; result += xm * coefficient[m]; } return result; } public double evaluate(double x) { double result = 0.0; double xn = 1; for (int n = 0; n <= getDegree(); n++) { result += xn * coefficient[n]; xn *= x; } return result; } public Polynomial integrateWithLowerBound(double bound) { Double integrand = integrate(); // System.err.println("integrand = "+integrand); integrand.coefficient[0] = -integrand.evaluate(bound); return integrand; } public void setCoefficient(int n, double x) { coefficient[n] = x; } double[] coefficient; } public enum Type { DOUBLE, APDOUBLE, LOG_DOUBLE, BIG_DOUBLE//, RATIONAL } }
maxbiostat/beast-mcmc
src/dr/math/Polynomial.java
6,164
// Apfloat[] newCoefficient = new Apfloat[getDegree() + bd.getDegree()+1];
line_comment
nl
/* * Polynomial.java * * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard * * This file is part of BEAST. * See the NOTICE file distributed with this work for additional * information regarding copyright ownership and licensing. * * BEAST is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * BEAST is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with BEAST; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ package dr.math; //import org.apfloat.Apfloat; //import org.apfloat.ApfloatMath; import java.math.BigDecimal; import java.math.MathContext; import java.util.Arrays; /** * @author Marc A. Suchard */ public interface Polynomial extends Cloneable { public int getDegree(); public Polynomial multiply(Polynomial b); public Polynomial integrate(); public double evaluate(double x); public double logEvaluate(double x); public double logEvaluateHorner(double x); public void expand(double x); public Polynomial integrateWithLowerBound(double bound); public double getCoefficient(int n); public String getCoefficientString(int n); public void setCoefficient(int n, double x); public Polynomial getPolynomial(); public Polynomial copy(); public abstract class Abstract implements Polynomial { public abstract int getDegree(); public abstract Polynomial multiply(Polynomial b); public abstract Polynomial integrate(); public abstract double evaluate(double x); public abstract double getCoefficient(int n); public abstract void setCoefficient(int n, double x); public abstract Polynomial integrateWithLowerBound(double bound); public Polynomial getPolynomial() { return this; } public abstract double logEvaluate(double x); public abstract double logEvaluateHorner(double x); public abstract void expand(double x); public String toString() { StringBuffer bf = new StringBuffer(); for (int n = getDegree(); n >= 0; n--) { bf.append(getCoefficientString(n)); bf.append(X); bf.append(n); if (n > 0) bf.append(" + "); } return bf.toString(); } public abstract String getCoefficientString(int n); protected static final String FORMAT = "%3.2e"; private static final String X = " x^"; } public class LogDouble extends Abstract { public LogDouble(double[] coefficient) { this.logCoefficient = new double[coefficient.length]; this.positiveCoefficient = new boolean[coefficient.length]; for(int i=0; i<coefficient.length; i++) { if(coefficient[i] < 0) { this.logCoefficient[i] = Math.log(-coefficient[i]); this.positiveCoefficient[i] = false; } else { this.logCoefficient[i] = Math.log(coefficient[i]); this.positiveCoefficient[i] = true; } } } public double getLogCoefficient(int n) { return logCoefficient[n]; } public void expand(double x) { final int degree = getDegree(); for(int i=0; i<=degree; i++) logCoefficient[i] = x + logCoefficient[i]; } public String getCoefficientString(int n) { return String.format(FORMAT, getCoefficient(n)); } public LogDouble(double[] logCoefficient, boolean[] positiveCoefficient) { this.logCoefficient = logCoefficient; if (positiveCoefficient != null) this.positiveCoefficient = positiveCoefficient; else { this.positiveCoefficient = new boolean[logCoefficient.length]; Arrays.fill(this.positiveCoefficient,true); } } public LogDouble copy() { return new LogDouble(logCoefficient.clone(), positiveCoefficient.clone()); } public int getDegree() { return logCoefficient.length - 1; } public LogDouble multiply(Polynomial inB) { if (!(inB.getPolynomial() instanceof LogDouble)) throw new RuntimeException("yuck!"); LogDouble b = (LogDouble) inB.getPolynomial(); final int degreeA = getDegree(); final int degreeB = b.getDegree(); double[] newLogCoefficient = new double[degreeA + degreeB + 1]; boolean[] newPositiveCoefficient = new boolean[degreeA + degreeB + 1]; Arrays.fill(newLogCoefficient, java.lang.Double.NEGATIVE_INFINITY); Arrays.fill(newPositiveCoefficient, true); for (int n = 0; n <= degreeA; n++) { for (int m = 0; m <= degreeB; m++) { final double change = logCoefficient[n] + b.logCoefficient[m]; final int nm = n + m; final boolean positiveChange = !(positiveCoefficient[n] ^ b.positiveCoefficient[m]); if (newLogCoefficient[nm] == java.lang.Double.NEGATIVE_INFINITY) { newLogCoefficient[nm] = change; newPositiveCoefficient[nm] = positiveChange; } else { if (change != 0.0) { if (newPositiveCoefficient[nm] ^ positiveChange) { // Sign difference, must subtract if (newLogCoefficient[nm] > change) newLogCoefficient[nm] = LogTricks.logDiff(newLogCoefficient[nm], change); else { newLogCoefficient[nm] = LogTricks.logDiff(change, newLogCoefficient[nm]); newPositiveCoefficient[nm] = !newPositiveCoefficient[nm]; // Switch signs } } else { // Same signs, just add newLogCoefficient[nm] = LogTricks.logSum(newLogCoefficient[nm], change); } } } } } return new LogDouble(newLogCoefficient,newPositiveCoefficient); } public LogDouble integrate() { final int degree = getDegree(); double[] newLogCoefficient = new double[degree + 2]; boolean[] newPositiveCoefficient = new boolean[degree + 2]; for (int n=0; n<=degree; n++) { newLogCoefficient[n+1] = logCoefficient[n] - Math.log(n+1); newPositiveCoefficient[n+1] = positiveCoefficient[n]; } newLogCoefficient[0] = java.lang.Double.NEGATIVE_INFINITY; newPositiveCoefficient[0] = true; return new LogDouble(newLogCoefficient,newPositiveCoefficient); } public double evaluate(double x) { SignedLogDouble result = signedLogEvaluate(x); double value = Math.exp(result.value); if (!result.positive) value = -value; return value; } public double evaluateAsReal(double x) { double result = 0; double xn = 1; for (int n = 0; n <= getDegree(); n++) { result += xn * getCoefficient(n); xn *= x; } return result; } public double logEvaluate(double x) { if (x < 0) throw new RuntimeException("Negative arguments not yet implemented in Polynomial.LogDouble"); SignedLogDouble result = signedLogEvaluate(x); if (result.positive) return result.value; return java.lang.Double.NaN; // return -result.value; } public double logEvaluateHorner(double x) { if (x < 0) throw new RuntimeException("Negative arguments not yet implemented in Polynomial.LogDouble"); SignedLogDouble result = signedLogEvaluateHorners(x); if (result.positive) return result.value; return java.lang.Double.NaN; // return -result.value; } public SignedLogDouble signedLogEvaluateHorners(double x) { // Using Horner's Rule final double logX = Math.log(x); final int degree = getDegree(); double logResult = logCoefficient[degree]; boolean positive = positiveCoefficient[degree]; for(int n=degree-1; n>=0; n--) { logResult += logX; if (!(positiveCoefficient[n] ^ positive)) // Same sign logResult = LogTricks.logSum(logResult,logCoefficient[n]); else { // Different signs if (logResult > logCoefficient[n]) logResult = LogTricks.logDiff(logResult,logCoefficient[n]); else { logResult = LogTricks.logDiff(logCoefficient[n],logResult); positive = !positive; } } } return new SignedLogDouble(logResult,positive); } private SignedLogDouble signedLogEvaluate(double x) { final double logX = Math.log(x); final int degree = getDegree(); double logResult = logCoefficient[0]; boolean positive = positiveCoefficient[0]; for(int n=1; n<=degree; n++) { // logResult += logX; final double value = n*logX + logCoefficient[n]; if (!(positiveCoefficient[n] ^ positive)) // Same sign logResult = LogTricks.logSum(logResult,value); else { // Different signs if (logResult > value) logResult = LogTricks.logDiff(logResult,value); else { logResult = LogTricks.logDiff(value,logResult); positive = !positive; } } } return new SignedLogDouble(logResult,positive); } public double getCoefficient(int n) { double coef = Math.exp(logCoefficient[n]); if (!positiveCoefficient[n]) coef *= -1; return coef; } public void setCoefficient(int n, double x) { if (x < 0) { positiveCoefficient[n] = false; x = -x; } else positiveCoefficient[n] = true; logCoefficient[n] = Math.log(x); } public Polynomial integrateWithLowerBound(double bound) { LogDouble integrand = integrate(); SignedLogDouble signedLogDouble = integrand.signedLogEvaluate(bound); integrand.logCoefficient[0] = signedLogDouble.value; integrand.positiveCoefficient[0] = !signedLogDouble.positive; return integrand; } double[] logCoefficient; boolean[] positiveCoefficient; class SignedLogDouble { double value; boolean positive; SignedLogDouble(double value, boolean positive) { this.value = value; this.positive = positive; } } } public class BigDouble extends Abstract { private static MathContext precision = new MathContext(1000); public BigDouble(double[] doubleCoefficient) { this.coefficient = new BigDecimal[doubleCoefficient.length]; for(int i=0; i<doubleCoefficient.length; i++) coefficient[i] = new BigDecimal(doubleCoefficient[i]); } public BigDouble copy() { return new BigDouble(coefficient.clone()); } public String getCoefficientString(int n) { return coefficient[n].toString(); } public void expand(double x) { throw new RuntimeException("Not yet implement: Polynomial.BigDouble.expand()"); } public BigDouble(BigDecimal[] coefficient) { this.coefficient = coefficient; } public int getDegree() { return coefficient.length - 1; } public BigDouble multiply(Polynomial b) { if (!(b.getPolynomial() instanceof BigDouble)) throw new RuntimeException("Incompatiable polynomial types"); BigDouble bd = (BigDouble) b.getPolynomial(); BigDecimal[] newCoefficient = new BigDecimal[getDegree() + bd.getDegree()+1]; for(int i=0; i<newCoefficient.length; i++) newCoefficient[i] = new BigDecimal(0.0); for(int n=0; n<=getDegree(); n++) { for(int m=0; m<=bd.getDegree(); m++) newCoefficient[n+m] = newCoefficient[n+m].add(coefficient[n].multiply(bd.coefficient[m])); } return new BigDouble(newCoefficient); } public BigDouble integrate() { BigDecimal[] newCoefficient = new BigDecimal[getDegree()+2]; for(int n=0; n<=getDegree(); n++) { newCoefficient[n+1] = coefficient[n].divide(new BigDecimal(n+1),precision); } newCoefficient[0] = new BigDecimal(0.0); return new BigDouble(newCoefficient); } public double evaluate(double x) { return evaluateBigDecimal(new BigDecimal(x)).doubleValue(); } public double logEvaluate(double x) { return BigDecimalUtils.ln(evaluateBigDecimal(new BigDecimal(x)),10).doubleValue(); } public double logEvaluateHorner(double x) { return logEvaluate(x); } protected BigDecimal evaluateBigDecimal(BigDecimal x) { BigDecimal result = new BigDecimal(0.0); BigDecimal xn = new BigDecimal(1.0); for(int n=0; n<=getDegree(); n++) { result = result.add(coefficient[n].multiply(xn)); xn = xn.multiply(x); } return result; } public double getCoefficient(int n) { return coefficient[n].doubleValue(); } public void setCoefficient(int n, double x) { coefficient[n] = new BigDecimal(x); } public Polynomial integrateWithLowerBound(double bound) { BigDouble integrand = integrate(); final BigDecimal x0 = integrand.evaluateBigDecimal(new BigDecimal(bound)); integrand.coefficient[0] = x0.multiply(new BigDecimal(-1.0)); return integrand; } public void setCoefficient(int n, BigDecimal x) { coefficient[n] = x; } BigDecimal[] coefficient; } // public class APDouble extends Abstract { // // public String getCoefficientString(int n) { // return coefficient[n].toString(); // } // // public APDouble copy() { // return new APDouble(coefficient.clone()); // } // // public APDouble(double[] doubleCoefficient) { // this.coefficient = new Apfloat[doubleCoefficient.length]; // for(int i=0; i<doubleCoefficient.length; i++) // coefficient[i] = new Apfloat(doubleCoefficient[i]); // } // // public APDouble(Apfloat[] coefficient) { // this.coefficient = coefficient; // } // // public int getDegree() { // return coefficient.length - 1; // } // // public APDouble multiply(Polynomial b) { // if (!(b.getPolynomial() instanceof APDouble)) // throw new RuntimeException("Incompatiable polynomial types"); // APDouble bd = (APDouble) b.getPolynomial(); // Apfloat[] newCoefficient<SUF> // for(int i=0; i<newCoefficient.length; i++) // newCoefficient[i] = new Apfloat(0.0); // for(int n=0; n<=getDegree(); n++) { // for(int m=0; m<=bd.getDegree(); m++) // newCoefficient[n+m] = newCoefficient[n+m].add(coefficient[n].multiply(bd.coefficient[m])); // } // return new APDouble(newCoefficient); // } // // public APDouble integrate() { // Apfloat[] newCoefficient = new Apfloat[getDegree()+2]; // for(int n=0; n<=getDegree(); n++) { // newCoefficient[n+1] = coefficient[n].divide(new Apfloat(n+1)); // } // newCoefficient[0] = new Apfloat(0.0); // return new APDouble(newCoefficient); // } // // public double evaluate(double x) { // return evaluateAPDouble(new Apfloat(x)).doubleValue(); // } // // public double logEvaluate(double x) { // Apfloat result = evaluateAPDouble(new Apfloat((x))); // if (result.doubleValue() == 0) // return java.lang.Double.NEGATIVE_INFINITY; // return ApfloatMath.log(result).doubleValue(); // } // // public double logEvaluateHorner(double x) { // return logEvaluateInLogSpace(x); // } // // private static double log(Apfloat x) { // double log = ApfloatMath.log(x).doubleValue(); // if (java.lang.Double.isInfinite(log)) // throw new RuntimeException("Still infinite"); // return log; // } // // private static boolean positive(Apfloat x) { // return x.signum() != -1; // } // // public double logEvaluateInLogSpace(double x) { // // Using Horner's Rule // final double logX = Math.log(x); // final int degree = getDegree(); // boolean positive = positive(coefficient[degree]); // double logResult; // if (positive) // logResult = log(coefficient[degree]); // else // logResult = log(coefficient[degree].negate()); // for(int n=degree-1; n>=0; n--) { // logResult += logX; // if (coefficient[n].signum() != 0) { // final boolean nextPositive = positive(coefficient[n]); // double logNextValue; // if (nextPositive) // logNextValue = log(coefficient[n]); // else // logNextValue = log(coefficient[n].negate()); // if(!(nextPositive ^ positive)) // Same sign // logResult = LogTricks.logSum(logResult,logNextValue); // else { // Different signs // if (logResult > logNextValue) // logResult = LogTricks.logDiff(logResult,logNextValue); // else { // logResult = LogTricks.logDiff(logNextValue,logResult); // positive = !positive; // } // } // } // } // if (!positive) // logResult = -logResult; // return logResult; // } // // protected Apfloat evaluateAPDouble(Apfloat x) { // Apfloat result = new Apfloat(0.0); // Apfloat xn = new Apfloat(1.0); // for(int n=0; n<=getDegree(); n++) { // result = result.add(coefficient[n].multiply(xn)); // xn = xn.multiply(x); // } // // TODO Rewrite using Horner's Rule // return result; // } // // public double getCoefficient(int n) { // return coefficient[n].doubleValue(); // } // // public void setCoefficient(int n, double x) { // coefficient[n] = new Apfloat(x); // } // // public Polynomial integrateWithLowerBound(double bound) { // APDouble integrand = integrate(); // final Apfloat x0 = integrand.evaluateAPDouble(new Apfloat(bound)); // integrand.coefficient[0] = x0.multiply(new Apfloat(-1.0)); // return integrand; // } // // public void setCoefficient(int n, Apfloat x) { // coefficient[n] = x; // } // // Apfloat[] coefficient; // } public class Double extends Abstract { public Double(double[] coefficient) { this.coefficient = coefficient; } public Double copy() { return new Double(coefficient.clone()); } public Double(Polynomial polynomial) { this.coefficient = new double[polynomial.getDegree() + 1]; for (int n = 0; n <= polynomial.getDegree(); n++) coefficient[n] = polynomial.getCoefficient(n); } public void expand(double x) { final int degree = getDegree(); for(int i=0; i<=degree; i++) coefficient[i] = x * coefficient[i]; } public String getCoefficientString(int n) { return String.format(FORMAT, getCoefficient(n)); } public int getDegree() { return coefficient.length - 1; } public double getCoefficient(int n) { return coefficient[n]; } public double logEvaluate(double x) { return Math.log(evaluate(x)); } public double logEvaluateQuick(double x, int n) { return Math.log(evaluateQuick(x,n)); } public double logEvaluateHorner(double x) { // Uses Horner's Rule in log scale final int degree = getDegree(); final double logX = Math.log(x); boolean positive = coefficient[degree] > 0; double logResult; if (positive) logResult = Math.log(coefficient[degree]); else logResult = Math.log(-coefficient[degree]); for(int n=degree-1; n>=0; n--) { logResult += logX; boolean positiveCoefficient = coefficient[n] > 0; double logCoefficient; if (positiveCoefficient) logCoefficient = Math.log(coefficient[n]); else logCoefficient = Math.log(-coefficient[n]); if (!(positiveCoefficient ^ positive)) // Same sign logResult = LogTricks.logSum(logResult,logCoefficient); else { // Different signs if (logResult > logCoefficient) logResult = LogTricks.logDiff(logResult,logCoefficient); else { logResult = LogTricks.logDiff(logCoefficient,logResult); positive = !positive; } } } if (!positive) return java.lang.Double.NaN; return logResult; } public Polynomial.Double multiply(Polynomial b) { double[] newCoefficient = new double[getDegree() + b.getDegree() + 1]; for (int n = 0; n <= getDegree(); n++) { for (int m = 0; m <= b.getDegree(); m++) { newCoefficient[n + m] += coefficient[n] * b.getCoefficient(m); } } return new Double(newCoefficient); } public Polynomial.Double integrate() { double[] newCoefficient = new double[getDegree() + 2]; for (int n = 0; n <= getDegree(); n++) { newCoefficient[n + 1] = coefficient[n] / (n + 1); } return new Double(newCoefficient); } public double evaluateHorners(double x) { // Uses Horner's Rule final int degree = getDegree(); double result = coefficient[degree]; for (int n=degree-1; n>=0; n--) result = result*x + coefficient[n]; return result; } public double evaluateQuick(double x, int n) { int m = getDegree(); double xm = Math.pow(x,m); double result = xm * coefficient[m]; for (int i=n-1; i>0; i--) { xm /= x; m--; result += xm * coefficient[m]; } return result; } public double evaluate(double x) { double result = 0.0; double xn = 1; for (int n = 0; n <= getDegree(); n++) { result += xn * coefficient[n]; xn *= x; } return result; } public Polynomial integrateWithLowerBound(double bound) { Double integrand = integrate(); // System.err.println("integrand = "+integrand); integrand.coefficient[0] = -integrand.evaluate(bound); return integrand; } public void setCoefficient(int n, double x) { coefficient[n] = x; } double[] coefficient; } public enum Type { DOUBLE, APDOUBLE, LOG_DOUBLE, BIG_DOUBLE//, RATIONAL } }