001: /*
002: * Copyright (C) 2004 NNL Technology AB
003: * Visit www.infonode.net for information about InfoNode(R)
004: * products and how to contact NNL Technology AB.
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
019: * MA 02111-1307, USA.
020: */
021:
022: // $Id: Int4.java,v 1.2 2004/11/05 17:53:08 johan Exp $
023: package net.infonode.util.math;
024:
025: /**
026: * @author $Author: johan $
027: * @version $Revision: 1.2 $
028: */
029: final public class Int4 {
030: private int a;
031: private int b;
032: private int c;
033: private int d;
034:
035: public Int4() {
036: this (0, 0, 0, 0);
037: }
038:
039: public Int4(Int4 i) {
040: this (i.a, i.b, i.c, i.d);
041: }
042:
043: public Int4(int a, int b, int c, int d) {
044: this .a = a;
045: this .b = b;
046: this .c = c;
047: this .d = d;
048: }
049:
050: public int getA() {
051: return a;
052: }
053:
054: public void setA(int a) {
055: this .a = a;
056: }
057:
058: public int getB() {
059: return b;
060: }
061:
062: public void setB(int b) {
063: this .b = b;
064: }
065:
066: public int getC() {
067: return c;
068: }
069:
070: public void setC(int c) {
071: this .c = c;
072: }
073:
074: public int getD() {
075: return d;
076: }
077:
078: public void setD(int d) {
079: this .d = d;
080: }
081:
082: public Int4 set(Int4 i) {
083: a = i.a;
084: b = i.b;
085: c = i.c;
086: d = i.d;
087: return this ;
088: }
089:
090: public Int4 add(Int4 i) {
091: a += i.a;
092: b += i.b;
093: c += i.c;
094: d += i.d;
095: return this ;
096: }
097:
098: public Int4 sub(Int4 i) {
099: a -= i.a;
100: b -= i.b;
101: c -= i.c;
102: d -= i.d;
103: return this ;
104: }
105:
106: public Int4 div(long value) {
107: a /= value;
108: b /= value;
109: c /= value;
110: d /= value;
111: return this ;
112: }
113:
114: public Int4 mul(long value) {
115: a *= value;
116: b *= value;
117: c *= value;
118: d *= value;
119: return this ;
120: }
121:
122: public String toString() {
123: return a + ", " + b + ", " + c + ", " + d;
124: }
125:
126: }
|