method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
219e1ba3-9471-4b1d-ac2a-4690e001c434 | 4 | @Override
public void itemStateChanged(final ItemEvent e) {
if (canControlColumn()) {
if ((e.getStateChange() == ItemEvent.DESELECTED)
//JW: guarding against 1 leads to #212-swingx: setting
// column visibility programatically fails if
... |
68937d4f-2199-420c-a4ad-3ab7697895b8 | 6 | private void addGenerator(Generator generator) throws InitializationError
{
Class<?> klass = generator.klass();
Class<? extends Gen<?>> genClass = generator.generator();
// This might not be possible, but I'm unsure.
if (klass == null || genClass == null) {
throw new In... |
852ef7a9-7253-449a-bc65-a23dfc0bf50b | 0 | public Window(int _width, int _height, boolean _fullscreen, boolean _vsync, String _title) {
this.width = _width;
this.height = _height;
this.fullscreen = _fullscreen;
this.vSync = _vsync;
this.title = _title;
this.updateAspectRatio();
} |
c79dffb3-3607-42e3-85c1-7a274cc1f4e9 | 2 | public void render(Graphics g) {
Projectile projectile = null;
try {
for (String key : projectiles.keySet()) {
projectile = (Projectile) projectiles.get(key);
projectile.render(g);
}
} catch (ConcurrentModificationException concEx) {
... |
b36dfc8a-ed26-4b91-9bdd-6eee71572a4c | 3 | public void disableServiceModeWithGrace(Player player)
{
if(null != player)
{
if(playersInGracePeriod.containsKey(player.getName()))
{
playersInGracePeriod.remove(player.getName());
}
// if player has no service item in hand after grace period has expired,... |
b0f79794-eeb8-46e4-abb6-7725eefc9e0e | 0 | private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
id = in.readInt();
Name = in.readUTF();
System.out.println("read Object");
} |
9f5b7f95-a090-4786-8aac-61f717ebfdc9 | 5 | private void readActionProperties(String actionPrefix) {
String propertyPrefix = actionPrefix + ".";
try {
putValue(NAME, Tools.getLocalizedLabelText(propertyPrefix + NAME));
} catch (IllegalArgumentException ex) {
}
putValue(DEFAULT, getValue(NAME));
putValue(POPUP, getOptionalString(propertyPrefix + PO... |
2cc4914d-6686-4bd5-8e6e-5cb2526b11b0 | 7 | private String findName(int i, int j){
String suit;
if (i == 0) {
suit = "Hearts";
}else if (i == 1) {
suit = "Spades";
}else if (i == 2) {
suit = "Clubs";
}else{
suit = "Diamonds";
}
if (j == 0) {
return "A" + suit;
}else if (j == 10) {
return "J" + suit;
}else if (j == 11) {
re... |
531c987d-68d6-44e8-911f-c16198d0c82e | 4 | public void demagnify(){
if(magnifyingLevel == 2.5){
setMagnifyingLevel(1.5);
}else if(magnifyingLevel == 0.5){
setMagnifyingLevel(0.25);
}else if(magnifyingLevel == 1){
setMagnifyingLevel(0.5);
}else if(magnifyingLevel == 1.5){
magnifyingLevel = 1;
}
} |
532bc514-a18c-4c0c-87b5-6177783a3f3a | 6 | private static String[][] insertSorted(String[][] scoreToAdd,
String[][] previousScore) {
if (previousScore==null){
return scoreToAdd;
}
String temp[][]=new String[previousScore.length+1][2];
boolean hasInserted = false;
int intScoreToAdd = Integer.parseInt(scoreToAdd[0][1]);
for (int ... |
ba5f68d8-d9b9-4b2a-97fb-b1122a650727 | 5 | private void pausedOrderTable()
{
try
{
managerOrder.addObserver(this);
modelOrder = new OrderTablemodel(managerOrder.getPaused());
tblOrderList.setModel(modelOrder);
tblOrderList.getSelectionModel().addListSelectionListener(n... |
173c288d-57fd-4bba-8ee7-3e73eeb9ddeb | 7 | public void setLink(boolean input, int val) throws Exception {
m_input = input;
if (input) {
m_type = PURE_INPUT;
}
else {
m_type = PURE_OUTPUT;
}
if (val < 0 || (input && val > m_instances.numAttributes())
|| (!input && m_instances.classAttribute().isNominal()
&... |
b9ffafeb-25f8-4b31-af27-2fbdd68644d7 | 6 | public static void main(String args[]){
//Creating a colour scheme to test the renderer with
int colourSize = 5;
Colour[] colours = new Colour[colourSize];
for (int i=0; i<colourSize; i++) {
switch (i) {
case 0: Colour black = new Colour("#000000");
colours[i] =... |
79ead3ca-3269-4f8c-be31-0e7d78b36063 | 1 | private double nopeusToistaKohti(Pelihahmo h){
if (onkoNopeusToistaKohti(h)){
return Math.cos(hahmojenValinenKulma(h) - nopeudenSuunta(h))*kokonaisnopeus(h);
} else {
return 0;
}
} |
46dfee21-fc9f-4aa5-b657-d3784131b34e | 0 | public static void main(String[] args) {
String[] rankArray = {"Ace", "Jack", "King", "Queen", "Ten", "Nine", "Eight", "Seven", "Six", "Five", "Four", "Three", "Two"};
String[] SuitArray = {"Spades", "Diamonds", "Clubs", "Hearts"};
Integer[] pointArray = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
Deck Bicycle... |
cd729f7a-8e3f-4edc-9a11-5f9fb6f28beb | 5 | @Override
public boolean activate() {
final boolean valid = workLeft();
if ((valid && (GraniteMiner.curState == GraniteMiner.Status.NONE))) {
GraniteMiner.curState = THIS_STATE;
} else if (!valid && (GraniteMiner.curState == THIS_STATE)) {
GraniteMiner.curState = Gra... |
d35a2f30-3c24-4ea7-a816-0bb7ee796e7b | 1 | public void ListPatient(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
log.debug("PatientManager ListPatient method called...");
PatientService patientService=new PatientServiceImpl();
List<Patient> patientList = null;
try {
patientList = patientService... |
b4b6176b-5d8f-47f7-8eb9-181ee4b6fd69 | 2 | public static EnumLine getEnumLine(int value) {
for (EnumLine line : EnumLine.values()) {
if (line.getPosition() == value) {
return line;
}
}
return null;
} |
f13741b9-35a1-4434-9b8e-1fc6dec078a4 | 0 | public static void main(String[] args) {
new InnerThread1("InnerThread1");
new InnerThread2("InnerThread2");
new InnerRunnable1("InnerRunnable1");
new InnerRunnable2("InnerRunnable2");
new ThreadMethod("ThreadMethod").runTask();
} |
754b9340-56d7-4bd3-99fc-2bf2efadd35a | 2 | private void update_substracted_distribution( int j, double[] bowl ) {
if( 0 == j ) {
Arrays.fill(substracted_distribution, 0);
}
for (int i = 0; i < pref.length ; i++) {
substracted_distribution[i] += bowl[i];
}
} |
6175dd2a-5cd8-4ff4-9646-aee67295cf5c | 8 | public DimensionValueCollection getAllAsDimensionValueCollection ()
{
DimensionValueCollection cc = new DimensionValueCollection ();
if(size() != 0)
{
for(EnumMap <EpisodicMemory.InfoStored, DimensionValueCollection> i : values())
{
for(DimensionValueCollection c : i.values())
{
for(Dimension ... |
00943862-1650-4cf5-98f9-b90551f01e30 | 6 | public static String decoder(long[] message) {
String texte = "";
// On traite chaque bloc de message
for (int k = 0; k < message.length; k++) {
String strEnc = "" + message[k];
// On ajuste la longueur en ajoutant des espaces à gauche
while (strEnc.length() <... |
81c1302d-bb56-4fe8-a607-c621a453cbb5 | 2 | public static ScreenshotImage takeScreenShot() {
if (robot == null) {
try {
robot = new Robot();
} catch (AWTException ex) {
System.err.println(ex.getMessage());
return null;
}
}
// Get the dimensions of... |
190e64ba-32f4-42b8-9fc6-e03b33e2b786 | 2 | public static void ChooseAustin ()
{
if (Game.characterChoice == 1)
{
Game.CharacterOne = "Austin";
Game.CharacterOneHP = CharacterStats.AustinHP;
Game.CharacterOneAttack = CharacterStats.AustinAttack;
Game.CharacterOneMana = CharacterStats.AustinMana;
Game.CharacterOneRegen = CharacterSt... |
c8019c48-f309-4c3d-9dcd-57480d9c29ea | 0 | public static void main(String[] args)
{
JFrame frame = new JFrame("TopLevel Demo !");
JLabel label = new JLabel("hello");
label.setBackground(Color.YELLOW);
label.setPreferredSize(new Dimension(200,160));
JMenuBar menuBar = new JMenuBar();
menuBar.setBackground(Color.cyan);
menuBar.setPrefer... |
6535584f-751e-4206-b809-6212ba9b8072 | 6 | public void placeInPortal(World par1World, Entity par2Entity)
{
if (par1World.worldProvider.worldType != 1)
{
if (!this.placeInExistingPortal(par1World, par2Entity))
{
this.createPortal(par1World, par2Entity);
this.placeInExistingPortal(par1Wor... |
3feba1f1-a86e-4300-993d-d131ffdc25b6 | 5 | public static int BiGram_compute(String target, String word){
int similarity = 0;
char char1, char2;
StringBuilder wordStr1 = new StringBuilder('#' + word);
StringBuilder wordStr2 = new StringBuilder(word + '#');
Queue<Character> targetQueue1 = new LinkedList<Character>();
... |
12bab26f-fe64-466c-919d-9627631ee763 | 6 | public void visitInsn(final int opcode) {
// adds the instruction to the bytecode of the method
code.putByte(opcode);
// update currentBlock
// Label currentBlock = this.currentBlock;
if (currentBlock != null) {
if (compute == FRAMES) {
currentBlock.frame.execute(opcode, 0, null, null);
} else {
... |
3b414dcc-8fea-4b07-8568-e026e8d7d593 | 1 | public BaseDBLPInfos()
{
if(connection == null){
connection=new connection();
}
sql=connection.conn();
} |
e029a9da-8a29-4849-bb56-fa55478dea7d | 8 | private static boolean checkRegion(int region, int num, Puzzle puzzle) {
int numFound = 0;
int rowStart = region/3 * 3;
int colStart = region % 3 * 3;
for (int row = rowStart ; row < rowStart + 3; row ++) {
for (int col = colStart; col < colStart + 3; col++) {
... |
25ba4241-d6cb-4339-babb-fac6d625ba32 | 3 | public void init(FilterConfig config) throws ServletException {
this.filterConfig = config;
this.encoding = filterConfig.getInitParameter("encoding"); //从web.xml文件中读取encoding的值
String value = filterConfig.getInitParameter("ignore"); //从web.xml文件中读取ignore的值
//以下三种情况均为忽略大小写
if... |
2e7eba61-0697-428e-a4c1-fc19f90faf1e | 9 | private boolean check() {
if (!isBST()) StdOut.println("Not in symmetric order");
if (!isSizeConsistent()) StdOut.println("Subtree counts not consistent");
if (!isRankConsistent()) StdOut.println("Ranks not consistent");
if (!is23()) StdOut.println("Not a 2-3 tree"... |
34ce0bf7-49bc-4b6d-b2c0-7cf60c29dd07 | 0 | protected void execute() {} |
f694a921-7e49-4723-bb02-d2e3ca5cf6b4 | 1 | public void visitIntInsn(final int opcode, final int operand) {
if (mv != null) {
mv.visitIntInsn(opcode, operand);
}
execute(opcode, operand, null);
} |
bb6b0c69-1fb8-4230-a714-c3e45fbde4ae | 5 | private void loadIntersections() {
File file = null;
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].getName().equals("nodeID-lat-lon.tab")) {
file = listOfFiles[i];
break;
}
}
try {
Scanner sc = new Scanner(file);
while (sc.hasNextLine()) {
if (sc.hasNext()) {
in... |
93a5b6e6-a238-4cbb-ae18-99d60e8c0c23 | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
396379d7-7026-4035-8e86-6d80ebd400e8 | 8 | public String getValue() {
// The entity was not correctly initialised.
if (stringValue == null && hashValue == null) return id;
if(stringValue != null) {
return stringValue;
}
if (index == null) {
String value = hashValue.getDefault();
... |
220aba4f-1ca6-4e9d-a428-70621d3a4eac | 8 | public Color stateToColor(String state, boolean hard)
{
if (state.equals("0") == true)
return config.getBackgroundColorOkStatus();
else if (state.equals("1") == true) {
if (hard)
return config.getWarningBgColor();
return config.getWarningBgColorSoft();
}
else if (state.equals("2") == true) {
if... |
3ba107ff-c522-46fd-83d9-80e103fe51aa | 6 | public void writeTo(final CodedOutputStream output) throws IOException {
final boolean isMessageSet =
getDescriptorForType().getOptions().getMessageSetWireFormat();
for (final Map.Entry<FieldDescriptor, Object> entry :
getAllFields().entrySet()) {
final FieldDescriptor field = entry.getKe... |
a110cbde-c1f7-4eed-a3d1-04882ef7a88e | 0 | public void setRooms(Collection<RoomEntity> rooms) {
this.rooms = rooms;
} |
7dd0d841-3044-4890-870c-d178d210849e | 4 | private String ShortenDirection(String d) throws Exception {
String lowerD = d.toLowerCase().replaceAll("[^a-zA-Z0-9]","");
if (lowerD.charAt(0) == 'n') {
return "N";
} else if (lowerD.charAt(0) == 's') {
return "S";
} else if (lowerD.charAt(0) == 'e') {
return "E";
} else if (lowerD.charAt(0) == 'w... |
805a8756-d249-407a-af47-ada0ef036630 | 3 | public synchronized AudioDevice createAudioDevice()
throws JavaLayerException
{
if (!tested)
{
testAudioDevice();
tested = true;
}
try
{
return createAudioDeviceImpl();
}
catch (Exception ex)
{
throw new JavaLayerException("unable to create JavaSound device: "+ex);
}
catch (L... |
3c595caa-9045-4cd2-8812-3d989c1102a2 | 4 | private void enter(Key key) {
if (limitReached()) {
return;
}
TextGrid.DataGridCel cel = grid.getCel(currentRow + rowOffset,
currentCol + colOffset);
if (cel == null) {
grid.appendChar((char) 0x0a);
} else {
if (cel.getBufferI... |
fddd99c9-6671-4712-814c-661983c33b1e | 9 | public P386C() {
Scanner sc = new Scanner(System.in);
String s = sc.next();
N = s.length();
for (int i = 0; i < 26; i++) {
letterCount[i] = new BIT(N);
}
dp = new long[N][];
prev = new int[N];
int[] last = new int[26]... |
f8ea4ad2-3348-4774-aecf-41513a8bb022 | 9 | private boolean search(int x,int y,String word, int index,char[][] board, boolean[][] map)
{
if (board[x][y] != word.charAt(index)) return false;
map[x][y] = true;
if (index + 1 == word.length()) return true;
for (int i =0; i < 4;i++)
{
int x1 = x + fx[i];
int y1 = y + fy[i];
if (0 <= x1 && x1 < b... |
48c02266-2d80-4ff4-b7a9-f57bab84bf05 | 2 | public void showMainMenu() {
if (game.getGame() != null) {
game.getGame().closeGame();
game.getGame().setStart(false);
}
if (activeGui != null) activeGui.setVisible(false);
mainMenu.setVisible(true);
activeGui = mainMenu;
} |
ff32328d-f1b6-4590-b4f0-079e252ce4cc | 8 | public void omitLessFreq() {
if (name == null) return; // Illegal
int threshold = n_words[0] / LESS_FREQ_RATIO;
if (threshold < MINIMUM_FREQ) threshold = MINIMUM_FREQ;
Set<String> keys = freq.keySet();
int roman = 0;
for(Iterator<String> i = keys.iterator(); i.... |
3ae574fc-2167-4d79-b549-49f3c130226d | 4 | public List<Row> collectRowsAndSetOwner(List<Row> list, Row row, boolean childrenOnly) {
if (!childrenOnly) {
list.add(row);
row.setOwner(this);
}
if (row.isOpen() && row.hasChildren()) {
for (Row row2 : row.getChildren()) {
collectRowsAndSetOwner(list, row2, false);
}
}
return list;
} |
9aef72ab-18e6-4d8d-92ea-f25be6e721b4 | 2 | public static void main(String args[]) {
ArrayList<ArrayList<String>> records = new ArrayList<ArrayList<String>>();
ArrayList<ArrayList<String>> test_records = new ArrayList<ArrayList<String>>();
BuildTree t = new BuildTree();
depth = Integer.parseInt(Config.readConfig("depth"));
//Read the data in CSV... |
16392e91-2bdf-4b4a-b3fd-f3e0dbac9cea | 6 | public void intersectWithBullets()
{
Point2D.Double cornerP1=null,cornerP2=null,cornerP3=null,cornerP4=null;
float width = getWidth(),height = getHeight(),radians = getRotation();
// first set of Points
double diagHalfLength = Math.sqrt(width*width + height*height)/2;
double innerHalfAngle = Math.atan(heig... |
582e1343-3b89-48c4-bb4f-6b3b08dff6de | 5 | public void registerClient(ObjectInputStream IStream, ObjectOutputStream OStream) throws ClassNotFoundException, IOException{
MessagePacket connectMessage;
IStream.readObject();
connectMessage = (MessagePacket) IStream.readObject();
if(!sk.isConnected(connectMessage.getNick())){
ClientInfo cli... |
b2199025-5c71-4fff-837f-2ce5eea139a9 | 9 | private FlowToken readSlashToken() throws SnuggleParseException {
FlowToken result;
int afterSlashIndex = position+1;
int c = workingDocument.charAt(afterSlashIndex);
if (c==-1) {
/* Nothing following \\ */
result = createError(CoreErrorCode.TTEG01, position, afte... |
50bb588b-4e30-486d-9ad3-4a95ca7885be | 4 | public static void notifyEOS(String sourcename, int queueSize) {
synchronized (streamListenersLock) {
if (streamListeners == null)
return;
}
final String srcName = sourcename;
final int qSize = queueSize;
new Thread() {
@Override
public void run() {
synchronized (streamListenersLock) {
... |
65e70061-079a-4ee7-92fb-10837f81775d | 2 | private static CCVertex setNode(final CCVertex v, final int nodeId,
final List<CCNode> nodes) {
for (CCNode n : nodes) {
if (n.getNodeId() == nodeId) {
v.setCCNode(n);
break;
}
}
return v;
} |
97d6fe05-9b41-4226-b403-b6160193339e | 6 | public Object clone() throws CloneNotSupportedException
{
Feature result = (Feature)super.clone();
if(result.lookAt!=null)
{
result.lookAt = (LookAt)this.lookAt.clone();
result.lookAt.setParent(result);
}
if(result.timePrimitive!=null)
{
result.timePrimi... |
012eb4b6-b5ff-47fd-a698-14d4f30c017d | 2 | private static void list(PathChildrenCache cache) {
if (cache.getCurrentData().size() == 0) {
System.out.println("* empty *");
} else {
for (ChildData data : cache.getCurrentData()) {
System.out.println(data.getPath() + " = " + new String(data.getData()));
... |
5c29f9a1-85dd-486c-8e79-f2c74fc438a3 | 8 | public HashMap<String, ArrayList> outcome(Double amount)
{
HashMap<String, ArrayList> result = null;
int raw_amount = new Double(amount * 100).intValue();
try
{
List<String> commands = new ArrayList<String>();
commands.add("/bin/bash");
commands.a... |
b2b3861f-a27c-4e91-a6f8-289fd4d8d6a9 | 9 | public static int calcTopOfRange(double topPct, int topIdx, int botIdx, double[][] strats, double[] freqs, int nutsRank, TreeMap<HandRank, TreeSet<PairRank>> pairRankSets) {
int thresh = 0;
double totTopFreqs = 0;
double rankTotTopFreqs = 0;
double partialFreq = 0;
totTopFreqs = getDoubleArrayTotal(freqs);... |
69e9e892-388d-4244-8438-10e6ca037315 | 7 | void DoRound(double Limit) {
IntPoint pt1 = new IntPoint(Round(m_p.get(m_i).get(m_j).x + normals.get(m_k).X * m_delta), Round(m_p.get(m_i).get(m_j).y + normals.get(m_k).Y * m_delta));
IntPoint pt2 = new IntPoint(Round(m_p.get(m_i).get(m_j).x + normals.get(m_j).X * m_delta), Round(m_p.get(m_i).get(m_j).y + normals... |
7e2a90ee-ae0f-4b28-a1ab-10148449491d | 5 | private void handleTransIDs(TACMessage msg) {
TACMessage msg2 = null;
int oldEarliest = earliestTransID;
while (msg.nextTag()) {
if (msg.isTag("transID")) {
int id = msg.getValueAsInt(-1);
if (id > earliestTransID) {
earliestTransID = id;
}
if (id > oldEarliest) {
msg2 = new TACMessage("tran... |
f2ba8d0a-1f69-4c61-bc36-0f4d32eecf59 | 9 | public String timeoutShellCommandWithWatchdog(final String[] cmd, final String[] restartTimerKeywords, final int timeout, final boolean logLevel2, Target shell) {
StringBuilder sb = new StringBuilder();
try {
ProcessBuilder p = new ProcessBuilder(cmd);
... |
0588e98b-d4a7-4df0-be54-fca8ea28a978 | 5 | @Override
public void execute() throws ParseException
{
Schema schema = DBManager.getDBManager().getSchema(this.tableName);
if (schema == null) {
throw new ParseException("No table named " + this.tableName);
}
String line;
for(Attribute attr : schema.attributes)
{
line = attr.toString();
if (sche... |
adc558d7-de9a-461f-b34d-303e609b1c11 | 5 | public void compute() {
if (opponent == null)
return;
Vector3D myLocation = getLocation();
Vector3D opponentLocation = opponent.getLocation();
float myX = myLocation.getX(), myY = myLocation.getY();
if (myX > opponentLocation.getX())
myX -= 1;
else if (myX < opponentLocation.getX())
myX += 1;
if ... |
2f41e571-fc75-49ac-bbba-26b131a4d837 | 6 | @SuppressWarnings("deprecation")
public void initializeGUI(Player player) {
if (!players.containsKey(player.getUniqueId()))
players.put(player.getUniqueId(), Bukkit.createInventory(null, getCorrectSize(), "Kit Selector"));
Inventory inventory = players.get(player.getUniqueId());
inventory.clear();
... |
3ea48bc1-9f18-4bb9-8469-a535de1cd1b1 | 9 | @Override
public void endElement(final String uri, final String localName,
final String qName) throws SAXException {
switch (qName) {
case "mods" :
modList = onModsEnd();
break;
case "mod" :
mods.add(onModEnd());
break;
case "update" :
updateList.add(onUpdateEnd());
break;
case... |
d25c90f8-5256-4cc9-b3f9-3703ab2a5c72 | 8 | @Override
public List runBulkJobs(org.ggf.drmaa.JobTemplate jobTemplate, int start,
int end, int incr) throws DrmaaException {
if (jobTemplate == null) {
throw new InvalidJobTemplateException(
"The passed Job Template must not be null.");
}
if (!(jobTemplate instanceof JobTemplate)) {
throw new Inv... |
0aa670e0-008e-418a-be13-c0a0897bc265 | 2 | public void testToStandardMinutes_years() {
Period test = Period.years(1);
try {
test.toStandardMinutes();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.years(-1);
try {
test.toStandardMinutes();
fail(... |
b712995b-3090-48ea-bb91-10eca6529546 | 0 | public KeyInfoType getKeyInfo() {
return keyInfo;
} |
4692c738-3448-425c-ab49-6d9848fde279 | 5 | private void displayText (final Game game) {
final int height = game.getHeight();
final int width = game.getWidth();
System.out.printf("Score = %d%n", game.getScore());
// Display as the task requirement
for (int y = height - 1; y >= 0; y--) {
for (int x = 0; x < widt... |
ab1d868e-3bed-4ba6-afb6-4f3baac89b3b | 8 | @Override
public void keyReleased(int key, char c) {
// TODO Auto-generated method stub
super.keyReleased(key, c);
switch(key) {
case Input.KEY_A:
player.moveLeft = false;
player.setTurningRight(true);
break;
case Input.KEY_D:
player.moveRight = false;
player.setTurningLeft(true);
break;
... |
c9ae9943-8d45-457b-b5dd-95190a73e7f9 | 2 | @Override
public boolean equals(Object other) {
if(other == this) return true;
if(!(other instanceof Chance)) return false;
return probability == ((Chance) other).probability;
} |
73232d9c-2c68-4b7e-ae8d-c8571ef35964 | 7 | public Usuario selectEncarregado(String Nome, String Tipo) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Usuario user = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = cone... |
9d7f5b3a-b60e-4d83-a1ee-6b70c19cd2e0 | 3 | public void saveTo(String rootDirPath) throws ParserConfigurationException,
TransformerException, IOException {
if (currentPath == null) {
return;
}
input.deselect();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docB = documentBuilderFactory.... |
376eebe2-a34c-45aa-89a8-5cbce2be5337 | 1 | public void update() {
velocityOffset += velocity;
int maxOffset = (int)((1 - moveSpeed) * (float)backgroundManager.getMapWidth()) + width * 2;
if (velocityOffset > maxOffset) {
velocityOffset = 0 - (maxOffset + width * 2);
}
} |
a5383977-ea2e-4738-a391-352f3d00c91a | 0 | public void setChunkedTransfer(boolean chunkedTransfer) {
this.chunkedTransfer = chunkedTransfer;
} |
5c1fb998-9e73-45a9-aa5f-39a0deb9a0e7 | 9 | @Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap jobData = context.getJobDetail().getJobDataMap();
boolean isDebug = jobData.getBoolean("isDebug");
ConcurrentLinkedDeque<String> msgQueue = (ConcurrentLinkedDeque<String>) jobData.get("msgQue... |
2ecb91bd-78d3-4b82-a76a-d517549c9a63 | 7 | public String execute() {
Map<String, Object> session = ActionContext.getContext().getSession();
User user = (User) session.get("USER");
list = null;
String actionResult = "";
reportBusinesService = new ReportBusinesService();
list = reportBusinesService.createTrip(u... |
bcf7e41d-c8eb-475c-9836-14a411905a48 | 6 | public static String vizServerExportObject(Stella_Object renamed_Object, Module module) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(OntosaurusUtil.SGT... |
150b85e2-56bb-4020-9ad7-9adc13146631 | 3 | @Override
public Color getColor() {
r += colorPhase;
if (r > 1.0) {
r -= 1.0f;
g += colorPhase;
if (g > 1.0) {
g -= 1.0f;
b += colorPhase;
if (b > 1.0)
b -= 1.0f;
}
}
return new Color(r, g, b);
} |
4bd7a83b-000e-4ead-ab57-0573d591dbfd | 2 | public void parentRelease(){
if(this.subResponse.decrementAndGet() <= 0){
// 获取下一个缓冲区进行传输
ByteBuffer buffer = this.currentBufferQueue.poll();
while(buffer != null){
buffer.clear();
BufferPool.getInstance().releaseBuffer(buffer);// 将用完的缓冲区放回缓冲区池
buffer = this.currentBufferQueue.poll();// 从队列中... |
dd71a34f-90b6-4601-b03f-2fc31b964b34 | 0 | public void setDesc(String desc) {
this.desc = desc;
} |
2ca06a6f-196d-407e-abe5-cee56451818a | 8 | public static void main(String args[]) {
Initializer initilizer = new Initializer();
try {
initilizer.initializeServerWithPersistDataInServer();
} catch (CubeXmlFileNotExistsException e) {
e.printStackTrace();
} catch (CubeAlreadyExistsException e) {
e... |
99682e7b-6444-49f7-9d70-c502db180487 | 1 | @Override
public boolean equals(Object obj) {
if (obj instanceof AbstractMachine) {
return ((AbstractMachine) obj).id == id;
}
return false;
} |
e7dbe005-6e1c-46b7-a3b2-c1844bd6d84c | 4 | public static void bubbleSort(double unitValue[], double itemArray[][], int itemNumber[], double bagMaxWeight, DecimalFormat df){
for(int i=0; i<4; i++){
for(int j=i+1; j<4; j++){
if(unitValue[i]<unitValue[j]){
//Sorts unit values
double temp1 = unitValue[i];
unitValue[i] = unitValue[j];
un... |
458932dc-7846-4a13-8c82-9734b8d511e8 | 2 | public Role getSujetRoleMinimum() {
if (sujetRoleMinimum == null)
if (getCategorieParent() != null)
return getCategorieParent().getSujetRoleMinimum();
else
return Role.Utilisateur;
return sujetRoleMinimum;
} |
b7560883-c65d-40eb-b9b5-12f4f07dfa6b | 9 | private static void pushTest(final String[] args) throws CommunicationException, KeystoreException {
final String keystore = args[0];
final String password = args[1];
final String token = args[2];
final boolean production = args.length >= 4 && args[3].equalsIgnoreCase("production");
final boolean si... |
81ffcc7f-10b7-4b03-aac5-cfaa9723b203 | 9 | void run(){
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
R[] r = new R[n];
for(int i=0;i<n;i++)r[i]=new R(sc.nextInt(), sc.nextInt());
Arrays.sort(r);
int[][] dp = new int[n][n+1];
for(int[] a:dp)Arrays.fill(a, 1<<30);
dp[0][1] = r[0].a<=r[0].b?r[0].a:(1<<30);
for(int i=0;i<n;i++)dp[i][0] = ... |
35ed6795-7eb4-4efd-9128-2d8188ed842a | 9 | public void player1move(){
if (upPressed)
{
if(!player1.offscreentop)
{
player1.setY(player1.getY() - player1Speed);
}
} else if (downPressed)
{
if(!player... |
f68e509e-d1d1-49d1-943b-035f17b33385 | 6 | public static boolean EsValido(String s, char[][] tabla, Lexema lex) {
int estado = 0 + 1;
char[] array = s.toCharArray();
for (int i = 0; i < s.length(); i++) {
boolean encuentra = false;
for (int j = 0; j < tabla.length - 2; j++) {//no toma en cuenta el caracter 'P' ni ... |
302ad4cb-92c9-4798-8fad-d7a026814b8f | 3 | private void removePanel(JPanel panel) {
Boolean AlreadyExists = true;
try{
if(panel.getParent() != layers)
{
AlreadyExists = false;
}
}
catch(NullPointerException e){
AlreadyExists = false;
}
if(AlreadyExists)
{
layers.remove(panel);
panel = null;
}
} |
bbffc33b-7f12-4514-b622-979c4ae1c67c | 8 | public static void main(String[] args)
{
File directory = new File(INPUT_DIRECTORY);
String[] filenames = directory.list();
BufferedWriter bw = null;
try {
// Output File - clear it down first.
File outputFile = new File(OUTPUT_FILE);
outputFile.delete();
FileWriter f... |
6df1335b-073a-4966-8003-00c993de323c | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
b73580f2-d91d-4364-a833-e15a0c98b009 | 5 | public void recordClusterInfo(Cluster c){
if (!isRecording) return;
StringBuilder s = new StringBuilder();
String filename = String.format("cluster_%1$s_%2$s_%3$s", name, iterationCounter,c.ID);
s.append(filename+" =\n{\n");
s.append(String.format("\tindex: %1$s,\n", c.ID));
s.append("\twords: [");
for (i... |
2e2b4bd2-7803-442b-a09b-2ce8bbb35c95 | 3 | public void adicionaTurma(String codigoDisciplina, int numTurma)
throws DisciplinaInexistenteException, TurmaJaExisteException {
boolean teste = false;
for (Disciplina e : this.disciplina) {
if (e.getCodigo().equals(codigoDisciplina)) {
e.adicionaTurma(numTurma);
teste = true;
break;
}
}
... |
0fa3bc9f-ccf1-4939-9c52-d4d69a2a76a9 | 9 | public void dropItems(int i) {
int npc = 0;
//long start = System.currentTimeMillis();
Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
if(c != null) {
if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
c.magePoints += 1;
if (NPCDrops.constantDrops.get(n... |
ff5cceb3-9635-4a53-a513-66b649eb04e4 | 6 | public static void initSpriteMap() {
int row, column;
for (int j = 1; j < 3; j++) {
for (int i = 0; i < 15; i++) {
for (int k = 0; k < 3; k++) {
row = i * (j % 2) + (6 + k) * (j / 2);
column = i * (j / 2) + (6 + k) * (j % 2);
sprite[row][column] = new SpriteElement(
AcessType.ALL.value(... |
c1bf14da-1ca4-49a5-8d5d-d473756433cc | 6 | private void limitSimilarities() {
// sort the similarities by decreasing similarity and take the N most
// similar users
for (Map.Entry<Integer, LinkedHashMap<Integer, Double>> entry : similarities.entrySet()) {
ArrayList<Entry<Integer, Double>> list = new ArrayList<Entry<Integer, Double>>(entry.getValue().en... |
69072b64-08ca-43a6-a9a7-8a3fdfa519c3 | 2 | public boolean checkout(){
// Don't checkout a job that we don't want to do
// or has already been finished
if(status == COMPLETE || status == CANCELED)
return false;
// NOTE: We might already be checked out but thats
// alright, the first person to check out might s... |
19b9d00a-3ef9-4d95-953c-33848218587f | 5 | private void cbxFiltroItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbxFiltroItemStateChanged
/*JOptionPane.showMessageDialog(rootPane,"ssdfs");
lblFiltro.setVisible(false);*/
if(cbxFiltro.getSelectedItem().equals("Selecione")){
lblNome.setVisible(false);... |
664ef385-32bf-4cb3-b7dc-022f57cf5ff8 | 8 | public void collisionDetect(){
meleeHit=false;
theEnemies = new CopyOnWriteArrayList<Enemy>(enemylist);
for(Enemy e:theEnemies){
e.updateBounds();
if(e.enemyBounds.intersects(player.playerBounds)){
if(e.countToNextAttack ==0){
e.canAttack = true;
}
if(e.canAttack){
e.dealDamage();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.