text:
<?xml version="1.0" encoding="utf-8"?>
<!--Published:70EDFC97-B41D-43C5-B751-7C00AD999804-->
<!--Created:cbbc9d22-5cf7-4e4c-8ee9-42a772aae58a-->
<OfficeApp xsi:type="MailApp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/office/appforoffice/1.0">
  <Id>c3d7ecd3-9602-42d5-8c33-39710c0d3235</Id>
  <Version>1.0.0.3</Version>
  <ProviderName>Moodee Productions</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="Moodee" />
  <Description DefaultValue="R U Moodee" />
  <IconUrl DefaultValue="https://moodee.azurewebsites.net/red_smiley_64x64.png" />
  <SupportUrl DefaultValue="https://moodee.azurewebsites.net/support.html" />
  <Capabilities>
    <Capability Name="Mailbox" />
  </Capabilities>
  <DesktopSettings>
    <SourceLocation DefaultValue="https://moodee.azurewebsites.net" />
    <RequestedHeight>210</RequestedHeight>
  </DesktopSettings>
  <TabletSettings>
    <SourceLocation DefaultValue="https://moodee.azurewebsites.net" />
    <RequestedHeight>210</RequestedHeight>
  </TabletSettings>
  <PhoneSettings>
    <SourceLocation DefaultValue="https://moodee.azurewebsites.net" />
  </PhoneSettings>
  <Permissions>ReadWriteMailbox</Permissions>
  <Rule xsi:type="RuleCollection" Mode="And">
    <!-- To add more complex rules, add additional rule elements -->
    <Rule xsi:type="ItemIs" ItemType="Message" />
    <!-- E.g. To activate when a message contains an address -->
    <!-- <Rule xsi:type="ItemHasKnownEntity" EntityType="Address" /> -->
  </Rule>
</OfficeApp>


text:
package org.wso2.developerstudio.eclipse.gmf.esb;

/**
 *
 * A representation of the model object 'Default End Point Input Connector'.
 *
 *
 *
 * @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getDefaultEndPointInputConnector()
 * @model
 * @generated
 */
public interface DefaultEndPointInputConnector extends InputConnector {
} // DefaultEndPointInputConnector

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="shear">

        <roleset framnet="-" id="shear.01" name="slice off, as with scissors" vncls="10.4.2">
            <roles>
                <role descr="agent of cutting" f="" n="0">
                    <vnrole vncls="10.4.2" vntheta="agent"/>
                </role>
                <role descr="thing cut, smaller piece" f="" n="1">
                    <vnrole vncls="10.4.2" vntheta="theme"/>
                </role>
                <role descr="whole, source" f="" n="2">
                    <vnrole vncls="10.4.2" vntheta="source"/>
                </role>
                <role descr="instrument" f="" n="3">
                    <vnrole vncls="10.4.2" vntheta="instrument"/>
                </role>
                <note/>
            </roles>

            <example name="the one example" src="" type="">
                <inflection aspect="ns" form="participle" person="ns" tense="ns" voice="passive"/>
                <text>One old building, the Golden State Bank Building on Front Street,
                    had [its yellow brick facade]-1 sheared [*-1] off by the shock of the
                    quake, leaving a wedge of its third floor open to the air, while
                    piles of dusty bricks tumbled to the street below narrowly missing
                    rush-hour pedestrians and cars.
                </text>
                <rel f="">sheared</rel>
                <arg f="prd" n="m">off</arg>
                <arg f="" n="1">[*-1]</arg>

                <note/>
                <arg f="" n="3">by the shock of the quake</arg>
                <arg f="adv" n="m">leaving a wedge of its third floor open to the air,         while piles of dusty bricks tumbled to the street below         narrowly missing rush-hour pedestrians and cars</arg>
            </example>

            <example name="with agent and whole" src="" type="">
                <inflection aspect="ns" form="full" person="ns" tense="past" voice="active"/>
                <text>John sheared the top off the chocolate cake.</text>
                <arg f="" n="0">John</arg>
                <rel f="">sheared</rel>
                <arg f="" n="1">the top</arg>
                <arg f="" n="2">off the chocolate cake</arg>
                <note/>
            </example>

            <note>Member of Vncls wipe_instr-10.4.2-1.</note>
        </roleset>
        <note>Frames file for 'shear_off' based on sentences in wsj.</note>
    </predicate>
    <note/>
</frameset>


text:
package org.kie.remote.services.rest.query;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;

import org.jbpm.query.jpa.data.QueryCriteria;
import org.jbpm.query.jpa.data.QueryWhere;
import org.jbpm.query.jpa.service.QueryModificationService;

/**
 * This is the {@link QueryModificationService} implementation for the REST remote services,
 * which allows us to do complicated queries that join the following:

 *
The process instance tables to the variable instance log tables

 *
Or the task tables to the variable instance log tables

 *

 */
public class RemoteServicesQueryModificationService implements QueryModificationService {

    public RemoteServicesQueryModificationService() {
        // default constructor
    }

    @Override
    public boolean accepts(String listId) {
        return false;
    }

    @Override
    public void optimizeCriteria(QueryWhere queryWhere) {

    }

