home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_91ef8f0755f6da90634efc842e322a45
< prev
next >
Wrap
Text File
|
2000-03-23
|
5KB
|
166 lines
<HTML>
<HEAD>
<TITLE>Set::Scalar::Base - base class for Set::Scalar</TITLE>
<LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> Set::Scalar::Base - base class for Set::Scalar</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<UL>
<LI><A HREF="#creating">Creating</A></LI>
<LI><A HREF="#modifying">Modifying</A></LI>
<LI><A HREF="#displaying">Displaying</A></LI>
<LI><A HREF="#querying">Querying</A></LI>
<LI><A HREF="#deriving">Deriving</A></LI>
<LI><A HREF="#comparing">Comparing</A></LI>
</UL>
<LI><A HREF="#author">AUTHOR</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="name">NAME</A></H1>
<P>Set::Scalar::Base - base class for Set::Scalar</P>
<P>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
use Set::Scalar;
$s = Set::Scalar->new;
$s->insert('a', 'b');
$s->delete('b');
$t = Set::Scalar->new('x', 'y', $z);</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>
<H2><A NAME="creating">Creating</A></H2>
<PRE>
$s = Set::Scalar->new;
$s = Set::Scalar->new(@members);</PRE>
<PRE>
$t = $s->clone;</PRE>
<P>
<H2><A NAME="modifying">Modifying</A></H2>
<PRE>
$s->insert(@members);
$s->delete(@members);
$s->invert(@members); # insert if hasn't, delete if has</PRE>
<P>
<H2><A NAME="displaying">Displaying</A></H2>
<PRE>
print $s, "\n";</PRE>
<P>The display format of a set is the members of the set separated by
spaces and enclosed in parentheses ().</P>
<P>You can even display recursive sets.</P>
<P>
<H2><A NAME="querying">Querying</A></H2>
<PRE>
@members = $s->members;
@elements = $s->elements; # alias for members</PRE>
<PRE>
$size = $s->size;</PRE>
<PRE>
if ($s->member($member)) { ...</PRE>
<PRE>
$s->element # alias for member
$s->has # alias for member
$s->contains # alias for member</PRE>
<PRE>
$s->is_null
$s->is_universal</PRE>
<PRE>
$s->null # the null set
$s->universe # the universe of the set</PRE>
<P>
<H2><A NAME="deriving">Deriving</A></H2>
<PRE>
$u = $s->union($t);
$i = $s->intersection($t);
$d = $s->difference($t);
$e = $s->symmetric_difference($t);
$v = $s->unique($t);
$c = $s->complement;</PRE>
<P>These methods have operator overloads:</P>
<PRE>
$u = $s + $t; # union
$i = $s * $t; # intersection
$d = $s - $t; # difference
$e = $s % $t; # symmetric_difference
$v = $s / $t; # unique
$c = -$s; # complement</PRE>
<P>
<H2><A NAME="comparing">Comparing</A></H2>
<PRE>
$eq = $s->is_equal($t);
$dj = $s->is_disjoint($t);
$pi = $s->is_properly_intersecting($t);
$ps = $s->is_proper_subset($t);
$pS = $s->is_proper_superset($t);
$is = $s->is_subset($t);
$iS = $s->is_superset($t);</PRE>
<PRE>
$cmp = $s->compare($t);</PRE>
<P>The <CODE>compare</CODE> method returns a string from the following list:
``equal'', ``disjoint'', ``proper subset'', ``proper superset'', ``proper
intersect'', and ``disjoint universes'', if you try to compare sets of
different universes, and ``different'', if you try to compare sets and
non-sets (that are not equal in their string form).</P>
<PRE>
$ueq = $s->have_same_universe($t);</PRE>
<P>Note: currently it is <EM>possible</EM> but <STRONG>unsupported</STRONG> to have several
simultaneous universes for the sets. Do not go there, even if you
read the universe.t and <STRONG>think</STRONG> you understand. The interface
is not public and going to change.</P>
<P>These methods have operator overloads:</P>
<PRE>
$eq = $s == $t; # is_equal
$dj = $s != $t; # is_disjoint
# No operator overload for is_properly_intersecting.
$ps = $s < $t; # is_proper_subset
$pS = $s > $t; # is_proper_superset
$is = $s <= $t; # is_subset
$iS = $s >= $t; # is_superset</PRE>
<PRE>
$cmp = $s <=> $t;</PRE>
<P>
<HR>
<H1><A NAME="author">AUTHOR</A></H1>
<P>Jarkko Hietaniemi <<A HREF="mailto:jhi@iki.fi">jhi@iki.fi</A>></P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> Set::Scalar::Base - base class for Set::Scalar</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>