method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ef73131e-2f06-4003-b3dc-aec86dcc88ed | 5 | public void movement(int delta) {
if (this.duration == null) {
if (this.speedY < 5) this.speedY += 0.5f;
if (this.speedY == 5) this.alive = false;
if (this.random == 0) this.x += 0.1f * delta;
if (this.random == 1) this.x -= 0.1f * delta;
this.y += delta * (speedY * 0.08f);
}
else {
... |
59362370-5a06-4d89-8be4-d189550d0241 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Employee employee = (Employee) o;
if (id != employee.id) return false;
if (firstname != null ? !firstname.equals(employee.firstname) : employee... |
8817bf81-22d3-47a4-a44c-187eb7dc3ecc | 0 | private void initTextFields(){
/*===================Text Field of algorithm`s name==============*/
nameTextField = new JTextField();
nameTextField.setBounds(10, 30, 200,27);
nameTextField.addActionListener(new ActionListener() {
@Override
public void a... |
4c72e3c5-2b21-4a4b-8bac-21e83c9dce31 | 0 | public TabPane() {
super(JTabbedPane.NORTH);
datePane = new DatePane();
graphPane = new GraphPane();
exceptionPane = new ExceptionPane();
this.add("总流量", datePane);
this.add("统计图", graphPane);
this.add("异常日志",exceptionPane);
this.addChangeListener(new Chan... |
d46fd5a6-9626-4fdd-b3a0-1c2060958934 | 8 | private PagePhotonSpectrometer createPhotonSpectrometer() {
PagePhotonSpectrometer s = new PagePhotonSpectrometer();
s.setPage(page);
s.setModelID(modelIndex);
if (uid != null) {
s.setUid(uid);
uid = null;
}
if (type != -1) {
s.setType(type);
type = -1;
}
if (borderType != null) ... |
ccac5590-9373-4ede-9d8b-2ba8c2ec2ebc | 5 | public GridScheduler(String url, String downstream, String upstream, String registry) throws RemoteException {
// preconditions
assert(url != null) : "parameter 'url' cannot be null";
// init members
this.registry = registry;
this.url = url;
this.upstream_neighbour = upstream;
this.downstream_neighbour... |
d527fb2f-f3e0-49b3-b351-68c264571a46 | 8 | private static void addForms(XWPFParagraph p, Word wt, String color, Lang explang) {
addSpace(p);
addLeftParenthesis(p, color);
for (int i = 0; i < wt.getForms().size(); i++) {
Form f = wt.getForms().get(i);
if (f.getType() != FormType.UNDEF && f.getType() != FormType.PAR... |
95089386-2112-4fa0-97cb-4c6e81c0ca5c | 9 | private boolean r_t_plural() {
int among_var;
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
// (, line 160
// setlimit, line 161
v_1 = limit - cursor;
... |
85838a7c-a444-4838-a1c3-968cb36ab0ae | 9 | public synchronized static Integer getValue(Object layout, String key, int type)
{
Integer ret = null;
boolean cont = true;
for (int i = LAYOUTS.size() - 1; i >= 0; i--) {
Object l = LAYOUTS.get(i).get();
if (ret == null && l == layout) {
int[] rect = VALUES_TEMP.get(i).get(key);
if (cont && rect ... |
9818855c-1d9d-44b6-90fa-43f6765a712a | 2 | private int skipLine(InputStream in) throws IOException {
int c;
int len = 0;
while ((c = in.read()) >= 0 && c != 0x0d)
++len;
in.read(); /* skip 0x0a (LF) */
return len;
} |
b1595581-293c-48c0-935b-0687e1ab76ec | 4 | public static boolean movementPressed() {
if(Keybinds.DOWN.press() || Keybinds.RIGHT.press() || Keybinds.LEFT.press() || Keybinds.UP.press())
return true;
return false;
} |
5972ae38-6ebf-494b-8573-6c3b7c65bc45 | 3 | @Override
public AbstractComponent parse(String string) throws BookParseException {
if (string == null) {
throw new BookParseException("String is null");
}
try {
TextComponent component = (TextComponent) factory
.newComponent(EComponentType.WORD);
Pattern letterPattern = Pattern.compile(LETTER_REGE... |
d8bacd34-4b06-49c0-81ec-d115baa1e185 | 9 | @Override
public int compareTo(TexasHoldEmHand o) {
if (o.type == null) {
return -1;
}
if (type == null) {
return +1;
}
if (type == o.type) {
if (type == TexasHoldEmType.STRAIGHT_FLUSH || type == TexasHoldEmType.STRAIGHT) {
if ("A".equals(kickers.get(0).getRank())) {
return 1;
} else if... |
d11ca47b-92e2-4d47-bd94-fe0e484ceda1 | 1 | public static String intToHex(Integer value) {
String intString = Integer.toHexString(value);
System.out.println(intString.length());
System.out.println(intString);
Integer anzNullen = 4 - intString.length();
for(int i = 0; i < anzNullen; i++) {
intString = "0" + intString;
}
return intString;
} |
9e1bb3b3-95d2-4dbf-a4b2-2b2d5a9fb3bc | 8 | private void readFile(File file){
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
try {
String line = reader.readLine();
while(line != null){
if(line.startsWith("[") && line.endsWith("]")){
line = line.replace("[","").replace("]","").trim();
if(line.endsWith("VBN... |
a9e0b460-99c3-4f85-bd0c-f202b73a5e0d | 5 | public final static void pickAllChar(SeekableLittleEndianAccessor slea, MapleClient c) {
int charId = slea.readInt();
int world = slea.readInt();
c.setWorld(world);
String macs = slea.readMapleAsciiString();
c.updateMacs(macs);
if (c.hasBannedMac()) {
c.getSes... |
47b8005b-87c3-4304-9861-3126423529c0 | 7 | public boolean remove(Locatable locatable) {
if (locatable == null) {
throw new IllegalArgumentException("Locatable must not be 'null'.");
} else if (locatable instanceof Unit && canCarryUnits()) {
if (super.remove((Unit)locatable)) {
spendAllMoves();
... |
ec815d18-38c4-4cca-976c-5060be2ce7c0 | 3 | public boolean deleteWithMouse(MouseEvent mouse) {
Tool tool = GUI.controls.getTool();
Object o = getObject(mouseGetX(mouse), mouseGetY(mouse), tool);
if (o == null)
return false;
if (o instanceof Vertex) {
removeVertex((Vertex) o);
return true;
... |
a2d8c9fe-f9ee-4610-8dce-3ba61732a32f | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
3505c115-0562-4792-b0f5-a32aac25e64f | 6 | @Override
public int eval(Critter c) {
// returns the value of this expression for Critter c
Random rand = new Random();
int index = expr.eval(c);
int value;
String sensor = op.toString();
if(sensor.equals("mem")){
if(index >= c.memlength)
return 0;
value = c.getMem(index)... |
63992d13-4262-41b9-ae7a-4bd7f0b09130 | 6 | private void resize() {
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (getSkinnable().isKeepAspect()) {
if (aspectRatio * wi... |
7c8d0175-c2c0-454e-9a8d-48984eb7f929 | 0 | void setProgress(long progress) {
_progress = progress;
} |
1c0bc7ae-ad05-4843-8ee0-4ba3595843ea | 3 | private boolean wire(String color) {
switch (color) {
case "red":
return wire[0];
case "green":
return wire[1];
case "blue":
return wire[2];
}
return false;
} |
12925cc1-549d-41bb-964d-efefc8bcee8a | 6 | public void DeleteDepartamento(String Cod_Departamento) throws SQLException, excecaoDeletarElemento {
Connection conexao = null;
PreparedStatement comando = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_DELETE_DEPARTAMENTO)... |
ddd955b3-1b24-41ae-bc4d-f45395b5248e | 9 | public JPortInfo[] getConfig() throws Exception {
JPortInfo[] configInfo=null;
Vector lines = new Vector();
br = new BufferedReader(new FileReader(configFile));
line=null;
while ((line=br.readLine()) != null) {
if (!line.trim().startsWith("#") &&
!line.trim().equals("")) {
li... |
f9b93115-e329-4b4e-954f-00ac38231ca6 | 5 | @Override
public Boolean isVisible(Integer playerId) {
boolean visible = false;
if (detectiveIdList.contains(playerId))
visible = true;
else {
for(MrX a : listMrX) {
//if current player is a detective && it is a visible turn - display Mr X
if(a.getID().equals(playerId) && currentPlayerID != 0 && vi... |
9fe1598d-d018-4542-9d85-be52729c8f16 | 4 | @Override
public void run() {
try {
directoryQueue.addLast(rootDirectory);
final FileFilter fileTraversalFilter = new FileFilter() {
@Override
public boolean accept(File pathName) {
if (pathName.isDirectory()) {
... |
be13adf5-c90c-4136-94ba-cb0fd59a83bb | 8 | private double upperVal(double x) {
double pow = 1;
if (x==1)
return 1;
if (x>1.0) {
while(x>1.0) {
x /= 10.0;
pow *= 10;
}
}
else {
while(x<1.0) {
x *= 10.0;
pow /= 10;
}
//We want x to be between zero and 1
x /= 10;
pow *= 10;
}
if (x>0.5)
return 1... |
49936fce-05de-4fc7-9b6f-a1ac2fc03f47 | 7 | public static void main(String[] args) throws Exception
{
// parse input
Scanner temp = new Scanner(new File(args[0]));
int lineCount = 0;
String curr = "";
while (temp.hasNextLine())
{
curr = temp.nextLine();
if (curr.length() == 0)
... |
9a8041c4-1ce0-48d2-9ef3-db5c4071311e | 8 | private static List<String> processDeltas(List<String> origLines, List<Delta> deltas,
int contextSize) {
List<String> buffer = new ArrayList<String>();
int origTotal = 0; // counter for total lines output from Original
int revTotal = 0; // counter f... |
62fb33d1-889b-4506-8175-8b5e069d3d45 | 9 | private void handleDelete() {
String ipString = ipText.getText().trim();
String domString = nameText.getText().trim();
if (!ipString.isEmpty() && !domString.isEmpty()) {
Integer ip = DNSDB.stringToIP(ipText.getText());
if (dnsDB.delete(domString, ip)) {
JOptionPane.showMessageDialog(GUI.this, "'" + ip... |
a10fe3a8-8a56-4716-948e-2d4b96b0b0f1 | 0 | MapGetThread(Map<String, Integer> map) {
synchronized (lock) {
counter++;
}
this.map = map;
} |
d902db02-c1aa-4d06-80bb-334aef5731a3 | 4 | private static String getLibraryJarfiles(String dir) {
try {
String ret = "";
for (File item : new File(dir).listFiles()) {
if (item.isDirectory()) {
ret += getLibraryJarfiles(item.getCanonicalPath());
} else {
if (... |
15ab876e-c033-412d-a405-0077511c3a34 | 7 | private static final boolean exchange(L2PcInstance player, int objectId)
{
L2ItemInstance item = player.getInventory().getItemByObjectId(objectId);
if (item == null)
return false;
// check enchant level
if (item.getEnchantLevel() < 10)
return false;
// check grade
if (item.getItem().getCrystalT... |
b1170249-5787-4d78-9b14-28d353cdaff5 | 2 | public String toChineseString(boolean ignoreFractionalPart, boolean upperCase) {
return new ChineseNumber(ignoreFractionalPart ? value.setScale(0).toString() : value.toString(), upperCase ? ChineseNumberStyle.UPPER_CASE : ChineseNumberStyle.LOWER_CASE).toString();
} |
a3c64546-240e-410f-9218-e72adf7adf8e | 6 | public static <E extends Comparable<E>> BinaryTreeNode<E> insertNode(BinaryTreeNode<E> root, E value) {
if(root==null) {
root = new BinaryTreeNode<E>(value);
return root;
}
BinaryTreeNode<E> node = root;
while(node != null) {
if(value.compareTo(node.value)>0) {
if(node.right == null) {
Bina... |
d8876a4e-1ece-4b8c-9529-6571e42c7287 | 5 | private void requeteClient() throws IOException {
String data = "";
switch (statusCode()) {
case 200:
System.out.println("OK");
BufferedReader br = new BufferedReader(new FileReader(file));
String buffer;
do {
... |
5ad4157f-1181-4a68-a3c4-02bd49a4e45a | 9 | public ArrayList<Token> tokenizeLine(String line) {
// Remove tokens from previous iteration
tokens.clear();
String aLine = line;
int j = 0;
// Remove any comments
if ((j = aLine.indexOf(";")) != -1) {
aLine = aLine.substring(0,j);
}
... |
d0241dfc-cdc7-4651-bf61-830f3c9dc7fa | 8 | public GetExecutor getGetExecutor(Class locatorClass, Object identifier) {
final Class<?> clazz = locatorClass;
final String property = (identifier == null ? null : identifier.toString());
// 尝试一下bean处理
if (property != null) {
PropertyGetExecutor pExecutor = new PropertyGetE... |
e3d3a3ea-b247-4527-bba5-2388d81ccc20 | 0 | public final float getX(){
return getLocalTranslation().getX();
} |
3e970e7a-4be6-44b4-a4ff-f3a46362dcfc | 5 | public static void main(String[] args) {
System.out.println("Lancement du client");
try {
Remote r = Naming.lookup("rmi://"
+ InetAddress.getLocalHost().getHostAddress()
+ "/messagerieRMI");
if (r instanceof Messagerie) {
Messagerie irc = (Messagerie) r;
ActionsClientMessagerie clien... |
2118e014-67c1-450a-84ce-6931bb08c7ab | 7 | public static void execute(String command) {
List<String> args = new ArrayList<String>();
String parts[] = command.split(" ");
boolean inString = false;
StringBuilder buffer = new StringBuilder();
for (int n = 0; n < parts.length; n++) {
parts[n] = parts[n].trim();
if (!inString && parts[n].st... |
7a6886d3-d7e6-4fb7-9030-b073d0436290 | 6 | public Evaluator() {
Value = new int[Pattern.LAST][POW_3_8];
PatternNum = new int[Pattern.LAST][POW_3_8];
PatternSum = new int[Pattern.LAST][POW_3_8];
MirrorLine = new int[POW_3_8];
MirrorCorner = new int[POW_3_8];
for (int i = 0; i < POW_3_8; i++) {
int mirror_in = i;
int mirror_ou... |
6cfb83df-c37d-4b1d-84b6-98a30b9be7a7 | 9 | public static String getWiki(String inputString, HashMap<String, String> data) throws MalformedURLException, IOException {
// StringBuffer inputSb = new StringBuffer(inputString);
String parsedText = inputString.trim().replaceAll("\\s+", "%20");
if(parsedText.length() == 0)
... |
b86885fc-2135-4175-9d1b-34f215a2a854 | 3 | private boolean containNull(EnvironnementAbs environment){
for(int i = 0;i< environment.taille_envi;i++){
for(int j = 0; j< environment.taille_envi;j++){
if(environment.grille[i][j] == null)
return true;
}
}
return false;
} |
48a182cb-b525-4001-aba9-13e6e0f2d35f | 8 | public int[] search (ASEvaluation ASEval, Instances data)
throws Exception {
m_best = null;
m_generationReports = new StringBuffer();
if (!(ASEval instanceof SubsetEvaluator)) {
throw new Exception(ASEval.getClass().getName()
+ " is not a "
... |
e7a8d357-2424-4f76-a2c9-1386d8ebea0b | 3 | public void tick() {
rawElapsedTime += TIME_DELAY;
if (rawElapsedTime % (1000 - level * 100) == 0) {
fall();
}
if (!currentTetromino.getActiveStatus()) {
Vector<Integer> indexY = getCompleteLineYIndices();
while (!indexY.isEmpty()) {
removeCompletedLines(indexY);
indexY = getCompleteLineYIndi... |
ad262e9b-8d28-43f3-b035-c32c63356449 | 3 | @Override
public void mousePressed(MouseEvent e)
{
switch(e.getButton())
{
case MouseEvent.BUTTON1:
{
AreaSelection.renew(e.getLocationOnScreen());
break;
}
case MouseEvent.BUTTON2:
{
if(AreaSelection.isEnabled())
{
AreaSelection.cancelSelection();
}
else
{
Sys... |
9eadc3c4-f946-4fb3-81e0-0b5757e4605d | 7 | public void addEffect(SkillEffect e){
for (SkillEffect effect : skillEffects) {
if(effect == e) return;
}
skillEffects.add(e);
switch(skillEffects.size()){
case 1: tier = Tier.T1;
break;
case 2: tier = Tier.T2;
break;
case 3: tier = Tier.T3;
break;
case 4: tier = Tier.T4;
br... |
624cdc7b-e2f0-4f99-8c22-29db91247c74 | 0 | private void tempsreel_active() {
//System.out.println("temps reel actif");
connexion.setEnabled(false);
//conteneurNiv2_2.setEnabled(false);
Brep_source.setEnabled(false);
BLecture.setEnabled(false);
BPause.setEnabled(false);
BSuivant.setEnabled(false);
BPrecedent.setEnabled(false);
ip2.setEnabled(fa... |
67082243-6991-455d-840c-d2a1058f4f17 | 3 | @Override
public void run() {
gui = new SendGUI();
try {
ServerSocket ss = new ServerSocket( 9988 );
//System.out.println("Waiting for connection");
Socket s = ss.accept();
File sendfile = gui.getFile();
//System.out.println(sendfile.getAbsoluteFile());
gui.setVisible(true);
if( sendfile ... |
c15dbe1c-3bf3-48f8-9d00-476a0116d793 | 2 | public void printSizeOfSccs(int length, int dec_flag) {
for (int i = 0; i < 100; i++) {
if (dec_flag>0)
System.out.print(sortedSCCsSize[length-1-i] + " ");
else
System.out.print(sortedSCCsSize[i] + " ");
}
} |
3f4cd39f-fd26-4373-91a0-a2eab44fb294 | 5 | private void setZoomType(double magnitude, char zoomType)
{
//zoomType
//+ = zoom in
//- is zoom out
//s is standard
//t is trigonometric
//# is statistic
xmin=Double.parseDouble(Xmin.getText());
xmax=Double.parseDouble(Xmax.getText());
ymin=Do... |
116828a3-768b-4fc7-be9d-c2823e5431ab | 9 | public boolean isValidSudoku(char[][] board) {
int n = board.length;
if (n != 9)
return false;
int m = board[0].length;
if (m != 9)
return false;
List<HashSet<Integer>> rowCheckers = new ArrayList<>(9);
List<HashSet<Integer>> colCheckers = new ArrayList<>(9);
List<HashSet<Integer>> squareCheckers = ... |
241d419f-2c41-4a27-b8ba-3939184075f0 | 0 | @Test
public void addingVerticesToEmptyList() {
l.addVertex(v);
assertTrue(v.equals(l.getNeighbours(0).min()));
} |
939a876f-86c2-4124-bc8f-339d4e1e9945 | 5 | private void sysCallRead()
{
int addr = m_CPU.popStack();
int deviceID = m_CPU.popStack();
//SOS.debugPrintln("sysCallRead");
//If the device exists
DeviceInfo di;
if((di = findDevice(deviceID)) != null)
{
//If the device is actually open
... |
5ac7f018-2178-49eb-b577-9d983c56191e | 5 | public static void testPandR(int minTokenThreshold, int maxTokenThreshold, boolean includeApproximateMatches, String tokenizationType, File directory, boolean weighted) {
FileWriter writer;
String csv = "";
generateInvertedIndex(includeApproximateMatches, tokenizationType, directory);
... |
323e8747-4fbf-4edc-a886-4d4781ecb7dd | 6 | @Override
public void caseAAssignStmt(AAssignStmt node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(Assign");
inAAssignStmt(node);
if(node.getIdentifier() != null)
{
node.getIdentifier().apply(this);
}
... |
6ae0ec96-9b65-4094-a60a-1fbb5c385884 | 2 | protected Piece rotatePiece()
{
Piece piece = null;
Point[] temp = new Point[body.length];
//switch x,y to y,x
for (int i = 0; i < body.length; i++)
{
temp[i] = new Point();
temp[i].x = body[i].y;
temp[i].y = body[i].x;
}
... |
2de61ba6-ec19-4c50-9024-d760040a25d6 | 8 | @Override
public void update() {
InputHandler input = world.getGame().getInput();
int speed = 8;
// if (input.hasMouseMoved() && input.isMouseIn()) {
// setX(input.getMouseX());
// } else {
if (input.left.isDown()) { move(-speed, 0); }
... |
b62a6a98-048b-4cbd-bf33-af488f79155b | 9 | public void handleLogin(String loginData) throws IOException {
Logger.writeInfo("New user connecting...");
Logger.writeInfo("Parsing userdata...");
String[] loginDataArray = loginData.split("::");
if (loginDataArray.length < 3) {
// ##LOGIN:address:username
Logger.writeError("Recieved unreadable userda... |
b466bd53-1bb4-4cba-bf7b-637c0ac01334 | 4 | @Override
public void setData(int size, int transitions, int [][]bacteriaPosition) {
if(size <= 0)
throw new IllegalArgumentException();
if(transitions <= 0)
throw new IllegalArgumentException();
if(bacteriaPosition == null || !bacteriaPositionCheck(bacteriaPosition))
throw new IllegalArgumentException... |
94b9ece1-938c-431f-bb6c-3278fd76f656 | 3 | public void add(Category cat) {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(cat);
session.getTransaction().commit();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.ge... |
ce8749a3-c512-46ba-9468-bc49758ef560 | 7 | public void Update(final PCPanel panel, Graphics graphics) {
if(Counter < 100)
{
Counter++;
panel.Board.DrawBoard(graphics);
panel.AllPellets.DrawAllPellets(graphics);
panel.Blinky.Draw(graphics);
panel.Pinky.Draw(graphics);... |
bb8cfc2c-428f-445f-aec4-bda7fd48f879 | 6 | private void reduceNewUnits(){
newTimeSecond = (newTimeSecond + (newTimeMinute * 60) + (newTimeHour * 3600) + (newTimeDay * 86400));
if ((newTimeSecond <= 60) || (newTimeSecond >= 60)){
newTimeMinute = newTimeSecond / 60;
newTimeSecond = newTimeSecond % 60;
}
if ((newTimeMinute <= 60) || (newTimeMinute... |
0bda79c6-9be0-4aa0-aad6-731107133a0e | 8 | CtClass getPrimitiveType(int atype) {
switch (atype) {
case Opcode.T_BOOLEAN :
return CtClass.booleanType;
case Opcode.T_CHAR :
return CtClass.charType;
case Opcode.T_FLOAT :
return CtClass.floatType;
case Opcode.T_DOUBLE :
return C... |
dac3d545-ca6b-4566-ba65-a06445e843e4 | 5 | @Override
public void run() {
// Get the graphics context for the background.
backgroundGraphics = (Graphics2D) background.getGraphics();
// Determine how many milliseconds to wait in between drawings.
long fpsWait = (long) (1.0 / targetFPS * 1000);
main: while (gameRunning) {
long renderStart = System.n... |
97930c40-8bc7-4677-894f-68123d12812a | 8 | * @param mode
*/
public static void describe(Stella_Object name, Cons mode) {
{ Stella_Object renamed_Object = ((name == null) ? ((Stella_Object)(null)) : name.getObject(null));
Stella_Object modespec = mode.value;
Keyword validmode = null;
if (modespec == null) {
modespec = Stella.$... |
6e25a354-8efb-419a-8b87-cfb524270a04 | 9 | public void render(int xp, int yp, int xb, int yb, int size, int scale, SpriteSheet sheet){
int sheetSize = sheet.SIZE;
for(int y = 0; y < size * scale; y++){
int ya = y + yp;
for(int x = 0; x < size * scale; x++){
int xa = x + xp;
if(xa < -sheetSize || xa >= width || ya < 0 || ya >= height) break;
... |
ab76f8e4-e925-4d59-bf58-4b9bf0320b8d | 0 | private void showGame(){
getContentPane().removeAll();
getContentPane().add(this.canvas, BorderLayout.CENTER);
this.canvas.createBufferStrategy(2);
this.canvas.setVisible(true);
} |
e56dd195-0d12-4c96-8ce9-21838259b068 | 0 | public void setProtocol(String protocol) {
this.protocol = protocol;
} |
f363506a-52ef-4351-9690-04989f98de6d | 3 | public static void inputGuess(Guess g, Player p) {
Scanner sc = new Scanner(System.in);
String dec = " ";
Game.clearConsole(); // Empty the screen
System.out.println(dec+"-- Captain " +p.name+", press enter to proceed --"); // Display name of player whose turn it is
sc.nextLine();
System.out.println(... |
24e16948-5f53-4ba9-95a2-d9c9b3462c4e | 4 | public byte[] resetObjectReference(Reference objectReference, boolean isRc4) {
// Step 1: separate object and generation numbers for objectReference
int objectNumber = objectReference.getObjectNumber();
int generationNumber = objectReference.getGenerationNumber();
// Step 2:
//... |
c59b0c0f-097c-4f72-878a-a62ef0573bbe | 6 | private ScriptExecutor createScriptExecutor() {
String className = null;
ClassLoader loader = ScriptExecutor.class.getClassLoader();
// 1. try the JVM-instance-wide system property
try {
className = System.getProperty(property);
} catch (RuntimeException e) { /* norm... |
c6890b9e-490c-476e-8a99-1194b9d5d7a7 | 3 | private boolean receiveMessage(Message message) {
if (this.enemies.contains(message.getSender())){
return false;
}
else if (this.friends.contains(message.getSender())) {
this.wall.add(message);
return true;
}
else if (message.getMessage().equa... |
9ae89e57-a59f-4e55-830d-7ba35f16b7c6 | 5 | @SuppressWarnings("unchecked")
static void save()
{
Protect.log.info("[XolioProtect]Saving cuboids...");
try {
fos = new FileOutputStream(new File("plugins/XolioProtect/cubos.txt"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// #########... |
b6dbb94e-47bc-4544-a019-9bfe30bbd958 | 8 | public Register getRegister(int index) {
switch (index) {
case 0:
return R0;
case 1:
return R1;
case 2:
return R2;
case 3:
return R3;
case 4:
return R4;
case 5:
return R5;
case 6:
return R6;
case 7:
return R7;
default:
return null;
}
} |
0a410ccd-3bd1-4b3d-adbd-5506050a1e48 | 4 | public void endElement(String name)
{
if (name == null)
return;
String lastStartTag = (String) stack.peekFirst();
if (name.equalsIgnoreCase(lastStartTag)) {
if (name.equals("module")) {
currentModule = null;
} else if (currentModule != nu... |
1c525122-cf1a-4336-ad3a-19b66fc19c96 | 8 | public static String composeInternetUrl(String protocol, String userinfo, String host, int port, String path, String query, String fragment) {
{ OutputStringStream url = OutputStringStream.newOutputStringStream();
if (!(Stella.blankStringP(protocol))) {
url.nativeStream.print(protocol + "://");
... |
23f9f374-dbe7-4183-9226-2e9aa1ef90fe | 6 | protected LinkedList<Task> checkTasks() {
LinkedList<Task> onsetTasks = new LinkedList<Task>();
for (Task task : model.getTaskList()) {
if (!task.isActive())
continue;
Date presentTime = new Date();
if (task.nextTimeAfter(presentTime) == null) {
... |
491ae6ac-98de-47cc-8255-f9a908fe5ec2 | 4 | static public void main(String args[])
{
String[] argv;
long start = System.currentTimeMillis();
int argc = args.length + 1;
argv = new String[argc];
argv[0] = "jlc";
for(int i=0;i<args.length;i++)
argv[i+1] = args[i];
jlcArgs ma = new jlcArgs();
if (!ma.processArgs(argv))
System.exit(1);
Con... |
c62a0ab8-f502-4759-b9fe-ffe47e46115f | 9 | public String cryptanalyseCle(IMessage clair, IMessage crypte) {
/*
* La mthode cherche le premier caractre crypt du texte, puis evalue la clef de cryptage
* possible.
* Elle vrifie ensuite si le texte entier est cohrent avec cette cl.
*/
long d=new Date().getTime();
int i=0;
while(i<clair.taille() ... |
613ccc48-ec36-40d9-bb70-f0d9effbda8b | 0 | public Journal getById(Integer id) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Journal.class);
criteria.add(Restrictions.eq("id", id));
return (Journal) criteria.uniqueResult();
} |
63c1ebbe-50a2-452f-accb-c0859884af96 | 3 | @Override
public boolean decideDraw(int turn){
boolean rval;
net_play_count++;
moves_in_round++;
//We only add the draw instnace if the decidePlay outcome is good
createDrawHistory();
if (!USE_RAND && net_play_count < RAND_LIMIT && games_played > RAND_ROUNDS){
drawNet.compute(draw_instance.inputs);
... |
74b2c9e1-fa28-4266-a311-dd1aab866a40 | 6 | public Karte karteZiehen(String actionCommand) {
Karte karte = null;
Spieler aktuellerSpieler = spieler.get(this.getAktuellerSpielerIndex());
if (aktuellerSpieler.getGezogenCount() > 0) {
if (actionCommand.equals("Kartenstapel")) {
karte = this.ziehen();
... |
57e7d9da-cf3c-4b15-ac61-7d7540cda1a6 | 4 | @Override
public Line getPrecFromTitle() {
Section containingSection = ((TitleImp) this.getParent()).getParent();
if(containingSection.getIndex() >= 1) {
return containingSection.getParent().getSubSection(containingSection.getIndex() -1).getLastLine();
}
if (((TitleImp) this.getParent()).getParent().getPare... |
62443b9e-d525-453b-a4d5-7861d998ba30 | 1 | public String getNotes()
{
String eol = System.getProperty("line.seperator");
if(this.meetingNotes==null)
{
return "";
}else{
return this.meetingNotes;
}
} |
7e745d66-0ca0-4d66-a3de-314212f4c9d6 | 4 | @Override
public String getColumnName(int columnIndex) {
if (columnIndex == NUMBER) {
return "№";
} else if (columnIndex == TYPE) {
return "Тип";
} else if (columnIndex == MODEL) {
return "Модель";
} else if (columnIndex == RETURN_DATE) {
... |
9b8e5d72-5916-4f17-9b0a-f7d35bb4b8a4 | 3 | private void setBestSolve(Solve c) {
if (BestSolve == null) {
BestSolve = new Solve();
for (int i = 0; i < c.Colors.size(); i++) {
BestSolve.Colors.add(c.Colors.get(i));
}
BestSolve.Value = c.Value;
} else {
for (int i = 0; i < ... |
24945b28-fdc7-4606-aaa9-d396c66851fb | 0 | @Test
public void testStartOfDay() throws ParseException {
Date date = dateService.getStartOfDay(dateFormat.parse("19.08.2014 20:47:54.345"));
assertEquals(dateFormat.parse("19.08.2014 00:00:00.000"), date);
} |
5e0f313f-46ca-4301-bafa-98f0093da5a4 | 8 | private boolean isAreaEmpty(int x1, int x2, int y1, int y2)
{
if (x1 < 0 || y1 < 0 || x2 >= dungeon.length || y2 >= dungeon[0].length)
return false;
if (!isHorizontalLineEmpty(y1, x1, x2))
return false;
if (!isHorizontalLineEmpty(y2, x1, x2))
return false;... |
f5af0856-8ad6-4448-9f76-d5fbc64a3215 | 3 | public int checkIfMadeIt(int score){
int index = -1;
if(m_scoreBoard.isEmpty()){
return 0;
}
else{
//DEscobrindo a posiçao:
for(int i = 0; i < 5; i++){
if(score >= m_scoreBoard.get(i).getM_maxCoins()){
index... |
ce690714-1fdf-410f-914c-c86999f6032c | 8 | public static String parseType(String type){
if(StringUtils.isBlank(type)){
throw new InvalidParameterException("empty param type");
}
if("string".equalsIgnoreCase(type) || "str".equalsIgnoreCase(type)){
return "String";
}else if("int".equalsIgnoreCase(type) || "i... |
431ae45e-1dee-4a6b-925b-523f73ad7def | 0 | public MatchCounter(File directory, String keyword)
{
this.directory = directory;
this.keyword = keyword;
} |
d5555425-456e-4295-ae6a-52aa055fafbb | 8 | private ArrayList<ArrayList> getShapes(List shapes, Traject traject) throws UnsupportedEncodingException, FileNotFoundException, IOException {
FileInputStream stream = new FileInputStream("json/shapes.csv");
CSVReader reader = new CSVReader(new InputStreamReader(stream, "UTF-8"));
String[] next... |
c9607445-78ed-4495-b0ad-09ae5f6453f8 | 0 | public void setEncryptedValue(EncryptedDataType value) {
this.encryptedValue = value;
} |
8fc818c4-70b5-4b92-b720-e3e718d5fcff | 4 | public boolean setPlayer1(Player p1) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setPlayer1() BEGIN");
}
m_player1 = p1;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setPlayer1(... |
4402b9c5-effe-4344-b687-99b1986bdbe9 | 7 | public synchronized void run() {
try {
while (Thread.currentThread() == readerLog) {
try {
this.wait(100);
}
catch(Exception e) {}
if (inputLog.available() != 0) {
textArea.append(readLine(inputLog));
}
}
while (Thread.currentThread() == readerErr) {
tr... |
0333fba6-4569-449f-be8a-6a17f4ce35ba | 0 | public static void main(String[] args) {
Integer n1 = 128;
Integer n2 = 128;
System.out.println(n1 == n2);
System.out.println(n1 != n2);
Integer n3 = 127;
Integer n4 = 127;
System.out.println(n3 == n4);
System.out.println(n3 != n4);
} |
86f2b2e8-3832-4db4-ae2e-cac0480c5531 | 3 | public ArrayList<Point> downStairLocs() {
ArrayList<Point> locs = new ArrayList<Point>();
ArrayList<ArrayList<Entity>> entityarrays = new ArrayList<ArrayList<Entity>>(entities.values());
for (int x = 0; x < entityarrays.size(); x++) {
ArrayList<Entity> activeArray = entityarrays.get(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.