    @Override
    public <R> Predicate createPredicate(QueryCriteria criteria, CriteriaQuery<R> query, CriteriaBuilder builder) {
        return null;
    }

//    private static Map<String, Class<?>> taskCriteriaFieldClasses = TaskQueryServiceImpl.criteriaFieldClasses;
//    private static Map<String, String> taskCriteriaFields = TaskQueryServiceImpl.criteriaFields;
//    private static Map<String, String> taskCriteriaFieldJoinClauses = TaskQueryServiceImpl.criteriaFieldJoinClauses;
//
//    private static Map<String, Class<?>> auditCriteriaFieldClasses = JPAAuditLogService.criteriaFieldClasses;
//    private static Map<String, String> auditCriteriaFields = JPAAuditLogService.criteriaFields;
//
//    // add tables lookup table logic
//    private enum JbpmEntity {
//        processInstanceLog,
//        variableInstanceLog,
//        task,
//        stakeHolders,
//        potentialOwners,
//        businessAdministrators,
//    }
//
//    private static Set<String> procInstLogNeededCriterias = new CopyOnWriteArraySet<String>();
//    private static Set<String> varInstLogNeededCriterias = new CopyOnWriteArraySet<String>();
//    private static Set<String> procInstLogNeededWithVarInstLogCriterias = new CopyOnWriteArraySet<String>();
//    private static Set<String> taskNeededCriterias = new CopyOnWriteArraySet<String>();
//    private static Set<String> organizationalEntityNeededCriterias = new CopyOnWriteArraySet<String>();
//
//    static {
//
//        // when doing a task or proc inst log query, add var inst log if these criteria are used
//        varInstLogNeededCriterias.add(VARIABLE_ID_LIST);
//        varInstLogNeededCriterias.add(VALUE_LIST);
//        varInstLogNeededCriterias.add(OLD_VALUE_LIST);
//        varInstLogNeededCriterias.add(EXTERNAL_ID_LIST);
//        varInstLogNeededCriterias.add(VARIABLE_INSTANCE_ID_LIST);
//        varInstLogNeededCriterias.add(VAR_VALUE_ID_LIST);
//
//        // when doing a var inst log or proc inst log query, add task if these criteria are used
//        taskNeededCriterias.add(TASK_ID_LIST);
//        taskNeededCriterias.add(TASK_STATUS_LIST);
//        taskNeededCriterias.add(CREATED_BY_LIST);
//        taskNeededCriterias.add(STAKEHOLDER_ID_LIST);
//        taskNeededCriterias.add(POTENTIAL_OWNER_ID_LIST);
//        taskNeededCriterias.add(ACTUAL_OWNER_ID_LIST);
//        taskNeededCriterias.add(BUSINESS_ADMIN_ID_LIST);
//
//        // when doing a var inst log or proc inst log query, add orgEnt if these criteria are used
//        organizationalEntityNeededCriterias.add(STAKEHOLDER_ID_LIST);
//        organizationalEntityNeededCriterias.add(POTENTIAL_OWNER_ID_LIST);
//        organizationalEntityNeededCriterias.add(BUSINESS_ADMIN_ID_LIST);
//
//        // when doing a task or var inst log query, add task if these criteria are used
//        procInstLogNeededCriterias.add(START_DATE_LIST);
//        procInstLogNeededCriterias.add(END_DATE_LIST);
//        procInstLogNeededCriterias.add(PROCESS_INSTANCE_STATUS_LIST);
//
//        // when doing a task or var inst log query, add task if these criteria are used
//        procInstLogNeededWithVarInstLogCriterias.add(START_DATE_LIST);
//        procInstLogNeededWithVarInstLogCriterias.add(END_DATE_LIST);
//        procInstLogNeededWithVarInstLogCriterias.add(PROCESS_INSTANCE_STATUS_LIST);
//        procInstLogNeededWithVarInstLogCriterias.add(PROCESS_VERSION_LIST);
//    }
//
//    // query types
//    private static final int TASK_SUMMARY_QUERY_TYPE;
//    private static final int VARIABLE_INSTANCE_LOG_QUERY_TYPE;
//    private static final int PROCESS_INSTANCE_LOG_QUERY_TYPE;
//    private static final int OTHER_QUERY_TYPE;
//
//    static {
//       int idGen = 0;
//       TASK_SUMMARY_QUERY_TYPE = idGen++;
//       VARIABLE_INSTANCE_LOG_QUERY_TYPE = idGen++;
//       PROCESS_INSTANCE_LOG_QUERY_TYPE = idGen++;https://play.spotify.com/user/spotify/playlist/0IhwR4MDWOsZ6ZHo8CRTob
//       OTHER_QUERY_TYPE = idGen++;
//    }
//
//    /**
//     * This looks at the query string built and determines what type of query it is.
//     * @param queryBuilder The query string(Builder)
//     * @return an int showing which type it is (see "query types" above)
//     */
//    private int determineQueryType(Class querytype) {
//        if( TaskSummaryImpl.class.equals(querytype) ) {
//            return TASK_SUMMARY_QUERY_TYPE;
//        } else if( VariableInstanceLog.class.equals(querytype) ) {
//            return VARIABLE_INSTANCE_LOG_QUERY_TYPE;
//        } else if( ProcessInstanceLog.class.equals(querytype) ) {
//            return PROCESS_INSTANCE_LOG_QUERY_TYPE;
//        } else  {
//            throw new IllegalArgumentException("Unexpected type for query: " + querytype.getName() );
//        }
//    }
//
//    @Override
//    public <T> void addTablesToQuery( QueryWhere queryWhere, CriteriaQuery<T> query, Class<T> queryType ) {
////    public void addTablesToQuery( StringBuilder queryBuilder, QueryData queryData ) {
//        int type = determineQueryType(queryType);
//
//        // make a list with all of the parameter list ids
//        Set<String> parameterListIdsUsed  = new HashSet<String>();
//        parameterListIdsUsed.addAll(getParameterListIdsUsed(queryWhere.getCriteria()));
//
//        // go through parameter list ids to see which tables need to be added
//        Set<JbpmEntity> additionalTables = new HashSet<JbpmEntity>();
//        for( String listId : parameterListIdsUsed ) {
//            switch( type ) {
//            case TASK_SUMMARY_QUERY_TYPE:
//                if( procInstLogNeededCriterias.contains(listId) ) {
//                    additionalTables.add(JbpmEntity.processInstanceLog);
//                } else if( varInstLogNeededCriterias.contains(listId) ) {
//                    additionalTables.add(JbpmEntity.variableInstanceLog);
//                }
//                break;
//            case VARIABLE_INSTANCE_LOG_QUERY_TYPE:
//                if( procInstLogNeededWithVarInstLogCriterias.contains(listId) ) {
//                    additionalTables.add(JbpmEntity.processInstanceLog);
//                }
//                if( taskNeededCriterias.contains(listId) ) {
//                    additionalTables.add(JbpmEntity.task);
//                }
//                if( organizationalEntityNeededCriterias.contains(listId) ) {
//                    if( listId.equals(STAKEHOLDER_ID_LIST) ) {
//                        additionalTables.add(JbpmEntity.stakeHolders);
//                    } else if( listId.equals(POTENTIAL_OWNER_ID_LIST) ) {
//                        additionalTables.add(JbpmEntity.potentialOwners);
//                    } else if( listId.equals(BUSINESS_ADMIN_ID_LIST) ) {
//                        additionalTables.add(JbpmEntity.businessAdministrators);
//                    }
//                }
//                break;
//            case PROCESS_INSTANCE_LOG_QUERY_TYPE:
//                if( varInstLogNeededCriterias.contains(listId) ) {
//                    additionalTables.add(JbpmEntity.variableInstanceLog);
//                } else if( taskNeededCriterias.contains(listId) ) {
//                    additionalTables.add(JbpmEntity.task);
//                }
//                break;
//            default:
//                throw new IllegalStateException("Unknown query type: " + type);
//            }
//        }
//
//        // Add the extra tables
//        for( JbpmEntity table : additionalTables ) {
//            // TODO?
//            switch( table ) {
//            case processInstanceLog:
//            case variableInstanceLog:
//            case task:
//            case businessAdministrators:
//            case potentialOwners:
//            case stakeHolders:
//            default:
//                throw new IllegalStateException("Unexpected table: " + table.toString());
//            }
//        }
//    }
//
//    private List<String> getParameterListIdsUsed(List<QueryCriteria> criteriaList) {
//        List<String> parameterListIdsUsed = new LinkedList<String>();
//        for( QueryCriteria criteria : criteriaList ) {
//           if( criteria.isGroupCriteria() ) {
//               parameterListIdsUsed.addAll(getParameterListIdsUsed(criteriaList));
//           } else {
//               parameterListIdsUsed.add(criteria.getListId());
//           }
//        }
//        return parameterListIdsUsed;
//    }
//
//    private enum JbpmEntityJoin {
//        auditLogToTask, // log.processInstanceId = task.taskData.processInstanceId
//        auditLogToAuditLog, // log.processInstanceId = otherLog.processInstanceId
//        taskToAuditLog // task.taskData.processInstanceId = log.processInstanceId
//    }
//
//    @Override
//    public <R, T> void addCriteriaToQuery( QueryWhere queryWhere, CriteriaQuery<R> query, CriteriaBuilder criteriaBuilder, Class<T> queryType ) {
//
//       int type = determineQueryType(queryType);
//
//       boolean addLastVariableQueryClause = false;
//       boolean addVariableValueQueryClause = false;
//
//       Set<String> parameterListIdsUsed  = new HashSet<String>();
//       parameterListIdsUsed.addAll(getParameterListIdsUsed(queryWhere.getCriteria()));
//
//       if( type != VARIABLE_INSTANCE_LOG_QUERY_TYPE ) {
//           Set<String> queryDataParms = new HashSet<String>(getParameterListIdsUsed(queryWhere.getCriteria()));
//           Iterator<String> iter = queryDataParms.iterator();
//           int lastAndVarValFound = 0;
//           while( iter.hasNext() && lastAndVarValFound < 3 ) {
//               String listId = iter.next();
//               if( lastAndVarValFound % 2 == 0 )  {
//                   if( varInstLogNeededCriterias.contains(listId) ) {
//                       addLastVariableQueryClause = true;
//                       ++lastAndVarValFound;
//                       continue;
//                   }
//               } else if( VAR_VALUE_ID_LIST.equals(listId) )  {
//                  addVariableValueQueryClause = true;
//                  lastAndVarValFound += 2;
//                  continue;
//               }
//           }
//       }
//
//       // task queries
//       if( type == TASK_SUMMARY_QUERY_TYPE ) {
//           internalAddCriteriaToQuery(
//                   queryWhere, query, criteriaBuilder,
//
//                   procInstLogNeededCriterias, JbpmEntity.processInstanceLog,
//                   JbpmEntityJoin.auditLogToTask,
//
//                   varInstLogNeededCriterias, JbpmEntity.variableInstanceLog,
//                   JbpmEntityJoin.auditLogToTask);
//       }
//
//       // variable log queries
//       else if( type == VARIABLE_INSTANCE_LOG_QUERY_TYPE ) {
//           internalAddCriteriaToQuery(
//                   queryWhere, query, criteriaBuilder,
//
//                   procInstLogNeededWithVarInstLogCriterias, JbpmEntity.processInstanceLog,
//                  JbpmEntityJoin.auditLogToAuditLog,
//
//                   taskNeededCriterias, JbpmEntity.task,
//                   JbpmEntityJoin.taskToAuditLog);
//       }
//
//       // process log queries
//       else if( type == PROCESS_INSTANCE_LOG_QUERY_TYPE ) {
//           internalAddCriteriaToQuery(
//                   queryWhere, query, criteriaBuilder,
//
//                   varInstLogNeededCriterias, JbpmEntity.variableInstanceLog,
//                  JbpmEntityJoin.auditLogToAuditLog,
//
//                   taskNeededCriterias, JbpmEntity.task,
//                   JbpmEntityJoin.taskToAuditLog);
//       }
//
//       if( type != VARIABLE_INSTANCE_LOG_QUERY_TYPE ) {
//           if( addLastVariableQueryClause ) {
//               queryData.getIntersectParameters().remove(LAST_VARIABLE_LIST);
//               // @formatter:off
//               StringBuilder queryPhraseBuilder = new StringBuilder(" (")
//                   .append(varInstLogTableId).append(".id IN (SELECT MAX(ll.id) FROM VariableInstanceLog ll ")
//                   .append("GROUP BY ll.variableId, ll.processInstanceId))");
//               // @formatter:on
//               queryAppender.addToQueryBuilder(queryPhraseBuilder.toString(), false);
//           }
//           if( addVariableValueQueryClause ) {
//               if( ! queryData.intersectParametersAreEmpty() ) {
//                   List<String> varValParameters = (List<String>) queryData.getIntersectParameters().remove(VAR_VALUE_ID_LIST);
//                   if( varValParameters != null && ! varValParameters.isEmpty() ) {
//                      List<Object[]> varValCriteria = new ArrayList<Object[]>();
//                      checkVarValCriteria(varValParameters, false, false, varValCriteria);
//                      addVarValCriteria(! queryAppender.hasBeenUsed(), queryAppender, varInstLogTableId, varValCriteria);
//                      queryAppender.markAsUsed();
//                      queryAppender.queryBuilderModificationCleanup();
//                   }
//               }
//               if( ! queryData.intersectRegexParametersAreEmpty() ) {
//                   List<String> varValRegexParameters = queryData.getIntersectRegexParameters().remove(VAR_VALUE_ID_LIST);
//                   if( varValRegexParameters != null && ! varValRegexParameters.isEmpty() ) {
//                      List<Object[]> varValCriteria = new ArrayList<Object[]>();
//                      checkVarValCriteria(varValRegexParameters, false, true, varValCriteria);
//                      addVarValCriteria(! queryAppender.hasBeenUsed(), queryAppender, varInstLogTableId, varValCriteria);
//                      queryAppender.markAsUsed();
//                      queryAppender.queryBuilderModificationCleanup();
//                   }
//               }
//           }
//       }
//
//       int end = "SELECT".length();
//       if( type == VARIABLE_INSTANCE_LOG_QUERY_TYPE || type == PROCESS_INSTANCE_LOG_QUERY_TYPE ) {
//           queryAppender.getQueryBuilder().replace(0, end, "SELECT DISTINCT");
//       }
//    }
//
//    private static <T> void internalAddCriteriaToQuery(QueryWhere queryWhere, CriteriaQuery<T> query, CriteriaBuilder builder,
//           Set<String> firstNeededCriterias, JbpmEntity firstTable,
//           JbpmEntityJoin firstTableIdJoinClause,
//
//           Set<String> otherNeededCriterias, JbpmEntity otherTable,
//           JbpmEntityJoin otherTableJoinClause ) {
//
//        boolean addFirstTableJoinClause = false;
//        boolean addOtherTableJoinClause = false;
//
//        Set<String> processedListIds = new HashSet<String>();
//
//        Iterator<QueryCriteria> iter = queryWhere.getCriteria().iterator();
//        while( iter.hasNext() ) {
//            QueryCriteria criteria = iter.next();
//            String listId = criteria.getListId();
//            if( VAR_VALUE_ID_LIST.equals(listId) ) {
//                if( firstNeededCriterias.contains(listId) ) {
//                    addFirstTableJoinClause = true;
//                } else if ( otherNeededCriterias.contains(listId) ) {
//                    addOtherTableJoinClause = true;
//                }
//                continue;
//            }
//            if( firstNeededCriterias.contains(listId) )   {
//                iter.remove(); // to prevent double processing of this criteria
//                addCriteriaToQuery(criteria, firstTable, firstTableIdJoinClause, query, builder);
//            } else if( otherNeededCriterias.contains(listId) ) {
//                iter.remove(); // to prevent double processing of this criteria
//                addCriteriaToQuery(criteria, otherTable, otherTableJoinClause, query, builder);
//            }
//        }
//
//        for( String processedListId : processedListIds ) {
//            // remove processListId from criteria, so it's not processed twice!!
//        }
//        processedListIds.clear();
//
//        if( addFirstTableJoinClause ) {
//            // add join clause to first table id
//        }
//        if( addOtherTableJoinClause ) {
//            // add join clause to other table id
//        }
//    }
//
//    private static <T> void addCriteriaToQuery( QueryCriteria criteria, JbpmEntity table, JbpmEntityJoin joinType, CriteriaQuery<T> query, CriteriaBuilder builder ) {
//
//        Set<Root<?>> queryRoots = query.getRoots();
//        assert ! queryRoots.isEmpty() : "This query does not have any root tables!";
//
//        if( queryRoots.size() > 1 ) {
//            StringBuffer msg = new StringBuffer("This should not be possible! There are multiple query roots: ");
//            Iterator<Root<?>> iter = queryRoots.iterator();
//            msg.append(iter.next().getJavaType().getSimpleName());
//            while( iter.hasNext() ) {
//                msg.append(", ").append(iter.next().getJavaType().getSimpleName());
//            }
//            throw new IllegalStateException(msg.toString());
//        }
//
//        // TODO: add criteria
//    }

}


text:
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI, GHCForeignImportPrim,
             UnboxedTuples, MagicHash, UnliftedFFITypes, LambdaCase #-}
module GHCJS.DOM.JSFFI.Geolocation (
    module Generated
  , js_getCurrentPosition
  , getCurrentPosition'
  , getCurrentPosition
) where

