package test

合集下载

java接口默认修饰符

java接口默认修饰符

java接⼝默认修饰符概论: java接⼝可以是public 的,也可以是friendly的,但⼀定是abstracted的。

java接⼝⾥的⽅法只能是public的、abstract的。

java接⼝⾥的成员变量只能是public 的,static 的,final的;并且必须赋初值,否则通不过编译。

C++⽀持多重继承,如果两个⽗类有相同的成员变量,处理起来⽐较困难。

java 接⼝的成员变量之所以这样设计,就是为了解决C++ 中的这个问题。

成员变量必须是static 的,所以接⼝⾥的成员变量就不再属于某个对象,⽽是属于这个接⼝的。

⼦类的对象⾥就没有⽗类的这个成员变量。

那怎样使⽤⽗类⾥的成员变量呢?public interface Father {int i = 0;}public interface Father2 {int i = 2;}public class Son implements Father, Father2 {static int i = 3;public static void main(String[] args) {System.out.println(Father.i);System.out.println(Father2.i);System.out.println(i);}}接⼝问题: 实现两个接⼝,这两个接⼝⾥有两个签名相同,返回值不同的⽅法。

⼀个类同时实现,报错。

package test;public interface InterfaceTest { void todo();}/*** 以下是反编译的内容,接⼝默认是abstract的,* 接⼝⾥的⽅法默认都是public的、abstract的。

*package test;public abstract interface InterfaceTest { public abstract void todo();}*/上⾯⽤得是第三⽅的⼀个反编译⼯具,⽤ Eclipse 反编译插件编译后的结果却不同,如下:package test;public interface InterfaceTest { void todo();}接下来⼀探究竟:1.创建⼀个java 接⼝:public interface TestInterface {void say();}2.为这个接⼝添加⼀个abstract 修饰符public abstract interface TestInterface {void say();}结果⼀切正常,它的实现类运⾏毫不影响。

UL校准实验室电源要求

UL校准实验室电源要求

ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14 Form Page 1 Form Revised: 2005-12-27Number of pages in this package ____TEST LOCATION: []UL or Affiliate[]WTDP[]CTDP[]OTHERCompany Name Ting Un Product Service Co LtdAddress Floor 3, FANGXIN Bldg., No. 9, Jiangong Rd., Tianhe SoftwarePark, Zhongshan, Guangzhou, China.CLIENT INFORMATIONCompany Name Shenzhen S & T Motor Co LtdAddress Blk 20, No. 1, Tangjia Industrial Zone, Gongming Town, BaoanDistrict, Shenzhen, Guangdong, 518000AUDIT INFORMATION: [X] Description of TestsPer Standard No. UL 507C22.2 No.113 Edition 9th edition, withrevision pages dated Sept 27, 2007Sixth edition, with revisionpages April, 1997[ ] Tests Conducted by +Printed nameSignature[ ] UL Staff witnessing testing (WTDP only)Printed name Signature Reviewed and accepted by qualified Project HandlerPrinted Name Signature[]The following tests conducted in accordance with UL ______ were considered representative of the same tests required by Canadian Standard, ______.TESTS TO BE CONDUCTED: Test No. Done Test Name [X] Comments/Parameters []Tests Conducted by ++1 INDEPENDENCE OF TEST CIRCUIT:2 L, N, G VOLTAGE MEASUREMENTTEST:3ELECTRICAL REGULATION / CIRCUIT CAPACITY TESTS:[]The test facility was deemed to have the environment and capabilities necessary to perform the tests included in this data package. (WTDP Only)Test Equipment- See "TEST EQUIPMENT INFORMATION"Samples – See "TEST SAMPLE IDENTIFICATION"Instructions -+ - When all tests are conducted by one person, printed name and signature can be inserted here instead of including printed name and signature on each page containing data. Must indicate number of pages in the data package.++ - When test conducted by more than one person, printed name and signature of person conducting the test can be inserted next to the test name insteadof including printed name and signature on each page containing data. Must indicate number of pages in the data package.Special Instructions –Unless specified otherwise in the individual Methods, the tests shall be conducted under the following ambient conditions. Confirmation of these conditions shall be recorded at the time the test is conducted.AmbientTemperature, C 25 ± 15If the temperature attained by any part is limited by a temperature sensitive device, or is influenced by the temperature at which a change of state occurs, for example, the temperature of boiling water, the room temperatureis , increase of doubt maintained at:AmbientTemperature, C 23 ± 2ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 2 Form Revised: 2005-12-27Printed NameSignatureULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14 Form Page 3 Form Revised: 2005-12-27TEST EQUIPMENT INFORMATIONInst. ID No. InstrumentType Test Number +, TestTitle or Conditioning Function /Range Last Cal.Date Next Cal.Date+ - If Test Number is used, the Test Number must be identified on the data sheet pages or on the Data Sheet Package cover page.Printed Name SignatureThe following additional information is required when using client’s orrented equipment, or when a UL ID Number for an instrument number is not used. The Inst. ID No. below corresponds to the Inst. ID No. above.Inst.ID No. Make/Model/Serial Number/Asset No.[]The M&TE used for tests have minimum required accuracy and range/functions, and were calibrated to assure these levels.[]Test equipment information is recorded on UL’s Laboratory Project Management (LPM)/Laboratory Equipment Management (LEM) database. (This statement may be selected only if datasheets are completed electronically at a UL facility)ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 4 Form Revised: 2005-12-27Printed Name SignatureULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14 Form Page 5 Form Revised: 2005-12-27TEST SAMPLE IDENTIFICATION:The table below is provided to provide correlation of sample numbers to specific product related information. Refer to this table when a test identifies a test sample by "Sample No." only.Sample CardNo.Date Received[] Test No. Sample No.Manufacturer, Product Identification and Ratings+ - If Test Number is used, the Test Number or Numbers the sample was used in must be identified on the data sheet pages or on the Data Sheet Package cover page.[] Sampling Procedure -Printed Name SignatureThe following tests are intended for 50Hz and 60Hz power sources havingnominal voltages of 120V, 220V, 230V, 240V, 250V, 380V, 400V, 480V, 600V,etc.1. INDEPENDENCE OF TEST CIRCUITS2. L, N, G VOLTAGE MEASUREMENT TEST3. ELECTRICAL REGULATION / CIRCUIT CAPACITY TESTSA.VOLTAGE REGULATION / CIRCUIT CAPACITY TESTB. FREQUENCY STABILITY - LOADED SUPPY TESTC.TOTAL HARMONIC DISTORTION TEST1. The “Independence of Test Circuits” should be performed first whenpossible.2. The “Frequency Stability – Loaded Supply Test” is typically appliedwhere frequency converters are applied. In most cases, power grids in industrialized countries provide acceptable frequency stability. SeeU.S. Department of Commerce “Electrical Current Abroad” to assist indetermining if domestic power sources maintain a stable frequency.(/td/machinery/reports/current2002FINAL.pdf)3. The point selected for analysis to be located at the greatest electricaldistance (wiring length) from the supply transformer or power converter. Required items:1. A wiring diagram of the test circuit(s) in the test facility needs to beobtained for proper analysis. This diagram should illustrate wiringfrom the point of test back to the first transformer connection pointsupplying the test circuit(s).2. A general map or layout of the test facility indicating the location ofthe circuits being analyzed is recommended if the location cannot beeasily described.3. A calibrated:- Voltmeter- Ammeter- Total Harmonic Distortion (THD) Analyzer4. A resistive load(s) capable of loading the test circuit to the requiredamperage value. Typical loading is 20A for 120V and 15 A for 220Vthrough 250V*supply. Power sources having higher voltages are to beloaded at the rated circuit amperage value, or the maximum steady-state load expected during product testing. *Note – Some 50Hz 220V circuits are designed and limited to 10A maximum.ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 6 Form Revised: 2005-12-27Printed Name SignatureULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14 Form Page 7 Form Revised: 2005-12-27INDEPENDENCE OF TEST CIRCUIT:Where analysis of the facility wiring diagram indicates test circuits are connected to the same source of power as high demand switching loads such as air conditioning/ heating or manufacturing systems, the effect on test circuits from the cycling of this equipment is to be determined.METHOD1. The duration of this test is to be adjusted to allow high demandstarting loads to cycle. The cycling may need to occur more than once to determine the effect, in magnitude and duration, that the starting loads may have on the test circuits.2. The open circuit voltage at each representative test bench is to bemeasured under the normal daily conditions with air-conditioning / heating, manufacturing and lighting system in use.3. The measurement is to be repeated with air-conditioning/ heating andlighting system turned off. Make a note if the lighting system could not be turned off.RESULTS[ ] Bench outlet receptacle / test power connection point designation:______________[ ] See attached floor plan / wiring diagram.Usual conditionOpen circuitvoltage, VUnusual conditionsOpen circuitvoltage, VPrinted Name SignatureINDEPENDENCE OF TEST CIRCUIT: (CONT’D)RESULTS (CONT’D)The voltage measured at unusual conditions did not deviate from the usual condition by more than ±3% (or the value_____specified in the test standard).True _____ False _____ ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 8 Form Revised: 2005-12-27Printed Name SignatureULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14 Form Page 9 Form Revised: 2005-12-27L, N, G VOLTAGE MEASUREMENT TEST:METHODEach representative test bench outlet receptacle, or test powerconnection point, was checked by measuring the open circuit voltage between Line and Ground (L-G), Neutral and Ground (N-G), and Line and Neutral (L-N).NOTE – This test is not applicable for ungrounded “delta” systems.RESULTSOpen Circuit Voltage, V Bench / Location No. Receptacle No / ID. L-N L-G N-G[ ] The measured open circuit voltage between L-G is the same as thatbetween L-N.True _____ False _____[ ] The measured open circuit voltage at N-G is less than 4 V True _____ False _____Printed Name SignatureL, N, G VOLTAGE MEASUREMENT TEST: (CONT’D)NOTE 1 – If the L-G voltage measurement does not equal L-N voltage, the ground and / or neutral circuit connections may require service. Corrective action is required before proceeding with testing.NOTE 2 – If N-G voltage measurement is 4V or greater, circuit resistance of the ground path may be too high. Investigation and corrective action is required before proceeding with testing.Engineering or Lab Notes:1. Refer to the wiring diagram and floor plan for the location of thereceptacle / power connection point.ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 10 Form Revised: 2005-12-27Printed Name SignatureELECTRICAL REGULATION / CIRCUIT CAPACITY TESTS:Measurements “A”, “B” and “C” may be performed simultaneously.A. VOLTAGE REGULATION / CIRCUIT CAPACITY TESTMETHOD1. The open circuit voltage at the representative test bench receptacle /test power connection point is to be measured. Without furtheradjustment, the measurement is to be repeated after one hour.2. Without further adjusting the voltage, a load is connected to the sameoutlet / test power connection point to draw a minimum of 20A for 120V and 15 A for 220V through 250V* supply. Power sources having highervoltages are to be loaded at the rated circuit amperage value, or themaximum steady-state load expected during product testing. The voltage at the bench receptacle is measured. The loaded circuit is to operate for one hour and the input voltage under this loading condition is to be measured again and recorded.B. FREQUENCY STABILITY - LOADED SUPPY TESTMETHODNOTE - In most cases, power grids in industrialized countries provide acceptable frequency stability. See U.S. Department of Commerce “Electrical Current Abroad” to assist in determining if domestic power sources maintain a stable frequency.(/td/machinery/reports/current2002FINAL.pdf)1. The frequency of the voltage (sinusoid) at the representative test benchreceptacle / power connection point is to be measured under open circuit conditions.2. A load is to be connected and adjusted to draw a minimum of 20A for 120Vand 15 A for 220V through 250V* supply without further adjusting thevoltage. Power sources having higher voltages are to be loaded at the rated circuit amperage value, or the maximum steady-state load expected during product testing. The frequency of power source is to be measured with a frequency counter or with an oscilloscope. The circuit is to be loaded for one hour and the frequency under this loading condition is to be measured again and recorded.ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 11 Form Revised: 2005-12-27Printed Name SignatureELECTRICAL REGULATION / CIRCUIT CAPACITY TESTS: (CONT’D)*Note – Some 50Hz 220V circuits are designed and limited to 10A maximum. Use this value when loading these circuits and make a notation in the “Remarks” column.C. TOTAL HARMONIC DISTORTION TESTMETHOD1. Using a Total Harmonic Distortion analyzer, the harmonic distortion ofthe voltage at the representative test bench receptacle / powerconnection point is to be measured under open circuit conditions.2. The total harmonic distortion is measured with the bench receptacleloaded to a minimum of 20 A for 120V and 15 A for 220V through 250 V*supply without further adjusting the voltage. Power sources havinghigher voltages are to be loaded at the rated circuit amperage value, or the maximum steady-state load expected during product testing. Thecircuit with this load was allowed to operate for one hour and theharmonic distortion under this loading condition was measured again.*Note – Some 50Hz 220V circuits are designed and limited to 10A maximum. Use this value when loading these circuits and make a notation in the “Remarks” column.ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 12 Form Revised: 2005-12-27Printed Name SignatureELECTRICAL REGULATION / CIRCUIT CAPACITY TESTS: (CONT’D)- Practical Application –Making THD Measurements- Where IEC 61000-4-7 is applied in making harmonic measurements, an Instrument Class II rating is sufficient for obtaining data within UL’s laboratories.- Where IEC 61000-4-7 is not applied, measurements to the 50th harmonic are sufficient. Care must be made to record all THD instrumentsettings, including the filter window settings, to allow repeatability of future measurements. In the event the instrument filter settings are not accessible (or known) by the operator, the instrument manufacturer should be consulted to determine the type of filter window utilized in the instrument.1. Prior to making harmonic measurements, a detail schematic of thepower system being analyzed should be developed. This informationwill allow single-point harmonic measurements to be made wheremultiple parallel (voltage) paths exist, reducing measurement timeand the need to deploy multiple instruments.2. In many cases, the farthest “upstream” point from the connectionwhere harmonics are a concern will be at the output of the firstdistribution transformer encountered. Making a measurement atthis transformer will typically be representative of all parallelconnections (distribution panels, disconnects, etc) made at theoutput of the transformer.3. The measuring instrument should only be connected to the circuitin accordance with the manufacturer’s instructions. Specialattention should be paid to the maximum allowable instrumentvoltage with respect to the circuit to be measured.ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 13 Form Revised: 2005-12-27Printed Name SignatureULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14 Form Page 14 Form Revised: 2005-12-27ELECTRICAL REGULATION / CIRCUIT CAPACITY TESTS: (CONT’D)Engineering or Lab Notes:1. Refer to the wiring diagram and floor plan for the location of thereceptacle / power connection pointRESULTSA. Voltage Regulation / Circuit Capacity,B. Frequency StabilityC. Total Harmonic Distortion[ ] Bench outlet receptacle / test connection designation: ______________[ ] See attached floor plan / wiring diagram.Operating Condition Output Loading Current (A)Voltage (V) Frequency (Hz) THD of Voltage (%) Remarks Open circuit, at t = 0----------V oc1 = F oc1 =Open circuit, at t = 1 hr---------- V oc2 = F oc2 = -Max. load, at t = 0(for refonly)V max load 1 = F 1 =Max. load, at t = 1 hrV max load 2 = F 2 =Printed Name SignatureELECTRICAL REGULATION / CIRCUIT CAPACITY TESTS: (CONT’D)RESULTS (CONT’D)A. Voltage Regulation / Circuit Capacity1. Unloaded condition:The unloaded voltage regulation was calculated to be MAX of (V oc max - V nom ) x 100 = ____%; (V nom - V oc min) x 100= _____%The results comply with the voltage regulation requirement of ± 3% (or thelimit of ____ as specified in test standard______________)for unloaded condition (check one):True _____ False _____ 2.Max. loaded conditionThe loaded voltage regulation was calculated to be MAX of (V oc max - V nom ) x 100 = _____; (V nom - V oc min) x 100 = ________%The results comply with the voltage regulation requirement of ± 3% (or thelimit of ____ as specified in test standard______________) for max. loaded condition (check one):True _____ False _____ B. Frequency Stability – Loaded circuitFrequency variation = MAX of (F oc max – F nom)/F nom) X 100) = ______% ;(F nom – F oc min)/F nom) X 100 = ______%The results comply with the frequency tolerance of ±2.0% (or the limit of_____as specified in test standard______________) for max. frequencyvariation.True _____ False _____ ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 15 Form Revised: 2005-12-27Printed Name SignatureELECTRICAL REGULATION / CIRCUIT CAPACITY TESTS: (CONT’D)RESULTS (CONT’D)C. Total Harmonic DistortionBoth the THD at open circuit and at max load condition comply with the THD of 5% (or the value_____specified in the test standard) maximum*.True _____ False _____ *THD values greater than 5.0% may be judged acceptable if agreed to by all parties involved, the rationale is documented and requirements of the test standard are maintained.ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14Form Page 16 Form Revised: 2005-12-27Printed Name SignatureEND OF DATASHEET PACKAGE. THIS PAGE INTENTIONALLY LEFT BLANK ULS-01278-KKPT-DataSheet-2001 Form Issued: 2004-05-14 Form Page 17 Form Revised: 2005-12-27。

