text:
package org.apache.sentry.binding.hive;

import org.apache.sentry.core.AccessURI;
import org.apache.sentry.core.Database;
import org.apache.sentry.core.Table;
import org.apache.hadoop.hive.ql.exec.Task;
import org.apache.hadoop.hive.ql.hooks.ReadEntity;
import org.apache.hadoop.hive.ql.hooks.WriteEntity;
import org.apache.hadoop.hive.ql.metadata.AuthorizationException;

import java.io.Serializable;
import java.util.List;
import java.util.Set;

public class SentryOnFailureHookContextImpl implements SentryOnFailureHookContext {

  private final String command;
  private final Set<ReadEntity> inputs;
  private final Set<WriteEntity> outputs;
  private final String userName;
  private final String ipAddress;
  private final Database database;
  private final Table table;
  private final AccessURI udfURI;
  private final AccessURI partitionURI;
  private final AuthorizationException authException;

  public SentryOnFailureHookContextImpl(String command,
      Set<ReadEntity> inputs, Set<WriteEntity> outputs, Database db,
      Table tab, AccessURI udfURI, AccessURI partitionURI,
      String userName, String ipAddress, AuthorizationException e) {
    this.command = command;
    this.inputs = inputs;
    this.outputs = outputs;
    this.userName = userName;
    this.ipAddress = ipAddress;
    this.database = db;
    this.table = tab;
    this.udfURI = udfURI;
    this.partitionURI = partitionURI;
    this.authException = e;
  }

  @Override
  public String getCommand() {
    return command;
  }

  @Override
  public Set<ReadEntity> getInputs() {
    return inputs;
  }

  @Override
  public Set<WriteEntity> getOutputs() {
    return outputs;
  }

  @Override
  public String getUserName() {
    return userName;
  }

  @Override
  public String getIpAddress() {
    return ipAddress;
  }

  @Override
  public Database getDatabase() {
    return database;
  }

  @Override
  public Table getTable() {
    return table;
  }

  @Override
  public AccessURI getUdfURI() {
    return udfURI;
  }

  @Override
  public AccessURI getPartitionURI() {
    return partitionURI;
  }

  @Override
  public AuthorizationException getException() {
    return authException;
  }
}


text:
#ifndef KHRONOS_MANGLE_H
#if defined KHRONOS_NAME_MANGLING || defined REMOTE_API_LOGGING || defined BCG_MULTI_THREADED

/* EGL Functions */

#define eglGetError mangled_eglGetError
#define eglGetDisplay mangled_eglGetDisplay
#define eglInitialize mangled_eglInitialize
#define eglTerminate mangled_eglTerminate
#define eglQueryString mangled_eglQueryString
#define eglGetConfigs mangled_eglGetConfigs
#define eglChooseConfig mangled_eglChooseConfig
#define eglGetConfigAttrib mangled_eglGetConfigAttrib
#define eglCreateWindowSurface mangled_eglCreateWindowSurface
#define eglCreatePbufferSurface mangled_eglCreatePbufferSurface
#define eglCreatePixmapSurface mangled_eglCreatePixmapSurface
#define eglDestroySurface mangled_eglDestroySurface
#define eglQuerySurface mangled_eglQuerySurface
#define eglBindAPI mangled_eglBindAPI
#define eglQueryAPI mangled_eglQueryAPI
#define eglWaitClient mangled_eglWaitClient
#define eglReleaseThread mangled_eglReleaseThread
#define eglCreatePbufferFromClientBuffer mangled_eglCreatePbufferFromClientBuffer
#define eglSurfaceAttrib mangled_eglSurfaceAttrib
#define eglBindTexImage mangled_eglBindTexImage
#define eglReleaseTexImage mangled_eglReleaseTexImage
#define eglSwapInterval mangled_eglSwapInterval
#define eglCreateContext mangled_eglCreateContext
#define eglDestroyContext mangled_eglDestroyContext
#define eglMakeCurrent mangled_eglMakeCurrent
#define eglGetCurrentContext mangled_eglGetCurrentContext
#define eglGetCurrentSurface mangled_eglGetCurrentSurface
#define eglGetCurrentDisplay mangled_eglGetCurrentDisplay
#define eglQueryContext mangled_eglQueryContext
#define eglWaitGL mangled_eglWaitGL
#define eglWaitNative mangled_eglWaitNative
#define eglSwapBuffers mangled_eglSwapBuffers
#define eglCopyBuffers mangled_eglCopyBuffers
#define eglGetProcAddress mangled_eglGetProcAddress
#define eglClientWaitSyncKHR mangled_eglClientWaitSyncKHR
#define eglCreateImageKHR mangled_eglCreateImageKHR
#define eglCreateSyncKHR mangled_eglCreateSyncKHR
#define eglDestroyImageKHR mangled_eglDestroyImageKHR
#define eglDestroySyncKHR mangled_eglDestroySyncKHR
#define eglGetSyncAttribKHR mangled_eglGetSyncAttribKHR
#define eglGetSyncAttribKHR mangled_eglGetSyncAttribKHR
#define eglQueryProfilingDataNOK mangled_eglQueryProfilingDataNOK
#define eglSignalSyncKHR mangled_eglSignalSyncKHR
#define eglLockSurfaceKHR mangled_eglLockSurfaceKHR
#define eglUnlockSurfaceKHR mangled_eglUnlockSurfaceKHR
#define glEGLImageTargetRenderbufferStorageOES mangled_glEGLImageTargetRenderbufferStorageOES
#define glEGLImageTargetTexture2DOES mangled_glEGLImageTargetTexture2DOES
#define eglAcquireGlobalImageBRCM mangled_eglAcquireGlobalImageBRCM
#define eglCreateCopyGlobalImageBRCM mangled_eglCreateCopyGlobalImageBRCM
#define eglCreateGlobalImageBRCM mangled_eglCreateGlobalImageBRCM
#define eglReleaseGlobalImageBRCM mangled_eglReleaseGlobalImageBRCM
#define eglInitGlobalImageBRCM mangled_eglInitGlobalImageBRCM
#define eglTermGlobalImageBRCM mangled_eglTermGlobalImageBRCM

/* OpenGL ES 1.1 and 2.0 functions */

#define glAlphaFunc mangled_glAlphaFunc
#define glClearColor mangled_glClearColor
#define glClearDepthf mangled_glClearDepthf
#define glClipPlanef mangled_glClipPlanef
#define glColor4f mangled_glColor4f
#define glDepthRangef mangled_glDepthRangef
#define glFogf mangled_glFogf
#define glFogfv mangled_glFogfv
#define glFrustumf mangled_glFrustumf
#define glGetClipPlanef mangled_glGetClipPlanef
#define glGetFloatv mangled_glGetFloatv
#define glGetLightfv mangled_glGetLightfv
#define glGetMaterialfv mangled_glGetMaterialfv
#define glGetTexEnvfv mangled_glGetTexEnvfv
#define glGetTexParameterfv mangled_glGetTexParameterfv
#define glLightModelf mangled_glLightModelf
#define glLightModelfv mangled_glLightModelfv
#define glLightf mangled_glLightf
#define glLightfv mangled_glLightfv
#define glLineWidth mangled_glLineWidth
#define glLoadMatrixf mangled_glLoadMatrixf
#define glMaterialf mangled_glMaterialf
#define glMaterialfv mangled_glMaterialfv
#define glMultMatrixf mangled_glMultMatrixf
#define glMultiTexCoord4f mangled_glMultiTexCoord4f
#define glNormal3f mangled_glNormal3f
#define glOrthof mangled_glOrthof
#define glPointParameterf mangled_glPointParameterf
#define glPointParameterfv mangled_glPointParameterfv
#define glPointSize mangled_glPointSize
#define glPolygonOffset mangled_glPolygonOffset
#define glRotatef mangled_glRotatef
#define glScalef mangled_glScalef
#define glTexEnvf mangled_glTexEnvf
#define glTexEnvfv mangled_glTexEnvfv
#define glTexParameterf mangled_glTexParameterf
#define glTexParameterfv mangled_glTexParameterfv
#define glTranslatef mangled_glTranslatef

#define glActiveTexture mangled_glActiveTexture
#define glAlphaFuncx mangled_glAlphaFuncx
#define glBindBuffer mangled_glBindBuffer
#define glBindTexture mangled_glBindTexture
#define glBlendFunc mangled_glBlendFunc
#define glBlendColor mangled_glBlendColor
#define glBufferData mangled_glBufferData
#define glBlendEquation mangled_glBlendEquation
#define glBufferSubData mangled_glBufferSubData
#define glClear mangled_glClear
#define glClearColorx mangled_glClearColorx
#define glClearDepthx mangled_glClearDepthx
#define glClearStencil mangled_glClearStencil
#define glClientActiveTexture mangled_glClientActiveTexture
#define glClipPlanex mangled_glClipPlanex
#define glColor4ub mangled_glColor4ub
#define glColor4x mangled_glColor4x
#define glColorMask mangled_glColorMask
#define glColorPointer mangled_glColorPointer
#define glCompressedTexImage2D mangled_glCompressedTexImage2D
#define glCompressedTexSubImage2D mangled_glCompressedTexSubImage2D
#define glCopyTexImage2D mangled_glCopyTexImage2D
#define glCopyTexSubImage2D mangled_glCopyTexSubImage2D
#define glCullFace mangled_glCullFace
#define glDeleteBuffers mangled_glDeleteBuffers
#define glDeleteTextures mangled_glDeleteTextures
#define glDepthFunc mangled_glDepthFunc
#define glDepthMask mangled_glDepthMask
#define glDepthRangex mangled_glDepthRangex
#define glDisable mangled_glDisable
#define glDisableClientState mangled_glDisableClientState
#define glDrawArrays mangled_glDrawArrays
#define glDrawElements mangled_glDrawElements
#define glEnable mangled_glEnable
#define glEnableClientState mangled_glEnableClientState
#define glFinish mangled_glFinish
#define glFlush mangled_glFlush
#define glFogx mangled_glFogx
#define glFogxv mangled_glFogxv
#define glFrontFace mangled_glFrontFace
#define glFrustumx mangled_glFrustumx
#define glGetBooleanv mangled_glGetBooleanv
#define glGetBufferParameteriv mangled_glGetBufferParameteriv
#define glGetClipPlanex mangled_glGetClipPlanex
#define glGenBuffers mangled_glGenBuffers
#define glGenTextures mangled_glGenTextures
#define glGetError mangled_glGetError
#define glGetFixedv mangled_glGetFixedv
#define glGetIntegerv mangled_glGetIntegerv
#define glGetLightxv mangled_glGetLightxv
#define glGetMaterialxv mangled_glGetMaterialxv
#define glGetPointerv mangled_glGetPointerv
#define glGetString mangled_glGetString
#define glGetTexEnviv mangled_glGetTexEnviv
#define glGetTexEnvxv mangled_glGetTexEnvxv
#define glGetTexParameteriv mangled_glGetTexParameteriv
#define glGetTexParameterxv mangled_glGetTexParameterxv
#define glHint mangled_glHint
#define glIsBuffer mangled_glIsBuffer
#define glIsEnabled mangled_glIsEnabled
#define glIsTexture mangled_glIsTexture
#define glLightModelx mangled_glLightModelx
#define glLightModelxv mangled_glLightModelxv
#define glLightx mangled_glLightx
#define glLightxv mangled_glLightxv
#define glLineWidthx mangled_glLineWidthx
#define glLoadIdentity mangled_glLoadIdentity
#define glLoadMatrixx mangled_glLoadMatrixx
#define glLogicOp mangled_glLogicOp
#define glMaterialx mangled_glMaterialx
#define glMaterialxv mangled_glMaterialxv
#define glMatrixMode mangled_glMatrixMode
#define glMultMatrixx mangled_glMultMatrixx
#define glMultiTexCoord4x mangled_glMultiTexCoord4x
#define glNormal3x mangled_glNormal3x
#define glNormalPointer mangled_glNormalPointer
#define glOrthox mangled_glOrthox
#define glPixelStorei mangled_glPixelStorei
#define glPointParameterx mangled_glPointParameterx
#define glPointParameterxv mangled_glPointParameterxv
#define glPointSizex mangled_glPointSizex
#define glPolygonOffsetx mangled_glPolygonOffsetx
#define glPopMatrix mangled_glPopMatrix
#define glPushMatrix mangled_glPushMatrix
#define glReadPixels mangled_glReadPixels
#define glRotatex mangled_glRotatex
#define glSampleCoverage mangled_glSampleCoverage
#define glSampleCoveragex mangled_glSampleCoveragex
#define glScalex mangled_glScalex
#define glScissor mangled_glScissor
#define glShadeModel mangled_glShadeModel
#define glStencilFunc mangled_glStencilFunc
#define glStencilMask mangled_glStencilMask
#define glStencilOp mangled_glStencilOp
#define glTexCoordPointer mangled_glTexCoordPointer
#define glTexEnvi mangled_glTexEnvi
#define glTexEnvx mangled_glTexEnvx
#define glTexEnviv mangled_glTexEnviv
#define glTexEnvxv mangled_glTexEnvxv
#define glTexImage2D mangled_glTexImage2D
#define glTexParameteri mangled_glTexParameteri
#define glTexParameterx mangled_glTexParameterx
#define glTexParameteriv mangled_glTexParameteriv
#define glTexParameterxv mangled_glTexParameterxv
#define glTexSubImage2D mangled_glTexSubImage2D
#define glTranslatex mangled_glTranslatex
#define glVertexPointer mangled_glVertexPointer
#define glViewport mangled_glViewport

