method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
02e96ece-39c1-4dbf-a69b-744c642bc9f3 | 3 | private static Object getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes) throws Exception
{
final Class<?>[] parameterTypes = new Class[additionalParameterTypes.length + 2];
parameterTypes[0] = String.class;
parameterTypes[1] = int.class;
System.arraycopy(additionalParameterTypes, ... |
6a3155db-59f1-4c4b-afd6-02ebc5797b01 | 3 | private void getElementName() {//gets the string name of the objects of type base station, hub or client.
if (this.element instanceof BaseStation) {//if it is instance of Base Station
this.nombre_elemento = "Base Station";
} else if (this.element instanceof Client) {//if it is instance of C... |
e22dd9a5-1acd-47bf-a1a8-b1a978a247e3 | 0 | public Object GetObjectTypeToCreate()
{
return objectType;
} |
bf18573c-9d45-4ce6-8716-f6b20c8c1a79 | 9 | public boolean checkRootLabelCodes(LabelSet rlc) {
if (rlc == null && rootLabelCodes == null) {
return true; // or false ?
} else if ((rlc == null && rootLabelCodes != null) || (rlc != null && rootLabelCodes == null)) {
return false;
} else if (rlc.size() != rootLabelCodes.size()) {
return false;
} els... |
6b377e69-821d-41d6-af80-8d1e0c9f3ecf | 7 | public RoomInfo getByEvent(String value) throws ParseException {
JSONParser parser = new JSONParser();
//System.out.println(value);
JSONObject obj = (JSONObject) parser.parse(value);
JSONObject data = (JSONObject) obj.get("data");
String event = (String) obj.get("event");
String id_room = null;
/**
* {... |
14efc3f5-a9c3-445b-b5b2-0935a76059dd | 2 | public Number min(){
Number min = stack.getFirst();
for (T t : stack){
if (min.doubleValue() > t.doubleValue()){
min = t;
}
}
return min;
} |
156bd4a4-443b-45a1-ad55-85e8977e6d10 | 4 | public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT)
dx = 0;
if (key == KeyEvent.VK_RIGHT)
dx = 0;
if (key == KeyEvent.VK_UP)
dy = 0;
if (key == KeyEvent.VK_DOWN)
dy = 0;
} |
c7a76abf-f7d5-4ed8-ada5-9eee6ccf5d1b | 6 | public void setTier(String tier)
{
this.tier = tier;
switch(tier)
{
case "Heroic":
try {
this.tierImage = ImageIO.read(new File("img/heroic.png"));
} catch (IOException e) {
}
break;
case "Paragon":
try {
this.tierImage = ImageIO.read(new File("img/paragon.png"));
} catch (IOExcepti... |
3c65f115-91b1-4b76-9f9f-020c060ea24a | 7 | public boolean setDisplayName(String displayName)
{
resetLastError();
if (!isConnected())
{
saveLastError("setDisplayName(): Not connected to TS3 server!");
return false;
}
if (displayName == null || displayName.length() < 3)
{
saveLastError("setDisplayName(): displayName null or shorter tha... |
d3782b53-42f2-4452-8977-afb521d1298f | 3 | public ProvinceData(Map map) {
final int numProvs = Integer.parseInt(map.getString("max_provinces"));
rgbMap = new HashMap<Integer, Province>(numProvs);
allProvs = new Province[numProvs];
String defFileName = map.getString("definitions").replace('\\', '/');
if (... |
992afb5d-e8cb-45f6-b1c4-0a49f174f4f8 | 7 | private void refreshState() {
int semaphoreTime = 0;
PublicTransportCenter pTC;
while(true)
{
pTC = PublicTransportCenter.getPublicTransportCenter();
for (Semaphore semaphore : pTC.getSemaphores())
{
semaphoreTime = semaphore.getTime();
if(semaphoreTime == semaphore.getTimeGreen() && ... |
78499ba7-5cc9-4c2b-9484-cd65fa23af5d | 2 | public static void main(String[] args) throws InterruptedException {
OnNextPageLoadedListener<ActivityFeedItemImpl> listener = new OnNextPageLoadedListener<ActivityFeedItemImpl>() {
@Override
public void notify(List<ActivityFeedItemImpl> results) {
if (results == null)
return;
for (ActivityFee... |
88c17fd3-1cea-4f83-a73d-9044cee4cf56 | 1 | public void dropInfo(int howMuch) {
if ((howMuch & UNKNOWNATTRIBS) != 0)
unknownAttributes = null;
} |
51233a44-22a1-4cc3-91a5-879822e9ebe8 | 7 | public void paint(Graphics g) {
Graphics2D g2D = (Graphics2D) g;
boolean isPressed = getModel().isPressed();
boolean isRollover = getModel().isRollover();
int width = getWidth();
int height = getHeight();
Color[] tc = AbstractLookAndFeel.getThem... |
4f12b523-169d-4d7d-b33c-300f6de1309f | 4 | public void makeDeclaration(Set done) {
if (type == FOR) {
if (initInstr != null)
initInstr.makeDeclaration(done);
incrInstr.makeDeclaration(done);
}
cond.makeDeclaration(done);
super.makeDeclaration(done);
if (type == FOR && initInstr != null)
checkDeclaration(declare);
} |
ad374797-b371-4be9-bec0-b66dbc9fceca | 0 | public static void main(String[] args) throws ParseException {
// String orig = "October 2014";
//String orig = "September 2014";
//String orig = "August 2014";
String orig = "February 2014";
DateFormat df = new SimpleDateFormat("MMMM yyyy");
Date date = df.parse(orig);
System.out.println(date);
... |
4618344f-0ffd-49a7-923e-6a2ff6afdffa | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TaxonDesignation)) {
return false;
}
TaxonDesignation other = (TaxonDesignation) object;
if ((this.taxonDesigna... |
0b651941-e701-49c4-adcf-e6bf94de935e | 3 | public Set<Noppa> poistaKelpaamattomatSetista(Set<Noppa> nopat){
Set<Noppa> kelpoisat = new HashSet<Noppa>();
for(Noppa noppa: nopat){
for(Noppa noppakelpaa:kelpaavatnopat){
if(noppakelpaa.annaSilmaluku()==noppa.annaSilmaluku()){
kelpoisat.add(noppa);
... |
f82ad3dd-1a67-4a5c-ad73-2821e4082c41 | 8 | public static void main(String[] args) {
//number of times to execute,max value to add to stack,min value to add to stack
int n=150,max=2349,min=0;
Stack<Integer> stack = new Stack<Integer>();
//random stack manipulator loop
for (int count = 0; count < n; count++) {
int op = (int) (Math.random() * 4)... |
cf85f4fc-922f-4d83-89dc-a550d96b9e33 | 4 | public static void initUserFeature() {
double sum;
for(int i = 0; i < DataInfo.num_of_user;i++) {
sum = 0;
for(int j = 0; j < DataInfo.userlist[i].length; j++) {
int a = DataInfo.userlist[i][j];
sum += a % 10;
}
DataInfo.userFeature[i][0] = sum / DataInfo.num_of_item;
}
Random ran... |
e6ed42db-a21c-49ac-80aa-b49d6f488e32 | 2 | public static void copy(File srcFile, File destDir) {
System.out.println(srcFile.getAbsolutePath());
System.out.println(destDir.getAbsolutePath());
long copySizes = 0;
try {
FileChannel fcin = new FileInputStream(srcFile).getChannel();
FileChannel fcout = new FileOutputStream(dest... |
455edf01-b9ed-42e5-a6e8-259e36cf86dc | 3 | private int goTo(int index)
{
int state = state();
int low = 1;
int high = gotoTable[index].length - 1;
int value = gotoTable[index][0][1];
while(low <= high)
{
// int middle = (low + high) / 2;
int middle = (low + high) >>> 1;
if... |
1af6e0d2-b902-43ff-8d2c-5173eda50ea8 | 6 | public float[][] GeneratePerlinNoise(float[][] baseNoise, int octaveCount) {
int width = baseNoise.length;
int height = baseNoise[0].length;
float[][][] smoothNoise = new float[octaveCount][][]; // an array of 2D
// arrays
// containing
float persistance = 0.5f;
// generate ... |
68cf6b70-3f9c-4643-95d2-c76872d20de5 | 5 | public GameChatClient(){
// ask the user for a host, port, and user name
String host = JOptionPane.showInputDialog("Host address:");
String port = JOptionPane.showInputDialog("Host port:");
clientName = JOptionPane.showInputDialog("User name:");
if (host == null || port == null || clientName == null)
re... |
f3cbde3b-e34a-4f72-8273-3cd385e71ee4 | 9 | private boolean isNotEmpty(){
if(fName.equals("")||lName.equals("")||phone.equals("")||email.equals("")||addr.equals("")||city.equals("")||state.equals("")||ZIP.equals("")||date.equals("")){
JOptionPane.showMessageDialog(null,"Please fill out all fields.","Error",JOptionPane.WARNING_MESSAGE);
return false;
}e... |
45077d98-4ec0-44f5-8876-833725807dc7 | 0 | public static void hideNew() {
DIALOG.setVisible(false);
} |
c395b4cb-2a39-45d3-acbe-b7ca0315c15c | 3 | public void changeOrder(com.novativa.www.ws.streamsterapi.Order order) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[9])... |
41263a75-d52f-4ae0-a131-396fd12f5774 | 1 | public boolean isEmpty(){
if (top == null){
return true;
}
return false;
} |
fa299c05-9d71-4e7f-8605-fb595927f785 | 6 | public void actionPerformed(ActionEvent evt)
{
try
{
//Check if button has been selected
if (evt.getActionCommand().equals("New"))
{
openHomeScreen(createNewTextFile());
}
else if (evt.getActionCommand().equals("Open"))
... |
1e4b5aa4-833d-4355-ab96-2eb1b8b1f30c | 6 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Venda)) {
return false;
}
Venda other = (Venda) object;
if ((this.id == null && other.id != null) || (this.id !... |
b08c5ee5-4e82-490c-978d-a4353fb9d485 | 9 | @SuppressWarnings("rawtypes")
@Override
public Class getClass(int i_idColumn) {
switch (i_idColumn) {
case 0:
return Integer.class;
case 1:
return String.class;
case 2:
return HTMLLink.class;
case 3:
return String.class;
case 4:
return HTMLLink.class;
case 5:
return HTMLLink.class;
c... |
d9686a92-59ce-47b2-812c-bfa56e78d53a | 5 | public void tagVirts(DirManager dirManager) {
for (String superClazz : superClass) {
Clazz c = dirManager.findClazzFull(superClazz);
if (c != null) {
for (int i = 0; i < 3; i++) {
for (Function f : c.getFunctions(i)) {
if (functions[i].contains(f)) {
System.out.println("Tagging " + f.name ... |
3a091dc0-336e-4264-a652-3a1f3ced77df | 2 | public void randomPermutation() {
// copy this list into a temporary list
NodeOutgoingConnectionsList tmp = new NodeOutgoingConnectionsList(false);
while(!this.isEmpty()) {
tmp.push(this.pop());
}
java.util.Random rand = sinalgo.tools.statistics.Distribution.getRandom();
while(!tmp.isEmpty()) {
int o... |
f96b242f-b352-47c0-8ee1-ab30a959d95b | 5 | private int decide( String san, byte colour ) {
switch ( san.charAt( 0 ) ) {
case 'K':
return getKingOrigin( san.substring( 1 ), colour );
case 'Q':
return getQueenOrigin( san.substring( 1 ), colour );
case 'B':
return getBishopOrigin( san.substring( 1 ), colour );
ca... |
b1bd0c2a-6c6e-4689-ab79-7d5cedcb82d7 | 7 | public void setter(Object obj, String value)
throws IllegalArgumentException {
Method getMethod = getGetMethod();
Class<?> fieldType = getMethodReturnType(getMethod);
Method setMethod = getSetMethod(fieldType);
if (fieldType == String.class) {
try {
s... |
26e46b40-cca8-4c48-9ada-5324edb30c19 | 0 | public void println(){
System.out.println(_name);
} |
ce05bdf3-6108-4f68-984a-f602b7038b38 | 5 | public void outTextSearch(Point aPoint)
{
int pointX = (int)aPoint.getX();
int pointY = (int)aPoint.getY();
for(Map.Entry<Integer,TreeNode> e : this.nodes.entrySet())
{
TreeNode node = e.getValue();
int nodeX = (int)node.getTarget().getX();
int nodeY = (int)(node.getTarget().getY());
if((no... |
443a9875-85fc-4767-8e96-d4124bc67007 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Curso other = (Curso) obj;
if (descripcion == null) {
if (other.descripci... |
44820192-0113-4cae-826e-9128e234bfc5 | 7 | public String getPopulationDetails(Field field)
{
StringBuffer buffer = new StringBuffer();
if(!countsValid) {
generateCounts(field);
}
for(Class key : counters.keySet()) {
Counter info = counters.get(key);
int stringLength = info.getName().length(... |
c2dddd07-a6ac-4bb5-b343-13df4b0d557f | 7 | public static void main(String[] args) throws IOException {
CommClient client;
if (args.length > 0) {
client = new CommClient(args[0]);
}
else {
client = new CommClient("13");
}
String robotInput;
GUIBoard board = new GUIBoard();
board.setVisible(true);
board.repaint();
while ((robot... |
71a8b4ef-f262-4039-8459-7500e5fecd17 | 1 | @Test
@SuppressWarnings("unused")
public void testSizeOfNeighborhood() throws Exception {
// keeping the same implementation as before
// how does the size of the neighborhood influence the performance (root mean square error) of the recommender?
int[] sizes = {5, 10, 20, 40, 100, 200, 300, 400, 600, 800, 1200}... |
4c77d2d7-355d-4d41-8138-ea31ac1dce31 | 5 | public static void main(String[] args){
int c = 1;
int a = 1;
int b = 1;
//brute force method to check all values from 1-1000 if they meet the 2 conditions a+b+c==1000 abd c^2 == a^2 + b^2
for(c=1; c<998; c++){
for(b=1; b<998; b++){
for(a=1;a<998; a++){
if(a+b+c == 1000){
if(c*c == a*a + ... |
5d3d44a9-2b07-4b3d-8ba8-084bd5adc31f | 1 | public void setMovingDown(boolean isMovingDown) {
this.isMovingDown = isMovingDown;
this.isMovingUp = isMovingDown ? !isMovingDown : this.isMovingUp;
} |
6e087a5c-7160-4532-8499-3bcd3dfa5b70 | 2 | public void run() {
try {
ssocket = new ServerSocket(serverPort);
while (open_port) {
Socket s = ssocket.accept();
ClientSocketHandler csh = new ClientSocketHandler(s, list);
csh.start();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
56bceb34-0257-4d1d-bbff-2919cc8cb61c | 3 | @Override
public boolean isRight(String answer) {
if (answer != null) {
String trimmed = answer.trim();
for (String variant : variants) {
if (isEquals(variant, trimmed, ignoreCase)) {
return true;
}
}
}
r... |
f70bf1d1-fa8f-47c3-92ef-dafc1ed1f674 | 9 | protected TrackingGraph performOperation(GraphComponent component, Operation operation, boolean externalCall)
{
if(isShadow && externalCall)
throw new UnsupportedOperationException(
"A shadow graph only takes modifications from its transaction queue.");
if(externalCall)
if(((operation == Operation.ADD) ... |
61c226da-9158-4914-993e-5837cbad8740 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
742ab052-7409-4b04-95ae-7521dd432f13 | 4 | public int findScore(State state, int depth, char colorToPlay) {
nodeCount++;
if(depth == maxSearchDepth){ //Once at leaf, return the score of that state
return state.score();
}
List<Integer> legalMoves = state.legalMoves();
int bestScore = colorToPlay == 'X' ? -101 : 101; //Initialize best score as imp... |
496e84c8-4ada-4a77-b79b-37386a78c5ed | 9 | public int divide(int dividend, int divisor) {
if (divisor == 1)
return dividend;
int count = 0;
long tmpDividend = dividend;
tmpDividend = Math.abs(tmpDividend);
long tmpDivisor = divisor;
tmpDivisor = Math.abs(tmpDivisor);... |
d8fd3282-90cb-47ef-aad1-ce7b89f924ad | 2 | public int access_y_coordinate(int y) {
if (y < 0) {
return 0;
} else if (y >= width) {
return width - 1;
} else {
return y;
}
} |
63dd96af-9d1a-4940-b5f2-aad292130760 | 4 | public String[] findIndexFiles(File[] files) {
ArrayList<String> indices = new ArrayList<String>();
for (File file : files) {
String s = file.getAbsolutePath();
if (s.contains(".idx")) {
if (s.contains("cache")) {
indices.add(s);
... |
d011fa15-07cc-4e47-af3d-bb0fa6d7f617 | 8 | protected static String[] removeKey(String[] args) {
String[] result = null;
if (args != null && args.length > 0) {
// args is not empty
// find value.
if ((args[0].startsWith("-") && args[0].length() == 2)
|| (args[0].startsWith("--") && !args[0].contains("="))) {
result = ... |
418cdf39-f71a-4548-b235-a1ff7444f5a1 | 4 | private DefaultListModel <String> refreshListModel ()
{
List<User> userList = Accounts.instance().getUserList();
if ( ! userList.isEmpty() )
{
logger.debug( "Refreshing user data." );
for ( User user : userList )
{
listModel.addElement( u... |
0a8e1172-eec0-40cb-aca0-bbc8eb4947eb | 8 | private static String escapeJSON(String text) {
final StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
final char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
... |
37200f28-7952-4417-bd62-7ab62dce5185 | 9 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
n = Integer.parseInt(st.nextToken());
m = Integer.parseInt(st.nextToken());
k = Integer.pars... |
92b376db-5064-434b-adca-77dbfb89f38c | 6 | public static boolean isBinaryFile(File file) throws IOException {
InputStream in = null;
try {
in = new FileInputStream(file);
int size = file.length() > 500 ? 500 : new Long(file.length()).intValue();
byte[] bytes = new byte[size];
in.read(bytes, 0, byt... |
86bbe271-122f-4d52-8cab-95c0ce531c4a | 8 | public AddUserAccountBusinessJPanel(JPanel UserProcessContainer,UserAccountDirectory userAccountDirectory,BusinessAdminUserAccountsJPanel baujp,Business business) {
initComponents();
this.UserProcessContainer = UserProcessContainer;
this.userAccountDirectory = userAccountDirectory;
this.... |
f5d18e6b-d79c-477f-b162-3f4c82f542ab | 0 | @Override
public String toString() {
return "Fossils found!" + super.toString() + " Fossil=" + this.fossil + " SeenFossil=" + this.seenFossil;
} |
8543ee14-f8d1-460c-8ee7-af6216dec3ff | 7 | public void finishedSelectingUnits(TilePanel tilePanel, List<Unit> chosenUnits) {
UnitActionDetector unitActionDetector = new UnitActionDetector(selectedPanel, selectedUnit, tilePanel, chosenUnits);
if (unitActionDetector.isSelectingUnit()) {
selectedPanel = tilePanel;
selectedPanel.addTi... |
68509288-03c1-4c7e-aa57-b79ef93da39f | 4 | @Override
public Class<?> getColumnClass( int column ) {
switch( column ){
case 0: return Integer.class;
case 1: return Integer.class;
case 2: return Object.class;
default: return String.class;
}
... |
d7e25732-6983-447a-b38f-e9c6697b769e | 6 | public boolean chargeForRoad() {
if (! resForRoad()) return false;
for (int i = 0; i < BRICK_ROAD; i++) _hand.remove(Resource.Brick);
for (int i = 0; i < ORE_ROAD; i++) _hand.remove(Resource.Ore);
for (int i = 0; i < SHEEP_ROAD; i++) _hand.remove(Resource.Sheep);
for (int i = 0; i < TIMBER_ROAD; i++) _hand.re... |
3929339e-dcd6-4b3c-820c-081bcff03d19 | 4 | * @return The column index, or <code>-1</code> if none is found.
*/
public int overColumnIndex(int x) {
int pos = getInsets().left;
int count = mModel.getColumnCount();
for (int i = 0; i < count; i++) {
Column col = mModel.getColumnAtIndex(i);
if (col.isVisible()) {
pos += col.getWidth() + (mDrawColu... |
9b40c066-9392-4f96-86ac-b50b7909bb5f | 7 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String data;
try {
ArrayList<FilterBean> alFilter = new ArrayList<>();
if (request.getParameter("filter") != null) {
if (request.getParameter("filterop... |
6574accb-e488-4e63-ac9f-c81fbd29f3eb | 9 | @Override
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
ImageData imgData = sheetData.getCurrentImageData();
if (imgData.hasImage()){
g.clearRec... |
06005834-e1c5-4cdc-af23-4e45952bb8cf | 3 | public void update(long elapsedTime) {
//rotation = Math.atan2(this.getVelocityX(), this.getVelocityY());
// select the correct Animation
Animation newAnim = anim;
newAnim = creatureAnim[(int)getRotation()];
// update the Animation
if (anim != newAnim) {
ani... |
677c885d-a8d6-4d03-9a3d-05e898d5d9d9 | 2 | public boolean GenerarPagos(Pago p){
//se establese la coneccion con la base de datos
conn = Conector.conectorBd();
//desmembramos la clase pago y los pasamos de String a integer con parse int
int monto=p.getMonto();
String fecha=(p.getFechapago());
int Departamento=(p.getNdepto()... |
eae0410a-e501-438f-ab27-d06f107f9583 | 7 | public void paint(Graphics g)
{
g.setColor(Color.PINK);
if(detonateLocal)
{
if (senbonSakuraC-->0)
{
g.fillOval((int)x-SENBONSAKURA_RADIUS/2, (int)y-SENBONSAKURA_RADIUS/2, SENBONSAKURA_RADIUS, SENBONSAKURA_RADIUS);
}
... |
d04da61c-da03-41ed-a3d5-52e65cfb47aa | 0 | public int getAnzahlEinheiten() {
return this.anzahlEinheiten;
} |
0a710672-fa4a-489e-977c-8d7477647d3b | 3 | private QcTestStatus toTestStatus(String strStatus) {
QcTestStatus status = null;
if ("PASS".equals(strStatus)) {
status = QcTestStatus.PASSED;
} else if ("FAIL".equals(strStatus)) {
status = QcTestStatus.FAILED;
} else if ("SKIP".equals(strStatus)) {
... |
e199349e-6d48-4e38-97c8-e217f01ead54 | 8 | public boolean hit(Ray ray) {
double ox = ray.getOrigin().getX();
double oy = ray.getOrigin().getY();
double oz = ray.getOrigin().getZ();
double dx = ray.getDirection().getX();
double dy = ray.getDirection().getY();
double dz = ray.getDirection().getZ();
double ... |
57c4df38-1d29-4fda-b54a-94a8a10e2559 | 2 | private void createRouteDirectionFrame()
{
if (wGraph.hasRoute(toNode))
{
if (routeFrame != null)
{
routeFrame.dispose();
routeFrame = null;
routeScroll = null;
}
routeScroll = new JScrollPane(directions);
routeFrame = new JFrame("Directions"); // evt fra bla til bla
//routeFrame.add(... |
80d54dba-e04a-45a9-89bb-3e2b19b1451c | 9 | public void setLanguage(String par1Str)
{
if (!par1Str.equals(this.currentLanguage))
{
Properties var2 = new Properties();
try
{
this.loadLanguage(var2, "en_US");
}
catch (IOException var8)
{
;
... |
309cce5c-e93f-41e0-a97e-b36ce379cef0 | 1 | private static JMenu getViewMenu(EnvironmentFrame frame) {
Environment environment = frame.getEnvironment();
JMenu menu = new JMenu("View");
Serializable object = environment.getObject();
if (AutomatonAction.isApplicable(object)) {
Automaton automaton = (Automaton) object;
LayoutStorageAction store = new ... |
96341af3-5e03-4e97-a932-1f66fe561ecd | 6 | public int minCut(String s) {
if (s == null || s.length() == 0) {
return 0;
}
int[] cut = new int[s.length() + 1];
boolean[][] isPalindrome = getIsPalindrome(s);
cut[0] = 0;
for (int i = 1; i <= s.length(); i++) {
cut[i] = Integer.MAX_VALUE;
for (int j = 1; j <= i; j++) {
if (isPalindrome[i -... |
b3b0236f-09ba-432d-8404-33340b357b7f | 9 | @Override
public Component prepareRenderer(TableCellRenderer renderer,
int rowIndex, int vColIndex) {
Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
if(global.markChanges){
if(rowIndex>=ch.length) restate();
if(ch[rowIndex]>0 && vColIndex==1){... |
e218414b-0a01-4b4e-bb25-336fecd0a0d0 | 7 | public final void codeM(Member m) {
int modifiers=m.getModifiers();
if (Library.isField(m)) {
if ((modifiers & 0x0008)>0)
code(0xb2); // | getstatic
else
code(0xb4); // | getfield
writeShort(getIndex(m,12));
} else {
// method or constructor
boolean inIn... |
5b1338a8-e087-4684-a86e-36622e8765c1 | 0 | @Override
public void setState(StateModule state) {
this.state = state;
} |
b0679a2f-7541-4eee-aaa8-4c195e05a4d8 | 4 | /*Update DisplayName*/public boolean changeDisplayName(String username, String displayname){
try{
if(username.length() > 40)return false;
select1.setString(1, username);
ResultSet rs = select1.executeQuery();
while(rs.next()){
if(rs.getString("username").equals(username)){
updateDisplayNam... |
c5ed620b-c1ca-415d-9a89-026fa071ffe2 | 5 | @Override
public void render(GameContainer gc, Graphics g) {
g.setColor(C);
if (IntialParalysis > 0) {
Color Cn = new Color(C.b, C.g, C.r);
g.setColor(Cn);
}
if (health > 0) {
g.draw(getBounds());
} else {
if (a != null) {
... |
85dd3572-4894-4e74-b623-5c0b6c797276 | 9 | public void run() {
HTable table = null;
try {
Configuration conf = HBaseConfiguration.create();
table = new HTable(conf, tableName);
table.setAutoFlush(false);
} catch (IOException e) {
System.err.println("Error writing to Hbase");
}
while ((!out.getStatus().equals("done")) || (out.getOutQ().siz... |
541b394d-4f2e-4d10-9f05-62ecde5e77e7 | 6 | public static final String replaceTabsWithSpaces(String text,
int tabSize) {
String tabText = "";
for (int i=0; i<tabSize; i++) {
tabText += ' ';
}
// Common case: User's entering a single tab (pressed the tab key).
if (text.length()==1) {
return tabText;
}
// Otherwise, there may be more than... |
9cfeca05-ecb7-4bb2-82c5-ba7440f9fcfe | 9 | public String quoteIdentifier(CharSequence ident, IdentifierQuotingStrategy strategy, IdenitfierPart idenitfierPart) {
if(strategy == null){
throw new NullPointerException("strategy parameter of Dialect.quoteIdentifier must not be null (and is null)");
}
if(ident == null){
return n... |
edfe1655-dd26-413f-9cfd-0b9142a25797 | 3 | public byte[] getGraph(String dot_source, String type)
{
File dot;
byte[] img_stream = null;
try {
dot = writeDotSourceToFile(dot_source);
if (dot != null)
{
img_stream = get_img_stream(dot, type);
if (dot.delete() == false)
Sys... |
5c2d1827-5d94-4d2a-9f04-0331fc6270e8 | 3 | private static void add_Luncher_Destructor(War war) {
System.out.println("Select launcher detroyer type: Plane or Ship: ");
String type = scanner.next();
while (true) { // user
if (type.equalsIgnoreCase("ship") || type.equalsIgnoreCase("plane")) {
war.Create_Launcher_Destroyer(type);
break;
} else ... |
4a34b9f2-7e9f-408d-aa3a-9c2104fc76c5 | 8 | @Override
public void execute( CommandSender sender, String[] args ) {
if ( !( sender.hasPermission( "bungeesuite.version" ) || sender.hasPermission( "bungeesuite.admin" ) ) ) {
ProxiedPlayer p = ( ProxiedPlayer ) sender;
p.chat( "/bsversion" );
} else {
ByteArray... |
f4fcb339-58c0-4fc2-92c2-e82245ca0057 | 4 | private void btnLoadRegExpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadRegExpActionPerformed
String regExp = this.txtRegularExpression.getText();
if(regExp.isEmpty()){
JOptionPane.showMessageDialog(this,"Regular Expression field can't be empty.", "Invalid Regular Expression"... |
a2cf1ff0-9bc4-4c1c-a11f-5ef7c1473f01 | 5 | private void generateModeExclusionRules(List<CtModeExclusionRule> modeExclusionRules) {
if (null == modeExclusionRules || modeExclusionRules.size() == 0) return;
for (CtModeExclusionRule exclusionRule : modeExclusionRules) {
List<String> excludedList = exclusionRule.getExcludeWith();
if (null == excludedList ... |
dfae0d94-26b4-46f0-b791-5e5af964a00b | 5 | @Override
public boolean equals(Object obj)
{
if (obj instanceof Rectangle)
{
Rectangle tmp = (Rectangle) obj;
if (this.getP1().equals(tmp.getP1()) &&
this.getP2().equals(tmp.getP2()) &&
this.getP3().equals(tmp.getP3()) &&
... |
ae58cba9-6257-46d2-b34e-a78babf2fbf6 | 4 | public boolean matchesColor(LevelColor c){
if(a == c.getAplha() && r == c.getRed() && g == c.getGreen() && b == c.getBlue()){
return true;
}
return false;
} |
1a6aa3c0-cfe3-454b-a893-97898972be48 | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
int Count = Main.DecodeInt();
for(int i = 0;i<Count;i++)
{
int UserId = Main.DecodeInt();
int index = Main.Data.Friend_Requests.indexOf(UserId);
if(index < 0)
{
... |
12af0a4f-7467-414c-bd95-29ab998281a7 | 7 | private void placePlanets(final List<Player> orderedPlayerList) {
ListIterator<Player> it = orderedPlayerList.listIterator();
boolean continueToNextPlayer;
Player player;
for (int i = 0; i < NB_PLANETS_PER_PLAYER; i++) {
continueToNextPlayer = true;
while (continueToNextPlayer) {
// If the round is ... |
8efd1825-2e54-4106-9f6b-f9581ffacba8 | 9 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws
IOException,
ServletException,
IllegalS... |
8498246c-eb79-450a-9c0c-f3790994e4b6 | 4 | public static ArrayList<String[]> ToateSpectacolele()
{
//Citeste spectacolele din tabelul Spectacole al bazei de date
ArrayList<String[]> data = new ArrayList<>();
SQLiteStatement queryResult = null;
try
{
queryResult = database.prepare("SELECT ... |
a6c87f0d-b51b-44ee-b23e-521ac5acc9fd | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
8e82ebf7-d56e-4c7d-bc15-2347428c5b74 | 4 | public static List<Customer> formatOutputs(JSONArray results) {
final List<Customer> ret = new ArrayList<Customer>();
for (int i = 0; i < results.length(); i++) {
JSONObject r = null;
if (results.get(i) instanceof JSONObject)
r = (JSONObject) results.get(i);
if (r != null) {
final Customer c = new... |
853f18d3-7311-40e6-9d49-388e567d0161 | 3 | @Override
public RoomInfo emitEvent(String event, Jsonable data) throws NetworkMethodException {
Socket socket = null;
ObjectOutputStream oOut = null;
ObjectInputStream oIn = null;
RoomInfo result = null;
Object request, response;
try {
socket = new Socket(Constants.SERVER_IP, Constants.SERVER_PORT);
... |
f921ae44-bcd3-4b34-87dd-d33d3cc3f19e | 7 | protected void throwNotEnclosedException(Token openToken, Token bestToken){
StringBuilder errorText = new StringBuilder();
// main text
errorText.append("Missing enclosing separator");
// source
errorText.append(" @");
errorText.append(openToken.... |
e08df3d3-b7d4-4f7b-baf9-2a3fba6f15a3 | 8 | private WordFinder(SearchType t)
{
this._SearchType = t;
this.setPriority(Thread.MIN_PRIORITY);
for (int i = 0; i < 15; i++)
{
for (int k = 0; k < 15; k++)
{
Color c;
sw... |
a9a34a7c-e509-4f87-8698-22b92dcdbb51 | 1 | private boolean registerTemplate(Template template){
if(registredTemplates.contains(template))
return false;
else{
registredTemplates.add(template);
return true;
}
} |
af245dd9-55ee-4be0-b91e-da2a446382aa | 5 | public void checkShipCollisions() {
for (Ship ship : ships) {
boolean tmp[] = check.checkWallCollisions(ship);
if(tmp[0]==true){
ship.getPos().setX(ship.getSize().getWidth()/2);
}
if(tmp[1]==true){
ship.getPos().setY(ship.getSize().... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.