repo_name
stringlengths 4
116
| path
stringlengths 3
942
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
|---|---|---|---|---|
Godin/sonar
|
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ExternalProjectKeyAndOrganization.java
|
1091
|
/*
* SonarQube
* Copyright (C) 2009-2019 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program 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 (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.scanner.scan;
import java.util.Optional;
import javax.annotation.concurrent.Immutable;
@Immutable
public interface ExternalProjectKeyAndOrganization {
Optional<String> getProjectKey();
Optional<String> getOrganization();
}
|
lgpl-3.0
|
biotextmining/processes
|
src/main/java/com/silicolife/textmining/processes/ir/pubmed/PubMedConfiguration.java
|
299
|
package com.silicolife.textmining.processes.ir.pubmed;
public class PubMedConfiguration {
public static final int timeToWaitbetweenQueries = 3000;
public static final int numberOFRetries = 5;
public static final int blockSearchSize = 50;
public static final int searchMetaInfoblockSize = 5;
}
|
lgpl-3.0
|
daxxcoin/daxxcore
|
common/types_template.go
|
2033
|
// Copyright 2015 The daxxcoreAuthors
// This file is part of the daxxcore library.
//
// The daxxcore library 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
// (at your option) any later version.
//
// The daxxcore library 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 the daxxcore library. If not, see <http://www.gnu.org/licenses/>.
// +build none
//sed -e 's/_N_/Hash/g' -e 's/_S_/32/g' -e '1d' types_template.go | gofmt -w hash.go
package common
import "math/big"
type _N_ [_S_]byte
func BytesTo_N_(b []byte) _N_ {
var h _N_
h.SetBytes(b)
return h
}
func StringTo_N_(s string) _N_ { return BytesTo_N_([]byte(s)) }
func BigTo_N_(b *big.Int) _N_ { return BytesTo_N_(b.Bytes()) }
func HexTo_N_(s string) _N_ { return BytesTo_N_(FromHex(s)) }
// Don't use the default 'String' method in case we want to overwrite
// Get the string representation of the underlying hash
func (h _N_) Str() string { return string(h[:]) }
func (h _N_) Bytes() []byte { return h[:] }
func (h _N_) Big() *big.Int { return Bytes2Big(h[:]) }
func (h _N_) Hex() string { return "0x" + Bytes2Hex(h[:]) }
// Sets the hash to the value of b. If b is larger than len(h) it will panic
func (h *_N_) SetBytes(b []byte) {
// Use the right most bytes
if len(b) > len(h) {
b = b[len(b)-_S_:]
}
// Reverse the loop
for i := len(b) - 1; i >= 0; i-- {
h[_S_-len(b)+i] = b[i]
}
}
// Set string `s` to h. If s is larger than len(h) it will panic
func (h *_N_) SetString(s string) { h.SetBytes([]byte(s)) }
// Sets h to other
func (h *_N_) Set(other _N_) {
for i, v := range other {
h[i] = v
}
}
|
lgpl-3.0
|
sklintyg/statistik
|
service/src/main/java/se/inera/statistics/service/warehouse/WidelineConverter.java
|
10101
|
/*
* Copyright (C) 2022 Inera AB (http://www.inera.se)
*
* This file is part of sklintyg (https://github.com/sklintyg).
*
* sklintyg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sklintyg 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package se.inera.statistics.service.warehouse;
import java.time.Clock;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import se.inera.statistics.integration.hsa.model.HsaIdEnhet;
import se.inera.statistics.integration.hsa.model.HsaIdLakare;
import se.inera.statistics.integration.hsa.model.HsaIdVardgivare;
import se.inera.statistics.service.helper.ConversionHelper;
import se.inera.statistics.service.helper.HSAServiceHelper;
import se.inera.statistics.service.helper.Patientdata;
import se.inera.statistics.service.hsa.HsaInfo;
import se.inera.statistics.service.processlog.Arbetsnedsattning;
import se.inera.statistics.service.processlog.EventType;
import se.inera.statistics.service.processlog.IntygDTO;
import se.inera.statistics.service.report.util.Icd10;
import se.inera.statistics.service.report.util.Icd10.Kategori;
import se.inera.statistics.service.warehouse.model.db.WideLine;
@Component
public class WidelineConverter extends AbstractWidlineConverter {
private static final LocalDate ERA = LocalDate.parse("2000-01-01");
public static final int QUARTER = 25;
public static final int HALF = 50;
public static final int THREE_QUARTER = 75;
public static final int FULL = 100;
public static final int MAX_LENGTH_VGID = 50;
public static final int MAX_LENGTH_ENHETNAME = 255;
public static final int MAX_LENGTH_VARDGIVARE_NAMN = 255;
public static final int MAX_LENGTH_LAN_ID = 50;
public static final int MAX_LENGTH_KOMMUN_ID = 4;
public static final int MAX_LENGTH_VERKSAMHET_TYP = Integer.MAX_VALUE;
public static final int MAX_LENGTH_LAKARE_ID = 128;
public static final int MAX_LENGTH_TILLTALSNAMN = 128;
public static final int MAX_LENGTH_EFTERNAMN = 128;
private static final int DATE20100101 = 3653; // 365*10 + 3
private static final int MAX_YEARS_INTO_FUTURE = 5;
private static final int MAX_LENGTH_CORRELATION_ID = 50;
public static final String UNKNOWN_DIAGNOS = "unknown";
@Autowired
private Icd10 icd10;
@Autowired
private Clock clock;
public List<WideLine> toWideline(IntygDTO dto, HsaInfo hsa, long logId, String correlationId, EventType type) {
String lkf = getLkf(hsa);
String huvudenhet = HSAServiceHelper.getHuvudEnhetId(hsa);
String underenhet = HSAServiceHelper.getUnderenhetId(hsa);
String vardenhet = huvudenhet != null ? huvudenhet : underenhet;
String enhet = huvudenhet != null ? underenhet : null;
HsaIdVardgivare vardgivare = HSAServiceHelper.getVardgivarId(hsa);
if (vardenhet == null) {
vardenhet = dto.getEnhet();
}
String patient = dto.getPatientid();
Patientdata patientData = dto.getPatientData();
int kon = patientData.getKon().getNumberRepresentation();
int alder = patientData.getAlder();
String diagnos = dto.getDiagnoskod();
final Diagnos dx = parseDiagnos(diagnos);
int lakarkon = HSAServiceHelper.getLakarkon(hsa);
int lakaralder = HSAServiceHelper.getLakaralder(hsa);
String lakarbefattning = HSAServiceHelper.getLakarbefattning(hsa);
HsaIdLakare lakareid = new HsaIdLakare(dto.getLakareId());
final boolean active = !EventType.REVOKED.equals(type);
List<WideLine> lines = new ArrayList<>();
for (Arbetsnedsattning arbetsnedsattning : dto.getArbetsnedsattnings()) {
WideLine line = createWideLine(logId, correlationId, type, lkf, vardenhet, enhet, vardgivare, patient, kon, alder, dx,
lakarkon, lakaralder, lakarbefattning, lakareid, arbetsnedsattning, active);
lines.add(line);
}
return lines;
}
// CHECKSTYLE:OFF ParameterNumberCheck
@java.lang.SuppressWarnings("squid:S00107") // Suppress parameter number warning in Sonar
private WideLine createWideLine(long logId, String correlationId, EventType type, String lkf, String vardenhet,
String enhet, HsaIdVardgivare vardgivare, String patient, int kon,
int alder, Diagnos dx, int lakarkon, int lakaralder, String lakarbefattning,
HsaIdLakare lakareid, Arbetsnedsattning arbetsnedsattning, boolean active) {
WideLine line = new WideLine();
int sjukskrivningsgrad = arbetsnedsattning.getNedsattning();
LocalDate kalenderStart = arbetsnedsattning.getStart();
LocalDate kalenderEnd = arbetsnedsattning.getSlut();
line.setCorrelationId(correlationId);
line.setLakarintyg(logId);
line.setIntygTyp(type);
line.setActive(active);
line.setLkf(lkf);
line.setEnhet(new HsaIdEnhet(enhet));
line.setVardenhet(new HsaIdEnhet(vardenhet));
line.setVardgivareId(vardgivare);
line.setStartdatum(toDay(kalenderStart));
line.setSlutdatum(toDay(kalenderEnd));
line.setDiagnoskapitel(dx.diagnoskapitel);
line.setDiagnosavsnitt(dx.diagnosavsnitt);
line.setDiagnoskategori(dx.diagnoskategori);
line.setDiagnoskod(dx.diagnoskod);
line.setSjukskrivningsgrad(sjukskrivningsgrad);
line.setPatientid(patient);
line.setAlder(alder);
line.setKon(kon);
line.setLakaralder(lakaralder);
line.setLakarkon(lakarkon);
line.setLakarbefattning(lakarbefattning);
line.setLakareId(lakareid);
return line;
}
// CHECKSTYLE:ON ParameterNumberCheck
private Diagnos parseDiagnos(String diagnos) {
boolean isUnknownDiagnos = diagnos == null || UNKNOWN_DIAGNOS.equals(diagnos);
final Icd10.Kod kod = isUnknownDiagnos ? null : icd10.findKod(diagnos);
final Kategori kategori = kod != null ? kod.getKategori() : isUnknownDiagnos ? null : icd10.findKategori(diagnos);
final Diagnos dx = new Diagnos();
dx.diagnoskod = kod != null ? kod.getId() : null;
if (kategori != null) {
dx.diagnoskapitel = kategori.getAvsnitt().getKapitel().getId();
dx.diagnosavsnitt = kategori.getAvsnitt().getId();
dx.diagnoskategori = kategori.getId();
} else if (UNKNOWN_DIAGNOS.equals(diagnos)) {
dx.diagnoskapitel = null;
dx.diagnosavsnitt = null;
dx.diagnoskategori = UNKNOWN_DIAGNOS;
} else {
dx.diagnoskapitel = null;
dx.diagnosavsnitt = null;
dx.diagnoskategori = null;
}
return dx;
}
private void checkSjukskrivningsgrad(List<String> errors, int grad) {
if (!(grad == QUARTER || grad == HALF || grad == THREE_QUARTER || grad == FULL)) {
errors.add("Illegal sjukskrivningsgrad: " + grad);
}
}
private void checkStartdatum(List<String> errors, int startdatum) {
if (startdatum < DATE20100101 || startdatum > toDay(LocalDate.now(clock).plusYears(MAX_YEARS_INTO_FUTURE))) {
errors.add("Illegal startdatum: " + startdatum);
}
}
private void checkSlutdatum(List<String> errors, int slutdatum) {
if (slutdatum > toDay(LocalDate.now(clock).plusYears(MAX_YEARS_INTO_FUTURE))) {
errors.add("Illegal slutdatum: " + slutdatum);
}
}
private String getLkf(HsaInfo hsa) {
String lkf = HSAServiceHelper.getKommun(hsa);
if (lkf.isEmpty()) {
lkf = HSAServiceHelper.getLan(hsa);
} else if (lkf.length() == 2) {
lkf = HSAServiceHelper.getLan(hsa) + lkf;
}
return lkf;
}
public static int toDay(LocalDate dayDate) {
return (int) ChronoUnit.DAYS.between(ERA, dayDate);
}
public static LocalDate toDate(int day) {
return ERA.plusDays(day);
}
public List<String> validate(WideLine line) {
List<String> errors = new ArrayList<>();
checkField(errors, line.getLkf(), "LKF");
checkField(errors, line.getVardgivareId(), "Vårdgivare", MAX_LENGTH_VGID);
checkField(errors, line.getVardenhet(), "Vardenhet");
checkField(errors, line.getPatientid(), "Patient");
checkAge(errors, line.getAlder());
checkField(errors, line.getCorrelationId(), "CorrelationId", MAX_LENGTH_CORRELATION_ID);
checkSjukskrivningsgrad(errors, line.getSjukskrivningsgrad());
checkDates(errors, line.getStartdatum(), line.getSlutdatum());
return errors;
}
private void checkDates(List<String> errors, int startdatum, int slutdatum) {
checkStartdatum(errors, startdatum);
checkSlutdatum(errors, slutdatum);
if (startdatum > slutdatum) {
errors.add("Illegal dates. Start date (" + startdatum + ") must be before end date (" + slutdatum + ")");
}
}
private void checkAge(List<String> errors, int alder) {
if (alder == ConversionHelper.NO_AGE) {
errors.add("Error in patient age");
}
}
private static class Diagnos {
private String diagnoskod;
private String diagnoskapitel;
private String diagnosavsnitt;
private String diagnoskategori;
}
}
|
lgpl-3.0
|
philjord/jnif
|
jnif/src/nif/compound/NifbhkCMSDMaterial.java
|
623
|
package nif.compound;
import java.io.IOException;
import java.nio.ByteBuffer;
import nif.ByteConvert;
public class NifbhkCMSDMaterial
{
/**
* <compound name="bhkCMSDMaterial">
per-chunk material, used in bhkCompressedMeshShapeData
<add name="Material ID" type="uint">Unknown</add>
<add name="Unknown Integer" type="uint">Always 1?</add>
</compound>
*/
public int MaterialID;
public int UnknownInteger;
public NifbhkCMSDMaterial(ByteBuffer stream) throws IOException
{
MaterialID = ByteConvert.readInt(stream);
UnknownInteger = ByteConvert.readInt(stream);
}
}
|
lgpl-3.0
|
antigloss/go
|
logger/README.md
|
7058
|
# Overview
Package logger is a goroutine-safe logging facility which writes logs with different severity levels to files, console, or both. Logs with different severity levels are written to different logfiles.
# Features
1. Auto rotation: It'll create a new logfile whenever day changes or size of the current logfile exceeds the configured size limit.
2. Auto purging: It'll delete some oldest logfiles whenever the number of logfiles exceeds the configured limit.
3. Log-through: Logs with higher severity level will be written to all the logfiles with lower severity level.
4. Log levels: 6 different levels are supported. Logs with different levels are written to different logfiles. By setting the Logger object to a higher log level, lower level logs will be filtered out.
5. Logs are not buffered, they are written to logfiles immediately with os.(*File).Write().
6. It'll create symlinks that link to the most current logfiles.
# Basic examples
## Use the global Logger object
// logger.Init must be called first to create the global Logger object
err := logger.Init(&logger.Config{
LogDir: "./logs",
LogFileMaxSize: 200,
LogFileMaxNum: 500,
LogFileNumToDel: 50,
LogLevel: logger.LogLevelInfo,
LogDest: logger.LogDestFile,
Flag: logger.ControlFlagLogLineNum,
})
if err != nil {
panic(err)
}
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Warnf("Failed to parse protocol! uid=%d plid=%d cmd=%s", 1234, 678942, "getplayer")
## Create a new Logger object
While the global Logger object should be enough for most cases, you can also create as many Logger objects as desired.
newLogger, err := logger.New(&logger.Config{
LogDir: "./logs",
LogFileMaxSize: 200,
LogFileMaxNum: 500,
LogFileNumToDel: 50,
LogLevel: logger.LogLevelInfo,
LogDest: logger.LogDestFile,
Flag: logger.ControlFlagLogLineNum,
})
if err != nil {
panic(err)
}
newLogger.Info("abc", 123, 444.77)
newLogger.Error("abc", 123, 444.77)
newLogger.Close()
# Documentation
Please refer to [godoc](https://godoc.org/github.com/antigloss/go/logger) or [pkg.go.dev](https://pkg.go.dev/github.com/antigloss/go/logger).
# Performance
package main
import (
"fmt"
"github.com/antigloss/go/logger"
"runtime"
"sync"
"time"
)
var wg sync.WaitGroup
func main() {
logger.Init(&logger.Config{
LogDir: "./logs",
LogFileMaxSize: 200,
LogFileMaxNum: 500,
LogFileNumToDel: 50,
LogLevel: logger.LogLevelInfo,
LogDest: logger.LogDestFile,
Flag: logger.ControlFlagLogLineNum,
})
fmt.Print("Single goroutine (1000000 writes), GOMAXPROCS(1): ")
tSaved := time.Now()
for i := 0; i != 1000000; i++ {
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
}
fmt.Println(time.Now().Sub(tSaved))
fmt.Print("100000 goroutines (each makes 10 writes), GOMAXPROCS(1): ")
test()
fmt.Print("100000 goroutines (each makes 10 writes), GOMAXPROCS(2): ")
runtime.GOMAXPROCS(2)
test()
fmt.Print("100000 goroutines (each makes 10 writes), GOMAXPROCS(4): ")
runtime.GOMAXPROCS(4)
test()
fmt.Print("100000 goroutines (each makes 10 writes), GOMAXPROCS(8): ")
runtime.GOMAXPROCS(8)
test()
fmt.Print("100000 goroutines (each makes 10 writes), GOMAXPROCS(16): ")
runtime.GOMAXPROCS(16)
test()
}
func test() {
tSaved := time.Now()
for i := 0; i != 100000; i++ {
wg.Add(1)
go func() {
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
logger.Infof("Failed to find player! uid=%d plid=%d cmd=%s xxx=%d", 1234, 678942, "getplayer", 102020101)
wg.Add(-1)
}()
}
wg.Wait()
fmt.Println(time.Now().Sub(tSaved))
}
Running this test program under Win10, i7-9700 @ 3.00GHz(8 cores, 8 threads), WDS500G2B0A-00SM50(SSD):
Single goroutine (1000000 writes), GOMAXPROCS(1): 3.2784983s
100000 goroutines (each makes 10 writes), GOMAXPROCS(1): 4.0297497s
100000 goroutines (each makes 10 writes), GOMAXPROCS(2): 3.7067683s
100000 goroutines (each makes 10 writes), GOMAXPROCS(4): 3.8241992s
100000 goroutines (each makes 10 writes), GOMAXPROCS(8): 4.2463802s
100000 goroutines (each makes 10 writes), GOMAXPROCS(16): 4.1943385s
About 233 ~ 303 thousand writes per second.
Under macOS Catalina 10.15.6,i9-9880H @ 2.3GHz(8 cores, 16 threads), APPLE SSD AP2048N:
Single goroutine (1000000 writes), GOMAXPROCS(1): 4.311780023s
100000 goroutines (each makes 10 writes), GOMAXPROCS(1): 6.627393432s
100000 goroutines (each makes 10 writes), GOMAXPROCS(2): 5.553245254s
100000 goroutines (each makes 10 writes), GOMAXPROCS(4): 6.579052789s
100000 goroutines (each makes 10 writes), GOMAXPROCS(8): 5.725944572s
100000 goroutines (each makes 10 writes), GOMAXPROCS(16): 5.952777505s
About 149 ~ 231 thousand writes per second.
Under a cloud server, Ubuntu 18.04, Xeon Gold 6149 @ 3.10GHz(16 cores), unknown brand HDD:
Single goroutine (1000000 writes), GOMAXPROCS(1): 3.183363298s
100000 goroutines (each makes 10 writes), GOMAXPROCS(1): 3.992387381s
100000 goroutines (each makes 10 writes), GOMAXPROCS(2): 3.96368545s
100000 goroutines (each makes 10 writes), GOMAXPROCS(4): 3.936505055s
100000 goroutines (each makes 10 writes), GOMAXPROCS(8): 3.843349416s
100000 goroutines (each makes 10 writes), GOMAXPROCS(16): 3.864881766s
About 250 ~ 312 thousand writes per second.
|
lgpl-3.0
|
nuun-io/nuun-spring-plugin
|
src/test/java/io/nuun/plugin/spring/sample/Service3Internal.java
|
875
|
/**
* Copyright (C) 2013-2014 Kametic <epo.jemba@kametic.com>
*
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3, 29 June 2007;
* or any later version
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* 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 io.nuun.plugin.spring.sample;
public class Service3Internal implements Service3
{
@Override
public String serve()
{
return this.getClass().getName();
}
}
|
lgpl-3.0
|
Kelvinli1988/mysqlmv
|
src/main/java/org/mysqlmv/cd/workers/LogFileChangeDetector.java
|
4083
|
package org.mysqlmv.cd.workers;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.mysqlmv.Switch;
import org.mysqlmv.cd.dao.CdDao;
import org.mysqlmv.cd.workers.impl.DefaultLogFileChangeProcessor;
import org.mysqlmv.cd.workers.impl.LogFileScanStatus;
import org.mysqlmv.common.config.reader.ConfigFactory;
import org.slf4j.Logger;
import java.io.*;
import java.sql.SQLException;
/**
* Created by Kelvin Li on 11/18/2014 2:38 PM.
*/
public class LogFileChangeDetector implements Runnable {
public static Logger logger = org.slf4j.LoggerFactory.getLogger(LogFileChangeDetector.class);
private volatile long lastChangeTimeStamp;
private volatile String logRoot;
private LogFileChangeProcessor processor = new DefaultLogFileChangeProcessor();
@Override
public void run() {
logRoot = ConfigFactory.getINSTANCE().getProperty("log-root-folder");
Switch controller = Switch.getSwitch();
while(controller.getStatus()) {
scannLog();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void scannLog() {
try {
// When mysql is shutdown normally, a stop event will appears in the log file,
// then should handle this situation.
LogFileScanStatus status = LogFileScanStatus.SUCCESS;
File logFile = new File(findCurrentLogFile());
boolean isNewFile = false;
while(true) {
status = processor.onFileChange(logFile, isNewFile);
if(status.equals(LogFileScanStatus.SUCCESS)) {
break;
} else if(status.equals(LogFileScanStatus.STOP)) {
isNewFile = true;
logger.warn("Mysql DB service is shutdown.");
} else if(status.equals(LogFileScanStatus.CONTINUE_NEXT)) {
logFile = findNextFile();
isNewFile = true;
}
}
} catch (IOException e) {
logger.error("Error happened when reading bin-log.");
logger.error(ExceptionUtils.getStackTrace(e));
// throw new RuntimeException(e);
} catch (SQLException e) {
e.printStackTrace();
}
}
private File findNextFile() throws SQLException, IOException {
String logFullName = CdDao.findCurrentLogFileName();
String curFileName = new File(logFullName).getName();
File indexFile = findIndexLogfile();
BufferedReader indexReader = new BufferedReader(new FileReader(indexFile));
if(indexReader == null) {
return null;
}
String line = null;
while((line = indexReader.readLine()) != null) {
if(line.contains(".\\")) {
line = line.replace(".\\", "");
if(curFileName.equals(line)) {
line = indexReader.readLine().replace(".\\", "");
break;
}
}
}
if("".equals(line)) {
return null;
}
return new File(logRoot + "/" + line);
}
public File findIndexLogfile() {
File logDir = new File(logRoot);
File indexFile = null;
for(File ff : logDir.listFiles()) {
if(ff.getName().endsWith(".index")) {
indexFile = ff;
}
}
return indexFile;
}
private String findCurrentLogFile() throws IOException {
String currentLogFile = null;
File indexFile = findIndexLogfile();
BufferedReader indexReader = new BufferedReader(new FileReader(indexFile));
if(indexReader == null) {
return null;
}
String line = null;
while((line = indexReader.readLine()) != null) {
if(line.contains(".\\")) {
currentLogFile = line.replace(".\\", "");
}
}
return logRoot + "/" + currentLogFile;
}
}
|
lgpl-3.0
|
SonarSource/sonarqube
|
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfCeActivityTableTest/schema.sql
|
1326
|
CREATE TABLE "CE_ACTIVITY"(
"UUID" VARCHAR(40) NOT NULL,
"TASK_TYPE" VARCHAR(15) NOT NULL,
"MAIN_COMPONENT_UUID" VARCHAR(40),
"COMPONENT_UUID" VARCHAR(40),
"STATUS" VARCHAR(15) NOT NULL,
"MAIN_IS_LAST" BOOLEAN NOT NULL,
"MAIN_IS_LAST_KEY" VARCHAR(55) NOT NULL,
"IS_LAST" BOOLEAN NOT NULL,
"IS_LAST_KEY" VARCHAR(55) NOT NULL,
"SUBMITTER_UUID" VARCHAR(255),
"SUBMITTED_AT" BIGINT NOT NULL,
"STARTED_AT" BIGINT,
"EXECUTED_AT" BIGINT,
"EXECUTION_COUNT" INTEGER NOT NULL,
"EXECUTION_TIME_MS" BIGINT,
"ANALYSIS_UUID" VARCHAR(50),
"ERROR_MESSAGE" VARCHAR(1000),
"ERROR_STACKTRACE" CLOB,
"ERROR_TYPE" VARCHAR(20),
"WORKER_UUID" VARCHAR(40),
"CREATED_AT" BIGINT NOT NULL,
"UPDATED_AT" BIGINT NOT NULL
);
ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID");
CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID");
CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST", "STATUS");
CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY");
CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID");
CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST", "STATUS");
CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY");
|
lgpl-3.0
|
Frankie-PellesC/fSDK
|
Lib/src/mfuuid/guids0000003E.c
|
464
|
// Created file "Lib\src\mfuuid\guids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(GUID_PROCESSOR_SETTINGS_SUBGROUP, 0x54533251, 0x82be, 0x4824, 0x96, 0xc1, 0x47, 0xb6, 0x0b, 0x74, 0x0d, 0x00);
|
lgpl-3.0
|
Unnamed-Software/QMLAnimatedCharts
|
README.md
|
36
|
QMLAnimatedCharts
=================
|
lgpl-3.0
|
yesan/Spacebuilder
|
BusinessComponents/ContentOrganization/Announcements/Announcement.cs
|
3858
|
//------------------------------------------------------------------------------
// <copyright company="Tunynet">
// Copyright (c) Tunynet Inc. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using PetaPoco;
using Tunynet.Caching;
namespace Tunynet.Common
{
/// <summary>
/// 公告实体类
/// </summary>
[TableName("spb_Announcements")]
[PrimaryKey("Id", autoIncrement = true)]
[CacheSetting(true)]
[Serializable]
public class Announcement : IEntity
{
/// <summary>
/// 新建实体时使用
/// </summary>
public static Announcement New()
{
Announcement announcement = new Announcement()
{
Subject = string.Empty,
SubjectStyle = string.Empty,
Body = string.Empty,
HyperLinkUrl = string.Empty,
ReleaseDate = DateTime.UtcNow,
ExpiredDate = DateTime.UtcNow,
LastModified = DateTime.UtcNow,
CreatDate = DateTime.UtcNow.ToLocalTime()
};
return announcement;
}
#region 需持久化属性
/// <summary>
///Primary key
/// </summary>
public long Id { get; protected set; }
/// <summary>
///公告主题
/// </summary>
public string Subject { get; set; }
/// <summary>
///主题字体风格
/// </summary>
public string SubjectStyle { get; set; }
/// <summary>
///公告内容
/// </summary>
public string Body { get; set; }
/// <summary>
///是否是连接
/// </summary>
public bool IsHyperLink { get; set; }
/// <summary>
///链接地址
/// </summary>
public string HyperLinkUrl { get; set; }
/// <summary>
///是否启用
/// </summary>
public bool EnabledDescription { get; set; }
/// <summary>
///发布时间
/// </summary>
public DateTime ReleaseDate { get; set; }
/// <summary>
///过期时间
/// </summary>
public DateTime ExpiredDate { get; set; }
/// <summary>
///更新时间
/// </summary>
public DateTime LastModified { get; set; }
/// <summary>
///创建时间
/// </summary>
[SqlBehavior(~SqlBehaviorFlags.Update)]
public DateTime CreatDate { get; set; }
/// <summary>
///创建人Id
/// </summary>
public long UserId { get; set; }
/// <summary>
///显示顺序
/// </summary>
public long DisplayOrder { get; set; }
/// <summary>
///展示区域
/// </summary>
public string DisplayArea { get; set; }
#endregion
#region 扩展属性和方法
/// <summary>
/// 浏览数
/// </summary>
[Ignore]
public int HitTimes
{
get
{
CountService countService = new CountService(TenantTypeIds.Instance().Announcement());
return countService.Get(CountTypes.Instance().HitTimes(), this.Id);
}
}
/// <summary>
/// 撰稿人
/// </summary>
[Ignore]
public string UserName
{ get; set; }
/// <summary>
/// 管理员标示
/// </summary>
[Ignore]
public bool IsAdministrator
{ get; set; }
#endregion
#region IEntity 成员
object IEntity.EntityId { get { return this.Id; } }
bool IEntity.IsDeletedInDatabase { get; set; }
#endregion
}
}
|
lgpl-3.0
|
patrickmortensen/Elektro
|
Source To Merge/Interpreter/CInterpreter.cpp
|
1413
|
#include "CInterpreter.h"
#include "ErrorDefinitions.h"
#include "main.h"
CInterpreter::CInterpreter()
{}
CInterpreter::~CInterpreter()
{}
void CInterpreter::SetFileTree(CFileTree fileTree)
{
m_fileTree = fileTree;
}
unsigned int CInterpreter::CompileFileList()
{
char msg[512] = {0};
unsigned int* result = new unsigned int[m_fileTree.GetNumberOfFiles()];
for(int i = 0; i < m_fileTree.GetNumberOfFiles(); i++)
{
result[i] = CompileFile(m_fileTree.GetFile(i));
}
for(int i = 0; i < m_fileTree.GetNumberOfFiles(); i++)
{
if(result[i] == NO_ERROR)
m_fileTree.GetFile(i)->doScript();
else
{
sprintf(msg, "Could Not Run Script: %s | %s\n", m_fileTree.GetFile(i)->GetFilename(),
GetErrorText(result[i]));
debug.Log(msg);
}
}
return NO_ERROR;
}
unsigned int CInterpreter::CompileFile(CScriptFile* file)
{
m_scanner.SetFile(file);
unsigned int result = m_scanner.ScanFile();
if(result != NO_ERROR)
return result;
m_lexer.SetCharacters(m_scanner.GetCharacters(), m_scanner.GetCharacterCount());
result = m_lexer.ProcessCharacters();
if(result != NO_ERROR)
return result;
m_parser.SetScript(file);
m_parser.SetTokenList(m_lexer.GetTokens(), m_lexer.GetTokenCount());
result = m_parser.ParseTokens();
return result;
}
|
lgpl-3.0
|
lecovi/lecovi.github.io
|
listings/prog/str03.py.html
|
7712
|
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="description" content="str03.py">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>str03.py | Make it So!</title>
<link href="../../assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
<meta name="theme-color" content="#5670d4">
<meta name="generator" content="Nikola (getnikola.com)">
<link rel="alternate" type="application/rss+xml" title="RSS" hreflang="es" href="../../rss.xml">
<link rel="canonical" href="https://leo.bitson.group/listings/prog/str03.py.html">
<!--[if lt IE 9]><script src="../../assets/js/html5.js"></script><![endif]--><link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="../../assets/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<a href="#content" class="sr-only sr-only-focusable">Ir al contenido principal</a>
<!-- Menubar -->
<nav class="navbar navbar-inverse navbar-fixed-top"><div class="container">
<!-- This keeps the margins nice -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://leo.bitson.group/">
<span id="blog-title">Make it So!</span>
</a>
</div>
<!-- /.navbar-header -->
<div class="collapse navbar-collapse" id="bs-navbar" aria-expanded="false">
<ul class="nav navbar-nav">
<li>
<a href="../../blog/"><i class="fas fa-pencil-alt"></i> Blog</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-university"></i> Cursos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="../../cfp"><i class="fab fa-linux"></i> <strong>Centro de Formación Profesional<strong></strong></strong></a>
</li>
<li>
<a href="../../cfp/prog/"> <i class="fas fa-code-branch"></i> Técnicas de Programación</a>
</li>
<li>
<a href="../../ifts"><i class="fas fa-graduation-cap"></i> <strong>Terciario<strong></strong></strong></a>
</li>
<li>
<a href="../../ifts/arq/"> <i class="fas fa-laptop"></i> Arquitectura de Computadoras</a>
</li>
<li>
<a href="../../ifts/dlo/"> <i class="fas fa-sitemap"></i> Diagramación Lógica</a>
</li>
<li>
<a href="../../ifts/edd/"> <i class="fas fa-database"></i> Estructura de Datos</a>
</li>
<li>
<a href="../../ifts/par/"> <i class="fas fa-code"></i> Paradigmas de Programación</a>
</li>
<li>
<a href="../../ifts/ana/"> <i class="fab fa-trello"></i> Análisis de Sistemas</a>
</li>
<li>
<a href="../../bitson"><i class="fas fa-users"></i> <strong>BITSON<strong></strong></strong></a>
</li>
<li>
<a href="../../bitson/pyintro2018/"> <i class="fab fa-python"></i> Taller de Introducción a Python #PyConAR2018</a>
</li>
<li>
<a href="../../bitson/prog-sl/"> <i class="fas fa-keyboard"></i> Programación con Software Libre</a>
</li>
<li>
<a href="../../bitson/olin/"> <i class="fas fa-terminal"></i> Operador Básico GNU/Linux</a>
</li>
<li>
<a href="../../bitson/reli/"> <i class="fab fa-qq"></i> Administración de Redes con GNU/Linux</a>
</li>
</ul>
</li>
<li>
<a href="../../resources/"><i class="fas fa-wrench"></i> Recursos</a>
</li>
<li>
<a href="../../archive.html"><i class="fas fa-archive"></i> Archivo</a>
</li>
<li>
<a href="../../categories/"><i class="fas fa-tags"></i> Etiquetas</a>
</li>
<li>
<a href="../../rss.xml"><i class="fas fa-rss"></i> RSS</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="str03.py" id="sourcelink">Código fuente</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav><!-- End of Menubar --><div class="container" id="content" role="main">
<div class="body-content">
<!--Body content-->
<div class="row">
<nav class="breadcrumbs"><ul class="breadcrumb">
<li><a href="../">listings</a></li>
<li><a href=".">prog</a></li>
<li>str03.py</li>
</ul></nav><h1>str03.py
<small><a href="str03.py">(Código fuente)</a></small>
</h1>
<table class="codetable"><tr>
<td class="linenos"><div class="linenodiv"><pre><a href="#listingsprogstr03py-1">1</a>
<a href="#listingsprogstr03py-2">2</a>
<a href="#listingsprogstr03py-3">3</a>
<a href="#listingsprogstr03py-4">4</a></pre></div></td>
<td class="code"><pre class="code literal-block"><a name="listingsprogstr03py-1"></a><span class="n">a</span> <span class="o">=</span> <span class="s2">"el dia esta nublado"</span>
<a name="listingsprogstr03py-2"></a>
<a name="listingsprogstr03py-3"></a><span class="k">for</span> <span class="n">letra</span> <span class="ow">in</span> <span class="n">a</span><span class="p">:</span>
<a name="listingsprogstr03py-4"></a> <span class="k">print</span><span class="p">(</span><span class="n">letra</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span>
</pre></td>
</tr></table>
</div>
<!--End of body content-->
<footer id="footer"><div class="text-center">
Contents © 2019 <a href="mailto:leo+blog@bitson.group">Leandro E. Colombo Viña</a> -
<a href="https://www.facebook.com/bitsonargentina"><i class="fab fa-facebook"></i></a>
<a href="https://www.twitter.com/lecovi"><i class="fab fa-twitter"></i></a>
<a href="https://instagram.com/lecovi"><i class="fab fa-instagram"></i></a>
<a href="https://www.linkedin.com/in/leandrocolombo"><i class="fab fa-linkedin"></i></a>
<a href="https://www.telegram.me/lecovi"><i class="fas fa-send"></i></a>
<a href="#+5491130015328"><i class="fab fa-whatsapp"></i></a>
<a href="https://www.youtube.com/bitsonargentina"><i class="fab fa-youtube"></i></a>
<a href="https://plus.google.com/+LeandroEColomboVi%C3%B1a-bitson"><i class="fab fa-google-plus"></i></a>
<a href="https://www.github.com/lecovi"><i class="fab fa-github"></i></a>
<a href="https://bitbucket.org/colomboleandro"><i class="fab fa-bitbucket"></i></a> -
Powered by <a href="https://getnikola.com" rel="nofollow">Nikola</a> -
<a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License BY-NC-SA" style="border-width:0; margin-bottom:12px;" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"></a>
</div>
</footer>
</div>
</div>
<script src="../../assets/js/all-nocdn.js"></script><script>$('a.image-reference:not(.islink) img:not(.islink)').parent().colorbox({rel:"gal",maxWidth:"100%",maxHeight:"100%",scalePhotos:true});</script><!-- fancy dates --><script>
moment.locale("es");
fancydates(0, "YYYY-MM-DD HH:mm");
</script><!-- end fancy dates -->
</body>
</html>
|
lgpl-3.0
|
SonarSource/sonarqube
|
sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/QualityProfilesProvider.java
|
1663
|
/*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program 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 (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.scanner.repository;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
import org.sonar.scanner.bootstrap.ScannerProperties;
import org.sonar.scanner.rule.QualityProfiles;
import org.springframework.context.annotation.Bean;
public class QualityProfilesProvider {
private static final Logger LOG = Loggers.get(QualityProfilesProvider.class);
private static final String LOG_MSG = "Load quality profiles";
@Bean("QualityProfiles")
public QualityProfiles provide(QualityProfileLoader loader, ScannerProperties props) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
QualityProfiles profiles = new QualityProfiles(loader.load(props.getProjectKey()));
profiler.stopInfo();
return profiles;
}
}
|
lgpl-3.0
|
bhohbaum/compactcms
|
build/upload.bat
|
848
|
@echo off & setlocal enabledelayedexpansion
:: param 1 needs to be defined as ${selected_resource_path}
:: param 2 needs to be defined as ${resource_loc}
echo %1 > out.txt
echo %2 >> out.txt
set targetdir=%~dp1%
set targetdir=%targetdir:~3,999%
set targetdir=%targetdir:\=/%
:: remove the project name from path
:: put it between the : and the =
set targetdir=%targetdir:libcompactmvc=%
:: in case there exists a subdirectory with the same name as
:: the project directory put that name between the last two slashes
set targetdir=%targetdir://=/libcompactmvc/%
echo %targetdir% >> out.txt
set targetdir=%targetdir:~1,999%
copy login.ftp __tmpupload.ftp
echo cd %targetdir% >> __tmpupload.ftp
echo ls >> __tmpupload.ftp
echo put %2 >> __tmpupload.ftp
echo quit >> __tmpupload.ftp
ftp -i -s:__tmpupload.ftp
del __tmpupload.ftp
del out.txt
|
lgpl-3.0
|
nguyenti/recipeSite
|
web-app/css/app.css
|
1070
|
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 50px;
padding-bottom: 20px;
}
.title {
position: relative;
}
.dualCol {
columns: 2;
-webkit-columns: 2;
-moz-columns: 2;
}
.comment {
background-color: #bbb;
padding: 1em;
width: 100%;
margin: 10px;
border-radius: 5px;
}
.newComment {
padding: 1em;
width: 100%;
margin: 10px;
}
label.field {
text-align: right;
width: 15%;
float: left;
}
.rating {
width: 30%;
}
.textbox {
width: 65%;
}
.recipe {
background-color: #888;
margin: 10px;
width: 350px;
max-width: 95%;
height: 420px;
padding: 1.5em;
position: relative;
float: left;
left: 1.5em;
right: 1.5em;
display: table;
}
.recipe .inlink {
display:block;
height: 100%;
width: 100%;
text-decoration:none;
vertical-align: middle;
display: table-cell;
color: black;
}
.errors {
color: #D8000C;
background-color: #FFBABA;
padding: 1em;
}
span.errors input {
border: 1px solid red;
}
|
lgpl-3.0
|
alexeyk13/rexos
|
midware/fs/fat16.c
|
55001
|
/*
RExOS - embedded RTOS
Copyright (c) 2011-2019, RExOS team
All rights reserved.
author: Alexey E. Kramarenko (alexeyk13@yandex.ru)
*/
#include "fat16.h"
#include "../../userspace/ipc.h"
#include "../../userspace/error.h"
#include "../../userspace/process.h"
#include "../../userspace/stdio.h"
#include "../../userspace/storage.h"
#include "../../userspace/disk.h"
#include "../../userspace/utf.h"
#include "../../userspace/time.h"
#include <string.h>
#include "vfss_private.h"
#define FILE_ENTRIES_IN_SECTOR (FAT_SECTOR_SIZE / sizeof(FAT_FILE_ENTRY))
#define FAT_ENTRIES_IN_SECTOR (FAT_SECTOR_SIZE / 2)
typedef struct {
unsigned int first_cluster, current_cluster, cluster_num, pos;
} FAT16_FILE_INFO;
typedef struct {
FAT16_FILE_INFO fi, data;
unsigned int size, mode;
} FAT16_FILE_HANDLE_TYPE;
typedef enum {
FAT16_UPPER_CASE,
FAT16_LOWER_CASE,
FAT16_MIXED_CASE,
FAT16_UNDEFINED_CASE
} FAT16_CASE_TYPE;
static const uint8_t __FAT16_BOOT[FAT_SECTOR_SIZE] = {
0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, 0x00, 0x02, 0x00, 0x01, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x3F, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x5F, 0x58, 0xC1, 0x90, 0x4E, 0x4F, 0x20, 0x4E, 0x41,
0x4D, 0x45, 0x20, 0x20, 0x20, 0x20, 0x46, 0x41, 0x54, 0x31, 0x36, 0x20, 0x20, 0x20, 0x33, 0xC9,
0x8E, 0xD1, 0xBC, 0xF0, 0x7B, 0x8E, 0xD9, 0xB8, 0x00, 0x20, 0x8E, 0xC0, 0xFC, 0xBD, 0x00, 0x7C,
0x38, 0x4E, 0x24, 0x7D, 0x24, 0x8B, 0xC1, 0x99, 0xE8, 0x3C, 0x01, 0x72, 0x1C, 0x83, 0xEB, 0x3A,
0x66, 0xA1, 0x1C, 0x7C, 0x26, 0x66, 0x3B, 0x07, 0x26, 0x8A, 0x57, 0xFC, 0x75, 0x06, 0x80, 0xCA,
0x02, 0x88, 0x56, 0x02, 0x80, 0xC3, 0x10, 0x73, 0xEB, 0x33, 0xC9, 0x8A, 0x46, 0x10, 0x98, 0xF7,
0x66, 0x16, 0x03, 0x46, 0x1C, 0x13, 0x56, 0x1E, 0x03, 0x46, 0x0E, 0x13, 0xD1, 0x8B, 0x76, 0x11,
0x60, 0x89, 0x46, 0xFC, 0x89, 0x56, 0xFE, 0xB8, 0x20, 0x00, 0xF7, 0xE6, 0x8B, 0x5E, 0x0B, 0x03,
0xC3, 0x48, 0xF7, 0xF3, 0x01, 0x46, 0xFC, 0x11, 0x4E, 0xFE, 0x61, 0xBF, 0x00, 0x00, 0xE8, 0xE6,
0x00, 0x72, 0x39, 0x26, 0x38, 0x2D, 0x74, 0x17, 0x60, 0xB1, 0x0B, 0xBE, 0xA1, 0x7D, 0xF3, 0xA6,
0x61, 0x74, 0x32, 0x4E, 0x74, 0x09, 0x83, 0xC7, 0x20, 0x3B, 0xFB, 0x72, 0xE6, 0xEB, 0xDC, 0xA0,
0xFB, 0x7D, 0xB4, 0x7D, 0x8B, 0xF0, 0xAC, 0x98, 0x40, 0x74, 0x0C, 0x48, 0x74, 0x13, 0xB4, 0x0E,
0xBB, 0x07, 0x00, 0xCD, 0x10, 0xEB, 0xEF, 0xA0, 0xFD, 0x7D, 0xEB, 0xE6, 0xA0, 0xFC, 0x7D, 0xEB,
0xE1, 0xCD, 0x16, 0xCD, 0x19, 0x26, 0x8B, 0x55, 0x1A, 0x52, 0xB0, 0x01, 0xBB, 0x00, 0x00, 0xE8,
0x3B, 0x00, 0x72, 0xE8, 0x5B, 0x8A, 0x56, 0x24, 0xBE, 0x0B, 0x7C, 0x8B, 0xFC, 0xC7, 0x46, 0xF0,
0x3D, 0x7D, 0xC7, 0x46, 0xF4, 0x29, 0x7D, 0x8C, 0xD9, 0x89, 0x4E, 0xF2, 0x89, 0x4E, 0xF6, 0xC6,
0x06, 0x96, 0x7D, 0xCB, 0xEA, 0x03, 0x00, 0x00, 0x20, 0x0F, 0xB6, 0xC8, 0x66, 0x8B, 0x46, 0xF8,
0x66, 0x03, 0x46, 0x1C, 0x66, 0x8B, 0xD0, 0x66, 0xC1, 0xEA, 0x10, 0xEB, 0x5E, 0x0F, 0xB6, 0xC8,
0x4A, 0x4A, 0x8A, 0x46, 0x0D, 0x32, 0xE4, 0xF7, 0xE2, 0x03, 0x46, 0xFC, 0x13, 0x56, 0xFE, 0xEB,
0x4A, 0x52, 0x50, 0x06, 0x53, 0x6A, 0x01, 0x6A, 0x10, 0x91, 0x8B, 0x46, 0x18, 0x96, 0x92, 0x33,
0xD2, 0xF7, 0xF6, 0x91, 0xF7, 0xF6, 0x42, 0x87, 0xCA, 0xF7, 0x76, 0x1A, 0x8A, 0xF2, 0x8A, 0xE8,
0xC0, 0xCC, 0x02, 0x0A, 0xCC, 0xB8, 0x01, 0x02, 0x80, 0x7E, 0x02, 0x0E, 0x75, 0x04, 0xB4, 0x42,
0x8B, 0xF4, 0x8A, 0x56, 0x24, 0xCD, 0x13, 0x61, 0x61, 0x72, 0x0B, 0x40, 0x75, 0x01, 0x42, 0x03,
0x5E, 0x0B, 0x49, 0x75, 0x06, 0xF8, 0xC3, 0x41, 0xBB, 0x00, 0x00, 0x60, 0x66, 0x6A, 0x00, 0xEB,
0xB0, 0x4E, 0x54, 0x4C, 0x44, 0x52, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0D, 0x0A, 0x52, 0x65,
0x6D, 0x6F, 0x76, 0x65, 0x20, 0x64, 0x69, 0x73, 0x6B, 0x73, 0x20, 0x6F, 0x72, 0x20, 0x6F, 0x74,
0x68, 0x65, 0x72, 0x20, 0x6D, 0x65, 0x64, 0x69, 0x61, 0x2E, 0xFF, 0x0D, 0x0A, 0x44, 0x69, 0x73,
0x6B, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0xFF, 0x0D, 0x0A, 0x50, 0x72, 0x65, 0x73, 0x73, 0x20,
0x61, 0x6E, 0x79, 0x20, 0x6B, 0x65, 0x79, 0x20, 0x74, 0x6F, 0x20, 0x72, 0x65, 0x73, 0x74, 0x61,
0x72, 0x74, 0x0D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAC, 0xCB, 0xD8, 0x55, 0xAA};
static int fat16_get_free(VFSS_TYPE* vfss);
static void fat16_now(struct tm* ts)
{
TIME t;
SYSTIME uptime;
get_uptime(&uptime);
t.day = VFS_BASE_DATE + uptime.sec / SEC_IN_DAY;
t.ms = (uptime.sec % SEC_IN_DAY) * 1000 + uptime.usec / 1000;
gmtime(&t, ts);
}
static unsigned short fat16_fat_date_now()
{
struct tm ts;
fat16_now(&ts);
return ((ts.tm_year - FAT_DATE_EPOCH_YEAR) << FAT_DATE_YEAR_POS) | ((ts.tm_mon + 1) << FAT_DATE_MON_POS) | (ts.tm_mday << FAT_DATE_DAY_POS);
}
static unsigned short fat16_fat_time_now()
{
struct tm ts;
fat16_now(&ts);
return (ts.tm_hour << FAT_TIME_HOURS_POS) | (ts.tm_min << FAT_TIME_MINUTES_POS) | ((ts.tm_sec >> 1) << FAT_DATE_DAY_POS);
}
static unsigned short fat16_ztime_now()
{
SYSTIME uptime;
get_uptime(&uptime);
return uptime.usec / 10000;
}
static unsigned long fat16_cluster_to_sector(VFSS_TYPE* vfss, unsigned long cluster)
{
return vfss->fat16.reserved_sectors + vfss->fat16.fat_sectors * vfss->fat16.fat_count + vfss->fat16.root_sectors + (cluster - 2) * vfss->fat16.cluster_sectors;
}
static unsigned long fat16_get_fat_value(VFSS_TYPE* vfss, unsigned long cluster)
{
uint16_t* fat;
fat = vfss_read_sectors(vfss, vfss->fat16.reserved_sectors + (cluster / FAT_ENTRIES_IN_SECTOR), FAT_SECTOR_SIZE);
if (fat == NULL)
return FAT_CLUSTER_RESERVED;
return fat[cluster % FAT_ENTRIES_IN_SECTOR];
}
static unsigned long fat16_get_fat_next(VFSS_TYPE* vfss, unsigned long cluster)
{
unsigned long next;
next = fat16_get_fat_value(vfss, cluster);
if (next >= FAT_CLUSTER_RESERVED || next < 2)
{
#if (VFS_DEBUG_ERRORS)
printf("FAT16 warning: FAT corrupted\n");
#endif //VFS_DEBUG_ERRORS
error(ERROR_CORRUPTED);
}
return next;
}
static bool fat16_set_fat_value(VFSS_TYPE* vfss, unsigned long cluster, unsigned long value)
{
unsigned int i;
uint16_t* fat;
fat = vfss_read_sectors(vfss, vfss->fat16.reserved_sectors + (cluster / FAT_ENTRIES_IN_SECTOR), FAT_SECTOR_SIZE);
if (fat == NULL)
return false;
fat[cluster % FAT_ENTRIES_IN_SECTOR] = value;
for (i = 0; i < vfss->fat16.fat_count; ++i)
{
if (!vfss_write_sectors(vfss, vfss->fat16.reserved_sectors + vfss->fat16.fat_sectors * i + (cluster / FAT_ENTRIES_IN_SECTOR), FAT_SECTOR_SIZE))
return false;
}
return true;
}
static unsigned long fat16_find_free_cluster(VFSS_TYPE* vfss, unsigned long cluster)
{
unsigned long next_free;
//after current till last
for (next_free = cluster + 1; next_free < vfss->fat16.clusters_count; ++next_free)
if (fat16_get_fat_value(vfss, next_free) == FAT_CLUSTER_FREE)
return next_free;
//from first till current -1
for (next_free = 2; next_free < cluster; ++next_free)
if (fat16_get_fat_value(vfss, next_free) == FAT_CLUSTER_FREE)
return next_free;
#if (VFS_DEBUG_ERRORS)
printf("FAT16 warning: No free space\n");
#endif //VFS_DEBUG_ERRORS
return FAT_CLUSTER_RESERVED;
}
static unsigned long fat16_occupy_first_cluster(VFSS_TYPE* vfss)
{
unsigned long cluster = fat16_find_free_cluster(vfss, 2);
if (cluster >= FAT_CLUSTER_RESERVED)
return FAT_CLUSTER_RESERVED;
if (!fat16_set_fat_value(vfss, cluster, FAT_CLUSTER_LAST))
return FAT_CLUSTER_RESERVED;
return cluster;
}
static unsigned long fat16_occupy_next_cluster(VFSS_TYPE* vfss, unsigned long current_cluster)
{
unsigned long cluster = fat16_find_free_cluster(vfss, current_cluster);
if (cluster >= FAT_CLUSTER_RESERVED)
return FAT_CLUSTER_RESERVED;
if (!fat16_set_fat_value(vfss, current_cluster, cluster))
return FAT_CLUSTER_RESERVED;
if (!fat16_set_fat_value(vfss, cluster, FAT_CLUSTER_LAST))
return FAT_CLUSTER_RESERVED;
return cluster;
}
static bool fat16_release_chain(VFSS_TYPE* vfss, unsigned long start_cluster)
{
unsigned long cluster, next_cluster;
for (cluster = start_cluster; cluster < FAT_CLUSTER_RESERVED; cluster = next_cluster)
{
next_cluster = fat16_get_fat_value(vfss, cluster);
if (!fat16_set_fat_value(vfss, cluster, FAT_CLUSTER_FREE))
return false;
}
return true;
}
static unsigned int fat16_strspcpy(char* dst, char* src, unsigned int dst_size, unsigned int src_size, bool lowercase)
{
unsigned int i, size;
for (size = src_size; size; --size)
if (src[size - 1] != ' ')
break;
if (size >= dst_size)
size = dst_size - 1;
memcpy(dst, src, size);
dst[size] = '\x0';
if (lowercase)
{
for (i = 0; i < size; ++i)
if (dst[i] >= 'A' && dst[i] <= 'Z')
dst[i] += 0x20;
}
return size;
}
void fat16_init(VFSS_TYPE* vfss)
{
vfss->fat16.active = false;
}
static bool fat16_parse_boot(VFSS_TYPE* vfss)
{
FAT_BOOT_SECTOR_BPB_TYPE* bpb;
uint8_t* boot = vfss_read_sectors(vfss, 0, FAT_SECTOR_SIZE);
if (boot == NULL)
return false;
if (*((uint16_t*)(boot + MBR_MAGIC_OFFSET)) != MBR_MAGIC)
{
#if (VFS_DEBUG_ERRORS)
printf("FAT16: Invalid boot sector signature\n");
#endif //VFS_DEBUG_ERRORS
error(ERROR_NOT_SUPPORTED);
return false;
}
bpb = (void*)(boot + sizeof(FAT_BOOT_SECTOR_HEADER_TYPE));
if ((bpb->sector_size != FAT_SECTOR_SIZE) || (bpb->ext_signature != FAT_BPB_EXT_SIGNATURE))
{
error(ERROR_NOT_SUPPORTED);
#if (VFS_DEBUG_ERRORS)
printf("FAT16: Unsupported BPB\n");
#endif //VFS_DEBUG_ERRORS
return false;
}
vfss->fat16.cluster_sectors = bpb->cluster_sectors;
vfss->fat16.sectors_count = bpb->sectors_short;
vfss->fat16.root_count = bpb->root_count;
vfss->fat16.root_sectors = (bpb->root_count * sizeof(FAT_FILE_ENTRY) + FAT_SECTOR_SIZE - 1) / FAT_SECTOR_SIZE;
vfss->fat16.reserved_sectors = bpb->reserved_sectors;
vfss->fat16.fat_sectors = bpb->fat_sectors;
vfss->fat16.fat_count = bpb->fat_count;
if (vfss->fat16.sectors_count == 0)
vfss->fat16.sectors_count = bpb->sectors;
if (vfss->fat16.sectors_count > vfss_get_volume_sectors(vfss) || vfss->fat16.sectors_count == 0 || vfss->fat16.cluster_sectors == 0)
{
error(ERROR_CORRUPTED);
#if (VFS_DEBUG_ERRORS)
printf("FAT16: Boot sector corrupted\n");
#endif //VFS_DEBUG_ERRORS
return false;
}
vfss->fat16.clusters_count = (vfss->fat16.sectors_count - (vfss->fat16.reserved_sectors + vfss->fat16.fat_sectors * vfss->fat16.fat_count + vfss->fat16.root_sectors)) / vfss->fat16.cluster_sectors + 2;
vfss->fat16.cluster_size = vfss->fat16.cluster_sectors * FAT_SECTOR_SIZE;
vfss_resize_buf(vfss, vfss->fat16.cluster_size);
#if (VFS_DEBUG_INFO)
printf("FAT16 info:\n");
printf("cluster size: %d\n", vfss->fat16.cluster_sectors * FAT_SECTOR_SIZE);
printf("total sectors: %d\n", vfss->fat16.sectors_count);
printf("serial No: %08X\n", bpb->serial);
#endif //VFS_DEBUG_INFO
return true;
}
static void fat16_fi_create(FAT16_FILE_INFO* fi, unsigned int first_cluster)
{
fi->first_cluster = fi->current_cluster = first_cluster;
fi->cluster_num = fi->pos = 0;
}
static void fat16_fi_reset(FAT16_FILE_INFO* fi)
{
fi->current_cluster = fi->first_cluster;
fi->cluster_num = 0;
}
static bool fat16_fi_get_cluster_num(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, unsigned int cluster_num)
{
for(fat16_fi_reset(fi); fi->current_cluster < FAT_CLUSTER_RESERVED && fi->cluster_num < cluster_num; ++fi->cluster_num)
fi->current_cluster = fat16_get_fat_next(vfss, fi->current_cluster);
return fi->current_cluster < FAT_CLUSTER_RESERVED;
}
//sector offset inside current cluster
static unsigned int fat16_entry_get_sector_num(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi)
{
unsigned int cluster_num;
if (fi->first_cluster == VFS_ROOT)
{
if (fi->pos >= vfss->fat16.root_count)
return FAT_CLUSTER_RESERVED;
return fi->pos / FILE_ENTRIES_IN_SECTOR;
}
cluster_num = fi->pos / (FILE_ENTRIES_IN_SECTOR * vfss->fat16.cluster_sectors);
if (cluster_num != fi->cluster_num)
{
//most often case - iterate search
if (cluster_num == fi->cluster_num + 1)
{
fi->current_cluster = fat16_get_fat_next(vfss, fi->current_cluster);
fi->cluster_num = cluster_num;
}
else
fat16_fi_get_cluster_num(vfss, fi, cluster_num);
if (fi->current_cluster >= FAT_CLUSTER_RESERVED)
{
#if (VFS_DEBUG_ERRORS)
printf("FAT16: File entry cluster chain corrupted\n");
#endif //VFS_DEBUG_ERRORS
return FAT_CLUSTER_RESERVED;
}
}
return (fi->pos - FILE_ENTRIES_IN_SECTOR * vfss->fat16.cluster_sectors * fi->cluster_num) / FILE_ENTRIES_IN_SECTOR;
}
static unsigned int fat16_entry_get_sector_by_num(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, unsigned int sector_num)
{
if (fi->first_cluster == VFS_ROOT)
return vfss->fat16.reserved_sectors + vfss->fat16.fat_sectors * vfss->fat16.fat_count + sector_num;
return fat16_cluster_to_sector(vfss, fi->current_cluster) + sector_num;
}
static FAT_FILE_ENTRY* fat16_read_file_entry(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi)
{
unsigned int sector_num, pos_cur;
FAT_FILE_ENTRY* entries;
sector_num = fat16_entry_get_sector_num(vfss, fi);
if (sector_num >= FAT_CLUSTER_RESERVED)
return NULL;
if (fi->first_cluster == VFS_ROOT)
pos_cur = fi->pos - sector_num * FILE_ENTRIES_IN_SECTOR;
else
pos_cur = fi->pos - (fi->cluster_num * vfss->fat16.cluster_sectors + sector_num) * FILE_ENTRIES_IN_SECTOR;
entries = vfss_read_sectors(vfss, fat16_entry_get_sector_by_num(vfss, fi, sector_num), FAT_SECTOR_SIZE);
if (entries == NULL)
return NULL;
return entries + pos_cur;
}
static FAT_FILE_ENTRY* fat16_init_file_entry(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi)
{
FAT_FILE_ENTRY* entry;
entry = fat16_read_file_entry(vfss, fi);
if (entry == NULL)
return NULL;
memset(entry->name, ' ', 11);
entry->attr = 0;
entry->sys_attr = 0;
entry->security = 0;
entry->first_cluster = 0;
entry->size = 0;
entry->crt_ztime = fat16_ztime_now();
entry->crt_date = entry->mod_date = entry->acc_date = fat16_fat_date_now();
entry->crt_time = entry->mod_time = fat16_fat_time_now();
return entry;
}
static bool fat16_write_file_entry(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi)
{
unsigned int sector_num;
sector_num = fat16_entry_get_sector_num(vfss, fi);
if (sector_num >= FAT_CLUSTER_RESERVED)
return false;
return vfss_write_sectors(vfss, fat16_entry_get_sector_by_num(vfss, fi, sector_num), FAT_SECTOR_SIZE);
}
static bool fat16_allocate_file_entries(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, unsigned int count)
{
unsigned int i;
unsigned long next_cluster;
FAT_FILE_ENTRY* entry;
fat16_fi_reset(fi);
for(fi->pos = 0, i = 0; i < count; ++fi->pos)
{
if ((entry = fat16_read_file_entry(vfss, fi)) == NULL)
return false;
//last one
if (entry->name[0] == FAT_FILE_ENTRY_EMPTY)
break;
if (entry->name[0] == FAT_FILE_ENTRY_MAGIC_ERASED)
++i;
else
i = 0;
}
fi->pos -= i;
if (i == count)
return true;
//no hole? append.
if (fi->first_cluster == VFS_ROOT)
{
if (fi->pos + count >= vfss->fat16.root_count)
{
#if (VFS_DEBUG_ERRORS)
printf("FAT16: Warning: Too many root entries\n");
#endif //VFS_DEBUG_ERRORS
error(ERROR_NOT_FOUND);
return false;
}
}
else
{
i = (vfss->fat16.cluster_size - ((fi->pos * sizeof(FAT_FILE_ENTRY)) % vfss->fat16.cluster_size)) / sizeof(FAT_FILE_ENTRY);
//need more cluster?
if (i <= count)
{
if ((next_cluster = fat16_occupy_next_cluster(vfss, fi->current_cluster)) >= FAT_CLUSTER_RESERVED)
return false;
if (!vfss_zero_sectors(vfss, fat16_cluster_to_sector(vfss, next_cluster), vfss->fat16.cluster_sectors))
return false;
}
}
return true;
}
static uint8_t fat16_lfn_checksum(const char* name83)
{
unsigned int i;
uint8_t crc = 0;
for (i = 11; i; i--)
crc = ((crc & 1) << 7) + (crc >> 1) + (uint8_t)(*name83++);
return crc;
}
static unsigned int fat16_lfn_read_chunk(FAT_LFN_ENTRY* lfn, char* lfn_chunk_latin1)
{
uint16_t lfn_chunk[FAT_LFN_CHUNK_SIZE];
memcpy(lfn_chunk + 0, lfn->name1, 5 * 2);
memcpy(lfn_chunk + 5, lfn->name2, 6 * 2);
memcpy(lfn_chunk + 11, lfn->name3, 2 * 2);
return utf16_to_latin1(lfn_chunk, lfn_chunk_latin1, FAT_LFN_CHUNK_SIZE);
}
static bool fat16_lfn_write_chunk(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, uint8_t checksum, uint8_t seq, const char* name)
{
uint16_t lfn_chunk[FAT_LFN_CHUNK_SIZE];
FAT_LFN_ENTRY* lfn;
unsigned int lfn_chunk_size;
lfn = (FAT_LFN_ENTRY*)fat16_read_file_entry(vfss, fi);
if (lfn == NULL)
return false;
memset(lfn, 0xFF, sizeof(FAT_LFN_ENTRY));
lfn->seq = seq;
lfn->attr = FAT_FILE_ATTR_LFN;
lfn->type = 0x00;
lfn->checksum = checksum;
lfn->first_cluster = 0x0000;
lfn_chunk_size = latin1_to_utf16(name, lfn_chunk, FAT_LFN_CHUNK_SIZE);
//add tailing zero
if (lfn_chunk_size < FAT_LFN_CHUNK_SIZE)
++lfn_chunk_size;
memcpy(lfn->name1, lfn_chunk + 0, ((lfn_chunk_size >= 5 ? 5 : lfn_chunk_size) - 0) * 2);
if (lfn_chunk_size > 5)
memcpy(lfn->name2, lfn_chunk + 5, ((lfn_chunk_size >= 11 ? 11 : lfn_chunk_size) - 5) * 2);
if (lfn_chunk_size > 11)
memcpy(lfn->name3, lfn_chunk + 11, (lfn_chunk_size - 11) * 2);
return fat16_write_file_entry(vfss, fi);
}
static bool fat16_get_file_name(VFSS_TYPE* vfss, char* name, FAT16_FILE_INFO* fi, unsigned int mask, unsigned int ignore_mask)
{
FAT_FILE_ENTRY* entry;
FAT_LFN_ENTRY* lfn;
char lfn_chunk_latin1[FAT_LFN_CHUNK_SIZE];
unsigned int size, lfn_chunk_size;
uint8_t lfn_seq = 0x00;
uint8_t lfn_crc = 0x00;
size = 0;
for (;;)
{
entry = fat16_read_file_entry(vfss, fi);
if (entry == NULL)
return false;
if ((uint8_t)(entry->name[0]) == FAT_FILE_ENTRY_EMPTY)
return false;
if ((uint8_t)(entry->name[0]) == FAT_FILE_ENTRY_MAGIC_ERASED)
{
++fi->pos;
continue;
}
//LFN chunk process
if ((entry->attr & FAT_FILE_ATTR_LFN) == FAT_FILE_ATTR_LFN)
{
++fi->pos;
lfn = (FAT_LFN_ENTRY*)entry;
//last chunk is first
if (((lfn->seq & FAT_LFN_SEQ_LAST) && lfn_seq) || (((lfn->seq & FAT_LFN_SEQ_LAST) == 0) && ((lfn->seq & FAT_LFN_SEQ_MASK) != lfn_seq)))
{
#if (VFS_DEBUG_ERRORS)
printf("FAT16 warning: LFN wrong sequence\n");
#endif //VFS_DEBUG_ERRORS
lfn_seq = 0x00;
size = 0;
continue;
}
if (lfn->seq & FAT_LFN_SEQ_LAST)
{
lfn_seq = lfn->seq & FAT_LFN_SEQ_MASK;
lfn_crc = lfn->checksum;
}
else if (lfn->checksum != lfn_crc)
{
#if (VFS_DEBUG_ERRORS)
printf("FAT16 warning: LFN checksum not match\n");
#endif //VFS_DEBUG_ERRORS
lfn_seq = 0x00;
size = 0;
continue;
}
lfn_chunk_size = fat16_lfn_read_chunk(lfn, lfn_chunk_latin1);
memmove(name + lfn_chunk_size, name, size);
memcpy(name, lfn_chunk_latin1, lfn_chunk_size);
size += lfn_chunk_size;
name[size] = '\x0';
if (--lfn_seq == 0)
lfn_seq = 0xff;
continue;
}
if (((entry->attr & (mask & FAT_FILE_ATTR_REAL_MASK)) != (mask & FAT_FILE_ATTR_REAL_MASK)) ||
((mask & FAT_FILE_ATTR_DOT_OR_DOT_DOT) && entry->name[0] != '.') ||
((ignore_mask & FAT_FILE_ATTR_DOT_OR_DOT_DOT) && entry->name[0] == '.') ||
(entry->attr & (ignore_mask & FAT_FILE_ATTR_REAL_MASK)))
{
++fi->pos;
lfn_seq = 0x00;
size = 0;
continue;
}
if (lfn_seq == 0xff)
{
if (lfn_crc == fat16_lfn_checksum(entry->name))
return true;
#if (VFS_DEBUG_ERRORS)
else
printf("FAT16 warning: LFN checksum not match\n");
#endif //VFS_DEBUG_ERRORS
}
#if (VFS_DEBUG_ERRORS)
else if (lfn_seq)
printf("FAT16 warning: LFN sequence incomplete\n");
#endif //VFS_DEBUG_ERRORS
size = fat16_strspcpy(name, entry->name, VFS_MAX_FILE_PATH + 1, 8, entry->sys_attr & FAT_FILE_SYS_ATTR_NAME_LOWER_CASE);
if (entry->ext[0] != ' ')
{
name[size++] = '.';
fat16_strspcpy(name + size, entry->ext, VFS_MAX_FILE_PATH + 1 - size, 3, entry->sys_attr & FAT_FILE_SYS_ATTR_EXT_LOWER_CASE);
}
if (name[0] == FAT_FILE_ENTRY_STUFF_MAGIC)
name[0] = FAT_FILE_ENTRY_MAGIC_ERASED;
return true;
}
}
static unsigned int fat16_decode_attr(unsigned int fat_attr)
{
unsigned int res = 0;
if (fat_attr & FAT_FILE_ATTR_SUBFOLDER)
res |= VFS_ATTR_FOLDER;
if (fat_attr & FAT_FILE_ATTR_HIDDEN)
res |= VFS_ATTR_HIDDEN;
if (fat_attr & FAT_FILE_ATTR_READ_ONLY)
res |= VFS_ATTR_READ_ONLY;
return res;
}
static bool fat16_find_by_name(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, const char* name, unsigned int mask, unsigned int ignore_mask)
{
char name_cur[VFS_MAX_FILE_PATH + 1];
fat16_fi_reset(fi);
for (fi->pos = 0; fat16_get_file_name(vfss, name_cur, fi, mask, ignore_mask); ++fi->pos)
{
if (strcmp(name_cur, name) == 0)
return true;
}
return false;
}
static bool fat16_find_by_name83(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, const char* name83)
{
FAT_FILE_ENTRY* entry;
fat16_fi_reset(fi);
for (fi->pos = 0; (entry = fat16_read_file_entry(vfss, fi)) != NULL; ++fi->pos)
{
if ((uint8_t)(entry->name[0]) == FAT_FILE_ENTRY_EMPTY)
return false;
//skip erased and LFN chunks
if ((uint8_t)(entry->name[0]) == FAT_FILE_ENTRY_MAGIC_ERASED)
continue;
if ((entry->attr & FAT_FILE_ATTR_LFN) == FAT_FILE_ATTR_LFN)
continue;
if (memcmp(entry->name, name83, 11) == 0)
return true;
}
return false;
}
static bool fat16_get_by_name(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, const char* name, unsigned int mask, unsigned int ignore_mask)
{
FAT_FILE_ENTRY* entry;
if (!fat16_find_by_name(vfss, fi, name, mask, ignore_mask))
{
error(ERROR_NOT_FOUND);
return false;
}
entry = fat16_read_file_entry(vfss, fi);
fat16_fi_create(fi, entry->first_cluster);
return true;
}
static bool fat16_get_parent_folder(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi)
{
if (fi->first_cluster == VFS_ROOT)
return true;
return fat16_get_by_name(vfss, fi, VFS_PARENT_FOLDER, FAT_FILE_ATTR_DOT_OR_DOT_DOT, FAT_FILE_ATTR_LABEL);
}
static bool fat16_get_path(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, char* path)
{
unsigned int i;
char* path_cur;
//NULL path is current path
if (path == NULL)
return true;
//root only path
if (path[0] == '\x0')
{
fat16_fi_create(fi, VFS_ROOT);
return true;
}
//starting from root
if (path[0] == VFS_FOLDER_DELIMITER)
{
fat16_fi_create(fi, VFS_ROOT);
path++;
}
while (path[0] != '\x0')
{
path_cur = path;
for(i = 0; path[i] != '\x0' && path[i] != VFS_FOLDER_DELIMITER; ++i) {}
//wrong path, double /
if (i == 0)
{
error(ERROR_INVALID_PARAMS);
return false;
}
if (path[i] == '\x0')
path += i;
else
{
path[i] = '\x0';
path += i + 1;
}
if (strcmp(path_cur, VFS_CURRENT_FOLDER) == 0)
continue;
if (strcmp(path_cur, VFS_PARENT_FOLDER) == 0)
{
if (!fat16_get_parent_folder(vfss, fi))
return false;
continue;
}
if (!fat16_get_by_name(vfss, fi, path_cur, FAT_FILE_ATTR_SUBFOLDER, FAT_FILE_ATTR_LABEL))
return false;
}
return true;
}
static char* fat16_extract_file_from_path(char* raw, char** path)
{
char* file;
int i;
for (i = strlen(raw) - 1; i >= 0 && raw[i] != VFS_FOLDER_DELIMITER; --i) {}
file = raw + i + 1;
*path = raw;
if (strcmp(file, VFS_CURRENT_FOLDER) == 0)
return NULL;
if (strcmp(file, VFS_PARENT_FOLDER) == 0)
return NULL;
if (i >= 0)
raw[i] = '\x0';
else
*path = NULL;
return file;
}
static char* fat16_extract_ext_from_name(char* name_ext, char** name)
{
unsigned int len;
int i;
len = strlen(name_ext);
*name = name_ext;
if (len == 0)
return NULL;
//file. has no extension
if (name_ext[len - 1] == '.')
return NULL;
//file of .abc is name without extension
for (i = len - 1; i > 0; --i)
{
//dot found
if (name_ext[i] == '.')
{
name_ext[i] = '\x0';
return name_ext + i + 1;
}
//no extension
if (len - 1 - i >= 3)
break;
}
return NULL;
}
static bool fat16_is_folder_empty(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi)
{
FAT16_FILE_INFO folder_fi;
FAT_FILE_ENTRY* entry;
entry = fat16_read_file_entry(vfss, fi);
if (entry == NULL)
return false;
fat16_fi_create(&folder_fi, entry->first_cluster);
//can't erase root folder
if (folder_fi.first_cluster == VFS_ROOT)
return false;
//skip . and ..
for (folder_fi.pos = 2;; ++folder_fi.pos)
{
entry = fat16_read_file_entry(vfss, &folder_fi);
if (entry == NULL)
return false;
//skip LFN chunks, volume labels,
if ((entry->name[0] == FAT_FILE_ENTRY_MAGIC_ERASED) || (entry->attr == FAT_FILE_ATTR_LFN) || (entry->attr == FAT_FILE_ATTR_LABEL))
continue;
if (entry->name[0] == FAT_FILE_ENTRY_EMPTY)
return true;
//in all other cases it's file or folder
return false;
}
}
static char fat16_char_upper(char c)
{
if (c >= 'a' && c <= 'z')
return c - 0x20;
return c;
}
static bool fat16_83_existed_char(char c)
{
if (c == '.' || c == ' ')
return false;
return true;
}
static FAT16_CASE_TYPE fat16_get_case(char* str)
{
FAT16_CASE_TYPE c = FAT16_UNDEFINED_CASE;
for (; str[0]; str++)
{
if (!fat16_83_existed_char(str[0]))
return FAT16_MIXED_CASE;
if (str[0] >= 'A' && str[0] <= 'Z')
{
if (c == FAT16_LOWER_CASE)
return FAT16_MIXED_CASE;
c = FAT16_UPPER_CASE;
}
if (str[0] >= 'a' && str[0] <= 'z')
{
if (c == FAT16_UPPER_CASE)
return FAT16_MIXED_CASE;
c = FAT16_LOWER_CASE;
}
}
if (c == FAT16_UNDEFINED_CASE)
c = FAT16_UPPER_CASE;
return c;
}
static bool fat16_create_file_entry(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi, char* name_ext, uint8_t attr)
{
char* ext;
char* name;
char name83[11];
unsigned int len, i, j, first_cluster;
uint8_t name83_checksum;
FAT16_CASE_TYPE name_case, ext_case;
FAT_FILE_ENTRY* entry;
//make sure file(folder) not exists
if (fat16_find_by_name(vfss, fi, name_ext, 0, FAT_FILE_ATTR_LABEL))
{
error(ERROR_FILE_PATH_ALREADY_EXISTS);
return false;
}
len = strlen(name_ext);
ext = fat16_extract_ext_from_name(name_ext, &name);
if (name == NULL)
{
error(ERROR_INVALID_PARAMS);
return false;
}
if ((fat16_get_free(vfss)/vfss->fat16.cluster_size) < 2)
{
error(ERROR_FULL);
return false;
}
for (i = 0; i < 11; ++i)
name83[i] = ' ';
if (strlen(name) > 8)
name_case = FAT16_MIXED_CASE;
else
name_case = fat16_get_case(name);
if (ext)
{
ext_case = fat16_get_case(ext);
for (i = 0, j = 8; i < 3 && ext[i]; ++i)
if (fat16_83_existed_char(ext[i]))
name83[j++] = fat16_char_upper(ext[i]);
}
else
ext_case = FAT16_UPPER_CASE;
first_cluster = fat16_occupy_first_cluster(vfss);
if (first_cluster >= FAT_CLUSTER_RESERVED)
return false;
do {
//need lfn?
if (name_case == FAT16_MIXED_CASE || ext_case == FAT16_MIXED_CASE)
{
name_case = ext_case = FAT16_MIXED_CASE;
for (i = 0, j = 0; name[i] && j < 6; ++i)
if (fat16_83_existed_char(name[i]))
name83[j++] = fat16_char_upper(name[i]);
name83[j++] = '~';
//make sure short name is not used
for (i = 1; i <= 9; ++i)
{
name83[j] = '0' + i;
if (!fat16_find_by_name83(vfss, fi, name83))
break;
}
if (i > 9)
{
error(ERROR_FILE_PATH_ALREADY_EXISTS);
break;
}
//join name and ext
if (ext)
name[strlen(name)] = '.';
j = (len + FAT_LFN_CHUNK_SIZE - 1) / FAT_LFN_CHUNK_SIZE;
if (!fat16_allocate_file_entries(vfss, fi, 1 + j))
return false;
//write LFN chunks
name83_checksum = fat16_lfn_checksum(name83);
for (i = j; i > 0; --i)
{
if (!fat16_lfn_write_chunk(vfss, fi, name83_checksum, i | (i == j ? FAT_LFN_SEQ_LAST : 0), name + FAT_LFN_CHUNK_SIZE * (i - 1)))
break;
++fi->pos;
}
if (i)
break;
}
else
{
for (i = 0; i < 8 && name[i]; ++i)
name83[i] = fat16_char_upper(name[i]);
if (!fat16_allocate_file_entries(vfss, fi, 1))
break;
}
//write short entry
entry = fat16_init_file_entry(vfss, fi);
if (entry == NULL)
break;
memcpy(entry->name, name83, 11);
entry->attr = attr;
if (name_case == FAT16_LOWER_CASE)
entry->sys_attr |= FAT_FILE_SYS_ATTR_NAME_LOWER_CASE;
if (ext_case == FAT16_LOWER_CASE)
entry->sys_attr |= FAT_FILE_SYS_ATTR_EXT_LOWER_CASE;
entry->first_cluster = first_cluster;
if (!fat16_write_file_entry(vfss, fi))
break;
return true;
} while (false);
//error occured, free occupied cluster
fat16_release_chain(vfss, first_cluster);
return false;
}
static bool fat16_remove_file_entry(VFSS_TYPE* vfss, FAT16_FILE_INFO* fi)
{
FAT_FILE_ENTRY* entry;
FAT_LFN_ENTRY* lfn;
uint8_t name83_checksum, seq;
//first remove short entry
entry = fat16_read_file_entry(vfss, fi);
if (entry == NULL)
return false;
name83_checksum = fat16_lfn_checksum(entry->name);
entry->name[0] = FAT_FILE_ENTRY_MAGIC_ERASED;
if (!fat16_write_file_entry(vfss, fi))
return false;
//remove lfn chunks
if (fi->pos == 0)
return true;
for(--fi->pos;;--fi->pos)
{
lfn = (FAT_LFN_ENTRY*)fat16_read_file_entry(vfss, fi);
if (lfn == NULL)
return false;
if ((lfn->attr != FAT_FILE_ATTR_LFN) || (lfn->checksum != name83_checksum))
return true;
seq = lfn->seq;
lfn->attr = 0;
lfn->seq = FAT_FILE_ENTRY_MAGIC_ERASED;
if (!fat16_write_file_entry(vfss, fi))
return false;
if ((fi->pos == 0) || (seq & FAT_LFN_SEQ_LAST))
return true;
}
}
static void fat16_close_file(VFSS_TYPE* vfss, HANDLE h)
{
#if (VFS_FILE_ATTRIBUTES_UPDATE)
FAT16_FILE_HANDLE_TYPE* f;
FAT_FILE_ENTRY* entry;
f = so_get(&vfss->fat16.file_handles, h);
if (f)
{
entry = fat16_read_file_entry(vfss, &f->fi);
if (entry)
{
entry->acc_date = fat16_fat_date_now();
if (f->mode & VFS_MODE_WRITE)
{
entry->mod_date = entry->acc_date;
entry->mod_time = fat16_fat_time_now();
}
fat16_write_file_entry(vfss, &f->fi);
}
}
#endif //VFS_FILE_ATTRIBUTES_UPDATE
so_free(&vfss->fat16.file_handles, h);
}
static inline void fat16_mount(VFSS_TYPE* vfss)
{
if (vfss->fat16.active)
{
error(ERROR_ALREADY_CONFIGURED);
return;
}
so_create(&vfss->fat16.finds, sizeof(FAT16_FILE_INFO), 1);
so_create(&vfss->fat16.file_handles, sizeof(FAT16_FILE_HANDLE_TYPE), 1);
if (fat16_parse_boot(vfss))
vfss->fat16.active = true;
}
static void fat16_unmount(VFSS_TYPE* vfss)
{
HANDLE handle;
//1. free finds
while((handle = so_first(&vfss->fat16.finds)) != INVALID_HANDLE)
so_free(&vfss->fat16.finds, handle);
//2. free file_handles
while((handle = so_first(&vfss->fat16.file_handles)) != INVALID_HANDLE)
fat16_close_file(vfss, handle);
so_destroy(&vfss->fat16.finds);
so_destroy(&vfss->fat16.file_handles);
vfss->fat16.active = false;
}
static inline void fat16_find_first(VFSS_TYPE* vfss, unsigned int folder, HANDLE process)
{
HANDLE h;
FAT16_FILE_INFO* fi;
h = so_allocate(&vfss->fat16.finds);
if (h == INVALID_HANDLE)
return;
fi = so_get(&vfss->fat16.finds, h);
fat16_fi_create(fi, folder);
ipc_post_inline(process, HAL_CMD(HAL_VFS, VFS_FIND_FIRST), folder, h, 0);
error(ERROR_SYNC);
}
static inline void fat16_find_next(VFSS_TYPE* vfss, IPC* ipc)
{
VFS_FIND_TYPE* find;
FAT16_FILE_INFO* fi;
FAT_FILE_ENTRY* entry;
IO* io = (IO*)ipc->param2;
find = io_data(io);
fi = so_get(&vfss->fat16.finds, ipc->param1);
if (fi == NULL)
return;
if (!fat16_get_file_name(vfss, find->name, fi, 0, FAT_FILE_ATTR_LABEL | FAT_FILE_ATTR_DOT_OR_DOT_DOT))
{
error(ERROR_NOT_FOUND);
return;
}
entry = fat16_read_file_entry(vfss, fi);
find->item = entry->first_cluster;
find->size = entry->size;
find->attr = fat16_decode_attr(entry->attr);
++fi->pos;
io->data_size = sizeof(VFS_FIND_TYPE) - VFS_MAX_FILE_PATH + strlen(find->name) + 1;
io_complete_ex(ipc->process, HAL_IO_CMD(HAL_VFS, VFS_FIND_NEXT), ipc->param1, io, ipc->param1);
error(ERROR_SYNC);
}
static void fat16_find_close(VFSS_TYPE* vfss, HANDLE h)
{
so_free(&vfss->fat16.finds, h);
}
static inline void fat16_cd_up(VFSS_TYPE* vfss, unsigned int folder, HANDLE process)
{
FAT16_FILE_INFO fi;
fat16_fi_create(&fi, folder);
if (!fat16_get_parent_folder(vfss, &fi))
return;
ipc_post_inline(process, HAL_CMD(HAL_VFS, VFS_CD_UP), folder, fi.first_cluster, 0);
error(ERROR_SYNC);
}
static inline void fat16_cd_path(VFSS_TYPE* vfss, unsigned int folder, IO* io, HANDLE process)
{
FAT16_FILE_INFO fi;
fat16_fi_create(&fi, folder);
char* path = io_data(io);
if (strlen(path) > VFS_MAX_FILE_PATH)
{
error(ERROR_INVALID_PARAMS);
return;
}
if (!fat16_get_path(vfss, &fi, path))
return;
*((unsigned int*)io_data(io)) = fi.first_cluster;
io->data_size = sizeof(unsigned int);
io_complete(process, HAL_IO_CMD(HAL_VFS, VFS_CD_PATH), folder, io);
error(ERROR_SYNC);
}
static inline void fat16_read_volume_label(VFSS_TYPE* vfss, IPC* ipc)
{
char* name;
FAT16_FILE_INFO fi;
IO* io = (IO*)ipc->param2;
name = io_data(io);
fat16_fi_create(&fi, VFS_ROOT);
if (!fat16_get_file_name(vfss, name, &fi, FAT_FILE_ATTR_LABEL, FAT_FILE_ATTR_DOT_OR_DOT_DOT))
{
error(ERROR_NOT_FOUND);
return;
}
io->data_size = strlen(name) + 1;
io_complete_ex(ipc->process, HAL_IO_CMD(HAL_VFS, VFS_READ_VOLUME_LABEL), ipc->param1, io, ipc->param1);
error(ERROR_SYNC);
}
static inline void fat16_open_file(VFSS_TYPE* vfss, unsigned int folder, IO* io, HANDLE process)
{
VFS_OPEN_TYPE* ot;
FAT16_FILE_INFO fi;
HANDLE h;
FAT16_FILE_HANDLE_TYPE* f;
char* file;
char* path;
FAT_FILE_ENTRY* entry;
#if (VFS_MAX_HANDLES)
if (so_count(&vfss->fat16.file_handles) >= VFS_MAX_HANDLES)
{
error(ERROR_TOO_MANY_HANDLES);
return;
}
#endif //VFS_MAX_HANDLES
fat16_fi_create(&fi, folder);
ot = io_data(io);
if (strlen(ot->name) > VFS_MAX_FILE_PATH || (ot->mode & (VFS_MODE_READ | VFS_MODE_WRITE)) == 0)
{
error(ERROR_INVALID_PARAMS);
return;
}
file = fat16_extract_file_from_path(ot->name, &path);
if (file == NULL)
{
error(ERROR_INVALID_PARAMS);
return;
}
if (path)
if (!fat16_get_path(vfss, &fi, path))
return;
if (!fat16_find_by_name(vfss, &fi, file, 0, FAT_FILE_ATTR_LABEL | FAT_FILE_ATTR_SUBFOLDER))
{
if (ot->mode & VFS_MODE_WRITE)
{
//try to create file
if (!fat16_create_file_entry(vfss, &fi, file, FAT_FILE_ATTR_ARCHIVE))
return;
}
else
{
error(ERROR_NOT_FOUND);
return;
}
}
h = so_allocate(&vfss->fat16.file_handles);
if (h == INVALID_HANDLE)
return;
f = so_get(&vfss->fat16.file_handles, h);
memcpy(&f->fi, &fi, sizeof(FAT16_FILE_INFO));
entry = fat16_read_file_entry(vfss, &fi);
fat16_fi_create(&f->data, entry->first_cluster);
f->size = entry->size;
f->mode = ot->mode;
*((HANDLE*)io_data(io)) = h;
io->data_size = sizeof(HANDLE);
io_complete(process, HAL_IO_CMD(HAL_VFS, IPC_OPEN), folder, io);
error(ERROR_SYNC);
}
static inline void fat16_seek_file(VFSS_TYPE* vfss, HANDLE h, unsigned int pos)
{
FAT16_FILE_HANDLE_TYPE* f;
unsigned int cluster_num;
f = so_get(&vfss->fat16.file_handles, h);
if (f == NULL)
return;
if (pos > f->size)
f->data.pos = f->size;
else
f->data.pos = pos;
if ((f->data.pos == f->size) && f->size)
cluster_num = (f->size - 1) / vfss->fat16.cluster_size;
else
cluster_num = f->data.pos / vfss->fat16.cluster_size;
if (!fat16_fi_get_cluster_num(vfss, &f->data, cluster_num))
{
fat16_fi_reset(&f->data);
f->data.pos = 0;
}
}
static inline void fat16_read_file(VFSS_TYPE* vfss, HANDLE h, IO* io, unsigned int size, HANDLE process)
{
FAT16_FILE_HANDLE_TYPE* f;
unsigned int cluster_offset, sector_offset, chunk, sector, sectors_count, next_cluster;
uint8_t* buf;
f = so_get(&vfss->fat16.file_handles, h);
if (f == NULL)
return;
if ((f->mode & VFS_MODE_READ) == 0)
{
error(ERROR_ACCESS_DENIED);
return;
}
if (f->data.pos >= f->size)
{
error(ERROR_EOF);
return;
}
if (f->size - f->data.pos < size)
size = f->size - f->data.pos;
io->data_size = 0;
buf = vfss_get_buf(vfss);
while(size)
{
cluster_offset = f->data.pos % vfss->fat16.cluster_size;
sector_offset = cluster_offset % FAT_SECTOR_SIZE;
sector = cluster_offset / FAT_SECTOR_SIZE;
sectors_count = (size + sector_offset + FAT_SECTOR_SIZE - 1) / FAT_SECTOR_SIZE;
if (sectors_count + sector > vfss->fat16.cluster_sectors)
sectors_count = vfss->fat16.cluster_sectors - sector;
chunk = sectors_count * FAT_SECTOR_SIZE - sector_offset;
if (chunk > size)
chunk = size;
if (vfss_read_sectors(vfss, fat16_cluster_to_sector(vfss, f->data.current_cluster) + sector, sectors_count * FAT_SECTOR_SIZE) == NULL)
return;
io_data_append(io, buf + sector_offset, chunk);
size -= chunk;
f->data.pos += chunk;
if ((f->data.pos < f->size) && ((f->data.pos % vfss->fat16.cluster_size) == 0))
{
next_cluster = fat16_get_fat_next(vfss, f->data.current_cluster);
if (next_cluster >= FAT_CLUSTER_RESERVED)
{
fat16_fi_reset(&f->data);
f->data.pos = 0;
return;
}
else
f->data.current_cluster = next_cluster;
}
}
io_complete(process, HAL_IO_CMD(HAL_VFS, IPC_READ), h, io);
error(ERROR_SYNC);
}
static uint32_t fat16_size_to_clusters(VFSS_TYPE* vfss, uint32_t size)
{
uint32_t res = size / vfss->fat16.cluster_size;
if(size % vfss->fat16.cluster_size)
res++;
return res;
}
static bool fat16_is_enouth_space(VFSS_TYPE* vfss, uint32_t curr_pos, uint32_t curr_size, uint32_t size)
{
uint32_t curr_clusters =fat16_size_to_clusters(vfss, curr_size);
uint32_t need_clusters =fat16_size_to_clusters(vfss, curr_pos + size);
if(curr_clusters >=need_clusters)
return true;
if((need_clusters - curr_clusters ) > (fat16_get_free(vfss) / vfss->fat16.cluster_size))
return false;
return true;
}
static inline void fat16_write_file(VFSS_TYPE* vfss, HANDLE h, IO* io, HANDLE process)
{
FAT16_FILE_HANDLE_TYPE* f;
FAT_FILE_ENTRY* entry;
uint8_t* data;
uint8_t* buf;
unsigned int cluster_offset, sector_offset, chunk, sector, sectors_count, next_cluster, size;
f = so_get(&vfss->fat16.file_handles, h);
if (f == NULL)
return;
if ((f->mode & VFS_MODE_WRITE) == 0)
{
error(ERROR_ACCESS_DENIED);
return;
}
data = io_data(io);
if(!fat16_is_enouth_space(vfss, f->data.pos, f->size, io->data_size))
{
error(ERROR_FULL);
return;
}
buf = vfss_get_buf(vfss);
for (size = io->data_size; size; size -= chunk)
{
cluster_offset = f->data.pos % vfss->fat16.cluster_size;
sector_offset = cluster_offset % FAT_SECTOR_SIZE;
sector = cluster_offset / FAT_SECTOR_SIZE;
sectors_count = (size + sector_offset + FAT_SECTOR_SIZE - 1) / FAT_SECTOR_SIZE;
if (sectors_count + sector > vfss->fat16.cluster_sectors)
sectors_count = vfss->fat16.cluster_sectors - sector;
chunk = sectors_count * FAT_SECTOR_SIZE - sector_offset;
if (chunk > size)
chunk = size;
//append cluster. Empty file already have one
if ((f->data.pos == f->size) && (cluster_offset == 0) && f->size)
{
next_cluster = fat16_occupy_next_cluster(vfss, f->data.current_cluster);
if (next_cluster >= FAT_CLUSTER_RESERVED)
break;
f->data.current_cluster = next_cluster;
}
//readout first, no align
if (sector_offset || (chunk % FAT_SECTOR_SIZE))
{
if (vfss_read_sectors(vfss, fat16_cluster_to_sector(vfss, f->data.current_cluster) + sector, sectors_count * FAT_SECTOR_SIZE) == NULL)
break;
}
//overwrite data
memcpy(buf + sector_offset, data, chunk);
data += chunk;
//writeback
if (!vfss_write_sectors(vfss, fat16_cluster_to_sector(vfss, f->data.current_cluster) + sector, sectors_count * FAT_SECTOR_SIZE))
break;
f->data.pos += chunk;
//append to end of file
if (f->data.pos > f->size)
f->size = f->data.pos;
if ((f->data.pos < f->size) && ((f->data.pos % vfss->fat16.cluster_size) == 0))
{
next_cluster = fat16_get_fat_next(vfss, f->data.current_cluster);
if (next_cluster >= FAT_CLUSTER_RESERVED)
{
fat16_fi_reset(&f->data);
f->data.pos = 0;
break;
}
else
f->data.current_cluster = next_cluster;
}
}
//update file attributes
entry = fat16_read_file_entry(vfss, &f->fi);
if (entry)
{
entry->mod_date = fat16_fat_date_now();
entry->mod_time = fat16_fat_time_now();
entry->size = f->size;
fat16_write_file_entry(vfss, &f->fi);
}
io_complete_ex(process, HAL_IO_CMD(HAL_VFS, IPC_WRITE), h, io, io->data_size - size);
error(ERROR_SYNC);
}
static inline void fat16_remove(VFSS_TYPE* vfss, unsigned int folder, IO* io, HANDLE process)
{
FAT16_FILE_INFO fi;
FAT_FILE_ENTRY* entry;
char* file;
char* path;
char* file_path;
unsigned long first_cluster;
fat16_fi_create(&fi, folder);
file_path = io_data(io);
if (strlen(file_path) > VFS_MAX_FILE_PATH)
{
error(ERROR_INVALID_PARAMS);
return;
}
file = fat16_extract_file_from_path(file_path, &path);
if (file == NULL)
{
error(ERROR_INVALID_PARAMS);
return;
}
if (path)
if (!fat16_get_path(vfss, &fi, path))
return;
if (!fat16_find_by_name(vfss, &fi, file, 0, FAT_FILE_ATTR_LABEL))
{
error(ERROR_NOT_FOUND);
return;
}
entry = fat16_read_file_entry(vfss, &fi);
if (entry == NULL)
return;
first_cluster = entry->first_cluster;
if (entry->attr & FAT_FILE_ATTR_SUBFOLDER)
{
if (!fat16_is_folder_empty(vfss, &fi))
{
error(ERROR_FOLDER_NOT_EMPTY);
return;
}
}
if (!fat16_release_chain(vfss, first_cluster))
return;
if (!fat16_remove_file_entry(vfss, &fi))
return;
io->data_size = 0;
io_complete(process, HAL_IO_CMD(HAL_VFS, VFS_REMOVE), folder, io);
error(ERROR_SYNC);
}
static inline void fat16_mk_folder(VFSS_TYPE* vfss, unsigned int folder, IO* io, HANDLE process)
{
FAT16_FILE_INFO fi;
FAT16_FILE_INFO folder_fi;
FAT_FILE_ENTRY* entry;
unsigned int first_cluster;
char* file;
char* path;
char* file_path;
fat16_fi_create(&fi, folder);
file_path = io_data(io);
if (strlen(file_path) > VFS_MAX_FILE_PATH)
{
error(ERROR_INVALID_PARAMS);
return;
}
file = fat16_extract_file_from_path(file_path, &path);
if (file == NULL)
{
error(ERROR_INVALID_PARAMS);
return;
}
if (path)
if (!fat16_get_path(vfss, &fi, path))
return;
if (!fat16_create_file_entry(vfss, &fi, file, FAT_FILE_ATTR_SUBFOLDER))
return;
entry = fat16_read_file_entry(vfss, &fi);
if (entry == NULL)
return;
first_cluster = entry->first_cluster;
//zero items cluster
if (!vfss_zero_sectors(vfss, fat16_cluster_to_sector(vfss, first_cluster), vfss->fat16.cluster_sectors))
return;
//cd folder
fat16_fi_create(&folder_fi, first_cluster);
//mkdir .
entry = fat16_init_file_entry(vfss, &folder_fi);
entry->attr = FAT_FILE_ATTR_SUBFOLDER;
entry->first_cluster = first_cluster;
entry->name[0] = '.';
if (!fat16_write_file_entry(vfss, &folder_fi))
return;
//mkdir ..
folder_fi.pos = 1;
entry = fat16_init_file_entry(vfss, &folder_fi);
entry->attr = FAT_FILE_ATTR_SUBFOLDER;
entry->first_cluster = fi.first_cluster;
entry->name[0] = entry->name[1] = '.';
if (!fat16_write_file_entry(vfss, &folder_fi))
return;
io->data_size = 0;
io_complete(process, HAL_IO_CMD(HAL_VFS, VFS_MK_FOLDER), folder, io);
error(ERROR_SYNC);
}
static inline void fat16_format(VFSS_TYPE* vfss, IO* io, HANDLE process)
{
unsigned int root_sectors, fat_sectors, clusters_count, i;
FAT_BOOT_SECTOR_BPB_TYPE* bpb;
uint8_t* boot;
uint16_t* fat;
FAT16_FILE_INFO fi;
FAT_FILE_ENTRY* entry;
VFS_FAT_FORMAT_TYPE* format = io_data(io);
io->data_size = 0;
if (vfss->fat16.active)
{
error(ERROR_INVALID_MODE);
return;
}
vfss_resize_buf(vfss, format->cluster_sectors * FAT_SECTOR_SIZE);
root_sectors = (format->root_entries * sizeof(FAT_FILE_ENTRY) + FAT_SECTOR_SIZE - 1) / FAT_SECTOR_SIZE;
clusters_count = ((vfss_get_volume_sectors(vfss) - 1 - root_sectors) + format->cluster_sectors - 1) / format->cluster_sectors;
fat_sectors = ((clusters_count + 2) * 2 + FAT_SECTOR_SIZE - 1) / FAT_SECTOR_SIZE;
//generate boot sector
boot = vfss_get_buf(vfss);
memcpy(boot, __FAT16_BOOT, FAT_SECTOR_SIZE);
bpb = (void*)(boot + sizeof(FAT_BOOT_SECTOR_HEADER_TYPE));
vfss->fat16.cluster_sectors = bpb->cluster_sectors = format->cluster_sectors;
vfss->fat16.root_count = bpb->root_count = format->root_entries;;
vfss->fat16.root_sectors = (bpb->root_count * sizeof(FAT_FILE_ENTRY) + FAT_SECTOR_SIZE - 1) / FAT_SECTOR_SIZE;
vfss->fat16.fat_sectors = bpb->fat_sectors = fat_sectors;
vfss->fat16.fat_count = bpb->fat_count = format->fat_count;
#if (VFS_CLUSTER_ALIGN)
vfss->fat16.reserved_sectors = bpb->reserved_sectors = format->cluster_sectors - ((fat_sectors * format->fat_count + root_sectors + 1) % format->cluster_sectors) + 1;
#else
vfss->fat16.reserved_sectors = bpb->reserved_sectors = 1;
#endif //VFS_CLUSTER_ALIGN
bpb->hidden = vfss_get_volume_offset(vfss);
bpb->sectors = vfss_get_volume_sectors(vfss);
bpb->serial = format->serial;
if (!vfss_write_sectors(vfss, 0, FAT_SECTOR_SIZE))
return;
//zero fat, root
if (!vfss_zero_sectors(vfss, vfss->fat16.reserved_sectors, fat_sectors * format->fat_count + root_sectors))
return;
//init fat (sector is now zero)
fat = vfss_get_buf(vfss);
fat[0] = FAT_CLUSTER_RESERVED;
fat[1] = FAT_CLUSTER_LAST;
for (i = 0; i < vfss->fat16.fat_count; ++i)
if (!vfss_write_sectors(vfss, vfss->fat16.reserved_sectors+ vfss->fat16.fat_sectors * i, FAT_SECTOR_SIZE))
return;
//write label in root fs
fat16_fi_create(&fi, VFS_ROOT);
entry = fat16_init_file_entry(vfss, &fi);
if (entry == NULL)
return;
for (i = 0; i < 8 && format->label[i]; ++i)
entry->name[i] = fat16_char_upper(format->label[i]);
entry->attr = FAT_FILE_ATTR_LABEL;
if (fat16_write_file_entry(vfss, &fi))
return;
io_complete(process, HAL_IO_CMD(HAL_VFS, VFS_FORMAT), VFS_FS_HANDLE, io);
error(ERROR_SYNC);
}
static int fat16_get_free(VFSS_TYPE* vfss)
{
unsigned int free_clusters, cluster;
free_clusters = 0;
for (cluster = 2; cluster < vfss->fat16.clusters_count; ++cluster)
if (fat16_get_fat_value(vfss, cluster) == FAT_CLUSTER_FREE)
++free_clusters;
return free_clusters * vfss->fat16.cluster_size;
}
static inline int fat16_get_used(VFSS_TYPE* vfss)
{
return (vfss->fat16.clusters_count - 2) * vfss->fat16.cluster_size - fat16_get_free(vfss);
}
void fat16_request(VFSS_TYPE *vfss, IPC* ipc)
{
switch (HAL_ITEM(ipc->cmd))
{
case IPC_OPEN:
if (ipc->param1 == VFS_FS_HANDLE)
{
fat16_mount(vfss);
return;
}
break;
case VFS_FORMAT:
fat16_format(vfss, (IO*)ipc->param2, ipc->process);
return;
default:
break;
}
if (!vfss->fat16.active)
{
error(ERROR_NOT_CONFIGURED);
return;
}
switch (HAL_ITEM(ipc->cmd))
{
case VFS_FIND_FIRST:
fat16_find_first(vfss, ipc->param1, ipc->process);
break;
case VFS_FIND_NEXT:
fat16_find_next(vfss, ipc);
break;
case VFS_FIND_CLOSE:
fat16_find_close(vfss, (HANDLE)ipc->param1);
break;
case VFS_CD_UP:
fat16_cd_up(vfss, ipc->param1, ipc->process);
break;
case VFS_CD_PATH:
fat16_cd_path(vfss, ipc->param1, (IO*)ipc->param2, ipc->process);
break;
case VFS_READ_VOLUME_LABEL:
fat16_read_volume_label(vfss, ipc);
break;
case IPC_OPEN:
fat16_open_file(vfss, ipc->param1, (IO*)ipc->param2, ipc->process);
break;
case IPC_CLOSE:
if (ipc->param1 == VFS_FS_HANDLE)
fat16_unmount(vfss);
else
fat16_close_file(vfss, ipc->param1);
break;
case IPC_SEEK:
fat16_seek_file(vfss, ipc->param1, ipc->param2);
break;
case IPC_READ:
fat16_read_file(vfss, ipc->param1, (IO*)ipc->param2, ipc->param3, ipc->process);
break;
case IPC_WRITE:
fat16_write_file(vfss, ipc->param1, (IO*)ipc->param2, ipc->process);
break;
case VFS_REMOVE:
fat16_remove(vfss, ipc->param1, (IO*)ipc->param2, ipc->process);
break;
case VFS_MK_FOLDER:
fat16_mk_folder(vfss, ipc->param1, (IO*)ipc->param2, ipc->process);
break;
case VFS_GET_FREE:
ipc->param3 = fat16_get_free(vfss);
break;
case VFS_GET_USED:
ipc->param3 = fat16_get_used(vfss);
break;
default:
error(ERROR_NOT_SUPPORTED);
break;
}
}
|
lgpl-3.0
|
prokhor-ozornin/Catharsis.NET.Domain
|
doc/html/class_catharsis_1_1_domain_1_1_web_link_1_1_schema.js
|
2104
|
var class_catharsis_1_1_domain_1_1_web_link_1_1_schema =
[
[ "ColumnCommentCreatedOn", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#acf10a3ba60a74862f0f6c5693d4274b1", null ],
[ "ColumnCommentDescription", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a253b5a08698b9031bad6693e58d70276", null ],
[ "ColumnCommentId", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a62a44fbade52666afecb722b3cc0002c", null ],
[ "ColumnCommentImage", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a5209aed87483c60a6d60c77e0ab33ac2", null ],
[ "ColumnCommentName", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#aff737033215d67eb5727a33d09abb655", null ],
[ "ColumnCommentUpdatedOn", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#af1000ca8cfc7c0a7f9d06571659c6699", null ],
[ "ColumnCommentUri", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a074316460dc9e10ccf615ad67ddcfae1", null ],
[ "ColumnNameCreatedOn", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#ab40431c7dbc082df339dc71151fcff32", null ],
[ "ColumnNameDescription", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a9031ad7955bbc0fad88d60dbceac977d", null ],
[ "ColumnNameId", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a2c5f800e0f2eee1fcebe43a1cbab6d50", null ],
[ "ColumnNameImage", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a6d6e17b4d40fe663a922337b471f406f", null ],
[ "ColumnNameName", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a24f0c4399f4bbb5fdcb3f8892bb5c2d2", null ],
[ "ColumnNameUpdatedOn", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#ac1ff984be705dacb3cb0f3cfca73d6c9", null ],
[ "ColumnNameUri", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a607055be01cf88d11d958216e5bdd583", null ],
[ "TableComment", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#ad69651422e540bc44ee5131cbae72039", null ],
[ "TableName", "class_catharsis_1_1_domain_1_1_web_link_1_1_schema.html#a41c22ffc0b4eec63865355616bd39690", null ]
];
|
lgpl-3.0
|
falahati/NvAPIWrapper
|
NvAPIWrapper/Native/GPU/Structures/IlluminationZoneControlDataPiecewiseLinearRGB.cs
|
2194
|
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.GPU.Structures
{
/// <summary>
/// Holds information regarding a piecewise linear RGB control method
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct IlluminationZoneControlDataPiecewiseLinearRGB : IInitializable
{
private const int NumberColorEndPoints = 2;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NumberColorEndPoints)]
internal IlluminationZoneControlDataManualRGBParameters[] _EndPoints;
internal IlluminationZoneControlDataPiecewiseLinear _PiecewiseLinearData;
/// <summary>
/// Creates a new instance of <see cref="IlluminationZoneControlDataPiecewiseLinearRGB" />.
/// </summary>
/// <param name="endPoints">The list of RGB piecewise function endpoints.</param>
/// <param name="piecewiseLinearData">The piecewise function settings.</param>
public IlluminationZoneControlDataPiecewiseLinearRGB(
IlluminationZoneControlDataManualRGBParameters[] endPoints,
IlluminationZoneControlDataPiecewiseLinear piecewiseLinearData)
{
if (endPoints?.Length != NumberColorEndPoints)
{
throw new ArgumentOutOfRangeException(nameof(endPoints));
}
this = typeof(IlluminationZoneControlDataPiecewiseLinearRGB)
.Instantiate<IlluminationZoneControlDataPiecewiseLinearRGB>();
_PiecewiseLinearData = piecewiseLinearData;
Array.Copy(endPoints, 0, _EndPoints, 0, endPoints.Length);
}
/// <summary>
/// Gets the piecewise function settings
/// </summary>
public IlluminationZoneControlDataPiecewiseLinear PiecewiseLinearData
{
get => _PiecewiseLinearData;
}
/// <summary>
/// Gets the list of RGB function endpoints
/// </summary>
public IlluminationZoneControlDataManualRGBParameters[] EndPoints
{
get => _EndPoints;
}
}
}
|
lgpl-3.0
|
piif/Guirlande
|
EffectShade.cpp
|
216
|
#include <Guirlande.h>
static int h;
long EffectShade(long step) {
if (step == 0) {
h = 17;
}
for(byte i = 0; i < STRIP_LEN; i++) {
stripSetHL(i, h, (i+1) * 3);
}
stripUpdate();
h = h * 4;
return -1;
}
|
lgpl-3.0
|
PeterWolf-tw/NeoPraat
|
sources_5401/fon/Sound_enhance.cpp
|
5230
|
/* Sound_enhance.cpp
*
* Copyright (C) 1992-2011 Paul Boersma
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* pb 2002/07/16 GPL
* pb 2004/11/22 simplified Sound_to_Spectrum ()
* pb 2007/01/28 made compatible with stereo sounds (by rejecting them)
* pb 2007/07/22 renamed the overlap-add method in such a way that it does not sound like a trademark for diphone concatenation
* pb 2008/01/19 double
* pb 2011/06/07 C++
*/
#include "Manipulation.h"
#include "Sound_to_Pitch.h"
#include "Pitch_to_PitchTier.h"
#include "Pitch_to_PointProcess.h"
#include "Sound_and_Spectrum.h"
Sound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double factor) {
try {
if (my ny > 1)
Melder_throw ("Overlap-add works only on mono sounds.");
autoSound sound = Data_copy (me);
Vector_subtractMean (sound.peek());
autoPitch pitch = Sound_to_Pitch (sound.peek(), 0.8 / fmin, fmin, fmax);
autoPointProcess pulses = Sound_Pitch_to_PointProcess_cc (sound.peek(), pitch.peek());
autoPitchTier pitchTier = Pitch_to_PitchTier (pitch.peek());
autoDurationTier duration = DurationTier_create (my xmin, my xmax);
RealTier_addPoint (duration.peek(), 0.5 * (my xmin + my xmax), factor);
autoSound thee = Sound_Point_Pitch_Duration_to_Sound (sound.peek(), pulses.peek(), pitchTier.peek(), duration.peek(), 1.5 / fmin);
return thee.transfer();
} catch (MelderError) {
Melder_throw (me, ": not lengthened.");
}
}
Sound Sound_deepenBandModulation (Sound me, double enhancement_dB,
double flow, double fhigh, double slowModulation, double fastModulation, double bandSmoothing)
{
try {
autoSound thee = Data_copy (me);
double maximumFactor = pow (10, enhancement_dB / 20), alpha = sqrt (log (2.0));
double alphaslow = alpha / slowModulation, alphafast = alpha / fastModulation;
for (long channel = 1; channel <= my ny; channel ++) {
autoSound channelSound = Sound_extractChannel (me, channel);
autoSpectrum orgspec = Sound_to_Spectrum (channelSound.peek(), TRUE);
/*
* Keep the part of the sound that is outside the filter bank.
*/
autoSpectrum spec = Data_copy (orgspec.peek());
Spectrum_stopHannBand (spec.peek(), flow, fhigh, bandSmoothing);
autoSound filtered = Spectrum_to_Sound (spec.peek());
long n = thy nx;
double *amp = thy z [channel];
for (long i = 1; i <= n; i ++) amp [i] = filtered -> z [1] [i];
autoMelderProgress progress (L"Deepen band modulation...");
double fmin = flow;
while (fmin < fhigh) {
/*
* Take a one-bark frequency band.
*/
double fmid_bark = NUMhertzToBark (fmin) + 0.5, ceiling;
double fmax = NUMbarkToHertz (NUMhertzToBark (fmin) + 1);
if (fmax > fhigh) fmax = fhigh;
Melder_progress (fmin / fhigh, L"Band: ", Melder_fixed (fmin, 0), L" ... ", Melder_fixed (fmax, 0), L" Hz");
NUMmatrix_copyElements (orgspec -> z, spec -> z, 1, 2, 1, spec -> nx);
Spectrum_passHannBand (spec.peek(), fmin, fmax, bandSmoothing);
autoSound band = Spectrum_to_Sound (spec.peek());
/*
* Compute a relative intensity contour.
*/
autoSound intensity = Data_copy (band.peek());
n = intensity -> nx;
amp = intensity -> z [1];
for (long i = 1; i <= n; i ++) amp [i] = 10 * log10 (amp [i] * amp [i] + 1e-6);
autoSpectrum intensityFilter = Sound_to_Spectrum (intensity.peek(), TRUE);
n = intensityFilter -> nx;
for (long i = 1; i <= n; i ++) {
double frequency = intensityFilter -> x1 + (i - 1) * intensityFilter -> dx;
double slow = alphaslow * frequency, fast = alphafast * frequency;
double factor = exp (- fast * fast) - exp (- slow * slow);
intensityFilter -> z [1] [i] *= factor;
intensityFilter -> z [2] [i] *= factor;
}
intensity.reset (Spectrum_to_Sound (intensityFilter.peek()));
n = intensity -> nx;
amp = intensity -> z [1];
for (long i = 1; i <= n; i ++) amp [i] = pow (10, amp [i] / 2);
/*
* Clip to maximum enhancement.
*/
ceiling = 1 + (maximumFactor - 1.0) * (0.5 - 0.5 * cos (NUMpi * fmid_bark / 13));
for (long i = 1; i <= n; i ++) amp [i] = 1 / (1 / amp [i] + 1 / ceiling);
n = thy nx;
amp = thy z [channel];
for (long i = 1; i <= n; i ++) amp [i] += band -> z [1] [i] * intensity -> z [1] [i];
fmin = fmax;
}
}
Vector_scale (thee.peek(), 0.99);
/* Truncate. */
thy xmin = my xmin;
thy xmax = my xmax;
thy nx = my nx;
thy x1 = my x1;
return thee.transfer();
} catch (MelderError) {
Melder_throw (me, ": band modulation not deepened.");
}
}
/* End of file Sound_enhance.cpp */
|
lgpl-3.0
|
Frankie-PellesC/fSDK
|
Lib/src/Uuid/X64/imapi2uuid00000041.c
|
460
|
// Created file "Lib\src\Uuid\X64\imapi2uuid"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(IID_IFileSystemImage2, 0xd7644b2c, 0x1537, 0x4767, 0xb6, 0x2f, 0xf1, 0x38, 0x7b, 0x02, 0xdd, 0xfd);
|
lgpl-3.0
|
erelsgl/erel-sites
|
tnk1/dmut/dmut/1316.html
|
4089
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' lang='he' dir='rtl'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1255' />
<meta http-equiv='Content-Script-Type' content='text/javascript' />
<meta http-equiv='revisit-after' content='15 days' />
<link rel='stylesheet' href='../../../_script/klli.css' />
<link rel='stylesheet' href='../../_themes/klli.css' />
<title>ãøéåù</title>
<meta name='author' content="àøàì" />
<meta name='receiver' content="" />
<meta name='jmQovc' content="tnk1/dmut/dmut/1316" />
<meta name='tvnit' content="tnk_dmut" />
<meta name='description' lang='he' content="ãøéåù" />
<meta name='description' lang='en' content="this page is in Hebrew" />
<meta name='keywords' lang='he' content="ãøéåù,ãøéåù" />
</head><body class="dmwt"><div class="pnim">
<script type='text/javascript' src='../../../_script/vars.js'></script>
<!--NiwutElyon0-->
<div class="NiwutElyon">
<div class="NiwutElyon"><a href='../../index.html'>øàùé</a>><a href='../../dmut/index.html'>ãîåéåú úðëéåú</a>><a href='../../dmut/ToknLfiDmutHkl.html'>ëì äãîåéåú</a>></div>
</div>
<!--NiwutElyon1-->
<h1 id='h1'>ãøéåù</h1>
<div style='display:none'>
<p>îàú: àøàì
<p>÷åã: ãøéåù
</div>
<script type='text/javascript'>kotrt()</script>
<!--tosft0--><div id='tosft'>
<p>
<ol>
<li>çâé à 1: áùðú ùúéí ìãøéåù äîìê áçãù äùùé áéåí àçã ìçãù äéä ãáø ä' áéã çâé äðáéà àì æøááì áï ùàìúéàì ôçú éäåãä åàì éäåùò áï éäåöã÷ äëäï äâãåì ìàîø.
<li>æëøéä à 1: áçãù äùîéðé áùðú ùúéí ìãøéåù äéä ãáø ä' àì æëøéä áï áøëéä áï òãå äðáéà ìàîø.
<li>ãðéàì è 1: áùðú àçú ìãøéåù áï àçùåøåù îæøò îãé àùø äîìê òì îìëåú ëùãéí </ol>
<p>
<q class="psuq">àá: </q>
<a href='1318.html'>àçùåøåù </a>
</div><!--tosft--><!--tosft1-->
<ul id='ulbnim' style='display:none'>
<li>îàîø: <a href='../../ktuv/dniel/dn-06-ivrit.html' class="mamr">ãðéàì å - úøâåí ìòáøéú<small> / òîåñ -> àðöé÷ìåôãéú òåìí äúðê</small></a>
<li><a href='../../../tnk1/kma/qjrim1/driws_mdy.html'>ãøéåù äîãé <small>/ àøàì</small></a> <span class='date'>[× ××ª× ×-19:16:59 12.12.2020]</span></li>
<li><a href='../../../tnk1/ktuv/dniel/dn-06-29.html'>îìëåú ãøéåù åîìëåú ëåøù <small>/ àøàì</small></a> <span class='date'>[× ××ª× ×-20:06:11 12.12.2020]</span></li>
<li><a href='../../../tnk1/ktuv/dniel/dn-09-01.html'>ãøéåù áï àçùåøåù <small>/ àøàì</small></a> <span class='date'>[× ××ª× ×-20:21:10 12.12.2020]</span></li>
<li><a href='../../../tnk1/ktuv/dniel/dn-11-01.html'>îàá÷ äîìàëéí áéîé ãøéåù äîãé <small>/ àøàì</small></a> <span class='date'>[× ××ª× ×-21:23:03 12.12.2020]</span></li>
</ul><!--end-->
<script type='text/javascript'>
var theBnim = document.getElementById('ulbnim');
var theBnimArray = theBnim.innerHTML.split(/<li>/i);
var theWrittenBnim = new Array(theBnimArray.length);
</script>
<div class='awsp_mpwrt'>
<div class="noseim">
<script type='text/javascript'>ktov_bnim('<h2>ñôøéí</h2> <ol class="TableSublists"> ', 'ñôø:', ' </ol> ')</script>
<script type='text/javascript'>ktov_bnim('<h2>ðåùàéí</h2> <ol class="TableSublists"> ', 'àåñó:', ' </ol> ')</script>
</div>
<script type='text/javascript'>ktov_bnim('<div class="omnutiim"> <h2>îàîøéí ãîéåðééí åàîðåúééí</h2> <ol class="TableSublists"> ', '(îàîø ãîéåðé|ñéôåø|ùéø|öéåø):', ' </ol> </div>')</script>
<script type='text/javascript'>ktov_bnim('<div class="jelot"> <h2>ùàìåú åîàîøéí ìà âîåøéí</h2> <ol class="TableSublists"> ', '(îàîø ìà âîåø|îàîø ùìà ôåøñí|ùàìä):', ' </ol> </div>')</script>
<script type='text/javascript'>ktov_bnim('<div class="mamrim"> <h2>îàîøéí</h2> <ol class="TableSublists"> ', '(àúø|äáãìéí|îàîø|îáðä|îöâú|÷åáõ|ëìì|äâãøä):', ' </ol> </div>')</script>
</div>
<br style='clear:all'>
<h2 id='tguvot'>úåñôåú åúâåáåú</h2>
<ul class="tablesublists">
<script type='text/javascript'>ktov_bnim_axrim()</script>
</ul>
<script type='text/javascript'>tguva(); txtit()</script>
</div><!--pnim-->
</body></html>
|
lgpl-3.0
|
lenovor/quickml
|
src/main/java/quickml/supervised/classifier/twoStageModel/TwoStageModelBuilder.java
|
2871
|
package quickml.supervised.classifier.twoStageModel;
import com.google.common.collect.Lists;
import quickml.data.AttributesMap;
import quickml.data.ClassifierInstance;
import quickml.supervised.PredictiveModelBuilder;
import quickml.supervised.classifier.Classifier;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Created by alexanderhawk on 10/7/14.
*/
public class TwoStageModelBuilder implements PredictiveModelBuilder<TwoStageClassifier, ClassifierInstance> {
PredictiveModelBuilder< ? extends Classifier, ClassifierInstance> wrappedModelBuilder1;
PredictiveModelBuilder<? extends Classifier, ClassifierInstance> wrappedModelBuilder2;
public TwoStageModelBuilder(PredictiveModelBuilder< ? extends Classifier, ClassifierInstance> wrappedModelBuilder1,
PredictiveModelBuilder<? extends Classifier, ClassifierInstance> wrappedModelBuilder2) {
this.wrappedModelBuilder1 = wrappedModelBuilder1;
this.wrappedModelBuilder2 = wrappedModelBuilder2;
}
@Override
public TwoStageClassifier buildPredictiveModel(Iterable<ClassifierInstance> trainingData) {
List<ClassifierInstance> stage1Data = Lists.newArrayList();
List<ClassifierInstance> stage2Data = Lists.newArrayList();
List<ClassifierInstance> validationData = Lists.newArrayList();
for (ClassifierInstance instance : trainingData) {
if (instance.getLabel().equals("positive-both")) {
stage1Data.add(new ClassifierInstance(instance.getAttributes(), 1.0));
stage2Data.add(new ClassifierInstance(instance.getAttributes(), 1.0));
validationData.add(new ClassifierInstance(instance.getAttributes(), 1.0));
} else if (instance.getLabel().equals("positive-first")) {
stage1Data.add(new ClassifierInstance(instance.getAttributes(), 1.0));
stage2Data.add(new ClassifierInstance(instance.getAttributes(), 0.0));
validationData.add(new ClassifierInstance(instance.getAttributes(), 0.0));
} else if (instance.getLabel().equals("negative")) {
stage1Data.add(new ClassifierInstance(instance.getAttributes(), 0.0));
validationData.add(new ClassifierInstance(instance.getAttributes(), 0.0));
} else {
throw new RuntimeException("missing valid label");
}
}
Classifier c1 = wrappedModelBuilder1.buildPredictiveModel(stage1Data);
Classifier c2 = wrappedModelBuilder2.buildPredictiveModel(stage2Data);
return new TwoStageClassifier(c1, c2);
}
@Override
public void updateBuilderConfig(Map<String, Serializable> config) {
wrappedModelBuilder1.updateBuilderConfig(config);
wrappedModelBuilder2.updateBuilderConfig(config);
}
}
|
lgpl-3.0
|
xeonvs/globalsat-sporttracks-plugin
|
Device/GhPacketBase.cs
|
14491
|
/*
Copyright (C) 2010 Zone Five Software
This library 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.
This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
*/
// Author: Aaron Averill
using System;
using System.Collections.Generic;
using System.Text;
namespace ZoneFiveSoftware.SportTracks.Device.Globalsat
{
public class GhPacketBase
{
//Public properties - Mostly response, send handles PacketData
public byte CommandId;
public Int16 PacketLength;
//PacketData contains the usefuldata, not everything to send
public byte[] PacketData;
//Only used when receiving - sending is only included in the sent data
//Not stored now
//public byte Checksum;
public void InitPacket(byte CommandId, Int16 PacketLength)
{
this.CommandId = CommandId;
this.PacketLength = PacketLength;
this.PacketData = new byte[PacketLength];
for (int i = 0; i < this.PacketData.Length; i++ )
{
this.PacketData[i] = 0;
}
}
//The Gloabalsat specs does not explicitly write that the format is same for all
public const byte CommandWhoAmI = 0xBF;
public const byte CommandGetSystemInformation = 0x85;
public const byte CommandGetSystemConfiguration = 0x86;
public const byte CommandSetSystemConfiguration = 0x96;
public const byte CommandSetSystemInformation = 0x98;
public const byte CommandGetScreenshot = 0x83;
public const byte CommandGetWaypoints = 0x77;
public const byte CommandSendWaypoint = 0x76;
public const byte CommandDeleteWaypoints = 0x75;
public const byte CommandSendRoute = 0x93;
public const byte CommandDeleteAllRoutes = 0x97;
public const byte CommandGetTrackFileHeaders = 0x78;
public const byte CommandGetTrackFileSections = 0x80;
public const byte CommandGetNextTrackSection = 0x81;
//public const byte CommandReGetLastSection = 0x82;
public const byte CommandId_FINISH = 0x8A;
public const byte CommandSendTrackStart = 0x90;
public const byte CommandSendTrackSection = 0x91;
public const byte CommandDeleteTracks = 0x79;
//505, 580, 625XT, determines info in the trackpackets at TrainHeaderCTypeOffset
public const byte HeaderTypeLaps = 0xAA;
public const byte HeaderTypeTrackPoints = 0x55;
//Certain appearing responses, likely more exists
public const byte ResponseInsuficientMemory = 0x95;
public const byte ResponseResendTrackSection = 0x92;
public const byte ResponseSendTrackFinish = 0x9A;
public class Header
{
public DateTime StartTime;
public Int32 TrackPointCount; //Int16 in all but 625XT
public TimeSpan TotalTime;
public Int32 TotalDistanceMeters;
public Int16 LapCount; //Not used in all
}
public class Train : Header
{
//public Int16 StartPointIndex=0;
//public Int16 EndPointIndex=0;
//public bool Multisport;
public Int16 TotalCalories = 0;
public double MaximumSpeed = 0;
public byte MaximumHeartRate = 0;
public byte AverageHeartRate = 0;
public Int16 TotalAscend = 0;
public Int16 TotalDescend = 0;
//public Int16 MinimumAltitude;
//public Int16 MaximumAltitude;
public Int16 AverageCadence = 0;
public Int16 MaximumCadence = 0;
public Int16 AveragePower = 0;
public Int16 MaximumPower = 0;
//byte Sport1;
//byte Sport2;
//byte Sport3;
//byte Sport4;
//byte Sport5;
//public Int16 AverageTemperature; //GB580P
//public Int16 MaximumTemperature;
//public Int16 MaximumTemperature;
public IList<TrackPoint> TrackPoints = new List<TrackPoint>();
public IList<Lap> Laps = new List<Lap>();
//data related to the import, for instance if start date is changed
public string Comment = "";
}
public class TrackFileHeader : Header
{
public Int32 TrackPointIndex;
}
public class Lap
{
public TimeSpan EndTime;
public TimeSpan LapTime;
public Int32 LapDistanceMeters;
public Int16 LapCalories;
public double MaximumSpeed; //Int16 for some devices
public byte MaximumHeartRate;
public byte AverageHeartRate;
public Int16 MinimumAltitude;
public Int16 MaximumAltitude;
public Int16 AverageCadence;
public Int16 MaximumCadence;
public Int16 AveragePower;
public Int16 MaximumPower;
//public bool Multisport;
//public Int16 AverageTemperature; //GB580P
//public Int16 MaximumTemperature;
//public Int16 MaximumTemperature;
// public Int16 StartPointIndex;
// public Int16 EndPointIndex;
}
//Superset of all trackpoints
public class TrackPoint
{
//Same in all
public double Latitude; //4bit, Degrees * 1000000
public double Longitude; //4bit, Degrees * 1000000
//Int32 in GB580, Int16 in GH625XT, GH505, GH625, GH615
public Int32 Altitude; // Meters
//Int32 in GH625XT, Int16 in GB580, GH505, GH625, GH615
public double Speed=0; //4bit, Kilometers per hour * 100
public Byte HeartRate=0;
//Int32 in GH625XT, GB580, GH505, Int16 in GH625, GH615
public double IntervalTime=0; // Seconds * 10
//Int16 in GH625XT, GB580, GH505, (but not available?)
public Int16 Power=0; // Power, unknown units
//Int16 in GH625XT, GB580 (but not available, unknown use)
public Int16 PowerCadence=0; // unknown units
//Int16 in GH625XT, GB580, GH505, (but not available?)
public Int16 Cadence=0; // Cadence, RPM - revolutions per minute
public Int16 Temperature=0x7fff; //GB580P
}
public byte[] ConstructPayload(bool bigEndianPacketLength)
{
byte[] data = new byte[5 + this.PacketLength];
data[0] = 0x02;
//Add CommandId to length, always big endian
//Write(true, data, 1, (Int16)(this.PacketLength + 1));
byte[] b = BitConverter.GetBytes((Int16)(this.PacketLength + 1));
if (bigEndianPacketLength)
{
data[1] = b[1];
data[2] = b[0];
}
else
{
//Only for the 561
data[1] = b[0];
data[2] = b[1];
}
data[3] = this.CommandId;
for (int i = 0; i < this.PacketLength; i++)
{
data[4 + i] = this.PacketData[i];
}
data[this.PacketLength + 4] = GetCrc(false);
return data;
}
private byte GetCrc(bool received)
{
byte checksum = 0;
int len = this.PacketLength;
if (!received)
{
//For sent packets, include the packetid
len++;
}
byte[] b = BitConverter.GetBytes(len);
checksum ^= b[0];
checksum ^= b[1];
if (!received)
{
checksum ^= this.CommandId;
}
for (int i = 0; i < this.PacketLength; i++)
{
checksum ^= this.PacketData[i];
}
return checksum;
}
public bool ValidResponseCrc(byte checksum)
{
return (GetCrc(true) == checksum);
}
/// <summary>
/// Read a six byte representation of a date and time starting at the offset in the following format:
/// Year = 2000 + byte[0]
/// Month = byte[1]
/// Day = byte[2]
/// Hour = byte[3]
/// Minute = byte[4]
/// Second = byte[5]
/// </summary>
protected DateTime ReadDateTime(int offset)
{
return new DateTime(PacketData[offset + 0] + 2000, PacketData[offset + 1], PacketData[offset + 2], PacketData[offset + 3], PacketData[offset + 4], PacketData[offset + 5]);
}
protected int Write(int offset, DateTime t)
{
int year = (int)Math.Max(0, t.Year - 2000);
this.PacketData[offset+0] = (byte)year;
this.PacketData[offset+1] = (byte)t.Month;
this.PacketData[offset+2] = (byte)t.Day;
this.PacketData[offset+3] = (byte)t.Hour;
this.PacketData[offset+4] = (byte)t.Minute;
this.PacketData[offset+5] = (byte)t.Second;
return 6;
}
/// <summary>
/// Read a string starting at the offset.
/// </summary>
public string ByteArr2String(int startIndex, int length)
{
for (int i = startIndex; i < Math.Min(startIndex + length, PacketData.Length); i++)
{
if (PacketData[i] == 0x0)
{
length = i - startIndex;
break;
}
}
string str = UTF8Encoding.UTF8.GetString(PacketData, startIndex, length);
return str;
}
public int Write(int startIndex, int length, string s)
{
for (int j = 0; j < length; j++)
{
byte c = (byte)(j < s.Length ? s[j] : '\0');
this.PacketData[startIndex + j] = c;
}
//Ensure null termination
this.PacketData[startIndex + length - 1] = 0;
return length;
}
/// <summary>
/// Read a two byte integer starting at the offset.
/// </summary>
protected Int16 ReadInt16(int offset)
{
if (!IsLittleEndian)
{
return (Int16)((this.PacketData[offset] << 8) + this.PacketData[offset + 1]);
}
else
{
return BitConverter.ToInt16(this.PacketData, offset);
}
}
/// <summary>
/// Read a four byte integer starting at the offset.
/// </summary>
protected Int32 ReadInt32(int offset)
{
if (!IsLittleEndian)
{
return (this.PacketData[offset] << 24) + (this.PacketData[offset + 1] << 16) + (this.PacketData[offset + 2] << 8) + this.PacketData[offset + 3];
}
else
{
return BitConverter.ToInt32(this.PacketData, offset);
}
}
protected double ReadLatLon(int offset)
{
return ReadInt32(offset) / 1000000.0;
}
//Some static methods for standard field formats
static public Int32 ToGlobLatLon(double latlon)
{
return (int)Math.Round(latlon * 1000000);
}
static public Int16 ToGlobSpeed(double speed)
{
return (Int16)Math.Round(speed * 100 * 3.6);
}
static public double FromGlobSpeed(int speed)
{
return speed / 100.0 / 3.6;
}
static public Int32 ToGlobTime(double time)
{
return (Int32)Math.Round(time * 10);
}
static public Int16 ToGlobTime16(double time)
{
return (Int16)ToGlobTime(time);
}
static public double FromGlobTime(int time)
{
return time/10.0;
}
/// <summary>
/// Write a two byte integer starting at the offset.
/// </summary>
protected int Write(int offset, Int16 i)
{
return Write(offset, i, this.IsLittleEndian);
}
protected int Write(int offset, Int16 i, bool isLittleEndian)
{
byte[] b = BitConverter.GetBytes(i);
if (!isLittleEndian)
{
this.PacketData[offset + 0] = b[1];
this.PacketData[offset + 1] = b[0];
}
else
{
this.PacketData[offset + 0] = b[0];
this.PacketData[offset + 1] = b[1];
}
return 2;
}
/// <summary>
/// Write a four byte integer in little-endian format starting at the offset.
/// </summary>
//No overload to make sure correct
protected int Write32(int offset, Int32 i)
{
byte[] b = BitConverter.GetBytes(i);
if (!IsLittleEndian)
{
this.PacketData[offset + 0] = b[3];
this.PacketData[offset + 1] = b[2];
this.PacketData[offset + 2] = b[1];
this.PacketData[offset + 3] = b[0];
}
else
{
this.PacketData[offset + 0] = b[0];
this.PacketData[offset + 1] = b[1];
this.PacketData[offset + 2] = b[2];
this.PacketData[offset + 3] = b[3];
}
return 4;
}
//Note: The assumption is that the platform is LittleEndian
protected virtual bool IsLittleEndian { get { return false; } }
}
}
|
lgpl-3.0
|
HappyFaceIndustries/Kopernicus
|
Kopernicus/Configuration/Parser/Exceptions/ParserTargetMissingException.cs
|
1776
|
/**
* Kopernicus Planetary System Modifier
* ====================================
* Created by: - Bryce C Schroeder (bryce.schroeder@gmail.com)
* - Nathaniel R. Lewis (linux.robotdude@gmail.com)
*
* Maintained by: - Thomas P.
* - NathanKell
*
* Additional Content by: Gravitasi, aftokino, KCreator, Padishar, Kragrathea, OvenProofMars, zengei, MrHappyFace
* -------------------------------------------------------------
* This library 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 (at your option) any later version.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*
* This library is intended to be used as a plugin for Kerbal Space Program
* which is copyright 2011-2014 Squad. Your usage of Kerbal Space Program
* itself is governed by the terms of its EULA, not the license above.
*
* https://kerbalspaceprogram.com
*/
using System;
namespace Kopernicus
{
namespace Configuration
{
/**
* Exception representing a missing field
**/
public class ParserTargetMissingException : Exception
{
public ParserTargetMissingException (string message) : base(message) { }
}
}
}
|
lgpl-3.0
|
RWTH-OS/ostfriesentee-examples
|
app/benchmark/java/com/ihp/CalculationInLoop.java
|
611
|
/**
*
*/
package com.ihp;
/**
* @author Michael Maaser
*
*/
public class CalculationInLoop implements BenchmarkImplementation {
/* (non-Javadoc)
* @see com.ihp.TestImplementation#runTest(int)
*/
public void runTest(int times) {
for (;times>0;times--){
int a = 1;
for (int i = 1; i < 70; i++) {
a*=i;
}
}
}
/* (non-Javadoc)
* @see com.ihp.TestImplementation#getName()
*/
public String getName() {
return "Calculation 69! in a loop";
}
// public static void main(String[] args) {
// BenchmarkImplementation test = new CalculationInLoop();
// test.runTest(1);
// }
}
|
lgpl-3.0
|
stefan-baur/jesadido-poc
|
src/main/java/org/jesadido/poc/core/semantics/translating/en/EnTransletors.java
|
3102
|
/*
* jesadido-poc
* Copyright (C) 2016 Stefan K. Baur
*
* Licensed under the GNU Lesser General Public License, Version 3.0 (LGPL-3.0)
* https://www.gnu.org/licenses/lgpl-3.0.txt
*/
package org.jesadido.poc.core.semantics.translating.en;
import java.util.Arrays;
import java.util.LinkedList;
import org.jesadido.poc.core.semantics.translating.TranslationResult;
import org.jesadido.poc.core.semantics.translating.TransletParameters;
import org.jesadido.poc.core.semantics.translating.Transletor;
import org.jesadido.poc.core.syntax.tokens.TokenType;
public final class EnTransletors {
private static final Transletor NOMINAL_TRANSLETOR = new Transletor()
.add(Arrays.asList(TokenType.SUBSTANTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getIndefinite(r.getTranslator(), p.getConcept(0), new LinkedList<>())))
.add(Arrays.asList(TokenType.SUBSTANTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getIndefinite(r.getTranslator(), p.getConcept(0), p.getConcepts().subList(1, 2))))
.add(Arrays.asList(TokenType.SUBSTANTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getIndefinite(r.getTranslator(), p.getConcept(0), p.getConcepts().subList(1, 3))))
.add(Arrays.asList(TokenType.SUBSTANTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getIndefinite(r.getTranslator(), p.getConcept(0), p.getConcepts().subList(1, 4))))
.add(Arrays.asList(TokenType.ARTICLE, TokenType.SUBSTANTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getDefinite(r.getTranslator(), p.getConcept(0), p.getConcept(1), new LinkedList<>())))
.add(Arrays.asList(TokenType.ARTICLE, TokenType.SUBSTANTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getDefinite(r.getTranslator(), p.getConcept(0), p.getConcept(1), p.getConcepts().subList(2, 3))))
.add(Arrays.asList(TokenType.ARTICLE, TokenType.SUBSTANTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getDefinite(r.getTranslator(), p.getConcept(0), p.getConcept(1), p.getConcepts().subList(2, 4))))
.add(Arrays.asList(TokenType.ARTICLE, TokenType.SUBSTANTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR, TokenType.ADJECTIVE_SINGULAR), (TranslationResult r, TransletParameters p) -> r.setTranslation(EnUtils.getDefinite(r.getTranslator(), p.getConcept(0), p.getConcept(1), p.getConcepts().subList(2, 5))))
;
private EnTransletors() {
// A private utility class constructor
}
public static Transletor getNominalTransletor() {
return NOMINAL_TRANSLETOR;
}
}
|
lgpl-3.0
|
HydroCouple/hydrocouple.github.io
|
hydrocoupledocs/html/d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.js
|
2993
|
var class_hydro_couple_1_1_spatial_1_1_i_raster =
[
[ "RasterDataType", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57", [
[ "Unknown", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a6b6a05fc6ca4f23a7946b2a71e6745a2", null ],
[ "Byte", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a153211909d8759eba4752fc8f3251ca2", null ],
[ "UInt16", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a266985b8569588028028a205c37798a4", null ],
[ "Int16", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a733049b137b5d4312a2b1f4a8dbf3e14", null ],
[ "UInt32", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a525c93df497c1cc30532a19e0ed566d2", null ],
[ "Int32", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a9ba52e58957de9cccbfc1dd39c09b303", null ],
[ "Float32", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a652f7cca2f5d1895bd4313fd6bad9562", null ],
[ "Float64", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a7f8c473bcbc860a342fe2fb15d2b9203", null ],
[ "CInt16", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57ac7cccfaf04621a83331493abe221d107", null ],
[ "CInt32", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a8db4ee278f075285ddc0423411c5d6b1", null ],
[ "CFloat32", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a2bc275cf234741f12a6fbe02bfb7798c", null ],
[ "CFloat64", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a5c2b567403b2a5dea831822adc20c91e", null ]
] ],
[ "~IRaster", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#a13282336b47f8feab0b58deb7d62e524", null ],
[ "addRasterBand", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ad62fe6aa4649f4b58cb28ebc50cd53e9", null ],
[ "geoTransformation", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#a0f918dd8435650934c15042844ec3045", null ],
[ "getRasterBand", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#a2fb7cee15d778f6b2a7c608355ee1031", null ],
[ "rasterBandCount", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ab2e66474205ae38839014c875a804373", null ],
[ "spatialReferenceSystem", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#a57978d6397548c02e566d735386eff80", null ],
[ "xSize", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#a230349770291b0b61459a72c357b9adc", null ],
[ "ySize", "d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#a0e7ea53d6a681f0ac66f52c4d32632c1", null ]
];
|
lgpl-3.0
|
consumentor/Server
|
trunk/tools/ASP.NET MVC 2/trunk/src/MvcFutures/Mvc/Resources/MultiFormatActionResult.cs
|
1935
|
namespace Microsoft.Web.Mvc.Resources {
using System.Globalization;
using System.Net;
using System.Net.Mime;
using System.Web;
using System.Web.Mvc;
using Microsoft.Web.Resources;
/// <summary>
/// Returns the response in the format specified by the request. By default, supports returning the model
/// as a HTML view, XML and JSON.
/// If the response format requested is not supported, then the NotAcceptable status code is returned
/// </summary>
public class MultiFormatActionResult : ActionResult {
object model;
ContentType responseFormat;
HttpStatusCode statusCode;
public MultiFormatActionResult(object model, ContentType responseFormat)
: this(model, responseFormat, HttpStatusCode.OK) {
}
public MultiFormatActionResult(object model, ContentType responseFormat, HttpStatusCode statusCode) {
this.model = model;
this.responseFormat = responseFormat;
this.statusCode = statusCode;
}
public override void ExecuteResult(ControllerContext context) {
if (!TryExecuteResult(context, this.model, this.responseFormat)) {
throw new HttpException((int)HttpStatusCode.NotAcceptable, string.Format(CultureInfo.CurrentCulture, MvcResources.Resources_UnsupportedFormat, this.responseFormat));
}
}
public virtual bool TryExecuteResult(ControllerContext context, object model, ContentType responseFormat) {
if (!FormatManager.Current.CanSerialize(responseFormat)) {
return false;
}
context.HttpContext.Response.ClearContent();
context.HttpContext.Response.StatusCode = (int)this.statusCode;
FormatManager.Current.Serialize(context, model, responseFormat);
return true;
}
}
}
|
lgpl-3.0
|
didascalie-net/span
|
readme.md
|
957
|
# SPAN - Spaces And Nodes
## Environnement for real time media control and organisation
## Project Data Management Software
The SPAN project is designed around a JSON file with :
* namespace organisation and discovery
* highly customisable API
* multi-maping with multi-modes
* event/cues management
Even if this first (alpha) version is designed to work with Max 6 from Cycling74, this might be implemented in more environnements.
## Startup :
* Add this package to Applications/Max/packages or add the path to your packages.txt file.
* Add the span abstraction to your Max patch. You can then start to work with it.
## Change Log :
* Version 0.1: First release is planned to early 2014
# Licence
## Credits :
* *Written by Tom Mays & Renaud Rubiano - (2012-2013)*
* *Produced by didascalie.net*
* *Based on some parts of tapemovie (2006-2012)*
* *span uses [shell] max external, made by Jeremy Bernstein*
|
lgpl-3.0
|
pedrotgn/pyactor
|
examples/initparams.py
|
539
|
from pyactor.context import set_context, create_host, sleep, shutdown,\
serve_forever
class Someclass(object):
_tell = {'show_things'}
def __init__(self, op, thing):
self.things = [op, thing]
def show_things(self):
print(self.things)
if __name__ == '__main__':
set_context()
h = create_host()
params = ["hi", "you"]
# kparams = {"op":"hi", "thing":"you"}
# t = h.spawn('t', Someclass, *params)
t = h.spawn('t', Someclass, *["hi", "you"])
t.show_things()
shutdown()
|
lgpl-3.0
|
yangjiandong/appjruby
|
app-batch/src/main/java/org/sonar/batch/Batch.java
|
4700
|
/*
* Sonar, open source software quality management tool.
* Copyright (C) 2009 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* Sonar 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 (at your option) any later version.
*
* Sonar 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 Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
package org.sonar.batch;
import org.apache.commons.configuration.Configuration;
import org.picocontainer.Characteristics;
import org.picocontainer.MutablePicoContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.Plugins;
import org.sonar.api.resources.Project;
import org.sonar.api.utils.HttpDownloader;
import org.sonar.api.utils.IocContainer;
import org.sonar.api.utils.ServerHttpClient;
import org.sonar.batch.indexer.DefaultSonarIndex;
import org.sonar.core.plugin.JpaPluginDao;
import org.sonar.jpa.session.DatabaseSessionProvider;
import org.sonar.jpa.session.DriverDatabaseConnector;
import org.sonar.jpa.session.ThreadLocalDatabaseSessionFactory;
import java.net.URLClassLoader;
public class Batch {
private static final Logger LOG = LoggerFactory.getLogger(Batch.class);
private Configuration configuration;
private Object[] components;
public Batch(Configuration configuration, Object... components) {
this.configuration = configuration;
this.components = components;
}
public void execute() {
MutablePicoContainer container = null;
try {
container = buildPicoContainer();
container.start();
analyzeProjects(container);
} finally {
if (container != null) {
container.stop();
}
}
}
private void analyzeProjects(MutablePicoContainer container) {
// a child container is built to ensure database connector is up
MutablePicoContainer batchContainer = container.makeChildContainer();
batchContainer.as(Characteristics.CACHE).addComponent(ServerMetadata.class);
batchContainer.as(Characteristics.CACHE).addComponent(ProjectTree.class);
batchContainer.as(Characteristics.CACHE).addComponent(DefaultResourceCreationLock.class);
batchContainer.as(Characteristics.CACHE).addComponent(DefaultSonarIndex.class);
batchContainer.as(Characteristics.CACHE).addComponent(JpaPluginDao.class);
batchContainer.as(Characteristics.CACHE).addComponent(BatchPluginRepository.class);
batchContainer.as(Characteristics.CACHE).addComponent(Plugins.class);
batchContainer.as(Characteristics.CACHE).addComponent(ServerHttpClient.class);
batchContainer.as(Characteristics.CACHE).addComponent(HttpDownloader.class);
batchContainer.start();
ProjectTree projectTree = batchContainer.getComponent(ProjectTree.class);
DefaultSonarIndex index = batchContainer.getComponent(DefaultSonarIndex.class);
analyzeProject(batchContainer, index, projectTree.getRootProject());
// batchContainer is stopped by its parent
}
private MutablePicoContainer buildPicoContainer() {
MutablePicoContainer container = IocContainer.buildPicoContainer();
register(container, configuration);
URLClassLoader fullClassloader = RemoteClassLoader.createForJdbcDriver(configuration).getClassLoader();
// set as the current context classloader for hibernate, else it does not find the JDBC driver.
Thread.currentThread().setContextClassLoader(fullClassloader);
register(container, new DriverDatabaseConnector(configuration, fullClassloader));
register(container, ThreadLocalDatabaseSessionFactory.class);
container.as(Characteristics.CACHE).addAdapter(new DatabaseSessionProvider());
for (Object component : components) {
register(container, component);
}
return container;
}
private void register(MutablePicoContainer container, Object component) {
container.as(Characteristics.CACHE).addComponent(component);
}
private void analyzeProject(MutablePicoContainer container, DefaultSonarIndex index, Project project) {
for (Project module : project.getModules()) {
analyzeProject(container, index, module);
}
LOG.info("------------- Analyzing " + project.getName());
new ProjectBatch(container).execute(index, project);
}
}
|
lgpl-3.0
|
Frankie-PellesC/fSDK
|
Lib/src/ehstorguids/guids000000A2.c
|
466
|
// Created file "Lib\src\ehstorguids\guids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(WPD_CONTENT_TYPE_GENERIC_FILE, 0x0085e0a6, 0x8d34, 0x45d7, 0xbc, 0x5c, 0x44, 0x7e, 0x59, 0xc7, 0x3d, 0x48);
|
lgpl-3.0
|
Frankie-PellesC/fSDK
|
Lib/src/Uuid/guids0000002C.c
|
459
|
// Created file "Lib\src\Uuid\guids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(GUID_SLEEPBUTTON_ACTION_FLAGS, 0x2a160ab1, 0xb69d, 0x4743, 0xb7, 0x18, 0xbf, 0x14, 0x41, 0xd5, 0xe4, 0x93);
|
lgpl-3.0
|
solaimanjdn/framework
|
Signum.React/node_modules/@types/react-router/README.md
|
809
|
# Installation
> `npm install --save @types/react-router`
# Summary
This package contains type definitions for react-router (https://github.com/rackt/react-router).
# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/react-router
Additional Details
* Last updated: Fri, 27 Jan 2017 22:02:16 GMT
* Dependencies: history, react
* Global values: ReactRouter
# Credits
These definitions were written by Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>, Alex Wendland <https://github.com/awendland>, Kostya Esmukov <https://github.com/KostyaEsmukov>, John Reilly <https://github.com/johnnyreilly>.
|
lgpl-3.0
|
sparth9/Java-Aggregator
|
target/apidocs/net/sf/jagg/class-use/StdDevPopAggregator.html
|
6315
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_25) on Sun Mar 30 14:18:12 CDT 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class net.sf.jagg.StdDevPopAggregator (jagg-core 0.7.3-SNAPSHOT API)</title>
<meta name="date" content="2014-03-30">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class net.sf.jagg.StdDevPopAggregator (jagg-core 0.7.3-SNAPSHOT API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../net/sf/jagg/StdDevPopAggregator.html" title="class in net.sf.jagg">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?net/sf/jagg/class-use/StdDevPopAggregator.html" target="_top">Frames</a></li>
<li><a href="StdDevPopAggregator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class net.sf.jagg.StdDevPopAggregator" class="title">Uses of Class<br>net.sf.jagg.StdDevPopAggregator</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../net/sf/jagg/StdDevPopAggregator.html" title="class in net.sf.jagg">StdDevPopAggregator</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#net.sf.jagg">net.sf.jagg</a></td>
<td class="colLast">
<div class="block">Provides the classes and API necessary to perform aggregate operations.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="net.sf.jagg">
<!-- -->
</a>
<h3>Uses of <a href="../../../../net/sf/jagg/StdDevPopAggregator.html" title="class in net.sf.jagg">StdDevPopAggregator</a> in <a href="../../../../net/sf/jagg/package-summary.html">net.sf.jagg</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../net/sf/jagg/package-summary.html">net.sf.jagg</a> that return <a href="../../../../net/sf/jagg/StdDevPopAggregator.html" title="class in net.sf.jagg">StdDevPopAggregator</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../net/sf/jagg/StdDevPopAggregator.html" title="class in net.sf.jagg">StdDevPopAggregator</a></code></td>
<td class="colLast"><span class="strong">StdDevPopAggregator.</span><code><strong><a href="../../../../net/sf/jagg/StdDevPopAggregator.html#replicate()">replicate</a></strong>()</code>
<div class="block">Returns an uninitialized copy of this <code>Aggregator</code> object,
with the same property(ies) to analyze.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../net/sf/jagg/StdDevPopAggregator.html" title="class in net.sf.jagg">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?net/sf/jagg/class-use/StdDevPopAggregator.html" target="_top">Frames</a></li>
<li><a href="StdDevPopAggregator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2010–2014 jAgg Team. All rights reserved.</small></p>
</body>
</html>
|
lgpl-3.0
|
CrimsonDev14/crimsoncoin
|
doc/release-notes/release-notes-0.6.2.md
|
1725
|
crimson version 0.6.2 is now available for download at:
http://sourceforge.net/projects/crimson/files/crimson/crimson-0.6.2/
This is a bug-fix and code-cleanup release, with no major new features.
Please report bugs using the github issue tracker at:
https://github.com/crimson/crimson/issues
NOTABLE CHANGES
Much faster shutdowns. However, the blkindex.dat file is no longer
portable to different data directories by default. If you need a
portable blkindex.dat file then run with the new -detachdb=1 option
or the "Detach databases at shutdown" GUI preference.
Fixed https://github.com/crimson/crimson/issues/1065, a bug that
could cause long-running nodes to crash.
Mac and Windows binaries are compiled against OpenSSL 1.0.1b (Linux
binaries are dynamically linked to the version of OpenSSL on the system).
CHANGE SUMMARY
Use 'git shortlog --no-merges v0.6.0..' for a summary of this release.
Source codebase changes:
- Many source code cleanups and warnings fixes. Close to building with -Wall
- Locking overhaul, and several minor locking fixes
- Several source code portability fixes, e.g. FreeBSD
JSON-RPC interface changes:
- addmultisigaddress enabled for mainnet (previously only enabled for testnet)
Network protocol changes:
- protocol version 60001
- added nonce value to "ping" message (BIP 31)
- added new "pong" message (BIP 31)
Backend storage changes:
- Less redundant database flushing, especially during initial block download
- Shutdown improvements (see above)
Qt user interface:
- minor URI handling improvements
- progressbar improvements
- error handling improvements (show message box rather than console exception,
etc.)
- by popular request, make 4th bar of connection icon green
|
lgpl-3.0
|
Poesys-Associates/poesys-db
|
poesys-db/src/com/poesys/db/dao/delete/AbstractDeleteSql.java
|
2290
|
/*
* Copyright (c) 2008, 2011 Poesys Associates. All rights reserved.
*
* This file is part of Poesys-DB.
*
* Poesys-DB is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* Poesys-DB 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* Poesys-DB. If not, see <http://www.gnu.org/licenses/>.
*/
package com.poesys.db.dao.delete;
import java.sql.PreparedStatement;
import com.poesys.db.dto.IDbDto;
import com.poesys.db.pk.IPrimaryKey;
/**
* SQL statement specification for deleting a standard object. The concrete
* subclass contains the SQL statement and an implementation of
* <code>IDeleteSql.getSql()</code> that calls the <code>getSql</code> method in
* this class:
*
* <pre>
* public class DeleteTestSql extends AbstractDeleteSql {
*
* private static final String SQL = "DELETE FROM Test WHERE ";
*
* public String getSql(IPrimaryKey key) {
* return super.getSql(key, SQL);
* }
* }
* </pre>
*
* @author Robert J. Muller
* @param <T> the DTO type
*/
public abstract class AbstractDeleteSql<T extends IDbDto> implements
IDeleteSql<T> {
/**
* A helper method that takes the SQL from the caller (usually a concrete
* subclass of this class) and builds a complete SQL statement by adding the
* key to the WHERE clause
*
* @param key the primary key to add to the WHERE clause
* @param sql the SQL statement
* @return a complete SQL statement
*/
public String getSql(IPrimaryKey key, String sql) {
StringBuilder builder = new StringBuilder(sql);
builder.append(key.getSqlWhereExpression(""));
return builder.toString();
}
@Override
public <P extends IDbDto> int setParams(PreparedStatement stmt, int next,
P dto) {
next = dto.getPrimaryKey().setParams(stmt, next);
return next;
}
}
|
lgpl-3.0
|
SBird1337/source_of_the_sovereign
|
src/specials/camera_move.h
|
2001
|
/****************************************************************************
* Copyright (C) 2015-2016 by the SotS Team *
* *
* This file is part of Sovereign of the Skies. *
* *
* Sovereign of the Skies 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 *
* (at your option) any later version provided you include a copy of the *
* licence and this header. *
* *
* Sovereign of the Skies 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 Sovereign of the Skies. *
* If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************/
/**
* @file camera_move.h
* @author Sturmvogel
* @date 15 dec 2016
* @brief Scene to update the camera
*
* This provides prototypes to move the game camera
*/
#ifndef CAMERA_MOVE_H_
#define CAMERA_MOVE_H_
/* === PROTOTYPES === */
/**
* @brief move camera to position specified in CAMERA_VAR_X and CAMERA_VAR_Y
*/
void cam_sp_move_camera();
#endif
|
lgpl-3.0
|
Alfresco/gytheio
|
gytheio-commons/src/test/java/org/gytheio/content/handler/DelegatingContentHandlerImplTest.java
|
9751
|
/*
* Copyright (C) 2005-2019 Alfresco Software Limited.
*
* This file is part of Gytheio
*
* Gytheio 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
* (at your option) any later version.
*
* Gytheio 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 Gytheio. If not, see <http://www.gnu.org/licenses/>.
*/
package org.gytheio.content.handler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import org.gytheio.content.ContentIOException;
import org.gytheio.content.ContentReference;
import org.gytheio.content.file.FileProvider;
import org.gytheio.content.file.FileProviderImpl;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class DelegatingContentHandlerImplTest
{
private ContentReferenceHandler handlerA;
private ContentReferenceHandler handlerB;
private FileContentReferenceHandler delegatingHandler;
private ContentReference contentReferenceFile1a;
private ContentReference contentReferenceFile1b;
private ContentReference contentReferenceFile1c;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() throws Exception
{
FileProvider fileProviderA = new FileProviderImpl("content-handler-a");
handlerA = new MockFileContentReferenceHandlerImpl("content-handler-a");
((FileContentReferenceHandlerImpl) handlerA).setFileProvider(fileProviderA);
FileProvider fileProviderB = new FileProviderImpl("content-handler-b");
handlerB = new MockFileContentReferenceHandlerImpl("content-handler-b");
((FileContentReferenceHandlerImpl) handlerB).setFileProvider(fileProviderB);
ArrayList<ContentReferenceHandler> delegates = new ArrayList<ContentReferenceHandler>();
delegates.add(handlerA);
delegates.add(handlerB);
delegatingHandler = new DelegatingContentHandlerImpl();
((DelegatingContentHandlerImpl) delegatingHandler).setDelegates(delegates);
contentReferenceFile1a = getTextReference("/content-handler-a/file-a-1.txt");
contentReferenceFile1b = getTextReference("/content-handler-b/file-b-1.txt");
contentReferenceFile1c = getTextReference("/content-handler-c/file-c-1.txt");
}
private ContentReference getTextReference(String testPath) throws URISyntaxException
{
return getContentReference(testPath, "text/plain");
}
private ContentReference getContentReference(String testPath, String mediaType) throws URISyntaxException
{
return new ContentReference(this.getClass().getResource(testPath).toURI().toString(), mediaType);
}
@Test
public void testIsAvailable()
{
assertTrue(delegatingHandler.isAvailable());
((FileContentReferenceHandlerImpl) handlerA).setFileProvider(null);
assertFalse(delegatingHandler.isAvailable());
}
@Test
public void testIsContentReferenceSupported()
{
assertTrue(delegatingHandler.isContentReferenceSupported(contentReferenceFile1a));
assertTrue(delegatingHandler.isContentReferenceSupported(contentReferenceFile1b));
assertFalse(delegatingHandler.isContentReferenceSupported(contentReferenceFile1c));
}
@Test
public void testIsContentReferenceExists()
{
assertTrue(delegatingHandler.isContentReferenceExists(contentReferenceFile1a));
assertTrue(delegatingHandler.isContentReferenceExists(contentReferenceFile1b));
thrown.expect(UnsupportedOperationException.class);
delegatingHandler.isContentReferenceExists(contentReferenceFile1c);
}
@Test
public void testCreateContentReference()
{
thrown.expect(UnsupportedOperationException.class);
delegatingHandler.createContentReference("testCreate.txt", "text/plain");
}
@Test
public void testGetFile() throws Exception
{
File sourceFile = delegatingHandler.getFile(contentReferenceFile1a, false);
assertTrue(sourceFile.exists());
}
@Test
public void testNonFileDelegate() throws Exception
{
MockEmptyContentReferenceHandlerImpl handlerC = new MockEmptyContentReferenceHandlerImpl();
ArrayList<ContentReferenceHandler> delegates = new ArrayList<ContentReferenceHandler>();
delegates.add(handlerA);
delegates.add(handlerB);
delegates.add(handlerC);
ContentReference contentReference = new ContentReference("mock://empty.txt", "text/plain");
thrown.expect(UnsupportedOperationException.class);
delegatingHandler.getFile(contentReference, false);
}
@Test
public void testGetInputStream() throws Exception
{
InputStream sourceInputStream = delegatingHandler.getInputStream(contentReferenceFile1a, false);
assertEquals(15, sourceInputStream.available());
}
@Test
public void testPutFile() throws Exception
{
File sourceFile = new File(this.getClass().getResource(
"/content-handler-a/file-a-1.txt").toURI());
String targetFolder = "/content-handler-a";
ContentReference targetContentReference = getTextReference(targetFolder);
targetContentReference.setUri(targetContentReference.getUri() + "/file-a-3.txt");
delegatingHandler.putFile(sourceFile, targetContentReference);
File targetFile = new File(new URI(targetContentReference.getUri()));
assertTrue(targetFile.exists());
}
@Test
public void testPutInputStream() throws Exception
{
InputStream sourceInputStream = (this.getClass().getResourceAsStream(
"/content-handler-a/file-a-1.txt"));
String targetFolder = "/content-handler-a";
ContentReference targetContentReference = getTextReference(targetFolder);
targetContentReference.setUri(targetContentReference.getUri() + "/file-a-4.txt");
delegatingHandler.putInputStream(sourceInputStream, targetContentReference);
File targetFile = new File(new URI(targetContentReference.getUri()));
assertTrue(targetFile.exists());
}
@Test
public void testDelete() throws Exception
{
File sourceFile = new File(this.getClass().getResource(
"/content-handler-b/file-b-1.txt").toURI());
ContentReference targetContentReferenceToDelete = getTextReference("/content-handler-b");
targetContentReferenceToDelete.setUri(targetContentReferenceToDelete.getUri() + "/file-b-3.txt");
delegatingHandler.putFile(sourceFile, targetContentReferenceToDelete);
File fileToDelete = new File(new URI(targetContentReferenceToDelete.getUri()));
assertTrue(fileToDelete.exists());
delegatingHandler.delete(targetContentReferenceToDelete);
assertFalse(fileToDelete.exists());
}
/**
* Test class that allows checking for specific paths
*/
public class MockFileContentReferenceHandlerImpl extends FileContentReferenceHandlerImpl
{
private String supportedUriPath;
public MockFileContentReferenceHandlerImpl(String supportedUriPath)
{
this.supportedUriPath = supportedUriPath;
}
@Override
public boolean isContentReferenceSupported(ContentReference contentReference)
{
if (contentReference == null)
{
return false;
}
return contentReference.getUri().contains(supportedUriPath);
}
}
/**
* Test class for non-file content references
*/
public class MockEmptyContentReferenceHandlerImpl implements ContentReferenceHandler
{
@Override
public boolean isContentReferenceSupported(ContentReference contentReference)
{
return contentReference.getUri().startsWith("mock:/");
}
@Override
public boolean isContentReferenceExists(ContentReference contentReference)
{
return true;
}
@Override
public ContentReference createContentReference(String fileName, String mediaType) throws ContentIOException
{
return null;
}
@Override
public InputStream getInputStream(ContentReference contentReference, boolean waitForAvailability)
throws ContentIOException, InterruptedException
{
return null;
}
@Override
public long putInputStream(InputStream sourceInputStream, ContentReference targetContentReference)
throws ContentIOException
{
return 0;
}
@Override
public long putFile(File sourceFile, ContentReference targetContentReference) throws ContentIOException
{
return 0;
}
@Override
public void delete(ContentReference contentReference) throws ContentIOException
{
}
@Override
public boolean isAvailable()
{
return true;
}
}
}
|
lgpl-3.0
|
MeteoSwiss-APN/omni-compiler
|
tests/xcalablemp/local-view/coarray/F/MIX/this_image3.f90
|
1053
|
PROGRAM zzz
!$xmp nodes p(8)
!$xmp nodes q(2,2)=p(4:7)
integer s1[*], a1(10,20)[*], a2(10,20)[2,*], a3(10,20)[3,*]
!! integer t1[*], b1(10,20)[*], b2(10,20)[2,*], b3(10,20)[3,*]
!$xmp coarray on p :: s1,a1,a2,a3
!!!$xmp coarray on q :: t1,b1,b2,b3
s1=0
a1=0
a2=0
a3=0
nerr=0
me=this_image()
ni=num_images()
!$xmp task on q(1,:)
me1=this_image()
ni1=num_images()
if (me1==1) then
if (me/=4) then
nerr=nerr+1
write(*,200) me,4,me1
endif
else if (me1==2) then
if (me/=6) then
nerr=nerr+1
write(*,200) me,6,me1
endif
else
nerr=nerr+1
write(*,210) me
endif
!$xmp end task
200 format("[",i0,"] me1 should be ",i0," but ",i0)
210 format("[",i0,"] illegal run in task on q(1,:)")
if (nerr==0) then
write(*,100) me
else
write(*,110) me, nerr
end if
100 format("[",i0,"] OK")
110 format("[",i0,"] NG nerr=",i0)
END PROGRAM zzz
|
lgpl-3.0
|
ars22/WorkflowScheduling
|
lib/encog-core-3.3.0/apidocs/org/encog/ml/genetic/class-use/GeneticError.html
|
4287
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.6.0_30) on Sat Oct 11 22:51:34 UTC 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.encog.ml.genetic.GeneticError (Encog Core 3.3.0 API)</title>
<meta name="date" content="2014-10-11">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.encog.ml.genetic.GeneticError (Encog Core 3.3.0 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/encog/ml/genetic/GeneticError.html" title="class in org.encog.ml.genetic">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/encog/ml/genetic//class-useGeneticError.html" target="_top">FRAMES</a></li>
<li><a href="GeneticError.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.encog.ml.genetic.GeneticError" class="title">Uses of Class<br>org.encog.ml.genetic.GeneticError</h2>
</div>
<div class="classUseContainer">No usage of org.encog.ml.genetic.GeneticError</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/encog/ml/genetic/GeneticError.html" title="class in org.encog.ml.genetic">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/encog/ml/genetic//class-useGeneticError.html" target="_top">FRAMES</a></li>
<li><a href="GeneticError.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2014. All Rights Reserved.</small></p>
</body>
</html>
|
lgpl-3.0
|
benothman/jboss-web-nio2
|
java/org/apache/el/parser/AstFalse.java
|
1350
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/* Generated By:JJTree: Do not edit this line. AstFalse.java */
package org.apache.el.parser;
import javax.el.ELException;
import org.apache.el.lang.EvaluationContext;
/**
* @author Jacob Hookom [jacob@hookom.net]
* @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: remy.maucherat@jboss.com $
*/
public final class AstFalse extends BooleanNode {
public AstFalse(int id) {
super(id);
}
public Object getValue(EvaluationContext ctx)
throws ELException {
return Boolean.FALSE;
}
}
|
lgpl-3.0
|
YACOWS/PyNFe
|
pynfe/utils/__init__.py
|
4553
|
# *-* encoding: utf-8 *-*
import os
import codecs
import unicodedata
try:
from lxml import etree
except ImportError:
try:
# Python 2.5 - cElementTree
import xml.etree.cElementTree as etree
except ImportError:
try:
# Python 2.5 - ElementTree
import xml.etree.ElementTree as etree
except ImportError:
try:
# Instalacao normal do cElementTree
import cElementTree as etree
except ImportError:
try:
# Instalacao normal do ElementTree
import elementtree.ElementTree as etree
except ImportError:
raise Exception('Falhou ao importar lxml/ElementTree')
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import flags
# from geraldo.utils import memoize
# @memoize
def so_numeros(texto):
"""Retorna o texto informado mas somente os numeros"""
return ''.join(filter(lambda c: ord(c) in range(48, 58), texto))
# @memoize
def obter_pais_por_codigo(codigo):
# TODO
if codigo == '1058':
return 'Brasil'
CAMINHO_DATA = os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..', 'data')
CAMINHO_MUNICIPIOS = os.path.join(CAMINHO_DATA, 'MunIBGE')
CARACTERS_ACENTUADOS = {
ord(u'á'): u'a',
ord(u'â'): u'a',
ord(u'à'): u'a',
ord(u'ã'): u'a',
ord(u'é'): u'e',
ord(u'ê'): u'e',
ord(u'í'): u'i',
ord(u'ó'): u'o',
ord(u'õ'): u'o',
ord(u'ô'): u'o',
ord(u'ú'): u'u',
ord(u'ç'): u'c',
}
# @memoize
def normalizar_municipio(municipio):
if not isinstance(municipio, unicode):
municipio = municipio.decode('utf-8')
return municipio.lower().translate(CARACTERS_ACENTUADOS).upper()
# @memoize
def carregar_arquivo_municipios(uf, reverso=False):
if isinstance(uf, basestring):
try:
uf = int(uf)
except ValueError:
uf = flags.CODIGOS_ESTADOS[uf.upper()]
caminho_arquivo = os.path.join(CAMINHO_MUNICIPIOS, 'MunIBGE-UF%s.txt' % uf)
# Carrega o conteudo do arquivo
fp = codecs.open(caminho_arquivo, "r", "utf-8-sig")
linhas = list(fp.readlines())
fp.close()
municipios_dict = {}
for linha in linhas:
codigo, municipio = linha.split('\t')
codigo = codigo.strip()
municipio = municipio.strip()
if not reverso:
municipios_dict[codigo] = municipio
else:
municipios_dict[normalizar_municipio(municipio)] = codigo
return municipios_dict
# @memoize
def obter_codigo_por_municipio(municipio, uf):
# TODO: fazer UF ser opcional
municipios = carregar_arquivo_municipios(uf, True)
return municipios[normalizar_municipio(municipio)]
# @memoize
def obter_municipio_por_codigo(codigo, uf, normalizado=False):
# TODO: fazer UF ser opcional
municipios = carregar_arquivo_municipios(uf)
municipio = municipios.get(unicode(codigo))
if municipio is None:
raise ValueError
if normalizado:
return normalizar_municipio(municipio)
return municipio
# @memoize
def obter_municipio_e_codigo(dados, uf):
'''Retorna código e município
municipio_ou_codigo - espera receber um dicionário no formato:
{codigo: 121212, municipio: u'municipio'}
'''
cod = dados.get('codigo', '')
mun = normalizar_municipio(dados.get('municipio', ''))
try:
cod = int(cod)
except ValueError:
cod = obter_codigo_por_municipio(mun, uf)
# TODO: se ainda com este teste apresentar erros de nessa seção
# desenvolver um retorno que informe ao cliente quais nfes estão com erro
# e não explodir esse a geração das outras nfes
municipio = obter_municipio_por_codigo(cod, uf, normalizado=True)
return cod, municipio
# @memoize
def extrair_tag(root):
return root.tag.split('}')[-1]
def formatar_decimal(dec):
if dec * 100 - int(dec * 100):
return str(dec)
else:
return "%.2f" % dec
def safe_str(str_):
if not isinstance(str_, unicode):
if isinstance(str_, str):
str_ = str_.decode('utf8')
else:
str_ = unicode(str_)
return unicodedata.normalize('NFKD', str_).encode('ascii', 'ignore')
def obter_uf_por_codigo(codigo_uf):
if isinstance(codigo_uf, basestring) and codigo_uf.isalpha():
return codigo_uf
estados = {v: k for k, v in flags.CODIGOS_ESTADOS.items()}
return estados[unicode(codigo_uf)]
|
lgpl-3.0
|
shurizzle/Scroto
|
HookManager/Hooker.Constants.cs
|
7936
|
using System;
namespace HookManager
{
public static partial class Hooker
{
public enum WM : uint
{
NULL = 0x0000,
CREATE = 0x0001,
DESTROY = 0x0002,
MOVE = 0x0003,
SIZE = 0x0005,
ACTIVATE = 0x0006,
SETFOCUS = 0x0007,
KILLFOCUS = 0x0008,
ENABLE = 0x000A,
SETREDRAW = 0x000B,
SETTEXT = 0x000C,
GETTEXT = 0x000D,
GETTEXTLENGTH = 0x000E,
PAINT = 0x000F,
CLOSE = 0x0010,
QUERYENDSESSION = 0x0011,
QUERYOPEN = 0x0013,
ENDSESSION = 0x0016,
QUIT = 0x0012,
ERASEBKGND = 0x0014,
SYSCOLORCHANGE = 0x0015,
SHOWWINDOW = 0x0018,
WININICHANGE = 0x001A,
SETTINGCHANGE = WININICHANGE,
DEVMODECHANGE = 0x001B,
ACTIVATEAPP = 0x001C,
FONTCHANGE = 0x001D,
TIMECHANGE = 0x001E,
CANCELMODE = 0x001F,
SETCURSOR = 0x0020,
MOUSEACTIVATE = 0x0021,
CHILDACTIVATE = 0x0022,
QUEUESYNC = 0x0023,
GETMINMAXINFO = 0x0024,
PAINTICON = 0x0026,
ICONERASEBKGND = 0x0027,
NEXTDLGCTL = 0x0028,
SPOOLERSTATUS = 0x002A,
DRAWITEM = 0x002B,
MEASUREITEM = 0x002C,
DELETEITEM = 0x002D,
VKEYTOITEM = 0x002E,
CHARTOITEM = 0x002F,
SETFONT = 0x0030,
GETFONT = 0x0031,
SETHOTKEY = 0x0032,
GETHOTKEY = 0x0033,
QUERYDRAGICON = 0x0037,
COMPAREITEM = 0x0039,
GETOBJECT = 0x003D,
COMPACTING = 0x0041,
[Obsolete]
COMMNOTIFY = 0x0044,
WINDOWPOSCHANGING = 0x0046,
WINDOWPOSCHANGED = 0x0047,
[Obsolete]
POWER = 0x0048,
COPYDATA = 0x004A,
CANCELJOURNAL = 0x004B,
NOTIFY = 0x004E,
INPUTLANGCHANGEREQUEST = 0x0050,
INPUTLANGCHANGE = 0x0051,
TCARD = 0x0052,
HELP = 0x0053,
USERCHANGED = 0x0054,
NOTIFYFORMAT = 0x0055,
CONTEXTMENU = 0x007B,
STYLECHANGING = 0x007C,
STYLECHANGED = 0x007D,
DISPLAYCHANGE = 0x007E,
GETICON = 0x007F,
SETICON = 0x0080,
NCCREATE = 0x0081,
NCDESTROY = 0x0082,
NCCALCSIZE = 0x0083,
NCHITTEST = 0x0084,
NCPAINT = 0x0085,
NCACTIVATE = 0x0086,
GETDLGCODE = 0x0087,
SYNCPAINT = 0x0088,
NCMOUSEMOVE = 0x00A0,
NCLBUTTONDOWN = 0x00A1,
NCLBUTTONUP = 0x00A2,
NCLBUTTONDBLCLK = 0x00A3,
NCRBUTTONDOWN = 0x00A4,
NCRBUTTONUP = 0x00A5,
NCRBUTTONDBLCLK = 0x00A6,
NCMBUTTONDOWN = 0x00A7,
NCMBUTTONUP = 0x00A8,
NCMBUTTONDBLCLK = 0x00A9,
NCXBUTTONDOWN = 0x00AB,
NCXBUTTONUP = 0x00AC,
NCXBUTTONDBLCLK = 0x00AD,
INPUT_DEVICE_CHANGE = 0x00FE,
INPUT = 0x00FF,
KEYFIRST = 0x0100,
KEYDOWN = 0x0100,
KEYUP = 0x0101,
CHAR = 0x0102,
DEADCHAR = 0x0103,
SYSKEYDOWN = 0x0104,
SYSKEYUP = 0x0105,
SYSCHAR = 0x0106,
SYSDEADCHAR = 0x0107,
UNICHAR = 0x0109,
KEYLAST = 0x0109,
IME_STARTCOMPOSITION = 0x010D,
IME_ENDCOMPOSITION = 0x010E,
IME_COMPOSITION = 0x010F,
IME_KEYLAST = 0x010F,
INITDIALOG = 0x0110,
COMMAND = 0x0111,
SYSCOMMAND = 0x0112,
TIMER = 0x0113,
HSCROLL = 0x0114,
VSCROLL = 0x0115,
INITMENU = 0x0116,
INITMENUPOPUP = 0x0117,
MENUSELECT = 0x011F,
MENUCHAR = 0x0120,
ENTERIDLE = 0x0121,
MENURBUTTONUP = 0x0122,
MENUDRAG = 0x0123,
MENUGETOBJECT = 0x0124,
UNINITMENUPOPUP = 0x0125,
MENUCOMMAND = 0x0126,
CHANGEUISTATE = 0x0127,
UPDATEUISTATE = 0x0128,
QUERYUISTATE = 0x0129,
CTLCOLORMSGBOX = 0x0132,
CTLCOLOREDIT = 0x0133,
CTLCOLORLISTBOX = 0x0134,
CTLCOLORBTN = 0x0135,
CTLCOLORDLG = 0x0136,
CTLCOLORSCROLLBAR = 0x0137,
CTLCOLORSTATIC = 0x0138,
MOUSEFIRST = 0x0200,
MOUSEMOVE = 0x0200,
LBUTTONDOWN = 0x0201,
LBUTTONUP = 0x0202,
LBUTTONDBLCLK = 0x0203,
RBUTTONDOWN = 0x0204,
RBUTTONUP = 0x0205,
RBUTTONDBLCLK = 0x0206,
MBUTTONDOWN = 0x0207,
MBUTTONUP = 0x0208,
MBUTTONDBLCLK = 0x0209,
MOUSEWHEEL = 0x020A,
XBUTTONDOWN = 0x020B,
XBUTTONUP = 0x020C,
XBUTTONDBLCLK = 0x020D,
MOUSEHWHEEL = 0x020E,
MOUSELAST = 0x020E,
PARENTNOTIFY = 0x0210,
ENTERMENULOOP = 0x0211,
EXITMENULOOP = 0x0212,
NEXTMENU = 0x0213,
SIZING = 0x0214,
CAPTURECHANGED = 0x0215,
MOVING = 0x0216,
POWERBROADCAST = 0x0218,
DEVICECHANGE = 0x0219,
MDICREATE = 0x0220,
MDIDESTROY = 0x0221,
MDIACTIVATE = 0x0222,
MDIRESTORE = 0x0223,
MDINEXT = 0x0224,
MDIMAXIMIZE = 0x0225,
MDITILE = 0x0226,
MDICASCADE = 0x0227,
MDIICONARRANGE = 0x0228,
MDIGETACTIVE = 0x0229,
MDISETMENU = 0x0230,
ENTERSIZEMOVE = 0x0231,
EXITSIZEMOVE = 0x0232,
DROPFILES = 0x0233,
MDIREFRESHMENU = 0x0234,
IME_SETCONTEXT = 0x0281,
IME_NOTIFY = 0x0282,
IME_CONTROL = 0x0283,
IME_COMPOSITIONFULL = 0x0284,
IME_SELECT = 0x0285,
IME_CHAR = 0x0286,
IME_REQUEST = 0x0288,
IME_KEYDOWN = 0x0290,
IME_KEYUP = 0x0291,
MOUSEHOVER = 0x02A1,
MOUSELEAVE = 0x02A3,
NCMOUSEHOVER = 0x02A0,
NCMOUSELEAVE = 0x02A2,
WTSSESSION_CHANGE = 0x02B1,
TABLET_FIRST = 0x02c0,
TABLET_LAST = 0x02df,
CUT = 0x0300,
COPY = 0x0301,
PASTE = 0x0302,
CLEAR = 0x0303,
UNDO = 0x0304,
RENDERFORMAT = 0x0305,
RENDERALLFORMATS = 0x0306,
DESTROYCLIPBOARD = 0x0307,
DRAWCLIPBOARD = 0x0308,
PAINTCLIPBOARD = 0x0309,
VSCROLLCLIPBOARD = 0x030A,
SIZECLIPBOARD = 0x030B,
ASKCBFORMATNAME = 0x030C,
CHANGECBCHAIN = 0x030D,
HSCROLLCLIPBOARD = 0x030E,
QUERYNEWPALETTE = 0x030F,
PALETTEISCHANGING = 0x0310,
PALETTECHANGED = 0x0311,
HOTKEY = 0x0312,
PRINT = 0x0317,
PRINTCLIENT = 0x0318,
APPCOMMAND = 0x0319,
THEMECHANGED = 0x031A,
CLIPBOARDUPDATE = 0x031D,
DWMCOMPOSITIONCHANGED = 0x031E,
DWMNCRENDERINGCHANGED = 0x031F,
DWMCOLORIZATIONCOLORCHANGED = 0x0320,
DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
GETTITLEBARINFOEX = 0x033F,
HANDHELDFIRST = 0x0358,
HANDHELDLAST = 0x035F,
AFXFIRST = 0x0360,
AFXLAST = 0x037F,
PENWINFIRST = 0x0380,
PENWINLAST = 0x038F,
APP = 0x8000,
USER = 0x0400,
CPL_LAUNCH = USER + 0x1000,
CPL_LAUNCHED = USER + 0x1001,
SYSTIMER = 0x118
}
public enum HookType : int
{
WH_JOURNALRECORD = 0,
WH_JOURNALPLAYBACK = 1,
WH_KEYBOARD = 2,
WH_GETMESSAGE = 3,
WH_CALLWNDPROC = 4,
WH_CBT = 5,
WH_SYSMSGFILTER = 6,
WH_MOUSE = 7,
WH_HARDWARE = 8,
WH_DEBUG = 9,
WH_SHELL = 10,
WH_FOREGROUNDIDLE = 11,
WH_CALLWNDPROCRET = 12,
WH_KEYBOARD_LL = 13,
WH_MOUSE_LL = 14
}
public const int WH_KEYBOARD = 2;
public const int WH_MOUSE = 7;
public const int WH_KEYBOARD_LL = 13;
public const int WH_MOUSE_LL = 14;
public const int VK_SHIFT = 0x10;
public const int VK_CAPITAL = 0x14;
public const int VK_NUMLOCK = 0x90;
public const int WM_KEYDOWN = 0x100;
public const int WM_KEYUP = 0x101;
public const int WM_SYSKEYDOWN = 0x104;
public const int WM_SYSKEYUP = 0x105;
public const int WM_MOUSEMOVE = 0x200;
public const int WM_LBUTTONDOWN = 0x201;
public const int WM_LBUTTONUP = 0x202;
public const int WM_LBUTTONDBLCLK = 0x203;
public const int WM_RBUTTONDOWN = 0x204;
public const int WM_RBUTTONUP = 0x205;
public const int WM_RBUTTONDBLCLK = 0x206;
public const int WM_MBUTTONDOWN = 0x207;
public const int WM_MBUTTONUP = 0x208;
public const int WM_MBUTTONDBLCLK = 0x209;
public const int WM_MOUSEWHEEL = 0x20A;
}
}
|
lgpl-3.0
|
zak-k/cartopy
|
lib/cartopy/tests/crs/test_nearside_perspective.py
|
2158
|
# (C) British Crown Copyright 2016, Met Office
#
# This file is part of cartopy.
#
# cartopy 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
# (at your option) any later version.
#
# cartopy 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 cartopy. If not, see <https://www.gnu.org/licenses/>.
"""
Tests for the NearsidePerspective projection.
"""
from __future__ import (absolute_import, division, print_function)
import unittest
from numpy.testing import assert_almost_equal
from nose.tools import assert_equal
from cartopy.tests.crs.test_geostationary import (GeostationaryTestsMixin,
check_proj4_params)
from cartopy.crs import NearsidePerspective
class TestEquatorialDefault(unittest.TestCase, GeostationaryTestsMixin):
# Check that it behaves just like Geostationary, in the absence of a
# central_latitude parameter.
test_class = NearsidePerspective
expected_proj_name = 'nsper'
class TestOwnSpecifics(unittest.TestCase):
def test_central_latitude(self):
# Check the effect of the added 'central_latitude' key.
geos = NearsidePerspective(central_latitude=53.7)
expected = ['+ellps=WGS84', 'h=35785831', 'lat_0=53.7', 'lon_0=0.0',
'no_defs',
'proj=nsper',
'units=m', 'x_0=0', 'y_0=0']
check_proj4_params(geos, expected)
assert_almost_equal(geos.boundary.bounds,
(-5372584.78443894, -5372584.78443894,
5372584.78443894, 5372584.78443894),
decimal=4)
if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
|
lgpl-3.0
|
mapacheL/extensions
|
Signum.Web.Extensions/Excel/Views/_ViewStart.generated.cs
|
1592
|
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASP
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Signum.Entities;
using Signum.Utilities;
using Signum.Web;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Excel/Views/_ViewStart.cshtml")]
public partial class _Excel_Views__ViewStart_cshtml : System.Web.Mvc.ViewStartPage
{
public _Excel_Views__ViewStart_cshtml()
{
}
public override void Execute()
{
#line 1 "..\..\Excel\Views\_ViewStart.cshtml"
Layout = "~/Views/Shared/_Layout.cshtml";
#line default
#line hidden
}
}
}
#pragma warning restore 1591
|
lgpl-3.0
|
xanview/live555
|
groupsock/include/groupsock_version.hh
|
294
|
// Version information for the "groupsock" library
// Copyright (c) 1996-2018 Live Networks, Inc. All rights reserved.
#ifndef _GROUPSOCK_VERSION_HH
#define _GROUPSOCK_VERSION_HH
#define GROUPSOCK_LIBRARY_VERSION_STRING "2018.08.28"
#define GROUPSOCK_LIBRARY_VERSION_INT 1535414400
#endif
|
lgpl-3.0
|
jonnor/gegl
|
gegl/process/gegl-eval-visitor.c
|
5916
|
/* This file is part of GEGL
*
* GEGL 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 (at your option) any later version.
*
* GEGL 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 GEGL; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2003 Calvin Williamson
*/
#include "config.h"
#include <glib-object.h>
#include <string.h>
#include "gegl.h"
#include "gegl-debug.h"
#include "gegl-types-internal.h"
#include "gegl-eval-visitor.h"
#include "graph/gegl-node.h"
#include "operation/gegl-operation.h"
#include "operation/gegl-operation-context.h"
#include "graph/gegl-pad.h"
#include "graph/gegl-visitable.h"
#include "gegl-instrument.h"
#include "operation/gegl-operation-sink.h"
#include "buffer/gegl-region.h"
static void gegl_eval_visitor_class_init (GeglEvalVisitorClass *klass);
static void gegl_eval_visitor_visit_pad (GeglVisitor *self,
GeglPad *pad);
G_DEFINE_TYPE (GeglEvalVisitor, gegl_eval_visitor, GEGL_TYPE_VISITOR)
static void
gegl_eval_visitor_class_init (GeglEvalVisitorClass *klass)
{
GeglVisitorClass *visitor_class = GEGL_VISITOR_CLASS (klass);
visitor_class->visit_pad = gegl_eval_visitor_visit_pad;
}
static void
gegl_eval_visitor_init (GeglEvalVisitor *self)
{
}
extern long babl_total_usecs;
/* this is the visitor that does the real computations for GEGL */
static void
gegl_eval_visitor_visit_pad (GeglVisitor *self,
GeglPad *pad)
{
GeglNode *node = gegl_pad_get_node (pad);
gpointer context_id = self->context_id;
GeglOperationContext *context = gegl_node_get_context (node, context_id);
GeglOperation *operation = node->operation;
GEGL_VISITOR_CLASS (gegl_eval_visitor_parent_class)->visit_pad (self, pad);
if (gegl_pad_is_output (pad))
{
/* processing only really happens for output pads */
if (context->cached)
{
GEGL_NOTE (GEGL_DEBUG_PROCESS, "Using cache for pad '%s' on \"%s\"", gegl_pad_get_name (pad), gegl_node_get_debug_name (node));
gegl_operation_context_set_object (context,
gegl_pad_get_name (pad),
G_OBJECT (node->cache));
}
else
{
glong time = gegl_ticks ();
glong babl_time = babl_total_usecs;
/* Make the operation do it's actual processing */
GEGL_NOTE (GEGL_DEBUG_PROCESS, "Processing pad '%s' on \"%s\"", gegl_pad_get_name (pad), gegl_node_get_debug_name (node));
gegl_operation_process (operation, context, gegl_pad_get_name (pad),
&context->result_rect);
babl_time = babl_total_usecs - babl_time;
time = gegl_ticks () - time;
gegl_instrument ("process", gegl_node_get_operation (node), time);
gegl_instrument (gegl_node_get_operation (node), "babl", babl_time);
}
}
else if (gegl_pad_is_input (pad))
{
GeglPad *source_pad = gegl_pad_get_connected_to (pad);
/* the work needed to be done on input pads is to set the
* data from the corresponding output pad it is connected to
*/
if (source_pad)
{
GValue value = { 0 };
GParamSpec *prop_spec = gegl_pad_get_param_spec (pad);
GeglNode *source_node = gegl_pad_get_node (source_pad);
GeglOperationContext *source_context = gegl_node_get_context (source_node, context_id);
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec));
gegl_operation_context_get_property (source_context,
gegl_pad_get_name (source_pad),
&value);
if (!g_value_get_object (&value) &&
!g_object_get_data (G_OBJECT (source_node), "graph"))
g_warning ("eval-visitor encountered a NULL buffer passed from: %s.%s-[%p]",
gegl_node_get_debug_name (source_node),
gegl_pad_get_name (source_pad),
g_value_get_object (&value));
gegl_operation_context_set_property (context,
gegl_pad_get_name (pad),
&value);
/* reference counting for this source dropped to zero, freeing up */
if (-- gegl_node_get_context (
gegl_pad_get_node (source_pad), context_id)->refs == 0 &&
g_value_get_object (&value))
{
gegl_operation_context_remove_property (
gegl_node_get_context (
gegl_pad_get_node (source_pad), context_id),
gegl_pad_get_name (source_pad));
}
g_value_unset (&value);
/* processing for sink operations that accepts partial consumption
and thus probably are being processed by the processor from the
this very operation.
*/
if (GEGL_IS_OPERATION_SINK (operation) &&
!gegl_operation_sink_needs_full (operation))
{
GEGL_NOTE (GEGL_DEBUG_PROCESS, "Processing pad '%s' on \"%s\"", gegl_pad_get_name (pad), gegl_node_get_debug_name (node));
gegl_operation_process (operation, context, "output",
&context->result_rect);
}
}
}
}
|
lgpl-3.0
|
tchegito/zildo
|
zeditor/src/zeditor/tools/banque/Foret4.java
|
6694
|
package zeditor.tools.banque;
import java.awt.Point;
import java.util.Arrays;
import zeditor.tools.tiles.Banque;
import zeditor.tools.tiles.GraphChange;
// Foret4 = exteria8 (194 tiles)
public class Foret4 extends Banque {
public Foret4() {
coords = new Point[] {
/* Ruines */
/* Bordures de collines */
// Orange flower
new Point(0, 0), new Point(16, 0), new Point(32, 0), new Point(48, 0),
new Point(0, 16), new Point(16, 16), new Point(32, 16),
new Point(48, 16), new Point(0, 32), new Point(32, 32),
new Point(48, 32), new Point(0, 48), new Point(16, 48),
new Point(32, 48), new Point(48, 48),
/* Sols */
new Point(32, 64), new Point(48, 64), new Point(64, 64),
new Point(32, 80), new Point(64, 48),
/* Grand pilier */
new Point(96, 0), new Point(112, 0), new Point(144, 0),
new Point(192, 0), new Point(96, 16), new Point(112, 16),
new Point(192, 16), new Point(128, 16), new Point(144, 16),
new Point(96, 32), new Point(112, 32), new Point(128, 32),
new Point(144, 32), new Point(96, 48), new Point(112, 48),
new Point(128, 48), new Point(144, 48),
/* Statues */
new Point(0, 64), new Point(16, 64), new Point(0, 80),
new Point(16, 80), new Point(160, 0), new Point(176, 0),
new Point(160, 16), new Point(176, 16), new Point(160, 32),
new Point(176, 32),
/* Maison jaune */
new Point(208, 0), new Point(224, 0), new Point(272, 0),
new Point(208, 16), new Point(224, 16), new Point(240, 16),
new Point(256, 16), new Point(272, 16), new Point(208, 32),
new Point(224, 32), new Point(272, 32), new Point(208, 48),
new Point(224, 48),
/* Déco de palais */
new Point(64, 0), new Point(64, 16), new Point(64, 32),
new Point(80, 0), new Point(80, 16), new Point(80, 32),
new Point(192, 32), new Point(0, 96), new Point(16, 96),
new Point(0, 112), new Point(16, 112), new Point(32, 112),
new Point(48, 112),
/* Forˆt enchant‚e */
/* Sols bosquet */
new Point(240, 80), new Point(240, 96), new Point(240, 112),
/* Bordures forˆt */
new Point(224, 64), new Point(240, 64), new Point(256, 64),
new Point(224, 80), new Point(256, 80), new Point(208, 96),
new Point(272, 96), new Point(208, 112), new Point(224, 112),
new Point(256, 112), new Point(272, 112), new Point(224, 128),
new Point(240, 128), new Point(256, 128),
/* Bas du grand arbre */
new Point(96, 64), new Point(112, 64), new Point(128, 64),
new Point(144, 64), new Point(96, 80), new Point(112, 80),
new Point(128, 80), new Point(144, 80),
/* Petits arbres */
new Point(288, 80), new Point(304, 80), new Point(288, 96),
new Point(304, 96), new Point(272, 48), new Point(288, 48),
new Point(272, 64), new Point(288, 64),
/* Tronc d'arbre tunnel */
new Point(160, 48), new Point(176, 48), new Point(192, 48),
new Point(160, 64), new Point(176, 64), new Point(192, 64),
new Point(160, 80), new Point(176, 80), new Point(192, 80),
new Point(160, 96), new Point(176, 96), new Point(192, 96),
new Point(160, 112), new Point(176, 112), new Point(192, 112),
new Point(160, 128), new Point(176, 128), new Point(192, 128),
new Point(96, 96), new Point(112, 96),
/* Souche creuse */
new Point(128, 96), new Point(144, 96), new Point(128, 112),
new Point(144, 112), new Point(128, 128), new Point(144, 128),
/* Clairière */
/* Feuillage */
new Point(0, 128), new Point(16, 128), new Point(32, 128),
new Point(48, 128), new Point(0, 144), new Point(16, 144),
new Point(32, 144), new Point(48, 144), new Point(0, 160),
new Point(16, 160), new Point(32, 160), new Point(48, 160),
new Point(0, 176), new Point(16, 176), new Point(32, 176),
new Point(64, 128), new Point(80, 128),
new Point(96, 128), new Point(112, 128), new Point(64, 144),
new Point(80, 144), new Point(96, 144), new Point(112, 144),
new Point(64, 160), new Point(80, 160), new Point(96, 160),
new Point(112, 160), new Point(80, 176),
new Point(96, 176), new Point(112, 176),
/* Ombres */
new Point(144, 144), new Point(160, 144), new Point(128, 160),
new Point(144, 160), new Point(176, 160),
new Point(144, 176), new Point(160, 176),
/* Estrade de pierre */
new Point(224, 144), new Point(240, 144), new Point(256, 144),
new Point(208, 144), new Point(208, 160), new Point(224, 160),
new Point(240, 160), new Point(256, 160), new Point(192, 144),
new Point(192, 160), new Point(176, 176), new Point(192, 176),
new Point(208, 176), new Point(224, 176), new Point(240, 176),
new Point(256, 176), new Point(272, 176), new Point(288, 176),
/* Piédestal */
new Point(272, 144), new Point(288, 144), new Point(272, 160),
new Point(288, 160),
/* Close trees */
new Point(304, 0), new Point(304, 16), new Point(304, 32),
new Point(304, 48), new Point(304, 64),
/* Buche creuse */
new Point(208, 112),
/* Wood stairs */
new Point(272, 128),
/* Hole in the ground */
new Point(304, 112),
/* Ill tree */
new Point(0, 304), new Point(16, 304), new Point(32, 304), new Point(48, 304),
new Point(0, 320), new Point(16, 320), new Point(32, 320), new Point(48, 320),
new Point(0, 336), new Point(16, 336), new Point(32, 336), new Point(48, 336),
new Point(0, 352), new Point(16, 352), new Point(32, 352), new Point(48, 352),
// Flowers (215)
new Point(208, 112), new Point(224, 112), new Point(240, 112), // Blue
new Point(208, 128), new Point(224, 128), new Point(240, 128), // Blue pack
new Point(176, 128), new Point(192, 144), new Point(208, 144), // Red flower
// Water mud (224)
new Point(224, 144),
// Higher stump
new Point(144, 176), new Point(160, 176), new Point(144, 192), new Point(160, 192),
// Water mud border
new Point(176, 160), new Point(192, 160),
// Nettle
new Point(160, 48), new Point(176, 48),
// Higher stump top
new Point(144, 208), new Point(160, 208),
// Birch (bouleau) 235
new Point(0, 208), new Point(16, 208), new Point(32, 208), new Point(48, 208),
new Point(0, 224), new Point(16, 224), new Point(32, 224), new Point(48, 224),
new Point(0, 240), new Point(16, 240), new Point(32, 240), new Point(48, 240),
new Point(0, 256), new Point(16, 256), new Point(32, 256), new Point(48, 256),
new Point(0, 272), new Point(16, 272), new Point(32, 272), new Point(48, 272)
};
pkmChanges = Arrays.asList(new GraphChange[] {
new GraphChange("exteria8", 0, 0),
new GraphChange("exteria1", 215, 80),
new GraphChange("exteria1", 235, -80)});
}
}
|
lgpl-3.0
|
freyssin/elmis
|
README.md
|
16038
|
# eLMIS (*eL*ua *M*QTT *I*oT *S*ervice Platform)
A micro-service eLUA / MQTT platform for the IoT World with NodeMCU.
----
## Firmware requirements
**eLMIS** framwework depends on [NodeMCU](https://nodemcu.readthedocs.io/en/master/),
an eLua based firmware for the ESP8266 WiFi SOC from Espressif. In order to use eLMIS
you need somes specific firmware modules. You may build such a firmware from the
[NodeMCU cloud build service](https://nodemcu-build.com).
You need to include the following modules: bit, cjson, cron, dht, file, gpio, i2c,
mqtt, net, node, ow, pwm, rtctime, tmr, u8g, uart, wifi, ws2812.
Many of these modules are only needed for some specific components of the framework,
so you can build a restrained firmware depending of your project.
----
## Base framework
The base framework consists of 2 modules:
* The first one (init.lua) initializes the WiFI network and then launches the framework.
The network credentials (SSID and password) are stored in the config_net.lua file.
* The second one (startup.lua) initializes the MQTT communications and registers all the
requested components. This module use 2 configuration files:
* config_mqtt.lua
* config_dev.lua
#### Firmware requirements
mqtt, net, tmr, wifi.
### Initialisation component: *init.lua*
This component allow to first setup the WiFi connection and then launch the framework.
In order to avoid a PANIC loop it defines a 3 seconds pause that would allow you to
interrupt the sequence by e.g. deleting or renaming init.lua file (see
[NodeMCU init.lua](https://nodemcu.readthedocs.io/en/master/en/upload/#initlua)).
#### Configuration: *config_net.lua*
This configuration file defines the SSID and password needed to connect to your WiFi
network, for example:
```lua
ssid = "xxxxxxxx"
pwd = "xxxxxxxx"
```
### Base component: *startup.lua*
This component initializes the MQTT connection according to the parameters in
config_mqtt.lua configuration file. Next it initializes each component listed in the
config_dev.lua configuration file.
#### Published datas
The component publish a retained messages on the ${data}/${device}/status topic:
* "on" after initialisation
* "off" in case of failure or shutdown (using the will MQTT functionnality).
#### Framework component
Each component *comp* returns a description table with at least an initialisation function
(called by the framework), and a table defining all remote actions.
Each remote action can be remotely invoked by sending a message on the
${ctrl}/${device}/${comp}/${method} topic. For example, the relay component defines
2 remote actions allowing to remotely toggle or blink the relay by sending messages
on ${ctrl/${device}}/relay/toggle or ${ctrl}/${device}/relay/blink topics.
A component can publishes datas on ${data}/${device}/${resource} topics. For example,
a DHT22 component will regularly publish messages on ${data}/dht22/temperature and
${data}/${device}/dht22/humidity topics.
#### Configuration: *config_mqtt.lua*
This file contains the MQTT configuration:
* MQTT URI and credentials.
* The session's options.
* The unique device identifier (also used as MQTT client identifier).
* The topic tree convention.
For example:
```lua
-- Define MQTT URI
mqtt_broker="192.168.1.80"
mqtt_port=1883
-- Define MQTT credentials
mqtt_user=nil
mqtt_password=nil
-- Define session parameters
mqtt_clean=1
-- Define device identifier
deviceID = "nodemcu01"
-- Define the MQTT topics paths for datas and control
data="/dev/data/"..deviceID.."/"
ctrl="/dev/ctrl/"..deviceID.."/"
```
#### Configuration: *config_dev.lua*
This file contains the declaration of a unique global variable devices_list defining
the list of all components to initialize.
For example:
```lua
devices_list = { "device", "firmware", "led", "dht22", "relay" }
```
----
## Build a new module
This section explains how to build a new component using the eLMIS platform.
### X.lua
The X.lua file contains an empty component, you can use it as a canvas. To build
your own component from the X canvas you need:
1. Add the variables and functions needed by the X shield in the related
sections. Pay attention to declare local variables and functions to avoid
collision with declaration in other components.
* If you need to send datas about X resources you may use the publish
function. The first parameter is the name of yourdevice (contained in the
dev local variable), the second parameter is the name of the resource (for
example *temperature* or *humidity* for the DHT22 device), and the last
parameter is the message.
2. Add the initialisation code needed by the X shield in the init_x
functions.
3. Add the [remote actions](#framework-component) in the actions table.
* Declare as *remote actions* each method that you want remotely invoked by
sending a message.
* if the key associated to the method in the *actions* table is m1,
the method will be invoked each time a message will be sent on the
*${ctrl}/${device}/X/m1* topic.
4. Add in the X table each method of the component that you want to use
from the outside. Remote actions don't need to be declared in this table,
from the framework point of view only init method and actions table are
needed.
5. Add the X component in the *devices_list table* of the *config_dev.lua* file.
For example, you can build an Hello component with specification below:
* Send regularly an *hello* message on the "hello" resource.
* Define a *remote actions* "set_hello" allowing to change the *hello* message.
```lua
-- LGPL v3 License (Free Software Foundation)
-- Copyright (C) 2017 ScalAgent Distributed Technologies
-- Hello module
local Hello = {}
local dev, publish
-- Hello shield parameters
-- If period set to 0 datas shall be get explicitly, otherwise the device
-- send data automatically. Set by default to 10s in init_hello.
local period=0
local timer = tmr.create()
local msg = "Hello world"
-- Declare component functions below
local function set_msg(m)
print("set_msg: ".. m)
msg = m
end
local function send_msg()
publish(dev, "hello", msg)
end
local function register(p)
if (p > 0) then
if (p < 1000) then
p = 1000
end
if (period > 0) then
timer:interval(p)
else
timer:register(p, tmr.ALARM_AUTO, send_msg)
timer:start()
end
period = p
else
if (period > 0) then
timer:unregister();
end
period = 0
end
end
local function set_period(m)
p = tonumber(m)
register(p)
end
-- Initialisation function
local function init_hello(d, p)
dev = d
publish = p
-- Add the initialisation of the Hello shield
register(10000)
end
-- Table of functions
local actions = {
["set_hello"] = set_msg,
["set_period"] = set_period,
["say_hello"] = send_msg
}
-- These 2 methods are needed by micro-service framework
Hello.init = init_hello
Hello.actions = actions
-- These methods below are only needed for external use of the X module
Hello.set_msg = set_msg
Hello.set_period = set_period
Hello.send_msg = send_msg
return Hello
```
----
## Extended framework
The components below correspond to extended functionnaly of the platform, for example
giving extra informations about the device or its configuration, or allowing OTA
(Other The Air) configuration or updates.
### device.lua
This component allows to get information about the device and its configuration.
#### Remote actions
* **get_info**: Returns various informations about firmware version, chip and flash
identifiers, it corresponds to a call to the fnction node.info(). The request message
is empty, the reply is sent as a unique message on ${data}/${device}/info topic.
* **get_fsinfo**: Returns informations about the filesystem, it corresponds to a call
to the function file.fsinfo(). The request message is empty, the reply is sent as a
unique message on ${data}/${device}/fsinfo topic.
* **get_heap**: Returns the current heap size, it corresponds to a call to node.heap().
The request message is empty, the reply is sent as a unique message on
${data}/${device}/heap topic.
* **get_flashsize**: Returns the flash chip size in bytes, it corresponds to a call to
the function node.flash_size(). The request message is empty, the reply is sent as a
unique message on ${data}/${device}/info topic.
* **restart**: Asks to restart the device.
#### Published datas
Currently empty.
### firmware.lua
This component allows to control the platorm, currently software updates and restart.
#### Remote actions
* **update**: Atomically updates the requesting LUA file. The basename of file to update
is given in the first line of the message (without ".lua" extension), the next lines of
the message contains the new file content.
* **restart**: Asks to restart the device.
#### Published datas
Currently empty.
#### Software updates
The update is made atomically, a file named *${basename}.tmp* is first created with the content of the message then renamed *${basename}.lua*.
----
## Additionnal components
Each component below corresponds to a device, for example a Wemos shield.
"led" and "hello" components correspond respectively to an actuator and to a
sensor that need no other stuff than Wemos.
### led.lua
This component allows to play with the blue led on Wemos or ESP8266 boards.
#### Remote actions
* **toggle**: change the state of the GPIO2 associated to the blue led on boead. At
initialisation the state is *gpio.HIGH*.
* **blink**: temporarily change during 1 second the state of the GPIO2 associated to
the led. The period of change is defined in milliseconds by the delay local variable.
#### Published datas
Currently empty.
### hello.lua
This component allows to publish an hello message from the board. The message can be
send either explicitly by invoking **say_hello** action or periodically (in observation
mode).
#### Remote actions
* **set_hello**: this method defines the hello message, set to "Hello world' at
starting.
* **set_period**: this method allows to set the observation period and takes as
parameter an integer representing the observation period in milliseconds. If the
resulting period is less than or equal to 0 the observation is disabled.
than 0 the component is in observation mode.
* **say_hello**: this method triggers the publication of the hello message.
#### Published datas
If the component is initialized in observation mode it publishes regularly (see period
local variable, by default 10.000 ms) the *hello* message.
* **hello**: *${data}/${device}/hello/hello*
### sht30.lua
This component correponds to the use of the Wemos SHT30 shield.
Be careful, the Wemos SHT30 shield is not compatible with the relay or WS2812
shields.
#### Remote actions
Currently there are two remote actions defined, one to set the observation period
of sensor, the other to explicitly get the data from the corresponding sensor. At
starting the component is configured in observation mode with a period of 10.000
milliseconds.
* **set_period**: this method allows to set the observation period and takes as
parameter an integer representing the observation period in milliseconds. If the
resulting period is less than or equal to 0 the observation is disabled.
than 0 the component is in observation mode.
* **get_data**: trigger the publication of the sensor's temperature and humidity
datas on the corresponding topics *${data}/${device}/sht30/temperature* and
*${data}/${device}/sht30/humidity*.
#### Published datas
If the component is initialized in observation mode it publishes regularly (see period
local variable, by default 10.000 ms) the sensor's temperature and humidity datas.
* **temperature**: *${data}/${device}/sht30/temperature*
* **humidity**: *${data}/${device}/sht30/humidity*
### dht22.lua
This component correponds to the use of the old Wemos DHT shield based on DHT11
or DHT22.
It should be used as is with a DHT11 or DHT22 shield.
#### Remote actions
Currently there are two remote actions defined, one to set the observation period
of sensor, the other to explicitly get the data from the corresponding sensor. At
starting the component is configured in observation mode with a period of 10.000
milliseconds.
* **set_period**: this method allows to set the observation period and takes as
parameter an integer representing the observation period in milliseconds. If the
resulting period is less than or equal to 0 the observation is disabled.
than 0 the component is in observation mode.
* **get_data**: trigger the publication of the sensor's temperature and humidity
datas on the corresponding topics *${data}/${device}/dht22/temperature* and
*${data}/${device}/dht22/humidity*.
#### Published datas
If the component is initialized in observation mode it publishes regularly (see period
local variable) the sensor's temperature and humidity datas.
* **temperature**: *${data}/${device}/dht22/temperature*
* **humidity**: *${data}/${device}/dht22/humidity*
### dht12.lua
This component correponds to the use of the new Wemos DHT shield based on DHT12.
Be careful, this new Wemos DHT shield is not compatible with the relay or WS2812
shields.
#### Remote actions
Currently there are two remote actions defined, one to set the observation period
of sensor, the other to explicitly get the data from the corresponding sensor. At
starting the component is configured in observation mode with a period of 10.000
milliseconds.
* **set_period**: this method allows to set the observation period and takes as
parameter an integer representing the observation period in milliseconds. If the
resulting period is less than or equal to 0 the observation is disabled.
than 0 the component is in observation mode.
* **get_data**: trigger the publication of the sensor's temperature and humidity
datas on the corresponding topics *${data}/${device}/dht12/temperature* and
*${data}/${device}/dht12/humidity*.
#### Published datas
If the component is initialized in observation mode it publishes regularly (see period
local variable) the sensor's temperature and humidity datas.
* **temperature**: *${data}/${device}/dht12/temperature*
* **humidity**: *${data}/${device}/dht12/humidity*
### relay.lua
This component correponds to the use of the Wemos relay shield.
Be careful, the Wemos relay shield is not compatible with the SHT30 or DHT12 I2C
shields. A solution is to modify the wiring to release the pin D1 (used by I2C) and
use the pin D5 to control the relay.
#### Remote actions
* **toggle**: change the state of the GPIO5 associated to the Wemos relay shield. At
starting the state is *gpio.LOW*.
* **blink**: temporarily change during 1 second the state of the GPIO5 associated to
the shield. The period of change is defined in milliseconds by the delay local variable.
#### Published datas
Currently empty.
### WS2812.lua
This component correponds to the use of the Wemos WS2812 RGB led shield.
Be careful, the Wemos WS2812 led shield is not compatible with the ws2812 NodeMCU
module. A solution is to modify the wiring to release the pin D2 (also used by I2C)
and use the pin D4 (used by ws2812 module) to control the led.
The led state is defined first by its status (on | off), and second by its color.
There are 7 predefined colors: red, green, blue, yellow, magenta, cyan and
white.
At starting the led is off and its color is *green*.
#### Remote actions
* **on**: set on the RGB led with the color given in parameter. If there is no
parameter or if the color is not defined the color is not changed.
* **color**: change the color of the led with the color given in parameter. If
there is no parameter or if the color is not defined the color is not changed.
The color change will be taken in account to the next state change.
* **toggle**: change the state of the RGB led (on -> off, and off -> on).
* **blink**: temporarily change during 1 second the state of the RGB led. The
period of change is defined in milliseconds by the delay local variable.
* **off**: set off the RGB led.
#### Published datas
Currently empty.
----
|
lgpl-3.0
|
km-works/portal-rpc
|
portal-rpc-client/src/main/java/com/liferay/portal/model/impl/LayoutRevisionCacheModel.java
|
10917
|
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library 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.1 of the License, or (at your option)
* any later version.
*
* This library 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.
*/
package com.liferay.portal.model.impl;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.LayoutRevision;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Date;
/**
* The cache model class for representing LayoutRevision in entity cache.
*
* @author Brian Wing Shun Chan
* @see LayoutRevision
* @generated
*/
public class LayoutRevisionCacheModel implements CacheModel<LayoutRevision>,
Externalizable {
@Override
public String toString() {
StringBundler sb = new StringBundler(63);
sb.append("{layoutRevisionId=");
sb.append(layoutRevisionId);
sb.append(", groupId=");
sb.append(groupId);
sb.append(", companyId=");
sb.append(companyId);
sb.append(", userId=");
sb.append(userId);
sb.append(", userName=");
sb.append(userName);
sb.append(", createDate=");
sb.append(createDate);
sb.append(", modifiedDate=");
sb.append(modifiedDate);
sb.append(", layoutSetBranchId=");
sb.append(layoutSetBranchId);
sb.append(", layoutBranchId=");
sb.append(layoutBranchId);
sb.append(", parentLayoutRevisionId=");
sb.append(parentLayoutRevisionId);
sb.append(", head=");
sb.append(head);
sb.append(", major=");
sb.append(major);
sb.append(", plid=");
sb.append(plid);
sb.append(", privateLayout=");
sb.append(privateLayout);
sb.append(", name=");
sb.append(name);
sb.append(", title=");
sb.append(title);
sb.append(", description=");
sb.append(description);
sb.append(", keywords=");
sb.append(keywords);
sb.append(", robots=");
sb.append(robots);
sb.append(", typeSettings=");
sb.append(typeSettings);
sb.append(", iconImage=");
sb.append(iconImage);
sb.append(", iconImageId=");
sb.append(iconImageId);
sb.append(", themeId=");
sb.append(themeId);
sb.append(", colorSchemeId=");
sb.append(colorSchemeId);
sb.append(", wapThemeId=");
sb.append(wapThemeId);
sb.append(", wapColorSchemeId=");
sb.append(wapColorSchemeId);
sb.append(", css=");
sb.append(css);
sb.append(", status=");
sb.append(status);
sb.append(", statusByUserId=");
sb.append(statusByUserId);
sb.append(", statusByUserName=");
sb.append(statusByUserName);
sb.append(", statusDate=");
sb.append(statusDate);
sb.append("}");
return sb.toString();
}
@Override
public LayoutRevision toEntityModel() {
LayoutRevisionImpl layoutRevisionImpl = new LayoutRevisionImpl();
layoutRevisionImpl.setLayoutRevisionId(layoutRevisionId);
layoutRevisionImpl.setGroupId(groupId);
layoutRevisionImpl.setCompanyId(companyId);
layoutRevisionImpl.setUserId(userId);
if (userName == null) {
layoutRevisionImpl.setUserName(StringPool.BLANK);
}
else {
layoutRevisionImpl.setUserName(userName);
}
if (createDate == Long.MIN_VALUE) {
layoutRevisionImpl.setCreateDate(null);
}
else {
layoutRevisionImpl.setCreateDate(new Date(createDate));
}
if (modifiedDate == Long.MIN_VALUE) {
layoutRevisionImpl.setModifiedDate(null);
}
else {
layoutRevisionImpl.setModifiedDate(new Date(modifiedDate));
}
layoutRevisionImpl.setLayoutSetBranchId(layoutSetBranchId);
layoutRevisionImpl.setLayoutBranchId(layoutBranchId);
layoutRevisionImpl.setParentLayoutRevisionId(parentLayoutRevisionId);
layoutRevisionImpl.setHead(head);
layoutRevisionImpl.setMajor(major);
layoutRevisionImpl.setPlid(plid);
layoutRevisionImpl.setPrivateLayout(privateLayout);
if (name == null) {
layoutRevisionImpl.setName(StringPool.BLANK);
}
else {
layoutRevisionImpl.setName(name);
}
if (title == null) {
layoutRevisionImpl.setTitle(StringPool.BLANK);
}
else {
layoutRevisionImpl.setTitle(title);
}
if (description == null) {
layoutRevisionImpl.setDescription(StringPool.BLANK);
}
else {
layoutRevisionImpl.setDescription(description);
}
if (keywords == null) {
layoutRevisionImpl.setKeywords(StringPool.BLANK);
}
else {
layoutRevisionImpl.setKeywords(keywords);
}
if (robots == null) {
layoutRevisionImpl.setRobots(StringPool.BLANK);
}
else {
layoutRevisionImpl.setRobots(robots);
}
if (typeSettings == null) {
layoutRevisionImpl.setTypeSettings(StringPool.BLANK);
}
else {
layoutRevisionImpl.setTypeSettings(typeSettings);
}
layoutRevisionImpl.setIconImage(iconImage);
layoutRevisionImpl.setIconImageId(iconImageId);
if (themeId == null) {
layoutRevisionImpl.setThemeId(StringPool.BLANK);
}
else {
layoutRevisionImpl.setThemeId(themeId);
}
if (colorSchemeId == null) {
layoutRevisionImpl.setColorSchemeId(StringPool.BLANK);
}
else {
layoutRevisionImpl.setColorSchemeId(colorSchemeId);
}
if (wapThemeId == null) {
layoutRevisionImpl.setWapThemeId(StringPool.BLANK);
}
else {
layoutRevisionImpl.setWapThemeId(wapThemeId);
}
if (wapColorSchemeId == null) {
layoutRevisionImpl.setWapColorSchemeId(StringPool.BLANK);
}
else {
layoutRevisionImpl.setWapColorSchemeId(wapColorSchemeId);
}
if (css == null) {
layoutRevisionImpl.setCss(StringPool.BLANK);
}
else {
layoutRevisionImpl.setCss(css);
}
layoutRevisionImpl.setStatus(status);
layoutRevisionImpl.setStatusByUserId(statusByUserId);
if (statusByUserName == null) {
layoutRevisionImpl.setStatusByUserName(StringPool.BLANK);
}
else {
layoutRevisionImpl.setStatusByUserName(statusByUserName);
}
if (statusDate == Long.MIN_VALUE) {
layoutRevisionImpl.setStatusDate(null);
}
else {
layoutRevisionImpl.setStatusDate(new Date(statusDate));
}
layoutRevisionImpl.resetOriginalValues();
return layoutRevisionImpl;
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException {
layoutRevisionId = objectInput.readLong();
groupId = objectInput.readLong();
companyId = objectInput.readLong();
userId = objectInput.readLong();
userName = objectInput.readUTF();
createDate = objectInput.readLong();
modifiedDate = objectInput.readLong();
layoutSetBranchId = objectInput.readLong();
layoutBranchId = objectInput.readLong();
parentLayoutRevisionId = objectInput.readLong();
head = objectInput.readBoolean();
major = objectInput.readBoolean();
plid = objectInput.readLong();
privateLayout = objectInput.readBoolean();
name = objectInput.readUTF();
title = objectInput.readUTF();
description = objectInput.readUTF();
keywords = objectInput.readUTF();
robots = objectInput.readUTF();
typeSettings = objectInput.readUTF();
iconImage = objectInput.readBoolean();
iconImageId = objectInput.readLong();
themeId = objectInput.readUTF();
colorSchemeId = objectInput.readUTF();
wapThemeId = objectInput.readUTF();
wapColorSchemeId = objectInput.readUTF();
css = objectInput.readUTF();
status = objectInput.readInt();
statusByUserId = objectInput.readLong();
statusByUserName = objectInput.readUTF();
statusDate = objectInput.readLong();
}
@Override
public void writeExternal(ObjectOutput objectOutput)
throws IOException {
objectOutput.writeLong(layoutRevisionId);
objectOutput.writeLong(groupId);
objectOutput.writeLong(companyId);
objectOutput.writeLong(userId);
if (userName == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(userName);
}
objectOutput.writeLong(createDate);
objectOutput.writeLong(modifiedDate);
objectOutput.writeLong(layoutSetBranchId);
objectOutput.writeLong(layoutBranchId);
objectOutput.writeLong(parentLayoutRevisionId);
objectOutput.writeBoolean(head);
objectOutput.writeBoolean(major);
objectOutput.writeLong(plid);
objectOutput.writeBoolean(privateLayout);
if (name == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(name);
}
if (title == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(title);
}
if (description == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(description);
}
if (keywords == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(keywords);
}
if (robots == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(robots);
}
if (typeSettings == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(typeSettings);
}
objectOutput.writeBoolean(iconImage);
objectOutput.writeLong(iconImageId);
if (themeId == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(themeId);
}
if (colorSchemeId == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(colorSchemeId);
}
if (wapThemeId == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(wapThemeId);
}
if (wapColorSchemeId == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(wapColorSchemeId);
}
if (css == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(css);
}
objectOutput.writeInt(status);
objectOutput.writeLong(statusByUserId);
if (statusByUserName == null) {
objectOutput.writeUTF(StringPool.BLANK);
}
else {
objectOutput.writeUTF(statusByUserName);
}
objectOutput.writeLong(statusDate);
}
public long layoutRevisionId;
public long groupId;
public long companyId;
public long userId;
public String userName;
public long createDate;
public long modifiedDate;
public long layoutSetBranchId;
public long layoutBranchId;
public long parentLayoutRevisionId;
public boolean head;
public boolean major;
public long plid;
public boolean privateLayout;
public String name;
public String title;
public String description;
public String keywords;
public String robots;
public String typeSettings;
public boolean iconImage;
public long iconImageId;
public String themeId;
public String colorSchemeId;
public String wapThemeId;
public String wapColorSchemeId;
public String css;
public int status;
public long statusByUserId;
public String statusByUserName;
public long statusDate;
}
|
lgpl-3.0
|
stack-of-tasks/soth
|
unitTesting/thcod.cpp
|
2350
|
/* -------------------------------------------------------------------------- *
*
* Simple test of the HCOD class with assertion.
*
* -------------------------------------------------------------------------- */
#define SOTH_DEBUG
#define SOTH_DEBUG_MODE 10
#define SOTH_TEMPLATE_DEBUG_MODE 10
#include "RandomGenerator.hpp"
#include "soth/HCOD.hpp"
#include "soth/Random.hpp"
#include "soth/debug.hpp"
using namespace soth;
int main(int, char**) {
soth::sotDebugTrace::openFile();
soth::Random::setSeed(7);
const int NB_STAGE = 3;
const int RANKFREE[] = {3, 4, 3, 5, 3};
const int RANKLINKED[] = {2, 2, 1, 5, 3};
const int NR[] = {5, 4, 5, 5, 8};
const int NC = 12;
/* Initialize J and b. */
std::vector<Eigen::MatrixXd> J(NB_STAGE);
std::vector<soth::VectorBound> b(NB_STAGE);
soth::generateDeficientDataSet(J, b, NB_STAGE, RANKFREE, RANKLINKED, NR, NC);
b[0][1] = std::make_pair(-0.1, 2.37);
for (int i = 0; i < NB_STAGE; ++i) {
sotDEBUG(0) << "J" << i + 1 << " = " << (soth::MATLAB)J[i] << std::endl;
sotDEBUG(0) << "e" << i + 1 << " = " << b[i] << ";" << std::endl;
}
std::cout << J[0](0, 0) << std::endl;
assert(std::abs(J[0](0, 0) - 0.544092) < 1e-5);
/* SOTH structure construction. */
soth::HCOD hcod(NC, NB_STAGE);
for (int i = 0; i < NB_STAGE; ++i) {
hcod.pushBackStage(J[i], b[i]);
assert(NR[i] > 0);
}
hcod.setInitialActiveSet();
hcod.setNameByOrder("stage_");
hcod.initialize();
hcod.Y.computeExplicitly();
hcod.computeSolution(true);
std::cout << hcod.rank() << " " << hcod[0].rank() << " " << hcod[1].rank()
<< " " << hcod[2].rank() << std::endl;
assert((hcod.rank() == 4) && (hcod[0].rank() == 0) && (hcod[1].rank() == 2) &&
(hcod[2].rank() == 2));
double tau = hcod.computeStepAndUpdate();
hcod.makeStep(tau);
std::cout << "tau:" << tau << " " << std::abs(tau - 0.486522) << " "
<< soth::Stage::EPSILON << std::endl;
assert((std::abs(tau - 0.486522) <= 50 * soth::Stage::EPSILON) &&
"Check bound test failed.");
hcod.computeLagrangeMultipliers(hcod.nbStages());
bool testL = hcod.testLagrangeMultipliers(hcod.nbStages(), std::cout);
sotDEBUG(5) << "Test multipliers: " << ((testL) ? "Passed!" : "Failed...")
<< std::endl;
assert(testL && "Lagrange Multipliers test failed.");
}
|
lgpl-3.0
|
Bang3DEngine/Bang
|
include/Bang/TextureUnitManager.h
|
1797
|
#ifndef TEXTUREUNITMANAGER_H
#define TEXTUREUNITMANAGER_H
#include <queue>
#include <unordered_map>
#include <vector>
#include "Bang/Array.tcc"
#include "Bang/BangDefines.h"
#include "Bang/EventEmitter.tcc"
#include "Bang/EventListener.h"
#include "Bang/EventListener.tcc"
#include "Bang/GL.h"
#include "Bang/IEventsDestroy.h"
namespace Bang
{
template <class>
class EventEmitter;
class IEventsDestroy;
class Texture;
class TextureUnitManager : public EventListener<IEventsDestroy>
{
public:
using TexUnit = uint;
TextureUnitManager();
static void BindTextureToUnit(Texture *texture, TexUnit unit);
static TexUnit BindTextureToUnit(Texture *texture);
static uint GetMaxTextureUnits();
static uint GetNumUsableTextureUnits();
static void UnBindAllTexturesFromAllUnits();
static uint GetUnitTextureIsBoundTo(Texture *texture);
static GLId GetBoundTextureToUnit(GL::TextureTarget texTarget,
GL::Enum textureUnit);
static void PrintTextureUnits();
static TextureUnitManager *GetActive();
private:
uint m_numMaxTextureUnits = SCAST<uint>(-1);
uint m_numUsableTextureUnits = SCAST<uint>(-1);
TexUnit m_voidTexUnit = -1;
uint m_timestampCounter = 0;
std::queue<TexUnit> m_freeUnits;
std::unordered_map<GLId, uint> m_timestampTexIdUsed;
std::unordered_map<GLId, Texture *> m_textureIdToTexture;
std::unordered_map<GLId, TexUnit> m_textureIdToBoundUnit;
TexUnit MakeRoomAndGetAFreeTextureUnit();
void UpdateStructuresForUsedTexture(Texture *texture, uint usedUnit);
void UnTrackTexture(GLId textureId);
void CheckBindingsValidity() const;
void OnDestroyed(EventEmitter<IEventsDestroy> *object) override;
};
} // namespace Bang
#endif // TEXTUREUNITMANAGER_H
|
lgpl-3.0
|
muzgash/fornberg
|
src/libfornberg.c
|
1808
|
#include "libfornberg.h"
float get_weight(int N, int m, int n, int v,float *vector)
{
return vector[(N+1)*(N+1)*m+(N+1)*n+v];
}
void fornberg_weights(int M,int p,int *alpha,float *delta)
//Orden de la derivada
//p grado de aproximacion
//alpha el vector con los indices de los puntos donde se va a tomar la derivada, i.e. -2 -1 0 1 2 para derivadas centradas con aproximacion de 4 puntos
//delta vector con los pesos de la derivada
{
int N=p;//Numero de puntos a tomar sin el del centro
//int M=1;//Orden de la derivada
//float delta[(M+1)*(N+1)*(N+1)];//movemos el índice en el orden n, v, m esto es delta[(N+1)*(N+1)*m+(N+1)*n+v]
//delta=(float*)malloc((M+1)*(N+1)*(N+1)*sizeof(float));
float c1, c2, c3;
int min;
int i,j,n,v,m; //contadores
delta[(N+1)*(N+1)*0+(N+1)*0+0]=1;
c1=1;
printf("delta %d %d %d=%f\n",0,0,0,get_weight(N,0,0,0,delta));
for( n = 1; n <= N; n++ ) {
c2=1;
for( v = 0; v <= n-1; v++ ) {
c3=alpha[n]-alpha[v];
c2=c2*c3;
if( n <= M ) {
delta[(N+1)*(N+1)*n+(N+1)*(n-1)+v]=0;
}
if(n<M) min=n;
else min=M;
for( m = 0; m <= min; m++ ) {
if(m==0) delta[(N+1)*(N+1)*m+(N+1)*n+v]=(alpha[n]*get_weight(N,m,n-1,v,delta))/c3;
else delta[(N+1)*(N+1)*m+(N+1)*n+v]=(alpha[n]*get_weight(N,m,n-1,v,delta)-m*get_weight(N,m-1,n-1,v,delta))/c3;
}
}
for( m = 0; m <= min; m++ ) {
if(m==0) delta[(N+1)*(N+1)*m+(N+1)*n+n]=(c1/c2)*(-1*alpha[n-1]*get_weight(N,m,n-1,n-1,delta));
else delta[(N+1)*(N+1)*m+(N+1)*n+n]=(c1/c2)*(m*get_weight(N,m-1,n-1,n-1,delta)-alpha[n-1]*get_weight(N,m,n-1,n-1,delta));
}
c1=c2;
}
/*for(m=0;m<M+1;m++) {
for(n=m;n<N+1;n++) {
for(v=0;v<=n;v++){
printf("valor del coeficiente para m= %d n = %d y v = %d es %f\n",m,n,v,get_weight(N,m,n,v,delta));
}
}
}*/
}
|
lgpl-3.0
|
Depter/JRLib
|
NetbeansProject/jreserve-dummy/substance/src/main/java/org/pushingpixels/substance/api/ColorSchemeTransform.java
|
2058
|
/*
* Copyright (c) 2005-2010 Substance Kirill Grouchnikov. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* o Neither the name of Substance Kirill Grouchnikov nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.pushingpixels.substance.api;
/**
* Defines transformation on a color scheme.
*
* @author Kirill Grouchnikov
*/
public interface ColorSchemeTransform {
/**
* Transforms the specified color scheme.
*
* @param scheme
* The original color scheme to transform.
* @return The transformed color scheme.
*/
public SubstanceColorScheme transform(SubstanceColorScheme scheme);
}
|
lgpl-3.0
|
Wmaxlees/jarvis-os
|
jarvis-nlp/src/SNLayer.cpp
|
1179
|
/**
Copyright 2015 W. Max Lees
This file is part of Jarvis OS.
Jarvis OS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Jarvis OS 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Jarvis OS. If not, see <http://www.gnu.org/licenses/>.
*/
/**
FILE: SNLayer.cpp
@author W. Max Lees
@docdate 06.12.2015
@descr Layer of neurons for the Sigmoid Neuron Network implementation
*/
#include "SNLayer.hpp"
namespace Jarvis {
namespace JarvisNLP {
/*!
Initializes the layer based on the number of previous neurons
and the size of the current layer
*/
template <typename T>
void SigmoidNeuronLayer<T>::init(int prevLayerSize, int layerSize) {
}
}
}
|
lgpl-3.0
|
lukaszpiotr/pylama_with_gjslint
|
pylama/checkers/pylint/reporters/__init__.py
|
4482
|
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""utilities methods and classes for reporters"""
import sys
import locale
import os
from .. import utils
CMPS = ['=', '-', '+']
# py3k has no more cmp builtin
if sys.version_info >= (3, 0):
def cmp(a, b):
return (a > b) - (a < b)
def diff_string(old, new):
"""given a old and new int value, return a string representing the
difference
"""
diff = abs(old - new)
diff_str = "%s%s" % (CMPS[cmp(old, new)], diff and ('%.2f' % diff) or '')
return diff_str
class Message(object):
"""This class represent a message to be issued by the reporters"""
def __init__(self, reporter, msg_id, location, msg):
self.msg_id = msg_id
self.abspath, self.module, self.obj, self.line, self.column = location
self.path = self.abspath.replace(reporter.path_strip_prefix, '')
self.msg = msg
self.C = msg_id[0]
self.category = utils.MSG_TYPES[msg_id[0]]
self.symbol = reporter.linter.check_message_id(msg_id).symbol
def format(self, template):
"""Format the message according to the given template.
The template format is the one of the format method :
cf. http://docs.python.org/2/library/string.html#formatstrings
"""
return template.format(**(self.__dict__))
class BaseReporter(object):
"""base class for reporters
symbols: show short symbolic names for messages.
"""
extension = ''
def __init__(self, output=None):
self.linter = None
# self.include_ids = None # Deprecated
# self.symbols = None # Deprecated
self.section = 0
self.out = None
self.out_encoding = None
self.encode = None
self.set_output(output)
# Build the path prefix to strip to get relative paths
self.path_strip_prefix = os.getcwd() + os.sep
def add_message(self, msg_id, location, msg):
"""Client API to send a message"""
# Shall we store the message objects somewhere, do some validity checking ?
raise NotImplementedError
def set_output(self, output=None):
"""set output stream"""
self.out = output or sys.stdout
# py3k streams handle their encoding :
if sys.version_info >= (3, 0):
self.encode = lambda x: x
return
def encode(string):
if not isinstance(string, unicode):
return string
encoding = (getattr(self.out, 'encoding', None) or
locale.getdefaultlocale()[1] or
sys.getdefaultencoding())
# errors=replace, we don't want to crash when attempting to show
# source code line that can't be encoded with the current locale
# settings
return string.encode(encoding, 'replace')
self.encode = encode
def writeln(self, string=''):
"""write a line in the output buffer"""
print >> self.out, self.encode(string)
def display_results(self, layout):
"""display results encapsulated in the layout tree"""
self.section = 0
if hasattr(layout, 'report_id'):
layout.children[0].children[0].data += ' (%s)' % layout.report_id
self._display(layout)
def _display(self, layout):
"""display the layout"""
raise NotImplementedError()
# Event callbacks
def on_set_current_module(self, module, filepath):
"""starting analyzis of a module"""
pass
def on_close(self, stats, previous_stats):
"""global end of analyzis"""
pass
def initialize(linter):
"""initialize linter with reporters in this package """
utils.register_plugins(linter, __path__[0])
|
lgpl-3.0
|
Heather/Pyramid-Head
|
src/ltimer.h
|
2600
|
/*
L - Linux library for easy writing of linux daemons in C++.
Copyright (C) 2012 Alexander Wenzel.
This library 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.0 of the License, or (at your option) any later version.
This library 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 this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
// LTimer
// Dependency: none
#ifndef L_TIMER
#define L_TIMER
#include "lili.h"
#include "stdint.h"
#include "time.h"
/**********************************************************************/
// LTimer
/**********************************************************************/
//! Timer object in milliseconds resolution
/*!
Timer used to measure time in milliseconds.
*/
class LTimer {
public:
//! Default constructor.
/*!
Timer is set to invalid.
*/
LTimer();
//! Copy constructor.
/*!
\param timer Timer to be copied.
*/
LTimer(const LTimer& timer);
//! Constructor provides milliseconds
/*!
Start timer.
\param mseconds Milliseconds after which timer is elapsed.
*/
LTimer(unsigned int mseconds);
//! Destructor.
~LTimer();
//! Start the timer.
/*!
\param mseconds The amount of milliseconds the timer runs.
*/
void start(unsigned int mseconds);
//! Clears and stops timer.
void clear();
//! Check if timer is still running.
/*!
\return true = time is elapsed, false = timer is still running.
*/
bool elapsed();
//! The number of milliseconds the timer is still running.
/*!
\return time in milliseconds the timer still runs.
*/
unsigned int togo();
//! Copy an existing timer.
/*!
\param timer The timer to be copied.
\return pointer to itself.
*/
LTimer& operator = (const LTimer& timer);
protected:
//! Returns the current number of ticks the PC is running.
/*!
\return number of ticks.
*/
unsigned int ticks();
private:
unsigned int msecondsStart;
unsigned int msecondsFinish;
};
#endif /* L_TIMER */
// kate: indent-mode cstyle; indent-width 4; replace-tabs on;
|
lgpl-3.0
|
netsuileo/sfu-cluster-dashboard
|
dashboard/tpl/site/modules/monitoring_nodes/graphs/base_graphs.html
|
4047
|
{% extends "site/modules/monitoring_nodes/monitoring_nodes_base.html" %}
{% block static_charts %}
{% load static %}
<script src="{% static 'chart/Chart.min.js' %}"></script>
<script src="{% static 'chart/canvasjs.min.js' %}"></script>
{% endblock %}
{% block static_local %}
<script src="{% static 'modules/monitoring_nodes/graphs/graphs.js' %}"></script>
<link rel="stylesheet" href="{% static 'modules/monitoring_nodes/graphs/graphs.css' %}">
{% endblock %}
{% block breadcrump_inactive %}
{{ block.super }}
<li><a href="{% url 'modules:monitoring_nodes:graphs:index' %}">Графики</a></li>
{% endblock %}
{% block breadcrump_active %}
<li class="active">Выбор графиков для просмотра</li>
{% endblock %}
{% block inner_content %}
{% for graph in graphs_info %}
<div class="row">
<div class="col-lg-10 col-lg-offset-1 graph"
plugin-name="{{ graph.plugin_name }}"
node-name="{{ graph.node_name }}"
param-name="{{ graph.param_name }}">
<div class="graph-title">{{ graph.node_name }} /{{ graph.plugin_name }} / {{ graph.param_name }}</div>
<div class="graph-actions-container">
<div class="graph-actions graph-actions-type">
<select class="form-control selectpicker show-tick" title="Тип графика">
{% for type in graph.types %}
<option value="{{ type }}">{{ type }}</option>
{% endfor %}
</select>
</div>
<div class="graph-actions graph-actions-select-time">
<div class='input-group'>
<select class="form-control selectpicker show-tick" title="Показать данные за">
<option value="default">По умолчанию</option>
<option value="hour">За последний час</option>
<option value="6-hours">За последние 6 часов</option>
<option value="day">За последний день</option>
<option value="week">За последнюю неделю</option>
<option value="month">За последний месяц</option>
<option value="half-year">За последние полгода</option>
</select>
</div>
</div>
<div class="graph-actions graph-actions-from">
<div class='input-group'>
<input type='text' class="form-control date-time-input" title="time-from">
<span class="input-group-addon">
От <span class="fa fa-calendar"></span>
</span>
</div>
</div>
<div class="graph-actions graph-actions-to">
<div class='input-group'>
<input type='text' class="form-control date-time-input" title="time-to">
<span class="input-group-addon">
До <span class="fa fa-calendar"></span>
</span>
</div>
</div>
<div class="graph-actions graph-actions-refresh">
<button class="btn btn-default btn-graph-refresh">
<i class="fa fa-refresh"></i>
</button>
</div>
</div>
<div id="canvas_{{ graph.id }}"
class="graph-canvas graphs"></div>
</div>
</div>
{% endfor %}
{% endblock %}
|
lgpl-3.0
|
croco-bio/croco-cyto
|
src/main/java/de/lmu/ifi/bio/croco/cyto/ui/OperationsTable.java
|
1482
|
package de.lmu.ifi.bio.croco.cyto.ui;
import java.awt.Component;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellRenderer;
public class OperationsTable extends JTable {
class OperationModel extends AbstractTableModel{
private static final long serialVersionUID = 1L;
List<JButton> possibleOperations = null;
public OperationModel(List<JButton> possibleOperations) {
this.possibleOperations = possibleOperations;
}
@Override
public Class<?> getColumnClass(int columnIndex) {
return JButton.class;
}
@Override
public int getColumnCount() {
return 1;
}
@Override
public int getRowCount() {
return possibleOperations.size();
}
@Override
public String getColumnName(int column) {
return "Operation";
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return possibleOperations.get(rowIndex);
}
}
//class OperationRendered im
class Renderer implements TableCellRenderer{
@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, int row,
int column) {
return (JButton)value;
}
}
public OperationsTable( List<JButton> possibleOperations){
this.setModel(new OperationModel(possibleOperations));
this.setDefaultRenderer(JButton.class, new Renderer() );
}
}
|
lgpl-3.0
|
1Tristan/VariantSync
|
src/de/ovgu/variantsync/VariantSyncPlugin.java
|
12061
|
package de.ovgu.variantsync;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.texteditor.ITextEditor;
import org.osgi.framework.BundleContext;
import de.ovgu.variantsync.applicationlayer.ModuleFactory;
import de.ovgu.variantsync.applicationlayer.Util;
import de.ovgu.variantsync.applicationlayer.context.ContextProvider;
import de.ovgu.variantsync.applicationlayer.context.IContextOperations;
import de.ovgu.variantsync.applicationlayer.datamodel.context.Context;
import de.ovgu.variantsync.applicationlayer.datamodel.context.FeatureExpressions;
import de.ovgu.variantsync.applicationlayer.datamodel.monitoring.MonitorItemStorage;
import de.ovgu.variantsync.applicationlayer.deltacalculation.DeltaOperationProvider;
import de.ovgu.variantsync.applicationlayer.features.FeatureProvider;
import de.ovgu.variantsync.applicationlayer.features.IFeatureOperations;
import de.ovgu.variantsync.applicationlayer.monitoring.ChangeListener;
import de.ovgu.variantsync.applicationlayer.monitoring.MonitorNotifier;
import de.ovgu.variantsync.applicationlayer.synchronization.SynchronizationProvider;
import de.ovgu.variantsync.persistencelayer.IPersistanceOperations;
import de.ovgu.variantsync.presentationlayer.controller.ControllerHandler;
import de.ovgu.variantsync.presentationlayer.controller.ControllerTypes;
import de.ovgu.variantsync.presentationlayer.view.AbstractView;
import de.ovgu.variantsync.presentationlayer.view.console.ChangeOutPutConsole;
import de.ovgu.variantsync.presentationlayer.view.context.MarkerHandler;
import de.ovgu.variantsync.presentationlayer.view.context.PartAdapter;
import de.ovgu.variantsync.presentationlayer.view.eclipseadjustment.VSyncSupportProjectNature;
import de.ovgu.variantsync.utilitylayer.UtilityModel;
import de.ovgu.variantsync.utilitylayer.log.LogOperations;
/**
* Entry point to start plugin variantsync. Variantsync supports developers to
* synchronize similar software projects which are developed in different
* variants. This version is based on first version of variantsync which was
* developed by Lei Luo in 2012.
*
* @author Tristan Pfofe (tristan.pfofe@st.ovgu.de)
* @version 2.0
* @since 14.05.2015
*/
public class VariantSyncPlugin extends AbstractUIPlugin {
// shared instance
private static VariantSyncPlugin plugin;
private ChangeOutPutConsole console;
private List<IProject> projectList = new ArrayList<IProject>();
private Map<IProject, MonitorItemStorage> synchroInfoMap = new HashMap<IProject, MonitorItemStorage>();
private ChangeListener resourceModificationListener;
private IPersistanceOperations persistenceOp = ModuleFactory
.getPersistanceOperations();
private IContextOperations contextOp = ModuleFactory.getContextOperations();
private IFeatureOperations featureOp = ModuleFactory.getFeatureOperations();
private ControllerHandler controller = ControllerHandler.getInstance();
@Override
public void start(BundleContext context) {
try {
super.start(context);
} catch (Exception e) {
LogOperations.logError("Plugin could not be started.", e);
}
plugin = this;
console = new ChangeOutPutConsole();
removeAllMarkers();
initMVC();
initContext();
initFeatureExpressions();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
listenForActiveClass();
}
});
try {
initResourceMonitoring();
} catch (CoreException e) {
LogOperations.logError(
"Resouce monitoring could not be initialized.", e);
}
}
/**
* Listen whether the active file in the java editor changes.
*/
public void listenForActiveClass() {
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow ww = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = ww.getActivePage();
if (page == null)
return;
page.addPartListener(new PartAdapter());
}
@Override
public void stop(BundleContext context) {
persistenceOp.saveFeatureExpressions(featureOp.getFeatureExpressions());
// stop default-context or any other active context
try {
contextOp.stopRecording();
persistenceOp.saveContext(contextOp
.getContext(VariantSyncConstants.DEFAULT_CONTEXT), Util
.parseStorageLocation(contextOp
.getContext(VariantSyncConstants.DEFAULT_CONTEXT)));
} catch (NullPointerException e) {
// recordings was already stopped and contexts were cleaned up
}
plugin = null;
try {
super.stop(context);
} catch (Exception e) {
LogOperations.logError("Plugin could not be started.", e);
}
IWorkspace ws = ResourcesPlugin.getWorkspace();
ws.removeResourceChangeListener(resourceModificationListener);
}
public String getWorkspaceLocation() {
return ResourcesPlugin.getWorkspace().getRoot().getLocation()
.toString();
}
/**
* Returns list of projects which has eclipse nature support and variantsync
* nature id.
*
* @return list of projects
*/
public List<IProject> getSupportProjectList() {
this.projectList.clear();
for (IProject project : ResourcesPlugin.getWorkspace().getRoot()
.getProjects()) {
try {
if (project.isOpen()
&& project
.hasNature(VSyncSupportProjectNature.NATURE_ID)) {
this.projectList.add(project);
}
} catch (CoreException e) {
UtilityModel.getInstance().handleError(e,
"nature support could not be checked");
}
}
return new ArrayList<IProject>(projectList);
}
/**
* Updates synchroInfoMap. This map contains IProject-objects mapped to
* SynchroInfo objects.
*/
public void updateSynchroInfo() {
this.synchroInfoMap.clear();
List<IProject> projects = this.getSupportProjectList();
for (IProject project : projects) {
IFile infoFile = project.getFolder(
VariantSyncConstants.ADMIN_FOLDER).getFile(
VariantSyncConstants.ADMIN_FILE);
MonitorItemStorage info = new MonitorItemStorage();
if (infoFile.exists()) {
try {
info = persistenceOp.readSynchroXMLFile(infoFile
.getContents());
} catch (CoreException e) {
UtilityModel.getInstance().handleError(e,
"info file could not be read");
}
}
this.synchroInfoMap.put(project, info);
}
}
/**
* Initializes model view controller implementation to encapsulate gui
* elements from business logic.
*/
private void initMVC() {
// register models as request handler for controller
controller.addModel(new SynchronizationProvider(),
ControllerTypes.SYNCHRONIZATION);
controller
.addModel(new DeltaOperationProvider(), ControllerTypes.DELTA);
controller.addModel(new FeatureProvider(), ControllerTypes.FEATURE);
controller.addModel(new ContextProvider(), ControllerTypes.CONTEXT);
controller.addModel(MonitorNotifier.getInstance(),
ControllerTypes.MONITOR);
}
/**
* Loads all contexts which are saved in a XML-file.
*/
private void initContext() {
String storageLocation = VariantSyncPlugin.getDefault()
.getWorkspaceLocation() + VariantSyncConstants.CONTEXT_PATH;
File folder = new File(storageLocation);
if (folder.exists() && folder.isDirectory()) {
File[] files = folder.listFiles();
for (File f : files) {
Context c = persistenceOp.loadContext(f.getPath());
if (c != null)
contextOp.addContext(c);
else
System.out.println(f.toString());
}
}
contextOp.activateContext(VariantSyncConstants.DEFAULT_CONTEXT);
}
/**
* Loads all feature expressions which are saved in a XML-file.
*/
private void initFeatureExpressions() {
String storageLocation = VariantSyncPlugin.getDefault()
.getWorkspaceLocation()
+ VariantSyncConstants.FEATURE_EXPRESSION_PATH;
File folder = new File(storageLocation.substring(0,
storageLocation.lastIndexOf("/")));
if (folder.exists() && folder.isDirectory()) {
File[] files = folder.listFiles();
for (File f : files) {
FeatureExpressions featureExpressions = persistenceOp
.loadFeatureExpressions(f.getPath());
Iterator<String> it = featureExpressions
.getFeatureExpressions().iterator();
while (it.hasNext()) {
featureOp.addFeatureExpression(it.next());
}
it = featureOp.getFeatureModel().getFeatureNames().iterator();
while (it.hasNext()) {
featureOp.addFeatureExpression(it.next());
}
}
}
}
/**
* Prepares resource monitoring in eclipse workspace. Resource monitoring
* means that projects will be watches. If a projects´s resource changes and
* change was saved, monitoring will notice changed resource (POST_CHANGE).
* A resource is a file or folder.
*
* @throws CoreException
* resources could not be monitored
*/
private void initResourceMonitoring() throws CoreException {
resourceModificationListener = new ChangeListener();
ResourcesPlugin.getWorkspace().addResourceChangeListener(
resourceModificationListener, IResourceChangeEvent.POST_CHANGE);
resourceModificationListener.registerSaveParticipant();
}
/**
* Returns monitored items of specific project.
*
* @param project
* the project to get monitored items from
* @return MonitorItemStorage
*/
public MonitorItemStorage getSynchroInfoFrom(IProject project) {
if (this.synchroInfoMap.get(project) == null) {
this.updateSynchroInfo();
}
return this.synchroInfoMap.get(project);
}
/**
* Registers a view. If a model fires an event, all registered views receive
* this element.
*
* @param view
* view to register
*/
public void registerView(AbstractView view, ControllerTypes type) {
controller.addView(view, type);
}
/**
* Removes a view from controller. If a model fires an event, this view will
* no longer receive this event.
*
* @param view
* view to remove
*/
public void removeView(AbstractView view, ControllerTypes type) {
controller.removeView(view, type);
}
/**
* @return the display
*/
public static Display getStandardDisplay() {
Display display = Display.getCurrent();
if (display == null) {
display = Display.getDefault();
}
return display;
}
/**
* Logs a message on eclipse console.
*
* @param msg
* the message to log
*/
public void logMessage(String msg) {
console.logMessage(msg);
}
/**
* @return the console
*/
public ChangeOutPutConsole getConsole() {
return console;
}
/**
* @return the controller
*/
public ControllerHandler getController() {
return controller;
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static VariantSyncPlugin getDefault() {
return plugin;
}
/**
* Always good to have this static method as when dealing with IResources
* having a interface to get the editor is very handy
*
* @return
*/
public static ITextEditor getEditor() {
return (ITextEditor) getActiveWorkbenchWindow().getActivePage()
.getActiveEditor();
}
public static Shell getShell() {
return getActiveWorkbenchWindow().getShell();
}
public static IWorkbenchWindow getActiveWorkbenchWindow() {
return getDefault().getWorkbench().getActiveWorkbenchWindow();
}
private void removeAllMarkers() {
List<IProject> projects = getSupportProjectList();
for (IProject p : projects) {
MarkerHandler.getInstance().clearAllMarker(p);
}
}
public ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(VariantSyncConstants.PLUGIN_ID, path);
}
}
|
lgpl-3.0
|
mdaus/nitro
|
docs/nitro-nitf.sourceforge.net/apidocs/c/2.5java/allclasses-noframe.html
|
4828
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_03) on Wed Dec 09 19:42:43 EST 2009 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
All Classes (NITRO Java Bindings 2.5-dev API)
</TITLE>
<META NAME="date" CONTENT="2009-12-09">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameHeadingFont">
<B>All Classes</B></FONT>
<BR>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="nitf/BandInfo.html" title="class in nitf">BandInfo</A>
<BR>
<A HREF="nitf/BandSource.html" title="class in nitf">BandSource</A>
<BR>
<A HREF="nitf/BlockingInfo.html" title="class in nitf">BlockingInfo</A>
<BR>
<A HREF="nitf/CloneableObject.html" title="class in nitf">CloneableObject</A>
<BR>
<A HREF="nitf/ComponentInfo.html" title="class in nitf">ComponentInfo</A>
<BR>
<A HREF="nitf/DESegment.html" title="class in nitf">DESegment</A>
<BR>
<A HREF="nitf/DestructibleObject.html" title="class in nitf">DestructibleObject</A>
<BR>
<A HREF="nitf/DESubheader.html" title="class in nitf">DESubheader</A>
<BR>
<A HREF="nitf/DownSampler.html" title="class in nitf">DownSampler</A>
<BR>
<A HREF="nitf/Extensions.html" title="class in nitf">Extensions</A>
<BR>
<A HREF="nitf/Field.html" title="class in nitf">Field</A>
<BR>
<A HREF="nitf/FieldType.html" title="class in nitf">FieldType</A>
<BR>
<A HREF="nitf/FieldWarning.html" title="class in nitf">FieldWarning</A>
<BR>
<A HREF="nitf/FileHeader.html" title="class in nitf">FileHeader</A>
<BR>
<A HREF="nitf/FileSecurity.html" title="class in nitf">FileSecurity</A>
<BR>
<A HREF="nitf/FileSource.html" title="class in nitf">FileSource</A>
<BR>
<A HREF="nitf/GraphicSegment.html" title="class in nitf">GraphicSegment</A>
<BR>
<A HREF="nitf/GraphicSubheader.html" title="class in nitf">GraphicSubheader</A>
<BR>
<A HREF="nitf/ImageReader.html" title="class in nitf">ImageReader</A>
<BR>
<A HREF="nitf/ImageSegment.html" title="class in nitf">ImageSegment</A>
<BR>
<A HREF="nitf/ImageSource.html" title="class in nitf">ImageSource</A>
<BR>
<A HREF="nitf/ImageSubheader.html" title="class in nitf">ImageSubheader</A>
<BR>
<A HREF="nitf/ImageWriter.html" title="class in nitf">ImageWriter</A>
<BR>
<A HREF="nitf/IOHandle.html" title="class in nitf">IOHandle</A>
<BR>
<A HREF="nitf/IOInterface.html" title="class in nitf">IOInterface</A>
<BR>
<A HREF="nitf/LabelSegment.html" title="class in nitf">LabelSegment</A>
<BR>
<A HREF="nitf/LabelSubheader.html" title="class in nitf">LabelSubheader</A>
<BR>
<A HREF="nitf/LookupTable.html" title="class in nitf">LookupTable</A>
<BR>
<A HREF="nitf/MaxDownSampler.html" title="class in nitf">MaxDownSampler</A>
<BR>
<A HREF="nitf/MemoryIO.html" title="class in nitf">MemoryIO</A>
<BR>
<A HREF="nitf/MemorySource.html" title="class in nitf">MemorySource</A>
<BR>
<A HREF="nitf/NativeIOInterface.html" title="class in nitf">NativeIOInterface</A>
<BR>
<A HREF="nitf/NITFException.html" title="class in nitf">NITFException</A>
<BR>
<A HREF="nitf/NITFObject.html" title="class in nitf">NITFObject</A>
<BR>
<A HREF="nitf/NITFResourceManager.html" title="class in nitf">NITFResourceManager</A>
<BR>
<A HREF="nitf/PixelSkipDownSampler.html" title="class in nitf">PixelSkipDownSampler</A>
<BR>
<A HREF="nitf/PluginRegistry.html" title="class in nitf">PluginRegistry</A>
<BR>
<A HREF="nitf/Reader.html" title="class in nitf">Reader</A>
<BR>
<A HREF="nitf/Record.html" title="class in nitf">Record</A>
<BR>
<A HREF="nitf/RESegment.html" title="class in nitf">RESegment</A>
<BR>
<A HREF="nitf/RESubheader.html" title="class in nitf">RESubheader</A>
<BR>
<A HREF="nitf/SegmentReader.html" title="class in nitf">SegmentReader</A>
<BR>
<A HREF="nitf/SegmentSource.html" title="class in nitf">SegmentSource</A>
<BR>
<A HREF="nitf/SegmentWriter.html" title="class in nitf">SegmentWriter</A>
<BR>
<A HREF="nitf/StreamIOWriteHandler.html" title="class in nitf">StreamIOWriteHandler</A>
<BR>
<A HREF="nitf/SubWindow.html" title="class in nitf">SubWindow</A>
<BR>
<A HREF="nitf/SumSq2BandDownSampler.html" title="class in nitf">SumSq2BandDownSampler</A>
<BR>
<A HREF="nitf/TextSegment.html" title="class in nitf">TextSegment</A>
<BR>
<A HREF="nitf/TextSubheader.html" title="class in nitf">TextSubheader</A>
<BR>
<A HREF="nitf/TRE.html" title="class in nitf">TRE</A>
<BR>
<A HREF="nitf/TRE.FieldPair.html" title="class in nitf">TRE.FieldPair</A>
<BR>
<A HREF="nitf/Version.html" title="enum in nitf">Version</A>
<BR>
<A HREF="nitf/WriteHandler.html" title="class in nitf">WriteHandler</A>
<BR>
<A HREF="nitf/Writer.html" title="class in nitf">Writer</A>
<BR>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|
lgpl-3.0
|
OpenDA-Association/OpenDA
|
model_hspf/java/src/org/openda/model_hspf/WdmTimeSeriesIoObject.java
|
16319
|
/* MOD_V2.0
* Copyright (c) 2012 OpenDA Association
* All rights reserved.
*
* This file is part of OpenDA.
*
* OpenDA 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 (at your option) any later version.
*
* OpenDA 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 OpenDA. If not, see <http://www.gnu.org/licenses/>.
*/
package org.openda.model_hspf;
import java.io.File;
import java.text.ParseException;
import java.util.*;
import org.openda.blackbox.interfaces.IoObjectInterface;
import org.openda.exchange.DoubleExchangeItem;
import org.openda.exchange.timeseries.TimeUtils;
import org.openda.interfaces.IExchangeItem;
import org.openda.interfaces.IExchangeItem.Role;
import org.openda.utils.Results;
/**
* IoObject for one WDM (Watershed Data Management) file.
*
* See http://water.usgs.gov/cgi-bin/man_wrdapp?wdm(1) :
* A WDM file is a binary, direct-access file used to store
* hydrologic, hydraulic, meteorologic, water-quality, and
* physiographic data. The WDM file is organized into data
* sets (DSN = Data Set Number). Each data set contains a specific type of data, such
* as streamflow at a specific site or air temperature at a
* weather station. Each data set contains attributes that
* describe the data, such as station identification number,
* time step of data, latitude, and longitude. A WDM file may
* contain a single data set or as many as 200,000 data sets.
* A data set may be described by a few attributes or by
* hundreds of attributes. Data can be added, deleted, and
* modified without restructuring the data in the file. Space
* from deleted data sets is reused.
*
* To manually open and edit a wdm file use WDMUtil, which
* is installed as part of the BASINS package, which is available from:
* http://water.epa.gov/scitech/datait/models/basins/index.cfm
*
* The HSPF model can be installed as part of the BASINS package,
* which is available from:
* http://water.epa.gov/scitech/datait/models/basins/index.cfm
*
* @author Arno Kockx
*/
@Deprecated
//use WdmTimeSeriesDataObject instead.
public class WdmTimeSeriesIoObject implements IoObjectInterface {
/**
* The timeZone that is used by the model.
* This is required to convert the times of the data values
* to/from the timeZone that is used by the model.
* Default is GMT.
*/
private TimeZone timeZone = TimeZone.getTimeZone("GMT");
/**
* Absolute path name of the file containing the data for this IoObject.
*/
private String wdmTimeSeriesFilePath;
private int wdmTimeSeriesFileNumber;
/**
* Absolute path name of the wdm message file.
* The wdm message file is required for the fortran wdm library
* methods to work properly.
*/
private String wdmMessageFilePath;
private WdmDll wdmDll;
private Role role;
private IExchangeItem startTimeExchangeItem = null;
private IExchangeItem endTimeExchangeItem = null;
private double startTimeDouble = Double.NaN;
private double endTimeDouble = Double.NaN;
private List<WdmTimeSeriesExchangeItem> wdmTimeSeriesExchangeItems = new ArrayList<WdmTimeSeriesExchangeItem>();
/**
* @param workingDir the working directory.
* @param fileName the pathname of the file containing the data for this IoObject (relative to the working directory).
* @param arguments the first argument should be the pathname of the wdm.dll file (relative to the working directory),
* the second argument should be the pathname of the message file (relative to working directory),
* the third argument should be the role of this IoObject. Role can be 'input' or 'output',
* the fourth argument should be the timeZone that is used by the model (in hours with respect to GMT, between -12 and 12),
* for role INPUT the fifth and sixth arguments should be the ids of the startTime and endTime exchangeItems respectively,
* for role OUTPUT the fifth and sixth arguments should be respectively the startTime and endTime of the model run,
* the (optional) seventh and further arguments should be the location and parameter ids of the time series for which exchange items should be made,
* if no seventh and further arguments present then exchange items will be created for all time series in the file.
*/
public void initialize(File workingDir, String fileName, String[] arguments) {
//initialize wdmTimeSeriesFilePath.
File wdmTimeSeriesFile = new File(workingDir, fileName);
if (!wdmTimeSeriesFile.exists()) {
throw new IllegalArgumentException(getClass().getSimpleName() + ": Time series file '" + wdmTimeSeriesFile.getAbsolutePath() + "' does not exist.");
}
this.wdmTimeSeriesFilePath = wdmTimeSeriesFile.getAbsolutePath();
//create a unique fortran file unit number to use for the wdmTimeSeriesFile.
this.wdmTimeSeriesFileNumber = WdmUtils.generateUniqueFortranFileUnitNumber();
//initialize wdmDll.
if (arguments == null || arguments.length < 1) {
throw new IllegalArgumentException(getClass().getSimpleName() + ": No arguments specified. The first argument should be the path of the wdm.dll file (relative to working directory).");
}
this.wdmDll = WdmUtils.initializeWdmDll(workingDir, arguments[0]);
//initialize wdmMessageFilePath.
if (arguments.length < 2) {
throw new IllegalArgumentException(getClass().getSimpleName() + ": No arguments specified. The second argument should be the path of the message file (relative to working directory).");
}
this.wdmMessageFilePath = WdmUtils.initializeWdmMessageFilePath(workingDir, arguments[1]);
//initialize role.
if (arguments.length < 3) {
throw new IllegalArgumentException(getClass().getSimpleName() + ": No role argument specified. The third argument should be the role of this IoObject. Role can be 'input' or 'output'.");
}
this.role = WdmUtils.initializeRole(arguments[2]);
//get timeZone.
if (arguments.length < 4) {
throw new IllegalArgumentException("No timeZone argument specified for " + getClass().getSimpleName()
+ ". The fourth argument should be the timeZone that is used by the model (in hours with respect to GMT, between -12 and 12).");
}
try {
double timeZoneOffsetInHours = Double.parseDouble(arguments[3]);
this.timeZone = TimeUtils.createTimeZoneFromDouble(timeZoneOffsetInHours);
} catch (Exception e) {
throw new IllegalArgumentException("Cannot parse fourth argument '" + arguments[3] + "' for " + getClass().getSimpleName()
+ ". The fourth argument should be the timeZone that is used by the model (in hours with respect to GMT, between -12 and 12).", e);
}
//this object can be used for either input or output. In both cases the run startTime and endTime
//are needed. However the timeInfoExchangeItems are only set for input ioObjects (see BBModelInstance.compute)
//and the aliases are only available for output ioObjects (because the aliases are set after the input ioObjects
//have already been initialized). Therefore depending on the role use different arguments to get the
//startTime and endTime here.
//Note: the timeInfoExchangeItems are also set after the input ioObjects have already been initialized,
//but the timeInfoExchangeItems need only be created during ioObject initialization and can then be
//used later, after they have been set.
if (this.role == Role.Input) {
//create exchange items.
if (arguments.length < 6) {
throw new IllegalArgumentException("No start/endTime exchange item ids arguments specified for " + getClass().getSimpleName()
+ ". For role INPUT the fifth and sixth arguments should be the ids of the startTime and endTime exchangeItems respectively.");
}
//get start and end time.
this.startTimeExchangeItem = new DoubleExchangeItem(arguments[4], 0);
this.endTimeExchangeItem = new DoubleExchangeItem(arguments[5], 0);
} else {
if (arguments.length < 6) {
throw new IllegalArgumentException("No start/endTime arguments specified for " + getClass().getSimpleName()
+ ". For role OUTPUT the fifth and sixth arguments should be respectively the startTime and endTime of the model run.");
}
//get start time.
try {
this.startTimeDouble = TimeUtils.date2Mjd(arguments[4]);
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid startTime argument specified for " + getClass().getSimpleName()
+ ". Cannot parse fifth argument '" + arguments[4] + "'. For role OUTPUT the fifth and sixth arguments should be respectively the startTime and endTime of the model run.", e);
}
//get end time.
try {
this.endTimeDouble = TimeUtils.date2Mjd(arguments[5]);
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid endTime argument specified for " + getClass().getSimpleName()
+ ". Cannot parse sixth argument '" + arguments[5] + "'. For role OUTPUT the fifth and sixth arguments should be respectively the startTime and endTime of the model run.", e);
}
}
//initialize wdmTimeSeriesExchangeItems.
if (arguments.length < 7) {
Results.putMessage(getClass().getSimpleName() + ": No time series ids arguments specified. Exchange items will be created for all time series in the file.");
createWdmTimeSeriesExchangeItemsFromFile();
} else {
//create exchange items for specified time series only.
Results.putMessage(getClass().getSimpleName() + ": Time series ids arguments specified. Exchange items will be created for specified time series ids only.");
String[] timeSeriesIdList = Arrays.copyOfRange(arguments, 6, arguments.length);
createWdmTimeSeriesExchangeItemsFromList(timeSeriesIdList);
}
//read all values for all exchangeItems in one go, so that not needed to open/close same file for each read separately.
readValuesAndTimesFromFile();
}
private void createWdmTimeSeriesExchangeItemsFromList(String[] timeSeriesIdList) {
//reset this.timeSeriesExchangeItems list.
this.wdmTimeSeriesExchangeItems.clear();
//create exchange items for all time series ids in the list.
WdmUtils.openWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber, this.wdmTimeSeriesFilePath, this.wdmMessageFilePath);
this.wdmTimeSeriesExchangeItems.addAll(WdmUtils.createExchangeItemsFromList(this.wdmDll, this.wdmTimeSeriesFileNumber, this.wdmTimeSeriesFilePath, this.role, timeSeriesIdList));
WdmUtils.closeWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber);
if (this.wdmTimeSeriesExchangeItems.isEmpty()) throw new IllegalStateException(this.getClass().getSimpleName() + ": this.wdmTimeSeriesExchangeItems.isEmpty()");
}
private void createWdmTimeSeriesExchangeItemsFromFile() {
//reset this.timeSeriesExchangeItems list.
this.wdmTimeSeriesExchangeItems.clear();
//create exchange items for all time series in the file.
WdmUtils.openWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber, this.wdmTimeSeriesFilePath, this.wdmMessageFilePath);
this.wdmTimeSeriesExchangeItems.addAll(WdmUtils.createExchangeItemsFromFile(this.wdmDll, this.wdmTimeSeriesFileNumber, this.role));
WdmUtils.closeWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber);
if (this.wdmTimeSeriesExchangeItems.isEmpty()) throw new IllegalArgumentException(this.getClass().getSimpleName() + ": No time series found in time series file '" + this.wdmTimeSeriesFilePath + "'.");
}
public IExchangeItem[] getExchangeItems() {
//return all available exchange items.
List<IExchangeItem> exchangeItems = new ArrayList<IExchangeItem>(this.wdmTimeSeriesExchangeItems);
if (this.startTimeExchangeItem != null && this.endTimeExchangeItem != null) {
exchangeItems.add(this.startTimeExchangeItem);
exchangeItems.add(this.endTimeExchangeItem);
}
return exchangeItems.toArray(new IExchangeItem[exchangeItems.size()]);
}
/**
* If this IoObject has role Output (i.e. output from the model), then this method
* reads the data from the wdm file and stores it in the wdmTimeSeriesExchangeItems
* in this IoObject.
*
* Updates the in-memory stored values and times by reading from the wdm file.
*/
private void readValuesAndTimesFromFile() {
if (this.role == Role.Input) {
return;
}
if (Double.isNaN(this.startTimeDouble) || Double.isNaN(this.endTimeDouble)) {
throw new IllegalStateException(getClass().getSimpleName() + " not initialized yet.");
}
Results.putMessage(getClass().getSimpleName() + ": reading " + this.wdmTimeSeriesExchangeItems.size()
+ " output time series from file " + this.wdmTimeSeriesFilePath + " with fortran unit number " + this.wdmTimeSeriesFileNumber + ".");
//open wdm file.
WdmUtils.openWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber, this.wdmTimeSeriesFilePath, this.wdmMessageFilePath);
for (WdmTimeSeriesExchangeItem wdmTimeSeriesExchangeItem : this.wdmTimeSeriesExchangeItems) {
//read data from file and set in wdmTimeSeriesExchangeItem.
WdmUtils.readTimesAndValues(this.wdmDll, this.wdmTimeSeriesFileNumber, this.wdmTimeSeriesFilePath, wdmTimeSeriesExchangeItem, this.startTimeDouble, this.endTimeDouble, this.timeZone);
}
//close wdm file.
WdmUtils.closeWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber);
}
/**
* If this IoObject has role Input (i.e. input for the model), then this method writes the data
* from all wdmTimeSeriesExchangeItems in this IoObject to the wdm file
* so that it can be used as input by the model.
*/
public void finish() {
if (this.role == Role.Output) {
return;
}
if (this.startTimeExchangeItem == null || this.endTimeExchangeItem == null) {
throw new IllegalStateException(getClass().getSimpleName() + " not initialized yet.");
}
Results.putMessage(getClass().getSimpleName() + ": writing " + this.wdmTimeSeriesExchangeItems.size()
+ " input time series to file " + this.wdmTimeSeriesFilePath + " with fortran unit number " + this.wdmTimeSeriesFileNumber + ".");
//get start and end times.
double startTime = (Double) this.startTimeExchangeItem.getValues();
double endTime = (Double) this.endTimeExchangeItem.getValues();
//open wdm file.
WdmUtils.openWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber, this.wdmTimeSeriesFilePath, this.wdmMessageFilePath);
for (WdmTimeSeriesExchangeItem wdmTimeSeriesExchangeItem : this.wdmTimeSeriesExchangeItems) {
//write data from wdmTimeSeriesExchangeItem to file.
WdmUtils.writeTimesAndValues(this.wdmDll, this.wdmTimeSeriesFileNumber, this.wdmTimeSeriesFilePath, wdmTimeSeriesExchangeItem, startTime, endTime, this.timeZone);
}
//close wdm file.
WdmUtils.closeWdmFile(this.wdmDll, this.wdmTimeSeriesFileNumber);
}
}
|
lgpl-3.0
|
pcolby/libqtaws
|
src/codecommit/updatepullrequestapprovalrulecontentrequest.h
|
1564
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_UPDATEPULLREQUESTAPPROVALRULECONTENTREQUEST_H
#define QTAWS_UPDATEPULLREQUESTAPPROVALRULECONTENTREQUEST_H
#include "codecommitrequest.h"
namespace QtAws {
namespace CodeCommit {
class UpdatePullRequestApprovalRuleContentRequestPrivate;
class QTAWSCODECOMMIT_EXPORT UpdatePullRequestApprovalRuleContentRequest : public CodeCommitRequest {
public:
UpdatePullRequestApprovalRuleContentRequest(const UpdatePullRequestApprovalRuleContentRequest &other);
UpdatePullRequestApprovalRuleContentRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(UpdatePullRequestApprovalRuleContentRequest)
};
} // namespace CodeCommit
} // namespace QtAws
#endif
|
lgpl-3.0
|
pcolby/libqtaws
|
src/route53resolver/getfirewalldomainlistrequest.h
|
1469
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_GETFIREWALLDOMAINLISTREQUEST_H
#define QTAWS_GETFIREWALLDOMAINLISTREQUEST_H
#include "route53resolverrequest.h"
namespace QtAws {
namespace Route53Resolver {
class GetFirewallDomainListRequestPrivate;
class QTAWSROUTE53RESOLVER_EXPORT GetFirewallDomainListRequest : public Route53ResolverRequest {
public:
GetFirewallDomainListRequest(const GetFirewallDomainListRequest &other);
GetFirewallDomainListRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(GetFirewallDomainListRequest)
};
} // namespace Route53Resolver
} // namespace QtAws
#endif
|
lgpl-3.0
|
queueit/QueueIT.Security-JavaEE
|
QueueIT.Security/src/queueit/security/uribuilder/ObjectUtils.java
|
27162
|
/*
* Copyright 2002-2013 the original author or 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 queueit.security.uribuilder;
import java.lang.reflect.Array;
import java.util.Arrays;
/**
* Miscellaneous object utility methods.
*
* <p>Mainly for internal use within the framework; consider
* <a href="http://jakarta.apache.org/commons/lang/">Jakarta's Commons Lang</a>
* for a more comprehensive suite of object utilities.
*
* <p>Thanks to Alex Ruiz for contributing several enhancements to this class!
*
* @author Juergen Hoeller
* @author Keith Donald
* @author Rod Johnson
* @author Rob Harrop
* @author Chris Beams
* @since 19.03.2004
* @see org.apache.commons.lang.ObjectUtils
*/
public abstract class ObjectUtils {
private static final int INITIAL_HASH = 7;
private static final int MULTIPLIER = 31;
private static final String EMPTY_STRING = "";
private static final String NULL_STRING = "null";
private static final String ARRAY_START = "{";
private static final String ARRAY_END = "}";
private static final String EMPTY_ARRAY = ARRAY_START + ARRAY_END;
private static final String ARRAY_ELEMENT_SEPARATOR = ", ";
/**
* Return whether the given throwable is a checked exception:
* that is, neither a RuntimeException nor an Error.
* @param ex the throwable to check
* @return whether the throwable is a checked exception
* @see java.lang.Exception
* @see java.lang.RuntimeException
* @see java.lang.Error
*/
public static boolean isCheckedException(Throwable ex) {
return !(ex instanceof RuntimeException || ex instanceof Error);
}
/**
* Check whether the given exception is compatible with the exceptions
* declared in a throws clause.
* @param ex the exception to checked
* @param declaredExceptions the exceptions declared in the throws clause
* @return whether the given exception is compatible
*/
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class[] declaredExceptions) {
if (!isCheckedException(ex)) {
return true;
}
if (declaredExceptions != null) {
int i = 0;
while (i < declaredExceptions.length) {
if (declaredExceptions[i].isAssignableFrom(ex.getClass())) {
return true;
}
i++;
}
}
return false;
}
/**
* Determine whether the given object is an array:
* either an Object array or a primitive array.
* @param obj the object to check
*/
public static boolean isArray(Object obj) {
return (obj != null && obj.getClass().isArray());
}
/**
* Determine whether the given array is empty:
* i.e. {@code null} or of zero length.
* @param array the array to check
*/
public static boolean isEmpty(Object[] array) {
return (array == null || array.length == 0);
}
/**
* Check whether the given array contains the given element.
* @param array the array to check (may be {@code null},
* in which case the return value will always be {@code false})
* @param element the element to check for
* @return whether the element has been found in the given array
*/
public static boolean containsElement(Object[] array, Object element) {
if (array == null) {
return false;
}
for (Object arrayEle : array) {
if (nullSafeEquals(arrayEle, element)) {
return true;
}
}
return false;
}
/**
* Check whether the given array of enum constants contains a constant with the given name,
* ignoring case when determining a match.
* @param enumValues the enum values to check, typically the product of a call to MyEnum.values()
* @param constant the constant name to find (must not be null or empty string)
* @return whether the constant has been found in the given array
*/
public static boolean containsConstant(Enum<?>[] enumValues, String constant) {
return containsConstant(enumValues, constant, false);
}
/**
* Check whether the given array of enum constants contains a constant with the given name.
* @param enumValues the enum values to check, typically the product of a call to MyEnum.values()
* @param constant the constant name to find (must not be null or empty string)
* @param caseSensitive whether case is significant in determining a match
* @return whether the constant has been found in the given array
*/
public static boolean containsConstant(Enum<?>[] enumValues, String constant, boolean caseSensitive) {
for (Enum<?> candidate : enumValues) {
if (caseSensitive ?
candidate.toString().equals(constant) :
candidate.toString().equalsIgnoreCase(constant)) {
return true;
}
}
return false;
}
/**
* Case insensitive alternative to {@link Enum#valueOf(Class, String)}.
* @param <E> the concrete Enum type
* @param enumValues the array of all Enum constants in question, usually per Enum.values()
* @param constant the constant to get the enum value of
* @throws IllegalArgumentException if the given constant is not found in the given array
* of enum values. Use {@link #containsConstant(Enum[], String)} as a guard to avoid this exception.
*/
public static <E extends Enum<?>> E caseInsensitiveValueOf(E[] enumValues, String constant) {
for (E candidate : enumValues) {
if(candidate.toString().equalsIgnoreCase(constant)) {
return candidate;
}
}
throw new IllegalArgumentException(
String.format("constant [%s] does not exist in enum type %s",
constant, enumValues.getClass().getComponentType().getName()));
}
/**
* Append the given object to the given array, returning a new array
* consisting of the input array contents plus the given object.
* @param array the array to append to (can be {@code null})
* @param obj the object to append
* @return the new array (of the same component type; never {@code null})
*/
public static <A,O extends A> A[] addObjectToArray(A[] array, O obj) {
Class<?> compType = Object.class;
if (array != null) {
compType = array.getClass().getComponentType();
}
else if (obj != null) {
compType = obj.getClass();
}
int newArrLength = (array != null ? array.length + 1 : 1);
@SuppressWarnings("unchecked")
A[] newArr = (A[]) Array.newInstance(compType, newArrLength);
if (array != null) {
System.arraycopy(array, 0, newArr, 0, array.length);
}
newArr[newArr.length - 1] = obj;
return newArr;
}
/**
* Convert the given array (which may be a primitive array) to an
* object array (if necessary of primitive wrapper objects).
* <p>A {@code null} source value will be converted to an
* empty Object array.
* @param source the (potentially primitive) array
* @return the corresponding object array (never {@code null})
* @throws IllegalArgumentException if the parameter is not an array
*/
public static Object[] toObjectArray(Object source) {
if (source instanceof Object[]) {
return (Object[]) source;
}
if (source == null) {
return new Object[0];
}
if (!source.getClass().isArray()) {
throw new IllegalArgumentException("Source is not an array: " + source);
}
int length = Array.getLength(source);
if (length == 0) {
return new Object[0];
}
Class wrapperType = Array.get(source, 0).getClass();
Object[] newArray = (Object[]) Array.newInstance(wrapperType, length);
for (int i = 0; i < length; i++) {
newArray[i] = Array.get(source, i);
}
return newArray;
}
//---------------------------------------------------------------------
// Convenience methods for content-based equality/hash-code handling
//---------------------------------------------------------------------
/**
* Determine if the given objects are equal, returning {@code true}
* if both are {@code null} or {@code false} if only one is
* {@code null}.
* <p>Compares arrays with {@code Arrays.equals}, performing an equality
* check based on the array elements rather than the array reference.
* @param o1 first Object to compare
* @param o2 second Object to compare
* @return whether the given objects are equal
* @see java.util.Arrays#equals
*/
public static boolean nullSafeEquals(Object o1, Object o2) {
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
if (o1.equals(o2)) {
return true;
}
if (o1.getClass().isArray() && o2.getClass().isArray()) {
if (o1 instanceof Object[] && o2 instanceof Object[]) {
return Arrays.equals((Object[]) o1, (Object[]) o2);
}
if (o1 instanceof boolean[] && o2 instanceof boolean[]) {
return Arrays.equals((boolean[]) o1, (boolean[]) o2);
}
if (o1 instanceof byte[] && o2 instanceof byte[]) {
return Arrays.equals((byte[]) o1, (byte[]) o2);
}
if (o1 instanceof char[] && o2 instanceof char[]) {
return Arrays.equals((char[]) o1, (char[]) o2);
}
if (o1 instanceof double[] && o2 instanceof double[]) {
return Arrays.equals((double[]) o1, (double[]) o2);
}
if (o1 instanceof float[] && o2 instanceof float[]) {
return Arrays.equals((float[]) o1, (float[]) o2);
}
if (o1 instanceof int[] && o2 instanceof int[]) {
return Arrays.equals((int[]) o1, (int[]) o2);
}
if (o1 instanceof long[] && o2 instanceof long[]) {
return Arrays.equals((long[]) o1, (long[]) o2);
}
if (o1 instanceof short[] && o2 instanceof short[]) {
return Arrays.equals((short[]) o1, (short[]) o2);
}
}
return false;
}
/**
* Return as hash code for the given object; typically the value of
* {@code {@link Object#hashCode()}}. If the object is an array,
* this method will delegate to any of the {@code nullSafeHashCode}
* methods for arrays in this class. If the object is {@code null},
* this method returns 0.
* @see #nullSafeHashCode(Object[])
* @see #nullSafeHashCode(boolean[])
* @see #nullSafeHashCode(byte[])
* @see #nullSafeHashCode(char[])
* @see #nullSafeHashCode(double[])
* @see #nullSafeHashCode(float[])
* @see #nullSafeHashCode(int[])
* @see #nullSafeHashCode(long[])
* @see #nullSafeHashCode(short[])
*/
public static int nullSafeHashCode(Object obj) {
if (obj == null) {
return 0;
}
if (obj.getClass().isArray()) {
if (obj instanceof Object[]) {
return nullSafeHashCode((Object[]) obj);
}
if (obj instanceof boolean[]) {
return nullSafeHashCode((boolean[]) obj);
}
if (obj instanceof byte[]) {
return nullSafeHashCode((byte[]) obj);
}
if (obj instanceof char[]) {
return nullSafeHashCode((char[]) obj);
}
if (obj instanceof double[]) {
return nullSafeHashCode((double[]) obj);
}
if (obj instanceof float[]) {
return nullSafeHashCode((float[]) obj);
}
if (obj instanceof int[]) {
return nullSafeHashCode((int[]) obj);
}
if (obj instanceof long[]) {
return nullSafeHashCode((long[]) obj);
}
if (obj instanceof short[]) {
return nullSafeHashCode((short[]) obj);
}
}
return obj.hashCode();
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(Object[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + nullSafeHashCode(array[i]);
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(boolean[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + hashCode(array[i]);
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(byte[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + array[i];
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(char[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + array[i];
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(double[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + hashCode(array[i]);
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(float[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + hashCode(array[i]);
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(int[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + array[i];
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(long[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + hashCode(array[i]);
}
return hash;
}
/**
* Return a hash code based on the contents of the specified array.
* If {@code array} is {@code null}, this method returns 0.
*/
public static int nullSafeHashCode(short[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
int arraySize = array.length;
for (int i = 0; i < arraySize; i++) {
hash = MULTIPLIER * hash + array[i];
}
return hash;
}
/**
* Return the same value as {@link Boolean#hashCode()}}.
* @see Boolean#hashCode()
*/
public static int hashCode(boolean bool) {
return bool ? 1231 : 1237;
}
/**
* Return the same value as {@link Double#hashCode()}}.
* @see Double#hashCode()
*/
public static int hashCode(double dbl) {
long bits = Double.doubleToLongBits(dbl);
return hashCode(bits);
}
/**
* Return the same value as {@link Float#hashCode()}}.
* @see Float#hashCode()
*/
public static int hashCode(float flt) {
return Float.floatToIntBits(flt);
}
/**
* Return the same value as {@link Long#hashCode()}}.
* @see Long#hashCode()
*/
public static int hashCode(long lng) {
return (int) (lng ^ (lng >>> 32));
}
//---------------------------------------------------------------------
// Convenience methods for toString output
//---------------------------------------------------------------------
/**
* Return a String representation of an object's overall identity.
* @param obj the object (may be {@code null})
* @return the object's identity as String representation,
* or an empty String if the object was {@code null}
*/
public static String identityToString(Object obj) {
if (obj == null) {
return EMPTY_STRING;
}
return obj.getClass().getName() + "@" + getIdentityHexString(obj);
}
/**
* Return a hex String form of an object's identity hash code.
* @param obj the object
* @return the object's identity code in hex notation
*/
public static String getIdentityHexString(Object obj) {
return Integer.toHexString(System.identityHashCode(obj));
}
/**
* Return a content-based String representation if {@code obj} is
* not {@code null}; otherwise returns an empty String.
* <p>Differs from {@link #nullSafeToString(Object)} in that it returns
* an empty String rather than "null" for a {@code null} value.
* @param obj the object to build a display String for
* @return a display String representation of {@code obj}
* @see #nullSafeToString(Object)
*/
public static String getDisplayString(Object obj) {
if (obj == null) {
return EMPTY_STRING;
}
return nullSafeToString(obj);
}
/**
* Determine the class name for the given object.
* <p>Returns {@code "null"} if {@code obj} is {@code null}.
* @param obj the object to introspect (may be {@code null})
* @return the corresponding class name
*/
public static String nullSafeClassName(Object obj) {
return (obj != null ? obj.getClass().getName() : NULL_STRING);
}
/**
* Return a String representation of the specified Object.
* <p>Builds a String representation of the contents in case of an array.
* Returns {@code "null"} if {@code obj} is {@code null}.
* @param obj the object to build a String representation for
* @return a String representation of {@code obj}
*/
public static String nullSafeToString(Object obj) {
if (obj == null) {
return NULL_STRING;
}
if (obj instanceof String) {
return (String) obj;
}
if (obj instanceof Object[]) {
return nullSafeToString((Object[]) obj);
}
if (obj instanceof boolean[]) {
return nullSafeToString((boolean[]) obj);
}
if (obj instanceof byte[]) {
return nullSafeToString((byte[]) obj);
}
if (obj instanceof char[]) {
return nullSafeToString((char[]) obj);
}
if (obj instanceof double[]) {
return nullSafeToString((double[]) obj);
}
if (obj instanceof float[]) {
return nullSafeToString((float[]) obj);
}
if (obj instanceof int[]) {
return nullSafeToString((int[]) obj);
}
if (obj instanceof long[]) {
return nullSafeToString((long[]) obj);
}
if (obj instanceof short[]) {
return nullSafeToString((short[]) obj);
}
String str = obj.toString();
return (str != null ? str : EMPTY_STRING);
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(Object[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(String.valueOf(array[i]));
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(boolean[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(array[i]);
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(byte[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(array[i]);
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(char[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append("'").append(array[i]).append("'");
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(double[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(array[i]);
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(float[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(array[i]);
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(int[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(array[i]);
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(long[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(array[i]);
}
sb.append(ARRAY_END);
return sb.toString();
}
/**
* Return a String representation of the contents of the specified array.
* <p>The String representation consists of a list of the array's elements,
* enclosed in curly braces ({@code "{}"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Returns
* {@code "null"} if {@code array} is {@code null}.
* @param array the array to build a String representation for
* @return a String representation of {@code array}
*/
public static String nullSafeToString(short[] array) {
if (array == null) {
return NULL_STRING;
}
int length = array.length;
if (length == 0) {
return EMPTY_ARRAY;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
if (i == 0) {
sb.append(ARRAY_START);
}
else {
sb.append(ARRAY_ELEMENT_SEPARATOR);
}
sb.append(array[i]);
}
sb.append(ARRAY_END);
return sb.toString();
}
}
|
lgpl-3.0
|
fashiontec/bodyapps-android
|
app/src/main/java/org/fashiontec/bodyapps/sync/Sync.java
|
5676
|
/*
* Copyright (c) 2014, Fashiontec (http://fashiontec.org)
* Licensed under LGPL, Version 3
*/
package org.fashiontec.bodyapps.sync;
import android.util.Log;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Class to handle main sync methods
*/
public class Sync {
static final String TAG = Sync.class.getName();
protected String baseURL = "http://freelayers.org"; //base URL of the API
public void setBaseURL(String baseURL) {
this.baseURL = baseURL;
}
/**
* Method which makes all the post calls
*
* @param url
* @param json
* @return
*/
public HttpResponse post(String url, String json, int conTimeOut, int socTimeOut) {
HttpResponse response = null;
try {
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, conTimeOut);
HttpConnectionParams.setSoTimeout(httpParameters, socTimeOut);
HttpClient httpclient = new DefaultHttpClient(httpParameters);
HttpPost httpPost = new HttpPost(url);
StringEntity se = new StringEntity(json);
httpPost.setEntity(se);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
response = httpclient.execute(httpPost);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
return response;
}
/**
* Downloads a file from given URL.
*
* @param url
* @param file
* @return
*/
public int download(String url, String file) {
try {
URL u = new URL(url);
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setConnectTimeout(2000);
c.setRequestProperty("Accept", "application/vnd.valentina.hdf");
c.connect();
FileOutputStream f = new FileOutputStream(new File(file));
InputStream in = c.getInputStream();
//download code
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = in.read(buffer)) > 0) {
f.write(buffer, 0, len1);
}
f.close();
} catch (Exception e) {
Log.e(TAG, e.getMessage());
return -1;
}
return 1;
}
/**
* Manages get requests.
*
* @param url
* @param conTimeOut
* @param socTimeOut
* @return
*/
public HttpResponse get(String url, int conTimeOut, int socTimeOut) {
HttpResponse response = null;
try {
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, conTimeOut);
HttpConnectionParams.setSoTimeout(httpParameters, socTimeOut);
HttpClient client = new DefaultHttpClient(httpParameters);
HttpGet request = new HttpGet(url);
request.setHeader("Accept", "application/json");
response = client.execute(request);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
return response;
}
/**
* Manages put requests
*
* @param url
* @param json
* @param conTimeOut
* @param socTimeOut
* @return
*/
public HttpResponse put(String url, String json, int conTimeOut, int socTimeOut) {
HttpResponse response = null;
try {
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, conTimeOut);
HttpConnectionParams.setSoTimeout(httpParameters, socTimeOut);
HttpClient client = new DefaultHttpClient(httpParameters);
HttpPut request = new HttpPut(url);
StringEntity se = new StringEntity(json);
request.setEntity(se);
request.setHeader("Accept", "application/json");
request.setHeader("Content-type", "application/json");
response = client.execute(request);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
return response;
}
/**
* Manages delete requests.
*
* @param url
* @param conTimeOut
* @param socTimeOut
* @return
*/
public HttpResponse DELETE(String url, int conTimeOut, int socTimeOut) {
HttpResponse response = null;
try {
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, conTimeOut);
HttpConnectionParams.setSoTimeout(httpParameters, socTimeOut);
HttpClient client = new DefaultHttpClient(httpParameters);
HttpDelete request = new HttpDelete(url);
request.setHeader("Accept", "application/json");
response = client.execute(request);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
return response;
}
}
|
lgpl-3.0
|
kyungtaekLIM/PSI-BLASTexB
|
src/ncbi-blast-2.5.0+/c++/src/objects/seqfeat/MultiOrgName.cpp
|
1860
|
/* $Id$
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Author: .......
*
* File Description:
* .......
*
* Remark:
* This code was originally generated by application DATATOOL
* using the following specifications:
* 'seqfeat.asn'.
*/
// standard includes
#include <ncbi_pch.hpp>
// generated includes
#include <objects/seqfeat/MultiOrgName.hpp>
// generated classes
BEGIN_NCBI_SCOPE
BEGIN_objects_SCOPE // namespace ncbi::objects::
// destructor
CMultiOrgName::~CMultiOrgName(void)
{
}
END_objects_SCOPE // namespace ncbi::objects::
END_NCBI_SCOPE
/* Original file checksum: lines: 57, chars: 1733, CRC32: 90d381d7 */
|
lgpl-3.0
|
grappendorf/arduino-framework
|
EasyVR/docs/html/functions.html
|
16363
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>EasyVR Library: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
</ul>
</div>
<div class="tabs2">
<ul class="tablist">
<li class="current"><a href="functions.html"><span>All</span></a></li>
<li><a href="functions_func.html"><span>Functions</span></a></li>
<li><a href="functions_enum.html"><span>Enumerations</span></a></li>
<li><a href="functions_eval.html"><span>Enumerator</span></a></li>
</ul>
</div>
<div class="tabs3">
<ul class="tablist">
<li><a href="#index_a"><span>a</span></a></li>
<li><a href="#index_b"><span>b</span></a></li>
<li><a href="#index_c"><span>c</span></a></li>
<li><a href="#index_d"><span>d</span></a></li>
<li><a href="#index_e"><span>e</span></a></li>
<li><a href="#index_f"><span>f</span></a></li>
<li><a href="#index_g"><span>g</span></a></li>
<li><a href="#index_h"><span>h</span></a></li>
<li><a href="#index_i"><span>i</span></a></li>
<li><a href="#index_j"><span>j</span></a></li>
<li><a href="#index_k"><span>k</span></a></li>
<li><a href="#index_l"><span>l</span></a></li>
<li><a href="#index_m"><span>m</span></a></li>
<li><a href="#index_n"><span>n</span></a></li>
<li><a href="#index_o"><span>o</span></a></li>
<li><a href="#index_p"><span>p</span></a></li>
<li><a href="#index_r"><span>r</span></a></li>
<li><a href="#index_s"><span>s</span></a></li>
<li><a href="#index_t"><span>t</span></a></li>
<li><a href="#index_v"><span>v</span></a></li>
<li><a href="#index_w"><span>w</span></a></li>
</ul>
</div>
</div>
<div class="contents">
Here is a list of all documented class members with links to the class documentation for each member:
<h3><a class="anchor" id="index_a"></a>- a -</h3><ul>
<li>ACTION_SET
: <a class="el" href="class_easy_v_r.html#adb75a7e43d0b92f054005f2446a1603da154ca49b33f5554087af25f1d0e4443f">EasyVR</a>
</li>
<li>addCommand()
: <a class="el" href="class_easy_v_r.html#a9685e8a54a3fd13709ae720076307f92">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_b"></a>- b -</h3><ul>
<li>B115200
: <a class="el" href="class_easy_v_r.html#addcd418f1bff081911a8fb38a62286a5ac1f2933dbb39e111bf14fbd10ca9dba2">EasyVR</a>
</li>
<li>B19200
: <a class="el" href="class_easy_v_r.html#addcd418f1bff081911a8fb38a62286a5af975fbd1b044c9494e3b8bc23c746560">EasyVR</a>
</li>
<li>B38400
: <a class="el" href="class_easy_v_r.html#addcd418f1bff081911a8fb38a62286a5accba157b6983e9577b802caa11c3f3a5">EasyVR</a>
</li>
<li>B57600
: <a class="el" href="class_easy_v_r.html#addcd418f1bff081911a8fb38a62286a5a4158fd234b0cacbb768c3fbedaff3ea4">EasyVR</a>
</li>
<li>B9600
: <a class="el" href="class_easy_v_r.html#addcd418f1bff081911a8fb38a62286a5a86d7bec7ffa5d95b1b73c494821e567f">EasyVR</a>
</li>
<li>Baudrate
: <a class="el" href="class_easy_v_r.html#addcd418f1bff081911a8fb38a62286a5">EasyVR</a>
</li>
<li>BEEP
: <a class="el" href="class_easy_v_r.html#af3bda4f1b38d9b99ee492c259f412e8ba55c335030e8a8ca836ef2f944e44355b">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
<li>changeBaudrate()
: <a class="el" href="class_easy_v_r.html#a5fc0a8eebd4ba4377e747d4de2d356ea">EasyVR</a>
</li>
<li>check()
: <a class="el" href="class_easy_v_r_bridge.html#ae1ee541bb22588b6a71650c807efca90">EasyVRBridge</a>
</li>
<li>checkEEPROM()
: <a class="el" href="class_easy_v_r_bridge.html#a7a508e7c60fb0b06390e80ff16d24d0a">EasyVRBridge</a>
</li>
<li>CLAP_SENSE_HIGH
: <a class="el" href="class_easy_v_r.html#a6c7afcd7af17bb4617c18a813cf66df8a123b6e470cccbe979b54fd8bf8cca435">EasyVR</a>
</li>
<li>CLAP_SENSE_LOW
: <a class="el" href="class_easy_v_r.html#a6c7afcd7af17bb4617c18a813cf66df8ac04f525838b870cee05fd8612e66b021">EasyVR</a>
</li>
<li>CLAP_SENSE_MID
: <a class="el" href="class_easy_v_r.html#a6c7afcd7af17bb4617c18a813cf66df8a4aa20ac85404e825155117f1a9941426">EasyVR</a>
</li>
<li>ClapSense
: <a class="el" href="class_easy_v_r.html#a6c7afcd7af17bb4617c18a813cf66df8">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_d"></a>- d -</h3><ul>
<li>detect()
: <a class="el" href="class_easy_v_r.html#a54820318c743846723c0040c04f62df7">EasyVR</a>
</li>
<li>DIRECTION_SET
: <a class="el" href="class_easy_v_r.html#adb75a7e43d0b92f054005f2446a1603dad5e08c51ffaf866f6a03b6ef0094aae8">EasyVR</a>
</li>
<li>dumpCommand()
: <a class="el" href="class_easy_v_r.html#aa5dfa1bb8a4d59f82f4ef5cfb3da7e97">EasyVR</a>
</li>
<li>dumpSoundTable()
: <a class="el" href="class_easy_v_r.html#a86655e4bdf1558c471412adcbccf212a">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>EASY
: <a class="el" href="class_easy_v_r.html#a221b779e6bb7b8d40677d7642bfefac5a26d394b5caf2853dbcef5884f0f068dd">EasyVR</a>
</li>
<li>EASYVR
: <a class="el" href="class_easy_v_r.html#a2af2c6f2596e5cc6b96f738b48bd35d6aaf85af1320fd05fb9b7ec8a348cb8bfd">EasyVR</a>
</li>
<li>EasyVR()
: <a class="el" href="class_easy_v_r.html#a175ad2790b92ab9505e5785c465a04fb">EasyVR</a>
</li>
<li>ENGLISH
: <a class="el" href="class_easy_v_r.html#a315ca917ad583797f709ea477dd28705afb297577dad4cc723ce8e94430f3defc">EasyVR</a>
</li>
<li>eraseCommand()
: <a class="el" href="class_easy_v_r.html#ade1c4262473afe7fe9d1d3371ab6b8ca">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_f"></a>- f -</h3><ul>
<li>FRENCH
: <a class="el" href="class_easy_v_r.html#a315ca917ad583797f709ea477dd28705addd353630892a63d1cc28cf236e80c6e">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_g"></a>- g -</h3><ul>
<li>GERMAN
: <a class="el" href="class_easy_v_r.html#a315ca917ad583797f709ea477dd28705a38367e930fdceda587507c5579092617">EasyVR</a>
</li>
<li>getCommand()
: <a class="el" href="class_easy_v_r.html#a834260587b1299abfc9b616c5e674812">EasyVR</a>
</li>
<li>getCommandCount()
: <a class="el" href="class_easy_v_r.html#a62bfce1496ebee862442c3b009ee8ab6">EasyVR</a>
</li>
<li>getError()
: <a class="el" href="class_easy_v_r.html#a4475ed5c298ad3967a895bc03ad03268">EasyVR</a>
</li>
<li>getGroupMask()
: <a class="el" href="class_easy_v_r.html#a691081b50bb5793d71a9269ce41732fb">EasyVR</a>
</li>
<li>getID()
: <a class="el" href="class_easy_v_r.html#aa98163cb0bdb2f19883ae4d1629ddae6">EasyVR</a>
</li>
<li>getPinInput()
: <a class="el" href="class_easy_v_r.html#aa1f9f0fc892d56a59107295c1475b60b">EasyVR</a>
</li>
<li>getWord()
: <a class="el" href="class_easy_v_r.html#adbf89404ec291c079e4f7bb807aac85f">EasyVR</a>
</li>
<li>Group
: <a class="el" href="class_easy_v_r.html#ace1050b29fb6a0619ecf018e6cb26bce">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_h"></a>- h -</h3><ul>
<li>HARD
: <a class="el" href="class_easy_v_r.html#a221b779e6bb7b8d40677d7642bfefac5a712b8eb9268f114b4afc567f24bc536f">EasyVR</a>
</li>
<li>HARDER
: <a class="el" href="class_easy_v_r.html#a221b779e6bb7b8d40677d7642bfefac5a82792e91f6d0de41fb2ded4b192d1321">EasyVR</a>
</li>
<li>HARDEST
: <a class="el" href="class_easy_v_r.html#a221b779e6bb7b8d40677d7642bfefac5a61bc5dbddf1928a20f3c2299ecd774d5">EasyVR</a>
</li>
<li>hasFinished()
: <a class="el" href="class_easy_v_r.html#ac448c0d2c73cbf593d2b2e72cdad7443">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_i"></a>- i -</h3><ul>
<li>INPUT_HIZ
: <a class="el" href="class_easy_v_r.html#a3a8a28825ae2b26e757181838cf38a8fa2d9cef0aae8892312903ab7fde464484">EasyVR</a>
</li>
<li>INPUT_STRONG
: <a class="el" href="class_easy_v_r.html#a3a8a28825ae2b26e757181838cf38a8fa0ec553e07d4c66c1b4ab01bfabe7147e">EasyVR</a>
</li>
<li>INPUT_WEAK
: <a class="el" href="class_easy_v_r.html#a3a8a28825ae2b26e757181838cf38a8fa21276fae639d0dc383dde865c4281fa1">EasyVR</a>
</li>
<li>IO1
: <a class="el" href="class_easy_v_r.html#ac97c75321bd298017c7fd91769f101e6a17a52bdf6be8a8aa8f28cc5ed2ad65fc">EasyVR</a>
</li>
<li>IO2
: <a class="el" href="class_easy_v_r.html#ac97c75321bd298017c7fd91769f101e6abeda2b531fd3396af9bd354b5ef020a8">EasyVR</a>
</li>
<li>IO3
: <a class="el" href="class_easy_v_r.html#ac97c75321bd298017c7fd91769f101e6a407bc4408d49d67d52a2d128126cb600">EasyVR</a>
</li>
<li>isConflict()
: <a class="el" href="class_easy_v_r.html#af597a452b60d36ee9e8646962535d122">EasyVR</a>
</li>
<li>isMemoryFull()
: <a class="el" href="class_easy_v_r.html#ac2302c8c48d709c09ea639c358d9d693">EasyVR</a>
</li>
<li>isTimeout()
: <a class="el" href="class_easy_v_r.html#a5d9ba39eba853f2ba5eb0efba8dc30df">EasyVR</a>
</li>
<li>ITALIAN
: <a class="el" href="class_easy_v_r.html#a315ca917ad583797f709ea477dd28705ad30f43a96bae49422414cbf4c9569832">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_j"></a>- j -</h3><ul>
<li>JAPANESE
: <a class="el" href="class_easy_v_r.html#a315ca917ad583797f709ea477dd28705ade61af5cb0cbe763220c01428547b632">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_k"></a>- k -</h3><ul>
<li>Knob
: <a class="el" href="class_easy_v_r.html#a2795a2625c14f6431d12f250e3d8f4b2">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_l"></a>- l -</h3><ul>
<li>Language
: <a class="el" href="class_easy_v_r.html#a315ca917ad583797f709ea477dd28705">EasyVR</a>
</li>
<li>Level
: <a class="el" href="class_easy_v_r.html#a221b779e6bb7b8d40677d7642bfefac5">EasyVR</a>
</li>
<li>loop()
: <a class="el" href="class_easy_v_r_bridge.html#a5d9ad306e1a4e6240998c188b2720cc9">EasyVRBridge</a>
</li>
<li>LOOSE
: <a class="el" href="class_easy_v_r.html#a2795a2625c14f6431d12f250e3d8f4b2a68ea0be7268fdd64402adf4bf7a1dafa">EasyVR</a>
</li>
<li>LOOSER
: <a class="el" href="class_easy_v_r.html#a2795a2625c14f6431d12f250e3d8f4b2af494af9f98826d062519368c08202b25">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_m"></a>- m -</h3><ul>
<li>ModuleId
: <a class="el" href="class_easy_v_r.html#a2af2c6f2596e5cc6b96f738b48bd35d6">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_n"></a>- n -</h3><ul>
<li>NORMAL
: <a class="el" href="class_easy_v_r.html#a221b779e6bb7b8d40677d7642bfefac5a50d1448013c6f17125caee18aa418af7">EasyVR</a>
</li>
<li>NUMBER_SET
: <a class="el" href="class_easy_v_r.html#adb75a7e43d0b92f054005f2446a1603da09702c2eb973b7fe0c0fcab5dea9803d">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_o"></a>- o -</h3><ul>
<li>OUTPUT_HIGH
: <a class="el" href="class_easy_v_r.html#a3a8a28825ae2b26e757181838cf38a8fabd65d73153183405f29ef07823b40b51">EasyVR</a>
</li>
<li>OUTPUT_LOW
: <a class="el" href="class_easy_v_r.html#a3a8a28825ae2b26e757181838cf38a8fab1e89822dcebb01e037dfafbf389ca24">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_p"></a>- p -</h3><ul>
<li>PASSWORD
: <a class="el" href="class_easy_v_r.html#ace1050b29fb6a0619ecf018e6cb26bcea0763974ac198d8ead8dd2112dadfb216">EasyVR</a>
</li>
<li>PinConfig
: <a class="el" href="class_easy_v_r.html#a3a8a28825ae2b26e757181838cf38a8f">EasyVR</a>
</li>
<li>PinNumber
: <a class="el" href="class_easy_v_r.html#ac97c75321bd298017c7fd91769f101e6">EasyVR</a>
</li>
<li>playSound()
: <a class="el" href="class_easy_v_r.html#ae6053ff97ca1f2513937cb151e6c89f2">EasyVR</a>
</li>
<li>playSoundAsync()
: <a class="el" href="class_easy_v_r.html#a89c4525f1ec13bbb7ab25f662c8f087b">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>recognizeCommand()
: <a class="el" href="class_easy_v_r.html#a11f17661017b7fdd2e6505d784386bf9">EasyVR</a>
</li>
<li>recognizeWord()
: <a class="el" href="class_easy_v_r.html#a74f21b2542308dd00082ff31029315d6">EasyVR</a>
</li>
<li>removeCommand()
: <a class="el" href="class_easy_v_r.html#a6cfac9e923405d675b9e95f7b21a0823">EasyVR</a>
</li>
<li>resetAll()
: <a class="el" href="class_easy_v_r.html#a14e5b0a179bbfed85f5c4955b68f8ee4">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_s"></a>- s -</h3><ul>
<li>setCommandLabel()
: <a class="el" href="class_easy_v_r.html#a1ebfb1125926991f3da2ffcb6734332b">EasyVR</a>
</li>
<li>setDelay()
: <a class="el" href="class_easy_v_r.html#adbd242d3bded23995e03a3f67fd37565">EasyVR</a>
</li>
<li>setKnob()
: <a class="el" href="class_easy_v_r.html#a41b2015d5a226a396588e621345b90b9">EasyVR</a>
</li>
<li>setLanguage()
: <a class="el" href="class_easy_v_r.html#ad4ed8fb679b17ac37a22d7b7da025828">EasyVR</a>
</li>
<li>setLevel()
: <a class="el" href="class_easy_v_r.html#a8abcb200864fb6abe73fb9d48dd10404">EasyVR</a>
</li>
<li>setPinOutput()
: <a class="el" href="class_easy_v_r.html#aea82e7215f767e2db2514c9502c7e8f9">EasyVR</a>
</li>
<li>setTimeout()
: <a class="el" href="class_easy_v_r.html#a5b6dc8d67cc9dd8aba8750700139c167">EasyVR</a>
</li>
<li>sleep()
: <a class="el" href="class_easy_v_r.html#a5b808f06f00a336ac93c3cfff45204b2">EasyVR</a>
</li>
<li>SoundIndex
: <a class="el" href="class_easy_v_r.html#af3bda4f1b38d9b99ee492c259f412e8b">EasyVR</a>
</li>
<li>SoundVolume
: <a class="el" href="class_easy_v_r.html#a13a2f58e7b39056ea3c1fa73fbb3bee7">EasyVR</a>
</li>
<li>SPANISH
: <a class="el" href="class_easy_v_r.html#a315ca917ad583797f709ea477dd28705a0d9215736bac53766d4e0e324e02d737">EasyVR</a>
</li>
<li>stop()
: <a class="el" href="class_easy_v_r.html#a68a350717fe6bf9012843e7c977d87b2">EasyVR</a>
</li>
<li>STRICT
: <a class="el" href="class_easy_v_r.html#a2795a2625c14f6431d12f250e3d8f4b2a459b52e1bdb128570809aba2a4c92d2c">EasyVR</a>
</li>
<li>STRICTER
: <a class="el" href="class_easy_v_r.html#a2795a2625c14f6431d12f250e3d8f4b2aa178fc576cadc47712e8120bd3028616">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
<li>trainCommand()
: <a class="el" href="class_easy_v_r.html#ae644c05f1eb9001961cb18787014f4a9">EasyVR</a>
</li>
<li>TRIGGER
: <a class="el" href="class_easy_v_r.html#ace1050b29fb6a0619ecf018e6cb26bcea16be61c7643c97ef03953cad704f0345">EasyVR</a>
</li>
<li>TRIGGER_SET
: <a class="el" href="class_easy_v_r.html#adb75a7e43d0b92f054005f2446a1603da3cf1b68176fca83c07376788c4dffafc">EasyVR</a>
</li>
<li>TYPICAL
: <a class="el" href="class_easy_v_r.html#a2795a2625c14f6431d12f250e3d8f4b2a2c458fc43e2b6d3bfee2ca96e2bc72f9">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_v"></a>- v -</h3><ul>
<li>VOL_DOUBLE
: <a class="el" href="class_easy_v_r.html#a13a2f58e7b39056ea3c1fa73fbb3bee7a44c2113f45b243c841d491d882848e96">EasyVR</a>
</li>
<li>VOL_FULL
: <a class="el" href="class_easy_v_r.html#a13a2f58e7b39056ea3c1fa73fbb3bee7a0509bed5fb71917934c881895a8a41cf">EasyVR</a>
</li>
<li>VOL_HALF
: <a class="el" href="class_easy_v_r.html#a13a2f58e7b39056ea3c1fa73fbb3bee7a5e87162f7ca32275eaf0421196f3120c">EasyVR</a>
</li>
<li>VOL_MIN
: <a class="el" href="class_easy_v_r.html#a13a2f58e7b39056ea3c1fa73fbb3bee7abf471612c2e14607367c1a81c931a603">EasyVR</a>
</li>
<li>VRBOT
: <a class="el" href="class_easy_v_r.html#a2af2c6f2596e5cc6b96f738b48bd35d6abf58bd8a75213d1cce6811abecc04c22">EasyVR</a>
</li>
</ul>
<h3><a class="anchor" id="index_w"></a>- w -</h3><ul>
<li>WAKE_ON_2CLAPS
: <a class="el" href="class_easy_v_r.html#a452cf4e72669262cc138a18ea27adcc5aa8e0631761e18623862fe5027f0a6926">EasyVR</a>
</li>
<li>WAKE_ON_3CLAPS
: <a class="el" href="class_easy_v_r.html#a452cf4e72669262cc138a18ea27adcc5aafdae07b8fa1346df43977dd99a5de88">EasyVR</a>
</li>
<li>WAKE_ON_CHAR
: <a class="el" href="class_easy_v_r.html#a452cf4e72669262cc138a18ea27adcc5a3beef700012e10a0ce4bc68375c097eb">EasyVR</a>
</li>
<li>WAKE_ON_LOUDSOUND
: <a class="el" href="class_easy_v_r.html#a452cf4e72669262cc138a18ea27adcc5a7d258a298d720c12da6be6d68d2e6e8b">EasyVR</a>
</li>
<li>WAKE_ON_WHISTLE
: <a class="el" href="class_easy_v_r.html#a452cf4e72669262cc138a18ea27adcc5ac51d41c0baeb89c2ecab4b3e4c16f983">EasyVR</a>
</li>
<li>WakeMode
: <a class="el" href="class_easy_v_r.html#a452cf4e72669262cc138a18ea27adcc5">EasyVR</a>
</li>
<li>Wordset
: <a class="el" href="class_easy_v_r.html#adb75a7e43d0b92f054005f2446a1603d">EasyVR</a>
</li>
</ul>
</div>
<hr class="footer"/><address class="footer"><small>Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
|
lgpl-3.0
|
xennygrimmato/nmt
|
src/OpenNMT/tools/utils/tokenizer.lua
|
13497
|
local tokenizer = {}
local unicode = require('tools.utils.unicode')
local case = require ('tools.utils.case')
local separators = require('tools.utils.separators')
local alphabet = require('tools.utils.alphabets')
local alphabet_list = {}
for k,_ in pairs(alphabet.ranges) do
table.insert(alphabet_list, k)
end
local options = {
{
'-mode', 'conservative',
[[Define how aggressive should the tokenization be. `aggressive` only keeps sequences
of letters/numbers, `conservative` allows a mix of alphanumeric as in: "2,000", "E65",
"soft-landing", etc. `space` is doing space tokenization.]],
{
enum = {'space', 'conservative', 'aggressive'}
}
},
{
'-joiner_annotate', false,
[[Include joiner annotation using `-joiner` character.]]
},
{
'-joiner', separators.joiner_marker,
[[Character used to annotate joiners.]]
},
{
'-joiner_new', false,
[[In `-joiner_annotate` mode, `-joiner` is an independent token.]]
},
{
'-case_feature', false,
[[Generate case feature.]]
},
{
'-segment_case', false,
[[Segment case feature, splits AbC to Ab C to be able to restore case]]
},
{
'-segment_alphabet', {},
[[Segment all letters from indicated alphabet.]],
{
enum = alphabet_list,
}
},
{
'-segment_numbers', false,
[[Segment numbers into single digits.]]
},
{
'-segment_alphabet_change', false,
[[Segment if alphabet change between 2 letters.]]
},
{
'-bpe_model', '',
[[Apply Byte Pair Encoding if the BPE model path is given. If the option is used,
BPE related options will be overridden/set automatically if the BPE model specified by `-bpe_model`
is learnt using `learn_bpe.lua`.]]
},
{
'-bpe_EOT_marker', separators.EOT,
[[Marker used to mark the End of Token while applying BPE in mode 'prefix' or 'both'.]]
},
{
'-bpe_BOT_marker', separators.BOT,
[[Marker used to mark the Beginning of Token while applying BPE in mode 'suffix' or 'both'.]]
},
{
'-bpe_case_insensitive', false,
[[Apply BPE internally in lowercase, but still output the truecase units.
This option will be overridden/set automatically if the BPE model specified by `-bpe_model`
is learnt using `learn_bpe.lua`.]]
},
{
'-bpe_mode', 'suffix',
[[Define the BPE mode. This option will be overridden/set automatically if the BPE model
specified by `-bpe_model` is learnt using `learn_bpe.lua`. `prefix`: append `-bpe_BOT_marker`
to the begining of each word to learn prefix-oriented pair statistics;
`suffix`: append `-bpe_EOT_marker` to the end of each word to learn suffix-oriented pair
statistics, as in the original Python script; `both`: `suffix` and `prefix`; `none`:
no `suffix` nor `prefix`.]],
{
enum = {'suffix', 'prefix', 'both', 'none'}
}
},
{
'-normalize_cmd', '',
[[Command for on-the-fly corpus normalization. It should work in 'pipeline' mode.]]
}
}
function tokenizer.getOpts()
return options
end
function tokenizer.declareOpts(cmd)
cmd:setCmdLineOptions(options, 'Tokenizer')
end
local function inTable(v, t)
for _, vt in ipairs(t) do
if v == vt then
return true
end
end
return false
end
-- minimalistic tokenization
-- - remove utf-8 BOM character
-- - turn sequences of separators into single space
-- - skip any other non control character [U+0001-U+002F]
-- - keep sequence of letters/numbers and tokenize everything else
local function tokenize(line, opt)
if opt.mode == 'space' then
local index = 1
local tokens = {}
while index <= line:len() do
local sepStart, sepEnd = line:find(' ', index)
local sub
if not sepStart then
sub = line:sub(index)
if sub ~= '' then
table.insert(tokens, sub)
end
break
else
sub = line:sub(index, sepStart - 1)
if sub ~= '' then
table.insert(tokens, sub)
end
index = sepEnd + 1
end
end
return tokens
end
local tokens = {}
-- contains the current token
local curtok = ''
-- keep category of the previous character
local space = true
local letter = false
local prev_alphabet
local number = false
local other = false
local placeholder = false
-- iterate on utf-8 characters
for v, c, nextv in unicode.utf8_iter(line) do
if placeholder then
if c == separators.ph_marker_close then
curtok = curtok .. c
letter = true
prev_alphabet = 'placeholder'
placeholder = false
space = false
else
if unicode.isSeparator(v) then
c = string.format(separators.protected_character.."%04x", v)
end
curtok = curtok .. c
end
elseif c == separators.ph_marker_open then
if space == false then
if opt.joiner_annotate and not(opt.joiner_new) then
curtok = curtok .. opt.joiner
end
table.insert(tokens, curtok)
if opt.joiner_annotate and opt.joiner_new then
table.insert(tokens, opt.joiner)
end
elseif other == true then
if opt.joiner_annotate then
if curtok == '' then
if opt.joiner_new then table.insert(tokens, opt.joiner)
else tokens[#tokens] = tokens[#tokens] .. opt.joiner end
end
end
end
curtok = c
placeholder = true
elseif unicode.isSeparator(v) then
if space == false then
table.insert(tokens, curtok)
curtok = ''
end
-- if the character is the ZERO-WIDTH JOINER character (ZWJ), add joiner
if v == 0x200D then
if opt.joiner_annotate and opt.joiner_new and #tokens then
table.insert(tokens, opt.joiner)
elseif opt.joiner_annotate then
if other or (number and unicode.isLetter(nextv)) then
tokens[#tokens] = tokens[#tokens] .. opt.joiner
else
curtok = opt.joiner
end
end
end
number = false
letter = false
space = true
other = false
else
-- skip special characters and BOM and
if v > 32 and not(v == 0xFEFF) then
-- normalize the separator marker and feat separator
if c == separators.joiner_marker then c = separators.joiner_marker_substitute end
if c == separators.feat_marker then c = separators.feat_marker_substitute end
local is_letter = unicode.isLetter(v)
local is_alphabet
if is_letter and (opt.segment_alphabet_change or #opt.segment_alphabet>0) then
is_alphabet = alphabet.findAlphabet(v)
end
local is_number = unicode.isNumber(v)
local is_mark = unicode.isMark(v)
-- if we have a mark, we keep type of previous character
if is_mark then
is_letter = letter
is_number = number
end
if opt.mode == 'conservative' then
if is_number or (c == '-' and letter == true) or c == '_' or
(letter == true and (c == '.' or c == ',') and (unicode.isNumber(nextv) or unicode.isLetter(nextv))) then
is_letter = true
end
end
if is_letter then
if not(letter == true or space == true) or
(letter == true and not is_mark and
(prev_alphabet == 'placeholder' or
(prev_alphabet == is_alphabet and inTable(is_alphabet, opt.segment_alphabet)) or
(prev_alphabet ~= is_alphabet and opt.segment_alphabet_change))) then
if opt.joiner_annotate and not(opt.joiner_new) and prev_alphabet ~= 'placeholder' then
curtok = curtok .. opt.joiner
end
table.insert(tokens, curtok)
if opt.joiner_annotate and opt.joiner_new then
table.insert(tokens, opt.joiner)
end
curtok = ''
if opt.joiner_annotate and not(opt.joiner_new) and prev_alphabet == 'placeholder' then
curtok = curtok .. opt.joiner
end
elseif other == true then
if opt.joiner_annotate then
if curtok == '' then
if opt.joiner_new then table.insert(tokens, opt.joiner)
else tokens[#tokens] = tokens[#tokens] .. opt.joiner end
end
end
end
curtok = curtok .. c
space = false
number = false
other = false
letter = true
prev_alphabet = is_alphabet
elseif is_number then
if letter == true or (number and opt.segment_numbers) or not(number == true or space == true) then
local addjoiner = false
if opt.joiner_annotate then
if opt.joiner_new then
addjoiner = true
else
if not(letter) and not(placeholder) then
curtok = curtok .. opt.joiner
else
c = opt.joiner .. c
end
end
end
table.insert(tokens, curtok)
if addjoiner then
table.insert(tokens, opt.joiner)
end
curtok = ''
elseif other == true then
if opt.joiner_annotate then
if opt.joiner_new then
table.insert(tokens, opt.joiner)
else
tokens[#tokens] = tokens[#tokens] .. opt.joiner
end
end
end
curtok = curtok..c
space = false
letter = false
other = false
number = true
else
if not space == true then
if opt.joiner_annotate and not(opt.joiner_new) then
c = opt.joiner .. c
end
table.insert(tokens, curtok)
if opt.joiner_annotate and opt.joiner_new then
table.insert(tokens, opt.joiner)
end
curtok = ''
elseif other == true then
if opt.joiner_annotate then
if opt.joiner_new then
table.insert(tokens, opt.joiner)
else
curtok = opt.joiner
end
end
end
curtok = curtok .. c
table.insert(tokens, curtok)
curtok = ''
number = false
letter = false
other = true
space = true
end
end
end
end
-- last token
if (curtok ~= '') then
table.insert(tokens, curtok)
end
return tokens
end
function tokenizer.tokenize(opt, line, bpe)
-- tokenize
local tokens = tokenize(line, opt)
-- apply segmetn feature if requested
if opt.segment_case then
local sep = ''
if opt.joiner_annotate then sep = opt.joiner end
tokens = case.segmentCase(tokens, sep)
end
-- apply bpe if requested
if bpe then
local sep = ''
if opt.joiner_annotate then sep = opt.joiner end
tokens = bpe:segment(tokens, sep)
end
-- add-up case feature if requested
if opt.case_feature then
tokens = case.addCase(tokens)
end
return tokens
end
local function analyseToken(t, joiner)
local feats = {}
local tok = ""
local p
local leftsep = false
local rightsep = false
local i = 1
while i <= #t do
if t:sub(i, i+#separators.feat_marker-1) == separators.feat_marker then
p = i
break
end
tok = tok .. t:sub(i, i)
i = i + 1
end
if tok:sub(1,#joiner) == joiner then
tok = tok:sub(1+#joiner)
leftsep = true
if tok == '' then rightsep = true end
end
if tok:sub(-#joiner,-1) == joiner then
tok = tok:sub(1,-#joiner-1)
rightsep = true
end
if p then
p = p + #separators.feat_marker
local j = p
while j <= #t do
if t:sub(j, j+#separators.feat_marker-1) == separators.feat_marker then
table.insert(feats, t:sub(p, j-1))
j = j + #separators.feat_marker - 1
p = j + 1
end
j = j + 1
end
table.insert(feats, t:sub(p))
end
return tok, leftsep, rightsep, feats
end
local function getTokens(t, joiner)
local fields = {}
t:gsub("([^ ]+)", function(tok)
local w, leftsep, rightsep, feats = analyseToken(tok, joiner)
table.insert(fields, { w=w, leftsep=leftsep, rightsep=rightsep, feats=feats })
end)
return fields
end
function tokenizer.detokenize(line, opt)
local dline = ""
local tokens = getTokens(line, opt.joiner)
for j = 1, #tokens do
local token = tokens[j].w
if j > 1 and not tokens[j-1].rightsep and not tokens[j].leftsep then
dline = dline .. " "
end
if token:sub(1, separators.ph_marker_open:len()) == separators.ph_marker_open then
local inProtected = false
local protectSeq = ''
local rtok = ''
for _, c, _ in unicode.utf8_iter(token) do
if inProtected then
protectSeq = protectSeq .. c
if protectSeq:len() == 4 then
rtok = rtok .. unicode._cp_to_utf8(tonumber(protectSeq, 16))
inProtected = false
end
elseif c == separators.protected_character then
inProtected = true
else
rtok = rtok .. c
if c == separators.ph_marker_close then
break
end
end
end
token = rtok
end
if opt.case_feature then
token = case.restoreCase(token, tokens[j].feats)
end
dline = dline .. token
end
return dline
end
return tokenizer
|
lgpl-3.0
|
defus/daf-architcture
|
commons/src/main/java/cm/gov/daf/sif/titrefoncier/model/Parcelle.java
|
1753
|
package cm.gov.daf.sif.titrefoncier.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotEmpty;
import cm.gov.daf.sif.model.BaseEntity;
/**
* Encapsule les informations sur la parcelle
*
* @author Albert
*/
@Entity
@Table(name = "parcelles")
public class Parcelle extends BaseEntity {
@Column(name = "num", length = 100)
@NotEmpty
private String num;
@Column(name = "type", length = 100)
@NotEmpty
private String type;
@Column(name = "superficie")
@NotEmpty
private Integer superficie;
@ManyToOne
@JoinColumn(name = "lot_id")
private Lot lot;
@ManyToOne
@JoinColumn(name = "proprietaire_id")
@NotEmpty
private Proprietaire proprietaire;
public Parcelle() {
super();
// TODO Auto-generated constructor stub
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getSuperficie() {
return superficie;
}
public void setSuperficie(Integer superficie) {
this.superficie = superficie;
}
public Lot getLot() {
return lot;
}
public void setLot(Lot lot) {
this.lot = lot;
}
public Proprietaire getProprietaire() {
return proprietaire;
}
public void setProprietaire(Proprietaire proprietaire) {
this.proprietaire = proprietaire;
}
@Override
public String toString() {
return "Parcelle [num=" + num + ", superficie=" + superficie + ", id=" + id + "]";
}
}
|
lgpl-3.0
|
trejkaz/hex-components
|
viewer/src/main/java/org/trypticon/hex/plaf/SelectionUpAction.java
|
1229
|
/*
* Hex - a hex viewer and annotator
* Copyright (C) 2009-2014,2016-2017,2021 Hakanai, Hex Project
*
* This program 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
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.trypticon.hex.plaf;
import org.trypticon.hex.HexViewer;
import javax.annotation.Nonnull;
/**
* Action to move the selection up one row.
*
* @author trejkaz
*/
// Swing's own guidelines say not to use serialisation.
@SuppressWarnings("serial")
class SelectionUpAction extends AbstractRelativeSelectionMoveAction {
@Override
protected int getShift(@Nonnull HexViewer viewer) {
return -viewer.getBytesPerRow();
}
}
|
lgpl-3.0
|
WFoundation/WF.Player
|
WF.Player.iOS/Services/Geolocation/Geolocator.cs
|
11735
|
//
// Copyright 2011-2013, Xamarin 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.
//
using System;
using CoreLocation;
using System.Threading.Tasks;
using System.Threading;
using Foundation;
using UIKit;
using Xamarin.Forms;
using WF.Player.Services.Geolocation;
using Vernacular;
using WF.Player.Services.Settings;
[assembly: Dependency(typeof(WF.Player.iOS.Services.Geolocation.Geolocator))]
namespace WF.Player.iOS.Services.Geolocation
{
public class Geolocator : IGeolocator
{
UIDeviceOrientation? _orientation;
NSObject _observer;
public Geolocator()
{
this.manager = GetManager();
this.manager.AuthorizationChanged += OnAuthorizationChanged;
this.manager.Failed += OnFailed;
// if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0))
this.manager.LocationsUpdated += OnLocationsUpdated;
// else
// this.manager.UpdatedLocation += OnUpdatedLocation;
this.manager.UpdatedHeading += OnUpdatedHeading;
}
public event EventHandler<PositionErrorEventArgs> PositionError;
public event EventHandler<PositionEventArgs> PositionChanged;
public event EventHandler<PositionEventArgs> HeadingChanged;
public double DesiredAccuracy
{
get;
set;
}
public bool IsListening
{
get { return this.isListening; }
}
public bool SupportsHeading
{
get { return CLLocationManager.HeadingAvailable; }
}
public bool IsGeolocationAvailable
{
get { return true; } // all iOS devices support at least wifi geolocation
}
public bool IsGeolocationEnabled
{
get { return CLLocationManager.Status == CLAuthorizationStatus.Authorized; }
}
public Position LastKnownPosition
{
get {
return _position;
}
}
public Task<Position> GetPositionAsync (int timeout)
{
return GetPositionAsync (timeout, CancellationToken.None, false);
}
public Task<Position> GetPositionAsync (int timeout, bool includeHeading)
{
return GetPositionAsync (timeout, CancellationToken.None, includeHeading);
}
public Task<Position> GetPositionAsync (CancellationToken cancelToken)
{
return GetPositionAsync (Timeout.Infinite, cancelToken, false);
}
public Task<Position> GetPositionAsync (CancellationToken cancelToken, bool includeHeading)
{
return GetPositionAsync (Timeout.Infinite, cancelToken, includeHeading);
}
public Task<Position> GetPositionAsync (int timeout, CancellationToken cancelToken)
{
return GetPositionAsync (timeout, cancelToken, false);
}
public Task<Position> GetPositionAsync (int timeout, CancellationToken cancelToken, bool includeHeading)
{
if (timeout <= 0 && timeout != Timeout.Infinite)
throw new ArgumentOutOfRangeException ("timeout", "Timeout must be positive or Timeout.Infinite");
TaskCompletionSource<Position> tcs;
if (!IsListening)
{
var m = GetManager();
tcs = new TaskCompletionSource<Position> (m);
var singleListener = new GeolocationSingleUpdateDelegate (m, DesiredAccuracy, includeHeading, timeout, cancelToken);
m.Delegate = singleListener;
m.StartUpdatingLocation ();
if (includeHeading && SupportsHeading)
m.StartUpdatingHeading ();
return singleListener.Task;
}
else
{
tcs = new TaskCompletionSource<Position>();
if (this._position == null)
{
EventHandler<PositionErrorEventArgs> gotError = null;
gotError = (s,e) =>
{
tcs.TrySetException (new GeolocationException (e.Error));
PositionError -= gotError;
};
PositionError += gotError;
EventHandler<PositionEventArgs> gotPosition = null;
gotPosition = (s, e) =>
{
tcs.TrySetResult (e.Position);
PositionChanged -= gotPosition;
};
PositionChanged += gotPosition;
}
else
tcs.SetResult (this._position);
}
return tcs.Task;
}
/// <summary>
/// Starts the update process of the Geolocator.
/// </summary>
/// <param name="minTime">Minimum time in milliseconds.</param>
/// <param name="minDistance">Minimum distance in meters.</param>
public void StartListening (uint minTime, double minDistance)
{
StartListening (minTime, minDistance, false);
}
/// <summary>
/// Starts the update process of the Geolocator.
/// </summary>
/// <param name="minTime">Minimum time in milliseconds.</param>
/// <param name="minDistance">Minimum distance in meters.</param>
/// <param name="includeHeading">Should the Geolocator update process update heading too.</param>
public void StartListening (uint minTime, double minDistance, bool includeHeading)
{
// Get last known position from settings
_position = _position ?? new Position();
_position.Latitude = Settings.Current.GetValueOrDefault<double>(Settings.LastKnownPositionLatitudeKey);
_position.Longitude = Settings.Current.GetValueOrDefault<double>(Settings.LastKnownPositionLongitudeKey);
_position.Altitude = Settings.Current.GetValueOrDefault<double>(Settings.LastKnownPositionAltitudeKey);
if (minTime < 0)
throw new ArgumentOutOfRangeException ("minTime");
if (minDistance < 0)
throw new ArgumentOutOfRangeException ("minDistance");
if (this.isListening)
throw new InvalidOperationException ("Already listening");
if(!CLLocationManager.LocationServicesEnabled || !(CLLocationManager.Status == CLAuthorizationStatus.AuthorizedAlways || CLLocationManager.Status == CLAuthorizationStatus.AuthorizedWhenInUse))
{
return;
throw new NotImplementedException ("GPS not existing or not authorized");
}
this.isListening = true;
this.manager.DesiredAccuracy = CLLocation.AccurracyBestForNavigation;
this.manager.DistanceFilter = minDistance;
this.manager.StartUpdatingLocation ();
if (includeHeading && CLLocationManager.HeadingAvailable) {
this.manager.HeadingFilter = 1;
this.manager.StartUpdatingHeading ();
}
UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();
_observer = NSNotificationCenter.DefaultCenter.AddObserver (UIDevice.OrientationDidChangeNotification, OnDidRotate);
}
/// <summary>
/// Stops the update process of the Geolocator.
/// </summary>
public void StopListening ()
{
if (!this.isListening)
return;
this.isListening = false;
if (CLLocationManager.HeadingAvailable)
this.manager.StopUpdatingHeading ();
this.manager.StopUpdatingLocation ();
// Save last known position for later
if (this._position != null)
{
Settings.Current.AddOrUpdateValue(Settings.LastKnownPositionLatitudeKey, this._position.Latitude);
Settings.Current.AddOrUpdateValue(Settings.LastKnownPositionLongitudeKey, this._position.Longitude);
Settings.Current.AddOrUpdateValue(Settings.LastKnownPositionAltitudeKey, this._position.Altitude);
}
this._position = null;
NSNotificationCenter.DefaultCenter.RemoveObserver (_observer);
UIDevice.CurrentDevice.EndGeneratingDeviceOrientationNotifications();
_observer.Dispose();
}
private readonly CLLocationManager manager;
private bool isListening;
private Position _position;
private CLLocationManager GetManager()
{
CLLocationManager m = null;
new NSObject().InvokeOnMainThread (() => m = new CLLocationManager());
if (m.RespondsToSelector (new ObjCRuntime.Selector("requestWhenInUseAuthorization")))
{
m.RequestWhenInUseAuthorization ();
}
return m;
}
/// <summary>
/// Raises the did rotate event.
/// </summary>
/// <remarks>
/// Had to do this, because didn't find a property where to get the actual orientation.
/// Seems to be the easies method.
/// </remarks>
/// <param name="notice">Notice.</param>
private void OnDidRotate(NSNotification notice)
{
UIDevice device = (UIDevice)notice.Object;
if (device.Orientation != UIDeviceOrientation.FaceUp && device.Orientation != UIDeviceOrientation.FaceDown && device.Orientation != UIDeviceOrientation.Unknown)
_orientation = device.Orientation;
}
private void OnUpdatedHeading (object sender, CLHeadingUpdatedEventArgs e)
{
if (e.NewHeading.MagneticHeading == -1)
return;
Position p = (this._position == null) ? new Position () : new Position (this._position);
// If HeadingAccuracy is below 0, than the heading is invalid
if (e.NewHeading.HeadingAccuracy < 0)
return;
var newHeading = e.NewHeading.MagneticHeading;
p.Heading = CheckDeviceOrientationForHeading(newHeading);
this._position = p;
OnHeadingChanged (new PositionEventArgs (p));
}
private void OnLocationsUpdated (object sender, CLLocationsUpdatedEventArgs e)
{
foreach (CLLocation location in e.Locations)
UpdatePosition (location);
}
private void OnUpdatedLocation (object sender, CLLocationUpdatedEventArgs e)
{
UpdatePosition (e.NewLocation);
}
private void UpdatePosition (CLLocation location)
{
Position p = (this._position == null) ? new Position () : new Position (this._position);
if (location.HorizontalAccuracy > -1)
{
p.Accuracy = location.HorizontalAccuracy;
p.Latitude = location.Coordinate.Latitude;
p.Longitude = location.Coordinate.Longitude;
}
if (location.VerticalAccuracy > -1)
{
p.Altitude = location.Altitude;
p.AltitudeAccuracy = location.VerticalAccuracy;
}
if (location.Speed > -1)
p.Speed = location.Speed;
p.Timestamp = new DateTimeOffset (location.Timestamp.ToDateTime());
this._position = p;
OnPositionChanged (new PositionEventArgs (p));
location.Dispose();
}
private void OnFailed (object sender, Foundation.NSErrorEventArgs e)
{
if ((CLError)(int)e.Error.Code == CLError.Network)
OnPositionError (new PositionErrorEventArgs (GeolocationError.PositionUnavailable));
}
private void OnAuthorizationChanged (object sender, CLAuthorizationChangedEventArgs e)
{
if (e.Status == CLAuthorizationStatus.Denied || e.Status == CLAuthorizationStatus.Restricted)
OnPositionError (new PositionErrorEventArgs (GeolocationError.Unauthorized));
}
private void OnPositionChanged (PositionEventArgs e)
{
var changed = PositionChanged;
if (changed != null)
changed (this, e);
}
private void OnHeadingChanged (PositionEventArgs e)
{
var changed = HeadingChanged;
if (changed != null)
changed (this, e);
}
private void OnPositionError (PositionErrorEventArgs e)
{
StopListening();
var error = PositionError;
if (error != null)
error (this, e);
}
double CheckDeviceOrientationForHeading(double heading)
{
double realHeading = heading;
// Don't do this, because device orientation is set to portrait,
// but device orientation changes when rotating device.
// switch (_orientation) {
// case UIDeviceOrientation.Portrait:
// break;
// case UIDeviceOrientation.PortraitUpsideDown:
// realHeading = realHeading + 180.0f;
// break;
// case UIDeviceOrientation.LandscapeLeft:
// realHeading = realHeading + 90.0f;
// break;
// case UIDeviceOrientation.LandscapeRight:
// realHeading = realHeading - 90.0f;
// break;
// default:
// break;
// }
while (realHeading < 0)
realHeading += 360.0;
realHeading = realHeading % 360;
return realHeading;
}
}
}
|
lgpl-3.0
|
yjwen/hada
|
test/Prim.hs
|
1873
|
module Prim( plusOne, plusOne8, plusOne16, plusOne32, plusOne64
, plusOneU, plusOneU8, plusOneU16, plusOneU32, plusOneU64
, lshc, lshc8, lshc16, lshc32, lshc64
, rshc, rshc8, rshc16, rshc32, rshc64
, lshcU, lshcU8, lshcU16, lshcU32, lshcU64
, rshcU, rshcU8, rshcU16, rshcU32, rshcU64) where
import Data.Int
import Data.Word
import Data.Bits
plusOne :: Int -> Int
plusOne = (+1)
plusOne8 :: Int8 -> Int8
plusOne8 = (+1)
plusOne16 :: Int16 -> Int16
plusOne16 = (+1)
plusOne32 :: Int32 -> Int32
plusOne32 = (+1)
plusOne64 :: Int64 -> Int64
plusOne64 = (+1)
plusOneU :: Word -> Word
plusOneU = (+1)
plusOneU8 :: Word8 -> Word8
plusOneU8 = (+1)
plusOneU16 :: Word16 -> Word16
plusOneU16 = (+1)
plusOneU32 :: Word32 -> Word32
plusOneU32 = (+1)
plusOneU64 :: Word64 -> Word64
plusOneU64 = (+1)
-- Left shift by a constant
lshc :: Int -> Int
lshc = (`shift` 1)
lshc8 :: Int8 -> Int8
lshc8 = (`shift` 2)
lshc16 :: Int16 -> Int16
lshc16 = (`shift` 3)
lshc32 :: Int32 -> Int32
lshc32 = (`shift` 4)
lshc64 :: Int64 -> Int64
lshc64 = (`shift` 5)
lshcU :: Word -> Word
lshcU = (`shift` 1)
lshcU8 :: Word8 -> Word8
lshcU8 = (`shift` 2)
lshcU16 :: Word16 -> Word16
lshcU16 = (`shift` 3)
lshcU32 :: Word32 -> Word32
lshcU32 = (`shift` 4)
lshcU64 :: Word64 -> Word64
lshcU64 = (`shift` 5)
-- Right shift by a constant
rshc :: Int -> Int
rshc = (`shift` (-1))
rshc8 :: Int8 -> Int8
rshc8 = (`shift` (-1))
rshc16 :: Int16 -> Int16
rshc16 = (`shift` (-1))
rshc32 :: Int32 -> Int32
rshc32 = (`shift` (-1))
rshc64 :: Int64 -> Int64
rshc64 = (`shift` (-1))
rshcU :: Word -> Word
rshcU = (`shift` (-1))
rshcU8 :: Word8 -> Word8
rshcU8 = (`shift` (-1))
rshcU16 :: Word16 -> Word16
rshcU16 = (`shift` (-1))
rshcU32 :: Word32 -> Word32
rshcU32 = (`shift` (-1))
rshcU64 :: Word64 -> Word64
rshcU64 = (`shift` (-1))
|
lgpl-3.0
|
mar9000/plantuml
|
src/net/sourceforge/plantuml/posimo/Mirror.java
|
1402
|
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2014, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML 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
* (at your option) any later version.
*
* PlantUML 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*/
package net.sourceforge.plantuml.posimo;
public class Mirror {
private final double max;
public Mirror(double max) {
this.max = max;
}
public double getMirrored(double v) {
if (v < 0 || v > max) {
throw new IllegalArgumentException();
}
//return v;
return max - v;
}
}
|
lgpl-3.0
|
pcolby/libqtaws
|
src/lookoutequipment/stopinferenceschedulerrequest_p.h
|
1553
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_STOPINFERENCESCHEDULERREQUEST_P_H
#define QTAWS_STOPINFERENCESCHEDULERREQUEST_P_H
#include "lookoutequipmentrequest_p.h"
#include "stopinferenceschedulerrequest.h"
namespace QtAws {
namespace LookoutEquipment {
class StopInferenceSchedulerRequest;
class StopInferenceSchedulerRequestPrivate : public LookoutEquipmentRequestPrivate {
public:
StopInferenceSchedulerRequestPrivate(const LookoutEquipmentRequest::Action action,
StopInferenceSchedulerRequest * const q);
StopInferenceSchedulerRequestPrivate(const StopInferenceSchedulerRequestPrivate &other,
StopInferenceSchedulerRequest * const q);
private:
Q_DECLARE_PUBLIC(StopInferenceSchedulerRequest)
};
} // namespace LookoutEquipment
} // namespace QtAws
#endif
|
lgpl-3.0
|
hkust-smartcar/libsccc
|
inc/libbase/kl26/mcg.h
|
962
|
/*
* mcg.h
*
* Author: Ming Tsang
* Copyright (c) 2014-2015 HKUST SmartCar Team
* Refer to LICENSE for details
*/
#pragma once
#include <cstdint>
#include "libbase/kl26/mcg_c.h"
namespace libbase
{
namespace kl26
{
class Mcg
{
public:
struct Config
{
Config();
uint32_t external_oscillator_khz;
/// The core and the system clock
uint32_t core_clock_khz;
/// The bus and the flash clock
uint32_t bus_clock_khz;
};
static Mcg& Get()
{
static Mcg inst;
return inst;
}
void Init();
uint32_t GetCoreClock()
{
return m_core_clock;
}
private:
Mcg();
/**
* Get the Config object used during initialization, to be implemented by
* user
*
* @return
*/
static Config GetMcgConfig();
void InitFbe(const Config &config);
void InitPbe(const Config &config, const uint8_t vdiv);
void InitPee(const Config &config);
void InitClocks(const Config &config, const uint32_t core_clock);
uint32_t m_core_clock;
};
}
}
|
lgpl-3.0
|
RakeshShrestha/Php-Web-Objects
|
admin/app/libraries/Csv.php
|
2754
|
<?php
/**
# Copyright Rakesh Shrestha (rakesh.shrestha@gmail.com)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions must retain the above copyright notice.
*/
final class Csv
{
private $enclosure;
private $delimiter;
private $rows;
private $numfields;
public function __construct()
{
$this->enclosure = "\"";
$this->delimiter = ",";
$this->rows = array();
$this->numfields = 0;
}
public function load($file, $headersonly = false)
{
$ext = mb_strtolower(mb_strrchr($file, '.'));
if ($ext == '.csv' || $ext == '.txt') {
$row = 1;
$handle = fopen($file, 'r');
if ($ext == '.txt')
$this->delimiter = "\t";
while (($data = fgetcsv($handle, 1000, $this->delimiter, $this->enclosure)) !== FALSE) {
if ($row == 1) {
foreach ($data as $key => $val)
$headingTexts[] = mb_strtolower(mb_trim($val));
$this->numfields = count($headingTexts);
}
if ($this->numfields < 2) {
fclose($handle);
return 0;
}
if ($headersonly) {
fclose($handle);
return $headingTexts;
}
if ($row > 1) {
foreach ($data as $key => $value) {
unset($data[$key]);
$data[mb_strtolower($headingTexts[$key])] = $value;
}
$this->rows[] = $data;
}
$row ++;
}
fclose($handle);
}
return $this->rows;
}
public function write($csv_delimiter, array $csv_headers_array, array $csv_write_res)
{
if (! isset($csv_delimiter)) {
$csv_delimiter = $this->delimiter;
}
$data = "";
$data_temp = '';
foreach ($csv_headers_array as $val) {
$data_temp .= $this->enclosure . mb_strtolower($val) . $this->enclosure . $csv_delimiter;
}
$data .= rtrim($data_temp, $csv_delimiter) . "\r\n";
echo $data;
$data = "";
$data_temp = '';
foreach ($csv_write_res as $val) {
$data_temp = '';
foreach ($val as $val2) {
$data_temp .= $this->enclosure . $val2 . $this->enclosure . $csv_delimiter;
}
$data .= rtrim($data_temp, $csv_delimiter) . "\r\n";
}
echo $data;
}
}
|
lgpl-3.0
|
jaluk8/talented-gm
|
src/controllers/turnnotescontroller.cpp
|
879
|
#include "turnnotescontroller.h"
#include "../models/talentdata.h"
#include "../models/talentfile.h"
#include "../models/turn.h"
#include <QTextEdit>
TurnNotesController::TurnNotesController(QObject* parent) : Controller(parent)
{
notes = "";
}
void TurnNotesController::setWidgets(QTextEdit* turnNotes)
{
uiNotes = turnNotes;
view.append(uiNotes);
connect(uiNotes, SIGNAL(textChanged()), this, SLOT(on_viewUpdate()));
}
void TurnNotesController::toView()
{
uiNotes->setText(notes);
}
void TurnNotesController::toModel()
{
TalentData::lockTalentFile()->currentTurn()->setNotes(notes);
TalentData::unlockTalentFile();
}
void TurnNotesController::fromModel()
{
notes = TalentData::lockTalentFile()->currentTurn()->getNotes();
TalentData::unlockTalentFile();
}
void TurnNotesController::fromView()
{
notes = uiNotes->toPlainText();
}
|
lgpl-3.0
|
kyungtaekLIM/PSI-BLASTexB
|
src/ncbi-blast-2.5.0+/c++/src/algo/blast/api/rpsblast_local.cpp
|
12514
|
/* $Id: rpsblast_local.cpp 448376 2014-10-06 09:52:42Z mcelhany $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Authors: Amelia Fong
*
*/
/** @file rpsblast_local.cpp
*/
#include <ncbi_pch.hpp>
#include <corelib/ncbifile.hpp>
#include <corelib/ncbiapp.hpp>
#include <algo/blast/api/local_blast.hpp>
#include <algo/blast/api/objmgr_query_data.hpp>
#include <corelib/ncbithr.hpp>
#include <corelib/ncbitime.hpp>
#include <corelib/ncbimtx.hpp>
#include <corelib/ncbiexpt.hpp>
#include <algo/blast/api/rpsblast_local.hpp>
#include <objtools/blast/seqdb_reader/seqdb.hpp>
#include <algo/blast/api/blast_rps_options.hpp>
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(blast)
static const char delimiter[] = "#rps#";
static const size_t delimiter_len = sizeof(delimiter) - 1; // exclude \0
static void s_ConvertConcatStringToVectorOfString(const string & s, vector<string> & v)
{
int pos_start = 0;
while(1)
{
size_t pos_find = s.find(delimiter, pos_start);
if(pos_find == string::npos)
break;
TSeqPos length = pos_find - pos_start;
v.push_back(s.substr(pos_start, length));
pos_start = pos_find + delimiter_len;
}
v.push_back(s.substr(pos_start, s.size() - pos_start ));
}
static void s_MergeAlignSet(CSeq_align_set & final_set, const CSeq_align_set & input_set)
{
CSeq_align_set::Tdata & final_list = final_set.Set();
const CSeq_align_set::Tdata & input_list = input_set.Get();
CSeq_align_set::Tdata::const_iterator input_it = input_list.begin();
CSeq_align_set::Tdata::iterator final_it = final_list.begin();
while(input_it != input_list.end())
{
double final_evalue;
double input_evalue;
(*final_it)->GetNamedScore(CSeq_align::eScore_EValue, final_evalue);
(*input_it)->GetNamedScore(CSeq_align::eScore_EValue, input_evalue);
if(input_evalue == final_evalue)
{
//Pulling a trick here to keep the program flow simple
//Replace the final evalue with input bitscore and vice versa
(*final_it)->GetNamedScore(CSeq_align::eScore_BitScore, input_evalue);
(*input_it)->GetNamedScore(CSeq_align::eScore_BitScore, final_evalue);
}
if(input_evalue < final_evalue)
{
CSeq_align_set::Tdata::const_iterator start_input_it = input_it;
while(1)
{
const CSeq_id & id_prev = (*input_it)->GetSeq_id(1);
input_it++;
if(input_it == input_list.end())
{
break;
}
if(! id_prev.Match((*input_it)->GetSeq_id(1)))
{
break;
}
}
final_list.insert(final_it, start_input_it, input_it);
}
else
{
while(1)
{
const CSeq_id & id_prev = (*final_it)->GetSeq_id(1);
final_it++;
if(final_it == final_list.end())
{
break;
}
if(! id_prev.Match((*final_it)->GetSeq_id(1)))
{
break;
}
}
if(final_it == final_list.end())
{
final_list.insert(final_it, input_it, input_list.end());
break;
}
}
}
}
static CRef<CSearchResultSet> s_CombineSearchSets(vector<CRef<CSearchResultSet> > & t, unsigned int num_of_threads)
{
CRef<CSearchResultSet> aggregate_search_result_set (new CSearchResultSet());
aggregate_search_result_set->clear();
for(unsigned int i=0; i < t[0]->GetNumQueries(); i++)
{
vector< CRef<CSearchResults> > thread_results;
thread_results.push_back (CRef<CSearchResults> (&((*(t[0]))[i])));
const CSeq_id & id = *(thread_results[0]->GetSeqId());
for(unsigned int d=1; d < num_of_threads; d++)
{
thread_results.push_back ((*(t[d]))[id]);
}
CRef<CSeq_align_set> align_set(new CSeq_align_set);
TQueryMessages aggregate_messages;
for(unsigned int d=0; d< num_of_threads; d++)
{
if(thread_results[d]->HasAlignments())
{
CConstRef<CSeq_align_set> thread_align_set = thread_results[d]->GetSeqAlign();
if(align_set->IsEmpty())
{
align_set->Set().insert(align_set->Set().begin(),
thread_align_set->Get().begin(),
thread_align_set->Get().end());
}
else
{
s_MergeAlignSet(*align_set, *thread_align_set);
}
}
aggregate_messages.Combine(thread_results[d]->GetErrors());
}
TMaskedQueryRegions query_mask;
thread_results[0]->GetMaskedQueryRegions(query_mask);
CRef<CSearchResults> aggregate_search_results (new CSearchResults(thread_results[0]->GetSeqId(),
align_set,
aggregate_messages,
thread_results[0]->GetAncillaryData(),
&query_mask,
thread_results[0]->GetRID()));
aggregate_search_result_set->push_back(aggregate_search_results);
}
return aggregate_search_result_set;
}
static void s_ModifyVolumePaths(vector<string> & rps_database)
{
for(unsigned int i=0; i < rps_database.size(); i++)
{
size_t found = rps_database[i].find(".pal");
if(string::npos != found)
rps_database[i]= rps_database[i].substr(0, found);
}
}
static bool s_SortDbSize(const pair<string, Int8> & a, const pair<string, Int8> & b)
{
return(a.second > b.second);
}
static void s_MapDbToThread(vector<string> & db, unsigned int num_of_threads)
{
unsigned int db_size = db.size();
vector <pair <string, Int8> > p;
for(unsigned int i=0; i < db_size; i++)
{
vector<string> path;
CSeqDB::FindVolumePaths(db[i], CSeqDB::eProtein, path, NULL, true);
_ASSERT(path.size() == 1);
CFile f(path[0]+".loo");
Int8 length = f.GetLength();
_ASSERT(length > 0 );
//Scale down, just in case
p.push_back(make_pair(db[i], length/1000));
}
sort(p.begin(), p.end(),s_SortDbSize);
db.resize(num_of_threads);
vector<Int8> acc_size(num_of_threads, 0);
for(unsigned char i=0; i < num_of_threads; i++)
{
db[i] = p[i].first;
acc_size[i] = p[i].second;
}
for(unsigned int i= num_of_threads; i < db_size; i++)
{
unsigned int min_index = 0;
for(unsigned int j=1; j<num_of_threads; j++)
{
if(acc_size[j] < acc_size[min_index])
min_index = j;
}
acc_size[min_index] += p[i].second;
db[min_index] = db[min_index] + delimiter + p[i].first;
}
}
CRef<CSearchResultSet> s_RunLocalRpsSearch(const string & db,
CBlastQueryVector & query_vector,
CRef<CBlastOptionsHandle> opt_handle)
{
CSearchDatabase search_db(db, CSearchDatabase::eBlastDbIsProtein);
CRef<CLocalDbAdapter> db_adapter(new CLocalDbAdapter(search_db));
CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(query_vector));
CLocalBlast lcl_blast(queries, opt_handle, db_adapter);
CRef<CSearchResultSet> results = lcl_blast.Run();
return results;
}
class CRPSThread : public CThread
{
public:
CRPSThread(CRef<CBlastQueryVector> query_vector,
const string & db,
CRef<CBlastOptions> options);
void * Main(void);
private:
CRef<CSearchResultSet> RunTandemSearches(void);
CRPSThread(const CRPSThread &);
CRPSThread & operator=(const CRPSThread &);
vector<string> m_db;
CRef<CBlastOptionsHandle> m_opt_handle;
CRef<CBlastQueryVector> m_query_vector;
};
/* CRPSThread */
CRPSThread::CRPSThread(CRef<CBlastQueryVector> query_vector,
const string & db,
CRef<CBlastOptions> options):
m_query_vector(query_vector)
{
m_opt_handle.Reset(new CBlastRPSOptionsHandle(options));
s_ConvertConcatStringToVectorOfString(db, m_db);
}
void* CRPSThread::Main(void)
{
CRef<CSearchResultSet> * result = new (CRef<CSearchResultSet>);
if(m_db.size() == 1)
{
*result = s_RunLocalRpsSearch(m_db[0],
*m_query_vector,
m_opt_handle);
}
else
{
*result = RunTandemSearches();
}
return result;
}
CRef<CSearchResultSet> CRPSThread::RunTandemSearches(void)
{
unsigned int num_of_db = m_db.size();
vector<CRef<CSearchResultSet> > results;
for(unsigned int i=0; i < num_of_db; i++)
{
results.push_back(s_RunLocalRpsSearch(m_db[i],
*m_query_vector,
m_opt_handle));
}
return s_CombineSearchSets(results, num_of_db);
}
/* CThreadedRpsBlast */
CLocalRPSBlast::CLocalRPSBlast(CRef<CBlastQueryVector> query_vector,
const string & db,
CRef<CBlastOptionsHandle> options,
unsigned int num_of_threads):
m_num_of_threads(num_of_threads),
m_db_name(db),
m_opt_handle(options),
m_query_vector(query_vector),
m_num_of_dbs(0)
{
CSeqDB::FindVolumePaths(db, CSeqDB::eProtein, m_rps_databases, NULL, false);
m_num_of_dbs = m_rps_databases.size();
if( 1 == m_num_of_dbs)
{
m_num_of_threads = kDisableThreadedSearch;
}
}
void CLocalRPSBlast::x_AdjustDbSize(void)
{
if(m_opt_handle->GetOptions().GetEffectiveSearchSpace()!= 0)
return;
if(m_opt_handle->GetOptions().GetDbLength()!= 0)
return;
CSeqDB db(m_db_name, CSeqDB::eProtein);
Uint8 db_size = db.GetTotalLengthStats();
int num_seq = db.GetNumSeqsStats();
if(0 == db_size)
db_size = db.GetTotalLength();
if(0 == num_seq)
num_seq = db.GetNumSeqs();
m_opt_handle->SetOptions().SetDbLength(db_size);
m_opt_handle->SetOptions().SetDbSeqNum(num_seq);
return;
}
CRef<CSearchResultSet> CLocalRPSBlast::Run(void)
{
if(1 != m_num_of_dbs)
{
x_AdjustDbSize();
}
if(kDisableThreadedSearch == m_num_of_threads)
{
if(1 == m_num_of_dbs)
{
return s_RunLocalRpsSearch(m_db_name, *m_query_vector, m_opt_handle);
}
else
{
s_ModifyVolumePaths(m_rps_databases);
vector<CRef<CSearchResultSet> > results;
for(unsigned int i=0; i < m_num_of_dbs; i++)
{
results.push_back(s_RunLocalRpsSearch(m_rps_databases[i],
*m_query_vector,
m_opt_handle));
}
return s_CombineSearchSets(results, m_num_of_dbs);
}
}
else
{
return RunThreadedSearch();
}
}
CRef<CSearchResultSet> CLocalRPSBlast::RunThreadedSearch(void)
{
s_ModifyVolumePaths(m_rps_databases);
if((kAutoThreadedSearch == m_num_of_threads) ||
(m_num_of_threads > m_rps_databases.size()))
{
//Default num of thread : a thread for each db
m_num_of_threads = m_rps_databases.size();
}
else if(m_num_of_threads < m_rps_databases.size())
{
// Combine databases, modified the size of rps_database
s_MapDbToThread(m_rps_databases, m_num_of_threads);
}
vector<CRef<CSearchResultSet> * > thread_results(m_num_of_threads, NULL);
vector <CRPSThread* > thread(m_num_of_threads, NULL);
vector<CRef<CSearchResultSet> > results;
for(unsigned int t=0; t < m_num_of_threads; t++)
{
// CThread destructor is protected, all threads destory themselves when terminated
thread[t] = (new CRPSThread(m_query_vector, m_rps_databases[t], m_opt_handle->SetOptions().Clone()));
thread[t]->Run();
}
for(unsigned int t=0; t < m_num_of_threads; t++)
{
thread[t]->Join(reinterpret_cast<void**> (&thread_results[t]));
}
for(unsigned int t=0; t < m_num_of_threads; t++)
{
results.push_back(*(thread_results[t]));
}
CRef<CBlastRPSInfo> rpsInfo = CSetupFactory::CreateRpsStructures(m_db_name,
CRef<CBlastOptions> (&(m_opt_handle->SetOptions())));
return s_CombineSearchSets(results, m_num_of_threads);
}
END_SCOPE(blast)
END_NCBI_SCOPE
|
lgpl-3.0
|
modelinglab/ocl
|
core/src/main/java/org/modelinglab/ocl/core/ast/types/CollectionType.java
|
8485
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.modelinglab.ocl.core.ast.types;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.modelinglab.ocl.core.ast.utils.ClassifierVisitor;
import org.modelinglab.ocl.core.ast.utils.OclVisitor;
/**
*
* @author Gonzalo Ortiz Jaureguizar (gortiz at software.imdea.org)
*/
public class CollectionType extends DataType {
private static final long serialVersionUID = 1L;
Classifier elementType;
private static CollectionType genericInstance = null;
public CollectionType() {
}
public CollectionType(Classifier elementType) {
Preconditions.checkArgument(elementType != null, "Element type of collection types must be "
+ "different than (java) null.");
this.elementType = elementType;
}
protected CollectionType(CollectionType other) {
super(other);
elementType = other.elementType.clone();
}
public static CollectionType getGenericInstance() {
if (genericInstance == null) {
genericInstance = new CollectionType();
genericInstance.setElementType(TemplateParameterType.getGenericCollectionElement());
}
return genericInstance;
}
public Classifier getElementType() {
return elementType;
}
public void setElementType(Classifier elementType) {
this.elementType = elementType;
}
public boolean isOrdered() {
switch (getCollectionKind()) {
case BAG:
case SET:
return false;
case ORDERED_SET:
case SEQUENCE:
return true;
default:
throw new IllegalStateException("This function has no sense in abstract collections");
}
}
public boolean isUnique() {
switch (getCollectionKind()) {
case BAG:
return false;
case SEQUENCE:
case ORDERED_SET:
case SET:
return true;
default:
throw new IllegalStateException("This function has no sense in abstract collections");
}
}
public static CollectionType newCollection(CollectionKind kind) {
CollectionType result;
switch (kind) {
case BAG:
result = new BagType();
break;
case COLLECTION:
result = new CollectionType();
break;
case ORDERED_SET:
result = new OrderedSetType();
break;
case SEQUENCE:
result = new SequenceType();
break;
case SET:
result = new SetType();
break;
default:
throw new AssertionError();
}
return result;
}
@Override
public void fixTemplates(TemplateRestrictions restrictions) {
super.fixTemplates(restrictions);
restrictions.instantiate("T", elementType, true);
}
@Override
public List<Classifier> getSuperClassifiers() {
assert getElementType() != null;
List<Classifier> elementSuperClassifiers;
elementSuperClassifiers = getElementType().getSuperClassifiers();
List<Classifier> result;
CollectionType ct;
if (getCollectionKind() != CollectionKind.COLLECTION) {
/*
* Result will have a collection foreach element in elementSuperClassifiers, a specific
* collection type foreach element in elementSuperClassifiers, the AnyType, and a collection
* and a specific collection type of elementType
*/
result = new ArrayList<Classifier>(elementSuperClassifiers.size() * 2 + 1 + 2);
CollectionKind collectionKind = getCollectionKind();
ct = CollectionType.newCollection(collectionKind);
ct.setElementType(getElementType());
result.add(ct);
for (Classifier superElement : elementSuperClassifiers) {
ct = CollectionType.newCollection(collectionKind);
ct.setElementType(superElement);
result.add(ct);
}
ct = new CollectionType();
ct.setElementType(getElementType());
result.add(ct);
} else {
result = new ArrayList<Classifier>(elementSuperClassifiers.size() + 1);
}
for (Classifier superElement : elementSuperClassifiers) {
ct = new CollectionType();
ct.setElementType(superElement);
result.add(ct);
}
result.add(AnyType.getInstance());
return result;
}
@Override
public CollectionType getRestrictedType(TemplateRestrictions restrictions) {
if (getElementType() instanceof TemplateParameterType) {
TemplateParameterType template = (TemplateParameterType) getElementType();
Classifier newElement = restrictions.getInstance(template.getSpecification());
if (newElement != null) {
CollectionType result = CollectionType.newCollection(getCollectionKind());
result.setElementType(newElement);
return result;
} else { //restrictions does not contains elementType
return this;
}
} else { //elementType is not a tempate
return this;
}
}
@Override
protected void conformsPreconditions(Classifier otherClassifier) {
super.conformsPreconditions(otherClassifier);
Preconditions.checkState(elementType != null,
"To evaluate conforms with CollectionType#getElementType() must not be null");
}
@Override
protected boolean conformsToProtected(Classifier conformsTarget, TemplateRestrictions instanciatedTemplates) {
if (!(conformsTarget instanceof CollectionType)) {
return false;
}
final CollectionType otherCollection = (CollectionType) conformsTarget;
if (!elementType.conformsTo(otherCollection.getElementType(), instanciatedTemplates)) {
return false;
}
return otherCollection.getCollectionKind() == this.getCollectionKind()
|| otherCollection.getCollectionKind() == CollectionKind.COLLECTION;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CollectionType other = (CollectionType) obj;
if (this.elementType != other.elementType && (this.elementType == null || !this.elementType.equals(other.elementType))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 29 * hash + (this.elementType != null ? this.elementType.hashCode() : 0);
return hash;
}
@Override
public CollectionType clone() {
return new CollectionType(this);
}
@Override
public String getName() {
return getCollectionKind().toString() + "(" + elementType + ')';
}
@Override
public ClassifierType getClassifierType() {
return new ClassifierType(this);
}
public CollectionKind getCollectionKind() {
return CollectionKind.COLLECTION;
}
@Override
public <Result, Arg> Result accept(ClassifierVisitor<Result, Arg> visitor, Arg arguments) {
return visitor.visit(this, arguments);
}
public <Result, Arg> Result accept(OclVisitor<Result, Arg> visitor, Arg arguments) {
return visitor.visit(this, arguments);
}
public static enum CollectionKind {
COLLECTION, BAG, SET, ORDERED_SET, SEQUENCE;
@Override
public String toString() {
switch (this) {
case COLLECTION:
return "Collection";
case BAG:
return "Bag";
case SET:
return "Set";
case ORDERED_SET:
return "OrderedSet";
case SEQUENCE:
return "Sequence";
default:
throw new AssertionError();
}
}
}
}
|
lgpl-3.0
|
pixelspark/corespark
|
Libraries/Spirit/boost/miniboost/boost/mpl/iterator_tags.hpp
|
880
|
#ifndef BOOST_MPL_ITERATOR_TAG_HPP_INCLUDED
#define BOOST_MPL_ITERATOR_TAG_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/iterator_tags.hpp,v $
// $Date: 2004/12/01 02:44:52 $
// $Revision: 1.3.2.1 $
#include <boost/mpl/int.hpp>
namespace boost { namespace mpl {
struct forward_iterator_tag : int_<0> { typedef forward_iterator_tag type; };
struct bidirectional_iterator_tag : int_<1> { typedef bidirectional_iterator_tag type; };
struct random_access_iterator_tag : int_<2> { typedef random_access_iterator_tag type; };
}}
#endif // BOOST_MPL_ITERATOR_TAG_HPP_INCLUDED
|
lgpl-3.0
|
lbndev/sonarqube
|
server/sonar-server/src/main/java/org/sonar/server/es/request/package-info.java
|
967
|
/*
* SonarQube
* Copyright (C) 2009-2017 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program 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 (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@ParametersAreNonnullByDefault
package org.sonar.server.es.request;
import javax.annotation.ParametersAreNonnullByDefault;
|
lgpl-3.0
|
01org/jndn-management
|
src/main/java/com/intel/jndn/management/types/ChannelStatus.java
|
3314
|
/*
* jndn-management
* Copyright (c) 2016, Regents of the University of California.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 3, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
*/
package com.intel.jndn.management.types;
import com.intel.jndn.management.enums.NfdTlv;
import com.intel.jndn.management.helpers.EncodingHelper;
import net.named_data.jndn.encoding.EncodingException;
import net.named_data.jndn.encoding.tlv.TlvDecoder;
import net.named_data.jndn.encoding.tlv.TlvEncoder;
import net.named_data.jndn.util.Blob;
import java.nio.ByteBuffer;
/**
* Represent a ChannelStatus object.
*
* @see <a href="http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset">Face Management</a>
*/
public class ChannelStatus implements Decodable {
private String localUri = "";
/////////////////////////////////////////////////////////////////////////////
/**
* Default constructor.
*/
public ChannelStatus() {
// nothing to do
}
/**
* Constructor from wire format.
*
* @param input wire format
* @throws EncodingException when decoding fails
*/
public ChannelStatus(final ByteBuffer input) throws EncodingException {
wireDecode(input);
}
/**
* Encode using a new TLV encoder.
*
* @return The encoded buffer
*/
public final Blob wireEncode() {
TlvEncoder encoder = new TlvEncoder();
wireEncode(encoder);
return new Blob(encoder.getOutput(), false);
}
/**
* Encode as part of an existing encode context.
*
* @param encoder TlvEncoder instance
*/
public final void wireEncode(final TlvEncoder encoder) {
int saveLength = encoder.getLength();
encoder.writeBlobTlv(NfdTlv.LocalUri, new Blob(localUri).buf());
encoder.writeTypeAndLength(NfdTlv.ChannelStatus, encoder.getLength() - saveLength);
}
/**
* Decode the input from its TLV format.
*
* @param input The input buffer to decode. This reads from position() to
* limit(), but does not change the position.
* @throws EncodingException when decoding fails
*/
public final void wireDecode(final ByteBuffer input) throws EncodingException {
TlvDecoder decoder = new TlvDecoder(input);
wireDecode(decoder);
}
/**
* {@inheritDoc}
*/
@Override
public void wireDecode(final TlvDecoder decoder) throws EncodingException {
int endOffset = decoder.readNestedTlvsStart(NfdTlv.ChannelStatus);
this.localUri = EncodingHelper.toString(decoder.readBlobTlv(NfdTlv.LocalUri));
decoder.finishNestedTlvs(endOffset);
}
/**
* @return channel URI
*/
public String getLocalUri() {
return localUri;
}
/**
* Set channel URI.
*
* @param localUri channel URI
* @return this
*/
public ChannelStatus setLocalUri(final String localUri) {
this.localUri = localUri;
return this;
}
@Override
public String toString() {
return "ChannelStatus(" + getLocalUri() + ")";
}
}
|
lgpl-3.0
|
blitvin/fsm4java
|
src/main/java/org/blitvin/statemachine/InvalidFactoryImplementation.java
|
1094
|
/*
* (C) Copyright Boris Litvin 2014, 2015
* This file is part of FSM4Java library.
*
* FSM4Java 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
* (at your option) any later version.
*
* FSM4Java 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FSM4Java If not, see <http://www.gnu.org/licenses/>.
*/
package org.blitvin.statemachine;
public class InvalidFactoryImplementation extends Exception {
private static final long serialVersionUID = -5234585034138276392L;
public InvalidFactoryImplementation(String message , Throwable cause) {
super(message, cause);
}
public InvalidFactoryImplementation(String message){
super(message);
}
}
|
lgpl-3.0
|
peredelkin/aecu
|
libs/adc.c
|
76
|
#include "adc.h"
void adc_init(void)
{
ADMUX;
ADCSRA;
ADCSRB;
}
|
lgpl-3.0
|
kralisch/jams
|
JAMSCloudClient/src/jams/server/client/sync/SyncTable.java
|
12177
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package jams.server.client.sync;
import jams.JAMS;
import jams.server.client.Controller;
import jams.server.entities.Workspace;
import jams.tools.StringTools;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractCellEditor;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
/**
*
* @author christian
*/
public class SyncTable extends JTable {
Component tableSyncModeCells[];
Font defaultFont = new Font("Times New Roman", Font.PLAIN, 10);
File localWorkspace = null;
Workspace serverWorkspace = null;
Controller ctrl = null;
final int COLUMN_COUNT = 5;
final int COLUMN_SIZE[] = {25, 365, 75, 90, 50};
final String COLUMN_NAMES[] = {"", JAMS.i18n("Path"), JAMS.i18n("Extension"), JAMS.i18n("Operation"), JAMS.i18n("SIZE")};
final Class COLUMN_CLASSES[] = {Boolean.class, String.class, String.class, FileSync.SyncMode.class, Long.class};
final int SYNCMODE_COLUMN = 3;
/**
*
* @param ctrl
* @param defaultFont
*/
public SyncTable(Controller ctrl, Font defaultFont) {
super(10, 5);
this.ctrl = ctrl;
if (defaultFont != null) {
this.defaultFont = defaultFont;
}
}
/**
*
* @param localWorkspace
*/
public void setLocalWorkspace(File localWorkspace) {
this.localWorkspace = localWorkspace;
initModel();
}
/**
*
* @return
*/
public File getLocalWorkspace() {
return this.localWorkspace;
}
/**
*
* @param serverWorkspace
*/
public void setServerWorkspace(Workspace serverWorkspace) {
this.serverWorkspace = serverWorkspace;
initModel();
}
/**
*
* @return
*/
public Workspace getServerWorkspace() {
return this.serverWorkspace;
}
private void initModel() {
SyncTableModel syncTableModel = new SyncTableModel(ctrl, localWorkspace, serverWorkspace);
setModel(syncTableModel);
SyncWorkspaceTableRenderer renderer
= new SyncWorkspaceTableRenderer(syncTableModel.getSyncList());
setDefaultRenderer(String.class, renderer);
setDefaultRenderer(Long.class, renderer);
getColumnModel().getColumn(SYNCMODE_COLUMN).setCellRenderer(renderer);
getColumnModel().getColumn(SYNCMODE_COLUMN).setCellEditor(new SyncModeEditor());
setShowHorizontalLines(false);
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
for (int i = 0; i < COLUMN_COUNT; i++) {
getColumnModel().getColumn(i).setPreferredWidth(COLUMN_SIZE[i]);
}
}
@Override
public SyncTableModel getModel() {
if (super.getModel() instanceof SyncTableModel) {
return (SyncTableModel) super.getModel();
} else {
return null;
}
}
/**
*
*/
public class SyncTableModel extends AbstractTableModel {
ArrayList<FileSync> syncList = null;
/**
*
* @param ctrl
* @param localWsDirectory
* @param remoteWs
*/
public SyncTableModel(Controller ctrl, File localWsDirectory, Workspace remoteWs) {
if (ctrl == null
|| localWsDirectory == null
|| remoteWs == null) {
syncList = new ArrayList<>();
} else {
syncList = ctrl.workspaces()
.getSynchronizationList(localWsDirectory, remoteWs)
.getList(null);
}
}
/**
*
* @return
*/
public List<FileSync> getSyncList() {
return syncList;
}
/**
*
* @return
*/
public FileSync getRoot() {
if (syncList == null || syncList.isEmpty()) {
return null;
}
return syncList.get(0).getRoot();
}
@Override
public int getRowCount() {
return syncList.size();
}
@Override
public int getColumnCount() {
return COLUMN_COUNT;
}
@Override
public String getColumnName(int columnIndex) {
return COLUMN_NAMES[columnIndex];
}
@Override
public Class<?> getColumnClass(int columnIndex) {
return COLUMN_CLASSES[columnIndex];
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return columnIndex == 0
|| (columnIndex == SYNCMODE_COLUMN && tableSyncModeCells[rowIndex] instanceof JComboBox);
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
FileSync fs = syncList.get(rowIndex);
switch (columnIndex) {
case 0:
return fs.isDoSync();
case 1:
if (fs.getLocalFile() != null) {
return fs.getLocalFile().getPath();
}
return null;
case 2: {
String name = syncList.get(rowIndex).getLocalFile().getName();
int lastIndex = name.lastIndexOf(".");
if (lastIndex == -1) {
return "";
} else {
return name.substring(lastIndex, name.length());
}
}
case 3:
return syncList.get(rowIndex).getSyncMode();
case 4:
if (fs.getServerFile() != null) {
return fs.getServerFile().getFile().getFileSize();
} else {
return 0;
}
}
return null;
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if (columnIndex == 0) {
syncList.get(rowIndex).setDoSync((Boolean) aValue, true);
//generateTableCells();
fireTableDataChanged();
}
if (columnIndex == 3) {
syncList.get(rowIndex).setSyncMode((FileSync.SyncMode) aValue);
generateTableCells(syncList);
fireTableDataChanged();
}
}
}
private class SyncModeEditor extends AbstractCellEditor
implements TableCellEditor,
ActionListener {
JComboBox currentBox = null;
public SyncModeEditor() {
}
@Override
public void actionPerformed(ActionEvent e) {
}
//Implement the one CellEditor method that AbstractCellEditor doesn't.
@Override
public Object getCellEditorValue() {
if (currentBox != null) {
return currentBox.getSelectedItem();
}
return null;
}
//Implement the one method defined by TableCellEditor.
@Override
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column) {
if (tableSyncModeCells[row] instanceof JComboBox) {
return currentBox = (JComboBox) tableSyncModeCells[row];
} else {
return currentBox = null;
}
}
}
private class SyncWorkspaceTableRenderer extends JLabel implements TableCellRenderer {
List<FileSync> syncList = null;
public SyncWorkspaceTableRenderer(List<FileSync> syncList) {
this.syncList = syncList;
generateTableCells(syncList);
setOpaque(true); //MUST do this for background to show up.
}
@Override
public Component getTableCellRendererComponent(
JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column) {
//special handling of column 3
if (column == SYNCMODE_COLUMN) {
return tableSyncModeCells[row];
}
setBackground(Color.WHITE);
setForeground(Color.BLACK);
if (value instanceof Long) {
setText(StringTools.humanReadableByteCount((Long) value, false));
setHorizontalAlignment(JLabel.RIGHT);
} else if (value instanceof Integer) {
setText(StringTools.humanReadableByteCount((Integer) value, false));
setHorizontalAlignment(JLabel.RIGHT);
} else {
setText(value.toString());
setHorizontalAlignment(JLabel.LEFT);
}
FileSync fs = syncList.get(row);
if (!fs.isExisting()) {
setBackground(Color.green);
} else if (fs.isModified()) {
setBackground(Color.red);
}
if (fs instanceof DirectorySync) {
setBackground(Color.darkGray);
setForeground(Color.white);
}
setFont(defaultFont);
return this;
}
}
private void generateTableCells(List<FileSync> syncList) {
tableSyncModeCells = new Component[syncList.size()];
for (int i = 0; i < syncList.size(); i++) {
FileSync fs = syncList.get(i);
if (fs.getSyncOptions().length == 1) {
tableSyncModeCells[i] = new JLabel(
fs.getSyncOptions()[0].toString(),
JLabel.CENTER);
tableSyncModeCells[i].setBackground(Color.WHITE);
tableSyncModeCells[i].setForeground(Color.BLACK);
if (!syncList.get(i).isExisting()) {
tableSyncModeCells[i].setBackground(Color.green);
} else if (syncList.get(i).isModified()) {
tableSyncModeCells[i].setBackground(Color.red);
}
if (syncList.get(i) instanceof DirectorySync) {
tableSyncModeCells[i].setBackground(Color.darkGray);
tableSyncModeCells[i].setForeground(Color.white);
}
((JLabel) tableSyncModeCells[i]).setOpaque(true);
} else {
JComboBox box = new JComboBox(fs.getSyncOptions());
box.putClientProperty("row", new Integer(i));
box.setSelectedItem(fs.getSyncMode());
box.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JComboBox src = (JComboBox) e.getSource();
int row = (Integer) src.getClientProperty("row");
((SyncTableModel) getModel()).setValueAt(src.getSelectedItem(), row, 3);
}
});
tableSyncModeCells[i] = box;
tableSyncModeCells[i].setBackground(Color.WHITE);
tableSyncModeCells[i].setForeground(Color.BLACK);
}
tableSyncModeCells[i].setFont(defaultFont);
}
}
}
|
lgpl-3.0
|
advanced-online-marketing/AOM
|
vendor/googleads/googleads-php-lib/src/Google/AdsApi/Dfp/v201708/ActivityError.php
|
1048
|
<?php
namespace Google\AdsApi\Dfp\v201708;
/**
* This file was generated from WSDL. DO NOT EDIT.
*/
class ActivityError extends \Google\AdsApi\Dfp\v201708\ApiError
{
/**
* @var string $reason
*/
protected $reason = null;
/**
* @param string $fieldPath
* @param \Google\AdsApi\Dfp\v201708\FieldPathElement[] $fieldPathElements
* @param string $trigger
* @param string $errorString
* @param string $reason
*/
public function __construct($fieldPath = null, array $fieldPathElements = null, $trigger = null, $errorString = null, $reason = null)
{
parent::__construct($fieldPath, $fieldPathElements, $trigger, $errorString);
$this->reason = $reason;
}
/**
* @return string
*/
public function getReason()
{
return $this->reason;
}
/**
* @param string $reason
* @return \Google\AdsApi\Dfp\v201708\ActivityError
*/
public function setReason($reason)
{
$this->reason = $reason;
return $this;
}
}
|
lgpl-3.0
|
premium-minds/billy
|
billy-gin/src/main/java/com/premiumminds/billy/gin/services/export/BillyTemplateBundle.java
|
1309
|
/*
* Copyright (C) 2017 Premium Minds.
*
* This file is part of billy GIN.
*
* billy GIN 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 (at your option) any
* later version.
*
* billy GIN 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 billy GIN. If not, see <http://www.gnu.org/licenses/>.
*/
package com.premiumminds.billy.gin.services.export;
import java.io.InputStream;
public interface BillyTemplateBundle {
/**
* returns the path to the image file to be used as a logo
*
* @return The path of the logo image file
*/
public String getLogoImagePath();
/**
* returns the path to the xslt file to be used as the pdf template
* generator
*
* @return The path of the xslt template file.
*/
public InputStream getXSLTFileStream();
public String getPaymentMechanismTranslation(Enum<?> pmc);
}
|
lgpl-3.0
|
Frankie-PellesC/fSDK
|
Lib/src/strmiids/X64/strmiids000001C9.c
|
465
|
// Created file "Lib\src\strmiids\X64\strmiids"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(ENCAPIPARAM_BITRATE_MODE, 0xee5fb25c, 0xc713, 0x40d1, 0x9d, 0x58, 0xc0, 0xd7, 0x24, 0x1e, 0x25, 0x0f);
|
lgpl-3.0
|
fabienroyer/GpxSonar
|
CCachePageWriter.h
|
4824
|
#ifndef _INC_CCachePageWriter
#define _INC_CCachePageWriter
#include <vector>
using namespace std;
class CGpxParser;
class CGeoCache;
class CCachePageWriterHandler;
typedef enum {
GcRatingDifficulty = 0,
GcRatingTerrain
} GcRatingType;
// This class describes a portion of an HTML template. Once all the parts have been used and all the writer handlers called,
// the HTML page is complete and can be displayed.
class CHtmlSeg
{
public:
string m_HtmlSeg;
CCachePageWriterHandler* m_pH;
public:
CHtmlSeg(char* pHtmlSeg, CCachePageWriterHandler* pH);
// Format text according to the segment definition
string Format(CGpxParser& Parser, CGeoCache& Cache);
// Format integers according to the segment definition
string FormatStats(int NotesFound, int NotesDNF, int NotesNote, int NotesArchive);
protected:
// Creates a string of star bitmaps matching the given rating
string WriteStars(double Rating, GcRatingType Type);
// Returns the filename of the icon matching the log type
string LogIconLookup(int LogType);
// Returns the filename of the icon matching the status of the field note
string FieldNoteStatusLookup(int Status);
// Searches for markup markers and returns a complete string with substitutions
string ScanForMarkup(char* pText, int Length);
// Performs lookups on commonly used tags in logs found on GC.com
string MarkupLookup(char* pMarkup);
// Replace spaces with '_' in cache type bitmaps
wstring SpaceToUnderscore(wstring& Str);
// Strip <IMG SRC=""> tags from HTML cache descriptions
void StripImgTag(char* pTag);
};
typedef vector<CHtmlSeg*> HtmlSegCont;
typedef vector<CHtmlSeg*>::iterator itHtmlSeg;
// This class is used as a specialized handler for particular template segments which require more processing
class CCachePageWriterHandler
{
public:
CCachePageWriterHandler();
// Virtual function called for each tag in the template associated with a writer handler
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
// Writes out travel bug label if travel bugs exist in the cache
class CTBLabelWriter : public CCachePageWriterHandler
{
public:
CTBLabelWriter()
{}
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
// Writes out travel bug records
class CTBWriter : public CCachePageWriterHandler
{
public:
CTBWriter()
{}
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
class CWarningWriter : public CCachePageWriterHandler
{
public:
CWarningWriter()
{}
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
class CLogWriter : public CCachePageWriterHandler
{
public:
CLogWriter()
{}
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
class CHintsWriter : public CCachePageWriterHandler
{
public:
CHintsWriter()
{}
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
class CSpoilerPicsWriter : public CCachePageWriterHandler
{
protected:
wstring m_SpoilerPicsPath;
public:
CSpoilerPicsWriter()
{}
void SetSpoilerPicsPath(const wstring& SpoilerPicsPath);
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
class CHintsLabelWriter : public CCachePageWriterHandler
{
public:
CHintsLabelWriter()
{}
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
class CReportWriter : public CCachePageWriterHandler
{
public:
CReportWriter()
{}
virtual string OnWrite(CGpxParser& Parser, CGeoCache& Cache, CHtmlSeg* pHtmlSeg);
};
class CCacheReportsPref;
class CFieldNoteMgr;
// Produces an HTML page describing a cache using a templatized document broken down into segments associated with data members of a
// cache object.
class CCachePageWriter
{
private:
HtmlSegCont m_Segs;
CTBLabelWriter m_TBLabelWriter;
CTBWriter m_TBWriter;
CLogWriter m_LogWriter;
CHintsWriter m_HintsWriter;
CHintsLabelWriter m_HintsLabelWriter;
CReportWriter m_ReportWriter;
CWarningWriter m_WarningWriter;
public:
CSpoilerPicsWriter m_SpoilerPicsWriter;
public:
CCachePageWriter();
~CCachePageWriter();
void LoadTemplate(const TCHAR* pTplPath);
// Register the various parts of the HTML page to be generated
void AddSeg(char* pHtmlSeg, CCachePageWriterHandler* pH = 0);
// Write the cache page out
void Write(CGpxParser& Parser, CGeoCache& Cache, TCHAR* pFilePath);
// Write a report page out
void WriteReport(CCacheReportsPref* pPref, CFieldNoteMgr* pFNM, CGpxParser& Parser, TCHAR* pFilePath);
// General cleanup
void Reset();
};
#endif
|
lgpl-3.0
|
zoggy/ocaml-rdf
|
web/refdoc/Rdf_rdfs.html
|
5691
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<ocamldoc with-contents="true">
<title>OCaml-RDF reference documentation : Rdf_rdfs</title><contents><div class="ocamldoc-page">
<div class="navbar"><a class="pre" href="Rdf_rdf.html" title="Rdf_rdf">Previous</a>
 <a class="up" href="index.html" title="Index">Up</a>
 <a class="post" href="Rdf_sioc.html" title="Rdf_sioc">Next</a>
</div>
<h1>Module <a href="type_Rdf_rdfs.html">Rdf_rdfs</a></h1>
<pre><span class="keyword">module</span> Rdf_rdfs: <code class="code">sig</code> <a href="Rdf_rdfs.html">..</a> <code class="code">end</code></pre><div class="info module top">
Elements of <code class="code">http://www.w3.org/2000/01/rdf-schema#</code><br/>
</div>
<hr width="100%"/>
<pre><span id="VALrdfs"><span class="keyword">val</span> rdfs</span> : <code class="type">Iri.t</code></pre><div class="info ">
<code class="code">http://www.w3.org/2000/01/rdf-schema#</code><br/>
</div>
<pre><span id="VALrdfs_"><span class="keyword">val</span> rdfs_</span> : <code class="type">string -> Iri.t</code></pre>
<pre><span id="VALc_Class"><span class="keyword">val</span> c_Class</span> : <code class="type">Iri.t</code></pre><div class="info ">
The class of classes.<br/>
</div>
<pre><span id="VALcomment"><span class="keyword">val</span> comment</span> : <code class="type">Iri.t</code></pre><div class="info ">
A description of the subject resource.<br/>
</div>
<pre><span id="VALc_Container"><span class="keyword">val</span> c_Container</span> : <code class="type">Iri.t</code></pre><div class="info ">
The class of RDF containers.<br/>
</div>
<pre><span id="VALc_ContainerMembershipProperty"><span class="keyword">val</span> c_ContainerMembershipProperty</span> : <code class="type">Iri.t</code></pre><div class="info ">
The class of container membership properties, rdf:_1, rdf:_2, ...,
all of which are sub-properties of 'member'.<br/>
</div>
<pre><span id="VALc_Datatype"><span class="keyword">val</span> c_Datatype</span> : <code class="type">Iri.t</code></pre><div class="info ">
The class of RDF datatypes.<br/>
</div>
<pre><span id="VALdomain"><span class="keyword">val</span> domain</span> : <code class="type">Iri.t</code></pre><div class="info ">
A domain of the subject property.<br/>
</div>
<pre><span id="VALisDefinedBy"><span class="keyword">val</span> isDefinedBy</span> : <code class="type">Iri.t</code></pre><div class="info ">
The defininition of the subject resource.<br/>
</div>
<pre><span id="VALlabel"><span class="keyword">val</span> label</span> : <code class="type">Iri.t</code></pre><div class="info ">
A human-readable name for the subject.<br/>
</div>
<pre><span id="VALc_Literal"><span class="keyword">val</span> c_Literal</span> : <code class="type">Iri.t</code></pre><div class="info ">
The class of literal values, eg. textual strings and integers.<br/>
</div>
<pre><span id="VALmember"><span class="keyword">val</span> member</span> : <code class="type">Iri.t</code></pre><div class="info ">
A member of the subject resource.<br/>
</div>
<pre><span id="VALrange"><span class="keyword">val</span> range</span> : <code class="type">Iri.t</code></pre><div class="info ">
A range of the subject property.<br/>
</div>
<pre><span id="VALc_Resource"><span class="keyword">val</span> c_Resource</span> : <code class="type">Iri.t</code></pre><div class="info ">
The class resource, everything.<br/>
</div>
<pre><span id="VALseeAlso"><span class="keyword">val</span> seeAlso</span> : <code class="type">Iri.t</code></pre><div class="info ">
Further information about the subject resource.<br/>
</div>
<pre><span id="VALsubClassOf"><span class="keyword">val</span> subClassOf</span> : <code class="type">Iri.t</code></pre><div class="info ">
The subject is a subclass of a class.<br/>
</div>
<pre><span id="VALsubPropertyOf"><span class="keyword">val</span> subPropertyOf</span> : <code class="type">Iri.t</code></pre><div class="info ">
The subject is a subproperty of a property.<br/>
</div>
<pre><span class="keyword">module</span> <a href="Rdf_rdfs.Open.html">Open</a>: <code class="code">sig</code> <a href="Rdf_rdfs.Open.html">..</a> <code class="code">end</code></pre><br/>
<div class="section-title" id="2_Buildingvocabularydescriptions">Building vocabulary descriptions</div><br/>
<pre><span id="VALadd_namespaces"><span class="keyword">val</span> add_namespaces</span> : <code class="type"><a href="Rdf_graph.html#TYPEgraph">Rdf_graph.graph</a> -> unit</code></pre><div class="info ">
Add usual <code class="code">rdf</code> and <code class="code">rdfs</code> namespaces in the given graph.<br/>
</div>
<pre><span id="VALmk_property"><span class="keyword">val</span> mk_property</span> : <code class="type"><a href="Rdf_graph.html#TYPEgraph">Rdf_graph.graph</a> -><br/> label:string -><br/> ?label_lang:(string * string) list -><br/> ?comment:string -><br/> ?comment_lang:(string * string) list -><br/> ?domains:Iri.t list -><br/> ?ranges:Iri.t list -><br/> ?subof:Iri.t -> ?more:(Iri.t * <a href="Rdf_term.html#TYPEterm">Rdf_term.term</a>) list -> Iri.t -> unit</code></pre>
<pre><span id="VALmk_class"><span class="keyword">val</span> mk_class</span> : <code class="type"><a href="Rdf_graph.html#TYPEgraph">Rdf_graph.graph</a> -><br/> label:string -><br/> ?label_lang:(string * string) list -><br/> ?comment:string -><br/> ?comment_lang:(string * string) list -><br/> ?subof:Iri.t -> ?more:(Iri.t * <a href="Rdf_term.html#TYPEterm">Rdf_term.term</a>) list -> Iri.t -> unit</code></pre></div></contents></ocamldoc>
|
lgpl-3.0
|
DualNova-Team/DualNova
|
src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php
|
2760
|
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program 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
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
use pocketmine\utils\Binary;
use pocketmine\network\mcpe\NetworkSession;
class CommandBlockUpdatePacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET;
/** @var bool */
public $isBlock;
/** @var int */
public $x;
/** @var int */
public $y;
/** @var int */
public $z;
/** @var int */
public $commandBlockMode;
/** @var bool */
public $isRedstoneMode;
/** @var bool */
public $isConditional;
/** @var int */
public $minecartEid;
/** @var string */
public $command;
/** @var string */
public $lastOutput;
/** @var string */
public $name;
/** @var bool */
public $shouldTrackOutput;
protected function decodePayload(){
$this->isBlock = (($this->get(1) !== "\x00"));
if($this->isBlock){
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->commandBlockMode = $this->getUnsignedVarInt();
$this->isRedstoneMode = (($this->get(1) !== "\x00"));
$this->isConditional = (($this->get(1) !== "\x00"));
}else{
//Minecart with command block
$this->minecartEid = $this->getEntityRuntimeId();
}
$this->command = $this->getString();
$this->lastOutput = $this->getString();
$this->name = $this->getString();
$this->shouldTrackOutput = (($this->get(1) !== "\x00"));
}
protected function encodePayload(){
($this->buffer .= ($this->isBlock ? "\x01" : "\x00"));
if($this->isBlock){
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->putUnsignedVarInt($this->commandBlockMode);
($this->buffer .= ($this->isRedstoneMode ? "\x01" : "\x00"));
($this->buffer .= ($this->isConditional ? "\x01" : "\x00"));
}else{
$this->putEntityRuntimeId($this->minecartEid);
}
$this->putString($this->command);
$this->putString($this->lastOutput);
$this->putString($this->name);
($this->buffer .= ($this->shouldTrackOutput ? "\x01" : "\x00"));
}
public function handle(NetworkSession $session) : bool{
return $session->handleCommandBlockUpdate($this);
}
}
|
lgpl-3.0
|
pcolby/libqtaws
|
src/cognitoidentityprovider/setriskconfigurationresponse_p.h
|
1417
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_SETRISKCONFIGURATIONRESPONSE_P_H
#define QTAWS_SETRISKCONFIGURATIONRESPONSE_P_H
#include "cognitoidentityproviderresponse_p.h"
namespace QtAws {
namespace CognitoIdentityProvider {
class SetRiskConfigurationResponse;
class SetRiskConfigurationResponsePrivate : public CognitoIdentityProviderResponsePrivate {
public:
explicit SetRiskConfigurationResponsePrivate(SetRiskConfigurationResponse * const q);
void parseSetRiskConfigurationResponse(QXmlStreamReader &xml);
private:
Q_DECLARE_PUBLIC(SetRiskConfigurationResponse)
Q_DISABLE_COPY(SetRiskConfigurationResponsePrivate)
};
} // namespace CognitoIdentityProvider
} // namespace QtAws
#endif
|
lgpl-3.0
|
pcolby/libqtaws
|
src/managedblockchain/getnoderequest_p.h
|
1393
|
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_GETNODEREQUEST_P_H
#define QTAWS_GETNODEREQUEST_P_H
#include "managedblockchainrequest_p.h"
#include "getnoderequest.h"
namespace QtAws {
namespace ManagedBlockchain {
class GetNodeRequest;
class GetNodeRequestPrivate : public ManagedBlockchainRequestPrivate {
public:
GetNodeRequestPrivate(const ManagedBlockchainRequest::Action action,
GetNodeRequest * const q);
GetNodeRequestPrivate(const GetNodeRequestPrivate &other,
GetNodeRequest * const q);
private:
Q_DECLARE_PUBLIC(GetNodeRequest)
};
} // namespace ManagedBlockchain
} // namespace QtAws
#endif
|
lgpl-3.0
|
virtualidentityag/hydra-youtube
|
src/VirtualIdentity/YoutubeBundle/EventDispatcher/YoutubeChangedEvent.php
|
882
|
<?php
/*
* This file is part of the Virtual-Identity Youtube package.
*
* (c) Virtual-Identity <dev.saga@virtual-identity.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace VirtualIdentity\YoutubeBundle\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;
use VirtualIdentity\YoutubeBundle\Interfaces\YoutubeEntityInterface;
class YoutubeChangedEvent extends Event
{
/**
* The youtube that changed
*
* @var YoutubeEntityInterface
*/
protected $youtube;
public function __construct(YoutubeEntityInterface $youtube)
{
$this->youtube = $youtube;
}
/**
* Returns the changed youtube
*
* @return YoutubeEntityInterface
*/
public function getYoutube()
{
return $this->youtube;
}
}
|
lgpl-3.0
|
BlueVia/Official-Library-Android
|
doc/html/interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html
|
32363
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>BlueViaAndroidSDK: IConnector Interface Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">BlueViaAndroidSDK <span id="projectnumber">1.6</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<h1>IConnector Interface Reference</h1> </div>
</div>
<div class="contents">
<!-- doxytag: class="com::bluevia::android::commons::connector::IConnector" --><div class="dynheader">
Inheritance diagram for IConnector:</div>
<div class="dyncontent">
<div class="center">
<img src="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.png" usemap="#IConnector_map" alt=""/>
<map id="IConnector_map" name="IConnector_map">
<area href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html" alt="HttpConnector" shape="rect" coords="0,56,127,80"/>
<area href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1oauth_1_1OauthHttpConnector.html" alt="OauthHttpConnector" shape="rect" coords="0,112,127,136"/>
</map>
</div></div>
<p><a href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#ad06de2f50730c56f1f4d1b7954182aa2">create</a> (String address, HashMap< String, String > parameters, byte[] content, HashMap< String, String > headers) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#a051a1e4484f52df99fd7571114af32b4">create</a> (String address, HashMap< String, String > parameters, <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1multipart_1_1BlueviaPartBase.html">BlueviaPartBase</a>[] parts, HashMap< String, String > headers) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#a4da5bb059903234fa3afb7313c4ba04e">retrieve</a> (String address) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#a75a6d7d28396eb465a579cbc0fb2d66c">retrieve</a> (String address, HashMap< String, String > parameters) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#ad43d7a92514a8f225c8af6aeae24943e">retrieve</a> (String address, HashMap< String, String > parameters, HashMap< String, String > headers) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#a41fe93a1beb25f96a782f8ecff131e0c">update</a> (String address, HashMap< String, String > parameters, byte[] body, HashMap< String, String > headers) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#acc2934759808396933bfde62be67352f">delete</a> (String address) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#ad32f9b7f6373778827ab6a1c6d92eba0">delete</a> (String address, HashMap< String, String > parameters) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#acd3fd00cecc225f815fb5347dbf6821f">delete</a> (String address, HashMap< String, String > parameters, HashMap< String, String > headers) throws BlueviaException, IOException</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html#a5ae591df94fc66ccb85cbb6565368bca">close</a> ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Interface that will be implemented by REST clients that will allow to manage REST requests and responses</p>
<dl class="author"><dt><b>Author:</b></dt><dd>Telefonica R&D </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a5ae591df94fc66ccb85cbb6565368bca"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::close" ref="a5ae591df94fc66ccb85cbb6565368bca" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void close </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Close and free all connector resources </p>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a5ae591df94fc66ccb85cbb6565368bca">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="ad06de2f50730c56f1f4d1b7954182aa2"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::create" ref="ad06de2f50730c56f1f4d1b7954182aa2" args="(String address, HashMap< String, String > parameters, byte[] content, HashMap< String, String > headers)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> create </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>parameters</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">byte[] </td>
<td class="paramname"><em>content</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>headers</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to create an entity using POST method</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
<tr><td class="paramname">parameters</td><td>The query parameters for the request </td></tr>
<tr><td class="paramname">content</td><td>the body of the request </td></tr>
<tr><td class="paramname">headers</td><td>headers of the request </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#ad06de2f50730c56f1f4d1b7954182aa2">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="a051a1e4484f52df99fd7571114af32b4"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::create" ref="a051a1e4484f52df99fd7571114af32b4" args="(String address, HashMap< String, String > parameters, BlueviaPartBase[] parts, HashMap< String, String > headers)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> create </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>parameters</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1multipart_1_1BlueviaPartBase.html">BlueviaPartBase</a>[] </td>
<td class="paramname"><em>parts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>headers</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using HTTP REST to the server in order to create a multipart entity</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
<tr><td class="paramname">parameters</td><td>the query parameters for the request </td></tr>
<tr><td class="paramname">parts</td><td>the multiparts </td></tr>
<tr><td class="paramname">headers</td><td>headers of the request </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a051a1e4484f52df99fd7571114af32b4">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="acd3fd00cecc225f815fb5347dbf6821f"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::delete" ref="acd3fd00cecc225f815fb5347dbf6821f" args="(String address, HashMap< String, String > parameters, HashMap< String, String > headers)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> delete </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>parameters</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>headers</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to retrieve an entity from the server</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
<tr><td class="paramname">parameters</td><td>the parameters in order to do the filtering </td></tr>
<tr><td class="paramname">headers</td><td>headers of the request </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a2342ba40560172f9aceeac45e1e3ddbc">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="ad32f9b7f6373778827ab6a1c6d92eba0"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::delete" ref="ad32f9b7f6373778827ab6a1c6d92eba0" args="(String address, HashMap< String, String > parameters)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> delete </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>parameters</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to retrieve an entity from the server</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
<tr><td class="paramname">parameters</td><td>the parameters in order to do the filtering </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a888dab2fccfcbb85bdaa1ea8196e68c0">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="acc2934759808396933bfde62be67352f"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::delete" ref="acc2934759808396933bfde62be67352f" args="(String address)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> delete </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em></td><td>)</td>
<td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to retrieve an entity from the server</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a9e81babddd39de3861a2f65466f9547d">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="ad43d7a92514a8f225c8af6aeae24943e"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::retrieve" ref="ad43d7a92514a8f225c8af6aeae24943e" args="(String address, HashMap< String, String > parameters, HashMap< String, String > headers)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> retrieve </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>parameters</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>headers</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to retrieve an entity from the server</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
<tr><td class="paramname">parameters</td><td>the parameters in order to do the filtering </td></tr>
<tr><td class="paramname">headers</td><td>headers of the request </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a7df1b99864332b8e4bb854c5d35ffd83">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="a75a6d7d28396eb465a579cbc0fb2d66c"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::retrieve" ref="a75a6d7d28396eb465a579cbc0fb2d66c" args="(String address, HashMap< String, String > parameters)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> retrieve </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>parameters</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to retrieve an entity from the server</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
<tr><td class="paramname">parameters</td><td>the parameters in order to do the filtering </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a7e03fb355e10e2efe14f99ac75ed767e">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="a4da5bb059903234fa3afb7313c4ba04e"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::retrieve" ref="a4da5bb059903234fa3afb7313c4ba04e" args="(String address)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> retrieve </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em></td><td>)</td>
<td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to retrieve an entity from the server</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#a29459927c0dc7612ec04e4a40a744217">HttpConnector</a>.</p>
</div>
</div>
<a class="anchor" id="a41fe93a1beb25f96a782f8ecff131e0c"></a><!-- doxytag: member="com::bluevia::android::commons::connector::IConnector::update" ref="a41fe93a1beb25f96a782f8ecff131e0c" args="(String address, HashMap< String, String > parameters, byte[] body, HashMap< String, String > headers)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1GenericResponse.html">GenericResponse</a> update </td>
<td>(</td>
<td class="paramtype">String </td>
<td class="paramname"><em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>parameters</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">byte[] </td>
<td class="paramname"><em>body</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">HashMap< String, String > </td>
<td class="paramname"><em>headers</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> throws <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1exception_1_1BlueviaException.html">BlueviaException</a>, IOException</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a request using REST to the gSDP server in order to create an entity</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">address</td><td>the uri to create the entity remotely via REST </td></tr>
<tr><td class="paramname">parameters</td><td>The query parameters for the request </td></tr>
<tr><td class="paramname">body</td><td>the body of the request </td></tr>
<tr><td class="paramname">headers</td><td>headers of the request </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the response of the operation </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
<table class="exception">
<tr><td class="paramname">BlueviaException</td><td></td></tr>
<tr><td class="paramname">IOException</td><td></td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="classcom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1http_1_1HttpConnector.html#af55a3162f4680d4537447c5aa912b355">HttpConnector</a>.</p>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>com</b> </li>
<li class="navelem"><b>bluevia</b> </li>
<li class="navelem"><b>android</b> </li>
<li class="navelem"><b>commons</b> </li>
<li class="navelem"><b>connector</b> </li>
<li class="navelem"><a class="el" href="interfacecom_1_1bluevia_1_1android_1_1commons_1_1connector_1_1IConnector.html">IConnector</a> </li>
<li class="footer">Generated on Fri May 11 2012 13:18:54 for BlueViaAndroidSDK by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
</ul>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Enumerations</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</body>
</html>
|
lgpl-3.0
|