<commit_before>

package com.vzome.core.render;

import com.vzome.core.algebra.AlgebraicMatrix;
import com.vzome.core.algebra.AlgebraicNumber;
import com.vzome.core.algebra.AlgebraicVector;
import com.vzome.core.math.Polyhedron;
import com.vzome.core.math.RealVector;
import com.vzome.core.math.symmetry.Direction;
import com.vzome.core.model.Manifestation;

/**
 * @author <NAME>
 *
 */
public class RenderedManifestation
{
    private Manifestation mManifestation;
    
    private Polyhedron mShape;
    
    private String mColorName;
    
    private AlgebraicMatrix mOrientation;
    
    private float mGlow = 0.0f, mTransparency = 0.0f;
    
    private Object mGraphicsObject;
    
    private boolean mPickable = true, mMirrored = false;

    private AlgebraicVector location;

    private int strutZone = -1;

    private AlgebraicNumber strutLength = null;

	private Direction strutOrbit = null;
    
//    private transient Axis mAxis = null;

    public RenderedManifestation( Manifestation m )
    {
        mManifestation = m;
        if ( m != null )
            location = m .getLocation();
//        AlgebraicField factory = (AlgebraicField) m .getLocation() .getFactory();
        mOrientation = null; // factory .identity();
    }

    public void setGraphicsObject( Object go )
    {
        mGraphicsObject = go;
    }
    
    public Object getGraphicsObject()
    {
        return mGraphicsObject;
    }


    public void setGlow( float glow )
    {
        mGlow = glow;
    }


    public float getGlow()
    {
        return mGlow;
    }


    public void setTransparency( float trans )
    {
        mTransparency = trans;
    }


    public float getTransparency()
    {
        return mTransparency;
    }


    /**
     * Shape can be null if the strut length is too short (see resetAttributes),
     * or if the panel has no normal (though the latter should now be an error
     * before we get to this point).
     * @param shape
     */
    public void setShape( Polyhedron shape )
    {
        mShape = shape;
    }
    
    public Polyhedron getShape()
    {
        return mShape;
    }
    
    public void setPickable( boolean value )
    {
        mPickable = value;
    }
    
    public boolean isPickable()
    {
        return mPickable;
    }

    public Manifestation getManifestation()
    {
        return mManifestation;
    }

    public String getColorName()
    {
        return mColorName;
    }

    public void setColorName( String name )
    {
        mColorName = name;
    }
    
    public void setOrientation( AlgebraicMatrix m, boolean mirrored )
    {
        mOrientation = m;
        mMirrored = mirrored;
    }

    public AlgebraicMatrix getOrientation()
    {
        return mOrientation;
    }

    /**
     * @return
     */
    public boolean reverseOrder()
    {
        return mMirrored;
    }
//
//    /**
//     * Useful only for struts.  This is for optimization.
//     * @param axis
//     */
//    public void setAxis( Axis axis )
//    {
//        mAxis = axis;
//    }
//    
//    public Axis getAxis()
//    {
//        return mAxis;
//    }