#define glAttachShader mangled_glAttachShader
#define glBindAttribLocation mangled_glBindAttribLocation
#define glBlendEquationSeparate mangled_glBlendEquationSeparate
#define glBlendFuncSeparate mangled_glBlendFuncSeparate
#define glCreateProgram mangled_glCreateProgram
#define glCreateShader mangled_glCreateShader
#define glDeleteProgram mangled_glDeleteProgram
#define glDeleteShader mangled_glDeleteShader
#define glDetachShader mangled_glDetachShader
#define glDisableVertexAttribArray mangled_glDisableVertexAttribArray
#define glEnableVertexAttribArray mangled_glEnableVertexAttribArray
#define glGetActiveAttrib mangled_glGetActiveAttrib
#define glGetActiveUniform mangled_glGetActiveUniform
#define glGetAttachedShaders mangled_glGetAttachedShaders
#define glGetAttribLocation mangled_glGetAttribLocation
#define glGetProgramiv mangled_glGetProgramiv
#define glGetProgramInfoLog mangled_glGetProgramInfoLog
#define glGetUniformfv mangled_glGetUniformfv
#define glGetUniformiv mangled_glGetUniformiv
#define glGetUniformLocation mangled_glGetUniformLocation
#define glGetVertexAttribfv mangled_glGetVertexAttribfv
#define glGetVertexAttribiv mangled_glGetVertexAttribiv
#define glGetVertexAttribPointerv mangled_glGetVertexAttribPointerv
#define glIsProgram mangled_glIsProgram
#define glIsShader mangled_glIsShader
#define glLinkProgram mangled_glLinkProgram
#define glStencilFuncSeparate mangled_glStencilFuncSeparate
#define glStencilMaskSeparate mangled_glStencilMaskSeparate
#define glStencilOpSeparate mangled_glStencilOpSeparate
#define glUniform1i mangled_glUniform1i
#define glUniform2i mangled_glUniform2i
#define glUniform3i mangled_glUniform3i
#define glUniform4i mangled_glUniform4i
#define glUniform1f mangled_glUniform1f
#define glUniform2f mangled_glUniform2f
#define glUniform3f mangled_glUniform3f
#define glUniform4f mangled_glUniform4f
#define glUniform1iv mangled_glUniform1iv
#define glUniform2iv mangled_glUniform2iv
#define glUniform3iv mangled_glUniform3iv
#define glUniform4iv mangled_glUniform4iv
#define glUniform1fv mangled_glUniform1fv
#define glUniform2fv mangled_glUniform2fv
#define glUniform3fv mangled_glUniform3fv
#define glUniform4fv mangled_glUniform4fv
#define glUniformMatrix2fv mangled_glUniformMatrix2fv
#define glUniformMatrix3fv mangled_glUniformMatrix3fv
#define glUniformMatrix4fv mangled_glUniformMatrix4fv
#define glUseProgram mangled_glUseProgram
#define glValidateProgram mangled_glValidateProgram
#define glVertexAttrib1f mangled_glVertexAttrib1f
#define glVertexAttrib2f mangled_glVertexAttrib2f
#define glVertexAttrib3f mangled_glVertexAttrib3f
#define glVertexAttrib4f mangled_glVertexAttrib4f
#define glVertexAttrib1fv mangled_glVertexAttrib1fv
#define glVertexAttrib2fv mangled_glVertexAttrib2fv
#define glVertexAttrib3fv mangled_glVertexAttrib3fv
#define glVertexAttrib4fv mangled_glVertexAttrib4fv
#define glVertexAttribPointer mangled_glVertexAttribPointer
#define glCompileShader mangled_glCompileShader
#define glGetShaderiv mangled_glGetShaderiv
#define glGetShaderInfoLog mangled_glGetShaderInfoLog
#define glGetShaderSource mangled_glGetShaderSource
#define glReleaseShaderCompiler mangled_glReleaseShaderCompiler
#define glShaderSource mangled_glShaderSource
#define glShaderBinary mangled_glShaderBinary
#define glGetShaderPrecisionFormat mangled_glGetShaderPrecisionFormat
#define glIsRenderbuffer mangled_glIsRenderbuffer
#define glBindRenderbuffer mangled_glBindRenderbuffer
#define glDeleteRenderbuffers mangled_glDeleteRenderbuffers
#define glGenRenderbuffers mangled_glGenRenderbuffers
#define glRenderbufferStorage mangled_glRenderbufferStorage
#define glGetRenderbufferParameteriv mangled_glGetRenderbufferParameteriv
#define glIsFramebuffer mangled_glIsFramebuffer
#define glBindFramebuffer mangled_glBindFramebuffer
#define glDeleteFramebuffers mangled_glDeleteFramebuffers
#define glGenFramebuffers mangled_glGenFramebuffers
#define glCheckFramebufferStatus mangled_glCheckFramebufferStatus
#define glFramebufferTexture2D mangled_glFramebufferTexture2D
#define glFramebufferRenderbuffer mangled_glFramebufferRenderbuffer
#define glGetFramebufferAttachmentParameteriv mangled_glGetFramebufferAttachmentParameteriv
#define glGenerateMipmap mangled_glGenerateMipmap

#define glPointSizePointerOES mangled_glPointSizePointerOES
#define glDiscardFramebufferEXT mangled_glDiscardFramebufferEXT
#define glInsertEventMarkerEXT mangled_glInsertEventMarkerEXT
#define glPushGroupMarkerEXT mangled_glPushGroupMarkerEXT
#define glPopGroupMarkerEXT mangled_glPopGroupMarkerEXT

#define glDrawTexfOES mangled_glDrawTexfOES
#define glDrawTexfvOES mangled_glDrawTexfvOES
#define glDrawTexiOES mangled_glDrawTexiOES
#define glDrawTexivOES mangled_glDrawTexivOES
#define glDrawTexsOES mangled_glDrawTexsOES
#define glDrawTexsvOES mangled_glDrawTexsvOES
#define glDrawTexxOES mangled_glDrawTexxOES
#define glDrawTexxvOES mangled_glDrawTexxvOES

#define glIsRenderbufferOES mangled_glIsRenderbufferOES
#define glBindRenderbufferOES mangled_glBindRenderbufferOES
#define glDeleteRenderbuffersOES mangled_glDeleteRenderbuffersOES
#define glGenRenderbuffersOES mangled_glGenRenderbuffersOES
#define glRenderbufferStorageOES mangled_glRenderbufferStorageOES
#define glGetRenderbufferParameterivOES mangled_glGetRenderbufferParameterivOES
#define glIsFramebufferOES mangled_glIsFramebufferOES
#define glBindFramebufferOES mangled_glBindFramebufferOES
#define glDeleteFramebuffersOES mangled_glDeleteFramebuffersOES
#define glGenFramebuffersOES mangled_glGenFramebuffersOES
#define glCheckFramebufferStatusOES mangled_glCheckFramebufferStatusOES
#define glFramebufferRenderbufferOES mangled_glFramebufferRenderbufferOES
#define glFramebufferTexture2DOES mangled_glFramebufferTexture2DOES
#define glGetFramebufferAttachmentParameterivOES mangled_glGetFramebufferAttachmentParameterivOES
#define glGenerateMipmapOES mangled_glGenerateMipmapOES

#endif

#if defined KHRONOS_NAME_MANGLING || defined BCG_MULTI_THREADED

#define vgCreateEGLImageTargetKHR mangled_vgCreateEGLImageTargetKHR

