axsl-commit Mailing List for aXSL (Page 2)
An API for XSL-FO.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(36) |
Apr
(36) |
May
(127) |
Jun
(193) |
Jul
(12) |
Aug
(46) |
Sep
(66) |
Oct
(28) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(39) |
Feb
(68) |
Mar
(58) |
Apr
(88) |
May
(40) |
Jun
(82) |
Jul
(213) |
Aug
(19) |
Sep
(2) |
Oct
(26) |
Nov
(2) |
Dec
|
2008 |
Jan
(5) |
Feb
(30) |
Mar
(26) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
(4) |
Apr
(44) |
May
(1) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
(7) |
May
(35) |
Jun
|
Jul
|
Aug
(48) |
Sep
(10) |
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(40) |
2017 |
Jan
(82) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(37) |
Mar
(28) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(27) |
2021 |
Jan
(52) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(8) |
Nov
(72) |
Dec
(100) |
2022 |
Jan
(119) |
Feb
(94) |
Mar
(4) |
Apr
|
May
|
Jun
(5) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
|
Nov
(10) |
Dec
(97) |
2023 |
Jan
(52) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
(21) |
Oct
(8) |
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(11) |
Feb
(1) |
Mar
|
Apr
(27) |
May
(62) |
Jun
(27) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <vic...@us...> - 2025-06-04 12:11:08
|
Revision: 2858 http://sourceforge.net/p/axsl/code/2858 Author: victormote Date: 2025-06-04 12:11:01 +0000 (Wed, 04 Jun 2025) Log Message: ----------- 1. Add type-specific abstract classes to house the equals and hashCode methods. 2. Move existing code in ByteSequence to new abstract class. Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java Added Paths: ----------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractBooleanSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractByteSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractCharSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractDoubleSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractFloatSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractIntSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractLongSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractNibbleSequence.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractShortSequence.java Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractBooleanSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractBooleanSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractBooleanSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link BooleanSequence}. + */ +public abstract class AbstractBooleanSequence extends AbstractPrimitiveSequence implements BooleanSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractBooleanSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractByteSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractByteSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractByteSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,83 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link ByteSequence}. + */ +public abstract class AbstractByteSequence extends AbstractPrimitiveSequence implements ByteSequence { + + /** A magic number used in the computation of the hash code. */ + private static final int HASH_FACTOR = 31; + + /** + * A reasonable implementation of {@link Object#equals(Object)}, assuming that the only content in the + * implementation is the sequence of bytes. + * @param other The object being compared for equality. + * @return True if and only if {@code this} is equal to {@code other}. + */ + public boolean equals(final Object other) { + if (this == other) { + return true; + } + if (! (other instanceof ByteSequence)) { + return false; + } + + final ByteSequence otherSequence = (ByteSequence) other; + /* We cannot use Arrays.equals() here, as ByteSequence should not expose its immutable internal array. + * Instead, we imitate it. */ + + /* The Arrays.equals() logic first compares the identify of the two arrays. Although we could devise a way to do + * the same here, such a comparison should always be negative, since implementations should ensure that those + * two arrays /never/ have the same identity, to avoid mutation. */ + + if (this.length() != otherSequence.length()) { + return false; + } + for (int index = 0; index < this.length(); index ++) { + if (this.byteAt(index) != otherSequence.byteAt(index)) { + return false; + } + } + return true; + } + + /** + * A reasonable implementation of {@link Object#hashCode()}, assuming that the only content in the implementation is + * the sequence of bytes. + * @return The hash code. + */ + public int hashCode() { + /* We cannot use Arrays#hashCode(byte[]) here, as ByteSequence should not expose its immutable internal array. + * Instead, we imitate it. */ + int result = 1; + for (int index = 0; index < length(); index ++) { + final byte element = byteAt(index); + result = HASH_FACTOR * result + element; + } + return result; + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractByteSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractCharSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractCharSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractCharSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link CharSequence}. + */ +public abstract class AbstractCharSequence extends AbstractPrimitiveSequence implements CharSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractCharSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractDoubleSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractDoubleSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractDoubleSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link DoubleSequence}. + */ +public abstract class AbstractDoubleSequence extends AbstractPrimitiveSequence implements DoubleSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractDoubleSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractFloatSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractFloatSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractFloatSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link FloatSequence}. + */ +public abstract class AbstractFloatSequence extends AbstractPrimitiveSequence implements FloatSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractFloatSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractIntSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractIntSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractIntSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link IntSequence}. + */ +public abstract class AbstractIntSequence extends AbstractPrimitiveSequence implements IntSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractIntSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractLongSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractLongSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractLongSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link LongSequence}. + */ +public abstract class AbstractLongSequence extends AbstractPrimitiveSequence implements LongSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractLongSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractNibbleSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractNibbleSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractNibbleSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link NibbleSequence}. + */ +public abstract class AbstractNibbleSequence extends AbstractPrimitiveSequence implements NibbleSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractNibbleSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractShortSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractShortSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractShortSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -0,0 +1,41 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Methods probably useful to all implementations of {@link ShortSequence}. + */ +public abstract class AbstractShortSequence extends AbstractPrimitiveSequence implements ShortSequence { + + @Override + public boolean equals(final Object other) { + return super.equals(other); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractShortSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java 2025-06-04 11:17:33 UTC (rev 2857) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java 2025-06-04 12:11:01 UTC (rev 2858) @@ -23,6 +23,8 @@ package org.axsl.primitive.sequence; +import java.nio.charset.Charset; + /** * A readable sequence of {@link Byte#TYPE} values, providing uniform, read-only access to such values. * This is intended to be the equivalent of {@link CharSequence}, but for {@link Byte#TYPE} instead of @@ -30,61 +32,7 @@ */ public interface ByteSequence { - /** A magic number used in the computation of the hash code. */ - int HASH_FACTOR = 31; - /** - * A reasonable implementation of {@link Object#equals(Object)}, assuming that the only content in the - * implementation is the sequence of bytes. - * To use, implementations should override {@link Object#equals(Object)} with a call to this method. - * @param other The object being compared for equality. - * @return True if and only if {@code this} is equal to {@code other}. - */ - default boolean altEquals(final Object other) { - if (this == other) { - return true; - } - if (! (other instanceof ByteSequence)) { - return false; - } - - final ByteSequence otherSequence = (ByteSequence) other; - /* We cannot use Arrays.equals() here, as ByteSequence should not expose its immutable internal array. - * Instead, we imitate it. */ - - /* The Arrays.equals() logic first compares the identify of the two arrays. Although we could devise a way to do - * the same here, such a comparison should always be negative, since implementations should ensure that those - * two arrays /never/ have the same identity, to avoid mutation. */ - - if (this.length() != otherSequence.length()) { - return false; - } - for (int index = 0; index < this.length(); index ++) { - if (this.byteAt(index) != otherSequence.byteAt(index)) { - return false; - } - } - return true; - } - - /** - * A reasonable implementation of {@link Object#hashCode()}, assuming that the only content in the implementation is - * the sequence of bytes. - * To use, implementations should override {@link Object#hashCode()} with a call to this method. - * @return The hash code. - */ - default int altHashCode() { - /* We cannot use Arrays#hashCode(byte[]) here, as ByteSequence should not expose its immutable internal array. - * Instead, we imitate it. */ - int result = 1; - for (int index = 0; index < length(); index ++) { - final byte element = byteAt(index); - result = HASH_FACTOR * result + element; - } - return result; - } - - /** * Returns the length of this byte sequence. * @return The number of {@link Byte#TYPE}s in this sequence. * @see CharSequence#length() @@ -108,7 +56,7 @@ * See {@link java.nio.charset.StandardCharsets} for charsets that are available on all Java implementations. * @return A new string. */ - String toString(java.nio.charset.Charset charset); + String toString(Charset charset); /** * Convenience method that converts the {@link Byte#TYPE}s in this array to a String, using the "US-ASCII" character This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-06-04 11:17:42
|
Revision: 2857 http://sourceforge.net/p/axsl/code/2857 Author: victormote Date: 2025-06-04 11:17:33 +0000 (Wed, 04 Jun 2025) Log Message: ----------- Move common primitive sequence code to aXSL. Added Paths: ----------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractPrimitiveSequence.java Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractPrimitiveSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractPrimitiveSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractPrimitiveSequence.java 2025-06-04 11:17:33 UTC (rev 2857) @@ -0,0 +1,44 @@ +/* + * Copyright 2022 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Common code for primitive sequences. + */ +public abstract class AbstractPrimitiveSequence { + + /** The template for the message for this exception. */ + private static final String FORMAT = "Index = %d, Size = %d"; + + /** + * Always throws an IndexOutOfBoundsException with a helpful message. + * @param offendingIndex The index value that is out-of-bounds. + * @param sizeOfOffendedItem The size of the indexed object whose range was violated. + */ + public void throwIndexOutOfBoundsException(final int offendingIndex, final int sizeOfOffendedItem) { + final String message = String.format(FORMAT, offendingIndex, sizeOfOffendedItem); + throw new IndexOutOfBoundsException(message); + } + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/AbstractPrimitiveSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-06-03 16:04:11
|
Revision: 2856 http://sourceforge.net/p/axsl/code/2856 Author: victormote Date: 2025-06-03 16:04:07 +0000 (Tue, 03 Jun 2025) Log Message: ----------- Add methods usable as substitutes for equals() and hashCode(). Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java 2025-06-03 10:39:46 UTC (rev 2855) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequence.java 2025-06-03 16:04:07 UTC (rev 2856) @@ -30,7 +30,61 @@ */ public interface ByteSequence { + /** A magic number used in the computation of the hash code. */ + int HASH_FACTOR = 31; + /** + * A reasonable implementation of {@link Object#equals(Object)}, assuming that the only content in the + * implementation is the sequence of bytes. + * To use, implementations should override {@link Object#equals(Object)} with a call to this method. + * @param other The object being compared for equality. + * @return True if and only if {@code this} is equal to {@code other}. + */ + default boolean altEquals(final Object other) { + if (this == other) { + return true; + } + if (! (other instanceof ByteSequence)) { + return false; + } + + final ByteSequence otherSequence = (ByteSequence) other; + /* We cannot use Arrays.equals() here, as ByteSequence should not expose its immutable internal array. + * Instead, we imitate it. */ + + /* The Arrays.equals() logic first compares the identify of the two arrays. Although we could devise a way to do + * the same here, such a comparison should always be negative, since implementations should ensure that those + * two arrays /never/ have the same identity, to avoid mutation. */ + + if (this.length() != otherSequence.length()) { + return false; + } + for (int index = 0; index < this.length(); index ++) { + if (this.byteAt(index) != otherSequence.byteAt(index)) { + return false; + } + } + return true; + } + + /** + * A reasonable implementation of {@link Object#hashCode()}, assuming that the only content in the implementation is + * the sequence of bytes. + * To use, implementations should override {@link Object#hashCode()} with a call to this method. + * @return The hash code. + */ + default int altHashCode() { + /* We cannot use Arrays#hashCode(byte[]) here, as ByteSequence should not expose its immutable internal array. + * Instead, we imitate it. */ + int result = 1; + for (int index = 0; index < length(); index ++) { + final byte element = byteAt(index); + result = HASH_FACTOR * result + element; + } + return result; + } + + /** * Returns the length of this byte sequence. * @return The number of {@link Byte#TYPE}s in this sequence. * @see CharSequence#length() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-06-03 10:39:50
|
Revision: 2855 http://sourceforge.net/p/axsl/code/2855 Author: victormote Date: 2025-06-03 10:39:46 +0000 (Tue, 03 Jun 2025) Log Message: ----------- Remove unnecessary char-to-byte conversion options. Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java 2025-05-31 20:50:14 UTC (rev 2854) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java 2025-06-03 10:39:46 UTC (rev 2855) @@ -101,14 +101,6 @@ ByteSequenceMutable append(CharSequence charSequence, Charset charset); /** - * Converts a {@link CharSequence} to bytes using a specified charset and appends those bytes to this sequence. - * @param charSequence The sequence to be converted and appended. - * @param charsetName The name of the character set to use during the char-to-byte conversion. - * @return A reference to this. - */ - ByteSequenceMutable append(CharSequence charSequence, String charsetName); - - /** * Converts a single char to byte(s) using the "US-ASCII" charset and appends those byte(s) to this sequence. * @param theChar The char to be converted and appended. * @return A reference to this. @@ -124,14 +116,6 @@ ByteSequenceMutable append(char theChar, Charset charset); /** - * Converts a single char to byte(s) using a specified charset and appends those byte(s) to this sequence. - * @param theChar The char to be converted and appended. - * @param charsetName The name of the character set to use during the char-to-byte conversion. - * @return A reference to this. - */ - ByteSequenceMutable append(char theChar, String charsetName); - - /** * Appends the content of an input stream. * It is the responsibility of the calling code to manage the opening and closing of the stream and to position the * stream where reading should begin. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-31 20:50:17
|
Revision: 2854 http://sourceforge.net/p/axsl/code/2854 Author: victormote Date: 2025-05-31 20:50:14 +0000 (Sat, 31 May 2025) Log Message: ----------- Add compare method to ByteSequencePlus. Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java 2025-05-30 23:55:41 UTC (rev 2853) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java 2025-05-31 20:50:14 UTC (rev 2854) @@ -683,4 +683,41 @@ */ String difference(Object other); + /** + * <p>Compares two byte arrays lexicographically, as if they were strings. + * If the array is considered as a sequence where index 0 is at the left, and index (length - 1) is at the right, + * the comparison runs from left to right. + * The result is a negative integer if this {@code ByteSequencePlus} object lexicographically precedes the argument + * object. + * The result is a positive integer if this {@code ByteSequencePlus} object lexicographically follows the argument + * object. + * The result is zero if the sequences are equal; {@code compareTo} returns {@code 0} exactly when the + * {@link #equals(Object)} method would return {@code true}.</p> + * + * <p>If the two sequences are different, then either they have different characters at some index that is a valid + * index for both sequences, or their lengths are different, or both. + * If they have different characters at one or more index positions, let <i>k</i> be the smallest such index; then + * the sequence whose byte at position <i>k</i> has the smaller value, as determined by using the < operator, + * lexicographically precedes the other sequence. + * In this case, {@code compareTo} returns the difference of the two character values at position {@code k} in + * the two sequences:</p> + * <blockquote><pre> + * this.byteAt(k) - other.byteAt(k) + * </pre></blockquote> + * + * <p>If there is no index position at which they differ, then the shorter sequence lexicographically precedes the + * longer sequence. + * In this case, {@code compareTo} returns the difference of the lengths of the sequences:</p> + * <blockquote><pre> + * this.length() - other.length() + * </pre></blockquote> + * + * @param other The {@code ByteSequence} to be compared. + * @return Tthe value {@code 0} if the argument sequence is equal to this sequence; a value less than {@code 0} if + * this sequence is lexicographically less than the argument sequence; and a value greater than {@code 0} if this + * sequence is lexicographically greater than the argument sequence. + * @see String#compareTo(String) + */ + int compareToLtR(ByteSequence other); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-30 23:55:44
|
Revision: 2853 http://sourceforge.net/p/axsl/code/2853 Author: victormote Date: 2025-05-30 23:55:41 +0000 (Fri, 30 May 2025) Log Message: ----------- Move CharSet to foray-ps-data. Removed Paths: ------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/CharSet.java Deleted: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/CharSet.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/CharSet.java 2025-05-30 22:31:45 UTC (rev 2852) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/CharSet.java 2025-05-30 23:55:41 UTC (rev 2853) @@ -1,106 +0,0 @@ -/* - * Copyright 2009 The aXSL Project. - * http://www.axsl.org - * - * 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. - */ - -/* - * $LastChangedRevision$ - * $LastChangedDate$ - * $LastChangedBy$ - */ - -package org.axsl.ps; - -/** - * <p>A CharSet is a collection of related characters. - * Fonts are frequently designed to cover a specific collection of characters. - * For example, 12 of the Base-14 fonts cover the ExtendedRoman collection.</p> - * - * <p>The main purpose of the CharSet interface is to efficiently map a Unicode code point to an array index that can be - * used in some other place to store information about that code point. - * For example, as an Adobe Font Metrics (AFM) file is parsed, width metric information is accumulated about each glyph - * in the font. - * Those widths are most efficiently stored in an array, but some means for getting the index to that array is needed. - * The font Encoding is not a suitable concept to use as an index for such information, because it is limited to 256 - * characters and, as a matter of practice, most Encodings use less than that. - * A font may contain more than 256 glyphs. - * For example, the ExtendedRoman character set contains 315 glyphs. - * By separating CharSet from Encoding, we can record all of the information about a font without caring how it will be - * encoded as it is used.</p> - */ -public interface CharSet { - - /** - * Enumeration of predefined character sets. - */ - enum Predefined { - - /** The "Windows ANSI" character set, also known as Windows Code Page 1252. Its members are the same as those - * encoded in {@link PsEncoding.Predefined#WIN_ANSI}. */ - WINDOWS_ANSI("WindowsANSI"), - - /** The "Extended Roman" character set. There does not seem to be an official list for this character set, but - * it can be inferred from the AFM files for the PDF Base-14 Roman fonts. */ - EXTENDED_ROMAN("ExtendedRoman"); - - /** The name of the character set. */ - private String name; - - /** - * Private Constructor. - * @param name The name of the character set. - */ - Predefined(final String name) { - this.name = name; - } - - /** - * Returns the name of the character set. - * @return The name of the character set. - */ - public String getName() { - return this.name; - } - - /** - * Finds the instance that matches a given name. - * @param name The name of the predefined character set to find. - * @return The predefined character set matching {@code name}, or null if no such character set exists. - */ - public static Predefined findByName(final String name) { - for (int i = 0; i < CharSet.Predefined.values().length; i++) { - final Predefined charSet = CharSet.Predefined.values()[i]; - if (charSet.getName().equals(name)) { - return charSet; - } - } - return null; - } - } - - /** - * Returns the array index for a Unicode code point in this character set. - * @param codePoint The Unicode code point whose index should be found. - * @return The index for {@code codePoint}, or -1 if it is not in the character set. - */ - int getIndex(int codePoint); - - /** - * Returns the number of elements (Unicode code points) in this character set. - * @return The number of elements in this character set. - */ - int size(); - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-30 22:31:48
|
Revision: 2852 http://sourceforge.net/p/axsl/code/2852 Author: victormote Date: 2025-05-30 22:31:45 +0000 (Fri, 30 May 2025) Log Message: ----------- Move GlyphList interface to foray-ps-data. Removed Paths: ------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/GlyphList.java Deleted: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/GlyphList.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/GlyphList.java 2025-05-30 16:42:43 UTC (rev 2851) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/GlyphList.java 2025-05-30 22:31:45 UTC (rev 2852) @@ -1,62 +0,0 @@ -/* - * Copyright 2009 The aXSL Project. - * http://www.axsl.org - * - * 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. - */ - -/* - * $LastChangedRevision$ - * $LastChangedDate$ - * $LastChangedBy$ - */ - -package org.axsl.ps; - -/** - * Maps glyph names to Unicode code points. - * Such a mapping is needed because Type 1 fonts are keyed by names, and these names must be mapped to their - * corresponding code points before an {@link EncodingVector} can be built. - */ -public interface GlyphList { - - /** - * Enumeration of the predefined glphy lists. - */ - enum Predefined { - /** - * The Adobe Glyph List, the standard glyph list used in most Type 1 fonts. - * See http://partners.adobe.com/asn/tech/type/glyphlist.txt for the list, and see - * http://partners.adobe.com/asn/tech/type/unicodegn.jsp for the background. - */ - AGL, - - /** The special glyph list used for dingbat fonts. */ - ZAPF_DINGBATS; - } - - /** - * Finds the Unicode code point which corresponds to a given glyph name. - * @param glyphName The glyph name for which a code point is sought. - * @return The Unicode code point which corresponds to {@code glyphName}, or -1 if there is none. - */ - int mapGlyphNameToCodePoint(String glyphName); - - /** - * Finds the glyph name for a given Unicode code point. - * @param codePoint The Unicode code point for which a glyph name is sought. - * @return The glyph name which corresponds to {@code codePoint}, or null if there is none. - */ - String mapCodePointToGlyphName(int codePoint); - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-30 16:42:47
|
Revision: 2851 http://sourceforge.net/p/axsl/code/2851 Author: victormote Date: 2025-05-30 16:42:43 +0000 (Fri, 30 May 2025) Log Message: ----------- Move PsEncodeFilter to FOray foray-ps-data, which has fewer restrictions on it than foray-ps. If filters are needed, they can be obtained directly from there. Removed Paths: ------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java Deleted: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java 2025-05-30 14:02:04 UTC (rev 2850) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java 2025-05-30 16:42:43 UTC (rev 2851) @@ -1,85 +0,0 @@ -/* - * Copyright 2009 The aXSL Project. - * http://www.axsl.org - * - * 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. - */ - -/* - * $LastChangedRevision$ - * $LastChangedDate$ - * $LastChangedBy$ - */ - -package org.axsl.ps; - -import java.io.FilterOutputStream; -import java.io.OutputStream; - -/** - * A PostScript encoding filter object. - * @see "PostScript Language Reference, Third Edition, Section 3.8.4 for discussion of filters." - * @see "PostScript Language Reference, Third Edition, Section 3.13 for discussion of filtered files." - */ -public abstract class PsEncodeFilter extends FilterOutputStream { - - /** - * Constructor. - * @param out The output stream being wrapped. - */ - public PsEncodeFilter(final OutputStream out) { - super(out); - } - - /** - * Return a PostScript name representation of the filter, e.g. /FlateEncode. - * @return A PostScript name representation of the filter. - */ - public abstract String getName(); - - /** - * Return the PostScript name of the filter that should be used to decode content encoded by this filter. - * For example, if this filter is "/FlateEncode", this method should return "/FlateDecode". - * @return The name of the decode filter. - */ - public abstract String getDecodeName(); - - /** - * Sets the decode parameters for this filter. - * @param decodeParms The new decode parameters. - */ - public abstract void setDecodeParms(String decodeParms); - - /** - * Return a parameter dictionary for this filter, or null if there is none. - * @return The parameter dictionary for this filter. - */ - public abstract String getDecodeParms(); - - /** - * Sets this filter to a state where it acts as a null filter, simply passing the data through as received. - * This is useful in cases where the filter needs to exist as a marker, but should not be applied. - * One example is the case where the raw data has already been filtered, but the filter needs to be created anyway - * to signal to something downstream that it needs to be unfiltered. - */ - public abstract void setInactive(); - - /** - * Sets the length of the output line that should be written during encoding. - * This only applies to some filter types, such as that for {@link PsFilterType#ASCII_HEX}, and will be ignored by - * other filter types. - * @param lineLength The length, in ASCII characters, of the filter output lines. - */ - public abstract void setLineLength(int lineLength); - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-30 14:02:11
|
Revision: 2850 http://sourceforge.net/p/axsl/code/2850 Author: victormote Date: 2025-05-30 14:02:04 +0000 (Fri, 30 May 2025) Log Message: ----------- Remove a throws clause and an Exception class. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreter.java trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java Removed Paths: ------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreterException.java Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreter.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreter.java 2025-05-30 13:28:25 UTC (rev 2849) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreter.java 2025-05-30 14:02:04 UTC (rev 2850) @@ -30,9 +30,9 @@ /** * Parses and interprets the input. - * @throws PsInterpreterException For any PostScript error. + * @throws PsException For any PostScript error. */ - void process() throws PsInterpreterException; + void process() throws PsException; /** * Returns the font directory. Deleted: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreterException.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreterException.java 2025-05-30 13:28:25 UTC (rev 2849) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInterpreterException.java 2025-05-30 14:02:04 UTC (rev 2850) @@ -1,73 +0,0 @@ -/* - * Copyright 2009 The aXSL Project. - * http://www.axsl.org - * - * 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. - */ - -/* - * $LastChangedRevision$ - * $LastChangedDate$ - * $LastChangedBy$ - */ - -package org.axsl.ps; - -/** - * Exception class for problems interpreting a PostScript file. - */ -public class PsInterpreterException extends Exception { - - /** Constant needed for serialization. */ - private static final long serialVersionUID = -721753368687001434L; - - /** - * Constructs a new exception with {@code null} as its detail message. - * The cause is not initialized, and may subsequently be initialized by a call to {@link #initCause}. - */ - public PsInterpreterException() { - super(); - } - - /** - * Constructs a new exception with the specified detail message. - * The cause is not initialized, and may subsequently be initialized by a call to {@link #initCause}. - * @param message The detail message. - * The detail message is saved for later retrieval by the {@link #getMessage()} method. - */ - public PsInterpreterException(final String message) { - super(message); - } - - /** - * Constructs a new exception with the specified detail message and cause. - * <p>Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated in - * this exception's detail message. - * @param message The detail message (which is saved for later retrieval by the {@link #getMessage()} method). - * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). - * (A @code(null) value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - public PsInterpreterException(final String message, final Throwable cause) { - super(message, cause); - } - - /** - * Constructs a new exception with the specified cause and a detail message describing that cause. - * This constructor is useful for exceptions that are little more than wrappers for other throwables. - * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). - * (A @code(null) value is permitted, and indicates that the cause is nonexistent or unknown.) - */ - public PsInterpreterException(final Throwable cause) { - super(cause); - } -} Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-30 13:28:25 UTC (rev 2849) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-30 14:02:04 UTC (rev 2850) @@ -58,8 +58,7 @@ * @param input The input stream to be interpreted. * @param systemDict The system dictionary. * @return A new interpreter. - * @throws PsException For errors creating the interpreter. */ - PsInterpreter createInterpreter(InputStream input, PsSystemDict systemDict) throws PsException; + PsInterpreter createInterpreter(InputStream input, PsSystemDict systemDict); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-30 13:28:34
|
Revision: 2849 http://sourceforge.net/p/axsl/code/2849 Author: victormote Date: 2025-05-30 13:28:25 +0000 (Fri, 30 May 2025) Log Message: ----------- Replace PsInput with InputStream. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java Removed Paths: ------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInput.java Deleted: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInput.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInput.java 2025-05-28 18:58:18 UTC (rev 2848) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsInput.java 2025-05-30 13:28:25 UTC (rev 2849) @@ -1,49 +0,0 @@ -/* - * Copyright 2009 The aXSL Project. - * http://www.axsl.org - * - * 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. - */ - -/* - * $LastChangedRevision$ - * $LastChangedDate$ - * $LastChangedBy$ - */ - -package org.axsl.ps; - -import org.axsl.primitive.sequence.ByteSequence; - -import java.io.IOException; - -/** - * Interface for objects that wish to be used as input to the PostScript interpreter. - * This interface is needed because a variety of file types may be used as input to a PostScript interpreter. - * For example, Type 1 font files are frequently packaged in operating-system-specific wrapper files that must be - * unwrapped (and sometimes decoded) before they can be consumed by the PostScript interpreter. - * This interface allows other classes to do that work and pass the results through to the interpreter. - * - * Please note that the implementing class is responsible for any buffering of - * the data for i/o efficiency purposes. - */ -public interface PsInput { - - /** - * Returns the next byte array chunk in the input so that it can be consumed by the PostScript interpreter. - * @return The next byte array that should be consumed by the interpreter, or null if there is no more input. - * @throws IOException For I/O Errors. - */ - ByteSequence providePostScriptInput() throws IOException; - -} Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-28 18:58:18 UTC (rev 2848) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-30 13:28:25 UTC (rev 2849) @@ -24,7 +24,6 @@ package org.axsl.ps; import java.awt.Graphics2D; -import java.io.IOException; import java.io.InputStream; /** @@ -33,14 +32,6 @@ public interface PsServer { /** - * Creates a {@link PsInput} instance from a File. - * @param input The input to be processed as PostScript input. - * @return The newly-created PsInput. - * @throws IOException For errors opening the file. - */ - PsInput createPsInput(InputStream input) throws IOException; - - /** * Returns a read-only system dictionary. * This is useful for cases where no drawing should be done, but we wish to interpret the document and see the * state of the various data structures. This was specifically designed for parsing Type 1 fonts and extracting @@ -64,11 +55,11 @@ /** * Creates a PostScript interpreter. - * @param psInput The input source to be interpreted. + * @param input The input stream to be interpreted. * @param systemDict The system dictionary. * @return A new interpreter. * @throws PsException For errors creating the interpreter. */ - PsInterpreter createInterpreter(PsInput psInput, PsSystemDict systemDict) throws PsException; + PsInterpreter createInterpreter(InputStream input, PsSystemDict systemDict) throws PsException; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-28 18:58:23
|
Revision: 2848 http://sourceforge.net/p/axsl/code/2848 Author: victormote Date: 2025-05-28 18:58:18 +0000 (Wed, 28 May 2025) Log Message: ----------- Move more common code from FOray to MutableSequence (aXSL). Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java 2025-05-28 16:43:12 UTC (rev 2847) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java 2025-05-28 18:58:18 UTC (rev 2848) @@ -29,6 +29,98 @@ public interface MutableSequence { /** + * The maximum size of array to allocate. + * Some VMs reserve some header words in an array. + * Attempts to allocate larger arrays may result in OutOfMemoryError: Requested array size exceeds VM limit. + * This value is based on the private constant java.lang.AbstractStringBuilder.MAX_ARRAY_SIZE. + * @see "The package-visible class java.lang.AbstractStringBuilder." + */ + int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; + + /** Default Capacity increment size. */ + int DEFAULT_BLOCK_SIZE = 2048; + + + + + +/* ********** Methods related to CAPACITY. ************************************************************************** */ + + + /** + * Returns the current capacity. + * The capacity is the total size, in elements, of the internal buffer. + * Any excess of it over {@link #length()} is available for newly inserted elements. + * Adding elements beyond the capacity will result in an allocation. + * @return The current capacity. + * @see java.lang.StringBuilder#capacity() + */ + int capacity(); + + /** + * Ensures that the capacity is at least equal to the specified minimum. + * If the current capacity is less than the argument, then a new internal array is allocated with greater capacity. + * The new capacity is the larger of: + * <ul> + * <li>The {@code minimumCapacity} argument. + * <li>Twice the old capacity, plus {@code 2}. + * </ul> + * If the {@code minimumCapacity} argument is nonpositive, this method takes no action and simply returns. + * Note that subsequent operations on this object can reduce the actual capacity below that requested here. + * @param minimumCapacity The minimum desired capacity. + * @see java.lang.StringBuilder#ensureCapacity(int) + */ + void ensureCapacity(int minimumCapacity); + + /** + * Attempts to reduce storage used for the sequence. + * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space + * efficient. + * Calling this method may, but is not required to, affect the value returned by a subsequent call to the + * {@link #capacity()} method. + */ + void trimToSize(); + + /** + * Returns a capacity at least as large as the given minimum capacity. + * Returns the current capacity increased by the same amount + 2. + * Will not return a capacity greater than {@code MAX_ARRAY_SIZE} unless the given minimum capacity is greater than + * that. + * @param minCapacity the desired minimum capacity + * @return The new capacity. + * @throws OutOfMemoryError If minCapacity is less than zero or greater than {@link Integer#MAX_VALUE}. + */ + default int newCapacity(final int minCapacity) { + int newCapacity = (capacity() << 1) + 2; + if (newCapacity - minCapacity < 0) { + newCapacity = minCapacity; + } + return (newCapacity <= 0 || MAX_ARRAY_SIZE - newCapacity < 0) ? hugeCapacity(minCapacity) : newCapacity; + } + + /** + * Computes the new capacity for the case where the minimum requested capacity is greater than the normal increment + * amount. + * @param minCapacity The requested minimum capacity. + * @return The computed new capacity. + */ + default int hugeCapacity(final int minCapacity) { + if (Integer.MAX_VALUE - minCapacity < 0) { + throw new OutOfMemoryError(); + } + return (minCapacity > MAX_ARRAY_SIZE) ? minCapacity : MAX_ARRAY_SIZE; + } + + + + + + + +/* ********** Methods related to CONTENT. *************************************************************************** */ + + + /** * Sets the new length of the sequence. * Existing elements are left unchanged unless they are truncated by this operation. * New elements are created as needed if this operation results in a larger array, and are initialized with zero. @@ -51,24 +143,6 @@ void sort(); /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Treating this sequence as a stack, indicates whether there are any items in the stack. * @return True if and only if there are no items on the stack. * @see java.util.Stack#empty() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-28 16:43:17
|
Revision: 2847 http://sourceforge.net/p/axsl/code/2847 Author: victormote Date: 2025-05-28 16:43:12 +0000 (Wed, 28 May 2025) Log Message: ----------- Create superinterface for shared methods. Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java Added Paths: ----------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -35,26 +35,9 @@ * <li>void sort()</li> * </ul> */ -public interface BooleanSequenceMutable extends BooleanSequencePlus, Swappable { +public interface BooleanSequenceMutable extends MutableSequence, BooleanSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with - * {@link Boolean#FALSE}. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The boolean at the specified index is set to {@code newBoolean}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the boolean {@code newBoolean} at position {@code index}. @@ -67,24 +50,6 @@ void setBooleanAt(int index, boolean newBoolean); /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -145,13 +110,6 @@ boolean peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -37,25 +37,9 @@ * serialization, parsing, etc., this interface contains methods that have no analog in the other mutable sequence * interfaces like (for example) {@link IntSequenceMutable}.</p> */ -public interface ByteSequenceMutable extends ByteSequencePlus, Swappable { +public interface ByteSequenceMutable extends MutableSequence, ByteSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with zero. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The byte at the specified index is set to {@code newByte}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the short {@code newByte} at position {@code index}. @@ -68,30 +52,6 @@ void setByteAt(int index, byte newByte); /** - * Sorts the specified array into ascending numerical order. - * @see java.util.Arrays#sort(byte[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -209,13 +169,6 @@ byte peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -34,26 +34,9 @@ * be subclassed to conform to this interface either. * That said, this interface should attempt to conform to the naming conventions used in that class.</p> */ -public interface CharSequenceMutable extends CharSequencePlus, Swappable { +public interface CharSequenceMutable extends MutableSequence, CharSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with the null - * character (zero). - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The character at the specified index is set to {@code newChar}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the character {@code newChar} at position {@code index}. @@ -66,30 +49,6 @@ void setCharAt(int index, char newChar); /** - * Sorts this sequence into ascending numerical order. - * @see java.util.Arrays#sort(char[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -150,13 +109,6 @@ char peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -29,25 +29,9 @@ * doubles, the methods {@link #push(double)}, {@link #pop()}, {@link #peek()}, and {@link #empty()} being provided for * that purpose.</p> */ -public interface DoubleSequenceMutable extends DoubleSequencePlus, Swappable { +public interface DoubleSequenceMutable extends MutableSequence, DoubleSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with zero. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The double at the specified index is set to {@code newDouble}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the double {@code newDouble} at position {@code index}. @@ -60,30 +44,6 @@ void setDoubleAt(int index, double newDouble); /** - * Sorts this sequence into ascending numerical order. - * @see java.util.Arrays#sort(double[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -144,13 +104,6 @@ double peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -29,25 +29,9 @@ * floats, the methods {@link #push(float)}, {@link #pop()}, {@link #peek()}, and {@link #empty()} being provided for * that purpose.</p> */ -public interface FloatSequenceMutable extends FloatSequencePlus, Swappable { +public interface FloatSequenceMutable extends MutableSequence, FloatSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with zero. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The float at the specified index is set to {@code newFloat}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the float {@code newFloat} at position {@code index}. @@ -60,30 +44,6 @@ void setFloatAt(int index, float newFloat); /** - * Sorts this sequence into ascending numerical order. - * @see java.util.Arrays#sort(float[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -144,13 +104,6 @@ float peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -29,25 +29,9 @@ * ints, the methods {@link #push(int)}, {@link #pop()}, {@link #peek()}, and {@link #empty()} being provided for that * purpose.</p> */ -public interface IntSequenceMutable extends IntSequencePlus, Swappable { +public interface IntSequenceMutable extends MutableSequence, IntSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with zero. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The int at the specified index is set to {@code newInt}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the int {@code newInt} at position {@code index}. @@ -84,30 +68,6 @@ int insertSortedUnique(int newInt); /** - * Sorts this sequence into ascending numerical order. - * @see java.util.Arrays#sort(int[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -168,13 +128,6 @@ int peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -29,25 +29,9 @@ * longs, the methods {@link #push(long)}, {@link #pop()}, {@link #peek()}, and {@link #empty()} being provided for that * purpose.</p> */ -public interface LongSequenceMutable extends LongSequencePlus, Swappable { +public interface LongSequenceMutable extends MutableSequence, LongSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with zero. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The long at the specified index is set to {@code newLong}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the long {@code newLong} at position {@code index}. @@ -60,30 +44,6 @@ void setLongAt(int index, long newLong); /** - * Sorts this sequence into ascending numerical order. - * @see java.util.Arrays#sort(long[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -144,13 +104,6 @@ long peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java (rev 0) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -0,0 +1,78 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.primitive.sequence; + +/** + * Super-interface for all primitive mutable sequences. + */ +public interface MutableSequence { + + /** + * Sets the new length of the sequence. + * Existing elements are left unchanged unless they are truncated by this operation. + * New elements are created as needed if this operation results in a larger array, and are initialized with zero. + * The {@code newLength} argument must be greater than or equal to {@code 0}. + * @param newLength The new length. + * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. + */ + void setLength(int newLength); + + /** + * Sets the new length of the sequence to zero. + * @see #setLength(int) + */ + void clear(); + + /** + * Sorts the specified array into ascending numerical order. + * @see java.util.Arrays#sort(byte[]) + */ + void sort(); + + /** + * Returns the current capacity. + * The capacity is the total size, in elements, of the internal buffer. + * Any excess of it over {@link #length()} is available for newly inserted elements. + * Adding elements beyong the capacity will result in an allocation. + * @return The current capacity. + */ + int capacity(); + + /** + * Attempts to reduce storage used for the sequence. + * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space + * efficient. + * Calling this method may, but is not required to, affect the value returned by a subsequent call to the + * {@link #capacity()} method. + */ + void trimToSize(); + + /** + * Treating this sequence as a stack, indicates whether there are any items in the stack. + * @return True if and only if there are no items on the stack. + * @see java.util.Stack#empty() + */ + boolean empty(); + +} Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/MutableSequence.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -29,25 +29,9 @@ * nibbles, the methods {@link #push(byte)}, {@link #pop()}, {@link #peek()}, and {@link #empty()} being provided for * that purpose.</p> */ -public interface NibbleSequenceMutable extends NibbleSequencePlus, Swappable { +public interface NibbleSequenceMutable extends MutableSequence, NibbleSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with zero. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The nibble at the specified index is set to {@code newNibble}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the nibble {@code newNibble} at position {@code index}. @@ -60,30 +44,6 @@ void setNibbleAt(int index, byte newNibble); /** - * Sorts this sequence into ascending numerical order. - * @see java.util.Arrays#sort(short[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append, stored in the low-order four bits. * @return A reference to this. @@ -144,13 +104,6 @@ byte peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java 2025-05-28 16:43:12 UTC (rev 2847) @@ -29,25 +29,9 @@ * shorts, the methods {@link #push(short)}, {@link #pop()}, {@link #peek()}, and {@link #empty()} being provided for * that purpose.</p> */ -public interface ShortSequenceMutable extends ShortSequencePlus, Swappable { +public interface ShortSequenceMutable extends MutableSequence, ShortSequencePlus, Swappable { /** - * Sets the new length of the sequence. - * Existing elements are left unchanged unless they are truncated by this operation. - * New elements are created as needed if this operation results in a larger array, and are initialized with zero. - * The {@code newLength} argument must be greater than or equal to {@code 0}. - * @param newLength The new length. - * @throws IndexOutOfBoundsException If the {@code newLength} argument is negative. - */ - void setLength(int newLength); - - /** - * Sets the new length of the sequence to zero. - * @see #setLength(int) - */ - void clear(); - - /** * The short at the specified index is set to {@code newShort}. * This sequence is altered to represent a new sequence that is identical to the old sequence, except that it * contains the short {@code newShort} at position {@code index}. @@ -60,30 +44,6 @@ void setShortAt(int index, short newShort); /** - * Sorts this sequence into ascending numerical order. - * @see java.util.Arrays#sort(short[]) - */ - void sort(); - - /** - * Returns the current capacity. - * The capacity is the total size, in elements, of the internal buffer. - * Any excess of it over {@link #length()} is available for newly inserted elements. - * Adding elements beyong the capacity will result in an allocation. - * @return The current capacity. - */ - int capacity(); - - /** - * Attempts to reduce storage used for the sequence. - * If the buffer is larger than necessary to hold its current sequence, then it may be resized to become more space - * efficient. - * Calling this method may, but is not required to, affect the value returned by a subsequent call to the - * {@link #capacity()} method. - */ - void trimToSize(); - - /** * Appends the specified item to this sequence. * @param newItem The item to append. * @return A reference to this. @@ -144,13 +104,6 @@ short peek(); /** - * Treating this sequence as a stack, indicates whether there are any items in the stack. - * @return True if and only if there are no items on the stack. - * @see java.util.Stack#empty() - */ - boolean empty(); - - /** * Copies the content of this sequence into an immutable container. * @return A new immutable sequence whose content is identical to that of this. * @see java.lang.CharSequence#toString() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-28 14:51:11
|
Revision: 2846 http://sourceforge.net/p/axsl/code/2846 Author: victormote Date: 2025-05-28 14:51:08 +0000 (Wed, 28 May 2025) Log Message: ----------- Add delete and delete range methods to mutable primitive sequence interfaces. Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/BooleanSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -158,4 +158,26 @@ */ BooleanSequencePlus toImmutable(); + /** + * Removes the {@code boolean} at the specified position in this sequence. + * This sequence is shortened by one {@code boolean}. + * @param index Index of the {@code boolean} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + BooleanSequenceMutable deleteBooleanAt(int index); + + /** + * Removes the booleans in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such boolean exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + BooleanSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -222,4 +222,26 @@ */ ByteSequencePlus toImmutable(); + /** + * Removes the {@code byte} at the specified position in this sequence. + * This sequence is shortened by one {@code byte}. + * @param index Index of the {@code byte} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + ByteSequenceMutable deleteByteAt(int index); + + /** + * Removes the bytes in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such byte exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + ByteSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/CharSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -163,4 +163,26 @@ */ CharSequencePlus toImmutable(); + /** + * Removes the {@code char} at the specified position in this sequence. + * This sequence is shortened by one {@code char}. + * @param index Index of the {@code char} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + CharSequenceMutable deleteCharAt(int index); + + /** + * Removes the chars in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such char exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + CharSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/DoubleSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -157,4 +157,26 @@ */ DoubleSequencePlus toImmutable(); + /** + * Removes the {@code double} at the specified position in this sequence. + * This sequence is shortened by one {@code double}. + * @param index Index of the {@code double} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + DoubleSequenceMutable deleteDoubleAt(int index); + + /** + * Removes the doubles in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such double exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + DoubleSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/FloatSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -157,4 +157,26 @@ */ FloatSequencePlus toImmutable(); + /** + * Removes the {@code float} at the specified position in this sequence. + * This sequence is shortened by one {@code float}. + * @param index Index of the {@code float} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + FloatSequenceMutable deleteFloatAt(int index); + + /** + * Removes the floats in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such float exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + FloatSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/IntSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -181,4 +181,26 @@ */ IntSequencePlus toImmutable(); + /** + * Removes the {@code int} at the specified position in this sequence. + * This sequence is shortened by one {@code int}. + * @param index Index of the {@code int} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + IntSequenceMutable deleteIntAt(int index); + + /** + * Removes the ints in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such int exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + IntSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/LongSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -157,4 +157,26 @@ */ LongSequencePlus toImmutable(); + /** + * Removes the {@code long} at the specified position in this sequence. + * This sequence is shortened by one {@code long}. + * @param index Index of the {@code long} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + LongSequenceMutable deleteLongAt(int index); + + /** + * Removes the longs in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such long exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + LongSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/NibbleSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -157,4 +157,26 @@ */ NibbleSequencePlus toImmutable(); + /** + * Removes the {@code nibble} at the specified position in this sequence. + * This sequence is shortened by one {@code nibble}. + * @param index Index of the {@code nibble} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + NibbleSequenceMutable deleteNibbleAt(int index); + + /** + * Removes the nibbles in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such nibble exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + NibbleSequenceMutable delete(int start, int end); + } Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java 2025-05-27 15:01:50 UTC (rev 2845) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ShortSequenceMutable.java 2025-05-28 14:51:08 UTC (rev 2846) @@ -157,4 +157,26 @@ */ ShortSequencePlus toImmutable(); + /** + * Removes the {@code short} at the specified position in this sequence. + * This sequence is shortened by one {@code short}. + * @param index Index of the {@code short} to remove. + * @return This object. + * @throws IndexOutOfBoundsException If {@code index} is negative or greater than or equal to {@link #length()}. + */ + ShortSequenceMutable deleteShortAt(int index); + + /** + * Removes the shorts in a range of this sequence. + * The range begins at the specified {@code start} and extends to the character at index {@code end - 1} or to the + * end of the sequence if no such short exists. + * If {@code start} is equal to {@code end}, no changes are made. + * @param start The beginning index, inclusive. + * @param end The ending index, exclusive. + * @return This object. + * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than + * {@code end}. + */ + ShortSequenceMutable delete(int start, int end); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-27 15:01:55
|
Revision: 2845 http://sourceforge.net/p/axsl/code/2845 Author: victormote Date: 2025-05-27 15:01:50 +0000 (Tue, 27 May 2025) Log Message: ----------- Doc and formatting changes only. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java 2025-05-27 11:44:43 UTC (rev 2844) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsEncodeFilter.java 2025-05-27 15:01:50 UTC (rev 2845) @@ -27,7 +27,9 @@ import java.io.OutputStream; /** - * A PostScript filter object. + * A PostScript encoding filter object. + * @see "PostScript Language Reference, Third Edition, Section 3.8.4 for discussion of filters." + * @see "PostScript Language Reference, Third Edition, Section 3.13 for discussion of filtered files." */ public abstract class PsEncodeFilter extends FilterOutputStream { @@ -46,10 +48,8 @@ public abstract String getName(); /** - * Return the PostScript name of the filter that should be used to decode - * content encoded by this filter. - * For example, if this filter is "/FlateEncode", this method should - * return "/FlateDecode". + * Return the PostScript name of the filter that should be used to decode content encoded by this filter. + * For example, if this filter is "/FlateEncode", this method should return "/FlateDecode". * @return The name of the decode filter. */ public abstract String getDecodeName(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-27 11:44:46
|
Revision: 2844 http://sourceforge.net/p/axsl/code/2844 Author: victormote Date: 2025-05-27 11:44:43 +0000 (Tue, 27 May 2025) Log Message: ----------- Remove unnecessary "throws" clauses. If the operation is unsupported, implementations should throw an (unchecked) UnsupportedOperationException instead. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-27 11:07:42 UTC (rev 2843) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-27 11:44:43 UTC (rev 2844) @@ -46,27 +46,24 @@ * state of the various data structures. This was specifically designed for parsing Type 1 fonts and extracting * information from them. * @return A read-only system dictionary. - * @throws PsException If this operation is unsupported. */ - PsSystemDict getReadOnlySystemDict() throws PsException; + PsSystemDict getReadOnlySystemDict(); /** * Returns a system dictionary suitable for writing into a PDF stream. * @return A PDF system dictionary. - * @throws PsException If this operation is unsupported. */ - PsSystemDict getPdfSystemDict() throws PsException; + PsSystemDict getPdfSystemDict(); /** * Returns a system dictionary which can draw on a Java2D graphic. * @param graphics The Java2D graphics instance. * @return A Java2D system dictionary. - * @throws PsException If this operation is unsupported. */ - PsSystemDict getJava2dSystemDict(Graphics2D graphics) throws PsException; + PsSystemDict getJava2dSystemDict(Graphics2D graphics); /** - * Returns an interpreter. + * Creates a PostScript interpreter. * @param psInput The input source to be interpreted. * @param systemDict The system dictionary. * @return A new interpreter. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-27 11:07:48
|
Revision: 2843 http://sourceforge.net/p/axsl/code/2843 Author: victormote Date: 2025-05-27 11:07:42 +0000 (Tue, 27 May 2025) Log Message: ----------- Use InputStream instead of File as basis for PsInput. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-26 17:33:37 UTC (rev 2842) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-27 11:07:42 UTC (rev 2843) @@ -24,8 +24,8 @@ package org.axsl.ps; import java.awt.Graphics2D; -import java.io.File; import java.io.IOException; +import java.io.InputStream; /** * Provides PostScript-related services to client applications. @@ -34,11 +34,11 @@ /** * Creates a {@link PsInput} instance from a File. - * @param inputFile The file to be processed as PostScript input. + * @param input The input to be processed as PostScript input. * @return The newly-created PsInput. * @throws IOException For errors opening the file. */ - PsInput createPsInput(File inputFile) throws IOException; + PsInput createPsInput(InputStream input) throws IOException; /** * Returns a read-only system dictionary. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-26 17:33:41
|
Revision: 2842 http://sourceforge.net/p/axsl/code/2842 Author: victormote Date: 2025-05-26 17:33:37 +0000 (Mon, 26 May 2025) Log Message: ----------- Remove methods to obtain filters from the PsServer. These should be obtained some other way. Modified Paths: -------------- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java =================================================================== --- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-26 11:58:06 UTC (rev 2841) +++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsServer.java 2025-05-26 17:33:37 UTC (rev 2842) @@ -26,8 +26,6 @@ import java.awt.Graphics2D; import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; /** * Provides PostScript-related services to client applications. @@ -35,22 +33,6 @@ public interface PsServer { /** - * Creates a decode filter of a specified type. - * @param filterType The type of filter to be created. - * @param inputStream The underlying input stream to be filtered. - * @return The newly-created filter. - */ - InputStream createDecodeFilter(PsFilterType filterType, InputStream inputStream); - - /** - * Creates an encode filter of a specified type. - * @param filterType The type of filter to be created. - * @param outputStream The underlying output stream to be filtered. - * @return The newly-created filter. - */ - PsEncodeFilter createEncodeFilter(PsFilterType filterType, OutputStream outputStream); - - /** * Creates a {@link PsInput} instance from a File. * @param inputFile The file to be processed as PostScript input. * @return The newly-created PsInput. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-26 11:58:09
|
Revision: 2841 http://sourceforge.net/p/axsl/code/2841 Author: victormote Date: 2025-05-26 11:58:06 +0000 (Mon, 26 May 2025) Log Message: ----------- Rename method parameters, for clarity. Modified Paths: -------------- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java =================================================================== --- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java 2025-05-23 16:21:08 UTC (rev 2840) +++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/sequence/ByteSequencePlus.java 2025-05-26 11:58:06 UTC (rev 2841) @@ -200,16 +200,16 @@ * * <p>The returned index is the smallest value <i>k</i> for which: * <blockquote><pre> - * this.startsWith(str, <i>k</i>) + * this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @return The index of the first occurrence of the specified subsequence, or {@code -1} if there is no such * occurrence. * @see java.lang.String#indexOf(java.lang.String) */ - int indexOf(CharSequence str); + int indexOf(CharSequence sequence); /** * Returns the index within this sequence of the first occurrence of the specified subsequence, starting at the @@ -217,17 +217,17 @@ * * <p>The returned index is the smallest value <i>k</i> for which: * <blockquote><pre> - * <i>k</i> >= fromIndex {@code &&} this.startsWith(str, <i>k</i>) + * <i>k</i> >= fromIndex {@code &&} this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @param fromIndex The index from which to start the search. * @return The index of the first occurrence of the specified subsequence, starting at the specified index, or * {@code -1} if there is no such occurrence. * @see java.lang.String#indexOf(java.lang.String, int) */ - int indexOf(CharSequence str, int fromIndex); + int indexOf(CharSequence sequence, int fromIndex); /** * Returns the index within this sequence of the first occurrence of the specified subsequence. @@ -234,16 +234,16 @@ * * <p>The returned index is the smallest value <i>k</i> for which: * <blockquote><pre> - * this.startsWith(str, <i>k</i>) + * this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @return The index of the first occurrence of the specified subsequence, or {@code -1} if there is no such * occurrence. * @see java.lang.String#indexOf(java.lang.String) */ - int indexOf(ByteSequence str); + int indexOf(ByteSequence sequence); /** * Returns the index within this sequence of the first occurrence of the specified subsequence, starting at the @@ -251,17 +251,17 @@ * * <p>The returned index is the smallest value <i>k</i> for which: * <blockquote><pre> - * <i>k</i> >= fromIndex {@code &&} this.startsWith(str, <i>k</i>) + * <i>k</i> >= fromIndex {@code &&} this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @param fromIndex The index from which to start the search. * @return The index of the first occurrence of the specified subsequence, starting at the specified index, or * {@code -1} if there is no such occurrence. * @see java.lang.String#indexOf(java.lang.String, int) */ - int indexOf(ByteSequence str, int fromIndex); + int indexOf(ByteSequence sequence, int fromIndex); /** * Returns the index within this byte sequence of the last occurrence of the specified subsequence. @@ -269,16 +269,16 @@ * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> - * this.startsWith(str, <i>k</i>) + * this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @return The index of the last occurrence of the specified subsequence, or {@code -1} if there is no such * occurrence. * @see java.lang.String#lastIndexOf(java.lang.String) */ - int lastIndexOf(CharSequence str); + int lastIndexOf(CharSequence sequence); /** * Returns the index within this sequence of the last occurrence of the specified subsequence, searching backward @@ -286,17 +286,17 @@ * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> - * <i>k</i> {@code <=} fromIndex {@code &&} this.startsWith(str, <i>k</i>) + * <i>k</i> {@code <=} fromIndex {@code &&} this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @param fromIndex The index to start the search from. * @return The index of the last occurrence of the specified subsequence, searching backward from the specified * index, or {@code -1} if there is no such occurrence. * @see java.lang.String#lastIndexOf(java.lang.String, int) */ - int lastIndexOf(CharSequence str, int fromIndex); + int lastIndexOf(CharSequence sequence, int fromIndex); /** * Returns the index within this byte sequence of the last occurrence of the specified subsequence. @@ -304,16 +304,16 @@ * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> - * this.startsWith(str, <i>k</i>) + * this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @return The index of the last occurrence of the specified subsequence, or {@code -1} if there is no such * occurrence. * @see java.lang.String#lastIndexOf(java.lang.String) */ - int lastIndexOf(ByteSequence str); + int lastIndexOf(ByteSequence sequence); /** * Returns the index within this sequence of the last occurrence of the specified subsequence, searching backward @@ -321,17 +321,17 @@ * * <p>The returned index is the largest value <i>k</i> for which: * <blockquote><pre> - * <i>k</i> {@code <=} fromIndex {@code &&} this.startsWith(str, <i>k</i>) + * <i>k</i> {@code <=} fromIndex {@code &&} this.startsWith(sequence, <i>k</i>) * </pre></blockquote> * If no such value of <i>k</i> exists, then {@code -1} is returned. * - * @param str The subsequence to search for. + * @param sequence The subsequence to search for. * @param fromIndex The index to start the search from. * @return The index of the last occurrence of the specified subsequence, searching backward from the specified * index, or {@code -1} if there is no such occurrence. * @see java.lang.String#lastIndexOf(java.lang.String, int) */ - int lastIndexOf(ByteSequence str, int fromIndex); + int lastIndexOf(ByteSequence sequence, int fromIndex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-23 16:21:11
|
Revision: 2840 http://sourceforge.net/p/axsl/code/2840 Author: victormote Date: 2025-05-23 16:21:08 +0000 (Fri, 23 May 2025) Log Message: ----------- Move Font format from enum to standalone class, so that it is extensible. Modified Paths: -------------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java Added Paths: ----------- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFormat.java Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-05-23 15:38:14 UTC (rev 2839) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2025-05-23 16:21:08 UTC (rev 2840) @@ -51,26 +51,6 @@ /** - * Enumeration of constants to describe the format of a font. - */ - enum Format { - - /** Font-format constant indicating that the font is a Type1 font. */ - TYPE1, - - /** Font-format constant indicating that the font is a TrueType font. */ - TRUETYPE, - - /** Font-format constant indicating that the font is an OpenType font with TrueType outlines. */ - OTF_TRUETYPE, - - /** Font-format constant indicating that the font is an OpenType font with Compact Font Format (CFF) data (no - * TrueType outlines). */ - OTF_CFF; - } - - - /** * Enumeration of possible algorithms that could be used to compute the line-height for a given font. * @see Font#normalLineHeightFactor(Font.LineHeightAlgorithm) for a more complete discussion. */ @@ -439,10 +419,10 @@ Font.Complexity getFontComplexity(); /** - * Returns a value indicating what format (e.g. Type1, TrueType) this font is. - * @return One of {@link Format#TYPE1}, or {@link Format#TRUETYPE}. + * Returns the format of this font. + * @return The format of this font. */ - Font.Format getFontFormat(); + FontFormat getFormat(); /** * Returns the general source of this font. Added: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFormat.java =================================================================== --- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFormat.java (rev 0) +++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFormat.java 2025-05-23 16:21:08 UTC (rev 2840) @@ -0,0 +1,76 @@ +/* + * Copyright 2025 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.font; + +import org.axsl.constants.MimeConstants; + +/** + * Enumeration of font formats. + * The purpose here is to provide basic format information to applications that are clients of the font system, but + * who do not have access to the implementation classes. + * It is structured as a class instead of an enum so that it can easily be be expanded with additional formats as + * needed. + * It notionally ties the font type to a Media Type (MIME type), as being a similar way of expressing the same thing. + * However, the Media Type is deliberately (and rightfully) restrictive, whereas our purpose here is to be expansive. + * Also, in some cases Media Type is not granular enough for the purposes needed here. + * For that reason, any string, or no string, can be used. + */ +public class FontFormat { + + /** A Type1 font.*/ + public static final FontFormat TYPE1 = new FontFormat("font-pseudo/type1"); + + /** A TrueType font. */ + public static final FontFormat TRUETYPE = new FontFormat(MimeConstants.MIME_FONT_TTF); + + /** An OpenType font with TrueType outlines. */ + public static final FontFormat OTF_TRUETYPE = new FontFormat(MimeConstants.MIME_FONT_OTF); + + /** An OpenType font with Compact Font Format (CFF) data (no TrueType outlines). */ + public static final FontFormat OTF_CFF = new FontFormat(MimeConstants.MIME_FONT_OTF); + + + + + + /** The Media Type (or MIME) for this font format. */ + private String mime; + + /** + * Constructor. + * @param mime The Media Type (or MIME) for this font format. + */ + public FontFormat(final String mime) { + this.mime = mime; + } + + /** + * Returns the Media Type (MIME type) for this font format. + * @return The Media Type (MIME type) for this font format. + */ + public String getMime() { + return this.mime; + } + +} Property changes on: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFormat.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java 2025-05-23 15:38:14 UTC (rev 2839) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java 2025-05-23 16:21:08 UTC (rev 2840) @@ -33,7 +33,7 @@ * needed. * It notionally ties the graphic type to a Media Type (MIME type), as being a similar way of expressing the same thing. * However, the Media Type is deliberately (and rightfully) restrictive, whereas our purpose here is to be expansive. - * Also, some cases Media Type is not granular enough for the purposes needed here. + * Also, in some cases Media Type is not granular enough for the purposes needed here. * For that reason, any string, or no string, can be used. */ public class GraphicFormat { @@ -65,6 +65,10 @@ /** Constant indicating a MathML graphic. */ public static final GraphicFormat MATHML = new GraphicFormat(MimeConstants.MIME_MATHML); + + + + /** The Media Type (or MIME) for this graphic format. */ private String mime; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-23 15:38:15
|
Revision: 2839 http://sourceforge.net/p/axsl/code/2839 Author: victormote Date: 2025-05-23 15:38:14 +0000 (Fri, 23 May 2025) Log Message: ----------- Add magic numbers for version number comparison. Modified Paths: -------------- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/NumericConstants.java Modified: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/NumericConstants.java =================================================================== --- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/NumericConstants.java 2025-05-23 12:22:48 UTC (rev 2838) +++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/NumericConstants.java 2025-05-23 15:38:14 UTC (rev 2839) @@ -58,6 +58,45 @@ /** The exponent to use when cubing a value, which is {@value}. */ public static final int CUBED_EXPONENT = 3; + + + + + + /** Magic number indicating version 0 of some format, for example a font or a font table. */ + public static final byte VERSION_0 = 0; + + /** Magic number indicating version 1 of some format, for example a font or a font table. */ + public static final byte VERSION_1 = 1; + + /** Magic number indicating version 2 of some format, for example a font or a font table. */ + public static final byte VERSION_2 = 2; + + /** Magic number indicating version 3 of some format, for example a font or a font table. */ + public static final byte VERSION_3 = 3; + + /** Magic number indicating version 4 of some format, for example a font or a font table. */ + public static final byte VERSION_4 = 4; + + /** Magic number indicating version 5 of some format, for example a font or a font table. */ + public static final byte VERSION_5 = 5; + + /** Magic number indicating version 6 of some format, for example a font or a font table. */ + public static final byte VERSION_6 = 6; + + /** Magic number indicating version 7 of some format, for example a font or a font table. */ + public static final byte VERSION_7 = 7; + + /** Magic number indicating version 8 of some format, for example a font or a font table. */ + public static final byte VERSION_8 = 8; + + /** Magic number indicating version 9 of some format, for example a font or a font table. */ + public static final byte VERSION_9 = 9; + + /** Magic number indicating version 10 of some format, for example a font or a font table. */ + public static final byte VERSION_10 = 10; + + /** * Private constructor. This is a utility class that should never be instantiated. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-23 12:22:52
|
Revision: 2838 http://sourceforge.net/p/axsl/code/2838 Author: victormote Date: 2025-05-23 12:22:48 +0000 (Fri, 23 May 2025) Log Message: ----------- Combine Type enumeration and MIME type into a single extensible class. Modified Paths: -------------- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MimeConstants.java trunk/axsl/axsl-graphic/build.gradle trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java Added Paths: ----------- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java Modified: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MimeConstants.java =================================================================== --- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MimeConstants.java 2025-05-22 21:14:38 UTC (rev 2837) +++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MimeConstants.java 2025-05-23 12:22:48 UTC (rev 2838) @@ -24,10 +24,14 @@ package org.axsl.constants; /** - * Some MIME types needed in publishing applications. + * Some "Media Types" (formerly known as MIME types) used by publishing applications. + * @see <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">IANA Media Types</a> */ public final class MimeConstants { + /* ***** For Document or Application MIME types, see: + * https://www.iana.org/assignments/media-types/media-types.xhtml#application ***** */ + /** The MIME type for PDF. */ public static final String MIME_PDF = "application/pdf"; @@ -37,6 +41,14 @@ /** The (pseudo) MIME type for Java 2D output. */ public static final String MIME_JAVA2D = "java/java2d"; + + + + + + /* ***** For Graphic (Image or Vector) MIME types, see: + * https://www.iana.org/assignments/media-types/media-types.xhtml#image ***** */ + /** The MIME type for SVG. */ public static final String MIME_SVG = "image/svg+xml"; @@ -43,6 +55,54 @@ /** The (assumed) MIME type for MathML documents. */ public static final String MIME_MATHML = "text/mathml"; + /** The MIME type for GIF images. */ + public static final String MIME_GIF = "image/gif"; + + /** The MIME type for PNG images. */ + public static final String MIME_PNG = "image/png"; + + /** The MIME type for JPEG images. */ + public static final String MIME_JPEG = "image/jpeg"; + + /** The MIME type for TIFF images. */ + public static final String MIME_TIFF = "image/tiff"; + + /** The MIME type for BMP images. */ + public static final String MIME_BMP = "image/bmp"; + + /** The MIME type for EPS images (same as for PostScript). */ + public static final String MIME_EPS = MIME_POSTSCRIPT; + + + + + + + /* ***** For Font MIME types, see: https://www.iana.org/assignments/media-types/media-types.xhtml#font ***** */ + + /** The MIME type for a font collection. */ + public static final String MIME_FONT_COLLECTION = "font/collection"; + + /** The MIME type for an OTF font. */ + public static final String MIME_FONT_OTF = "font/otf"; + + /** The MIME type for an SFNT font. */ + public static final String MIME_FONT_SFNT = "font/sfnt"; + + /** The MIME type for a TTF font. */ + public static final String MIME_FONT_TTF = "font/ttf"; + + /** The MIME type for a WOFF font. */ + public static final String MIME_FONT_WOFF = "font/woff"; + + /** The MIME type for a WOFF2 font. */ + public static final String MIME_FONT_WOFF2 = "font/woff2"; + + + + + + /** * Private contructor. This is a utility class that should never be instantiated. */ Modified: trunk/axsl/axsl-graphic/build.gradle =================================================================== --- trunk/axsl/axsl-graphic/build.gradle 2025-05-22 21:14:38 UTC (rev 2837) +++ trunk/axsl/axsl-graphic/build.gradle 2025-05-23 12:22:48 UTC (rev 2838) @@ -8,6 +8,7 @@ implementation (group: 'org.axsl.org.w3c.dom.svg', name: 'svg-dom-java', version: versions.svgDom) implementation (group: 'org.axsl.org.w3c.dom.mathml', name: 'mathml-dom-java', version: versions.mathMlDom) + implementation (project(':axsl-constants')) implementation (project(':axsl-primitive')) implementation (project(':axsl-ps')) implementation (project(':axsl-font')) Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 21:14:38 UTC (rev 2837) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-23 12:22:48 UTC (rev 2838) @@ -40,39 +40,6 @@ public interface Graphic { /** - * Enumeration of graphic formats. - */ - enum Type { - - /** Constant indicating a TIFF image. */ - TIFF, - - /** Constant indicating an SVG graphic. */ - SVG, - - /** Constant indicating a JPEG image. */ - JPEG, - - /** Constant indicating a GIG image. */ - GIF, - - /** Constant indicating an EPS graphic. */ - EPS, - - /** Constant indicating a BMP image. */ - BMP, - - /** Constant indicating a PDF graphic. */ - PDF, - - /** Constant indicating a PNG graphic. */ - PNG, - - /** Constant indicating a MathML graphic. */ - MATHML, - } - - /** * Enumeration of compression schemes used in Graphic files. */ enum Compression { @@ -162,18 +129,12 @@ void close(); /** - * Indicates the type of this graphic. - * @return The type of this graphic, or null if it is not known. + * Indicates the format of this graphic. + * @return The format of this graphic, or null if it is not known. */ - Graphic.Type getGraphicType(); + GraphicFormat getFormat(); /** - * Return corresponding mime type. - * @return image mime type - */ - String getMimeType(); - - /** * Return the name of the Graphic. Some graphic formats include a name as part of their meta information. * @return The name of this graphic, or null if no name is available in the graphic. */ Added: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java (rev 0) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java 2025-05-23 12:22:48 UTC (rev 2838) @@ -0,0 +1,87 @@ +/* + * Copyright 2005 The aXSL Project. + * http://www.axsl.org + * + * 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. + */ + +/* + * $LastChangedRevision$ + * $LastChangedDate$ + * $LastChangedBy$ + */ + +package org.axsl.graphic; + +import org.axsl.constants.MimeConstants; + +/** + * Enumeration of graphic formats. + * The purpose here is to provide basic format information to applications that are clients of the graphic system, but + * who do not have access to the implementation classes. + * It is structured as a class instead of an enum so that it can easily be be expanded with additional formats as + * needed. + * It notionally ties the graphic type to a Media Type (MIME type), as being a similar way of expressing the same thing. + * However, the Media Type is deliberately (and rightfully) restrictive, whereas our purpose here is to be expansive. + * Also, some cases Media Type is not granular enough for the purposes needed here. + * For that reason, any string, or no string, can be used. + */ +public class GraphicFormat { + + /** Constant indicating a TIFF image. */ + public static final GraphicFormat TIFF = new GraphicFormat(MimeConstants.MIME_TIFF); + + /** Constant indicating an SVG graphic. */ + public static final GraphicFormat SVG = new GraphicFormat(MimeConstants.MIME_SVG); + + /** Constant indicating a JPEG image. */ + public static final GraphicFormat JPEG = new GraphicFormat(MimeConstants.MIME_JPEG); + + /** Constant indicating a GIG image. */ + public static final GraphicFormat GIF = new GraphicFormat(MimeConstants.MIME_GIF); + + /** Constant indicating an EPS graphic. */ + public static final GraphicFormat EPS = new GraphicFormat(MimeConstants.MIME_EPS); + + /** Constant indicating a BMP image. */ + public static final GraphicFormat BMP = new GraphicFormat(MimeConstants.MIME_BMP); + + /** Constant indicating a PDF graphic. */ + public static final GraphicFormat PDF = new GraphicFormat(MimeConstants.MIME_PDF); + + /** Constant indicating a PNG graphic. */ + public static final GraphicFormat PNG = new GraphicFormat(MimeConstants.MIME_PNG); + + /** Constant indicating a MathML graphic. */ + public static final GraphicFormat MATHML = new GraphicFormat(MimeConstants.MIME_MATHML); + + /** The Media Type (or MIME) for this graphic format. */ + private String mime; + + /** + * Constructor. + * @param mime The Media Type (or MIME) for this graphic format. + */ + public GraphicFormat(final String mime) { + this.mime = mime; + } + + /** + * Returns the Media Type (MIME type) for this graphic format. + * @return The Media Type (MIME type) for this graphic format. + */ + public String getMime() { + return this.mime; + } + +} Property changes on: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicFormat.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-22 21:14:44
|
Revision: 2837 http://sourceforge.net/p/axsl/code/2837 Author: victormote Date: 2025-05-22 21:14:38 +0000 (Thu, 22 May 2025) Log Message: ----------- Move compression method from Graphic to BitmapGraphic. Modified Paths: -------------- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 16:29:37 UTC (rev 2836) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 21:14:38 UTC (rev 2837) @@ -69,6 +69,12 @@ Color getTransparentColor(); /** + * Indicates the type of compression used in this graphic. + * @return The type of compression used in this graphic, or null if it is not known. + */ + Graphic.Compression getCompressionType(); + + /** * Indicates whether a graphic has its colors inverted. * Some applications, most notably Adobe Photoshop, invert the image colors, and client applications need to know * this in order to be able to render the graphic properly. Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 16:29:37 UTC (rev 2836) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 21:14:38 UTC (rev 2837) @@ -168,12 +168,6 @@ Graphic.Type getGraphicType(); /** - * Indicates the type of compression used in this graphic. - * @return The type of compression used in this graphic, or null if it is not known. - */ - Graphic.Compression getCompressionType(); - - /** * Return corresponding mime type. * @return image mime type */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-22 16:29:39
|
Revision: 2836 http://sourceforge.net/p/axsl/code/2836 Author: victormote Date: 2025-05-22 16:29:37 +0000 (Thu, 22 May 2025) Log Message: ----------- Move a bitmap-only method from Graphic to BitmapGraphic. Modified Paths: -------------- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 16:09:50 UTC (rev 2835) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 16:29:37 UTC (rev 2836) @@ -23,6 +23,8 @@ package org.axsl.graphic; +import org.axsl.primitive.sequence.ByteSequence; + import java.awt.Color; import java.awt.color.ColorSpace; @@ -31,9 +33,18 @@ */ public interface BitmapGraphic extends Graphic { - /* This interface is just a marker at the moment. There are several methods in Graphic that need to be moved to - * this subinterface after the infrastructure is in place to better handle EPS, which is part vector and part - * bitmap. */ + /** + * Return the raw content of the sample portion of the graphic. + * This content may be either compressed or uncompressed. + * This method is provided to avoid unnecessary filtering when that is possible. + * For example, JPEG images are compressed using a DCT filter, so applications that wish to embed the JPEG data + * using a DCT filter can avoid the overhead of having the graphic convert itself to a standard format (see + * {@link #getContent()}, and then needing to recompress it after getting the uncompressed image. + * @return The raw content of the sample portion of the graphic content. + * Graphics that contain only vector data (no image samples) return null. + * @throws GraphicException For errors during parsing of the graphic content. + */ + ByteSequence getRawSamples() throws GraphicException; /** * Return the number of uncompressed bits per component or channel for this graphic. Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 16:09:50 UTC (rev 2835) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 16:29:37 UTC (rev 2836) @@ -139,19 +139,6 @@ ColorSpace getColorSpace(); /** - * Return the raw content of the sample portion of the graphic. - * This content may be either compressed or uncompressed. - * This method is provided to avoid unnecessary filtering when that is possible. - * For example, JPEG images are compressed using a DCT filter, so applications that wish to embed the JPEG data - * using a DCT filter can avoid the overhead of having the graphic convert itself to a standard format (see - * {@link #getContent()}, and then needing to recompress it after getting the uncompressed image. - * @return The raw content of the sample portion of the graphic content. - * Graphics that contain only vector data (no image samples) return null. - * @throws GraphicException For errors during parsing of the graphic content. - */ - ByteSequence getRawSamples() throws GraphicException; - - /** * Return the uncompressed content of the graphic. * This content is provided in a standard image coordinate system and scanning order format that is used by * PostScript and PDF. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-22 16:09:53
|
Revision: 2835 http://sourceforge.net/p/axsl/code/2835 Author: victormote Date: 2025-05-22 16:09:50 +0000 (Thu, 22 May 2025) Log Message: ----------- Move two bitmap-only methods from Graphic to BitmapGraphic. Modified Paths: -------------- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 15:46:08 UTC (rev 2834) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 16:09:50 UTC (rev 2835) @@ -23,6 +23,7 @@ package org.axsl.graphic; +import java.awt.Color; import java.awt.color.ColorSpace; /** @@ -45,6 +46,18 @@ int getBitsPerComponent(); /** + * Indicates whether this image is transparent. + * @return True if and only if the image is transparent. + */ + boolean isTransparent(); + + /** + * Return the transparent color, if any. + * @return The transparent color, or null if the image is not transparent. + */ + Color getTransparentColor(); + + /** * Indicates whether a graphic has its colors inverted. * Some applications, most notably Adobe Photoshop, invert the image colors, and client applications need to know * this in order to be able to render the graphic properly. Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 15:46:08 UTC (rev 2834) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 16:09:50 UTC (rev 2835) @@ -25,7 +25,6 @@ import org.axsl.primitive.sequence.ByteSequence; -import java.awt.Color; import java.awt.color.ColorSpace; import java.net.URL; import java.util.List; @@ -140,18 +139,6 @@ ColorSpace getColorSpace(); /** - * Indicates whether this image is transparent. - * @return True if and only if the image is transparent. - */ - boolean isTransparent(); - - /** - * Return the transparent color, if any. - * @return The transparent color, or null if the image is not transparent. - */ - Color getTransparentColor(); - - /** * Return the raw content of the sample portion of the graphic. * This content may be either compressed or uncompressed. * This method is provided to avoid unnecessary filtering when that is possible. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vic...@us...> - 2025-05-22 15:46:12
|
Revision: 2834 http://sourceforge.net/p/axsl/code/2834 Author: victormote Date: 2025-05-22 15:46:08 +0000 (Thu, 22 May 2025) Log Message: ----------- Move a bitmap-only method from Graphic to BitmapGraphic. Modified Paths: -------------- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 15:19:23 UTC (rev 2833) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/BitmapGraphic.java 2025-05-22 15:46:08 UTC (rev 2834) @@ -23,6 +23,8 @@ package org.axsl.graphic; +import java.awt.color.ColorSpace; + /** * A graphic that is composed of an array of pixels. */ @@ -33,6 +35,16 @@ * bitmap. */ /** + * Return the number of uncompressed bits per component or channel for this graphic. + * For example, a typical opaque RGB image has 3 components, each component using 8 bits to describe its integral + * value from 0 to 255, and this method would return 8. + * The number of components or channels can be obtained by 1) getting the color space {@link #getColorSpace()}, then + * from it getting the number of components {@link ColorSpace#getNumComponents()}. + * @return The number of bits per component. + */ + int getBitsPerComponent(); + + /** * Indicates whether a graphic has its colors inverted. * Some applications, most notably Adobe Photoshop, invert the image colors, and client applications need to know * this in order to be able to render the graphic properly. @@ -40,5 +52,4 @@ */ boolean isInverted(); - } Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java =================================================================== --- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 15:19:23 UTC (rev 2833) +++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/Graphic.java 2025-05-22 15:46:08 UTC (rev 2834) @@ -140,16 +140,6 @@ ColorSpace getColorSpace(); /** - * Return the number of uncompressed bits per component or channel for this graphic. - * For example, a typical opaque RGB image has 3 components, each component using 8 bits to describe its integral - * value from 0 to 255, and this method would return 8. - * The number of components or channels can be obtained by 1) getting the color space {@link #getColorSpace()}, then - * from it getting the number of components {@link ColorSpace#getNumComponents()}. - * @return The number of bits per component. - */ - int getBitsPerComponent(); - - /** * Indicates whether this image is transparent. * @return True if and only if the image is transparent. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |