method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
abdc2307-5765-42fb-ae8c-645f851a9ee1 | 6 | private Either<A, P2<Boolean, Set<A>>> tryUpdate(final A a, final F<A, A> f) {
if (isEmpty())
return right(P.p(false, this));
else if (ord.isLessThan(a, head()))
return l().tryUpdate(a, f).right().map(set -> set._1() ? P.p(true, (Set<A>) new Tree<A>(ord, color(), set._2(), head(), r())) : set);
... |
de68e4ef-3fe6-4bb1-87d4-9e0dc087c2d9 | 9 | public static String[] getPhonemeASR2(int i, String refWords,
String refPhones, String testWav, String lesson, String choices) {
String[] line = new String[i];
int timeout = 0;
int trial = 0;
// if (!Globals.installer){
// testWav = "../../" + testWav.replaceAll("\"", "");
// }
String j_phcmd = "janus ... |
a7831165-db97-4b06-8734-8ef30287d29f | 3 | private boolean isDigitBetweenOneAndFour(String str)
{
boolean isDigitAppropriate = false;
char[] signsInString = str.toCharArray();
if (signsInString.length == 1)
{
char sign = signsInString[0];
isDigitAppropriate = Character.isDigit(sign) && Character.getNum... |
b69a5493-8b00-4b55-a6b8-84e59cd2ec94 | 9 | void getGroup(Group group, ElementType parent)
throws XMLMiddlewareException, MalformedURLException, IOException, EOFException
{
// This gets a choice or sequence.
boolean moreCPs = true;
while (moreCPs)
{
discardWhitespace();
getContentParticle(group, parent);
... |
afe8cdd3-557b-475a-b4cd-d548c99e3675 | 6 | public void move()
{
if(canJump) jump();
if(input != null){
if(input.left){
isStill = false;
if(x >= 2) x -= 3;
dir = 1;
left();
}
if(input.right){
isStill = false;
if(x <= 535) x += 3;
dir = 2;
right();
}
}
} |
f8687a64-8de6-44e6-9503-7c75fed4fe70 | 4 | @Override
public void onKeyPressed(Keys key, char keyTyped)
{
if(key.equals(Keys.ENTER))
{
outputString = inputString.toString();
// Log.info("> " + outputString);
inputString.setLength(0);
}
else if (key.equals(Keys.BACKSPACE))
{
if(inputString.length() > 0)
{
inputString.setLength(inputS... |
0c84a7a2-6e5e-4127-b406-ce4ea65eb577 | 1 | public static List<Appointment> findByVenue(long venueId)
throws SQLException {
List<Appointment> aAppt = new ArrayList<Appointment>();
ResultSet resultSet =
Data._find(Appointment.class.getSimpleName(), "venueId", String
.valueOf(venueId));
while (resultSet.next())
{
aAppt.add(Appointment.creat... |
31279503-e039-43e9-8e26-3e826852ebf0 | 0 | public String getHTTPHeader() {
String fmt = "%s=%s; expires=%s";
return String.format(fmt, n, v, e);
} |
df365d5b-a286-4e59-9931-60a18e695a5a | 0 | public static void main(String[] args)
{
OverrideTest test = new OverrideTest();
System.out.println(test.toString());
} |
e68abcab-23ce-433c-b1e1-061ea1c3e564 | 2 | public int putClassType(String name) {
TypeSignature.checkTypeSig(name);
if (name.charAt(0) == 'L')
name = name.substring(1, name.length() - 1);
else if (name.charAt(0) != '[')
throw new IllegalArgumentException("wrong class type: " + name);
return putIndexed(CLASS, name, putUTF8(name), 0);
} |
5fc6023e-b70f-46ea-b308-20bc4fa30b8a | 4 | public static Type getBaseType(String typeStr)
{
if (typeStr.equals("int")) return new IntType();
if (typeStr.equals("float")) return new FloatType();
if (typeStr.equals("bool")) return new BoolType();
if (typeStr.equals("void")) return new VoidType();
return new ErrorType("U... |
5f480430-08ba-4bc8-a6cd-a66a9c52bc55 | 6 | public String toString(){
String picture = "";
String assister = ""; //Used solely to help us draw
String assister2 = ""; //Another helper
String assister3 = "";
String assister4 = "";
for (int x = 0; x <= numOfDisks; x++){
assister = assister +" ";
assister3 = assister3 + "-";
}
assister2 = assi... |
dd706d17-1d88-43f5-bd17-cf17dc8e32b3 | 6 | private boolean interact(final SceneObject location, final String action, final boolean open) {
final Point center = location.getCentralPoint();
if (centralPoint == null || distanceBetween(Mouse.getLocation(), center) > 4) {
centralPoint = center;
if (!Calculations.isOnScreen(cen... |
a988cbe8-6ad1-48a4-9181-e4373dc35106 | 6 | public JFastRequest(Socket socket)
throws IOException, JFastException
{
this.socket = socket;
properties = new Properties();
data = new byte[0];
input = socket.getInputStream();
output = socket.getOutputStream();
JFastMessage message = null;
... |
b80e7717-5b2a-49e4-a04a-9b875877986f | 5 | public Mob getClosestMobToFollow(int uniqueID, Vector2i p1) {
double min = Double.MAX_VALUE;
Mob follow = null;
for (Mob mob : mobs) {
if (!mob.isInvisible() && mob.getUniqueID() != uniqueID && !(mob instanceof BadTonny)) {
double distance = p1.getDistance(new Vector2i((int) mob.getX(), (int) mob.getY()));
... |
d5483b53-6a7e-4b4c-998f-d583c7d3eb67 | 1 | public void moveDown() {
if ((y + length + v) < FRAME_HEIGHT) {
y += v;
} else {
y = FRAME_HEIGHT - length;
}
} |
3d6fb343-9361-43ed-9293-7af1c3be4a79 | 4 | public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
threadLocal.set(session);
... |
a52d58d2-dd59-4974-8778-1fa14a20b446 | 9 | public int calcularH(Nodo nodo){
Estado estado=nodo.getEstado();
Matriz matriz=estado.getMatriz();
int heuristicaUno = 0, heuristicaDos = 0, cargafaltante = 0;
int[] posicionRobot = matriz.retornarCoordenadaDe(ID_ROBOT);
int[] posicionSitioUno = matriz.retornarCoo... |
25fb02b0-2cbc-4a7f-86c9-27a16911ffdd | 4 | void addSubcommand(Command command) {
if(submenus.containsKey(command.getCommand())) {
boolean allGood = true;
for(Command cmd : submenus.get(command.getCommand())) {
if(SubmenuManager.compareStringArr(cmd.getSubcommand(), command.getSubcommand()))
allGood = false;
}
if(allGood)
submenus.get(... |
6952e57b-e153-4af8-8b7e-f4965c355348 | 8 | private void destroyBoxes() {
Iterator<Box> i = BombermanGame.level.iterator();
//destroy boxes
while (i.hasNext()) {
Box box = i.next();
if (!box.isBreakable()) continue;
if ((x == box.x) && (y == box.y + BOX_SIZE || y == box.y - BOX_SIZE)) {
... |
3ac2a088-47d1-49e8-a315-91db2be7e6fa | 7 | public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;integratedSecurity=true;";
// Declare the JDBC objects.
Connection con = null;
Statement stmt ... |
9b117c53-d35d-40de-bc85-f98027194a8e | 7 | @Override
public boolean checkMove(GameBoard gb, int player, Coordinates coord) {
try {
if (gb.getOccupation(coord) != EMPTY)
return false;
} catch (OutOfBoundsException e) {
return false;
}
for (int i = -1; i <= 1; ++i)
... |
ab9ede6e-9ed6-4a69-b5bf-56f26a054990 | 3 | public int trap(int[] A) {
if (A.length < 3)
return 0;
int[] leftMax = new int[A.length];
for (int i = 1; i < A.length; i++) {
leftMax[i] = Math.max(leftMax[i - 1], A[i - 1]);
}
int rightMax = 0;
int count = 0;
for (int i = A.length - 2; ... |
5a687f92-545d-453e-bb54-473f21c2977b | 8 | public static String prettyPrint(String jsonPayload) {
int indent = 0;
StringBuilder output = new StringBuilder();
JsonLexer lexer = new JsonLexer(new StringReader(jsonPayload));
while (lexer.hasNext()) {
JsonToken token = lexer.next();
if (token.getType() == Json... |
0df79aa6-6295-415d-a198-24031b60d086 | 9 | private boolean parsePrivmsg(String in, String[] split) { // Handles all msgs.
String line = getLine(in);
String name = in.toString().split("!")[0].substring(1);
String channel = split[2].split(":")[0];
if (!line.contains("\u0001")) { // If normal msg
if (!channel.equals(s... |
4bec0fe1-3ed0-4d15-9aec-5384785192db | 3 | public void setGraph( Graph graph ) {
if( this.graph != graph ) {
if( this.graph != null ) {
disconnect();
}
this.graph = graph;
if( this.graph != null ) {
connect();
}
regraph();
}
} |
1d457622-3c09-4063-a040-32103fa9e05d | 8 | public void init(String startLine) {
data = null;
performSeparationOfCommonEdges = true;
if (startLine != null && (startLine.contains("-E") || startLine.contains("--no-separation"))) {
performSeparationOfCommonEdges = false;
}
dropShadows = true;
if (startLine != null && (startLine.contains("-S") || star... |
0bf06d13-7b1b-402d-b4a3-cb5fb6199ad3 | 8 | public static void elaborateInstance(Stella_Object self) {
if (((Boolean)(Logic.$FILLINGCONSTRAINTPROPAGATIONQUEUESp$.get())).booleanValue()) {
return;
}
if (Logic.$JUST_IN_TIME_FORWARD_INFERENCEp$) {
if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(self), Logic.SGT_LOGIC_LOGIC_OBJECT)) {
... |
0b364735-05d6-48aa-b801-cf5b96d2147b | 0 | public void shake() {
this.addEffMult(0.02);
} |
d2b17935-0a22-4940-81d4-68b326003e7c | 9 | protected boolean[] datasetIntegrity(
boolean nominalPredictor,
boolean numericPredictor,
boolean stringPredictor,
boolean datePredictor,
boolean relationalPredictor,
boolean multiInstance,
int classType,
boolean predictorMissing,
boolean classMissing) {
... |
952b546d-2c9a-4583-83db-4558250b89e1 | 0 | public String getSymbol() {
return mySymbol;
} |
ffb5f075-190e-4c0a-8e9d-52db372a0797 | 0 | public PhonePopup(final Stage parentStage, String titleText,
String phoneType) throws MalformedURLException {
this.root = new StackPane();
this.root.autosize();
this.scene = new Scene(root,
AppSettings.getDoubleValue("phone.popup.width"),
AppSettings.getDoubleValue("phone.popup.height"),
Color.we... |
db9ad9dd-9fdb-4260-9537-dcdc035e1764 | 5 | public boolean ballInGoalzone(ObjBall ball) {
if(ball == null)
return false;
Pos ballPos = mh.getPos(ball.getDistance(), getDirection() + ball.getDirection());
ballPos = mh.vAdd(getPosition(), ballPos);
if(((ballPos.x <= -36) && (ballPos.x >= -52.5)) && ((-20.16 <= ballPos.y) && (ballPos.y <= 20.16... |
6930083f-02ba-44f2-ac14-381d1a9dfb0f | 8 | private void decodeHuffmanData (final BZip2HuffmanStageDecoder huffmanDecoder) throws IOException {
final byte[] bwtBlock = this.bwtBlock;
final byte[] huffmanSymbolMap = this.huffmanSymbolMap;
final int streamBlockSize = this.bwtBlock.length;
final int huffmanEndOfBlockSymbol = this.huffmanEndOfBlockSymbol;
... |
da79d64e-8cfa-478b-ab0c-4a0fac74a911 | 1 | public void deleteProperty(String section, String var) {
if (map.containsKey(section + '.' + var)) map.remove(section + '.' + var);
} |
972205b2-f7c9-43c8-a2f9-aed98e445309 | 2 | public void createDirectory() {
File file = new File(source);
if (!file.exists()) {
if (file.mkdir()) {
System.out.println("Directory is created!");
} else {
System.out.println("Failed to create directory!");
}
}
} |
8e1d26e9-6741-4697-9472-fecb80f8976e | 9 | public int getWidth(String text) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null.");
}
if (text.length() == 0) {
return 0;
}
if (displayListCaching) {
DisplayList displayList = (DisplayList) displayLists.get(text)... |
3b76598e-f5cf-4047-9992-414638e01f70 | 4 | public void newGame() {
String s;
String name = "";
s = "Welcome to Ye Olde RPG!\n";
s += "\nChoose your difficulty: \n";
s += "\t1: Easy\n";
s += "\t2: Not so easy\n";
s += "\t3: Beowulf hath nothing on me. Bring it on.\n";
s += "Selection: ";
System.out.print( s );
try {
difficulty = Integer.parseIn... |
4f9ca424-ff5c-4ee0-8537-6e9a2b728951 | 0 | public List findByTimeLimit(Object timeLimit) {
return findByProperty(TIME_LIMIT, timeLimit);
} |
106befa5-98aa-4425-9ee9-a1080e6968fc | 3 | private static GameObject searchLoop(List<GameObject> gameObjects, String name){
GameObject temp = null;
for(GameObject go:gameObjects){
if (go.getId().equals(name)){
return go;
}else {
temp = searchLoop(go.getChildren(),name);
}
... |
cc9b2060-c2aa-441c-b628-29a5e7da451d | 5 | private void createPPT()
{
try
{
Slide introSlide = slideShow.createSlide();
TextBox intro = introSlide.addTitle();
intro.setFillColor(TITLE_BACKGROUND_COLOR);
intro.setLineColor(TITLE_BORDER_COLOR);
Rectangle2D introRect = ne... |
b11b9e07-87ec-4b61-891b-c59cf47715db | 2 | public UsuarioBean getFromLogin(UsuarioBean oUsuario) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
String strId = oMysql.getId("usuario", "login", oUsuario.getLogin());
if (strId == null) {
oUsuario.setId(0);
} else {
... |
18060c2c-6e62-4b56-86f1-68d4d14ba1cf | 9 | public void buildPeers(String host, int port, int hops){
LoggerUtil.getLogger().fine("build peers");
if(this.maxPeerReached() || hops <= 0){
return;
}
PeerInfo currentPeer = new PeerInfo(host,port);
List<P2PMessage> responseList = this.connectAndSend(currentPeer, SharerMessage.PEER_NAME, "", true);
if... |
9cb375a0-4f1e-4ade-aabd-e643eaeebefc | 6 | @EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
if (main.isIngame()) {
Team team = main.getTeamByPlayer(event.getEntity());
if (team != null) {
team.removePlayer(event.getEntity());
}
OfflinePlayer oPlayer = damageCounter.get(... |
b999866a-f172-4b00-8e7a-31015f5e8d13 | 1 | public static void main(String[] args) {
Funcion fun = new Funcion() {
@Override
public double f(double x) {
return 0;
}
@Override
public double f(double x, double y) {
return x + y - 1;
}
@Over... |
5a111a37-9084-4e6b-9b66-10552e0de980 | 0 | public V getValue(){
return mValue;
} |
e5134fd9-e267-4830-bd2a-8147f961ca69 | 0 | @Override
public void mouseExited(MouseEvent paramMouseEvent) {/**/} |
b4faf1fa-4311-4904-8d35-7e45d1eb4611 | 8 | public static BufferedImage cechyMetoda1(BufferedImage in){
BufferedImage out = new BufferedImage(in.getWidth(), in.getHeight(), in.getType());
BufferedImage outtmp = new BufferedImage(in.getWidth(), in.getHeight(), in.getType());
out = RGB.powiekszKopiujac(in, 0);
outtm... |
29cc4269-f048-494b-a6ae-6142ebaf74c6 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Vector2 other = (Vector2) obj;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) != Fl... |
680a7618-a47e-4eb2-ab81-7c8f1ecdc0c5 | 5 | String getAxisTypeName()
{
String ret = "";
switch( axis )
{
case AXIS_NONE:
ret = "NONE";
break;
case Sxvd.AXIS_ROW:
ret = "ROW";
break;
case Sxvd.AXIS_COL:
ret = "COL";
break;
case Sxvd.AXIS_PAGE:
ret = "PAGE";
break;
case Sxvd.AXIS_DATA:
ret = "DATA";
bre... |
ec886e76-43b2-4ef1-beb8-f07943fa3382 | 0 | public String getNameObject() { return nameObject; } |
73832c08-1539-46ef-87c4-7b83b5698a5b | 2 | public void insertEnd(Object obj) {
if (head == null) {
head = new SListNode(obj);
} else {
SListNode node = head;
while (node.next != null) {
node = node.next;
}
node.next = new SListNode(obj);
}
size++;
} |
60be5a0e-300b-4c12-9c32-744403669b3f | 0 | @Column(name = "PEP_POS_ID")
@Id
public BigInteger getPepPosId() {
return pepPosId;
} |
837027e0-c1b8-4b7b-9054-124005685656 | 0 | public double getArea_Body(){
return area_Body_rot = this.getHig()*rad;
} |
57c7daa1-79b6-4fd2-84c7-8690f61e5876 | 0 | public Entradas getEntradasIdEntrada() {
return entradasIdEntrada;
} |
4bbf2903-0059-4ec7-8d51-e262079bcb0c | 4 | @Override
public List<String> onTabComplete(CommandSender sender, Command command,
String alias, String[] args) {
if (args.length == 1) {
List<String> matches = new ArrayList<String>();
for (String subcommand : subcommands) {
if (StringUtil.startsWithIgnor... |
4378295f-c007-486d-a026-ac8735724436 | 3 | private int getIntAttr(HTML.Attribute name, int deflt ) {
AttributeSet attr = fElement.getAttributes();
if( attr.isDefined(name) ) {
int i;
String val = (String) attr.getAttribute(name);
if( val == null )
i = deflt;
else
try{
i = Math.max(0, Integer.parseInt(val));
}catch( NumberFormatE... |
ae816808-2739-4767-bc94-bf6de71491e4 | 1 | public void analyze() {
String type = getType();
int index = type.indexOf('L');
if (index != -1) {
int end = type.indexOf(';', index);
Main.getClassBundle().reachableClass(
type.substring(index + 1, end).replace('/', '.'));
}
} |
f896468d-590b-4df8-b3f0-3784207c272e | 6 | private int jjMoveStringLiteralDfa15_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(13, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(14, active0);
return 15;
}
switch(curChar)
{
case 1... |
906828e2-0877-4cc2-8711-f52ecd07037f | 0 | public Render(Graphics2D g) {
this.g = g;
} |
8a4a0028-f1c7-479f-a50b-9ad9d3a923b7 | 9 | private void initPrintFrame(final boolean selectedDataTableObjectsOnly) {
// den Spezial-Konstruktor aufrufen:
if(_archive) {
_printFrame = new ArchiveDataTableView(_connection, _attributeGroup, _aspect, _dataDescription.getSimulationVariant());
}
else {
_printFrame = new DataViewFrame(
_connection,... |
6dadda91-6885-446f-b44a-2e6360951930 | 1 | private CategoryDataset createDataset() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (T item : getHistogram().keySet()) {
dataset.addValue(getHistogram().get(item), "Categories", (String) item);
}
return dataset;
} |
8bbbe680-062d-4e65-b7ad-c33921a38f23 | 9 | public Value newValue(final Type type) {
if (type == null) {
return BasicValue.UNINITIALIZED_VALUE;
}
boolean isArray = type.getSort() == Type.ARRAY;
if (isArray) {
switch (type.getElementType().getSort()) {
case Type.BOOLEAN:
case Type.CHAR:
case Type.BYTE:
case Type.SHORT:
return new Ba... |
cf9314de-c54c-4c36-b8d0-56c4c6857e0d | 1 | public boolean isHeld() {
if(isDisabled())
return false;
return held;
} |
3ae8b045-7e80-44fd-9e21-9782ec37d787 | 8 | public void parkVehicle(Vehicle v, int time, int intendedDuration) throws SimulationException, VehicleException {
if(!spacesAvailable(v))
throw new SimulationException("No suitable space avaliabvle for parking");
if(v.isParked() || v.wasParked())
throw new VehicleException("vehicle not in the correct state");... |
5ba0539c-2009-4c87-9b4d-04026984bbb7 | 6 | public EditInfo getEditInfo(int n) {
if (n == 0) {
return new EditInfo("Min Frequency (Hz)", minF, 0, 0);
}
if (n == 1) {
return new EditInfo("Max Frequency (Hz)", maxF, 0, 0);
}
if (n == 2) {
return new EditInfo("Sweep Time (s)", sweepTime, 0,... |
894c63c1-f523-4f57-8342-6a7c9bdcf08f | 3 | private static String openFile(String fileName) {
String returnValue = "";
FileReader file = null;
try {
file = new FileReader(fileName);
BufferedReader reader = new BufferedReader(file);
String line = "";
while ((line = reader.readLine()) != null) {
returnValue += line + "\n";
}
reader.... |
d85a91c2-f1a2-465f-8ceb-e26e1f2242eb | 4 | public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double xs = s... |
3f8847c4-3bfa-4289-a47e-1c68bb36445a | 3 | private void bg(String label) {
if (verbose)
System.out.println("(Branch? " + (acc > 0 ? "YES" : "NO") + ")");
if (acc > 0)
index = branches.get(label) - 1;
} |
96b03b52-8f74-4de4-9238-ed9b7833b689 | 0 | public boolean documentIsOpen(int docSelector) {
return docOpenStates[docSelector] ;
} |
911e3ca5-88a4-400c-8030-7469aaf39b9d | 5 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
e4190610-7c0a-4c3a-8264-dd3b95738463 | 2 | public void close() {
try {
if (reader != null) reader.close();
} catch (IOException e) {
}
reader = null;
line = null;
lineNum = 0;
seqReady = false;
} |
bdf5d1b6-8487-4c2e-8eb1-91a82fa52c6a | 4 | public static int isGreater(Point p1, Point p2){
int i = 0;
if (p1.x < p2.x){
i = -1;
}
else if (p1.x > p2.x){
i = 1;
}
else if (p1.y < p2.y){
i = -1;
}
else if (p1.y > p2.y){
i = 1;
}
return i;
} |
95d711d9-63fc-431d-8c09-18e25bed1976 | 6 | private void remove(int i) {
if(size() >= i){
if (i == 1) {
firstElement = firstElement.getNextElement();
} else if (i > 1) {
Element tmpf = firstElement;
Element tmps = firstElement.getNextElement();
Element tmpt = firstElement.getNextElement().getNextElement();
int count = 2;
while (... |
57bb67c6-ea5b-4ae7-8d85-718cf71959ba | 8 | private void initialize() {
this.addWindowListener(new WindowAdapter() {
@Override
public void windowActivated(WindowEvent e) {
super.windowActivated(e);
Log.logfile("", new Date(Calendar.getInstance().getTimeInMillis()));
}
@Override
public void windowClosing(WindowEvent e) {
super.wi... |
d0cd60ab-3003-4064-8565-7c0afcb9154f | 5 | public void sortBySuit() {
ArrayList<Card> newHand = new ArrayList<Card>();
while(hand.size() > 0) {
int pos = 0;
Card c = hand.get(0);
for (int i = 1; i < hand.size(); i++) {
Card c1 = hand.get(i);
if(c1.getSuit() < c.getSuit() || (
c1.getSuit() == c.getSuit() && c1.getSuit() < c.getSuit()))... |
cc03b582-a217-46be-adb2-9909199cca42 | 5 | public void keyPressed(KeyEvent kE) {
int key = kE.getKeyCode();
if(key == KeyEvent.VK_UP) shape1.moveY(-1);
if(key == KeyEvent.VK_DOWN) shape1.moveY(1);
if(key == KeyEvent.VK_RIGHT)shape1.moveX(1);
if(key == KeyEvent.VK_LEFT) shape1.moveX(-1);
if(key == KeyEvent.VK_SPACE) {
System.out.println(shape1.... |
7c3ad1a6-61f8-475c-831f-7f64ad781124 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Address)) return false;
Address address = (Address) o;
if (city != null ? !city.equals(address.city) : address.city != null) return false;
if (street != null ? !street.equals(address.... |
3884fbb1-6090-4c63-8713-3313453398fe | 5 | @SuppressWarnings("resource")
public void searchEngineMenu3(DataSource ds) {
// TODO: finish searchEngine3
while (true) {
System.out.println("Alarming Age Search Engine");
System.out.println("Back = 0. Please enter a test name:");
Scanner scanner = new Scanner(System.in);
String testName = scanner.n... |
941cdafc-25c0-46b0-95b6-ade466fbe7bc | 8 | @Override
public MatchResult checkKoota(Nakshatra boyStar, Nakshatra girlStar) {
MatchResult matchResult = MatchResult.ADHAMA;
int distance = MatchMakerCommonService.getGirlToBoyNakshatraDistance(boyStar, girlStar);
switch (distance) {
case 4:
case 7:
case 10:
case 13:
case 16:
case 19:
case 22:
... |
7dd16d31-aa2f-492f-9560-a704a851ce70 | 0 | public boolean getPowered(){
return powered;
} |
09e84e3b-df6d-48bd-8938-36d9a80eb0fa | 5 | static int login(Scanner scanner, ObjectOutputStream toServer, ObjectInputStream fromServer) throws
IOException, ClassNotFoundException {
log.debug("Start \"login\" method");
System.out.println("Input login:");
String login = scanner.next().toLowerCase();
System.out.println("... |
0ca46def-7f5d-4404-81b1-0399aaa25b8f | 9 | @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... |
efcf3e59-1f9c-4136-885b-42dad849bcac | 3 | public Factory make(Class<?> cl) throws InstantiationException,
IllegalAccessException {
if (Factory.class.isAssignableFrom(cl))
return (cl.asSubclass(Factory.class).newInstance());
if (Sprite.class.isAssignableFrom(cl))
return (new DynFactory(cl.asSubclass(Sprite.class)));
return (null);
} |
f33aa08d-028c-45a0-ae17-7941fdad2261 | 1 | private void buildDFSTraversal(GeneralTreeNode<T> cur) {
OutputQueue.add(cur);
Iterator<GeneralTreeNode<T>> it = cur.getChildren();
while (it.hasNext()) {
this.buildDFSTraversal(it.next());
}
} |
71c4ff62-ec44-403b-ae05-7fc5c2a4925e | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
4fd81421-2b9c-481b-bb04-8fc4c648fb83 | 0 | @Test
public void testGetY() {
System.out.println("getY");
assertEquals(1.0, new Orb(4,12,1,1).getY(), 0.00001);
} |
e4f6a5f2-c62b-4009-92ed-a05bc5a4c6f9 | 2 | private void doExpandChildren(List<Node> nodes) {
for (Node node : nodes) {
if(node instanceof TitledPane){
TitledPane tPane = (TitledPane) node;
tPane.setExpanded(true);
}
}
} |
9a37e463-a350-44ce-8af6-dbbb61bf3b20 | 7 | public ListNode swapPairs(ListNode head){
if(head == null)
return null;
if(head.next == null)
return head;
ListNode pointer = head;
ListNode newHead = head.next;
int counter = 1;
ListNode lastNode = head;
while(pointer.next != null){
ListNode temp = pointer.next;
if(counter%2 == 1){
lastNo... |
adf3c894-e91b-497a-a29a-eabc688d30bb | 9 | public int synthesis(Packet op){
Info vi=vd.vi;
// first things first. Make sure decode is ready
opb.readinit(op.packet_base, op.packet, op.bytes);
// Check the packet type
if(opb.read(1)!=0){
// Oops. This is not an audio data packet
return (-1);
}
// read our mode and pre/... |
19d86d05-0385-4b9c-9a14-8dd7aa4a46e4 | 7 | final public String IntString(int type) throws ParseException {
String s;
final StringBuffer buf = new StringBuffer();
assert type == IN_FLOAT || type == IN_INTEGER;
SetState(type);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER:
s = jj_consume_token(INTEGER).image;... |
dc5aa985-7648-4fec-9b82-8641ba562ec1 | 3 | private void projectUnselected(String oldProjectName) {
if (oldProjectName != null) {
displayedIssues.removeListener(projectIssuesListener);
displayedIssues = null;
table.getSelectionModel().clearSelection();
table.getItems().clear();
if (newIssue != n... |
d416a06d-7cf8-4f50-9dd7-2f9439b686fe | 3 | public void drawMinigameMenu(Graphics g)
{
g.setColor(new Color(0,0,0,200));
g.fillRect(0,0,getWidth(),getHeight());
g.setFont(new Font("Sanserif",Font.BOLD,12));
g.setColor(Color.WHITE);
g.drawImage(icon,80,85,16,16,this);
g.drawString("Pick a minigame (Data will be saved when game starts!!!)",100,70);... |
39556199-44ed-4858-9e73-7f38dc818005 | 2 | public ErrorLog(String message) {
StringBuffer content = new StringBuffer();
content.append("\n----------------------------------------\n----------------------------------------\n");
content.append(Config.getDate());
content.append(" -- ");
content.append(Control.version);
content.append("\n\n");
content.... |
35fc0b7c-20d8-4be2-ac02-f9e585c356a9 | 6 | private void rawplay(AudioFormat targetFormat, AudioInputStream din) throws IOException, LineUnavailableException
{
byte[] data = new byte[64];
SourceDataLine line = getLine(targetFormat);
if (line != null)
{
// Start
line.start();
int nBytesRead = 0, nBytesWritten = 0;
while (!stop && ... |
7fc0c5d9-2f18-46b7-8590-a824678c783a | 6 | public void set(int x, int y, Color color) {
if (x < 0 || x >= width()) throw new IndexOutOfBoundsException("x must be between 0 and " + (width()-1));
if (y < 0 || y >= height()) throw new IndexOutOfBoundsException("y must be between 0 and " + (height()-1));
if (color == null) throw new NullPoi... |
584fb285-5131-436c-847a-0520e392fb15 | 8 | public E removeMin( ) {
if ( size == 0 )
throw new NoSuchElementException("PriQueHeap.removeMinElement");
else {
int hole = 1,
child = 2;
qe[0] = qe[1]; // qu[1] is now a proper hole
while ( child+1 < size &&
( comp.compare( qe[child], qe[size]) < 0 ||
comp.compare( qe[c... |
55270ecb-fa37-4da3-b8cf-cdf117d74cd1 | 2 | public void method574(OnDemandFetcher onDemandFetcher) {
if (modelIds == null) {
return;
}
for (int element : modelIds) {
onDemandFetcher.method560(element & 0xffff, 0);
}
} |
dd1c11a7-1049-4fa5-a5e0-6f2b1c6bb4dd | 9 | public static String saveScreenshot(File var0, int var1, int var2) {
try {
File var3 = new File(var0, "screenshots");
var3.mkdir();
if(buffer == null || buffer.capacity() < var1 * var2) {
buffer = BufferUtils.createByteBuffer(var1 * var2 * 3);
}
if(imageDa... |
5ef9b9ac-5f20-4dfe-935f-5159069efaae | 0 | public Point2D getRelativePixelCenter()
{
return new Point2D.Double(getPixelSideLength()/2.0, getPixelSideLength()/2.0);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.