method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d6c506c0-e800-429e-992c-028b7c34373e | 6 | @EventHandler
public void PlayerFireResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getPlayerConfig().getDouble("Player.... |
f366bee0-69eb-4ee8-bb5b-379a4e808649 | 1 | public void load() {
try {
FileInputStream in = new FileInputStream(settingsFilePath);
properties.load(in);
in.close();
} catch (IOException e) {
//settings file not found - using defaults
}
} |
d6714cbe-3b78-416b-9276-30332cd47e7d | 3 | public RAFFile replaceRessource(String input) throws IOException {
RAFFile retVal = null;
outtaloop:
for(Map.Entry<String,ArrayList<RAFFile>> file : archives.entrySet())
{
for(RAFFile rafFile : file.getValue())
{
if(rafFile.searchForRessource(inpu... |
32b26600-56ec-4fc9-bbf4-c1e508d36b40 | 6 | private static BeanstreamResponse fromJson(int httpStatusCode, String jsonPayload, MediaType responseType) {
JsonParser parser = new JsonParser();
JsonObject json = parser.parse(jsonPayload).getAsJsonObject();
BeanstreamResponseBuilder builder = new BeanstreamResponseBuilder();
builder... |
180def89-97bb-4d1b-856f-532e0d538d24 | 7 | private static long getMinimaOfAND(long[] arr) {
int maxLen = 0;
String[] bin = new String[arr.length];
for (int i = 0; i < arr.length; i++) {
bin[i] = Long.toBinaryString(arr[i]);
if(bin[i].length() > maxLen) {
maxLen = bin[i].length();
}
... |
93a28f6d-d55b-44c9-b20d-aa8796e22ae6 | 3 | public static String splitLabel(String conceptRole) {
int indeX = 0;
String conceptName = "";
if (conceptRole.length() > 10) {
for (int i = 0; i < conceptRole.length(); i++) {
if (Character.isUpperCase(conceptRole.charAt(i))) {
indeX = i;
}
}
conceptName = conceptRole.substring(0, indeX);
... |
3f2b0e14-1fa2-4f2c-ae4f-28b549d60c44 | 9 | private Annotation addAnnotationValueHelper(String property, URI nameSpaceURI, boolean propertyIsRel) {
AnnotationImpl annotation = new AnnotationImpl(getDocument());
if ( null == property ) {
return null;
}
String[] curie = property.split(":");
if ( propertyIsRel ) {
... |
29f60adf-994e-4a0d-9d7e-3d37ff7505b1 | 1 | public AbstractCarriage(int id) throws CarriageException {
if (id >= 0)
this.ID = id;
else
throw new CarriageException("Id is under zero");
} |
e07671e5-6bc0-4123-bdd4-32b4504838ee | 7 | @Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final NamingInfo other = (NamingInfo)obj;
i... |
4348147e-5721-4cf4-9a75-92f53e85644c | 1 | public boolean isNumber() {
return !this.getContent().equals("#") || !this.getContent().equals("0");
} |
7ffaf14a-21ac-49bf-b5d9-20636185c268 | 8 | public boolean publishShpCollection(String workspace, String storeName, URI resource)
throws FileNotFoundException {
// Deduce upload method & mime type from resource syntax.
UploadMethod method = null;
String mime = null;
if (resource.getScheme().equals("file") || resource.... |
e6a12523-a62a-4016-8f83-c33abb70c367 | 5 | public ArrayList<MeetingInvite> getAllMeetingInvitesFromDatabase(){
ArrayList<MeetingInvite> meetingInvites = new ArrayList<>();
ArrayList<HashMap<String, String>> meetingInvites_raw = mySQLQuery.getAllRows("MeetingInvite");
for(HashMap<String, String> meetingInvite_raw : meetingInvites_raw){
... |
3a963791-e08a-4919-9b12-de6ef23a484a | 6 | public void parseFile(String xmlFile, String dtdFile)
throws IOException {
BufferedReader br = new BufferedReader(new FileReader(path + xmlFile+".xml"));
BufferedReader br1 = new BufferedReader(new FileReader(path + dtdFile+".dtd"));
FileWriter fw = new FileWriter(path + "temp111.xml");
BufferedWriter bw = ... |
143ae594-831b-4b60-94c7-3a0ebbcba557 | 3 | public static Obstacle[][] readConfCsv(int n){
String path = "conf/confLevel"+ n +".csv";
Obstacle[][] obs = new Obstacle[Obstacle.confLines][];
InputStreamReader isReader= new InputStreamReader(Obstacle.class.getClassLoader().getResourceAsStream(path));
try (BufferedReader reader = new BufferedReader(isRe... |
1434ffb4-e1d3-4aaa-903a-b3ac0ab7c21e | 0 | public LocalDate getDepartureDate() {
return this._departureDate;
} |
b4bbce5d-1334-4d9c-9f2a-7689170f8991 | 7 | protected void setFieldValue(Object obj, String fieldname, Object value)
{
Field field = null;
try
{
field = getField(obj, fieldname);
if (field != null)
{
if (field.getType() == Boolean.class)
{
value = (value.equals("1") || String.valueOf(value)
.equalsIgnoreCase("true")) ? Boole... |
179d6832-7602-4a35-a958-2c1cdf8b7be5 | 9 | private Point getPointForLocation(int location) {
Point p = new Point();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
switch (location) {
case TOP_LEFT:
p.x = 10;
p.y = 30;
break;
case TOP:
p.x = (screen.width - 270) / 2;
p.y = 30;
break;
case TOP_RIGHT:
p.x = screen.... |
e4803163-42d6-4208-8f1a-1403b4b8c47e | 6 | public void Update(double timestamp, double duration, float[] magnitudes, float[] phases){
final GraphicsContext context = display.getGraphicsContext2D();
display.setWidth(width);
display.setHeight(height);
context.setFill(backgroundColor);
context.fillRect(0, 0, display.getWidth(), displa... |
021ce636-f3f8-4a45-a2f1-384b64d2a7e3 | 2 | public boolean isPushLambdaTransition(Transition transition) {
PDATransition trans = (PDATransition) transition;
String toPush = trans.getStringToPush();
if (toPush.length() != 0)
return false;
/*
* String input = trans.getInputToRead(); if(input.length() != 1) return
* false;
*/
String toPop = tr... |
ee6d39b1-6d53-4741-85a3-fbf6a448fe66 | 6 | protected boolean isValid(){
if (hasCharacter()){
if (!characterData.isValid()){
return false;
}
}
for (TileObjectDisplayData data : itemData){
if (!data.isValid()){
return false;
}
}
for (TileObjectDisplayData data : edgeData.values()){
if (!data.isValid()){
return false;
... |
96fcdaff-2275-4c30-8e5a-c8f9010b1813 | 3 | public static boolean cancelDownload()
{
try
{
if(is != null) is.close();
if(os != null)
{
os.flush();
os.close();
}
return true;
}
catch(Exception e)
{
return false;
}
} |
cd9cb1f3-7ad6-46c9-9d74-ff9ed83e0272 | 3 | protected static boolean isAList(String text) {
String arr[] = Util.splitByNewLineSign(text);
for (int i = 0; i < arr.length; i++) {
if (arr[i].length() != 0) {
if (isAListChar(arr[i].charAt(0)) == true) {
return true;
}
}
... |
cb88df40-2a2a-46a9-8108-b3cf48ac61ff | 5 | public ConcordiaMembers searchMember(String firstName, String lastName, String concordiaID){
for(ConcordiaMembers member: concordiaMembers){
if(member!=null){
if(member.getFirstName().equals(firstName) && member.getLastName().equals(lastName) && member.getConcordiaID().equals(concordiaID)){
return member... |
aa52b417-e5eb-4bca-8d5d-021090f0df33 | 4 | public static boolean isOperator(String token) {
if ("+".equals(token) || "-".equals(token)
|| "*".equals(token) || "/".equals(token))
return true;
return false;
} |
2992be8a-ba8d-45b2-bf6d-b4133f96f95a | 8 | public void checaProyectilChocaConBricks(){
for (Object lstCaja : lstCajas ){
Brick briCaja = (Brick) lstCaja;
if (briCaja.getEstado() < 3){
if (briCaja.colisionaAbajo(proBola)){
proyectilChocaArriba();
briCaja.setEstad... |
0932b3cd-2d20-47d6-b473-3a8e5d234571 | 5 | private Vector<Vector<String>> getWQLEventNode(String xml,String ParamAttValue)
{
if(xml==null){System.out.println("ERROR:SSAP_XMLTools:getWQLEventTriple: XML message is null");return null;}
Element parameters = getParameterElement(xml,"name", ParamAttValue);
if(parameters==null){System.out.println("ERROR:SSAP_... |
bd8b830f-ca7d-443c-ad3a-3175159d82b8 | 5 | @SuppressWarnings("rawtypes")
public static void printMap(Map map, int depth)
{
final Iterator i = map.keySet().iterator();
Object key = null;
for (int k = 0; k < depth; k++)
System.out.print(" ");
System.out.println("Dictionary:");
while (i.hasNext() && (key = ... |
eeee3534-ada8-4958-8a02-266e2daf472b | 2 | public List<Element> getElementsOnPosition(Position position) {
List<Element> posElements = new ArrayList<Element>();
for (Element element : elements) {
if (element.getPositions().contains(position))
posElements.add(element);
}
return posElements;
} |
ecb740a4-43da-4e63-a2d7-e2f361885120 | 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://down... |
8eefe0b2-a878-47be-8b0f-1859be48012b | 0 | public static void quitter() {
System.exit(0);
} |
e8869b75-bbd3-43d8-a55b-f04ffef44e49 | 1 | public void displayAccounts()
{
Hashtable<Integer, Customer> copy = Database.getCustomers();
Set<Integer> keys = copy.keySet();
System.out.println("Bank " + bankID + " Accounts:");
for(Integer key: keys)
{
System.out.println(copy.get(key));
}
} |
007d0b0d-e0c8-4f23-b384-19de465958e5 | 6 | public fightermakerView(SingleFrameApplication app) {
super(app);
current_move=null;
current_sprite=null;
x=0;
y=0;
listOfMoves_main_file=null;
listOfMoves_sprites_file=null;
hitbox_color_selected="";
hitbox_inde... |
9340a7e5-f6b1-48b0-aff1-16c9bee5c692 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
2d81c33e-959e-4d8d-84f1-5bc1c9e79162 | 5 | public static void findTheUglyNumber(int n){
if(n==0){
return;
}
int count = 0;
int[] res = new int[n];
int t2=0,t3=0,t5=0;
res[count] = 1;
while(count < n-1){
while(res[t2] *2 <= res[count]){
t2 ++;
}
while(res[t3]*3 <= res[count]){
t3 ++;
}
while(res[t5]*5 <= res[count]){
t... |
0ac07ff8-c647-46f3-a250-410833bec92e | 1 | private void loadImage(String path) {
try {
Image img = new Image(path);
img.setFilter(Image.FILTER_NEAREST);
spriteSheet = new SpriteSheet(img, x, y);
} catch (SlickException e) {
System.out.println("Cannot find Image for SpriteMap!...or maybe there's a ... |
ab27c3da-ec94-4338-872b-7a66dbaa89cd | 1 | @Override
public void run() {
HashSet<Outline> outlines;
synchronized (OUTLINES) {
PENDING = false;
outlines = new HashSet<>(OUTLINES);
OUTLINES.clear();
}
for (Outline outline : outlines) {
outline.sizeColumnsToFit();
outline.repaint();
}
} |
653ea549-3d54-48a2-8113-5897a48c0b38 | 8 | private String compute(String num1, String operation, String num2) {
double value1;
double value2;
double answer = 0;
if(num1.indexOf('e') >= 0) {
String[] parts = num1.split("e");
value1 = Math.pow(Double.parseDouble(parts[0]), Double.parseDouble(parts[0]));
}
else {
value1 = Double.parseDo... |
a60f7ceb-a7a7-4710-bc01-f7b158165693 | 5 | @Override
public void draw(Graphics g) {
g.setColor(new Color(0, 0, 0, 30));
g.fillRect(0, 0, width, height);
g.setColor(new Color(20, 20, 20));
for (int i = 0; i < width; i += 50) {
for (int j = 0; j < height; j += 50) {
g.fillRect(i, j, 5, 5);
... |
a8b19b40-1672-4323-af94-7aadd6209829 | 2 | public ChatChannel createAndJoinChannel(ChatChannel chatChannel, User user){
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String insertIntoC... |
959fef2d-6817-4706-9c13-a3b71c364b8b | 0 | final public double getConfidence() {
// should be 1.0 if this node supposedly represents a "fact", or 0 > n > 1 if it is known to be a guess
return 1.0;
} |
9bde173c-a5eb-462e-aa47-58f2c7311d2a | 7 | public ArrayList getUnsynchronizedComponents() {
YIComponent view = controller.getView();
Object model = controller.getModel();
ArrayList result = new ArrayList();
try {
ArrayList comps = YUIToolkit.getViewComponents(view);
Iterator it = comps.iterator... |
b889c0bd-a828-4f68-b62d-5505a0d84cc9 | 3 | @Override
public void setPlayers(RobPlayerInfo[] candidateVictims) {
victims = candidateVictims;
int numberOfPlayers = 0;
if(candidateVictims != null)
numberOfPlayers = candidateVictims.length;
if(numberOfPlayers != 0){
this.remove(buttonPanel);
buttonPanel = new JPanel();
buttonPanel.setBord... |
07fe972d-2584-4d1e-b414-d24b1b1a7860 | 9 | public static int computeRawVarint64Size(final long value) {
if ((value & (0xffffffffffffffffL << 7)) == 0) return 1;
if ((value & (0xffffffffffffffffL << 14)) == 0) return 2;
if ((value & (0xffffffffffffffffL << 21)) == 0) return 3;
if ((value & (0xffffffffffffffffL << 28)) == 0) return 4;
if ((va... |
7c318ae7-e0c7-4a43-9ebf-441a66d54e68 | 6 | public void controlUpdate(float tpf){
super.update(tpf);
System.out.println("4444 works");
if(spatial != null && target != null) {
// Implement your custom control here ...
// Change scene graph, access and modify userdata in the spatial, etc
if(target.getUser... |
659b694c-8bbd-482e-81ab-fdb38a151199 | 0 | public double getOpacite() {
return opacite;
} |
297d71fd-7c3a-406c-b3cf-1e6d88453337 | 1 | public boolean equals(Object o)
{
try
{
return toString().equals(((Case)o).toString());
}
catch(ClassCastException e)
{
return false;
}
} |
98f680fe-ef3c-47a7-9d5d-5561615c7c3e | 7 | public static Method getMethod(String name, Class<?> clazz, Class<?>... paramTypes) {
Class<?>[] t = toPrimitiveTypeArray(paramTypes);
for (Method m : clazz.getMethods()) {
Class<?>[] types = toPrimitiveTypeArray(m.getParameterTypes());
if (m.getName().equals(name) && equalsTypeArray(types, t))
return m;
... |
fda67d88-96f7-47f9-96e3-5c72054d9012 | 8 | private void setListener() {
rBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
showCourseTable();
}
});
infoTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
int selectRowNum = infoTable.getSelectedRow();
int clic... |
a0901815-2f6d-4efd-a793-9ab9f62c358a | 9 | private void updateEngine(double delta) {
//time related things must be multiplied by delta
//non time related ignore delta
//draws tiles
Tile[][] viewTiles = new Tile[20][15];
for (int x = 0; x < 20; x++) {
for (int y = 0; y < 15; y++) {
if ((x + (... |
5eda3fb6-abce-4a86-a1f4-7d2edfaa1490 | 2 | protected Object convertNullSource(Class<?> sourceType, Class<?> targetType) {
return null;
} |
3234e66c-bae1-49fd-9f5e-237b024b8084 | 3 | public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (this.opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
this.put(key, value);
}
return this;
} |
5c15e9b8-85eb-4718-a540-377f551bc9cb | 3 | public void run()
{
while(true)
{
try
{
if(this.task != 0)
{
System.out.println("Worker " + this.getId() + " Task left : " + this.task);
this.task--;
Thread.sleep(500);
}
else
{
notifyAll();
wait();
}
}
catch (InterruptedException e)
{
... |
81abd28d-5cc9-4a26-8846-54278c147f5d | 1 | public CycSOAPService() {
System.out.println("CycSoapService");
if (Log.current == null)
Log.makeLog("cyc-soap-service.log");
} |
aad49abd-bdcd-43b7-bbf7-4d1c81de8032 | 1 | public void run() {
for (int i = 1; i <= ConcurrentHashMapDemo.NUMBER; i++) {
map.get(key);
}
synchronized (lock) {
counter--;
}
} |
92f27a59-191e-4e30-b4aa-a795a0d0dc21 | 0 | @Test
public void testDecrementFood() {
System.out.println("removeFood");
Cell instance = new Cell(0,0);
instance.setFood(100);
instance.decrementFood();
int expResult = 99;
int result = instance.getFood();
assertEquals(expResult, result);
ins... |
55c8eda0-9fec-4acb-8857-d843a9339954 | 8 | private static IProjectEventListener generateIProjectEventListener(final List<ExternalFinderItem> finderItems) {
return new IProjectEventListener() {
private final List<Component> menuItems = new ArrayList<Component>();
@Override
public void onProjectChanged(final IProjectEv... |
935a8206-c015-44d1-ba38-067639a937df | 7 | private String makeCookie(String id, HttpServletRequest request) {
Cookie cookies[] = request.getCookies();
String bookHistroy = null;
// System.out.println("length: "+cookies.length);
for(int i = 0; cookies != null && i < cookies.length; i++){
System.out.println("length_for: "+cookies.length);
if(cookie... |
303b4186-b5b9-471d-acf9-8077109feeee | 8 | public static Cons kifBiconditionalToTwoImplies(Cons tree) {
if (tree.length() > 3) {
{ OutputStringStream stream000 = OutputStringStream.newOutputStringStream();
{ Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
try {
Native.setBooleanSpecial(Stella.$PRINTREADAB... |
b7957d48-a489-4735-a4ca-4a74e52e6afc | 3 | public UsuarioBean get(UsuarioBean oUsuarioBean) throws Exception {
if (oUsuarioBean.getId() > 0) {
try {
oMysql.conexion(enumTipoConexion);
if (!oMysql.existsOne("usuario", oUsuarioBean.getId())) {
oUsuarioBean.setId(0);
} else {
... |
7e89dd61-f9fa-4272-91a1-234761dc5c92 | 5 | public String toString() {
try {
java.io.StringWriter strw = new java.io.StringWriter();
TabbedPrintWriter writer = new TabbedPrintWriter(strw);
writer.println(super.toString() + ": " + addr + "-"
+ (addr + length));
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_INOUT) != 0) {
writer.pr... |
1cbb80ce-d202-470d-863c-2cf61045921d | 9 | private boolean askLevelPlayer(){
attempts = 0;
boolean LevelSelected = Boolean.FALSE;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(!LevelSelected){
try{
System.out.println("Welcome to play hangman of South American Countries");
System.out.println("Enter a number... |
389f8795-80e6-4995-9982-7f7fbcc71cbc | 8 | @Override
public void run() {
int regen_marker = stamina;
while(true){
if(health >= 1){ //hunts
if(!hunt()){
wander();
}
}
else{
wander();
}
if(stamina > stamina_stat *2){ //reproduces
reproduce();
}
stamina--; //loses energy and h... |
f6fada4f-5048-4ff3-bc4d-1a93e4667436 | 0 | public int tamanho()
{
return this.quantasContas;
} |
63cadf89-a7ac-48c2-9bfb-3a57902350c2 | 9 | @Override
public boolean equals( Object o )
{
if( this == o )
return true;
if( o == null || getClass() != o.getClass() )
return false;
ComplexImmutableObject that = ( ComplexImmutableObject )o;
if( initialValue != that.initialValue )
return false;
if( strict != that.strict )
return false;
if... |
7465ce6e-700b-4cb1-8a5f-b5eb4357a19f | 7 | private void tick() {
mLat = mLat + mDY;
mLon = mLon + mDX;
sendPacket();
segTraveledDistance += distPerTick;
if (segTraveledDistance >= segDistance) {
// start next segment or end
if (!mPath.isEmpty()) {
Vertex v = mPath.get(0);
mPath.remove(0);
if (v instanceof Vertex) {
updateMoti... |
b05b1aa1-59fc-4c01-afdf-421faf1ca7e0 | 0 | public static byte[] ElgamalEncrypt(String key, BigInteger y, BigInteger k, BigInteger p) throws Exception {
BigInteger m = new BigInteger(key, 16);
//encrypt c = (m + y^k)(mod p)
BigInteger c = m.add(y.modPow(k, p)).mod(p);
return Utilities.toBytes(c);
} |
2637ceb1-b3f3-48c9-a6c1-b36888452693 | 5 | public static Rank parseLine(Line line) {
if (line.equals("owner"))
return Owner;
else if (line.equals("admin"))
return Admin;
else if (line.equals("mod"))
return Mod;
else if (line.equals("friend"))
return Friend;
else if (line.equals("producer"))
return Producer;
else
return ... |
ec9f7e50-10c3-4cff-894c-8aa36053f7f5 | 4 | public void IniciarOtello()
{
q5 = new Query("consult", new Term[] {new Atom("C:/Users/Luan Cardoso/Documents/NetBeansProjects/Otello/eval.pl")});
System.out.println( "consult2 " + (q5.query() ? "succeeded" : "failed"));
q2 = new Query("consult", new Term[] {new Atom("C:/Use... |
05ce320b-6490-4ac9-a371-3c9454cf64e5 | 5 | private boolean hasAcceptableContenType() {
List<String> contentTypes = getAcceptableContentTypes();
if (contentTypes != null) {
if (contentTypes.isEmpty()) {
return true;
}
String currentContentType = getContentType();
if (currentContent... |
954a8af3-abf9-430d-afe4-c925c7f62e82 | 8 | public void openFile() {
if(jfc.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
File newFile = jfc.getSelectedFile();
if(!newFile.exists()) {
JOptionPane.showMessageDialog(frame, newFile.getName() + " does not exist.");
return;
} else if(!newFile.equals(projFile)) {
int save = JOptionPane... |
5639d684-3998-4b12-bf21-5599539ef4fb | 0 | public final byte getMetadata(){return (byte)((((char)(data << 12)) >>> 12));} |
2e02f964-b2e6-49ca-82b3-961d105af713 | 0 | public ForAllTestCases(final Xpp3Dom results) {
this.results = results;
} |
046a6798-874d-4a7c-92cf-e66ed1848eca | 8 | public static Level levelToJUL(org.apache.logging.log4j.Level lvl) {
switch (lvl) {
case OFF:
return Level.OFF;
case FATAL:
case ERROR:
return Level.SEVERE;
case WARN:
return Level.WARNING;
case INFO:
return Level.INFO;
... |
2a5a1ed7-db00-419e-b7c5-52a0f9499ce9 | 6 | static public void DeleteObject (int ActiveObj, int ListTypeControl){
System.out.println("Deleting..");
if (ListTypeControl == 0){
// ## REBUILD ARRAY...
Customer[] ActiveCustomerArray = new Customer[Globals.ATA.CustomerArray.length-1];
// Everything before that object for deletion
... |
af781e34-6b49-444a-8e51-50c3fb78642a | 7 | public static void main(final String[] args)
throws IOException {
File polyCmd;
File driverPath = null;
try {
driverPath = PointGroupsUtility.getPolymakeDriverPath();
}
catch (FileNotFoundException e) {
final String err =
"Standard set-up of project was changed!\n"
... |
fa07aa28-075f-4785-8f99-b89940697c8b | 2 | public static PermissionRelationship getPermissions(ChunkyObject object, ChunkyObject permObject) {
if (!permissions.containsKey(object)) {
permissions.put(object, new HashMap<ChunkyObject, PermissionRelationship>());
}
HashMap<ChunkyObject, PermissionRelationship> perms = permission... |
9bd8d114-84be-4d3f-a417-3dfee6e4ca7e | 3 | public void run(){
try{
BufferedInputStream buf = new BufferedInputStream(is);
InputStreamReader inread = new InputStreamReader(buf);
BufferedReader bufferedreader = new BufferedReader(inread);
String line;
while ((line = bufferedreader.readLine()) != null) {
if(isErr){
... |
b621d056-b630-4e52-9109-bf0baa157e6b | 5 | private void updatePath(float x, float y) {
closedPath = null;
if (path == null) {
path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
path.moveTo(x, y);
bounds = new Rectangle2D.Float(x, y, 0, 0);
} else {
path.lineTo(x, y);
float _xmax = (float)bounds.getMaxX... |
71ed0804-1834-4a27-8abd-fdaa8959ff48 | 6 | @Override
public void run ( )
{
while ( this.running && this.application.isRunning ( ) )
{
try
{
if ( ! this.application.isPaused ( ) )
{
String urlString = this.application.getLinkManager ( ).getNextUnvisitedLink ( ) ;
if ( urlString != null )
{
Document document = J... |
8ee84dca-88ff-4be6-9bc0-5335a988c5b7 | 7 | public int read(byte[] output, int maxReadLength)
{
// Make sure there are enough bytes to read, if not then pause until there are.
// Note: we don't have to worry about bytes in the middle of the range being false and reading those by accident
// The loop that reads bytes (see the synchroni... |
752e0803-e55b-4192-ad7f-1af21b4f6b09 | 4 | @Override
protected
void parseSelf(Document doc) throws ProblemsReadingDocumentException {
trackCounter = 0;
List<Element> imgList = queryXPathList("//pre:div[@id='tralbumArt']//pre:img", doc);
if (imgList.size() > 0) {
try {
coverUrl = resolveLink((imgList.get(0)).getAttributeValue("src"));
} catch... |
a60da85f-c161-4940-86f5-9a1e1cdd059f | 2 | public boolean isSpare() {
if (first + second == 10 && first != 10)
return true;
else
return false;
} |
d481ec59-205f-4306-b655-86efc4875794 | 4 | @Override
public void execute(double t) {
Matrix y = new ColumnMatrix(output.getDim());
if (pi.isConnected()) {
if (mi.isConnected()) {
y = mi.getInput().times(-1);
y = y.plus(pi.getInput());
} else
y = pi.getInput();
} else {
if (mi.isConnected())
y = mi.getInput().times(-1);
}
try ... |
9076d807-2689-46a4-9d48-42eea7f364f3 | 3 | public JSONObject accumulate(String key, Object value)
throws JSONException {
testValidity(value);
Object object = opt(key);
if (object == null) {
put(key, value instanceof JSONArray ?
new JSONArray().put(value) : value);
} else if (object inst... |
a1ba6baf-8c81-4820-ad80-1518e01ecd0e | 9 | public boolean bufferKestrelGet(int index) {
assert _emitBuffer.size() == 0; // JTODO
KestrelClientInfo info = _kestrels.get(index);
long now = System.currentTimeMillis();
if(now > info.blacklistTillTimeMs) {
List<Item> items = null;
try {
items ... |
c34cd2b0-f3e1-4879-a3f6-be47bd649e89 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Attribute other = (Attribute) obj;
if (!name.equals(other.name))
return false;
return true;
} |
b34257ef-6d6e-4741-80ba-d10b7a53ce6b | 8 | public static void makeIndex(String fileName){
try {
BufferedReader br=new BufferedReader(new FileReader(fileName));
Pattern P = Pattern.compile("(<<<)(.*)(>>>)");
String tempLine = new String();
String url = new String();
List<String> wordsInPage = new LinkedList<String>();
int pageNumber ... |
100b0c45-3c60-47ab-b2ef-dd28004d25d2 | 2 | public void updateTransformation(double[][] newTransf, boolean updateCenter) {
transformation = TransformationManager.matrixMultiplication(transformation, newTransf);
double[][] coord = center.getTransformedCoordinates();
double[][] t = TransformationManager.translation3D(-coord[0][0], -coord[0][1], -coord[0][2])... |
a8aa7f4b-6625-400e-ad2c-dbff1ca8b6ea | 1 | @Test
public void toString_test() {
try{
double [][]mat= {{1.0,2.0}, {3.0,1.0}};
String matStr = Matrix.toString(mat);
String expStr=(" 1.0 2.0\n"+
" 3.0 1.0\n");
Assert.assertNotSame(matStr, expStr);
}
catch... |
e5b0e7a3-cc21-4e2e-a029-b264aeb21172 | 9 | protected void backward(DatasetExample example) {
int size = example.size();
// Initialize the beta[size-1] values.
Vector<Double> last = beta.get(size - 1);
if (tagged[size - 1]) {
// Zero to every state.
for (int state = 0; state < numStates; ++state)
last.set(state, 0.0);
// Get the correct st... |
4b73adbb-586c-41f1-9b80-9f1279c56b28 | 3 | private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
/*Obtenemos el prov seleccionado de la tabla:*/
Proveedor proveedorQueSeEliminara = obtenerInformacionDeRenglonSelecccionado();
//checamos si se seleccionó algún prov de la tabl... |
eb43e23b-332a-4609-b244-c2164337f84a | 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://down... |
710c07c6-ff33-4476-806c-505531fa1f99 | 2 | @Override
public String toString() {
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < headers.length; i++)
buffer.append(headers[i] + "\t");
buffer.append("\n");
for (final SoldItem item : rows) {
buffer.append(item.getId() + "\t");
buffer.append(item.getName() + "\t");
buffer.... |
ada42199-e0a7-46a2-aa31-095aebec4a17 | 2 | public void nouveauTour(){
for (int x=0; x<IConfig.LARGEUR_CARTE; x++){
for (int y=0; y<IConfig.HAUTEUR_CARTE; y++){
map[x][y].nouveauTour();
}
}
} |
037fb8ab-9714-4c46-8215-02072d88d018 | 0 | public PreferencesFrame() {
super(false, false, false, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT);
// Button Text and Other Copy
OK = GUITreeLoader.reg.getText("ok");
CANCEL = GUITreeLoader.reg.getText("cancel");
APPLY = GUITreeLoader.reg.getText("apply");
RESTORE_DEFAULTS = GUITreeLoade... |
17284d64-b1f7-4061-ae3d-c52207ed7c64 | 9 | public static Map<String,Object> stringToMap(String inComing){
Map<String,Object> result = new HashMap<String,Object>();
if(inComing == null) {
return null;
}
JsonReader jsonReader = Json.createReader(new StringReader(inComing));
JsonObject object = jsonReader.readO... |
c92ecceb-8033-435f-9456-7c52cccef6f4 | 3 | private void openUriInBrowser(URI uri) {
if (uri != null) {
if (java.awt.Desktop.isDesktopSupported()) {
try {
java.awt.Desktop.getDesktop().browse(uri);
} catch (IOException ex) {
System.err.println(ex.getMessage());
... |
0c2bee24-4e75-4131-9b37-cc16d71ccc4e | 7 | final void method620(Class101 class101) {
Class101_Sub1 class101_sub1 = (Class101_Sub1) class101;
if (aClass129Array5322 != null) {
for (int i = 0; i < aClass129Array5322.length; i++) {
Class129 class129 = aClass129Array5322[i];
Class129 class129_285_ = class129;
if (((Class129) class129).aClass129_1888 !=... |
bfaee123-73dc-4797-b349-2af62d7b4a2c | 4 | public int addBlockToDB( ) throws MiniDB_Exception{
int newBlockID = (int)-1;
for (int i=0; i<MiniDB_Constants.DB_MAX_BLOCKS && newBlockID==-1; i++){
if( !dbBlockUsed[i] ){
newBlockID = (int)i;
dbBlockUsed[i] = true;
}
}
if( newBlockID == -1 ) throw new MiniDB_Exception( MiniDB_Exception... |
b80887f4-5bad-4dd8-912a-86e9f725d55b | 1 | @Test
public void scale_test() {
try{
double []mat1= {1.0,2.0,3.0,1.0};
double factor= 2;
double[]result = Vector.scale(factor, mat1);
double exp[]={2.0,4.0,6.0,2.0};
Assert.assertArrayEquals(exp, result, 0);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemente... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.