############################################################################# ## ## This file is part of GAP, a system for computational discrete algebra. ## This file's authors include Martin Schönert. ## ## Copyright of GAP belongs to its developers, whose names are too numerous ## to list here. Please refer to the COPYRIGHT file for details. ## ## SPDX-License-Identifier: GPL-2.0-or-later ## ## This file contains some methods applicable to objects in general. ##
############################################################################# ## #M '<obj1> = <obj2>' . . . . . . . . . . . for objects in different families ##
##### This file contains some methods applicable to objects in general. "for two java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 2
IsNotIdenticalObj,
[ IsObject,
IsObject ], 0,
false );
############################################################################# ## #M \=( <fam1>, <fam2> ) . . . . . . . . . . . . . . . . . for two families ##
InstallMethod( \=,
## next are cyclotomics (see <Ref Filt="IsCyclotomic"/>),## finite field elements in different characteristics are compared
true## (see <Ref Filt="IsBool"/>),
[ ## and lists (see ## note that two lists can be compared with <C><</C> if and only if their
## The reason for this## would be hard to maintain when new kinds of objects are introduced,
############################################################################# ## #M \<( <obj1>, <obj2> ) . . . . . . . for two objects in different families ## ## <#GAPDoc Label="[1]{object.gi}"> ## Only for the following kinds of objects, an ordering via <C><</C> of objects ## in <E>different</E> families (see <Ref Sect="Families"/>) is supported. ## Rationals (see <Ref Filt="IsRat"/>) are smallest, ## next are cyclotomics (see <Ref Filt="IsCyclotomic"/>), ## followed by finite field elements (see <Ref Filt="IsFFE"/>); ## finite field elements in different characteristics are compared ## via their characteristics, ## next are permutations (see <Ref Filt="IsPerm"/>), ## followed by the boolean values <K>true</K>, <K>false</K>, and <K>fail</K> ## (see <Ref Filt="IsBool"/>), ## characters (such as <C>{</C>}a{'}', see <Ref Filt="IsChar"/>), ## and lists (see <Ref Filt="IsList"/>) are largest; ## note that two lists can be compared with <C><</C> if and only if their ## elements are again objects that can be compared with <C><</C>. ## <P/> ## For other objects, &GAP; does <E>not</E> provide an ordering via <C><</C>. ## The reason for this is that a total ordering of all &GAP; objects ## would be hard to maintain when new kinds of objects are introduced, ## and such a total ordering is hardly used in its full generality. ## <P/> ## However, for objects in the filters listed above, the ordering via <C><</C> ## has turned out to be useful. ## For example, one can form <E>sorted lists</E> containing integers and nested ## lists of integers, and then search in them using <C>PositionSorted</C> ## (see <Ref Sect="Finding Positions in Lists"/>). ## <P/> ## Of course it would in principle be possible to define an ordering ## via <C><</C> also for certain other objects, ## by installing appropriate methods for the operation <C>\<</C>. ## But this may lead to problems at least as soon as one loads &GAP; code ## in which the same is done, under the assumption that one is completely ## free to define an ordering via <C><</C> for other objects than the ones ## for which the <Q>official</Q> &GAP; provides already an ordering via <C><</C>. ## <#/GAPDoc> ## function()
,, ,infostr;
TO_COMPARE := [
[ if i<j func: ReturnTrue;elsefunc= ReturnFalse fi;
[ IsFFE, "finite field element" ],
[ IsPerm, "permutation" ],
[ IsBool, "boolean" ],
[ IsChar ( java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 56
;
in 1. Length TO_COMPARE )]do forIsNotIdenticalObj, if i <> j then if i < j then func
infostr: "fora"
( z1 ) <Characteristic(z2);
APPEND_LIST_INTR infostr,TO_COMPARE[j]2 ;
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 43
[[]1] j[1 ,0 func ) fi;
od;
; endBIND_GLOBAL("LT_LIST_LIST_FINITE", function( list1, list2 )
InstallMethod( \<, "for two finite field elements in different java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0
IsNotIdenticalObj,
[ IsFFE # directly in the next call if possible.if ( and IsSmallList()then function(
( z1 (z2 ; end );
InstallMethod( \<, "for two small lists, possibly :1;
true, if list1[ i then
)
false
local len, i fi
# We ask for being small in order to catch the default methodslen ( ; # directly in the next call if possible.InstallMethod( <
list1 )IsSmallList )then
return java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 9 else
len:= Minimum( java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
i:= 1; while i <=InstallMethod(, [IsObject] o>"<>"; if list1[i] < java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
return true; ##
return false; fi;
i:= i+1;
od;
return [] (o)P()end ;
# this command is useful to construct strings made of objects. It calls # PrintString to its arguments and concatenates them. It is used in the # library, but is not meant to be documented. (LB) #
BIND_GLOBAL("STRINGIFY", function (\";
local s,ijava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
s := ShallowCopy(String(arg## for i in [2..Length(arg)] do
Append(,(arg[i]);
od function(st)
return s; end);
BIND_GLOBAL("PRINT_STRINGIFY", function(arg)
local s, i;
: ShallowCopyPrintString[1]; for i in [2..Length(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 18
Append(s,"\>");
Append(s ;
<")
od;
return)java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 end);
############################################################################# ## #F StripLineBreakCharacters( <string> ) . . . removes \< and \> characters ##
InstallGlobalFunction( StripLineBreakCharacters, function(st)
"forfor object,and apositiveinteger,
= EmptyStringLength(); for IsObjectjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 if c
Addjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 fi; if Length(str )>=n then
ShrinkAllocationString(res);
return res; end);
############################################################################# ## #M PrintString( <obj>, <width> ) . . . . . convert object into a string ##
InstallMethod( PrintString =" java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 "foran a java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 44
truejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
[ str :=Concatenation(blanks{[1. fill]} str )java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
IsPosInt ] 0,
function( str, n od;
local blanks, fill;
str:= java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 15
# If <width> is too small, return. if Length( str ) >= n then
return ShallowCopy(str); fi;
# If <width> is positive, blanks are filled in from the left.
blanks := " ";
fill = ; while fill > 0do 0
=(, ; else
str :=
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fill := n Length)>=-then
od;
;
)
InstallMethod( PrintString,
f ,
true,
[,
IsNegRat : ( java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 48 0,
function , n )
local blanks, fill;
str:= PrintString( str );
return str; if Length( str ) >= -n then
eturnShallowCopy()java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 fijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
# If <width> is negative, blanks are filled in from the right. 0,
fill ,) 0 if fill ;
str := Concatenation( str, blanks ); else
str #M String( <obj>, <width> ) . . . . . convert object into a string fi;
fill := - n - Length( str );
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 17
end# If <width> is too small, return.
InstallMethod( PrintString,
ShallowCopyjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
true,
[IsObject,
IsZeroCyc ], 0,
function( str, zero )
return (str ) end ) fill 0do
############################################################################# ## #M String( <obj>, <width> ) . . . . . convert object into a string ##
InstallMethod( "for an object, fill := n - Length ;
true,
[ IsObject,
java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 6 0java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
n)
java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 0
str:= blanks,fill;
# If <width> is too small, return. if Length( str ) >=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return ShallowCopystr) fi;
# If <width> is positive, blanks are filled in from the left.
blanks ;
# If>isnegative java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 while fill > 0do if fill >= Length >0
:( java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 48
else
java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 65 fi
filljava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
od;(java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 endjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
InstallMethod( String, "java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 ##
, 0,
function java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 25
# If <width> is too small, return. if ]
ShallowCopy() fi;
dth is negative,blanks are filled in from the right.
blanks :#############################################################################
fill := - n - Length( str );
hile fill 0 java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22 if fill >= Length( blanks ) then
str := java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 2 else
str := Concatenation( str, blanks{ [ 1 .. fill ] } ); fi;
fill : -n- Length( str );
od;
return str; end );
( , "for an object, and zero",
true ;
[,
IsZeroCyc ],
not(,)
function java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
return java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 10 end );
############################################################################# ## #M PrintObj( <obj> ) ##
InstallMethod( Name ; "for an object java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
true,
[ java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 2
SUM_FLAGS, , 1# this has to beat the legacy method function ( obj ) Print()
############################################################################# ## #M ViewObj( <obj> ) . . . . . . . . . . . . . . . . for an object with name ##
InstallMethod( ViewObj, "for an object with name",
true,
[ HasName##
SUM_FLAGS,# override anything specific
()Print ; ;
############################################################################# ## #V DEFAULTVIEWSTRING . . . . . . . . . default string returned by ViewString ##
if ()then
############################################################################# ## #M ViewObj( <obj> ) . . . . . try view string before delegating to PrintObj ##
InstallMethod(#############################################################################
#M IsInternallyConsistent( <obj> ) . . . . . . . default##
true,
[ IsObject ], 1, # beat the PrintObj installation in oper1.g function ( obj ) "default '',
local st;
st := , ifnot(())then
Print(st); else
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0 fi## end );
############################################################################# ## #M ViewString( <obj> ) . . . . . . . . . . . . . . . for an object with name ##
InstallMethod( ViewString, "for an object true,
[ java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 6
Name )
############################################################################# ## #M ViewString( <obj> ) . . . . . . . . . . . . . . . . . . . default method ##
InstallMethod(ViewString generic " ,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 # in the resclasses package function(obj)
return DEFAULTVIEWSTRING;
od
############################################################################# ## #M ShallowCopy( <obj> ) . . . . . . . . . . . . . . . shallow copy of <obj> ##
InstallMethod( ShallowCopy, "#M KnownPropertiesOfObject( <object> ) . . . . . list of names of properties
true,
[IsObject ] 0"or an "
function obj ) if IsCopyable(obj) then
TryNextMethod(); else
return obj;
; end );
############################################################################# ## #M KnownAttributesOfObject( <object> ) . . . . . list of names of attributes ##
InstallMethod "for an object",
,
[ IsObject ], 0,
function( obj )
local type, trues;
# get the flags list
type := TypeObj(obj);
trues := TRUES_FLAGS(type![2]);
# filter the representations
atomic readonly FILTER_REGION do
trues := Filtered( trues, x -> #M KnownTruePropertiesOfObject( <object> ) list of names of true properties
od;
# convert it into names, removing the "Has" prefix"
return List(NamesFilter(rues) x - x{[.Length)}) end );
############################################################################# ## #M KnownPropertiesOfObject( <object> ) . . . . . list of names of properties ##
InstallMethod( KnownPropertiesOfObject, "or an object"
true,
[ IsObject ], 0,
function( obj )
local type, trues;
# get the flags list
type := TypeObj(obj);
trues :=trues :=TRUES_FLAGStype!2]);
# filter the representations
atomic readonlyatomicreadonly FILTER_REGION
trues := trues := Filtered, x- INFO_FILTERS[x] in FNUM_PROS );
od;
# convert it into names, removing the "Has" prefix"
return List( NamesFilter(trues), x -> x{[4..Length(x)]} ); end );
############################################################################# ## #M KnownPropertiesOfObject( <object> ) . . . . . list of names of properties #M KnownTruePropertiesOfObject( <object> ) list of names of true properties ##
InstallMethod( KnownTruePropertiesOfObject, "for an object",od;
true # convert it into names
[ ]java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 0,
#M CategoriesOfObject( <object> ) . . . . . . . list of names of categories
local type, trues;
# get the flags list
type := TypeObj(obj##
trues =TRUES_FLAGStype!2];
# filter the representations
true,
]
od;
# convert it into names
return NamesFilter(trues); end );
############################################################################# ## #M CategoriesOfObject( <object> ) . . . . . . . list of names of categories ##
InstallMethod( : TRUES_FLAGS(ype!2])
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
true,
[ IsObject ], 0,
function( obj )
local type, trues;
# get the flags list
type ()
trues
# filter the representations
atomic readonly FILTER_REGION do
trues :=#############################################################################
##
# convert it into names
## end)
############################################################################# ## #M RepresentationsOfObject( <object> ) . . list of names of representations ##
InstallMethod( RepresentationsOfObject: (; "for an object",
true,
[IsObject , 0,
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
local , ;
# get the flags list
= TypeObjobj)
java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 7
# filter the representations
atomic readonly FILTER_REGION java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 6
trues := Filtered( trues, x ##
od;
# convert it into names
return trues) end );
############################################################################# ## #V DEFAULTDISPLAYSTRING . . . . . . default string returned by DisplayString ##
BIND_GLOBAL(## We do not call `PrintObj' because strings shall be displayed without
############################################################################# ## #M Display( <obj> ) . . . . . . . . . . . . . . . . . . . display an object ## ## We do not call `PrintObj' because strings shall be displayed without ## enclosing doublequotes. ## function( java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 "generic: use if (,DEFAULTDISPLAYSTRING)then
true,
[IsObject] 0, functionPrintst)
local st;
fi
IsIdenticalObj(t,EFAULTDISPLAYSTRING)then
else ############################################################################# fi; end );
############################################################################# ## #M DisplayString( <obj> ) . . . . . . . . . . display string for an object ## ## We do not call `PrintObj' because strings shall be displayed without ## enclosing doublequotes. ##
true
,-,
(obj java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
[ java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0 function( obj )
return DEFAULTDISPLAYSTRING; end );
InstallMethod( PostMakeImmutable, "unless,
true,
[IsObject], 0, function( obj)
end ); end );
############################################################################# ## #M SetName( <obj>,<name> ) ## ## generic routine to test 2nd argument ##
InstallMethod(InstallMethod "eneric test routine" true,[IsObject,sObject ] # override setter
, function( obj,str ) if not IsString(str)(objstr java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
Error(":<ame> be a string"; fi;
TryNextMethod(); end)
############################################################################# ## #V TYPE_KERNEL_OBJECT ## ## ## ## TYPE_KERNEL_OBJECT is the type of data objects used internally in the ## kernel which have no significant &GAP; callable methods and should not ## normally be seen at &GAP; level. These are typically lookup tables or ## buffers created and used within the kernel and containing binary data only ##
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.9Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.