method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c71f33f7-451c-4209-9c4d-e92c9dd0bcc4 | 2 | private PrettyForm getPrettyForm(String uuid_calendar) {
List<PrettyForm> returnPf = this.jdbcTemplate.query(SQL_GET_PRETTY_BY_CAL_ID, new Object[]{UUID.fromString(uuid_calendar)}, new RowMapper<PrettyForm>() {
@Override
public PrettyForm mapRow(ResultSet rs, int rowNum) throws SQLExcept... |
0679baad-c704-48e4-8f90-144a6234fdf7 | 7 | public void onLivingUpdate()
{
super.onLivingUpdate();
this.field_21088_b = this.field_21089_a;
this.field_21086_f = this.field_21087_c;
this.field_21084_h = this.field_21085_g;
this.lastTentacleAngle = this.tentacleAngle;
this.field_21085_g += this.field_21080_l;
... |
369884ae-9df2-40d8-995e-f8167319a115 | 7 | @Override
public boolean perform(final Context context) {
// Example: /<command> pattern[ get][ <Player>]
int position = 2;
if (context.arguments.size() >= 2 && !context.arguments.get(1).equalsIgnoreCase(this.name)) position = 1;
OfflinePlayer target = Parser.parsePlayer(context, pos... |
85c543ff-2be9-488f-a0e1-bfcdf1b76cda | 0 | @Override
public void endSetup(Attributes atts) {
AbstractPreferencesPanel prefPanel = (AbstractPreferencesPanel) GUITreeLoader.getAncestorElementOfClass("com.organic.maynard.outliner.util.preferences.AbstractPreferencesPanel");
prefPanel.endAddSubContainer(this);
} |
ddfa7dea-c92b-47a3-b34e-d410a7bc601e | 2 | public Scope getScope(Object obj, int scopeType) {
int count = scopes.size();
for (int ptr = count; ptr-- > 0;) {
Scope scope = (Scope) scopes.elementAt(ptr);
if (scope.isScopeOf(obj, scopeType))
return scope;
}
return null;
} |
86eb5169-1cbc-4ab6-8268-d397b76a1ed5 | 5 | @Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y))
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
for (Player p:apples.playerList)
{
if (apples.pointDis(X, Y, p.x, p.y)<radius&... |
e25ea9ab-a0fa-47c8-9ce8-45fdd7ba6320 | 3 | int pack(Buffer opb){
// preamble
opb.write(0x03, 8);
opb.write(_vorbis);
// vendor
opb.write(_vendor.length, 32);
opb.write(_vendor);
// comments
opb.write(comments, 32);
if(comments!=0){
for(int i=0; i<comments; i++){
if(user_comments[i]!=null){
opb.write(... |
3cf46793-ecb6-43d9-99df-e1938900de50 | 0 | public void setTable(JTable table) {
this.table = table;
} |
8b28d360-e579-4b6d-9ee7-e8ca1b1ac2ab | 8 | @SuppressWarnings("fallthrough")
private void beforeValue(boolean root) throws IOException {
switch (peek()) {
case NONEMPTY_DOCUMENT:
if (!lenient) {
throw new IllegalStateException(
"JSON must have only one top-level value.");
}
// fall-through
case EMPTY_DOCUMENT: ... |
7b51c577-c05d-4588-b830-91e9565d64da | 5 | @Override
protected Prompt acceptValidatedInput(ConversationContext cc, boolean input)
{
if(input == false)
{
cc.getForWhom().sendRawMessage("You cancelled the selling of the chunk");
return Prompt.END_OF_CONVERSATION;
}
... |
bc171c1f-9329-4073-a283-dd597874e739 | 1 | @SuppressWarnings("deprecation")
public void testPropertyCompareToYear2() {
DateTime test1 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
YearMonthDay ymd1 = new YearMonthDay(2003, 6, 9);
YearMonthDay ymd2 = new YearMonthDay(2004, 6, 9);
YearMonthDay ymd3 = new YearMonthDay(2005, 6, 9);
... |
ace9189a-640d-41f0-8aa7-a585264dfe18 | 2 | public String getPIDByMID(Statement statement,String MID)//根据MID获取PID
{
String result = null;
sql = "select PID from Manager where MID = '" + MID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getString("PID");
}
}
catch (SQLException e)
{
Syste... |
91cb916c-9615-4117-8678-95cc7f7456e0 | 4 | public Component getTableCellRendererComponent(
JTable table, Object obj,
boolean isSelected, boolean hasFocus,
int row, int column) {
if(obj instanceof Collection){
this.setCollection((Collection<? extends O... |
94814a8e-08e3-4201-95e5-f9e3d401ce79 | 4 | public String extractLastName(String fullName)throws Exception {
if (fullName == null || fullName.length() <= 1) {
throw new IllegalArgumentException(ERR_NAME);
}
String[] nameParts = fullName.trim().split(" ");
if (nameParts.length > 2) {
nameParts[1] = nameParts... |
7e0f0154-f353-4a7f-99fc-6e6df989011e | 0 | public void action(){
command.execute();
} |
e9cd39df-4340-4048-ab4c-84aa9d43df21 | 4 | private final OctetWorker getWorker()
{
if (logger.isDebugEnabled()) {
logger.debug("getWorker()");
}
try
{
return(OctetWorker) pool.pop();
}
catch(EmptyStackException x)
{
int maxThreads = XmlRpc.getMaxThreads();
if... |
4ced6181-c2ed-4cef-9507-09a564608d31 | 4 | public PhoneBookGUI(PhoneBook pb) {
super("PhoneBook");
phoneBook = pb;
String fileName = JOptionPane
.showInputDialog("Vilken sparfil vill du läsa in?");
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream(
fileName));
phoneBook = (PhoneBook) in.readObject();
} catch (FileNo... |
af59ac39-9d11-4d46-a8b5-1f69ee9fe336 | 2 | public void printElement(){
System.out.print("CLASS " + identifier + " ATTRIBUTES ");
//print attribute
Iterator<Attribut> it = this.attribut.iterator();
while (it.hasNext()) {
Attribut att = it.next();
System.out.print(att.getIdentifier() + " : " + att.getType() + ", ");
}
//print operation
... |
82a8bd8f-eb6e-4c75-bde9-aaa2963d6d20 | 4 | public void move(Rectangle2D bounds)
{
x += dx;
y += dy;
if (x < bounds.getMinX())
{
x = bounds.getMinX();
dx = -dx;
}
if (x + XSIZE >= bounds.getMaxX())
{
x = bounds.getMaxX() - XSIZE;
dx = -dx;
}
if (y < bounds.getMinY())
... |
15340df1-ac86-45e7-a77f-ee22c505e2b5 | 5 | final Class348_Sub42_Sub11 method1625(int i, int i_0_) {
anInt2963++;
Class348_Sub42_Sub11 class348_sub42_sub11
= (Class348_Sub42_Sub11) aClass60_2960.method583((long) i_0_, -51);
if (class348_sub42_sub11 != null)
return class348_sub42_sub11;
byte[] is;
if ((i_0_ ^ 0xffffffff) > -32769)
is = aClass4... |
f865884d-1614-4e2a-bba9-b82e66388e42 | 6 | private void validateOpCode() throws AssemblyException {
//All opCodes besides END must have a LOC; DC opCodes must have a label
if (opCode == OpCode.END && loc != null || opCode != OpCode.END && loc == null || opCode == OpCode.DC && label == null)
throw new AssemblyException("Invalid line: " + source);
} |
128a1b1a-9656-49b6-a46e-548450be10fe | 8 | public void performButton(GameModel myModel) {
myModel.getMap().unhighlightRange(
targetTileBackground());
if (!myModel.getSelectedUnit().hasAttribute(Attribute.ATTACK)) {
return;
}
AttributeAvailableActions availableActions = (AttributeAvailableActions) myModel... |
a1359718-27be-4b96-b0ba-3283d893efed | 0 | public ButtonClicker(AbstractButton button) {
this.button = button;
} |
7f417723-ef8b-4397-87a0-f978746d532d | 6 | public ArrayList<LinkedList<TreeNode>> createLinkedList() {
ArrayList<LinkedList<TreeNode>> ll_array = new ArrayList<LinkedList<TreeNode>>();
LinkedList<TreeNode> list = new LinkedList<TreeNode>();
int current_depth = 0;
// add depth=0
list.add(this.tree.root);
ll_array.add(list);
while (true) {
// cr... |
cc0f2ffd-2b3e-4e32-a4c9-12d8d84e177c | 4 | public boolean assignWork(int workType, Minion minion) {
switch (workType) {
case 1:
if (missileCount > 0) {
missileCount--;
minion.workType = workType;
minion.updatePosition();
return true;
... |
ee606e23-3ca7-4e8f-95a5-d43a6b16b4f2 | 3 | public void setFrozen(boolean paramBoolean)
{
synchronized (this.FreezeLock)
{
this.Frozen = paramBoolean;
if ((paramBoolean == false) && (this.BufferTainted))
{
if (this.TaintEntireScreen)
repaint();
else
repaint(this.TaintArea.x, this.TaintArea.y, this.... |
cede1ffc-bd63-47dd-acdc-491c486c8cd5 | 9 | @Override
public void onRepaint(Graphics graphics) {
if (Game.isLoggedIn()) {
Graphics2D g = (Graphics2D) graphics;
g.setRenderingHints(RENDERING_HINTS);
g.setColor(new Color(194, 178, 146));
g.fillRect(0, 0, (int) Game.getDimensions().getWidth(), 50);
... |
3827b7ae-3b4c-4bfc-8262-98fb99661a59 | 1 | public boolean isPromotionMove(Piece piece, Field to) {
return piece instanceof Pawn && to.isLastRow(piece.isWhite);
} |
740af648-c031-4470-86ab-d4f023162db7 | 9 | public EvaluadorMano(ArrayList<Carta> pMano) {
cartas = pMano;
// Buscando patrones
calcularDistribuciones();
buscarEscala();
buscarColor();
buscarDuplicados();
// Buscando Valores Especiales
boolean esValorEspecial =
(esE... |
09c2b4b2-2381-40a2-b85a-0750619e4152 | 2 | @Before
public void setUp(){
for(int i = 0; i < 20; i++){
if(i % 2 == 0){
testSolutions.put(i, (double) i);
}else{
testSolutions.put(i, (double) i * 2);
}
}
classUnderTest = new TheStar();
classUnderTest.setSolutionFitness(testSolutions);
} |
2ff1f7b8-f9c9-476c-b58f-49c46fd076ee | 7 | @Override
public List<Set<DirectedGraphNode>>
partition(Collection<DirectedGraphNode> nodeSet) {
if (nodeSet.isEmpty()) {
return Collections.<Set<DirectedGraphNode>>emptyList();
}
nodeSetBelongsToGraph(nodeSet);
this.nodes = new Node[nodeSet.siz... |
2cb909d7-0bcc-43f3-9125-1593183f580d | 0 | public boolean isManaged() {
return managed;
} |
b81909ac-65dd-424d-aef7-41870c3af4e8 | 2 | public static OpenCycInferenceMode fromString(String modeName) {
for (final OpenCycInferenceMode mode : values()) {
if (mode.getDescription().getValue().toString().equalsIgnoreCase(modeName)) {
return mode;
}
}
return null;
} |
2d27f778-c851-4cac-8bc6-9f406e35fa2f | 4 | @Override
public void keyReleasedFramework(KeyEvent e) {
switch (gameState) {
case MAIN_MENU:
//the user can press any key to start the game, when a key
//any key is released the game starts
newGame();
break;
case GAMEOV... |
2daab293-b6e7-4435-aafe-bdf559b8cfda | 7 | public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
final String sortType = request.getParameter("sortType");
Player[] all = Roster.getRoster().getAll();
Arrays.sort(all, new Comparator<Player>() {
public int compare(Play... |
6685e99d-498c-4f00-bd9b-60ce4bbe78b1 | 9 | private ValCol negaMaxWithABPruning(int depth, int counter, int sign,
int alpha, int beta) {
if (isStopSignaled) {
return null;
}
if (boardCopy.gameOver() || depth == searchDepth) {
int util = sign * boardCopy.getAnalysis(counter);
return new ValCol(util, -1);// col doesn't matter since search depth
... |
568bf504-78a8-48b2-a207-e18abd854bb3 | 1 | public void closeCon()
{
try
{
con.close();
}
catch (Exception e)
{
System.out.println("Error while closing connection: " + e.toString());
}
} |
7b7aa577-0057-494e-a9bb-2523f25b06ad | 5 | @Override
public void focusLost(FocusEvent arg0) {
try {
String Str = _view.edt_ID.getText();
if (!Str.isEmpty() && runtime >=0) {
if (runtime==0) runtime++;
csearch(Integer.parseInt (Str));
... |
36a37fc8-e2f6-45d6-9990-a536096d3f61 | 4 | public void SetAImove(Coordinate move) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetAImove() BEGIN");
}
m_AImove = move;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetAImove() END");
}
} |
3bd6796e-d0bc-40bd-beab-ff7fab623f2d | 8 | @EventHandler(ignoreCancelled = true)
public void handle(PlayerInteractEvent event) {
Material mat = event.getMaterial();
Action action = event.getAction();
Player player = event.getPlayer();
Block b = event.getClickedBlock();
GameSession session = plugin.getGameManager().getGameSessionOfPlayer(player);
if... |
591dd30f-49f9-4d53-a909-e1db03db5154 | 4 | public boolean unpin( int frameNo ) throws InvalidFrameNumberException, PageUnpinnedException
{
if ((frameNo < 0) || (frameNo >= (int)mgr.getNumBuffers())) {
throw new InvalidFrameNumberException (null, "BUFMGR: BAD_BUFFRAMENO.");
}
if ((mgr.frameTable())[frameNo].pin_count() == 0) {
... |
b85cc47e-804d-441c-9dae-b66777384f14 | 5 | @EventHandler
public void onPlayerMove(PlayerMoveEvent e){
Player player = e.getPlayer();
if(e.getFrom().getBlock().getLocation().equals(e.getTo().getBlock().getLocation())){
return;
}
Location location = e.getTo();
location.setY(location.getY() - 2);
if(location.getBlock().getState() instanceof Sign){
... |
7ba65d28-1412-48aa-ae8f-93d71bed138b | 4 | public static boolean readBooleanAttribute(Element elem, String name,
boolean defaultValue)
{
boolean back = defaultValue ;
String str = elem.getAttribute(name) ;
if (str != null)
{
if (str.length() > 0)
{
int hash = str.hashCode() ;
... |
6f6332b2-6769-4eba-8f4a-d69c9716a1e4 | 6 | static protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
line += (column = ... |
45e28db6-9ee8-4185-a4f9-9be4dba5e5ab | 5 | private String getType(String houzhui){
if(houzhui.equals("jpg")||houzhui.equals("jpeg")||houzhui.equals("png")||houzhui.equals("gif"))
return "image";
else if(houzhui.equals("txt"))
return "text";
return "";
} |
7b61a33c-346b-4d2e-b36c-6ef621bdfd2a | 1 | public void setCanBeAvail(final boolean flag) {
canBeAvail = flag;
if (SSAPRE.DEBUG) {
System.out.println(this);
}
} |
0e60300d-7f90-428e-9d0a-d5bbca1e130a | 7 | private static void printAllPrimes(int limit){
if(limit<=1)
System.out.println("No Primes");
else if(limit==2)
System.out.println("Primes : 2");
else{
for(int dividend=3; dividend<limit; dividend++){
if(dividend%2==0)
continue;
boolean isPrime = true;
int loopCounter = 0;
fo... |
c54bae24-2e75-467b-ad6b-f08a31ba13b1 | 6 | private Response takeAnswer() throws IOException{ //Implementation to take answer input. Used for storing user responses and storing answer keys.
String s; //Input String
@SuppressWarnings("unchecked")
ArrayList<String> copy = (ArrayList<String>) choice.clone(); //Replacement of choice to allow popping off option... |
4f44d157-c984-46c3-a39a-7030ce2837f0 | 8 | public void reset() {
for (int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[x].length; y++) {
tiles[x][y] = new Tile(x, y);
if (x == 0 && y == 0) {
tiles[x][y].setState(State.START);
start = tiles[x][y];
... |
7317feab-1f4e-4347-b00d-5ca580f91c69 | 7 | public void setCurrentPlayer(int player) {
if (current_player != -1) {
for (int i = 0; i < unitDefinitions.resource_defs.get(current_player+1).size(); i++) {
unitDefinitions.resource_defs.get(current_player+1).get(i).active_player = false;
}
for (int i = 0; i < unitDefinitions.unit_defs.ge... |
d2ad1aa4-d095-4f92-b62a-9d4ad2c4da15 | 8 | private void executeCommand(String command, List<String> arguments) {
try {
if (command.equals("CreateGraph")) {
createGraph(arguments);
} else if (command.equals("CreateNode")) {
createNode(arguments);
} else if (command.equals("AddNode")) {
... |
77817e59-c179-4c00-9d1e-1e15afad4f7d | 7 | public boolean processMsg(CConnection cc) {
is = (FdInStream)cc.getInStream();
os = (FdOutStream)cc.getOutStream();
client = cc;
initGlobal();
if (session == null) {
if (!is.checkNoWait(1))
return false;
if (is.readU8() == 0) {
int result = is.readU32();
String... |
43d494c9-c816-4422-be7d-a9ec54159e67 | 6 | public static final void TransformPlayer(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
// D9 A4 FD 00
// 11 00
// A0 C0 21 00
// 07 00 64 66 62 64 66 62 64
slea.skip(4); // Timestamp
final byte slot = (byte) slea.readShort();
final int itemId = slea.readInt();
final S... |
a584bcfc-e51b-448f-a8d7-62cc395b44e0 | 3 | public boolean isInside(int x, int y) {
return x >= 0 && y >= 0 && x < width && y < height;
} |
73aa6539-6be6-462e-8a41-89e2aa77b682 | 3 | @Override
public boolean equals(final Object that){
return this == that || (that != null && this.getClass() == that.getClass()) && this.getCharacter() == ((Hangul) that).getCharacter();
} |
6bb8c1a5-123e-41c0-8a84-7a82d78ac800 | 3 | public void atIntConst(IntConst i) throws CompileError {
arrayDim = 0;
int type = i.getType();
if (type == IntConstant || type == CharConstant)
exprType = (type == IntConstant ? INT : CHAR);
else
exprType = LONG;
} |
1f331f0d-cb32-46be-9240-09657daad8c3 | 9 | public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("ok") || e.getSource() == bacString) {
if (!sha1.isSelected()) {
if (bacString.getText().length() == 0) {
bacValue = null;
} else {
bacValue = bacString.getText().getBytes();
}
} else {
try {
MessageDiges... |
82e4ccf6-1c84-4691-a26b-8b12a858f674 | 9 | private void parseArguements(String[] args, Job job) throws IOException {
for (int i = 0; i < args.length; ++i) {
if ("-input".equals(args[i])) {
String files = args[++i];
for (String file : files.split(",")) {
FileInputFormat.addInputPath(job, new Path(file));
}
} else if ("-output".equals(arg... |
111f23f0-2adf-414b-af5d-52f1fed46d67 | 7 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
WerknemerService werknemerService = new WerknemerService();
List<String> fouten = new ArrayList<>();
BigDecimal opslagBedrag = null;
Long werknemersNr = Long.parseLong(request.getParameter("... |
b7c08aea-f216-43aa-88ed-1154a981a543 | 8 | public static void main(String[] args) {
Scanner input = new Scanner(System.in);
float x = input.nextFloat();
float y = input.nextFloat();
//checks for the whole rectangle made from the little ones
if ((x >= 12.5 && x <= 22.5) && (y >= 6 && y <= 13.5)) {
//checks if the point is in the smallest rectang... |
64bdfb28-97db-4b2e-b4bf-4439fe9e6750 | 5 | private Boolean CheckIfCrafted(Player player) {
ItemStack i = player.getItemInHand();
if (i == null)
return false;
if (!i.hasItemMeta())
return false;
// Meta stuff
ItemMeta im = i.getItemMeta();
if (!im.hasDisplayName())
return false;
String dn = im.getDisplayName();
List<String> lore = im.ge... |
123898c5-7a07-4fb7-a8cc-cee0e246e6f6 | 2 | public String outCar(String ticket) {
if(ticket.equals("")){
return "请输入你的取车票据号!";
}
if(!contain(new Ticket(ticket))) {
return "我们这没有停你的车。";
}
Car car = out(new Ticket(ticket));
return "OK,车牌是[" + car.getCode() + "],欢迎下次光临。";
} |
415a3dae-fb82-4ba9-b62f-bc25683a7986 | 0 | public String getId()
{
return id;
} |
9f9978bb-561f-4818-800e-a3229eb85d12 | 1 | void removePermantly(){
for(LightTrailPart lightTrailPart: getLightTrailParts()){
lightTrailPart.removePermantly();
}
} |
36b635ec-15f4-41a9-a03f-ef10607d877a | 7 | public boolean buttonUp(Controller controller, int code) {
switch(code){
case XBox360Pad.BUTTON_A: MyInput.setKey(Input.JUMP, false); break;
case XBox360Pad.BUTTON_X: MyInput.setKey(Input.INTERACT, false); break;
case XBox360Pad.BUTTON_RB: MyInput.setKey(Input.ATTACK, false); break;
case XBox360Pad.BUTTON_Y: ... |
33131afb-a937-4979-b3d7-ba24f685768b | 6 | public boolean pickAndExecuteAnAction() {
synchronized(orders) {
for(Order o : orders) {
if(o.s == OrderState.PickedUp) {
removeOrder(o);
return true;
}
}
}
synchronized(orders) ... |
5e03f647-c4da-4251-80c1-60454ae91a9c | 5 | private boolean processCommand(Command command)
{
boolean wantToQuit = false;
CommandWord commandWord = command.getCommandWord();
switch (commandWord) {
case UNKNOWN:
System.out.println("I don't know what you mean...");
break;
case ... |
4e4c7b30-9ad4-4f90-8b7a-ff0c914c9dc2 | 0 | public PrimitiveUndoableEdit(Node node, String oldText, String newText) {
this.node = node;
this.oldText = oldText;
this.newText = newText;
} |
31581488-4453-4394-bff1-870c89ac918d | 9 | public static Set cal(int n , int m){
Set[][] a = new HashSet[n+1][m+1];
for(int i= 0; i<=n;i++)
for(int j = 0; j<=m;j++){
a[i][j] = new HashSet();
if(j==i && i >= 1) {
List l = new ArrayList();
l.add(j);
... |
6996c1f8-a70d-4f35-b678-1d2d12cde655 | 3 | public boolean hasIdNodeName(Node serverNode, String name) {
NodeList elements = serverNode.getChildNodes();
boolean isNode = false;
for (int i = 1; i < elements.getLength(); i++) {
Node element = elements.item(i);
if (element.getNodeName().equals("id") && element.getText... |
b0fbef0d-9c68-47da-ae2d-d3fd0f533eba | 1 | @SuppressWarnings("unchecked")
public E next()
{
if (!hasNext()) throw new NoSuchElementException();
E r = (E) elements[(head + offset) % elements.length];
offset++;
return r;
} |
a7341aa0-99a8-4c88-a95a-1e639feb1d00 | 0 | @AnnotationTest(value1 = "dd")
public static void main(String[] args)
{
AnnotationUse usage = new AnnotationUse();
usage.method();
} |
7bdaacb9-96a9-45c3-8768-59ca6c298016 | 4 | public TO convert(FROM m,TO defaultValue,Object... args) throws HeraException{
try {
if(args.length == 0){
return convertNumber(m,defaultValue);
} else if(args.length == 1){
return convertNumber(m,defaultValue,Boolean.valueOf(args[0].toString()));
} else {
throw new HeraException("未找到匹配的参数");
... |
7b28f12b-ec4a-4b98-96d6-7352db7494b6 | 1 | public static List<List<Character>> combine(String word, int k) {
List<Character> list = new ArrayList<Character>();
for (int i = 0; i < word.length(); i ++) {
list.add(word.charAt(i));
}
Collections.sort(list);
return comb(k, list);
} |
6fd14bed-d577-4329-8622-87911f9a87fe | 1 | public void inicializadorPalabraParaTest(String palabra){
palabraActual = palabra.split("");
for(int i=1; i<palabraActual.length; i++){
palabraRespuesta.add("_");
}
tamanioPalabra = palabraActual.length - 1;
} |
1a395e1d-db6a-4a2e-8b3c-f4a26254a525 | 9 | private static void method377(int ai[], int i, int j, int l, int i1)
{
int k;//was parameter
if(aBoolean1462)
{
if(i1 > DrawingArea.centerX)
i1 = DrawingArea.centerX;
if(l < 0)
l = 0;
}
if(l >= i1)
return;
i += l;
k = i1 - l >> 2;
if(anInt1465 == 0)
{
while(--k >= 0)
{
ai[... |
8b2f69e9-fc9f-4df7-98a5-7647c637fba6 | 0 | public void setSportKit(boolean sportKit) {
this.sportKit = sportKit;
} |
98a75c88-ba12-41d0-91e0-0332ef288f5f | 5 | private void adjustFlight(float height) {
//
// Firstly, determine what your current position is relative to the aim
// point-
final Vec3D disp = aimPos.sub(position, null) ;
final Vec2D heading = new Vec2D().setTo(disp).scale(-1) ;
//
// Calculate rate of lateral speed and descent-
f... |
28f7a89c-a7c3-4991-8bf9-14f4ccf122f3 | 9 | private List<Action> buildOrder(Player a) {
List<Action> actions = new ArrayList<Action>();
for(Action action : a.getActions()){
if (action.type == Type.Building && buildings)
actions.add(action);
if (action.type == Type.Unit && units)
actions.add(action);
if (action.type == Type.Research && resea... |
2f4cde84-b091-4761-95e3-e21acda8514d | 4 | private String munecoIntermedio(){
String muneco = "";
if(intentos == 3){
muneco = muneco + " O <BR>"+
" / <BR>";
}
if(intentos == 2){
muneco = muneco + " O <BR>"+
" /|\\ <BR>";
}
if(intentos == 1){
muneco = muneco + " O <BR>"+
" /|\\ <BR>"+
... |
2e019e67-4ba3-43eb-a7bb-6ba38b3c05e6 | 9 | @Override
public void reset() {
turns = 0;
for (Agent agent : Lagents)
agent.reset();
e = new Square[gameSize][gameSize]; // creation of environment array
totalC = 0;
for (int i = 0; i < e.length; ++i)
for (int j = 0; j < e[0].length; ++j) {
e[i][j] = new Square();
e[i][j].available = true;
... |
8ef70914-4ee9-4db8-a3cd-887a53437797 | 6 | private BeanProperty findImmediateProperty(Class<?> clazz, String property)
throws NoSuchPropertyException {
BeanProperty result = null;
try {
BeanInfo bi = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor pd : bi.getPropertyDescriptors()) {
if (!"class".equals(pd.getName())) {
BeanProp... |
25d830fb-dab0-4592-ad5b-3ec17cb0873f | 3 | /* */ @EventHandler
/* */ public void onInventoryOpen(InventoryOpenEvent event)
/* */ {
/* 296 */ if (!(event.getPlayer() instanceof Player))
/* */ {
/* 298 */ return;
/* */ }
/* */
/* 302 */ Player p = (Player)event.getPlayer();
/* */
/* 304 */ if (Main.get... |
019f3a76-b32e-4995-b146-c443d7cab50c | 6 | @Override
public String getQuerySQL() {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yy", Locale.US);
if (beginDate!=null || endDate!=null || lastNum!=null) {
return "select P.ID, P.REGNUM, P.ID_TYPE, P.BEGINDATE, PT.GROUPTYPE, PT.TYPE " +
"from DPS$PACK... |
b87a1b22-d9f2-48aa-8477-4e16c321e109 | 6 | public int getIdLastDevice() {
Connection conn = null;
PreparedStatement st = null;
ResultSet row = null;
int id = 0;
try {
conn = OracleDAOFactory.createConnection();
st = conn.prepareStatement(GET_ID_LAST_DEVICE);
row = st.executeQuery();
if (row.next()) {
id = row.getInt(1);
}else{
... |
d3ef8d02-263d-409b-9845-207458f8fb07 | 7 | @Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Connection connect = null;
Statement statement = ... |
4664b758-7455-4879-b536-41950e59f268 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cost other = (Cost) obj;
if (periods == null) {
if (other.periods != null)
return false;
} else if (!period... |
581c1a7a-6a22-45c5-bc5b-db40dae7b213 | 8 | public static void fillHex(int i, int j, int n, Graphics2D g2) {
int x;
if (i % 2 != 0) {
x = j * h + r;
} else {
x = j * h;
}
int y = i * (h - (t / 2));
switch (n) {
// BLANK
case 0:
g2.setColor(COLOURCELL)... |
046ccad0-0c99-443d-8a8b-ba3d5eb183ce | 0 | public void addTreatment(Treatment treatment){
this.treatment.add(treatment);
} |
2351529e-7fb7-4cdd-91f6-c8c649725f62 | 8 | public void stopCalculatingGravity(boolean vectorField) {
// Wait for all to finish
if (vectorField) {
synchronized (vectorFieldFutures_) {
while (!vectorFieldFutures_.isEmpty()) {
try {
vectorFieldFutures_.poll().get(2,TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStack... |
007e4cae-6f82-4d29-8583-5cfaa7ef901d | 7 | static boolean validCube(long[][] a){
for(int i=0; i<8; i++){
long[] distance = new long[7];
int n=0;
for(int j=0; j<8; j++){
if(i!=j){
distance[n++] = distanceSquare(a, i, j);
}
}
Arrays.sort(distanc... |
004db9cc-1e76-4ff4-bb43-8d722a9f3a19 | 4 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Position other = (Position) obj;
return this.x == other.x && this.y == other.y;
} |
13013176-19a6-44e1-b3a4-b38326ef16a0 | 7 | public void inxbuild() {
int i, j, smallpos, smallval;
int[] p;
int[] q;
int previouscol, startpos;
previouscol = 0;
startpos = 0;
for (i = 0; i < netsize; i++) {
p = network[i];
smallpos = i;
smallval = p[1]; /* index on g */
/* find smallest in i..netsize-1 */
for (j = i + 1; j < netsiz... |
1f2b5161-83a8-45cc-8282-e3c63b74cb13 | 7 | public void removeListener(Class<? extends SequenceListener> listenerClass,
int preOrPost) {
List<SequenceListener> toRemove = null;
SequenceGenerator gen = null;
if (preOrPost == POST) {
toRemove = postTrimListeners;
gen = (TrimmingListener) getListener(TrimmingListener.class, PRE);
}
if (preOrPost ... |
9651dd71-5a0f-443d-a753-dfa2a04233ea | 7 | public static Node<Integer> cycleStart(Node<Integer> head) {
//zero or single node
if(head == null || head.next == null) {
return null;
}
Node slow = head;
Node fast = head;
while(fast!=null && fast.next!= null) {
slow = slow.next;
f... |
cea90da9-e8da-4166-a312-7b81a53ae82f | 4 | public int getLine(String id) {
for (Symbol p : params) {
if (p.getName().equals(id))
return p.getLine();
}
for (Symbol v : symbols) {
if (v.getName().equals(id))
return v.getLine();
}
return -1;
} |
273fc517-6124-4abe-ac6c-6bd8db5ae4bd | 1 | @Override
public void dragOver(DropTargetDragEvent dtde) {
if (mDragDockable != null) {
updateForDragOver(dtde.getLocation());
dtde.acceptDrag(DnDConstants.ACTION_MOVE);
} else {
dtde.rejectDrag();
}
} |
aaecd8ff-2bfa-4cb3-baa5-68fa47f9e3ba | 1 | @Override
public Color getPixel() {
if (r.nextFloat() < 0.5)
return Color.black;
else
return Color.white;
} |
ff037de9-7cdb-4069-a3d5-3bb142092a05 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
8398ca1b-0643-45f6-92ad-f46b06463cfd | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-YOUPOSS> sk... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.