跌落试验标准(Dropteststandard)

跌落试验标准(Dropteststandard)

跌落试验标准(Drop test standard)Package drop test standard published: 10-05-05 source: Hits: 1903 field selection: large and smallPackage drop test standardPeople's Republic of China national standardGB/T4857.5-92 instead of GB4857.5-84Method of drop test for packaged transport packagesPackaging-Transport packages-Vertical impacttest method by droppingTransport package drop test in the standard equivalent to the international standard ISO2248-1985 "packaging - complete and filled".1. subject matter and scope:This standard specifies the content of vertical impact testing for performance test equipment, test procedures and test reports for transport packages.This standard is applicable to the evaluation of the protection ability of transport packages under vertical impact the impact strength and packaging of the contents. It can be used as a single test, also can be used as part of a series of experiments.2. reference standard:Marking method of GB/T4857.1 packaging transport packages of various parts of theGB/Y4857.2 packaging transport packages temperature and humidity conditioningThe general principle of GB/T4857.17 packaging transport packages compilation of performance test programThe quantitative data of GB/T4857.18 packaging transport packages for the compilation of performance test3. test principle: filed test samples to a predetermined height, and then make it according to the predetermined state of free fall, collision and impact table.4. test equipment:4.1. impact: impact test table for the horizontal plane, does not move, not deformation, and meet the following requirements:A. is a single object, quality is at least 50 times of test sample quality;B. have a large enough area, to ensure that the test sample falls completely in the impact on the table;The impact of C. in the table any two points on the level of clearance was more than 2mm;The impact of 100mm2 on the table D. in any area under static load of 10kg, the deformation amount shall not exceed 0.1mm.4.2. lifting device: in lifting or descending process, should not damage the test sample.4.3. support device: support device of test samples should be able to make the test sample in the predetermined state required prior to release.4.4. release: in the release of the test sample in the fall, should make the test sample without any part of touch device, ensure the selfDrop by.5. test procedure:5.1. test sample preparation: prepare the test samples according to the requirements of GB/T4857.17.The various parts of the 5.2. test sample number: each part of the test samples are numbered according to the provisions of GB/T4857.1.Pretreatment of 5.3. test sample: according to the provisions of GB/T4857.2, selected a condition of temperature and humidity on the test sample pretreatment.Temperature and humidity conditions in the 5.4. test:The test shall be carried out in the pretreatment with the same conditions of temperature and humidity. If not up to the pretreatment conditions, should be in as far as possible to test pretreatment temperature and humidity conditions.5.5.Test intensity value choice: according to the provisions of GB/T4857.18 test of strength value.5.6 test procedure:5.6.1 filed test samples to the drop height of the required position, and according to a predetermined state will hold. The vertical height and predeterminedThe height difference does not exceed a predetermined level + 2%. Drop height refers to the test sample is ready to release the lowest and the impact of the tableThe distance between.5.6.2 according to the predetermined state, the release of test samples:A. falls, the angle between the drop side and the level of test sample surface maximum of not more than 2 degrees;B. edge drop, the angle between the edge of the South and drop level maximum of not more than 2 degrees, the test sample surface and the impact of regulationsTable error angle not greater than 5 degrees angle or 10% (with larger values prevail), so that the test sample of gravityBy falling edge line;C. angle drop, the test sample set angle error surface and the impact surface is less than 5 or the 10% (with a large angleThe numerical test samples shall prevail), so that the gravity line through the drop angle;D. no matter what the state and shape of the test samples, test samples should be made by the gravity line surface, line, drop point.The actual impact velocity and impact velocity of 5.6.3. free fall when the difference is no more than a free fall of + 1%.5.6.4. after the test according to the relevant standards or regulations to inspect the damage filling packaging and test results are analyzed.6. test report:The contents of the A. name, specification, type and quantity;The number of B. test samples;C. details: name, packing container size, structure and material specifications; accessories, buffer pad, support,fixing method,Sealing, bundling and other protective measures;The quality and the quality of the contents of the D. test samples, in kilograms;E. pretreatment temperature relative humidity and pretreatment time;F. for testing the temperature and relative humidity;G. detailed placement status test samples when testing;Sequence number h. and drop test samples;Drop height I. test samples, in millimeters;The type of equipment used by J. test;K. records of the test results, and observed in the trial in any help to the correct interpretation of test results of the phenomenon;L. it is shown that the difference of the standard and test method;M. test date, test personnel to sign, seal test.。

