text:
'use strict';

/**
 * @class
 * Initializes a new instance of the TaskIdRange class.
 * @constructor
 * @summary A range of task ids that a task can depend on. All tasks with ids
 * in the range must complete successfully before the dependent task can be
 * scheduled.
 *
 * @member {number} start The first task id in the range.
 *
 * @member {number} end The last task id in the range.
 *
 */
function TaskIdRange() {
}

/**
 * Defines the metadata of TaskIdRange
 *
 * @returns {object} metadata of TaskIdRange
 *
 */
TaskIdRange.prototype.mapper = function () {
  return {
    required: false,
    serializedName: 'TaskIdRange',
    type: {
      name: 'Composite',
      className: 'TaskIdRange',
      modelProperties: {
        start: {
          required: true,
          serializedName: 'start',
          type: {
            name: 'Number'
          }
        },
        end: {
          required: true,
          serializedName: 'end',
          type: {
            name: 'Number'
          }
        }
      }
    }
  };
};

module.exports = TaskIdRange;

redpajama_set_name: RedPajamaGithub


text:
package editor

import (
	"fmt"
	"log"
	"time"
	"unicode/utf8"

	"github.com/wi-ed/wi/wicore"
	"github.com/wi-ed/wi/wicore/colors"
	"github.com/wi-ed/wi/wicore/raster"
)

// TODO(maruel): Likely move into wicore for reuse.
type view struct {
	commands      wicore.CommandsW
	keyBindings   wicore.KeyBindingsW
	eventRegistry wicore.EventRegistry
	id            int
	title         string
	isDisabled    bool
	naturalX      int // Desired size.
	naturalY      int
	actualX       int // Actual size in UI.
	actualY       int
	window        wicore.Window
	onAttach      func(v *view, w wicore.Window)
	defaultFormat raster.CellFormat
	buffer        *raster.Buffer
	events        []wicore.EventListener
}

// wicore.View interface.

func (v *view) ID() string {
	return fmt.Sprintf("view:%d", v.id)
}

func (v *view) String() string {
	return fmt.Sprintf("View(%s)", v.title)
}

func (v *view) Close() error {
	var err error
	for _, event := range v.events {
		err2 := event.Close()
		if err2 != nil {
			err = err2
		}
	}
	return err
}

func (v *view) Commands() wicore.Commands {
	return v.commands
}

func (v *view) CommandsW() wicore.CommandsW {
	return v.commands
}

func (v *view) KeyBindings() wicore.KeyBindings {
	return v.keyBindings
}

func (v *view) KeyBindingsW() wicore.KeyBindingsW {
	return v.keyBindings
}

func (v *view) Title() string {
	return v.title
}

func (v *view) IsDisabled() bool {
	return v.isDisabled
}

func (v *view) NaturalSize() (x, y int) {
	return v.naturalX, v.naturalY
}

func (v *view) SetSize(x, y int) {
	log.Printf("View(%s).SetSize(%d, %d)", v.Title(), x, y)
	v.actualX = x
	v.actualY = y
	v.buffer = raster.NewBuffer(x, y)
}

func (v *view) OnAttach(w wicore.Window) {
	if v.onAttach != nil {
		v.onAttach(v, w)
	}
	v.window = w
}

// DefaultFormat returns the View's format or the parent Window's View's format.
func (v *view) DefaultFormat() raster.CellFormat {
	if v.defaultFormat.Empty() && v.window != nil {
		w := v.window.Parent()
		if w != nil {
			return w.View().DefaultFormat()
		}
	}
	return v.defaultFormat
}

// A disabled static view.
type staticDisabledView struct {
	view
}

func (v *staticDisabledView) Buffer() *raster.Buffer {
	// TODO(maruel): Use the parent view format by default. No idea how to
	// surface this information here. Cost is at least a RPC, potentially
	// multiple when multiple plugins are involved in the tree.
	v.buffer.Fill(raster.Cell{' ', v.DefaultFormat()})
	v.buffer.DrawString(v.Title(), 0, 0, v.DefaultFormat())
	return v.buffer
}

// Empty non-editable window.
func makeStaticDisabledView(e wicore.Editor, id int, title string, naturalX, naturalY int) *staticDisabledView {
	return &staticDisabledView{
		view{
			commands:      makeCommands(),
			keyBindings:   makeKeyBindings(),
			eventRegistry: e,
			id:            id,
			title:         title,
			isDisabled:    true,
			naturalX:      naturalX,
			naturalY:      naturalY,
			defaultFormat: raster.CellFormat{Fg: colors.Red, Bg: colors.Black},
			events:        []wicore.EventListener{},
		},
	}
}

// The status line is a hierarchy of Window, one for each element, each showing
// a single item.
func statusRootViewFactory(e wicore.Editor, id int, args ...string) wicore.ViewW {
	// TODO(maruel): OnResize(), query the root Window size, if y<=5 or x<=15,
	// set the root status Window to y=0, so that it becomes effectively
	// invisible when the editor window is too small.
	v := makeStaticDisabledView(e, id, "Status Root", 1, 1)
	v.defaultFormat.Bg = colors.LightGray
	v.onAttach = func(v *view, w wicore.Window) {
		id := w.ID()
		e.TriggerCommands(
			wicore.EnqueuedCommands{
				[][]string{
					{"window_new", id, "left", "status_active_window_name"},
					{"window_new", id, "right", "status_position"},
					{"window_new", id, "fill", "status_mode"},
				},
				nil,
			})
	}
	return v
}

func statusActiveWindowNameViewFactory(e wicore.Editor, id int, args ...string) wicore.ViewW {
	// Active Window View name.
	// TODO(maruel): Register events of Window activation, make itself Invalidate().
	v := makeStaticDisabledView(e, id, "Status Name", 15, 1)
	v.defaultFormat = raster.CellFormat{}
	return v
}

func statusModeViewFactory(e wicore.Editor, id int, args ...string) wicore.ViewW {
	// Mostly for testing purpose, will contain the current mode "Insert" or "Command".
	v := makeStaticDisabledView(e, id, e.KeyboardMode().String(), 10, 1)
	v.defaultFormat = raster.CellFormat{}
	event := e.RegisterEditorKeyboardModeChanged(func(mode wicore.KeyboardMode) {
		v.title = mode.String()
	})
	v.events = append(v.events, event)
	return v
}

func statusPositionViewFactory(e wicore.Editor, id int, args ...string) wicore.ViewW {
	// Position, % of file.
	// TODO(maruel): Register events of movement, make itself Invalidate().
	v := makeStaticDisabledView(e, id, "Status Position", 15, 1)
	v.defaultFormat = raster.CellFormat{}
	event := e.RegisterDocumentCursorMoved(func(doc wicore.Document, col, row int) {
		v.title = fmt.Sprintf("%d,%d", col, row)
	})
	v.events = append(v.events, event)
	return v
}

func infobarAlertViewFactory(e wicore.Editor, id int, args ...string) wicore.ViewW {
	out := "Alert: " + args[0]
	l := utf8.RuneCountInString(out)
	v := makeStaticDisabledView(e, id, out, l, 1)
	v.onAttach = func(v *view, w wicore.Window) {
		wicore.Go("infobarAlert", func() {
			// Dismiss after 5 seconds.
			<-time.After(5 * time.Second)
			wicore.PostCommand(e, nil, "window_close", w.ID())
		})
	}
	return v
}

// RegisterDefaultViewFactories registers the builtins views factories.
func RegisterDefaultViewFactories(e Editor) {
	e.RegisterViewFactory("command", commandViewFactory)
	e.RegisterViewFactory("infobar_alert", infobarAlertViewFactory)
	e.RegisterViewFactory("new_document", documentViewFactory)
	e.RegisterViewFactory("status_active_window_name", statusActiveWindowNameViewFactory)
	e.RegisterViewFactory("status_mode", statusModeViewFactory)
	e.RegisterViewFactory("status_position", statusPositionViewFactory)
	e.RegisterViewFactory("status_root", statusRootViewFactory)
}

// Commands

