method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d75afac1-e702-4427-b436-4c3d10f542ff | 6 | public boolean aukaiseMonta(int x, int y) {
if (!kentta.getSolu(x, y).isAuki()) {
return true;
}
if (!flagienMaaraOikein(x, y)) {
return true;
}
for (int i = x - 1; i < x + 2; i++) {
for (int k = y - 1; k < y + 2; k++) {
... |
8b6214da-02ab-4479-9c68-f5e4225c11cf | 3 | @Override
public void run() {
while (!mTasks.isEmpty()) {
T t = mTasks.remove();
if (handleTask(t)) {
workUnitDoneTask(this, t);
}
}
synchronized (this) {
workerThread = createNewThread();
//有可能执行完createNewThread就已经有新任务了,这时候需要继续执行
if (!mTasks.isEmpty()) {
workerThread.start();
}
}... |
c5523c8d-1f36-47e0-bd98-02d2f4904683 | 5 | public static boolean accept(AbstractSyntaxNode node, TokenReader reader)
{
boolean result = false;
if (reader.accept(Token.DATA_INTEGER))
{
final Token numberToken = reader.lookahead(-1);
final int number = Integer.parseInt(numberToken.getMatched());
... |
9a78c002-75fa-420c-98fc-118e4ffb3645 | 4 | public static void main(String[] arg){
VorbisFile ov=null;
try{
if(arg.length>0){
ov=new VorbisFile(arg[0]);
}
else{
ov=new VorbisFile(System.in, null, -1);
}
}
catch(Exception e){
System.err.println(e);
return;
}
if(ov.seekable()){
Sys... |
fb3de151-1cd4-46fb-8766-43c65ef7626a | 9 | boolean perform(Command c) {
sendReadOnlyBefore(c);
if(c.op == null) return false; // FOR COMMANDS HAVING ONLY READ ONLY BUT NO ACTUAL CMD
for (int s = 1; s < slot_num; s++) {
if (c.cmdEquals(decisions.get(s))) {
slot_num++;
// logger.log(messageLevel,"... |
ff67913a-2af4-406b-8c93-2a69bed646ab | 0 | public final void setH(final Integer h) { this.h = h; } |
caaf503a-e0c0-4f50-b0da-988d82b118a6 | 4 | private void saveStats() {
int nameScoreDate = 0; ///< Names = 0, Scores = 1, Dates = 2
int j; ///< Line in leaderboard
try {
bfw = new BufferedWriter(new FileWriter(statsFile));
for (int i = 0; i < (leaderboard.length * leaderboard[0].length); i++) {
j = ... |
6fe48906-a495-4e70-b64a-571e90f81839 | 9 | Directions guessDirectionIgnoringRotation(int fromIndex, int toIndex) {
int fromRow = getRow(fromIndex);
int toRow = getRow(toIndex);
int fromCol = getColumn(fromIndex);
int toCol = getColumn(toIndex);
if (fromRow == toRow) {
if (fromCol < toCol) {
ret... |
2ff86475-2e38-4234-9e18-b38587036934 | 9 | private void evalStartState(char c) throws CalculatorException
{
if (Character.isSpaceChar(c))
{
// not expected
assert(false);
}
else if (Character.isDigit(c))
{
m_integerOrNumerator = c - '0';
m_sign = 1;
m_state =... |
002d3513-a524-46e4-a152-efa32be84610 | 5 | public void run()
{
// Last tick time
long lastTickTime = System.nanoTime();
// How many time should the game tick each second.
double nsPerTick = 1000000000 / TPS;
// The number of unprocessed ticks.
double unprocessedTicks = 0;
// Updated visible TPS / FPS every second (see further down).
long second... |
fe6c4b8d-7fc7-48ec-9675-d303f2dcb9e3 | 7 | public static Cons cppTranslateNthMethodCall(Symbol operator, Surrogate owner, Cons arguments) {
{ boolean setterP = operator == Stella.SYM_STELLA_NTH_SETTER;
Stella_Object collection = arguments.value;
Stella_Object position = arguments.last();
Stella_Object value = (setterP ? arguments.rest.valu... |
bc974633-d482-4697-a283-d7e6939b6e20 | 0 | public Set<String> getUsers() throws DataLoadFailedException {
return dataHolder.getUsers();
} |
47e46223-3bad-4326-b946-e7e5e9c95bed | 9 | protected void printAttributeSummary(boolean nominalPredictor,
boolean numericPredictor,
boolean stringPredictor,
boolean datePredictor,
boolean relationalPredi... |
c81c8755-06ac-471f-9100-648e81c0b0eb | 9 | public void removeNotify() {
GraphicalEditPart nextSelection = null;
if (getParent().isActive()) {
// This guide is being deleted (but the ruler is still active). If
// this guide
// is selected, determine which part is to be selected next.
int thisPos = getRulerProvider().getGuidePosition(getModel());
... |
e024c0de-e1f8-48a4-a43d-de6a0de1c860 | 7 | public void testMultipleSplits() throws Exception {
e=createChannel("E", true);
f=createChannel("F", true);
g=createChannel("G", true);
h=createChannel("H", true);
i=createChannel("I", true);
j=createChannel("J", true);
Util.waitUntilAllChannelsHaveSameView(10000,... |
b4c5aa06-48ae-46a2-8077-80d324357d6d | 0 | public void constructCity()
{
buildCityHall();
} |
d44187d9-c377-4d5e-a2ed-278357ce0ed3 | 2 | static void indentLine (int n, String s)
{
for (; n >= 8; n -= 8)
System.out.print ('\t');
while (n-- > 0)
System.out.print (' ');
System.out.println (s);
} |
3db4638c-6452-4f4e-8624-0d7d7a0651ec | 5 | private void setVideoDefault(Attributes attrs) {
// find the value to be set, then set it
if (attrs.getValue(0).equals("starttime"))
videoDef.setStartTime(Integer.valueOf(attrs.getValue(1)));
else if (attrs.getValue(0).equals("endtime"))
videoDef.setEndTime(Integer.valueOf(attrs.getValue(1)));
else if (at... |
1fb44d12-b46a-42f3-aea3-fe4175277f72 | 9 | public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()){
//left
case 37: {Game.p.Move(-Xspeed, 0); break;}
case 65: {Game.p.Move(-Xspeed, 0); break;}
//up
case 38: {Game.p.Move(0, -Yspeed); break;}
case 87: {Game.p.Move(0, -Yspeed); break;}
//right
case 39: {Game.p.Move(Xspeed, 0); break... |
874b5355-d6d9-45aa-b062-bb43e0ce5d2c | 4 | public static void forceDelete(final File file) throws IOException {
if (file == null) {
return;
}
if (file.isDirectory()) {
deleteDirectory(file);
} else {
final boolean filePresent = file.exists();
if (!file.delete()) {
i... |
f813c7b0-a017-4b35-888d-64d9a34f764c | 8 | public boolean setup(){
////// Setup our OSC port
try {
sender = new OSCPortOut();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
... |
c9ec6959-cfc3-4ef8-839a-0344581c567b | 9 | @Override
public void execute() throws ParseException {
DBManager mng = DBManager.getDBManager();
List<String> attrNamesInCondition = Eval.getNames(this.condition);
Table table = mng.getTable(this.tableName);
if (table == null) {
throw new ParseException("No table named " + this.tableName);
}
List<Integ... |
635edcfa-2f48-42bc-8815-028f6409b3db | 8 | @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JLabel e = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if ((row == redCell[0]) && (column =... |
5845ebdc-2b73-416d-87dd-6a58ba0e8d0b | 9 | private void registerCommand(Command cmd) {
String cmdString = cmd.getCommand().split(" ")[0];
helper.registerCommand(cmdString);
PluginCommand pCmd = helper.getCommand(cmdString);
pCmd.setPermission(cmd.getPermission().getPermissionDefault().toString());
if(cmd.getSubcommand().length == 0) {
pCmd.setPermi... |
4fb36437-4a93-45e2-9069-36d32425f693 | 0 | public CharacterSelect(GameStates state, int player)
{
this.state = state;
setLayout(new FlowLayout());
select = new JLabel("Player " + player + " select character");
add(select);
tf = new JTextArea("Choose a character from below:");
tf.setPreferredSize(new Dimension(200, 40));
add(tf);
//A... |
77596f1f-9751-4892-acb0-78877b26dd00 | 3 | public static double studentTProb(double tValue, int df) {
if (tValue != tValue) throw new IllegalArgumentException("argument tValue is not a number (NaN)");
if (tValue == Double.POSITIVE_INFINITY) {
return 1.0;
} else {
if (tValue == Double.NEGATIVE_INFINITY) {
return 0.0;
} else {
double ddf = ... |
c1f85cef-5e2c-4f33-be17-abcab3f3f979 | 6 | public double calNumero (double numC)
{
double C;
if (numC==2||numC==5||numC==8){
C=Math.pow(numC, 2);
return C ;
}
if (numC==4||numC==7||numC==9){
return numC*5;
}else{
return numC;
}
} |
998008a7-d1b4-45c5-8467-dc14a6e93a72 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
ddfd8834-3e98-429c-8714-a62a252a471c | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new StringBuffer(... |
6f528826-b021-4a55-84ed-1eba203e2bd0 | 0 | public void add(Item item) {
Node<Item> oldfirst = first;
first = new Node<Item>();
first.item = item;
first.next = oldfirst;
N++;
} |
310d9d84-d4ea-4b62-a0d1-93b17175841b | 0 | private void prepareImage(Image image) {
image.setTimestamp(System.currentTimeMillis());
} |
524b9d1f-ac83-4b72-b9e0-11082619fc54 | 9 | private static String[][] unifyVariable(String variable, String sentence, String[][] currentSub){
for(int i = 1; i < currentSub.length; i++){
if(currentSub[i][0] != null){
if(currentSub[i][0].equals(variable)){
return currentSub;
}
else if(currentSub[i][0].equals(sentence)){
return currentSub... |
c44425b8-8c92-43bc-910a-1705b7b6ffe9 | 2 | public double[][] simplifiedCurveCoordinates(){
if(!this.simplifyDone){
if(!this.tolerenceEntered){
throw new IllegalArgumentException("No tolerance has been entered");
}
else{
this.douglasPeucker();
}
}
return Point... |
9a6d3189-57b4-494f-8137-48cf120be9e1 | 9 | public String isEquivalent(int[] c, int[] s){
int n = c.length;
int max = 0;
for(int i=0; i<n; i++){
max+=c[i];
}
int[] b = new int[max+1];
Arrays.fill(b, -1);
b[0] = 0;
for(int i=0; i<n; i++){
for(int j=max-c[i]; j>=0; j--){
... |
5c2e1d31-8586-4bf6-a26a-aa6dc41acce5 | 1 | public PlayerFlag(Grid grid, Player player) {
super(grid);
if (player == null)
throw new IllegalArgumentException("The given Player is invalid!");
this.player = player;
} |
ff4ee2a8-6d64-4d01-b634-b83b32eb0736 | 1 | private void startTweeningTheScore(AnimatedScore animatedScore) {
// // position_xy
//
//
// Tween.to(animatedScore, 3, 2.0f).target(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2)
// .ease(Back.INOUT).start(tweenManager);
//alpha
Tween.set(animatedScore, AnimatedScoreAccessor.ALPHA).target(0).start... |
7488d583-48bd-4c42-a287-ba825848ca9d | 1 | public static void spawnPigChest (Location loc, int amount) {
int i = 0;
while (i < amount) {
LivingEntity pig = (LivingEntity) loc.getWorld().spawnEntity(loc, EntityType.PIG);
pig.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1));
Entity min... |
18b6de60-b711-4e89-acb0-d1b40d199996 | 9 | public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner s = new Scanner(System.in);
double[] points = new double[]{s.nextDouble(), s.nextDouble(), s.nextDouble()};
Arrays.sort(points);
if(points[2] >= points[1] + points[0]){
System.out.prin... |
19bb7902-ec7f-4b00-bd71-bc3941bb786f | 0 | public void delete(int id){
TravelTrip travelTripTemp = findById(id);
em.remove(travelTripTemp);
} |
de1d5922-cc4b-4c0b-af25-486f49abc63f | 1 | public static void main(String[] args) {
Conta conta = new Conta();
conta.setId(7);
EntityManager em = new JPAUtil().getEntityManager();
MovimentacaoDAO movimentacaoDao = new MovimentacaoDAO(em);
em.getTransaction().begin();
List<Movimentacao> encontrado = movimentacaoDao.listaTodasMovimentacoesPorNome("... |
a73739e8-fe8d-4663-ac4a-b8437b9b39bf | 2 | public void BuscarMejorImpuesto(String buscarClase,double valor)
{
if(buscarClase.equals("OperadorA"))
{
tpv = new OperadoraA(valor);
tpv.ObtenerCalculo();
}
else if (buscarClase.equals("OperadorB"))
{
tpv = new OperadoraB(valor);
... |
b24966bc-6bf5-4f3a-9a64-d56f1236929d | 9 | public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
try {
if (src == resetTrain) {
newGame();
} else if (src == submitLocomotive) {
addLocomotive(
Integer.parseInt(locomotiveWeightField.getText()),
getLocomotiveString());
} else if (src == submitFreightCar) {
... |
2ff8aefb-4e5e-415c-9d08-f1217ebeec0a | 3 | private Chunk loadChunkFromFile(int var1, int var2) {
if(this.chunkLoader == null) {
return null;
} else {
try {
Chunk var3 = this.chunkLoader.loadChunk(this.worldObj, var1, var2);
if(var3 != null) {
var3.lastSaveTime = this.worldObj.getWorldTime();
... |
3bf975aa-da7f-4b3b-bc21-03e569c749cd | 0 | public String Echo(String message) {
final long id = conn.getCurrentConnectionInfo().getIdConnection();
System.out.println("Echo: " + message + " from id " + id);
return "Echo: " + message + " from id " + id;
} |
1f9919b5-5fcf-4224-9bd3-08d5eddeba08 | 6 | public static int[] rotate2(int[] pix, float beta, int iw, int ih, int owh) {
pix = GT.translate(pix, (owh-iw)/2, (owh-ih)/2, iw, ih, owh, owh);
int[] opix = new int[owh * owh];
double t = beta / 180;
for (int i = 0; i < owh; i++) {
for (int j = 0; j < owh; j++) {
double p = Math.sqrt((j - owh/2... |
a4178360-cc91-43b1-94de-95a841924e49 | 3 | public static char convertScoreToChar(Integer score) throws ScoreNotDigitException {
if (score == 0) {
return IConstants.ZERO_LABEL;
}
if (score == 10) {
return IConstants.STRIKE_LABEL;
}
String scoreString = score.toString();
if(scoreString.length() != 1) {
throw new ScoreNotDigitException();
... |
77adb3fc-6589-42fd-b8b4-47508317d290 | 6 | public static TreeMap<Long, File> getNumericalOrderFilesWithNumericalUnderscoreFilenames_TreeMap(
File[] files,
String underscore) {
TreeMap<Long, File> result = new TreeMap<Long, File>();
String filename;
String[] split;
for (File file : files) {
file... |
28404b7f-6635-44b6-932a-828401973aff | 7 | public void update(Observable s, Object c)
{
if (s instanceof MenuListener)
{
ActionEvent ae = (ActionEvent)c;
if (ae.getActionCommand().compareTo(ImportHTML.getLabel()) == 0)
{
FileFrame myFileChooser = new FileFrame(1);
... |
92778570-9c44-4b11-844e-b418163e781d | 3 | public void testMaxYear() {
final ISOChronology chrono = ISOChronology.getInstanceUTC();
final int maxYear = chrono.year().getMaximumValue();
DateTime start = new DateTime(maxYear, 1, 1, 0, 0, 0, 0, chrono);
DateTime end = new DateTime(maxYear, 12, 31, 23, 59, 59, 999, chrono);
... |
98024c1b-8a06-4231-9baf-de0257f35f3b | 2 | static int findCycleLength(int num){
int count=0;
while (num > 1){
if(num%2==0){
num=num/2;
}else{
num=3*(num)+1;
}
count++;
}
return count;
} |
dc368226-27f3-4f40-919d-149c5ff311de | 5 | private boolean needshift() {
if (parent instanceof Window) {
Window wnd = (Window) parent;
if (wnd.cap != null) {
String str = wnd.cap.text;
if (str.equals("Oven") || str.equals("Finery Forge")
|| str.equals("Steel Crucible")) {
return true;
}
}
}
return false;
} |
5b5c6654-e3e0-4451-8234-49feebcdba07 | 8 | public void transaction() throws Exception
{
while (true)
{
System.out.println("Attente du destinataire (couple IP/port)");
rx(dataSocket, message);
System.out.println("Configuration destinataire réussi...");
try
{
while(Sequence != nbSequence)
{
System.out.println("Début de la transmis... |
4aba4c03-ca51-4c63-a134-f5e0694f23c8 | 1 | private void sortFasterNonStable(T[] a, T[] aux,
int lo, int hi)
{ // Sort a[lo..hi].
if (hi <= lo)
return;
int mid = lo + (hi - lo) / 2;
sortFasterNonStable(a, aux, lo, mid); // Sort left half.
sortFasterNonStable(a, aux, mid + 1, hi); // Sort right half.
mergeFasterNonStable(a, aux, lo, mid, hi); // ... |
b9ef96cb-0a1d-4bac-b263-f79236eb770f | 7 | @Override
public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from,
HantoCoordinate to) throws HantoException {
if(gameIsOver) {
throw new HantoException("game is already over");
}
MoveResult result = checkresign(pieceType, from, to);
if(pieceType == null && from == null && to =... |
cce4b0f5-f511-4e71-9bae-7542d029ed68 | 6 | public void updateAsScheduled(int numUpdates) {
super.updateAsScheduled(numUpdates) ;
if (! structure.intact()) return ;
//
// Provide power and life support-
final float condition = (structure.repairLevel() + 1f) / 2 ;
final int SB = structure.upgradeLevel(SECURITY_MEASURES) ;
int powerLim... |
a89cf8dd-eada-4dd2-bc09-e93b632007e9 | 9 | static void drgnbstr_draw_sprites(osd_bitmap bitmap)
{
int offs;
for (offs = 0; offs < spriteram_size[0]; offs += 2){
int number = spriteram.read(offs) | ((spriteram_3.read(offs) & 0x80) << 1);
int color = (spriteram.read(offs+1) & 0x3f);
int sx = (spriteram_2.read(offs+1)) + 0x100*(spriteram_3.read(off... |
6bdd9536-3e7e-4e9d-a39d-63e5cd9bd9e0 | 8 | @SuppressWarnings({ "unchecked", "rawtypes" })
private void replaceData(Map<String, Object> newData)
throws StickyWebDataSourceParseException {
data = new HashMap<String, Output>();
for (Entry<String, Object> es : newData.entrySet()) {
if (es.getValue() instanceof ArrayList) {
ArrayList values = (ArrayLi... |
7d3c4945-8c3b-4321-9e52-3b4b7516fcba | 2 | public TreeNode<T> findTreeNode(Comparable<T> cmp) {
for (TreeNode<T> element : this.elementsIndex) {
T elData = element.data;
if (cmp.compareTo(elData) == 0)
return element;
}
return null;
} |
cc7c72f4-a205-410c-a183-1ad364142219 | 2 | public ValueType dereferenceNextPlus() {
if(code >= A.code && code <= J.code)
return getByCode((byte)(code+0x10));
throw new IllegalStateException("Can not dereference+plus type "+this);
} |
4a2c05a7-99b2-49e1-9926-39674a34f237 | 8 | public void listen() {
listen = new Thread("Listen")
{
public void run()
{
while (running)
{
Message message = null;
try
{
message = client.receive();
}
catch (IOException e)
{
continue;
}
switch (message.getType())
{
case connect:
cl... |
d973b6bd-034d-4867-85f7-e57a64bd28a1 | 4 | protected void loadRolloutData() {
try {
FileInputStream rolloutFile = new FileInputStream("Output.rollout");
ObjectInputStream stream = new ObjectInputStream(rolloutFile);
Object result = stream.readObject();
if(result instanceof RolloutResult){
rollout = (RolloutResult) result;
}
} catch (FileN... |
c3e61290-a9f7-4022-a66b-ed63ad0a6a4d | 2 | private static final byte[] encodeString(ByteBuffer string)
{
int length = string.array().length;
int num_digits = 1;
while((length /= 10) > 0)
{
num_digits++;
}
byte[] bencoded_string = new byte[length+num_digits+1];
bencoded_string[num_digits] = ... |
820a7b73-8259-4d52-aa3a-dd08c1f5f5c5 | 8 | private boolean solve() {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
if (i == j || j == k || i == k) continue;
Date date = new Date(field[i], field[j], field[k]);
if (date.isLeg... |
6913a57d-cc5e-46db-806e-f0b776c21665 | 9 | @Override
public void buttonY(boolean pressed) {
if(enabled) {
if(ses2 != null) {
setFlagsFalse();
if(future != null) {
future.cancel(true);
}
}
if(pressed == true) {
yFlag = true;
dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetYAssignedKeyCode());
if(... |
f8c8e670-bf6a-41cf-8015-ab616198f19e | 2 | public void setExtensionList(ArrayList extensionList) {
this.extensionList = extensionList;
// Check extensionList for wildcard character.
anyExtensionWillDo = false;
for (int i = 0; i < extensionList.size(); i++) {
String extension = (String) extensionList.get(i);
if (extension.equals(WILDCARD_CHARACT... |
20c0a5b5-1caf-4d45-94af-251532acb732 | 2 | public void updateInOutCatch(FlowBlock catchFlow) {
VariableSet gens = ((TryBlock) block).gen;
/*
* Merge the locals used in the catch block with those written by the
* try block
*/
catchFlow.in.merge(gens);
/*
* The gen/kill sets must be updated for every jump in the other block
*/
Iterator ... |
1a7b8701-b8ed-4814-8515-73c1dc6537f0 | 8 | void setWidgetSortIndicator () {
if (sortIndicatorButton.getSelection ()) {
/* Reset to known state: 'down' on column 0. */
table1.setSortDirection (SWT.DOWN);
TableColumn [] columns = table1.getColumns();
for (int i = 0; i < columns.length; i++) {
TableColumn column = columns[i];
if (i == 0) tabl... |
3d857ba2-ab48-414f-95d6-439db5df2a3c | 8 | private void doWalk(GameMap retMap) {
int x;
int y;
do {
x = rand.nextInt(retMap.getX() - 2) + 1;
y = rand.nextInt(retMap.getY() - 2) + 1;
} while (retMap.getCell(x, y).isPassable());
while (!retMap.nextToCell(x, y, MapCellFloor.getInstance())) {
... |
00c94004-5b77-4ec5-8247-d401b67f4f14 | 6 | public void writeUTF8ULong(long val) throws IOException {
if (val < 0x80) {
writeRawUInt((int) val, 8);
} else if (val < 0x800) {
writeRawUInt(0xC0 | (int) (val >> 6), 8);
writeRawUInt(0x80 | (int) (val & 0x3F), 8);
} else if (val < 0x10000) {
writ... |
7eafa819-d43f-4650-85c2-03df66deabb1 | 8 | private Observer getWatchedEntryObserver()
{
return new Observer(){
@Override
public void update(Observable o,
Object arg)
{
if (arg instanceof File)
{
File file = (File)arg;
EntryDataModel model = (EntryDataModel)list.getModel();
EntryInt... |
2b028933-eff5-48ba-9008-23fe33b0311c | 5 | private void getAll(TreeNode node) {
int l = 0;
int r = 0;
int p = 0;
if (node.left != null) {
l = node.left.key;
}
if (node.right != null) {
r = node.right.key;
}
if (node.parent != null) {
p = node.parent.key;
}
HashPrinter.treeNode(node, l, r, p);
if (node.left != null) {
... |
188d2dab-e1f8-4fe0-8269-ba5d3be78438 | 5 | public Token[] tokenize(String input)
{
Token[] initialTokens = innerTokenizer.tokenize(input);
List tokens = new ArrayList();
for (int i=0; i<initialTokens.length; i++) {
Token tok = initialTokens[i];
String str = "^"+tok.getValue()+"$";
if (keepOldToken... |
e1a9ffca-21f7-4aa8-9dca-a336ffdaf469 | 1 | @Test
public void newVector_test() {
try{
double val=3;
int m=4;
double result[]= Vector.newVector(m, val);
double exp[]={3,3,3,3};
Assert.assertArrayEquals(result, exp,0.0);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemented");
}
} |
7eb5075c-39bb-423f-9d74-7521a288ff8a | 5 | public final void mouseReleased(MouseEvent event) {
int eventButton = event.getButton();
if (eventButton == MouseEvent.BUTTON1) {
mouseButton1Pressed = false;
} else if (eventButton == MouseEvent.BUTTON2) {
mouseButton2Pressed = false;
} else if (eventButton == M... |
f1a81283-f880-4ced-9795-e91dfcb41564 | 5 | private boolean isWallDetected() {
if ((sensorThread.getSonarDistance1() < MAX_DISTANCE && sensorThread.getSonarDistance2() < CONTROL_DISTANCE
|| sensorThread.getSonarDistance2() < MAX_DISTANCE && sensorThread.getSonarDistance1() < CONTROL_DISTANCE)
&& Math.abs(sensorThread.getSonarDistance1()- sensorThread... |
54ca441c-9bc3-411b-9341-e8fae86858fa | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
if (label.equalsIgnoreCase("hidden"))
{
if (!sender.hasPermission("hiddenmc.admin"))
{
locale.sendNoPermission((Player) sender);
return tru... |
5023ca47-db94-4ff5-b5d3-fb46ef07224f | 3 | public void reloadConfig() {
boolean configExists = configExists();
if (configFile == null) {
configFile = new File(dir+"/gods.yml");
}
config = YamlConfiguration.loadConfiguration(configFile);
// Look for defaults in the jar
InputStream defConfigStream = plugin.getResource(de... |
160891ea-c788-4436-9d37-557f6c6bc5d3 | 5 | private static void writeToFile(Serializable serializable)
{
FileOutputStream fout = null;
ObjectOutputStream oos =null;
try
{
fout = new FileOutputStream("triangle.ser");
oos = new ObjectOutputStream(fout);
oos.writeObject(serializable);
... |
07fff34e-58e6-44ef-96dd-923b19829a06 | 5 | private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
JFileChooser chooser = new JFileChooser();
int returnOption = chooser.showOpenDialog(this);
switch (returnOption) {
case JFileChooser.CANCEL_OPTION:
... |
c46c2b3c-0bbb-4bb1-abb0-a46e5db2b6cb | 0 | @PersistenceContext
public void setEntityManager(EntityManager em) {
this.em = em;
} |
f743fdde-5a92-403f-8c3e-5b79f46e507c | 3 | public SessionClient() {
try {
String url = "//" + SESSION_SERVER_MACHINE_NAME + "/"
+ SESSION_SERVER_SERVICE_NAME;
//sessionServer = (SessionServer) Naming.lookup(url);
Registry registry = LocateRegistry.getRegistry("localhost", 2099);
sessio... |
62e364c4-9709-4854-a261-26154fb572f2 | 2 | public void update(){
age++;
if(age - lastHit > 600){
if(strength<maxStrength){
strength += rechargeRate;
}
}
} |
be00a374-2a6d-4acd-90b9-52d2515c5ffd | 4 | @Override
public List<AssemblyLine> generate(Context context)
{
final List<AssemblyLine> lines = Lists.newLinkedList();
if (Compiler.debug)
{
lines.add(new Comment("Start if"));
}
String blockStart = context.getUniqueId("start_if_block");
Stri... |
8c3ee12f-3a74-43f0-a568-b925b1ce6fda | 0 | private SendMessage() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Enviar mensaje");
putValue(SHORT_DESCRIPTION, "Enviar mensaje");
putValue(LONG_DESCRIPTION, "Enviar mensaje");
putValue(SMALL_ICON, new... |
7077793e-a537-4316-9afd-b29682671332 | 3 | public static String toString(JSONObject o) throws JSONException {
boolean b = false;
Iterator keys = o.keys();
String s;
StringBuffer sb = new StringBuffer();
while (keys.hasNext()) {
s = keys.next().toString();
if (!o.isNull(s)) {
... |
c8f383a8-6bf0-4995-bf81-ed6dce02da2b | 6 | private void clearRelation() {
if (parents[Parent.PAPA.ordinal()] != null)
if (parents[Parent.PAPA.ordinal()].removed)
parents[Parent.PAPA.ordinal()] = null;
if (parents[Parent.MAMA.ordinal()] != null)
if (parents[Parent.MAMA.ordinal()].removed)
parents[Parent.MAMA.ordinal()] = null;
if (getPartner(... |
b51d94a3-1c84-49cc-9558-e4c9c30c7188 | 5 | public static void drawPiramid(int numOfLines) {
int k = 0;
//цикл строк, где b - номер строки
for (int b = 0; b < numOfLines; b++) {
k++; // количество звездочек в текущей строке
/*цикл вывода пробелов и звездочек в строке*/
for (int numOfspaces = ... |
9b620698-be09-4de1-818b-06fc54be8e83 | 1 | public static List<String> toList(String[] args) {
List<String> list = new ArrayList<String>(args.length);
for(String item : args) list.add(item);
return list;
} |
be557080-5e26-4424-80c3-6499b50aff70 | 0 | public static SandwichFactory getInstance() {
return instance;
} |
39bcbb0f-fcc8-4904-9b65-57328d2a48ea | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((previousGrids == null) ? 0 : previousGrids.hashCode());
result = prime * result
+ ((vehicles == null) ? 0 : vehicles.hashCode());
return result;
} |
6e042636-7b43-4e44-865d-ddb5ac87bd75 | 0 | public void setCategories(String newCategories) {
categories = newCategories.split(",");
} |
55857118-cb27-49a6-93ef-fdcc2b2f05ea | 0 | @Override
public String toString() {
return "LogicTimeStampClock[" + this.clock + "]";
} |
87590c01-e69c-4cfa-8361-297d0bd66f1a | 7 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String texts = in.nextLine();
String[] textSplits = texts.split(" ");
int[] index = new int[textSplits.length];
int n = 0;
if (textSplits.length == 1) {
System.out.println(textSplits[0]);
}
Map<String, Integer> wordsC... |
9fb52c60-3e0f-442b-8d59-db5c784fb6d2 | 0 | public PropertiesDialog(Game game) {
this.game = game;
this.setLayout(new BorderLayout());
this.setModal(false);
this.setUndecorated(true);
this.setAlwaysOnTop(true);
this.saveButton.addActionListener(this);
this.cancelButton.addActionListener(this);
this.add(this.saveButton, BorderLayout.PAGE_E... |
b463601d-8f29-4808-937d-d84529ececc2 | 2 | public static URL getTypeIconURL(int typeID, short size) throws ApiException {
if(Arrays.binarySearch(typeIconSizes, size) < 0)
throw new ApiException("Invallid image size: "+Short.toString(size)+". Allowed sizes are: "+Arrays.toString(characterPortraitSizes));
try {
return new URL(IMAGE_SERVICE_URL+"/Invento... |
01cac6b7-aab5-4df6-abc4-39119409eca2 | 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-NAME> <S-IS-... |
2dd55509-e51d-45a7-a993-649c3a451b1f | 7 | @Override
public boolean validateData() {
code = textFieldCode.getText().trim();
names = textFieldNames.getText().trim();
birthday = dateChooserBirthday.getDate();
email = textFieldEmail.getText().trim();
String key;
if (code.length() == 0) {
key = "app.w... |
fa2129d5-bc35-47cb-986a-016ecd05279c | 8 | public AllEnum.AnimationCommands intToAnimation(){
if(currentComboNo == 1){
return AllEnum.AnimationCommands.PUNCH1;
}
if(currentComboNo == 2){
return AllEnum.AnimationCommands.PUNCH2;
}
if(currentComboNo == 3){
return AllEnum... |
1eb8963b-1f6d-48f4-b076-c02d2ad663e8 | 1 | @Override
public boolean previous() {
if (pointer <= 0) {
currentRecord = null;
return false;
}
pointer--;
currentRecord = new RowRecord(rows.get(pointer), metaData, parser.isColumnNamesCaseSensitive(), pzConvertProps, strictNumericParse,
upper... |
dfb4fe52-8d5d-4f6e-9d4c-ab95315ebcd9 | 9 | public boolean createBackup(boolean fullbackup){
boolean completed = true;
Connection con = null;
Statement st = null;
ResultSet rs = null;
String url = getProps().getProperty("url");
String user = getProps().getProperty("dbuser");
String password = getProps().getProperty("dbpassword... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.