ptest包的说明文档说明书

ptest包的说明文档说明书

Package‘ptest’October14,2022Type PackageTitle Periodicity Tests in Short Time SeriesVersion1.0-8Date2016-11-12Author Yuanhao Lai and A.I.McLeodMaintainer A.I.McLeod<***************>Depends R(>=3.0),Description Implements p-value computations using an approximation to the cumulative distribu-tion function for a variety of tests for periodicity.These tests include harmonic regres-sion tests with normal and double exponential errors as well as modifica-tions of Fisher's g test.An accompanying vignette illustrates the application of these tests. License GPL(>=2)LazyData trueNeedsCompilation yesImports quantreg(>=5.0)RoxygenNote5.0.1Suggests knitr,boot,lattice,rmarkdown,GeneCycle,VignetteBuilder knitrRepository CRANDate/Publication2016-11-1221:41:37R topics documented:alpha (2)B1 (3)B2 (4)B3 (5)Cc (6)cdc15 (7)cdc28 (7)12alpha fitHReg (8)pgram (9)ptestg (10)ptestReg (12)simHReg (14)Index16 alpha Microarray time series experiment for yeast cell cycle from alpha ex-perimentDescription6,178yeast genes expression measures(log-ratios)with series length18from the alpha factor ex-periment.Usagedata(alpha)FormatMatrix with6178rows and18columns.Some missing data.Rows and columns are labelled.-attr(*,"dimnames")=List of2..$:chr[1:6178]"Y AL001C""Y AL002W""Y AL003W""Y AL004W".....$:chr[1:18]"alpha0""alpha7""alpha14""alpha21"...SourceThe data is extracted from the ExpressionSet of the R package yeastCC.ReferencesSpellman,P.T.,Sherlock,G.,Zhang,M.Q.,Iyer,V.R.,Anders,K.,Eisen,M.B.,...&Futcher,B.(1998).Comprehensive identification of cell cycle-regulated genes of the yeast Saccharomycescerevisiae by microarray hybridization.Molecular biology of the cell,9(12),3273-3297.Dudoit S(2016).yeastCC:Spellman et al.(1998)and Pramila/Breeden(2006)yeast cell cycle microarray data.R package version1.12.0.Examplesdata(alpha)qqnorm(colMeans(alpha,na.rm=TRUE))qqnorm(rowMeans(alpha,na.rm=TRUE))B13 B1Benchmark set B1DescriptionList for yeast genes which are most likely to be periodic(the benchmark set1in de Lichtenberg et al.(2005)).Usagedata(B1)FormatA vector containg113genes’names.DetailsA total of113genes previously identified as periodically expressed in small-scale experiments.Theset encompasses the104genes used by Spellman et al.(1998)and nine genes added by Johansson et al.(2003).SourceThe raw data can be downloaded from http://www.cbs.dtu.dk/cellcycle/yeast_benchmark/ benchmark.php.ReferencesDe Lichtenberg,U.,Jensen,L.J.,Fausboll,A.,Jensen,T.S.,Bork,P.,&Brunak,S.(2005).Compar-ison of computational methods for the identification of cell cycle-regulated genes.Bioinformatics, 21(7),1164-1171.Examplesdata(alpha)data(B1)alphaB1<-alpha[rownames(alpha)\%in\%B1,]4B2 B2Benchmark set B2DescriptionList for yeast genes which are most likely to be periodic(the benchmark set2in de Lichtenberg et al.(2005)).Usagedata(B2)FormatA vector containg352genes’names.DetailsGenes whose promoters were bound(P-value below0.01)by at least one of nine known cell cycle transcription factors in both of the Chromatin IP studies by Simon et al.(2001)and Lee et al.(2002).To obtain a benchmark set that is independent of B1,we removed all genes included in B1(50).The resulting benchmark set,B2,consists of352genes of which many should be expectedto be cell cycle regulated,since their promoters are associated with known stage-specific cell cycle transcription factors.SourceThe raw data can be downloaded from http://www.cbs.dtu.dk/cellcycle/yeast_benchmark/ benchmark.php.ReferencesDe Lichtenberg,U.,Jensen,L.J.,Fausboll,A.,Jensen,T.S.,Bork,P.,&Brunak,S.(2005).Compar-ison of computational methods for the identification of cell cycle-regulated genes.Bioinformatics, 21(7),1164-1171.Examplesdata(alpha)data(B2)alphaB2<-alpha[rownames(alpha)\%in\%B2,]B35 B3Benchmark set B3DescriptionList for yeast genes which are less likely to be periodic(the benchmark set3in de Lichtenberg et al.(2005)).Usagedata(B3)FormatA vector containg518genes’names.DetailsGenes annotated in MIPS(Mewes et al.,2002)as’cell cycle and DNA processing’.From these,we removed genes annotated specifically as’meiosis’and genes included in B1(67),leaving518genes.As a large number of genes involved in the cell cycle are not subject to transcriptional regulation (not periodic),and because B1was explicitly removed,a relatively small fraction of these genes should be expected to be periodically expressed.SourceThe raw data can be downloaded from http://www.cbs.dtu.dk/cellcycle/yeast_benchmark/ benchmark.php.ReferencesDe Lichtenberg,U.,Jensen,L.J.,Fausboll,A.,Jensen,T.S.,Bork,P.,&Brunak,S.(2005).Compar-ison of computational methods for the identification of cell cycle-regulated genes.Bioinformatics, 21(7),1164-1171.Examplesdata(alpha)data(B3)alphaB3<-alpha[rownames(alpha)\%in\%B3,]6Cc Cc Microarray time series experiment for Caulobacter crescentus bacte-rial cell cycleDescriptionIn this microarray experiment there are3062genes measured every1hour.There are19is missing gene labels and these have been given labels ORFna1,...,ORFna19.There310with duplicate labels.Of these duplicate labels,295are duplicated twice,12are duplicated3times and3are duplicated 4times.Duplicate labels are renamed ORF...to ORF...a and ORF...b etc.Usagedata(Cc)FormatMatrix with3062rows and11columns.Some missing data.Rows and columns are labelled.-attr(*,"dimnames")=List of2..$:chr[1:3062]"ORF06244a""ORF03152a""ORF03156a""ORF03161a".....$:chr[1:11]"1""2""3""4"...DetailsGene expression from synchronized cultures of the bacterium Caulobacter crescentus(Laub et al., 2000).(Laub et al.,2000)identified553genes whose messenger RNA levels varied as a function of the cell cycle but their statistical analysis was not very sophisticated and they probably identified too many genes.Wichert et al.(2004)found that44genes were found which displayed periodicity based on the Fisher’s g-test using a FDR with q=0.05.ReferencesLaub,M.T.,McAdams,H.H.,Feldblyum,T.,Fraser,C.M.and Shapiro,L.(2000)Global analysis of the genetic network controlling a bacterial cell cycle Science,290,2144-2148.Wichert,S.,Fokianos K.and Strimmer K.(2004)Identifying periodically expressed transcrips in microarray time series data.Bioinformatics,18,5-20.Examplesdata(Cc)qqnorm(colMeans(Cc,na.rm=TRUE))qqnorm(rowMeans(Cc,na.rm=TRUE))cdc157 cdc15Microarray time series experiment for yeast cell cycle from cdc15ex-perimentDescription6,178yeast genes expression measures(log-ratios)with series length24from the cdc15experiment. Usagedata(cdc15)FormatMatrix with6178rows and24columns.Some missing data.Rows and columns are labelled.-attr(*,"dimnames")=List of2..$:chr[1:6178]"Y AL001C""Y AL002W""Y AL003W""Y AL004W".....$:chr[1:24]"cdc15.10""cdc15.30""cdc15.50""cdc15.70"...SourceThe data is extracted from the ExpressionSet of the R package yeastCC.ReferencesSpellman,P.T.,Sherlock,G.,Zhang,M.Q.,Iyer,V.R.,Anders,K.,Eisen,M.B.,...&Futcher,B.(1998).Comprehensive identification of cell cycle-regulated genes of the yeast Saccharomycescerevisiae by microarray hybridization.Molecular biology of the cell,9(12),3273-3297.Dudoit S(2016).yeastCC:Spellman et al.(1998)and Pramila/Breeden(2006)yeast cell cycle microarray data.R package version1.12.0.Examplesdata(cdc15)qqnorm(colMeans(cdc15,na.rm=TRUE))qqnorm(rowMeans(cdc15,na.rm=TRUE))cdc28Microarray time series experiment for yeast cell cycle from cdc28ex-perimentDescription6,178yeast genes expression measures(log-ratios)with series length17from the cdc28experiment. Usagedata(cdc28)8fitHRegFormatMatrix with6178rows and17columns.Some missing data.Rows and columns are labelled.-attr(*,"dimnames")=List of2..$:chr[1:6178]"Y AL001C""Y AL002W""Y AL003W""Y AL004W".....$:chr[1:17]"cdc28.0""cdc28.10""cdc28.20""cdc28.30"...SourceThe data is extracted from the ExpressionSet of the R package yeastCC.ReferencesSpellman,P.T.,Sherlock,G.,Zhang,M.Q.,Iyer,V.R.,Anders,K.,Eisen,M.B.,...&Futcher,B.(1998).Comprehensive identification of cell cycle-regulated genes of the yeast Saccharomycescerevisiae by microarray hybridization.Molecular biology of the cell,9(12),3273-3297.Dudoit S(2016).yeastCC:Spellman et al.(1998)and Pramila/Breeden(2006)yeast cell cycle microarray data.R package version1.12.0.Examplesdata(cdc28)qqnorm(colMeans(cdc28,na.rm=TRUE))qqnorm(rowMeans(cdc28,na.rm=TRUE))fitHReg Fits Three Parameter Harmonic RegressionDescriptionEstimates A,B and f in the harmonic regression,y(t)=mu+A*cos(2*pi*f*t)+B*sin(2*pi*f*t)+e(t).The default algorithm is enumerative but an exact non-linear LS option is also provided.UsagefitHReg(y,t=1:length(y),algorithm=c("enumerative","exact"))Argumentsy series.t Time points.algorithm method for the optimizationDetailsProgram is interfaced to C for efficient computation.ValueObject of class"HReg"produced.pgram9 Author(s)A.I.McLeod and Yuanhao LaiExamplesset.seed(193)z<-simHReg(10,f=2.5/10,1,1)ans<-fitHReg(z)ans$freq#optimal frequency=0.2376238##ORF06806in Cc dataset.z<-c(0.42,0.89,1.44,1.98,2.21,2.04,0.82,0.62,0.56,0.8,1.33)ans2<-fitHReg(z,algorithm="exact")sum(resid(ans2)^2)#0.2037463ans1<-fitHReg(z)sum(resid(ans1)^2)#0.242072#compare with nls()t<-1:length(z)ans<-nls(z~mu+alpha*cos(2*pi*lambda*t+phi),start=list(mu=1,alpha=1,lambda=0.1,phi=0.0))coefficients(ans)sum(resid(ans)^2)#0.2037pgram Periodogram computationDescriptionThe periodogram is computed.Usagepgram(z,fr="default",method=c("periodogram","regression"))Argumentsz time series vector of length n,say.fr use"default"for usual Fourier frequencies,1/n,...,floor(n/2)/n.Set fr=N,to evaluate the periodogram at the Fourier frequencies corresponding to a time se-ries of length N.Finally set fr to any desired set of frequencies.Note frequenciesare in cycles per unit time sometimes called temoral frequency to distinguishfrom angular frequency.Both are widely used in time series.method either periodogram or regression10ptestg DetailsUses FFT.So if the length of z is a highly composite number,the computation is very efficient.Otherwise the usual DFT is used.ValuePeriodogram evaluated at the Fourier frequencies or R-square.Author(s)A.I.McLeod and Yuanhao LaiExamplesz<-sunspot.yearn<-length(z)I<-pgram(z)f<-I[,1]I<-I[,2]plot(f,I,xlab="f",ylab="f",type="l")title(main="Periodogram for Annual Sunpots,1700-1988")#z<-c(0.42,0.89,1.44,1.98,2.21,2.04,0.82,0.62,0.56,0.8,1.33)fr<-(1:50)/101pgram(z)pgram(z,fr=101)pgram(z,fr=fr)pgram(z,method="regression")pgram(z,method="regression",fr=101)pgram(z,method="regression",fr=fr)ptestg Test short time series for periodicity based on periodogramsDescriptionThis function is used to test the existence of the periodicity for a short time series(length<=100).Several methods based on periodograms are provided with the response surface method imple-mented for efficiently obtaining accurate p-values.Usageptestg(z,method=c("Fisher","robust","extended","extendedRobust","FisherRSR"),multiple=FALSE)ptestg11Argumentsz A series or a matrix containg series as columnsmethod The statistical test to be used.See details for more information.multiple Indicating whether z contains multiple series.DetailsThe null hypothesis is set as no peridicities,H0:f=0.Discriptions of different test statistics(meth-ods)are as follow:Fisher:The Fisher’s g test statistic.The p-value is computed directly from the exact distribution.robust:The robust g test proprosed in Ahdesmaki et al.(2005),where the p-value is computed bythe response surface regression method.extended:The extended Fisher’s g test statistic,which extend the Fisher’s g test by enlarging thesearching region of the frequency from the fourier frequencies to be En=j/101|j=1,...,50andj/101≥1/n.The p-value is computed by the response surface regression method.extendedRobust:Extend the frequency searching region of the robust En=j/101|j=1,...,50andj/101≥1/n.The p-value is computed by the response surface regression method.FisherRSR:Only for experimental purposes,the Fisher;s g test with p-value computed form theresponse surface regression method.ValueObject of class"Htest"produced.An object of class"Htest"is a list containing the following components:obsStat Vector containing the observed test statistics.pvalue Vector containing the p-values of the selected tests.freq Vector containing the estimated frequencies.Author(s)Yuanhao Lai and A.I.McLeodReferencesFisher,R.A.(1929).Tests of significance in harmonic analysis.Proc.Roy.Soc.A,125,54-59.Ahdesmaki,M.,Lahdesmaki,H.,Pearson,R.,Huttunen,H.,and Yli-Harja O.(2005).BMC Bioin-formatics6:117./1471-2105/6/117.MacKinnon,James(2001):Computing numerical distribution functions in econometrics,Queen’sEconomics Department Working Paper,No.1037.See AlsoptestRegExamples#Simulate the harmonic regression model with standard Gaussian error termsset.seed(193)##Non-Fourier frequencyz<-simHReg(n=14,f=2/10,A=2,B=1,model="Gaussian",sig=1)ptestg(z,method="Fisher")ptestg(z,method="robust")ptestg(z,method="extended")ptestg(z,method="extendedRobust")ptestg(z,method="FisherRSR")#Performe tests on the alpha factor experimentdata(alpha)##Eliminate genes with missing observationsalpha.nonNA<-alpha[complete.cases(alpha),]##Using the multiple option to do the test for all the genes##Transpose the data set so that each column stands for a genealpha.nonNA<-t(alpha.nonNA)result<-ptestg(alpha.nonNA,method="extended",multiple=TRUE)str(result)#The movtivating example:gene ORF06806in Ccdata(Cc)x<-Cc[which(rownames(Cc)=="ORF06806"),]plot(1:length(x),x,type="b",main="ORF06806",xlab="time",ylab="Gene expression")ptestg(x,method="Fisher")#Fail to detect the periodicityptestg(x,method="robust")ptestg(x,method="extended")ptestReg Test short time series for periodicity with maximum likelihood ratiotestsDescriptionThis function is used to test the existence of the periodicity for a short time series(length<=100).Likelihood ratio tests under the Gaussian or the Laplace assumptions are provided with the response surface method implemented for efficiently obtaining accurate p-values.UsageptestReg(z,method=c("LS","L1"),multiple=FALSE)Argumentsz A series or a matrix containg series as columnsmethod The statistical test to be used.See details for more information.multiple Indicating whether z contains multiple series.DetailsThe null hypothesis is set as no peridicities,H0:f=0.Discriptions of different test statistics(meth-ods)are as follow:LS:The-2loglikelihood ratio test statistic based on the likelihood ratio test with normal noises, where the p-values are efficiently computed by the response surface method.L1:The-2loglikelihood ratio test statistic based on the likelihood ratio test with Laplace noises, where the p-values are efficiently computed by the response surface method.ValueObject of class"Htest"produced.An object of class"Htest"is a list containing the following components:obsStat Vector containing the observed test statistics.pvalue Vector containing the p-values of the selected tests.freq Vector containing the estimated frequencies.Author(s)Yuanhao Lai and A.I.McLeodReferencesIslam,M.S.(2008).Peridocity,Change Detection and Prediction in Microarrays.Ph.D.Thesis,The University of Western Ontario.Li,T.H.(2010).A nonlinear method for robust spectral analysis.Signal Processing,IEEE Trans-actions on,58(5),2466-2474.MacKinnon,James(2001):Computing numerical distribution functions in econometrics,Queen’s Economics Department Working Paper,No.1037.See AlsofitHReg,ptestgExamples#Simulate the harmonic regression model with standard Gaussian error termsset.seed(193)#Non-Fourier frequencyz<-simHReg(n=14,f=2/10,A=2,B=1,model="Gaussian",sig=1)ptestReg(z,method="LS")#Normal likelihood ratio testptestReg(z,method="L1")#Laplace likelihood ratio testfitHReg(z,algorithm="exact")#the nls fitted result#Performe tests on the alpha factor experimentdata(alpha)##Eliminate genes with missing observationsalpha.nonNA<-alpha[complete.cases(alpha),]##Using the multiple option to do the test for all the genes##Transpose the data set so that each column stands for a genealpha.nonNA<-t(alpha.nonNA)result<-ptestReg(alpha.nonNA,method="LS",multiple=TRUE)str(result)#The movtivating example:gene ORF06806in Ccdata(Cc)x<-Cc[which(rownames(Cc)=="ORF06806"),]plot(1:length(x),x,type="b",main="ORF06806",xlab="time",ylab="Gene expression")ptestg(x,method="Fisher")#Fail to detect the periodicityptestReg(x,method="LS")#The periodicity is significantly not zeroptestReg(x,method="L1")#The periodicity is significantly not zerosimHReg Simulate harmonic regression modelsDescriptionSimulates a harmonic regression.Possible types of models are normal,t(5),Laplace,cubic and AR1.UsagesimHReg(n,f,A,B,model=c("Gaussian","t5","Laplace","cubic","AR1"),phi=0,sig=1)Argumentsn Length of series.f Frequency.A Cosine amplitude.B Sine amplitude.model The model used for generating the error term.See details.phi Only used if AR1error distribution is selected.sig The standard error of the series.DetailsGenerate a harmonic series y with length n,where y t=A∗cos(2∗pi∗f∗t)+B∗sin(2∗pi∗f∗t)+sig∗e t,t=1,...,n,and e comes from one of the following specified distributions with mean0and standard error1:Gaussian:A standard normal distribution(i.i.d.).t5:A t distribution with5degrees of freedom(i.i.d.,standardized to mean0and variance1).Laplace:A Laplace(double exponential)distribution(i.i.d.,standardized to mean0and variance1).cubic:A standard normal distribution for e,but y=y3this time.AR1:An AR(1)series with autocorrelation paramater phi(standardized to mean0and variance1).ValueVector of length n,simulated harmonic series.Author(s)A.I.McLeod and Yuanhao LaiReferencesMcLeod,A.I.,Yu,Hao and Krougly,Z.(2007),Algorithms for Linear Time Series Analysis:With R Package,Journal of Statistical Software23,51-26.See AlsofitHReg,ptestRegExamples#Simulate the harmonic regression model with standard Gaussian error termsz<-simHReg(10,f=2/10,1,2,model="Gaussian",sig=1)#Fourier Frequencyplot(1:10,z,type="b")#Simulate the AR(1)errorsz<-simHReg(10,f=0/10,0,0,model="AR1",phi=0.2,sig=1)acf(z)Index∗datasetsalpha,2B1,3B2,4B3,5Cc,6cdc15,7cdc28,7∗tsfitHReg,8pgram,9ptestg,10ptestReg,12simHReg,14alpha,2B1,3B2,4B3,5Cc,6cdc15,7cdc28,7fitHReg,8,13,15pgram,9ptestg,10,13ptestReg,11,12,15simHReg,1416。