#define vgGetError mangled_vgGetError
#define vgFlush mangled_vgFlush
#define vgFinish mangled_vgFinish
#define vgSetf mangled_vgSetf
#define vgSeti mangled_vgSeti
#define vgSetfv mangled_vgSetfv
#define vgSetiv mangled_vgSetiv
#define vgGetf mangled_vgGetf
#define vgGeti mangled_vgGeti
#define vgGetVectorSize mangled_vgGetVectorSize
#define vgGetfv mangled_vgGetfv
#define vgGetiv mangled_vgGetiv
#define vgSetParameterf mangled_vgSetParameterf
#define vgSetParameteri mangled_vgSetParameteri
#define vgSetParameterfv mangled_vgSetParameterfv
#define vgSetParameteriv mangled_vgSetParameteriv
#define vgGetParameterf mangled_vgGetParameterf
#define vgGetParameteri mangled_vgGetParameteri
#define vgGetParameterVectorSize mangled_vgGetParameterVectorSize
#define vgGetParameterfv mangled_vgGetParameterfv
#define vgGetParameteriv mangled_vgGetParameteriv
#define vgLoadIdentity mangled_vgLoadIdentity
#define vgLoadMatrix mangled_vgLoadMatrix
#define vgGetMatrix mangled_vgGetMatrix
#define vgMultMatrix mangled_vgMultMatrix
#define vgTranslate mangled_vgTranslate
#define vgScale mangled_vgScale
#define vgShear mangled_vgShear
#define vgRotate mangled_vgRotate
#define vgMask mangled_vgMask
#define vgRenderToMask mangled_vgRenderToMask
#define vgCreateMaskLayer mangled_vgCreateMaskLayer
#define vgDestroyMaskLayer mangled_vgDestroyMaskLayer
#define vgFillMaskLayer mangled_vgFillMaskLayer
#define vgCopyMask mangled_vgCopyMask
#define vgClear mangled_vgClear
#define vgCreatePath mangled_vgCreatePath
#define vgClearPath mangled_vgClearPath
#define vgDestroyPath mangled_vgDestroyPath
#define vgRemovePathCapabilities mangled_vgRemovePathCapabilities
#define vgGetPathCapabilities mangled_vgGetPathCapabilities
#define vgAppendPath mangled_vgAppendPath
#define vgAppendPathData mangled_vgAppendPathData
#define vgModifyPathCoords mangled_vgModifyPathCoords
#define vgTransformPath mangled_vgTransformPath
#define vgInterpolatePath mangled_vgInterpolatePath
#define vgPathLength mangled_vgPathLength
#define vgPointAlongPath mangled_vgPointAlongPath
#define vgPathBounds mangled_vgPathBounds
#define vgPathTransformedBounds mangled_vgPathTransformedBounds
#define vgDrawPath mangled_vgDrawPath
#define vgCreatePaint mangled_vgCreatePaint
#define vgDestroyPaint mangled_vgDestroyPaint
#define vgSetPaint mangled_vgSetPaint
#define vgGetPaint mangled_vgGetPaint
#define vgSetColor mangled_vgSetColor
#define vgGetColor mangled_vgGetColor
#define vgPaintPattern mangled_vgPaintPattern
#define vgCreateImage mangled_vgCreateImage
#define vgDestroyImage mangled_vgDestroyImage
#define vgClearImage mangled_vgClearImage
#define vgImageSubData mangled_vgImageSubData
#define vgGetImageSubData mangled_vgGetImageSubData
#define vgChildImage mangled_vgChildImage
#define vgGetParent mangled_vgGetParent
#define vgCopyImage mangled_vgCopyImage
#define vgDrawImage mangled_vgDrawImage
#define vgSetPixels mangled_vgSetPixels
#define vgWritePixels mangled_vgWritePixels
#define vgGetPixels mangled_vgGetPixels
#define vgReadPixels mangled_vgReadPixels
#define vgCopyPixels mangled_vgCopyPixels
#define vgCreateFont mangled_vgCreateFont
#define vgDestroyFont mangled_vgDestroyFont
#define vgSetGlyphToPath mangled_vgSetGlyphToPath
#define vgSetGlyphToImage mangled_vgSetGlyphToImage
#define vgClearGlyph mangled_vgClearGlyph
#define vgDrawGlyph mangled_vgDrawGlyph
#define vgDrawGlyphs mangled_vgDrawGlyphs
#define vgColorMatrix mangled_vgColorMatrix
#define vgConvolve mangled_vgConvolve
#define vgSeparableConvolve mangled_vgSeparableConvolve
#define vgGaussianBlur mangled_vgGaussianBlur
#define vgLookup mangled_vgLookup
#define vgLookupSingle mangled_vgLookupSingle
#define vgHardwareQuery mangled_vgHardwareQuery
#define vgGetString mangled_vgGetString
#define vgCreateEGLImageTargetKHR mangled_vgCreateEGLImageTargetKHR

#define vguArc mangled_vguArc
#define vguComputeWarpQuadToQuad mangled_vguComputeWarpQuadToQuad
#define vguComputeWarpQuadToSquare mangled_vguComputeWarpQuadToSquare
#define vguComputeWarpSquareToQuad mangled_vguComputeWarpSquareToQuad
#define vguEllipse mangled_vguEllipse
#define vguLine mangled_vguLine
#define vguPolygon mangled_vguPolygon
#define vguRect mangled_vguRect
#define vguRoundRect mangled_vguRoundRect

#if !defined(REMOTE_API_LOGGING) && !defined(BCG_MULTI_THREADED)
/* Internal functions */
#define egl_surface_create mangled_egl_surface_create
#define egl_surface_from_vg_image mangled_egl_surface_from_vg_image
#define egl_surface_term mangled_egl_surface_term
#define egl_surface_set_attrib mangled_egl_surface_set_attrib
#define egl_context_create mangled_egl_context_create
#define egl_context_term mangled_egl_context_term
#endif

#endif   //KHRONOS_NAME_MANGLING
#endif   //KHRONOS_MANGLED_H

redpajama_set_name: RedPajamaGithub


text:
package org.kie.pmml.commons.model;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

import org.kie.pmml.api.enums.CAST_INTEGER;
import org.kie.pmml.api.enums.OP_TYPE;
import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent;

/**
 * @see Target
 */
public class KiePMMLTarget extends AbstractKiePMMLComponent {

    private static final long serialVersionUID = -6336733489238275499L;
    private List<KiePMMLTargetValue> targetValues = null;
    private OP_TYPE opType;
    private String field;
    private CAST_INTEGER castInteger;
    private Double min = null;
    private Double max = null;
    private double rescaleConstant = 0;
    private double rescaleFactor = 1;

    private KiePMMLTarget(String name, List<KiePMMLExtension> extensions) {
        super(name, extensions);
    }

    public static Builder builder(String name, List<KiePMMLExtension> extensions) {
        return new Builder(name, extensions);
    }

    public Object modifyPrediction(Object prediction) {
        if (!(prediction instanceof Number)) {
            // TODO DROOLS-6345 TargetValue currently unimplemented - only direct number operations allowed
            return prediction;
        }
        double predictionDouble = (double) prediction;
        Number toReturn = applyMin(predictionDouble);
        toReturn = applyMax((double)toReturn);
        toReturn = applyRescaleFactor((double)toReturn);
        toReturn = applyRescaleConstant((double)toReturn);
        toReturn = applyCastInteger((double)toReturn);
        // TODO DROOLS-6345 TargetValue currently unimplemented
        return toReturn;
    }

    Double applyMin(double predictionDouble) {
        return  min != null ? Math.max(min, predictionDouble) : predictionDouble;
    }

    Double applyMax(double predictionDouble) {
        return  max != null ? Math.min(max, predictionDouble) : predictionDouble;
    }

    Double applyRescaleFactor(double predictionDouble) {
        return  predictionDouble * rescaleFactor;
    }

    Double applyRescaleConstant(double predictionDouble) {
        return  predictionDouble + rescaleConstant;
    }

    Number applyCastInteger(double predictionDouble) {
        return  castInteger != null ? castInteger.getScaledValue(predictionDouble) : predictionDouble;
    }

    public String getField() {
        return field;
    }

    public List<KiePMMLTargetValue> getTargetValues() {
        return targetValues;
    }

    public OP_TYPE getOpType() {
        return opType;
    }

    public CAST_INTEGER getCastInteger() {
        return castInteger;
    }

    public Double getMin() {
        return min;
    }

    public Double getMax() {
        return max;
    }

    public double getRescaleConstant() {
        return rescaleConstant;
    }

    public double getRescaleFactor() {
        return rescaleFactor;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        KiePMMLTarget that = (KiePMMLTarget) o;
        return Double.compare(that.rescaleConstant, rescaleConstant) == 0 && Double.compare(that.rescaleFactor,
                                                                                rescaleFactor) == 0 && Objects.equals(targetValues, that.targetValues) && opType == that.opType && Objects.equals(field, that.field) && castInteger == that.castInteger && Objects.equals(min, that.min) && Objects.equals(max, that.max);
    }

    @Override
    public int hashCode() {
        return Objects.hash(targetValues, opType, field, castInteger, min, max, rescaleConstant, rescaleFactor);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", KiePMMLTarget.class.getSimpleName() + "[", "]")
                .add("targetValues=" + targetValues)
                .add("opType=" + opType)
                .add("field='" + field + "'")
                .add("castInteger=" + castInteger)
                .add("min=" + min)
                .add("max=" + max)
                .add("rescaleConstant=" + rescaleConstant)
                .add("rescaleFactor=" + rescaleFactor)
                .add("name='" + name + "'")
                .add("extensions=" + extensions)
                .add("id='" + id + "'")
                .add("parentId='" + parentId + "'")
                .toString();
    }

    public static class Builder extends AbstractKiePMMLComponent.Builder<KiePMMLTarget> {

        private Builder(String name, List<KiePMMLExtension> extensions) {
            super("Target-", () -> new KiePMMLTarget(name, extensions));
        }

        public Builder withTargetValues(List<KiePMMLTargetValue> targetValues) {
            toBuild.targetValues = Collections.unmodifiableList(targetValues);
            return this;
        }

        public Builder withOpType(OP_TYPE opType) {
            toBuild.opType = opType;
            return this;
        }

        public Builder withField(String field) {
            toBuild.field = field;
            return this;
        }

        public Builder withCastInteger(CAST_INTEGER castInteger) {
            toBuild.castInteger = castInteger;
            return this;
        }

        public Builder withMin(double min) {
            toBuild.min = min;
            return this;
        }

        public Builder withMax(double max) {
            toBuild.max = max;
            return this;
        }

        public Builder withRescaleConstant(double rescaleConstant) {
            toBuild.rescaleConstant = rescaleConstant;
            return this;
        }

        public Builder withRescaleFactor(double rescaleFactor) {
            toBuild.rescaleFactor = rescaleFactor;
            return this;
        }

    }
}


text:
http://cqrsjourney.github.com

## Appendix 1

4th May 2012

These release notes apply to the Pseudo-Production Release (V1) of the
Contoso Conference Management System.

# Building and Running the Sample Code (RI)

This appendix describes how to obtain, build and run the RI.

These instructions describe five different scenarios for running the RI:

1. Running the application on a local web server and using a local
   message bus and event store.
2. Running the application on a local web server and using the Windows
   Azure Service Bus and an event store that uses Windows Azure table
   storage.
3. Deploying the application to the local Windows Azure compute emulator
   and using a local message bus and event store.
4. Deploying the application to the local Windows Azure compute emulator
   and using the Windows Azure Service Bus and an event store that uses
   Windows Azure table storage.
5. Deploying the application to Windows Azure and using the Windows
   Azure Service Bus and an event store that uses Windows Azure table
   storage.

> **Note 1:** The local message bus and event store use SQL Express and
> are intended to help you run the application locally for demonstration
> purposes. They are not intended to illustrate a production-ready
> scenario.

> **Note 2:** Scenarios 1,2,3 and 4 use SQL Express for other data
> storage requirements. Scenario 5 requires you to use SQL Azure instead
> of SQL Express.

# Prerequisites

Before you begin, you should install the following pre-requisites:

* Visual Studio 2010 or later
* SQL Server 2008 Express or later
* ASP.NET MVC 3 (Visual Studio 2010)
* ASP.NET MVC 4 Installer (Visual Studio 2010)
* Windows Azure SDK for .NET - November 2011 or later.

> **Note:** Currently the RI requires the Windows Azure runtime
> libraries in order to compile. This is true even for scenario 1. The
> Windows Azure SDK includes these libraries.

You can download and install all of these except for Visual Studio by
using the Web Platform Installer 4.0.

You can install the remaining dependencies from NuGet by running the
script **install-packages.ps1** included with the downloadable source.

If you plan to deploy the RI to Windows Azure, you must have a Windows
Azure subscription, a SQL Azure subscription, and a Windows Azure
Service Bus subscription. You should be aware, that depending on your
Windows Azure subscription type, you may incur usage charges when you
use the Windows Azure Service Bus, Windows Azure table storage, and when
you deploy and run the RI in Windows Azure.

At the time of writing, you can sign-up for a Windows Azure free trial
that enables you to run the RI in Windows Azure.

> **Note:** Scenario 1 enables you to run the RI locally without using
> the Windows Azure compute and storage emulators.

If you want to run the SpecFlow acceptance tests, you should also
install [SpecFlow][specflow].

# Obtaining the Code

