Nice/src/mlsub/typing Enumeration.java,1.18,1.19

Daniel Bonniot <[email protected]> Thu, 26 May 2005 12:25:49 +0000
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/src/mlsub/typing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3014/src/mlsub/typing

Modified Files:
	Enumeration.java 
Log Message:
Whitespace cleanup.


Index: Enumeration.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Enumeration.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Enumeration.java	4 Jan 2005 21:20:21 -0000	1.18
--- Enumeration.java	26 May 2005 12:25:46 -0000	1.19
***************
*** 44,51 ****
  
      Monotype[] tags = null;
!     
      if (domain.getMonotype().equivalent() instanceof TupleType)
        tags = ((TupleType) domain.getMonotype().equivalent()).types;
!     
      if (tags == null)
        throw new InternalError("enumerate should be done on a tuple domain");
--- 44,51 ----
  
      Monotype[] tags = null;
! 
      if (domain.getMonotype().equivalent() instanceof TupleType)
        tags = ((TupleType) domain.getMonotype().equivalent()).types;
! 
      if (tags == null)
        throw new InternalError("enumerate should be done on a tuple domain");
***************
*** 79,83 ****
     * Enumerate all the tuples of tags in a Domain
     *
!    * If all[i] is false, we are not interested in getting all solutions 
     * for position i, only one witness is enough.
     *
--- 79,83 ----
     * Enumerate all the tuples of tags in a Domain
     *
!    * If all[i] is false, we are not interested in getting all solutions
     * for position i, only one witness is enough.
     *
***************
*** 114,132 ****
      return res;
    }
!   
!   /** Try all combinations of Kinds for free type variables. 
        There are two stages:
        If doAll is true, set the tags for which all solutions must be listed.
        Otherwise, set the other tags, and stop as soon as one solution is found.
     */
!   private static final void setFloatingKinds(Element[] tags, 
  					     boolean[] all,
! 					     int minFloating, 
  					     List res,
! 					     boolean doAll) 
      throws Unsatisfiable
    {
!     while(minFloating<tags.length 
! 	  && (all[minFloating] != doAll || 
                isFixedKind(tags[minFloating].getKind())))
        minFloating++;
--- 114,132 ----
      return res;
    }
! 
!   /** Try all combinations of Kinds for free type variables.
        There are two stages:
        If doAll is true, set the tags for which all solutions must be listed.
        Otherwise, set the other tags, and stop as soon as one solution is found.
     */