// RegisterViewCommands registers view-related commands
func RegisterViewCommands(dispatcher wicore.CommandsW) {
	cmds := []wicore.Command{}
	for _, cmd := range cmds {
		dispatcher.Register(cmd)
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">

        <title>Discovering Class Members (The Java™ Tutorials >
            The Reflection API > Classes)
</title>

     <meta name="description" content="This reflection Java tutorial describes using reflection for accessing and manipulating classes, fields, methods, and constructors" />
     <meta name="keywords" content="java programming, learn java, java sample code, java reflection" />

A browser with JavaScript enabled is required for this page to operate properly.

                            Download
                                the JDK

                            Search the
                                Tutorials

                            Hide the TOC

        Trail: The Reflection API

Lesson: Classes

Section: Sealing Packages in Extensions

Classes

Retrieving Class Objects

Examining Class Modifiers and Types

Discovering Class Members

Troubleshooting

                Home Page
                >
                The Reflection API
                >
                Classes

                « Previous • Trail • Next »

Discovering Class Members

There are two categories of methods provided in
Class
for accessing fields, methods, and constructors: methods which enumerate these
members and methods which search for particular members.  Also there are
distinct methods for accessing members declared directly on the class versus
methods which search the superinterfaces and superclasses for inherited
members.  The following tables provide a summary of all the member-locating
methods and their characteristics.

Class Methods for Locating Fields

Class
API
List of members?
Inherited members?
Private members?

getDeclaredField()nonoyes

getField()noyesno

getDeclaredFields()yesnoyes

getFields()yesyesno

Class Methods for Locating Methods

Class
API
List of members?
Inherited members?
Private members?

getDeclaredMethod()nonoyes

getMethod()noyesno

getDeclaredMethods()yesnoyes

getMethods()yesyesno

Class Methods for Locating Constructors

Class
API
List of members?
Inherited members?
Private members?

getDeclaredConstructor()noN/A1yes

getConstructor()noN/A1no

getDeclaredConstructors()yesN/A1yes

getConstructors()yesN/A1no

 1 Constructors are not inherited.

 Given a class name and an indication of which members are of
interest, the
ClassSpy
example uses the get*s() methods to determine the list of all
public elements, including any which are inherited.

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Member;
import static java.lang.System.out;

enum ClassMember { CONSTRUCTOR, FIELD, METHOD, CLASS, ALL }

public class ClassSpy {
    public static void main(String... args) {
	try {
	    Class<?> c = Class.forName(args[0]);
	    out.format("Class:%n  %s%n%n", c.getCanonicalName());

	    Package p = c.getPackage();
	    out.format("Package:%n  %s%n%n",
		       (p != null ? p.getName() : "-- No Package --"));

	    for (int i = 1; i < args.length; i++) {
		switch (ClassMember.valueOf(args[i])) {
		case CONSTRUCTOR:
		    printMembers(c.getConstructors(), "Constructor");
		    break;
		case FIELD:
		    printMembers(c.getFields(), "Fields");
		    break;
		case METHOD:
		    printMembers(c.getMethods(), "Methods");
		    break;
		case CLASS:
		    printClasses(c);
		    break;
		case ALL:
		    printMembers(c.getConstructors(), "Constuctors");
		    printMembers(c.getFields(), "Fields");
		    printMembers(c.getMethods(), "Methods");
		    printClasses(c);
		    break;
		default:
		    assert false;
		}
	    }

        // production code should handle these exceptions more gracefully
	} catch (ClassNotFoundException x) {
	    x.printStackTrace();
	}
    }

    private static void printMembers(Member[] mbrs, String s) {
	out.format("%s:%n", s);
	for (Member mbr : mbrs) {
	    if (mbr instanceof Field)
		out.format("  %s%n", ((Field)mbr).toGenericString());
	    else if (mbr instanceof Constructor)
		out.format("  %s%n", ((Constructor)mbr).toGenericString());
	    else if (mbr instanceof Method)
		out.format("  %s%n", ((Method)mbr).toGenericString());
	}
	if (mbrs.length == 0)
	    out.format("  -- No %s --%n", s);
	out.format("%n");
    }

    private static void printClasses(Class<?> c) {
	out.format("Classes:%n");
	Class<?>[] clss = c.getClasses();
	for (Class<?> cls : clss)
	    out.format("  %s%n", cls.getCanonicalName());
	if (clss.length == 0)
	    out.format("  -- No member interfaces, classes, or enums --%n");
	out.format("%n");
    }
}

 This example is relatively compact; however the printMembers()
method is slightly awkward due to the fact that the
java.lang.reflect.Member
interface has existed since the earliest implementations of reflection and it
could not be modified to include the more useful
getGenericString() method when generics were introduced.  The only
alternatives are to test and cast as shown, replace this method with
printConstructors(), printFields(), and
printMethods(), or to be satisfied with the relatively spare
results of
Member.getName().

 Samples of the output and their interpretation follows.  User input is in
italics.

$ java ClassSpy java.lang.ClassCastException CONSTRUCTOR
Class:
  java.lang.ClassCastException

Package:
  java.lang

Constructor:
  public java.lang.ClassCastException()
  public java.lang.ClassCastException(java.lang.String)

 Since constructors are not inherited, the exception chaining mechanism
constructors (those with a
Throwable
parameter) which are defined in the immediate super class
RuntimeException
and other super classes are not found.

$ java ClassSpy java.nio.channels.ReadableByteChannel METHOD
Class:
  java.nio.channels.ReadableByteChannel

Package:
  java.nio.channels

Methods:
  public abstract int java.nio.channels.ReadableByteChannel.read(java.nio.ByteBuffer) throws java.io.IOException
  public abstract void java.nio.channels.Channel.close() throws java.io.IOException
  public abstract boolean java.nio.channels.Channel.isOpen()

The interface
java.nio.channels.ReadableByteChannel
defines
read().  The remaining methods are inherited from a super interface.  This code could
easily be modified to list only those methods that are actually declared in the
class by replacing get*s() with getDeclared*s().

$ java ClassSpy ClassMember FIELD METHOD
Class:
  ClassMember

Package:
  -- No Package --

Fields:
  public static final ClassMember ClassMember.CONSTRUCTOR
  public static final ClassMember ClassMember.FIELD
  public static final ClassMember ClassMember.METHOD
  public static final ClassMember ClassMember.CLASS
  public static final ClassMember ClassMember.ALL

Methods:
  public static ClassMember ClassMember.valueOf(java.lang.String)
  public static ClassMember[] ClassMember.values()
  public final int java.lang.Enum.hashCode()
  public final int java.lang.Enum.compareTo(E)
  public int java.lang.Enum.compareTo(java.lang.Object)
  public final java.lang.String java.lang.Enum.name()
  public final boolean java.lang.Enum.equals(java.lang.Object)
  public java.lang.String java.lang.Enum.toString()
  public static <T> T java.lang.Enum.valueOf(java.lang.Class<T>,java.lang.String)
  public final java.lang.Class<E> java.lang.Enum.getDeclaringClass()
  public final int java.lang.Enum.ordinal()
  public final native java.lang.Class<?> java.lang.Object.getClass()
  public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
  public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
  public final void java.lang.Object.wait() throws java.lang.InterruptedException
  public final native void java.lang.Object.notify()
  public final native void java.lang.Object.notifyAll()

 In the fields portion of these results, enum constants are listed.  While
these are technically fields, it might be useful to distinguish them from other
fields.  This example could be modified to use
java.lang.reflect.Field.isEnumConstant()
for this purpose.  The
EnumSpy
example in a later section of this trail, Examining Enums, contains a possible
implementation.

 In the methods section of the output, observe that the method name includes
the name of the declaring class.  Thus, the toString()
method is implemented by
Enum, not inherited from
Object.  The code could be amended to make this more obvious by using
Field.getDeclaringClass().  The following fragment illustrates part of a potential solution.

if (mbr instanceof Field) {
    Field f = (Field)mbr;
    out.format("  %s%n", f.toGenericString());
    out.format("  -- declared in: %s%n", f.getDeclaringClass());
}

            « Previous
            •
            Trail
            •
            Next »

Problems with the examples? Try Compiling and Running
        the Examples: FAQs.

    Complaints? Compliments? Suggestions? Give
    us your feedback.

Your use of this page and all the material on pages under "The Java Tutorials" banner,
and all the material on pages under "The Java Tutorials" banner is subject to the Java SE Tutorial Copyright
and License.
Additionally, any example code contained in any of these Java
Tutorials pages is licensed under the
Code
Sample License.

About Oracle | Oracle Technology Network | Terms of Service

Copyright © 1995, 2011 Oracle and/or its affiliates. All rights reserved.

        Previous page: Examining Class Modifiers and Types

Next page: Troubleshooting

A browser with JavaScript enabled is required for this page to operate properly.


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd ">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com</groupId>
	<artifactId>ssh</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>zsx Maven Webapp</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<jdk.version>1.7</jdk.version>
		<!-- spring版本号 -->
		<spring.version>4.3.18.RELEASE</spring.version>
		<!-- mybatis版本号 -->
		<mybatis.version>3.4.1</mybatis.version>
		<!-- log4j日志文件管理包版本 -->
		<slf4j.version>1.7.21</slf4j.version>
		<log4j.version>1.2.17</log4j.version>
		<!-- hibernate版本号 -->
		<hibernate.version>5.1.0.Final</hibernate.version>
	</properties>

	<dependencies>

		<!-- spring mvc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!-- spring核心包 -->
		<!-- springframe start -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-oxm</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- springframe end -->

		<!-- aspectjweaver.jar这是Spring AOP所要用到的包 -->
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>1.8.9</version>
		</dependency>

		<!-- hibernate -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>${hibernate.version}</version>
		</dependency>

		<!-- mysql驱动包 -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.38</version>
		</dependency>

		<dependency>
		    <groupId>org.springframework.data</groupId>
		    <artifactId>spring-data-redis</artifactId>
		    <version>1.7.2.RELEASE</version>
		</dependency>

		<dependency>
		    <groupId>redis.clients</groupId>
		    <artifactId>jedis</artifactId>
		    <version>2.9.0</version>
		</dependency>

		<!-- junit测试包 -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
            <version>4.13.1</version>
			<scope>test</scope>
		</dependency>

		<!-- 阿里巴巴数据源包 -->
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>druid</artifactId>
			<version>1.0.25</version>
		</dependency>

		<!-- Json包 -->
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>fastjson</artifactId>
			<version>1.2.68</version>
		</dependency>

		<!-- -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.9.10.4</version>
		</dependency>

		<!-- 文件上传 -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.3.3</version>
		</dependency>

		<!-- 日志文件管理包 -->
		<!-- log start -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<!-- log end -->

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
		</dependency>

	</dependencies>
	<build>
		<finalName>ssh</finalName>

		<!--  -->
		<sourceDirectory>src/main/java</sourceDirectory>
		<testSourceDirectory>src/test/java</testSourceDirectory>

		<resources>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
			</testResource>
		</testResources>

		<outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
		<testOutputDirectory>src/main/webapp/WEB-INF/classes</testOutputDirectory>

		<!-- 公用的插件配置项,给子项目共用的(在这里是为了防止<executions>标签报错) -->
		<pluginManagement>
			<plugins>
				<!-- maven插件:将项目依赖包拷贝到指定目录 (执行一下 Run As —— Maven build 就会执行copy)-->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-dependency-plugin</artifactId>
					<version>2.8</version>
					<executions>
						<execution>
							<id>copy-dependencies</id>
							<phase>compile</phase>
							<goals>
	                        	<goal>copy-dependencies</goal>
	                    	</goals>
	                    	<configuration>
			                	<outputDirectory>src/main/webapp/WEB-INF/lib</outputDirectory>
							</configuration>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>

		<!-- Maven插件 -->
		<plugins>
			<!-- 编译插件 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>${jdk.version}</source> <!-- 源代码使用的开发版本 -->
					<target>${jdk.version}</target> <!-- 需要生成的目标class文件的编译版本 -->
					<!-- 一般而言,target与source是保持一致的, -->
					<!-- 但是,有时候为了让程序能在其他版本的jdk中运行(对于低版本目标jdk,源代码中需要没有使用低版本jdk中不支持的语法), -->
					<!-- 会存在target不同于source的情况 -->
					<encoding>${project.build.sourceEncoding}</encoding>
					<fork>true</fork>
					<meminitial>512m</meminitial>
					<maxmem>2048m</maxmem>
				</configuration>
			</plugin>

			<!-- 设置资源文件的编码方式  -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.4.3</version>
				<executions>
				    <execution>
				        <phase>compile</phase>
				    </execution>
				</executions>
				<configuration>
				    <encoding>UTF-8</encoding>
				</configuration>
			</plugin>

			<!--  -->
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
    			<version>2.4.1</version>
    			<configuration>
    				<filesets>
    					<fileset>
    						<directory>src/main/webapp/WEB-INF/lib</directory>
    						<followSymlinks>false</followSymlinks>
    					</fileset>
    				</filesets>
    			</configuration>
			</plugin>

		</plugins>

	</build>
</project>


text:
<?php
require_once __DIR__ . '../../../vendor/autoload.php';

use ApiGateway\Model\Control\DeleteTrafficSpecialControl;
use ApiGateway\ApiService;

$object = new DeleteTrafficSpecialControl();
$object->setTrafficControlId();
$object->setSpecialType();
$object->setSpecialKey();

$serviceObj = new ApiService($object);
$response   = $serviceObj->get();

print_r($response);


text: export { MedicationReminder20 as default } from "../../";


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Cercospora viticola f. rupestris Cif.

### Remarks
null


text:
package com.dtolabs.shared.resources;
/*
* TestResourceXMLGenerator.java
*
* User: Greg Schueler greg@dtosolutions.com
* Created: Oct 7, 2010 2:37:09 PM
*
*/

import com.dtolabs.rundeck.core.common.NodeEntryImpl;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;

import java.io.File;
import java.io.IOException;
import java.io.FileOutputStream;
import java.util.HashSet;
import java.util.HashMap;
import java.util.List;

public class TestResourceXMLGenerator extends TestCase {
    ResourceXMLGenerator resourceXMLGenerator;
    private File test1;
    private File test2;
    private SAXReader reader;

    public TestResourceXMLGenerator(final String name) {
        super(name);
    }

    public static Test suite() {
        return new TestSuite(TestResourceXMLGenerator.class);
    }

    protected void setUp() throws Exception {
        new File("build/test-target").mkdirs();
        test1 = new File("build/test-target/TestResourceXMLGenerator-test1.xml");
        test2 = new File("build/test-target/doesnotexist/test.xml");
        reader = new SAXReader(false);
    }

    protected void tearDown() throws Exception {
        if(test1.exists()){
//            test1.deleteOnExit();
        }
    }

    public static void main(final String[] args) {
        junit.textui.TestRunner.run(suite());
    }

    public void testResourceXMLGenerator() throws Exception {
        {
            final ResourceXMLGenerator gen = new ResourceXMLGenerator(test2);
            try {
                gen.generate();
                fail("Should throw IOException due to missing dir");
            } catch (IOException e) {
                assertNotNull(e);
            }
        }
        {
            final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
            gen.generate();
            assertTrue(test1.exists());
            assertTrue(test1.isFile());
        }
        assertTrue(test1.delete());
        {
            final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
            //add a node
            final NodeEntryImpl node = new NodeEntryImpl("test1", "test1name");
            gen.addNode(node);
            gen.generate();
            assertTrue(test1.exists());
            assertTrue(test1.isFile());
            //assert contents
            final Document d = reader.read(test1);
            assertNotNull(d);
            final Element root = d.getRootElement();
            assertEquals("project", root.getName());
            assertEquals(1, root.selectNodes("/project/*").size());
            assertEquals(1, root.selectNodes("node").size());
            assertEquals("test1name", root.selectSingleNode("node/@name").getStringValue());
            assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
            assertEquals("", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("", root.selectSingleNode("node/@username").getStringValue());
        }
        assertTrue(test1.delete());
        {
            final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
            //add a node
            final NodeEntryImpl node = new NodeEntryImpl("test1", "test1name");
            node.setDescription("test desc");
            node.setOsArch("test arch");
            node.setOsFamily("test fam");
            node.setOsName("test osname");
            node.setOsVersion("test vers");
            final HashSet<String> tags = new HashSet<String>();
            tags.add("a");
            tags.add("d");
            node.setTags(tags);
            node.setUsername("test user");

            gen.addNode(node);
            gen.generate();
            assertTrue(test1.exists());
            assertTrue(test1.isFile());
            //assert contents
            final Document d = reader.read(test1);
            assertNotNull(d);
            final Element root = d.getRootElement();
            assertEquals("project", root.getName());
            assertEquals(1, root.selectNodes("/project/*").size());
            assertEquals(1, root.selectNodes("node").size());
            assertEquals("test1name", root.selectSingleNode("node/@name").getStringValue());
            assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
            assertEquals("a, d", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
        }
        {  //test to outputstream
            assertTrue(test1.delete());
            final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
            //add a node
            final NodeEntryImpl node = new NodeEntryImpl("test1", "test1name");
            node.setDescription("test desc");
            node.setOsArch("test arch");
            node.setOsFamily("test fam");
            node.setOsName("test osname");
            node.setOsVersion("test vers");
            final HashSet<String> tags = new HashSet<String>();
            tags.add("a");
            tags.add("d");
            node.setTags(tags);
            node.setUsername("test user");

            gen.addNode(node);
            gen.generate();
            assertTrue(test1.exists());
            assertTrue(test1.isFile());
            //assert contents
            final Document d = reader.read(test1);
            assertNotNull(d);
            final Element root = d.getRootElement();
            assertEquals("project", root.getName());
            assertEquals(1, root.selectNodes("/project/*").size());
            assertEquals(1, root.selectNodes("node").size());
            assertEquals("test1name", root.selectSingleNode("node/@name").getStringValue());
            assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
            assertEquals("a, d", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
        }
        assertTrue(test1.delete());
        {
            //test arbitrary attributes
            final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
            //add a node
            final NodeEntryImpl node = new NodeEntryImpl("test1", "test1name");
            node.setDescription("test desc");
            node.setUsername("test user");
            final HashMap<String, String> attributes = new HashMap<String, String>();
            attributes.put("myattr", "myattrvalue");
            attributes.put("-asdf", "test value");
            node.setAttributes(attributes);

            gen.addNode(node);
            gen.generate();
            assertTrue(test1.exists());
            assertTrue(test1.isFile());
            //assert contents
            final Document d = reader.read(test1);
            assertNotNull(d);
            final Element root = d.getRootElement();
            assertEquals("project", root.getName());
            assertEquals(1, root.selectNodes("/project/*").size());
            assertEquals(1, root.selectNodes("node").size());
            assertEquals("myattrvalue", root.selectSingleNode("node/@myattr").getStringValue());
            //weird attr name will be set as attribute subelement
            assertNotNull( root.selectSingleNode("node/attribute"));
            assertEquals(1, root.selectNodes("node/attribute").size());
            assertEquals("-asdf", root.selectSingleNode("node/attribute/@name").getStringValue());
            assertEquals("test value", root.selectSingleNode("node/attribute/@value").getStringValue());
        }
    }
    public void testTags() throws Exception {
        final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
        //add a node
        final NodeEntryImpl node = new NodeEntryImpl("test1", "test1name");
        node.setDescription("test desc");
        node.setOsArch("test arch");
        node.setOsFamily("test fam");
        node.setOsName("test osname");
        node.setOsVersion("test vers");
        final HashSet<String> tags = new HashSet<String>();
        tags.add("a");
        tags.add("b");
        node.setTags(tags);
        node.getTags().add("c");
        node.setUsername("test user");

        gen.addNode(node);
        gen.generate();
        assertTrue(test1.exists());
        assertTrue(test1.isFile());
        //assert contents
        final Document d = reader.read(test1);
        assertNotNull(d);
        final Element root = d.getRootElement();
        assertEquals("project", root.getName());
        assertEquals(1, root.selectNodes("/project/*").size());
        assertEquals(1, root.selectNodes("node").size());
        assertEquals("test1name", root.selectSingleNode("node/@name").getStringValue());
        assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
        assertEquals("a, b, c", root.selectSingleNode("node/@tags").getStringValue());
        assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
        assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
        assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
        assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
        assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
        assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
    }

    /**
     * Attributes with a ":" are generated in separate <attribute .. /> elements
     * @throws Exception
     */
    public void testAttributeCharsColon() throws Exception {
        //test attributes with xml special chars
        final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
        //add a node
        final NodeEntryImpl node = new NodeEntryImpl("test1", "test1name");
        node.setDescription("test desc");
        node.setUsername("test user");
        final HashMap<String, String> attributes = new HashMap<String, String>();
        attributes.put("my:attr", "myattrvalue");
        attributes.put("another:attribute", "test value");
        node.setAttributes(attributes);

        gen.addNode(node);
        gen.generate();
        assertTrue(test1.exists());
        assertTrue(test1.isFile());
        //assert contents
        final Document d = reader.read(test1);
        assertNotNull(d);
        final Element root = d.getRootElement();
        assertEquals("project", root.getName());
        assertEquals(1, root.selectNodes("/project/*").size());
        assertEquals(1, root.selectNodes("node").size());
        //weird attr name will be set as attribute subelement
        assertNotNull( root.selectSingleNode("node/attribute"));
        List list = root.selectNodes("node/attribute");
        assertEquals(2, list.size());

        Node attr1 = (Node) list.get(0);
        assertEquals("another:attribute", attr1.selectSingleNode("@name").getStringValue());
        assertEquals("test value", attr1.selectSingleNode("@value").getStringValue());

        Node attr2 = (Node)list.get(1);
        assertEquals("my:attr", attr2.selectSingleNode("@name").getStringValue());
        assertEquals("myattrvalue", attr2.selectSingleNode("@value").getStringValue());
    }

    /**
     * Attributes with a "." are generated in separate <attribute .. /> elements
     * @throws Exception
     */
    public void testAttributeCharsPeriod() throws Exception {
        //test attributes with xml special chars
        final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
        //add a node
        final NodeEntryImpl node = new NodeEntryImpl("test1", "test1name");
        node.setDescription("test desc");
        node.setUsername("test user");
        final HashMap<String, String> attributes = new HashMap<String, String>();
        attributes.put("my.attr", "myattrvalue");
        attributes.put("another.attribute", "test value");
        node.setAttributes(attributes);

        gen.addNode(node);
        gen.generate();
        assertTrue(test1.exists());
        assertTrue(test1.isFile());
        //assert contents
        final Document d = reader.read(test1);
        assertNotNull(d);
        final Element root = d.getRootElement();
        assertEquals("project", root.getName());
        assertEquals(1, root.selectNodes("/project/*").size());
        assertEquals(1, root.selectNodes("node").size());
        //weird attr name will be set as attribute subelement
        assertNotNull("expected node/attribute elements", root.selectSingleNode("node/attribute"));
        List list = root.selectNodes("node/attribute");
        assertEquals(2, list.size());

        for (Object o : list) {
            Node attr1 = (Node) list.get(0);
            String name = attr1.selectSingleNode("@name").getStringValue();
            if("another.attribute".equals(name)){
                assertEquals("another.attribute", name);
                assertEquals("test value", attr1.selectSingleNode("@value").getStringValue());
            }else{
                assertEquals("my.attr", name);
                assertEquals("myattrvalue", attr1.selectSingleNode("@value").getStringValue());
            }
        }

    }
}


text:
package io.quarkus.arc.test.unused;

import java.util.concurrent.atomic.AtomicInteger;

import javax.inject.Singleton;

@Bravo // Intercepted by Bravo, injected in Alpha!
@Singleton
public class Counter {

    private AtomicInteger counter = new AtomicInteger();

    public int incrementAndGet() {
        return counter.incrementAndGet();
    }

    public void reset() {
        counter.set(0);
    }

    public int get() {
        return counter.get();
    }

}


text:
'use strict';

module.exports = require('./lib/forbject');


text:
<?xml version="1.0" encoding="UTF-8"?>
<esrifv apiversion="3.3" builddate="@BUILD_DATE@"/>


text:
import itertools
import operator
import os.path
import re
from collections import Counter, defaultdict
from functools import partial, reduce
from heapq import heappop, heappush
from io import TextIOBase
from itertools import combinations, pairwise, permutations
from math import isfinite, prod

INPUT=os.path.join(os.path.dirname(__file__), "input.txt")
with open(INPUT) as f:
    data = f.read()

test="""Player 1 starting position: 4
Player 2 starting position: 8"""

def part1(data):
    p = [int(w[-1])-1 for w in data.splitlines()]
    scores = [0,0]
    throws = 0
    while True:
        for player in (0,1):
            throw = 3*throws + 6
            throws += 3
            p[player] = (p[player] + throw) % 10
            scores[player] += p[player] + 1
            if scores[player] >= 1000:
                return(scores[1-player]*throws)

print(part1(test))
print(part1(data))

"""
Should have generated with this instead of by hand:

    throws = defaultdict(int)
    for i in (1,2,3):
        for j in (1,2,3):
            for k in (1,2,3):
                throws[i+j+k] += 1
    assert list(sorted(throws.items())) == THROWS
"""
THROWS = [(3,1),(4,3),(5,6),(6,7),(7,6),(8,3),(9,1)]

def simulate_multiverse(states, player):
    wins = 0
    new_states = defaultdict(int)
    for throw,count in THROWS:
        for (pos, score), times in states.items():
            new_pos = (pos[player] + throw) % 10
            new_score = score[player] + new_pos + 1
            if new_score >= 21:
                wins += times*count
                continue
            # Create new tuples by slicing - as immutables cannot directly change tuple
            pos = pos[:player] + (new_pos,) + pos[player+1:]
            score = score[:player] + (new_score,) + score[player+1:]
            new_states[(pos, score)] += times * count
    return new_states, wins

def part2(data):
    pos = tuple(int(w[-1])-1 for w in data.splitlines())
    states = {
        (pos, (0, 0)): 1,
    }
    winner = [0,0]
    while states:
        for player in (0,1):
            states, wins = simulate_multiverse(states, player)
            winner[player] += wins
    return max(winner)

print(part2(test))
print(part2(data))


text:
package com.example.androidapplication.contacts;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.Toast;

public class SearchContactActivity extends ListActivity implements View.OnClickListener{
    //Create database object
    final SampleDBManager db = new SampleDBManager(this);
    //Declare EditText, Button and TextView
    EditText SearchContactEditText;
    Button SearchContactButton;
    TextView NoContactToSearch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_contact);

        //initialize them to appropriate id
        NoContactToSearch = (TextView) findViewById(R.id.textViewNoContactToSearch);
        SearchContactEditText =(EditText)findViewById(R.id.editTextSearchContact);
        SearchContactButton = (Button)findViewById(R.id.buttonSeachContact);
        SearchContactButton.setOnClickListener(this);

        db.open();//open the database
        Cursor cursor = db.getRow();//create a cursor to get all rows
        if (cursor.getCount()==0) {//if there is no rows in the table than prompt the user
            NoContactToSearch.setText("Nothing to search as Your contact list is empty :)");
            SearchContactButton.setEnabled(false);
        }
        db.close();//close the database

    }//end onCreate

    // Reference: The following code is from
    //http://stackoverflow.com/questions/5545217/back-button-and-refreshing-previous-activity
    @Override
    public void onRestart() {//restart the activity to get the updated data when back button is pressed.
        super.onRestart();
        finish();
        startActivity(getIntent());
    }
    // Reference complete

    @Override
    public void onClick(View v) {
        if(v.getId() == R.id.buttonSeachContact){// if the search button is pressed than
            if (SearchContactEditText.getText().toString().equals("")){//check to makse sure edit text is not empty
                Toast.makeText(this, "Enter name to search for", Toast.LENGTH_SHORT).show();
            }
            else{//once its not empty than
                db.open();//open the database
                Cursor cursor = db.searchRow(SearchContactEditText.getText().toString());//create a cursor to search for a row

                if (cursor.getCount()!=0) {//if the input string is found than set in the list
                    String[] columns = new String[]{"contact_name"};
                    int[] to = new int[]{R.id.textViewDisplayContactname};

                    SimpleCursorAdapter simpleCursorAdapter = new SimpleCursorAdapter(this,R.layout.row_layout,cursor,columns,to);
                    setListAdapter(simpleCursorAdapter);
                }
                else{//if the input data is not found than notify the user
                    //NoContactToSearch.setText("Contact " + SearchContactEditText.getText().toString()+ " does not exists");
                    Toast.makeText(this, "contact " + SearchContactEditText.getText().toString() +" does not exists", Toast.LENGTH_SHORT).show();
                }
                db.close();//close the databse

            }//end else

        }//end imageButtonAdd

    }//end onClick

    protected void onListItemClick(ListView l, View v, int position, long id) {//if the user clicked on name from the list
        Cursor cursor = ((SimpleCursorAdapter)l.getAdapter()).getCursor();
        cursor.moveToPosition(position);

        //pass the corresponding data of the selected row to the edit contact activity
        Intent myintent = new Intent(SearchContactActivity. this, EditContactActivity.class);
        myintent.putExtra("rowid", cursor.getString(cursor.getColumnIndex("_id")).toString());
        myintent.putExtra("fullname", cursor.getString(cursor.getColumnIndex("contact_name")).toString());
        myintent.putExtra("address1", cursor.getString(cursor.getColumnIndex("contact_address1")).toString());
        myintent.putExtra("address2", cursor.getString(cursor.getColumnIndex("contact_address2")).toString());
        myintent.putExtra("county", cursor.getString(cursor.getColumnIndex("contact_county")).toString());
        myintent.putExtra("contactno", cursor.getString(cursor.getColumnIndex("contact_contactno")).toString());
        startActivity(myintent);

    }//end onListItemClick

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_search_contact, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

}//end class


text:
package tectonicus.blockTypes;

import tectonicus.BlockContext;
import tectonicus.BlockType;
import tectonicus.BlockTypeRegistry;
import tectonicus.rasteriser.Mesh;
import tectonicus.raw.RawChunk;
import tectonicus.renderer.Geometry;
import tectonicus.texture.SubTexture;
import tectonicus.util.Colour4f;

public class HugeMushroom implements BlockType
{
	private final String name;

	private SubTexture cap, pores, stem;

	private Colour4f colour;

	public HugeMushroom(String name, SubTexture cap, SubTexture pores, SubTexture stem)
	{
		this.name = name;

		this.cap = cap;
		this.pores = pores;
		this.stem = stem;

		colour = new Colour4f(1, 1, 1, 1);
	}

	@Override
	public String getName()
	{
		return name;
	}

	@Override
	public boolean isSolid()
	{
		return true;
	}

	@Override
	public boolean isWater()
	{
		return false;
	}

	@Override
	public void addInteriorGeometry(int x, int y, int z, BlockContext world, BlockTypeRegistry registry, RawChunk chunk, Geometry geometry)
	{
		addEdgeGeometry(x, y, z, world, registry, chunk, geometry);
	}

	@Override
	public void addEdgeGeometry(int x, int y, int z, BlockContext world, BlockTypeRegistry registry, RawChunk chunk, Geometry geometry)
	{
		final int data = chunk.getBlockData(x, y, z);

		SubTexture top = pores;
		SubTexture bottom = pores;
		SubTexture north = pores;
		SubTexture south = pores;
		SubTexture east = pores;
		SubTexture west = pores;

		/*
		0	 Fleshy piece	 Pores on all sides
		1	 Corner piece	 Cap texture on top, directions 1 (cloud direction) and 2 (sunrise)
		2	 Side piece	 Cap texture on top and direction 2 (sunrise)
		3	 Corner piece	 Cap texture on top, directions 2 (sunrise) and 3 (cloud origin)
		4	 Side piece	 Cap texture on top and direction 1 (cloud direction)
		5	 Top piece	 Cap texture on top
		6	 Side piece	 Cap texture on top and direction 3 (cloud origin)
		7	 Corner piece	 Cap texture on top, directions 0 (sunset) and 1 (cloud direction)
		8	 Side piece	 Cap texture on top and direction 0 (sunset)
		9	 Corner piece	 Cap texture on top, directions 3 (cloud origin) and 0 (sunset)
		10	 Stem piece	 Stem texture on all four sides, pores on top and bottom
		*/
		// N
		//sets	rises
		//	S

		// cloud direction N
		// cloud origin S
		// sunrise E
		// sunset W

		switch (data)
		{
			case 0:
				// Pores on all sides
				break;
			case 1:
				// Corner - Cap texture on top, directions 1 (cloud direction) and 2 (sunrise)
				top = north = east = cap;
				break;
			case 2:
				// Side - Cap texture on top and direction 2 (sunrise)
				top = east = cap;
				break;
			case 3:
				// Corner - Cap texture on top, directions 2 (sunrise) and 3 (cloud origin)
				top = east = south = cap;
				break;
			case 4:
				// Side - Cap texture on top and direction 1 (cloud direction)
				top = north = cap;
				break;
			case 5:
				// Top - Cap texture on top
				top = cap;
				break;
			case 6:
				// Side - Cap texture on top and direction 3 (cloud origin)
				top = south = cap;
				break;
			case 7:
				// Corner - Cap texture on top, directions 0 (sunset) and 1 (cloud direction)
				top = west = north = cap;
				break;
			case 8:
				// Side - Cap texture on top and direction 0 (sunset)
				top = west = cap;
				break;
			case 9:
				// Corner - Cap texture on top, directions 3 (cloud origin) and 0 (sunset)
				top = south = west = cap;
				break;
			case 10:
				// Stem
				north = south = east = west = stem;
				break;
			default:
		}

		top = cap;

		Mesh topMesh = geometry.getMesh(top.texture, Geometry.MeshType.Solid);
		Mesh bottomMesh = geometry.getMesh(bottom.texture, Geometry.MeshType.Solid);

		Mesh northMesh = geometry.getMesh(north.texture, Geometry.MeshType.Solid);
		Mesh southMesh = geometry.getMesh(south.texture, Geometry.MeshType.Solid);
		Mesh eastMesh = geometry.getMesh(east.texture, Geometry.MeshType.Solid);
		Mesh westMesh = geometry.getMesh(west.texture, Geometry.MeshType.Solid);

		BlockUtil.addTop(world, chunk, topMesh, x, y, z, colour, top, registry);
		BlockUtil.addBottom(world, chunk, bottomMesh, x, y, z, colour, bottom, registry);

		BlockUtil.addNorth(world, chunk, northMesh, x, y, z, colour, north, registry);
		BlockUtil.addSouth(world, chunk, southMesh, x, y, z, colour, south, registry);
		BlockUtil.addEast(world, chunk, eastMesh, x, y, z, colour, east, registry);
		BlockUtil.addWest(world, chunk, westMesh, x, y, z, colour, west, registry);
	}
}


text:
package com.googlesource.gerrit.plugins.rabbitmq.worker;

public interface EventWorkerFactory {
  EventWorker create();
}


text:
.class public Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;
.super Ljava/lang/Object;
.source "DcSwitchAsyncChannel.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "RequestInfo"
.end annotation

# instance fields
.field executedPhoneId:I

.field final priority:I

.field final request:Landroid/net/NetworkRequest;

.field private final requestLog:Landroid/util/LocalLog;

# direct methods
.method public constructor <init>(Landroid/net/NetworkRequest;ILandroid/util/LocalLog;)V
    .locals 1
    .param p1, "request"    # Landroid/net/NetworkRequest;
    .param p2, "priority"    # I
    .param p3, "l"    # Landroid/util/LocalLog;

    .prologue
    .line 73
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 74
    iput-object p1, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->request:Landroid/net/NetworkRequest;

    .line 75
    iput p2, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->priority:I

    .line 76
    iput-object p3, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->requestLog:Landroid/util/LocalLog;

    .line 77
    const/4 v0, -0x1

    iput v0, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->executedPhoneId:I

    .line 73
    return-void
.end method

# virtual methods
.method public getLog()Landroid/util/LocalLog;
    .locals 1

    .prologue
    .line 85
    iget-object v0, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->requestLog:Landroid/util/LocalLog;

    return-object v0
.end method

.method public log(Ljava/lang/String;)V
    .locals 1
    .param p1, "str"    # Ljava/lang/String;

    .prologue
    .line 81
    iget-object v0, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->requestLog:Landroid/util/LocalLog;

    invoke-virtual {v0, p1}, Landroid/util/LocalLog;->log(Ljava/lang/String;)V

    .line 80
    return-void
.end method

.method public toString()Ljava/lang/String;
    .locals 2

    .prologue
    .line 90
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v1, "[ request="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->request:Landroid/net/NetworkRequest;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string/jumbo v1, ", executedPhoneId="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget v1, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->executedPhoneId:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 91
    const-string/jumbo v1, ", priority="

    .line 90
    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 91
    iget v1, p0, Lcom/android/internal/telephony/dataconnection/DcSwitchAsyncChannel$RequestInfo;->priority:I

    .line 90
    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 91
    const-string/jumbo v1, "]"

    .line 90
    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


text:
"""

    OpenAPI spec version:

    Generated by: https://github.com/swagger-api/swagger-codegen.git

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from pprint import pformat
from six import iteritems
import re

class V1NodeSystemInfo(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """

    operations = [
    ]

    # The key is attribute name
    # and the value is attribute type.
    swagger_types = {
        'machine_id': 'str',
        'system_uuid': 'str',
        'boot_id': 'str',
        'kernel_version': 'str',
        'os_image': 'str',
        'container_runtime_version': 'str',
        'kubelet_version': 'str',
        'kube_proxy_version': 'str'
    }

    # The key is attribute name
    # and the value is json key in definition.
    attribute_map = {
        'machine_id': 'machineID',
        'system_uuid': 'systemUUID',
        'boot_id': 'bootID',
        'kernel_version': 'kernelVersion',
        'os_image': 'osImage',
        'container_runtime_version': 'containerRuntimeVersion',
        'kubelet_version': 'kubeletVersion',
        'kube_proxy_version': 'kubeProxyVersion'
    }

    def __init__(self, machine_id=None, system_uuid=None, boot_id=None, kernel_version=None, os_image=None, container_runtime_version=None, kubelet_version=None, kube_proxy_version=None):
        """
        V1NodeSystemInfo - a model defined in Swagger

        """

        self._machine_id = machine_id
        self._system_uuid = system_uuid
        self._boot_id = boot_id
        self._kernel_version = kernel_version
        self._os_image = os_image
        self._container_runtime_version = container_runtime_version
        self._kubelet_version = kubelet_version
        self._kube_proxy_version = kube_proxy_version

    @property
    def machine_id(self):
        """
        Gets the machine_id of this V1NodeSystemInfo.
        Machine ID reported by the node.

        :return: The machine_id of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._machine_id

    @machine_id.setter
    def machine_id(self, machine_id):
        """
        Sets the machine_id of this V1NodeSystemInfo.
        Machine ID reported by the node.

        :param machine_id: The machine_id of this V1NodeSystemInfo.
        :type: str
        """

        self._machine_id = machine_id

    @property
    def system_uuid(self):
        """
        Gets the system_uuid of this V1NodeSystemInfo.
        System UUID reported by the node.

        :return: The system_uuid of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._system_uuid

    @system_uuid.setter
    def system_uuid(self, system_uuid):
        """
        Sets the system_uuid of this V1NodeSystemInfo.
        System UUID reported by the node.

        :param system_uuid: The system_uuid of this V1NodeSystemInfo.
        :type: str
        """

        self._system_uuid = system_uuid

    @property
    def boot_id(self):
        """
        Gets the boot_id of this V1NodeSystemInfo.
        Boot ID reported by the node.

        :return: The boot_id of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._boot_id

    @boot_id.setter
    def boot_id(self, boot_id):
        """
        Sets the boot_id of this V1NodeSystemInfo.
        Boot ID reported by the node.

        :param boot_id: The boot_id of this V1NodeSystemInfo.
        :type: str
        """

        self._boot_id = boot_id

    @property
    def kernel_version(self):
        """
        Gets the kernel_version of this V1NodeSystemInfo.
        Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).

        :return: The kernel_version of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._kernel_version

    @kernel_version.setter
    def kernel_version(self, kernel_version):
        """
        Sets the kernel_version of this V1NodeSystemInfo.
        Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).

        :param kernel_version: The kernel_version of this V1NodeSystemInfo.
        :type: str
        """

        self._kernel_version = kernel_version

    @property
    def os_image(self):
        """
        Gets the os_image of this V1NodeSystemInfo.
        OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).

        :return: The os_image of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._os_image

    @os_image.setter
    def os_image(self, os_image):
        """
        Sets the os_image of this V1NodeSystemInfo.
        OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).

        :param os_image: The os_image of this V1NodeSystemInfo.
        :type: str
        """

        self._os_image = os_image

    @property
    def container_runtime_version(self):
        """
        Gets the container_runtime_version of this V1NodeSystemInfo.
        ContainerRuntime Version reported by the node through runtime remote API (e.g. docker://1.5.0).

        :return: The container_runtime_version of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._container_runtime_version

    @container_runtime_version.setter
    def container_runtime_version(self, container_runtime_version):
        """
        Sets the container_runtime_version of this V1NodeSystemInfo.
        ContainerRuntime Version reported by the node through runtime remote API (e.g. docker://1.5.0).

        :param container_runtime_version: The container_runtime_version of this V1NodeSystemInfo.
        :type: str
        """

        self._container_runtime_version = container_runtime_version

    @property
    def kubelet_version(self):
        """
        Gets the kubelet_version of this V1NodeSystemInfo.
        Kubelet Version reported by the node.

        :return: The kubelet_version of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._kubelet_version

    @kubelet_version.setter
    def kubelet_version(self, kubelet_version):
        """
        Sets the kubelet_version of this V1NodeSystemInfo.
        Kubelet Version reported by the node.

        :param kubelet_version: The kubelet_version of this V1NodeSystemInfo.
        :type: str
        """

        self._kubelet_version = kubelet_version

    @property
    def kube_proxy_version(self):
        """
        Gets the kube_proxy_version of this V1NodeSystemInfo.
        KubeProxy Version reported by the node.

        :return: The kube_proxy_version of this V1NodeSystemInfo.
        :rtype: str
        """
        return self._kube_proxy_version

    @kube_proxy_version.setter
    def kube_proxy_version(self, kube_proxy_version):
        """
        Sets the kube_proxy_version of this V1NodeSystemInfo.
        KubeProxy Version reported by the node.

        :param kube_proxy_version: The kube_proxy_version of this V1NodeSystemInfo.
        :type: str
        """

        self._kube_proxy_version = kube_proxy_version

    def to_dict(self):
        """
        Returns the model properties as a dict
        """
        result = {}

        for attr, _ in iteritems(V1NodeSystemInfo.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return pformat(self.to_dict())

    def __repr__(self):
        """
        For `print` and `pprint`
        """
        return self.to_str()

    def __eq__(self, other):
        """
        Returns true if both objects are equal
        """
        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other


text:
package org.apache.druid.storage.aliyun;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.CopyObjectRequest;
import com.aliyun.oss.model.ListObjectsRequest;
import com.aliyun.oss.model.OSSObjectSummary;
import com.aliyun.oss.model.ObjectListing;
import com.aliyun.oss.model.StorageClass;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.inject.Inject;
import org.apache.druid.java.util.common.IOE;
import org.apache.druid.java.util.common.ISE;
import org.apache.druid.java.util.common.MapUtils;
import org.apache.druid.java.util.common.RetryUtils;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.segment.loading.DataSegmentMover;
import org.apache.druid.segment.loading.DataSegmentPusher;
import org.apache.druid.segment.loading.SegmentLoadingException;
import org.apache.druid.timeline.DataSegment;

import java.io.IOException;
import java.util.Map;

public class OssDataSegmentMover implements DataSegmentMover
{
  private static final Logger log = new Logger(OssDataSegmentMover.class);

  /**
   * Any implementation of DataSegmentMover is initialized when an ingestion job starts if the extension is loaded
   * even when the implementation of DataSegmentMover is not used. As a result, if we accept an OSS client instead
   * of a supplier of it, it can cause unnecessary config validation for OSS even when it's not used at all.
   * To perform the config validation only when it is actually used, we use a supplier.
   *
   * See OmniDataSegmentMover for how DataSegmentMovers are initialized.
   */
  private final Supplier<OSS> clientSupplier;
  private final OssStorageConfig config;

  @Inject
  public OssDataSegmentMover(
      Supplier<OSS> client,
      OssStorageConfig config
  )
  {
    this.clientSupplier = client;
    this.config = config;
  }

  @Override
  public DataSegment move(DataSegment segment, Map<String, Object> targetLoadSpec) throws SegmentLoadingException
  {
    try {
      Map<String, Object> loadSpec = segment.getLoadSpec();
      String bucket = MapUtils.getString(loadSpec, "bucket");
      String key = MapUtils.getString(loadSpec, "key");

      final String targetBucket = MapUtils.getString(targetLoadSpec, "bucket");
      final String targetKey = MapUtils.getString(targetLoadSpec, "baseKey");

      final String targetPath = OssUtils.constructSegmentPath(
          targetKey,
          DataSegmentPusher.getDefaultStorageDir(segment, false)
      );

      if (targetBucket.isEmpty()) {
        throw new SegmentLoadingException("Target OSS bucket is not specified");
      }
      if (targetPath.isEmpty()) {
        throw new SegmentLoadingException("Target OSS baseKey is not specified");
      }

      safeMove(bucket, key, targetBucket, targetPath);

      return segment.withLoadSpec(
          ImmutableMap.<String, Object>builder()
              .putAll(
                  Maps.filterKeys(
                      loadSpec,
                      new Predicate<String>()
                      {
                        @Override
                        public boolean apply(String input)
                        {
                          return !("bucket".equals(input) || "key".equals(input));
                        }
                      }
                  )
              )
              .put("bucket", targetBucket)
              .put("key", targetPath)
              .build()
      );
    }
    catch (OSSException e) {
      throw new SegmentLoadingException(e, "Unable to move segment[%s]: [%s]", segment.getId(), e);
    }
  }

  private void safeMove(
      final String srcBucket,
      final String srcPath,
      final String targetBucket,
      final String targetPath
  ) throws SegmentLoadingException
  {
    try {
      OssUtils.retry(
          () -> {
            final String copyMsg = StringUtils.format(
                "[%s://%s/%s] to [%s://%s/%s]",
                OssStorageDruidModule.SCHEME,
                srcBucket,
                srcPath,
                OssStorageDruidModule.SCHEME,
                targetBucket,
                targetPath
            );
            try {
              selfCheckingMove(srcBucket, targetBucket, srcPath, targetPath, copyMsg);
              return null;
            }
            catch (OSSException | IOException | SegmentLoadingException e) {
              log.info(e, "Error while trying to move " + copyMsg);
              throw e;
            }
          }
      );
    }
    catch (Exception e) {
      Throwables.propagateIfInstanceOf(e, OSSException.class);
      Throwables.propagateIfInstanceOf(e, SegmentLoadingException.class);
      throw new RuntimeException(e);
    }
  }

  /**
   * Copies an object and after that checks that the object is present at the target location, via a separate API call.
   * If it is not, an exception is thrown, and the object is not deleted at the old location. This "paranoic" check
   * is added after it was observed that oss may report a successful move, and the object is not found at the target
   * location.
   */
  private void selfCheckingMove(
      String srcBucket,
      String dstBucket,
      String srcPath,
      String dstPath,
      String copyMsg
  ) throws IOException, SegmentLoadingException
  {
    if (srcBucket.equals(dstBucket) && srcPath.equals(dstPath)) {
      log.info("No need to move file[%s://%s/%s] onto itself", OssStorageDruidModule.SCHEME, srcBucket, srcPath);
      return;
    }
    final OSS client = this.clientSupplier.get();
    if (client.doesObjectExist(srcBucket, srcPath)) {
      final ObjectListing listResult = client.listObjects(
          new ListObjectsRequest(srcBucket, srcPath, null, null, 1)
      );
      // Using getObjectSummaries().size() instead of getKeyCount as, in some cases
      // it is observed that even though the getObjectSummaries returns some data
      // keyCount is still zero.
      if (listResult.getObjectSummaries().size() == 0) {
        // should never happen
        throw new ISE("Unable to list object [%s://%s/%s]", OssStorageDruidModule.SCHEME, srcBucket, srcPath);
      }
      final OSSObjectSummary objectSummary = listResult.getObjectSummaries().get(0);
      if (objectSummary.getStorageClass() != null &&
          objectSummary.getStorageClass().equals(StorageClass.IA.name())) {
        throw new OSSException(
            StringUtils.format(
                "Cannot move file[%s://%s/%s] of storage class glacier, skipping.",
                OssStorageDruidModule.SCHEME,
                srcBucket,
                srcPath
            )
        );
      } else {
        log.info("Moving file %s", copyMsg);
        final CopyObjectRequest copyRequest = new CopyObjectRequest(srcBucket, srcPath, dstBucket, dstPath);
        client.copyObject(copyRequest);
        if (!client.doesObjectExist(dstBucket, dstPath)) {
          throw new IOE(
              "After copy was reported as successful the file doesn't exist in the target location [%s]",
              copyMsg
          );
        }
        deleteWithRetriesSilent(srcBucket, srcPath);
        log.debug("Finished moving file %s", copyMsg);
      }
    } else {
      // ensure object exists in target location
      if (client.doesObjectExist(dstBucket, dstPath)) {
        log.info(
            "Not moving file [%s://%s/%s], already present in target location [%s://%s/%s]",
            OssStorageDruidModule.SCHEME,
            srcBucket,
            srcPath,
            OssStorageDruidModule.SCHEME,
            dstBucket,
            dstPath
        );
      } else {
        throw new SegmentLoadingException(
            "Unable to move file %s, not present in either source or target location",
            copyMsg
        );
      }
    }
  }

  private void deleteWithRetriesSilent(final String bucket, final String path)
  {
    try {
      deleteWithRetries(bucket, path);
    }
    catch (Exception e) {
      log.error(e, "Failed to delete file [%s://%s/%s], giving up", OssStorageDruidModule.SCHEME, bucket, path);
    }
  }

  private void deleteWithRetries(final String bucket, final String path) throws Exception
  {
    RetryUtils.retry(
        () -> {
          try {
            clientSupplier.get().deleteObject(bucket, path);
            return null;
          }
          catch (Exception e) {
            log.info(e, "Error while trying to delete [%s://%s/%s]", OssStorageDruidModule.SCHEME, bucket, path);
            throw e;
          }
        },
        OssUtils.RETRYABLE,
        3
    );
  }
}


text:
#ifndef __ASM_PLAT_ATA_CORE_H
#define __ASM_PLAT_ATA_CORE_H __FILE__

/* These functions are only for use with the core support code, such as
 * the cpu specific initialisation code
*/

/* re-define device name depending on support. */
static inline void s3c_cfcon_setname(char *name)
{
#ifdef CONFIG_SAMSUNG_DEV_IDE
	s3c_device_cfcon.name = name;
#endif
}

#endif /* __ASM_PLAT_ATA_CORE_H */


text:
using namespace dc;

//------------------------------------------------------------------------------------------------
// Name:  dcIndex32
// Desc:  Initializes the class
//------------------------------------------------------------------------------------------------
dcIndex32::dcIndex32()
{
    myValue = 0;
}

//------------------------------------------------------------------------------------------------
// Name: toString
// Desc: Gets a string representation of this class type
//------------------------------------------------------------------------------------------------
std::string dcIndex32::toString() const
{
    char stringValue[16];
    sprintf_s( stringValue, sizeof(stringValue), "%lu", myValue );
    return stringValue;
}

//----[  interpret  ]----------------------------------------------------------
void dcIndex32::interpret(const char* string) {
  int i;
  sscanf_s(string, "%i", &i);
  myValue = i;
}

//------------------------------------------------------------------------------------------------
// Name:  staticTypeName
// Desc:  Obtains the name of this class type
//------------------------------------------------------------------------------------------------
std::string dcIndex32::staticTypeName()
{
    return "Index32";
}


text:
package com.michaelfotiadis.steam.data.steam;

import java.io.Serializable;

public interface SteamApiModel extends Serializable {
    // Marker Interface
}


text:
@echo off
call dobuild_env.bat

call dobuild_single SharpTemplate 4.0 net40
call dobuild_single SharpTemplate 4.5 net45
call dobuild_nuget SharpTemplate

call dobuild_clean
pause


text:
<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "comment".
 *
 * @property integer $id
 * @property string $content
 * @property integer $status
 * @property integer $create_time
 * @property string $update_time
 * @property integer $userid
 * @property string $email
 * @property string $url
 * @property integer $post_id
 *
 * @property Post $post
 * @property Commentstatus $status0
 * @property User $user
 */
class Comment extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'comment';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['content', 'status', 'userid', 'email', 'post_id'], 'required'],
            [['content'], 'string'],
            [['status', 'create_time', 'userid', 'post_id'], 'integer'],
            [['email', 'url'], 'string', 'max' => 128],
            [['post_id'], 'exist', 'skipOnError' => true, 'targetClass' => Post::className(), 'targetAttribute' => ['post_id' => 'id']],
            [['status'], 'exist', 'skipOnError' => true, 'targetClass' => Commentstatus::className(), 'targetAttribute' => ['status' => 'id']],
            [['userid'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['userid' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'content' => '内容',
            'status' => '状态',
            'create_time' => '评论时间',
            'update_time' => '审核时间',
            'userid' => '用户id',
            'email' => '邮箱',
            'url' => '链接',
            'post_id' => '文章 ID',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getPost()
    {
        return $this->hasOne(Post::className(), ['id' => 'post_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getStatus0()
    {
        return $this->hasOne(Commentstatus::className(), ['id' => 'status']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUser()
    {
        return $this->hasOne(User::className(), ['id' => 'userid']);
    }

    //评论列表页面处理评论内容最多显示20个字符
    public function getContentStr ()
    {
        $temStr = strip_tags($this->content);
        $temLen = mb_strlen($temStr);
        return mb_substr($temStr, 0, 10, 'utf-8').(($temLen>10) ? '…' : '');
    }

    public function approve()
    {
        $this->status = 2; //设置评论状态为审核
        return $this->save() ? true : false;
    }

    public static function getPendingCommentCount()
    {
        return Comment::find()->where(['status'=>1])->count();
    }

    // 更新时间
    public function beforeSave($insert)
    {
        if (parent::beforeSave($insert)){
            $this->update_time = time();
            return true;
        }else{
            return false;
        }
    }

    // 获取最新十条评论
    public static function findRecentComments($limit = 10)
    {
        $data = Comment::find()
            ->where(['status'=>2]) //通过审核的
            ->orderBy('create_time desc')
            ->limit($limit)
            ->all();
        return $data;
    }
}


text:
package in.thekreml.plugins.gpio.api;

import org.restlet.Component;
import org.restlet.Restlet;
import org.restlet.data.Protocol;
import org.restlet.routing.VirtualHost;

public class ServerComponent extends Component {
	private static final Integer apiPort = 44567;
	//private static final Integer managerPort = 44765;
	private static final String  hostName = "localhost|127.0.0.1";

	public ServerComponent() {
		//getLogService().setLoggerName("");
		getServers().add(Protocol.HTTP, apiPort);
		getClients().add(Protocol.FILE);
	}

	public void enableAPI() {
		addVirtualHost("API", hostName, apiPort, new ApiRestlet());
	}

	public void enableManager() {
		//addVirtualHost("Manager", hostName, apiPort, new ManagerRestlet());
	}

	private void addVirtualHost(String name, String hostName, Integer port, Restlet restlet) {
		VirtualHost vhost = new VirtualHost(getContext());
		vhost.setName(name);
		vhost.setHostDomain(hostName);
		vhost.setHostPort(port.toString());
		vhost.attach(restlet);
		getHosts().add(vhost);
	}
}


text:
package io.yawp.repository.models.basic;

import java.io.Serializable;

public class Pojo implements Serializable {

    private static final long serialVersionUID = 7597296508950375357L;

    private String stringValue;

    private Long longValue;

    public Pojo() {
    }

    public Pojo(String stringValue) {
        this.stringValue = stringValue;
    }

    public String getStringValue() {
        return stringValue;
    }

    public void setStringValue(String stringValue) {
        this.stringValue = stringValue;
    }

    public Long getLongValue() {
        return longValue;
    }

    public void setLongValue(Long longValue) {
        this.longValue = longValue;
    }
}


text:
#include "StInternal.h"

//
// Acquires the spin lock when it is seen as busy.
//

VOID
FASTCALL
SlowAcquireSpinLock (
    __inout PSPINLOCK Lock
    )
{
    ST_PARKER Parker;
    PST_PARKER State;
    ULONG SpinCount;

    do {

        //
        // Try to acquire spinning for the specified number of cycles.
        //

        SpinCount = Lock->SpinCount;
        do {
            if ((State = Lock->State) == SL_FREE) {
                if  (CasPointer(&Lock->State, SL_FREE, SL_BUSY)) {
                    return;
                }
                continue;
            }

            //
            // If the spinlock's queue isn't empty, we stop spinning.
            //

            if (State != SL_BUSY || SpinCount-- == 0) {
                break;
            }
            SpinWait(1);
        } while (TRUE);

        //
        // Initialize a locked parker and insert in the lock's queue,
        // but only if the lock remains busy.
        //

        InitializeParker(&Parker, 0);
        do {
            if ((State = Lock->State) == SL_FREE) {
                if  (CasPointer(&Lock->State, SL_FREE, SL_BUSY)) {
                    return;
                }
                continue;
            }
            Parker.Next = State;
            if  (CasPointer(&Lock->State, State, &Parker)) {
                break;
            }
        } while (TRUE);

        //
        // Park unconditionally the current thread and, after it is released,
        // retry the spinlock acquire.
        //

        ParkThread(&Parker);
    } while (TRUE);
}

//
// Releases the spinlock waiters.
//

VOID
FASTCALL
ReleaseSpinLockWaiters (
    __inout PST_PARKER WaitList
    )
{
    PST_PARKER Next;
    PST_PARKER WakeStackTop;

    //
    // Build a stack with the waiting threads in order to unpark
    // them by its lock arrival order.
    //

    WakeStackTop = NULL;
    do {
        Next = WaitList->Next;
        WaitList->Next = WakeStackTop;
        WakeStackTop = WaitList;
    } while ((WaitList = Next) != SL_BUSY);

    do {
        Next = WakeStackTop->Next;
        UnparkThread(WakeStackTop, WAIT_SUCCESS);
    } while ((WakeStackTop = Next) != NULL);
}


text:
namespace TestCases.SS.Formula.PTG
{

    using System;
    using System.IO;
    using NUnit.Framework;
    using NPOI.HSSF.Model;
    using NPOI.HSSF.UserModel;
    using NPOI.SS.Formula.PTG;
    using NPOI.SS.UserModel;
    using TestCases.HSSF;
    /**
     * Tests for functions from external workbooks (e.g. YEARFRAC).
     *
     *
     * @author Josh Micich
     */
    [TestFixture]
    public class TestExternalFunctionFormulas
    {

        /**
         * Tests <c>NameXPtg.ToFormulaString(Workbook)</c> and logic in Workbook below that
         */
        [Test]
        public void TestReadFormulaContainingExternalFunction()
        {
            HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("externalFunctionExample.xls");

            String expectedFormula = "YEARFRAC(B1,C1)";
            ISheet sht = wb.GetSheetAt(0);
            String cellFormula = sht.GetRow(0).GetCell(0).CellFormula;
            Assert.AreEqual(expectedFormula, cellFormula);
        }
        [Test]
        public void TestParse()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

            HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("externalFunctionExample.xls");
            Ptg[] ptgs = HSSFFormulaParser.Parse("YEARFRAC(B1,C1)", wb);
            Assert.AreEqual(4, ptgs.Length);
            Assert.AreEqual(typeof(NameXPtg), ptgs[0].GetType());

            wb.GetSheetAt(0).GetRow(0).CreateCell(6).CellFormula = ("YEARFRAC(C1,B1)");
#if !HIDE_UNREACHABLE_CODE
            if (false)
            {
                // In case you fancy Checking in excel
                try
                {
                    FileStream tempFile = File.Create("testExtFunc.xls");
                    //FileOutputStream fout = new FileOutputStream(tempFile);
                    wb.Write(tempFile);
                    tempFile.Close();
                    //Console.WriteLine("check out " + tempFile.getAbsolutePath());
                }
                catch (IOException e)
                {
                    throw e;
                }
            }
#endif
        }
        [Test]
        public void TestEvaluate()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

            HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("externalFunctionExample.xls");
            ISheet sheet = wb.GetSheetAt(0);
            HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
            ConfirmCellEval(sheet, 0, 0, fe, "YEARFRAC(B1,C1)", 29.0 / 90.0);
            ConfirmCellEval(sheet, 1, 0, fe, "YEARFRAC(B2,C2)", 0.0);
            ConfirmCellEval(sheet, 2, 0, fe, "YEARFRAC(B3,C3,D3)", 0.0);
            ConfirmCellEval(sheet, 3, 0, fe, "IF(ISEVEN(3),1.2,1.6)", 1.6);
            ConfirmCellEval(sheet, 4, 0, fe, "IF(ISODD(3),1.2,1.6)", 1.2);
        }

        private static void ConfirmCellEval(ISheet sheet, int rowIx, int colIx,
                HSSFFormulaEvaluator fe, String expectedFormula, double expectedResult)
        {
            ICell cell = sheet.GetRow(rowIx).GetCell(colIx);
            Assert.AreEqual(expectedFormula, cell.CellFormula);
            CellValue cv = fe.Evaluate(cell);
            Assert.AreEqual(expectedResult, cv.NumberValue, 0.0);
        }
    }

}


text:
package com.sedmelluq.discord.lavaplayer.container;

import java.util.List;

public class MediaContainerRegistry {
  public static final MediaContainerRegistry DEFAULT_REGISTRY = new MediaContainerRegistry(MediaContainer.asList());

  private final List<MediaContainerProbe> probes;

  public MediaContainerRegistry(List<MediaContainerProbe> probes) {
    this.probes = probes;
  }

  public MediaContainerProbe find(String name) {
    for (MediaContainerProbe probe : probes) {
      if (name.equals(probe.getName())) {
        return probe;
      }
    }

    return null;
  }

  public List<MediaContainerProbe> getAll() {
    return probes;
  }

  public static MediaContainerRegistry extended(MediaContainerProbe... additional) {
    List<MediaContainerProbe> probes = MediaContainer.asList();

    for (MediaContainerProbe probe : additional) {
      probes.add(probe);
    }

    return new MediaContainerRegistry(probes);
  }
}


text:
	<link rel="stylesheet" type="text/css" href="blog.css">
	<title>Jessica's Blog</title>

Around the World and Back Again

Home

Jessica Tatham

About Me

Resume

Email Jessica

Facebook

LinkedIn

Blogs

Cultural Blogs

Technical Blogs

Travel

Photography

Videos

Functional Programming vs. Object-Oriented Programming

Ruby is mostly considered to be an object-oriented programming language, although it has been debated that it still untilizes some practices used in Functional programming. Since I am still a newby in programming and don't really have enough background to make a educated arguement either way, I thought I would give you guys an idea about what each programming type is all about.

Object-Oriented Programming:
OOP utilizes methods and classes in its codes in order to create objects that have various properties while the object is in its given state. The output of a program can vary based on how it is processed through the methods.

Simple Example of OOP code:

As you can see, depending on whether you are utilizing the add method or subtract method, your output will vary.

Functional Programming:
Functional Programming can best be described as a concept which models mathmatical functions. FP has no objects or 'states', its output has no variation or side effects.

Example: I don't have any experience using functional programming, so I stole an example from a website.

I hope this was helpful :)

Posted by: Jessica Tatham

<time pubdate datetime = "2014-03-16"></time>

Web Counter