Package org.apache.sis.util.iso

Examples of org.apache.sis.util.iso.SimpleInternationalString


            if (title == null) {
                title = party.getPositionName();
                if (title == null) {
                    String name = party.getIndividualName();
                    if (name != null) {
                        title = new SimpleInternationalString(name);
                    }
                }
            }
        }
    }
View Full Code Here


     * Tests conversions to {@link InternationalString}.
     */
    @Test
    public void testInternationalString() {
        final ObjectConverter<String,InternationalString> c = new StringConverter.InternationalString();
        runInvertibleConversion(c, "Some sentence", new SimpleInternationalString("Some sentence"));
        assertSerializedEquals(c);
    }
View Full Code Here

        if (duration != null) try {
            final TemporalFactory factory = TemporalUtilities.getTemporalFactory();
            InternationalString years = null;
            int value;
            if ((value = duration.getYears()) != 0) {
                years = new SimpleInternationalString(Integer.toString(value));
            }
            InternationalString months = null;
            if ((value = duration.getMonths()) != 0) {
                months = new SimpleInternationalString(Integer.toString(value));
            }
            InternationalString weeks = null; // no weeks in javax.xml.datatype.Duration
            InternationalString days = null;
            if ((value = duration.getDays()) != 0) {
                days = new SimpleInternationalString(Integer.toString(value));
            }
            InternationalString hours = null;
            if ((value = duration.getHours()) != 0) {
                hours = new SimpleInternationalString(Integer.toString(value));
            }
            InternationalString minutes = null;
            if ((value = duration.getMinutes()) != 0) {
                minutes = new SimpleInternationalString(Integer.toString(value));
            }
            InternationalString seconds = null;
            if ((value = duration.getSeconds()) != 0) {
                seconds = new SimpleInternationalString(Integer.toString(value));
            }
            metadata = factory.createPeriodDuration(years, months, weeks, days, hours, minutes, seconds);
        } catch (UnsupportedOperationException e) {
            warningOccured("setElement", e);
        }
View Full Code Here

     */
    private void testWithXLink(final boolean useReferenceResolverMock) {
        final XLink link = new XLink();
        link.setShow(XLink.Show.REPLACE);
        link.setActuate(XLink.Actuate.ON_LOAD);
        link.setTitle(new SimpleInternationalString("myLinkTitle"));
        metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
        if (useReferenceResolverMock) {
            context = ReferenceResolverMock.begin(true);
            // XMLTestCase.clearContext() will dispose the context.
        }
View Full Code Here

        assertEquals(XLink.Type.EXTENDED, link.getType());
        assertEquals("XLink[type=\"extended\", role=\"org:apache:sis:role\"]", link.toString());
        assertFalse("Hash code should have changed.", hashCode == (hashCode = link.hashCode()));
        assertFalse("Hash code can not be zero.", hashCode == 0);

        link.setTitle(new SimpleInternationalString("Some title"));
        assertEquals(XLink.Type.EXTENDED, link.getType());
        assertEquals("XLink[type=\"extended\", role=\"org:apache:sis:role\", title=\"Some title\"]", link.toString());
        assertFalse("Hash code should have changed.", hashCode == (hashCode = link.hashCode()));
        assertFalse("Hash code can not be zero.", hashCode == 0);
View Full Code Here

    @Test
    public void testEquals() throws URISyntaxException {
        final XLink link = new XLink();
        link.setType(XLink.Type.AUTO);
        link.setRole(new URI("org:apache:sis:role"));
        link.setTitle(new SimpleInternationalString("Some title"));
        link.freeze();

        final XLink other = new XLink();
        assertFalse(link.equals(other));
        assertFalse(link.hashCode() == other.hashCode());

        other.setType(XLink.Type.AUTO);
        assertFalse(link.equals(other));
        assertFalse(link.hashCode() == other.hashCode());

        other.setRole(new URI("org:apache:sis:role"));
        assertFalse(link.equals(other));
        assertFalse(link.hashCode() == other.hashCode());

        other.setTitle(new SimpleInternationalString("Some title"));
        assertEquals(link, other);
        assertEquals(link.hashCode(), other.hashCode());

        other.freeze();
        assertEquals(link, other);
View Full Code Here

            CharSequence string = "An ordinary sentence.";
            switch (i) {
                case 0/* Test directly on the String instance. */              break;
                case 1:  string = new StringBuilder            ((String) string); break;
                case 2:  string = new StringBuffer             ((String) string); break;
                case 3:  string = new SimpleInternationalString((String) string); break;
                default: throw new AssertionError(i);
            }
            final int length = string.length();
            assertEquals(-1, indexOf(string, "dummy",     0, length));
            assertEquals( 0, indexOf(string, "An",        0, length));
View Full Code Here

            switch (i) {
                case 0:  sequence =                              ("testCopyChars()"); break;
                case 1:  sequence = new StringBuilder            ("testCopyChars()"); break;
                case 2:  sequence = new StringBuffer             ("testCopyChars()"); break;
                case 3:  sequence =     CharBuffer.wrap          ("testCopyChars()"); break;
                case 4:  sequence = new SimpleInternationalString("testCopyChars()"); break;
                default: throw new AssertionError(i);
            }
            Arrays.fill(buffer, '-');
            copyChars(sequence, 4, buffer, 2, 9);
            assertEquals("--CopyChars-", String.valueOf(buffer));
View Full Code Here

    /**
     * Returns the given string as an {@code InternationalString} if non-null, or {@code null} otherwise.
     */
    private static InternationalString toInternationalString(final String value) {
        return (value != null) ? new SimpleInternationalString(value) : null;
    }
View Full Code Here

        if (list != null) {
            final Set<InternationalString> words = new LinkedHashSet<InternationalString>();
            for (String keyword : list.split(KEYWORD_SEPARATOR)) {
                keyword = keyword.trim();
                if (!keyword.isEmpty()) {
                    words.add(new SimpleInternationalString(keyword));
                }
            }
            if (!words.isEmpty()) {
                keywords = new DefaultKeywords();
                keywords.setKeywords(words);
View Full Code Here

TOP

Related Classes of org.apache.sis.util.iso.SimpleInternationalString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.