!   private static final void setFloatingKinds(Element[] tags,
  					     boolean[] all,
! 					     int minFloating,
  					     List res,
! 					     boolean doAll)
      throws Unsatisfiable
    {
!     while(minFloating<tags.length
! 	  && (all[minFloating] != doAll ||
                isFixedKind(tags[minFloating].getKind())))
        minFloating++;
***************
*** 135,139 ****
        {
          Element tag = tags[minFloating];
!         
          if (tag.getKind() == TopMonotype.TopKind.instance)
            {
--- 135,139 ----
        {
          Element tag = tags[minFloating];
! 
          if (tag.getKind() == TopMonotype.TopKind.instance)
            {
***************
*** 143,147 ****
          else
            {
!             // There might be a garbagy Engine.variablesConstraint 
              // in the monotype variable variable
              tag.setKind(null);
--- 143,147 ----
          else
            {
!             // There might be a garbagy Engine.variablesConstraint
              // in the monotype variable variable
              tag.setKind(null);
***************
*** 151,156 ****
  	  {
  	    Engine.Constraint c = (Engine.Constraint) cs.next();
! 	    
! 	    if (c.hasConstants() && 
  		c != nice.tools.typing.PrimitiveType.nullTC.getKind())
  	      {
--- 151,156 ----
  	  {
  	    Engine.Constraint c = (Engine.Constraint) cs.next();
! 
! 	    if (c.hasConstants() &&
  		c != nice.tools.typing.PrimitiveType.nullTC.getKind())
  	      {
***************
*** 182,186 ****
  	List solutions = enumerateTags(tags, all);
  	res.addAll(solutions);
! 	if (solutions.size() > 0) 
  	  /*
  	     We found solutions for the current choice of kinds for tags.
--- 182,186 ----
  	List solutions = enumerateTags(tags, all);
  	res.addAll(solutions);
! 	if (solutions.size() > 0)
  	  /*
  	     We found solutions for the current choice of kinds for tags.
***************
*** 205,209 ****
    {
      TagsList tuples = new TagsList(tags.length);
!     List kinds = new ArrayList(tags.length); /* euristic: 
  						at most one kind per tag */
      List observers = new ArrayList(tags.length); // idem
--- 205,209 ----
    {
      TagsList tuples = new TagsList(tags.length);
!     List kinds = new ArrayList(tags.length); /* euristic:
  						at most one kind per tag */
      List observers = new ArrayList(tags.length); // idem
***************
*** 214,223 ****
      Engine.enter(false);
      try{
!       
        for(int i = 0;i<tags.length;i++)
  	{
  	  Engine.Constraint k = Engine.getConstraint(tags[i].getKind());
  	  BitVector obs;
! 	  
  	  int idx = kinds.indexOf(k);
  	  if(idx<0)
--- 214,223 ----
      Engine.enter(false);
      try{
! 
        for(int i = 0;i<tags.length;i++)
  	{
  	  Engine.Constraint k = Engine.getConstraint(tags[i].getKind());
  	  BitVector obs;
! 
  	  int idx = kinds.indexOf(k);
  	  if(idx<0)
***************
*** 228,232 ****
  	  else
  	    obs = (BitVector) observers.get(idx);
! 	  
  	  // ignore non matchable kinds
  	  // XXX move up ?
--- 228,232 ----
  	  else
  	    obs = (BitVector) observers.get(idx);
! 
  	  // ignore non matchable kinds
  	  // XXX move up ?
***************
*** 240,248 ****
  	  else
  	    constTC = ((Monotype) tags[i]).head();
! 	  
  	  if(constTC == null)
  	    throw new InternalError
  	      (tags[i].getKind() + " is not a valid kind in enumerate");
! 	
  	  TypeConstructor varTC = new TypeConstructor(constTC.variance);
  	  vars[i] = varTC;
--- 240,248 ----
  	  else
  	    constTC = ((Monotype) tags[i]).head();
! 
  	  if(constTC == null)
  	    throw new InternalError
  	      (tags[i].getKind() + " is not a valid kind in enumerate");
! 
  	  TypeConstructor varTC = new TypeConstructor(constTC.variance);
  	  vars[i] = varTC;
***************
*** 262,270 ****
  	  }
  	}
!     
        Engine.Constraint[] pKinds = (Engine.Constraint[])
  	kinds.toArray(new Engine.Constraint[kinds.size()]);
!       
!       BitVector[] pObs = (BitVector[]) 
  	observers.toArray(new BitVector[observers.size()]);
  
--- 262,270 ----
  	  }
  	}
! 
        Engine.Constraint[] pKinds = (Engine.Constraint[])
  	kinds.toArray(new Engine.Constraint[kinds.size()]);
! 
!       BitVector[] pObs = (BitVector[])
  	observers.toArray(new BitVector[observers.size()]);
  
***************
*** 275,279 ****
        Engine.backtrack(false, false);
      }
!     
      return tuples.tags;
    }
--- 275,279 ----
        Engine.backtrack(false, false);
      }
! 
      return tuples.tags;
    }
***************
*** 293,300 ****
        {
  	tuples.startAddition();
! 	
  	final BitVector obs = observers[act];
  	final mlsub.typing.lowlevel.Engine.Constraint kind = kinds[act];
! 	
  	kind.enumerate
  	  (obs,
--- 293,300 ----
        {
  	tuples.startAddition();
! 
  	final BitVector obs = observers[act];
  	final mlsub.typing.lowlevel.Engine.Constraint kind = kinds[act];
! 
  	kind.enumerate
  	  (obs,
***************
*** 309,313 ****
                         /* If this index does not need all solutions
                            (i.e. all[index] is false), and the solution
!                           sol does not pass checkClassConstraint, 
                            it might have been that some other solution, which
                            we don't generate, would pass. So in this case
--- 309,313 ----
                         /* If this index does not need all solutions
                            (i.e. all[index] is false), and the solution
!                           sol does not pass checkClassConstraint,
                            it might have been that some other solution, which
                            we don't generate, would pass. So in this case
***************
*** 319,323 ****
                         var = vars[index];
  
!                        // We only deal with matchable tags, 
                         // and those that belong to this kind.
                         if (var == null || var.getKind() != kind)
--- 319,323 ----
                         var = vars[index];
  
!                        // We only deal with matchable tags,
                         // and those that belong to this kind.
                         if (var == null || var.getKind() != kind)
***************
*** 337,346 ****
  		       var = vars[index];
  
!                        // We only deal with matchable tags, 
                         // and those that belong to this kind.
                         if (var == null || var.getKind() != kind)
                           continue;
  
! 		       solution = (TypeConstructor) 
                           kind.getElement(getSolutionOf(var.getId()));
  		       tuples.set(index, solution);
--- 337,346 ----
  		       var = vars[index];
  
!                        // We only deal with matchable tags,
                         // and those that belong to this kind.
                         if (var == null || var.getKind() != kind)
                           continue;
  
! 		       solution = (TypeConstructor)
                           kind.getElement(getSolutionOf(var.getId()));
  		       tuples.set(index, solution);
***************
*** 360,368 ****
  
    /**
!      Return true if and only if sol can be the runtime tag of a 
       subtype of var. This especially involves checking the eventual
       constraints on the type parameters of the class sol.
    */
!   private static boolean checkClassConstraint(Element var, 
                                                TypeConstructor sol)
    {
--- 360,368 ----
  
    /**
!      Return true if and only if sol can be the runtime tag of a
       subtype of var. This especially involves checking the eventual
       constraints on the type parameters of the class sol.
    */
!   private static boolean checkClassConstraint(Element var,
                                                TypeConstructor sol)
    {
***************
*** 406,410 ****
    }
  
!   /** 
        A list of possible values for tags.
  
--- 406,410 ----
    }
  
!   /**
        A list of possible values for tags.
  
***************
*** 413,421 ****
  
        TagsList tags = new TagsList(width);
!       for (...) 
        {
          ...
          tags.startAddition();
! 	for (each possibility for the tags in the group) 
  	{
  	  tags.startEntry();
--- 413,421 ----
  
        TagsList tags = new TagsList(width);
!       for (...)
        {
          ...
          tags.startAddition();
! 	for (each possibility for the tags in the group)
  	{
  	  tags.startEntry();
***************
*** 448,452 ****
      boolean endAddition()
      {
!       return first; 
      }
  
--- 448,452 ----
      boolean endAddition()
      {
!       return first;
      }
  
***************
*** 464,468 ****
  	}
        else
! 	// copy the first elements at the end, 
  	// so that they can be overwritten with the new values
  	for(int i = 0; i < size; i++)
--- 464,468 ----
  	}
        else
! 	// copy the first elements at the end,
  	// so that they can be overwritten with the new values
  	for(int i = 0; i < size; i++)



-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click