    public RealVector getLocation()
    {
        if ( location == null )
            return new RealVector( 0d, 0d, 0d );
        else
            return location .toRealVector();
    }

    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((location == null) ? 0 : location.hashCode());
        result = prime * result + (mMirrored ? 1231 : 1237);
        result = prime * result + ((mShape == null) ? 0 : mShape.hashCode());
        result = prime * result + ((mOrientation == null) ? 0 : mOrientation.hashCode());
        return result;
    }

    public boolean equals( Object obj )
    {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( !(obj instanceof RenderedManifestation) )
            return false;
        RenderedManifestation other = (RenderedManifestation) obj;
        if ( ! location .equals( other.location ) )
            return false;
        if ( mMirrored != other.mMirrored )<commit_msg>David's NPE fix to support panels in article mode<commit_after>

package com.vzome.core.render;

import com.vzome.core.algebra.AlgebraicMatrix;
import com.vzome.core.algebra.AlgebraicNumber;
import com.vzome.core.algebra.AlgebraicVector;
import com.vzome.core.math.Polyhedron;
import com.vzome.core.math.RealVector;
import com.vzome.core.math.symmetry.Direction;
import com.vzome.core.model.Manifestation;

/**
 * @author <NAME>
 *
 */
public class RenderedManifestation
{
    private Manifestation mManifestation;
    
    private Polyhedron mShape;
    
    private String mColorName;
    
    private AlgebraicMatrix mOrientation;
    
    private float mGlow = 0.0f, mTransparency = 0.0f;
    
    private Object mGraphicsObject;
    
    private boolean mPickable = true, mMirrored = false;

    private AlgebraicVector location;

    private int strutZone = -1;

    private AlgebraicNumber strutLength = null;

	private Direction strutOrbit = null;
    
//    private transient Axis mAxis = null;

    public RenderedManifestation( Manifestation m )
    {
        mManifestation = m;
        if ( m != null )
            location = m .getLocation();
//        AlgebraicField factory = (AlgebraicField) m .getLocation() .getFactory();
        mOrientation = null; // factory .identity();
    }

    public void setGraphicsObject( Object go )
    {
        mGraphicsObject = go;
    }
    
    public Object getGraphicsObject()
    {
        return mGraphicsObject;
    }


    public void setGlow( float glow )
    {
        mGlow = glow;
    }


    public float getGlow()
    {
        return mGlow;
    }


    public void setTransparency( float trans )
    {
        mTransparency = trans;
    }


    public float getTransparency()
    {
        return mTransparency;
    }


    /**
     * Shape can be null if the strut length is too short (see resetAttributes),
     * or if the panel has no normal (though the latter should now be an error
     * before we get to this point).
     * @param shape
     */
    public void setShape( Polyhedron shape )
    {
        mShape = shape;
    }
    
    public Polyhedron getShape()
    {
        return mShape;
    }
    
    public void setPickable( boolean value )
    {
        mPickable = value;
    }
    
    public boolean isPickable()
    {
        return mPickable;
    }

    public Manifestation getManifestation()
    {
        return mManifestation;
    }

    public String getColorName()
    {
        return mColorName;
    }

    public void setColorName( String name )
    {
        mColorName = name;
    }
    
    public void setOrientation( AlgebraicMatrix m, boolean mirrored )
    {
        mOrientation = m;
        mMirrored = mirrored;
    }

    public AlgebraicMatrix getOrientation()
    {
        return mOrientation;
    }

    /**
     * @return
     */
    public boolean reverseOrder()
    {
        return mMirrored;
    }
//
//    /**
//     * Useful only for struts.  This is for optimization.
//     * @param axis
//     */
//    public void setAxis( Axis axis )
//    {
//        mAxis = axis;
//    }
//    
//    public Axis getAxis()
//    {
//        return mAxis;
//    }

    public RealVector getLocation()
    {
        if ( location == null )
            return new RealVector( 0d, 0d, 0d );
        else
            return location .toRealVector();
    }

    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((location == null) ? 0 : location.hashCode());
        result = prime * result + (mMirrored ? 1231 : 1237);
        result = prime * result + ((mShape == null) ? 0 : mShape.hashCode());
        result = prime * result + ((mOrientation == null) ? 0 : mOrientation.hashCode());
        return result;
    }

    public boolean equals( Object obj )
    {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( !(obj instanceof RenderedManifestation) )
            return false;
        RenderedManifestation other = (RenderedManifestation) obj;
        if ( location == null ) {
            if ( other.location != null )
                return false;
        } else if ( ! location .equals( other.location ) )
            return false;
        if ( mMirrored != other.mMirrored )
{'fraction_non_alphanumeric': 0.09403318818406496, 'fraction_numerical': 0.005178298222902201, 'mean_word_length': 1.9273165690664829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6986432', 'n_tokens_mistral': 2617, 'n_tokens_neox': 2476, 'n_words': 691}