ISTA 1A标准(运输标准)

ISTA 1A标准(运输标准)

Appendix APackage TestingISTA Test Procedure 1AIntroductionInternational Safe Transit Association (ISTA)ISTA, the association for transport packaging, is an international leader in advancing the science of packaging and the use of performance testing techinques. Its member companies are supported in the development of effective packaging, methods, and logistic systems that prevent or reduce transportation and handling damage during product distribution. ISTA test procedures are continuously under review and updated periodically. To ensure that you are utilizing the most recent publication of the test procedure, contact ISTA at:INTERNATIONAL SAFE TRANSIT ASSOCIATION1400 ABBOTT RD STE 160EAST LANSING MI 48823-1900Telephone: 517-333-3437Fax: 517-333-3813Internet: Test Procedure 1A, Performance Test for Individual Packaged-Products (150 lb (68.2 kg) or Less), is copyrighted by ISTA and is reprinted here with its permission.Preshipment TestingThe ISTA Preshipment Test Procedures provide a means for a manufacturer to predetermine the probability of the safe arrival of their packaged products at their destination through the utilization of tests developed to simulate the shocks and stresses normally encountered during handling and transportation. ISTA has confined its technical activities to the packaged product only. Neither the product nor the container is considered separately. The tests, it is stressed, are basic tests. Test level and sequence should be changed to adapt to known distribution situations and these changes are documented in the report. These test procedures are performance tests and, when properly applied, will provide tangible benefits of reduced damage, economically balanced costs, and improved customer satisfaction. It is also emphasized that these procedures are not intended to evaluate the protection afforded packaged products from other conditions such as moisture, corrosion, contaminating odors, etc. They may or may not comply with carrier requirements for packaging.To maintain certified status and eligibility for identification with the TRANSIT TESTED seal, each packaged product must be retested whenever a change is made in either the product, the process, or the package. Changes in the packaged product include changes in design, size, and/or material. As a quality control procedure, packaged products should be retested as frequently as feasible.Very ImportantISTA 1 Series Integrity Test ProcedureThe entire document shall be read and understood before proceeding with a test.There are three sections: Overview, Testing and Report•Overview provides the general knowledge required before going into the testing laboratory and•Testing presents the specific instructions to do the testing in the laboratory and•Report indicates what data shall be recorded to submit a test report to ISTA. ISTA Test Procedures and Test Projects are the worldwide leaders in Performance Tests for Packaged-Products.Two systems of weights and measures are presented in ISTA test procedures. They are the English system (Inch-Pound) and the international system SI (Metric). Inch-Pound units are shown first with Metric units in brackets, except in some tables where they are shown separately.• Either system may be used as the unit of measure (standard units), but • The standard units chosen shall be used consistently throughout the procedure.• Units are converted to two significant figures and• Not exact equivalents.OverviewPrefaceTest Procedure 1A is an integrity test for individual packaged-products.• It can be used to evaluate the performance of a packaged-product.• It can be used to compare relative performance of package and product design alternatives.• The package and product are considered together and not separately.• Some conditions of transit, such as moisture, pressure or unusual handling, may not be covered.Other ISTA Procedures may be appropriate for different conditions or to meet different objectives.Specific suggestions:• To use random vibration instead of fixed displacement vibration, use ISTA Integrity Test Procedure 1G and not 1A.• For packaged-products where a minimum compression value should be tested, use ISTA Integrity Test Procedure 1C.• For packaged-products intended for international distribution consider ISTA Integrity-Plus Test Procedure 2A.• For packaged-products that may be transported in a small parcel delivery system consider ISTA General Simulation Test Procedure 3C.• Refer to Guidelines for Selecting and Using ISTA Projects and Procedures for additional information.ISTA 1 Series tests are basic tests that consist of integrity test procedures. • They are not simulations of actual transport hazards, and• do not necessarily comply with carrier packaging regulations.When properly applied, ISTA procedures will provide tangible benefits of: • reduced damage,• economically balanced costs and• improved customer satisfaction.ScopeTest Procedure 1A covers testing of individual packaged-products weighing 150 pounds (68.2 kg) or less when prepared for shipment.Note:To be eligible for mailing, a single parcel cannot exceed 70 pounds. Product Damage Tolerance and Degradation AllowanceThe shipper shall determine the following prior to testing:• What constitutes damage to the product and• what damage tolerance level is allowable, if any, and• the correct methodology to determine product condition at the conclusion of the test and• the acceptable package condition at the conclusion of the test.For additional information on this determination process refer to Guidelines for Selecting and Using ISTA Projects and Procedures.SamplesSamples should be the untested actual package and product, but if one or both are not available, the substitutes shall be as identical as possible to actual items.•Number of samples required: One sample is required for the tests in this procedure.•Replicate Testing Recommended: To permit an adequate determination of representative performance of the packaged-product, ISTA:- Requires the procedure to be performed a minimum of one time, but- Recommends performing the procedure five or more times, using new samples with each test.Note:Packages that have already been subjected to the rigors of transportation cannot be assumed to represent standard conditions. In order to insure testing in perfect condition, products and packages shipped to certified laboratories for testing must be:• over-packaged for shipment to the laboratory or• repackaged in new packaging at the laboratory.Test SequenceThe tests shall be performed on each test sample in the sequence indicated in the following table:Sequence #TestCategory Test Type Test LevelFor ISTACertification1Vibration Fixed 1 in. (25 mm) peak to peak at a RequiredDisplacement frequency to be determined2Shock Drop Height varies with packaged-productweightRequired2Alternative Incline(Conbur)Impact Velocityvaries with packaged-product weight2AlternativeHorizontial Impact)Impact Velocityvaries with packaged-product weightEquipment Required VibrationEquipment required for the Fixed Displacement Vibration Test:• Vibration Test System with a 1 inch (25 mm) fixed or controlled displacement complying with Method A1 or A2 of the apparatus section of ASTM D 999-96. Rotary or vertical linear motion of the platform is acceptable.• Metal shim 0.06 inch (1.5 mm), thick approximately 2.0 inches(50 mm) wide and at a convenient length.• Tachometer or suitable indicator for determining vibration frequency in cycles per second (Hz) or cycles per minute (CPM).• Automatic timer or stopwatch.Equipment Required for Shock TestThe following alternatives are acceptable for the equipment required for the Shock Test:*In compliance with the apparatus section of ASTM.ProcedureIdentification of Faces, Edges and CornersPrior to beginning the tests identify the faces, edges and corners according to the procedure below.Step Action1Place the packaged-product in its intended shipping position as determined by shipper. If the shipping position can be variable, place the packaged-product so that the primary shipping label location is on the top face.2Does the packaged-product have only six faces (2 sides, 2 ends, top and bottom)?• If Yes, then go to Step 5.• If No, continue to next Step.3Develop a method to identify each face, edge and corner and document with a diagram.4Go to the next Block.5Is the package a corrugated container?• If Yes, continue to next Step.• If No, then go to Step 8.6Does the package have a manufacurer's joint connecting a side and an end face?• If Yes, continue to next Step.• If No, then go to Step 8.7Turn the packaged-product so that you are looking directly at a face with the manufacturer's joint on the observer's right and go to Step 9.8Position one of the smallest width faces of the packaged-product directly in front of you.910Identify edges using the numbers of the two faces forming that edge.Example: Edge 1-2 is the edge formed by face 1 and face 2 of the packaged-product.11Identify corners using the numbers of the three faces that meet to form that corner.Example: Corner 2-3-5 is the corner formed by face 2, face 3, and face 5 of the packaged-product. 12Go to next Block.Packaged-Product Weight and Size MeasurementYou shall know the packaged-products:• gross weight in pounds (kg) rounded up to a whole number, and• outside dimensions of Length, Width, and Height (L x W x H) in inches (mm or m).Before You Begin Vibration TestingCaution: A restraining device or devices shall be used with the vibration test system to:• Prevent the test specimen from moving off the platform and• Maintain test orientation of the packaged-product, but• The device or devices shall not restrict the vertical motion of the test specimen during the test.For Fixed Displacement Vibration:Step Action1Familiarity with the following formula is required to calculatethe test duration after the frequency required to bounce the packaged-product is determined in the Vibration Test Block:Test Duration in Minutes = 14, 200 Vibratory ImpactsCycles Per Minute (CPM) or[Cycles Per Second (Hz) x 60]2The chart below shows example Test Durations calculated for several frequencies: CPM Hz Test Duration in Minutes150 2.595180 3.079210 3.568240 4.060270 4.553300 5.048Vibration TestThe table below indicates the steps to perform a Fixed Displacement Vibration Test.Step Action1Put the packaged-product on the vibration table so that face 3 rests on the platform.2Start the vibration system to vibrate at 1.0 inches (25 mm) total displacement at the machine's lowest frequency.3Maintain a fixed displacement at 1 inch (25 mm) and slowly increase the frequency (speed) of the vibration table until the packaged-product begins to momentarily leave the surface of the platform. 4Hold the vibration frequency to that determined in Step 3.5Can a metal shim be intermittently moved between the bottom of the longest dimension of the packaged-product and the surface of the platform?• If Yes, hold that frequency and then continue to next Step.• If No, then increase the frequency until the requirement of Step 5 is met and hold that vibration frequency.6Determine the test duration in minutes using the formula indicated in the Before You Begin Block and the CPM or Hz frequency identified in Step 5.7Begin the vibration duration.8Are you using a vertical linear motion on the vibration system?• If Yes, then go to Step 12.• If No, then continue with the next Step.9Stop the vibration test halfway throught the vibration duration and perform the appropriate action as indicated below:• IF a single 90° horizontal rotation is possible, THEN perform a horizontal rotation of 90° as the specimen rests on the platform.• IF a single 90° horizontal rotation is not practical because of the size of the packaged-product or the stability of the packaged-product, THEN perform a horizontal rotation of 180° as the specimen tests on the platform.10Start the vibration system and continue the vibration test at the frequency used in Step 7.11Can a metal shim be intermittently moved between the bottom of the longest dimension of the packaged-product and the surface of the platform?• If Yes, then continue to next Step.• If No, then slowly increase the frequency until the requirement of Step 11 is met.12Complete vibration duration.13Inspection of the packaged-product for visible damage is allowed, provided inspection does not alter, in any way, the current condition of the package or the condition or position of the product(s). 14Vibration testing is now complete. Go to the Shock Test Block.Before You Begin Shock TestingThe test drop height varies with the weight of the packaged-product. Find the weight of the packaged-product in the following chart to determine a drop height or an equivalent impact velocity to be used for a substituted drop: Packaged-Product Weight Drop Height Impact VelocityEqual to or greater than But Less than Free Fall Incline or Horizontallb kg lb kg In.mm ft/s m/s0021103076013 3.9211041192461011 3.4411961281846010 3.0612810045123108.0 2.510045150688200 6.6 2.0The test method requires the packaged-product to be dropped in several different package orientations.A drop test must be performed in all required orientations where dropping the packaged-product is practical.If dropping in a required orientation is not practical an equivalent incline or horizontal test can be substituted for that orientation.When using impact velocity, if any test in a Test Sequence is below the required minimum level, that sequence event must be repeated until the test impact velocity meets the minimum.Shock TestThe table below indicates the steps to perform the Drop Shock Test.Step Action1Determine the method(s) of test and the required drop height or impact velocity in the Before You Begin Block.2Do you have a packaged-product with only 6 faces as identified in the Face, Edge and Corner Identification Block?• If Yes, continue with the next Step.• If No, then go to Step 6.3Test the packaged-product according to the method(s) and level(s) determined in Step 1. Follow the sequence in the table below.4Sequence #Orientation Specific face, edge or corner1Corner most fragile face-3 corner, if not known, test 2-3-52Edge shortest edge radiating from the corner tested3Edge next longest edge radiating from the corner tested4Edge longest edge radiating from the corner tested5Face one of the smallest faces6Face opposite small face7Face one of the medium faces8Face opposite medium face9Face one of the largest faces10Face opposite large face5All testing is now complete. Go to the Test Report Block.6Select a bottom face corner to replace the corner required in Step 4 Sequence 1 to begin the test. 7Identify the edges of the packaged-product that meet the Step 4 Sequence2 through 4 requirements.8Select any 6 faces to replace the faces required in Step 4 Sequence 5 through 10.9Using the corner, edges and faces from Steps 6 through 8 go to Step 3 and proceed.10All testing is now complete. Go to the Test Report Block.ReportBefore You Begin ReportThe packaged-product has satisfactorily passed the test if, upon examination, it meets the Product Damage Tolerance and Package Degradation Allowance. ISTA Certified Testing Laboratories:• Should file a test report on all ISTA Test Procedures or Projects conducted. • Shall file a test report on all ISTA Test Procedures or Projects conducted to obtain Transit Tested Package Certification or Acknowledgement.For additional information, refer to Guidelines for Selecting and Using ISTA Test Projects and Procedures.ISTA Transit Tested ProgramThe ISTA Transit Tested Certification Mark as shown is a:• registered certification mark and• can only be used by license agreement and• by a member of the International Safe Transit Association.When a member prints this certification mark on a packaged-product with their license number they are showing their customer and the carrier that it has passed the requirements of ISTA preshipment testing.In order to maintain its certified status and eligibility for identification with the TRANSIT TESTED Certification Mark, each packaged-product must bere-tested whenever a change is made in the:• Product or• Process or• Package.Changes in the product include changes in:• Design or• Size or• Materials.Changes in the process include changes in:• Manufacturing or• Assembly or• Filling.Changes in the package include changes in:• Configuration or• Dimensions or• Weight or• Materials or• Components.As a quality control procedure, packaged-products should be re-tested frequently, for example, yearly.General RequirementsThe following information is required when completing the Certified Laboratory Test Report:ISTA Certified Testing Laboratory Information• Complete laboratory name and address• Test Laboratory ID number• Test Technician who performed the test• Test Report submitted by: name and signatureProduct Manufacturer/Shipper Information• Manufacturer/Shipper company name and address• Test requested by (individuals name)• Manufacturer/Shipper ISTA License Number, if applicable and knownThird-party Test Request Information• Test conducted for company name and address• Test requested by (individuals name)• Relationship to the product manufacturer/shipperTest Information• Test Procedure or Project performed• Date tested• Number of samples tested• Number of replicate tests performed• Test Number(s) assigned by test laboratory, if applicableProduct Description• Detailed description of the product under test, including model designation or other specific means of product identification that distinguishes it from any other product.Package Description• Describe entire shipping unit• Type or style of package• List materials used inside the package, if applicable• Pallet or skid, if applicable• Picture or drawing of any interior cushioning, if applicable• Method of closure, if applicablePackaged-Product Tested• Gross weight of packaged-product• External container size in inches (mm or m): Length x Width x Depth(L x W x D)• A picture should be includedProduct Damage Tolerance Criteria• Definition of product damage tolerance• Name of who determined definition of product damage tolerance• Description of the method of determining product damagePackage Degradation Allowance Criteria• Definition of package degradation allowance• Name of whom determined definition of package degradation allowance • Description of the method of determining package degradation Specific RequirementsThe following information is specific to this test procedure and shall be reported with the required general information when completing the Certified Laboratory Test Report:Test ResultsReport if the packaged-product(s):• Passed or• FailedTest Plan• Report which unit of measure was used, English or Metric.• Report any deviations from the required test plan.• Include an explanation as to why the test was conducted differently.Test Laboratory Comments• As a result of the testing, report any recommendations for packaged-product improvement.• Any general comments.Vibration Test• Describe restraining device or devices used• First test orientation- Orientation of specimen tested- Test frequency in Hz or CPM• Second test orientation• Report the degrees of rotation, if applicable:- 90°or- 180°- Test frequency in Hz or CPM• Test duration in minutes• Number of vibratory impacts, and• Results of visual inspection for damage, if applicableShock TestReport the following:• Orientation of each shock• Severity of each shock recorded:- For Drop Test as drop height in inches (mm)- For free fall equivalent as velocity change in inches per second (m/s)- For incline as impact velocity in inches per second (m/s)- Horizontal equivalent as velocity change in inches per second (m/s)Report if an incline or horizontal shock was substituted for any test orientation. • Which orientation• Which test method was used- Free fall equivalent shock, incline or horizontal• Explain the reason for the substitution for each orientation。

