hexsha
stringlengths
40
40
size
int64
8
1.04M
content
stringlengths
8
1.04M
avg_line_length
float64
2.24
100
max_line_length
int64
4
1k
alphanum_fraction
float64
0.25
0.97
d9c5e010b5650cb5844022ae137f080c8e1a30f9
769
import java.io.File; import java.io.IOException; public class User { String nameString; long phoneNo; String addressString; User(String name,long phoneNo,String addressString){ this.nameString = name; this.phoneNo = phoneNo; this.addressString = addressString; } public void createFile() { try { //creating file as name.phoneNo.txt File userFile = new File("C:\\Users\\Sreshtha\\eclipse-workspace\\Restaurants Billing System\\src\\Users\\"+this.nameString+"."+this.phoneNo+".txt"); if(userFile.exists()) { System.out.println("Welcome back !"); return; } else { userFile.createNewFile(); System.out.println("Welcome !"); } } catch (IOException e) { System.out.println("Restaurant is closed !"); return; } } }
24.806452
152
0.681404
26ebb08a09e219fa90e52b439119fa86e52c5750
6,446
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =======================================================================*/ // This class has been generated, DO NOT EDIT! package org.tensorflow.op.linalg; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; import org.tensorflow.op.Operands; import org.tensorflow.op.RawOp; import org.tensorflow.op.Scope; import org.tensorflow.op.annotation.Endpoint; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TFloat32; import org.tensorflow.types.family.TType; /** * Performs a quantized matrix multiplication of `a` by the matrix `b` with bias * add. * <p> * The inputs must be two-dimensional matrices and 1D bias vector. And the inner * dimension of `a` (after being transposed if `transpose_a` is non-zero) must * match the outer dimension of `b` (after being transposed if `transposed_b` is * non-zero). Then do broadcast add operation with bias values on the matrix * multiplication result. The bias size must match inner dimension of `b`. * * @param <W> data type for {@code out()} output */ public final class QuantizedMatMulWithBias<W extends TType> extends RawOp { /** * Optional attributes for {@link org.tensorflow.op.linalg.QuantizedMatMulWithBias} */ public static class Options { /** * @param transposeA If true, `a` is transposed before multiplication. */ public Options transposeA(Boolean transposeA) { this.transposeA = transposeA; return this; } /** * @param transposeB If true, `b` is transposed before multiplication. */ public Options transposeB(Boolean transposeB) { this.transposeB = transposeB; return this; } /** * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. */ public Options inputQuantMode(String inputQuantMode) { this.inputQuantMode = inputQuantMode; return this; } private Boolean transposeA; private Boolean transposeB; private String inputQuantMode; private Options() { } } /** * Factory method to create a class wrapping a new QuantizedMatMulWithBias operation. * * @param scope current scope * @param a A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`. * @param b A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`. * @param bias A 1D bias tensor with size matching inner dimension of `b` (after being * transposed if `transposed_b` is non-zero). * @param minA The float value that the lowest quantized `a` value represents. * @param maxA The float value that the highest quantized `a` value represents. * @param minB The float value that the lowest quantized `b` value represents. * @param maxB The float value that the highest quantized `b` value represents. * @param Toutput * @param options carries optional attributes values * @return a new instance of QuantizedMatMulWithBias */ @Endpoint(describeByClass = true) public static <W extends TType, T extends TType, U extends TType, V extends TType> QuantizedMatMulWithBias<W> create(Scope scope, Operand<T> a, Operand<U> b, Operand<V> bias, Operand<TFloat32> minA, Operand<TFloat32> maxA, Operand<TFloat32> minB, Operand<TFloat32> maxB, Class<W> Toutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBias", scope.makeOpName("QuantizedMatMulWithBias")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); opBuilder.addInput(bias.asOutput()); opBuilder.addInput(minA.asOutput()); opBuilder.addInput(maxA.asOutput()); opBuilder.addInput(minB.asOutput()); opBuilder.addInput(maxB.asOutput()); opBuilder = scope.apply(opBuilder); opBuilder.setAttr("Toutput", Operands.toDataType(Toutput)); if (options != null) { for (Options opts : options) { if (opts.transposeA != null) { opBuilder.setAttr("transpose_a", opts.transposeA); } if (opts.transposeB != null) { opBuilder.setAttr("transpose_b", opts.transposeB); } if (opts.inputQuantMode != null) { opBuilder.setAttr("input_quant_mode", opts.inputQuantMode); } } } return new QuantizedMatMulWithBias<W>(opBuilder.build()); } /** * @param transposeA If true, `a` is transposed before multiplication. */ public static Options transposeA(Boolean transposeA) { return new Options().transposeA(transposeA); } /** * @param transposeB If true, `b` is transposed before multiplication. */ public static Options transposeB(Boolean transposeB) { return new Options().transposeB(transposeB); } /** * @param inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED. */ public static Options inputQuantMode(String inputQuantMode) { return new Options().inputQuantMode(inputQuantMode); } /** */ public Output<W> out() { return out; } /** * The float value that the lowest quantized output value represents. */ public Output<TFloat32> minOut() { return minOut; } /** * The float value that the highest quantized output value represents. */ public Output<TFloat32> maxOut() { return maxOut; } /** The name of this op, as known by TensorFlow core engine */ public static final String OP_NAME = "QuantizedMatMulWithBias"; private Output<W> out; private Output<TFloat32> minOut; private Output<TFloat32> maxOut; private QuantizedMatMulWithBias(Operation operation) { super(operation); int outputIdx = 0; out = operation.output(outputIdx++); minOut = operation.output(outputIdx++); maxOut = operation.output(outputIdx++); } }
35.224044
312
0.697332
6fd59decda773dc507873b8556d0b8267b88346c
9,665
/** * TextBlock.java * Copyright (c) 2018, Innovatics Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and / or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.pdfjet; import java.util.*; /** * Class for creating blocks of text. * */ public class TextBlock { private Font font = null; private Font fallbackFont = null; private String text = null; private float space = 0f; private int textAlign = Align.LEFT; private float x; private float y; private float w = 300f; private float h = 200f; private int background = Color.white; private int brush = Color.black; /** * Creates a text block. * * @param font the text font. */ public TextBlock(Font font) { this.font = font; this.space = this.font.getDescent(); } /** * Sets the fallback font. * * @param fallbackFont the fallback font. * @return the TextBlock object. */ public TextBlock setFallbackFont(Font fallbackFont) { this.fallbackFont = fallbackFont; return this; } /** * Sets the block text. * * @param text the block text. * @return the TextBlock object. */ public TextBlock setText(String text) { this.text = text; return this; } /** * Sets the location where this text block will be drawn on the page. * * @param x the x coordinate of the top left corner of the text block. * @param y the y coordinate of the top left corner of the text block. * @return the TextBlock object. */ public TextBlock setLocation(float x, float y) { this.x = x; this.y = y; return this; } /** * Sets the width of this text block. * * @param width the specified width. * @return the TextBlock object. */ public TextBlock setWidth(float width) { this.w = width; return this; } /** * Returns the text block width. * * @return the text block width. */ public float getWidth() { return this.w; } /** * Sets the height of this text block. * * @param height the specified height. * @return the TextBlock object. */ public TextBlock setHeight(float height) { this.h = height; return this; } /** * Returns the text block height. * * @return the text block height. */ public float getHeight() throws Exception { return drawOn(null).h; } /** * Sets the space between two lines of text. * * @param space the space between two lines. * @return the TextBlock object. */ public TextBlock setSpaceBetweenLines(float space) { this.space = space; return this; } /** * Returns the space between two lines of text. * * @return float the space. */ public float getSpaceBetweenLines() { return space; } /** * Sets the text alignment. * * @param textAlign the alignment parameter. * Supported values: Align.LEFT, Align.RIGHT and Align.CENTER. */ public TextBlock setTextAlignment(int textAlign) { this.textAlign = textAlign; return this; } /** * Returns the text alignment. * * @return the alignment code. */ public int getTextAlignment() { return this.textAlign; } /** * Sets the background to the specified color. * * @param color the color specified as 0xRRGGBB integer. * @return the TextBlock object. */ public TextBlock setBgColor(int color) { this.background = color; return this; } /** * Returns the background color. * * @return int the color as 0xRRGGBB integer. */ public int getBgColor() { return this.background; } /** * Sets the brush color. * * @param color the color specified as 0xRRGGBB integer. * @return the TextBlock object. */ public TextBlock setBrushColor(int color) { this.brush = color; return this; } /** * Returns the brush color. * * @return int the brush color specified as 0xRRGGBB integer. */ public int getBrushColor() { return this.brush; } // Is the text Chinese, Japanese or Korean? private boolean isCJK(String text) { int cjk = 0; int other = 0; for (char ch : text.toCharArray()) { if (ch >= 0x4E00 && ch <= 0x9FFF || // Unified CJK ch >= 0xAC00 && ch <= 0xD7AF || // Hangul (Korean) ch >= 0x30A0 && ch <= 0x30FF || // Katakana (Japanese) ch >= 0x3040 && ch <= 0x309F) { // Hiragana (Japanese) cjk += 1; } else { other += 1; } } return cjk > other; } /** * Draws this text block on the specified page. * * @param page the page to draw this text block on. * @return the TextBlock object. */ public TextBlock drawOn(Page page) throws Exception { if (page != null) { if (getBgColor() != Color.white) { page.setBrushColor(this.background); page.fillRect(x, y, w, h); } page.setBrushColor(this.brush); } return drawText(page); } private TextBlock drawText(Page page) throws Exception { List<String> list = new ArrayList<String>(); StringBuilder buf = new StringBuilder(); String[] lines = text.split("\\r?\\n"); for (String line : lines) { if (isCJK(line)) { buf.setLength(0); for (int i = 0; i < line.length(); i++) { Character ch = line.charAt(i); if (font.stringWidth(fallbackFont, buf.toString() + ch) < this.w) { buf.append(ch); } else { list.add(buf.toString()); buf.setLength(0); buf.append(ch); } } if (!buf.toString().trim().equals("")) { list.add(buf.toString().trim()); } } else { if (font.stringWidth(fallbackFont, line) < this.w) { list.add(line); } else { buf.setLength(0); String[] tokens = line.split("\\s+"); for (String token : tokens) { if (font.stringWidth(fallbackFont, buf.toString() + " " + token) < this.w) { buf.append(" " + token); } else { list.add(buf.toString().trim()); buf.setLength(0); buf.append(token); } } if (!buf.toString().trim().equals("")) { list.add(buf.toString().trim()); } } } } lines = list.toArray(new String[] {}); float x_text; float y_text = y + font.getAscent(); for (int i = 0; i < lines.length; i++) { if (textAlign == Align.LEFT) { x_text = x; } else if (textAlign == Align.RIGHT) { x_text = (x + this.w) - (font.stringWidth(fallbackFont, lines[i])); } else if (textAlign == Align.CENTER) { x_text = x + (this.w - font.stringWidth(fallbackFont, lines[i]))/2; } else { throw new Exception("Invalid text alignment option."); } if (page != null) { page.drawString( font, fallbackFont, lines[i], x_text, y_text); } if (i < (lines.length - 1)) { y_text += font.getBodyHeight() + space; } else { y_text += font.getDescent() + space; } } this.h = y_text - y; return this; } } // End of TextBlock.java
26.847222
87
0.526746
234473f66cbd8805058eb5161232299950d596cd
616
package org.sag.xstream.xstreamconverters; import soot.Scene; import soot.SootClass; import com.thoughtworks.xstream.converters.SingleValueConverter; public class SimpleSootClassConverter implements SingleValueConverter { @Override public boolean canConvert(@SuppressWarnings("rawtypes") Class arg0) { return arg0.equals(SootClass.class); } @Override public Object fromString(String str) { if(str.equals("NULL")) return null; return Scene.v().getSootClass(str); } @Override public String toString(Object arg0) { if(arg0 == null) return "NULL"; return ((SootClass)arg0).getName(); } }
20.533333
71
0.751623
e4d86323d94ec6327c5afe67b824cd0c589372b7
3,702
package com.custom.keyboard.util; import androidx.annotation.NonNull; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import java.io.IOException; import java.io.StringReader; import java.util.Objects; import java.util.Optional; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Util { public static void show2Darray(String [][] arr) { for (String[] ar : arr) { if (ar == null) continue; for (String a: ar) { System.out.print(" " + a); } System.out.println(); } } public static void print(@NonNull Object... a) { for (Object i : a) System.out.print(i + " "); System.out.println(); } public static Document toXmlDocument(String str) { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder; Document document = null; try { docBuilder = docBuilderFactory.newDocumentBuilder(); document = docBuilder.parse(new InputSource(new StringReader(str))); } catch (ParserConfigurationException | IOException | SAXException e) { e.printStackTrace(); } return document; } // general public static void noop() {} public static <T> T notNull(T value) { return Objects.requireNonNull(value); } public static <T> boolean isNull(T value) { return (value != null); } public static <T> T orNull(T value, T defaultValue) { return Optional.ofNullable(value).orElse(defaultValue); } public static String[][] to2Darray(String source, String outerdelim, String innerdelim) { String[][] result = new String[source.replaceAll("[^" + outerdelim + "]", "").length() + 1][]; int count = 0; for (String line : source.split ("[" + outerdelim + "]")) { result [count++] = line.split(innerdelim); } return result; } public static String getClassName() { Class<?> enclosingClass = Util.class.getEnclosingClass(); String className; if (enclosingClass != null) { className = enclosingClass.getName(); } else { className = Util.class.getName(); } try { className = className.split("\\.")[0]; } catch (Exception ignored) {} return className; } public static int getLineNumber() { return ___8drrd3148796d_Xaf(); } public static int ___8drrd3148796d_Xaf() { boolean thisOne = false; int thisOneCountDown = 1; StackTraceElement[] elements = Thread.currentThread().getStackTrace(); for (StackTraceElement element : elements) { String methodName = element.getMethodName(); int lineNum = element.getLineNumber(); if (thisOne && (thisOneCountDown == 0)) { return lineNum; } else if (thisOne) { thisOneCountDown--; } if (methodName.equals("___8drrd3148796d_Xaf")) { thisOne = true; } } return -1; } public static String methodName() { return Thread.currentThread().getStackTrace()[1].getMethodName(); } public String getMethodName() { return new Throwable().getStackTrace()[1].getMethodName(); } public String getMethodName(int depth) { return new Throwable().getStackTrace()[depth].getMethodName(); } }
30.595041
102
0.595894
5fddf418d526309e0d4e3255ab58318ae04246b9
2,526
package nba.player; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import edu.sjtu.jsearcher.scheduler.DefaultScheduler; import edu.sjtu.jsearcher.scheduler.SpiderConfig; import edu.sjtu.jsearcher.test.pojCrawler.POJOutputer; import edu.sjtu.jsearcher.test.pojCrawler.POJProblemExtractor; import edu.sjtu.jsearcher.url.manager.URL; public class PlayerTest { public static void main(String[] args) { //demo: crawl poj problem List<String> urls = Arrays.asList("http://nba.sports.sina.com.cn/team/Spurs.shtml", "http://nba.sports.sina.com.cn/team/Timberwolves.shtml", "http://nba.sports.sina.com.cn/team/Heat.shtml", "http://nba.sports.sina.com.cn/team/Pistons.shtml", "http://nba.sports.sina.com.cn/team/Celtics.shtml", "http://nba.sports.sina.com.cn/team/Grizzlies.shtml", "http://nba.sports.sina.com.cn/team/Nuggets.shtml", "http://nba.sports.sina.com.cn/team/Suns.shtml", "http://nba.sports.sina.com.cn/team/Magic.shtml", "http://nba.sports.sina.com.cn/team/Pacers.shtml", "http://nba.sports.sina.com.cn/team/76ers.shtml", "http://nba.sports.sina.com.cn/team/Mavericks.shtml", "http://nba.sports.sina.com.cn/team/Jazz.shtml", "http://nba.sports.sina.com.cn/team/Lakers.shtml", "http://nba.sports.sina.com.cn/team/Hawks.shtml", "http://nba.sports.sina.com.cn/team/Cavaliers.shtml", "http://nba.sports.sina.com.cn/team/Knicks.shtml", "http://nba.sports.sina.com.cn/team/Rockets.shtml", "http://nba.sports.sina.com.cn/team/Trail%20Blazers.shtml", "http://nba.sports.sina.com.cn/team/Clippers.shtml", "http://nba.sports.sina.com.cn/team/Wizards.shtml", "http://nba.sports.sina.com.cn/team/Bulls.shtml", "http://nba.sports.sina.com.cn/team/Nets.shtml", "http://nba.sports.sina.com.cn/team/Pelicans.shtml", "http://nba.sports.sina.com.cn/team/Thunder.shtml", "http://nba.sports.sina.com.cn/team/Warriors.shtml", "http://nba.sports.sina.com.cn/team/Hornets.shtml", "http://nba.sports.sina.com.cn/team/Bucks.shtml", "http://nba.sports.sina.com.cn/team/Raptors.shtml", "http://nba.sports.sina.com.cn/team/Kings.shtml"); List<URL> seeds = new ArrayList<URL>(); for(String url : urls) { seeds.add(new URL(url)); } //create scheduler instance and configure common parameters DefaultScheduler ds = DefaultScheduler.createDefaultScheduler("JSearcher.yml"); // configure other parameters SpiderConfig.setDataExtractor(ds, new PlayerExtractor()); // run tasks ds.runTask(seeds); } }
40.741935
85
0.714568
b6cf62f801eb0b28877174b7f4a52df340754d06
1,078
package pugz.hallows.common.world; import net.minecraft.entity.Entity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.util.ITeleporter; import java.util.function.Function; public class HallowsTeleporter implements ITeleporter { private final BlockPos pos; public HallowsTeleporter(BlockPos pos) { this.pos = pos; } @Override public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function<Boolean, Entity> repositionEntity) { Entity e = repositionEntity.apply(false); if (!(e instanceof ServerPlayerEntity)) return e; ServerPlayerEntity player = (ServerPlayerEntity) e; BlockPos teleporterPos = this.pos; if (teleporterPos == null) return e; player.addExperienceLevel(0); player.setPositionAndUpdate(teleporterPos.getX() + 0.5D, teleporterPos.getY() + 1D, teleporterPos.getZ() + 0.5D); return e; } }
33.6875
150
0.730056
04d382ace80438a59c097b3f41652f96009acd1c
165
package no.acntech.sandbox.client; import no.acntech.sandbox.webservice.greeting.v1.GreetingPortType; public interface GreetingClient extends GreetingPortType { }
23.571429
66
0.842424
85ddb2b9193e3fae3a422758981b1ea1763d83b4
628
package com.atguigu.gmall.ums.service; import com.baomidou.mybatisplus.extension.service.IService; import com.atguigu.gmall.common.bean.PageResultVo; import com.atguigu.gmall.common.bean.PageParamVo; import com.atguigu.gmall.umsinterface.entity.UserEntity; /** * 用户表 * * @author mj * @email mj@110.com * @date 2020-05-17 16:26:32 */ public interface UserService extends IService<UserEntity> { PageResultVo queryPage(PageParamVo paramVo); Boolean check(String data, Integer type); void register(UserEntity user,String code); UserEntity queryByUsernameAndpassword(String username, String password); }
24.153846
76
0.769108
fb9c75f6d66875e3284ed193f44d9b7a0de77f48
22,666
/******************************************************************************* * Copyright 2012 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ /** * */ package edu.internet2.middleware.grouper.ws.coresoap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; import java.util.TreeSet; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.ToStringBuilder; import edu.internet2.middleware.grouper.attr.AttributeDef; import edu.internet2.middleware.grouper.attr.AttributeDefName; import edu.internet2.middleware.grouper.misc.GrouperVersion; import edu.internet2.middleware.grouper.pit.PITAttributeDef; import edu.internet2.middleware.grouper.util.ChangeToVersionCustomizable; import edu.internet2.middleware.grouper.util.GrouperUtil; import edu.internet2.middleware.grouper.ws.util.GrouperServiceUtils; import edu.internet2.middleware.grouper.ws.util.GrouperWsVersionUtils; /** * Result of one attribute def name being retrieved. The number of * attribute def names will equal the number of attribute def names related to the result * * @author mchyzer */ public class WsAttributeDef implements Comparable<WsAttributeDef>, ChangeToVersionCustomizable { /** * integer ID for object */ private String idIndex; /** * integer ID for object * @return the id */ public String getIdIndex() { return this.idIndex; } /** * integer ID for object * @param idIndex1 */ public void setIdIndex(String idIndex1) { this.idIndex = idIndex1; } /** * make sure this is an explicit toString */ @Override public String toString() { return ToStringBuilder.reflectionToString(this); } /** extension of attributeDef, the part to the right of last colon in name */ private String extension; /** * convert a set of attribute def names to results * @param attributeDefNameSet * @return the attributeDefs (null if none or null) */ public static WsAttributeDef[] convertAttributeDefNames(Set<AttributeDefName> attributeDefNameSet) { if (attributeDefNameSet == null || attributeDefNameSet.size() == 0) { return null; } Set<AttributeDef> attributeDefSet = new TreeSet<AttributeDef>(); Set<String> idsOfAttributeDefs = new LinkedHashSet<String>(); for (AttributeDefName attributeDefName : attributeDefNameSet) { if (!idsOfAttributeDefs.contains(attributeDefName.getAttributeDefId())) { idsOfAttributeDefs.add(attributeDefName.getAttributeDefId()); attributeDefSet.add(attributeDefName.getAttributeDef()); } } return convertAttributeDefs(attributeDefSet); } /** * convert a set of attribute def names to results * @param attributeDefSet * @return the attributeDefs (null if none or null) */ public static WsAttributeDef[] convertAttributeDefs(Set<AttributeDef> attributeDefSet) { if (attributeDefSet == null || attributeDefSet.size() == 0) { return null; } int attributeDefSetSize = attributeDefSet.size(); WsAttributeDef[] wsAttributeDefResults = new WsAttributeDef[attributeDefSetSize]; int index = 0; for (AttributeDef attributeDef : attributeDefSet) { WsAttributeDef wsAttributeDef = new WsAttributeDef(attributeDef, null); wsAttributeDefResults[index] = wsAttributeDef; index++; } return wsAttributeDefResults; } /** * friendly description of this attributeDef */ private String description; /** * Full name of the attributeDef (all extensions of parent stems, separated by colons, and the extention of this attributeDef */ private String name; /** * universally unique identifier of this attributeDef */ private String uuid; /** * type of attribute def, from enum AttributeDefType, e.g. attr, domain, type, limit, perm */ private String attributeDefType; /** * T of F for if can be assigned multiple times to one object */ private String multiAssignable; /** * T or F for if multiple values can be assigned to the attribute assignment */ private String multiValued; /** * what type of value on assignments: AttributeDefValueType: e.g. integer, timestamp, string, floating, marker, memberId */ private String valueType; /** * assign to Attribute Def T|F */ private String assignToAttributeDef = "F"; /** * assign to Attribute Def assignment T|F */ private String assignToAttributeDefAssignment = "F"; /** * assign to effective membership T|F */ private String assignToEffectiveMembership = "F"; /** * assign to effective membership assignment T|F */ private String assignToEffectiveMembershipAssignment = "F"; /** * assign to group T|F */ private String assignToGroup = "F"; /** * assign to group assignment T|F */ private String assignToGroupAssignment = "F"; /** * assign to immediate membership T|F */ private String assignToImmediateMembership = "F"; /** * assign to immediate membership assignment T|F */ private String assignToImmediateMembershipAssignment = "F"; /** * assign to member T|F */ private String assignToMember = "F"; /** * assign to member assignment T|F */ private String assignToMemberAssignment = "F"; /** * assign to stem T|F */ private String assignToStem = "F"; /** * assign to stem assignment T|F */ private String assignToStemAssignment = "F"; /** * @return true if this attribute def is assigned to anything */ public boolean areThereAnyAssignables() { return this.getAssignToAttributeDef().equalsIgnoreCase("T") || this.getAssignToAttributeDefAssignment().equalsIgnoreCase("T") || this.getAssignToEffectiveMembership().equalsIgnoreCase("T") || this.getAssignToEffectiveMembershipAssignment().equalsIgnoreCase("T") || this.getAssignToGroup().equalsIgnoreCase("T") || this.getAssignToGroupAssignment().equalsIgnoreCase("T") || this.getAssignToImmediateMembership().equalsIgnoreCase("T") || this.getAssignToImmediateMembershipAssignment().equalsIgnoreCase("T") || this.getAssignToMember().equalsIgnoreCase("T") || this.getAssignToMemberAssignment().equalsIgnoreCase("T") || this.getAssignToStem().equalsIgnoreCase("T") || this.getAssignToStemAssignment().equalsIgnoreCase("T"); } /** * @return the assignToAttributeDef */ public String getAssignToAttributeDef() { return this.assignToAttributeDef; } /** * @param assignToAttributeDef1 the assignToAttributeDef to set */ public void setAssignToAttributeDef(String assignToAttributeDef1) { this.assignToAttributeDef = assignToAttributeDef1; } /** * @return the assignToAttributeDefAssignment */ public String getAssignToAttributeDefAssignment() { return this.assignToAttributeDefAssignment; } /** * @param assignToAttributeDefAssignment1 the assignToAttributeDefAssignment to set */ public void setAssignToAttributeDefAssignment(String assignToAttributeDefAssignment1) { this.assignToAttributeDefAssignment = assignToAttributeDefAssignment1; } /** * @return the assignToEffectiveMembership */ public String getAssignToEffectiveMembership() { return this.assignToEffectiveMembership; } /** * @param assignToEffectiveMembership1 the assignToEffectiveMembership to set */ public void setAssignToEffectiveMembership(String assignToEffectiveMembership1) { this.assignToEffectiveMembership = assignToEffectiveMembership1; } /** * @return the assignToEffectiveMembershipAssignment */ public String getAssignToEffectiveMembershipAssignment() { return this.assignToEffectiveMembershipAssignment; } /** * @param assignToEffectiveMembershipAssignment1 the assignToEffectiveMembershipAssignment to set */ public void setAssignToEffectiveMembershipAssignment( String assignToEffectiveMembershipAssignment1) { this.assignToEffectiveMembershipAssignment = assignToEffectiveMembershipAssignment1; } /** * @return the assignToGroup */ public String getAssignToGroup() { return this.assignToGroup; } /** * @param assignToGroup1 the assignToGroup to set */ public void setAssignToGroup(String assignToGroup1) { this.assignToGroup = assignToGroup1; } /** * @return the assignToGroupAssignment */ public String getAssignToGroupAssignment() { return this.assignToGroupAssignment; } /** * @param assignToGroupAssignment1 the assignToGroupAssignment to set */ public void setAssignToGroupAssignment(String assignToGroupAssignment1) { this.assignToGroupAssignment = assignToGroupAssignment1; } /** * @return the assignToImmediateMembership */ public String getAssignToImmediateMembership() { return this.assignToImmediateMembership; } /** * @param assignToImmediateMembership1 the assignToImmediateMembership to set */ public void setAssignToImmediateMembership(String assignToImmediateMembership1) { this.assignToImmediateMembership = assignToImmediateMembership1; } /** * @return the assignToImmediateMembershipAssignment */ public String getAssignToImmediateMembershipAssignment() { return this.assignToImmediateMembershipAssignment; } /** * @param assignToImmediateMembershipAssignment1 the assignToImmediateMembershipAssignment to set */ public void setAssignToImmediateMembershipAssignment( String assignToImmediateMembershipAssignment1) { this.assignToImmediateMembershipAssignment = assignToImmediateMembershipAssignment1; } /** * @return the assignToMember */ public String getAssignToMember() { return this.assignToMember; } /** * @param assignToMember1 the assignToMember to set */ public void setAssignToMember(String assignToMember1) { this.assignToMember = assignToMember1; } /** * @return the assignToMemberAssignment */ public String getAssignToMemberAssignment() { return this.assignToMemberAssignment; } /** * @param assignToMemberAssignment1 the assignToMemberAssignment to set */ public void setAssignToMemberAssignment(String assignToMemberAssignment1) { this.assignToMemberAssignment = assignToMemberAssignment1; } /** * @return the assignToStem */ public String getAssignToStem() { return this.assignToStem; } /** * @param assignToStem1 the assignToStem to set */ public void setAssignToStem(String assignToStem1) { this.assignToStem = assignToStem1; } /** * @return the assignToStemAssignment */ public String getAssignToStemAssignment() { return this.assignToStemAssignment; } /** * @param assignToStemAssignment1 the assignToStemAssignment to set */ public void setAssignToStemAssignment(String assignToStemAssignment1) { this.assignToStemAssignment = assignToStemAssignment1; } /** * type of attribute def, from enum AttributeDefType, e.g. attr, domain, type, limit, perm * @return the type */ public String getAttributeDefType() { return this.attributeDefType; } /** * type of attribute def, from enum AttributeDefType, e.g. attr, domain, type, limit, perm * @param attributeDefType1 */ public void setAttributeDefType(String attributeDefType1) { this.attributeDefType = attributeDefType1; } /** * T of F for if can be assigned multiple times to one object * @return if multi assignable */ public String getMultiAssignable() { return this.multiAssignable; } /** * T of F for if can be assigned multiple times to one object * @param multiAssignable1 */ public void setMultiAssignable(String multiAssignable1) { this.multiAssignable = multiAssignable1; } /** * T or F, if has values, if can assign multiple values to one assignment * @return T or F, if has values, if can assign multiple values to one assignment */ public String getMultiValued() { return this.multiValued; } /** * T or F, if has values, if can assign multiple values to one assignment * @param multiValued1 */ public void setMultiValued(String multiValued1) { this.multiValued = multiValued1; } /** * what type of value on assignments: AttributeDefValueType: e.g. integer, timestamp, string, floating, marker, memberId * @return value type */ public String getValueType() { return this.valueType; } /** * what type of value on assignments: AttributeDefValueType: e.g. integer, timestamp, string, floating, marker, memberId * @param valueType1 */ public void setValueType(String valueType1) { this.valueType = valueType1; } /** * can be assigned to these types * @return assignable tos */ private String[] retrieveAssignableTos() { Set<String> assignableTosSet = new TreeSet<String>(); //ATTRIBUTE_DEF, ATTRIBUTE_DEF_ASSIGNMENT, EFFECTIVE_MEMBERSHIP, //EFFECTIVE_MEMBERSHIP_ASSIGNMENT, GROUP, GROUP_ASSIGNMENT, IMMEDIATE_MEMBERSHIP, //IMMEDIATE_MEMBERSHIP_ASSIGNMENT, MEMBER, MEMBER_ASSIGNMENT, STEM, STEM_ASSIGNMENT if (GrouperUtil.booleanValue(this.assignToAttributeDef, false)) { assignableTosSet.add("ATTRIBUTE_DEF"); } if (GrouperUtil.booleanValue(this.assignToAttributeDefAssignment, false)) { assignableTosSet.add("ATTRIBUTE_DEF_ASSIGNMENT"); } if (GrouperUtil.booleanValue(this.assignToEffectiveMembership, false)) { assignableTosSet.add("EFFECTIVE_MEMBERSHIP"); } if (GrouperUtil.booleanValue(this.assignToEffectiveMembershipAssignment, false)) { assignableTosSet.add("EFFECTIVE_MEMBERSHIP_ASSIGNMENT"); } if (GrouperUtil.booleanValue(this.assignToGroup, false)) { assignableTosSet.add("GROUP"); } if (GrouperUtil.booleanValue(this.assignToGroupAssignment, false)) { assignableTosSet.add("GROUP_ASSIGNMENT"); } if (GrouperUtil.booleanValue(this.assignToImmediateMembership, false)) { assignableTosSet.add("IMMEDIATE_MEMBERSHIP"); } if (GrouperUtil.booleanValue(this.assignToImmediateMembershipAssignment, false)) { assignableTosSet.add("IMMEDIATE_MEMBERSHIP_ASSIGNMENT"); } if (GrouperUtil.booleanValue(this.assignToMember, false)) { assignableTosSet.add("MEMBER"); } if (GrouperUtil.booleanValue(this.assignToMemberAssignment, false)) { assignableTosSet.add("MEMBER_ASSIGNMENT"); } if (GrouperUtil.booleanValue(this.assignToStem, false)) { assignableTosSet.add("STEM"); } if (GrouperUtil.booleanValue(this.assignToStemAssignment, false)) { assignableTosSet.add("STEM_ASSIGNMENT"); } if (assignableTosSet.size() == 0) { return null; } return GrouperUtil.toArray(assignableTosSet, String.class); } /** * can be assigned to these types * @param assignableTos1 */ private void assignAssignableTos(String[] assignableTos1) { Set<String> assignableTosSet = GrouperUtil.length(assignableTos1) == 0 ? new HashSet<String>() : GrouperUtil.toSet(assignableTos1); this.assignToAttributeDef = assignableTosSet.contains("ATTRIBUTE_DEF") ? "T" : "F"; this.assignToAttributeDefAssignment = assignableTosSet.contains("ATTRIBUTE_DEF_ASSIGNMENT") ? "T" : "F"; this.assignToEffectiveMembership = assignableTosSet.contains("EFFECTIVE_MEMBERSHIP") ? "T" : "F"; this.assignToEffectiveMembershipAssignment = assignableTosSet.contains("EFFECTIVE_MEMBERSHIP_ASSIGNMENT") ? "T" : "F"; this.assignToGroup = assignableTosSet.contains("GROUP") ? "T" : "F"; this.assignToGroupAssignment = assignableTosSet.contains("GROUP_ASSIGNMENT") ? "T" : "F"; this.assignToImmediateMembership = assignableTosSet.contains("IMMEDIATE_MEMBERSHIP") ? "T" : "F"; this.assignToImmediateMembershipAssignment = assignableTosSet.contains("IMMEDIATE_MEMBERSHIP_ASSIGNMENT") ? "T" : "F"; this.assignToMember = assignableTosSet.contains("MEMBER") ? "T" : "F"; this.assignToMemberAssignment = assignableTosSet.contains("MEMBER_ASSIGNMENT") ? "T" : "F"; this.assignToStem = assignableTosSet.contains("STEM") ? "T" : "F"; this.assignToStemAssignment = assignableTosSet.contains("STEM_ASSIGNMENT") ? "T" : "F"; } /** * no arg constructor */ public WsAttributeDef() { //blank } /** * construct based on attribute def name, assign all fields * @param attributeDef * @param wsAttributeDefLookup is the lookup to set looked up values */ public WsAttributeDef(AttributeDef attributeDef, WsAttributeDefLookup wsAttributeDefLookup) { if (attributeDef != null) { this.setDescription(StringUtils.trimToNull(attributeDef.getDescription())); this.setName(attributeDef.getName()); this.setUuid(attributeDef.getId()); this.setExtension(attributeDef.getExtension()); this.attributeDefType = attributeDef.getAttributeDefTypeDb(); this.multiAssignable = GrouperServiceUtils.booleanToStringOneChar(attributeDef.isMultiAssignable()); this.multiValued = GrouperServiceUtils.booleanToStringOneChar(attributeDef.isMultiValued()); this.valueType = attributeDef.getValueTypeDb(); //if greater then 2.2 then set id index if (GrouperWsVersionUtils.retrieveCurrentClientVersion() .greaterOrEqualToArg(GrouperVersion.valueOfIgnoreCase("v2_2_000"))) { this.setIdIndex(attributeDef.getIdIndex() == null ? null : attributeDef.getIdIndex().toString()); } } else { if (wsAttributeDefLookup != null) { //no attributeDef, set the look values so the caller can keep things in sync this.setName(wsAttributeDefLookup.getName()); this.setUuid(wsAttributeDefLookup.getUuid()); this.setExtension(GrouperUtil.extensionFromName(wsAttributeDefLookup.getName())); //if greater then 2.2 then set id index if (GrouperWsVersionUtils.retrieveCurrentClientVersion() .greaterOrEqualToArg(GrouperVersion.valueOfIgnoreCase("v2_2_000"))) { this.setIdIndex(wsAttributeDefLookup.getIdIndex() == null ? null : wsAttributeDefLookup.getIdIndex().toString()); } } } } /** * construct based on attribute def name, assign all fields * @param attributeDef * @param wsAttributeDefLookup is the lookup to set looked up values */ public WsAttributeDef(PITAttributeDef attributeDef, WsAttributeDefLookup wsAttributeDefLookup) { if (attributeDef != null) { this.setName(attributeDef.getName()); this.setUuid(attributeDef.getSourceId()); this.setExtension(GrouperUtil.extensionFromName(attributeDef.getName())); this.attributeDefType = attributeDef.getAttributeDefTypeDb(); } else { if (wsAttributeDefLookup != null) { //no attributeDef, set the look values so the caller can keep things in sync this.setName(wsAttributeDefLookup.getName()); this.setUuid(wsAttributeDefLookup.getUuid()); this.setExtension(GrouperUtil.extensionFromName(wsAttributeDefLookup.getName())); } } } /** * friendly description of this attributeDef * @return the description */ public String getDescription() { return this.description; } /** * Full name of the attributeDef (all extensions of parent stems, separated by colons, * and the extention of this attributeDef * @return the name */ public String getName() { return this.name; } /** * universally unique identifier of this attributeDef * @return the uuid */ public String getUuid() { return this.uuid; } /** * friendly description of this attributeDef * @param description1 the description to set */ public void setDescription(String description1) { this.description = description1; } /** * Full name of the attributeDef (all extensions of parent stems, separated by colons, * and the extention of this attributeDef * @param name1 the name to set */ public void setName(String name1) { this.name = name1; } /** * universally unique identifier of this attributeDef * @param uuid1 the uuid to set */ public void setUuid(String uuid1) { this.uuid = uuid1; } /** * extension of attributeDef, the part to the right of last colon in name * @return the extension */ public String getExtension() { return this.extension; } /** * extension of attributeDef, the part to the right of last colon in name * @param extension1 the extension to set */ public void setExtension(String extension1) { this.extension = extension1; } /** * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(WsAttributeDef o2) { if (this == o2) { return 0; } //lets by null safe here if (this == null) { return -1; } if (o2 == null) { return 1; } return GrouperUtil.compare(this.getName(), o2.getName()); } /** * @see edu.internet2.middleware.grouper.util.ChangeToVersionCustomizable#customizeChangeFromVersion(java.lang.Object) */ public void customizeChangeFromVersion(Object objectToConvertTo) { if (objectToConvertTo != null) { //we need to convert between a field for each assignable to the list of assignables String[] assignableTos = this.retrieveAssignableTos(); GrouperUtil.assignField(objectToConvertTo, "assignableTos", assignableTos); } } /** * @see edu.internet2.middleware.grouper.util.ChangeToVersionCustomizable#customizeChangeToVersion(java.lang.Object) */ public void customizeChangeToVersion(Object objectToConvertFrom) { if (objectToConvertFrom != null) { String[] assignableTos = (String[])GrouperUtil.fieldValue(objectToConvertFrom, "assignableTos"); this.assignAssignableTos(assignableTos); } } }
29.474642
143
0.705285
c623d28677b0552307e2ae3d04379532f80ea0a6
3,217
package com.nus.cool.core.io.writestore; import com.google.common.primitives.Ints; import com.nus.cool.core.schema.FieldType; import com.nus.cool.core.util.IntegerUtil; import lombok.Getter; import java.io.DataOutput; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MetaInvariantFieldWS implements MetaFieldWS { // private final FieldType[] dataType; @Getter private Map<String, List<Object>> metaInvariantFields = new HashMap<>(); @Getter private List<Integer> invariantIndex; @Getter private final Integer userKeyIndex; @Getter private List<Integer> invariantTypes = new ArrayList<>(); public MetaInvariantFieldWS(List<Integer> invariantIndex, Integer userKeyIndex) { // this.dataType = dataType; this.invariantIndex = invariantIndex; this.userKeyIndex = userKeyIndex; } @Override public int writeTo(DataOutput out) throws IOException { int bytesWritten = 0; for (int i = 0; i < invariantTypes.size(); i++) { out.writeInt(invariantTypes.get(i)); bytesWritten += Ints.BYTES; } for (String key : metaInvariantFields.keySet()) { out.writeInt(key.getBytes().length); bytesWritten+=Ints.BYTES; out.writeChars(key); bytesWritten += key.getBytes().length; List<Object> tempList = metaInvariantFields.get(key); for (int i = 0; i < tempList.size(); i++) { if (tempList.get(i).getClass().toString() == "int") { // out.writeInt(Ints.BYTES); // bytesWritten += Ints.BYTES; out.writeInt(IntegerUtil.toNativeByteOrder((int) tempList.get(i))); bytesWritten += Ints.BYTES; } else { out.writeInt(tempList.get(i).toString().getBytes().length); out.writeChars(tempList.get(i).toString()); bytesWritten += tempList.get(i).toString().getBytes().length; bytesWritten += Ints.BYTES; } } } return bytesWritten; } public void putInvariant(String UserID, List<Object> invariantData) { if (this.metaInvariantFields.size() == 0) { for (int i = 0; i < invariantData.size(); i++) { if (invariantData.get(i).getClass().toString() == "int") { this.invariantTypes.add(0); } else { this.invariantTypes.add(1); } } } if (this.metaInvariantFields.containsKey(UserID)) { return; } else { this.metaInvariantFields.put(UserID, invariantData); } } @Override public void put(String v) { } @Override public void update(String v) { } @Override public int find(String v) { return 0; } @Override public int count() { return 0; } @Override public FieldType getFieldType() { return null; } @Override public void complete() { } }
27.973913
87
0.574448
65eac89472283dba23cfe37983302d224c675a61
288
package com.mossle.form.manager; import com.mossle.core.hibernate.HibernateEntityDao; import com.mossle.form.domain.DynamicModelData; import org.springframework.stereotype.Service; @Service public class DynamicModelDataManager extends HibernateEntityDao<DynamicModelData> { }
22.153846
52
0.822917
993d5a75d61b65397137db141722ca478beb97e7
1,350
package edu.unc.ils.mrc.hive.ir.lucene.analysis; import java.io.Reader; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.ISOLatin1AccentFilter; import org.apache.lucene.analysis.LowerCaseFilter; import org.apache.lucene.analysis.StopFilter; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter; import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter.Side; import org.apache.lucene.analysis.standard.StandardFilter; import org.apache.lucene.analysis.standard.StandardTokenizer; public class AutocompleteAnalyzer extends Analyzer { private static final String[] ENGLISH_STOP_WORDS = { "a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "i", "if", "in", "into", "is", "no", "not", "of", "on", "or", "s", "such", "t", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with" }; public TokenStream tokenStream(String fieldName, Reader reader) { TokenStream result = new StandardTokenizer(reader); result = new StandardFilter(result); result = new LowerCaseFilter(result); result = new ISOLatin1AccentFilter(result); result = new StopFilter(result, ENGLISH_STOP_WORDS); result = new EdgeNGramTokenFilter( result, Side.FRONT,1, 20); return result; } }
31.395349
66
0.714815
eaa90c0c7cfdbdaa8a7b842164deae322963d7f9
3,652
package com.example.android.popularmovies; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import com.example.android.popularmovies.Utilities.JSONUtils; import com.example.android.popularmovies.model.Movie; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; public class MovieAdapter extends RecyclerView.Adapter<MovieAdapter.MovieAdapterViewHolder> { private static final String TAG = MovieAdapter.class.getSimpleName(); private final Context mContext; private final MovieAdapterOnClickHandler mClickHandler; private List<Movie> movieList = new ArrayList<>(); // interface for on click messages public interface MovieAdapterOnClickHandler { void onClick(Movie clickedMovie); } /** * create MovieAdapter * @param clickHandler is called when the poster is clicked. */ public MovieAdapter(Context context, List<Movie> movies, MovieAdapterOnClickHandler clickHandler) { movieList = movies; mClickHandler = clickHandler; mContext = context; } class MovieAdapterViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { ImageView mImageView; public MovieAdapterViewHolder(View view) { super(view); mImageView = (ImageView) view.findViewById(R.id.movie_list_poster); view.setOnClickListener(this); } /** * * @param view is the called view */ public void onClick(View view) { int adapterPosition = getAdapterPosition(); mClickHandler.onClick(movieList.get(adapterPosition)); Log.d(TAG, "onClick: is not working!!!!"); } } /** * * @param viewGroup the view holders are here * @param viewType if more than one type * @return new MovieAdapterViewHolder that holds view for each grid item */ @NonNull @Override public MovieAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) { Context context = viewGroup.getContext(); int layoutIdForListItem = R.layout.movie_list; LayoutInflater inflater = LayoutInflater.from(context); boolean shouldAttachToParentImmediately = false; View view = inflater.inflate(layoutIdForListItem, viewGroup, shouldAttachToParentImmediately); return new MovieAdapterViewHolder(view); } @Override public void onBindViewHolder(@NonNull MovieAdapterViewHolder holder, int position) { Movie movie = movieList.get(position); String POSTER_URL = JSONUtils.IMAGE_BASE_URL + JSONUtils.POSTER_SIZE_REGULAR + movie.getPosterThumbnail(); if (!TextUtils.isEmpty(POSTER_URL)) { Picasso.with(mContext) .load(POSTER_URL.trim()) .placeholder(R.drawable.baseline_camera_alt_black_18dp) .error(R.drawable.baseline_error_outline_black_18dp) .into(holder.mImageView); } Log.d(TAG, "onBindViewHolder: is not working!!!!" + POSTER_URL); } @Override public int getItemCount() { return movieList == null ? 0 : movieList.size(); } public void add(ArrayList<Movie> data) { this.movieList = data; notifyDataSetChanged(); } public void clear() { movieList.clear(); } }
32.900901
114
0.683187
5a856a2467d4ef1832d3f5734a789ae275bafc88
91
package io.eventuate.tram.events.common; /** * 领域事件 */ public interface DomainEvent { }
11.375
40
0.703297
039f6e6525f4f227975ba05dba23d51963c89cb4
1,282
package by.egar.addressbook.test; import by.egar.addressbook.model.ContactDatas; import by.egar.addressbook.model.Contacts; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; public class ContactModTests extends TestsBase { @BeforeMethod private void ensurePrecondition() { if (app.db().contacts().size() == 0) { app.getGoTo().add_NewPage(); app.contact().create(new ContactDatas().withFirstname("daniil")); } } @Test public void testContactMod() { Contacts before = app.db().contacts(); ContactDatas modifiedContact = before.iterator().next(); ContactDatas contact = new ContactDatas() .withId(modifiedContact.getId()).withFirstname("daniil").withLastname("astapenko").withEmail("daniil.astapeno@gmail.ru").withGroup("test3"); app.getGoTo().add_NewPage(); app.contact().modify(contact); assertThat(app.contact().count(), equalTo(before.size())); Contacts after = app.db().contacts(); assertThat(after, equalTo(before.without(modifiedContact).withAdded(contact))); verifyContactListInUI(); } }
36.628571
156
0.684087
179b4299fc4f187079688f6edc5c8036b5e4da1c
931
package org.wso2.carbon.dataservices.core.odata; import org.apache.olingo.server.api.uri.UriParameter; import org.apache.olingo.server.api.uri.queryoption.expression.Expression; /** * Class to have access to a simple constructor for UriParameter Objects. Used by ODataAdapter for navigation in compound resource paths. */ public class NavigationUriParameter implements UriParameter { private String name; private String text; public NavigationUriParameter(String name, String text) { this.name = name; this.text = text; } @Override public String getAlias() { return null; } @Override public Expression getExpression() { return null; } @Override public String getName() { return this.name; } @Override public String getReferencedProperty() { return null; } @Override public String getText() { return this.text; } @Override public String toString() { return name + "=" + text; } }
19
137
0.734694
8a2f02fad776d42c3790b4312021406c43a0da91
382
package ir.unitycorn.app.roomlibrelated.entities; import androidx.room.Dao; import androidx.room.Query; import java.util.List; @Dao public interface ContentEntityDao { //Article Activity => Returns the contents with the matching article_id @Query("select * from content where content_parent=:parentId") public List<ContentEntity> getContentById(String parentId); }
23.875
75
0.777487
39032ff4f37737e1f14eca9c8400999e4fc602e6
3,176
/* * Copyright (C) 2018 CyberAgent, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.linkedin.android.litr.filter.video.gl; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.linkedin.android.litr.filter.Transform; import com.linkedin.android.litr.filter.video.gl.parameter.ShaderParameter; import com.linkedin.android.litr.filter.video.gl.parameter.Uniform3f; /** * Colors video pixels in false colors. A color channel value of a pixel is calculated as an interpolation between * two channel values weighted by video pixel luminance. */ public class FalseColorFilter extends VideoFrameRenderFilter { private static final String FRAGMENT_SHADER = "#extension GL_OES_EGL_image_external : require\n" + "precision lowp float;\n" + "uniform samplerExternalOES sTexture;\n" + "varying highp vec2 vTextureCoord;\n" + "uniform float intensity;\n" + "uniform vec3 firstColor;\n" + "uniform vec3 secondColor;\n" + "const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\n" + "void main()\n" + "{\n" + "lowp vec4 textureColor = texture2D(sTexture, vTextureCoord);\n" + "float luminance = dot(textureColor.rgb, luminanceWeighting);\n" + "gl_FragColor = vec4( mix(firstColor.rgb, secondColor.rgb, luminance), textureColor.a);\n" + "}\n"; /** * Create the instance of frame render filter * @param firstColor first color channel values * @param secondColor second color channel values */ public FalseColorFilter(@NonNull float[] firstColor, @NonNull float[] secondColor) { this(firstColor, secondColor, null); } /** * Create frame render filter with source video frame, then scale, then position and then rotate the bitmap around its center as specified. * @param firstColor first color channel values * @param secondColor second color channel values * @param transform {@link Transform} that defines positioning of source video frame within target video frame */ public FalseColorFilter(@NonNull float[] firstColor, @NonNull float[] secondColor, @Nullable Transform transform) { super(DEFAULT_VERTEX_SHADER, FRAGMENT_SHADER, new ShaderParameter[] { new Uniform3f("firstColor", firstColor[0], firstColor[1], firstColor[2]), new Uniform3f("secondColor", secondColor[0], secondColor[1], secondColor[2]) }, transform); } }
41.246753
143
0.673489
243e08e8c35befa14c21fdc16944d7e06b78d0f9
2,761
/* * Licensed to CRATE Technology GmbH ("Crate") under one or more contributor * license agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. Crate licenses * this file to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may * obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * * However, if you have executed another commercial license agreement * with Crate these terms will supersede the license and you may use the * software solely pursuant to the terms of the relevant commercial agreement. */ package io.crate.metadata.doc; import com.google.common.collect.ImmutableList; import io.crate.metadata.ColumnIdent; import io.crate.types.DataType; import io.crate.common.collections.Tuple; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; public final class PartitionedByMappingExtractor { private PartitionedByMappingExtractor() { } @SuppressWarnings("unchecked") public static Iterable<Tuple<ColumnIdent, DataType>> extractPartitionedByColumns(Map<String, Object> mapping) { Map<String, Object> metaMap = (Map<String, Object>) mapping.get("_meta"); if (metaMap != null) { Object partitionedByColumnsMaybe = metaMap.get("partitioned_by"); if (partitionedByColumnsMaybe instanceof List) { List<List<String>> partitionedByColumns = (List<List<String>>) partitionedByColumnsMaybe; return extractPartitionedByColumns(partitionedByColumns); } } return ImmutableList.of(); } static Iterable<Tuple<ColumnIdent, DataType>> extractPartitionedByColumns(Collection<List<String>> partitionedByList) { return partitionedByList.stream() .map(PartitionedByMappingExtractor::toColumnIdentAndType)::iterator; } private static Tuple<ColumnIdent, DataType> toColumnIdentAndType(List<String> partitioned) { String dottedColumnName = partitioned.get(0); ColumnIdent column = ColumnIdent.fromPath(dottedColumnName); String typeDefinition = partitioned.get(1); DataType type = DocIndexMetadata.getColumnDataType(Collections.singletonMap("type", typeDefinition)); return new Tuple<>(column, type); } }
42.476923
123
0.735603
af0a4526b0842286b0c5e69703410a6e279057fe
3,594
package pt.com.gcs.conf; import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import org.caudexorigo.Shutdown; import org.caudexorigo.io.FilenameUtils; import org.caudexorigo.text.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class GcsInfo { private static Logger log = LoggerFactory.getLogger(GcsInfo.class); public static final String VERSION = "200808032331"; private static final GcsInfo instance = new GcsInfo(); public static String getAgentHost() { String prop = instance.conf.getNet().getIp(); if (StringUtils.isBlank(prop)) { log.error("Fatal error: Must define valid host."); Shutdown.now(); } return prop; } public static String getAgentName() { String prop = instance.conf.getName(); if (StringUtils.isBlank(prop)) { log.error("Fatal error: Must define an Agent name."); Shutdown.now(); } return prop; } public static int getAgentPort() { int iprop = instance.conf.getNet().getPort(); return iprop; } public static String getBasePersistentDirectory() { String prop = instance.conf.getPersistency().getDirectory(); String defaultDir = FilenameUtils.normalizeNoEndSeparator(System.getProperty("user.dir")) + File.separator + "persistent"; if (StringUtils.isBlank(prop)) { log.warn("No directory for persistent storage. Using default: {}", defaultDir); return defaultDir; } else { return FilenameUtils.normalizeNoEndSeparator(prop); } } public static int getInitialDelay() { int iprop = instance.conf.getNet().getDiscoveryDelay(); return iprop; } public static String getStatisticsTopic() { String prop = instance.conf.getStatistics().getTopic(); return prop; } public static String getConfigVersion() { String prop = instance.conf.getConfigVersion(); return prop; } public static String getWorldMapPath() { String prop = instance.conf.getNet().getFileRef(); if (StringUtils.isBlank(prop)) { log.error("Fatal error: Must define a valid path for the world map file."); Shutdown.now(); } return prop; } private Config conf; private GcsInfo() { String filePath = System.getProperty("config-path"); if (StringUtils.isBlank(filePath)) { log.error("Fatal error: No configuration file defined. Please set the enviroment variable 'config-path' to valid path for the configuration file"); Shutdown.now(); } try { JAXBContext jc = JAXBContext.newInstance("pt.com.gcs.conf"); Unmarshaller u = jc.createUnmarshaller(); conf = (Config) u.unmarshal(new File(filePath)); } catch (JAXBException e) { log.error("Fatal error: {}", e.getMessage()); Shutdown.now(); } } public static int getBrokerUdpPort() { int iprop = instance.conf.getNet().getBrokerUdpPort(); return iprop; } public static int getBrokerHttpPort() { int iprop = instance.conf.getNet().getBrokerHttpPort(); return iprop; } public static int getBrokerPort() { int iprop = instance.conf.getNet().getBrokerPort(); return iprop; } public static boolean isDropboxEnabled() { return instance.conf.getMessaging().getDropbox().isEnabled(); } public static String getDropBoxDir() { return instance.conf.getMessaging().getDropbox().getDir(); } public static int getDropBoxCheckInterval() { return instance.conf.getMessaging().getDropbox().getCheckInterval(); } }
23.490196
151
0.685865
1f51c7237afaf8da066fe6bc4b9964e1afdcdb61
452
package cm.study.robot.common; import static org.testng.Assert.*; import org.testng.annotations.Test; public class AstUtilsTest { private String javaFile = "/home/chenming/ws-plugin/codeRobot/common/src/test/java/cm/study/robot/common/XXXService.java"; @Test public void AstUtils() throws Exception { AstUtils.init( javaFile ).codeRobot( AstUtils.SERVICE ).scan().generate(); // AstUtils.init( javaFile ).scan(); } }
22.6
124
0.710177
9cc131ef1ac708d077e5f217c0672d89ea47377f
6,021
// Generated from src\main\java\org\schorn\ella\antlr\SpecParser.g4 by ANTLR 4.7.2 package org.schorn.ella.antlr; import org.antlr.v4.runtime.tree.ParseTreeVisitor; /** * This interface defines a complete generic visitor for a parse tree produced * by {@link SpecParser}. * * @param <T> The return type of the visit operation. Use {@link Void} for * operations with no return type. */ public interface SpecParserVisitor<T> extends ParseTreeVisitor<T> { /** * Visit a parse tree produced by {@link SpecParser#def}. * @param ctx the parse tree * @return the visitor result */ T visitDef(SpecParser.DefContext ctx); /** * Visit a parse tree produced by {@link SpecParser#typeCreation}. * @param ctx the parse tree * @return the visitor result */ T visitTypeCreation(SpecParser.TypeCreationContext ctx); /** * Visit a parse tree produced by {@link SpecParser#defineType}. * @param ctx the parse tree * @return the visitor result */ T visitDefineType(SpecParser.DefineTypeContext ctx); /** * Visit a parse tree produced by {@link SpecParser#typeAttributes}. * @param ctx the parse tree * @return the visitor result */ T visitTypeAttributes(SpecParser.TypeAttributesContext ctx); /** * Visit a parse tree produced by {@link SpecParser#typeAttribute}. * @param ctx the parse tree * @return the visitor result */ T visitTypeAttribute(SpecParser.TypeAttributeContext ctx); /** * Visit a parse tree produced by {@link SpecParser#parameters}. * @param ctx the parse tree * @return the visitor result */ T visitParameters(SpecParser.ParametersContext ctx); /** * Visit a parse tree produced by {@link SpecParser#parameter}. * @param ctx the parse tree * @return the visitor result */ T visitParameter(SpecParser.ParameterContext ctx); /** * Visit a parse tree produced by {@link SpecParser#command}. * @param ctx the parse tree * @return the visitor result */ T visitCommand(SpecParser.CommandContext ctx); /** * Visit a parse tree produced by {@link SpecParser#cmdPath}. * @param ctx the parse tree * @return the visitor result */ T visitCmdPath(SpecParser.CmdPathContext ctx); /** * Visit a parse tree produced by {@link SpecParser#listOfValues}. * @param ctx the parse tree * @return the visitor result */ T visitListOfValues(SpecParser.ListOfValuesContext ctx); /** * Visit a parse tree produced by {@link SpecParser#listValue}. * @param ctx the parse tree * @return the visitor result */ T visitListValue(SpecParser.ListValueContext ctx); /** * Visit a parse tree produced by {@link SpecParser#attrCreation}. * @param ctx the parse tree * @return the visitor result */ T visitAttrCreation(SpecParser.AttrCreationContext ctx); /** * Visit a parse tree produced by {@link SpecParser#addTypeToAttr}. * @param ctx the parse tree * @return the visitor result */ T visitAddTypeToAttr(SpecParser.AddTypeToAttrContext ctx); /** * Visit a parse tree produced by {@link SpecParser#attributeAttributes}. * @param ctx the parse tree * @return the visitor result */ T visitAttributeAttributes(SpecParser.AttributeAttributesContext ctx); /** * Visit a parse tree produced by {@link SpecParser#attributeAttribute}. * @param ctx the parse tree * @return the visitor result */ T visitAttributeAttribute(SpecParser.AttributeAttributeContext ctx); /** * Visit a parse tree produced by {@link SpecParser#typeFlavor}. * @param ctx the parse tree * @return the visitor result */ T visitTypeFlavor(SpecParser.TypeFlavorContext ctx); /** * Visit a parse tree produced by {@link SpecParser#attrFlavor}. * @param ctx the parse tree * @return the visitor result */ T visitAttrFlavor(SpecParser.AttrFlavorContext ctx); /** * Visit a parse tree produced by {@link SpecParser#typeQualifier}. * @param ctx the parse tree * @return the visitor result */ T visitTypeQualifier(SpecParser.TypeQualifierContext ctx); /** * Visit a parse tree produced by {@link SpecParser#attributeType}. * @param ctx the parse tree * @return the visitor result */ T visitAttributeType(SpecParser.AttributeTypeContext ctx); /** * Visit a parse tree produced by {@link SpecParser#enumQualifier}. * @param ctx the parse tree * @return the visitor result */ T visitEnumQualifier(SpecParser.EnumQualifierContext ctx); /** * Visit a parse tree produced by {@link SpecParser#cmdAction}. * @param ctx the parse tree * @return the visitor result */ T visitCmdAction(SpecParser.CmdActionContext ctx); /** * Visit a parse tree produced by {@link SpecParser#cmdObject}. * @param ctx the parse tree * @return the visitor result */ T visitCmdObject(SpecParser.CmdObjectContext ctx); /** * Visit a parse tree produced by {@link SpecParser#cmd}. * @param ctx the parse tree * @return the visitor result */ T visitCmd(SpecParser.CmdContext ctx); /** * Visit a parse tree produced by {@link SpecParser#enumID}. * @param ctx the parse tree * @return the visitor result */ T visitEnumID(SpecParser.EnumIDContext ctx); /** * Visit a parse tree produced by {@link SpecParser#typeNameRef}. * @param ctx the parse tree * @return the visitor result */ T visitTypeNameRef(SpecParser.TypeNameRefContext ctx); /** * Visit a parse tree produced by {@link SpecParser#typeNameDef}. * @param ctx the parse tree * @return the visitor result */ T visitTypeNameDef(SpecParser.TypeNameDefContext ctx); /** * Visit a parse tree produced by {@link SpecParser#pattern}. * @param ctx the parse tree * @return the visitor result */ T visitPattern(SpecParser.PatternContext ctx); /** * Visit a parse tree produced by {@link SpecParser#number}. * @param ctx the parse tree * @return the visitor result */ T visitNumber(SpecParser.NumberContext ctx); /** * Visit a parse tree produced by {@link SpecParser#datetime}. * @param ctx the parse tree * @return the visitor result */ T visitDatetime(SpecParser.DatetimeContext ctx); }
32.197861
82
0.720977
16caa03be493cf981535df3c4e40993a435d4ec7
392
package com.example.cinema.bl.sales; import com.example.cinema.vo.ResponseVO; public interface ConsumptionService { /** * 获取用户的消费记录 * 缩略模式的列表 * @param userId * @return */ ResponseVO getConsumptionByUserId(int userId); /** * 获得一条详细的消费记录 * @param consumptionId * @return */ ResponseVO getConsumptionDetails(int consumptionId); }
17.818182
56
0.645408
7d8c08afb927bbf28ec7fe97e594b7734928ca54
13,619
package owltools.reasoner; import java.util.HashSet; import java.util.Set; import org.geneontology.reasoner.OWLExtendedReasoner; import org.semanticweb.owlapi.model.AxiomType; import org.semanticweb.owlapi.model.OWLAxiom; import org.semanticweb.owlapi.model.OWLClass; import org.semanticweb.owlapi.model.OWLClassExpression; import org.semanticweb.owlapi.model.OWLDataProperty; import org.semanticweb.owlapi.model.OWLDataPropertyExpression; import org.semanticweb.owlapi.model.OWLLiteral; import org.semanticweb.owlapi.model.OWLNamedIndividual; import org.semanticweb.owlapi.model.OWLObject; import org.semanticweb.owlapi.model.OWLObjectProperty; import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.parameters.AxiomAnnotations; import org.semanticweb.owlapi.model.parameters.Imports; import org.semanticweb.owlapi.reasoner.AxiomNotInProfileException; import org.semanticweb.owlapi.reasoner.BufferingMode; import org.semanticweb.owlapi.reasoner.ClassExpressionNotInProfileException; import org.semanticweb.owlapi.reasoner.FreshEntitiesException; import org.semanticweb.owlapi.reasoner.InconsistentOntologyException; import org.semanticweb.owlapi.reasoner.InferenceType; import org.semanticweb.owlapi.reasoner.Node; import org.semanticweb.owlapi.reasoner.NodeSet; import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration; import org.semanticweb.owlapi.reasoner.ReasonerInterruptedException; import org.semanticweb.owlapi.reasoner.TimeOutException; import org.semanticweb.owlapi.reasoner.UnsupportedEntailmentTypeException; import org.semanticweb.owlapi.reasoner.impl.DefaultNodeSet; import org.semanticweb.owlapi.reasoner.impl.OWLClassNode; import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; import org.semanticweb.owlapi.reasoner.impl.OWLReasonerBase; import org.semanticweb.owlapi.util.Version; import owltools.graph.OWLGraphWrapper; /** * * incomplete. * * the goal is to expose OWLGraphReasoner reachability queries via the reasoner interface. * * however, OWLReasoners do not support returning class expressions for superclass queries, * so this provides an extra method * * @author cjm * */ public class GraphReasoner extends OWLReasonerBase implements OWLExtendedReasoner { private static final Version version = new Version(1, 0, 0, 0); private OWLGraphWrapper gw; protected GraphReasoner(OWLOntology rootOntology, OWLReasonerConfiguration configuration, BufferingMode bufferingMode) { super(rootOntology, configuration, bufferingMode); gw = new OWLGraphWrapper(rootOntology); } public String getReasonerName() { return "Graph Reasoner"; } public Version getReasonerVersion() { return version; } public void interrupt() { // TODO Auto-generated method stub } public void precomputeInferences(InferenceType... inferenceTypes) throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException { // TODO Auto-generated method stub } public boolean isPrecomputed(InferenceType inferenceType) { // TODO Auto-generated method stub return false; } public Set<InferenceType> getPrecomputableInferenceTypes() { // TODO Auto-generated method stub return null; } public boolean isConsistent() throws ReasonerInterruptedException, TimeOutException { return true; } public boolean isSatisfiable(OWLClassExpression classExpression) throws ReasonerInterruptedException, TimeOutException, ClassExpressionNotInProfileException, FreshEntitiesException, InconsistentOntologyException { // TODO Auto-generated method stub return true; } public Node<OWLClass> getUnsatisfiableClasses() throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException { return OWLClassNode.getBottomNode(); } public boolean isEntailed(OWLAxiom axiom) throws ReasonerInterruptedException, UnsupportedEntailmentTypeException, TimeOutException, AxiomNotInProfileException, FreshEntitiesException, InconsistentOntologyException { return getRootOntology().containsAxiom(axiom, Imports.INCLUDED, AxiomAnnotations.IGNORE_AXIOM_ANNOTATIONS); } public boolean isEntailed(Set<? extends OWLAxiom> axioms) throws ReasonerInterruptedException, UnsupportedEntailmentTypeException, TimeOutException, AxiomNotInProfileException, FreshEntitiesException, InconsistentOntologyException { for (OWLAxiom ax : axioms) { if (!getRootOntology().containsAxiom(ax, Imports.INCLUDED, AxiomAnnotations.IGNORE_AXIOM_ANNOTATIONS)) { return false; } } return true; } public boolean isEntailmentCheckingSupported(AxiomType<?> axiomType) { return false; } public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct) throws ReasonerInterruptedException, TimeOutException, FreshEntitiesException, InconsistentOntologyException, ClassExpressionNotInProfileException { DefaultNodeSet<OWLClass> result = new OWLClassNodeSet(); Set<OWLObject> subs = gw.queryDescendants(ce, false, true); for (OWLObject s : subs) { if (s instanceof OWLClassExpression) { if (s instanceof OWLClass) { result.addEntity((OWLClass) s); } else { } } else { } } return result; } /** * note that this is not a standard reasoner method * * @param ce * @param direct * @return all superclasses, where superclasses can include anon class expressions * @throws InconsistentOntologyException * @throws ClassExpressionNotInProfileException * @throws FreshEntitiesException * @throws ReasonerInterruptedException * @throws TimeOutException */ public Set<OWLClassExpression> getSuperClassExpressions(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { Set<OWLClassExpression> result = new HashSet<OWLClassExpression>(); Set<OWLObject> supers = gw.getSubsumersFromClosure(ce); for (OWLObject sup : supers) { if (sup instanceof OWLClassExpression) { result.add((OWLClassExpression) sup); } else { } } return result; } public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { DefaultNodeSet<OWLClass> result = new OWLClassNodeSet(); Set<OWLObject> supers = gw.getSubsumersFromClosure(ce); for (OWLObject sup : supers) { if (sup instanceof OWLClassExpression) { if (sup instanceof OWLClass) { result.addEntity((OWLClass) sup); } else { } } else { } } return result; } public Node<OWLClass> getEquivalentClasses(OWLClassExpression ce) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) throws ReasonerInterruptedException, TimeOutException, FreshEntitiesException, InconsistentOntologyException { return new OWLClassNodeSet(); } public Node<OWLObjectPropertyExpression> getTopObjectPropertyNode() { // TODO Auto-generated method stub return null; } public Node<OWLObjectPropertyExpression> getBottomObjectPropertyNode() { // TODO Auto-generated method stub return null; } public NodeSet<OWLObjectPropertyExpression> getSubObjectProperties( OWLObjectPropertyExpression pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLObjectPropertyExpression> getSuperObjectProperties( OWLObjectPropertyExpression pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public Node<OWLObjectPropertyExpression> getEquivalentObjectProperties( OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLObjectPropertyExpression> getDisjointObjectProperties( OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public Node<OWLObjectPropertyExpression> getInverseObjectProperties( OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLClass> getObjectPropertyDomains( OWLObjectPropertyExpression pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLClass> getObjectPropertyRanges( OWLObjectPropertyExpression pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public Node<OWLDataProperty> getTopDataPropertyNode() { // TODO Auto-generated method stub return null; } public Node<OWLDataProperty> getBottomDataPropertyNode() { // TODO Auto-generated method stub return null; } public NodeSet<OWLDataProperty> getSubDataProperties(OWLDataProperty pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLDataProperty> getSuperDataProperties(OWLDataProperty pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public Node<OWLDataProperty> getEquivalentDataProperties(OWLDataProperty pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLDataProperty> getDisjointDataProperties( OWLDataPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLClass> getDataPropertyDomains(OWLDataProperty pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { DefaultNodeSet<OWLNamedIndividual> result = new OWLNamedIndividualNodeSet(); Set<OWLObject> subs = gw.queryDescendants(ce, true, true); for (OWLObject s : subs) { if (s instanceof OWLNamedIndividual) { result.addEntity((OWLNamedIndividual) s); } else { } } return result; } public NodeSet<OWLNamedIndividual> getObjectPropertyValues( OWLNamedIndividual ind, OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public Set<OWLLiteral> getDataPropertyValues(OWLNamedIndividual ind, OWLDataProperty pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public Node<OWLNamedIndividual> getSameIndividuals(OWLNamedIndividual ind) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } public NodeSet<OWLNamedIndividual> getDifferentIndividuals( OWLNamedIndividual ind) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } @Override protected void handleChanges(Set<OWLAxiom> addAxioms, Set<OWLAxiom> removeAxioms) { // TODO Auto-generated method stub } public Node<OWLClass> getTopClassNode() { // TODO Auto-generated method stub return null; } public Node<OWLClass> getBottomClassNode() { // TODO Auto-generated method stub return null; } @Override public Set<OWLClass> getSuperClassesOver(OWLClassExpression ce, OWLObjectProperty p, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException { // TODO Auto-generated method stub return null; } }
31.525463
109
0.805492
e90ac98a070d83c69ee411ca795ac3e4bd8bebb9
797
/* * Copyright (c) 2021. Pradeesh Kumar */ package org.pradeesh.crawler.web; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.ConfigurationPropertiesScan; /** * The type Crawler application. * * @author pradeesh.kumar */ @SpringBootApplication(scanBasePackages = {"org.pradeesh.crawler", "org.pradeesh.crawler.common", "org.pradeesh.crawler.web"}) @ConfigurationPropertiesScan("org.pradeesh.crawler.common.config") public class CrawlerApplication { /** * The entry point of application. * * @param args the input arguments */ public static void main(String[] args) { SpringApplication.run(CrawlerApplication.class, args); } }
28.464286
126
0.74404
e8ad9f1b37d8c1c49bf4090b2d16681d846f3227
1,346
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package eapli.base.gestaochaofabrica.export.application; import eapli.base.gestaodepositos.domain.Deposito; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; /** * * @author mdias */ public class XmlDepositoExporter implements ChaoFabricaExporter<Deposito> { private PrintWriter stream; @Override public void begin(String filename) throws IOException { stream = new PrintWriter(new FileWriter(filename)); stream.println("<Depositos>"); } @Override public void element(Deposito d, Date dataI, Date dataF) { stream.println("<Deposito>"); stream.printf("<CodigoDeposito>%s</CodigoDeposito>%n", d.identity()); stream.printf("<Descricao>%s</Descricao>%n", d.descricao()); stream.println("</Deposito>"); } @Override public void elementSeparator() { // nothing to do } @Override public void end() { stream.println("</Depositos>"); stream.close(); } @Override public void cleanup() { if (stream != null) { stream.close(); } } }
24.035714
79
0.64636
0a1425d6e88b9f1a59bf0ad43a7aa9dd97e15ca0
2,779
package com.github.shardingsphere.paper.cornucopia.jdbctest.constants; public class SysbenchConstant { public static String jdbcType = "ss-jdbc"; public static String dbType = "db-type"; public static String jdbcUrl= "jdbc-url"; public static String username = "username"; public static String password = "password"; public static String configFilePath; public static int time; public static int thread; public static String scriptName; public static int tableSize; public static int tables; public static int percentile; public static String distributionTransaction; public static int mergeSortFrom; public static int mergeSortTo; public static boolean useTransaction; public static void initConstants() { jdbcType = System.getProperty("jdbc-type"); configFilePath = System.getProperty("conf"); time = Integer.parseInt(System.getProperty("time")); thread = Integer.parseInt(System.getProperty("thread")); scriptName = System.getProperty("script"); tableSize = Integer.parseInt(System.getProperty("table-size")); tables = Integer.parseInt(System.getProperty("tables")); distributionTransaction = System.getProperty("transaction-mode"); if (null == System.getProperty("percentile") || "".equals(System.getProperty("percentile"))){ percentile = 99; } else { percentile = Integer.parseInt(System.getProperty("percentile")); } if (null != System.getProperty("jdbc-type")) { jdbcType = System.getProperty("jdbc-type"); } if (null == System.getProperty("jdbc-type")) { jdbcType = "ss-jdbc"; } if (null != System.getProperty("jdbc-url")) { jdbcUrl = System.getProperty("jdbc-url"); } if (null != System.getProperty("username")) { username = System.getProperty("username"); } if (null != System.getProperty("password")) { password = System.getProperty("password"); } if (null != System.getProperty("merge-sort-from")) { mergeSortFrom = Integer.parseInt(System.getProperty("merge-sort-from")); } if (null != System.getProperty("merge-sort-to")) { mergeSortTo = Integer.parseInt(System.getProperty("merge-sort-to")); } if (null != System.getProperty("use-transaction")) { useTransaction = Boolean.parseBoolean(System.getProperty("use-transaction")); } if (null != System.getProperty("db-type")) { dbType = System.getProperty("db-type"); } else { dbType = "mysql"; } } }
33.890244
101
0.611731
50b8e58baf50e73e143416012b696de7b5c98a9d
1,145
package com.builtbroken.mffs.api.slots; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; /** * Created by pwaln on 6/3/2016. */ @Deprecated public class BaseSlot<ENTITY extends IInventory> extends Slot { /* The IInventory that will be assigned. */ protected ENTITY inventoryTile; /** * Constructor. * * @param entity The entity * @param slotId The slot id. * @param xPos The Xpossition of the slot. * @param yPos The Y position of the slot. */ public BaseSlot(ENTITY entity, int slotId, int xPos, int yPos) { super(entity, slotId, xPos, yPos); this.inventoryTile = entity; } @Override public boolean isItemValid(ItemStack stack) { return inventoryTile.isItemValidForSlot(this.slotNumber, stack); } public int getSlotStackLimit() { ItemStack stack = inventoryTile.getStackInSlot(this.slotNumber); if (stack != null) { return stack.getMaxStackSize(); } return inventoryTile.getInventoryStackLimit(); } }
24.361702
72
0.651528
7a23270fd884e48134a47b41eacf6a80fd079d17
582
package com.bookstore.saver.domain; import lombok.Data; import javax.persistence.*; @Entity @Data public class UserBilling { @Id @Column(name="b_id") @GeneratedValue(strategy = GenerationType.AUTO) private Long bId; private String userBillingName; private String userBillingStreet1; private String userBillingStreet2; private String userBillingCity; private String userBillingState; private String userBillingCountry; private String userBillingZipcode; @OneToOne(cascade = CascadeType.ALL) private UserPayment userPayment; }
22.384615
51
0.750859
b6fae9709e13f844bbbf1b97279d65ec1d915a71
1,030
package com.foxconn.iot.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import com.foxconn.iot.entity.ApplicationEntity; import com.foxconn.iot.entity.ApplicationVersionEntity; import com.foxconn.iot.entity.ApplicationVersionVo; public interface ApplicationVersionRepository extends JpaRepository<ApplicationVersionEntity, Long> { ApplicationVersionEntity findById(long id); @Query(value = "select new com.foxconn.iot.entity.ApplicationVersionVo(a.id, a.version, a.link, a.details, a.createOn, a.status, a.application.id) from ApplicationVersionEntity a where a.application.id=:appid order by a.createOn desc") List<ApplicationVersionVo> queryByApplication(@Param("appid") long appid); @Query(value = "select a.application from ApplicationVersionEntity a where a.id=:id") ApplicationEntity queryApplicationById(@Param("id") long id); }
44.782609
237
0.8
6f73c7a540001987229456d3446dad736f9cf7c9
1,784
package com.hly.march2.config; import com.hly.march2.interceptor.MyInterceptor1; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; //使用WebMvcConfigurerAdapter可以来扩展SpringMVC的功能 //@EnableWebMvc 不要接管SpringMVC @Configuration public class MyWebMvcConfig implements WebMvcConfigurer { /** * 此方法用来专门注册一个Interceptor,如HandlerInterceptorAdapter * 当spring boot版本升级为2.x时,访问静态资源就会被HandlerInterceptor拦截,网上有很多处理办法都是如下写法 * "/js/**","/css/**","/images/**" * @param registry */ @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new MyInterceptor1()).addPathPatterns("/**") .excludePathPatterns("/editormd/**","/jquery/**","/marked/**","/res/**","/toastr/**","/xss/**"); } /** * 以前要访问一个页面需要先创建个Controller控制类,再写方法跳转到页面 * 在这里配置后就不需要那么麻烦了,直接访问http://localhost:8080/toLogin就跳转到login.jsp页面了 * @param registry */ @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("home"); // registry.addViewController("/login").setViewName("login"); // registry.addViewController("/home").setViewName("home"); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // 将url为 /static/** 的请求映射到 /static/ 路径下进行查找 // registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); } }
39.644444
112
0.729821
5c86a060053ead26b725b35fe95440797f582523
1,320
package com.anop.config; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.csrf.CookieCsrfTokenRepository; import org.springframework.security.web.server.authentication.RedirectServerAuthenticationSuccessHandler; /** * 安全配置类 * * @author Xue_Feng */ @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { private static final String VALID_EMAIL_URL = "/v1/valid_email"; private static final String SUCCESS_FORWARD_URL = "/user"; private static final String FAILURE_FORWARD_URL = "/failed"; @Override protected void configure(HttpSecurity http) throws Exception { http .httpBasic().disable() .authorizeRequests() .anyRequest().authenticated() .and() .cors() .and() .csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) .and() .formLogin() .successForwardUrl(SUCCESS_FORWARD_URL) .failureForwardUrl(FAILURE_FORWARD_URL); } }
34.736842
105
0.724242
a809e89463ff6bb6d4ee02ed4ce5826d0e788822
1,022
package cz.kuzna.android.mvvmdatabinding.donutlist.inject; import android.app.Activity; import java.lang.ref.WeakReference; import cz.kuzna.android.core.inject.D2Module; import cz.kuzna.android.core.inject.scope.ActivityScope; import cz.kuzna.android.mvvmdatabinding.donutlist.ui.DonutListActivity; import cz.kuzna.android.mvvmdatabinding.donutlist.ui.DonutListViewModel; import cz.kuzna.android.mvvmdatabinding.donutlist.ui.DonutsAdapter; import dagger.Module; import dagger.Provides; /** * @author Radek Kuznik */ @Module public class DonutListModule implements D2Module { private WeakReference<Activity> activity; public DonutListModule(Activity activity) { this.activity = new WeakReference<Activity>(activity); } @Provides @ActivityScope DonutsAdapter adapter() { return new DonutsAdapter(); } @Provides @ActivityScope DonutListViewModel viewModel(final DonutsAdapter adapter) { return new DonutListViewModel(activity.get(), adapter); } }
26.205128
72
0.763209
6caa75e85938c65f2404370e6200cf9288c97c24
794
package org.noear.solon.view.jsp; import org.noear.solon.SolonApp; import org.noear.solon.Utils; import org.noear.solon.core.Plugin; import org.noear.solon.core.handle.RenderManager; import org.noear.solon.core.util.PrintUtil; public class XPluginImp implements Plugin { public static boolean output_meta = false; @Override public void start(SolonApp app) { output_meta = app.cfg().getInt("solon.output.meta", 0) > 0; if (Utils.loadClass("javax.servlet.ServletResponse") == null) { PrintUtil.warn("solon: javax.servlet.ServletResponse not exists! JspRender failed to load."); return; } JspRender render = JspRender.global(); RenderManager.register(render); RenderManager.mapping(".jsp", render); } }
29.407407
105
0.686398
4e02c02b2221a6c8eb9d99ba07106e93009eb50e
494
/** */ package aadl2; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>System Classifier</b></em>'. * <!-- end-user-doc --> * * <!-- begin-model-doc --> * <p>From package AADLDetails::Components::System.</p> * <!-- end-model-doc --> * * * @see aadl2.Aadl2Package#getSystemClassifier() * @model abstract="true" * @generated */ public interface SystemClassifier extends ComponentClassifier, aadl2.System, SystemSubcomponentType { } // SystemClassifier
22.454545
101
0.651822
fc468c9d84fa4295d5eef3e53f1bb62cd511d41f
4,226
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.beam.sdk.transforms.reflect; import static org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.errors; import com.google.common.reflect.TypeToken; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.FakeDoFn; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Tests for {@link DoFnSignatures}. */ @RunWith(JUnit4.class) public class DoFnSignaturesTest { @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void testBadExtraContext() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Must take a single argument of type Context"); DoFnSignatures.analyzeBundleMethod( errors(), TypeToken.of(FakeDoFn.class), new DoFnSignaturesTestUtils.AnonymousMethod() { void method(DoFn<Integer, String>.Context c, int n) {} }.getMethod(), TypeToken.of(Integer.class), TypeToken.of(String.class)); } @Test public void testMultipleStartBundleElement() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Found multiple methods annotated with @StartBundle"); thrown.expectMessage("bar()"); thrown.expectMessage("baz()"); thrown.expectMessage(getClass().getName() + "$"); DoFnSignatures.INSTANCE.getOrParseSignature( new DoFn<String, String>() { @ProcessElement public void foo() {} @StartBundle public void bar() {} @StartBundle public void baz() {} }.getClass()); } @Test public void testMultipleFinishBundleMethods() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Found multiple methods annotated with @FinishBundle"); thrown.expectMessage("bar(Context)"); thrown.expectMessage("baz(Context)"); thrown.expectMessage(getClass().getName() + "$"); DoFnSignatures.INSTANCE.getOrParseSignature( new DoFn<String, String>() { @ProcessElement public void foo(ProcessContext context) {} @FinishBundle public void bar(Context context) {} @FinishBundle public void baz(Context context) {} }.getClass()); } @Test public void testPrivateStartBundle() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("startBundle()"); thrown.expectMessage("Must be public"); thrown.expectMessage(getClass().getName() + "$"); DoFnSignatures.INSTANCE.getOrParseSignature( new DoFn<String, String>() { @ProcessElement public void processElement() {} @StartBundle void startBundle() {} }.getClass()); } @Test public void testPrivateFinishBundle() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("finishBundle()"); thrown.expectMessage("Must be public"); thrown.expectMessage(getClass().getName() + "$"); DoFnSignatures.INSTANCE.getOrParseSignature( new DoFn<String, String>() { @ProcessElement public void processElement() {} @FinishBundle void finishBundle() {} }.getClass()); } }
34.080645
84
0.69451
26c1a69a04685fb64178d61988a69d06635a0300
1,348
package com.example.hjiang.gactelphonedemo.util; import com.base.module.call.Conf; import com.base.module.call.StatusChangeListener; import com.base.module.call.line.LineObj; import com.example.hjiang.gactelphonedemo.IStatusChangeListener; import java.util.List; /** * Created by hjiang on 16-1-8. */ public class LineStatusListener extends StatusChangeListener { private IStatusChangeListener iStatusChangeListener; public LineStatusListener(IStatusChangeListener iStatusChangeListener){ this.iStatusChangeListener = iStatusChangeListener; } @Override public void onLineStateChanged(List<LineObj> lines, LineObj line) { iStatusChangeListener.onLineStateChanged(lines,line); } @Override public void onConfStateChanged(Conf conf) { iStatusChangeListener.onConfStateChanged(conf); } @Override public void onStartLineRecord(LineObj lineobj) { iStatusChangeListener.onStartLineRecord(lineobj); } @Override public void onStopLineRecord(LineObj lineobj) { iStatusChangeListener.onStopLineRecord(lineobj); } @Override public void onStartConfRecord(String id) { iStatusChangeListener.onStartConfRecord(id); } @Override public void onStopConfRecord(Conf conf) { iStatusChangeListener.onStopConfRecord(conf); } }
31.348837
75
0.749258
243b04e9d0d0f9f3a49e84091588f0740d511a67
1,866
/* This file was generated by SableCC (http://www.sablecc.org/). */ package compiler.node; import compiler.analysis.*; @SuppressWarnings("nls") public final class AIntConstExpr extends PExpr { private TIntConst _intConst_; public AIntConstExpr() { // Constructor } public AIntConstExpr( @SuppressWarnings("hiding") TIntConst _intConst_) { // Constructor setIntConst(_intConst_); } @Override public Object clone() { return new AIntConstExpr( cloneNode(this._intConst_)); } public void apply(Switch sw) { ((Analysis) sw).caseAIntConstExpr(this); } public TIntConst getIntConst() { return this._intConst_; } public void setIntConst(TIntConst node) { if(this._intConst_ != null) { this._intConst_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._intConst_ = node; } @Override public String toString() { return "" + toString(this._intConst_); } @Override void removeChild(@SuppressWarnings("unused") Node child) { // Remove child if(this._intConst_ == child) { this._intConst_ = null; return; } throw new RuntimeException("Not a child."); } @Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._intConst_ == oldChild) { setIntConst((TIntConst) newChild); return; } throw new RuntimeException("Not a child."); } }
19.642105
107
0.546624
c8586f37992bcd7c2721112dc2a533e1e60416c9
4,632
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: request/group/update_group_request.proto package im.turms.turms.pojo.request.group; public interface UpdateGroupRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:im.turms.proto.UpdateGroupRequest) com.google.protobuf.MessageOrBuilder { /** * <code>int64 group_id = 1;</code> * @return The groupId. */ long getGroupId(); /** * <code>.google.protobuf.StringValue group_name = 2;</code> * @return Whether the groupName field is set. */ boolean hasGroupName(); /** * <code>.google.protobuf.StringValue group_name = 2;</code> * @return The groupName. */ com.google.protobuf.StringValue getGroupName(); /** * <code>.google.protobuf.StringValue group_name = 2;</code> */ com.google.protobuf.StringValueOrBuilder getGroupNameOrBuilder(); /** * <code>.google.protobuf.StringValue intro = 3;</code> * @return Whether the intro field is set. */ boolean hasIntro(); /** * <code>.google.protobuf.StringValue intro = 3;</code> * @return The intro. */ com.google.protobuf.StringValue getIntro(); /** * <code>.google.protobuf.StringValue intro = 3;</code> */ com.google.protobuf.StringValueOrBuilder getIntroOrBuilder(); /** * <code>.google.protobuf.StringValue announcement = 4;</code> * @return Whether the announcement field is set. */ boolean hasAnnouncement(); /** * <code>.google.protobuf.StringValue announcement = 4;</code> * @return The announcement. */ com.google.protobuf.StringValue getAnnouncement(); /** * <code>.google.protobuf.StringValue announcement = 4;</code> */ com.google.protobuf.StringValueOrBuilder getAnnouncementOrBuilder(); /** * <code>.google.protobuf.StringValue profile_picture_url = 5;</code> * @return Whether the profilePictureUrl field is set. */ boolean hasProfilePictureUrl(); /** * <code>.google.protobuf.StringValue profile_picture_url = 5;</code> * @return The profilePictureUrl. */ com.google.protobuf.StringValue getProfilePictureUrl(); /** * <code>.google.protobuf.StringValue profile_picture_url = 5;</code> */ com.google.protobuf.StringValueOrBuilder getProfilePictureUrlOrBuilder(); /** * <code>.google.protobuf.Int32Value minimum_score = 6;</code> * @return Whether the minimumScore field is set. */ boolean hasMinimumScore(); /** * <code>.google.protobuf.Int32Value minimum_score = 6;</code> * @return The minimumScore. */ com.google.protobuf.Int32Value getMinimumScore(); /** * <code>.google.protobuf.Int32Value minimum_score = 6;</code> */ com.google.protobuf.Int32ValueOrBuilder getMinimumScoreOrBuilder(); /** * <code>.google.protobuf.Int64Value group_type_id = 7;</code> * @return Whether the groupTypeId field is set. */ boolean hasGroupTypeId(); /** * <code>.google.protobuf.Int64Value group_type_id = 7;</code> * @return The groupTypeId. */ com.google.protobuf.Int64Value getGroupTypeId(); /** * <code>.google.protobuf.Int64Value group_type_id = 7;</code> */ com.google.protobuf.Int64ValueOrBuilder getGroupTypeIdOrBuilder(); /** * <code>.google.protobuf.Int64Value mute_end_date = 8;</code> * @return Whether the muteEndDate field is set. */ boolean hasMuteEndDate(); /** * <code>.google.protobuf.Int64Value mute_end_date = 8;</code> * @return The muteEndDate. */ com.google.protobuf.Int64Value getMuteEndDate(); /** * <code>.google.protobuf.Int64Value mute_end_date = 8;</code> */ com.google.protobuf.Int64ValueOrBuilder getMuteEndDateOrBuilder(); /** * <code>.google.protobuf.Int64Value successor_id = 9;</code> * @return Whether the successorId field is set. */ boolean hasSuccessorId(); /** * <code>.google.protobuf.Int64Value successor_id = 9;</code> * @return The successorId. */ com.google.protobuf.Int64Value getSuccessorId(); /** * <code>.google.protobuf.Int64Value successor_id = 9;</code> */ com.google.protobuf.Int64ValueOrBuilder getSuccessorIdOrBuilder(); /** * <code>.google.protobuf.BoolValue quit_after_transfer = 10;</code> * @return Whether the quitAfterTransfer field is set. */ boolean hasQuitAfterTransfer(); /** * <code>.google.protobuf.BoolValue quit_after_transfer = 10;</code> * @return The quitAfterTransfer. */ com.google.protobuf.BoolValue getQuitAfterTransfer(); /** * <code>.google.protobuf.BoolValue quit_after_transfer = 10;</code> */ com.google.protobuf.BoolValueOrBuilder getQuitAfterTransferOrBuilder(); }
30.675497
84
0.694085
4d429cebad813545dee60d0b433b0553992e4fc3
1,096
package com.rtsw.openetl.testing.unit.format; import com.rtsw.openetl.agent.common.Configuration; import com.rtsw.openetl.agent.format.CSVFormat; import com.rtsw.openetl.testing.unit.common.Bootstrap; import org.junit.Test; import static org.junit.Assert.assertEquals; /** * @author RT Software Studio */ public class CSVFormatTest { @Test public void testFormat() throws Exception { Configuration configuration = new Configuration(); configuration.set("column_separator", ";"); configuration.set("line_separator", "\n"); configuration.set("header", true); configuration.set("encoding", "UTF-8"); CSVFormat format = new CSVFormat(); format.init(configuration); byte[] head = format.format(Bootstrap.table()); assertEquals(new String(head), "Id;Firstname;Lastname;DateOfBirth;Alive;Weight;Height"); byte[] data = format.format(Bootstrap.table(), Bootstrap.row()); assertEquals(new String(data), "1;John;Doe;Tue Jan 01 00:00:00 EET 1980;true;87.5;180.0"); format.clean(); } }
28.102564
98
0.680657
960336d43062c14f822a1ae6110b15c87f34b88d
5,435
package trycb.service; import static com.couchbase.client.java.kv.LookupInSpec.get; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import com.couchbase.client.core.error.DocumentNotFoundException; import com.couchbase.client.java.Bucket; import com.couchbase.client.java.Cluster; import com.couchbase.client.java.Collection; import com.couchbase.client.java.Scope; import com.couchbase.client.java.kv.LookupInResult; import com.couchbase.client.java.search.SearchOptions; import com.couchbase.client.java.search.SearchQuery; import com.couchbase.client.java.search.queries.ConjunctionQuery; import com.couchbase.client.java.search.result.SearchResult; import com.couchbase.client.java.search.result.SearchRow; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataRetrievalFailureException; import org.springframework.stereotype.Service; import trycb.model.Result; @Service public class Hotel { private static final Logger LOGGER = LoggerFactory.getLogger(Hotel.class); private Bucket bucket; @Autowired public Hotel(Bucket bucket) { this.bucket = bucket; } /** * Search for a hotel in a particular location. */ public Result<List<Map<String, Object>>> findHotels(final Cluster cluster, final String location, final String description) { ConjunctionQuery fts = SearchQuery.conjuncts(SearchQuery.term("hotel").field("type")); if (location != null && !location.isEmpty() && !"*".equals(location)) { fts.and(SearchQuery.disjuncts( SearchQuery.matchPhrase(location).field("country"), SearchQuery.matchPhrase(location).field("city"), SearchQuery.matchPhrase(location).field("state"), SearchQuery.matchPhrase(location).field("address") )); } if (description != null && !description.isEmpty() && !"*".equals(description)) { fts.and(SearchQuery.disjuncts( SearchQuery.matchPhrase(description).field("description"), SearchQuery.matchPhrase(description).field("name") )); } logQuery(fts.export().toString()); SearchOptions opts = SearchOptions.searchOptions().limit(100); SearchResult result = cluster.searchQuery("hotels-index", fts, opts); String queryType = "FTS search - scoped to: inventory.hotel within fields country, city, state, address, name, description"; return Result.of(extractResultOrThrow(result), queryType); } /** * Search for an hotel. */ public Result<List<Map<String, Object>>> findHotels(final Cluster cluster, final String description) { return findHotels(cluster, "*", description); } /** * Find all hotels. */ public Result<List<Map<String, Object>>> findAllHotels(final Cluster cluster) { return findHotels(cluster, "*", "*"); } /** * Extract a FTS result or throw if there is an issue. */ private List<Map<String, Object>> extractResultOrThrow(SearchResult result) { if (result.metaData().metrics().errorPartitionCount() > 0) { LOGGER.warn("Query returned with errors: " + result.metaData().errors()); throw new DataRetrievalFailureException("Query error: " + result.metaData().errors()); } List<Map<String, Object>> content = new ArrayList<Map<String, Object>>(); for (SearchRow row : result.rows()) { LookupInResult res; try { Scope scope = bucket.scope("inventory"); Collection collection = scope.collection("hotel"); res = collection.lookupIn(row.id(), Arrays.asList(get("country"), get("city"), get("state"), get("address"), get("name"), get("description"))); } catch (DocumentNotFoundException ex) { continue; } Map<String, Object> map = new HashMap<String, Object>(); String country = res.contentAs(0, String.class); String city = res.contentAs(1, String.class); String state = res.contentAs(2, String.class); String address = res.contentAs(3, String.class); StringBuilder fullAddr = new StringBuilder(); if (address != null) fullAddr.append(address).append(", "); if (city != null) fullAddr.append(city).append(", "); if (state != null) fullAddr.append(state).append(", "); if (country != null) fullAddr.append(country); if (fullAddr.length() > 2 && fullAddr.charAt(fullAddr.length() - 2) == ',') fullAddr.delete(fullAddr.length() - 2, fullAddr.length() - 1); map.put("name", res.contentAs(4, String.class)); map.put("description", res.contentAs(5, String.class)); map.put("address", fullAddr.toString()); content.add(map); } return content; } /** * Helper method to log the executing query. */ private static void logQuery(String query) { LOGGER.info("Executing FTS Query: {}", query); } }
36.722973
132
0.625759
ac2c9e2f1c77c853cf92670b0762b9011e1d1eec
1,044
package org.satya.intern.java_mail_API; import java.io.IOException; import java.util.Properties; import org.junit.*; import javax.mail.AuthenticationFailedException; import javax.mail.MessagingException; public class TestReceiveMail { static final Properties prop = new Properties(); ReadInbox read_mail = new ReadInbox(); @BeforeClass public static void before() throws IOException { System.out.println("before"); prop.load(new TestReceiveMail().getClass().getClassLoader().getResourceAsStream("config.properties")); } @Test public void testCreateStore () throws MessagingException, IOException { Assert.assertTrue(read_mail.createStore(prop.getProperty("USER_NAME"), prop.getProperty("PASSWORD"))); } @Test(expected=AuthenticationFailedException.class) public void testCreateStorefailedCase () throws MessagingException, IOException { read_mail.createStore(prop.getProperty("USER_NAME"), "wrong_password"); } @AfterClass public static void after() { System.out.println("After"); prop.clear(); } }
27.473684
104
0.769157
ee2de079e7b57ff93b816bf34fd518a1b13c2997
770
package com.hyw.as31try; class TestRepeatData { public static void main(String[] args) { String[] in = {"a", "a", "a"}; String old = ""; for (int i = 0; i < in.length; i++) { System.out.println("input: " + in[i]); try { if (in[i].isEmpty()) { System.out.println(in[i]); continue; } if (old.equals(in[i])) { System.out.println(in[i]); continue; } old = in[i]; System.out.println("old: " + old); }catch (Exception e){ System.out.println(e.getMessage()); } } } }
27.5
52
0.368831
f8c66665b560ef072d914084e4bdaa58f6f41506
501
package org.nuclearzone.myblog.service; import org.nuclearzone.myblog.domain.BlogPost; import org.nuclearzone.myblog.repository.BlogPostRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class BlogPostService extends AbstractBlogService<BlogPost> { @Autowired private BlogPostRepository postRepository; @Override protected BlogPostRepository getRepository() { return postRepository; } }
27.833333
69
0.812375
5d058eb997b2962018e291a251059a23cd451269
2,265
/* * Copyright 2020-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.ifinalframework.spiriter.jdbc.entity; import lombok.Data; import org.ifinalframework.data.annotation.*; import org.ifinalframework.spiriter.jdbc.contants.SchemaConstants; /** * @author likly * @version 1.0.0 * @since 1.0.0 */ @Data @Schema(SchemaConstants.INFORMATION_SCHEMA) @UpperCase public class Columns implements IEntity<Long> { private static final long serialVersionUID = -8388951644802121940L; @PrimaryKey @WriteOnly @Deprecated private Long id; @Column("TABLE_CATALOG") private String catalog; @Column("TABLE_SCHEMA") private String schema; @Column("TABLE_NAME") private String table; @Column("COLUMN_NAME") private String name; @Column("ORDINAL_POSITION") private Integer ordinal; @Column("COLUMN_DEFAULT") private String defaultValue; @Column("IS_NULLABLE") private String nullable; @Column("DATA_TYPE") private String dataType; @Column("CHARACTER_MAXIMUM_LENGTH") private Long characterMaximumLength; @Column("CHARACTER_OCTET_LENGTH") private Long characterOctetLength; @Column("NUMERIC_PRECISION") private Long numericPrecision; @Column("NUMERIC_SCALE") private Long numericScale; @Column("DATETIME_PRECISION") private Long datetimePrecision; @Column("CHARACTER_SET_NAME") private String characterSetName; @Column("COLLATION_NAME") private String collation; @Column("COLUMN_TYPE") private String type; @Column("COLUMN_KEY") private String key; @Column("EXTRA") private String extra; @Column("COLUMN_COMMENT") private String comment; }
28.670886
75
0.723179
32a1014107449c2e1a97e3ce373c4db5d58da59f
1,641
package TD2.jourDeLaSemaine; /******************************************************************************************** * @author JunkJumper * * @license https://creativecommons.org/licenses/by/4.0/ License CC BY 4.0 * * @since File available since 24/05/2020 * ********************************************************************************************/ public class JourSemaine { public final String[] JOURS = {"lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche"}; // 0 1 2 3 4 5 6 public int jour; public JourSemaine() { this(0); } public JourSemaine(int j) { this.setJour(j); } public JourSemaine(String s) { int j; switch (s.toLowerCase()) { case "mardi": j = 1; break; case "mercredi": j = 2; break; case "jeudi": j = 3; break; case "vendredi": j = 4; break; case "samedi": j = 5; break; case "dimanche": j = 6; break; default: j = 0; break; } this.setJour(j); } public String toString() { return this.getJour(this.getNumero()); } public JourSemaine veille() { if(this.getNumero() == 0) { return new JourSemaine(6); } else { return new JourSemaine(this.getNumero()-1); } } public JourSemaine lendemain() { if(this.getNumero() == 6) { return new JourSemaine(0); } else { return new JourSemaine(this.getNumero()+1); } } public int getNumero() { return jour; } public void setJour(int jour) { this.jour = jour; } public String getJour(int i) { return this.JOURS[i]; } }
19.535714
105
0.500305
24c1f2bceb4d904bbe360ddf35f1a05364a4762d
8,753
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved * * The contents of this file is dual-licensed under 2 * alternative Open Source/Free licenses: LGPL 2.1 or later and * Apache License 2.0. (starting with JNA version 4.0.0). * * You can freely decide which license you want to apply to * the project. * * You may obtain a copy of the LGPL License at: * * http://www.gnu.org/licenses/licenses.html * * A copy is also included in the downloadable source code package * containing JNA, in file "LGPL2.1". * * You may obtain a copy of the Apache License at: * * http://www.apache.org/licenses/ * * A copy is also included in the downloadable source code package * containing JNA, in file "AL2.0". */ package com.sun.jna.platform.win32.COM; import com.sun.jna.WString; import com.sun.jna.platform.win32.Guid.IID; import com.sun.jna.platform.win32.Guid.REFIID; import com.sun.jna.platform.win32.OaIdl.DISPID; import com.sun.jna.platform.win32.OaIdl.DISPIDByReference; import com.sun.jna.platform.win32.OaIdl.EXCEPINFO; import com.sun.jna.platform.win32.OleAuto.DISPPARAMS; import com.sun.jna.platform.win32.Variant.VARIANT; import com.sun.jna.platform.win32.WinDef.LCID; import com.sun.jna.platform.win32.WinDef.UINT; import com.sun.jna.platform.win32.WinDef.UINTByReference; import com.sun.jna.platform.win32.WinDef.WORD; import com.sun.jna.platform.win32.WinNT.HRESULT; import com.sun.jna.ptr.IntByReference; import com.sun.jna.ptr.PointerByReference; // TODO: Auto-generated Javadoc /** * Wrapper class for the IDispatch interface * * IDispatch.GetTypeInfoCount 12 IDispatch.GetTypeInfo 16 * IDispatch.GetIDsOfNames 20 IDispatch.Invoke 24 * * @author Tobias Wolf, wolf.tobias@gmx.net */ public interface IDispatch extends IUnknown { public final static IID IID_IDISPATCH = new IID( "00020400-0000-0000-C000-000000000046"); /** * Retrieves the number of type information interfaces that an object provides (either 0 or 1). * * @param pctinfo The number of type information interfaces provided by the object. If the object provides type information, this number is 1; otherwise the number is 0. * @return This method can return one of these values. * S_OK * Success. * E_NOTIMPL * Failure. */ public HRESULT GetTypeInfoCount(UINTByReference pctinfo); /** * Retrieves the type information for an object, which can then be used to get the type information for an interface. * * @param iTInfo The type information to return. Pass 0 to retrieve type information for the IDispatch implementation. * @param lcid The locale identifier for the type information. * An object may be able to return different type information for different languages. This is important * for classes that support localized member names. For classes that do not support localized member names, * this parameter can be ignored. * @param ppTInfo The requested type information object. * @return S_OK * Success. * DISP_E_BADINDEX * The iTInfo parameter was not 0. */ public HRESULT GetTypeInfo(UINT iTInfo, LCID lcid, PointerByReference ppTInfo); /** * Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs, which can be used * on subsequent calls to Invoke. The dispatch function DispGetIDsOfNames provides a standard implementation of GetIDsOfNames. * * @param riid Reserved for future use. Must be IID_NULL. * @param rgszNames The array of names to be mapped. * @param cNames The count of the names to be mapped. * @param lcid The locale context in which to interpret the names. * @param rgDispId Caller-allocated array, each element of which contains an identifier (ID) corresponding to one of the names passed in * the rgszNames array. The first element represents the member name. The subsequent elements represent each of the member's parameters. * @return status of the operation */ public HRESULT GetIDsOfNames(REFIID riid, WString[] rgszNames, int cNames, LCID lcid, DISPIDByReference rgDispId); /** * Provides access to properties and methods exposed by an object. The dispatch function DispInvoke provides a standard implementation of Invoke. * * @param dispIdMember Identifies the member. Use GetIDsOfNames or the object's documentation to obtain the dispatch identifier. * @param riid Reserved for future use. Must be IID_NULL. * @param lcid The locale context in which to interpret arguments. The lcid is used by the GetIDsOfNames function, and is also * passed to Invoke to allow the object to interpret its arguments specific to a locale. * <p/> * Applications that do not support multiple national languages can ignore this parameter. For more information, * refer to Supporting Multiple National Languages and Exposing ActiveX Objects. * @param wFlags Flags describing the context of the Invoke call. * DISPATCH_METHOD * The member is invoked as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag can be set. * DISPATCH_PROPERTYGET * The member is retrieved as a property or data member. * DISPATCH_PROPERTYPUT * The member is changed as a property or data member. * DISPATCH_PROPERTYPUTREF * The member is changed by a reference assignment, rather than a value assignment. This flag is valid only when the property accepts a reference to an object. * @param pDispParams Pointer to a DISPPARAMS structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays. * @param pVarResult Pointer to the location where the result is to be stored, or NULL if the caller expects no result. This argument is ignored if DISPATCH_PROPERTYPUT or DISPATCH_PROPERTYPUTREF is specified. * @param pExcepInfo Pointer to a structure that contains exception information. This structure should be filled in if DISP_E_EXCEPTION is returned. Can be NULL. * @param puArgErr The index within rgvarg of the first argument that has an error. Arguments are stored in pDispParams-&gt;rgvarg in reverse order, * so the first argument is the one with the highest index in the array. This parameter is returned only when the resulting return * value is DISP_E_TYPEMISMATCH or DISP_E_PARAMNOTFOUND. This argument can be set to null. For details, see Returning Errors. * @return This method can return one of these values. * S_OK * Success. * DISP_E_BADPARAMCOUNT * The number of elements provided to DISPPARAMS is different from the number of arguments accepted by the method or property. * DISP_E_BADVARTYPE * One of the arguments in DISPPARAMS is not a valid variant type. * DISP_E_EXCEPTION * The application needs to raise an exception. In this case, the structure passed in pexcepinfo should be filled in. * DISP_E_MEMBERNOTFOUND * The requested member does not exist. * DISP_E_NONAMEDARGS * This implementation of IDispatch does not support named arguments. * DISP_E_OVERFLOW * One of the arguments in DISPPARAMS could not be coerced to the specified type. * DISP_E_PARAMNOTFOUND * One of the parameter IDs does not correspond to a parameter on the method. In this case, puArgErr is set to the first argument that contains the error. * DISP_E_TYPEMISMATCH * One or more of the arguments could not be coerced. The index of the first parameter with the incorrect type within rgvarg is returned in puArgErr. * DISP_E_UNKNOWNINTERFACE * The interface identifier passed in riid is not IID_NULL. * DISP_E_UNKNOWNLCID * The member being invoked interprets string arguments according to the LCID, and the LCID is not recognized. If the LCID is not needed to interpret arguments, this error should not be returned * DISP_E_PARAMNOTOPTIONAL * A required parameter was omitted. */ public HRESULT Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS.ByReference pDispParams, VARIANT.ByReference pVarResult, EXCEPINFO.ByReference pExcepInfo, IntByReference puArgErr); }
56.108974
215
0.708214
14b24ca10f4b272acf6148a49dac902e5afab744
4,068
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.accumulo.examples.combiner; import java.io.IOException; import java.util.Iterator; import java.util.Map; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.Combiner; import org.apache.accumulo.core.iterators.IteratorEnvironment; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; /** * This combiner calculates the max, min, sum, and count of long integers represented as strings in * values. It stores the result in a comma-separated value of the form min,max,sum,count. If such a * value is encountered while combining, its information is incorporated into the running * calculations of min, max, sum, and count. See {@link Combiner} for more information on which * values are combined together. */ public class StatsCombiner extends Combiner { public static final String RADIX_OPTION = "radix"; private int radix = 10; @Override public Value reduce(Key key, Iterator<Value> iter) { long min = Long.MAX_VALUE; long max = Long.MIN_VALUE; long sum = 0; long count = 0; while (iter.hasNext()) { String[] stats = iter.next().toString().split(","); if (stats.length == 1) { long val = Long.parseLong(stats[0], radix); min = Math.min(val, min); max = Math.max(val, max); sum += val; count += 1; } else { min = Math.min(Long.parseLong(stats[0], radix), min); max = Math.max(Long.parseLong(stats[1], radix), max); sum += Long.parseLong(stats[2], radix); count += Long.parseLong(stats[3], radix); } } String ret = Long.toString(min, radix) + "," + Long.toString(max, radix) + "," + Long.toString(sum, radix) + "," + Long.toString(count, radix); return new Value(ret.getBytes()); } @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); if (options.containsKey(RADIX_OPTION)) radix = Integer.parseInt(options.get(RADIX_OPTION)); else radix = 10; } @Override public IteratorOptions describeOptions() { IteratorOptions io = super.describeOptions(); io.setName("statsCombiner"); io.setDescription("Combiner that keeps track of min, max, sum, and count"); io.addNamedOption(RADIX_OPTION, "radix/base of the numbers"); return io; } @Override public boolean validateOptions(Map<String,String> options) { if (!super.validateOptions(options)) return false; if (options.containsKey(RADIX_OPTION) && !options.get(RADIX_OPTION).matches("\\d+")) throw new IllegalArgumentException( "invalid option " + RADIX_OPTION + ":" + options.get(RADIX_OPTION)); return true; } /** * A convenience method for setting the expected base/radix of the numbers * * @param iterConfig * Iterator settings to configure * @param base * The expected base/radix of the numbers. */ public static void setRadix(IteratorSetting iterConfig, int base) { iterConfig.addOption(RADIX_OPTION, base + ""); } }
34.769231
99
0.694444
f55e6a5b173a82db64344facb83acdca899d1482
6,286
package edu.northwestern.bioinformatics.studycalendar.restlets.representations; import edu.northwestern.bioinformatics.studycalendar.core.Fixtures; import edu.northwestern.bioinformatics.studycalendar.domain.Gender; import edu.northwestern.bioinformatics.studycalendar.domain.Subject; import edu.northwestern.bioinformatics.studycalendar.domain.SubjectProperty; import edu.northwestern.bioinformatics.studycalendar.tools.MapBuilder; import gov.nih.nci.cabig.ctms.lang.DateTools; import org.json.JSONArray; import org.json.JSONObject; import java.io.IOException; import java.util.Calendar; import java.util.List; /** * @author Rhett Sutphin */ public class SubjectJsonRepresentationTest extends JsonRepresentationTestCase { private Subject subject; private SubjectJsonRepresentation writeRep; private JSONObject subjectJson; private SubjectJsonRepresentation readRep; @Override protected void setUp() throws Exception { super.setUp(); subject = Fixtures.createSubject("MR1100401003", "Harvey", "Lago", DateTools.createDate(2010, Calendar.APRIL, 1), Gender.UNKNOWN); subject.setGridId("GRID%HL"); writeRep = new SubjectJsonRepresentation(subject, request.getRootRef()); subjectJson = new JSONObject( new MapBuilder<String, Object>(). put("first_name", "Elwood"). put("last_name", "Dowd"). put("person_id", "MR0430507001"). put("birth_date", "1943-05-07"). put("gender", "Male"). toMap() ); subjectJson.put("properties", new JSONArray("[ { 'name': 'Hat size', 'value': '6 3/4' } ]")); readRep = new SubjectJsonRepresentation(subjectJson); } ////// WRITE public void testFirstNamePresent() throws Exception { assertEquals("Harvey", writeAndGetStringField("first_name")); } public void testLastNamePresent() throws Exception { assertEquals("Lago", writeAndGetStringField("last_name")); } public void testFullNamePresent() throws Exception { assertEquals("Harvey Lago", writeAndGetStringField("full_name")); } public void testLastFirstPresent() throws Exception { assertEquals("Lago, Harvey", writeAndGetStringField("last_first")); } public void testBirthDatePresent() throws Exception { assertEquals("2010-04-01", writeAndGetStringField("birth_date")); } public void testGenderPresent() throws Exception { assertEquals("Unknown", writeAndGetStringField("gender")); } public void testJsonSafelyGeneratedWhenGenderNull() throws Exception { subject.setGender(null); assertFalse(writeAndParseObject(writeRep).has("gender")); } public void testPersonIdPresent() throws Exception { assertEquals("MR1100401003", writeAndGetStringField("person_id")); } public void testSubjectIdentifierIsPersonIdWhenSet() throws Exception { assertEquals("MR1100401003", writeAndGetStringField("subject_identifier")); } public void testSubjectIdentifierIsGridIdWhenNoPersonId() throws Exception { subject.setPersonId(null); assertEquals("GRID%HL", writeAndGetStringField("subject_identifier")); } public void testPropertiesEmptyWhenNoProperties() throws Exception { JSONArray actual = writeAndParseObject(writeRep).getJSONArray("properties"); assertNotNull("Missing properties", actual); assertEquals("Properties not empty", 0, actual.length()); } public void testPropertiesPresentWhenSubjectHasThem() throws Exception { subject.getProperties().add(new SubjectProperty("Visible", "no")); subject.getProperties().add(new SubjectProperty("Height", "6 ft")); JSONArray actual = writeAndParseObject(writeRep).getJSONArray("properties"); assertEquals("Wrong number of properties serialized", 2, actual.length()); assertEquals("Wrong 1st prop name", "Visible", actual.getJSONObject(0).getString("name")); assertEquals("Wrong 1st prop value", "no", actual.getJSONObject(0).getString("value")); assertEquals("Wrong 2nd prop name", "Height", actual.getJSONObject(1).getString("name")); assertEquals("Wrong 2nd prop value", "6 ft", actual.getJSONObject(1).getString("value")); } public void testLinkToSchedulesProvided() throws Exception { JSONObject actualHref = writeAndParseObject(writeRep).optJSONObject("href"); assertNotNull("No hyperlinks", actualHref); assertEquals("Wrong schedules ref", ROOT_URI + "/subjects/MR1100401003/schedules", actualHref.getString("schedules")); } public void testLinkToSchedulesUsesGridIdIfNoPersonId() throws Exception { subject.setPersonId(null); JSONObject actualHref = writeAndParseObject(writeRep).optJSONObject("href"); assertNotNull("No hyperlinks", actualHref); assertEquals("Wrong schedules ref", ROOT_URI + "/subjects/GRID%25HL/schedules", actualHref.getString("schedules")); } private String writeAndGetStringField(String field) throws IOException { return writeAndParseObject(writeRep).optString(field); } ////// READ public void testReadsFirstName() throws Exception { assertEquals("Elwood", readRep.getSubject().getFirstName()); } public void testReadsLastName() throws Exception { assertEquals("Dowd", readRep.getSubject().getLastName()); } public void testReadsBirthDate() throws Exception { assertDayOfDate(1943, Calendar.MAY, 7, readRep.getSubject().getDateOfBirth()); } public void testReadsPersonId() throws Exception { assertEquals("MR0430507001", readRep.getSubject().getPersonId()); } public void testReadsGender() throws Exception { assertEquals(Gender.MALE, readRep.getSubject().getGender()); } public void testReadsProperties() throws Exception { List<SubjectProperty> actual = readRep.getSubject().getProperties(); assertEquals(1, actual.size()); assertEquals("Wrong property name", "Hat size", actual.get(0).getName()); assertEquals("Wrong property value", "6 3/4", actual.get(0).getValue()); } }
40.038217
101
0.697741
1acecf8bd44ea1940f63ddc3c98680e1677619fa
1,248
/* * Copyright 2013-2014 S. Webber * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.projog.core.function.compare; import org.projog.core.function.AbstractSingletonPredicate; import org.projog.core.term.Term; import org.projog.core.term.TermComparator; /* TEST %TRUE b@>a %FALSE b@>b %FALSE b@>c %TRUE b@>1 %FALSE b@>b(a) */ /** * <code>X@&gt;Y</code> - term "greater than" test. * <p> * Succeeds when the term argument <code>X</code> is greater than the term argument <code>Y</code>. * </p> */ public final class TermGreaterThan extends AbstractSingletonPredicate { @Override protected boolean evaluate(Term arg1, Term arg2) { return TermComparator.TERM_COMPARATOR.compare(arg1, arg2) > 0; } }
30.439024
99
0.720353
d7bf1a583313ea13fe6970a8ffd1c81ecc10dd2e
398
package com.bjgoodwill.dao.base; import java.util.List; import org.apache.ibatis.annotations.Param; import com.bjgoodwill.entity.TStudent; /** * @author Zhangyichao */ public interface TStudentBaseMapper { int insertTStudent(TStudent object); int updateTStudent(TStudent object); List<TStudent> queryTStudent(TStudent object); TStudent queryTStudentLimit1(TStudent object); }
20.947368
50
0.771357
647bbd366aafe55279647b34cbc623f33a1e0d28
3,970
package tutoraid.model.student; import java.io.IOException; import java.util.ArrayList; import java.util.List; import tutoraid.commons.util.CollectionUtil; import tutoraid.model.lesson.Lesson; /** * Represents a Student in the TutorAid. * Guarantees: details are present and not null, field values are validated, immutable. */ public class InitialStudent { // Identity fields private final StudentName studentName; private final Phone studentPhone; private final ParentName parentName; private final Phone parentPhone; // Data fields private final ProgressList progressList; private final ArrayList<String> lessonNames; /** * Every field must be present and not null. */ public InitialStudent(StudentName studentName, Phone studentPhone, ParentName parentName, Phone parentPhone, ProgressList progressList, ArrayList<String> lessonNames) { CollectionUtil.requireAllNonNull(studentName, studentPhone, parentName, parentPhone, progressList); this.studentName = studentName; this.studentPhone = studentPhone; this.parentName = parentName; this.parentPhone = parentPhone; this.progressList = progressList; this.lessonNames = lessonNames; } /** * Convert an InitialStudent to a Student by creating the dependencies to Lesson objects. * At the same time, Student objects are added to the respective Lesson objects. * * @param fullLessonList A list of available lessons in TutorAid * @return The resulting Student object */ public Student toStudent(List<Lesson> fullLessonList) throws IOException { Lessons lessons = new Lessons(); Student student = new Student(studentName, studentPhone, parentName, parentPhone, progressList, lessons); for (String lessonName : lessonNames) { addStudentLessonLink(lessonName, fullLessonList, lessons, student); } return student; } /** * Finds lessons by a lesson name and creates the dependency between the Lesson object and the Student object. * * @param lessonName The name of the lesson * @param fullLessonList The list of all lessons * @param lessons The lessons object of the Student * @param student The Student object involved in the dependency * @throws IOException if there are too many students in a lesson (over-capacity) */ public void addStudentLessonLink(String lessonName, List<Lesson> fullLessonList, Lessons lessons, Student student) throws IOException { for (Lesson lesson : fullLessonList) { if (lesson.toNameString().equals(lessonName) && lesson.isFull()) { fullLessonList.forEach(Lesson::removeAllStudents); throw new IOException(); } else if (lesson.toNameString().equals(lessonName) && !student.hasLesson(lesson)) { lessons.addLesson(lesson); lesson.addStudent(student); } } } public StudentName getStudentName() { return studentName; } /** * Returns true if both initial students have the same identity and data fields. * This defines a stronger notion of equality between two initial students. */ @Override public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof InitialStudent)) { return false; } InitialStudent otherStudent = (InitialStudent) other; return otherStudent.studentName.equals(studentName) && otherStudent.studentPhone.equals(studentPhone) && otherStudent.parentName.equals(parentName) && otherStudent.parentPhone.equals(parentPhone) && otherStudent.progressList.equals(progressList) && otherStudent.lessonNames.equals(lessonNames); } }
37.45283
118
0.671788
cf83b3b3a9c9a2bff45f562f5c14f0dbb6f544ad
2,547
/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.idea.tests.gui.framework.aspects; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.io.FileUtil; import com.intellij.testGuiFramework.framework.RestartUtilsKt; import java.io.File; import java.io.IOException; import org.jetbrains.annotations.NotNull; import org.junit.rules.TestWatcher; import org.junit.runner.Description; /** * Tries to create a log in GuiTests.getGuiTestRootDirPath()/system/log, and writes the test full name to it when the test starts and when * it finishes. */ public class AspectsAgentLogger extends TestWatcher { private static final Logger LOGGER = Logger.getInstance(AspectsAgentLogger.class); @Override protected void starting(@NotNull Description description) { File aspectsAgentLog = AspectsAgentLogUtil.getAspectsAgentLog(); if (aspectsAgentLog == null) { return; } if (RestartUtilsKt.isFirstRun()) { String testName = String.format("%s.%s", description.getClassName(), description.getMethodName()); try { FileUtil.writeToFile(aspectsAgentLog, String.format("STARTED %s\n", testName), true); } catch (IOException e) { LOGGER.warn(String.format("Error while writing STARTED tag of test %s to aspects agent log.", testName)); } } } @Override protected void finished(@NotNull Description description) { File aspectsAgentLog = AspectsAgentLogUtil.getAspectsAgentLog(); if (aspectsAgentLog == null) { return; } if (RestartUtilsKt.isLastRun()) { String testName = String.format("%s.%s", description.getClassName(), description.getMethodName()); try { FileUtil.writeToFile(aspectsAgentLog, String.format("FINISHED %s\n", testName), true); } catch (IOException e) { LOGGER.warn(String.format("Error while writing FINISHED tag of test %s to aspects agent log.", testName)); } } } }
36.385714
138
0.720063
749c3f52470b2f8d70843e1f73804cc790861ec5
2,064
/* * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.mdm.agent.api; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.wso2.mdm.agent.utils.Constants; import org.wso2.mdm.agent.utils.StreamHandler; import android.util.Log; public class ShellExecutor { private static final String LOG_TAG = ShellExecutor.class.getName(); /** * Executes shell commands on the device. * @param shellCommand - Shell command that needs to be executed. * @return - Shell command response. */ public String executeCommand(String[] shellCommand) { Process shellProcess = null; String response = null; BufferedReader shellInput = null; try { if (shellCommand != null) { shellProcess = Runtime.getRuntime().exec(shellCommand); } } catch (IOException e) { Log.e(LOG_TAG, "Shell command processing failed." + e); } if(shellProcess!=null){ shellInput = new BufferedReader( new InputStreamReader( shellProcess.getInputStream()) ); } try { while (shellInput!=null && (response = shellInput.readLine()) != null) { if (Constants.DEBUG_MODE_ENABLED) { Log.d(LOG_TAG, "Shell Executor Result." + response); } } } catch (IOException e) { Log.e(LOG_TAG, "Shell input processing failed." + e); }finally{ StreamHandler.closeBufferedReader(shellInput, LOG_TAG); } return response; } }
27.891892
75
0.699612
a30cc41ad5815507d5acd9d53b1f3a4ac42d64b5
731
package com.aspose.asposecloudpdf.examples.document; import com.aspose.asposecloudpdf.ApiException; import com.aspose.asposecloudpdf.api.PdfApi; import com.aspose.asposecloudpdf.examples.Common; import com.aspose.asposecloudpdf.model.AsposeResponse; public class PutPageConvertToJPEG { public static void main(String[] args) throws ApiException { PdfApi pdfApi = new PdfApi("XXXXXXXXXXX", "XXXXXXX"); final String name = "4pages.pdf"; Common.uploadFile(pdfApi, name); int pageNumber = 2; final String resultFile = "page.jpeg"; final String outPath = resultFile; AsposeResponse response = pdfApi.putPageConvertToJpeg(name, pageNumber, outPath, null, null, "", null); System.out.print(response.getCode()); } }
31.782609
105
0.772914
47b960652124b9bd36a50f864a5883b5d44df014
909
package com.zyb.mvptest.presenter; import com.zyb.mvptest.contract.IBookContract; import com.zyb.mvptest.contract.IBookContract.IBookView; import com.zyb.mvptest.model.BookModel; import java.util.List; /** * Created by zhangyb on 2017/3/8. */ public class BookPresenter implements IBookContract.IBookPresenter, BookModel.IGetBookResultListener { private IBookView bookView; private BookModel bookModel; public BookPresenter(IBookView view) { bookView = view; bookView.setPresenter(this); bookModel = BookModel.getInstance(); bookModel.setGetBookResultListener(this); } @Override public void getBookList() { bookView.showLoadingDialog(); bookModel.getBookList(); } @Override public void getBookSuccess(List<String> bookList) { bookView.dismissLoadingDialog(); bookView.showBookList(bookList); } }
25.25
102
0.712871
b537be130c6beb2fd58ae675f7be6efbebe13895
575
package org.javaswift.joss.headers.object; import org.apache.http.HttpResponse; import org.javaswift.joss.headers.SimpleHeader; public class ObjectContentType extends SimpleHeader { public static final String CONTENT_TYPE = "Content-Type"; public ObjectContentType(String value) { super(value); } @Override public String getHeaderName() { return CONTENT_TYPE; } public static ObjectContentType fromResponse(HttpResponse response) { return new ObjectContentType(convertResponseHeader(response, CONTENT_TYPE)); } }
25
84
0.737391
41ce027409c0aae23807b5f7bc7701589d557fac
4,750
package com.simibubi.create.foundation.render.effects; import java.util.ArrayList; import javax.annotation.Nullable; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL30; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.FullscreenQuad; import com.jozufozu.flywheel.util.RenderUtil; import com.simibubi.create.foundation.render.AllProgramSpecs; import com.simibubi.create.foundation.render.CreateContexts; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.shader.Framebuffer; import net.minecraft.client.shader.FramebufferConstants; import net.minecraft.util.math.vector.Matrix4f; import net.minecraft.util.math.vector.Vector3d; public class EffectsHandler { private static EffectsHandler instance; @Nullable public static EffectsHandler getInstance() { if (Backend.getInstance().available() && instance == null) { instance = new EffectsHandler(Backend.getInstance()); } if (!Backend.getInstance().available() && instance != null) { instance.delete(); instance = null; } return instance; } public static float getNearPlane() { return 0.05f; } public static float getFarPlane() { return Minecraft.getInstance().gameRenderer.getFarPlaneDistance() * 4; } private final Backend backend; private final Framebuffer framebuffer; private final ArrayList<FilterSphere> spheres; public EffectsHandler(Backend backend) { this.backend = backend; spheres = new ArrayList<>(); Framebuffer render = Minecraft.getInstance().getFramebuffer(); framebuffer = new Framebuffer(render.framebufferWidth, render.framebufferHeight, false, Minecraft.IS_RUNNING_ON_MAC); } public void addSphere(FilterSphere sphere) { this.spheres.add(sphere); } public void render(Matrix4f view) { if (spheres.size() == 0) { return; } GL20.glEnable(GL20.GL_DEPTH_TEST); GL20.glDepthRange(getNearPlane(), getFarPlane()); prepFramebufferSize(); Framebuffer mainBuffer = Minecraft.getInstance().getFramebuffer(); backend.compat.fbo.bindFramebuffer(FramebufferConstants.FRAME_BUFFER, framebuffer.framebufferObject); GL11.glClear(GL30.GL_COLOR_BUFFER_BIT); SphereFilterProgram program = CreateContexts.EFFECTS.getProgram(AllProgramSpecs.CHROMATIC); program.bind(); program.bindColorTexture(mainBuffer.getColorAttachment()); program.bindDepthTexture(mainBuffer.getDepthAttachment()); GameRenderer gameRenderer = Minecraft.getInstance().gameRenderer; ActiveRenderInfo activeRenderInfo = gameRenderer.getActiveRenderInfo(); Matrix4f projection = gameRenderer.getBasicProjectionMatrix(activeRenderInfo, AnimationTickHolder.getPartialTicks(), true); projection.a33 = 1; projection.invert(); program.bindInverseProjection(projection); Matrix4f inverseView = view.copy(); inverseView.invert(); program.bindInverseView(inverseView); Vector3d cameraPos = activeRenderInfo.getProjectedView(); program.setCameraPos(cameraPos.inverse()); for (FilterSphere sphere : spheres) { sphere.x -= cameraPos.x; sphere.y -= cameraPos.y; sphere.z -= cameraPos.z; } spheres.sort((o1, o2) -> { double l1 = RenderUtil.length(o1.x, o1.y, o1.z); double l2 = RenderUtil.length(o2.x, o2.y, o2.z); return (int) Math.signum(l2 - l1); }); program.uploadFilters(spheres); program.setFarPlane(getFarPlane()); program.setNearPlane(getNearPlane()); FullscreenQuad.INSTANCE.get().draw(); program.bindColorTexture(0); program.bindDepthTexture(0); GL20.glActiveTexture(GL20.GL_TEXTURE0); program.unbind(); spheres.clear(); backend.compat.fbo.bindFramebuffer(GL30.GL_READ_FRAMEBUFFER, framebuffer.framebufferObject); backend.compat.fbo.bindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, mainBuffer.framebufferObject); backend.compat.blit.blitFramebuffer(0, 0, mainBuffer.framebufferWidth, mainBuffer.framebufferHeight, 0, 0, mainBuffer.framebufferWidth, mainBuffer.framebufferHeight, GL30.GL_COLOR_BUFFER_BIT, GL20.GL_LINEAR); backend.compat.fbo.bindFramebuffer(FramebufferConstants.FRAME_BUFFER, mainBuffer.framebufferObject); } public void delete() { framebuffer.deleteFramebuffer(); } private void prepFramebufferSize() { MainWindow window = Minecraft.getInstance().getWindow(); if (framebuffer.framebufferWidth != window.getFramebufferWidth() || framebuffer.framebufferHeight != window.getFramebufferHeight()) { framebuffer.func_216491_a(window.getFramebufferWidth(), window.getFramebufferHeight(), Minecraft.IS_RUNNING_ON_MAC); } } }
31.25
210
0.777474
14a66a7f77e3a14b98d9ec4e60ce7519ba7c79ca
5,327
package mage.cards.n; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.Cards; import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.PermanentCard; import mage.game.stack.Spell; import mage.players.Player; /** * * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public final class NephaliaAcademy extends CardImpl { public NephaliaAcademy(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.LAND},""); // If a spell or ability an opponent controls causes you to discard a card, you may reveal that card and put it on top of your library instead of putting it anywhere else. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NephaliaAcademyEffect())); // {T}: Add {C}. this.addAbility(new ColorlessManaAbility()); } private NephaliaAcademy(final NephaliaAcademy card) { super(card); } @Override public NephaliaAcademy copy() { return new NephaliaAcademy(this); } } class NephaliaAcademyEffect extends ReplacementEffectImpl { private UUID cardId; private int zoneChangeCounter; public NephaliaAcademyEffect() { super(Duration.WhileOnBattlefield, Outcome.Benefit); staticText = "If a spell or ability an opponent controls causes you to discard a card, you may reveal that card and put it on top of your library instead of putting it anywhere else."; } public NephaliaAcademyEffect(final NephaliaAcademyEffect effect) { super(effect); this.cardId = effect.cardId; this.zoneChangeCounter = effect.zoneChangeCounter; } @Override public NephaliaAcademyEffect copy() { return new NephaliaAcademyEffect(this); } @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DISCARD_CARD || event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == GameEvent.EventType.DISCARD_CARD) { return event.getPlayerId().equals(source.getControllerId()); } if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { if (event.getTargetId().equals(cardId) && game.getState().getZoneChangeCounter(event.getTargetId()) == zoneChangeCounter) { if (((ZoneChangeEvent) event).getFromZone() == Zone.HAND && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) { return true; } } } return false; } @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { if (event.getType() == GameEvent.EventType.DISCARD_CARD) { // only save card info if it's an opponent effect Card card = game.getCard(event.getTargetId()); if (card != null) { boolean isAnOpponentEffect = false; MageObject object = game.getObject(event.getSourceId()); if (object instanceof PermanentCard) { isAnOpponentEffect = game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId()); } else if (object instanceof Spell) { isAnOpponentEffect = game.getOpponents(source.getControllerId()).contains(((Spell) object).getControllerId()); } else if (object instanceof Card) { isAnOpponentEffect = game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId()); } if (isAnOpponentEffect) { cardId = card.getId(); zoneChangeCounter = game.getState().getZoneChangeCounter(cardId); } } return false; } if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { Player controller = game.getPlayer(source.getControllerId()); Card card = game.getCard(event.getTargetId()); if (controller != null && card != null) { cardId = null; zoneChangeCounter = 0; if (controller.chooseUse(outcome, "Put " + card.getIdName() + " on top of your library instead?", source, game)) { Cards cardsToLibrary = new CardsImpl(card); // reveal the card then put it on top of your library controller.revealCards(card.getName(), cardsToLibrary, game); controller.putCardsOnTopOfLibrary(cardsToLibrary, game, source, false); return true; } } } return false; } }
38.601449
192
0.639009
b3efd51bb474b543a8c714a44cc336f3500f3721
278
package de.adorsys.xs2a.adapter.service.psd2.model; public class ScaStatusResponse { private String scaStatus; public String getScaStatus() { return scaStatus; } public void setScaStatus(String scaStatus) { this.scaStatus = scaStatus; } }
19.857143
51
0.68705
03e2dfff68f849ae569287617d75bc8040cbce15
305
package io.micronaut.data.hibernate; import io.micronaut.data.annotation.Repository; import io.micronaut.data.hibernate.entities.EventTest; import io.micronaut.data.repository.CrudRepository; import java.util.UUID; @Repository public interface EventTestRepo extends CrudRepository<EventTest, Long> { }
25.416667
72
0.832787
7e473718b11a69becf93b01ecef8064fee5c5585
1,087
package moze_intel.projecte.integration.crafttweaker; import com.blamejared.crafttweaker.api.CraftTweakerAPI; import com.blamejared.crafttweaker.impl.entity.MCEntityType; import moze_intel.projecte.utils.EntityRandomizerHelper; import net.minecraft.entity.EntityType; import net.minecraft.entity.MobEntity; public class CraftTweakerHelper { public static boolean checkNonNull(Object value, String message) { if (value == null) { CraftTweakerAPI.logError(message); return false; } return true; } public static boolean validateEMC(long emc) { if (emc < 0) { CraftTweakerAPI.logError("EMC cannot be set to a negative number."); return false; } return true; } public static EntityType<? extends MobEntity> getMob(MCEntityType entityType) { return entityType == null ? null : EntityRandomizerHelper.getEntityIfMob(entityType.getInternal()); } public static boolean isMob(EntityType<? extends MobEntity> living) { if (living == null) { CraftTweakerAPI.logError("MCEntityType must be of a valid mob entity."); return false; } return true; } }
28.605263
101
0.75989
52df61cb19ae77849a7e6fff720a1d5c2d680cc0
3,708
package nl.esi.metis.aisparser.impl; import nl.esi.metis.aisparser.AISMessage10; import nl.esi.metis.aisparser.Sixbit; import nl.esi.metis.aisparser.UtilsSpare; /** ESI AIS Parser * * Copyright 2011/2012 by Pierre van de Laar (Embedded Systems Institute) * Copyright 2008 by Brian C. Lane <bcl@brianlane.com> * All Rights Reserved * * @author Pierre van de Laar * @author Brian C. Lane */ import nl.esi.metis.aisparser.annotations.AISIllegalValueAnnotation; import nl.esi.metis.aisparser.provenance.VDMMessageProvenance; /** AIS Message 10 * UTC and date inquiry * * Field Nr Field Name NrOf Bits (from, to ) * ------------------------------------------------------------------------ * 1 messageID 6 ( 1, 6) * 2 repeatIndicator 2 ( 7, 8) * 3 userID 30 ( 9, 38) * 4 spare1 2 ( 39, 40) * 5 destinationID 30 ( 41, 70) * 6 spare2 2 ( 71, 72) * ---- + * (maximum) number of bits 72 */ class AISMessage10Impl extends AISMessageImpl implements AISMessage10 { private static final int LENGTH = 72; public static boolean validLength(int length) { return length == LENGTH; } /** * Return the difference in available and needed bits to parse this sixbit as an AISMessage * A positive difference indicates that there are more bits available than needed by the standard. * @param sb * @return */ public static int differenceInBits(Sixbit sb) { return (sb.available() - LENGTH); } private static final int SPARE1_FROM = 39; private static final int SPARE1_TO = 40; private int spare1; /** spare1 * @return int value of spare1 (2 bits [39,40]) */ public int getSpare1() { return spare1; } private static final int DESTINATIONID_FROM = 41; private static final int DESTINATIONID_TO = 70; private int destinationID; /** destinationID * @return int value of destinationID (30 bits [41,70]) */ public int getDestinationID() { return destinationID; } private static final int SPARE2_FROM = 71; private static final int SPARE2_TO = 72; private int spare2; /** spare2 * @return int value of spare2 (2 bits [71,72]) */ public int getSpare2() { return spare2; } /** AISMessage 10 constructor * @param content AIS content * @param prov the provenance of the message * @precondition validLength(content.length()) && AISMessageBase.getMessageId(content)==10 */ public AISMessage10Impl(Sixbit content, VDMMessageProvenance prov) { super(content, prov); assert(validLength(content.length())); assert(getMessageID() == 10); spare1 = content.getIntFromTo(SPARE1_FROM,SPARE1_TO); if (!UtilsSpare.isSpareSemanticallyCorrect(spare1)) { annotations.add(new AISIllegalValueAnnotation("getSpare1", spare1, UtilsSpare.range)); } destinationID = content.getIntFromTo(DESTINATIONID_FROM,DESTINATIONID_TO); spare2 = content.getIntFromTo(SPARE2_FROM,SPARE2_TO); if (!UtilsSpare.isSpareSemanticallyCorrect(spare2)) { annotations.add(new AISIllegalValueAnnotation("getSpare2", spare2, UtilsSpare.range)); } } /** Generates a String representing the AIS message. * Format: all fields are shown in the order as specified by the standard separated by the SEPARATOR string. */ @Override public String toString() { return super.toString() + SEPARATOR + Integer.toString(getDestinationID()); } }
33.107143
109
0.62945
94aaa4b32c2372670e2243800da13ce63b50c192
485
package iti.suitceyes.listeners; import java.util.Observable; import java.util.Observer; public class MyObserver implements Observer{ public void observe(Observable o) { o.addObserver(this); } @Override public void update(Observable o, Object arg) { int someVariable = ((MessageBin) o).getSomeVariable(); System.out.println("Some variable is now " + someVariable); } public static void main(String[] args) { // TODO Auto-generated method stub } }
18.653846
64
0.709278
9da629d3ac2daf875a2d42e06917d64260e00024
4,489
package org.codemucker.jmutate.generate.matcher; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.codemucker.jfind.ClassFilter; import org.codemucker.jfind.ClassScanner; import org.codemucker.jfind.FindResult; import org.codemucker.jfind.Root; import org.codemucker.jfind.matcher.AClass; import org.codemucker.jfind.matcher.ARoot; import org.codemucker.jfind.matcher.ARootResource; import org.codemucker.jmatch.AString; import org.codemucker.jmatch.Matcher; import org.codemucker.jmutate.ResourceLoader; import org.codemucker.jmutate.SourceFilter; import org.codemucker.jmutate.SourceScanner; import org.codemucker.jmutate.ast.JType; import org.codemucker.jmutate.ast.matcher.AJType; import com.google.common.base.Strings; /** * Scans for sources and compiled classes. Allows for scanning of current project sources and third party compiled libs */ public class PojoSourceAndClassScanner { private static final Logger log = LogManager.getLogger(PojoSourceAndClassScanner.class); private final ResourceLoader resourceLoader; private final Matcher<Root> scanRootMatcher; private final Matcher<String> scanForClassNameMatcher; private final Matcher<Class<?>> scanForClasses; private final Matcher<JType> scanForTypes; public PojoSourceAndClassScanner(ResourceLoader resourceLoader,String dependenciesExpression,String pojoNameExpression, String pojoClassExpression) { this.resourceLoader = resourceLoader; this.scanRootMatcher = ARoot.with().dependenciesExpression(dependenciesExpression); this.scanForClassNameMatcher = AString.matchingExpression(pojoNameExpression); this.scanForClasses = AClass.with().fullName(scanForClassNameMatcher).expression(pojoClassExpression); this.scanForTypes= AJType.with().fullName(scanForClassNameMatcher).expression(pojoClassExpression); if(log.isDebugEnabled()){ log.debug(" looking for classes in:"); log.debug(" pojoDependencies: " + (Strings.isNullOrEmpty(dependenciesExpression)?"<any>":dependenciesExpression)); log.debug(" pojoNames: " + (Strings.isNullOrEmpty(pojoNameExpression)?"<any>":pojoNameExpression)); log.debug(" pojoClassExpression: " + (Strings.isNullOrEmpty(pojoClassExpression)?"<any>":pojoClassExpression)); log.debug(" pojoNameMatcher : " + scanForClassNameMatcher); log.debug(" pojoClassMatcher : " + scanForClasses); log.debug(" pojoTypeMatcher : " + scanForTypes); log.debug("scanning for pojos in roots:"); for(Root root:resourceLoader.getAllRoots()){ if(scanRootMatcher.matches(root)){ log.debug("INCLUDE " + root); } } //log.debug("ignored roots:"); for(Root root:resourceLoader.getAllRoots()){ if(!scanRootMatcher.matches(root)){ log.debug("EXCLUDE " + root); } } } } public FindResult<Class<?>> scanForReflectedClasses(){ log.debug("scanning for compiled pojos"); FindResult<Class<?>> results = ClassScanner.with() .scanRoots(resourceLoader.getAllRoots()) .classLoader(resourceLoader.getClassLoader()) .filter(ClassFilter.where() .rootMatches(scanRootMatcher) .resourceMatches(ARootResource.with().className(scanForClassNameMatcher)) .classMatches(scanForClasses)) .build() .findClasses(); log.debug("found: " + results.toList().size() + " compiled pojos"); return results; } public FindResult<JType> scanSources() { log.debug("scanning for source pojos"); FindResult<JType> results = SourceScanner.with() .scanRoots(resourceLoader.getAllRoots()) .filter(SourceFilter.where() .rootMatches(scanRootMatcher) .resourceMatches(ARootResource.with().className(scanForClassNameMatcher)) .typeMatches(scanForTypes)) .build() .findTypes(); log.debug("found: " + results.toList().size() + " source pojos"); return results; } }
46.278351
154
0.646915
754d9894bce5bdbbdf04b80f49f512258aa31281
84
/** * Spring MVC REST controllers. */ package ar.com.dtabares.jexpenses.web.rest;
16.8
43
0.714286
66a5d8b80188559ae80fa51296f9eaf27217b67a
9,236
package com.thinkgem.jeesite.modules.export.service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.thinkgem.jeesite.common.service.CrudService; import com.thinkgem.jeesite.common.utils.DateUtils; import com.thinkgem.jeesite.modules.export.dao.ExportDao; import com.thinkgem.jeesite.modules.export.entity.ChirldFileStatistics; import com.thinkgem.jeesite.modules.export.entity.Export; import com.thinkgem.jeesite.modules.export.entity.ExportChildhelp; import com.thinkgem.jeesite.modules.export.entity.ExportTeo; import com.thinkgem.jeesite.modules.export.entity.HepatitisBSchedule; import com.thinkgem.jeesite.modules.export.entity.MonthlyReportOnVaccConsumption; @Service @Transactional(readOnly = true) public class ExportService extends CrudService<ExportDao, ExportChildhelp> { @Autowired ExportDao dao; /** * 二类疫苗统计表 * @author zhouqj * @date 2017年5月5日 下午5:58:13 * @description * @param export * @return * */ public List<ExportTeo> twoCategoriesOfVaccStatistics(ExportTeo export) { return dao.twoCategoriesOfVaccStatistics(export); } /** * 接种乙肝明细表 * @author wangdedi * @date 2017年5月5日 下午5:03:17 * @description * @param hepatitisBSchedule * @return * */ public List<HepatitisBSchedule> hepatitisBSchedule(Export export) { return dao.hepatitisBSchedule(export); } /** * 疫苗消耗日报 * @author wangdedi * @date 2017年5月5日 下午7:04:35 * @description * @param export * @return * */ public List<MonthlyReportOnVaccConsumption> monthlyReportOnVaccConsumption(Export export) { return dao.monthlyReportOnVaccConsumption(export); } /** * 查询所有的社区 * @author xuejinshan * @date 2017年9月11日 下午8:21:50 * @description * @return * */ public List<HashMap<String, String>> findAllshequ() { return dao.findAllshequ(); } /** * 查询儿童建卡及时率 * @author xuejinshan * @date 2017年9月12日 下午2:38:45 * @description * @param map * @return * */ public List<HashMap<String, String>> findCard_in_time(HashMap<String, Object> map) { return dao.findCard_in_time(map); } /** * 按居住 类型查询建卡数 儿童建卡查询 * @author xuejinshan * @date 2017年9月13日 上午11:11:42 * @description * @param map * @return * */ public List<HashMap<String, String>> findCard_num(HashMap<String, Object> map) { return dao.findCard_num(map); } /** * 按在册情况 查询儿童加卡数 * @author xuejinshan * @date 2017年9月13日 下午12:27:05 * @description * @param map * @return * */ public List<HashMap<String, String>> findCard_num2(HashMap<String, Object> map) { return dao.findCard_num2(map); } /** * 统计儿童基本信息完整性 * @author xuejinshan * @date 2017年9月14日 下午2:47:48 * @description * @param chirldFileStatistics * @return * */ public List<HashMap<String, Object>> findChirld_baseInfo_integrity(ChirldFileStatistics chirldFileStatistics) { return dao.findChirld_baseInfo_integrity(chirldFileStatistics); } public List<HashMap<String, Object>> manageFindChirld_baseInfo_integrity(ChirldFileStatistics chirldFileStatistics) { List<HashMap<String, Object>> temps=findChirld_baseInfo_integrity(chirldFileStatistics); for(HashMap<String, Object> map:temps){ map.put("nianfen", DateUtils.formatDate(DateUtils.parseDate(map.get("nianfen")), "yyyy-MM-dd")); } return temps; } /** * 统计儿童基础档案完整性时 同时查询儿童基本信息, * @author xuejinshan * @date 2017年9月15日 下午4:05:47 * @description * @param chirldFileStatistics * @return * */ public List<HashMap<String, Object>> findChirld_baseInfo(ChirldFileStatistics chirldFileStatistics) { return dao.findChirld_baseInfo(chirldFileStatistics); } /** * 查询儿童接种几录完整性 * @author xuejinshan * @date 2017年9月16日 下午1:53:18 * @description * @param chirldFileStatistics * @return * */ public List<HashMap<String, Object>> findChirld_vaccnum_integrity(ChirldFileStatistics chirldFileStatistics) { return dao.findChirld_vaccnum_integrity(chirldFileStatistics); } /** * 查询儿童接种记录完整性 的同时查询一些接种记录的相关的信息 * @author xuejinshan * @date 2017年9月16日 下午1:57:29 * @description * @param chirldFileStatistics * @return * */ public List<HashMap<String, Object>> findChirld_vaccnumInfo(ChirldFileStatistics chirldFileStatistics) { return dao.findChirld_vaccnumInfo(chirldFileStatistics); } /** * 查询去年出生人数 和总人数 * @author xuejinshan * @date 2017年9月4日 下午3:10:48 * @description * @param exportChildhelp * @return * */ public ExportChildhelp findNewAndAll311(ExportChildhelp exportChildhelp){ return dao.findNewAndAll311(exportChildhelp); } /** * 常规3-1-1统计 * @author xuejinshan * @date 2017年9月16日 下午8:55:58 * @description * @param exportChildhelp * @return * */ public List<HashMap<String, Object>> selectVaccData311_(ExportChildhelp exportChildhelp) { return dao.selectVaccData311_(exportChildhelp); } /** * 常规3-1-2统计 * @author zhouqj * @date 2017年9月19日 下午3:08:50 * @description * @param exportChildhelp * @return * */ public List<HashMap<String, Object>> selectVaccData312_(ExportChildhelp exportChildhelp) { return dao.selectVaccData312_(exportChildhelp); } /** * 常规3-1-2的数据分类 * @author zhouqj * @date 2017年9月19日 下午3:14:13 * @description * @param exportChildhelp * @return * */ public List<List<HashMap<String, Object>>> manageVaccData312_(ExportChildhelp exportChildhelp){ List<HashMap<String, Object>> datalist = selectVaccData312_(exportChildhelp); return manageVaccDataHelp_(datalist); } /** * 常规3-1-3统计 * @author zhouqj * @date 2017年9月19日 下午3:08:50 * @description * @param exportChildhelp * @return * */ public List<HashMap<String, Object>> selectVaccData313_(ExportChildhelp exportChildhelp) { return dao.selectVaccData313_(exportChildhelp); } /** * 常规3-1-3的数据分类 * @author zhouqj * @date 2017年9月19日 下午3:14:13 * @description * @param exportChildhelp * @return * */ public List<List<HashMap<String, Object>>> manageVaccData313_(ExportChildhelp exportChildhelp){ List<HashMap<String, Object>> datalist = selectVaccData313_(exportChildhelp); return manageVaccDataHelp_(datalist); } /** * 常规3-1-4统计 * @author zhouqj * @date 2017年9月19日 下午6:43:10 * @description * @param exportChildhelp * @return * */ public List<HashMap<String, Object>> selectVaccData314_(ExportChildhelp exportChildhelp){ return dao.selectVaccData314_(exportChildhelp); } /** * 常规3-1-4的数据分类 * @author zhouqj * @date 2017年9月19日 下午6:43:10 * @description * @param exportChildhelp * @return * */ public List<List<HashMap<String, Object>>> manageVaccData314_(ExportChildhelp exportChildhelp){ List<HashMap<String, Object>> datalist = selectVaccData314_(exportChildhelp); return manageVaccDataHelp_(datalist); } /** * 常规3-1-5统计 * @author zhouqj * @date 2017年9月19日 下午6:43:10 * @description * @param exportChildhelp * @return * */ public List<HashMap<String, Object>> selectVaccData315_(ExportChildhelp exportChildhelp){ return dao.selectVaccData315_(exportChildhelp); } /** * 常规3-1-5的数据分类 * @author zhouqj * @date 2017年9月19日 下午6:43:10 * @description * @param exportChildhelp * @return * */ public List<List<HashMap<String, Object>>> manageVaccData315_(ExportChildhelp exportChildhelp){ List<HashMap<String, Object>> datalist = selectVaccData315_(exportChildhelp); return manageVaccDataHelp_(datalist); } /** * manageVaccData处理方法 即封装双层的list集合 * @author xuejinshan * @date 2017年8月31日 下午7:06:18 * @description * @param exportChildhelp * @return * */ public List<List<HashMap<String, Object>>> manageVaccDataHelp_(List<HashMap<String, Object>> datalist){ List<List<HashMap<String, Object>>> returnlist = new ArrayList<List<HashMap<String, Object>>>(); List<HashMap<String, Object>> tempList = new ArrayList<HashMap<String, Object>>(); if(datalist != null && datalist.size() > 0){ for(int i=1;i<=(datalist.size()/25);i++){ tempList.addAll(datalist.subList((i-1)*25, i*25)); returnlist.add(tempList); tempList = new ArrayList<HashMap<String, Object>>(); } tempList.addAll(datalist.subList(datalist.size()-datalist.size()%25, datalist.size())); returnlist.add(tempList); tempList = new ArrayList<HashMap<String, Object>>(); }else{ return new ArrayList<List<HashMap<String, Object>>>(); } return returnlist; } /*计算并保存常规接种(3-1-1)数据开始*/ /** * 常规接种(3-1-1)数据初始化 暂时未用到 * @author Jack * @date 2017年11月1日 下午7:26:01 * @description * 卡介苗 0101 * 脊灰(减毒二倍体) 0301 * 百白破 0401 * 白破 0601 * 乙肝(酿酒酵母) 0202 * 麻疹 0901 * 乙脑(灭活) 1803 * 风疹(二倍体) 1101 * 腮腺炎 1001 * 流脑A 1601 */ // public void initRoutine3_1_1(){ // // } /** * 查询报表3-1-1数据 暂时未用到 * @author Jack * @date 2017年11月3日 下午5:12:02 * @description * @param startDate * @param endDate * @return * */ public List<HashMap<String, String>> selectRoutine3_1_1(String startDate, String endDate){ return dao.selectRoutine3_1_1(startDate, endDate); } /*计算并保存常规接种(3-1-1)数据结束*/ }
24.433862
118
0.711455
3d11eb6c2583c0491b60e7d379c3551459f8d579
559
package com.xhh.demo.http.mock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * mock 测试准备类 * * @author tiger * @version 1.0.0 createTime: 14/12/27 下午8:57 * @see com.xhh.demo.http.mock.OrderHelper * @since 1.6 */ @Component public class OrderCreate { @Autowired private OrderHelper orderHelper; public void create() { System.out.println(getAmt()); System.out.println(orderHelper.resolve()); } public int getAmt() { return 10; } }
19.275862
62
0.674419
21dd60668fe934d88ead7d778b3afd535e1c3c77
4,132
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.authorization.fluent.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** Defines values for ServicePrincipalsOrderby. */ public final class ServicePrincipalsOrderby extends ExpandableStringEnum<ServicePrincipalsOrderby> { /** Static value id for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby ID = fromString("id"); /** Static value id desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby ID_DESC = fromString("id desc"); /** Static value deletedDateTime for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby DELETED_DATE_TIME = fromString("deletedDateTime"); /** Static value deletedDateTime desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby DELETED_DATE_TIME_DESC = fromString("deletedDateTime desc"); /** Static value appRoleId for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby APP_ROLE_ID = fromString("appRoleId"); /** Static value appRoleId desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby APP_ROLE_ID_DESC = fromString("appRoleId desc"); /** Static value createdDateTime for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby CREATED_DATE_TIME = fromString("createdDateTime"); /** Static value createdDateTime desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby CREATED_DATE_TIME_DESC = fromString("createdDateTime desc"); /** Static value principalDisplayName for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby PRINCIPAL_DISPLAY_NAME = fromString("principalDisplayName"); /** Static value principalDisplayName desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby PRINCIPAL_DISPLAY_NAME_DESC = fromString("principalDisplayName desc"); /** Static value principalId for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby PRINCIPAL_ID = fromString("principalId"); /** Static value principalId desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby PRINCIPAL_ID_DESC = fromString("principalId desc"); /** Static value principalType for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby PRINCIPAL_TYPE = fromString("principalType"); /** Static value principalType desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby PRINCIPAL_TYPE_DESC = fromString("principalType desc"); /** Static value resourceDisplayName for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby RESOURCE_DISPLAY_NAME = fromString("resourceDisplayName"); /** Static value resourceDisplayName desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby RESOURCE_DISPLAY_NAME_DESC = fromString("resourceDisplayName desc"); /** Static value resourceId for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby RESOURCE_ID = fromString("resourceId"); /** Static value resourceId desc for ServicePrincipalsOrderby. */ public static final ServicePrincipalsOrderby RESOURCE_ID_DESC = fromString("resourceId desc"); /** * Creates or finds a ServicePrincipalsOrderby from its string representation. * * @param name a name to look for. * @return the corresponding ServicePrincipalsOrderby. */ @JsonCreator public static ServicePrincipalsOrderby fromString(String name) { return fromString(name, ServicePrincipalsOrderby.class); } /** @return known ServicePrincipalsOrderby values. */ public static Collection<ServicePrincipalsOrderby> values() { return values(ServicePrincipalsOrderby.class); } }
49.783133
119
0.781946
be4710893b27c9b2d3c8f222cdfa855f08008b83
3,233
package com.jim.framework.web.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.core.*; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; /** * Created by jiang on 2017/2/18. */ //@Configuration public class RabbitMQConfig { protected Logger logger = LoggerFactory.getLogger(getClass().getName()); @Value("${mq.rabbit.host}") private String mqRabbitHost; @Value("${mq.rabbit.port}") private Integer mqRabbitPort; @Value("${mq.rabbit.username}") private String mqRabbitUserName; @Value("${mq.rabbit.password}") private String mqRabbitPassword; @Value("${mq.rabbit.virtualHost}") private String mqRabbitVirtualHost; public final static String QUEUE_NAME = "jim_queue"; public final static String EXCHANGE_NAME = "jim_exchange"; public final static String ROUTING_KEY="jim"; @Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory connectionFactory = new CachingConnectionFactory(this.mqRabbitHost,this.mqRabbitPort); connectionFactory.setUsername(this.mqRabbitUserName); connectionFactory.setPassword(this.mqRabbitPassword); connectionFactory.setVirtualHost(this.mqRabbitVirtualHost); connectionFactory.setPublisherConfirms(true); return connectionFactory; } @Bean public RabbitTemplate rabbitTemplate() { RabbitTemplate template = new RabbitTemplate(connectionFactory()); return template; } @Bean public DirectExchange defaultExchange() { return new DirectExchange(EXCHANGE_NAME); } @Bean public Queue queue() { return new Queue(QUEUE_NAME, true); } @Bean public Binding binding() { return BindingBuilder.bind(queue()).to(defaultExchange()).with(ROUTING_KEY); } @Bean public SimpleMessageListenerContainer messageContainer() { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory()); container.setQueues(queue()); container.setExposeListenerChannel(true); container.setMaxConcurrentConsumers(1); container.setConcurrentConsumers(1); container.setAcknowledgeMode(AcknowledgeMode.MANUAL); container.setMessageListener(new ChannelAwareMessageListener() { public void onMessage(Message message, com.rabbitmq.client.Channel channel) throws Exception { byte[] body = message.getBody(); logger.info("消费端接收到消息 : " + new String(body)); channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); } }); return container; } }
34.393617
120
0.702134
78c3b7e070823937bfb9c591535d90aca38ec8e4
87
package com.stripe.model; public class DeletedCard extends DeletedExternalAccount { }
17.4
57
0.827586
7a371c8a26dfd91ca9006071021cb446c275603b
1,356
package com.gemini.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.index.IndexDirection; import org.springframework.data.mongodb.core.index.Indexed; import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @Document(collection="Hotels") public class Hotel { @Id private String id; private String name; @Indexed(direction = IndexDirection.ASCENDING) private int pricePerNight; private Address address; private List<Review> review; public String getId() { return id; } public String getName() { return name; } public Integer getPricePerNight() { return pricePerNight; } public Address getAddress() { return address; } public List<Review> getReview() { return review; } public void setReview(List<Review> review) { this.review = review; } public void setName(String name) { this.name = name; } public void setPricePerNight(int pricePerNight) { this.pricePerNight = pricePerNight; } public void setAddress(Address address) { this.address = address; } public void setId(String id) { this.id = id; } }
21.52381
66
0.670354
42e5fc497342b474722c0ba00413e65313bb263e
1,242
package com.jfinalshop.bean; import com.jfinalshop.bean.SystemConfig.CurrencyType; /** * Bean类 - 财付通配置 * */ public class TenpayConfig { public static final String PAYMENT_URL = "http://service.tenpay.com/cgi-bin/v3.0/payservice.cgi";// 财付通支付请求URL public static final String QUERY_URL = "http://mch.tenpay.com/cgi-bin/cfbi_query_order_v3.cgi";// 财付通查询请求URL public static final String RETURN_URL = "/shop/payment/tenpayReturn";// 处理返回结果的URL public static final String SHOW_URL = "/shop/payment/result";// 支付完成显示URL // 财付通交易类型(即时交易、担保交易-实物、担保交易-虚拟) public enum TenpayType { direct, partnerMaterial, partnerVirtual } // 支持货币种类 public static final CurrencyType[] currencyType = {CurrencyType.CNY}; private TenpayType tenpayType;// 财会通交易类型 private String bargainorId;// 商户号 private String key;// 密钥 public TenpayType getTenpayType() { return tenpayType; } public void setTenpayType(String tenpayType) { this.tenpayType = TenpayType.valueOf(tenpayType); } public String getBargainorId() { return bargainorId; } public void setBargainorId(String bargainorId) { this.bargainorId = bargainorId; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } }
23.884615
111
0.736715
6d459039e4e9256a4a4118fa888fffdcc27bbb5f
1,157
/* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package com.facebook.imagepipeline.animated.testing; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; import org.robolectric.annotation.RealObject; /** * A shadow of {@link Canvas} that works with the tests in this package. */ @Implements(Canvas.class) public class MyShadowCanvas { @RealObject private Canvas mRealCanvas; private Bitmap mBitmap; public void __constructor__(Bitmap bitmap) { mBitmap = bitmap; } @Implementation public void drawBitmap(Bitmap bitmap, float left, float top, Paint paint) { for (int x = 0; x < bitmap.getWidth(); x++) { for (int y = 0; y < bitmap.getHeight(); y++) { mBitmap.setPixel(x, y, bitmap.getPixel(x, y)); } } } }
27.547619
78
0.72083
6e15ae5a5e63558cdb4ac76b1c7c340614a2a2c5
1,424
package dev.spaceseries.spacechat.model.manager; import java.util.*; public abstract class MapManager<K, V> implements Manager { /** * Map */ private Map<K, V> map; /** * Construct map manager */ public MapManager() { this.map = new HashMap<>(); } /** * Construct map manager * <p> * Creates a clone of the map and initializes the map manager with the clone * * @param def default, initialized */ public MapManager(Map<K, V> def) { this.map.putAll(def); } /** * Returns the map * * @return map */ public Map<K, V> getAll() { return this.map; } /** * Returns gotten value * * @param k key * @return gotten value */ public V get(K k) { return map.get(k); } /** * Returns gotten value * * @param k key * @param def default * @return gotten value */ public V get(K k, V def) { return map.getOrDefault(k, def); } /** * Adds to the map * * @param k k * @param v v */ public void add(K k, V v) { this.map.put(k, v); } /** * Removes a K * * @param k k */ public void remove(K k) { this.map.remove(k); } /** * Clears the map */ public void clear() { this.map.clear(); } }
16.55814
80
0.479635
03451239348a1a30b4f9e140d7c7cf8e8c283d44
39,108
/** * Copyright (c) 2011, Ben Fortuna * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * o Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * o Neither the name of Ben Fortuna nor the names of any other contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.fortuna.ical4j.model; import java.io.IOException; import java.net.URISyntaxException; import java.text.ParseException; import net.fortuna.ical4j.model.property.Action; import net.fortuna.ical4j.model.property.Attach; import net.fortuna.ical4j.model.property.Attendee; import net.fortuna.ical4j.model.property.CalScale; import net.fortuna.ical4j.model.property.Categories; import net.fortuna.ical4j.model.property.Clazz; import net.fortuna.ical4j.model.property.Comment; import net.fortuna.ical4j.model.property.Completed; import net.fortuna.ical4j.model.property.Contact; import net.fortuna.ical4j.model.property.Country; import net.fortuna.ical4j.model.property.Created; import net.fortuna.ical4j.model.property.Description; import net.fortuna.ical4j.model.property.DtEnd; import net.fortuna.ical4j.model.property.DtStamp; import net.fortuna.ical4j.model.property.DtStart; import net.fortuna.ical4j.model.property.Due; import net.fortuna.ical4j.model.property.Duration; import net.fortuna.ical4j.model.property.ExDate; import net.fortuna.ical4j.model.property.ExRule; import net.fortuna.ical4j.model.property.ExtendedAddress; import net.fortuna.ical4j.model.property.FreeBusy; import net.fortuna.ical4j.model.property.Geo; import net.fortuna.ical4j.model.property.LastModified; import net.fortuna.ical4j.model.property.Locality; import net.fortuna.ical4j.model.property.Location; import net.fortuna.ical4j.model.property.LocationType; import net.fortuna.ical4j.model.property.Method; import net.fortuna.ical4j.model.property.Name; import net.fortuna.ical4j.model.property.Organizer; import net.fortuna.ical4j.model.property.PercentComplete; import net.fortuna.ical4j.model.property.Postalcode; import net.fortuna.ical4j.model.property.Priority; import net.fortuna.ical4j.model.property.ProdId; import net.fortuna.ical4j.model.property.RDate; import net.fortuna.ical4j.model.property.RRule; import net.fortuna.ical4j.model.property.RecurrenceId; import net.fortuna.ical4j.model.property.Region; import net.fortuna.ical4j.model.property.RelatedTo; import net.fortuna.ical4j.model.property.Repeat; import net.fortuna.ical4j.model.property.RequestStatus; import net.fortuna.ical4j.model.property.Resources; import net.fortuna.ical4j.model.property.Sequence; import net.fortuna.ical4j.model.property.Status; import net.fortuna.ical4j.model.property.StreetAddress; import net.fortuna.ical4j.model.property.Summary; import net.fortuna.ical4j.model.property.Tel; import net.fortuna.ical4j.model.property.Transp; import net.fortuna.ical4j.model.property.Trigger; import net.fortuna.ical4j.model.property.TzId; import net.fortuna.ical4j.model.property.TzName; import net.fortuna.ical4j.model.property.TzOffsetFrom; import net.fortuna.ical4j.model.property.TzOffsetTo; import net.fortuna.ical4j.model.property.TzUrl; import net.fortuna.ical4j.model.property.Uid; import net.fortuna.ical4j.model.property.Url; import net.fortuna.ical4j.model.property.Version; import net.fortuna.ical4j.model.property.XProperty; /** * A factory for creating iCalendar properties. Note that if relaxed parsing is enabled (via specifying the system * property: icalj.parsing.relaxed=true) illegal property names are allowed. * * @author Ben Fortuna * * $Id$ [05-Apr-2004] */ public class PropertyFactoryImpl extends AbstractContentFactory implements PropertyFactory { private static final long serialVersionUID = -7174232004486979641L; private static PropertyFactoryImpl instance = new PropertyFactoryImpl(); /** * Constructor made private to prevent instantiation. */ protected PropertyFactoryImpl() { registerDefaultFactory(Property.ACTION, new ActionFactory()); registerDefaultFactory(Property.ATTACH, new AttachFactory()); registerDefaultFactory(Property.ATTENDEE, new AttendeeFactory()); registerDefaultFactory(Property.CALSCALE, new CalScaleFactory()); registerDefaultFactory(Property.CATEGORIES, new CategoriesFactory()); registerDefaultFactory(Property.CLASS, new ClazzFactory()); registerDefaultFactory(Property.COMMENT, new CommentFactory()); registerDefaultFactory(Property.COMPLETED, new CompletedFactory()); registerDefaultFactory(Property.CONTACT, new ContactFactory()); registerDefaultFactory(Property.COUNTRY, new CountryFactory()); registerDefaultFactory(Property.CREATED, new CreatedFactory()); registerDefaultFactory(Property.DESCRIPTION, new DescriptionFactory()); registerDefaultFactory(Property.DTEND, new DtEndFactory()); registerDefaultFactory(Property.DTSTAMP, new DtStampFactory()); registerDefaultFactory(Property.DTSTART, new DtStartFactory()); registerDefaultFactory(Property.DUE, new DueFactory()); registerDefaultFactory(Property.DURATION, new DurationFactory()); registerDefaultFactory(Property.EXDATE, new ExDateFactory()); registerDefaultFactory(Property.EXRULE, new ExRuleFactory()); registerDefaultFactory(Property.EXTENDED_ADDRESS, new ExtendedAddressFactory()); registerDefaultFactory(Property.FREEBUSY, new FreeBusyFactory()); registerDefaultFactory(Property.GEO, new GeoFactory()); registerDefaultFactory(Property.LAST_MODIFIED, new LastModifiedFactory()); registerDefaultFactory(Property.LOCALITY, new LocalityFactory()); registerDefaultFactory(Property.LOCATION, new LocationFactory()); registerDefaultFactory(Property.LOCATION_TYPE, new LocationTypeFactory()); registerDefaultFactory(Property.METHOD, new MethodFactory()); registerDefaultFactory(Property.NAME, new NameFactory()); registerDefaultFactory(Property.ORGANIZER, new OrganizerFactory()); registerDefaultFactory(Property.PERCENT_COMPLETE, new PercentCompleteFactory()); registerDefaultFactory(Property.POSTALCODE, new PostalcodeFactory()); registerDefaultFactory(Property.PRIORITY, new PriorityFactory()); registerDefaultFactory(Property.PRODID, new ProdIdFactory()); registerDefaultFactory(Property.RDATE, new RDateFactory()); registerDefaultFactory(Property.RECURRENCE_ID, new RecurrenceIdFactory()); registerDefaultFactory(Property.REGION, new RegionFactory()); registerDefaultFactory(Property.RELATED_TO, new RelatedToFactory()); registerDefaultFactory(Property.REPEAT, new RepeatFactory()); registerDefaultFactory(Property.REQUEST_STATUS, new RequestStatusFactory()); registerDefaultFactory(Property.RESOURCES, new ResourcesFactory()); registerDefaultFactory(Property.RRULE, new RRuleFactory()); registerDefaultFactory(Property.SEQUENCE, new SequenceFactory()); registerDefaultFactory(Property.STATUS, new StatusFactory()); registerDefaultFactory(Property.STREET_ADDRESS, new StreetAddressFactory()); registerDefaultFactory(Property.SUMMARY, new SummaryFactory()); registerDefaultFactory(Property.TEL, new TelFactory()); registerDefaultFactory(Property.TRANSP, new TranspFactory()); registerDefaultFactory(Property.TRIGGER, new TriggerFactory()); registerDefaultFactory(Property.TZID, new TzIdFactory()); registerDefaultFactory(Property.TZNAME, new TzNameFactory()); registerDefaultFactory(Property.TZOFFSETFROM, new TzOffsetFromFactory()); registerDefaultFactory(Property.TZOFFSETTO, new TzOffsetToFactory()); registerDefaultFactory(Property.TZURL, new TzUrlFactory()); registerDefaultFactory(Property.UID, new UidFactory()); registerDefaultFactory(Property.URL, new UrlFactory()); registerDefaultFactory(Property.VERSION, new VersionFactory()); } private static class ActionFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Action(parameters, value); } public Property createProperty(final String name) { return new Action(); } } private static class AttachFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Attach(parameters, value); } public Property createProperty(final String name) { return new Attach(); } } private static class AttendeeFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Attendee(parameters, value); } public Property createProperty(final String name) { return new Attendee(); } } private static class CalScaleFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new CalScale(parameters, value); } public Property createProperty(final String name) { return new CalScale(); } } private static class CategoriesFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Categories(parameters, value); } public Property createProperty(final String name) { return new Categories(); } } private static class ClazzFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Clazz(parameters, value); } public Property createProperty(final String name) { return new Clazz(); } } private static class CommentFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Comment(parameters, value); } public Property createProperty(final String name) { return new Comment(); } } private static class CompletedFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Completed(parameters, value); } public Property createProperty(final String name) { return new Completed(); } } private static class ContactFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Contact(parameters, value); } public Property createProperty(final String name) { return new Contact(); } } private static class CountryFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Country(parameters, value); } public Property createProperty(final String name) { return new Country(); } } private static class CreatedFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Created(parameters, value); } public Property createProperty(final String name) { return new Created(); } } private static class DescriptionFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Description(parameters, value); } public Property createProperty(final String name) { return new Description(); } } private static class DtEndFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new DtEnd(parameters, value); } public Property createProperty(final String name) { return new DtEnd(); } } private static class DtStampFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new DtStamp(parameters, value); } public Property createProperty(final String name) { return new DtStamp(); } } /** * @return */ private static class DtStartFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new DtStart(parameters, value); } public Property createProperty(final String name) { return new DtStart(); } } private static class DueFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Due(parameters, value); } public Property createProperty(final String name) { return new Due(); } } private static class DurationFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Duration(parameters, value); } public Property createProperty(final String name) { return new Duration(); } } private static class ExDateFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new ExDate(parameters, value); } public Property createProperty(final String name) { return new ExDate(); } } private static class ExRuleFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new ExRule(parameters, value); } public Property createProperty(final String name) { return new ExRule(); } } private static class ExtendedAddressFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new ExtendedAddress(parameters, value); } public Property createProperty(final String name) { return new ExtendedAddress(); } } private static class FreeBusyFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new FreeBusy(parameters, value); } public Property createProperty(final String name) { return new FreeBusy(); } } private static class GeoFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Geo(parameters, value); } public Property createProperty(final String name) { return new Geo(); } } private static class LastModifiedFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new LastModified(parameters, value); } public Property createProperty(final String name) { return new LastModified(); } } private static class LocalityFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Locality(parameters, value); } public Property createProperty(final String name) { return new Locality(); } } private static class LocationFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Location(parameters, value); } public Property createProperty(final String name) { return new Location(); } } private static class LocationTypeFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new LocationType(parameters, value); } public Property createProperty(final String name) { return new LocationType(); } } private static class MethodFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Method(parameters, value); } public Property createProperty(final String name) { return new Method(); } } private static class NameFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Name(parameters, value); } public Property createProperty(final String name) { return new Name(); } } private static class OrganizerFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Organizer(parameters, value); } public Property createProperty(final String name) { return new Organizer(); } } private static class PercentCompleteFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new PercentComplete(parameters, value); } public Property createProperty(final String name) { return new PercentComplete(); } } private static class PostalcodeFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Postalcode(parameters, value); } public Property createProperty(final String name) { return new Postalcode(); } } private static class PriorityFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Priority(parameters, value); } public Property createProperty(final String name) { return new Priority(); } } private static class ProdIdFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new ProdId(parameters, value); } public Property createProperty(final String name) { return new ProdId(); } } private static class RDateFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new RDate(parameters, value); } public Property createProperty(final String name) { return new RDate(); } } private static class RecurrenceIdFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new RecurrenceId(parameters, value); } public Property createProperty(final String name) { return new RecurrenceId(); } } private static class RegionFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Region(parameters, value); } public Property createProperty(final String name) { return new Region(); } } private static class RelatedToFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new RelatedTo(parameters, value); } public Property createProperty(final String name) { return new RelatedTo(); } } private static class RepeatFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Repeat(parameters, value); } public Property createProperty(final String name) { return new Repeat(); } } private static class RequestStatusFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new RequestStatus(parameters, value); } public Property createProperty(final String name) { return new RequestStatus(); } } private static class ResourcesFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Resources(parameters, value); } public Property createProperty(final String name) { return new Resources(); } } private static class RRuleFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new RRule(parameters, value); } public Property createProperty(final String name) { return new RRule(); } } private static class SequenceFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Sequence(parameters, value); } public Property createProperty(final String name) { return new Sequence(); } } private static class StatusFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Status(parameters, value); } public Property createProperty(final String name) { return new Status(); } } private static class StreetAddressFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new StreetAddress(parameters, value); } public Property createProperty(final String name) { return new StreetAddress(); } } private static class SummaryFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Summary(parameters, value); } public Property createProperty(final String name) { return new Summary(); } } private static class TelFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Tel(parameters, value); } public Property createProperty(final String name) { return new Tel(); } } private static class TranspFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Transp(parameters, value); } public Property createProperty(final String name) { return new Transp(); } } private static class TriggerFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Trigger(parameters, value); } public Property createProperty(final String name) { return new Trigger(); } } private static class TzIdFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new TzId(parameters, value); } public Property createProperty(final String name) { return new TzId(); } } private static class TzNameFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new TzName(parameters, value); } public Property createProperty(final String name) { return new TzName(); } } private static class TzOffsetFromFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new TzOffsetFrom(parameters, value); } public Property createProperty(final String name) { return new TzOffsetFrom(); } } private static class TzOffsetToFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new TzOffsetTo(parameters, value); } public Property createProperty(final String name) { return new TzOffsetTo(); } } private static class TzUrlFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new TzUrl(parameters, value); } public Property createProperty(final String name) { return new TzUrl(); } } private static class UidFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Uid(parameters, value); } public Property createProperty(final String name) { return new Uid(); } } private static class UrlFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Url(parameters, value); } public Property createProperty(final String name) { return new Url(); } } private static class VersionFactory implements PropertyFactory { private static final long serialVersionUID = 1L; public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Version(parameters, value); } public Property createProperty(final String name) { return new Version(); } } /** * @return Returns the instance. */ public static PropertyFactoryImpl getInstance() { return instance; } /** * {@inheritDoc} */ public Property createProperty(final String name) { final PropertyFactory factory = (PropertyFactory) getFactory(name); if (factory != null) { return factory.createProperty(name); } else if (isExperimentalName(name)) { return new XProperty(name); } else if (allowIllegalNames()) { return new XProperty(name); } else { throw new IllegalArgumentException("Illegal property [" + name + "]"); } } /** * {@inheritDoc} */ public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { final PropertyFactory factory = (PropertyFactory) getFactory(name); if (factory != null) { return factory.createProperty(name, parameters, value); } else if (isExperimentalName(name)) { return new XProperty(name, parameters, value); } else if (allowIllegalNames()) { return new XProperty(name, parameters, value); } else { throw new IllegalArgumentException("Illegal property [" + name + "]"); } } /** * @param name * @return */ private boolean isExperimentalName(final String name) { return name.startsWith(Property.EXPERIMENTAL_PREFIX) && name.length() > Property.EXPERIMENTAL_PREFIX.length(); } }
38.416503
114
0.676383
853c07a8010ac878104257e15249d9523514f515
1,128
package it.soft.domain; import java.io.Serializable; import javax.persistence.*; /** * The persistent class for the tipologia_destinazione_uso database table. * */ @Entity @Table(name="tipologia_destinazione_uso") public class TipologiaDestinazioneUso implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="idtipologia_destinazione_uso", unique=true, nullable=false) private int idtipologiaDestinazioneUso; @Column(name="descrizione_tipologia", length=45) private String descrizioneTipologia; public TipologiaDestinazioneUso() { } public int getIdtipologiaDestinazioneUso() { return this.idtipologiaDestinazioneUso; } public void setIdtipologiaDestinazioneUso(int idtipologiaDestinazioneUso) { this.idtipologiaDestinazioneUso = idtipologiaDestinazioneUso; } public String getDescrizioneTipologia() { return this.descrizioneTipologia; } public void setDescrizioneTipologia(String descrizioneTipologia) { this.descrizioneTipologia = descrizioneTipologia; } }
26.232558
77
0.773936
edf612162596fba8c474cc0e1b204203ea7ad3b8
1,721
package com.example.dddecommerce.commandModel; import com.example.dddecommerce.coreapi.*; import org.axonframework.commandhandling.CommandHandler; import org.axonframework.eventsourcing.EventSourcingHandler; import org.axonframework.modelling.command.AggregateIdentifier; import org.axonframework.modelling.command.AggregateLifecycle; import org.axonframework.spring.stereotype.Aggregate; import java.math.BigDecimal; @Aggregate public class Order { @AggregateIdentifier private String orderId; private String product; private String customer; private BigDecimal price; public Order() {} @CommandHandler public Order(CreateOrderCommand command){ AggregateLifecycle.apply(new OrderCreatedEvent(command.getOrderId(), command.getCustomer())); } @CommandHandler public void handle(AddProductCommand command) { AggregateLifecycle.apply(new AddProductEvent(command.getOrderId(), command.getProduct(), command.getPrice())); } @CommandHandler public void handle(RemoveProductCommand command) { AggregateLifecycle.apply(new RemoveProductEvent(command.getOrderId(), command.getProduct())); } @EventSourcingHandler protected void on(OrderCreatedEvent event) { this.orderId = event.getOrderId(); this.customer = event.getCustomer(); } @EventSourcingHandler protected void on(AddProductEvent event) { this.orderId = event.getOrderId(); this.product = event.getProduct(); this.price = event.getPrice(); } @EventSourcingHandler protected void on(RemoveProductEvent event) { this.orderId = event.getOrderId(); this.product = event.getProduct(); } }
29.672414
118
0.732714
15a964fcf01401bdaa873f8be5f534f40235912d
1,907
package com.example.betweenus.backend.utils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; /** * Created by ninjakiki on 2/18/16. */ public class ServletUtils { private static int CHUNK_SIZE = 4096; /** * Helper method to copy bytes from an input stream into an output stream * @param in The stream to read from * @param out The stream to write to * @return the nunber of bytes copied * @throws IOException If any error occurs processing data from the input stream */ public static int copyBytes(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[CHUNK_SIZE]; int len = 0; int count = 0; // read in one chunk at a time until the stream is empty while ((len = in.read(buffer)) != -1) { count += len; out.write(buffer, 0, len); } return count; } /** * Helper method to copy headers from input stream to an output stream * @param headerFields * @param resp */ public static void copyHeaders(Map<String, List<String>> headerFields, HttpServletResponse resp) { for (Map.Entry<String, List<String>> entry : headerFields.entrySet()) { final String headerKey = entry.getKey(); final List<String> headerValues = entry.getValue(); if (headerValues != null) { StringBuilder builder = new StringBuilder(headerValues.size()); for (int i = 0; i < headerValues.size(); i++) { builder.append(headerValues.get(i)); if (i < headerValues.size() - 1) builder.append(", "); } resp.addHeader(headerKey, builder.toString()); } } } }
31.783333
102
0.607236
2e5ff5caa55d731ba4f687fbf4f836f6b0d5c0d7
1,837
package com.messagemedia.service; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for MessageTagListType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="MessageTagListType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="tag" type="{http://xml.m4u.com.au/2009}MessageTagType" maxOccurs="unbounded"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MessageTagListType", propOrder = { "tag" }) public class MessageTagListType { @XmlElement(required = true) protected List<MessageTagType> tag; /** * Gets the value of the tag property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the tag property. * * <p> * For example, to add a new item, do as follows: * <pre> * getTag().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link MessageTagType } * * */ public List<MessageTagType> getTag() { if (tag == null) { tag = new ArrayList<MessageTagType>(); } return this.tag; } }
26.242857
107
0.634731
ea049fe3b9cd03e0f5d3db2de4d62ada647792a9
878
package org.appsec.securityrat.api.provider.advanced; import java.util.Set; import org.appsec.securityrat.api.dto.rest.StatusColumnValueDto; import org.appsec.securityrat.api.provider.IdentifiableProvider; public interface StatusColumnValueProvider extends IdentifiableProvider<Long, StatusColumnValueDto> { /** * Returns all {@link StatusColumnValueDto} instances that are associated * with the specified <code>statusColumnId</code>. * * @param statusColumnId The identifier of the status column. * * @return Either a collection of all associated * {@link StatusColumnValueDto} instances or <code>null</code>, if * either an error occurred or if the specified * <code>statusColumnId</code> does not exist. */ Set<StatusColumnValueDto> findByStatusColumn(Long statusColumnId); }
38.173913
78
0.718679
b0566ceafe83bf3bbfe060b37b7fa12347c0cb5f
2,284
package gamecontrollers.commands.gameplaycommands; import gamecontrollers.commands.GameplayActionCommand; import gamecontrollers.save.CommandSaveVisitor; import gamecontrollers.turn.TurnController; import models.board.*; import models.board.TileComponentContents.Palace; import java.util.List; /* THIS ASSIGNS POINTS = HALF THE PALACE LEVEL. IN ORDER TO CHANGE THIS THE SUBCLASS THIS CLASS AND OVERRIDE SAID METHOD */ /** * Created by kevinnieman on 4/20/14. */ public class PlacePalaceCommand implements GameplayActionCommand { private TurnController controller; private int level; private Space space; private SharedResources resources; private List<TileComponentContent> city; public PlacePalaceCommand(TurnController controller, int level, Space space, SharedResources resources, List<TileComponentContent> city){ this.controller = controller; this.space = space; this.level = level; this.resources = resources; this.city = city; } @Override public void execute() { TileComponent tile = new TileComponent(HexDirection.N, new Palace(level)); //this code is not copypasta //place that tile boiiiii space.placeTile(tile); //update resource counter resources.decNumThreeTiles(); //update dat turn counter controller.playTile(); //special palace stuff for score controller.getCurrentPlayer().alterFamePoints(level/2); //special palace stuff to flop canAcceptPalace for(TileComponentContent comp : city){ comp.setCanAcceptPalace(false); } } @Override public void undo() { //this code is not copypasta //(un)place that tile boiiiii space.removeTile(); //update resource counter resources.incNumThreeTiles(); //update dat turn counter controller.removeTile(); //special palace stuff for score controller.getCurrentPlayer().alterFamePoints(-level/2); //special palace stuff to flop canAcceptPalace for(TileComponentContent comp : city){ comp.setCanAcceptPalace(true); } } @Override public void accept(CommandSaveVisitor visitor) { } }
28.55
141
0.681261
c04a66b63217b0b452cf43461e78341d354ec583
1,214
package net.haesleinhuepf.clij2.assistant.utilities; import ij.IJ; import ij.plugin.PlugIn; import net.haesleinhuepf.clij2.assistant.services.SuggestionService; import net.haesleinhuepf.clij2.assistant.services.UsageAnalyser; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class CustomSuggestions implements PlugIn { @Override public void run(String arg) { String folder = IJ.getDirectory("Folder with clij-macros"); UsageAnalyser combinedUsageStats = new UsageAnalyser( folder); String output = combinedUsageStats.all(); String target_file = IJ.getDirectory("imagej") + "/suggestions/"; new File(target_file).mkdirs(); target_file = target_file + "suggestions_" + System.currentTimeMillis() + ".config" ; File outputTarget = new File(target_file); try { FileWriter writer = new FileWriter(outputTarget); writer.write(output); writer.close(); } catch (IOException e) { e.printStackTrace(); } SuggestionService.getInstance().invalidate(); IJ.log("New suggestions written to " + target_file); } }
29.609756
94
0.668863
cb983fee0f18a4bf77dc7e01fa3484d1844205ce
1,991
package fr.berger.enhancedlist.graph; import fr.berger.beyondcode.util.EnhancedObservable; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Objects; /** * Color is the representation of the color in the graph theory. In this project, it is represented by a positive * number. * @author Valentin Berger */ public class Color extends EnhancedObservable implements Serializable, Cloneable, Comparable<Color> { /** * The color of the vertex/edge. If it is equal to -1, it means that the vertex/edge has not been colored yet. * This number must be greater than zero. */ private long colorNumber; public Color(long colorNumber) { setColorNumber(colorNumber); } public Color() { initColorNumber(); } /* COLOR METHOD */ /* GETTER & SETTER */ public long getColorNumber() { return colorNumber; } public void setColorNumber(long colorNumber) { if (colorNumber < -1) throw new IllegalArgumentException(); this.colorNumber = colorNumber; } public void initColorNumber() { setColorNumber(-1); } /* SERIALIZATION METHODS */ private void writeObject(@NotNull ObjectOutputStream stream) throws IOException { stream.writeLong(getColorNumber()); } private void readObject(@NotNull ObjectInputStream stream) throws IOException { setColorNumber(stream.readLong()); } /* COMPARABLE METHOD */ @Override public int compareTo(@NotNull Color o) { return Long.compare(getColorNumber(), o.getColorNumber()); } /* OVERRIDES */ @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Color)) return false; Color color = (Color) o; return getColorNumber() == color.getColorNumber(); } @Override public int hashCode() { return Objects.hash(getColorNumber()); } @Override public String toString() { return Long.toString(colorNumber); } }
22.625
113
0.724259
13b078eacafcee0060990d2f755fab291590e296
15,922
package iamdilipkumar.com.spacedig.utils; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import java.util.ArrayList; import java.util.List; import iamdilipkumar.com.spacedig.BuildConfig; import iamdilipkumar.com.spacedig.R; import iamdilipkumar.com.spacedig.data.CadColumns; import iamdilipkumar.com.spacedig.data.NasaProvider; import iamdilipkumar.com.spacedig.data.NeoColumns; import iamdilipkumar.com.spacedig.models.MediaOptions; import iamdilipkumar.com.spacedig.models.SimpleItemModel; import iamdilipkumar.com.spacedig.models.cad.Cad; import iamdilipkumar.com.spacedig.models.epic.AttitudeQuaternions; import iamdilipkumar.com.spacedig.models.epic.CentroidCoordinates; import iamdilipkumar.com.spacedig.models.epic.DscovrJ2000Position; import iamdilipkumar.com.spacedig.models.epic.Epic; import iamdilipkumar.com.spacedig.models.epic.LunarJ2000Position; import iamdilipkumar.com.spacedig.models.epic.SunJ2000Position; import iamdilipkumar.com.spacedig.models.neo.CloseApproachDatum; import iamdilipkumar.com.spacedig.models.neo.EstimatedDiameter; import iamdilipkumar.com.spacedig.models.neo.NearEarthObject; import iamdilipkumar.com.spacedig.models.neo.OrbitalData; import iamdilipkumar.com.spacedig.models.neo.RelativeVelocity; import iamdilipkumar.com.spacedig.models.rover.MarsRoverPhoto; import iamdilipkumar.com.spacedig.models.rover.Rover; import iamdilipkumar.com.spacedig.models.search.Item; import iamdilipkumar.com.spacedig.models.search.Search; /** * Created on 05/07/17. * * @author dilipkumar4813 * @version 1.0 */ public class ParsingUtils { public static SimpleItemModel getRoverModel(MarsRoverPhoto item, Context context) { String landingDate = "", launchDate = "", status = ""; Rover rover = item.getRover(); if (rover != null) { landingDate = context.getString(R.string.landing_date) + " " + rover.getLandingDate(); launchDate = context.getString(R.string.launch_date) + " " + rover.getLaunchDate(); status = context.getString(R.string.status) + " " + rover.getStatus(); } String fullDescription = landingDate + "\n" + launchDate + "\n\n" + status; return new SimpleItemModel(String.valueOf(item.getId()), item.getCamera().getFullName(), item.getCamera().getName(), item.getImgSrc(), fullDescription, 0); } public static SimpleItemModel getEpicModel(Epic item, Context context) { String[] subParts = item.getImage().split("_"); String year = subParts[2].substring(0, 4); String month = subParts[2].substring(4, 6); String day = subParts[2].substring(6, 8); String image = "https://api.nasa.gov/EPIC/archive/natural/" + year + "/" + month + "/" + day + "/png/" + item.getImage() + ".png?api_key=" + BuildConfig.API; String sunPosition = "", aQuaternions = "", ceroidCoordinates = "", lunarPosition = "", dscovrPosition = ""; CentroidCoordinates centroidCoordinates = item.getCentroidCoordinates(); SunJ2000Position sunJ2000Position = item.getSunJ2000Position(); LunarJ2000Position lunarJ2000Position = item.getLunarJ2000Position(); DscovrJ2000Position dscovrJ2000Position = item.getDscovrJ2000Position(); AttitudeQuaternions attitudeQuaternions = item.getAttitudeQuaternions(); String earthDate = item.getDate(); if (attitudeQuaternions != null) { aQuaternions = context.getString(R.string.quaternions) + " Q0 - " + attitudeQuaternions.getQ0() + ", Q1 - " + attitudeQuaternions.getQ1() + ", Q2 - " + attitudeQuaternions.getQ2() + ", Q3 - " + attitudeQuaternions.getQ3(); } if (dscovrJ2000Position != null) { dscovrPosition = context.getString(R.string.dscovr_position) + " X - " + dscovrJ2000Position.getX() + " Y - " + dscovrJ2000Position.getY() + " Z - " + dscovrJ2000Position.getZ(); } if (lunarJ2000Position != null) { lunarPosition = context.getString(R.string.lunar_position) + " X -" + lunarJ2000Position.getX() + " Y -" + lunarJ2000Position.getY() + " Z -" + lunarJ2000Position.getZ(); } if (sunJ2000Position != null) { sunPosition = context.getString(R.string.sun_position) + " X - " + sunJ2000Position.getX() + " Y - " + sunJ2000Position.getY() + " Z - " + sunJ2000Position.getZ(); } if (centroidCoordinates != null) { ceroidCoordinates = context.getString(R.string.centroid_coordinates) + " " + centroidCoordinates.getLat() + ", " + centroidCoordinates.getLon(); } String description = item.getCaption() + "\n\n" + aQuaternions + "\n\n" + ceroidCoordinates + "\n\n" + lunarPosition + "\n\n" + dscovrPosition + "\n\n" + sunPosition; return new SimpleItemModel("", earthDate, ceroidCoordinates, image, description, 0); } public static List<SimpleItemModel> getSearchDetails(Context context, Search search) { List<SimpleItemModel> searchItems = new ArrayList<>(); for (Item item : search.getCollection().getItems()) { String id, title, description, shortDescription, imageUrl, downloadUrl = null; id = item.getData().get(0).getNasaId(); title = item.getData().get(0).getTitle(); description = item.getData().get(0).getDescription() + "\n\n" + context.getString(R.string.created) + " " + item.getData().get(0).getDateCreated(); shortDescription = context.getString(R.string.media_type) + " " + item.getData().get(0).getMediaType(); if (item.getData().get(0).getMediaType().contains("video")) { imageUrl = "https://cdn.pixabay.com/photo/2016/01/19/17/29/earth-1149733_960_720.jpg"; downloadUrl = item.getHref().replace(" ", "%20"); } else { imageUrl = item.getLinks().get(0).getHref(); } searchItems.add(new SimpleItemModel(id, title, shortDescription, imageUrl, description, 0, downloadUrl)); } return searchItems; } public static void getNeoModel(NearEarthObject item, Context context) { String description, estDiameter = "", orbData = ""; String closeApproach = context.getString(R.string.close_approach); String hazardous = context.getString(R.string.hazardous_asteroid); if (item.getIsPotentiallyHazardousAsteroid()) { hazardous += " true"; } else { hazardous += " false"; } for (CloseApproachDatum closeItem : item.getCloseApproachData()) { RelativeVelocity relativeVelocity = closeItem.getRelativeVelocity(); closeApproach += "\n" + closeItem.getCloseApproachDate() + closeItem.getOrbitingBody() + "\n\n" + context.getString(R.string.relative_velocity) + "\n" + context.getString(R.string.kilometers_per_hour) + " " + relativeVelocity.getKilometersPerHour() + "\n" + context.getString(R.string.kilometers_per_second) + " " + relativeVelocity.getKilometersPerSecond() + "\n" + context.getString(R.string.miles_per_hour) + " " + relativeVelocity.getMilesPerHour(); } EstimatedDiameter estimatedDiameter = item.getEstimatedDiameter(); if (item.getEstimatedDiameter() != null) { estDiameter = context.getString(R.string.estimated_diameter) + "\n" + context.getString(R.string.feet) + " " + estimatedDiameter.getFeet().getEstimatedDiameterMax() + "\n" + context.getString(R.string.kilometers) + " " + estimatedDiameter.getKilometers().getEstimatedDiameterMax() + "\n" + context.getString(R.string.meters) + " " + estimatedDiameter.getMeters().getEstimatedDiameterMax() + "\n" + context.getString(R.string.miles) + " " + estimatedDiameter.getMiles().getEstimatedDiameterMax(); } OrbitalData orbitalData = item.getOrbitalData(); if (orbitalData != null) { orbData = context.getString(R.string.orbital_data) + "\n" + context.getString(R.string.orbit_determination_date) + " " + orbitalData.getOrbitDeterminationDate() + "\n" + context.getString(R.string.orbit_uncertainty) + " " + orbitalData.getOrbitUncertainty() + "\n" + context.getString(R.string.minimum_orbit_intersection) + " " + orbitalData.getMinimumOrbitIntersection() + "\n" + context.getString(R.string.jupiter_tisserand_invariant) + " " + orbitalData.getJupiterTisserandInvariant() + "\n" + context.getString(R.string.epoch_osculation) + " " + orbitalData.getEpochOsculation() + "\n" + context.getString(R.string.eccentricity) + " " + orbitalData.getEccentricity() + "\n" + context.getString(R.string.semi_major_axis) + " " + orbitalData.getSemiMajorAxis() + "\n" + context.getString(R.string.inclination) + " " + orbitalData.getInclination() + "\n" + context.getString(R.string.ascending_node_longitude) + " " + orbitalData.getAscendingNodeLongitude() + "\n" + context.getString(R.string.orbital_period) + " " + orbitalData.getOrbitalPeriod() + "\n" + context.getString(R.string.perihelion_distance) + " " + orbitalData.getPerihelionDistance() + "\n" + context.getString(R.string.aphelion_distance) + " " + orbitalData.getAphelionDistance() + "\n" + context.getString(R.string.perihelion_time) + " " + orbitalData.getPerihelionTime() + "\n" + context.getString(R.string.mean_anomaly) + " " + orbitalData.getMeanAnomaly() + "\n" + context.getString(R.string.mean_motion) + " " + orbitalData.getMeanMotion() + "\n" + context.getString(R.string.equinox) + " " + orbitalData.getEquinox(); } description = context.getString(R.string.absolute_magnitude) + " " + item.getAbsoluteMagnitudeH() + "\n" + hazardous + "\n\n" + closeApproach + "\n\n" + estDiameter + "\n\n" + orbData; ContentValues neoData = new ContentValues(); neoData.put(NeoColumns.NEO_ID, item.getNeoReferenceId()); neoData.put(NeoColumns.NAME, item.getName()); neoData.put(NeoColumns.DESCRIPTION, description); neoData.put(NeoColumns.SHORT_DESCRIPTION, hazardous); neoData.put(NeoColumns.IMAGEURL, "http://star.arm.ac.uk/impact-hazard/DOOMS_DAY.JPG"); context.getContentResolver().insert(NasaProvider.NeoData.CONTENT_URI, neoData); } public static List<SimpleItemModel> getNeoList(Cursor neoCursor) { List<SimpleItemModel> itemModels = new ArrayList<>(); if (neoCursor != null) { if (neoCursor.moveToFirst()) { do { SimpleItemModel itemModel = new SimpleItemModel(neoCursor.getString( neoCursor.getColumnIndex(NeoColumns.NEO_ID)), neoCursor.getString(neoCursor.getColumnIndex(NeoColumns.NAME)), neoCursor.getString(neoCursor.getColumnIndex(NeoColumns.SHORT_DESCRIPTION)), neoCursor.getString(neoCursor.getColumnIndex(NeoColumns.IMAGEURL)), neoCursor.getString(neoCursor.getColumnIndex(NeoColumns.DESCRIPTION)), 0); itemModels.add(itemModel); } while (neoCursor.moveToNext()); } neoCursor.close(); } return itemModels; } public static List<SimpleItemModel> getCadDataIntoContentProvider(Cad cad, Context context) { List<SimpleItemModel> simpleItemModels = new ArrayList<>(); for (List<String> item : cad.getData()) { String name = "", information = "", shortDescription = ""; for (int i = 0; i < cad.getFields().size(); i++) { if (i == 0) { name = item.get(i); } if (cad.getFields().get(i).equalsIgnoreCase("dist")) { shortDescription = context.getString(R.string. collision_approach_short_description) + " " + item.get(i); } information += cad.getFields().get(i) + ": " + item.get(i) + "\n"; } ContentValues cadData = new ContentValues(); cadData.put(CadColumns.NEO_ID, ""); cadData.put(CadColumns.NAME, name); cadData.put(CadColumns.DESCRIPTION, information); cadData.put(CadColumns.SHORT_DESCRIPTION, shortDescription); cadData.put(CadColumns.IMAGEURL, "https://pbs.twimg.com/media/CQ5xYRXVEAAeiCy.jpg"); context.getContentResolver().insert(NasaProvider.CadData.CONTENT_URI, cadData); } return simpleItemModels; } public static List<SimpleItemModel> getCadContent(Cursor cadCursor) { List<SimpleItemModel> simpleItemModels = new ArrayList<>(); if (cadCursor != null) { if (cadCursor.moveToFirst()) { do { SimpleItemModel itemModel = new SimpleItemModel(cadCursor.getString( cadCursor.getColumnIndex(CadColumns.NEO_ID)), cadCursor.getString(cadCursor.getColumnIndex(CadColumns.NAME)), cadCursor.getString(cadCursor.getColumnIndex(CadColumns.SHORT_DESCRIPTION)), cadCursor.getString(cadCursor.getColumnIndex(CadColumns.IMAGEURL)), cadCursor.getString(cadCursor.getColumnIndex(CadColumns.DESCRIPTION)), 0); simpleItemModels.add(itemModel); } while (cadCursor.moveToNext()); } cadCursor.close(); } return simpleItemModels; } public static MediaOptions parseMediaAsset(String response) { MediaOptions mediaOptions = null; try { JSONArray mediaArray = new JSONArray(response); String original = null, medium = null, small = null; for (int i = 0; i < mediaArray.length(); i++) { String item = mediaArray.getString(i).replace("http://", "https://"); if (item.contains("orig.")) { original = item.replace(" ", "%20"); Log.d("results", original); } else if (item.contains("medium.")) { medium = item.replace(" ", "%20"); Log.d("results", medium); } else if (item.contains("small.")) { small = item.replace(" ", "%20"); Log.d("results", small); } } mediaOptions = new MediaOptions(original, medium, small); } catch (JSONException e) { e.printStackTrace(); } return mediaOptions; } }
50.069182
135
0.59647
803bb480010fc46b251721615a4d6a395b90235b
978
package javax.safetycritical; import vm.Memory; class ScjPeriodicEventHandlerProcess extends ScjProcess { ScjPeriodicEventHandlerProcess(ManagedSchedulable handler, int[] stack) { super(handler, stack); } protected void gotoNextState(PriorityFrame pFrame) { if (state == ScjProcess.State.HANDLED) { // finished executing handleAsyncEvent if (Mission.getMission().terminationPending()) { Mission.getMission().msSetForMission .removeMSObject(msObject); state = ScjProcess.State.TERMINATED; } else { state = ScjProcess.State.SLEEPING; start(); pFrame.sleepingQueue.insert(this); } return; } else if (state == ScjProcess.State.WAITING) { ; } else if (state == ScjProcess.State.REQUIRELOCK) { ; } else { state = ScjProcess.State.READY; pFrame.readyQueue.insert(this); } } void switchToPrivateMemArea() { Memory.switchToArea(((ManagedEventHandler)msObject).privateMemory.getDelegate()); } }
22.227273
83
0.707566
afff763ce2fa1c2e76b9ea8fde1493512bbc41de
1,238
package dev.xframe.net.session; import java.util.function.Consumer; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; public interface OperationListener extends ChannelFutureListener { @Override default void operationComplete(ChannelFuture future) throws Exception { if(!future.isSuccess()) { onFailure(future.cause()); } else { onComplete(); } } void onFailure(Throwable cause); void onComplete(); static OperationListener of(Consumer<Throwable> onFailure) { return of(null, onFailure); } static OperationListener of(Runnable onComplete) { return of(onComplete, null); } static OperationListener of(Runnable onComplete, Consumer<Throwable> onFailure) { return new OperationListener() { @Override public void onFailure(Throwable cause) { if(onFailure != null) { onFailure.accept(cause); } } @Override public void onComplete() { if(onComplete != null) { onComplete.run(); } } }; } }
26.340426
85
0.57916
9f63fc75ed7059692a8a610b787cc0dc517bf2e1
1,960
package edu.nju.mall.conditionSqlQuery; import edu.nju.mall.util.CommonUtils; import lombok.AllArgsConstructor; import lombok.Data; import javax.persistence.criteria.*; @Data @AllArgsConstructor /** * @Description: 简单条件表达式 * @Author: yangguan * @CreateDate: 2019-12-21 19:24 */ public class SimpleCondition implements Condition { private String fieldName; /** * 用于比较的第一个参数 */ private Object value; /** * 用于比较的第二个参数,between的时候用,其他时候为null */ private Object value2; private Operator operator; @Override @SuppressWarnings("unchecked") public Predicate toPredicate(Root<?> root, CriteriaQuery<?> query, CriteriaBuilder builder) { Path condition = root.get(fieldName); switch (operator) { case EQ: return builder.equal(condition, value); case NE: return builder.notEqual(condition, value); case LIKE: // if (!(value instanceof String)) // throw new Exception(); //抛String类型错误 exception return builder.like(condition, CommonUtils.fuzzyStringSplicing((String) value)); case LT: return builder.lessThan(condition, (Comparable) value); case GT: return builder.greaterThan(condition, (Comparable) value); case LTE: return builder.lessThanOrEqualTo(condition, (Comparable) value); case GTE: return builder.greaterThanOrEqualTo(condition, (Comparable) value); case BETWEEN: return builder.between(condition, (Comparable) value, (Comparable) value2); case IN: return builder.isMember(value, condition); case NOT_IN: return builder.isNotMember(value, condition); case ISNULL: return builder.isNull(condition); } return null; } }
30.153846
97
0.605102
b981c90d25b4a0ea3e6123ef29ec8dc2d4afd160
188
package de.bonn.eis.api; import org.springframework.web.bind.annotation.RestController; /** * Created by korovin on 3/18/2017. */ @RestController public class SuggestionController { }
17.090909
62
0.765957
cf3d97c40f65a6e90bad905a455715635ee6107d
421
package com.hutoma.api.containers.sub; import com.hutoma.api.containers.AiDevId; import java.util.UUID; /** * Created by pedrotei on 19/06/17. */ public class AiMinP extends AiDevId { private final double minP; public AiMinP(final UUID devId, final UUID aiid, final double minP) { super(devId, aiid); this.minP = minP; } public double getMinP() { return this.minP; } }
18.304348
73
0.655582
5bfdb767746ae90ae8b5fcf4df46e8c7c35796e8
4,923
package integration.jackplay.play; import fortest.myapp.MyBaseClass; import fortest.myapp.MyClass; import fortest.myapp.MyClassLoader; import jackplay.TheatreRep; import jackplay.bootstrap.PlayGround; import jackplay.play.InfoCenter; import org.junit.Test; import static org.junit.Assert.*; import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; import java.util.Map; public class InfoCenterTest { InfoCenter infoCenter = TheatreRep.getInfoCenter(); final Class MYBASECLASS = MyBaseClass.class; final Class MYCLASS = MyClass.class; final Class JAVA_UTIL_ARRAY_LIST = java.util.ArrayList.class; @Test public void shouldFindLoadedClasses() { List<Class> myclasses = infoCenter.findLoadedModifiableClasses("fortest.myapp.MyBaseClass"); assertEquals(1, myclasses.size()); assertEquals(MYBASECLASS, myclasses.get(0)); } @Test public void shouldFindMatchingMethod() { Method myfunction1 = infoCenter.findMatchingMethod(MyBaseClass.class, new PlayGround("fortest.myapp.MyBaseClass.test1(int,java.lang.String)")); assertNotNull(myfunction1); assertEquals("test1", myfunction1.getName()); Method myfunction2 = infoCenter.findMatchingMethod(MyBaseClass.class, new PlayGround("fortest.myapp.MyBaseClass.test2(java.lang.Object,java.util.List)")); assertNotNull(myfunction2); assertEquals("test2", myfunction2.getName()); Method myfunction3 = infoCenter.findMatchingMethod(MyBaseClass.class, new PlayGround("fortest.myapp.MyBaseClass.test3(java.lang.Object[],int[][])")); assertNotNull(myfunction3); assertEquals("test3", myfunction3.getName()); } @Test public void shouldGiveLoadedMethods() throws Exception { Map<String, Map<String, String>> loadedMethods = infoCenter.allModifiableMethods(); assertEquals("java.lang.String", loadedMethods.get("fortest.myapp.MyBaseClass").get("test1(int,java.lang.String)")); assertEquals("void", loadedMethods.get("java.util.ArrayList").get("clear()")); } @Test public void shouldRecogniseExistenceOfMethodBody() { Method myAbstract = infoCenter.findMatchingMethod(MyBaseClass.class, new PlayGround("fortest.myapp.MyBaseClass.myAbstract()")); Method myNative = infoCenter.findMatchingMethod(MyBaseClass.class, new PlayGround("fortest.myapp.MyBaseClass.myNative()")); Method myfunction2 = infoCenter.findMatchingMethod(MyBaseClass.class, new PlayGround("fortest.myapp.MyBaseClass.test2(java.lang.Object,java.util.List)")); assertFalse(infoCenter.hasMethodBody(myAbstract)); assertFalse(infoCenter.hasMethodBody(myNative)); assertTrue(infoCenter.hasMethodBody(myfunction2)); } @Test public void shouldIncludePrivateInnerClass() throws Exception { MyClass.load(); List<Class> privateInnerClasses = infoCenter.findLoadedModifiableClasses("fortest.myapp.MyClass$MyPrivateInnerClass"); assertEquals(1, privateInnerClasses.size()); Method test1 = infoCenter.findMatchingMethod(privateInnerClasses.get(0), new PlayGround("fortest.myapp.MyClass$MyPrivateInnerClass.test1()")); assertNotNull(test1); List<Class> privateStaticInnerClasses = infoCenter.findLoadedModifiableClasses("fortest.myapp.MyClass$MyPrivateStaticInnerClass"); assertEquals(1, privateStaticInnerClasses.size()); Method test2 = infoCenter.findMatchingMethod(privateStaticInnerClasses.get(0), new PlayGround("fortest.myapp.MyClass$MyPrivateStaticInnerClass.test3()")); assertNotNull(test2); } @Test public void shouldIncludeProtectedInnerClass() throws Exception { MyClass.load(); assertEquals(1, infoCenter.findLoadedModifiableClasses("fortest.myapp.MyClass$MyProtectedInnerClass").size()); assertEquals(1, infoCenter.findLoadedModifiableClasses("fortest.myapp.MyClass$MyProtectedStaticInnerClass").size()); } @Test public void shouldNotUseCanonicalNameForClassName() throws Exception { MyClass.load(); assertEquals(1, infoCenter.findLoadedModifiableClasses("fortest.myapp.MyClass$MyProtectedInnerClass").size()); assertEquals(0, infoCenter.findLoadedModifiableClasses("fortest.myapp.MyClass.MyProtectedInnerClass").size()); } @Test public void shouldFindClassesLoadedByCustomClassLoader() throws Exception { MyClassLoader loader = new MyClassLoader(); Class clz = loader.findClass("CustomLoadedClass"); List<Class> customLoadedClasses = infoCenter.findLoadedModifiableClasses("fortest.dynaloaded.CustomLoadedClass"); assertEquals(1, customLoadedClasses.size()); Method test1 = infoCenter.findMatchingMethod(customLoadedClasses.get(0), new PlayGround("fortest.dynaloaded.CustomLoadedClass.test1(java.lang.String)")); assertNotNull(test1); } }
45.583333
162
0.743652
f6df24ba34020a1121d61dcd6447183260ab42e3
1,035
package com.wang.mall.admin.service; import com.wang.mall.admin.dto.SmsFlashPromotionProduct; import com.wang.mall.model.SmsFlashPromotionProductRelation; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * 闪购商品场次关系Service * * @author 王念 * @create 2020-02-14 15:06 */ public interface SmsFlashPromotionProductRelationService { /** * 批量添加关联 */ @Transactional int create(List<SmsFlashPromotionProductRelation> relations); /** * 修改关联信息 */ int update(Long id, SmsFlashPromotionProductRelation relation); /** * 删除关联 */ int delete(Long id); /** * 获取关联详情 */ SmsFlashPromotionProductRelation item(Long id); /** * 分页查询商品及促销信息 * * @param id 闪购场次id * @param pageNum 页数 * @param pageSize 单页数据大小 */ List<SmsFlashPromotionProduct> list(Long id, Integer pageNum, Integer pageSize); /** * 根据场次id获取商品关系数量 * * @param id */ long getCount(Long id); }
19.528302
84
0.645411
7143af3189f4c1a150a187a2dc13bb415c3424cc
232
/* * Decompiled with CFR. */ package org.benf.cfr.tests; public class CondJumpTest2c { public boolean test(boolean bl, boolean bl2) { boolean bl3; return bl2 && bl == (bl3 = bl2) || bl2 && (bl3 = bl); } }
19.333333
61
0.581897
89882ce0efceed78a615f35faaf93ab6ee85172d
545
package com.bitpress.lambdas.part2; import com.bitpress.lambdas.Orc; import com.bitpress.lambdas.OrcRepository; import java.util.List; public class Main { public static void main(String[] args) { List<Orc> orcList = OrcRepository.getOrcs(); printOrcs(orcList); OrcUtility.sortByName(orcList); printOrcs(orcList); } public static void printOrcs(List<Orc> orcs) { System.out.println("\nOrc Roster:\n"); for (Orc orc : orcs) { System.out.println(orc); } } }
21.8
52
0.633028
53b4d8c4ef12f8669cd580d46461e177b5900433
3,943
/* * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.b2international.snowowl.snomed.reasoner.normalform; import static com.google.common.base.Preconditions.checkNotNull; import java.text.MessageFormat; import java.util.Objects; import com.b2international.snowowl.snomed.datastore.ConcreteDomainFragment; import com.b2international.snowowl.snomed.datastore.SnomedRefSetUtil; import com.b2international.snowowl.snomed.datastore.index.taxonomy.ReasonerTaxonomy; import com.b2international.snowowl.snomed.snomedrefset.DataType; /** * Wraps concept concrete domain members, used in the normal form generation process. */ final class NormalFormValue implements NormalFormProperty { private final ConcreteDomainFragment fragment; private final ReasonerTaxonomy reasonerTaxonomy; /** * Creates a new instance from the specified concrete domain member. * * @param fragment the concrete domain fragment to wrap (may not be <code>null</code>) * @param reasonerTaxonomy * * @throws NullPointerException if the given concrete domain member is <code>null</code> */ public NormalFormValue(final ConcreteDomainFragment fragment, final ReasonerTaxonomy reasonerTaxonomy) { this.fragment = checkNotNull(fragment, "fragment"); this.reasonerTaxonomy = checkNotNull(reasonerTaxonomy, "reasonerTaxonomy"); } public String getSerializedValue() { return fragment.getSerializedValue(); } public long getTypeId() { return fragment.getTypeId(); } public long getRefSetId() { return fragment.getRefSetId(); } public String getMemberId() { return fragment.getMemberId(); } public boolean isReleased() { return fragment.isReleased(); } @Override public boolean isSameOrStrongerThan(final NormalFormProperty property) { if (this == property) { return true; } if (!(property instanceof NormalFormValue)) { return false; } final NormalFormValue other = (NormalFormValue) property; // Check type SCTID subsumption, data type (reference set SCTID) and value equality return true && getRefSetId() == other.getRefSetId() && closureContains(getTypeId(), other.getTypeId()) && getSerializedValue().equals(other.getSerializedValue()); } private boolean ancestorsContains(final long conceptId1, final long conceptId2) { return reasonerTaxonomy.getInferredAncestors().getDestinations(conceptId1, false).contains(conceptId2); } private boolean closureContains(final long conceptId1, final long conceptId2) { return (conceptId1 == conceptId2) || ancestorsContains(conceptId1, conceptId2); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof NormalFormValue)) { return false; } final NormalFormValue other = (NormalFormValue) obj; if (getRefSetId() != other.getRefSetId()) { return false; } if (getTypeId() != other.getTypeId()) { return false; } if (!getSerializedValue().equals(other.getSerializedValue())) { return false; } return true; } @Override public int hashCode() { return Objects.hash(getSerializedValue(), getRefSetId(), getTypeId()); } @Override public String toString() { final String refSetId = Long.toString(getRefSetId()); final DataType dataType = SnomedRefSetUtil.getDataType(refSetId); return MessageFormat.format("{0,number,#} : {1} [{2}]", getTypeId(), getSerializedValue(), dataType); } }
33.700855
105
0.754502
9deff81720278806e47e23db4de56281018e4553
998
package com.gb.snakeladder; import com.gb.snakeladder.model.Game; import com.gb.snakeladder.model.Player; import java.util.Scanner; public class SnakeLadderApplication { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter board Size"); int boardSize = scanner.nextInt(); System.out.println("Enter number of players"); int numberOfPlayers = scanner.nextInt(); System.out.println("Enter number of snakes"); int numSnakes = scanner.nextInt(); System.out.println("Enter number of ladders"); int numLadders = scanner.nextInt(); Game game = new Game(numLadders, numSnakes, boardSize); for (int i = 0; i < numberOfPlayers; i++) { System.out.println("Enter player name"); String pName = scanner.next(); Player player = new Player(pName); game.addPlayer(player); } game.playGame(); } }
33.266667
63
0.630261
02c9e313e6e5596b829c2adbfee8706ee6e15eb8
2,372
package com.manyong.smarttrashcan_final; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; /** * Created by ain53 on 2017-05-30. */ public class dbHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "smarttrash.db"; private static final int DATABASE_VERSION = 1; public dbHelper(Context context){ super(context, DATABASE_NAME , null, DATABASE_VERSION); } public void onCreate(SQLiteDatabase db){ // 회원 정보 테이블 생성 db.execSQL("CREATE TABLE member ( id TEXT PRIMARY KEY," + "password TEXT NOT NULL, name TEXT NOT NULL, address TEXT);"); // 쓰레기통 정보 테이블 생성 db.execSQL("CREATE TABLE trash ( tid int PRIMARY KEY," + "tname TEXT not null, ttime time," + "tlat TEXT, tlon TEXT);"); // 쓰레기통 정보 추가 db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(1, '장영실관', '36.737425', '127.075984');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(2, '대학본부', '36.737680', '127.074972');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(3, '체육관', '36.737574', '127.072892');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(4, '제2공학관', '36.737128', '127.073495');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(5, '제1공학관', '36.736600', '127.074849');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(6, '강석규교육관', '36.735977', '127.074716');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(7, '우체국근처', '36.736247', '127.075738');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(8, '조형관', '36.735187', '127.074256');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(9, '예술관', '36.735169', '127.075037');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(10, '자연대', '36.736227', '127.072320');"); db.execSQL("INSERT INTO trash(tid, tname, tlat, tlon) VALUES(11, '세출호', '36.739448041025646', '127.07539088909981');"); } public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){ db.execSQL("DROP TABLE if EXISTS member"); db.execSQL("DROP TABLE if EXISTS trash"); onCreate(db); } }
47.44
127
0.634486
0fcfb00520809692b436b4848f24a3616e23868b
2,653
package com.github.donkirkby.vograbulary.ultraghost; import java.util.Random; /** * Source of random choices for Ultraghost. Pulled into a separate class to * make it easier to mock out in tests. * @author don * */ public class UltraghostRandom { private Random random; // Each entry holds the odds of that letter appearing in that position. private double[] startingOdds; private double[] interiorOdds; private double[] endingOdds; public UltraghostRandom() { this(new Random()); } public UltraghostRandom(Random random) { this.random = random; } /** * Generate a new puzzle. * @return a string with three upper-case letters */ public String generatePuzzle() { StringBuilder builder = new StringBuilder(3); builder.append(generateLetter(startingOdds)); builder.append(generateLetter(interiorOdds)); builder.append(generateLetter(endingOdds)); return builder.toString(); } /** * Choose the index of the starting student. * @param studentCount the total number of students. */ public int chooseStartingStudent(int studentCount) { return random.nextInt(studentCount); } private char generateLetter(double[] letterOdds) { double remaining = random.nextDouble(); int i = 0; boolean isDone = false; while ( ! isDone) { remaining -= letterOdds[i]; if (i < letterOdds.length-1 && remaining >= 0) { i++; } else { isDone = true; } } return (char) ('A' + i); } /** * Load a list of words that can be used to choose letter frequencies * for generating puzzles. */ public void loadWordList(Iterable<String> wordList) { int alphabetSize = 26; startingOdds = new double[alphabetSize]; interiorOdds = new double[alphabetSize]; endingOdds = new double[alphabetSize]; int wordCount = 0; int interiorCount = 0; for (String word : wordList) { wordCount++; startingOdds[word.charAt(0) - 'A'] += 1; endingOdds[word.charAt(word.length()-1) - 'A'] += 1; for (int i = 1; i < word.length()-1; i++) { interiorCount++; interiorOdds[word.charAt(i) - 'A'] += 1; } } for (int i = 0; i < alphabetSize; i++) { startingOdds[i] /= wordCount; interiorOdds[i] /= interiorCount; endingOdds[i] /= wordCount; } } }
28.836957
75
0.569544
65e453e95f9317d6195b8b348de2f8bf3ce1a375
8,734
package com.bug.parking.widget; import android.app.AlarmManager; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Log; import android.view.View; import android.widget.RemoteViews; import com.bug.parking.R; import com.bug.parking.data.FloorData; import com.bug.parking.data.TimePeriodsData; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit; /** * Created by json on 15. 8. 14.. */ public class MyWidgetProvider extends AppWidgetProvider { public static final String TAG = "ParkingWidget"; private static final String ACTION_FIND_CLICK = "com.bug.parking.action.FIND_CLICK"; private static final String ACTION_UPDATE_BY_ALARM = "com.bug.parking.action.UPDATE_BY_ALARM"; private static final String ACTION_START_ALARM = "com.bug.parking.action.START_ALARM"; private static final String ACTION_STOP_ALARM = "com.bug.parking.action.STOP_ALARM"; private static final String fileName = "park.png"; @Override public void onDisabled(Context context) { stopAlarm(context); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // Perform this loop procedure for each App Widget that belongs to this provider for (int widgetId : appWidgetIds) { RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget); remoteViews.setOnClickPendingIntent(R.id.widget_find, getPendingSelfIntent(context, ACTION_FIND_CLICK)); updateWidget(context, remoteViews); // Intent intent = new Intent(context, SimpleWidgetProvider.class); // intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); // intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds); // PendingIntent pendingIntent = PendingIntent.getBroadcast(context, // 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); // remoteViews.setOnClickPendingIntent(R.id.actionButton, pendingIntent); appWidgetManager.updateAppWidget(widgetId, remoteViews); } } @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (ACTION_FIND_CLICK.equals(intent.getAction())) { find(context); stopAlarm(context); callOnUpdate(context); } else if (ACTION_UPDATE_BY_ALARM.equals(intent.getAction())) { callOnUpdate(context); } else if (ACTION_START_ALARM.equals(intent.getAction())) { startAlarm(context); } else if (ACTION_STOP_ALARM.equals(intent.getAction())) { stopAlarm(context); } } private PendingIntent getPendingSelfIntent(Context context, String action) { // An explicit intent directed at the current class (the "self"). Intent intent = new Intent(context, getClass()); intent.setAction(action); return PendingIntent.getBroadcast(context, 0, intent, 0); } private void callOnUpdate(Context context) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); // Uses getClass().getName() rather than MyWidget.class.getName() for portability into any App Widget Provider Class ComponentName thisAppWidgetComponentName = new ComponentName(context.getPackageName(), getClass().getName()); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidgetComponentName); onUpdate(context, appWidgetManager, appWidgetIds); } private Bitmap getPicture(Context context) { String picturePath = context.getFilesDir().toString() + "/" + fileName; File file = new File(picturePath); Bitmap picture = null; try { picture = BitmapFactory.decodeStream(new FileInputStream(file)); } catch (FileNotFoundException e) { Log.d(TAG, "Error get picture: " + e.getMessage()); } return picture; } private void updateWidget(Context context, RemoteViews remoteViews) { SharedPreferences sharedPref = context.getSharedPreferences(context.getString(R.string.preference_file_key), Context.MODE_PRIVATE); if (sharedPref.getBoolean("parked", false)) { // picture Bitmap picture = getPicture(context); remoteViews.setImageViewBitmap(R.id.widget_picture, picture); // floor int floor = sharedPref.getInt("floor", -1); if (floor != -1) { remoteViews.setTextViewText(R.id.widget_floor, FloorData.getItem(floor)); } // time int period = sharedPref.getInt("period", -1); int hour = sharedPref.getInt("hour", -1); int minute = sharedPref.getInt("minute", -1); if (period != -1 && hour != -1 && minute != -1) { String time = String.format("%s %02d : %02d", TimePeriodsData.getItem(period), hour + 1, minute); remoteViews.setTextViewText(R.id.widget_time, time); } long parkingTime = sharedPref.getLong("parkingTime", 0); if (parkingTime != 0) { Date currentDate = new Date(System.currentTimeMillis()); long timeDiff = currentDate.getTime() - parkingTime; long timeDiffHour = TimeUnit.MILLISECONDS.toHours(timeDiff); timeDiff -= TimeUnit.HOURS.toMillis(timeDiffHour); long timeDiffMinute = TimeUnit.MILLISECONDS.toMinutes(timeDiff); String timeDiffString = String.format("%02d : %02d", timeDiffHour, timeDiffMinute); remoteViews.setTextViewText(R.id.widget_time_diff, timeDiffString); } // memo String memo = sharedPref.getString("memo", ""); if (!memo.isEmpty()) { remoteViews.setTextViewText(R.id.widget_memo, memo); } // find remoteViews.setViewVisibility(R.id.widget_find, View.VISIBLE); } else { remoteViews.setTextViewText(R.id.widget_floor, ""); remoteViews.setTextViewText(R.id.widget_time, ""); remoteViews.setTextViewText(R.id.widget_time_diff, ""); remoteViews.setTextViewText(R.id.widget_memo, ""); remoteViews.setViewVisibility(R.id.widget_find, View.INVISIBLE); } } private void find(Context context) { SharedPreferences sharedPref = context.getSharedPreferences(context.getString(R.string.preference_file_key), Context.MODE_PRIVATE); sharedPref.edit().putBoolean("parked", false).commit(); } private void startAlarm(Context context) { AppWidgetAlarm appWidgetAlarm = new AppWidgetAlarm(context); appWidgetAlarm.startAlarm(); } private void stopAlarm(Context context) { AppWidgetAlarm appWidgetAlarm = new AppWidgetAlarm(context); appWidgetAlarm.stopAlarm(); } public class AppWidgetAlarm { private final int ALARM_ID = 0; private final int INTERVAL_MILLIS = 60000; private Context context; public AppWidgetAlarm(Context context) { this.context = context; } public void startAlarm() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MILLISECOND, INTERVAL_MILLIS); Intent alarmIntent = new Intent(ACTION_UPDATE_BY_ALARM); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, ALARM_ID, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); // RTC does not wake the device up alarmManager.setRepeating(AlarmManager.RTC, calendar.getTimeInMillis(), INTERVAL_MILLIS, pendingIntent); } public void stopAlarm() { Intent alarmIntent = new Intent(ACTION_UPDATE_BY_ALARM); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, ALARM_ID, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.cancel(pendingIntent); } } }
40.248848
139
0.670254