* The source code is hosted in GitHub at
  [https://github.com/mspnp/cqrs-journey-code][source].
* On this page, by clicking on the **Zip** button, you can download a
  zip file that contains the complete repository.
* After you have downloaded the code, you should un-zip it to a suitable
  location on your hard drive.

# Creating the Databases

## SQL Express Database

For scenarios 1,2,3 and 4 you can create a local SQL Express database
called **Conference** by running the script **Install-Database.ps1** in
the scripts folder.

The projects in the solution use this database to store application
data. The SQL-based message bus and event store also use this database.

## SQL Azure Database

For scenario 5, you must create a SQL Azure database called
**Conference** by running the script **Install-Database.ps1** in
the scripts folder.

The follow command will populate a SQL Azure database called
**Conference** with the tables and views required to support the RI
(this script assumes that you have already created the **Conference**
database in SQL Azure):

```
.\Install-Database.ps1 -ServerName [your-sql-azure-server].database.windows.net -DoNotCreateDatabase -DoNotAddNetworkServiceUser -UseSqlServerAuthentication -UserName [your-sql-azure-username]
```

You must then modify the ServiceConfiguration.Cloud.cscfg file in the Conference.Azure project to use the following connection strings.

**SQL Azure Connection String**

```
Server=tcp:[your-sql-azure-server].database.windows.net;Database=myDataBase;User ID=[your-sql-azure-username]@[your-sql-azure-server];Password=[your-sql-azure-password];Trusted_Connection=False;Encrypt=True; MultipleActiveResultSets=True;
```

**Windows Azure Connection String**

```
DefaultEndpointsProtocol=https;AccountName=[your-windows-azure-storage-account-name];AccountKey=[your-windows-azure-storage-account-key]
```

**Conference.Azure\ServiceConfiguration.Cloud.cscfg**

```
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="Conference.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
  <Role name="Conference.Web.Admin">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="[your-windows-azure-connection-string]" />
      <Setting name="DbContext.ConferenceManagement" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.SqlBus" value="[your-sql-azure-connection-string] />
    </ConfigurationSettings>
  </Role>
  <Role name="Conference.Web.Public">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="[your-windows-azure-connection-string]" />
      <Setting name="DbContext.Payments" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.ConferenceRegistration" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.SqlBus" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.BlobStorage" value="[your-sql-azure-connection-string]" />
    </ConfigurationSettings>
  </Role>
  <Role name="WorkerRoleCommandProcessor">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="[your-windows-azure-connection-string]" />
      <Setting name="DbContext.Payments" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.EventStore" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.ConferenceRegistrationProcesses" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.ConferenceRegistration" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.SqlBus" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.BlobStorage" value="[your-sql-azure-connection-string]" />
      <Setting name="DbContext.ConferenceManagement" value="your-sql-azure-connection-string]" />
    </ConfigurationSettings>
  </Role>
</ServiceConfiguration>
```

# Creating the Settings.xml File

Before you can build the solution you must create a **Settings.xml** file
in the **Infrastructure Projects\Azure** solution folder. You can copy the
**Settings.Template.xml** in this solution folder to create a
**Settings.xml** file.

If you plan to use the Windows Azure Service Bus and the Windows Azure
table storage based event store then you must edit the **Settings.xml**
file in the **Infrastructure Projects\Azure** solution folder to include
details of your Windows Azure storage account and a Windows Azure
Service Bus namespace.

> **Note:** See the contents of the **Settings.Template.xml** for details
> of the configuration information that is required.

> **Note:** You cannot currently use the Windows Azure storage emulator
> for the event store. You must use a real Windows Azure storage
> account.

# Building the RI

Open the **Conference** Visual Studio solution file in the code
repository that you downloaded and un-zipped.

You can use NuGet to download and install all of the dependencies by
running the script **install-packages.ps1** before building the
solution.

## Build Configurations

The solution includes a number of build configurations. These are
described in the following sections:

### Release

Use the **Release** build configuration if you plan to deploy your
application to Windows Azure.

This solution uses the Windows Azure Service Bus to provide the
messaging infrastructure.

Use this build configuration if you plan to deploy the RI to Windows
Azure (scenario 5).

### Debug

Use the **Debug** build configuration if you plan either to deploy your
application locally to the Windows Azure compute emulator or run the
application locally and stand-alone without using the Windows Azure
compute emulator.

This solution uses the Windows Azure Service Bus to provide the
messaging infrastructure and the event store based on Windows Azure
table storage (scenarios 2 and 4).

### DebugLocal

Use the **DebugLocal** build configuration if you plan either to deploy
your application locally to the Windows Azure compute emulator or run
the application on a local web server without using the Windows
Azure compute emulator.

This solution uses a local messaging infrastructure and event store
built using SQL Server (scenarios 1 and 3).

# Running the RI

When you run the RI, you should first create a conference, add at least
one seat type, and then publish the conference using the
**Conference.Web.Admin** site.

After you have published the conference you will then be able to use the
site to order seats and use the simulated the payment process using the
**Conference.Web** site.

The following sections describe how to run the RI using in the different
scenarios.

## Scenario 1. Local Web Server, SQL Event Bus, SQL Event Store

To run this scenario you should build the application using the
**DebugLocal** configuration.

Run the **WorkerRoleCommandProcessor** project as a console application.

Run the **Conference.Web.Public** and **Conference.Web.Admin** (located
in the **ConferenceManagement** folder) as web applications.

## Scenario 2. Local Web Server, Windows Azure Service Bus, Table Storage Event Store

To run this scenario you should build the application using the
**Debug** configuration.

Run the **WorkerRoleCommandProcessor** project as a console application.

Run the **Conference.Web.Public** and **Conference.Web.Admin** (located
in the **ConferenceManagement** folder) as web applications.

## Scenario 3. Compute Emulator, SQL Event Bus, SQL Event Store

To run this scenario you should build the application using the
**DebugLocal** configuration.

Run the **Conference.Azure** Windows Azure project.

> **Note:** To use the Windows Azure compute emulator you must launch
> Visual Studio as an administrator.

## Scenario 4. Compute Emulator, Windows Azure Service Bus, Table Storage Event Store

To run this scenario you should build the application using the
**Debug** configuration.

Run the **Conference.Azure** Windows Azure project.

> **Note:** To use the Windows Azure compute emulator you must launch
> Visual Studio as an administrator.

## Scenario 5. Windows Azure, Windows Azure Service Bus, Table Storage Event Store

Deploy the **Conference.Azure** Windows Azure project to your Windows
Azure account.

> **Note:** You must also ensure that you have created **Conference**
> database in SQL Azure using the **Install-Database.ps1** in the
> scripts folder as described above. You must also ensure that you have
> modified the connection strings in the
> configuration files in the solution to point to your SQL Azure
> **Conference** database instead of your local SQL Express
> **Conference** database as described above.

# Running the Tests

The following sections describe how to run the unit, integration, and
acceptance tests.

## Running the Unit and Integration Tests

The unit and integration tests in the **Conference** solution are
created using **xUnit.net**.

For more information about how you can run these tests please visit the
[xUnit.net][xunit] site on Codeplex.

## Running the Acceptance Tests

The acceptance tests are located in the Visual Studio solution in the
**Conference.AcceptanceTests** folder.

You can use NuGet to download and install all of the dependencies by
running the script **install-packages.ps1** before building this
solution.

The acceptance tests are created using SpecFlow. For more information
about SpecFlow, please visit [SpecFlow][specflow].

The SpecFlow tests are implemented using **xUnit.net**.

The **Conference.AcceptanceTests** solution uses the same build
configurations as the **Conference** solution to control whether the
acceptance tests are run against either the local SQL-based messaging
infrastructure and event store or the Windows Azure Service Bus
messaging infrastructure and Windows Azure table storage based event
store.

# Known Issues

## Runtime Activation Error in Debug Mode

When you run the application in debug mode you will see an error in the
**Conference.Web.Public** web application:

```
Activation error occured while trying to get instance of type IControllerFactory
```

Click in the **Continue** button and the application will run as
expected.

## Server Error in '/' Application

When you run the application in using the Debug build configuration you see

```
Server Error in '/' Application.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ...

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ...
```

For help resolving this issue see [Azure: A connection attempt failed...][connectionerror]

## Missing Validation

Currently, there is no validation to:

* Check that the end date for a conference is later than the start date.
* Check that email addresses are in a valid format.

## Other Known Issues

* No security features have been implemented yet.
* No performance or localizability tests have been performed yet.
* The UI is still a work in progress.
* Validation in the UI is not yet complete.
* You see a list of outstanding issues for the V1 release [here][v1outstanding].

[source]:          https://github.com/mspnp/cqrs-journey-code
[xunit]:           http://xunit.codeplex.com/
[specflow]:        http://www.specflow.org/
[connectionerror]: http://blogs.msdn.com/b/narahari/archive/2011/12/21/azure-a-connection-attempt-failed-because-the-connected-party-did-not-properly-respond-after-a-period-of-time-or-established-connection-failed-because-connected-host-has-failed-to-respond-x-x-x-x-x-quot.aspx
[v1outstanding]:   https://github.com/mspnp/cqrs-journey-code/issues/search?utf8=%E2%9C%93&q=v1


text:
<?php

namespace App\Policies;

use App\User;
use App\Comment;

class CommentPolicy extends Policy
{
    /**
     * Determine whether the user can delete the comment.
     *
     * @param  \App\User  $user
     * @param  \App\Comment  $comment
     * @return mixed
     */
    public function delete(User $user, Comment $comment)
    {
        return $comment->user_id === $user->id;
    }
}


text:
package org.gradle.test.performance.mediummonolithicjavaproject.p187;

public class Production3744 {

    private Production3741 property0;

    public Production3741 getProperty0() {
        return property0;
    }

    public void setProperty0(Production3741 value) {
        property0 = value;
    }

    private Production3742 property1;

    public Production3742 getProperty1() {
        return property1;
    }

    public void setProperty1(Production3742 value) {
        property1 = value;
    }

    private Production3743 property2;

    public Production3743 getProperty2() {
        return property2;
    }

    public void setProperty2(Production3743 value) {
        property2 = value;
    }

    private String property3;

    public String getProperty3() {
        return property3;
    }

    public void setProperty3(String value) {
        property3 = value;
    }

    private String property4;

    public String getProperty4() {
        return property4;
    }

    public void setProperty4(String value) {
        property4 = value;
    }

    private String property5;

    public String getProperty5() {
        return property5;
    }

    public void setProperty5(String value) {
        property5 = value;
    }

    private String property6;

    public String getProperty6() {
        return property6;
    }

    public void setProperty6(String value) {
        property6 = value;
    }

    private String property7;

    public String getProperty7() {
        return property7;
    }

    public void setProperty7(String value) {
        property7 = value;
    }

    private String property8;

    public String getProperty8() {
        return property8;
    }

    public void setProperty8(String value) {
        property8 = value;
    }

    private String property9;

    public String getProperty9() {
        return property9;
    }

    public void setProperty9(String value) {
        property9 = value;
    }

}


text:
.. _orm_mixins_toplevel:

Composing Mapped Hierarchies with Mixins
========================================

A common need when mapping classes using the :ref:`Declarative
<orm_declarative_mapping>` style is to share some functionality, such as a set
of common columns, some common table options, or other mapped properties,
across many classes.  The standard Python idioms for this is to have the
classes inherit from a superclass which includes these common features.

When using declarative mappings, this idiom is allowed via the
usage of mixin classes, as well as via augmenting the declarative base
produced by either the :meth:`_orm.registry.generate_base` method
or :func:`_orm.declarative_base` functions.

When using mixins or abstract base classes with Declarative, a decorator
known as :func:`_orm.declared_attr` is frequently used.  This decorator
allows the creation of class methods that produce a parameter or ORM construct that will be
part of a declarative mapping.  Generating constructs using a callable
allows for Declarative to get a new copy of a particular kind of object
each time it calls upon the mixin or abstract base on behalf of a new
class that's being mapped.

An example of some commonly mixed-in idioms is below::

    from sqlalchemy.orm import declarative_mixin, declared_attr

    @declarative_mixin
    class MyMixin:
        @declared_attr
        def __tablename__(cls):
            return cls.__name__.lower()

        __table_args__ = {"mysql_engine": "InnoDB"}
        __mapper_args__ = {"always_refresh": True}

        id = Column(Integer, primary_key=True)

    class MyModel(MyMixin, Base):
        name = Column(String(1000))

Where above, the class ``MyModel`` will contain an "id" column
as the primary key, a ``__tablename__`` attribute that derives
from the name of the class itself, as well as ``__table_args__``
and ``__mapper_args__`` defined by the ``MyMixin`` mixin class.  The
:func:`_orm.declared_attr` decorator applied to a class method called
``def __tablename__(cls):`` has the effect of turning the method into a class
method while also indicating to Declarative that this attribute is significant
within the mapping.

.. tip::

  The use of the :func:`_orm.declarative_mixin` class decorator marks a
  particular class as providing the service of providing SQLAlchemy declarative
  assignments as a mixin for other classes.  This decorator is currently only
  necessary to provide a hint to the :ref:`Mypy plugin <mypy_toplevel>` that
  this class should be handled as part of declarative mappings.

There's no fixed convention over whether ``MyMixin`` precedes
``Base`` or not.  Normal Python method resolution rules apply, and
the above example would work just as well with::

    class MyModel(Base, MyMixin):
        name = Column(String(1000))

This works because ``Base`` here doesn't define any of the
variables that ``MyMixin`` defines, i.e. ``__tablename__``,
``__table_args__``, ``id``, etc.   If the ``Base`` did define
an attribute of the same name, the class placed first in the
inherits list would determine which attribute is used on the
newly defined class.

Augmenting the Base
~~~~~~~~~~~~~~~~~~~

In addition to using a pure mixin, most of the techniques in this
section can also be applied to the base class itself, for patterns that
should apply to all classes derived from a particular base.  This is achieved
using the ``cls`` argument of the :func:`_orm.declarative_base` function::

    from sqlalchemy.orm import declarative_base, declared_attr

    class Base:
        @declared_attr
        def __tablename__(cls):
            return cls.__name__.lower()

        __table_args__ = {"mysql_engine": "InnoDB"}

        id = Column(Integer, primary_key=True)

    Base = declarative_base(cls=Base)

    class MyModel(Base):
        name = Column(String(1000))

Where above, ``MyModel`` and all other classes that derive from ``Base`` will
have a table name derived from the class name, an ``id`` primary key column,
as well as the "InnoDB" engine for MySQL.

Mixing in Columns
~~~~~~~~~~~~~~~~~

The most basic way to specify a column on a mixin is by simple
declaration::

    @declarative_mixin
    class TimestampMixin:
        created_at = Column(DateTime, default=func.now())

    class MyModel(TimestampMixin, Base):
        __tablename__ = "test"

        id = Column(Integer, primary_key=True)
        name = Column(String(1000))

Where above, all declarative classes that include ``TimestampMixin``
will also have a column ``created_at`` that applies a timestamp to
all row insertions.

Those familiar with the SQLAlchemy expression language know that
the object identity of clause elements defines their role in a schema.
Two ``Table`` objects ``a`` and ``b`` may both have a column called
``id``, but the way these are differentiated is that ``a.c.id``
and ``b.c.id`` are two distinct Python objects, referencing their
parent tables ``a`` and ``b`` respectively.

In the case of the mixin column, it seems that only one
:class:`_schema.Column` object is explicitly created, yet the ultimate
``created_at`` column above must exist as a distinct Python object
for each separate destination class.  To accomplish this, the declarative
extension creates a **copy** of each :class:`_schema.Column` object encountered on
a class that is detected as a mixin.

This copy mechanism is limited to simple columns that have no foreign
keys, as a :class:`_schema.ForeignKey` itself contains references to columns
which can't be properly recreated at this level.  For columns that
have foreign keys, as well as for the variety of mapper-level constructs
that require destination-explicit context, the
:class:`_orm.declared_attr` decorator is provided so that
patterns common to many classes can be defined as callables::

    from sqlalchemy.orm import declared_attr

    @declarative_mixin
    class ReferenceAddressMixin:
        @declared_attr
        def address_id(cls):
            return Column(Integer, ForeignKey('address.id'))

    class User(ReferenceAddressMixin, Base):
        __tablename__ = 'user'
        id = Column(Integer, primary_key=True)

Where above, the ``address_id`` class-level callable is executed at the
point at which the ``User`` class is constructed, and the declarative
extension can use the resulting :class:`_schema.Column` object as returned by
the method without the need to copy it.

Columns generated by :class:`_orm.declared_attr` can also be
referenced by ``__mapper_args__`` to a limited degree, currently
by ``polymorphic_on`` and ``version_id_col``; the declarative extension
will resolve them at class construction time::

    @declarative_mixin
    class MyMixin:
        @declared_attr
        def type_(cls):
            return Column(String(50))

        __mapper_args__= {'polymorphic_on':type_}

    class MyModel(MyMixin, Base):
        __tablename__='test'
        id =  Column(Integer, primary_key=True)

.. _orm_declarative_mixins_relationships:

Mixing in Relationships
~~~~~~~~~~~~~~~~~~~~~~~

Relationships created by :func:`~sqlalchemy.orm.relationship` are provided
with declarative mixin classes exclusively using the
:class:`_orm.declared_attr` approach, eliminating any ambiguity
which could arise when copying a relationship and its possibly column-bound
contents. Below is an example which combines a foreign key column and a
relationship so that two classes ``Foo`` and ``Bar`` can both be configured to
reference a common target class via many-to-one::

    @declarative_mixin
    class RefTargetMixin:
        @declared_attr
        def target_id(cls):
            return Column('target_id', ForeignKey('target.id'))

        @declared_attr
        def target(cls):
            return relationship("Target")

    class Foo(RefTargetMixin, Base):
        __tablename__ = "foo"
        id = Column(Integer, primary_key=True)

    class Bar(RefTargetMixin, Base):
        __tablename__ = "bar"
        id = Column(Integer, primary_key=True)

    class Target(Base):
        __tablename__ = "target"
        id = Column(Integer, primary_key=True)

Using Advanced Relationship Arguments (e.g. ``primaryjoin``, etc.)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:func:`~sqlalchemy.orm.relationship` definitions which require explicit
primaryjoin, order_by etc. expressions should in all but the most
simplistic cases use **late bound** forms
for these arguments, meaning, using either the string form or a function/lambda.
The reason for this is that the related :class:`_schema.Column` objects which are to
be configured using ``@declared_attr`` are not available to another
``@declared_attr`` attribute; while the methods will work and return new
:class:`_schema.Column` objects, those are not the :class:`_schema.Column` objects that
Declarative will be using as it calls the methods on its own, thus using
*different* :class:`_schema.Column` objects.

The canonical example is the primaryjoin condition that depends upon
another mixed-in column::

    @declarative_mixin
    class RefTargetMixin:
        @declared_attr
        def target_id(cls):
            return Column("target_id", ForeignKey("target.id"))

        @declared_attr
        def target(cls):
            return relationship(
                Target,
                primaryjoin=Target.id == cls.target_id,  # this is *incorrect*
            )

Mapping a class using the above mixin, we will get an error like::

    sqlalchemy.exc.InvalidRequestError: this ForeignKey's parent column is not
    yet associated with a Table.

This is because the ``target_id`` :class:`_schema.Column` we've called upon in our
``target()`` method is not the same :class:`_schema.Column` that declarative is
actually going to map to our table.

The condition above is resolved using a lambda::

    @declarative_mixin
    class RefTargetMixin:
        @declared_attr
        def target_id(cls):
            return Column('target_id', ForeignKey('target.id'))

        @declared_attr
        def target(cls):
            return relationship(Target,
                primaryjoin=lambda: Target.id==cls.target_id
            )

or alternatively, the string form (which ultimately generates a lambda)::

    @declarative_mixin
    class RefTargetMixin:
        @declared_attr
        def target_id(cls):
            return Column("target_id", ForeignKey("target.id"))

        @declared_attr
        def target(cls):
            return relationship(
                Target, primaryjoin=f"Target.id=={cls.__name__}.target_id"
            )

.. seealso::

    :ref:`orm_declarative_relationship_eval`

Mixing in deferred(), column_property(), and other MapperProperty classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Like :func:`~sqlalchemy.orm.relationship`, all
:class:`~sqlalchemy.orm.interfaces.MapperProperty` subclasses such as
:func:`~sqlalchemy.orm.deferred`, :func:`~sqlalchemy.orm.column_property`,
etc. ultimately involve references to columns, and therefore, when
used with declarative mixins, have the :class:`_orm.declared_attr`
requirement so that no reliance on copying is needed::

    @declarative_mixin
    class SomethingMixin:
        @declared_attr
        def dprop(cls):
            return deferred(Column(Integer))

    class Something(SomethingMixin, Base):
        __tablename__ = "something"

The :func:`.column_property` or other construct may refer
to other columns from the mixin.  These are copied ahead of time before
the :class:`_orm.declared_attr` is invoked::

    @declarative_mixin
    class SomethingMixin:
        x = Column(Integer)
        y = Column(Integer)

        @declared_attr
        def x_plus_y(cls):
            return column_property(cls.x + cls.y)

.. versionchanged:: 1.0.0 mixin columns are copied to the final mapped class
   so that :class:`_orm.declared_attr` methods can access the actual column
   that will be mapped.

.. _decl_mixin_inheritance:

Controlling table inheritance with mixins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``__tablename__`` attribute may be used to provide a function that
will determine the name of the table used for each class in an inheritance
hierarchy, as well as whether a class has its own distinct table.

This is achieved using the :class:`_orm.declared_attr` indicator in conjunction
with a method named ``__tablename__()``.   Declarative will always
invoke :class:`_orm.declared_attr` for the special names
``__tablename__``, ``__mapper_args__`` and ``__table_args__``
function **for each mapped class in the hierarchy, except if overridden
in a subclass**.   The function therefore
needs to expect to receive each class individually and to provide the
correct answer for each.

For example, to create a mixin that gives every class a simple table
name based on class name::

    from sqlalchemy.orm import declarative_mixin, declared_attr

    @declarative_mixin
    class Tablename:
        @declared_attr
        def __tablename__(cls):
            return cls.__name__.lower()

    class Person(Tablename, Base):
        id = Column(Integer, primary_key=True)
        discriminator = Column("type", String(50))
        __mapper_args__ = {"polymorphic_on": discriminator}

    class Engineer(Person):
        __tablename__ = None
        __mapper_args__ = {"polymorphic_identity": "engineer"}
        primary_language = Column(String(50))

Alternatively, we can modify our ``__tablename__`` function to return
``None`` for subclasses, using :func:`.has_inherited_table`.  This has
the effect of those subclasses being mapped with single table inheritance
against the parent::

    from sqlalchemy.orm import (
        declarative_mixin,
        declared_attr,
        has_inherited_table,
    )

    @declarative_mixin
    class Tablename:
        @declared_attr
        def __tablename__(cls):
            if has_inherited_table(cls):
                return None
            return cls.__name__.lower()

    class Person(Tablename, Base):
        id = Column(Integer, primary_key=True)
        discriminator = Column("type", String(50))
        __mapper_args__ = {"polymorphic_on": discriminator}

    class Engineer(Person):
        primary_language = Column(String(50))
        __mapper_args__ = {"polymorphic_identity": "engineer"}

.. _mixin_inheritance_columns:

Mixing in Columns in Inheritance Scenarios
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In contrast to how ``__tablename__`` and other special names are handled when
used with :class:`_orm.declared_attr`, when we mix in columns and properties (e.g.
relationships, column properties, etc.), the function is
invoked for the **base class only** in the hierarchy.  Below, only the
``Person`` class will receive a column
called ``id``; the mapping will fail on ``Engineer``, which is not given
a primary key::

    @declarative_mixin
    class HasId:
        @declared_attr
        def id(cls):
            return Column("id", Integer, primary_key=True)

    class Person(HasId, Base):
        __tablename__ = "person"
        discriminator = Column("type", String(50))
        __mapper_args__ = {"polymorphic_on": discriminator}

    class Engineer(Person):
        __tablename__ = "engineer"
        primary_language = Column(String(50))
        __mapper_args__ = {"polymorphic_identity": "engineer"}

It is usually the case in joined-table inheritance that we want distinctly
named columns on each subclass.  However in this case, we may want to have
an ``id`` column on every table, and have them refer to each other via
foreign key.  We can achieve this as a mixin by using the
:attr:`.declared_attr.cascading` modifier, which indicates that the
function should be invoked **for each class in the hierarchy**, in *almost*
(see warning below) the same way as it does for ``__tablename__``::

    @declarative_mixin
    class HasIdMixin:
        @declared_attr.cascading
        def id(cls):
            if has_inherited_table(cls):
                return Column(ForeignKey("person.id"), primary_key=True)
            else:
                return Column(Integer, primary_key=True)

    class Person(HasIdMixin, Base):
        __tablename__ = "person"
        discriminator = Column("type", String(50))
        __mapper_args__ = {"polymorphic_on": discriminator}

    class Engineer(Person):
        __tablename__ = "engineer"
        primary_language = Column(String(50))
        __mapper_args__ = {"polymorphic_identity": "engineer"}

.. warning::

    The :attr:`.declared_attr.cascading` feature currently does
    **not** allow for a subclass to override the attribute with a different
    function or value.  This is a current limitation in the mechanics of
    how ``@declared_attr`` is resolved, and a warning is emitted if
    this condition is detected.   This limitation does **not**
    exist for the special attribute names such as ``__tablename__``, which
    resolve in a different way internally than that of
    :attr:`.declared_attr.cascading`.

.. versionadded:: 1.0.0 added :attr:`.declared_attr.cascading`.

Combining Table/Mapper Arguments from Multiple Mixins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the case of ``__table_args__`` or ``__mapper_args__``
specified with declarative mixins, you may want to combine
some parameters from several mixins with those you wish to
define on the class itself. The
:class:`_orm.declared_attr` decorator can be used
here to create user-defined collation routines that pull
from multiple collections::

    from sqlalchemy.orm import declarative_mixin, declared_attr

    @declarative_mixin
    class MySQLSettings:
        __table_args__ = {"mysql_engine": "InnoDB"}

    @declarative_mixin
    class MyOtherMixin:
        __table_args__ = {"info": "foo"}

    class MyModel(MySQLSettings, MyOtherMixin, Base):
        __tablename__ = "my_model"

        @declared_attr
        def __table_args__(cls):
            args = dict()
            args.update(MySQLSettings.__table_args__)
            args.update(MyOtherMixin.__table_args__)
            return args

        id = Column(Integer, primary_key=True)

Creating Indexes with Mixins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To define a named, potentially multicolumn :class:`.Index` that applies to all
tables derived from a mixin, use the "inline" form of :class:`.Index` and
establish it as part of ``__table_args__``::

    @declarative_mixin
    class MyMixin:
        a = Column(Integer)
        b = Column(Integer)

        @declared_attr
        def __table_args__(cls):
            return (
                Index(f"test_idx_{cls.__tablename__}", "a", "b"),
            )

    class MyModel(MyMixin, Base):
        __tablename__ = "atable"
        c = Column(Integer, primary_key=True)


text:
import { expect } from 'chai';
import redis from 'redis';
import moment from 'moment';
import { hookRemoveCacheInformation as r } from '../../src';

const client = redis.createClient();

describe('Redis Remove Cache Object Hook', () => {

  it('removes the cache object', () => {
    const hook = r();
    const mock = {
      params: { query: ''},
      path: '',
      id: 'remove-cache-test-route',
      result: {
        cache: {
          cached: true,
          duration: 3600 * 24 * 7,
          expiresOn: moment().add(moment.duration(3600 * 24 * 7, 'seconds'))
        }
      },
      app: {
        get: (what) => {
          return client;
        }
      }
    };

    return hook(mock).then(result => {
      const data = result.result;

      expect(data).not.to.have.property('cache');
    });
  });

  it('does not remove anything else thant the cache object', () => {
    const hook = r();
    const mock = {
      params: { query: ''},
      path: '',
      id: 'remove-cache-test-route',
      result: {
        property: 'test'
      },
      app: {
        get: (what) => {
          return client;
        }
      }
    };

    return hook(mock).then(result => {
      const data = result.result;

      expect(data).to.deep.equal({property: 'test'});
    });
  });
});


text:
package com.google.common.math;

import static com.google.common.math.MathTesting.ALL_BIGINTEGER_CANDIDATES;
import static com.google.common.math.MathTesting.FINITE_DOUBLE_CANDIDATES;
import static com.google.common.math.MathTesting.POSITIVE_FINITE_DOUBLE_CANDIDATES;

import junit.framework.TestCase;

import sun.misc.FpUtils;

import java.math.BigInteger;

/**
 * Tests for {@link DoubleUtils}.
 *
 * @author Louis Wasserman
 */
public class DoubleUtilsTest extends TestCase {
  public void testNextDown() {
    for (double d : FINITE_DOUBLE_CANDIDATES) {
      assertEquals(FpUtils.nextDown(d), DoubleUtils.nextDown(d));
    }
  }

  public void testBigToDouble() {
    for (BigInteger b : ALL_BIGINTEGER_CANDIDATES) {
      assertEquals(b.doubleValue(), DoubleUtils.bigToDouble(b));
    }
  }

  public void testEnsureNonNegative() {
    assertEquals(0.0, DoubleUtils.ensureNonNegative(0.0));
    for (double positiveValue : POSITIVE_FINITE_DOUBLE_CANDIDATES) {
      assertEquals(positiveValue, DoubleUtils.ensureNonNegative(positiveValue));
      assertEquals(0.0, DoubleUtils.ensureNonNegative(-positiveValue));
    }
    assertEquals(Double.POSITIVE_INFINITY, DoubleUtils.ensureNonNegative(Double.POSITIVE_INFINITY));
    assertEquals(0.0, DoubleUtils.ensureNonNegative(Double.NEGATIVE_INFINITY));
    try {
      DoubleUtils.ensureNonNegative(Double.NaN);
      fail("Expected IllegalArgumentException from ensureNonNegative(Double.NaN)");
    } catch (IllegalArgumentException expected) {
    }
  }
}


text:
package com.sun.java.swing.plaf.motif;

import java.awt.event.*;
import javax.swing.MenuSelectionManager;

/**
 * A default MouseListener for menu elements
 *
 * @author Arnaud Weber
 */
class MotifMenuMouseListener extends MouseAdapter {
    public void mousePressed(MouseEvent e) {
        MenuSelectionManager.defaultManager().processMouseEvent(e);
    }
    public void mouseReleased(MouseEvent e) {
        MenuSelectionManager.defaultManager().processMouseEvent(e);
    }
    public void mouseEntered(MouseEvent e) {
        MenuSelectionManager.defaultManager().processMouseEvent(e);
    }
    public void mouseExited(MouseEvent e) {
        MenuSelectionManager.defaultManager().processMouseEvent(e);
    }
}


text:
<?php

require_once(__DIR__ . '/../GitHubClient.php');
require_once(__DIR__ . '/../GitHubService.php');
require_once(__DIR__ . '/../objects/GitHubUser.php');

class GitHubOrgsMembers extends GitHubService
{

	/**
	 * Members list
	 *
	 * @return array<GitHubUser>
	 */
	public function membersList($org)
	{
		$data = array();

		return $this->client->request("/orgs/$org/members", 'GET', $data, 200, 'GitHubUser', true);
	}

	/**
	 * Response if requester is not an organization member
	 *
	 */
	public function responseIfRequesterIsNotAnOrganizationMember($org, $user)
	{
		$data = array();

		return $this->client->request("/orgs/$org/members/$user", 'DELETE', $data, 204, '');
	}

	/**
	 * Public members list
	 *
	 * @return array<GitHubUser>
	 */
	public function publicMembersList($org)
	{
		$data = array();

		return $this->client->request("/orgs/$org/public_members", 'GET', $data, 200, 'GitHubUser', true);
	}

	/**
	 * Check public membership
	 *
	 */
	public function checkPublicMembership($org, $user)
	{
		$data = array();

		return $this->client->request("/orgs/$org/public_members/$user", 'PUT', $data, 204, '');
	}

}


text:
CREATE TABLE users
(id MEDIUMINT NOT NULL auto_increment,
 first_name VARCHAR(30),
 last_name VARCHAR(30),
 email VARCHAR(30),
 admin BOOLEAN,
 last_login TIME,
 is_active BOOLEAN,
 pass VARCHAR(300),
 PRIMARY KEY (id)
);


text:
/*
 * TrafficLightContext.cpp
 *
 *  Created on: Mar 4, 2017
 *      Author: nico
 */

#include "RobotArmContext.hpp"

#include <iostream>
#include "ConcreteStates.hpp"
#include <thread>

/**
 * @brief Typedef to make the type shorter and more readable
 */
typedef std::shared_ptr<AbstractRobotArmState> RobotArmState_SPTR;

RobotArmContext::RobotArmContext(RobotArm aLynx) : Context(), lynx(aLynx)
{
	setCurrentState(RobotArmState_SPTR(new InitState(this)));
}

RobotArmContext::~RobotArmContext()
{
}

void RobotArmContext::addRobotArmEvent(States::Events event)
{
	currentState->handleEvent(Event(event)); // for direct event handling
}

RobotArm& RobotArmContext::getRobotArm()
{
	return lynx;
}

void RobotArmContext::handleNotification()
{
}

RobotArmContext::RobotArmContext(
		RobotArmContext& aRobotArmContext) : Context(), lynx(aRobotArmContext.lynx)
{
}


text:
/**
 * PULL API
 * REST api for static sport data.  Every resource is protected by an **API key** which must be placed in X-Api-Key request header:  X-Api-Key: your_api_key  and every request has to be made with client certificate.
 *
 * OpenAPI spec version:
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 *
 * 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.
 */

(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['ApiClient', 'model/InlineResponse20014'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // CommonJS-like environments that support module.exports, like Node.
    module.exports = factory(require('../ApiClient'), require('../model/InlineResponse20014'));
  } else {
    // Browser globals (root is window)
    if (!root.RtsmunityPublicApiSdk) {
      root.RtsmunityPublicApiSdk = {};
    }
    root.RtsmunityPublicApiSdk.PlayersApi = factory(root.RtsmunityPublicApiSdk.ApiClient, root.RtsmunityPublicApiSdk.InlineResponse20014);
  }
}(this, function(ApiClient, InlineResponse20014) {
  'use strict';

  /**
   * Players service.
   * @module api/PlayersApi
   * @version 1.0.0
   */

  /**
   * Constructs a new PlayersApi.
   * @alias module:api/PlayersApi
   * @class
   * @param {module:ApiClient} apiClient Optional API client implementation to use,
   * default to {@link module:ApiClient#instance} if unspecified.
   */
  var exports = function(apiClient) {
    this.apiClient = apiClient || ApiClient.instance;

    /**
     * Callback function to receive the result of the getPlayers operation.
     * @callback module:api/PlayersApi~getPlayersCallback
     * @param {String} error Error message, if any.
     * @param {Array.<module:model/InlineResponse20014>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * List All Players
     *
     * @param {String} sport Sport key
     * @param {Object} opts Optional parameters
     * @param {Number} opts.teamId Filter players by team id
     * @param {module:api/PlayersApi~getPlayersCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/InlineResponse20014>}
     */
    this.getPlayers = function(sport, opts, callback) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'sport' is set
      if (sport == undefined || sport == null) {
        throw "Missing the required parameter 'sport' when calling getPlayers";
      }

      var pathParams = {
        'sport': sport
      };
      var queryParams = {
        'team_id': opts['teamId']
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = ['application/json; charset=utf-8'];
      var returnType = [InlineResponse20014];

      return this.apiClient.callApi(
        '/{sport}/players', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    }
  };

  return exports;
}));


text:
import EmberObject, { computed } from '@ember/object';

/**
 * Base class for adapters that store values in HTML5 web storage (localStorage
 * or sessionStorage)
 *
 * @class WebStorageAdapter
 * @private
 * @extends Ember.OBject
 */
export default EmberObject.extend({
  /**
   * The storage API to use -- either "localStorage" or "sessionStorage"
   *
   * @property storageAPI
   * @private
   */
  storageAPI: null,

  /**
   * The storage object -- window.localStorage or window.sessionStorage
   *
   * @property storage
   * @private
   */
  storage: computed('storageAPI', function () {
    return window[this.storageAPI];
  }),

  /**
   * Get a value
   *
   * @param {String} key
   * @returns {String} value
   */
  getValue(key) {
    return this.storage.getItem(key);
  },

  /**
   * Set a value
   *
   * @param {String} key
   * @param {String} value
   * @return {Void}
   */
  setValue(key, value) {
    this.storage.setItem(key, value);
  },

  /**
   * Delete a value
   *
   * @param {String} key
   * @return {Void}
   */
  deleteValue(key) {
    this.storage.removeItem(key);
  },

  /**
   * Get count of stored values
   *
   * @returns {Integer}
   */
  getItemCount() {
    return this.storage.length;
  },

  /**
   * Get the key of the stored value at an index
   *
   * @param {Integer} index
   * @returns {String}
   */
  getKeyAt(index) {
    return this.storage.key(index);
  },

  /**
   * Get an array of the keys of all the stored values
   *
   * @returns {Array}
   */
  getKeys() {
    let keys = [];
    let count = this.getItemCount();
    for (let i = 0; i < count; i++) {
      keys.push(this.getKeyAt(i));
    }
    return keys;
  },
});


text:
[![Version](https://img.shields.io/cocoapods/v/SwiftPages.svg?style=flat)](http://cocoapods.org/pods/SwiftPages)
[![License](https://img.shields.io/cocoapods/l/SwiftPages.svg?style=flat)](http://cocoapods.org/pods/SwiftPages)
[![Platform](https://img.shields.io/cocoapods/p/SwiftPages.svg?style=flat)](http://cocoapods.org/pods/SwiftPages)

Features

---

- A simple yet beautifully architected solution for management of paged-style view controllers.
- Dynamic loading of view controllers, allowing handling of high amounts of data without compromising memory.
- Highly customisable, all items have clean API's to change them to any appearance or size.
- Can be sized and positioned anywhere within a view controller.
- Made for iPhone and iPad.
- Extensively documented code for quick understanding.

Installation

---

### CocoaPods

SwiftPages is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "SwiftPages"
```

### Manual

Just Include the SwiftPages.swift file found on the demo in your project, and you're good to go!

Usage

---

Using **SwiftPages** in your project is very simple and straightforward.

### Create a SwiftPages Instance

First create your SwiftPages instance, there are two ways to do it, as an **IBOoutlet** of a view of type SwiftPages from the storyboard, or programmatically:

**As an IBOoutlet of a view of type SwiftPages from the storyboard**

Place a UIView in your view controller and assign its constraints, make its class be of type SwiftPages. Then control drag to your view controller as an IBOutlet.

**As a fully programmatic SwiftPages view.**

Declare it in the viewDidLoad function of your view controller and set the desired position and size:
```swift
let swiftPagesView : SwiftPages!
swiftPagesView = SwiftPages(frame: CGRectMake(0, 0, self.view.frame.width, self.view.frame.height))
```
Then, after the initialization (described below), add it as a subview on your view controller:
```swift
self.view.addSubview(swiftPagesView)
```

### Initialization
SwiftPages can be initialized in one of two ways:

**Initialize with images as buttons on the top bar:**

First create an array of strings, the strings will be the Storyboard ID's of the view controllers you would like to include:
```swift
var VCIDs : [String] = ["FirstVC", "SecondVC", "ThirdVC", "FourthVC", "FifthVC"]
```
Then create an array of UIImages which will correlate in order to the VC ID's array created above, it also has to have the same number of items as the aforementioned array:
```swift
var buttonImages : [UIImage] = [UIImage(named:"HomeIcon.png")!,
                                        UIImage(named:"LocationIcon.png")!,
                                        UIImage(named:"CollectionIcon.png")!,
                                        UIImage(named:"ListIcon.png")!,
                                        UIImage(named:"StarIcon.png")!]
```
Finally, use the `initializeWithVCIDsArrayAndButtonImagesArray` function with the two arrays created:
```swift
swiftPagesView.initializeWithVCIDsArrayAndButtonImagesArray(VCIDs, buttonImagesArray: buttonImages)
```

**Initialize with text on buttons:**

First, alike with the image initialization, create an array of strings, the strings will be the Storyboard ID's of the view controllers you would like to include:
```swift
var VCIDs : [String] = ["FirstVC", "SecondVC", "ThirdVC", "FourthVC", "FifthVC"]
```
Then create an array of titles which will correlate in order to the VC ID's array created above, it must have the same number of items as the aforementioned array:
```swift
var buttonTitles : [String] = ["Home", "Places", "Photos", "List", "Tags"]
```
Finally, use the `initializeWithVCIDsArrayAndButtonTitlesArray` function with the two arrays created:
```swift
swiftPagesView.initializeWithVCIDsArrayAndButtonTitlesArray(VCIDs, buttonTitlesArray: buttonTitles)
```

Customisation

---

Once you have your `SwiftPages` instance you can customize the appearance of all item's using the class API's, to view the API list look for the `API's` Mark on the SwiftPages class. Below is a brief customization sample:
```swift
swiftPagesView.enableAeroEffectInTopBar(true)
swiftPagesView.setButtonsTextColor(UIColor.whiteColor())
swiftPagesView.setAnimatedBarColor(UIColor.whiteColor())
```

Example

---

You can find a full example on usage and customization on the Xcode project attached to this repository.

License

---

The MIT License (MIT)

**Copyright (c) 2015 Gabriel Alvarado (gabrielle.alva@gmail.com)**

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
[!!] The contents of this page are taken (with some minor changes) from <http://www.geertdedeckere.be/article/introducing-codebench> and are copyright Geert De Deckere.

For a long time I have been using a quick-and-dirty `benchmark.php` file to optimize bits of PHP code, many times regex-related stuff. The file contained not much more than a [gettimeofday](http://php.net/gettimeofday) function wrapped around a `for` loop. It worked, albeit not very efficiently. Something more solid was needed. I set out to create a far more usable piece of software to aid in the everlasting quest to squeeze every millisecond out of those regular expressions.

## Codebench Goals

### Benchmark multiple regular expressions at once

Being able to compare the speed of an arbitrary amount of regular expressions would be tremendously useful. In case you are wondering—yes, I had been writing down benchmark times for each regex, uncommenting them one by one. You get the idea. Those days should be gone forever now.

### Benchmark multiple subjects at once

What gets overlooked too often when testing and optimizing regular expressions is the fact that speed can vastly differ depending on the subjects, also known as input or target strings. Just because your regular expression matches, say, a valid email address quickly, does not necessarily mean it will quickly realize when an invalid email is provided. I plan to write a follow-up article with hands-on regex examples to demonstrate this point. Anyway, Codebench allows you to create an array of subjects which will be passed to each benchmark.

### Make it flexible enough to work for all PCRE functions

Initially I named the module "Regexbench". I quickly realized, though, it would be flexible enough to benchmark all kinds of PHP code, hence the change to "Codebench". While tools specifically built to help profiling PCRE functions, like [preg_match](http://php.net/preg_match) or [preg_replace](http://php.net/preg_replace), definitely have their use, more flexibility was needed here. You should be able to compare all kinds of constructions like combinations of PCRE functions and native PHP string functions.

### Create clean and portable benchmark cases

Throwing valuable benchmark data away every time I needed to optimize another regular expression had to stop. A clean file containing the complete set of all regex variations to compare, together with the set of subjects to test them against, would be more than welcome. Moreover, it would be easy to exchange benchmark cases with others.

### Visualize the benchmarks

Obviously providing a visual representation of the benchmark results, via simple graphs, would make interpreting them easier. Having not to think about Internet Explorer for once, made writing CSS a whole lot more easy and fun. It resulted in some fine graphs which are fully resizable.

Below are two screenshots of Codebench in action. `Valid_Color` is a class made for benchmarking different ways to validate hexadecimal HTML color values, e.g. `#FFF`. If you are interested in the story behind the actual regular expressions, take a look at [this topic in the Kohana forums](http://forum.kohanaframework.org/discussion/2192).

![Benchmarking several ways to validate HTML color values](codebench_screenshot1.png)
**Benchmarking seven ways to validate HTML color values**

![Collapsable results per subject for each method](codebench_screenshot2.png)
**Collapsable results per subject for each method**

## Working with Codebench

Codebench is included in Kohana 3, but if you need you [can download it](http://github.com/kohana/codebench/) from GitHub. Be sure Codebench is activated in your `application/bootstrap.php`.

Creating your own benchmarks is just a matter of creating a class that extends the Codebench class.  The class should go in `classes/bench` and the class name should have the `Bench_` prefix.  Put the code parts you want to compare into separate methods. Be sure to prefix those methods with `bench_`, other methods will not be benchmarked. Glance at the files in `modules/codebench/classes/bench/` for more examples.

Here is another short example with some extra explanations.

	// classes/bench/ltrimdigits.php
	class Bench_LtrimDigits extends Codebench {

		// Some optional explanatory comments about the benchmark file.
		// HTML allowed. URLs will be converted to links automatically.
		public $description = 'Chopping off leading digits: regex vs ltrim.';

		// How many times to execute each method per subject.
		// Total loops = loops * number of methods * number of subjects
		public $loops = 100000;

		// The subjects to supply iteratively to your benchmark methods.
		public $subjects = array
		(
			'123digits',
			'no-digits',
		);

		public function bench_regex($subject)
		{
			return preg_replace('/^\d+/', '', $subject);
		}

		public function bench_ltrim($subject)
		{
			return ltrim($subject, '0..9');
		}
	}

And the winner is… [ltrim](http://php.net/ltrim). Happy benchmarking!


text:
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var SimpleServiceRequestBase_1 = require("./SimpleServiceRequestBase");
/**
 * ## @internal *Not Implemented*
 */
var GetClientExtensionRequest = (function (_super) {
    __extends(GetClientExtensionRequest, _super);
    function GetClientExtensionRequest() {
        _super.apply(this, arguments);
    }
    GetClientExtensionRequest.prototype.Execute = function () { throw new Error("GetClientExtensionRequest.ts - Execute : Not implemented."); };
    GetClientExtensionRequest.prototype.GetMinimumRequiredServerVersion = function () { throw new Error("GetClientExtensionRequest.ts - GetMinimumRequiredServerVersion : Not implemented."); };
    GetClientExtensionRequest.prototype.GetResponseXmlElementName = function () { throw new Error("GetClientExtensionRequest.ts - GetResponseXmlElementName : Not implemented."); };
    GetClientExtensionRequest.prototype.GetXmlElementName = function () { throw new Error("GetClientExtensionRequest.ts - GetXmlElementName : Not implemented."); };
    GetClientExtensionRequest.prototype.ParseResponse = function (reader) { throw new Error("GetClientExtensionRequest.ts - ParseResponse : Not implemented."); };
    GetClientExtensionRequest.prototype.WriteElementsToXml = function (writer) { throw new Error("GetClientExtensionRequest.ts - WriteElementsToXml : Not implemented."); };
    return GetClientExtensionRequest;
}(SimpleServiceRequestBase_1.SimpleServiceRequestBase));
exports.GetClientExtensionRequest = GetClientExtensionRequest;


text:
using BaseClients.Architecture;
using BaseClients.Core;
using NUnit.Framework;
using System.Collections.Generic;
using System.Net;

namespace SchedulingClients.Core.Test
{
    public abstract class AbstractInvalidServerClientTest
    {
        protected List<IClient> clients = new List<IClient>();

        [OneTimeSetUp]
        public virtual void OneTimeSetup()
        {
            IPAddress ipAddress = IPAddress.Parse("192.168.255.255");
            settings = new EndpointSettings(ipAddress);
        }

        protected EndpointSettings settings;

        [OneTimeTearDown]
        public virtual void OneTimeTearDown()
        {
            foreach (IClient client in clients)
            {
                client.Dispose();
            }
        }
    }
}


text:
layout: post
date: '2015-09-03'
title: "Allure Bridals M476 Modest Vintage Lace Dress"
category: Allure Bridals
tags: [Allure Bridals]
---
### Allure Bridals M476 Modest Vintage Lace Dress
Just **$416.99**
###

Vintage-inspired all-over lace modest wedding dress. This lace gown features a beautiful Queen-Anne neckline with stunning scallops. A chapel length train and covered buttons complete this elegant style.
Available in sizes 2-32.

Buy it: [https://www.eudances.com/en/allure-bridals/126-allure-bridals-m476-modest-vintage-lace-dress.html](https://www.eudances.com/en/allure-bridals/126-allure-bridals-m476-modest-vintage-lace-dress.html)


text:
/* */
'use strict';
Object.defineProperty(exports, "__esModule", {value: true});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactAddonsPureRenderMixin = require('react-addons-pure-render-mixin');
var _reactAddonsPureRenderMixin2 = _interopRequireDefault(_reactAddonsPureRenderMixin);
var _svgIcon = require('../../svg-icon');
var _svgIcon2 = _interopRequireDefault(_svgIcon);
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {default: obj};
}
var ImageFilterCenterFocus = _react2.default.createClass({
  displayName: 'ImageFilterCenterFocus',
  mixins: [_reactAddonsPureRenderMixin2.default],
  render: function render() {
    return _react2.default.createElement(_svgIcon2.default, this.props, _react2.default.createElement('path', {d: 'M5 15H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zM12 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'}));
  }
});
exports.default = ImageFilterCenterFocus;
module.exports = exports['default'];


text:
class AddFeaturedToPage < ActiveRecord::Migration
  def self.up
    add_column :pages, :featured, :boolean, :default => 0
  end

  def self.down
    remove_column :pages, :featured
  end
end


text:
use std::cmp;

/// Trait to mark a sortable implementation.
///
/// Intended for use with [`pivot_sort_high_to_low`](fn.pivot_sort_high_to_low.html)
///
/// # Examples
///
/// ```
/// use lib_word_count::pivot_sort::Sortable;
///
/// struct Something {
///     x: i64,
/// }
///
/// impl Sortable for Something {
///     fn weight(&self) -> i64 {
///         self.x
///     }
/// }
///
/// let something = Something{
///     x: 2
/// };
///
/// assert_eq!(something.weight(), 2i64);
/// ```
#[stable]
pub trait Sortable {
    /// The value to sort by.
    #[stable]
    fn weight(&self) -> i64;
}

/// Sort a given vector from highest 'weight' to lowest 'weight'.
///
/// Order is derived from the return-value of `weight()`.
///
/// # Arguments
///
/// * `items`    A reference to a vector containing items that implement the Sortable trait. The items
///             will be sorted on the vector itself.
///
/// # Examples
///
/// ```
/// use lib_word_count::pivot_sort;
/// # use std::cmp;

/// # #[derive(Debug, PartialEq)]
/// # struct Something {
/// #       weight: i64,
/// #       id: i64
/// # }

/// # impl pivot_sort::Sortable for Something {
/// #       fn weight(&self) -> i64 {
/// #           self.weight
/// #       }
/// # }

/// // We use id to distinguish the order of objects with eual weight.
/// let mut sort_me = vec![
///     Something{weight: 5, id: 1},
///     Something{weight: 2, id: 1},
///     Something{weight: 1, id: 1},
///     Something{weight: 3, id: 1},
///     Something{weight: 2, id: 2},
///     Something{weight: 5, id: 2},
///     Something{weight: 4, id: 1},
/// ];
///
/// pivot_sort::pivot_sort_high_to_low(&mut sort_me);
///
/// assert_eq!(sort_me, vec![
///     Something{weight: 5, id: 1},
///     Something{weight: 5, id: 2},
///     Something{weight: 4, id: 1},
///     Something{weight: 3, id: 1},
///     Something{weight: 2, id: 1},
///     Something{weight: 2, id: 2},
///     Something{weight: 1, id: 1},
/// ]);
/// ```
#[stable]
pub fn pivot_sort_high_to_low<'a, T: Sortable>(items: &mut Vec<T>) {
    if items.len() == 0 {
        return;
    }

    let pivot = match items.pop() {
        Some(valid_pivot) => valid_pivot,
        None => unreachable!(),
    };
    let pivot_weight = pivot.weight();

    let lower: &mut Vec<T> = &mut Vec::new();
    let higher: &mut Vec<T> = &mut Vec::new();
    let equal: &mut Vec<T> = &mut vec![pivot];

    while let Some(item) = items.pop() {
        match item.weight().cmp(&pivot_weight) {
            cmp::Ordering::Less => lower.insert(0, item),
            cmp::Ordering::Equal => equal.insert(0, item),
            cmp::Ordering::Greater => higher.insert(0, item),
        }
    }

    pivot_sort_high_to_low(higher);
    pivot_sort_high_to_low(lower);

    items.append(higher);
    items.append(equal);
    items.append(lower);
}


text:
<?php

namespace Budbee\Model;

use \JsonSerializable;

/**
 * @author Nicklas Moberg
 */
class OrderInterval implements JsonSerializable
{
    static $dataTypes = array(
        'collection' => '\Budbee\Model\Interval',
        'delivery' => '\Budbee\Model\Interval'
    );

    /**
     * Collection interval
     * @var \Budbee\Model\Interval
     */
    public $collection;

    /**
     * Delivery interval
     * @var \Budbee\Model\Interval
     */
    public $delivery;

    public function __construct(\Budbee\Model\Interval $collection = null, \Budbee\Model\Interval $delivery = null)
    {
    	$this->collection = $collection;
    	$this->delivery = $delivery;
    }

    public function jsonSerialize()
    {
    	return array(
    		'collection' => $this->collection,
    		'delivery' => $this->delivery
    	);
    }
}


text:
package org.apache.spark.sql.execution.joins

import org.apache.spark.TaskContext
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.{Attribute, Expression}
import org.apache.spark.sql.catalyst.plans._
import org.apache.spark.sql.catalyst.plans.physical._
import org.apache.spark.sql.execution.{BinaryExecNode, SparkPlan}
import org.apache.spark.sql.execution.metric.SQLMetrics

/**
 * Performs a hash join of two child relations by first shuffling the data using the join keys.
 */
case class ShuffledHashJoinExec(
    leftKeys: Seq[Expression],
    rightKeys: Seq[Expression],
    joinType: JoinType,
    buildSide: BuildSide,
    condition: Option[Expression],
    left: SparkPlan,
    right: SparkPlan)
  extends BinaryExecNode with HashJoin {

  override lazy val metrics = Map(
    "numOutputRows" -> SQLMetrics.createMetric(sparkContext, "number of output rows"),
    "buildDataSize" -> SQLMetrics.createSizeMetric(sparkContext, "data size of build side"),
    "buildTime" -> SQLMetrics.createTimingMetric(sparkContext, "time to build hash map"),
    "avgHashProbe" -> SQLMetrics.createAverageMetric(sparkContext, "avg hash probe"))

  override def requiredChildDistribution: Seq[Distribution] =
    ClusteredDistribution(leftKeys) :: ClusteredDistribution(rightKeys) :: Nil

  private def buildHashedRelation(iter: Iterator[InternalRow]): HashedRelation = {
    val buildDataSize = longMetric("buildDataSize")
    val buildTime = longMetric("buildTime")
    val start = System.nanoTime()
    val context = TaskContext.get()
    val relation = HashedRelation(iter, buildKeys, taskMemoryManager = context.taskMemoryManager())
    buildTime += (System.nanoTime() - start) / 1000000
    buildDataSize += relation.estimatedSize
    // This relation is usually used until the end of task.
    context.addTaskCompletionListener(_ => relation.close())
    relation
  }

  protected override def doExecute(): RDD[InternalRow] = {
    val numOutputRows = longMetric("numOutputRows")
    val avgHashProbe = longMetric("avgHashProbe")
    streamedPlan.execute().zipPartitions(buildPlan.execute()) { (streamIter, buildIter) =>
      val hashed = buildHashedRelation(buildIter)
      join(streamIter, hashed, numOutputRows, avgHashProbe)
    }
  }
}


text:
'use strict'
const {ecs, createLogger} = require('../util')

module.exports = function clusterFactory ({name}) {
  const log = createLogger('ECS cluster', name)

  async function getArn () {
    let arn
    const {clusters} = await ecs.describeClustersAsync({clusters: [name]})
    if (clusters[0]) {
      if (clusters[0].status === 'ACTIVE') {
        arn = clusters[0].clusterArn
      }
    }
    return arn
  }

  async function create () {
    const arn = await getArn()
    log.creating()
    if (arn) {
      log.alreadyCreated()
    } else {
      // http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ECS.html#createCluster-property
      await ecs.createClusterAsync({clusterName: name})
      log.created()
    }
  }

  async function destroy () {
    const arn = await getArn()
    log.destroying()
    if (!arn) {
      log.alreadyDestroyed()
    } else {
      // http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ECS.html#deleteCluster-property
      await ecs.deleteClusterAsync({cluster: name})
    }
  }

  return {
    create,
    destroy,
    getArn,
    name,
  }
}


text:
const _ = require('lodash');
const Promise = require('./promise');

module.exports = fn => (!_.isFunction(fn) ?
    (Promise.reject(Error('Invalid callback function'))) :
    (new Promise((resolve, reject) => fn((err, data) => {
      if (err) {
        console.error(err, _.get(err, 'stack'));
        return reject(err);
      }
      resolve(data);
    }))));