CAbi ITS检测费用

CAbi ITS检测费用

Effective Apr, 2008Textile Testing PackageSpecially for CabiCAbi专用全套纺织品测试Fabric Full Package Test (per colorway): Asia USD145.00织物全套测试 (每色): 亚洲美元价:145.00 $(If garment is a sweater or denim jean with special wash submit in garment form for thistest.)(毛衣或经过特殊后处理的粗布牛仔裤,请以成衣进行以下测试.)Flammability (for non exempted fabrics) 燃烧测试 (非豁免织物适用)Fiber Content 纤维成分测试Fabric Weight织物克重Fabric Count织物密度Yarn Size 纱线支数Dimensional Stability to Laundering (after 3 washes) or Dry-cleaning (1 Dry-clean) 水洗尺寸稳定性 (3次洗涤后) 或干洗尺寸稳定性 (1 次干洗)Appearance after Laundering (after 3 washes) or Dry-cleaning (1 Dry-clean) 水洗后外观 (3次洗涤后) 或干洗后外观 (1 次干洗)Dimensional Stability to Steam (for Dry cleanable)蒸汽尺寸稳定性 (适用只可干洗织物)Appearance after Steam (for Dry cleanable only)蒸汽后外观(适用只可干洗织物)Torque 扭曲度Color Fastness to Laundering or Dry-cleaning 水洗色牢度或干洗色牢度Color Fastness to Chlorine Bleach (washable item only)氯漂白色牢度 (只适用可水洗项目)Color Fastness to non Chlorine Bleach (washable item only)非氯漂白色牢度 (只适用可水洗项目)Color Fastness to Crocking 摩擦色牢度Color Fastness to Light (only if garment is for outerwea r)光照色牢度(只适用于外衣的织物)Color Fastness to Perspiration* 汗渍色牢度*pH Value pH 值(酸碱度)Tearing Strength (Woven only) 撕破强力 (仅梭织物)Tensile Strength (Woven only) 拉伸强力 (仅梭织物)Bursting Strength (Knit only) 顶破强力 (仅针织物)Pilling Resistance - Martindale 抗起毛起球性–马丁旦尔法Pile Retention* (for pile fabric only) 绒毛保持性* (仅起绒织物)Stretch & Recovery* (for Stretchable fabrics only) 弹性及回复力* (仅可拉伸织物)Each Additional Colorway, includes Asia USD28.00每一种附加色, 包括亚洲美元价:28.00 $Color Fastness to Laundering or Dry-cleaning 水洗色牢度或干洗色牢度Color Fastness to Chlorine Bleach (washable items only)氯漂白色牢度 (只适用可水洗项目)Color Fastness to non Chlorine Bleach (washable items only)非氯漂白色牢度 (只适用可水洗项目)Color Fastness to Crocking 摩擦色牢度Color Fastness to Perspiration* 汗渍色牢度*Garment Package Test (per Garment): Asia USD85.00成衣全套测试 (每款): 亚洲美元价:85.00 $Dimensional Stability to Laundering (after 3 washes) or Dry-cleaning (1 Dry-clean) 水洗尺寸稳定性 (3次洗涤后) 或干洗尺寸稳定性 (1 次干洗)Appearance after Laundering (after 3 washes) or Dry-cleaning (1 Dry-clean) 水洗后外观 (3次洗涤后) 或干洗后外观 (1 次干洗)Torque 扭曲度Fabric Weight * 织物克重NewSeam Strength (Woven only) 接缝强力 (仅梭织物)Zipper Attachment Strength * 拉链接缝强力NewSeam Slippage (Woven only) 接缝滑移 (仅梭织物)Seam Bursting Strength (Knit only) 接缝顶破强力 (仅针织物)Button or Snap Attachment Strength 钮扣或按钮附着力Operability of zipper*拉链性能 ASTM D2062 New* Test items marked * are items are not included in the package process, Additionalcharge is required. * 另收费用Full Package Garment Testing Asia USD $175全套成衣测试亚洲美元价:175 $ (Garments without Satisfactory Full Fabric Testing Or as requested by CAbi)(未经过全套织物测试获得满意结果的成衣或由CAbi 质量主管要求测试的成衣) This test is required for all focus group and re-orders所有的大货订单和翻单都要求进行此测试Flammability (for non-exempted fabrics) 燃烧测试 (非豁免织物适用)Fiber Content 纤维成分测试Fabric Weight 织物克重Fabric Count 织物密度Yarn Size 纱线支数Dimensional Stability (3 HL or 1 Dryclean) 水洗尺寸稳定性 (3次水洗或1次干洗) Appearance After Laundering (3 HL or 1 Dryclean)水洗后外观 (3次水洗或1次干洗)Dimensional Stability to Steam (Dryclean only)蒸汽尺寸稳定性 (适用只可干洗织物)Appearance After Steam (Dryclean only)蒸汽后外观(适用只可干洗织物)Tensile Strength 拉伸强力Tear Strength 撕破强力Bursting Strength (knits only) 顶破强力(仅针织物)Pilling Resistance (Martindale) 抗起毛起球性–马丁旦尔法Pile Retention (pile fabric only) * 绒毛保持性 (仅起绒织物)Stretch and Recovery (stretch fabrics only) * 弹性及回复力 (仅可拉伸织物)Torque 扭曲度PH PH 值(酸碱度)Colorfastness to Laundering (3 HL or 1 Dryclean)水洗色牢度(3次水洗或1次干洗)Colorfastness to Bleaching Instruction 漂白色牢度Colorfastness to Crocking 摩擦色牢度Colorfastness to Light (outerwear only)* 光照色牢度 (只适用于外衣的织物)Colorfastness to Perspiration* 汗渍色牢度*Seam Strength (woven only) 接缝强力 (仅梭织物)Seam Slippage (woven only) 接缝滑移 (仅梭织物)Seam Bursting Strength (knits only) 接缝顶破强力(仅针织物)Button/Snap Attachment Strength 钮扣或按钮附着力Zipper Attachment Strength * 拉链与成衣之间的接缝强力Operability of Zipper * 拉链性能Zipper Attachment Strength * 拉链与成衣之间的接缝强力Asia USD10.00Operability of Zipper * 拉链性能Asia USD12.00Zipper full package test (per garment): Asia USD56.00拉链全套测试(每款成衣)亚洲美元价 56.00$ Zipper strength 拉链强力 ASTM D2061 – 2006BS 3084 -2006Durability per 500 cycles 拉链耐久性(每500个循环)Operability of zipper 拉链性能 ASTM D2062Nickel testing Asia USD52.00镍含量测试亚洲美元价 52.00$ EN 1811Lead testing Asia USD17.00铅含量测试亚洲美元价 17.00$ CPSC 16 CFR 1303Notes注意事项:(1) The proposed Asia package price is applicable to Intertek Bangladesh, China(Hong Kong, Guangzhou, Shanghai, Tianjin, Hanzhou, and Wuxi) India(Mumbai, New Delhi, Tirupur & Bangalore), Indonesia, Korea, Pakistan,Philippines, Singapore, Taiwan, Thailand and Vietnam.以上提出的亚洲区全套测试价格适用于以下天祥实验室:孟加拉国,中国(香港,广州,上海,天津,杭州,无锡),印度(孟买,新德里,蒂鲁巴和班加罗尔),印度尼西亚,韩国,巴基斯坦,菲律宾,新加坡,台湾,泰国和越南。

