// CanCastle returns true if the given color and side combination
// can castle, otherwise returns false.
773
func (cr CastleRights) CanCastle(c Color, side Side) bool {
	char := "k"
	if side == QueenSide {
		char = "q"
	}
	if c == White {
		char = strings.ToUpper(char)
	}
	return strings.Contains(string(cr), char)
}
1189060
func Decor(mh *Hints) bool {
	if mh.Flags&HintDecorations > 0 {
		noDecor := mh.Decoration == DecorationNone ||
			(mh.Decoration&DecorationAll == 0 &&
				mh.Decoration&DecorationTitle == 0 &&
				mh.Decoration&DecorationResizeH == 0)
		return !noDecor
	}
	return true
}
568725
func (p *peer) CanSend(chID byte) bool {
	if !p.IsRunning() {
		return false
	}
	return p.mconn.CanSend(chID)
}
243735
func (re *RelateFonts) IsContainsFamilyAndStyle(family string, style int) bool {
	i := 0
	max := len(*re)
	for i < max {
		if (*re)[i].Family == family && (*re)[i].Style == style  {
			return true
		}
		i++
	}
	return false
}
1208772
func (p *PhysicalTopN) canPushDown() bool {
	exprs := make([]expression.Expression, 0, len(p.ByItems))
	for _, item := range p.ByItems {
		exprs = append(exprs, item.Expr)
	}
	_, _, remained := expression.ExpressionsToPB(p.ctx.GetSessionVars().StmtCtx, exprs, p.ctx.GetClient())
	return len(remained) == 0
}
422341
func (s *SeriesSegment) CanWrite(data []byte) bool {
	return s.w != nil && s.size+uint32(len(data)) <= SeriesSegmentSize(s.id)
}
851811
func (p *PopOp) CanPop(id string) bool {
	if _, hasTomb := p.tombs[id]; hasTomb {
		return false // already popped by someone else
	}
	if _, present := p.idToKeys[id]; present {
		return true // listed in the set
	}
	return false
}
1161113
func (s *Style) Has(ttype TokenType) bool {
	return !s.get(ttype).IsZero() || s.synthesisable(ttype)
}
1136693
func (m Material) IsFlammable() bool {
	if !m.IsBlock() {
		return false
	}
	switch m {
	case WoodPlanks, Wood, Leaves, Note, Bed, TallGrass, DeadBush, Wool, Tnt,
		Bookshelf, StairsWoodOak, Chest, CraftingTable, SignPost, DoorWood,
		SignWall, PlateWood, Jukebox, Fence, ChestLocked, Trapdoor,
		MushroomBrownHuge, MushroomRedHuge, Vine, FenceGate, SlabDoubleWood,
		SlabWood, StairsSpruceWood, StairsBirchWood, StairsJungleWood,
		ChestTrapped, DaylightSensor:
		return true
	}
	return false
}
340963
func (e *Element) IsEnabled() (bool, error) {
	e.lock.RLock()
	defer e.lock.RUnlock()

	if !e.ready {
		return false, &ElementNotReadyErr{}
	}
	disabled, ok := e.attributes["disabled"]
	// if the attribute doesn't exist, it's enabled.
	if !ok {
		return true, nil
	}
	if disabled == "true" || disabled == "" {
		return false, nil
	}
	return true, nil
}
250734
func (r *TrieRequest) CanSend(peer *peer) bool {
	return peer.HasBlock(r.Id.BlockHash, r.Id.BlockNumber, true)
}
734219
func HasColor(ctx context.Context) bool {
	_, ok := ctx.Value(ctxKeyColor).(bool)
	return ok
}
462455
func castleMoves(pos *Position) []*Move {
	moves := []*Move{}
	kingSide := pos.castleRights.CanCastle(pos.Turn(), KingSide)
	queenSide := pos.castleRights.CanCastle(pos.Turn(), QueenSide)
	// white king side
	if pos.turn == White && kingSide &&
		(^pos.board.emptySqs&(bbForSquare(F1)|bbForSquare(G1))) == 0 &&
		!squaresAreAttacked(pos, F1, G1) &&
		!pos.inCheck {
		m := &Move{s1: E1, s2: G1}
		m.addTag(KingSideCastle)
		moves = append(moves, m)
	}
	// white queen side
	if pos.turn == White && queenSide &&
		(^pos.board.emptySqs&(bbForSquare(B1)|bbForSquare(C1)|bbForSquare(D1))) == 0 &&
		!squaresAreAttacked(pos, C1, D1) &&
		!pos.inCheck {
		m := &Move{s1: E1, s2: C1}
		m.addTag(QueenSideCastle)
		moves = append(moves, m)
	}
	// black king side
	if pos.turn == Black && kingSide &&
		(^pos.board.emptySqs&(bbForSquare(F8)|bbForSquare(G8))) == 0 &&
		!squaresAreAttacked(pos, F8, G8) &&
		!pos.inCheck {
		m := &Move{s1: E8, s2: G8}
		m.addTag(KingSideCastle)
		moves = append(moves, m)
	}
	// black queen side
	if pos.turn == Black && queenSide &&
		(^pos.board.emptySqs&(bbForSquare(B8)|bbForSquare(C8)|bbForSquare(D8))) == 0 &&
		!squaresAreAttacked(pos, C8, D8) &&
		!pos.inCheck {
		m := &Move{s1: E8, s2: C8}
		m.addTag(QueenSideCastle)
		moves = append(moves, m)
	}
	return moves
}
203145
func Can() (bool, error) {
	find := true
	_, err := exec.LookPath(gitCmd)
	if err != nil {
		find = false
	}
	return find, err
}
1010113
func canMerge16(a, b interval16) bool {
	if int64(a.last())+1 < int64(b.start) {
		return false
	}
	return int64(b.last())+1 >= int64(a.start)
}
309956
func (c *Color) Equals(c2 *Color) bool {
	if len(c.params) != len(c2.params) {
		return false
	}

	for _, attr := range c.params {
		if !c2.attrExists(attr) {
			return false
		}
	}

	return true
}
80013
func (t Type) IsBuiltin() bool {
	_, ok := scalarTypes[t.TypeString()]
	return ok
}