text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Column(name = "item_id")
@Id
public int getItemId() {
return itemId;
} | 0 |
public void mouseEntered(MouseEvent e) {
} | 0 |
* @param string2
* @param otherstrings
* @return String
*/
public static String string_concatenate(String string1, String string2, Cons otherstrings) {
if (otherstrings.length() == 0) {
return (Native.stringConcatenate(string1, string2));
}
{ StringBuffer result = null;
int length = string1.length() + string2.length();
int index = 0;
{ String string = null;
Cons iter000 = otherstrings;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
string = ((StringWrapper)(iter000.value)).wrapperValue;
length = length + string.length();
}
}
result = Stella.makeRawMutableString(length);
{ char ch = Stella.NULL_CHARACTER;
String vector000 = string1;
int index000 = 0;
int length000 = vector000.length();
for (;index000 < length000; index000 = index000 + 1) {
ch = vector000.charAt(index000);
edu.isi.stella.javalib.Native.mutableString_nthSetter(result, ch, index);
index = index + 1;
}
}
{ char ch = Stella.NULL_CHARACTER;
String vector001 = string2;
int index001 = 0;
int length001 = vector001.length();
for (;index001 < length001; index001 = index001 + 1) {
ch = vector001.charAt(index001);
edu.isi.stella.javalib.Native.mutableString_nthSetter(result, ch, index);
index = index + 1;
}
}
{ String string = null;
Cons iter001 = otherstrings;
for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
string = ((StringWrapper)(iter001.value)).wrapperValue;
{ char ch = Stella.NULL_CHARACTER;
String vector002 = string;
int index002 = 0;
int length002 = vector002.length();
for (;index002 < length002; index002 = index002 + 1) {
ch = vector002.charAt(index002);
edu.isi.stella.javalib.Native.mutableString_nthSetter(result, ch, index);
index = index + 1;
}
}
}
}
return (result.toString());
}
} | 6 |
private boolean positionJouable(Couleur uneCouleur, Position unePosition)
{
Case laCase = this.plateau.obtenirCase(unePosition);
if (laCase.estOccupee())
return false;
for (Direction direction : Direction.values())
{
if (encercleAdversaire(uneCouleur, laCase.obtenirPosition(),
direction))
return true;
}
return false;
} | 3 |
public static void Mute(CommandSender sender, String muted, Long time){
if (sender instanceof Player) {
if (!Access.canMute((Player) sender)){
sender.sendMessage(Msg.$("not-permitted"));
return;
}
if (time == -1) {
if (!Access.canMute((Player) sender, "forever")) {
sender.sendMessage(Msg.$("not-permitted"));
return;
}
}
}
if (!isMuted(muted)) {
config.set("mute.".concat(muted.toLowerCase()).concat(".time"), time);
config.set("mute.".concat(muted.toLowerCase()).concat(".start"), System.currentTimeMillis());
try {
config.save(configFile);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
sender.sendMessage(Msg.$("muted-success").replace("%player%", muted));
if (time == -1) {
MuteMan.server.getPlayer(muted).sendMessage(Msg.$("you-are-muted").replace("%time%", Msg.$("ever")));
} else {
MuteMan.server.getPlayer(muted).sendMessage(Msg.$("you-are-muted").replace("%time%", MuteManager.getTime(MuteMan.server.getPlayer(muted).getName()).toString().concat(Msg.$("sec"))));
}
} else {
sender.sendMessage(Msg.$("muted-already").replace("%time%", getTime(muted).toString()).replace("-1", Msg.$("ever")));
}
} | 7 |
private void checkWorkerLiveness(){
//System.out.println("monitor timer expire!");
Set<Integer> workerIdSet = workerStatusMap.keySet();
Iterator<Integer> idIterator = workerIdSet.iterator();
while(idIterator.hasNext()){
int id = idIterator.next();
if(workerStatusMap.get(id).intValue() == -1)
continue;
else if(workerStatusMap.get(id).intValue() > 1){
System.out.println("worker "+id+" is not alive. remove it");
removeNode(id);
}
else{
workerStatusMap.put(id, workerStatusMap.get(id).intValue()+1);
}
}
} | 3 |
public int read(byte[] buffer, int offset, int length) {
if (closed) {
return -1;
}
int totalBytesRead = 0;
while (totalBytesRead < length) {
int numBytesRead = super.read(buffer,
offset + totalBytesRead,
length - totalBytesRead);
if (numBytesRead > 0) {
totalBytesRead += numBytesRead;
}
else {
reset();
}
}
return totalBytesRead;
} | 3 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CreateManager frame = new CreateManager();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} | 1 |
@Test
public void resolve() {
long[][] data = loadArrays("data"+File.separator+"p018.txt");
int E=data.length-1;
for(int i=E-1;i>=0;i--){
for(int j=0;j<=i;j++){
data[i][j]+=data[i+1][j]>data[i+1][j+1]?data[i+1][j]:data[i+1][j+1];
}
}
print(data[0][0]);
} | 3 |
public static ThrowCalculator makeCalculator(String difficulty) {
if (difficulty.equalsIgnoreCase("random")) {
return new RandomThrow();
} else {
return new SmartThrow();
}
} | 1 |
public static void cppHelpOutputBinaryOperator(Cons expression, int nestlevel) {
{ Stella_Object arg1 = expression.value;
StringWrapper op = ((StringWrapper)(expression.rest.value));
Stella_Object arg2 = expression.rest.rest.value;
if (StringWrapper.cppNestedOperatorNeedsParenthesesP(op, arg1)) {
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print("(");
}
if (Stella_Object.cppBinaryOperatorP(op)) {
Cons.cppHelpOutputBinaryOperator(((Cons)(arg1)).rest, nestlevel + 1);
}
else {
Stella_Object.cppOutputStatement(arg1);
}
if (StringWrapper.cppNestedOperatorNeedsParenthesesP(op, arg1)) {
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print(")");
}
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print(" ");
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print(op.wrapperValue);
if (StringWrapper.cppIndentableBinaryOperatorP(op)) {
{
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.println();
Stella.cppIndent();
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print(" ");
{ int i = Stella.NULL_INTEGER;
int iter000 = 1;
int upperBound000 = nestlevel;
boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;
for (;unboundedP000 ||
(iter000 <= upperBound000); iter000 = iter000 + 1) {
i = iter000;
i = i;
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print(" ");
}
}
}
}
else {
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print(" ");
}
if (StringWrapper.cppNestedOperatorNeedsParenthesesP(op, arg2)) {
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print("(");
}
if (Stella_Object.cppBinaryOperatorP(arg2)) {
Cons.cppHelpOutputBinaryOperator(((Cons)(arg2)).rest, nestlevel + 1);
}
else {
Stella_Object.cppOutputStatement(arg2);
}
if (StringWrapper.cppNestedOperatorNeedsParenthesesP(op, arg2)) {
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print(")");
}
}
} | 9 |
public void setQuery(String query) {
this.query = query;
if (this.query != null) {
this.query_list = new ArrayList();
parseQuery(this.query_list, this.query);
}
} | 1 |
@Test
public void testIsBrowser() {
assertTrue(Application.GMAIL.isInReferrerString("http://mail.google.com/mail/?ui=1&ik=xx&view=cv&search=inbox&th=xx&ww=xx&cvap=5&qt=&zx=xx"));
} | 0 |
@SuppressWarnings("static-access")
public ProcessCommandImpl(Socket requestSocket1,
PropertiesConfiguration prop2) {
try {
this.requestSocket = requestSocket1;
this.prop =prop2;
wait = prop.getInt("ThreadSleep_period");
timePeriod=prop.getInt("TimePeriod");
printWriter = new PrintWriter(requestSocket.getOutputStream(), true);
reader = new BufferedReader(new InputStreamReader(requestSocket.getInputStream()));
number=prop.getString("SmsOperatorId");
String command1 = "1,REGIST,"+number;
logger.info("sending Registration command to CAS server is: "+command1);
printWriter.println(command1);
if (printWriter.checkError()) {
ProcessCommandImpl.closeIOFile();
}else{
Reminder(timePeriod);
String output = reader.readLine();
logger.info("output from CAS Server is :" + output);
CSVReader reader1 = new CSVReader(new StringReader(output));
String[] tokens = reader1.readNext();
if (tokens.length > 2) {
String message = tokens[1];
if (message.equalsIgnoreCase("0")) {
logger.info("Registration command successfully executed");
}else if(message.equalsIgnoreCase("9000")){
logger.info("Registration command failure");
String error = tokens[2];
logger.error("failure: " + error);
throw new IllegalAccessException() ;
}else {
logger.info("Registration command failure");
String error = tokens[2];
logger.error("failure: " + error);
throw new Exception() ;
}
}
}
} catch (IllegalAccessException e) {
logger.error("wrong SMS_operatorId:"+number+" , server connection through this SMS OperatorId is Not Possible");
} catch (Exception e){
logger.error("exception : " + e.getCause().getLocalizedMessage());
}
} | 6 |
public PerformanceRecord getPerformanceRecord(String fileName) throws IOException {
BufferedReader reader = new BufferedReader (new FileReader(fileName));
String line;
String result = "";
String propertyVerified = "";
double userTime = 0;
double systemTime = 0;
long bddNodes = 0;
String formatted = "";
try{
while((line = reader.readLine())!=null) {
if(line.startsWith("Model checking results")) {
line = reader.readLine();
line = reader.readLine();
if(line.endsWith("true")) {
result = "true";
} else if(line.endsWith("false")) {
result = "false";
}
propertyVerified = line.substring(0, line.indexOf("."));
}
if(line.startsWith("Resources used")) {
while((line = reader.readLine())!=null) {
if(line.startsWith("user time")) {
int startIndex = line.lastIndexOf("..")+2;
int endIndex = line.lastIndexOf(" s");
String sub = line.substring(startIndex, endIndex);
userTime += Float.parseFloat(sub.trim());
} else if(line.startsWith("system time")) {
int startIndex = line.lastIndexOf("..")+2;
int endIndex = line.lastIndexOf(" s");
String sub = line.substring(startIndex, endIndex);
systemTime += Float.parseFloat(sub.trim());
} else if(line.startsWith("BDD nodes allocated")) {
int startIndex = line.lastIndexOf("..")+2;
String sub = line.substring(startIndex, line.length());
bddNodes += Float.parseFloat(sub.trim());
break;
}
}
}
}
formatted = formatted + StringUtil.padWithSpace(result+"",7)+" ";
formatted = formatted + StringUtil.padWithRightSpace(""+(userTime),15) + StringUtil.padWithRightSpace(""+(systemTime),15) + StringUtil.padWithRightSpace(""+(bddNodes),15);
formatted = formatted + " " + fileName.substring(fileName.lastIndexOf("\\")+1);
}finally{reader.close();}
PerformanceRecord pr = new PerformanceRecord(fileName.substring(fileName.lastIndexOf("\\")+1), userTime, systemTime, bddNodes, propertyVerified, Boolean.parseBoolean(result));
return pr;
} | 9 |
private void setScores(){
String eol = System.getProperty("line.separator");
String name;
String score;
try{
Writer output = new BufferedWriter(new FileWriter(scorecard));
if(scores.size() == 0){
output.write("JCAL" + eol);
output.write("8000" + eol);
output.write("IS" + eol);
output.write("7000" + eol);
output.write("THE" + eol);
output.write("6000" + eol);
output.write("BEST" + eol);
output.write("5000" + eol);
output.write("OMG" + eol);
output.write("4000" + eol);
output.write("SO" + eol);
output.write("3000" + eol);
output.write("WOW" + eol);
output.write("2000" + eol);
output.write("YAY!" + eol);
output.write("1000" + eol);
output.close();
readScores();
return;
}
for(int i = 0;i<8;i++){
name = scores.get(i).getName() + eol;
score = Integer.toString(scores.get(i).getScore()) + eol;
output.write(name);
output.write(score);
}
output.close();
} catch(IOException e){
e.printStackTrace();
System.err.println("IO Error of some kind in setScores");
return;
}
} | 3 |
public int getRightDiag(int i, int j, int r) {
int sum = 0;
int imax = this.length;
int jmax = this.width;
for (int n = 0; n <= 2 * r; n++) {
int ii = topo.idI(i + r - n, j - r + n, imax, jmax);
int jj = topo.idJ(i, j - r + n, imax, jmax);
if ( (!(ii < 0) && !(ii >= imax)) && (!(jj < 0) && !(jj >= jmax)) && (ii != i || jj != j ) ) {
sum += this.getCell(ii, jj).toBit();
}
}
return sum;
} | 7 |
public int destroy() {
if (lifecycleSupport == null) {
return handleErrno(Errno.ENOTSUPP);
}
if (log != null && log.isDebugEnabled()) {
log.debug("destroy: shutdown filesystem");
}
try {
return handleErrno(lifecycleSupport.destroy());
} catch(Exception e) {
return handleException(e);
}
} | 4 |
static void build_key_square(char[][] square,String key)
{
boolean[] filled=new boolean[26];
String key_u=key.toUpperCase();
int cur_row=0;
int cur_col=0;
for(int i=0;i<key_u.length();i++)
{
char cur_c=key_u.charAt(i);
if(cur_c=='J')
{
cur_c='I';
}
int order=cur_c-'A';
if(!filled[order])
{
square[cur_row][cur_col]=cur_c;
filled[order]=true;
}
else
{
continue;
}
if(cur_row==4)
{
cur_row=0;
cur_col++;
}
else
{
cur_row++;
}
}
for(int i=0;i<26;i++)
{
char cur_c=(char)('A'+i);
if(cur_c=='J')
continue;
if(!filled[i])
{
square[cur_row][cur_col]=cur_c;
filled[i]=true;
}
else
{
continue;
}
if(cur_row==4)
{
cur_row=0;
cur_col++;
}
else
{
cur_row++;
}
}
} | 8 |
public float getPreferredSpan(int axis) {
int extra = 2*(getBorder()+getSpace(axis));
switch (axis) {
case View.X_AXIS:
return fWidth+extra;
case View.Y_AXIS:
return fHeight+extra;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
} | 2 |
public static int numberOfDays (int num)//enter month number
{
if (num==1||num==3||num==5||num==7||num==8||num==10||num==12)
return 31;
else if (num==2)
return 28;
else if (num==-2)//leap year
return 29;
else
return 30;
} | 9 |
public void update(World w)
{
repaint();
currGeneration = w.getGeneration();
int nxtPopulation = w.getPopulation();
double growthRate = 0.0, deathRate = 0.0;
if (currGeneration == 0)
{
maxPopulation = nxtPopulation;
minPopulation = nxtPopulation;
}
else
{
growthRate = ((nxtPopulation - currPopulation)*1.0) / (currPopulation*1.0);
deathRate = -growthRate;
if (nxtPopulation > maxPopulation) maxPopulation = nxtPopulation;
if (nxtPopulation < minPopulation) minPopulation = nxtPopulation;
if (growthRate > maxGrowthRate) maxGrowthRate = growthRate;
if (deathRate > maxDeathRate) maxDeathRate = deathRate;
}
//updates start here
genLabel.setText("Generation: " + currGeneration);
popLabel.setText("Population: " + currPopulation);
maxPopLabel.setText("Maximum population: " + maxPopulation);
minPopLabel.setText("Minimum population: " + minPopulation);
maxGrowthLabel.setText("Maximum growth rate: " + Math.round(maxGrowthRate*100000.00)/100000.00);
maxDeathLabel.setText("Maximum death rate: " + Math.round(maxDeathRate*100000.00)/100000.00);
population.addDataPoint((double)nxtPopulation);
popChange.addDataPoint((double)nxtPopulation - currPopulation);
growDeathRate.addDataPoint(Math.max(growthRate,deathRate));
currPopulation = nxtPopulation;
} | 5 |
static public Object deserializeArray(InputStream in, Class elemType, int length)
throws IOException
{
if (elemType==null)
throw new NullPointerException("elemType");
if (length<-1)
throw new IllegalArgumentException("length");
Object obj = deserialize(in);
Class cls = obj.getClass();
if (!cls.isArray())
throw new InvalidObjectException("object is not an array");
Class arrayElemType = cls.getComponentType();
if (arrayElemType!=elemType)
throw new InvalidObjectException("unexpected array component type");
if (length != -1)
{
int arrayLength = Array.getLength(obj);
if (arrayLength!=length)
throw new InvalidObjectException("array length mismatch");
}
return obj;
} | 6 |
public void update() {
getNextPosition();
checkTileMapCollision();
setPosition(xtemp, ytemp);
//check flinching
if(flinching) {
long elapsed = (System.nanoTime() - flinchTimer) / 1000000;
if(elapsed > 400) {
flinching = false;
}
}
// if hits a wall, go other direction
if(facingRight && dx == 0) {
facingRight = false;
} else if(!facingRight && dx == 0) {
facingRight = true;
}
// update animation
animation.update();
} | 6 |
public static String escapeString(String str) {
try
{
escapeHelper.setString(1, str);
} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
String rtn = escapeHelper.toString();
return rtn.substring( rtn.indexOf( ": " ) + 2 );
} | 1 |
@Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
String title=request.getParameter(Room.TITLE);
int masterRoom=Integer.parseInt(request.getParameter(Room.MULTIPURPOSE_ROOM));
int capacity=Integer.parseInt(request.getParameter(Room.CAPACITY));
DatabaseManager manager=DatabaseManager.getManager();
MultipurposeRoom multipurposeRoom=manager.getMultipurposeRoomDao().queryForId(masterRoom);
if(multipurposeRoom==null){
ServletResult.sendResult(response, ServletResult.NOT_FOUND);
return;
}
Room room=new Room();
room.setRoom(multipurposeRoom);
room.setCapacity(capacity);
if(!MyServlet.isEmpty(title)) room.setTitle(title);
if(manager.getRoomDao().create(room)==1){
ServletResult.sendResult(response, new CreateResult(
ServletResult.SUCCESS, room.getId()));
response.setStatus(HttpServletResponse.SC_CREATED);
}
else{
ServletResult.sendResult(response, ServletResult.ERROR);
}
} catch (NumberFormatException e) {
e.printStackTrace();
ServletResult.sendResult(response, ServletResult.BAD_NUMBER_FORMAT);
} catch (SQLException e) {
e.printStackTrace();
ServletResult.sendResult(response, ServletResult.ERROR);
}
} | 5 |
public static void multiplicatoria(TreeMap<Integer, Integer> raiz) {
TreeMap<Integer, Integer> casa = (TreeMap<Integer,Integer>)raiz.clone();
for (Entry<Integer, Integer> entry : casa.entrySet()) {
if (entry.getKey() < 500 && !arr[entry.getKey()])
continue;
int i = 0;
for (i = 0; i < primos.length; i++) {
if (entry.getKey() % primos[i] == 0) {
if (entry.getValue() == 1)
raiz.remove(entry.getKey());
else
raiz.put(entry.getKey(), entry.getValue() - 1);
int val = 0;
if (raiz.containsKey(entry.getKey() / primos[i]))
val = raiz.get(entry.getKey() / primos[i]);
raiz.put(entry.getKey() / primos[i], val + 1);
val = 0;
if (raiz.containsKey(primos[i]))
val = raiz.get(primos[i]);
raiz.put(primos[i], val + 1);
multiplicatoria(raiz);
break;
}
}
if(i<primos.length)break;
}
} | 9 |
public void close(Connection con,PreparedStatement preparedStatement,ResultSet rs){
try {
if(rs!=null){
rs.close();
rs = null;
}if(preparedStatement!=null){
preparedStatement.close();
preparedStatement = null;
}if(con!=null&&!con.isClosed()){
con.close();
con = null;
}
} catch (SQLException e) {
e.printStackTrace();
}
} | 5 |
static public void decodeFile(String src)
{
byte[] fileBytes;
try {
fileBytes = read(new File(src));
for(int n=0;n<fileBytes.length;n++)
{
fileBytes[n]-=key;
}
write(src, fileBytes);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | 3 |
@Override
public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game)
{
int[] gameSpriteOrder = game.getSpriteOrder();
int spriteOrderCount = gameSpriteOrder.length;
for(int i = 0; i < spriteOrderCount; ++i)
{
int spriteTypeInt = gameSpriteOrder[i];
if(notItypes.contains(spriteTypeInt))
continue;
Iterator<VGDLSprite> spriteIt = game.getSpriteGroup(spriteTypeInt);
if(spriteIt != null) while(spriteIt.hasNext())
{
VGDLSprite sp = spriteIt.next();
sp.setRect(sp.lastrect);
}
}
} | 4 |
public void stopCurrentBattle() {
if(current != null) {
// shut it down to stop it quickly
current.stop();
current.setFPS(BattleRunner.START_FPS);
// unpause it (or it will never stop)
if(current.isPaused()) {
current.setPaused(false);
}
current = null;
}
} | 2 |
protected void doTestCycAccess14(CycAccess cycAccess) {
long startMilliseconds = System.currentTimeMillis();
if (cycAccess.getCycConnection() != null) {
System.out.println(cycAccess.getCycConnection().connectionInfo());
} else {
System.out.println("CycConnection info is null.");
}
resetCycConstantCaches();
try {
// second call should access the cache by GUID
cycAccess.traceOn();
System.out.println("------------");
Guid organizationGuid = new Guid(ORGANIZATION_GUID_STRING);
CycConstant organization = cycAccess.getConstantByGuid(organizationGuid);
System.out.println("------------");
organization = cycAccess.getConstantByGuid(organizationGuid);
System.out.println("------------");
cycAccess.traceOff();
} catch (Throwable e) {
e.printStackTrace();
fail(e.getMessage());
}
List localDisjointWiths = null;
/*
// complete received objects immediately
cycAccess.deferObjectCompletion = false;
System.out.println("deferObjectCompletion = false");
// trace should show the use of the CycConstantCache to avoid redundant server
// accesses for the term name.
// getLocalDisjointWith.
try {
CycConstant vegetableMatter =
cycAccess.getKnownConstantByGuid("bd58c455-9c29-11b1-9dad-c379636f7270");
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
assertNotNull(localDisjointWiths);
assertTrue(localDisjointWiths.toString().indexOf("AnimalBLO") > 0);
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
}
catch (Throwable e) {
fail(e.toString());
}
*/
// getLocalDisjointWith.
localDisjointWiths = null;
try {
CycConstant vegetableMatter = cycAccess.getKnownConstantByGuid(VEGETABLE_MATTER_GUID_STRING);
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
assertNotNull(localDisjointWiths);
//System.out.println("localDisjointWiths.toString()");
//assertTrue(localDisjointWiths.toString().indexOf("AnimalBLO") > 0);
//System.out.println("localDisjointWiths.toString()");
//assertTrue(localDisjointWiths.toString().indexOf("AnimalBLO") > 0);
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
localDisjointWiths = cycAccess.getDisjointWiths(vegetableMatter);
} catch (Throwable e) {
fail(e.toString());
}
// makeUniqueCycConstant
try {
final String constantName = "MyConstant";
CycConstant cycConstant1 = cycAccess.makeUniqueCycConstant(constantName);
System.out.println(cycConstant1.cyclify());
assertTrue(cycConstant1.getName().startsWith(constantName));
CycConstant cycConstant2 = cycAccess.makeUniqueCycConstant(constantName);
System.out.println(cycConstant2.cyclify());
assertTrue(cycConstant2.getName().startsWith(constantName));
assertTrue(!cycConstant1.getName().equals(cycConstant2.getName()));
CycConstant cycConstant3 = cycAccess.makeUniqueCycConstant(constantName);
System.out.println(cycConstant3.cyclify());
assertTrue(cycConstant3.getName().startsWith(constantName));
assertTrue(!cycConstant3.getName().equals(cycConstant1.getName()));
assertTrue(!cycConstant3.getName().equals(cycConstant2.getName()));
} catch (Throwable e) {
fail(e.toString());
}
long endMilliseconds = System.currentTimeMillis();
System.out.println(" " + (endMilliseconds - startMilliseconds) + " milliseconds");
} | 4 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((mob.location().domainType()!=Room.DOMAIN_INDOORS_CAVE)
&&((mob.location().getAtmosphere()&RawMaterial.MATERIAL_ROCK)==0))
{
mob.tell(L("This magic only works in caves."));
return false;
}
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
// now see if it worked
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,null,this,verbalCastCode(mob,null,auto),auto?"":L("^S<S-NAME> chant(s) for a pool.^?"));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
final String itemID = "Spring";
final Item newItem=CMClass.getItem(itemID);
if(newItem==null)
{
mob.tell(L("There's no such thing as a '@x1'.\n\r",itemID));
return false;
}
newItem.setName(L("a magical pool"));
newItem.setDisplayText(L("a little magical pool flows here."));
newItem.setDescription(L("The pool is coming magically from the ground. The water looks pure and clean."));
mob.location().addItem(newItem);
mob.location().showHappens(CMMsg.MSG_OK_ACTION,L("Suddenly, @x1 starts flowing here.",newItem.name()));
SpringLocation=mob.location();
littleSpring=newItem;
beneficialAffect(mob,newItem,asLevel,0);
mob.location().recoverPhyStats();
}
}
else
return beneficialWordsFizzle(mob,null,L("<S-NAME> chant(s) for a pool, but nothing happens."));
// return whether it worked
return success;
} | 7 |
@SuppressWarnings ( {
"unused", "resource"
} )
@Test
public void testWriteJournal () throws Exception {
if ( this.socketAddress == null ) {
return;
}
try ( AFUNIXSocket sock = connectToServer() ) {
System.err.println("Client running");
InputStream is = sock.getInputStream();
AFUNIXOutputStream os = sock.getOutputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
dos.write("PRIORITY=2\n".getBytes("UTF-8"));
dos.write("MESSAGE=TEST\n".getBytes("UTF-8"));
// os.sendmsg(bos.toByteArray(), true);
System.err.println("Wrote from client");
}
catch ( Exception e ) {
e.printStackTrace();
}
} | 2 |
public void randomState()
{
Random rand = new Random();
int index = rand.nextInt(5);
this.clearLore();
int copy = index;
HashMap<String,Integer> map = new HashMap<String, Integer>();
for(Map.Entry<String,Sender> entry : Main.map.entrySet()){
if(entry.getValue().allow(item.getTypeId())) {
System.out.print("allow");
if (rand.nextInt(10) > copy)
map.put(entry.getKey(), entry.getValue().random());
}
}
for(Map.Entry<String,Integer> en : map.entrySet()){
if(index--<0) break;
this.setLevel(en.getKey(),en.getValue());
}
addString("打孔口");
} | 5 |
@Override
public String toString() {
return "MESSAGE(MULTICASTMESSAGE)\n{"+ source +"->"+ dest +" seqNum:"+ seqNum +" duplicate:"+ duplicate +" kind:"+ kind
+" data:"+ data +" \nTIMESTAMP[:" + this.timeStamp + " ]\nACK:" + this.acknowledgement + "} "
+ "\nGROUPCLOCK = {" + clockForGroup.toString() + "}";
} | 0 |
public DatosIteracion masVisibles() {
DatosIteracion d = new DatosIteracion("auxiliar");
Lectura l = new Lectura(999999, 0, 0);
d.getValoresLecturas().add(l);
for (int i = 0; i < this.getValoresIteraciones().size(); i++) {
if (d.getValoresLecturas(d.getValoresLecturas().size() - 1)
.getnNodos() < this
.getValoresIteraciones(i)
.getValoresLecturas(
this.getValoresIteraciones(i).getValoresLecturas()
.size() - 1).getnNodos()) {
d = this.getValoresIteraciones(i);
}
if (d.getValoresLecturas(d.getValoresLecturas().size() - 1)
.getnNodos() == this
.getValoresIteraciones(i)
.getValoresLecturas(
this.getValoresIteraciones(i).getValoresLecturas()
.size() - 1).getnNodos()) {
if (d.getValoresLecturas(d.getValoresLecturas().size() - 1)
.getCapturados() > this
.getValoresIteraciones(i)
.getValoresLecturas(
this.getValoresIteraciones(i)
.getValoresLecturas().size() - 1)
.getCapturados()) {
d = this.getValoresIteraciones(i);
}
}
}
return d;
} | 4 |
public boolean deleteProdutos(Produtos produtos){
this.getConectaBanco();
try {
if (this.getConn()!= null || !this.getConn().isClosed()) {
this.getConn().setAutoCommit(false);
this.setStmt(this.getDeleteProdutos());
this.getStmt().setInt(1, produtos.getIdProduto());
this.getStmt().execute();
this.setSucesso(VERDADEIRO);
this.getConn().commit();
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (this.getConn()!= null ){
try {
this.getConn().rollback();
} catch (SQLException e) {
e.printStackTrace();
}
}
this.stopConectaBanco();
}
return this.isSucesso();
} | 5 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
CadQuestButton = new javax.swing.JButton();
ConsQuestButton = new javax.swing.JButton();
ImportAlunoButton = new javax.swing.JButton();
ImportProfButton = new javax.swing.JButton();
CadUsuarioButton = new javax.swing.JButton();
ConfigProvaButton = new javax.swing.JButton();
GerarProvaButton = new javax.swing.JButton();
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
});
CadQuestButton.setText("Cadastro de Questão");
if(!grupo.isCadastrarQuestao())
CadQuestButton.setEnabled(false);
CadQuestButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CadQuestButtonActionPerformed(evt);
}
});
ConsQuestButton.setText("Consulta de Questão");
if(!grupo.isConsultarQuestao())
ConsQuestButton.setEnabled(false);
ConsQuestButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ConsQuestButtonActionPerformed(evt);
}
});
ImportAlunoButton.setText("Importar Aluno");
if(!grupo.isImportarAlunos())
ImportAlunoButton.setEnabled(false);
ImportAlunoButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ImportAlunoButtonActionPerformed(evt);
}
});
ImportProfButton.setText("Importar Professor");
if(!grupo.isImportarProfessores())
ImportProfButton.setEnabled(false);
ImportProfButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ImportProfButtonActionPerformed(evt);
}
});
CadUsuarioButton.setText("Cadastrar Usuário");
if(!grupo.isCadastrarUsuario())
CadUsuarioButton.setEnabled(false);
CadUsuarioButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CadUsuarioButtonActionPerformed(evt);
}
});
ConfigProvaButton.setText("Configurar Prova");
if(!grupo.isConfigurarProva())
ConfigProvaButton.setEnabled(false);
ConfigProvaButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ConfigProvaButtonActionPerformed(evt);
}
});
GerarProvaButton.setText("Gerar Prova");
if(!grupo.isGerarProva())
GerarProvaButton.setEnabled(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(CadQuestButton)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(CadUsuarioButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ConsQuestButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(ImportAlunoButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ImportProfButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ConfigProvaButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(28, 28, 28))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(GerarProvaButton, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(98, 98, 98))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(57, 57, 57)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(CadQuestButton)
.addComponent(ImportProfButton))
.addGap(34, 34, 34)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ImportAlunoButton)
.addComponent(ConsQuestButton))
.addGap(31, 31, 31)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(CadUsuarioButton)
.addComponent(ConfigProvaButton))
.addGap(31, 31, 31)
.addComponent(GerarProvaButton)
.addContainerGap(50, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents | 7 |
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (!playerConfig.contains("players." + player.getUniqueId().toString())) {
playerConfig.set("players." + player.getUniqueId().toString() + ".name", player.getName());
playerConfigClass.saveConfig();
Bukkit.getLogger().info("MultiSpawnPlus: " + player.getName() + " has joined for the first time! "
+ "Writing player info to players.yml");
if (config.getBoolean("options.random-spawn-on-join") == true) {
String spawnGroup = config.getString("options.first-join-spawn-group");
ArrayList<String> groupList = new ArrayList<String>();
for (int i = 0; i < allowed.length; i++) {
if (config.getString("spawns." + allowed[i] + ".spawn-group").equalsIgnoreCase(spawnGroup)) {
groupList.add(allowed[i]);
}
}
group = groupList.toArray(new String[groupList.size()]);
Random rand = new Random();
int i = rand.nextInt(group.length);
World world = Bukkit.getWorld(config.getString("spawns." + allowed[i] + ".world"));
double x = config.getInt("spawns." + group[i] + ".X") + 0.5;
double y = config.getInt("spawns." + group[i] + ".Y");
double z = config.getInt("spawns." + group[i] + ".Z") + 0.5;
int yaw = config.getInt("spawns." + group[i] + ".yaw");
int pitch = config.getInt("spawns." + group[i] + ".pitch");
Bukkit.getLogger().info("MultiSpawnPlus: - Teleporting " + player.getName() + " to " + group[i]
+ "(" + world + ", " + x + ", " + y + ", " + z + ", " + yaw + ", " + pitch + ")");
if (world == null) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cThat world does not exist!"));
} else {
Location loc = new Location(world, x, y, z, yaw, pitch);
player.teleport(loc);
}
}
} else {
Bukkit.getLogger().info("MultiSpawnPlus: " + player.getName() + " has joined!");
playerConfig.set("players." + player.getUniqueId().toString() + ".name", player.getName());
playerConfigClass.saveConfig();
}
} | 5 |
public void setLineeOrdine(List<OrderLine> lineeOrdine) {
this.lineeOrdine = lineeOrdine;
} | 0 |
Node add(Node t, Object key, Object val, Box found){
if(t == null)
{
if(val == null)
return new Red(key);
return new RedVal(key, val);
}
int c = doCompare(key, t.key);
if(c == 0)
{
found.val = t;
return null;
}
Node ins = c < 0 ? add(t.left(), key, val, found) : add(t.right(), key, val, found);
if(ins == null) //found below
return null;
if(c < 0)
return t.addLeft(ins);
return t.addRight(ins);
} | 6 |
public String getFixedFee() {
return FixedFee;
} | 0 |
double rate(Board board) {
int holes = 0;
// Count the holes, and sum up the heights
for (int x=0; x<board.getWidth(); x++) {
final int colHeight = board.getColumnHeight(x);
int y = colHeight - 2; // addr of first possible hole
while (y>=0) {
if (!board.getGrid(x,y)) {
holes++;
}
y--;
}
}
return holes;
} | 3 |
private boolean checkModels(List<Particle> seqParticles, List<Particle> paraParticles) {
for(Particle p1: seqParticles){
for(Particle p2: paraParticles){
if(compareParticles(p1,p2)){
paraParticles.remove(p2);
break;
}
}
}
if(paraParticles.size() == 0)
return true;
return false;
} | 4 |
private void dealtDamage()
{
if (player.equals("P1"))
{
if (direction)
{
getWorld().addObject(new P1AttackArea(x,y,1000,50,1,0,2.0,2,direction),x, y);
}
else
{
getWorld().addObject(new P1AttackArea(x,y,1000,50,1,0,2.0,2,direction),x, y);
}
}
else if (player.equals("P2"))
{
if (direction)
{
getWorld().addObject(new P2AttackArea(x,y,1000,50,1,0,2.0,2,direction),x, y);
}
else
{
getWorld().addObject(new P2AttackArea(x,y,1000,50,1,0,2.0,2,direction),x, y);
}
}
} | 4 |
public static void main(String[] args) throws IOException {
Scanner in = null;
FileReader fin = null;
/* If there is one argument, it is the file to be read from. */
if (args.length == 0) {
in = new Scanner(System.in);
} else if (args.length == 1) {
fin = new FileReader(args[0]);
in = new Scanner(fin);
} else {
/* The program is being used incorrectly. Notify the user. */
System.err.println("Usage: java main.BuddyMemoryAlgorithm [filename");
System.exit(0);
}
/* Create a memory manager with the memory size and minimum block size. */
MemoryManager manager = new MemoryManager(in.nextInt(), in.nextInt());
/* Continue processing requests until the end of input. */
while (in.hasNext()) {
/* Get the allocation ID. */
int requestId = in.nextInt();
/* Get the operation type - allocation or deallocation. */
String requestType = in.next();
/* See if allocating or deallocating. */
if (requestType.equals("+")) {
/* See how much space is required. */
int size = in.nextInt();
System.out.printf("Request ID %d: allocate %d bytes.\n", requestId, size);
/* Create a formal request to send to the memory manager. */
MemoryRequest request = new MemoryRequest(requestId, size);
/* Attempt to allocate the request. */
Memory allocated = manager.allocate(request);
if (allocated == null) {
/* The allocation returned null, could not be fulfilled. */
System.out.println(" Request deferred.");
} else {
/* The allocation was successful. Notify the user */
/* of the address of the newly allocated memory. */
System.out.printf(" Success; addr = 0x%08x.\n", allocated.getAddress());
}
} else if (requestType.equals("-")) {
/* Deallocate the memory block identified by the request ID. */
/* This will always be successful, so print as such. */
System.out.printf("Request ID %d: deallocate.\n Success.\n", requestId);
manager.deallocate(requestId);
} else {
/* There was a problem reading the request type, notify the user. */
System.err.printf("ERROR: got request ID (%d) but unknown request type (%s)",
requestId, requestType);
System.exit(1);
}
}
if (fin != null) {
fin.close();
}
} | 7 |
public int getColumnHeight(int x) {
if(caching && !columnHeightDirties[x]) {
return _columnHeights[x];
}
columnHeightDirties[x] = false;
for (int j = height - 1; j >= 0; j--) {
if (grid[x][j]) {
return (_columnHeights[x] = j+1);
}
}
return (_columnHeights[x] = 0);
} | 4 |
public void update(double time_difference) {
// Update delay
if (is_delaying) {
if (delay_timer <= 0) {
is_delaying = false;
} else {
delay_timer = Math.max(0, delay_timer - time_difference);
return;
}
}
// Update timer
timer += time_difference;
if (timer >= typing_wait) {
timer -= typing_wait;
// Finished
if (buffer.isEmpty()) {
is_typing = false;
// Delay
} else if (buffer.charAt(0) == DELAY_START) {
buffer = buffer.substring(1);
is_delaying = true;
String delay = "";
while (buffer.charAt(0) != DELAY_END) {
delay += buffer.charAt(0);
buffer = buffer.substring(1);
}
buffer = buffer.substring(1);
delay_timer = Double.parseDouble(delay);
// New Line
} else if (buffer.charAt(0) == SEPARATOR) {
current_order += 1;
buffer = buffer.substring(1);
} else {
// Too many lines
if (current_order >= LINES) {
ripple();
}
orders[current_order] += buffer.substring(0, 1);
buffer = buffer.substring(1);
}
}
} | 8 |
Atom merge( Atom other ) throws Exception
{
if ( other instanceof Fragment )
{
// if the other is a fragment then add it as a new row
Fragment f = (Fragment)other;
if ( !contains(f) )
{
Row r = new Row( sigla, groups, base );
r.setNested( this.nested() );
r.add( other );
r.versions.or(f.versions);
addRow( r );
}
}
else
{
// else if it is another table merge its rows with ours
// versions must not intersect or throw an exception
Table u = (Table) other;
for ( int i=0;i<u.rows.size();i++ )
{
Row r = u.rows.get(i);
addRow( r );
}
}
return this;
} | 3 |
@Override
protected Void doInBackground()
{
String search = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=";
search += button.getText().replace(" ", "+") + "+imdb";
try
{
URL url = new URL(search);
URLConnection connection = url.openConnection();
String line;
StringBuilder builder = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
while ((line = reader.readLine()) != null)
builder.append(line);
JSONObject obj = new JSONObject(builder.toString());
final JSONArray arr = obj.getJSONObject("responseData").getJSONArray("results");
for (int i = 0; i < arr.length(); i++)
{
String string = arr.getJSONObject(i).getString("url");
if (string.contains("title/tt"))
{
final int start = string.indexOf("/tt");
if (start >= 0)
{
string = string.substring(start + 1);
search = "http://www.omdbapi.com/?i=" + string.substring(0, string.indexOf("/"));
url = new URL(search);
connection = url.openConnection();
builder = new StringBuilder();
reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
while ((line = reader.readLine()) != null)
builder.append(line);
obj = new JSONObject(builder.toString());
button.getImdbInfos()[0] = obj.getString("Title");
button.getImdbInfos()[1] = obj.getString("Year");
button.getImdbInfos()[2] = obj.getString("Runtime");
button.getImdbInfos()[3] = obj.getString("Genre");
button.getImdbInfos()[4] = obj.getString("Director");
button.getImdbInfos()[5] = obj.getString("imdbRating");
button.getImdbInfos()[6] = string;
DatabaseSaver.save();
ListManager.reloadList(true);
break;
}
}
}
} catch (MalformedURLException ex)
{
System.err.println(search);
} catch (IOException ex)
{
System.err.println(search);
}
return null;
} | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Funcionario other = (Funcionario) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
} | 6 |
public static void changeGrade() throws IOException
{
fillArray.createArraylist();
makeGPA.createGPA();
for(int x=0;x<Students.database.size(); x++)
{
System.out.println("\n" + (x+1)+".)"+" "+Students.database.get(x));
}
System.out.println("What is the number of the student you would like to change.");
studentNumb=read.nextInt();
System.out.println("What period's grade would you like to change? 1, 2, or 3.");
classChoice=read.nextInt();
System.out.println("What is the students new grade.");
gradeNew=read.next();
if(studentNumb<25)
{
if(classChoice==1)
{
Students.database.get(studentNumb-1).setGradeClass1(gradeNew);
System.out.println(Students.database.get(studentNumb-1).getFirstName()+" "+Students.database.get(studentNumb-1).getLastName()+ " has a new grade for "+Students.database.get(studentNumb-1).getClass1()+", and that is "+gradeNew+".");
}
else if(classChoice==2)
{
Students.database.get(studentNumb-1).setGradeClass2(gradeNew);
System.out.println(Students.database.get(studentNumb-1).getFirstName()+" "+Students.database.get(studentNumb-1).getLastName()+ " has a new grade for "+Students.database.get(studentNumb-1).getClass2()+", and that is "+gradeNew+".");
}
else if(classChoice==3)
{
Students.database.get(studentNumb-1).setGradeClass3(gradeNew);
System.out.println(Students.database.get(studentNumb-1).getFirstName()+" "+Students.database.get(studentNumb-1).getLastName()+ " has a new grade for "+Students.database.get(studentNumb-1).getClass3()+", and that is "+gradeNew+".");
}
else
{
System.out.println("Sorry, that is not a period.");
}
}
else
{
System.out.println("That is not a valid student number.");
}
} | 5 |
private double getSimpleMass(Body body1, Body body2) {
double mass = 0;
Body ancestor = body1.parent;
while (ancestor != null) {
if (ancestor == body2) {
return body2.mass;
}
ancestor = ancestor.parent;
}
if (body1.parent == body2.parent
// Sibling case: bundle niblings with siblings
|| body1 == body2.parent
// Child case: bundle grandchildren with child
) {
return body2.systemMass;
}
if (body1.parent != null) {
if (body1.parent.parent == body2.parent) {
// Aunt/Uncle case: bundle cousins with aunt/uncle
return body2.systemMass;
}
}
return mass;
} | 6 |
public boolean tarkistaLoppusumma(){
int summa = 0;
for (Tulosruutu ruutu : pelaaja.annaTulosrivi().annaTulosruudut()){
if(ruutu.annaTyyppi().tyyppi!=17&&ruutu.annaTyyppi().tyyppi!=18){
summa = summa + ruutu.annaPisteet();
}
}
pelaaja.annaTulosrivi().annaTulosruudut().get(17).asetaPisteet(summa);
return true;
} | 3 |
private void drawStores(Graphics g){
int screenRes = Toolkit.getDefaultToolkit().getScreenResolution();//Using Toolkit class and the calculate the correct font size
int fontSize = (int)Math.round(7 * screenRes / 72.0); //calculate the correct font size
Font f = new Font("Arial", Font.BOLD, fontSize);
g.setFont(f);
ArrayList<int[]> reverseList = new ArrayList<int[]>(shopLists); //reverse, so it draws the first one at the top.
Collections.reverse(reverseList);
int font_X = -6; //font x position.
for (int i=0; i < reverseList.size(); i++){
int[] store = reverseList.get(i);
g.setColor(Color.GRAY);
g.fillOval(store[0]-6, store[1]-6,16,13);//draws the shadow of the dot
g.setColor(Color.orange);
g.fillOval(store[0]-8,store[1]-8,16,13); //draws a oval-dot
if (store[2]<5) {//if the rank < 5, mark a red dot next to it
g.setColor(Color.RED);
g.fillOval(store[0]-10,store[1]-10,6,6); //draws a oval-dot
g.setColor(new Color(203,30,44));
g.drawOval(store[0]-10,store[1]-10,6,6); //draws a oval-border
}
g.setColor(new Color(203,30,44));
g.drawOval(store[0]-8,store[1]-8,16,13); //draws a oval-border
g.setColor(new Color(0, 81, 119));
if (store[2]<10) font_X = -2; //if the rank is a single digit, draws in the center
g.drawString(String.valueOf(store[2]), store[0]+font_X, store[1]+3); //draw the font (the rank number)
}
} | 3 |
public int diferenca(Data d1) {
int totalDias = contaDias();
int totalDias1 = d1.contaDias();
return Math.abs(totalDias-totalDias1);
} | 0 |
public Double checkEmotionalSentiment ( String str ) {
// System.out.println("hhh : " + str);
if ( isPositiveSentiment(str) ) return 1.0;
else if ( isNegativeSentiment(str) ) return -1.0;
return 0.0;
} | 2 |
public boolean isUpperHessenberg(){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(j<(i+1) && this.matrix[i][j]!=0.0D)test = false;
}
}
return test;
} | 4 |
protected void update(Color winner, Board finalBoard, boolean[][][] moves) {
sims++;
if (winner != turn)
wins++;
// Update AMAF (RAVE) values
if (isLeaf && !isRoot) {
int parentTurn = parent.turn.ordinal();
for (Node sibling: parent.children) {
int x = sibling.recentPoint.x, y = sibling.recentPoint.y;
if (moves[x][y][parentTurn] == true)
sibling.updateRAVE(winner);
}
}
// Update criticality values
if (!isRoot) {
for (Node sibling: parent.children) {
int x = sibling.recentPoint.x, y = sibling.recentPoint.y;
Color color = finalBoard.board[x][y];
int winIndex = (color == winner ? 0 : 1);
parent.criticalityCounts[x][y][color.ordinal()][winIndex]++;
}
}
if (!isRoot) {
moves[recentPoint.x][recentPoint.y][parent.turn.ordinal()] = true;
parent.update(winner, finalBoard, moves);
}
} | 9 |
public void saveNewItem(PosListaPrecio itemOracle,
int idPos){
if (itemOracle.getPcaPrecioVenta() == null) {
logger.info(" ======== ITEM NO CREADO Precio de Venta NULO ======== ");
logger.info("itemOracle.getPcaIdElemento() = " + itemOracle.getPcaIdElemento());
logger.info("itemOracle.getPcaDescripcion() = " + itemOracle.getPcaDescripcion());
logger.info("itemOracle.getPcaPrecioVenta() = " + itemOracle.getPcaPrecioVenta());
logger.info("itemOracle.getPcaCantidad() = " + itemOracle.getPcaCantidad());
logger.info(" ======================================================= ");
} else if (itemOracle.getPcaPrecioVenta() == 0) {
logger.info(" ======== ITEM NO CREADO Precio de Venta en Cero (0) == ");
logger.info("itemOracle.getPcaIdElemento() = " + itemOracle.getPcaIdElemento());
logger.info("itemOracle.getPcaDescripcion() = " + itemOracle.getPcaDescripcion());
logger.info("itemOracle.getPcaPrecioVenta() = " + itemOracle.getPcaPrecioVenta());
logger.info("itemOracle.getPcaCantidad() = " + itemOracle.getPcaCantidad());
logger.info(" ======================================================= ");
} else {
// PREGUNTO EN ORACLE SI EL ITEM DE MYSQL EXISTE
if (itemOracle.getPcaIdElemento() == null){ // EL ITEM NO EXISTE EN EL POS
// CREAR UNO NUEVO
PhpposItemsEntity itemPos = new PhpposItemsEntity();
itemPos.setName(itemOracle.getPcaDescripcion());
itemPos.setCategory("producto");
itemPos.setSupplierId(10); // TODO APLICAR UN CRITERIO MEJOR A ESTE ASUNTO
itemPos.setItemNumber(String.valueOf(System.currentTimeMillis()));
itemPos.setDescription(itemOracle.getPcaDescripcion());
itemPos.setCostPrice(itemOracle.getPcaPrecioVenta());
itemPos.setUnitPrice(itemOracle.getPcaPrecioVenta());
itemPos.setQuantity(itemOracle.getPcaCantidad());
itemPos.setReorderLevel(1);
itemPos.setActive(1);
Integer idItemPos = (Integer) getHibernateTemplate().save(itemPos);
getHibernateTemplate().flush();
// LOG ENTRADAS
itemOracle.setPcaIdElemento(idItemPos);
saveLogEntrada(itemOracle, "N", idPos);
// JOIN CON LA TABLA LISTA PRECIOS DE SINFAD
itemOracle.setPcaIdElemento(idItemPos);
// ACTUALIZO EN CERO (0) EN ORACLE
itemOracle.setPcaCantidad(0);
itemOracle.setPcaEstado("A");
facOracleDAO.getHibernateTemplate().update(itemOracle); // se usa el facOracleDao
getHibernateTemplate().flush();
// CREAR EL IMPUESTO - INICIALMENTE CERO( 0 )
PhpposItemsTaxesEntity taxesItemPos = new PhpposItemsTaxesEntity();
taxesItemPos.setItemId(idItemPos);
taxesItemPos.setName("IVA");
taxesItemPos.setPercent(0);
getHibernateTemplate().save(taxesItemPos);
getHibernateTemplate().flush();
logger.info(" ");
logger.info(" ======== ITEM CREADO =============================== ");
logger.info("idItemPos = " + idItemPos);
logger.info("itemPos.getDescription() = " + itemPos.getDescription());
logger.info("itemPos.getUnitPrice() = " + itemPos.getUnitPrice());
logger.info("itemPos.getQuantity() = " + itemPos.getQuantity());
logger.info(" ======================================================= ");
logger.info(" ");
} // END IF EXISTE ITEM EN POS
}
} | 3 |
private boolean isColorTaken(JoinGameRequest request,
List<PlayerDescription> players, int playerGameIndex) {
boolean colorTaken = false;
for (int i = 0; i < players.size(); i++) {
PlayerDescription pd = players.get(i);
if (pd.getColor().toLowerCase().equals(request.getColor().toLowerCase()) && i != playerGameIndex) { // color already taken
colorTaken = true;
break;
}
}
return colorTaken;
} | 3 |
private static boolean isFloat(String lexeme) {
// Double.parseDouble and Float.parseFloat does not work for this
char firstChar = lexeme.charAt(0);
if (firstChar == '.') {
return false;
}
if (!lexeme.contains(".")) {
return false;
}
int count = 0;
char[] lexemeArray = lexeme.toCharArray();
for (char c : lexemeArray) {
if (c == '.') {
if (++count > 1) {
return false;
}
} else {
if (!Character.isDigit(c)) {
return false;
}
}
}
return true;
} | 6 |
public void resetTabIcons() {
ArrayList icons = new ArrayList();
DockKey k = getDockable().getDockKey();
if(k.isCloseEnabled() && isCloseButtonDisplayed) {
icons.add(closeSmartIcon);
}
if(k.isMaximizeEnabled() && isMaximizeButtonDisplayed) {
icons.add(maximizeSmartIcon);
}
if(k.isAutoHideEnabled() && isHideButtonDisplayed) {
icons.add(hideSmartIcon);
}
if(k.isFloatEnabled() && isFloatButtonDisplayed) {
icons.add(floatSmartIcon);
}
// this is an attempt to create the set of icons displayed for this dockable
// currently, only "close" is managed, but other buttons could be added, as
// the jTabebdPaneSmartIcon supports(simulates) many sub-buttons.
if(icons.size() > 0) {
SmartIconJButton[] iconsArray = (SmartIconJButton[]) icons.toArray(new SmartIconJButton[0]);
smartIcon = new JTabbedPaneSmartIcon(k.getIcon(), k.getName(), iconsArray);
smartIcon.setIconForTabbedPane(tabHeader);
tabHeader.addTab("", smartIcon, getDockable().getComponent());
} else {
tabHeader.addTab(k.getName(), k.getIcon(), getDockable().getComponent());
}
} | 9 |
private void affine_nearest_xy(final Image image, final Image affined) {
// Initialization:
messenger.log("Nearest-neighbor sampling in x-y");
progressor.status("Affine transforming"+component+"...");
progressor.steps(odims.c*odims.t*odims.z*odims.y);
// Affine transform using the backward transformation matrix:
final Coordinates ci = new Coordinates();
final Coordinates co = new Coordinates();
final double[] row = new double[odims.x];
affined.axes(Axes.X);
progressor.start();
for (co.c=ci.c=0; co.c<odims.c; ++co.c, ++ci.c) {
for (co.t=ci.t=0; co.t<odims.t; ++co.t, ++ci.t) {
for (co.z=ci.z=0; co.z<odims.z; ++co.z, ++ci.z) {
final double dz = co.z*ovz - opc.z;
for (co.y=0; co.y<odims.y; ++co.y) {
final double dy = co.y*ovy - opc.y;
for (int x=0; x<odims.x; ++x) {
final double dx = x*ovx - opc.x;
ci.x = FMath.round((ipc.x + dx*bwd.axx + dy*bwd.axy + dz*bwd.axz + bwd.axt)/ivx);
ci.y = FMath.round((ipc.y + dx*bwd.ayx + dy*bwd.ayy + dz*bwd.ayz + bwd.ayt)/ivy);
if (ci.x < 0 || ci.x > ipmax.x ||
ci.y < 0 || ci.y > ipmax.y) {
row[x] = background;
} else {
row[x] = image.get(ci);
}
}
affined.set(co,row);
progressor.step();
}
}
}
}
progressor.stop();
} | 9 |
public void run() {
if (this.recipients == null) {
for (String messageLine : this.message.split("\n")) Bukkit.broadcastMessage(messageLine);
}
else if (this.recipients.isEmpty()) {
for (String messageLine : this.message.split("\n")) this.sender.sendMessage(messageLine);
}
else {
String listRecipients = "";
for (CommandSender recipient : this.recipients) {
for (String messageLine : this.message.split("\n")) recipient.sendMessage(messageLine);
listRecipients += recipient.getName() + ", ";
}
sender.sendMessage("Sent search results to " +
listRecipients.substring(0, listRecipients.length() - 2) + ".");
}
} | 6 |
static String isField(ClassPool pool, ConstPool cp, CtClass fclass,
String fname, boolean is_private, int index) {
if (!cp.getFieldrefName(index).equals(fname))
return null;
try {
CtClass c = pool.get(cp.getFieldrefClassName(index));
if (c == fclass || (!is_private && isFieldInSuper(c, fclass, fname)))
return cp.getFieldrefType(index);
}
catch (NotFoundException e) {}
return null;
} | 5 |
public static String getServerIP(){
if(serverip == null) {
final int port = Bukkit.getPort();
if(Bukkit.getServer().getIp() == null){
serverip = Bukkit.getServer().getIp();
if (port != 25565)
serverip += ":"+port;
}
URL whatismyip;
try {
whatismyip = new URL("http://BattlePunishments.net/grabbers/ip.php");
} catch (Exception e) {
e.printStackTrace();
return null;
}
WebURL url = new WebURL(whatismyip);
url.getPage(new URLResponseHandler() {
public void validResponse(final BufferedReader br) throws IOException {
String ip = br.readLine();
if(ip == null)
throw new NullPointerException();
serverip = ip;
}
public void invalidResponse(Exception e) {
e.printStackTrace();
}
});
}
return serverip;
} | 5 |
public Drivability isDriveable(Vehicle c) {
if (c.getOrientation()== _lightControl.getState().getAllowedOrientation()) {
if (_lightControl.getState().isYellow()) {
return Drivability.Caution;
}
return Drivability.Driveable;
} else {
return Drivability.NotDriveable;
}
} | 2 |
public void testSetSecondOfMinute_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setSecondOfMinute(60);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString());
} | 1 |
@Override
public void maskedCopyFrom(MapLayer other, Area mask) {
Rectangle boundBox = mask.getBounds();
for (int y = boundBox.y; y < boundBox.y + boundBox.height; y++) {
for (int x = boundBox.x; x < boundBox.x + boundBox.width; x++) {
if (mask.contains(x,y)) {
setTileAt(x, y, ((TileLayer) other).getTileAt(x, y));
}
}
}
} | 3 |
public boolean shouldDefer(StringAppender inBuf) {
char[] buffer = new char[inBuf.length()];
inBuf.getChars(0, inBuf.length(), buffer, 0);
depth = cdepth = 0;
for (int i = 0; i < buffer.length; i++) {
switch (buffer[i]) {
case '/':
if (i + 1 < buffer.length && buffer[i + 1] == '*') {
cdepth++;
}
break;
case '*':
if (i + 1 < buffer.length && buffer[i + 1] == '/') {
cdepth--;
}
break;
case '{':
depth++;
break;
case '}':
depth--;
break;
}
}
return depth + cdepth > 0;
} | 9 |
public static void download(URL url, File file) throws IOException {
if (!file.getParentFile().exists())
file.getParentFile().mkdir();
if (file.exists())
file.delete();
file.createNewFile();
int size = url.openConnection().getContentLength();
Util.info("Downloading " + file.getName() + " (" + size / 1024
+ "kb) ...");
InputStream in = url.openStream();
OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
byte[] buffer = new byte[1024];
int len, downloaded = 0, msgs = 0;
final long start = System.currentTimeMillis();
while ((len = in.read(buffer)) >= 0) {
out.write(buffer, 0, len);
downloaded += len;
if ((int) ((System.currentTimeMillis() - start) / 500) > msgs) {
Util.info((int) ((double) downloaded / (double) size * 100d)
+ "%");
msgs++;
}
}
in.close();
out.close();
Util.info("Download finished");
} | 4 |
private void sendColorMessage(Color c, Node to) {
S4Message msg = new S4Message();
msg.color = c;
if(Tools.isSimulationInAsynchroneMode()) {
// sending the messages directly is OK in async mode
if(to != null) {
send(msg, to);
} else {
broadcast(msg);
}
} else {
// In Synchronous mode, a node is only allowed to send messages during the
// execution of its step. We can easily schedule to send this message during the
// next step by setting a timer. The MessageTimer from the default project already
// implements the desired functionality.
MessageTimer t;
if(to != null) {
t = new MessageTimer(msg, to); // unicast
} else {
t = new MessageTimer(msg); // multicast
}
t.startRelative(Tools.getRandomNumberGenerator().nextDouble(), this);
}
} | 3 |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event)
{
// CAUTION:This event fires, BEFORE the placed block is removed from the inventory!
// therefore, delay all checks for 1 tick because "itemInHand()" is needed for checks
// this event can be potentially fired every tick, (well...you need fast fingers)
// so make sure the handling (with schedulers...) is as efficient as possible for normal players
// check if this player is already scheduled for a delayed check (must be happened last tick) and if so,
// if the check has not yet been executed.
// if so, cancel the scheduler and re-schedule the check
// otherwise do some preconditions checks and if successful, schedule the check for next tick
if(playersScheduledForDelayedServiceModeCheck.containsKey(event.getPlayer().getName()) &&
(null != playersScheduledForDelayedServiceModeCheck.get(event.getPlayer().getName())))
{
// a new BlockPlaceEvent has fired while the check routine that is scheduled for the
// current tick has not yet been called for this player
// so cancel the task and re-schedule it for the next tick
playersScheduledForDelayedServiceModeCheck.get(event.getPlayer().getName()).cancel();
}
if(preconditionsOK(event.getPlayer())) // may player use MG at all in current situation?
{
boolean doCheck = false;
if(playersInSM.contains(event.getPlayer().getName()))
{
if(!playersInGracePeriod.containsKey(event.getPlayer().getName()))
{
doCheck = true;
}
}
else
{
if(playersOnWarmup.containsKey(event.getPlayer().getName()))
{
doCheck = true;
}
}
if(doCheck)
{
// check only if player is in SM and not already handled by any timer
playersScheduledForDelayedServiceModeCheck.put(event.getPlayer().getName(),
plugin.startDelayedServiceModeCheckTimer_Task(event.getPlayer())); // this will schedule the check handling for next tick
}
}
} | 7 |
void test() {
// Объявляем переменные
int x=127, y;
// y - не инициализированная переменная,
// использовать её компилятор не даст
//x=y; // => Ошибка компиляции
double фыва=77.7; // можно, но не нужно!
String myFirstString="Hello!"; // соглашение об именах
long l = 10000000000L;
//l = 0xffffffffaaL;
//l = 010; // 8
System.out.println("l="+l);
//l=0b10; // JDK 7 only
boolean f;
f = (x & 2) !=0; // 2-й 2-ичный разряд не равен 0
System.out.println("f="+f);
System.out.println("x="+Integer.toBinaryString(x));
System.out.println("x+="+(1<<31));
x+= 1<<31;
System.out.println("x="+Integer.toBinaryString(x));
System.out.println("x="+x);
System.out.println("x>>1="+Integer.toBinaryString(x>>1));
System.out.println("x>>1="+(x>>1));
System.out.println("x>>>1="+Integer.toBinaryString(x>>>1));
System.out.println("x>>>1="+(x>>>1));
if ( (x>3) ^ (x<7) ) {
// x>3 && x>=7 || x<=3 && x<7
}
byte b = 1;
//b=x; // ошибка компиляции
b=(byte) x; //
System.out.println("b="+Integer.toBinaryString(b));
//b=b+1; // ошибка компиляции - b+1 имеет тип int!!!
double w;
System.out.println((w=-100.1 % 30)); // -10
System.out.println("w="+w);
System.out.println(w == -10.1);
// BigDecimal
BigInteger big = new BigInteger("1111111111111111111111111111111111111111111111111111");
System.out.println( big.multiply(big) );
System.out.println( big.multiply(big) );
System.out.println("Integer.parseInt(\"752\")+3 = "+ (Integer.parseInt("752")+3)); // 755
for (int i=1, j=2; i<10; i++, j+=2) {
System.out.println(String.format("i=%5d j=%5d", i,j) );
}
y=0;
System.out.println( "++:" +( y++ + ++y));
System.out.println("y:"+y);
a: {
System.out.println("1");
System.out.println("2");
if (true) break a;
System.out.println("3");
System.out.println("4");
}
a: switch (5) {
case 7: System.out.println("7");
case 5: for (int i=0; i<7;i++) {
System.out.println("5"+i);
if (i==6) break; // 56
//if (i==6) break a; // 56 3
}
case 3: System.out.println("---3");
}
// Массивы
int aa[],bb=2;
System.out.println(bb);
int[][][] xx= new int[][][] { { {1,2},{3,4} } , { {1},null } , {{1,2,3} } };
int[] q=new int[]{7,2,8};
Arrays.sort(q);
System.out.println("q.length="+ q.length);
System.out.println(Arrays.toString(q));
System.out.println(Arrays.toString(xx[1])); // { {1},null }
xx[1][1]=q;
System.out.println(Arrays.toString(xx[1])); // { {1},null }
} | 8 |
public ArrayList<String> getSensorRecord(String sensor_id) throws NotFoundException, IllegalAccessError, SocketTimeoutException {
ArrayList<String> recordList = new ArrayList<String>();
try {
clientSocket.Escribir("HISTORICO " + sensor_id + '\n');
serverAnswer = clientSocket.Leer();
recordList.add(new String(serverAnswer.getBytes(), "UTF-8"));
while(!serverAnswer.contains("525 ERR") &&!serverAnswer.contains("524 ERR") && !serverAnswer.contains("322 OK")) {
serverAnswer = clientSocket.Leer();
recordList.add(new String(serverAnswer.getBytes(), "UTF-8"));
}
recordList.remove(recordList.size() - 1);
if(serverAnswer.contains("525 ERR")) {
throw new IllegalAccessError();
} else if(serverAnswer.contains("524 ERR")) {
throw new NotFoundException();
}
} catch (IOException e) {
throw new SocketTimeoutException();
}
for(int i = 0; i < recordList.size(); i++) {
System.out.println(recordList.get(i));
}
return recordList;
} | 7 |
public static void main (String args[]){
Scanner entrada = new Scanner(System.in);
System.out.println("Digite um número: \n"+
"1 – calcular o fatorial de um número dado\n" +
"2 – calcular a raiz quadrada de 3 números dados\n" +
"3 – imprimir a tabuada completa de 1 a 10\n"+
"4 – sair do programa");
int escolha = entrada.nextInt();
switch(escolha){
case 1:
System.out.println("Digite um número para calcular o fatorial: ");
double numero = entrada.nextDouble();// aqui criamos uma variável que irá armazenar o numero do fatorial
double numero2 = numero;
double fatorial = numero; // aqui criamos outra var. Será o resultado temporário da multiplicação
while (numero > 1){ // Enquanto x for menor que 1 faça o que está entre as chaves
fatorial = fatorial*(numero - 1); // A variável temporária ira receber o resultado da multiplicação dela, pelo valor de x menos 1
numero--; // aqui decrementamos o valor de x em um, no final do loop
}
System.out.println("O fatorial de "+numero2+" é: "+fatorial); // Esse comando imprime o valor de f. O último será o valor final do Fatorial.
break;
case 2:
System.out.println("Digite o primeiro número para calcular a raiz quadrada: ");
double num1 = entrada.nextDouble();
System.out.println("Digite o segundo número para calcular a raiz quadrada: ");
double num2 = entrada.nextDouble();
System.out.println("Digite o terceiro número para calcular a raiz quadrada: ");
double num3 = entrada.nextDouble();
System.out.println("As raizes quadradas dos números são, respectivamente: "+Math.sqrt(num1)+", "+Math.sqrt(num2)+" e "+Math.sqrt(num3));
break;
case 3:
for (int i = 1; i<=10; i++){
System.out.println ("Tabuada de: "+i);
for (int j = 1; j<=10; j++)
System.out.println (i+" x "+j+" = "+ i*j);
}
break;
case 4:
System.out.println("Saindo do programa.");
break;
}
} | 7 |
public static Method getAsMethodOfPublicBase(Class<?> c, Method m){
for(Class<?> iface : c.getInterfaces()){
for(Method im : iface.getMethods()){
if(isMatch(im, m)){
return im;
}
}
}
Class<?> sc = c.getSuperclass();
if(sc == null){
return null;
}
for(Method scm : sc.getMethods()){
if(isMatch(scm, m)){
return scm;
}
}
return getAsMethodOfPublicBase(sc, m);
} | 9 |
@Override
public void ParseIn(Connection Main, Server Environment)
{
DatabaseClient DB;
try {
DB = new DatabaseClient(Environment.DataBase);
}
catch (Exception ex)
{
Environment.Log.Print(ex);
Main.Disconnect();
return;
}
int len = Main.Data.Friend_Requests.size();
try
{
Environment.InitPacket(314, Main.ClientMessage);
Environment.Append(len, Main.ClientMessage);
Environment.Append(len, Main.ClientMessage);
for(int RequesterId : Main.Data.Friend_Requests)
{
Player pClient = Environment.ClientManager.GetClient(RequesterId);
if(pClient == null) continue;
if((pClient.Flags & Server.plrOnline) == Server.plrOnline) // Is Online?
{
Environment.Append(RequesterId, Main.ClientMessage);
Environment.Append(pClient.UserName, Main.ClientMessage);
Environment.Append(Integer.toString(RequesterId), Main.ClientMessage);
}
else
{
ResultSet userr = DB.Query("SELECT username FROM users WHERE id = '" + RequesterId + "' LIMIT 1;");
if(userr.next())
{
Environment.Append(RequesterId, Main.ClientMessage);
Environment.Append(userr.getString("username"), Main.ClientMessage);
Environment.Append(Integer.toString(RequesterId), Main.ClientMessage);
}
userr.close();
}
}
Environment.EndPacket(Main.Socket, Main.ClientMessage);
}
catch (Exception ex)
{
Environment.Log.Print(ex);
}
try
{
DB.Close();
}
catch(Exception ex)
{
Environment.Log.Print(ex);
}
} | 7 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(listadoLavanderia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(listadoLavanderia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(listadoLavanderia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(listadoLavanderia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new listadoLavanderia().setVisible(true);
}
});
} | 6 |
private GuanYu fetchValueFromRequest(HttpServletRequest request,GuanYu guanYu) {
String id = StringUtil.toString(request.getParameter("id"));
String gsjianjie = StringUtil.toString(request.getParameter("gsjianjie"));//公司简介 中文
String tzcelue = StringUtil.toString(request.getParameter("tzcelue"));//投资策略
String zzfuwu = StringUtil.toString(request.getParameter("zzfuwu"));//增值服务
String enGsjianjie = StringUtil.toString(request.getParameter("enGsjianjie"));
String enTzcelue = StringUtil.toString(request.getParameter("enTzcelue"));
String enZzfuwu = StringUtil.toString(request.getParameter("enZzfuwu"));
if("".equals(id)) {
return null;
}
if(!"".equals(gsjianjie)) {
guanYu.setGsjianjie(gsjianjie);
}
if(!"".equals(tzcelue)) {
guanYu.setTzcelue(tzcelue);
}
if(!"".equals(zzfuwu)) {
guanYu.setZzfuwu(zzfuwu);
}
if(!"".equals(enGsjianjie)) {
guanYu.setEnGsjianjie(enGsjianjie);
}
if(!"".equals(enTzcelue)) {
guanYu.setEnTzcelue(enTzcelue);
}
if(!"".equals(enZzfuwu)) {
guanYu.setEnZzfuwu(enZzfuwu);
}
return guanYu;
} | 7 |
@Override
public void mouseReleased(MouseEvent e) {
if (!potentialDrag) {
return;
}
source.removeMouseMotionListener(this);
potentialDrag = false;
if (changeCursor) {
source.setCursor(originalCursor);
}
if (destination instanceof JComponent) {
((JComponent) destination).setAutoscrolls(autoscrolls);
}
// Layout the components on the parent container
if (autoLayout) {
if (destination instanceof JComponent) {
((JComponent) destination).revalidate();
} else {
destination.validate();
}
}
if (destination instanceof SmartTextBox) {
try {
((SmartTextBox) destination).handleMove();
} catch (Exception ex) {
Logger.getLogger(ComponentMover.class.getName()).log(Level.SEVERE, null, ex);
}
}
} | 7 |
private byte compareDate(byte[] date1, short offset1, byte[] date2,
short offset2) {
short year1 = (short) ((short) (date1[offset1] * 10) + date1[(short) (offset1 + 1)]);
short year2 = (short) ((short) (date2[offset2] * 10) + date2[(short) (offset2 + 1)]);
short month1 = (short) ((short) (date1[(short) (offset1 + 2)] * 10) + date1[(short) (offset1 + 3)]);
short month2 = (short) ((short) (date2[(short) (offset2 + 2)] * 10) + date2[(short) (offset2 + 3)]);
short day1 = (short) ((short) (date1[(short) (offset1 + 4)] * 10) + date1[(short) (offset1 + 5)]);
short day2 = (short) ((short) (date2[(short) (offset2 + 4)] * 10) + date2[(short) (offset2 + 5)]);
if (year1 < year2) {
return -1;
} else if (year1 > year2) {
return 1;
}
if (month1 < month2) {
return -1;
} else if (month1 > month2) {
return 1;
}
if (day1 < day2) {
return -1;
} else if (day1 > day2) {
return 1;
}
return 0;
} | 6 |
public void inputHandler() {
if(Keys.isPressed(Keys.ENTER)) select();
if(Keys.isPressed(Keys.UP)) {
if(currentChoise > 0) {
//AudioBox.play("menuChanged", 0);
currentChoise--;
}
}
if(Keys.isPressed(Keys.DOWN)) {
if(currentChoise < options.length - 1) {
//AudioBox.play("menuChanged", 0);
currentChoise++;
}
}
} | 5 |
@Deprecated
public boolean createTable(String query) {
Statement statement = null;
if (query == null || query.equals("")) {
this.writeError("Could not create table: query is empty or null.", true);
return false;
}
try {
statement = connection.createStatement();
statement.execute(query);
statement.close();
} catch (SQLException e) {
this.writeError("Could not create table, SQLException: " + e.getMessage(), true);
return false;
}
return true;
} | 3 |
public ContentObject changeTypeOfRegion(ContentObject region, RegionType newType) throws IllegalArgumentException {
if (region == null || !(region.getType() instanceof RegionType))
throw new IllegalArgumentException("Not a region: "+region.getType());
if (region.getType().equals(newType))
return region;
ContentObject newRegion = contentFactory.createContent(newType);
//Remove old region from layout
RegionContainer parentRegion = null;
if (region instanceof Region)
parentRegion = ((Region)region).getParentRegion();
if (parentRegion == null)
removeRegion(region.getId());
else
((RegionContainer)parentRegion).removeRegion((Region)region);
this.contentFactory.getIdRegister().unregisterId(region.getId());
//Copy ID, outline, ...
try {
newRegion.setId(region.getId());
} catch (InvalidIdException e) {
}
newRegion.setCoords(region.getCoords().clone());
//Add new region to layout
if (parentRegion == null || !(newRegion instanceof Region))
regions.put(newRegion.getId(), (Region)newRegion);
else
parentRegion.addRegion((Region)newRegion);
return newRegion;
} | 8 |
public Priority getPriority() {
return priority;
} | 0 |
public void draw(Graphics2D g) {
Tool tool = controls.getTool();
// vykresli polhranu
if (begin != null && graph.player.state == RunState.stopped
&& tool.compatible(ToolType.create) && tool.compatible(ToolTarget.edge)) {
g.setColor(new Color(0, 0, 0));
g.draw(new Line2D.Double(begin.getX(), begin.getY(), xlast, ylast));
}
} | 4 |
public void setState(int state) {
this.state = state;
if(container != null) {
container.fireEvent(new StateChangeEvent(this, this.state));
}
} | 1 |
protected void setFocusToButton(int i) {
if (i > this.buttons.length) {
throw new IllegalArgumentException();
}
this.buttons[i].grabFocus();
} | 1 |
public Knowledge() {
//ArrayList<Event> tempEvents = new ArrayList<>();
events = new ArrayList<>();
/*
************************************************************************
*/
String[] czajowniaDescription;
czajowniaDescription = new String[4];
czajowniaDescription[0] = "Here you can taste tea from all around the world. With your friends and smooth sounds you will relax and forget about all your problems.";
czajowniaDescription[1] = "Czajownia's additional information";
czajowniaDescription[2] = "Czajownia's fun fun fun facts";
czajowniaDescription[3] = "Białoskórnicza 7";
czajownia = new Event("Czajownia",
czajowniaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.SHISHA,
AgeCategories.IRRELEVANT,
Beverages.TEA,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.OFFICIAL,
EventTypes.PRIVATE,
MusicLoudness.LOW,
MusicTypes.CLASSICAL,
PeopleAmount.LOW,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(czajownia);
/*
************************************************************************
*/
String[] renomaDescription;
renomaDescription = new String[4];
renomaDescription[0] = "Trade House Renoma is a unique place in Wroclaw. It combines the commercial offer of cultural respect for the history of the modern field of design, as well as leading a number of innovative programs, educational and social, as nearly as possible to respond to the needs of Wroclaw.";
renomaDescription[1] = "Czajownia's additional information";
renomaDescription[2] = "Czajownia's fun fun fun facts";
renomaDescription[3] = "ul. Świdnicka 40";
renoma = new Event("Renoma",
renomaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.SHOPPING,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(renoma);
/*
************************************************************************
*/
String[] odZmierzchuDoSwituDescription;
odZmierzchuDoSwituDescription = new String[4];
odZmierzchuDoSwituDescription[0] = "Czajownia's sample description";
odZmierzchuDoSwituDescription[1] = "Czajownia's additional information";
odZmierzchuDoSwituDescription[2] = "Czajownia's fun fun fun facts";
odZmierzchuDoSwituDescription[3] = "Czajownia's adress";
odZmierzchuDoSwitu = new Event("Od Zmierzchu do Świtu",
odZmierzchuDoSwituDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.STUDENTS,
Beverages.ALCOHOL,
Cost.MODERATE,
Day.SATURDAY,
Daytime.NIGHT,
DressCode.THEMATIC,
EventTypes.PRIVATE,
MusicLoudness.HIGH,
MusicTypes.ROCK,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(odZmierzchuDoSwitu);
/*
************************************************************************
*/
String[] galeriaDominikanskaDescription;
galeriaDominikanskaDescription = new String[4];
galeriaDominikanskaDescription[0] = "Galeria Dominikańska - a fabulous world of fashion in the very heart of the city of Wrocław, a few minutes walk from the Main Market Square. Brand-named retail stores, latest trends, world renowned fashion collections, cafes, restaurants, service outlets where everything that stands for quality, fashion and style can be found.";
galeriaDominikanskaDescription[1] = "Czajownia's additional information";
galeriaDominikanskaDescription[2] = "Czajownia's fun fun fun facts";
galeriaDominikanskaDescription[3] = "Plac Dominikański 3";
galeriaDominikanska = new Event("Galeria Dominikańska",
galeriaDominikanskaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.SHOPPING,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(galeriaDominikanska);
/*
************************************************************************
*/
String[] magnoliaDescription;
magnoliaDescription = new String[4];
magnoliaDescription[0] = "Magnolia Park is the largest shopping, entertainment and recreation center in Lower Silesia. The total retail space is currently 77,595 m2, and further investments are precisely executed. Among the tenants of the center is about 230 shops, cafes, restaurants and services. Other activities include a cinema and a children's playroom. Drivers customers can benefit from 3,018 parking spaces.";
magnoliaDescription[1] = "Czajownia's additional information";
magnoliaDescription[2] = "Czajownia's fun fun fun facts";
magnoliaDescription[3] = "ul. Legnicka 58";
magnolia = new Event("Magnolia",
magnoliaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.SHOPPING,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(magnolia);
/*
************************************************************************
*/
String[] dachMonopoluDescription;
dachMonopoluDescription = new String[4];
dachMonopoluDescription[0] = "Czajownia's sample description";
dachMonopoluDescription[1] = "Czajownia's additional information";
dachMonopoluDescription[2] = "Czajownia's fun fun fun facts";
dachMonopoluDescription[3] = "Czajownia's adress";
dachMonopolu = new Event("Monopol Roof",
dachMonopoluDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.DATE,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.IRRELEVANT,
EventTypes.PRIVATE,
MusicLoudness.LOW,
MusicTypes.CLASSICAL,
PeopleAmount.LOW,
WeatherTypes.SUNNY,
0.0);
this.events.add(dachMonopolu);
/*
************************************************************************
*/
String[] arkadyDescription;
arkadyDescription = new String[4];
arkadyDescription[0] = "Arkady Wrocław is a modern facility that meets the dominant features of retail, service, entertainment and office space, located in the central-southern part of the city.";
arkadyDescription[1] = "Czajownia's additional information";
arkadyDescription[2] = "Czajownia's fun fun fun facts";
arkadyDescription[3] = "ul. Powstańców Śląskich 2-4";
arkady = new Event("Arkady",
arkadyDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.SHOPPING,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(arkady);
/*
************************************************************************
*/
String[] upDescription;
upDescription = new String[4];
upDescription[0] = "Every weekend this club become cave of electro music. The best DJs presents their best tracks. Want more? This events is on the top of Times building with great view and open air space.\n"
+ "Be there with us.";
upDescription[1] = "Czajownia's additional information";
upDescription[2] = "Czajownia's fun fun fun facts";
upDescription[3] = "Kazimierza Wielkiego 1";
up = new Event("Up",
upDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.STUDENTS,
Beverages.ALCOHOL,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(up);
/*
************************************************************************
*/
String[] czarnyKotDescription;
czarnyKotDescription = new String[4];
czarnyKotDescription[0] = "Czarny Kot is decorated with an idea. The concept is to combine music with a passion for modern art. Red walls of the premises are littered with photographs, covers albums, music magazines and posters of concerts.";
czarnyKotDescription[1] = "Czajownia's additional information";
czarnyKotDescription[2] = "Czajownia's fun fun fun facts";
czarnyKotDescription[3] = "ul. Ruska 47/48a";
czarnyKot = new Event("Czarny Kot",
czarnyKotDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.STUDENTS,
Beverages.ALCOHOL,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(czarnyKot);
/*
************************************************************************
*/
String[] daytonaDescription;
daytonaDescription = new String[4];
daytonaDescription[0] = "The most recognizable brand club at the Market Square. Club Daytona is characterized by primarily unprecedented climate, which consists of modern decor and lighting, with elements of old school, car graphics, specially upholstered lodges, Cadillac's profile on one of the rooms, and the brick and stone walls.";
daytonaDescription[1] = "Czajownia's additional information";
daytonaDescription[2] = "Czajownia's fun fun fun facts";
daytonaDescription[3] = "Rynek 36/37";
daytona = new Event("Daytona",
daytonaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.STUDENTS,
Beverages.ALCOHOL,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.NIGHT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.HIGH,
MusicTypes.MODERN,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(daytona);
/*
************************************************************************
*/
String[] teatrWspolczesnyDescription;
teatrWspolczesnyDescription = new String[4];
teatrWspolczesnyDescription[0] = "Czajownia's sample description";
teatrWspolczesnyDescription[1] = "Czajownia's additional information";
teatrWspolczesnyDescription[2] = "Czajownia's fun fun fun facts";
teatrWspolczesnyDescription[3] = "Czajownia's adress";
teatrWspolczesny = new Event("Teatr Współczesny",
teatrWspolczesnyDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.THEATRE,
AgeCategories.ADULTS,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.OFFICIAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(teatrWspolczesny);
/*
************************************************************************
*/
String[] gafaDescription;
gafaDescription = new String[4];
gafaDescription[0] = "Do you wanna dance? We have found perfec place for you. Thematic parties with club music interest every music lover. Do you want to dance something from Latin America ? Salsa, Bachiata, Kizomba.. every Thursday in Gafa.";
gafaDescription[1] = "Czajownia's additional information";
gafaDescription[2] = "Czajownia's fun fun fun facts";
gafaDescription[3] = "ul. Ruska 51";
gafa = new Event("Gafa Club",
gafaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.CHEAP,
Day.IRRELEVANT,
Daytime.NIGHT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(gafa);
/*
************************************************************************
*/
String[] teatrPolskiDescription;
teatrPolskiDescription = new String[4];
teatrPolskiDescription[0] = "Polish Theatre in Wroclaw - Wroclaw theater, provincial cultural institution, founded in 1949 as the State Theatre of Lower Silesia in Wroclaw. Since 1969 bears its present name .";
teatrPolskiDescription[1] = "Czajownia's additional information";
teatrPolskiDescription[2] = "Czajownia's fun fun fun facts";
teatrPolskiDescription[3] = "ul. G. Zapolskiej 3";
teatrPolski = new Event("Teatr Polski",
teatrPolskiDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.THEATRE,
AgeCategories.ADULTS,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.OFFICIAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(teatrPolski);
/*
************************************************************************
*/
String[] sombreroDescription;
sombreroDescription = new String[4];
sombreroDescription[0] = "Heve you ever been in Mexico? And you'd like to? There is no need to fly over 15 000 km - just visit Sombrero music club to taste Mexical climate. Mexican drinks, music, arrangement this is what you can find in our place. Come to try sombrero hat.";
sombreroDescription[1] = "Czajownia's additional information";
sombreroDescription[2] = "Czajownia's fun fun fun facts";
sombreroDescription[3] = "Świdnicka 12-16";
sombrero = new Event("Sombrero Music Club",
sombreroDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.CHEAP,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(sombrero);
/*
************************************************************************
*/
String[] teatrKomediaDescription;
teatrKomediaDescription = new String[4];
teatrKomediaDescription[0] = "Wroclaw Comedy Theatre is a new, professional theater scene on the map of Wroclaw.\n"
+ "It was created as an extension of Monday's activities Theatre, founded in 1997 by Wojciech Dabrowski and Paul Okoński, former actors Wroclaw Mime Theatre and the Polish Theatre in Wroclaw. Since January 2005, Wroclaw Comedy Theatre has its headquarters on the hospitality scene Wroclaw Puppet Theatre.";
teatrKomediaDescription[1] = "Czajownia's additional information";
teatrKomediaDescription[2] = "Czajownia's fun fun fun facts";
teatrKomediaDescription[3] = "pl. Teatralny 4";
teatrKomedia = new Event("Teatr Komedia",
czajowniaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.THEATRE,
AgeCategories.ADULTS,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(teatrKomedia);
/*
************************************************************************
*/
String[] aquaparkDescription;
aquaparkDescription = new String[4];
aquaparkDescription[0] = "Aquapark Wrocław was formed to conduct business activity, and in particular activity related to promoting sport and propagating physical fitness, recreational and promotional activity, including activities supporting the local community and the local government, which is important for the development of the Wrocław Municipality.";
aquaparkDescription[1] = "Czajownia's additional information";
aquaparkDescription[2] = "Czajownia's fun fun fun facts";
aquaparkDescription[3] = "ul. Borowska 99";
aquapark = new Event("Aquapark",
aquaparkDescription,
ActivityTypes.ACTIVE,
ActiveActivities.SWIMMING,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.IRRELEVANT,
EventTypes.PUBLIC,
MusicLoudness.IRRELEVANT,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(aquapark);
/*
************************************************************************
*/
String[] casaDeLaMusicaDescription;
casaDeLaMusicaDescription = new String[4];
casaDeLaMusicaDescription[0] = "Want to try new dance? maybe somthing from coasts of Caribbean Sea? Try to dance Salsa, Bachiata, Merengue, Cha cha cha - you for sure ind something for you. Come and have great time with your friends.";
casaDeLaMusicaDescription[1] = "Czajownia's additional information";
casaDeLaMusicaDescription[2] = "Czajownia's fun fun fun facts";
casaDeLaMusicaDescription[3] = "Rynek Ratusz 11/12";
casaDeLaMusica = new Event("Casa De La Musica",
czajowniaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(casaDeLaMusica);
/*
************************************************************************
*/
String[] gliniankiDescription;
gliniankiDescription = new String[4];
gliniankiDescription[0] = "Natural reservoir of 3 lakes (swimming, canoeing and fishing) is available on site, among others. slide for children, camping and equipment rental.\n"
+ "- The longest water slide for kids (90 m long)\n"
+ "- Pitch of soccer and beach volleyball\n"
+ "- Hire of sunbeds\n"
+ "- Wake Park\n"
+ "- Land at outdoor events\n"
+ "- Log Cabin BBQ mountaineers";
gliniankiDescription[1] = "Czajownia's additional information";
gliniankiDescription[2] = "Czajownia's fun fun fun facts";
gliniankiDescription[3] = "ul. Kosmonautów 2";
glinianki = new Event("Glinianki",
gliniankiDescription,
ActivityTypes.ACTIVE,
ActiveActivities.SWIMMING,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.CHEAP,
Day.IRRELEVANT,
Daytime.NOON,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.IRRELEVANT,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.SUNNY,
0.0);
this.events.add(glinianki);
/*
************************************************************************
*/
String[] puzzleDescription;
puzzleDescription = new String[4];
puzzleDescription[0] = "Love electronic sounds? Spend your time with others electro soulmates. Perfect place for calming down after whole week of work, drinking beer with friends. Listen, swind, bounce, dance in the middle of Wrocław old town.";
puzzleDescription[1] = "Czajownia's additional information";
puzzleDescription[2] = "Czajownia's fun fun fun facts";
puzzleDescription[3] = "Przejście Garncarskie 2";
puzzle = new Event("Puzzle Music Club",
puzzleDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.STUDENTS,
Beverages.ALCOHOL,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.NIGHT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.HIGH,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(puzzle);
/*
************************************************************************
*/
String[] wroclawskieCentrumSpaDescription;
wroclawskieCentrumSpaDescription = new String[4];
wroclawskieCentrumSpaDescription[0] = "The complex of buildings and facilities equipped with swimming pools and baths and other equipment for hydrotherapy and spas, built in the late nineteenth century by the architect William Werdelmann, a professor at the School of Applied Arts in Barmen (today a part of Wuppertal).";
wroclawskieCentrumSpaDescription[1] = "Czajownia's additional information";
wroclawskieCentrumSpaDescription[2] = "Czajownia's fun fun fun facts";
wroclawskieCentrumSpaDescription[3] = "ul. Teatralna 10-12";
wroclawskieCentrumSpa = new Event("Wrocław's SPA Centre",
wroclawskieCentrumSpaDescription,
ActivityTypes.ACTIVE,
ActiveActivities.SWIMMING,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.IRRELEVANT,
EventTypes.PUBLIC,
MusicLoudness.IRRELEVANT,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(wroclawskieCentrumSpa);
/*
************************************************************************
*/
String[] stadionMiejski_soccerDescription;
stadionMiejski_soccerDescription = new String[4];
stadionMiejski_soccerDescription[0] = "The football stadium in Wroclaw, owned by the city of Wroclaw. The main user of the arena is a football club Slask Wroclaw. The stadium was one of the arenas for Euro 2012 - played on it were three group stage matches (including one Polish National Team - 16 June). The stadium meets the requirements of the highest fourth category of UEFA.";
stadionMiejski_soccerDescription[1] = "Czajownia's additional information";
stadionMiejski_soccerDescription[2] = "Czajownia's fun fun fun facts";
stadionMiejski_soccerDescription[3] = "al. Śląska 1";
stadionMiejski_soccer = new Event("City's Stadium (Soccer)",
stadionMiejski_soccerDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.SOCCER,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.HIGH,
MusicTypes.IRRELEVANT,
PeopleAmount.HIGH,
WeatherTypes.SUNNY,
0.0);
this.events.add(stadionMiejski_soccer);
/*
************************************************************************
*/
String[] halaOrbita_basketballDescription;
halaOrbita_basketballDescription = new String[4];
halaOrbita_basketballDescription[0] = "This is one of the most modern sports and entertainment in Europe. Hall \"ORBIT\" is, in fact, two halls: a large audience of nearly 3 thousand. places and small - designed mainly for ice rink, playground, or a side room attendant. The fully air-conditioned, ventilated and heated. Has a professional structured cabling, unlimited access to the telecommunications network and the Internet.";
halaOrbita_basketballDescription[1] = "Czajownia's additional information";
halaOrbita_basketballDescription[2] = "Czajownia's fun fun fun facts";
halaOrbita_basketballDescription[3] = "ul. Wejherowska 34";
halaOrbita_basketball = new Event("Orbit's hall (basketball)",
halaOrbita_basketballDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.BASKETBALL,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.HIGH,
MusicTypes.MODERN,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(halaOrbita_basketball);
/*
************************************************************************
*/
String[] stadionOlimpijski_speedwayDescription;
stadionOlimpijski_speedwayDescription = new String[4];
stadionOlimpijski_speedwayDescription[0] = "Multi-purpose stadium in Wroclaw, built between 1926-1928, designed by German architect Richard Konwiarz. It is a central element of the sports complex, located on the outskirts of Wroclaw Zaleśsie.";
stadionOlimpijski_speedwayDescription[1] = "Czajownia's additional information";
stadionOlimpijski_speedwayDescription[2] = "Czajownia's fun fun fun facts";
stadionOlimpijski_speedwayDescription[3] = "Al.I.J. Paderewskiego 35";
stadionOlimpijski_speedway = new Event("Olimpic Stadium (speedway)",
stadionOlimpijski_speedwayDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.SPEEDWAY,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.MORNING,
DressCode.IRRELEVANT,
EventTypes.PUBLIC,
MusicLoudness.IRRELEVANT,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.SUNNY,
0.0);
this.events.add(stadionOlimpijski_speedway);
/*
************************************************************************
*/
String[] mundoDescription;
mundoDescription = new String[4];
mundoDescription[0] = "Club music, popular place and good drinks, this and much more you can find im Mundo 71 Club. Popular DJs and many dancing young people. Do you like that? Go and check for more";
mundoDescription[1] = "Czajownia's additional information";
mundoDescription[2] = "Czajownia's fun fun fun facts";
mundoDescription[3] = "Ruska 51";
mundo = new Event("Mudno71 Music Club",
mundoDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.STUDENTS,
Beverages.DRINK,
Cost.CHEAP,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.HIGH,
MusicTypes.MODERN,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(mundo);
/*
************************************************************************
*/
String[] stadioOlimpijski_footballDescription;
stadioOlimpijski_footballDescription = new String[4];
stadioOlimpijski_footballDescription[0] = "Multi-purpose stadium in Wroclaw, built between 1926-1928, designed by German architect Richard Konwiarz. It is a central element of the sports complex, located on the outskirts of Wroclaw Zalesie.";
stadioOlimpijski_footballDescription[1] = "Czajownia's additional information";
stadioOlimpijski_footballDescription[2] = "Czajownia's fun fun fun facts";
stadioOlimpijski_footballDescription[3] = "Al.I.J. Paderewskiego 35";
stadioOlimpijski_football = new Event("Olimpic Stadium (football)",
stadioOlimpijski_footballDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.FOOTBALL,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.IRRELEVANT,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.SUNNY,
0.0);
this.events.add(stadioOlimpijski_football);
/*
************************************************************************
*/
String[] zooDescription;
zooDescription = new String[4];
zooDescription[0] = "Zoo is located at ul. Wroblewski 1-5 in Wroclaw, founded in 1865. It is the oldest existing on Polish lands and the largest (in terms of the number of issued animals) zoo in Poland. Garden area is 33 hectares.";
zooDescription[1] = "Czajownia's additional information";
zooDescription[2] = "Czajownia's fun fun fun facts";
zooDescription[3] = "ul. Wróblewskiego 1-5";
zoo = new Event("Zoo",
zooDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.ENTERTAINMENT,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.NOON,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.IRRELEVANT,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.SUNNY,
0.0);
this.events.add(zoo);
/*
************************************************************************
*/
String[] padBarDescription;
padBarDescription = new String[4];
padBarDescription[0] = "Padbar is more than just a bar. Imagine that you cross thresholds and greet cocktail bar with friends. You look to the card and choose one of over twenty different drinks - Peach on the Beach, Tennis, GTA London and play at Max. Then you get into the longer people play, catch the controller and join the game.";
padBarDescription[1] = "Czajownia's additional information";
padBarDescription[2] = "Czajownia's fun fun fun facts";
padBarDescription[3] = "ul. Kazimierza Wielkiego 1";
padBar = new Event("Pad Bar",
padBarDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.GAMING,
AgeCategories.STUDENTS,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.MODERN,
PeopleAmount.HIGH,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(padBar);
/*
************************************************************************
*/
String[] capitolDescription;
capitolDescription = new String[4];
capitolDescription[0] = "In the music theatre Capitol you will have chance to meet culture on the higher level. Spend time with proffessional singer in the directed performances.";
capitolDescription[1] = "Czajownia's additional information";
capitolDescription[2] = "Czajownia's fun fun fun facts";
capitolDescription[3] = "Marszałka Józefa Piłsudskiego 67";
capitol = new Event("Capitol Music Theatre",
capitolDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.THEATRE,
AgeCategories.ADULTS,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.OFFICIAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.CLASSICAL,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(capitol);
/*
************************************************************************
*/
String[] kasynoOlimpiqueDescription;
kasynoOlimpiqueDescription = new String[4];
kasynoOlimpiqueDescription[0] = "Building intended for legal gambling. Usually, the game takes place on special chips that playing should purchase at the entrance. Any win is also the chips that the casino lists the output service for the money.";
kasynoOlimpiqueDescription[1] = "Czajownia's additional information";
kasynoOlimpiqueDescription[2] = "Czajownia's fun fun fun facts";
kasynoOlimpiqueDescription[3] = "ul. Piłsudzkiego 40";
kasynoOlimpique = new Event("Casino Olimpic",
kasynoOlimpiqueDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.GAMBLING,
AgeCategories.ADULTS,
Beverages.ALCOHOL,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.NIGHT,
DressCode.OFFICIAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(kasynoOlimpique);
/*
************************************************************************
*/
String[] sushi77Description;
sushi77Description = new String[4];
sushi77Description[0] = "77 sushi attach great importance to the taste and appearance of food. We make sure that the dishes were delicious, enjoyed eyes, delighted the injection procedure, color and exquisitely executed set.";
sushi77Description[1] = "Czajownia's additional information";
sushi77Description[2] = "Czajownia's fun fun fun facts";
sushi77Description[3] = "ul. Powstańców Śląskich 2-4";
sushi77 = new Event("Sushi77",
sushi77Description,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.EATING,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(sushi77);
/*
************************************************************************
*/
String[] chaczapuriDescription;
chaczapuriDescription = new String[4];
chaczapuriDescription[0] = "Restaurants Georgian Chaczapuri is the only place in Poland with such an unusual assortment that given the high quality dishes combine with low price.";
chaczapuriDescription[1] = "Czajownia's additional information";
chaczapuriDescription[2] = "Czajownia's fun fun fun facts";
chaczapuriDescription[3] = "ul. Kiełbaśnicza 7";
chaczapuri = new Event("Chaczapuri",
chaczapuriDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.EATING,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.CHEAP,
Day.IRRELEVANT,
Daytime.NOON,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(chaczapuri);
/*
************************************************************************
*/
String[] amalfiDescription;
amalfiDescription = new String[4];
amalfiDescription[0] = "Italian restaurant and pizzeria \"Amalfi\" has been for many years on the gastronomic map of Wroclaw place valued by lovers of sunny Italy and its exquisite flavors. Especially for you we import from Italy proven quality products.";
amalfiDescription[1] = "Czajownia's additional information";
amalfiDescription[2] = "Czajownia's fun fun fun facts";
amalfiDescription[3] = "ul. Więzienna 21";
amalfi = new Event("Amalfi",
amalfiDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.EATING,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(amalfi);
/*
************************************************************************
*/
String[] capriPizzaDescription;
capriPizzaDescription = new String[4];
capriPizzaDescription[0] = "Pizzeria Trattoria \"Capri\" is located at the Prison street in the gallery \"Italiana\" and has two air-conditioned rooms divided into smokers and non-smokers and places in the passage with comfortable sofas.";
capriPizzaDescription[1] = "Czajownia's additional information";
capriPizzaDescription[2] = "Czajownia's fun fun fun facts";
capriPizzaDescription[3] = "ul.Więzienna 21";
capriPizza = new Event("Capri Pizza",
capriPizzaDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.EATING,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(capriPizza);
/*
************************************************************************
*/
String[] rodeoBarDescription;
rodeoBarDescription = new String[4];
rodeoBarDescription[0] = "Lovers of grilled dishes certainly can not miss this place in the Old Town. Although housed in the Gallery Italiana, do not be fooled - this is not the Mediterranean cuisine is known for this restaurant.";
rodeoBarDescription[1] = "Czajownia's additional information";
rodeoBarDescription[2] = "Czajownia's fun fun fun facts";
rodeoBarDescription[3] = "ul. Więzienna 21";
rodeoBar = new Event("Rodeo Bar",
rodeoBarDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.EATING,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.ROCK,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(rodeoBar);
/*
************************************************************************
*/
String[] hastaLaVistaDescription;
hastaLaVistaDescription = new String[4];
hastaLaVistaDescription[0] = "At the time of the opening in the center of Hasta La Vista we will find 12 indoor courts. They were built with special plates between which is a quartz sand.\n"
+ "This ensures uniform ball bounce off the walls. Everything is decorated according to the standards imposed by the World Squash Federation.";
hastaLaVistaDescription[1] = "Czajownia's additional information";
hastaLaVistaDescription[2] = "Czajownia's fun fun fun facts";
hastaLaVistaDescription[3] = "ul. Góralska 5";
hastaLaVista = new Event("Hasta La Vista",
hastaLaVistaDescription,
ActivityTypes.ACTIVE,
ActiveActivities.SQUASH,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.IRRELEVANT,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(hastaLaVista);
/*
************************************************************************
*/
String[] sportwerkDescription;
sportwerkDescription = new String[4];
sportwerkDescription[0] = "Squash is a great way to recover from daily stress and getting rid of unnecessary calories.\n"
+ "When you only have a moment come to our club and try your skills. Waiting for you are three professional courts for the game.";
sportwerkDescription[1] = "Czajownia's additional information";
sportwerkDescription[2] = "Czajownia's fun fun fun facts";
sportwerkDescription[3] = "ul. Kozonowska 69";
sportwerk = new Event("SportWerk",
sportwerkDescription,
ActivityTypes.ACTIVE,
ActiveActivities.SQUASH,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.IRRELEVANT,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(sportwerk);
/*
************************************************************************
*/
String[] fugaMundiDescription;
fugaMundiDescription = new String[4];
fugaMundiDescription[0] = "Twilight, green tables, men in suits... Would you like try play in this game? In Fuga Mundi Club are waiting for you 14 tables for pool billard and 3 tables for snooker.";
fugaMundiDescription[1] = "Czajownia's additional information";
fugaMundiDescription[2] = "Czajownia's fun fun fun facts";
fugaMundiDescription[3] = "Pl. Grunwaldzki 12-14";
fugaMundi = new Event("Fuga Mundi Pool Club",
fugaMundiDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.POOL,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(fugaMundi);
/*
************************************************************************
*/
String[] sezamDescription;
sezamDescription = new String[4];
sezamDescription[0] = "Billard cave in the old town center of Wrocław, you can try yourself on the green table, or face with your friends. Play billard in Sezam Club. ";
sezamDescription[1] = "Czajownia's additional information";
sezamDescription[2] = "Czajownia's fun fun fun facts";
sezamDescription[3] = "ul. Kuźnicza 10";
sezam = new Event("Sezam Billard Club",
sezamDescription,
ActivityTypes.PASSIVE,
ActiveActivities.IRRELEVANT,
PassiveActivities.POOL,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.EVENING,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(sezam);
/*
************************************************************************
*/
String[] skyBowlingDescription;
skyBowlingDescription = new String[4];
skyBowlingDescription[0] = "The highest scycraper in Wrocław - Sky Tower gives shelter for bowling club. Heavy balls hurrying to the crash with 10 bowling. Strike - it is not hard challenge. Come one and try";
skyBowlingDescription[1] = "Czajownia's additional information";
skyBowlingDescription[2] = "Czajownia's fun fun fun facts";
skyBowlingDescription[3] = "Powstańców Śląskich 73";
skyBowling = new Event("SkyBowling",
skyBowlingDescription,
ActivityTypes.ACTIVE,
ActiveActivities.BOWLING,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(skyBowling);
/*
************************************************************************
*/
String[] mirazBowlingDescription;
mirazBowlingDescription = new String[4];
mirazBowlingDescription[0] = "Since bowling was invented world has seen billions of strikes and same number of euphory scream. Would you like scream in the same way? Come to TGG Center and play on 10 bowling tracks.";
mirazBowlingDescription[1] = "Czajownia's additional information";
mirazBowlingDescription[2] = "Czajownia's fun fun fun facts";
mirazBowlingDescription[3] = "Słubicka 18";
mirazBowling = new Event("Miraż Bowling",
mirazBowlingDescription,
ActivityTypes.ACTIVE,
ActiveActivities.BOWLING,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.IRRELEVANT,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(mirazBowling);
/*
************************************************************************
*/
String[] creatorBowlingDescription;
creatorBowlingDescription = new String[4];
creatorBowlingDescription[0] = "This place is called Creator of fun and happiness. It animates your time and take off your stress. Creator bowling is perfect place for spending time with friends. Thought that strike if out of your possibility? Wrong - it isn't such hard if it seems to be. Check it and become bowling freak";
creatorBowlingDescription[1] = "Czajownia's additional information";
creatorBowlingDescription[2] = "Czajownia's fun fun fun facts";
creatorBowlingDescription[3] = "Szybowcowa 23";
creatorBowling = new Event("Creator Bowling",
creatorBowlingDescription,
ActivityTypes.ACTIVE,
ActiveActivities.BOWLING,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.MANY,
Cost.MODERATE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.LOW,
MusicTypes.IRRELEVANT,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(creatorBowling);
/*
************************************************************************
*/
String[] skyTowerFitnessDescription;
skyTowerFitnessDescription = new String[4];
skyTowerFitnessDescription[0] = "Fitness Academy Club was created for health and good condtion of the customers. Inside this gym you can recover you health and strengthen yourself. Your good shape influences on quality of life and efectiveness in work.";
skyTowerFitnessDescription[1] = "Czajownia's additional information";
skyTowerFitnessDescription[2] = "Czajownia's fun fun fun facts";
skyTowerFitnessDescription[3] = "Powstańców Śląskich 95";
skyTowerFitness = new Event("Sky Tower Fitness Academy",
skyTowerFitnessDescription,
ActivityTypes.ACTIVE,
ActiveActivities.FITNESS,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.JUICE,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(skyTowerFitness);
/*
************************************************************************
*/
String[] classicFitnessDescription;
classicFitnessDescription = new String[4];
classicFitnessDescription[0] = "Classic Fitness Club is located in Dominikanski Gallery Shopping Centre in the heart of the Wrocław. It was open over 10 years ago and since that day it succesively expands its offer. They promote move and health life style, which hardly influence on self confidence.";
classicFitnessDescription[1] = "Czajownia's additional information";
classicFitnessDescription[2] = "Czajownia's fun fun fun facts";
classicFitnessDescription[3] = "pl. Dominikański 3";
classicFitness = new Event("Classic Fitness",
classicFitnessDescription,
ActivityTypes.ACTIVE,
ActiveActivities.FITNESS,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.JUICE,
Cost.CHEAP,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(classicFitness);
/*
************************************************************************
*/
String[] pureJatomiFitnessRenomaDescription;
pureJatomiFitnessRenomaDescription = new String[4];
pureJatomiFitnessRenomaDescription[0] = "One of the Fitness Club of the world wide fitness clubs network, allows you to keep yourself in good shape without care about mundane issues - you don't care about the towel after the gym and carrying the shower gel with yourself. In pure jatomi fitness club you get your own locker for necessary staff and you can optionally get for every visit ready to use, fresh and fragrant towel.";
pureJatomiFitnessRenomaDescription[1] = "Czajownia's additional information";
pureJatomiFitnessRenomaDescription[2] = "Czajownia's fun fun fun facts";
pureJatomiFitnessRenomaDescription[3] = "ul. Świdnicka 40";
pureJatomiFitnessRenoma = new Event("Pure Jatomi Fitness Renoma",
pureJatomiFitnessRenomaDescription,
ActivityTypes.ACTIVE,
ActiveActivities.FITNESS,
PassiveActivities.IRRELEVANT,
AgeCategories.KIDS,
Beverages.ALCOHOL,
Cost.CHEAP,
Day.MONDAY,
Daytime.MORNING,
DressCode.OFFICIAL,
EventTypes.PRIVATE,
MusicLoudness.LOW,
MusicTypes.ROCK,
PeopleAmount.MODERATE,
WeatherTypes.SUNNY,
0.0);
this.events.add(pureJatomiFitnessRenoma);
/*
************************************************************************
*/
String[] pureJatomiFitnessPasazGrundwaldzkiDescription;
pureJatomiFitnessPasazGrundwaldzkiDescription = new String[4];
pureJatomiFitnessPasazGrundwaldzkiDescription[0] = "Would you like be in good shape? Are you forgotfull and many times yo went out of your house without towel, shower gel or gym stuff? We have perfet solution for you! Come and check the Pure Jatomi Gym inside Pasaż Grunwaldzki, there will be waiting for you private locker to store all necessary thing to train on the gym - you won't care about it anymore. Moreover, you can have provided clern, fresh and fragrant towel for every your gym visit. Want more? Come one and check out...";
pureJatomiFitnessPasazGrundwaldzkiDescription[1] = "Czajownia's additional information";
pureJatomiFitnessPasazGrundwaldzkiDescription[2] = "Czajownia's fun fun fun facts";
pureJatomiFitnessPasazGrundwaldzkiDescription[3] = "pl. Grunwaldzki 22 ";
pureJatomiFitnessPasazGrundwaldzki = new Event("Pure Jatomi Fitness Pasaż Grunwaldzki",
pureJatomiFitnessPasazGrundwaldzkiDescription,
ActivityTypes.ACTIVE,
ActiveActivities.FITNESS,
PassiveActivities.IRRELEVANT,
AgeCategories.IRRELEVANT,
Beverages.JUICE,
Cost.EXPENSIVE,
Day.IRRELEVANT,
Daytime.IRRELEVANT,
DressCode.CASUAL,
EventTypes.PUBLIC,
MusicLoudness.MODERATE,
MusicTypes.MODERN,
PeopleAmount.MODERATE,
WeatherTypes.IRRELEVANT,
0.0);
this.events.add(pureJatomiFitnessPasazGrundwaldzki);
} | 0 |
public void testContains() {
final String cols = "stringCol,doubleCol,dateCol,bigDecimalCol,intCol\r\n"//
+ "hello,2.20,20140523,123.45,6\r\n"//
+ ",,,,"//
;
final Parser p = DefaultParserFactory.getInstance().newDelimitedParser(new StringReader(cols), ',', FPConstants.NO_QUALIFIER);
final StreamingDataSet ds = p.parseAsStream();
ds.next();
final Optional<Record> record1 = ds.getRecord();
// test record 1 with Data in file!
assertEquals("rec1 string", "hello", record1.get().getString("stringCol"));
assertTrue("rec1 doubleCol", Double.compare(2.2, record1.get().getDouble("doubleCol")) == 0);
try {
assertEquals("rec1 dateCol", new Date(114, Calendar.MAY, 23), record1.get().getDate("dateCol"));
} catch (final ParseException e) {
fail();
}
assertEquals("rec1 intCol", 6, record1.get().getInt("intCol"));
assertEquals("rec1 bigDecimalCol", new BigDecimal("123.45"), record1.get().getBigDecimal("bigDecimalCol"));
// NOW RECORD 2 with ALL defaults
ds.next();
final Optional<Record> record2 = ds.getRecord();
assertEquals("rec2 string", "Hi", record2.get().getString("stringCol", () -> "Hi"));
assertTrue("rec2 doubleCol", Double.compare(3.76, record2.get().getDouble("doubleCol", () -> 3.76d)) == 0);
try {
assertEquals("rec2 dateCol", new Date(114, Calendar.JUNE, 11), record2.get().getDate("dateCol", () -> new Date(114, Calendar.JUNE, 11)));
} catch (final ParseException e) {
fail();
}
assertEquals("rec2 intCol", 8, record2.get().getInt("intCol", () -> 8));
assertEquals("rec2 bigDecimalCol", new BigDecimal("555"), record2.get().getBigDecimal("bigDecimalCol", () -> new BigDecimal("555")));
} | 2 |
public String toString()
{
final StringBuffer buf = new StringBuffer(30);
buf.append("Busmon.ind ");
if (tstampType == TYPEID_TIMESTAMP_EXT)
buf.append("ext.");
buf.append("timestamp ");
buf.append(tstamp);
buf.append(" seq ").append(getSequenceNumber());
// buf.append(" status 0x").append(Integer.toHexString(status));
if ((status & ~0x07) == 0)
buf.append(" (no error)");
else {
buf.append(" (");
if (getBitError())
buf.append("bit error ");
if (getFrameError())
buf.append("frame error ");
if (getLost())
buf.append("lost ");
if (getParityError())
buf.append("parity error");
if (buf.charAt(buf.length() - 1) == ' ')
buf.deleteCharAt(buf.length() - 1);
buf.append(")");
}
buf.append(": ").append(DataUnitBuilder.toHex(raw, " "));
return buf.toString();
} | 7 |
@Override
public void run() {
try {
String inputQuestion = this.mainForm.getInputQuestion().getText();
if (inputQuestion.equals(VAL)) {// 验证接入
vali();
} else if (inputQuestion.equals(EVENT_CLICK_KEY)){
handleClick();
} else if(inputQuestion.equals(EVENT_VIEW_KEY)){
handleView();
}else {// 处理消息
postXml();
}
} catch (Exception e) {
e.printStackTrace();
}
this.mainForm.notifyDone();
} | 4 |
@Override
public void mouseClicked(MouseEvent e) {
} | 0 |
public void exit(SimpleFrame frame)
{
File tempFile = new File(frame.fileName);
if(tempFile.exists()) tempFile.delete();
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
if(frame.getIsChanged())
{
int selection = JOptionPane.showConfirmDialog(null,"Do you want save document?", "Warrning", JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
if(selection == JOptionPane.NO_OPTION)
{
try
{
frame.getClient().close();
frame.getPtr().Disconnect(frame.getProjName(), frame.getLogin());
}
catch (RemoteException e1)
{
JOptionPane.showMessageDialog(frame, "Disconect from Server");
return;
}
System.exit(0);
}
if(selection == JOptionPane.YES_OPTION)
{
chooser.setCurrentDirectory(new File("."));
int result = chooser.showSaveDialog(null);
if (result == JFileChooser.APPROVE_OPTION)
{
frame.fileName = chooser.getSelectedFile().getPath();
PrintWriter out;
try
{
out = new PrintWriter(new FileWriter(frame.fileName));
String str = frame.getText().getText();
out.print(str);
out.close();
}
catch (IOException e)
{
JOptionPane.showMessageDialog(frame, "Saving error");
}
}
else
{
return;
}
}
}
else
{
try
{
frame.getClient().close();
frame.getPtr().Disconnect(frame.getProjName(), frame.getLogin());
}
catch (RemoteException e1)
{
JOptionPane.showMessageDialog(frame, "Disconect from Server");
return;
}
System.exit(0);
}
} | 8 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(tickID==Tickable.TICKID_MOB)
{
if((affected!=null)&&(affected instanceof MOB)&&(invoker!=null))
{
final MOB mob=(MOB)affected;
if(((mob.amFollowing()==null)
||(mob.amDead())
||(mob.location()!=invoker.location())))
{
mob.delEffect(this);
if(mob.amDead())
mob.setLocation(null);
mob.destroy();
}
}
}
return super.tick(ticking,tickID);
} | 8 |
private JPanel createCSSSettingsPanel()
{
final JPanel jp = new JPanel();
jp.setBorder(default_border);
BoxLayout bl = new BoxLayout(jp, BoxLayout.PAGE_AXIS);
jp.setLayout(bl);
JComponent cp = new JLabel(UIStrings.UI_CSS_NAME_LABEL);
setItemAlignment(cp);
jp.add(cp);
JPanel ip = new JPanel();
css_file_selector = new JComboBox();
css_file_selector.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent ie)
{
int type = ie.getStateChange();
switch(type)
{
case ItemEvent.ITEM_STATE_CHANGED:
{
CSSFile cf = (CSSFile)css_file_selector.getSelectedItem();
css_file_path_field.setText(cf.path);
break;
}
case ItemEvent.DESELECTED:
{
CSSFile ep2 = (CSSFile)css_file_selector.getSelectedItem();
CSSFile ep = (CSSFile)ie.getItem();
}
}
}
});
css_file_selector.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae)
{
String cmd = ae.getActionCommand();
if(cmd.equals("comboBoxChanged"))
{
CSSFile cf = (CSSFile)css_file_selector.getSelectedItem();
if(cf != null)
{
css_file_path_field.setText(cf.path);
css_file_path_field.setEnabled(true);
}
else
{
css_file_path_field.setText("no CSS file selected");
css_file_path_field.setEnabled(false);
}
}
}
});
Dimension d = css_file_selector.getPreferredSize();
d.width = 160;
css_file_selector.setPreferredSize(d);
css_file_selector.setEditable(true);
ip.add(css_file_selector);
JButton b = new JButton("+");
b.setToolTipText(UIStrings.SETTINGS_DIALOG_CSS_FILE_ADD);
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae)
{
CSSFile new_css_file = dialog_settings.newCSSFile(UIStrings.SETTINGS_DIALOG_DEFAULT_NEW_CSS_VALUES[0]);
new_css_file.path = UIStrings.SETTINGS_DIALOG_DEFAULT_NEW_CSS_VALUES[1];
css_file_selector.addItem(new_css_file);
css_file_selector.setSelectedItem(new_css_file);
}
});
d = b.getPreferredSize();
d.width = 20;
b.setPreferredSize(d);
ip.add(b);
b = new JButton("-");
b.setToolTipText(UIStrings.SETTINGS_DIALOG_CSS_FILE_REMOVE);
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae)
{
CSSFile cf = (CSSFile)css_file_selector.getSelectedItem();
int result = JOptionPane.showConfirmDialog(jp, "Remove CSS File: " + cf.name + "?", UIStrings.APPNAME, JOptionPane.YES_NO_OPTION);
if(result == JOptionPane.NO_OPTION)
{
return;
}
css_file_selector.removeItem(cf);
css_file_selector.setSelectedIndex(0);
}
});
b.setPreferredSize(d);
ip.add(b);
ip.add(Box.createHorizontalGlue());
setItemAlignment(ip);
jp.add(ip);
jp.add(Box.createVerticalStrut(10));
cp = new JLabel(UIStrings.UI_CSS_PATH_LABEL);
setItemAlignment(cp);
jp.add(cp);
ip = new JPanel(new FlowLayout(FlowLayout.LEFT));
css_file_path_field = new JTextField(40);
css_file_path_field.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae)
{
CSSFile cf = (CSSFile)css_file_selector.getSelectedItem();
cf.path = css_file_path_field.getText();
}
});
ip.add(css_file_path_field);
b = new JButton(folder_icon);
b.setToolTipText(UIStrings.SETTINGS_DIALOG_CSS_BROWSE_TOOLTIP);
b.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent ae)
{
JFileChooser fc = new JFileChooser();
int returnVal = fc.showDialog(null, "Select");
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
if(file.exists() && file.isFile())
{
css_file_path_field.setForeground(Color.BLACK);
}
else
{
css_file_path_field.setForeground(Color.RED);
css_file_path_field.setText(file.getAbsolutePath() + " [" + UIStrings.ERROR_INVALID_PATH + "]");
}
css_file_path_field.setText(file.getAbsolutePath());
}
else
{
}
}
});
ip.add(b);
setItemAlignment(ip);
jp.add(ip);
return jp;
} | 8 |
public String getPositionOfPerson(Person person) {
if (person != null) {
for (Entry<String, Person> entry : castAndCrew.entrySet()) {
if (person.equals(entry.getValue())) {
return entry.getKey();
}
}
}
return "";
} | 3 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.