Android_CTS_test(安装和命令)

Android_CTS_test(安装和命令)

一、Android CTS测试简介CTS 全称 Compatibility Test Suite 兼容性测试工具。

当电子产品开发出来,并定制了自己的 Android 系统后,必须要通过最新的 CTS 检测,以保证标准的 android application 能运行在该平台下。

通过了 CTS 验证,需要将测试报告提交给 Google,已取得 android market的认证。

CTS 是一款通过命令行操作的工具。

目前 cts 没有提供 windows 版本,只能在 Linux 下测试。

本文将详细介绍在ubantu系统上如何搭建CTS环境,以及运行测试计划和分析测试结果。

二、Android CTS测试环境搭建1.下载android-SDK linux版本,下载地址:/sdk/index.html步骤:1.安装android-sdk2.2 解压下载所得的android-sdk到安装的目录(任意),如:/home/tester/cts/ android-sdk-linux_86。

进入/home/tester/cts/ android-sdk-linux_86/tools,运行android可执行文件:双击,点击“在终端运行”,出现在左菜单中选择“Installed package”选项,点击下方“update All…”按钮,进入更新界面:选择左边的的package,选择“Reject”,不会更新该package,点击Install。

进入更新状态。

2.将platfrorm-tools目录下的adb文件拷贝到tools目录下(安装CTS时会用到)安装完成。

