method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
09282f72-abdd-4494-a237-e0dbe5f01c73 | 3 | @Override
public EntidadBancaria insert(EntidadBancaria entidad) {
PreparedStatement preparedStatement;
Connection connection = connectionFactory.getConnection();
try {
preparedStatement = connection.prepareStatement("INSERT INTO entidadbancaria(nombre, fechaCreacion, codigoEntid... |
9aee4ed5-f392-4040-8c37-6c33f07ba241 | 5 | public MdpApp getAppPassword(File file) {
ObjectInputStream ois = null;
MdpApp mdpApp = null;
try {
ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));
mdpApp = (MdpApp) ois.readObject();
AppUtils.setConsoleMessage("*** FileDAO ***\n mdp crypté : " + mdpApp.getMdpSha256(),... |
593e8bfe-aaf5-48cf-9ea9-c7038a64371c | 4 | @Override
public void propertyChanged(String id, String value)
{
if(id.equals(PRP_MODE))
{
if(this.isVisible())
updateControls();
}
if (id.equals(PRP_LANGUAGE_CODE))
{
createControls();
if (this.isV... |
d3cfb8a3-198f-4d50-9901-fd69c56244d6 | 5 | public static String getSkin(Block block) {
if (!isApplicable(block)) return null;
TileEntitySkull skull = (TileEntitySkull) ((CraftWorld) block
.getWorld()).getHandle().getTileEntity(block.getX(),
block.getY(), block.getZ());
try {
Field field = TileEntitySkull.class.getDeclaredField("c");
field.se... |
20af5178-f47a-41d6-b1af-7f6a8a7ca389 | 8 | final void method1716(boolean bool) {
anInt5897++;
int i = ((Class239) this).aClass348_Sub51_3136.method3428
((byte) -105).method1458(-23688);
if ((i ^ 0xffffffff) > -97)
((Class239) this).anInt3138 = 0;
if (bool != false)
aClass355_5900 = null;
if (((Class239) this).anInt3138 > 1 && (i ^ 0xfffffff... |
0b0de0ed-333f-412c-b294-bddcf23a805e | 1 | private int[] createBowl(int [] platter)
{
int[] bowl = new int[NUM_FRUITS];
int sz = 0;
while (sz < bowlsize) {
// pick a fruit according to current fruit distribution
int fruit = pickFruit(platter);
int c = 1 + random.nextInt(3);
c = Math.mi... |
54cd6241-d5d6-46c1-b29a-f3faf07451c6 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bid other = (Bid) obj;
if (bid == null) {
if (other.bid != null)
return false;
} else if (!bid.equals(other.bid))
return... |
6df05cf8-3cfa-4430-974d-e67e5ce6861a | 2 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String username = request.getParameter("username");
String password = request.... |
28c6e28e-1245-4c42-9332-1a1fdd1dc0c5 | 0 | @Override
public String toString() {
return String.format("Equivalence { uri: %s, amount: %s, duplicates: %s }",
this.uri, this.getAmount(), this.duplicates);
} |
408a7ee1-d89c-4337-8d58-d4fa54208d86 | 4 | public void moveY(int playerY) {
if(!dead){
if(playerY > y){
dy = .3;
}else if(playerY < y){
dy = -.3;
}
if(!knockback){
y += dy;
}else{
y += dy * -1;
}
}
} |
a266264f-f7b5-4124-a5d5-c5cd217f6a42 | 7 | private void fushImage(String url,String httpQueryString,OutputStream outputStream, MydfsTrackerServer storageTracker){
System.out.println("getQueryString():"+httpQueryString);
if(httpQueryString!=null){
url = url+"?"+httpQueryString;
}
System.out.println(url);
InputStream inputStream = storageTracker.rec... |
ecf0cc56-acc5-4bd4-b438-3bd8812a041e | 2 | public static void main(String[] args) {
// ûΨһƾ֤
String appId = "000000000000000000";
// ûΨһƾ֤Կ
String appSecret = "00000000000000000000000000000000";
// ýӿڻȡaccess_token
AccessToken at = WeixinUtil.getAccessToken(appId, appSecret);
if (null !... |
07d72683-ef76-4f61-95b2-8077b55e4ab7 | 1 | public long remainingSeconds() {
if ( !isActive() )
return 0;
return whenStarted + seconds - CurrentTime.inSeconds();
} |
72919694-a582-4d6f-abd3-faf62c47f788 | 5 | public boolean pushRequest(Request r){
if(conState != ConnectionState.connected){
throw new RuntimeException("Can only send requests on 'connected' connections");
}else if(peer_choking){
throw new RuntimeException("Can only send requests on unchoked connections");
}
if(ourRequests.contains(r.index)){
r... |
8d803078-0af2-45a7-9981-7267ca399ae9 | 2 | public long getLong(int index) throws JSONException {
Object object = get(index);
try {
return object instanceof Number ?
((Number) object).longValue() :
Long.parseLong((String) object);
} catch (Exception e) {
throw new JSONExcepti... |
4f82d6d7-118d-48ce-b8bf-61540df1147b | 0 | @Test
public void testGcdBaseCase() {
// the base case means that q == 0, so return p
int q = 0;
int p = 5;
int result = BasicMath.gcd(p, q);
assertEquals(result, p);
} |
4b0ddb90-cbaf-4016-83ec-caf79bf309fc | 2 | public RushTeam(String name, String displayName) {
setName(name);
setDisplayName(displayName);
switch(displayName) {
case "Blue":
setColor(ChatColor.BLUE);
break;
case "Orange":
setColor(ChatColor.GOLD);
break;
default:
break;
}
} |
3ed6edcc-ec22-4b92-a2b3-39376d0eff2c | 7 | private static void testTimeSVM(){
svm_problem prob = new svm_problem();
prob.l = storeFile.length;
int noFea = storeFile[0].length-1;
prob.x = new svm_node[prob.l][noFea];
prob.y = new double[prob.l];
for (int i = 0; i <prob.l; i++){
svm_node[] nodeList = pro... |
5d9b30b0-848e-4850-b609-f1c8b3905a8c | 0 | public UnrestrictedBruteParser(Grammar grammar, String target) {
super(grammar, target);
} |
17c4263c-5c46-445f-8730-3dbc07994f93 | 6 | public signUpAdmin(){
JPanel dialogPanel2 = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.HORIZONTAL;
//adding the the label for the Username
setLocation(560,380);
fNameAdd = new JLabel... |
6278adb2-c5a0-4461-a610-8c75be32ad24 | 2 | public void setTileCircuit(Vector2f pos, int circuit, int inputID){
Vector2f temp = TileUtil.getCoordinate(pos);
for(Tile tile : tileList ) {
if (TileUtil.getCoordinate(tile.getPosition()).equals(temp)){
tile.setCircuit(circuit);
tile.setInput(inputID);
}
}
} |
282c0c2d-88b5-4233-8284-a63c2fc17061 | 0 | public BuscaEmpresa() {
System.out.println("Instanciando uma Tarefa do tipo BuscaEmpresa "
+ this);
} |
b2379810-f7bb-49f9-be4c-e91097f6e7ec | 2 | public static BusSubmodesOfTransportEnumeration fromValue(String v) {
for (BusSubmodesOfTransportEnumeration c: BusSubmodesOfTransportEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
b2ffa321-b011-45ed-90a7-4a50706e5eca | 1 | public void setTexture(String texturePath){
try {
texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(texturePath));
} catch (IOException e) {
e.printStackTrace();
}
} |
f3ad4cb7-4dd9-4783-b82d-33cc53548b73 | 0 | public PartB getPartB() {
return partB;
} |
65c2334b-4154-4b74-8c11-582efe607af2 | 5 | public String getVersionFromManagementDependency(Dependency dependency) {
for (DependencyType depType: Arrays.asList(DEPENDENCY_MANAGEMENT_LIST, PLUGIN_MANAGEMENT, PLUGIN_MANAGEMENT_DEPENDENCIES)) {
for (Dependency mgtDep: dependencies.get(depType)) {
if (mgtDep.equalsIgnoreVersion(d... |
f54f8567-8ace-4357-ac57-33746094994a | 4 | protected void updateLandingStrip() {
if (landingStrip == null || landingStrip.destroyed()) {
final LandingStrip newStrip = new LandingStrip(this) ;
final Tile o = origin() ;
final int S = this.size ;
for (int n : TileConstants.N_ADJACENT) {
n = (n + 2) % 8 ;
newStrip.setPos... |
48d98d53-1892-4663-a109-859906302e27 | 9 | static void processCommandLine(String[] arguments) {
if (arguments.length > 0) {
ArrayList<String> args = new ArrayList<String>();
for (String arg : arguments) {
args.add(arg);
}
while (args.size() > 0) {
if ("-a".equalsIgnoreCase(args.get(0))) { //$NON-NLS-1$
args.remove(0);
try {
... |
d46a3d82-c45a-4409-9062-7154f25f5b61 | 0 | public void setAddress(Address address) {
Address = address;
} |
ca18a6d0-d6ab-47c6-be2d-9cb636c58946 | 3 | public static void bfs(int root) {
Queue<Integer> q = new LinkedList<Integer>();
Arrays.fill(v, 0, V, false);
q.add(root);
v[root] = true;
while (!q.isEmpty()) {
int node = q.poll();
for (int i = 0; i < G[node].size(); i++) {
Edge nodde = G[node].get(i);
int neigh = nodde.destino;
if (!v[nei... |
60f2cde6-2310-47eb-8d77-393daa3851eb | 4 | void add(float v) {
switch(dim) {
case 0:
x = v;
dim ++;
return;
case 1:
y = v;
dim ++;
return;
case 2:
z = v;
... |
516c85b2-e1e2-4ffc-a0d3-fe6fa8acfdbc | 0 | public void setStartDate(XMLGregorianCalendar value) {
this.startDate = value;
} |
7951d8a8-3ab8-4c59-850f-d570f3e80290 | 1 | @Override
public void propertyChange(PropertyChangeEvent e) {
String name = e.getPropertyName();
if (name.equals("page")) {
setTitle(getTitle());
}
} |
2204dcc9-01ee-4a8b-994d-8f5d09d55869 | 6 | private void makeDropTarget(final java.io.PrintStream out, final java.awt.Component c,
final boolean recursive) {
// Make drop target
final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget();
try {
dt.addDropTargetListener(dropListener);
} // end try
... |
95d5a51d-3939-4739-b0a2-bc521c58d6a6 | 1 | public String getPartName(String xpathExpression){
if (xpathExpression.contains("/")){
String varPart = xpathExpression.substring(0, xpathExpression.indexOf("/"));
return varPart.substring(varPart.indexOf(".")+1);
}else{
return xpathExpression.substring(xpathExpression.indexOf(".")+1);
}
} |
61124ea6-fcee-4556-bfca-b348924cab87 | 8 | @Override
public Object getValueAt(int row, int column) {
Mannschaft m = WettkampfTag.get().getMannschaften().get(row);
switch (column) {
case -1:
return m;
case 0:
return icon;
case 1:
return m.getName();
case 2:
return m.getVerein();
case 3:
return m.getRiege() != null ? m.getRiege().get... |
2f091a0b-537e-4920-9e2c-1d77822d9303 | 5 | public CSProperties getParameter() throws IOException {
CSProperties p = DataIO.properties();
for (Params paras : getParams()) {
String f = paras.getFile();
if (f != null) {
// original properties.
p.putAll(DataIO.properties(new FileReader(new File(f)),
"Parameter"));
// check for tables in ... |
38c48642-4eb4-4cb3-8025-ea040cba6158 | 3 | public static double toDouble(Object object) {
if (object instanceof Number) {
return ((Number) object).doubleValue();
}
try {
return Double.valueOf(object.toString());
} catch (NumberFormatException e) {
} catch (NullPointerException e) {
}
... |
addc53c0-0d73-4dc8-8d5e-147c02d7306a | 2 | public ArrayList<Tayte> haeTaytteet() throws DAOPoikkeus{
System.out.println("haetaan taytteita");
String sql = "select * from Tayte";
Connection yhteys = avaaYhteys();
ArrayList<Tayte> taytteet = new ArrayList<Tayte>();
PreparedStatement lause;
try {
lause = yhteys.prepareStatement(sql);
Sys... |
3b52fc0d-0753-42c2-aaeb-eba9ac532b58 | 9 | public static By by(String locator) {
By by;
if(locator.startsWith("//"))
by = By.xpath(locator);
else if(locator.startsWith("class="))
by =By.className(locator.replace("class=",""));
else if(locator.startsWith("css="))
by = By.cssSelector(locator.... |
feb5c90b-5658-45d6-adaa-d05a6beeb40f | 1 | public Piece createPromotionPiece(boolean isWhite) {
return new Queen(isWhite, isWhite ? this.board.whiteQueenImage : this.board.blackQueenImage);
} |
022d1c4f-590d-4020-b1e2-98f82adcd424 | 4 | public boolean onCommand(CommandSender cs, Command cmd,
String string, String[] args) {
Home Home = new Home(MainClass);
SetHome SetHome = new SetHome(MainClass);
if(string.equalsIgnoreCase("sethome")){
if(!(cs instanceof Player)){
return false;
}
else
SetHome.setHome(cs, cmd, string, args);
... |
cfd68a93-21e4-48ad-8b22-941c5f139adf | 6 | @Override
public void Play(PlayerResponse response) {
try {
List<Card> cards = response.getCards();
if(cards.size() < 4)
throw new Exception("not enough cards");
if(mP.getCurrentTurn() == bidPartner.getPosition()) {
passCards(bidPartner, bidWinner, cards);
mP.setCurrentTurn(bidWinner.getPosi... |
2867d8db-ad9d-4523-ab93-52b6a75187fe | 2 | public void print_heap(Binarynode root) {
System.out.println(root.value);
if (root.left != null) {
print_heap(root.left);
}
if (root.right != null) {
print_heap(root.right);
}
} |
c921654b-64d4-4a49-b32f-8a82e28aefef | 1 | public static void writeDataToFile(DataContainer dataContainer) throws IOException {
File fileDir = new File(backupFilePath);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileDir), "UTF-8"));
Set<TableDescription> tableDescriptions = dataContainer.getTable... |
f8819830-55e0-4457-9eff-748de89d6f6c | 9 | private void initControls() throws RemoteException, NotBoundException, MalformedURLException {
this.setLocationRelativeTo(null);
//setExtendedState(this.getExtendedState() | MAXIMIZED_BOTH)
// ############## INITIATE PERSONS ################
List<IPersonDTO> personsDTO = personControl... |
456c5eaf-8fd4-4515-8182-7316dd3ed397 | 5 | public Relation readFile(){
BufferedReader reader;
String currentLine;
try {
reader = new BufferedReader(new FileReader(input));
//Read the first line, that will be the relation name
storedRelation.relationName = reader.readLine().split(" ")[1];
//Burn one - blank line
reader.readLine();
... |
3c159fe4-d514-4d3a-a43a-962e69c3b33b | 4 | void resetEditors (boolean tab) {
TableItem oldItem = comboEditor.getItem ();
comboEditor.setEditor (null, null, -1);
if (oldItem != null) {
int row = table.indexOf (oldItem);
try {
new String (nameText.getText ());
} catch (NumberFormatException e) {
nameText.setText (oldItem.getText (NAME_C... |
15f5e02c-ecd3-4f32-9a0d-5590c076380f | 0 | @Test
public void isEmptyReturnsTrueWhenEmpty() {
assertTrue(s.isEmpty());
} |
e427ae67-6458-45ee-aef4-df37178108ad | 9 | private Coordinates getNextCoordinates() throws CloneNotSupportedException {
try
{
Coordinates lastHitCopy = lasthit.clone();
switch (direction) {
case 0:
if (lasthit.getX() == 9) {
return null;
... |
ca8ac338-d218-45d9-a2a5-9e827d402ef8 | 8 | public void draw() {
// Get the loaded materials and initialise necessary variables
Material[] materials = couchMesh.materials;
Material material;
Triangle drawTriangle;
int currentMaterial = -1;
int triangle = 0;
// For each triangle in the object
for (triangle = 0; triangle < couchMesh.triangles.len... |
f2001760-96c7-4366-bbb2-0a9b14b68cee | 3 | public void setTrue(TTrue node)
{
if(this._true_ != null)
{
this._true_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}... |
9db30521-4b9f-4a71-a259-0f5bbeebabfb | 4 | public void openConnection(String driverClassName, String url, String username, String password)
throws IllegalArgumentException, ClassNotFoundException, SQLException {
String msg = "Error: url is null or zero length!";
if (url == null || url.length() == 0) {
throw new IllegalArg... |
ef781e5f-ef7f-478d-8038-1612301dd4f0 | 5 | @Override
public synchronized List<String> getDocumentList() throws RemoteException {
try {
unlockDocument();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (NotBoundException e) {
e.printStackTrace();
}
List<String> docum... |
4c12d9c5-ad83-4764-8807-4aca1f16c1f9 | 1 | private boolean WriteConfigFile()
{
//write status
boolean status = false;
try
{
//open the file output stream
outStream = new FileOutputStream(System.getProperty("user.dir")+"/Data.csv");
//get the data stream for the file
... |
be1ccee5-7955-4e32-9440-c80ee5b76023 | 0 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
} |
1e8aa5a5-f51d-4652-b766-1060d3d6eabc | 1 | public double getPriority(T item) throws NoSuchElementException {
int index;
try {
index = map.get(item);
} catch (NullPointerException npe) {
throw new NoSuchElementException();
}
PQElement<T... |
5bb798c6-7424-4897-9952-8c3afff14a43 | 2 | public int attackNormal( Character opponent ) {
int type = (int)(Math.random()*2);
int damage = 0;
if (type == 0){
System.out.println(_name+" asks annoying question!");
damage = askQuestion(opponent);}
else {
System.out.println(_name + " does his homework using code found online!");
dama... |
77cdbd98-1074-4003-beee-e5a109a414ea | 2 | @Override
public ISocketServerConnection getConnectionById(long aIdConnection) {
for (Iterator<ISocketServerConnection> it = getConnections().iterator(); it.hasNext();) {
ISocketServerConnection ssc = it.next();
if (aIdConnection == ssc.getIdConnection()) return ssc;
}
return null;
} |
90e9e198-51de-4513-861b-a9fa74e3cbde | 9 | public void processFileAssoc(Source sourceInput, String localName, File outputFile,
ArrayList parameterList, String initialMode, PrintStream traceDestination)
throws TransformerException {
if (showTime) {
System.err.println("Processing " + sourceInput.get... |
37d53368-5793-4e50-b9df-6f9419a2c782 | 4 | public List<String> openFile(File file) {
List<String> list = new ArrayList<String>();
if (!file.isDirectory() && file.canWrite()) {
path = Paths.get(file.getAbsolutePath());
try (BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
String line = null;
while ((line = reade... |
7c1b9318-a661-4d65-9e5b-c0a1b0dfdef2 | 2 | public List<File> getArgumentsAsFiles() {
List<File> arguments = new ArrayList<>();
for (CmdLineData one : mData) {
if (!one.isOption()) {
arguments.add(new File(one.getArgument()));
}
}
return arguments;
} |
9413cd1c-1b73-44c7-98d0-d2848e1a5d10 | 2 | public void modificarImagen(int id, ArrayList datos)
{
// Cambiamos todos los datos, que se puedan cambiar, a minúsculas
for(int i = 0 ; i < datos.size() ; i++)
{
try{datos.set(i, datos.get(i).toString().toLowerCase());}
catch(Exception e){}
}
bibliote... |
601d6959-63b4-468f-ba1d-ba8b0e6c0084 | 1 | public VariableDependencyGraph getVariableDependencyGraph(Grammar grammar) {
VariableDependencyGraph graph = new VariableDependencyGraph();
initializeDependencyGraph(graph, grammar);
Production[] uprods = getUnitProductions(grammar);
for (int k = 0; k < uprods.length; k++) {
graph
.addTransition(getTran... |
1f077585-8bb0-410a-86ba-99d0867b3b6c | 3 | public int put(int key, int n) {
int pos, t = 1;
while (t < m) {
pos = toHash(key, t);
if (table[pos] == null) {
table[pos] = new HashEntry(key, t);
// ???????????????????????????????????????????????????????????????????????????????????? //
... |
72b352ac-47b6-4db1-a017-9cd43cf4b896 | 1 | public boolean choisirLigne(int id) throws IOException {
connexion.envoyer("CHOIX "+id+" "+Main.controleur.getId());
reponse = connexion.recevoir();
return (reponse.equals("OK") ? true : false);
} |
30305628-8fdb-4c9e-bd73-6a364b7326a7 | 6 | public static void string_cppOutputLiteral(String string) {
{ int free = Stella.$CPP_MAX_STRING_LITERAL_LENGTH$;
((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.print("\"");
{ char ch = Stella.NULL_CHARACTER;
String vector000 = string;
int index000 = 0;
int length00... |
4df6e2af-b51f-400d-98e0-9f0b8bd7827b | 4 | protected void removeFromTeamAOrB(String teamType) {
Object selectedValue = null;
String selectedStudent = null;
int selectedIndex = 0;
if (teamType.equals("A")) {
selectedValue = teamACDJlst.getSelectedValue();
if (selectedValue == null ) {
//warn no selected student
JOptionPane.showMessageDialog... |
ec80746e-7a54-4bbb-8911-547f2e4f7d62 | 0 | public List<ParkManager> getManagerList() {
return managerList;
} |
0ce66fa3-e51f-4504-903f-cf745255c17e | 5 | @Override
public void keyPressed (KeyEvent keyEvent) {
//System.out.println("key pressed");
switch (keyEvent.getExtendedKeyCode()) {
case 32:
frame.getHero().attack();
break;
case 37:
frame.getHero().setHeroOwnHorizontalSpeed(-... |
64e6ac00-8cd6-4a23-981f-93758beee40d | 9 | public Matrix<T> getVer () throws Exception {
if (this.cols != this.rows) {
throw new MatrixIsNotInversebleException();
}
Matrix<T> ex = this.getEx();
// set the diagonal line elements of the Matrix as "1"
for (int r = 0; r < rows; r++) {
T c = ex.get(r, r);
if (!c.isOne()) {
ex.set(r, r, thi... |
8f6bccd9-0fab-44a4-a161-9d8dca8caa6a | 0 | @Basic
@Column(name = "log_time")
public Timestamp getLogTime() {
return logTime;
} |
43a1aa94-9c80-4239-99fe-8354176cbbca | 1 | public static void buyItemTester(String name){
if(!ItemStorageInventory.create().addItem(ItemFactory.create().buyItem(name)) ){
System.out.println(name + " cannot be bought\n");
}
} |
d2b0152d-c00a-4d54-9f06-dd7b9b13a73c | 7 | private void executeAdding() {
if (action.contains("rooms")) {
Coordinate coordinate = sphereConverter.giveMouseCoordinates(mouseCoordinateX, mouseCoordinateY);
if (coordinate.giveLatitude() >= -90 && coordinate.giveLongitude() <= 90) {
Room room = new Room(-1, 50);
room.setLocation(coordinate.giveLongi... |
e6cf5a60-3f1b-4986-8029-6ef35d7d554a | 5 | public final DBMultipleStatement createMultipleStatement(final String... queries) {
if ((queries == null)||(queries.length == 0))
return null;
try {
final Connection connection = m_Pool.getConnection();
/* Disable auto commit */
connection.setAutoCommit(... |
ec50aa55-2d4c-4ab2-a1a3-aeb16d8269be | 4 | public void update() {
if (centerX <= 350 || speedX <= 0) {
centerX += speedX;
bg1.setSpeedX(0);
bg2.setSpeedX(0);
} else {
bg1.setSpeedX(-MOVESPEED);
bg2.setSpeedX(-MOVESPEED);
}
centerY += speedY;
// Handles Jumping
if (jumping == true) {
speedY++;
}
// Prevents from going out o... |
5c2c3112-6636-4730-8591-ac8a9b846a7a | 4 | public final boolean isVisited(){
if (isStranded()) return false;
if (tile1 == null){
return tile2.isVisited();
}
if (tile2 == null){
return tile1.isVisited();
}
return tile1.isVisited() || tile2.isVisited();
} |
e376b2f9-531e-4f96-9891-3b58f5432f27 | 3 | @Override
protected void read(InputBuffer b) throws IOException, ParsingException {
VariableLengthIntegerMessage vLength = getMessageFactory().parseVariableLengthIntegerMessage(b);
b = b.getSubBuffer(vLength.length());
long length = vLength.getLong();
if (length > MAX_LENGTH || length < 0) {
throw new Pars... |
4b23e1ea-507b-4fab-819b-3106faeaccd3 | 9 | public void deleteRowFromTable(int id) {
int currentTable = tabbedPane.getSelectedIndex();
if(currentTable == 0) {
for(int row = 0;row < movieModel.getRowCount();row++) {
if(movieModel.getValueAt(row, 0).equals(Integer.toString(id))) {
movieModel.removeRow(row);
}
}
}
if (currentTable == ... |
0f1a6436-1f0d-472d-a322-bfacfb125129 | 2 | @Override
public void render()
{
for(int x = 0; x < Game.WIDTH; x+= Tile.TILE_SIZE)
{
for(int y = 0; y < Game.HEIGHT; y+= Tile.TILE_SIZE)
{
g.drawImage(Images.WALL, x, y, Tile.TILE_SIZE, Tile.TILE_SIZE, null);
}
}
g.drawImage(Images.BLANK_GUI, 62, 8, 900, 740, null);
renderText(new Font("Impact... |
a6edc983-4c73-4b8c-931a-8bb8734da7b0 | 3 | public void setIdentificador(TIdentificador node)
{
if(this._identificador_ != null)
{
this._identificador_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
... |
a152deb6-b1ef-482a-b83a-e3a7491496af | 4 | public void SetNodeSubscriptField(Field field, Persistent obj, NodeReference node)
{
Long Id = obj.Id;
String fieldName = field.getName();
try {
Object fieldValue = field.get(obj);
if (fieldValue instanceof java.lang.String)
{
node.set(fieldValue.toString(), Id, fieldName);
}
... |
b3ff807a-d813-46b9-9877-9eb5091577e8 | 1 | public void RemoveFromMenu() {
if (Glob.instance != null) Glob.instance.paginae.remove(res);
RemoveListener();
} |
d2cdf139-fb4e-4cc7-8af6-10f78f2baeb3 | 2 | private void changeAccount() {
setVisible(false);
ArrayList<Booking> bookings = table.getSelectedObjects();
for (Booking booking : bookings) {
AccountSelector sel = AccountSelector.getAccountSelector(accounts, accountTypes);
sel.setVisible(true);
Account accou... |
8dfd7118-5e33-4e3b-adbf-57dea0ec155c | 3 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
AcessoSistema login = new AcessoSistema();
String nome = request.getParameter("nomeUsuario");
String senha = request.getParameter("Senha");
int resul... |
be20757a-fd40-4c64-97aa-b2532fd4ec56 | 3 | static String format(String msg, Object... args) {
try {
if (args != null && args.length > 0) {
return String.format(msg, args);
}
return msg;
} catch (Exception e) {
return msg;
}
} |
65524b2f-ce29-4df4-8ef3-2c3ad9123905 | 8 | public void clientInput(String input, int type)
{
if (type == 1) // audio
{
try
{
sendMessage("/audio " + Compressor.byteArrayToString(Compressor.compress(Compressor.stringToByteArray(input))));
}
catch (IOException e) {}
}
... |
47283169-0927-4769-abd3-d4eda8bb2f7e | 3 | public double[][][] getGridD2ydx1dx3(){
double[][][] ret = new double[this.lPoints][this.mPoints][this.nPoints];
for(int i=0; i<this.lPoints; i++){
for(int j=0; j<this.mPoints; j++){
for(int k=0; k<this.nPoints; k++){
ret[this.x1indices... |
06e4b2b1-4896-4a2f-b69b-7ce14a597634 | 7 | public Object [] getResultTypes() {
int addm = (m_AdditionalMeasures != null)
? m_AdditionalMeasures.length
: 0;
int overall_length = RESULT_SIZE+addm;
overall_length += NUM_IR_STATISTICS;
overall_length += NUM_WEIGHTED_IR_STATISTICS;
overall_length += NUM_UNWEIGHTED_IR_STATISTICS;
... |
5fc9a1ae-7837-4dcd-b6f2-908021f38ef4 | 6 | public boolean createUser(DataRow row)
{
if(!select(row).isEmpty())
{
ErrorDialog errorDialog = new ErrorDialog(true, "W bazie danych istnieje wpis o podanych parametrach.", "DatabaseManager", "createUser(DataRow row)", "row");
errorDialog.setVisible(true);
return... |
1a7187ef-0f36-4a90-a903-e9ccb118e5e9 | 5 | private Tile getTileFromGid(Document d, Map m, int x, int y, int gid) {
if (gid == 0) {
return null;
}
Tileset tileset = null;
NodeList tilesets = d.getElementsByTagName("tileset");
ArrayList<Tileset> ts = new ArrayList<>();
for (in... |
bb2801ec-8491-4afa-8ad8-d78bd9c19918 | 8 | public boolean covers (GeneralizedConditionChunk cond)
{
if(cond == null)
return false;
if(!equalsKeys(cond))
return false;
for(Dimension i : cond.values())
{
Dimension d = get(i.getID());
if(!d.checkMatchAll())
{
for(Value j : i.values())
{
if(!(d.containsKey(j.getID())))
ret... |
acd92342-ecb8-4f71-b6aa-245d88c2b7dc | 6 | public Point awayFromSegmentationPoint(Point point, int... numbersToSkip) {
boolean lResult = false;
double lAbsoluteDistance = shape.getDelta() / 2;
double lDistance;
double lDistance2;
double minDistance = 10000;
Point firstMinPoint = null;
Point secondMinPoint ... |
8b185760-d09a-4554-a12e-7b6d63d09191 | 9 | @Override
public List<SearchResult<SequenceMatcher>> searchForwards(final WindowReader reader,
final long fromPosition, final long toPosition) throws IOException {
// Initialise:
final int sequenceLength = matcher.length();
final int lastSequencePosition = sequenceLength - 1;
... |
c33659d9-fba1-4a94-a76f-e5121b251da2 | 3 | public List<Image> getImages() {
List<Image> images = new ArrayList<Image>();
Document document = Jsoup.parseBodyFragment(getContent());
for(Element img : document.body().select("img")) {
try {
URL src = new URL(BakaTsuki.getAbsolute(img.attr("src")));
if (isColorful(src)) {
String url = src.toS... |
3b2bf04a-e927-41bc-b90a-a290fff26807 | 2 | public void setOutputMode(String outputMode) {
if( !outputMode.equals(AlchemyAPI_Params.OUTPUT_XML) && !outputMode.equals(OUTPUT_RDF) )
{
throw new RuntimeException("Invalid setting " + outputMode + " for parameter outputMode");
}
this.outputMode = outputMode;
} |
d26a4e47-b987-49ce-ad85-9f26b6a9b3c1 | 5 | @Override
public boolean test(String value) {
// TODO Auto-generated method stub
if (value == null || value.equals("")) return true;
try {
int i = Integer.parseInt(value);
if (i >= 0 && i <= 9999) return true;
return false;
} catch (Exception e) {
// TODO: handle exception
return false;
}
} |
c7e2d473-3047-4c78-87bf-1bd9590f8537 | 0 | public static void add(Node node) {
getController().rootPane.getChildren().add(node);
} |
970aeca1-d192-4e86-b496-08fa484b3e19 | 0 | public int getGold() {
return gold;
} |
8f623631-92cb-47b6-849f-4fb9d4be3f23 | 6 | @Override
public V put(K key, V value) {
if (size > loadFactor * this.array.length)
{
resizeTable();
}
int i = 0;
V data = null;
int hash = hash(key, i);
Entry<K, V> entry = this.array[hash];
while (entry != null) {
if (key.equa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.