method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4cf28e13-90f4-4c49-9217-0a3827d6183c | 1 | public void setDecimalformat(String format) {
dformat = (!format.startsWith("%")) ? ('%' + format) : format;
} |
f4543d50-bfde-45dc-be0c-43ea08d3a684 | 8 | /* */ public void damageCheck() {
/* 40 */ Random r = new Random();
/* 41 */ for (int i = 0; i < Core.units.size(); i++) {
/* 42 */ Unit u = (Unit)Core.units.get(i);
/* */
/* 44 */ if (!this.hitUnits.contains(u)) {
/* 45 */ if (u.collision.intersects(this.highDamage)) {
/* 4... |
70a2ff46-e741-4a9c-b84b-df7ba3dd38df | 0 | public static void main(String[] args) {
int max = Integer.MAX_VALUE;
System.out.println("Overflow:");
System.out.println(max); // 2147483647
System.out.println(max + 1); // -2147483648
System.out.println(max + 2); // -2147483647
int min = Integer.MIN_VALUE;
... |
a49e5917-f88b-4877-bf20-c48c89597757 | 5 | private void drawNanopostImage() {
try {
File imgFile = np.getNanoPostFile(np.isFromOutbox());
if (!imgFile.exists()) {
panAttach.setVisible(false);
return;
}
BufferedImage image = ImageIO.read(imgFile);
if (image != nu... |
3bdb6267-23e6-4591-856d-af191d38d93e | 8 | public static FelixString tryParse(ParserReader in) throws IOException {
in.mark(1); // Prepare to roll back if we don't see a quote character.
int quote = in.read();
boolean isQuote = quote == S || quote == D;
if(!isQuote) {
in.reset();
return null; // Not a string
}
StringBuffer buf = new String... |
77a03200-75a0-4e43-b234-8d94a3edae6b | 6 | private boolean checkTable() {
String sql = "";
try {
Statement state = con.createStatement();
sql = "DESC " + database + "." + table;
ResultSet rs = state.executeQuery(sql);
int size = 0;
while (rs.next()) {
String field = rs.getString("Field");
String type = rs.getString("Type");
if (!t... |
0a1ae36b-8d4f-44aa-93d6-10a2e8e0099e | 2 | public List<Collidable> retrieve(List<Collidable> returnStuff,Collidable c) {
int index = getIndex(c);
if (index != -1 && nodes.get(0) != null) {
nodes.get(index).retrieve(returnStuff, c);
}
returnStuff.addAll(stuff);
return returnStuff;
} |
7cd1085e-a57c-43a1-9304-f34f15252490 | 0 | KeepAliveThread() {
lock = new ReentrantLock();
setName("KeepAliveThread");
setDaemon(true);
} |
067c91e0-4121-40f3-9d78-073a4d0bff7a | 9 | final public CommandControl isValid(List<String> lines) {
if (isCommandForbidden()) {
return CommandControl.NOT_OK;
}
final Matcher m1 = starting.matcher(lines.get(0).trim());
if (m1.matches() == false) {
return CommandControl.NOT_OK;
}
if (lines.size() == 1) {
return CommandControl.OK_PARTIAL;
}... |
cdc440b6-39a6-489b-a739-6c0c118a46ca | 3 | public ListEnemy DeserializationListEnemy(String songTitle)
{
ListEnemy LE=null;
try {
FileInputStream fis = new FileInputStream(songTitle);
ObjectInputStream ois= new ObjectInputStream(fis);
try
{
LE = (ListEnemy) ois.readObject();
... |
b698e8ae-c726-49d8-b440-fbf1aa75d2af | 0 | @Override
public String getName() {
return this.name;
} |
ad927912-25d8-4475-bf22-40d304486804 | 6 | private void jaaPisteet(Siirto ensimmaisen, Siirto toisen, AI eka, AI toka) {
if (ensimmaisen == Siirto.YHTEISTYO && toisen == Siirto.YHTEISTYO) {
eka.lisaaPisteita(yhteistyonPalkinto);
toka.lisaaPisteita(yhteistyonPalkinto);
} else if (ensimmaisen == Siirto.YHTEISTYO && toisen =... |
aead7005-428a-4e00-a3e9-d97dab6d6005 | 5 | public StatFileWriter(Session var1, File var2) {
File var3 = new File(var2, "stats");
if (!var3.exists()) {
var3.mkdirs();
}
File[] var4 = var2.listFiles();
int var5 = var4.length;
for (int var6 = 0; var6 < var5; ++var6) {
File var7 = var4[var6];... |
347b4a19-d474-4b0b-8439-b4df13408391 | 0 | @RequestMapping(method = RequestMethod.DELETE, value = "{id}")
public void deleteTask(@PathVariable("id") Integer id) {
tasksService.deleteById(id);
} |
dff7dced-bd09-4961-871a-bdcffdc1cfe4 | 2 | public void visitInnerClass(final String aname, final String outerName, final String innerName, final int attr_access) {
if ((name != null) && name.equals(aname)) {
this.access = attr_access;
}
super.visitInnerClass(aname, outerName, innerName, attr_access);
} |
9486f8fc-0192-4425-b33a-dc2bb966b2e6 | 5 | public int hashCode() {
int result;
result = (street != null ? street.hashCode() : 0);
result = 29 * result + (city != null ? city.hashCode() : 0);
result = 29 * result + (country != null ? country.hashCode() : 0);
result = 29 * result + (state != null ? state.hashCode() : 0);
... |
7cd422ae-786f-4740-aa74-676b15e02433 | 3 | public static String toHtml(String text, String url) throws Exception {
ParserConverter oParserConverter = new ParserConverter();
try {
if (text != null) {
if (!text.equals("")) {
text = oParserConverter.tag(text, "======", "h6");
text ... |
6b60ec75-4210-4e7b-a7e6-97f490e73be7 | 2 | @Override
protected void loadDatabase() throws DataLoadFailedException {
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException ex) {
throw new DataLoadFailedException(ex);
}
try {
connection = DriverManager.getConnection("jdbc:sql... |
6deaa9f6-4562-4d89-b71e-d46ce31fc7ef | 6 | public void start(BundleContext context) throws Exception {
m_context = context;
// We synchronize while registering the service listener and
// performing our initial dictionary service lookup since we
// don't want to receive service events when looking up the
// dictionary service, if one exists.
synchr... |
5ef4477e-92c8-41cf-a478-b1adedbce090 | 8 | public static void copyFile(String fileFrom, String fileTo) {
File srcFile = new File(fileFrom);
if (!srcFile.exists()) {
return;
}
File destFile = new File(fileTo);
if (destFile.exists()) {
destFile.delete();
}
try {
destFile.createNewFile();
} catch (IOException e) {
// TODO Auto-generated... |
7b0936de-579e-44d5-9fa4-caba5f19a5b6 | 0 | public Address getAddressCompany() {
return addressCompany;
} |
ac12b39b-93e5-41c7-839e-5deff2e092f8 | 4 | public boolean equalsExpr(final Expr other) {
return (other != null) && (other instanceof ShiftExpr)
&& (((ShiftExpr) other).dir == dir)
&& ((ShiftExpr) other).expr.equalsExpr(expr)
&& ((ShiftExpr) other).bits.equalsExpr(bits);
} |
fa930ae9-48a8-4794-954d-1487c83c0174 | 1 | public static DataTag getPlayerData(){
Object obj = read("player/player");
if(obj == null)
return null;
JSONObject data = (JSONObject) obj;
return new DataTag(data);
} |
ea0754ca-c748-460e-9d1b-65c39feb8e24 | 7 | @AroundInvoke
public Object invoke(InvocationContext context) throws Exception {
EntityTransaction trx = manager.getTransaction();
boolean criador = false;
try {
if (!trx.isActive()) {
// truque para fazer rollback no que já passou
// (senão, um futuro commit confirmaria até mesmo operações sem trans... |
4ebe3499-831b-46f3-8cf1-f8f829433fbd | 0 | public void setRap_num(int rap_num) {
this.rap_num = rap_num;
} |
d1d9695e-6d93-4fd2-940e-eca8540aa33d | 8 | private void recurseClick(int x, int y) {
Square square = board.getSquare(x, y);
if (square.isRevealed() || square.isFlagged() || square.isQuestioned()) return;
//first click square
square.setClicked();
listener.squareRevealed(x, y, square.numMines());
unclickedNonmines--;
//then check if it has any adj... |
ce543d01-a2e8-4206-8a8c-f9310e7f0d50 | 5 | public void merge(int low, int mid, int high){
//copy the entire array in the Auxilary array
for(int i=low;i<=high;i++){
arrAux[i] = arrInput[i];
}
int i = low;
int j = mid+1;
int k = low;
while(i<=mid && j<=high){
if(arrAux[i]<=arrAux[j]){
arrInput[k]=arrAux[i];
i++;
}
else{
ar... |
20a61ca6-3876-4051-9ac9-c3e3f2acbef8 | 0 | public StringBuilder getText() {
return text;
} |
201f5b93-20a9-4201-a799-7652e56c7a54 | 8 | @Override
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
p.doYourThing(gc,gameplayEnvironment);
gameplayEnvironment.doYourThing(gc);
if((System.currentTimeMillis() - lastKITick) > 300){
for(objekt a : gameplayEnvironment.getEnvironment()){
lastKITick = System.c... |
2a99a652-2bb8-4eb2-8228-752536a7d20a | 0 | public static void main(String[] args) {
// wap to find square root of number
ky = new Scanner(System.in);
System.out.println("enter the number");
double k=ky.nextDouble();
System.out.println("the square root is" +Math.sqrt(k));
} |
e440ce8d-ab35-4f71-a627-f40166bb5da4 | 9 | public void testMergeWithDifferentPartitions() throws Exception {
d=createChannel(a);
d.setName("D");
rd=new MyReceiver("D", d);
d.setReceiver(rd);
modifyConfigs(d);
d.connect("OverlappingMergeTest");
// Inject view {A,C,B} into A, B and C:
View new_view=... |
d497ec57-16de-4caa-a525-253eec7e1e28 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Group other = (Group) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.... |
78d1081c-de82-4819-be5f-85590aeff452 | 3 | private static void closeStatement(Statement stmt) {
if( stmt != null ) {
try {
if( !stmt.isClosed() ) {
stmt.close();
}
} catch (SQLException e) {
logger.error("Error closing the statement.", e);
}
}
} |
4d628fad-7e36-4f68-8bf0-8a3983a24015 | 7 | @Override
public int getCurrentBall()
{
assert !isGameOver();
int currentBall = 10;
for (int i = 0; i < rollCount; i++)
{
int pinsKnockedDown = pinsKnockedDownArray[i];
if (getCurrentFrame() == 10)
{
currentBall += 3.33;
}
else
{
if (pinsKnockedDown == 0)
{
currentBall += ... |
0fa8f2e0-8a13-4131-b9e9-0b7e63298a38 | 6 | @Override
public int match(String[] argsToTest) {
// args must contain one of the required pairs
int errorCount = 0;
for (String[] requiredElem : required) {
boolean found = false;
for (String testArg : argsToTest) {
if (isCommandArg(testArg)) {
if (matches(testArg, requiredElem)) {
found ... |
875ffc16-63f3-42da-ba05-00ee7c6171c9 | 7 | public int findKth(int[] nums1, int[] nums2, int k) {
int p1 = 0;
int p2 = 0;
System.out.println("p1: " + p1 + "p2: " + p2 + "k: " + k);
while (p1 < nums1.length && p2 < nums2.length) {
if (nums1[p1] > nums2[p2]) {
if (k == 1) {
return nums... |
f30c142e-1ea2-467c-9639-099a81fcb494 | 1 | public void ajErrorOutputNode() {
setMisalignment(this.getPotential() * (1 - this.getPotential()) * (this.getAnswer() - this.getPotential()));
//Adjustment of synaptic weights on the output layer
double lErr = this.getMisalignment();
for (int t = 0; t < this.getIncomingLinksNumber(); t+... |
426eb895-31de-488f-af3b-30861d5295be | 6 | public static void main(String args[])
{
/* 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 details see http://... |
a42569cf-a5cb-4fac-a411-22da365f5d31 | 2 | private void updateGrid(ClientUI client) {
Iterator<Integer> iter = client.net.getTerritoriesLayout().keySet().iterator();
TerritoriesLayout territories = client.net.getTerritoriesLayout();
while (iter.hasNext()) {
Integer key = iter.next();
Button button = client.buttonsMap.get(territories.get(key).getId(... |
59b4f921-8ef2-411c-8304-235e9310cc8a | 5 | public void mouseEntered(MouseEvent arg0) {
setBorder(bigBord);
double coutAttaque = Partie.getInstance().coutAttaque(territoire);
List<Element> elements = territoire.getElements();
String txt = "";
String occupantName;
Peuple occupant = this.territoire.getOccupant();
int nbUnite = this.territoi... |
a8bd79d3-d1d5-43ef-8394-1bc54317924a | 7 | @Override
public void connect(T t1, T t2, String s, int weight){
if (!nodes.containsKey(t1) || !nodes.containsKey(t2)){
throw new NoSuchElementException("Node finns ej vid connect");
}
if (nodes.get(t1) == nodes.get(t2)){
//this shouldn't happen as y... |
193c6e88-1ace-4413-b7a5-8c253f1f8f30 | 6 | public void main(String args[]) {
/* 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 details see http://download.or... |
fbef8cca-1bd8-416c-b330-9ce0f5bd0943 | 3 | public void addMessage(String user, String message) throws ChatRoomInvalidStateException {
try {
ChatRoomMessage msg = dbConnector.addMessage(user, chatRoomName, message);
ChatRoomMessage stub = (ChatRoomMessage) UnicastRemoteObject.exportObject(msg, 0);
for(Chat... |
68222310-b46b-4c11-875b-6d08ec654e23 | 9 | @Override
public HashMap<String, Float> getWeightsForQuery(HashMap<String, Integer> query) {
try {
HashMap<String, Float> weights = new HashMap<String, Float>();
float total = 0.0f;
for (int n : query.values()){
total += n;
}
if (to... |
82ce2cfe-7b77-4380-a75f-d7489f4f6841 | 5 | private void changeSelection(Item.Pocket newPocket)
{
if (state == State.BUY)
{
pocket = newPocket;
currentDisplay.clear();
for (Item aFullInventory : fullInventory) {
if (aFullInventory.pocket == newPocket)
currentDisplay.add(aFullInventory);
}
... |
8a1f0246-e72e-4888-b687-099560c336e1 | 5 | public Wave23(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 615; i++){
if(i % 5 == 0)
add(m.buildMob(MobID.ODDISH));
else if(i % 4 == 0)
add(m.buildMob(MobID.BELLSPROUT));
else if(i % 3 == 0)
add(m.buildMob(MobID.MEOWTH));
else if(i % 2 == 0)
add(m.buildMob(MobID.MANK... |
288c5807-e47f-4e44-aa5c-9394549741b3 | 3 | public EulerCamera(KeyboardBuffer kb, Vector3f position, Vector3f rotation) {
super(kb);
this.position = position;
this.rotation = rotation;
// Enable Depth clamping if supported
if (GLContext.getCapabilities().GL_ARB_depth_clamp) {
GL11.glEnable(ARBDepthClamp.GL_DEPTH_CLAMP);
}
//Instance the Mou... |
521aa659-d8cc-499a-8e64-9e56f03cf944 | 5 | public static boolean LoadNatives() {
String OS = System.getProperty("os.name").toLowerCase();
String os_res = "";
if (isWindows(OS)) {
os_res = "windows";
} else if (isMac(OS)) {
os_res = "macosx";
} else if (isUnix(OS)) {
os_res = "linux";
} else if (isSolaris(OS)) {
os_res = "solaris";
}... |
78fa0e0f-64aa-4eaf-aa12-e96a115cabcf | 6 | public Class<?> getCollectionOrArrayType() {
if (propertyDescriptor.getReadMethod().getReturnType().isArray()) {
return propertyDescriptor.getReadMethod().getReturnType()
.getComponentType();
}
if (!Collection.class.isAssignableFrom(getPropertyType())) {
throw new UnsupportedOperationException(
... |
e23b91d5-6e99-4e8b-afe9-8ccd0efe8286 | 6 | public void map(LongWritable key, Text values, Context context) throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
long numofSeqs = Long.valueOf(conf.get("numofSeqs"));
Double Support = Double.valueOf(conf.get("Support"));
//only one reducer as is... |
2d476585-a60f-40e3-aa5c-c83539550694 | 7 | public void calculateEntitesCount(DatasetLoader datasetHandler) throws Exception{
Hashtable<String, Document> documentsHash = datasetHandler.loadDocuments();
int numberOfUniqueWords = 0;
int numberOfEdges = 0;
long startTime = System.currentTimeMillis();
Enumeration ids = documentsHash.keys();
ArrayList<Str... |
1469ca98-49f7-4941-a66a-8a7fff8db3d3 | 9 | @Override
public String toString() {
return "Remarks {"
+ (extReferences != null ? " extReferences [" + extReferences + "]" : "")
+ (cls != null ? " cls [" + cls + "]" : "")
+ (idx != null ? " idx [" + idx + "]" : "")
+ (recommendedValue != null ? " recommendedValue [" + recommendedValue +... |
dd5f0689-66eb-4d31-97d1-0fa5fa7d0e69 | 3 | @Override
public void withdraw(String accountId, double amount) throws InvalidParamException, OverdraftException {
MethodResponse response = this.stub.sendMethodRequest("withdraw",
new Class[]{String.class, double.class},
new Object[]{accountId, amount});
Throwable t... |
1b2d004a-be61-4fd5-9cb4-0deae68099b5 | 6 | public static void startupCppTranslate() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
... |
ad3a9add-c3fd-421b-91af-f4c752ad1883 | 6 | public void leesQuizzenVanBestand(OpdrachtCatalogus opdrachtCatalogus, QuizCatalogus quizCatalogus){
File file = new File("bestanden/quizzen");
//
try{
Scanner scanner = new Scanner(file);
while (scanner.hasNext()){
List<Opdracht> opdrachten = new ArrayList<Opdracht>();
String lijn ... |
918709ea-db5d-4573-a6c5-0a005648fc53 | 3 | public Produto getProduto(String nomeOUcodigo) {
for (Produto p : produtos) {
if (p.getNome().equalsIgnoreCase(nomeOUcodigo) || p.getCodigo().equalsIgnoreCase(nomeOUcodigo)) {
return p;
}
}
return null;
} |
73765737-f844-4d2f-9c11-15155f38992f | 4 | public static void rename(Automaton a) {
State[] s = a.getStates();
int maxId = s.length - 1;
Set untaken = new HashSet(), reassign = new HashSet(Arrays.asList(s));
for (int i = 0; i <= maxId; i++)
untaken.add(new Integer(i));
for (int i = 0; i < s.length; i++)
if (untaken.remove(new Integer(s[i].getID(... |
e2227fa3-5d9e-4d66-a03f-e7fe58dd1004 | 2 | public static Collection<User> getUsers()
{
List<User> users = new LinkedList<User>();
try
{
String sql = "SELECT user_id,name from user_table";
PreparedStatement ps = Connect.getConnection().getPreparedStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.... |
5039aee0-f6fd-47b2-b4ad-6ef9afc7eddc | 6 | @Override
public void createFromXML(NodeList attributes) {
for(int i = 0; i < attributes.getLength(); i++) {
Node node = attributes.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Node value = node.getFirstChild();
if(node.getNodeNa... |
7c9eb481-91f9-4d6e-9e4f-51dad598bc5b | 1 | public static void rowStringValues(String row[], int[] idx, String[] vals) {
for (int i = 0; i < vals.length; i++) {
vals[i] = row[idx[i]];
}
} |
6e89c81b-729c-49ca-8671-061df8c6f897 | 8 | public static boolean literalEqlP(Stella_Object x, Stella_Object y) {
if (((x != null) &&
Stella_Object.isaP(x, Stella.SGT_STELLA_BOOLEAN_WRAPPER)) ||
((y != null) &&
Stella_Object.isaP(y, Stella.SGT_STELLA_BOOLEAN_WRAPPER))) {
return (((((BooleanWrapper)(x)) == null) &&
(!B... |
f6294592-2fc9-468d-8ba6-a5b3e0037923 | 0 | public void setName(String value) {
this.name = value;
} |
c3d49e29-e40e-45a6-b7da-9411f9172f58 | 4 | public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000.0 / 60.0;
double time = 0;
long lastSecond = System.currentTimeMillis();
this.requestFocus();
while(running){
long now = System.nanoTime();
time += (now - lastTime) / nsPerTick;
lastTime = now;
boole... |
08de6030-0a1f-4650-ac86-5facb248f182 | 2 | public String printParkInfo() {
String txt="";
if(ParkManage.getInstance().getParkList().size() == 0) {
txt="目前没有创建任何停车场,请先创建停车场!";
return txt;
}
int emptyNum = 0;
int totalNum = 0;
txt= txt + "-----------------------------------------"+ "\n";
for(int i = 0; i < ParkManage.getInstance().getParkList(... |
a198c3d3-e3ad-460f-80a4-a4f3dba363ae | 4 | public CtConstructor[] getDeclaredConstructors() {
CtMember.Cache memCache = getMembers();
CtMember cons = memCache.consHead();
CtMember consTail = memCache.lastCons();
int n = 0;
CtMember mem = cons;
while (mem != consTail) {
mem = mem.next();
Ct... |
3f031b3f-195f-4966-b47b-2be6089ebb94 | 3 | public static void clearBodies(){
Array<Body> bodies = new Array<Body>();
Objects.world.getBodies(bodies);
for(int i = 0; i < bodies.size; i++){
if(bodies.get(i) != null ){
if(bodies.get(i).getUserData() != null){
Objects.world.destroyBody(bodies.get(i));
}
}
}
} |
2e8e2a89-9715-4fe3-ab36-e375bc2ad8f7 | 3 | private long getTime() {
switch (type) {
case WALL_TIME:
return getWallTime();
case CPU_TIME:
return getCpuTime();
case USER_TIME:
return getUserTime();
default:
break;
}
return get... |
07bd9763-c68d-4be2-b44d-d13d66c57d97 | 3 | private void jBtnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnDeleteActionPerformed
// TODO add your handling code here:
try {
String sql = "DELETE FROM productos_has_pedidos WHERE pedidos_idpedidos = ? AND productos_idproductos = ? ";
String sql1 ... |
148ada43-5e8c-447f-8724-f331f09a7fb6 | 2 | private void createGameSelector(java.util.List<GameToSelect> gamesToSelect) {
JPanel container = new JPanel(new FlowLayout());
final JComboBox<GameToSelect> combo = new JComboBox<GameToSelect>();
combo.setSize(100, 20);
for(GameToSelect gameToSelect : gamesToSelect)
combo.ad... |
4a5f8f2c-80d5-4b06-950a-80d951cbfc75 | 2 | public boolean crearConexion(String db) {
boolean encontrado = false;
if (db.equals(ControladorServidor.BD_PERSONAL)) {
factory = new ConnectionFactory(
ControladorServidor.ARCHIVO_POSTGRESQL);
System.out.println("DEBUG: Creada connectionFactory con Postgres!");
encontrado = true;
} else if (db.equa... |
5d49fb68-f5df-4001-bdaf-e7743dc62b96 | 0 | @Override
public String toString() {
return "[Object of " + getClass().getName() + "]";
} |
e9332cef-47b6-4a8b-bcc8-dc56d75fe9b8 | 9 | @Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
System.out.println("Move up");
break;
case KeyEvent.VK_DOWN:
currentSprite = characterDown;
if (robot.isJumped() == false) {
robot.setDucked(true);
robot.setSpeedX(0);
}
break;
case KeyEven... |
69344007-1267-4a4f-88c7-c1576b4a7696 | 8 | public boolean IsSimilarTo(Cluster other, double overlapDegree) {
assert(other != null);
// ------------------------------------------------
// Find the common documents. If there are only a few documents,
// a linear search is used; otherwise the search uses a hash table.
int co... |
65ae4c1c-d8a5-4f5d-9707-16de80a0227c | 5 | public static void main(String args[]) {
Game g = new Othello();
Timer t = new Timer(g);
Timer t2 = new Timer(null);
t.setHours(t.m_hour_test);
if (t.getHours() == t.m_hour_test) {
System.out.println("Hour Set Success " + t.getHours());
}
t.setMinutes(t.m_minute_test);
if (t.getHours() == t.m_minute... |
ea2f826a-3b9e-433d-bc20-27a1f171f088 | 6 | public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
switch (getDirectionMeta(var5))
{
case 0:
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F... |
63cd711a-b6a8-4d22-a5bf-d689531bf775 | 1 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
long day = Long.parseLong(params.get("timestamp"));
day = DateUtil.getStartOfDay(day);
rtn.put("rtnCode", this.getRtnCode(200));
List<Appointment> aAppt = Appointment.f... |
299d4250-fa50-4e66-9584-514a55f43f3d | 2 | public boolean isInCorrectFormForConversion(Automaton automaton) {
if (hasSingleFinalState(automaton)
&& hasTransitionsInCorrectForm(automaton)) {
return true;
}
return false;
} |
d6096668-f700-4438-b5ee-230bbaaaa69a | 4 | public void FillRectW(int X, int Y, int H, int W, byte with)
{
for (int i1 = Math.max(X,0); i1 < Math.min(X+W,w); i1 ++)
{
for (int i2 = Math.max(Y,0); i2 < Math.min(Y+H,h); i2 ++)
{
if (cellData[i1][i2]!=CRYSTAL&&cellData[i1][i2]!=ETHE... |
63053cb9-2a00-4c60-ae27-a68e59508b0d | 9 | private void file_search(String nickname, String query) throws IOException {
/* (Re)build list of files in directory */
File directory = new File(folder);
if (!directory.isDirectory()) {
gui.update("[Client] ERROR: Not a directory.");
return;
}
if (directory.listFiles().length == 0 || !open) {
retu... |
f0e0a80b-2185-44d3-bd31-cdf1c33aeb6c | 5 | public byte[] read(int begin, int length) throws IOException {
if (!isAvaiable(begin, length)) {
throw new EOFException("Data not available " + "begin: " + begin + " length: " + length);
}
int filePieceIndex = findFilePieceIndex(begin);
FilePieceMapper filePiece = files.get(... |
ed92c013-284a-498c-b77d-65e3c287a431 | 3 | private Token tokenFromXml(int status, String content) {
Token token = new Token();
try {
Error error = errorFromXml(status, content);
if(error != null) {
token.setError(error);
return token;
}
JAXBContext context = JAXBContext.newInstance(Hash.class);
Unmarshaller unmarshaller = cont... |
5c55e9ab-f1bb-4741-b066-c1d4d0d5f71a | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
94072c43-0990-4a5d-8649-d90abb3b378b | 2 | public void initConnection()
{
//---Get Connection----
try
{
//JNDI Lookups for connection to database through JDBC
Context ic = new InitialContext();
datasource = (DataSource) ic.lookup("java:comp/env/" + DATA_SOURCE_NAME);
connection = datasource.getConnection();
}
catch (NamingExceptio... |
ced64617-efbd-4ff7-8238-48a0d2b31844 | 9 | private void applyHighlighting(String content, int line) throws BadLocationException {
int startOffset = rootElement.getElement(line).getStartOffset();
int endOffset = rootElement.getElement(line).getEndOffset() - 1;
int lineLength = endOffset - startOffset;
int contentLength = content.... |
3637ab5b-a9a7-4bff-a7b4-a7c753f7e14e | 7 | synchronized void startLogging() {
if (fLoggingEnabled)
return;
//
// If the first log file doesn't exist or its content length is 0,
// then don't shit files. [V1.85]
//
if (!fFiles[0].exists() || readContent(0).length() == 0)
fFiles[0].delete();... |
93aeae8d-f23f-4616-947c-ebb599df5e78 | 0 | public Wrapping(int x) {
i = x;
} |
ac670d1a-4508-457c-853f-99cf1443396a | 8 | public double Cldj(int iy, int im, int id) throws palError {
long iyL, imL;
/* Month lengths in days */
final int mtab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
TRACE("Cldj");
/* Validate year */
if (iy < -4699) {
Status = 1;
throw n... |
3ff99dce-104f-4708-8fa6-04d353c92220 | 2 | public SimpleFind(String args[]) {
// Get input from the console
String startingPath = ConsoleTools.getNonEmptyInput("Enter starting path: ");
String query = ConsoleTools.getNonEmptyInput("Enter string to find: ");
String[] fileExtensions = ConsoleTools.getSeriesOfInputs("Enter file extension to match: ");
... |
77b3d181-bf14-4dc1-930d-eebc93fe80d5 | 2 | public static void stop(String s) {
if (clips.get(s) == null)
return;
if (clips.get(s).isRunning())
clips.get(s).stop();
} |
25b4b9d6-c313-4007-8f85-41a7dacd6f3a | 2 | public Boolean teamIDExists(String userTeam, String userMatch){
try {
cs = con.prepareCall("{call GET_TEAMID(?,?)}");
cs.setString(1, userTeam);
cs.setString(2, userMatch);
if(!cs.executeQuery().next()){
return false;
}
} catch (SQLException e) {
e.printStackTrace();
}
return true;
} |
e38a5664-9827-47ed-8a2f-8de562930689 | 8 | private void assignStudentToCourse(Scanner sn) {
sn = new Scanner(new InputStreamReader(System.in));
Student newStudent = new Student();
System.out.print("Student first name: ");
String firstName = sn.next();
System.out.print("Student last name: ");
String lastName = sn.next();
System.out.print("Student i... |
8746c28a-ddae-4aae-92e2-0c935eac2d90 | 5 | void setGreen(States newState, int duration) {
if (currentState == NONE) {
if(!constructionRoad.isEmpty()) {
Iterator<Pair<States,Car>> iter = constructionRoad.values().iterator();
iter.hasNext();
if(newState == iter.next().getKey(... |
9f090866-a61c-4942-80ae-116460dc4242 | 7 | public Creature(int t) {
super(true, 0);
type = t;
if(type == 1){
ManaCost = 2;
attack = 1;
toughness = 1;
Name = "Pig";
Description ="This is a Pig, it has 1 attack and 1 toughness. It has the ability 'Floop to disable Corn'.";
} else if(type == 2){
ManaCost = 2;
attack = 1;
toughness =... |
216e0c9e-76a3-420e-971b-974f4fd750b2 | 7 | @EventHandler(priority = EventPriority.MONITOR)
public void onSignBreak(BlockBreakEvent event) {
Material block = event.getBlock().getType();
Player player = event.getPlayer();
if ((block.equals(Material.SIGN_POST)) || (block.equals(Material.WALL_SIGN))) {
Sign sign = (Sign) event.getBlock().getState();
St... |
14158687-2154-4856-aa3c-fb8da29aee86 | 2 | private int readZoomHeaders(SeekableStream fis, long fileOffset, int zoomLevels, boolean isLowToHigh) {
int level = 0;
BBZoomLevelHeader zoomLevelHeader;
if(zoomLevels < 1)
return 0;
// create zoom headers and data containers
zoomLevelHeaders = new ArrayList<BBZoomL... |
f52c3bf1-440b-4cf1-ba13-809fb7f6d3b0 | 2 | @Override
public boolean isSoundbankSupported(Soundbank soundbank) {
for (Synthesizer s : theSynths)
if (!s.isSoundbankSupported(soundbank))
return false;
return true;
} |
9a04704b-24dc-4d7d-b5ea-dd73be1d7617 | 8 | public int getSearchCount(String colName, String search) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuilder sb = new StringBuilder();
sb.append("select count(*) from member where ");
sb.append(colName);
sb.append(" like '%");
sb.append(search);
sb.append("%'")... |
4f9d6437-7812-4b36-956d-fb0b2b7dc6c7 | 3 | private static List<TimeSerie> getNeighboursWithinRange(int index) {
List<TimeSerie> neighbours = new ArrayList<TimeSerie>();
for (int i = 0; i < distanceMatrix.length; i++) {
if (i != index) {
double distance = distanceMatrix[index][i];
if (distance < eps) {
neighbours.add(timeSeries.get(i)... |
e23f45b1-bb62-49fc-bf8d-6aee0310f4a4 | 1 | @Override
public void endConnecting() {
if( itemShown ){
parent.removeItem( line );
}
itemShown = false;
} |
9e0068fd-b9b9-45c2-8c84-586674d9c59b | 0 | public Object clone() {
return new Animation(frames, totalDuration);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.