X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Fannotations%2FArgumentImpl.java;h=0a71ab94edf738cf4a850e5a0d2e1cfe81f155c3;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=30d1d08c4a896d448688807e3f899fb57358ce27;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/annotations/ArgumentImpl.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/annotations/ArgumentImpl.java index 30d1d08c4..0a71ab94e 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/annotations/ArgumentImpl.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/annotations/ArgumentImpl.java @@ -1,60 +1,60 @@ -package org.simantics.databoard.annotations; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Array; -import java.util.Arrays; - -public class ArgumentImpl implements Arguments { - - int hash; - Class[] args; - - public ArgumentImpl(Class...args) { - hash = Arrays.hashCode(args); - this.args = args; - } - - - /** - * Drop first arguments from an argument list. - * If all were dropped, null is returned. - * - * @param src source argument or null - * @param count argument count - * @return Argument or null. - */ - public static Arguments dropArguments(Arguments src, int count) { - if (src==null) return null; - int newLen = src.value().length - count; - if (newLen<=0) return null; - Class[] newList = (Class[]) Array.newInstance(Class.class, newLen); - System.arraycopy(src.value(), count, newList, 0, newLen); - return new ArgumentImpl(newList); - } - - @Override - public Class annotationType() { - return Arguments.class; - } - - @Override - public Class[] value() { - return args; - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public boolean equals(Object obj) { - if ( obj instanceof Arguments == false ) return false; - Arguments other = (Arguments) obj; - Class[] classArray1 = args; - Class[] classArray2 = other.value(); - - return Arrays.deepEquals(classArray1, classArray2); - } - -} +package org.simantics.databoard.annotations; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Array; +import java.util.Arrays; + +public class ArgumentImpl implements Arguments { + + int hash; + Class[] args; + + public ArgumentImpl(Class...args) { + hash = Arrays.hashCode(args); + this.args = args; + } + + + /** + * Drop first arguments from an argument list. + * If all were dropped, null is returned. + * + * @param src source argument or null + * @param count argument count + * @return Argument or null. + */ + public static Arguments dropArguments(Arguments src, int count) { + if (src==null) return null; + int newLen = src.value().length - count; + if (newLen<=0) return null; + Class[] newList = (Class[]) Array.newInstance(Class.class, newLen); + System.arraycopy(src.value(), count, newList, 0, newLen); + return new ArgumentImpl(newList); + } + + @Override + public Class annotationType() { + return Arguments.class; + } + + @Override + public Class[] value() { + return args; + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public boolean equals(Object obj) { + if ( obj instanceof Arguments == false ) return false; + Arguments other = (Arguments) obj; + Class[] classArray1 = args; + Class[] classArray2 = other.value(); + + return Arrays.deepEquals(classArray1, classArray2); + } + +}