import GHC.Base (IO(..))
import GHC.Prim (RealWorld, State#, ByteArray#)

import Control.Monad.IO.Class (MonadIO(..))

import GHCJS.Prim (JSRef(..))
import GHCJS.Foreign (jsNull)
import GHCJS.Marshal.Pure (pFromJSRef)
import GHCJS.DOM.Types

import GHCJS.DOM.JSFFI.PositionError (throwPositionException)
import GHCJS.DOM.JSFFI.Generated.Geolocation as Generated hiding (js_getCurrentPosition, getCurrentPosition)

foreign import javascript interruptible
        "$1[\"getCurrentPosition\"](function(pos) { $c(true, pos); }, function(e) { $c(false, e); }, $2);" js_getCurrentPosition ::
        JSRef Geolocation -> JSRef PositionOptions -> State# RealWorld -> (# State# RealWorld, Bool, ByteArray# #)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Geolocation.getCurrentPosition Mozilla Geolocation.getCurrentPosition documentation>
getCurrentPosition' :: MonadIO m => Geolocation -> Maybe PositionOptions -> m (Either PositionError Geoposition)
getCurrentPosition' self options = liftIO . IO $ \s# ->
      case js_getCurrentPosition (unGeolocation self) (maybe jsNull unPositionOptions options) s# of
          (# s2#, False, error #) -> (# s2#, Left  (PositionError (JSRef error)) #)
          (# s2#, True,  pos   #) -> (# s2#, Right (Geoposition   (JSRef pos  )) #)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Geolocation.getCurrentPosition Mozilla Geolocation.getCurrentPosition documentation>
getCurrentPosition :: MonadIO m => Geolocation -> Maybe PositionOptions -> m Geoposition
getCurrentPosition self options = getCurrentPosition' self options >>= either throwPositionException return


text:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Javanotes 6.0, Chapter 1 -- Overview: The Mental Landscape</title>
<link type="text/css" rel="stylesheet" href="../javanotes.css">

        [  First Section |
           Next Chapter |
           Main Index ]

Chapter 1

Overview: The Mental Landscape

<big>W</big>hen you begin a journey, it's a good idea to have
   a mental map of the terrain you'll be passing through. The same is true for an
   intellectual journey, such as learning to write computer programs. In this
   case, you'll need to know the basics of what computers are and how they work.
   You'll want to have some idea of what a computer program is and how one is
   created. Since you will be writing programs in the Java programming language,
   you'll want to know something about that language in particular and about the
   modern, networked computing environment for which Java is designed.

As you read this chapter, don't worry if you can't understand everything in
   detail. (In fact, it would be impossible for you to learn all the details from
   the brief expositions in this chapter.) Concentrate on learning enough about
   the big ideas to orient yourself, in preparation for the rest of the book.
   Most of what is covered in this chapter will be covered in much greater detail
   later in the book.

Contents of Chapter 1:

Section 1: The Fetch and Execute Cycle: Machine Language

Section 2: Asynchronous Events: Polling Loops and Interrupts

Section 3: The Java Virtual Machine

Section 4: Fundamental Building Blocks of Programs

Section 5: Objects and Object-oriented Programming

Section 6: The Modern User Interface

Section 7: The Internet and Beyond

Quiz on This Chapter

        [  First Section |
           Next Chapter |
           Main Index ]


text:
package joshie.harvest.quests.packet;

import io.netty.buffer.ByteBuf;
import joshie.harvest.core.HFTrackers;
import joshie.harvest.core.network.Packet;
import joshie.harvest.core.network.Packet.Side;
import joshie.harvest.core.network.PenguinPacket;
import joshie.harvest.knowledge.letter.LetterData;
import joshie.harvest.quests.data.QuestData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.network.ByteBufUtils;

import java.util.UUID;

@Packet(Side.CLIENT)
public class PacketSharedSync extends PenguinPacket {
    protected UUID uuid;

    public PacketSharedSync() {}
    public PacketSharedSync setUUID(UUID uuid) {
        this.uuid = uuid;
        return this;
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeBoolean(uuid != null);
        if (uuid != null) {
            ByteBufUtils.writeUTF8String(buf, uuid.toString());
        }
    }

    @Override
    public void fromBytes(ByteBuf buf) {
        if (buf.readBoolean()) {
            uuid = UUID.fromString(ByteBufUtils.readUTF8String(buf));
        }
    }

    @SuppressWarnings("unchecked")
   public <Q extends QuestData> Q getQuestDataFromPlayer(EntityPlayer player) {
        if (uuid == null) return (Q) HFTrackers.getPlayerTrackerFromPlayer(player).getQuests();
        else return (Q) HFTrackers.getTowns(player.world).getTownByID(uuid).getQuests();
    }

    @SuppressWarnings("unchecked")
    public <L extends LetterData> L getLetterDataFromPlayer(EntityPlayer player) {
        if (uuid == null) return (L) HFTrackers.getPlayerTrackerFromPlayer(player).getLetters();
        else return (L) HFTrackers.getTowns(player.world).getTownByID(uuid).getLetters();
    }
}


text:
<?php

class PSU_Oracle_Call extends PSU_Oracle_Caller {
	public $date_fields = array();
	public $in = array();
	public $out = array();
	public $procedure;
	public $type = 'procedure';

	public function __construct( $id, $procedure, $in = array(), $out = array(), $date_fields = array() ) {
		$this->id = $id;

		$this->procedure = $procedure;

		$this->in = PSU::params($in);
		$this->out = $out;

		$this->date_fields = PSU::params($date_fields);

		return $this;
	}//end constructor

	public function execute() {
		$prep = $this->prep();

		return parent::execute( $prep['sql'], $prep['in'], $prep['out'], $this->id );
	}//end execute

	public function prep() {
		$prep = array(
			'in' => array(),
			'out' => $this->out,
			'sql' => '',
		);

		$params = '';

		// parse params into parameter string
		foreach( $this->in as $key => $param ) {
			// check if there is an alias for this field
			$actual_key = $this->alias[ $key ] ?: $key;

			if( in_array( $actual_key, $this->date_fields ) ) {
				$params .= ", p_".$actual_key." => to_date('" . $param ."', 'YYYY-MM-DD')";
			} else {
				$params .= ", p_".$actual_key." => :".$key;
				$prep['in'][ $key ] = $param;
			}//end else
		}//end foreach

		if( $this->type == 'function' ) {
			$return = ':'.$this->return.' := ';
		}//end if

		$prep['sql'] .= $return.$this->procedure."(".trim($params, ',')."); \n";

		return $prep;
	}//end prep

	/**
	 * sets this Oracle Call as an oracle function rather than an oracle procedure
	 */
	public function is_function() {
		// set the type
		$this->type = 'function';

		// initialize a return variable name for ADOdb
		$this->return = 'return_'.$this->id;

		// add the return variable name to the out array
		$this->out[] = $this->return;

		return $this;
	}//end return
}//end PSU_Oracle_Call


text:
// bcrypt-test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <wincompat.h>
#include <bcrypt.h>
#include <stdio.h>
#include "picotls/ptlsbcrypt.h"
#include "picotls/minicrypto.h"

int KeyInit(BCRYPT_KEY_HANDLE *hKey, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz, const BYTE *proposedKey,
            DWORD proposedKeyLength, BYTE **ko, ULONG *ko_length)
{
    DWORD cbData = 0;
    HANDLE hAlgo = NULL;

    // Open an algorithm handle.
    NTSTATUS ret = BCryptOpenAlgorithmProvider(&hAlgo, name, NULL, 0);

    if (BCRYPT_SUCCESS(ret)) {
        // Set the properties to define the chaining mode
        ret = BCryptSetProperty(hAlgo, BCRYPT_CHAINING_MODE, (PBYTE)chain_mode, (ULONG)chain_mode_sz, 0);
    }

    *ko = NULL;
    *ko_length = 0;

    if (BCRYPT_SUCCESS(ret)) {
        DWORD ko_size = 0;
        ULONG cbResult = 0;

        ret = BCryptGetProperty(hAlgo, BCRYPT_OBJECT_LENGTH, (PUCHAR)&ko_size, (ULONG)sizeof(ko_size), &cbResult, 0);

        if (BCRYPT_SUCCESS(ret)) {
            *ko = (uint8_t *)malloc(ko_size);
            if (*ko == NULL) {
                ret = STATUS_NO_MEMORY;
            } else {
                *ko_length = ko_size;
                memset(*ko, 0, *ko_length);
            }
        }
    }

    if (BCRYPT_SUCCESS(ret)) {
        // Generate the key from supplied input key bytes.
        ret = BCryptGenerateSymmetricKey(hAlgo, hKey, *ko, *ko_length, (PBYTE)proposedKey, proposedKeyLength, 0);
    } else {
        if (*ko != NULL) {
            free(*ko);
            *ko = NULL;
            *ko_length = 0;
        }
    }

    if (hAlgo != NULL) {
        BCryptCloseAlgorithmProvider(hAlgo, 0);
    }

    return BCRYPT_SUCCESS(ret) ? 0 : -1;
}

void KeyRelease(BCRYPT_KEY_HANDLE *hKey, BYTE **ko, ULONG *ko_length)
{
    BCryptDestroyKey(*hKey);
    *hKey = NULL;
    if (*ko) {
        free(*ko);
    }
    *ko = NULL;
    *ko_length = 0;
}

int EncodeOneShot(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz, BYTE *key,
                  ULONG key_length,
    BYTE* iv, ULONG iv_length,
    BYTE *data, ULONG dataLength, uint64_t seq, BYTE *authData, ULONG authDataLength, ULONG authTagLength,
    BYTE *encrypted, ULONG encryptedLengthMax, ULONG *encryptedLength)
{

    BCRYPT_KEY_HANDLE hKey = NULL;
    BYTE *authTag = encrypted + dataLength;
    BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO bacmi;
    BYTE iv_nonce[PTLS_MAX_IV_SIZE];
    BYTE *ko = NULL;
    ULONG ko_length = 0;
    int ret = 0;

    *encryptedLength = 0;

    if (KeyInit(&hKey, name, chain_mode, chain_mode_sz, key, key_length, &ko, &ko_length) != 0) {
        return -1;
    }

    memset(authTag, 0, authTagLength);
    // Set the auth mode info for AEAD
    BCRYPT_INIT_AUTH_MODE_INFO(bacmi);
    ptls_aead__build_iv(aead, iv_nonce, iv, seq);
    bacmi.pbNonce = iv_nonce;
    bacmi.cbNonce = iv_length;
    bacmi.pbAuthData = authData;
    bacmi.cbAuthData = authDataLength;
    bacmi.pbTag = authTag;
    bacmi.cbTag = authTagLength;
    /* All other fields are set to NULL by the INIT macro. */

    /* If called with a NULL pointer for the data block, we will merely compute the block size. */
    DWORD cbCipherText = 0;
    NTSTATUS status = BCryptEncrypt(hKey, data, dataLength, &bacmi, NULL, 0, encrypted, encryptedLengthMax, &cbCipherText, 0);

    KeyRelease(&hKey, &ko, &ko_length);

    if (BCRYPT_SUCCESS(status)) {
        *encryptedLength = cbCipherText + authTagLength;
    } else {
        ret = -1;
    }

    return ret;
}

int DecodeOneShot(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz,
    BYTE *key, ULONG key_length, BYTE * iv, ULONG iv_length, BYTE *encrypted,
                  ULONG encryptedLength, uint64_t seq, BYTE *authData, ULONG authDataLength,
                  ULONG authTagLength, BYTE *decrypted, ULONG decryptedLengthMax, ULONG *decryptedLength)
{

    BCRYPT_KEY_HANDLE hKey = NULL;
    BYTE *authTag = encrypted + (encryptedLength - authTagLength);
    BYTE iv_nonce[PTLS_MAX_IV_SIZE];
    BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO bacmi;
    BYTE *ko = NULL;
    ULONG ko_length = 0;
    int ret = 0;

    *decryptedLength = 0;

    if (KeyInit(&hKey, name, chain_mode, chain_mode_sz, key, key_length, &ko, &ko_length) != 0) {
        return -1;
    }

    // Set the auth mode info for AEAD
    BCRYPT_INIT_AUTH_MODE_INFO(bacmi);
    ptls_aead__build_iv(aead, iv_nonce, iv, seq);
    bacmi.pbNonce = iv_nonce;
    bacmi.cbNonce = iv_length;
    bacmi.pbAuthData = authData;
    bacmi.cbAuthData = authDataLength;
    bacmi.pbTag = authTag;
    bacmi.cbTag = authTagLength;
    /* All other fields are set to NULL by the INIT macro. */

    /* If called with a NULL pointer for the data block, we will merely compute the block size. */
    DWORD cbCipherText = 0;
    NTSTATUS status = BCryptDecrypt(hKey, encrypted, encryptedLength - authTagLength, &bacmi, NULL, 0, decrypted,
                                    decryptedLengthMax, &cbCipherText, 0);

    KeyRelease(&hKey, &ko, &ko_length);

    if (BCRYPT_SUCCESS(status)) {
        *decryptedLength = cbCipherText;
    } else {
        ret = -1;
    }

    return ret;
}

int test_oneshot(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz)
{
    BYTE key[32];
    BYTE data[123];
    BYTE iv[PTLS_MAX_IV_SIZE];
    uint64_t nonce;
    BYTE authData[9];
    BYTE encrypted[256];
    ULONG encryptedLength;
    BYTE decrypted[256];
    ULONG decryptedLength;
    ULONG authTagLength = (ULONG)aead->tag_size;
    int ret = 0;

    assert(sizeof(key) >= aead->key_size);
    assert(sizeof(iv) >= aead->iv_size);
    assert(sizeof(data) + authTagLength <= sizeof(encrypted));
    assert(sizeof(decrypted) >= sizeof(encrypted));

    memset(key, 'k', sizeof(key));
    memset(data, 'd', sizeof(data));
    memset(iv, 'n', sizeof(iv));
    nonce = 0;
    memset(authData, 'a', sizeof(authData));

    ret = EncodeOneShot(aead, name, chain_mode, chain_mode_sz, key, (ULONG)aead->key_size, iv, (ULONG)aead->iv_size, data,
        123, nonce, authData, 9, authTagLength, encrypted, 256, &encryptedLength);

    printf("Encrypt one shot returns %d, l=%d\n", ret, encryptedLength);

    if (ret == 0) {
        ret = DecodeOneShot(aead, name, chain_mode, chain_mode_sz, key, (ULONG)aead->key_size,
            iv, (ULONG)aead->iv_size, encrypted, encryptedLength, nonce, authData, 9,
            authTagLength, decrypted, 256, &decryptedLength);

        printf("Decrypt one shot returns %d, l=%d\n", ret, decryptedLength);

        if (ret == 0) {
            if (decryptedLength != 123) {
                printf("Wrong length, not %d\n", 123);
                ret = -1;
            } else if (memcmp(data, decrypted, 123) != 0) {
                printf("Data and decrypted don't match\n");
                ret = -1;
            } else {
                printf("One shot matches.\n");
            }
        }
    }

    return ret;
}

void delete_test_aead_context(ptls_aead_context_t *ctx)
{
    if (ctx != NULL) {
        ctx->dispose_crypto(ctx);
        free(ctx);
    }
}

ptls_aead_context_t *new_test_aead_context(ptls_aead_algorithm_t *aead, int is_enc, BYTE *key, BYTE *iv)
{
    int ret = 0;
    ptls_aead_context_t *ctx = (ptls_aead_context_t *)malloc(aead->context_size);

    if (ctx != NULL) {
        memset(ctx, 0, aead->context_size);
        *ctx = (ptls_aead_context_t){aead};
        if (aead->setup_crypto(ctx, is_enc, key, iv) != 0) {
            printf("For %s, setup returns %d\n", aead->name, ret);
            delete_test_aead_context(ctx);
            ctx = NULL;
        }
    } else {
        printf("For %s, memory error during setup\n", aead->name);
    }

    return (ctx);
}

int test_decrypt(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz)
{
    BYTE key[32];
    BYTE iv[PTLS_MAX_IV_SIZE];
    BYTE data[123];
    uint64_t nonce;
    BYTE authData[9];
    BYTE encrypted[256];
    ULONG encryptedLength;
    BYTE decrypted[256];
    size_t decryptedLength;
    ULONG authTagLength = (ULONG)aead->tag_size;
    ptls_aead_context_t *ctx = NULL;
    int ret = 0;

    assert(sizeof(key) >= aead->key_size);
    assert(sizeof(iv) >= aead->iv_size);
    assert(sizeof(data) + authTagLength <= sizeof(encrypted));
    assert(sizeof(decrypted) >= sizeof(encrypted));

    memset(key, 'k', sizeof(key));
    memset(iv, 'n', sizeof(iv));
    memset(data, 'd', sizeof(data));
    nonce = 0;
    memset(authData, 'a', sizeof(authData));

    /* Create a decryption context */
    ctx = new_test_aead_context(aead, 0, key, iv);
    if (ctx == NULL) {
        ret = -1;
    }

    /* Do a simple encrypt using one shot bcrypt */
    if (ret == 0) {
        ret = EncodeOneShot(aead, name, chain_mode, chain_mode_sz, key, (ULONG)aead->key_size,
            iv, (ULONG)aead->iv_size, data, 123, nonce,
            authData, 9, authTagLength, encrypted, 256, &encryptedLength);
    }

    /* Try decrypt with library procedure */
    if (ret == 0) {
        decryptedLength = ctx->do_decrypt(ctx, decrypted, encrypted, encryptedLength, nonce, authData, 9);
        if (decryptedLength >= encryptedLength) {
            printf("For %s, decrypt returns %d\n", aead->name, (int)decryptedLength);
            ret = -1;
        } else if (decryptedLength != 123) {
            printf("For %s, decrypt returns %d instead of %d\n", aead->name, (int)decryptedLength, 123);
            ret = -1;
        } else if (memcmp(data, decrypted, decryptedLength) != 0) {
            printf("For %s, decrypted does not match clear text\n", aead->name);
            ret = -1;
        } else {
            printf("For %s, decrypting test passes.\n", aead->name);
        }
    }

    delete_test_aead_context(ctx);

    return ret;
}

int test_encrypt(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz)
{
    BYTE key[32];
    BYTE iv[PTLS_MAX_IV_SIZE];
    BYTE data[123];
    uint64_t nonce;
    BYTE authData[9];
    BYTE encryptedRef[256];
    ULONG encryptedRefLength;
    BYTE encrypted[256];
    size_t encryptedLength;
    ULONG authTagLength = (ULONG)aead->tag_size;
    ptls_aead_context_t *ctx = NULL;
    int ret = 0;

    assert(sizeof(key) >= aead->key_size);
    assert(sizeof(iv) >= aead->iv_size);
    assert(sizeof(data) + authTagLength <= sizeof(encrypted));
    assert(sizeof(data) + authTagLength <= sizeof(encryptedRef));

    memset(key, 'k', sizeof(key));
    memset(iv, 'n', sizeof(iv));
    memset(data, 'd', sizeof(data));
    nonce = 0;
    memset(authData, 'a', sizeof(authData));

    /* Create an encryption context */
    ctx = new_test_aead_context(aead, 1, key, iv);
    if (ctx == NULL) {
        ret = -1;
    }

    /* Do a simple encrypt using one shot bcrypt */
    if (ret == 0) {
        ret = EncodeOneShot(aead, name, chain_mode, chain_mode_sz, key, (ULONG)aead->key_size,
            iv, (ULONG)aead->iv_size, data, 123, nonce,
            authData, 9, authTagLength, encryptedRef, 256, &encryptedRefLength);
    }

    /* Try encrypt with library procedure */
    if (ret == 0) {
        ctx->do_encrypt_init(ctx, nonce, authData, 9);
        encryptedLength = ctx->do_encrypt_update(ctx, encrypted, data, 123);
        encryptedLength += ctx->do_encrypt_final(ctx, &encrypted[encryptedLength]);

        if (encryptedLength != encryptedRefLength) {
            printf("For %s, encrypt returns %d instead of %d\n", aead->name, (int)encryptedLength, encryptedRefLength);
            ret = -1;
        } else if (memcmp(encryptedRef, encrypted, encryptedRefLength) != 0) {
            printf("For %s, encrypted does not match ref\n", aead->name);
            for (ULONG i = 0; i < encryptedRefLength; i++) {
                if (encryptedRef[i] != encrypted[i]) {
                    printf("For %s, encrypted[%d] = 0x%02x vs encryptedRef[%d] = 0x%02x\n", aead->name, i, encrypted[i], i,
                           encryptedRef[i]);
                    break;
                }
            }
            ret = -1;
        } else {
            printf("For %s, encrypting test passes.\n", aead->name);
        }
    }

    delete_test_aead_context(ctx);

    return ret;
}

int test_encrypt_vector(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz)
{
    BYTE key[32];
    BYTE iv[PTLS_MAX_IV_SIZE];
    BYTE data[123];
    uint64_t nonce;
    BYTE authData[9];
    BYTE encryptedRef[256];
    ULONG encryptedRefLength;
    BYTE encrypted[256];
    size_t encryptedLength;
    ULONG authTagLength = (ULONG)aead->tag_size;
    ptls_aead_context_t *ctx = NULL;
    int ret = 0;

    assert(sizeof(key) >= aead->key_size);
    assert(sizeof(iv) >= aead->iv_size);
    assert(sizeof(data) + authTagLength <= sizeof(encrypted));
    assert(sizeof(data) + authTagLength <= sizeof(encryptedRef));

    memset(key, 'k', sizeof(key));
    memset(iv, 'n', sizeof(iv));
    memset(data, 'd', sizeof(data));
    nonce = 0;
    memset(authData, 'a', sizeof(authData));

    /* Create an encryption context */
    ctx = new_test_aead_context(aead, 1, key, iv);
    if (ctx == NULL) {
        ret = -1;
    }

    if (ret == 0) {
        ret = EncodeOneShot(aead, name, chain_mode, chain_mode_sz, key, (ULONG)aead->key_size, iv, (ULONG)aead->iv_size, data, 123,
                            nonce, authData, 9, authTagLength, encryptedRef, 256, &encryptedRefLength);
    }

    /* Try encrypt with vector procedure */
    if (ret == 0) {
        ptls_iovec_t input_vec[2];

        input_vec[0].base = data;
        input_vec[0].len = 23;
        input_vec[1].base = data + 23;
        input_vec[1].len = 100;

        ptls_aead_encrypt_v(ctx, encrypted, input_vec, 2, nonce, authData, 9);
        encryptedLength = 123 + authTagLength;

        if (encryptedLength != encryptedRefLength) {
            printf("For %s, encrypt_v returns %d instead of %d\n", aead->name, (int)encryptedLength, encryptedRefLength);
            ret = -1;
        } else if (memcmp(encryptedRef, encrypted, encryptedRefLength) != 0) {
            printf("For %s, vector encrypted does not match ref\n", aead->name);
            for (ULONG i = 0; i < encryptedRefLength; i++) {
                if (encryptedRef[i] != encrypted[i]) {
                    printf("For %s, vector encrypted[%d] = 0x%02x vs encryptedRef[%d] = 0x%02x\n", aead->name, i, encrypted[i], i,
                           encryptedRef[i]);
                    break;
                }
            }
            ret = -1;
        } else {
            printf("For %s, vector encrypting test passes.\n", aead->name);
        }
    }

    delete_test_aead_context(ctx);

    return ret;
}

int test_for_size(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz)
{
    BYTE key[32];
    BYTE iv[PTLS_MAX_IV_SIZE];
    uint64_t nonce;
    BYTE authData[9];
    BYTE *data = NULL;
    BYTE *encrypted = NULL;
    BYTE *decrypted = NULL;
    size_t encryptedLength;
    size_t decryptedLength;
    ULONG authTagLength = (ULONG)aead->tag_size;
    ptls_aead_context_t *ctx_e = NULL;
    ptls_aead_context_t *ctx_d = NULL;
    ULONG packet_size[] = {1500, 128, 3, 0};
    ULONG nb_packet_size = (ULONG)(sizeof(packet_size) / sizeof(ULONG));
    int ret = 0;

    assert(sizeof(key) >= aead->key_size);
    assert(sizeof(iv) >= aead->iv_size);

    memset(key, 'k', sizeof(key));
    memset(key, 'n', sizeof(iv));
    nonce = 0;
    memset(authData, 'a', sizeof(authData));

    /* Create the encryption contexts */
    ctx_e = new_test_aead_context(aead, 1, key, iv);
    ctx_d = new_test_aead_context(aead, 0, key, iv);

    if (ctx_e == NULL || ctx_d == NULL) {
        ret = -1;
    }

    /* Test a variety of packet sizes */
    for (ULONG i = 0; ret == 0 && i < nb_packet_size; i++) {
        ULONG data_size = (packet_size[i] > 0) ? packet_size[i] : 128;
        ULONG encrypted_size = packet_size[i] + authTagLength;

        data = (BYTE *)malloc(data_size);
        encrypted = (BYTE *)malloc(encrypted_size);
        decrypted = (BYTE *)malloc(data_size);

        if (data == NULL || encrypted == NULL || decrypted == NULL) {
            printf("For %s: cannot allocate memory for packet size[%d] = %d\n", aead->name, i, packet_size[i]);
        } else {
            memset(data, 'd', data_size);

            ctx_e->do_encrypt_init(ctx_e, nonce, authData, 9);
            encryptedLength = ctx_e->do_encrypt_update(ctx_e, encrypted, data, packet_size[i]);
            encryptedLength += ctx_e->do_encrypt_final(ctx_e, &encrypted[encryptedLength]);
            decryptedLength = ctx_d->do_decrypt(ctx_d, decrypted, encrypted, encryptedLength, nonce, authData, 9);

            if (decryptedLength >= encryptedLength) {
                printf("For %s, decrypt returns %d\n", aead->name, (int)decryptedLength);
                ret = -1;
            } else if (decryptedLength != packet_size[i]) {
                printf("For %s, decrypt returns %d instead of %d\n", aead->name, (int)decryptedLength, packet_size[i]);
                ret = -1;
            } else if (memcmp(data, decrypted, decryptedLength) != 0) {
                printf("For %s, decrypted does not match clear text\n", aead->name);
                ret = -1;
            } else {
                printf("For %s, test packet size[%d] = %d passes.\n", aead->name, i, packet_size[i]);
            }
        }

        if (data != NULL) {
            free(data);
            data = NULL;
        }

        if (encrypted != NULL) {
            free(encrypted);
            encrypted = NULL;
        }

        if (decrypted != NULL) {
            free(decrypted);
            decrypted = NULL;
        }
    }

    delete_test_aead_context(ctx_e);
    delete_test_aead_context(ctx_d);

    return ret;
}

int test_one_aead(ptls_aead_algorithm_t *aead, wchar_t *name, wchar_t *chain_mode, size_t chain_mode_sz)
{
    int ret = test_oneshot(aead, name, chain_mode, chain_mode_sz);

    printf("For %s, test one shot returns %d\n", aead->name, ret);

    if (ret == 0) {
        ret = test_decrypt(aead, name, chain_mode, chain_mode_sz);

        printf("For %s, test decrypt returns %d\n", aead->name, ret);
    }

    if (ret == 0) {
        ret = test_encrypt(aead, name, chain_mode, chain_mode_sz);

        printf("For %s, test encrypt returns %d\n", aead->name, ret);
    }

    if (ret == 0) {
        ret = test_encrypt_vector(aead, name, chain_mode, chain_mode_sz);

        printf("For %s, test encrypt returns %d\n", aead->name, ret);
    }

    if (ret == 0) {
        ret = test_for_size(aead, name, chain_mode, chain_mode_sz);

        printf("For %s, test packet sizes returns %d\n", aead->name, ret);
    }

    return ret;
}

/* Test of cipher functions.
 * The test verifies that a message encode with a bcrypt function can be
 * decoded with a minicrypto function, and vice versa.
 */

int test_cipher_one_way(char const *name1, char const *name2, ptls_cipher_algorithm_t *b1, ptls_cipher_algorithm_t *b2,
                        unsigned int nb_blocks)
{
    BYTE key[32];
    BYTE nonce[16];
    BYTE data[128];
    BYTE encrypted[128];
    BYTE decrypted[128];
    size_t data_size = b1->block_size * nb_blocks;
    ptls_cipher_context_t *ctx1 = NULL;
    ptls_cipher_context_t *ctx2 = NULL;
    int ret = 0;

    assert(sizeof(key) >= b1->key_size);
    assert(sizeof(data) >= data_size);
    assert(sizeof(nonce) >= b1->iv_size);

    memset(key, 'k', sizeof(key));
    memset(data, 'd', data_size);

    ctx1 = ptls_cipher_new(b1, 1, key);
    ctx2 = ptls_cipher_new(b2, 0, key);

    if (ctx1 == NULL || ctx2 == NULL) {
        ret = -1;
    } else {
        memset(nonce, 0, sizeof(nonce));
        if (ctx1->do_init != NULL) {
            ctx1->do_init(ctx1, nonce);
        }

        if (ctx2->do_init != NULL) {
            ctx2->do_init(ctx2, nonce);
        }

        ctx1->do_transform(ctx1, encrypted, data, data_size);
        ctx2->do_transform(ctx2, decrypted, encrypted, data_size);

        if (memcmp(data, decrypted, data_size) != 0) {
            printf("For %s -> %s, decrypted does not match clear text\n", name1, name2);
            ret = -1;
        } else {
            printf("For %s -> %s, test passes.\n", name1, name2);
        }
    }

    if (ctx1 != NULL) {
        ptls_cipher_free(ctx1);
    }

    if (ctx2 != NULL) {
        ptls_cipher_free(ctx2);
    }

    return ret;
}

int test_cipher_pair(char const *name1, char const *name2, ptls_cipher_algorithm_t *b1, ptls_cipher_algorithm_t *b2,
                     unsigned int nb_blocks)
{
    int ret = test_cipher_one_way(name1, name2, b1, b2, nb_blocks);

    if (ret == 0) {
        ret = test_cipher_one_way(name2, name1, b2, b1, nb_blocks);
    }

    return ret;
}

/* Test of the hash functions
 */

int test_hash_calc(char const *name1, char const *name2, ptls_hash_algorithm_t *h1, ptls_hash_algorithm_t *h2)
{
    BYTE data[123];
    BYTE tag1[128];
    BYTE tag2[128];
    ptls_hash_context_t *ctx1 = NULL;
    ptls_hash_context_t *ctx2 = NULL;
    int ret = 0;

    assert(sizeof(tag1) >= h1->digest_size);
    assert(sizeof(tag2) >= h2->digest_size);
    assert(h1->digest_size == h2->digest_size);

    memset(data, 'd', sizeof(data));
    memset(tag1, '1', sizeof(tag1));
    memset(tag2, '2', sizeof(tag2));

    if (h1->digest_size != h2->digest_size) {
        ret = -1;
    }
    if (ret == 0) {
        ret = ptls_calc_hash(h1, tag1, data, sizeof(data));
    }

    if (ret == 0) {
        ret = ptls_calc_hash(h2, tag2, data, sizeof(data));
    }

    if (ret == 0){
        if (memcmp(tag1, tag2, h1->digest_size) != 0) {
            printf("For %s -> %s, hash1 does not match hash2\n", name1, name2);
            ret = -1;
        } else {
            printf("For %s -> %s, hash test passes.\n", name1, name2);
        }
    }

    return ret;
}

/* Minimal test program for the bcrypt functions.
 * Need to add tests for the SHA256 and SHA384 implementations.
 */

int main()
{
    int ret = 0;

    ret |= test_cipher_pair("bcrypt aes128ecb", "minicrypto aes128ecb", &ptls_bcrypt_aes128ecb, &ptls_minicrypto_aes128ecb, 1);
    ret |= test_cipher_pair("bcrypt aes256ecb", "minicrypto aes256ecb", &ptls_bcrypt_aes256ecb, &ptls_minicrypto_aes256ecb, 1);

    ret |= test_cipher_pair("bcrypt aes128ctr", "minicrypto aes128ctr", &ptls_bcrypt_aes128ctr, &ptls_minicrypto_aes128ctr, 4);
    ret |= test_cipher_pair("bcrypt aes256ctr", "minicrypto aes256ctr", &ptls_bcrypt_aes256ctr, &ptls_minicrypto_aes256ctr, 4);

    ret |= test_one_aead(&ptls_bcrypt_aes128gcm, BCRYPT_AES_ALGORITHM, BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM));

    ret |= test_one_aead(&ptls_bcrypt_aes256gcm, BCRYPT_AES_ALGORITHM, BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM));

    ret |= test_hash_calc("bcrypt sha256", "minicrypto sha256", &ptls_bcrypt_sha256, &ptls_minicrypto_sha256);
    ret |= test_hash_calc("bcrypt sha384", "minicrypto sha384", &ptls_bcrypt_sha384, &ptls_minicrypto_sha384);

    exit(ret);
}


text: /* Only premium users are allowed to update a component */


text:
package example;

public class Contact {
    private String name;
    private String phone;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String toString() {
        return "name: " + name
                + "\nphone: " + phone;
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Hedwigia 52: 371 (1912)

#### Original name
Pluteus brunneoferruginosus Herp.

### Remarks
null


text:
package tablesaw;

import tablesaw.RegExFileSet;

import java.io.File;

public class RegExFileSetWrapper extends RegExFileSet
	{
	public RegExFileSetWrapper(String baseDir, String filePattern)
		{
		super(baseDir, filePattern);
		}

	public String getFileAction(java.io.File file, java.io.File dir)
		{
		return (getAction(file, dir).toString());
		}
	}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Sortable - UIkit tests</title>

Sortable

Grid

Test 1

Test 2

Test 3

Test 4

Test 5

Test 6

Test 7

Test 8

Test 9

Test 10

Test 11

Test 12

Stacked

Test 1

Test 2

Test 3

Test 4

Test 5


text:
package me.chanjar.jms.base.factory.consumer;

import javax.jms.Destination;

public class MessageConsumerOption {

  private String messageSelector;
  private Boolean noLocal;

  public String getMessageSelector() {
    return messageSelector;
  }

  /**
   * 可选, {@link javax.jms.Session#createConsumer(Destination, String)}
   *
   * @param messageSelector
   */
  public void setMessageSelector(String messageSelector) {
    this.messageSelector = messageSelector;
  }

  public Boolean getNoLocal() {
    return noLocal;
  }

  /**
   * 可选, {@link javax.jms.Session#createConsumer(Destination, String, boolean)}
   *
   * @param noLocal
   */
  public void setNoLocal(Boolean noLocal) {
    this.noLocal = noLocal;
  }
}


text:
streamcorpus-zoner
==================

streamcorpus-zoner is a streamcorpus-pipeline transform that provides
a trainable text document segmenter that identifies zones of a
document automatically.

This python package provides a transform stage called `zoner` that can
be configured to chop out unwanted sections of
`StreamItem.body.clean_{html,visible}` before NER tagging.


text:
if (! require('./cli/dev-bundle-bin-commands.js').process) {
  // Set up the Babel transpiler
  require('./tool-env/install-babel.js');

  // Run the Meteor command line tool
  require('./cli/main.js');
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: albertoperezperez
 * Date: 29/06/14
 * Time: 17:25
 */

namespace Configuration;

/**
 * Class Configuration
 * Contains information about the site shared among all classes
 * @package Configuration
 */
class Configuration {

    /**
     * @var Singleton configuration instance
     */
    private static $instance;

    /**
     * @var The menu options array
     */
    private $menuOptions;

    /**
     * @var int maximum image width
     */
    private $maxImageWidth;

    /**
     * @var int maximum image height
     */
    private $maxImageHeight;

    /**
     * @var string Images temporal folder
     */
    private $imagesFolder;

    /**
     * @var string Galery images temporal folder
     */
    private $galeryImagesFolder;

    /**
     * @var array Allowed file types
     */
    private $allowedFileTypes;

    /**
     * @var array The image mime types allowed
     */
    private $allowedMimeTypes;

    /**
     * Class Constructor, intializes the class properties
     */
    public function __construct() {

        //TODO:Separate into enumerate or something. define doesn't work
        $this->menuOptions = array(0 => 'inicio',
                                   1 => 'noticias',
                                   2 => 'asociacion',
                                   3 => 'ofertas',
                                   4 => 'agenda',
                                   5 => 'asociate',
                                   6 => 'galeria',
                                   7 => 'contacto');

        $this->menuModules = array(0 => 'home',
                                   1 => 'news',
                                   2 => 'asociation',
                                   3 => 'jobOffers',
                                   4 => 'agenda',
                                   5 => 'asociate',
                                   6 => 'galery',
                                   7 => 'contact',
                                   8 => 'search',
                                   9 => 'profile',
                                   10 => 'profileEdition');

        $this->maxImageWidth = 500;
        $this->maxImageHeight = 200;

        $this->imagesFolder = "images/tmp";
        $this->galeryImagesFolder = "images/tmp/galery";
        $this->allowedMimeTypes = array ("image/jpeg","image/jpg","image/png","image/gif");
        $this->allowedFileTypes = array ("jpg","jpeg","gif","png");

    }

    /**
     * Singleton implementation. Returns the shared configuration instance
     *
     * @return configuration instance
     */
    public static function sharedInstance () {

        if (Configuration::$instance == null) {

             Configuration::$instance = new Configuration();

        }

        return Configuration::$instance;

    }

    /**
     * Returns the menu options array
     *
     * @return array with the menu options
     */
    public function getMenuOptions() {

        return $this->menuOptions;

    }

    /**
     * Returns the menu modules array
     *
     * @return array with the modules for the menu options
     */
    public function getMenuModules() {

        return $this->menuModules;

    }

    /**
     * Returns the max image width
     * @return int the max image width
     */
    public function getImageMaxWidth() {

        return $this->maxImageWidth;
    }

    /**
     * Returns the max image height
     * @return int the max image height
     */
    public function getImageMaxHeight() {

        return $this->maxImageHeight;

    }

    /**
     * Returns the images folder
     * @return string the images folder
     */
    public function getImagesFolder() {

        return $this->imagesFolder;

    }

    /**
     * Returns the galery images folder
     * @return string the galery images folder
     */
    public function getGaleryImagesFolder() {

        return $this->galeryImagesFolder;

    }

    /**
     * Returns the allowed file types array
     *
     * @return array with the allowed file types
     */
    public function getAllowedFileTypes () {

        return $this->allowedFileTypes;

    }

    /**
     * Returns the allowed mime types array
     *
     * @return array with the allowed mime types
     */
    public function getAllowedMimeTypes () {

        return $this->allowedMimeTypes;

    }

}


text:
"""Create a virtual environment for the project"""
import argparse
from contextlib import suppress
from pathlib import Path
from typing import List, Optional

from .. import dependencies as deps
from ..actions import Action, ActionParams, ScaffoldOpts, Structure
from ..file_system import PathLike, chdir
from ..identification import get_id
from ..log import logger
from ..shell import get_command, get_executable
from . import Extension, store_with

DEFAULT: PathLike = ".venv"
"""Default directory name for collocated virtual environment that will be created"""

class Venv(Extension):
    """\
    Create a virtual environment for the project (using virtualenv or stdlib's venv).
    Default location: "{DEFAULT}".

    If ``virtualenv`` is available, it will be used, since it has some advantages over
    stdlib's ``venv`` (such as being faster, see https://virtualenv.pypa.io/en/stable/).

    Notice that even if part of Python's stdlib, ``venv`` is not guaranteed to be
    installed, some OS/distributions (such as Ubuntu) require an explicit installation.
    If you have problems, try installing virtualenv with pip and run the command again.
    """

    persist = False  # We just want the virtual env to be created on fresh projects

    def augment_cli(self, parser: argparse.ArgumentParser):
        """Augments the command-line interface parser.
        See :obj:`~pyscaffold.extension.Extension.augment_cli`.
        """
        parser.add_argument(
            self.flag,
            action=store_with(self),
            nargs="?",
            const=DEFAULT,
            default=argparse.SUPPRESS,
            type=Path,
            help=self.help_text.format(DEFAULT=DEFAULT),
        )
        parser.add_argument(
            "--venv-install",
            action=store_with(self),
            nargs="+",
            default=argparse.SUPPRESS,
            metavar="PACKAGE",
            help="install packages inside the created venv. "
            "The packages can have dependency ranges as if they would be written to a "
            "`requirements.txt` file, but remember to use quotes to avoid messing with "
            "the terminal",
        )
        return self

    def activate(self, actions: List[Action]) -> List[Action]:
        """Activate extension, see :obj:`~pyscaffold.extension.Extension.activate`."""
        actions = self.register(actions, run, after="init_git")
        actions = self.register(actions, install_packages, after=get_id(run))
        return self.register(actions, instruct_user, before="report_done")

def run(struct: Structure, opts: ScaffoldOpts) -> ActionParams:
    """Action that will create a virtualenv for the project"""

    project_path = opts["project_path"]
    venv_path = Path(opts.get("venv", DEFAULT))

    with chdir(project_path, **opts):
        if venv_path.is_dir():
            logger.report("skip", venv_path)
            return struct, opts

        create(venv_path, opts.get("pretend"))

    return struct, opts

def install_packages(struct: Structure, opts: ScaffoldOpts) -> ActionParams:
    """Install the specified packages inside the created venv."""

    packages = opts.get("venv_install")
    if not packages:
        return struct, opts

    pretend = opts.get("pretend")
    venv_path = get_path(opts)

    if not pretend:
        pip = get_command("pip", venv_path, include_path=False)
        if not pip:
            raise NotInstalled(f"pip cannot be found inside {venv_path}")
        pip("install", "-U", *deps.deduplicate(packages))

    logger.report("run", f"pip install -U {' '.join(packages)} [{venv_path}]")
    return struct, opts

def instruct_user(struct: Structure, opts: ScaffoldOpts) -> ActionParams:
    """Simply display a message reminding the user to activate the venv."""

    venv = opts.get("venv", DEFAULT)
    if opts.get("pretend"):
        logger.warning(f"\nA virtual environment was created: `{venv}`.\n")
        return struct, opts

    project = Path(opts["project_path"]).resolve()
    with chdir(project, **opts):
        venv_path = Path(venv)
        python_exe = get_executable("python", venv_path, include_path=False)
        pip_exe = get_executable("pip", venv_path, include_path=False)

    if python_exe and pip_exe:
        python = Path(python_exe).relative_to(project)
        pip = Path(pip_exe).relative_to(project)

        logger.warning(
            f"\nA virtual environment was created in the `{venv_path}` directory.\n"
            "You need to activate it (every time you open a new terminal),\n"
            f"or call directly {python} and {pip}.\n"
        )

    return struct, opts

def get_path(opts: ScaffoldOpts, default=DEFAULT) -> Path:
    """Get the path to the venv that will be created."""
    with chdir(opts.get("project_path", "."), **opts):
        return Path(opts.get("venv", default)).resolve()

def create_with_virtualenv(path: Path, pretend=False):
    import virtualenv

    args = [str(path)]

    if pretend:
        virtualenv.session_via_cli(args)
    else:
        logger.warning("\nInstalling virtual environment, it might take a while...\n")
        virtualenv.cli_run(args)

    logger.report("virtualenv", path)

def create_with_stdlib(path: Path, pretend=False):
    import venv

    if not pretend:
        logger.warning("\nInstalling virtual environment, it might take a while...\n")
        venv.create(str(path), with_pip=True)

    logger.report("venv", path)

def create(path: Path, pretend=False):
    """Create the virtual environment with the first technique available.
    (``virtualenv`` is preferred because it is faster).
    """
    for creator in (create_with_virtualenv, create_with_stdlib):
        with suppress(ImportError):
            creator(path, pretend)
            break
    else:
        # no break statement found, so no creator function executed correctly
        raise NotInstalled()

class NotInstalled(ImportError):
    """Neither virtualenv or venv are installed in the computer. Please check the
    following alternatives:

    - ``virtualenv`` can be installed via pip
    - ``venv`` is supposed to installed by default with Python3, however some OS or
      distributions (such as Ubuntu) break the standard library in a series of packages
      that need to be manually installed via OS package manager.
      You can try to search for a ``python-venv``, ``python3-venv`` or similar in the
      official repositories.
    """

    def __init__(self, msg: Optional[str] = None):
        super().__init__(msg or self.__doc__)


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace AutoMappingExercise.Models.DTOs
{
    public class EmployeeInfoDto
    {
        public int EmployeeId { get; set; }

        public string FirstName { get; set; }

        public string LastName { get; set; }

        public decimal Salary { get; set; }
    }
}


text:
namespace base {
class MessageLoopProxy;
}  // namespace base

namespace buzz {
class XmlElement;
}  // namespace buzz

namespace remoting {

class RsaKeyPair;
class IqSender;

// HostStatusSender sends the host status to the Chromoting Bot.
// Each host status stanza looks as follows:
//
// <cli:iq type="set" to="user@gmail.com/chromoting123123"
//     id="123" xmlns:cli="jabber:client">
//   <rem:host-status rem:hostid="0"
//       rem:status="OFFLINE" rem:exit-code="INVALID_HOST_CONFIGURATION"
//       xmlns:rem="google:remoting">
//     <rem:signature rem:time="1372878097">.signature.</rem:signature>
//     <rem:host-version>30.0.1554.0</rem:host-version>
//     <rem:log><rem:entry cpu="x86_64" event-name="host-status"
//         host-version="30.0.1560.0" os-name="Linux" role="host"/>
//     </rem:log>
//   </rem:host-status>
// </cli:iq>
//
// The signature is a base-64 encoded SHA-1 hash, signed with the host's
// private RSA key. The message being signed contains the full Jid (e.g.
// "user@gmail.com/chromoting123123"), the timestamp, the host status,
// and the exit code.
class HostStatusSender : SignalStrategy::Listener {
 public:

  enum HostStatus {
    OFFLINE = 0,
    ONLINE = 1
  };

  HostStatusSender(const std::string& host_id,
                   SignalStrategy* signal_strategy,
                   scoped_refptr<RsaKeyPair> key_pair,
                   const std::string& directory_bot_jid);
  virtual ~HostStatusSender();

  // SignalStrategy::Listener interface.
  virtual void OnSignalStrategyStateChange(
      SignalStrategy::State state) OVERRIDE;
  virtual bool OnSignalStrategyIncomingStanza(
      const buzz::XmlElement* stanza) OVERRIDE;

  // APIs for sending host status XMPP messages to the chromoting bot.
  // status: the reason (exit code) why the host is offline.
  void SendOnlineStatus();
  void SendOfflineStatus(HostExitCodes exit_code);

  inline static const char* HostStatusToString(HostStatus host_status) {
    return host_status_strings_[host_status];
  }

 private:
  // Helper method for sending either an online or an offline status message.
  void SendHostStatus(HostStatus status, HostExitCodes exit_code);

  // Helper method to compose host status stanzas.
  scoped_ptr<buzz::XmlElement> CreateHostStatusMessage(
      HostStatus status, HostExitCodes exit_code);

  // Helper method to create the signature blob used in the host status stanza.
  scoped_ptr<buzz::XmlElement> CreateSignature(
      HostStatus status, HostExitCodes exit_code);

  std::string host_id_;
  SignalStrategy* signal_strategy_;
  scoped_refptr<RsaKeyPair> key_pair_;
  std::string directory_bot_jid_;
  scoped_ptr<IqSender> iq_sender_;

  // The string representation of the HostStatus values.
  static const char* const host_status_strings_[2];

  DISALLOW_COPY_AND_ASSIGN(HostStatusSender);
};

}  // namespace remoting

#endif  // REMOTING_HOST_STATUS_SENDER_H_


text:
package src;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class DataInfo {
	private String file;

	public DataInfo(String file) {
		this.file = file;
	}

	public void clearDataInfo() {
		try {
			PrintWriter writer = new PrintWriter(file);
			writer.print("");
			writer.close();
		} catch (IOException e) {
			System.out.println("Write to DataInfo failed: " + e);
		}
	}

	public void writeDataInfo(String text) {
		try {
			BufferedWriter buffer = new BufferedWriter(new FileWriter(file, true));
			buffer.append(text + "\n");
			buffer.flush();
			buffer.close();
		} catch (IOException e) {
			System.out.println("Write to DataInfo failed: " + e);
		}

	}

	public String getFileName(){

		return file;
	}

	public boolean existFile(){

		File f = new File(file);
		if(f.exists()) { /* do something */
			return true;
		}else{
			return false;
		}

	}

}


text:
#include "DT3Core/Resources/Importers/ImporterGeometry3DS.hpp"
#include "DT3Core/Resources/ResourceTypes/GeometryResource.hpp"
#include "DT3Core/Types/FileBuffer/BinaryFileStream.hpp"
#include "DT3Core/Types/FileBuffer/FilePath.hpp"
#include "DT3Core/Types/Graphics/Mesh.hpp"
#include "DT3Core/Types/Math/Matrix3.hpp"
#include "DT3Core/Types/Math/Matrix4.hpp"
#include "DT3Core/System/Factory.hpp"
#include "DT3Core/System/FileManager.hpp"

//==============================================================================
//==============================================================================

namespace DT3 {

//==============================================================================
/// Register with object factory
//==============================================================================

IMPLEMENT_FACTORY_IMPORTER(ImporterGeometry3DS,3ds)

//==============================================================================
/// Standard class constructors/destructors
//==============================================================================

ImporterGeometry3DS::ImporterGeometry3DS (void)
{

}

ImporterGeometry3DS::~ImporterGeometry3DS (void)
{

}

//==============================================================================
//==============================================================================

DTerr	ImporterGeometry3DS::import(GeometryResource *target, std::string args)
{
	FilePath pathname(target->path());

    // open the file
    BinaryFileStream	infile;
	FileManager::open(infile, pathname, true);

    // Verify file type
    DTushort	chunk_id;
    DTuint	chunk_size;
    read(infile, chunk_id);
    read(infile, chunk_size);

    // Check first word
    if (chunk_id != CHUNK_MAIN3DS) {
        return DT3_ERR_FILE_WRONG_TYPE;
    }

    // Go back to beginning
    infile.seek_g(0, BinaryStream::FROM_BEGINNING);

	// start parsing
	_base_face = 0;
	_base_vertex = 0;

    _current_obj_id = -1;
    _current_hier_id = -1;

    // read the file
    parse_next_chunk(infile, chunk_size);

	// Post processing
    std::shared_ptr<Mesh>  mesh = Mesh::create();
    mesh->set_name("Mesh");

	mesh->set_vertex_stream(_vertices_stream);
	mesh->set_uv_stream0(_uvs_stream_0);
	mesh->set_uv_stream1(_uvs_stream_1);
	mesh->set_weights_index_stream(_weights_index_stream);
	mesh->set_weights_strength_stream(_weights_strength_stream);
	mesh->set_index_stream(_indices_stream);

	mesh->generate_normals();

    target->add_mesh(mesh);

	ASSERT(mesh->vertex_stream().size());

	return DT3_ERR_NONE;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::read(BinaryFileStream &in, DTubyte &v)
{
    in.read_raw((DTubyte*)&v, sizeof(DTbyte));
    return sizeof(DTubyte);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::read(BinaryFileStream &in, DTushort &v)
{

#if DT3_BYTEORDER == DT3_LIL_ENDIAN
    in.read_raw((DTubyte*)&v, sizeof(DTushort));
#else
    DTubyte	b1,b2;

    read(in, b1);
    read(in, b2);
    v = (DTushort) ((static_cast<DTuint>(b2) << 8) | (static_cast<DTuint>(b1) << 0));
#endif
    return sizeof(DTushort);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::read(BinaryFileStream &in, DTshort &v)
{

#if DT3_BYTEORDER == DT3_LIL_ENDIAN
    in.read_raw((DTubyte*)&v, sizeof(DTshort));
#else
    DTubyte	b1,b2;

    read(in, b1);
    read(in, b2);
    v = (DTshort) ((static_cast<DTuint>(b2) << 8) | (static_cast<DTuint>(b1) << 0));
#endif

    return sizeof(DTshort);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::read(BinaryFileStream &in, DTuint &v)
{
#if DT3_BYTEORDER == DT3_LIL_ENDIAN
    in.read_raw((DTubyte*)&v, sizeof(DTuint));
#else
    DTubyte	b1,b2,b3,b4;

    read(in, b1);
    read(in, b2);
    read(in, b3);
    read(in, b4);

	v = (DTuint)    (static_cast<DTuint>(b4) << 24) |
                    (static_cast<DTuint>(b3) << 16) |
                    (static_cast<DTuint>(b2) << 8) |
                    (static_cast<DTuint>(b1) << 0);
#endif

    return sizeof(DTuint);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::read(BinaryFileStream &in, DTfloat &v)
{

#if DT3_BYTEORDER == DT3_LIL_ENDIAN
    in.read_raw((DTubyte*)&v, sizeof(DTfloat));
#else
    DTuint loaded_float;
    read(in, loaded_float);
    v = *((DTfloat*) &loaded_float);
#endif

    return sizeof(DTfloat);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::read(BinaryFileStream &in, std::string &v)
{
    DTubyte character;

    // clear the string
    v = "";

    read(in, character);
    while (character != '\0') {
        v += (DTcharacter) character;
        read(in, character);
    };

    return static_cast<DTuint>(v.size()) + 1;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_main_3DS(BinaryFileStream &in, DTuint owner_chunk_size)
{
    return parse_next_chunk(in, owner_chunk_size);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_edit_3DS(BinaryFileStream &in, DTuint owner_chunk_size)
{
    return parse_next_chunk(in, owner_chunk_size);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_edit_object(BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTuint size_read = 0;

    // add another object
    ++_current_obj_id;
	//_hierarchy.resize(_hierarchy.size()+1);

    // read object name
    std::string object_name;
    size_read += read(in, object_name);
    //_hierarchy[_current_obj_id]._name = object_name;

	// Remember base index
	_base_face = (DTint) _indices_stream.size();
	_base_vertex = (DTint) _vertices_stream.size();

    // Keep on Parsing
    size_read += parse_next_chunk(in, owner_chunk_size - size_read);

    return size_read;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_obj_trimesh(BinaryFileStream &in, DTuint owner_chunk_size)
{
    return parse_next_chunk(in, owner_chunk_size);
}

//==============================================================================
//==============================================================================

void ImporterGeometry3DS::left_to_right_handed (const Vector3 &a, Vector3 &r)
{
    DTfloat x = -a.x;
    DTfloat y = a.z;
    DTfloat z = a.y;

    // Rotate Coords
    r.x = x;
    r.y = y;
    r.z = z;
}

DTuint	ImporterGeometry3DS::parse_tri_vertex(BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTint size_read = 0;
    DTushort	num_verts;

    size_read += read(in,num_verts);

	_vertices_stream.resize(_base_vertex + num_verts);
	_weights_index_stream.resize(_base_vertex + num_verts);
	_weights_strength_stream.resize(_base_vertex + num_verts);
	_uvs_stream_0.resize(_base_vertex + num_verts);
	_uvs_stream_1.resize(_base_vertex + num_verts);

    for (DTuint i = 0; i < num_verts; ++i) {
        DTfloat x,y,z;

        size_read += read(in,x);
        size_read += read(in,y);
        size_read += read(in,z);

		_vertices_stream[_base_vertex + i] = Vector3(x,y,z);

		left_to_right_handed( _vertices_stream[_base_vertex + i], _vertices_stream[_base_vertex + i] );

		_weights_index_stream[_base_vertex + i] = WeightsIndex(_current_obj_id,0,0,0);
		_weights_strength_stream[_base_vertex + i] = Vector4(1.0F,0.0F,0.0F,0.0F);
    }
    return size_read;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_tri_mapping_coords(BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTuint size_read = 0;
    DTushort num_coords;

    size_read += read(in,num_coords);

    for (DTuint i = 0; i < num_coords; ++i) {
		DTfloat u,v;

        size_read += read(in,u);
        size_read += read(in,v);

		_uvs_stream_0[_base_vertex + i].u = u;
		_uvs_stream_0[_base_vertex + i].v = v;

		_uvs_stream_1[_base_vertex + i].u = u;
		_uvs_stream_1[_base_vertex + i].v = v;
    }
    return size_read;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_tri_face(BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTuint size_read = 0;
    DTushort	num_faces, info;

    size_read += read(in,num_faces);

	_indices_stream.resize(_base_face + num_faces);

	//_hierarchy[_current_obj_id]._num_faces = num_faces;

    for (DTuint i = 0; i < num_faces; ++i) {
		DTushort v1,v2,v3;

        size_read += read(in,v1);
        size_read += read(in,v2);
        size_read += read(in,v3);

        size_read += read(in,info);

        // Test for inverting normal
        if (!(info & 0x0007)) {
			_indices_stream[_base_face + i].v[0] = (DTushort) (v1 + _base_vertex);
			_indices_stream[_base_face + i].v[1] = (DTushort) (v3 + _base_vertex);
			_indices_stream[_base_face + i].v[2] = (DTushort) (v2 + _base_vertex);
		} else {
			_indices_stream[_base_face + i].v[0] = (DTushort) (v1 + _base_vertex);
			_indices_stream[_base_face + i].v[1] = (DTushort) (v2 + _base_vertex);
			_indices_stream[_base_face + i].v[2] = (DTushort) (v3 + _base_vertex);
		}

    }
    return size_read;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_tri_face_map(BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTuint size_read = 0;
    DTushort num_faces;
	std::string name;

    size_read += read(in,name);
    size_read += read(in,num_faces);

    for (DTuint i = 0; i < num_faces; ++i) {
		DTushort face;

        size_read += read(in,face);
    }
    return size_read;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_tri_local(BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTuint size_read = 0;
    DTfloat xx,xy,xz, yx,yy,yz, zx,zy,zz, ox,oy,oz;

    size_read += read(in,xx);
    size_read += read(in,xy);
    size_read += read(in,xz);

    size_read += read(in,yx);
    size_read += read(in,yy);
    size_read += read(in,yz);

    size_read += read(in,zx);
    size_read += read(in,zy);
    size_read += read(in,zz);

    size_read += read(in,ox);
    size_read += read(in,oy);
    size_read += read(in,oz);

    Vector3 translation(ox,oy,oz);
    left_to_right_handed(translation,translation);

	Matrix4 transform(Matrix3::identity(), translation);

	//_hierarchy[_current_obj_id]._transform = transform;

    return size_read;
}
//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_key_f3DS (BinaryFileStream &in, DTuint owner_chunk_size)
{
    return parse_next_chunk(in, owner_chunk_size);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_obj_des (BinaryFileStream &in, DTuint owner_chunk_size)
{
    return parse_next_chunk(in, owner_chunk_size);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_obj_hier (BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTuint size_read = 0;

    DTshort       flags1,flags2,parent;
    std::string     name;

    size_read += read(in, name);
    size_read += read(in, flags1);
    size_read += read(in, flags2);
    size_read += read(in, parent);

    // set object info
    ++_current_hier_id;
    //_hierarchy[_current_hier_id]._parent = parent;

    //size_read += parseNextChunk(in, owner_chunk_size - size_read);
    return size_read;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_edit_material (BinaryFileStream &in, DTuint owner_chunk_size)
{
    return parse_next_chunk(in, owner_chunk_size);
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_mat_name_01 (BinaryFileStream &in, DTuint owner_chunk_size)
{
    DTint size_read = 0;
	std::string materialname;

    size_read += read(in,materialname);

    return size_read;
}

//==============================================================================
//==============================================================================

DTuint	ImporterGeometry3DS::parse_next_chunk(BinaryFileStream &in, DTuint owner_chunk_size)
{
    const DTuint    chunk_header_size = 6;	// 6 bytes for data read (chunk_id & chunk_size)
    DTushort        chunk_id;
    DTuint          chunk_size;
    DTuint          offset_in_chunk = 0;    // start after chunk id

    do {
        offset_in_chunk += read(in, chunk_id);
        offset_in_chunk += read(in, chunk_size);

        chunk_size -= chunk_header_size;	// Compensate for header

        switch (chunk_id) {
            case CHUNK_MAIN3DS:                 offset_in_chunk += parse_main_3DS(in, chunk_size);			break;
            case CHUNK_EDIT3DS:                 offset_in_chunk += parse_edit_3DS(in, chunk_size);			break;
            case CHUNK_EDITOBJECT:              offset_in_chunk += parse_edit_object(in, chunk_size);		break;

            case CHUNK_OBJ_TRIMESH:             offset_in_chunk += parse_obj_trimesh(in, chunk_size);		break;
            case CHUNK_TRI_VERTEX:              offset_in_chunk += parse_tri_vertex(in, chunk_size);		break;
            case CHUNK_TRI_MAPPINGCOORDS:       offset_in_chunk += parse_tri_mapping_coords(in, chunk_size);break;
            case CHUNK_TRI_FACE:                offset_in_chunk += parse_tri_face(in, chunk_size);			break;
            case CHUNK_TRI_FACE_MAP:            offset_in_chunk += parse_tri_face_map(in, chunk_size);		break;
            case CHUNK_TRI_LOCAL:               offset_in_chunk += parse_tri_local(in, chunk_size);			break;

			case CHUNK_KEYF3DS:					offset_in_chunk += parse_key_f3DS(in, chunk_size);			break;
			case CHUNK_OBJDES:					offset_in_chunk += parse_obj_des(in, chunk_size);			break;
			case CHUNK_OBJHIERARCH:				offset_in_chunk += parse_obj_hier(in, chunk_size);			break;

			case CHUNK_EDIT_MATERIAL:			offset_in_chunk += parse_edit_material(in, chunk_size);		break;
			case CHUNK_MAT_NAME01:				offset_in_chunk += parse_mat_name_01(in, chunk_size);		break;

            default:                            in.seek_g((DTint) chunk_size, BinaryStream::FROM_CURRENT);
                                                offset_in_chunk += chunk_size;
                                                break;	// Skip chunk
        };

        // Check for incorrectly read file
        if (offset_in_chunk > owner_chunk_size) {
            return offset_in_chunk;
        }

    } while (offset_in_chunk < owner_chunk_size);

    return offset_in_chunk;
}

//==============================================================================
//==============================================================================

} // DT3


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Open SCAP Library: xccdf_notice Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Open SCAP Library

Main Page

Related Pages

Modules

Data Structures

Files

Data Structures

Data Structure Index

Data Fields

Public Member Functions |
Data Fields

xccdf_notice Struct Reference
XCCDF

XCCDF benchmark legal notice.
 More...

#include <xccdf_benchmark.h>

Public Member Functions

struct xccdf_notice * 	xccdf_notice_new (void)

void 	xccdf_notice_free (struct xccdf_notice *notice)

struct xccdf_notice * 	xccdf_notice_clone (const struct xccdf_notice *notice)

Getters

Return value is pointer to structure's member.

Do not free unless you null the pointer in the structure. Use remove function otherwise.

const char * 	xccdf_notice_get_id (const struct xccdf_notice *notice)

struct oscap_text * 	xccdf_notice_get_text (const struct xccdf_notice *notice)

Setters

For lists use add functions.

Parameters of set functions are duplicated in memory and need to be freed by caller.

bool 	xccdf_notice_set_id (struct xccdf_notice *obj, const char *newval)

bool 	xccdf_notice_set_text (struct xccdf_notice *obj, struct oscap_text *newval)

Data Fields

char * 	id

struct oscap_text * 	text

Detailed Description

XCCDF benchmark legal notice.

The documentation for this struct was generated from the following files:

item.h

xccdf_benchmark.h

<address class="footer">
Generated by

 1.8.6
</address>


text:
package net.cryptonomica.entities;

import com.google.appengine.api.datastore.*;
import com.google.appengine.api.users.User;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;

@Entity // -> net.cryptonomica.service.OfyService
public class TestEntity implements Serializable {

    /* types:
     * see: https://cloud.google.com/appengine/docs/standard/java/datastore/entities (see: The following value types are supported:)
     * */

    @Id
    private String entityName;
    @Index
    private Double doubleProperty;
    @Index
    private Boolean booleanProperty;
    @Index
    private String stringProperty;
    // Up to 1 megabyte, not indexed
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/Text
    private Text textProperty;
    //
    // Up to 1500 bytes
    // ShortBlob contains an array of bytes no longer than DataTypeUtils.MAX_SHORT_BLOB_PROPERTY_LENGTH.
    // Unlike Blob, ShortBlobs are indexed by the datastore and can therefore be filtered and sorted on in queries.
    // If your data is too large to fit in a ShortBlob use Blob instead.
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/ShortBlob
    @Index
    private ShortBlob shortBlobProperty;
    //
    // Up to 1 megabyte, not indexed
    // To store files, particularly files larger than this 1MB limit, look at the Blobstore API.
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/Blob
    private Blob blobProperty;
    @Index
    private Date dateProperty;
    @Index
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/PostalAddress
    private PostalAddress postalAddressProperty;
    @Index
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/PhoneNumber
    private PhoneNumber phoneNumberProperty;
    @Index
    // An e-mail address datatype. Makes no attempt at validation.
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/Email
    private Email emailProperty;
    @Index
    // User represents a specific user, represented by the combination of an email address
    // and a specific Google Apps domain (which we call an authDomain). For normal Google login, authDomain will be set to "gmail.com".
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/users/User
    private User userProperty;
    @Index
    // An instant messaging handle. Includes both an address and its protocol. The protocol value is either a standard IM scheme
    // (legal scheme values are defined by IMHandle.Scheme or a URL identifying the IM network for the protocol (e.g. http://aim.com/).
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/IMHandle
    private IMHandle imHandleProperty;
    @Index
    // A Link is a URL of limited length.
    //In addition to adding the meaning of URL onto a String, a Link can also be longer than a Text value, with a limit of 2083 characters.
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/Link
    private Link linkProperty;
    @Index
    // A tag, ie a descriptive word or phrase. Entities may be tagged by users, and later returned by a queries for that tag.
    // Tags can also be used for ranking results (frequency), photo captions, clustering, activity, etc.
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/Category
    private Category categoryProperty;
    @Index
    // A user-provided integer rating for a piece of content. Normalized to a 0-100 scale.
    // https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/Rating
    private Rating ratingProperty;
    //
    // Collections and arrays are embedded normally, and can contain nested classes. You are encouraged to initialize collections in your constructor
    // If you do not initialize collections, Objectify will take a best guess at the appropriate type based on the field
    // (eg List will be initialized to ArrayList).
    private ArrayList<String> arrayListProperty;
    //
    // Objectify will store a Map<String, ?> as an EmbeddedEntity in the datastore
    // In order to use non-String keys with Maps, you may specify the @Stringify annotation
    private Map<String, String> mapProperty;
    @Index
    private Date entityCreatedOn;
    @Index
    private User entityCreatedBy;
    @Index
    private Integer entityCreatedOnYear;
    @Index
    private Integer entityCreatedOnMonth;
    @Index
    private Integer entityCreatedOnDay;

    /* ---- Constructor */

    public TestEntity() {
        Date date = new Date();
        LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        this.entityCreatedOnYear = localDate.getYear();
        this.entityCreatedOnMonth = localDate.getMonthValue();
        this.entityCreatedOnDay = localDate.getDayOfMonth();
    }

    /* ---- Getters and Setters */

    // (!) custom:
    public void setEntityCreatedOn(Date entityCreatedOn) {
        this.entityCreatedOn = entityCreatedOn;
        LocalDate localDate = this.entityCreatedOn.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        this.entityCreatedOnYear = localDate.getYear();
        this.entityCreatedOnMonth = localDate.getMonthValue();
        this.entityCreatedOnDay = localDate.getDayOfMonth();
    }

    // >>>

    public String getEntityName() {
        return entityName;
    }

    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    public Double getDoubleProperty() {
        return doubleProperty;
    }

    public void setDoubleProperty(Double doubleProperty) {
        this.doubleProperty = doubleProperty;
    }

    public Boolean getBooleanProperty() {
        return booleanProperty;
    }

    public void setBooleanProperty(Boolean booleanProperty) {
        this.booleanProperty = booleanProperty;
    }

    public String getStringProperty() {
        return stringProperty;
    }

    public void setStringProperty(String stringProperty) {
        this.stringProperty = stringProperty;
    }

    public Text getTextProperty() {
        return textProperty;
    }

    public void setTextProperty(Text textProperty) {
        this.textProperty = textProperty;
    }

    public ShortBlob getShortBlobProperty() {
        return shortBlobProperty;
    }

    public void setShortBlobProperty(ShortBlob shortBlobProperty) {
        this.shortBlobProperty = shortBlobProperty;
    }

    public Blob getBlobProperty() {
        return blobProperty;
    }

    public void setBlobProperty(Blob blobProperty) {
        this.blobProperty = blobProperty;
    }

    public Date getDateProperty() {
        return dateProperty;
    }

    public void setDateProperty(Date dateProperty) {
        this.dateProperty = dateProperty;
    }

    public PostalAddress getPostalAddressProperty() {
        return postalAddressProperty;
    }

    public void setPostalAddressProperty(PostalAddress postalAddressProperty) {
        this.postalAddressProperty = postalAddressProperty;
    }

    public PhoneNumber getPhoneNumberProperty() {
        return phoneNumberProperty;
    }

    public void setPhoneNumberProperty(PhoneNumber phoneNumberProperty) {
        this.phoneNumberProperty = phoneNumberProperty;
    }

    public Email getEmailProperty() {
        return emailProperty;
    }

    public void setEmailProperty(Email emailProperty) {
        this.emailProperty = emailProperty;
    }

    public User getUserProperty() {
        return userProperty;
    }

    public void setUserProperty(User userProperty) {
        this.userProperty = userProperty;
    }

    public IMHandle getImHandleProperty() {
        return imHandleProperty;
    }

    public void setImHandleProperty(IMHandle imHandleProperty) {
        this.imHandleProperty = imHandleProperty;
    }

    public Link getLinkProperty() {
        return linkProperty;
    }

    public void setLinkProperty(Link linkProperty) {
        this.linkProperty = linkProperty;
    }

    public Category getCategoryProperty() {
        return categoryProperty;
    }

    public void setCategoryProperty(Category categoryProperty) {
        this.categoryProperty = categoryProperty;
    }

    public Rating getRatingProperty() {
        return ratingProperty;
    }

    public void setRatingProperty(Rating ratingProperty) {
        this.ratingProperty = ratingProperty;
    }

    public ArrayList<String> getArrayListProperty() {
        return arrayListProperty;
    }

    public void setArrayListProperty(ArrayList<String> arrayListProperty) {
        this.arrayListProperty = arrayListProperty;
    }

    public Map<String, String> getMapProperty() {
        return mapProperty;
    }

    public void setMapProperty(Map<String, String> mapProperty) {
        this.mapProperty = mapProperty;
    }

    public Date getEntityCreatedOn() {
        return entityCreatedOn;
    }

    public User getEntityCreatedBy() {
        return entityCreatedBy;
    }

    public void setEntityCreatedBy(User entityCreatedBy) {
        this.entityCreatedBy = entityCreatedBy;
    }

    public Integer getEntityCreatedOnYear() {
        return entityCreatedOnYear;
    }

    public void setEntityCreatedOnYear(Integer entityCreatedOnYear) {
        this.entityCreatedOnYear = entityCreatedOnYear;
    }

    public Integer getEntityCreatedOnMonth() {
        return entityCreatedOnMonth;
    }

    public void setEntityCreatedOnMonth(Integer entityCreatedOnMonth) {
        this.entityCreatedOnMonth = entityCreatedOnMonth;
    }

    public Integer getEntityCreatedOnDay() {
        return entityCreatedOnDay;
    }

    public void setEntityCreatedOnDay(Integer entityCreatedOnDay) {
        this.entityCreatedOnDay = entityCreatedOnDay;
    }
}