method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4a6e8eae-dd29-4bb8-bd63-52878e44aa28 | 2 | public LinkedList<Stock> getStrongestStocks(int quantity){
LinkedList<Stock> sorted = qs.qsort(stocks, 2); // sort by percentChange
LinkedList<Stock> ret = new LinkedList<Stock>();
if (quantity > sorted.size())
quantity = sorted.size();
for (int i = sorted.size() - 1; i >= sorted.size() - quantity; i--){
... |
043e25a1-d2d5-4c49-b13c-b8657e1bdd48 | 5 | public static boolean DFS(Node root, int lookup)
{
if(root.getData() == lookup)
{
return true;
}
//DFS Uses a stack
Stack<Node> stack = new Stack<Node>();
//add root to stack
stack.add(root);
//Begin da while loop
boolean found = false;
//Logic: pop a node off the stack, recursive call, if ... |
1748b57d-6653-4ff9-aa5a-48df3bfe868e | 7 | public void attributeAsClassAt(int columnIndex) {
Reorder reorder;
String order;
int i;
if ( (columnIndex > 0) && (columnIndex < getColumnCount()) ) {
addUndoPoint();
try {
// build order string (1-based!)
order = "";
for (i = 1; i < m_Dat... |
b14a7648-b5cb-4b91-8a94-103f933fabe1 | 3 | private int hauteurMax() {
int toRet = 0;
if(t1.getHauteur()> toRet) toRet = t1.getHauteur();
if(t2.getHauteur()> toRet) toRet = t2.getHauteur();
if(t3.getHauteur()> toRet) toRet = t3.getHauteur();
return toRet;
} |
543996c4-5c3d-4468-919b-13a339e48459 | 8 | protected String reallyFindOneWays(Session viewerS, List<String> commands)
{
final StringBuilder str=new StringBuilder("");
try
{
for(final Enumeration<Room> r=CMLib.map().rooms();r.hasMoreElements();)
{
final Room R=r.nextElement();
if(R.roomID().length()>0)
{
for(int d=Directions.NUM_DIR... |
65dd10d6-248c-482b-9aaf-d9cbca860d52 | 3 | @Override
public void execute() {
Variables.status = "Sending Urn";
if(!Variables.teleButton.visible()){
Inventory.getItem(Variables.fullUrn_ID).getWidgetChild().interact("Teleport urn");
sleep(500,600);
}
if(Variables.teleButton.visible()){
Variables.teleButton.click(true);
sleep(1000,1200);
}
... |
e0895d86-707f-4f5e-8c42-4c72804901ee | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
99cf9a43-05ff-47c8-b3aa-2e7ba71cf4a0 | 5 | @Override
public List<Double> untransform(List<Double> in) {
if (in.size() != template.getNumCols()) {
throw new MLException(String.format(
"Unexpected in-vector size. Expected %d, Got: %d", template.getNumCols(), in.size()));
}
List<Double> out = new ArrayLis... |
0492a157-c7a0-44ed-be13-767b9f94b727 | 6 | public void insert( T item )
{
current = parent = grand = header;
nullNode.element = item;
while( compare( item, current ) != 0 )
{
great = grand; grand = parent; parent = current;
current = compare( item, current ) < 0 ?
current.left : current.right;
... |
54f3407e-aab2-44e2-843b-629e5bd60843 | 3 | public int remove (K key, int defaultValue) {
int hashCode = key.hashCode();
int index = hashCode & mask;
if (key.equals(keyTable[index])) {
keyTable[index] = null;
int oldValue = valueTable[index];
size--;
return oldValue;
}
index = hash2(hashCode);
if (key.equals(keyTable[index])) {
keyTab... |
e7bbe4c6-5165-410a-b407-8559ab72f74f | 3 | private int readID3v2Header(InputStream in) throws IOException
{
byte[] id3header = new byte[4];
int size = -10;
in.read(id3header,0,3);
// Look for ID3v2
if ( (id3header[0]=='I') && (id3header[1]=='D') && (id3header[2]=='3'))
{
in.read(id3header,0,3);
int majorVersion = id3header[0];
int revisi... |
5d66d805-d0a1-4c09-b474-623bfd0683af | 3 | public Vector3D getRandomLocation(int width, int height) {
while (true) {
int x = (int)(Math.random() * (float)getWidth());
int y = (int)(Math.random() * (float)getHeight());
if (!isBlockedByTerrain(x, y, width, height) && !isBlockedByTanq(x, y, width, height))
return new Vector3D(x, y, 0);
}
} |
e20ad2cc-1624-4fcc-954d-731c24ebc40c | 6 | public void applyPressure(float pressure) {
// FIXME: no variable size for smudge and oil :(
if (pressureSize && paintMode != M_SMUDGE && paintMode != M_OIL) {
curSize = Math.max(.1f, size * pressure);
} else {
curSize = Math.max(.1f, size);
}
// FIXME: what is the point of doing that?
if (curSize > ... |
aff90ee8-6a03-4414-b669-2b8a21c76482 | 0 | public ZipIterator(Iterable<T> first, Iterable<TOther> second, Joint<T, TOther, TResult> joint)
{
this._first = first.iterator();
this._second = second.iterator();
this._joint = joint;
} |
26790568-90d1-4801-b39a-b0b18369bf05 | 3 | public static int fib(int n) {
if (n < 0) {
throw new IllegalArgumentException("Error: int cannot be < 0!");
}
if (n == 0 || n == 1) {
return n;
}
return fib(n - 1) + fib(n - 2);
} |
0a54e720-d9ca-4df9-948e-bdef69962425 | 9 | public final void afficherValeur(final Node node) {
final String name = node.getNodeName();
if (node.hasChildNodes()) {
final Node fils = node.getFirstChild();
if (fils.getNodeType() == Node.TEXT_NODE) {
if (contientChiffreLettre(
fils.getNodeValue())) {
if (name.equals("type")
|| name.eq... |
1184ac41-36e0-4ec7-85fd-eaf76ca242ea | 5 | public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_SPACE) {
fire();
}
if (key == KeyEvent.VK_LEFT) {
dx = -1;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 1;
}
if (key == KeyEvent.VK_UP)... |
40dda44e-54cb-4c3f-bcd7-dd274bf2ab3b | 4 | public boolean judgeChessMan(ChessMan cm1,ChessMan cm2){
if(cm1.equals(cm2)){
return false;
}
if(!cm1.equalsValue(cm2)){
return false;
}
if(cm1.getValue()==0||cm2.getValue()==0){
return false;
}
return true;
} |
377e3a81-ac48-45f8-9b84-52540ff7be95 | 6 | public static Boolean parseBoolean(String text) {
switch (text.toLowerCase()) {
case "true":
case "on":
case "yes":
return true;
case "false":
case "off":
case "no":
default:
return false;
}
} |
4d3ff33e-bdc7-4ce6-a286-43c4bdccbde9 | 5 | @Override
public void handleEvents() {
ControllerManager.pollInput();
if (Keyboard.isKeyDown(Keyboard.KEY_F10)){
EntityManager.getMonitor().setDebug(false);
}
if (Keyboard.isKeyDown(Keyboard.KEY_F9)){
EntityManager.getMonitor().setDebug(true);
}
if (Keyboard.isKeyDown(Keyboard.KEY_F11)) AudioManager... |
2df71700-5bf3-4c6d-869d-0d12fde3a69d | 0 | public int length() {
return text.length();
} |
caead509-1401-4f78-9d26-d90a093b9038 | 7 | private void jTextField3FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField3FocusLost
boolean es_componente=false;
//voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos
//if (evt.getOppositeComponent()!=null){
int i=0;
... |
85474030-eec5-4c63-ae48-d0ebfaba3c60 | 7 | public boolean move(int i, int i0, int i1, int i2) {
if (canMove(i, i0)) {
for (int[] hint : getHints(i, i0)) {
if ((i1 == hint[0]) && (i2 == hint[1])) {
//se arrivo in fondo, devo creare un damone
if (((i1 == 0) || (i1 == 8 - 1)) && (tabellone... |
0d35b1cb-f034-46f3-8d49-5d6b9221308d | 1 | public static void main(String[] args) {
_2_InheritingExceptions sed = new _2_InheritingExceptions();
try {
sed.f();
} catch (SimpleException e) {
System.out.println("Caught it!");
}
} |
7ba6d775-0100-41fe-88b3-706d34e917d1 | 5 | public CheckResultMessage check22(int day) {
int r1 = get(2, 5);
int c1 = get(3, 5);
int r2 = get(6, 5);
int c2 = get(7, 5);
int r3 = get(13, 5);
int c3 = get(14, 5);
int r4 = get(39, 5);
int c4 = get(40, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in ... |
14b47183-af0c-4dc5-8e8a-807e1d0e2805 | 4 | private static java.sql.Connection connect(String endpoint, String driver,
String user, String pwd) {
// Dem DriverManager den Driver der DBMS geben.
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
LogHandler.writeStackTrace(Logger.getGlobal(), e, Level.SEVERE);
return null;
}
... |
c7f00772-8b22-4703-ae1e-fe970747a516 | 2 | @Override
public List<Patient> getlistPatient() throws Exception {
BasicConfigurator.configure();
log.debug("getlistPatient method called...");
List<Patient> list=new ArrayList<Patient>();
Statement stmt = null;
Connection conn=JDBCManager.getConnection();
try {
stmt = conn.createStatement()... |
1def4ff8-36fa-48a7-9981-451d6055076a | 8 | public static boolean isValidSnapshot(File f) throws IOException {
if (f==null || Util.getZxidFromName(f.getName(), "snapshot") == -1)
return false;
// Check for a valid snapshot
RandomAccessFile raf = new RandomAccessFile(f, "r");
try {
// including the header a... |
0c37c745-ad5e-4454-b346-59d89e5917c1 | 9 | public void handle(String pathInfo, final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final Handler handler = getHandler(pathInfo);
if (handler instanceof JsonParametersAware) {
setJsonParameters(request, handler);
}
request.setAttribute("handler", ha... |
229812b9-2122-408a-bcdd-60aad2ec050e | 1 | @AssistedInject
public PGridKey(@Assisted String key) {
if (key == null) {
throw new NullPointerException(
"PGridKey needs not null values to instantiate");
}
key_ = key;
} |
c65183a3-3f24-4af1-8487-78da2f3f9d23 | 3 | @Override
public void run() {
Database db = new Database();
while (running || parent.getQueueCount() > 0) {
LocationHistory history = parent.getNextHistory();
if (history == null) {
LockSupport.park();
} else {
... |
7555dd9a-2475-4928-b483-63dfe0046b32 | 4 | @SuppressWarnings ("rawtypes")
@Override
public List<?> getList(String path, List<?> def){
List<?> list = super.getList(path, def);
return list == null ? new ArrayList(0) : list;
} |
3fdf631c-1b98-4ea7-8b17-da9e3bd89515 | 9 | private Element buildPattern(String pattern, String changes) {
Element head = null;
Element temp = null;
pattern = Transliteration.expandRanges(pattern);
changes = Transliteration.expandRanges(changes);
final StringCharacterIterator a = new StringCharacterIterator(pattern);
final StringCharacterIter... |
af4fa72e-284f-4579-b554-bde951efe972 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Client client = (Client) o;
if (date_created != null ? !date_created.equals(client.date_created) : client.date_created != null)
return fals... |
f217937f-c76a-46a9-914f-ad1b357a7283 | 8 | public void paint(Graphics g) {
//paint the background
g.setColor(Color.BLACK);
g.fillRect(0, 0, TILE_WIDTH*width, TILE_HEIGHT*height);
// Only continue if there is a controller
if (controller == null) {
return;
}
... |
b9a62f40-b927-4ce8-9df8-2a31e9dde99d | 5 | public GuiLoad(Game game, int width, int height) {
super(game, width, height);
File p = new File(World.WORLD_DIR);
File[] fs = p.listFiles();
int valid = 0;
for (File f : fs) {
if (f.getName().endsWith(".dat")) {
valid++;
}
}
worldFiles = new File[valid];
for (int i = 0; i < valid; i++) {
w... |
e3330566-d6f2-4d3e-a7b9-e5c26b2d1fbc | 3 | protected static boolean isMeasureNumValid(int num) {
return (!Settings.LIM_96_MEASURES && num >= 0) || (num >= 0 && num <= 96);
} |
3b0d991a-0d20-43d2-9ff4-768fb5000441 | 3 | @SuppressWarnings("unused")
private boolean commandIsRegistered(String command) {
// check if we have it as an alias
if(aliasMapping.containsKey(command)) {
return true;
}
// no? Well maybe its the normal command then..
for(String registration: registeredCommands.keySet()) {
String[] parts = registr... |
4d7b3e4c-5e00-42f8-afdc-a7fb128778b7 | 3 | public static Node successor(Node node){
if(node.right != null)
return minimum(node.right);
Node y = node.p;
while(y != null && node == y.right){
node = y;
y = y.p;
}
return y;
} |
1b645beb-1d2b-4dda-bc09-696089c6db1f | 4 | @Override
public void renderBackground(float interpolation)
{
Vector2 realOffset = Interpolator.linearInterpolate(oldOffset, offset, interpolation);
drawBlueprintBackground();
if(R2DFileUtility.textureExists(texID.text) && tex != null)
{
if(!tex.getTextureLocation().equals(texID.text))
reloadTex();
... |
5aa187c3-88cf-489d-947e-ef9af731666d | 4 | public SoundScreen(Game game) {
super(game);
bleep = SoundPlayer.createSound("sounds/lazer.wav");
music = SoundPlayer.createSound("sounds/IntrigueMan.wav");
sprite = new SpriteSheet("images/button.png",100f,30f);
Button fxButton = new SpriteButton(sprite,150,100);
fxBu... |
553d49b4-d042-4725-ac83-c2742945659f | 5 | @Override
protected boolean checkChildren() {
// no children, then everything is fine
if (children.isEmpty()) {
return true;
}
validBranches.clear();
childrenErrorMessage = "No valid alternative.\n";
boolean status = false;
int alternative = 0;
... |
d9d814c4-7ffa-4506-b3a3-02049cb2a065 | 9 | private void readXML() throws SAXException, ParserConfigurationException, IOException, NoSuchAlgorithmException, InvalidKeySpecException {
try {
this.mutex.acquire();
// On parse le fichier une seule fois
File userFile = new File(XML_PATH);
DocumentBuilderFactory... |
98d83a0f-d385-432b-8b6a-0710bdddbdd9 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SingleStopwatch other = (SingleStopwatch) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (name == null) ... |
7a31100d-5d2b-41fc-96bf-78b75628f9b7 | 9 | public CadastroArtigos(String entrada, Revista revista) throws FileNotFoundException {
this.entrada = entrada;
this.revista = revista;
File arquivo = new File(entrada);
Scanner scanner = new Scanner(arquivo);
String cabecalho = scanner.nextLine();
while (scanner.hasNextLine()... |
abd987dd-f34e-40f7-8376-c6b00160d5b6 | 8 | public int [][] drawPath(int startX, int startY, int finalX, int finalY)
{
int pairs;
int x_dir = 0, y_dir = 0;
if(finalY == startY) //if queen is travelling horizontally
{
pairs = Math.abs(finalX - startX);
if(finalX - startX < 0)
x_dir = -1;... |
b73ab834-a74d-4400-8d29-d5c32e11e774 | 8 | private CostMatrixBuilder[] createConnectionCostFile(String connectionCSVFilename, String connectionCostDataFilename, short defaultCost, String charset) throws IOException {
CostMatrixBuilder[] matrixBuilders = new CostMatrixBuilder[3];
matrixBuilders[0] = new CostMatrixBuilder();
matrixBuilders[1] = new CostMa... |
608d8a08-9ea1-498f-9b30-d5afb13e0599 | 3 | public void addMeetingNotes(int id, String notes)
throws NullPointerException {
try {
pastMeetingList.get(id - futureCounter).setNotes(notes);
} catch (IllegalArgumentException ex) {
System.out
.println("I'm sorry but the Id entered does not seem to exist, please try again.");
} catch (IllegalStat... |
969e6d93-0ff9-41cd-ad56-67771754d06e | 2 | public static void main(String args[]) {
int total = 1632442;
int limit = 108829;
long begin = System.currentTimeMillis();
ExecutorService executorService = Executors.newFixedThreadPool(total
/ limit);
for (int i = 0; i <= total / limit; i++) {
SetAuthorRelation_In test = new SetAuthorRelation_In(i * l... |
49ad1519-f430-475e-9c65-75c50f4386cb | 0 | public String[] getKinds() {
return kinds;
} |
2e49ee1b-418a-4401-b466-293f2ffcd497 | 1 | public void close(){
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
} |
982588dc-5a82-4457-a4b7-2fc748ec1448 | 2 | public Pet randomPet() { // Create one random Pet
int n = rand.nextInt(types().size());
try {
return types().get(n).newInstance();
} catch(InstantiationException e) {
throw new RuntimeException(e);
} catch(IllegalAccessException e) {
throw new RuntimeException(e);
}
} |
f50d9a87-9942-433e-ab58-58377e041ba1 | 5 | public void fitToData (double[][] data) {
min.clear();
max.clear();
int numberOfObjects = data.length;
int numberOfDimensions = data[0].length;
for (int i = 0; i < numberOfDimensions; i++) {
add (data[0][i], data[0][i]);
}
for (int k = 1; k < numberOfObjects; k++) {
for (int i = 0; i < numberOfDi... |
34c9b27c-d331-4c0b-ae28-4e27e9aac3b9 | 7 | private void generate()
{
final double latest = this.history.getLatestIteration().doubleValue();
final double totalProducts = this.sumOfIterationsProduct();
for (Candidate candidate : Candidate.values())
{
final boolean wasLatest = candidate.equals(history.getLatestCandid... |
bf0d8005-8f0b-4c8a-8f46-2277ed0b929d | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabelOutletLocation other = (TabelOutletLocation) obj;
if (!Objects.equals(this.kodeLokasi, other.kodeLok... |
b07d1fc5-0228-4bd0-a9b8-4103fbdd5a74 | 1 | public Map<String, Row> getAll(String tableName) throws DataBaseTableException {
Table table = tableHashMap.get(tableName);
if (table == null) {
throw new DataBaseTableException("no such table");
}
return table.getAll();
} |
c33f07a7-feef-4c55-bbd7-557e8f8a33a6 | 4 | public UserLoginDialog(JFrame parent) {
super(parent, "Login", ModalityType.APPLICATION_MODAL);
setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
setBounds(100, 100, 450, 200);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().... |
cf6821de-a27a-47a1-b8b7-613a1cb5221f | 7 | public void actionPerformed(ActionEvent event) {
if (event.getSource() == closeConnection) {
if (socket != null) {
try {
socket.close();
} catch (IOException ioEx) {
System.out.println("\n* Unable to close link!*\n");
System.exit(1);
}
lineToSend.setEditable(false);
hostInput.gra... |
0b64093c-7ac0-4658-9ae8-eea01af49c06 | 9 | void readData() {
List<Short> files = smartID.getFileList();
InputStream in = null;
Short fid = BasicService.EF_COM;
files.remove(fid);
try {
fid = BasicService.EF_DG1;
if (files.contains(fid)) {
in = smartID.getInputStream(fid);
dg1file = new DG_1_FILE(in);
BasicInfo bi = dg1file.getInfo();... |
a7c5d96b-c649-41a5-bbda-002bfc2b7d77 | 9 | public void sampleParam(InstanceList docs, int[][] z, LogRandoms rng, int numItns, double stepSize) {
double[] param = getParam();
int I = param.length;
double[] rawParam = new double[I];
double rawParamSum = 0.0;
for (int i=0; i<I; i++) {
rawParam[i] = Math.log(param[i]);
rawParamSu... |
f7432cfe-e251-4959-880e-7afa5d78b00f | 8 | public static void initialiseInterproDb() throws IOException,
ParsingException {
Builder parser = new Builder();
Document doc = parser.build(new BufferedInputStream(
new FileInputStream(new File(getSettings()
.getPathToInterproDatabase()))));
Nodes ipr_nodes = doc.query("//interpro");
for (int i = ... |
b525e3ed-ba10-4e42-8a0f-eaf8ceb20e83 | 7 | final void method372(int i) {
anInt608++;
if (i != -25359)
((Class42) this).anInt578 = -106;
if (((Class42) this).anIntArray591 != null) {
for (int i_0_ = 0;
((i_0_ ^ 0xffffffff)
> (((Class42) this).anIntArray591.length ^ 0xffffffff));
i_0_ += 2) {
if ((((Class42) this).anInt603 ^ 0xffffffff)
... |
5cc4cad8-caaa-48f4-a699-6a519bea2319 | 6 | public static int divide(int dividend, int divisor) {
long divid = Math.abs((long)dividend);
long divir = Math.abs((long)divisor);
boolean isNg = (dividend > 0 && divisor < 0) || (dividend < 0 && divisor > 0);
int res = 0;
while (divir <= divid) {
long count = 1;
long sum = divir;
... |
2c86624a-a9bd-4fcb-ba8e-830566f10541 | 3 | public boolean isUnique(String s) {
for (int i = 0; i < s.length(); i++) {
char tmp = s.charAt(i);
for (int j = i + 1; j < s.length(); j++) {
if (tmp == s.charAt(j)) {
return false;
}
}
}
return true;
} |
7c121f35-9e35-4321-85e2-a2fe59f283dd | 3 | public static void saveEvents (Box b)
{
display.repaint();
Month m = b.getMonthStored();
Day d = b.getDayStored();
File f2 = new File (homeFile.toString()+"/"+m.getName());
f2.mkdir();
File f = new File (f2.toString()+"/"+d.getNum()+".cal") ;
BufferedWriter out;
if(f.exists())//if the text file for th... |
06525e8c-f5d5-446d-bd8f-8895f765b6ca | 8 | public static void main(String[] args) {
System.out.println();
System.out.printf("Table Verite Conditionel ET (&&)\n%s\t: %b\n%s\t: %b\n%s\t: %b\n%s\t: %b\n\n",
"false && false", (false && false),
"false && true", (false && true),
"true && false", (true && false),
"true && true", (true && true)
... |
1f9429be-810c-4bd8-8ec6-6de491ea67a3 | 8 | public final boolean applyReturnScroll(final MapleCharacter applyto) {
if (moveTo != -1) {
if (applyto.getMap().getReturnMapId() != applyto.getMapId()) {
MapleMap target;
if (moveTo == 999999999) {
target = applyto.getMap().getReturnMap();
... |
bd72f130-d88e-429d-9578-e63c5b58b189 | 6 | private void searchFolder(File src, Set<File> list, Set<String> urisAlreadyProcessed) {
if (inReportSrc(src))
return;
if (src.isDirectory()) {
for (String file : src.list())
searchFolder(new File(src, file), list, urisAlreadyProcessed);//recursive copy
} e... |
59244178-8d9e-4378-b7ae-beae4dc2fa4a | 8 | private int minmax(Color p, Board b, int d, int cutoff,
ArrayList<Integer> moves) {
if (moves == null) {
moves = new ArrayList<Integer>();
}
moves.clear();
if (d <= 0) {
return staticEval(p, b);
} else {
int maxsofar = In... |
cca29655-085b-4196-b5c9-2a496260ce65 | 7 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((addressLine1 == null) ? 0 : addressLine1.hashCode());
result = prime * result + ((city == null) ? 0 : city.hashCode());
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = pr... |
6b75b26a-c8be-42a8-b7a1-29e4f120dc3d | 4 | private void checkNptype(int type) throws ShellLinkException {
int mod = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
for (Field f : this.getClass().getFields()) {
try {
if ((f.getModifiers() & mod) == mod && type == ((Integer)f.get(null)).intValue())
return;
} catch (Exception e) {}
}
thr... |
fa457855-f816-4819-ac3d-1c3d65b9ea9b | 7 | public boolean onMouseMoved(MouseEvent e) {
// check for a rollover effect
SmartIconJButton btn = findButtonAt(e.getPoint());
boolean shouldRepaint = false;
if(btn != null) {
String tip = btn.getTooltipText();
if(tip != null) {
if(! tip.equals(localTooltipText)) {
this.localTooltipText = tip;
... |
ed0d8d6f-d80d-4016-8284-07e642f9a40e | 9 | public SimpleProperty(Class clazz, String name) {
this.name = name;
Class[] readParams = {};
readMethod = Reflection.getMethod(clazz, "get" + name, readParams);
if (readMethod == null) {
readMethod = Reflection.getMethod(clazz, "is" + name, readParams);
}
... |
4c34c40a-3892-4d4d-b9fb-ffac5a3700fa | 1 | public void printList(){
System.out.println(n);
if (next != null){
next.printList();
}
} |
184faa28-9d1f-492b-bbd0-5408e931789b | 0 | public void dodajOsobe(Osoba osoba) {
osoba.setId(null);
em.persist(osoba);
} |
c222bed9-f3d7-440b-9546-a170fd376fb1 | 1 | public LinkedList<User> getMostTrustedUsers(int amount) throws SQLException {
PreparedStatement statement = connection.prepareStatement(
"SELECT Username, Name, CreditCard, Address, Phone, IsManager FROM Users " +
"ORDER BY (SELECT COUNT(*) FROM Trusts WHERE IsTrusted=1 A... |
fcaf10cb-e615-4574-99f0-5a66de6c540a | 4 | public Graph buildInducedSubgraph(Vector<String> nodes)
{
int i=0, j=0;
Graph subGr=new Graph(name);
for(i=0;i<nodes.size();i++)
subGr.addNode(nodes.get(i));
for(i=0;i<nodes.size();i++)
{
String source=nodes.get(i);
HashMap<String,Double> adiac=mapNodes.get(source).getAdiacs();
for(j=0;j<nodes.si... |
3e1953b6-9b13-4ca0-a6a4-321a69ad3468 | 1 | public double getMass() {
double returnedMass = 0;
for (AstronomicalObject astronomicalObject : elements) {
returnedMass += astronomicalObject.getMass();
}
return returnedMass;
} |
0c09e719-12c1-408a-9197-2e038aa72274 | 3 | private void upload_cmd() {
@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
System.out.println("Input the filename which you want to upload in local:");
String filename = sc.nextLine();
if(false == client.namenode.exits(filename)){ //HDFSвڸļʱϴ
FileInputStream fis;
try {
fis = ne... |
189ce921-dad9-4824-a3d2-cd18740af150 | 4 | public synchronized void quizFileReWriter(Set<Quiz> quizList)throws RemoteException{
String filePath = "C:/JavaFiles/QuizManager/QuizMasterFile.csv";
File file = new File(filePath);
Set<Question> questionListForNewQuiz=new HashSet<Question>();
Set<Quiz> quizListWithoutTheFinalisedQuiz=quizList;
Iterator<Quiz... |
05aef559-6c13-40b8-a86e-89f6f999a727 | 8 | public void setOptions(String[] options) throws Exception {
// Pruning options
m_unpruned = Utils.getFlag('U', options);
m_reducedErrorPruning = Utils.getFlag('R', options);
m_binarySplits = Utils.getFlag('B', options);
String confidenceString = Utils.getOption('C', options);
if (confidenceStri... |
d66defbd-6aa9-44ca-87bb-bff43a41cde7 | 8 | public JSONObject parseUserMangaListXML(InputStream inputXML) throws MALException, IOException {
// My storage variables
final ArrayList<Manga> myManga = new ArrayList<Manga>();
final JSONObject mangaListData = new JSONObject();
final Manga currentManga = new Manga();
final User currentUser = new User();
... |
56fb3956-3333-4bd8-b833-74e50e90e1de | 4 | private void processAddReplica(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] obj = (Object[]) ev.get_data();
if (obj == null)
{
System.out.println(super.get_name() +
".processAddReplica(): replica is null");
retu... |
a543691f-3435-49c4-876d-760ff1353806 | 0 | public String getStrategyName(){
return null;
} |
9dbd4a48-1f34-46bf-bc81-b59e0e9f895f | 1 | @Override
public Object peek() throws EmptyStackException {
if (this.empty()) {
throw new EmptyStackException();
}
return this.listStack.get(this.listStack.size() - 1);
} |
3deb7ab9-06d7-4719-9fe3-aa57f1d32bea | 3 | public Set<User> addElectorate(String filename) {
Set<User> userSet = new HashSet<User>();
File file = new File(filename);
if (file.exists()) {
try {
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String GUID = scanner.nextLine().trim();
User user = getUser(GUID);
... |
8ab8e549-6c61-453e-86b9-d4f10bac6278 | 2 | public final static GetHttpPage getInstance() {
if(GetHttpPage.instance == null)
synchronized(GetHttpPage.class) {
if(GetHttpPage.instance == null)
GetHttpPage.instance= new GetHttpPage();
}
return GetHttpPage.instance;
} |
6ef04d3e-9f7e-441e-aa61-02a3d67fa086 | 6 | private final void method3151(int[][] is, byte i) {
anInt9487++;
if (i != -27)
method3152(86);
int i_0_ = Class348_Sub40_Sub6.anInt9139;
int i_1_ = Class286_Sub2.anInt6212;
TextureDefinition.method224((byte) -40, is);
Class348_Sub27.method3000(Class239_Sub22.anInt6076, 0,
Class299_Sub2.anInt6325, 0, i ... |
0a138608-942c-447f-8d43-cf334137c8c0 | 1 | public static void polarToCartesian(Graph graph, ArrayList vertices) {
Point2D polar, cartesian;
for (int i=0; i<vertices.size(); i++) {
polar = graph.pointForVertex(vertices.get(i));
cartesian = new Point2D.Double(Math.cos(polar.getY()) * polar.getX(),
Math.sin(polar.getY()) * polar.getX());
graph.... |
cbf3722c-4544-4617-bdaf-f2452b11d3b9 | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
21aa6ec7-5dde-4892-a0b7-2e47b6b1d813 | 6 | private TagNode findElement(ITagNodeCondition condition, boolean isRecursive) {
if (condition != null) {
for (Object item : children) {
if (item instanceof TagNode) {
TagNode currNode = (TagNode) item;
if (condition.satisfy(currNode)) {
... |
014ccfcb-007c-4920-b7a1-1d10dfdcd697 | 6 | @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if(!Commands.isPlayer(sender)) return false;
Player target = null;
Player p = (Player)sender;
if(args.length < 1 || args.length > 2) return false;
if(args.length ==... |
4d7af0dd-318c-4766-b99e-fe707e1a1e02 | 1 | public static byte[] utf8Bytes(String s) {
try {
return s.getBytes(UTF8);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 Charset not available");
}
} |
d4e2cc1d-1905-4c31-b85f-3f5fc436c33e | 4 | public void addDestructor(String id, String type) throws SecurityException,
IOException {
if (WarUtility.getDestructorById(id, this, type) != null) {
// tell controller the id already exists
}
if (type.equalsIgnoreCase("Plane") || type.equalsIgnoreCase("Ship")) {
Destructor desctructor = new Destructor... |
306ebc0b-cca4-4c28-83b1-4610f4b9f6d4 | 5 | public static Set<IElectricGrid> getMutuallyConnectedObjects(IElectricGrid gridObject) {
Set<IElectricGrid> connectedObjects = new HashSet<IElectricGrid>();
WorldCoordinate myPos = new WorldCoordinate(gridObject.getTile());
for (Map.Entry<WorldCoordinate, EnumSet<ConnectType>> position : gridOb... |
241d971c-b23b-405d-be7d-4d73b4d67e2f | 3 | @Override
public Object execute(Object obj, Object[] args) {
try {
return method.invoke(obj, args);
} catch (IllegalArgumentException e) {
return null;
} catch (IllegalAccessException e) {
return null;
} catch (InvocationTargetException e) {
return null;
}
} |
7809dbd4-6625-480d-b846-741104a47ec0 | 1 | public void setMap(QWidget m)
{
if (map != null) {
map.dispose();
}
map = m;
scroll = new QScrollArea();
scroll.setSizePolicy(Policy.MinimumExpanding, Policy.Preferred);
scroll.setWidget(m);
layout.addWidget(scroll, 0, 0, 2, 1);
//scroll.setStyleSheet("background-color: blue;");
} |
af5451ff-a003-41ed-bfa6-9a44a9aa0df1 | 1 | public static byte[] hex2Byte(String str) {
byte[] bytes = new byte[str.length() / 2];
for (int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) Integer.parseInt(str.substring(2 * i, 2 * i + 2), 16);
}
return bytes;
} |
3cf00523-53ac-4aa1-8807-9f8c3851bfcf | 9 | public void processSymbol(){
if ((!(currentState.equals("ACCEPT"))) && (!(currentState.equals("REJECT")))){
currentSymbol = (String)input.get(currentCell);
toState = transitions.get(currentState).get(currentSymbol).get("switchTo");
writeSymbol = transitions.get(currentState).... |
d552f972-3b3c-476e-9854-1c7a26faaa1f | 4 | public GUI(RecommendationControl recomControl) {
this.recomControl = recomControl;
attractionName = new String("attractionName");
ready = false;
// Initial
setTitle("TRAVELABULOUS - Destination Guru");
setSize(562,700);
titlePanel = new TitlePanel();
titlePanel.setPreferredSize(new Dimension(563, 175... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.