在Linux Command窗口输入以下命令:env可查看到当前PATH的值为:PATH=/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/ga mes:/home/username/bin:再输入以下命令,将Android SDK路径加入到环境变量中:exportPATH=/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin :/usr/games:/home/username/bin:/home/username/android-sdk-linux_86/platform-tools:/h ome/username/android-sdk-linux_86/toolsNote:1> 各环境变量之间用冒号隔开2> 如果PATH中已添加了Android SDK路径,默认即可2.下载android-cts包,下载地址:/compatibility/downloads.html根据手机系统版本下载对应版本的cts包,否则将无法运行测试a.配置CTS:进入/home/username/CTS/android-cts/tools目录,打开/home/username/CTS/android-cts/tools/startcts脚本进行编辑,找到脚本中第一次出现SDK_ROOT的地方(注释了的片段不算),将Android SDK的根目录路径赋值给“SDK_ROOT”,如下:# Add SDK_ROOT to the PATH for backwards compatibility with prior startcts# commands that required SDK_ROOT to find adb.if [ -n "${SDK_ROOT=/home/username/android-sdk-linux_86}" ]; thenPATH=${SDK_ROOT}/platform-tools:${SDK_ROOT}/tools:${PATH}fi然后保存编辑。

白盒测试和黑盒测试实验报告

白盒测试和黑盒测试实验报告

软件质量保证与测试实验指导计算机工程学院测试环境配置1.settingJunit(1)startEclipseSelectwindows-preferences-java-buildpath–classpathvariables(2)clicknew,thefigureofnewvariableentryisshown.(3)name JUNIT_LIBselectfile-选择JUnit插件所对应的JAR文件所在地,在Eclipse的安装目录的plugins目录中2.JUNIT的组成框架其中,junit.framework和junit.runner是两个核心包。

junit.framework负责整个测试对象的框架junit.runner负责测试驱动Junit的框架又可分为:A、被测试的对象。

B、对测试目标进行测试的方法与过程集合,可称为测试用例(TestCase)。

C、测试用例的集合,可容纳多个测试用例(TestCase),将其称作测试包(TestSuite)。

D、测试结果的描述与记录。

(TestResult)。

E、每一个测试方法所发生的与预期不一致状况的描述,称其测试失败元素(TestFailure)F、JUnitFramework中的出错异常(AssertionFailedError)。

JUnit框架是一个典型的Composite模式:TestSuite可以容纳任何派生自Test 的对象;当调用TestSuite对象的run()方法是,会遍历自己容纳的对象,逐个调用它们的run()方法。

3.JUnit中常用的接口和类Test接口——运行测试和收集测试结果Test接口使用了Composite设计模式,是单独测试用例(TestCase),聚合测试模式(TestSuite)及测试扩展(TestDecorator)的共同接口。

它的publicintcountTestCases()方法,它来统计这次测试有多少个TestCase,另外一个方法就是publicvoid run(TestResult),TestResult是实例接受测试结果,run方法执行本次测试。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

