### Question:
ImmutableNodeInst extends ImmutableElectricObject { public ImmutableNodeInst withFlag(Flag flag, boolean value) { return withFlags(flag.set(this.flags, value)); } ImmutableNodeInst(int nodeId, NodeProtoId protoId, Name name, TextDescriptor nameDescriptor,
            Orientation orient, EPoint anchor, EPoint size,
            int flags, byte techBits, TextDescriptor protoDescriptor, Variable[] vars, ImmutablePortInst[] ports); static ImmutableNodeInst newInstance(int nodeId, NodeProtoId protoId, Name name, TextDescriptor nameDescriptor,
            Orientation orient, EPoint anchor, EPoint size,
            int flags, int techBits, TextDescriptor protoDescriptor); ImmutableNodeInst withName(Name name); ImmutableNodeInst withNameDescriptor(TextDescriptor nameDescriptor); ImmutableNodeInst withOrient(Orientation orient); ImmutableNodeInst withAnchor(EPoint anchor); ImmutableNodeInst withSize(EPoint size); ImmutableNodeInst withStateBits(ImmutableNodeInst d); ImmutableNodeInst withFlag(Flag flag, boolean value); ImmutableNodeInst withTechSpecific(int techBits); ImmutableNodeInst withProtoDescriptor(TextDescriptor protoDescriptor); ImmutableNodeInst withVariable(Variable var); ImmutableNodeInst withoutVariable(Variable.Key key); boolean isEasyShape(); ImmutableNodeInst withPortInst(PortProtoId portProtoId, ImmutablePortInst portInst); boolean isUsernamed(); boolean isCellInstance(); ImmutablePortInst getPortInst(PortProtoId portProtoId); Iterator<PortProtoId> getPortsWithVariables(); boolean hasPortInstVariables(); boolean is(Flag flag); int hashCodeExceptVariables(); boolean equalsExceptVariables(ImmutableElectricObject o); void check(); static boolean isCellCenter(NodeProtoId protoId); int getElibBits(); static int flagsFromElib(int elibBits); static int techSpecificFromElib(int elibBits); void computeBounds(BoundsBuilder b, Rectangle2D.Double dstBounds); EPoint[] getTrace(); ImmutableNodeInst withTrace(Point2D[] points, TextDescriptor td); double[] getArcDegrees(); double getSerpentineTransistorLength(); static final Flag HARD_SELECT; static final Flag VIS_INSIDE; static final Flag LOCKED; final static ImmutableNodeInst[] NULL_ARRAY; final static ImmutableArrayList<ImmutableNodeInst> EMPTY_LIST; final int nodeId; final NodeProtoId protoId; final Name name; final TextDescriptor nameDescriptor; final Orientation orient; final EPoint anchor; final EPoint size; final byte techBits; final TextDescriptor protoDescriptor; static Comparator<ImmutableNodeInst> NAME_ORDER; }### Answer:
@Test public void testWithFlag() { System.out.println("withFlag"); assertSame(n0, n0.withFlag(ImmutableNodeInst.HARD_SELECT, n0.is(ImmutableNodeInst.HARD_SELECT))); assertSame(n0, n0.withFlag(ImmutableNodeInst.VIS_INSIDE, n0.is(ImmutableNodeInst.VIS_INSIDE))); assertSame(n0, n0.withFlag(ImmutableNodeInst.LOCKED, n0.is(ImmutableNodeInst.LOCKED))); }