method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d9f630eb-cff5-452e-b7a7-e4d225172d1e | 0 | public void SetStartBusStop(int startBusStop)
{
//set the start bus stop
this.startBustop = startBusStop;
} |
4405f8f0-4cbb-41cb-9424-ccd0516c2070 | 3 | private InEdgeIteratorImpl(InternalNodeWrapper<N, E> to, ContextualReachability<N, E, ?> contextualReachability) {
List<InternalNode<N, E>> reachableFromNodes = new ArrayList<InternalNode<N, E>>();
for (InternalNode<N, E> node : to.getReachableFrom()) {
if (contextu... |
d0d69374-2d56-4121-bb35-cf4f3a592bca | 8 | public svm_node[] getTemplatePixelsInSVMFormat(int x0, int y0, int x1, int y1) {
int xDistance,yDistance;
int startX,startY;
int currentX,currentY;
int Ox,Oy;
double xRes,yRes;
double offsetY;
double scaleFactor;
svm_node node;
svm_node template[] = new svm_node[735]; /* template ... |
39c05989-629f-417b-bfef-646260cf8ebc | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Animal other = (Animal) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
... |
c264d08a-b1f9-4c8e-aa36-7f9641bee584 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Machine other = (Machine) obj;
if (IP == null) {
if (other.IP != null)
return false;
} else if (!IP.equals(other.IP))
return false;
... |
249e597e-6957-4b5a-a471-041e73d953a4 | 0 | @Override
public void initialize() throws Exception
{
this.buildTrain();
this.createPlanTickets();
} |
4e43bc70-35cf-4185-964d-5cd7d8e78f23 | 0 | public String getPath() {
return this.key;
} |
c1c860d7-d7ee-4693-b222-89433e4405d7 | 5 | public void actionPerformed(ActionEvent e) {
String nick = GUIMain.userList.getSelectedValue().toString();
if (nick.startsWith("@")) {
nick = nick.replace("@", "");
} else if (nick.startsWith("$")) {
nick = nick.replace("$",... |
902a5fe6-919e-407e-a055-ec99182b9a05 | 7 | public static void appendPoison(final Client c) {
if (c.playerEquipment[c.playerShield] == 18340) {
c.sendMessage("Your Anti-poison totem prevents you from being poisoned.");
return;
}
if (System.currentTimeMillis() - c.lastPoisonSip > c.poisonImmune) {
c.sendMessage("You have been poisoned.");
c.isPo... |
ef1dae1c-a1da-49dd-a67d-56a34b4797c6 | 6 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Environment.InitPacket(451, Main.ClientMessage);
Environment.Append(0, Main.ClientMessage);
Environment.Append(Integer.toString(4), Main.ClientMessage);
List<Room> roomList = new ArrayList<Room>();
for(i... |
f16d7f84-902b-42ed-abec-022d909a73d6 | 2 | public void visitFieldExpr(final FieldExpr expr) {
if (expr.object() != null) {
expr.object().visit(this);
}
print(".");
if (expr.field() != null) {
print(expr.field().nameAndType().name());
}
} |
50112daf-d3d1-4df3-84c5-0f1681c82fb1 | 0 | public void setBAsString(String b) {
this.b = b;
} |
4485e812-a13a-4b40-a573-eaacbe55e3fc | 7 | public synchronized DataInputStream getChunkDataInputStream(int x, int z) {
if (outOfBounds(x, z)) {
debugln("READ", x, z, "out of bounds");
return null;
}
try {
int offset = getOffset(x, z);
if (offset == 0) {
// debugln("READ", x... |
2e5a1774-f4a4-42da-8544-7c69b415fecb | 1 | public static LogFileInfo getLogFileInfo(HierarchicalConfiguration logFileData)
{
LogFileInfo logFileInfo = null;
if (logFileData != null) {
logFileInfo = new LogFileInfo();
logFileInfo.setRunId(logFileData.getLong(RUNID_TAG));
logFileInfo.setType(logFileData.getString(TYPE_TAG... |
ad1b03ba-ff46-4a53-962d-ed8d725edbca | 6 | @Override
public boolean add(EmpleadoDTO em) {
boolean valor = false;
try {
em.setId_usuario(getMaxidUsuario()+1);
em.setActivo(true);
em.setTiene_foto(true);
conn = PaginaWebConnectionFactory.getInstance().getConnection();
String sql = "insert into usuario values(?,?,?,?,?,?,?,?,?,?)";
... |
0b1cb9c9-0fc7-4d03-b125-2b4b84ff9243 | 4 | private static int loadTexture(String fileName)
{
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
try
{
BufferedImage image = ImageIO.read(new File("./res/textures/" + fileName));
boolean hasAlpha = image.getColorMo... |
e791b1c1-179c-43d5-a3b3-2ab3bc138a4d | 9 | public static void divide(double basePercentage, int repetitions) {
// The percentage of the training set has to be between 0 and 1
if (0 > basePercentage || basePercentage > 1) {
System.err.println("The percentage of the training set has to be between 0 and 1.");
return;
}
for (int i = 1; i <= repetiti... |
902fd2ae-4398-476c-a50a-99c42027a724 | 3 | @Override
public boolean retainAll( final Collection<?> os ) {
boolean result = false;
final Iterator<T> iter = iterator();
while( iter.hasNext() ) {
if( !os.contains( iter.next() ) ) {
iter.remove();
result = true;
}
}
return result;
} |
8906dec6-28b4-4277-866f-1f460319e83e | 0 | public int getS2() {
return this.state2;
} |
15a9dddb-d662-4978-8cbb-6a7955be2f18 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if (getValueAt(0, column) == null) {
return String.class;
}
returnValue = getValueAt(0, column).getClass();
} else {
... |
5a34e9e1-b6ed-4af7-848a-fce0a71ee55e | 3 | private void calculateEnabledState(JoeTree tree) {
Document doc = tree.getDocument();
if (doc == Outliner.documents.getMostRecentDocumentTouched()) {
Node node = tree.getEditingNode();
if (tree.getComponentFocus() == OutlineLayoutManager.ICON && tree.getNumberOfSelectedNodes() >= 2) {
setEnabled(tr... |
ccc6a104-8a8a-449a-b849-0465acd70e66 | 7 | private void parseZip(String s) {
String x = s.trim(), zip = "";
int start = -2;
int slut = 0;
for (int i = 0; i < s.length(); i++) {
if (Character.isDigit(s.charAt(i))) { //if current char is digit
if (start == -2) {
start = i;
... |
658bcfb7-d3d3-4a9d-81de-26d39255a9f5 | 3 | private int processCommentSymbol(final OutStream outStream, final Character currentChar) throws StreamException {
outStream.writeSymbol(currentChar);
switch (currentChar) {
case '"':
return MODE_STRING;
case '\'':
return MODE_CHAR;
case... |
8caf485a-f86e-4af4-93ed-39eb9e3e7ce9 | 6 | public void updateRight(){
if(right > 0){
for(int i=top; i<height+top; i++){
for(int j=originalWidth; j<originalWidth+right; j++){
drawDiamond(j, i);
}
}
}
else if(right < 0){
for(int i=top; i<height+top; i++... |
16f3b339-2b4c-42a9-9f20-dee98b97553a | 6 | int possibleMovesNum(Point[] grid, Pair pr) {
int possible = 0;
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
Point currentPoint = pointAtGridIndex(grid, i, j);
if (currentPoint.value == 0) {
continue;
}
for (Pair d : directionsForPair(pr)) {
if (isValidBoardIndex(i ... |
c9966214-733a-4335-86d6-0f237b4f46c9 | 3 | public byte[] toByteArray() throws PacketEncodingException {
ByteBuffer buffer = ByteBuffer.allocate(HEADER_SIZE + (message == null ? 0 : message.length()));
buffer.putInt(protocolId);
buffer.put(Packet.encodeConnectionId(connectionId));
buffer.putShort(Packet.encodeSequenceNumber(sequenceNumber));
buffer.put... |
050393c3-f24e-4c41-99c8-99bf6160ceb3 | 7 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("rowset") && !stack.isEmpty()) {
EveAsset<EveAsset<?>> asset = stack.pop();
if (stack.isEmpty()) {
response.add(asset);
currentAsset = null;
}
}
if (qName.equals("row") && stack.is... |
a752587c-2907-458e-ad54-878671c938bf | 7 | @Override
public Object stringToValue(String text) throws ParseException {
if ("".equals(text)) {
getFormattedTextField().setBackground(Color.white);
return null;
}
Object retVal = null;
try {
retVal = super.stringToValue(text);
try {
Double.parseDouble(text);
if (!tex... |
f2e20eb0-ae5f-4b3b-98ba-d9d8605c5332 | 0 | public String getDay() {
return day;
} |
908856e7-70f2-4e94-9e0b-58b29a7053b7 | 6 | private int location(Value v, int position) throws Exception {
if(isSpilled(v) || v.getColor() == -2) {
int target = position == 1 ? t1 : t2;
// if this is a special spill case
if(v.getColor() < 0) {
if(v instanceof Fetch) {
int address = g... |
dfb588a0-cb01-4c37-9e4f-9d157a70bd81 | 0 | public static void remove(Object object) {
getController().rootPane.getChildren().remove(object);
} |
545c6825-5744-4b3a-80d8-cc8e27ab6944 | 9 | public ValidationErrorList validate(){
Person person = doctor.getPerson();
ValidationErrorList errorList = new ValidationErrorList();
Validator instance = ESAPI.validator();
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
if ( (instance.getValidInput("username", userAccount.getUsername(), "Name", 2... |
b415426e-8428-4e22-8f5c-389cd54990da | 2 | public List<MapName> getMapNameById(String lang, String id) {
List<MapName> mapNames = new ArrayList<MapName>();
List<MapName> result = new ArrayList<MapName>();
mapNames = sendRequest(lang);
for(MapName mapName : mapNames) {
if(mapName.getId().equals(id)) {
result.add(mapName);
}
}
return result;... |
91aa455f-40dd-431d-aaf6-64338ddc61b2 | 4 | private void notifyListeners() {
for (int j = 0; j < keys.length; j++) {
if (keys[j].gotPressed()) {
for (int i = 0; i < listeners.size(); i++) {
if(!newListeners.contains(listeners.get(i))) {
listeners.get(i).actionPerformed(
new InputEvent(keys[j], InputEventType.PRESSED));
} else {
... |
0ef4d9b5-6226-4178-81bd-e8a34ab7d250 | 0 | public byte[] getBuf() {
return buf;
} |
4bc3ec6b-0219-42e0-860a-99e1bfd25748 | 4 | @Override
public void deserialize(Buffer buf) {
experienceCharacter = buf.readDouble();
if (experienceCharacter < 0)
throw new RuntimeException("Forbidden value on experienceCharacter = " + experienceCharacter + ", it doesn't respect the following condition : experienceCharacter < 0");
... |
6221c10d-7738-4655-bcd2-399e60d5247f | 2 | @Override
public boolean propertyIsDefault(String key) {
if (propertyDefaultExists(key) && propertyExists(key)) {
return propertyEquals(key, getPropertyDefault(key));
} else {
return false;
}
} |
b2b0c9c4-1347-40b3-ae21-bd23a4331113 | 6 | private final String beginMultiLineCommentFilter( String line )
{
//assert !inJavadocComment;
//assert !inMultiLineComment;
if ( line == null || line.equals( "" ) )
{
return "";
}
int index;
//check to see if a multi-line comment starts on this l... |
ce058681-e211-4d28-b5b7-1bc0662c929c | 3 | public void fusionWithMultiplyFullAlpha(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alpha1... |
3b175d30-a184-45f3-af9c-b98e81c38dd3 | 0 | public ArrayList<String> getWorkPosition() {
return WorkPosition;
} |
e85e256e-6af9-4cc6-a4cb-6486d0e2ad0e | 4 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
objectGID = buf.readShort();
if (objectGID < 0)
throw new RuntimeException("Forbidden value on objectGID = " + objectGID + ", it doesn't respect the following condition : objectGID < 0");
powerRate = ... |
12e575fa-3951-45a9-823b-e87272658219 | 8 | @Override
public void handleMessage(Message msg) {
String uri = (String) msg.obj;
if (mLoadingManager.isOutdated(uri)) return;
switch (msg.what) {
case ACTION_ON_START: {
Set<ResourceSpecs<T>> set = mLoadingManager.getSpecsList(uri);
... |
59c80e62-cef7-4652-9b81-efab88ce3ad3 | 7 | public static HashMap<String,Integer> getEffectStats(HashSet<Integer> infPpl, HashSet<Integer> closedLocs) {
HashMap<String,Integer> stats = new HashMap<String,Integer>();
int affCount = 0;
int infConCount = 0;
int totalConCount = 0;
try {
Connection con = dbConnect();
PreparedStatement getNumLocCon = c... |
c5fce383-f3fb-4d57-8b0b-55a46f43deda | 9 | public int compareTo( Object obj ) {
if( obj == null ) {
return( -1 );
}
else if( obj instanceof GenKbGelCounterBuff ) {
GenKbGelCounterBuff rhs = (GenKbGelCounterBuff)obj;
int retval = super.compareTo( rhs );
if( retval != 0 ) {
return( retval );
}
{
int cmp = getRequiredCounterName().c... |
b60308ba-7e18-49b5-beb6-412c9f8b2c12 | 6 | protected static byte[] mintName(int ver, String node, String ns)
throws UUIDException {
/*
* Generates a Version 3 or Version 5 UUID. These are derived from a
* hash of a name and its namespace, in binary form.
*/
if (node.length() == 0)
throw new UUIDException(
"A name-string is required for V... |
6caa28f7-0b6e-4919-a1f3-9b94795f63cd | 4 | public void clearMap(GameAction gameAction) {
for (int i=0; i<keyActions.length; i++) {
if (keyActions[i] == gameAction) {
keyActions[i] = null;
}
}
for (int i=0; i<mouseActions.length; i++) {
if (mouseActions[i] == gameAction) {
... |
45c96160-3fda-4e3e-be18-148863f14558 | 1 | private boolean jj_3_73() {
if (jj_scan_token(AND)) return true;
return false;
} |
349ef64f-029a-4fae-b20c-68c733e0cc70 | 2 | protected String getMutatorName(Method m)
{
String name = m.getName();
if (name.startsWith("get"))
{
return "set" + name.substring(3);
}
else if (name.startsWith("is"))
{
return "set" + name.substring(2);
}
else
{
return null;// not valid, should not happen
}
} |
19b9d48f-c2a7-46a6-bff8-920cc9c69b1e | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Telefone other = (Telefone) obj;
if (this.id != other.id) {
return false;
}
i... |
14803b85-146f-48e8-a098-515f9b676c3a | 2 | @Override
public boolean isOutOfBounds(final char character){
return character != NONE && (character < HangulJamo.MIN_VALUE || HangulJamo.MAX_VALUE < character);
} |
3a0717b0-c8fa-469e-b812-7f9b2e392dc0 | 1 | private void readClassInfo(final DataInputStream in) throws IOException {
thisClass = in.readUnsignedShort();
superClass = in.readUnsignedShort();
final int numInterfaces = in.readUnsignedShort();
interfaces = new int[numInterfaces];
for (int i = 0; i < numInterfaces; i++) {
interfaces[i] = in.readUnsig... |
5ca49658-0521-4005-a0fa-91a9bd8b0c2f | 5 | public Zone getZoneWithCardId(int id) throws NoZoneOpenException {
int c;
for(c = 0; c < 5; c++) {
if(!this.monsterzones[c].isOpen()) {
if(this.monsterzones[c].card.id == id) {
return this.monsterzones[c];
}
} else if(!this.magiczones[c].isOpen()) {
if(this.magiczones[c].card.id == id) {
... |
8cb0ff4b-1f63-455c-ba86-041279615614 | 9 | public static Point2D coordinates(final Rectangle2D rectangle,
final RectangleAnchor anchor) {
Point2D result = new Point2D.Double();
if (anchor == RectangleAnchor.CENTER) {
result.setLocation(rectangle.getCenterX(), rectangle.getCenterY());
}
... |
1e96501a-b97f-4f79-b1a6-c1c46164a2da | 2 | @Override
public List<Direction> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException {
int pageSize = 50;
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(WHERE);
String queryStr = new QueryMapper() {
@O... |
78957f5a-32f2-4473-8dbc-b29ed8ef060e | 0 | public void setGivenBy(String givenBy) {
this.givenBy = givenBy;
} |
45aa369f-c551-4cb1-97af-14048bd51ad2 | 0 | private void initProgressBar(){
progressBar = new JProgressBar();
progressBar.setIndeterminate(true);
progressBar.setBounds(INDENT_LEFT, getHeight()-50, getWidth()-INDENT_LEFT*2,20);
progressBar.setVisible(true);
add(progressBar);
} |
649f183b-d07c-4709-b618-e03537035382 | 6 | public void update(int delta){
speedCounter += delta;
if(speedCounter >= speed){
speedCounter = 0;
}
for(int i=0;i<entities.size();i++){
Entity e = entities.get(i);
if(e instanceof Creature){
Creature c = (Creature)e;
c.ai.update(delta);
if(speedCounter == 0){
c.canAct = true;
}... |
9ad940e5-fe14-4aad-bad8-4f63bc294841 | 3 | public void run() {
try {
if (MTServer.available.tryAcquire()){
PrintStream out = new PrintStream(clientSocket.getOutputStream(), true);
Scanner in = new Scanner(clientSocket.getInputStream());
if (in.hasNextLine()... |
57870fc4-e20c-4510-ad78-9a6c4eb789f2 | 9 | public static void handleExamine(final Player player, InputStream stream) {
int npcIndex = stream.readUnsignedShort128();
boolean forceRun = stream.read128Byte() == 1;
if(forceRun)
player.setRun(forceRun);
final NPC npc = World.getNPCs().get(npcIndex);
if (npc == null || npc.hasFinished()
|| !player.ge... |
df10ef56-c8b8-400d-a9d9-b87090fa5d59 | 0 | public void setCp(String cp) {
this.cp = cp;
} |
256e2733-8f57-4f23-94b6-9806601ae432 | 4 | private int method177(int arg0, int arg1, int arg3) {
if (arg3 > 179) {
arg1 /= 2;
}
if (arg3 > 192) {
arg1 /= 2;
}
if (arg3 > 217) {
arg1 /= 2;
}
if (arg3 > 243) {
arg1 /= 2;
}
return (arg0 / 4 << 10) + (arg1 / 32 << 7) + arg3 / 2;
} |
82d6877d-6f04-4111-82e1-a32368576e32 | 8 | private void setElementField(String str1, String str2, double x) {
if (!(model instanceof MolecularModel))
return;
MolecularModel m = (MolecularModel) model;
int lb = str1.indexOf("[");
int rb = str1.indexOf("]");
double z = parseMathExpression(str1.substring(lb + 1, rb));
if (Double.isNaN(z))
return;... |
3077b8fb-2f21-4ebd-98a5-3170f1a9c0ac | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Customer other = (Customer) obj;
if (this.customerId != other.customerId) {
return false;
... |
b72f2212-e668-42dc-90ad-bf4b313172e3 | 9 | public void handleCommand(DOMBuilder builder, Element parentElement, CommandToken token)
throws SnuggleParseException {
/* Get the token to which the limit is being applied to, which is precisely the
* first argument.
*/
List<FlowToken> limitand = token.getArguments()[0].ge... |
39e22d52-858c-4891-85d6-374663fe5a16 | 7 | public void countAllLinksStatus() {
for (String link : links) {
HttpURLConnection httpURL;
int code = 0;
try {
httpURL = (HttpURLConnection) new URL(link).openConnection();
httpURL.setRequestMethod("HEAD");
code = httpURL.getResponseCode();
} catch (IOException e) {
System.out.println("... |
4c986d6f-16f8-4b06-a991-5ca6d40e89da | 0 | public PanelOptions getPanelOptions() {
WindowPrincipale window = (WindowPrincipale) this.getParent().getParent().getParent().getParent().getParent();
return window.getPanelSettings();
} |
cbd70b64-b84f-44a4-8292-4034f1568a5b | 6 | public void loadLevel(String filename) throws SlickException, IndexOutOfBoundsException{
Image level;
mobs = new ArrayList<Entity>();
player = new Entity(charFactory.GetTile(0, 0, 5, 6, Player.class));
level = new Image(filename);
if(level.getWidth() != TILE_COL || level.getHeight() != TILE_ROW){
throw new... |
689e0a72-2589-44e2-9e5e-539973e97241 | 6 | @Override public ByteChunk getChunk( String urn, int maxSize ) {
try {
File f = _getFile( urn );
if( f == null || f.length() > maxSize ) return null;
int size = (int)f.length();
byte[] data = new byte[size];
FileInputStream fis = new FileInputStream( f );
try {
int r=0;
for( int z; r < s... |
cb3a9813-7425-4dcc-9cc1-e47d3ae4dd9c | 6 | public Tilaus haeTilauksenTiedot(int tilausID) throws DAOPoikkeus, SQLException {
// Avataan ensiksi yhteys:
Connection yhteys = avaaYhteys();
// Alustetaan tarvittavat oliot ja muuttujat.
Asiakas asiakas = new Asiakas();
Tilaus tilaus = new Tilaus();
Tuote tuote = new Tuote();
Pizza pizza = new Pizza(... |
c9d8e01a-6e9a-4c07-859a-0209e19b7743 | 4 | public Player(){
frame = new JFrame("GrooveJaar Player");
frame.setIconImage((new ImageUtil().getLogo()));
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JScrollPane scrollPane = new JScrollPane();
JButton btnRemove = new JButton("Delete");
btnRemove.addActionListener(new ActionListener() {
... |
858b8727-be3b-4afa-9feb-ffd5d7283799 | 3 | public String bubbleSort2(String a) {
char[] arr = a.toCharArray();
for (int i = arr.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) { // notice
if (arr[j] > arr[j + 1]) {
swap(arr, j, j + 1);
}
}
}
return new String(arr);
} |
b4e80ad7-afe6-499e-8315-1fe29a887c96 | 8 | public void readFile (String filename) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(filename));
for (String line = in.readLine(); line != null; line = in.readLine()) {
if (line.trim().length() == 0) {
continue;
}
String[] ... |
3d0e95be-0848-43ff-90fd-87ee6f6c01b8 | 7 | boolean addCluster(NodeCluster seed) {
members.add(seed);
seed.isSetMember = true;
rawPull += seed.weightedTotal;
pullWeight += seed.weightedDivisor;
if (isRight) {
freedom = Math.min(freedom, seed.rightNonzero);
if (freedom == 0 || rawPull <= 0)
return true;
addIncomingClusters(seed);
... |
5e592ad9-8dab-4320-bdc8-3b49bd707544 | 9 | @Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
{
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String status = (String)value;
Icon icon=null;
... |
95133f24-a01d-4260-b4e9-05b8b9fc0c51 | 5 | private void getNextPosition() {
// movement
if(!facingRight) {
dx -= moveSpeed;
if(dx < - maxSpeed) {
dx = -maxSpeed;
}
} else if(facingRight){
dx += moveSpeed;
if(dx > maxSpeed) {
dx = maxSpeed;
}
}
if(falling) {
dy += fallSpeed;
}
} |
efd383e1-2cf5-43e4-abc4-c7e14d1c3aed | 2 | private String[] parseValues(String input, int column) {
StringTokenizer st = new StringTokenizer(input);
SortedSet values = new TreeSet();
while (st.hasMoreTokens()) {
String token = st.nextToken();
token = parseValue(token, column);
if (token == null)
continue;
values.add(token);
}
return (S... |
c4a12a3e-6f36-4b37-9729-c7cc5a5e2da0 | 9 | public void HandleInput(GameTime gameTime)
{
InputHandler input = mGameWindow.GetInputHandler();
Level level = mGameState.GetLevel();
Vector2 mousePosition = new Vector2(input.GetMouseX(), input.GetMouseY());
mousePosition = mGameState.GetCamera().ScreenToWorld(mousePosition);
mAngle = (float)Math.to... |
2dc65d89-5634-4a92-bc7a-bef5a0d6bf26 | 1 | private void movePosChildren(Vector2f vector2f){
for (GUI child:children){
child.setPosition(vector2f.add(child.getPosition().sub(getPosition()).getXY()));
}
} |
c24d6d8c-38ba-4949-8f8b-cdea7abd0dc7 | 3 | public static byte[] toByteArray(final Object obj)
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
} catch (Exception ex) {
throw n... |
d852aee6-85e7-4b1e-9e97-26d3b3b77b39 | 7 | public GetInvoiceDetailsResponse(Map<String, String> map, String prefix) {
if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) {
String newPrefix = prefix + "responseEnvelope" + '.';
this.responseEnvelope = new ResponseEnvelope(map, newPrefix);
}
if( map.containsKey(prefix + "invoice" + ".me... |
369b2aa5-9b2d-4cae-b947-46a7239b5a0d | 5 | @Override
@EventHandler(ignoreCancelled = true)
public void onPlayerInteract(final PlayerInteractEvent interaction) {
super.onPlayerInteract(interaction);
if (interaction.getAction() != Action.LEFT_CLICK_BLOCK) return;
if (!Kiosk.SIGN_BLOCKS.contains(interaction.getClickedBlock().getTyp... |
ff918e9f-6d3a-4b6f-8218-89245fd15e3f | 6 | public void updateTable(){
//add columns
columns = new Vector();
columns.addElement("Alternatives");
objs = con.getObjPanel().getPrimitiveObjectives(); //do we really need this temp holder?
for(int i=0; i<objs.size(); i++){
columns.add(objs.get(i).toString());
}
//add data
rows = new Vector(... |
de231da5-e35d-4f3b-a6ee-b8482db8a936 | 6 | public static void main(String args[]) throws IOException {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For deta... |
c6d51faa-0095-4ecf-b2ea-1acb3bf0357e | 2 | private static void processKeyEvents(){
if(Keyboard.getEventKeyState()){
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){
Game.setState(previousState);
}
}
} |
5447ae29-3da6-4ed5-9388-c2e513f41e69 | 6 | protected String getPassword(final int times) {
if(times <= 0) {
throw new IllegalArgumentException("times cannot be lower than 1!");
}
String[] pwInput = new String[times];
// ask password n times
for(int i=0; i<times; i++) {
PasswordDialog pwdDialog = new P... |
f2f84dd1-9130-47f7-9514-5ed7ccf4ccdf | 9 | public void testGetPhoneNumbers() throws InterruptedException{
driver.get(URL);
Thread.sleep(3000);
WebElement phone = driver.findElement(By.id("revPhone:firstField"));
WebElement city = driver.findElement(By.id("revPhone:city"));
WebElement search = driver.findElement(By.id("revPhone:search"));
try {
... |
844a3dbf-0191-4604-8d78-7fd0fe2129fe | 7 | public boolean isTBonded(Atom a) {
if (tbondList == null || tbondList.isEmpty())
return false;
synchronized (tbondList) {
for (TBond t : tbondList) {
if (t.getAtom1() == a || t.getAtom2() == a || t.getAtom3() == a || t.getAtom4() == a)
return true;
}
}
return false;
} |
7b357e03-60e5-432e-bf64-d6b082f4b98b | 4 | @Override
public void selectInterface(String interfaceName) {
try {
NetworkInterface selected = NetworkInterface.getByName(interfaceName);
for ( int i = 0; i < selected.getInterfaceAddresses().size(); i++ )
{
InetAddress bcast = selected.getInterfaceAddresses().get(i).getBroadcast();
if ( bcast != ... |
74519deb-c47e-4653-9c1c-ddb1636f6ac0 | 6 | private String adjustUnitsInString(String input, float scale){
StringBuilder output = new StringBuilder(input);
Matcher matcher = decimalPattern.matcher(input);
while ( matcher.find() ){
String group1 = ( matcher.group(1) == null ) ? "" : matcher.group(1).trim();
String... |
a7ed50e5-bc2a-4904-8d47-0ad7edc63352 | 4 | public static void main(String[] args) {
String line = "";
String message = "";
int c;
try {
while ((c = System.in.read()) >= 0) {
switch (c) {
case '\n':
if (line.equals("go")) {
PlanetWars pw = new PlanetWars(message);
DoTurn(pw);
pw.FinishTurn();
message = "";
} e... |
2f39cbc3-64eb-4fbf-9e3d-c5e25ad9725b | 3 | public void permuteRec(int level, int[] num, List<ArrayList<Integer>> res, Deque<Integer> stk, boolean[] visited){
if(level == num.length){
res.add(new ArrayList<Integer>(stk));
return;
}
for(int i = 0; i < num.length; ++i){
if(!visited[i]){
stk.addLast(num[i]);
visited[i] = true;
... |
a593232b-1136-4a67-8c2a-fdb2786e6f36 | 1 | public void usingEntrySetAndIterator(Map<Integer, String> map){
Iterator<Map.Entry<Integer, String>> itrtr = map.entrySet().iterator();
while (itrtr.hasNext()) {
Map.Entry<Integer, String> entry = itrtr.next();
System.out.println("Key: "+entry.getKey()+" Value: "+entry.getValue());
}
} |
f312fe1f-233e-4e2a-92cc-63a64f244ef2 | 7 | public int largestRectangleArea(int[] height){
if(height==null || height.length==0) return 0;
if(height.length==1) return height[0];
Stack<Integer> stack=new Stack<Integer>();
stack.push(-1);
int max=0;
for(int i=0;i<height.length;i++){
int curHeight=height[i];
int peekIndex=stack.peek();
... |
f2fac149-e011-41fb-8d2c-092de9c6cb50 | 6 | @Override
public String execute(HttpServletRequest request) throws SQLException, ClassNotFoundException {
String tableName = request.getParameter("TableName");
System.out.println(tableName);
if (tableName != null && tableName != "") {
try {
Class.forName("org.h2.Driver")... |
4f729bdb-70ea-4240-ae44-c7b9d1e02964 | 5 | protected void doDataIn(PeerMessage pm){
if(pm.type == PeerMessage.Type.CHOKE){
this.peer_choking = true;
//Drop our requests. They aint gana get done.
System.out.println(toString()+" choked us.");
}else if(pm.type == PeerMessage.Type.UNCHOKE){
System.out.println(toString()+" unchoked us.");
this.pee... |
6aa20475-f759-4f9a-b443-70a4d54d41fe | 5 | public static void findTwoLargest(int[] a) {
int largest = a[0];
int nextLargest = a[0];
for (int i = 0 ; i < a.length ; i++) {
if (a[i] > largest) {
largest = a[i];
}
}
for (int i = 0 ; i < a.length ; i++) {
if (a[i] > nextLargest && a[i] < largest) {
nextLargest = a[i];
}
}
System... |
a7edca12-75ac-4a80-9815-8cb00c2076ea | 3 | private boolean validPixel(int x, int y) {
boolean validX = x >= -this.getWidth() / 2 && x <= this.getWidth() / 2;
boolean validY = y >= -this.getHeight() / 2
&& y <= this.getHeight() / 2;
return validX && validY;
} |
76a5fb9b-1f1b-4659-afa3-8e1043796289 | 9 | public static void setSkin(final String skinName, final JFrame frame) {
try {
if (skinName.equals("seaGlass")) {
UIManager.setLookAndFeel(new SeaGlassLookAndFeel());
} else if (skinName.equals("syntheticaStandard")) {
UIManager.setLookAndFeel(new Synthetic... |
d852d83c-44f6-4bdd-b85d-6c7ce84a9e58 | 2 | public void run()
{
Scanner in = new Scanner( System.in );
while (in.hasNextLine())
{
String line = in.nextLine();
if (line.equalsIgnoreCase( QUIT ))
{
finished = true;
break;
}
else
{
... |
bcc77f71-7e74-4a43-b63b-5423428f43ef | 8 | public static void showEditor(String skinFilename) {
Path skinPath;
if (!skinFilename.endsWith(Constants.SKINFILE_SUFFIX)) {
skinPath = Constants.PROGRAM_SKINS_PATH.resolve(skinFilename + Constants.SKINFILE_SUFFIX);
} else {
skinPath = Constants.PROGRAM_SKINS_PATH.resolve... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.