package test;/** @(#)Board.java 1.4 04/08/31*/import javax.microedition.lcdui.*;import java.io.InputStream;/*** Board类需要知道箱子怎样移动,处理“撤销”操作,以及处理屏幕读取* 程序中大量使用位操作运算符,这样,在移动箱子的时候可以减少很多的判断,使程序更高效* 关键是,移动设备的资源有限,位操作的速度比一般的运算要快许多*/public class Board {private int level; // 游戏级别private byte[] array; // 游戏版面上的格子private byte[] pathmap; // 用于查找最短路径private int width, height; // 游戏面板的宽度和高度private int pusher; // 推箱者在数组array中的下标位置private int packets = 0; // 箱子总数private int stored = 0; // 已移动到指定点的箱子的总数private byte[] moves; // 已记录的移动private int nmoves; // 已执行的移动次数private int npushes; // 已执行的推动次数// 移动的方向public static final int LEFT = 0;public static final int RIGHT = 3;public static final int UP = 1;public static final int DOWN = 2;public static final int MOVEPACKET = 4;// 用比特定义的各个格子的状态值public static final byte GROUND = 0; // 如果该格子里什么都没有,即空地public static final byte STORE = 1; // 如果该格子一个储物点,即箱子需要移动到的地方public static final byte PACKET = 2; // 如果该格子是一个箱子public static final byte WALL = 4; // 如果该格子是墙public static final byte PUSHER = 8; // 如果推箱者在该格子上/*** 创建一个新Board类来初始化一个简单puzzle*/public Board() {this.moves = new byte[200];screen0();}/*** 创建硬编码的简单游戏board*/public void screen0() {width = 9; // board宽height = 7; // board长array = new byte[width * height]; // board的格子level = 0; // 初始级别为0nmoves = 0; // 初始移动次数为0npushes = 0; // 初始推动次数为0// 初始化游戏board的各个格子,设置相应的初始状态值for (int x = 0; x < width; x++) {for (int y = 0; y < height; y++) {// 定义当前格子的状态值:// 如果当前格子为board的边缘上的格子,则将其状态值设为WALL(=4),即该格子是墙;// 否则,状态值设为GROUND(=0),即该格子是空地byte t = (x == 0 || y == 0 ||x == width - 1 || y == height - 1) ? W ALL : GROUND;set(x, y, t); // 设置格子状态}}// 构造一个简单的游戏(下面的值可以自行修改)packets = 2; // 箱子数为2stored = 0; // 0个箱子已经就位set(2, 2, PACKET); // 坐标为(2, 2)的格子上放一个箱子set(4, 4, PACKET); // 坐标为(4, 4)的格子上放一个箱子set(4, 2, STORE); // 坐标为(4, 2)的格子为一个储物点set(6, 4, STORE); // 坐标为(6, 4)的格子为一个储物点pusher = index(1, 1); // 推箱者所在坐标为(1, 1)}/*** 将推箱者向指定的方向移动:* 如果移动方向的格子是墙,则不移动* 如果是一个箱子,则尝试着去推动这个箱子* @param move 移动方向:LEFT,RIGHT,UP,DOWN中的一个* @return 实际移动的方向,如果没移动则为-1*/public int move(int move) {int obj = pusher + indexOffset(move); // obj为移动后,推箱者在数组array中的位置// 处理简单的情况,通过&操作来判断移动后的位置是否是墙// 如果移动后的位置是墙,则其状态值与WALL的&操作结果不为0// 实际上,看实例字段中状态值的定义,只有{GROUND, STORE, PACKET, W ALL, PUSHER} = {0, 1, 2, 4, 8},// 其中只有W ALL=4这个值跟W ALL的&操作结果不为0,为4,本程序下面类似的代码也是这个道理if ((array[obj] & WALL) != 0) { // 如果移动后的位置是墙,则返回-1,表示不移动return -1;}int m = movePacket(obj, move); // 推动箱子if (m < 0) { // 如果箱子无法移动,则不移动,移动完成return -1;}pusher = obj; // 移动推箱者的位置saveMove(m); // 保存移动记录return m;}/*** 由推箱者将箱子向指定的方向移动* 箱子是否被移到了储物点* @return -1 当无法移动或要移动到的位置上已经有箱子时*/private int movePacket(int index, int move) {if ((array[index] & PACKET) == 0) { // 如果要移动到的位置上已经有箱子return move; // 箱子没有移动}int dest = index + indexOffset(move);if (array[dest] > STORE) { // 如果要移动到的位置不是空地或储物点,则箱子无法移动return -1; // 无法将箱子移动到下一位置}array[index] &= ~PACKET; // 将箱子从当前位置移除if ((array[index] & STORE) != 0) { // 如果是从储物点将箱子移除,则已就位的箱子数减1stored--;}array[dest] |= PACKET; // 将箱子插入新的位置if ((array[dest] & STORE) != 0) { // 如果箱子移动到了一个储物点,则已就位的箱子数加1stored++;}npushes++; // 计数已完成的推动return move + MOVEPACKET;}/** 保存一个移动记录,必要时加大移动记录数组moves的长度*/private void saveMove(int move) {if (nmoves >= moves.length) { // 当移动次数大于移动记录数组moves的长度时,加大moves的长度byte[] n = new byte[moves.length + 50];System.arraycopy(moves, 0, n, 0, moves.length);moves = n;}moves[nmoves++] = (byte) move; // 记录一次移动}/*** 撤销最近一次移动* 其实就是反向移动一次,算法跟移动是一样的* @return 撤销的移动操作,如果没有则返回-1;* 参看LEFT, RIGHT, UP, DOWN, and MOVEPACKET*/public int undoMove() {if (nmoves <= 0) { // 如果移动次数为0,返回-1return -1;}int move = moves[--nmoves];int rev = (move & 3) ^ 3; // 将方向倒转int back = pusher + indexOffset(rev);if ((move & MOVEPACKET) != 0) {npushes--; // 撤销推动movePacket(pusher + indexOffset(move), rev); // 移动箱子}pusher = back;return move;}/*** 判断屏幕上的问题是否已解决,即所有箱子是否都已经被推到指定位置*/public boolean solved() {// 当箱子数和已被推到指定位置的箱子数相等时,表示问题已解决// 否则,问题没解决return packets == stored;}/*** 将玩家移动到(x, y)坐标点上* 如果成功则返回移动方向,否则返回-1* 坐标点(x, y)必须为空* @param x 横坐标* @param y 纵坐标* @return 移动方向* 参看LEFT, RIGHT, UP, DOWN, MOVEPACKET*/public int runTo(int x, int y, int max) {int target = index(x, y);if (target < 0 || target >= array.length) {return -1;}if (target == pusher) {return -1; // 已存在}// 填充路径if (pathmap == null || pathmap.length != array.length) {pathmap = new byte[array.length];}// 填充未设置的值for (int i = 0; i < pathmap.length; i++) {pathmap = 127;}// 填充最短的推动路径findTarget(target, (byte) 0);// 如果没有退回玩家位置,则将会没有可行路径if (pathmap[pusher] == 127) {return -1;} else {// 回退,所以要走一边刚刚建立的路径// 返回最后一次移动int pathlen = pathmap[pusher];int pathmin = pathlen - max;int dir = -1;for (pathlen--; pathlen >= pathmin; pathlen--) {if (pathmap[pusher - 1] == pathlen) {dir = LEFT;saveMove(dir);pusher--;} else if (pathmap[pusher + 1] == pathlen) {dir = RIGHT;saveMove(dir);pusher++;} else if (pathmap[pusher - width] == pathlen) {dir = UP;saveMove(dir);pusher -= width;} else if (pathmap[pusher + width] == pathlen) {dir = DOWN;saveMove(dir);pusher += width;} else {// 当程序执行到这里时,说明发生了严重的错误,所以应当终止程序throw new RuntimeException("runTo abort");}}return dir;}}/*** 通过填充搜索算法来找到推箱者的最短路径* 具体算法可以看数据结构的最短路径算法*/private void findTarget(int t, byte pathlen) {if (array[t] > STORE) {return; // 无论是墙还是玩家回环}// 路径已被测试过,且比当前最短路径长if (pathmap[t] <= pathlen) {return;}pathmap[t] = pathlen++; // 为当前位置设置路径长if (t == pusher) {return;}// 避免数组越界异常if (t - 1 >= 0) {findTarget(t - 1, pathlen); // 转到前一个格子}if ((t + 1) < array.length) {findTarget(t + 1, pathlen); // 转到下一个格子}if (t - width >= 0) {findTarget(t - width, pathlen); // 转到前一行}if ((t + width) < array.length) {findTarget(t + width, pathlen); // 转到下一行}}/*** 返回当前位置的格子* @param x 横坐标* @param y 纵坐标* @return* Bit标记; combinations of WALL, PUSHER, STORE, PACKET. */public byte get(int x, int y) {int offset = index(x, y);if (offset == pusher) {return (byte) (array[offset] | PUSHER);} else {return array[offset];}}/*** 设置指定格子的状态值*/private void set(int x, int y, byte value) {array[index(x, y)] = value;}/*** 计算坐标为(x, y)的格子在格子数组array中的下标*/private int index(int x, int y) {// 如果坐标值超出了范围,则返回-1,表示指定的坐标值不在数组array中if (x < 0 || x >= width ||y < 0 || y >= height) {return -1;}return y * width + x;}/*** 获得推箱者的位置,并将其以一个低于整形数的形式返回* 其中该整形数的低16位为推箱者的x坐标,高16位为推箱者的y坐标* @return 已编码的位置*/public int getPusherLocation() {// x,y坐标不能超过游戏面板宽带和高度int x = pusher % width;int y = pusher / width;return (y << 16) + x; // 将y移到高16位,低16位用x来填充}/*** 计算推箱者当前所在位置相对于移动方向在数组arry中的偏移量* 注意:墙的边缘通常有一个+/-禁区* 同时,估算指令将不会试图去+/-2*/private int indexOffset(int move) {// 判断移动方向,根据移动方向设置在array数组中的偏移量// 具体借助图形来理解这个算法switch (move & 3) {case LEFT: // 左移,在array中左移1位return -1;case RIGHT: // 右移,在array中右移1位return +1;case UP: // 上移,在array中左移width位return -width;case DOWN: // 下移,在array中右移width位return +width;}return 0; // 如果移动方向不存在,则不移动}/*** 从一个输入流中读取一本board相关的数据* 将数据读入一个固定大小的数组,然后做适当的调整* (这个方法就不注释了,算法很简单)* @param is 用于读取数据的输入流* @param*/public void read(InputStream is, int l) {final int W = 20;final int H = 20;byte[] b = new byte[W * H];// 此处以后可以添加调整大小的代码int c, w = 0;int x = 0, y = 0, xn = 0, yn = 0, npackets = 0;try {// 设置游戏面板格子中各种状态图标while ((c = is.read()) != -1) {switch (c) {case '\n':if (x > w) {w = x;}y++;x = 0;break;case '$':b[y * W + x++] = PACKET;npackets++;break;case '#':b[y * W + x++] = WALL;break;case ' ':b[y * W + x++] = GROUND;break;case '.':b[y * W + x++] = STORE;break;case '*':b[y * W + x] = PACKET;b[y * W + x++] |= STORE;npackets++;stored++;break;case '+': // 玩家站在储物点上b[y * W + x++] = STORE;case '@':xn = x;yn = y;x++;break;}}} catch (java.io.IOException ex) {ex.printStackTrace();}if (y > 0) {array = new byte[w * y];if (y > w) { // 当复制的时候,切换x和ywidth = y;height = w;for (y = 0; y < width; y++) {for (x = 0; x < w; x++) {array[index(y, x)] = b[y * W + x];}}pusher = index(yn, xn);} else {width = w;height = y;array = new byte[width * height];for (y = 0; y < height; y++) {for (x = 0; x < width; x++) {array[index(x, y)] = b[y * W + x];}}pusher = index(xn, yn);}stored = 0;packets = npackets;level = l;nmoves = 0;npushes = 0;}}/*** 获得游戏面板宽度*/public int getWidth() {return width;}/*** 获得游戏面板高度*/public int getHeight() {return height;}/*** 获得到目前为止的移动次数*/public int getMoves() {return nmoves;}/*** 获得记录箱子被推动次数*/public int getPushes() {return npushes;}/*** 获取已就位箱子数*/public int getStored() {return stored;}/*** 将横向移动的方向转换为array数组中的偏移量*/private int dx(int dir) {if (dir == LEFT) {return -1;}if (dir == RIGHT) {return +1;}return 0;}/*** 将纵向移动的方向转换为array数组中的偏移量*/private int dy(int dir) {if (dir == UP) {return -1;}if (dir == DOWN) {return +1;}return 0;}}。

相关文档
最新文档