method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4df29dd7-cbc4-4a54-8a9b-b678d6360a6f | 6 | public boolean equals( Object obj )
{
if( obj instanceof Unicodestring )
{
// compare Unicode strings at byte level rather than just string value
// if(val.equals(obj.toString()))return true;
if( westernencoding )
{
if( java.util.Arrays.equals( getWesternBytes(), ((Unicodestring) obj).getWesternByt... |
b9218810-b4ad-4d15-a4d3-caa5c741f1d3 | 0 | public String getMotif() {
return motif;
} |
4298f1c3-b89f-4d95-a079-218ca88960b2 | 4 | public static void main(String[] args) {
numOfman = 6;
//initailize man list
for(int index = 0; index < numOfman; index++){
String indexToString = "" + (index+1);
men.add(indexToString);
}
int counter = 1;
int index = 0;
//iterate man list
while(men.size() > 1){
//System.out.p... |
a74de77b-c5a9-4e39-8c90-7e36508e5532 | 7 | private final boolean cvc(int i)
{ if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} |
eeb59f58-58c2-4dc2-a9f0-109ac80311c8 | 8 | public ArrayList<Square> getLongestPath(Square where)
{
ArrayList[][] grid=makeGrid();
grid[where.x()][where.y()]=new ArrayList<Square>();
grid[where.x()][where.y()].add(where);
Queue<Square> active=new Queue<Square>();
active.push_back(where);
int longestPat... |
a5a323ec-68bf-4f28-a0d5-40ded16882db | 8 | public QRDecomposition (Matrix A) {
// Initialize.
QR = A.getArrayCopy();
m = A.getRowDimension();
n = A.getColumnDimension();
Rdiag = new double[n];
// Main loop.
for (int k = 0; k < n; k++) {
// Compute 2-norm of k-th column without under/overflow.
double n... |
e1cb4713-d7e8-4b53-a5df-0bf3e4a1ea6b | 2 | private Integer updateCity(Criteria criteria, AbstractDao dao) throws DaoException {
Integer idDescription = (Integer) criteria.getParam(DAO_ID_DESCRIPTION);
if (idDescription != null) {
Criteria beans = new Criteria();
beans.addParam(DAO_ID_DESCRIPTION, idDescription);
... |
254703ae-bde9-4fe5-a164-3814eef7db82 | 9 | static void addSubstitutions(int i, XMLNode xmlnode, StartupFileParser startupfileparser)
throws InvalidStartupElementException
{
int j = startupfileparser.nodeCount("substitute", xmlnode.XMLChild, true);
Bot bot = startupfileparser.getCurrentBot();
for(int k = j; k > 0; k--)
... |
ae74ec20-521c-4511-959f-12991a9e24c1 | 1 | private String[] readRow(CSVParser csv) {
try {
String[] r = csv.getLine();
return r;
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} |
52ca98ca-9333-4ed4-99d7-61a2bc3a7f08 | 0 | public String getToolTip() {
return "State Collapser";
} |
5ce18a61-ffea-4ff7-a730-a1aca5e41b99 | 6 | public void parseFile() throws IOException {
BufferedReader br = new BufferedReader(new FileReader(filename));
String line;
int i;
int curMajor;
int majorCount;
while ((line = br.readLine()) != null) {
String[] vals = line.split(",");
if (vals.length == 0) {
continue;
}
elements = new int... |
f4af53eb-9587-4dcf-8139-73acf78580da | 0 | public String getName() {
return name;
} |
791c1647-2dc9-4743-b800-3aad37379c75 | 9 | public static void main(String args[]) {
int spc = 1;
final int SIZE = 12;
int r = SIZE/2;
int s = 0;
int x = 1;
for (int i = r; i >=1; i--) { //line level
for (int j = 1; j <= i; j++) { //L star flag
System.out.print("*");
}
for (int j = 1; j <= x; j++) { //space maker
System.out.... |
8318f3ee-33f4-4145-9733-97fefa1d2305 | 3 | public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
if (isDeclaration) {
StoreInstruction store = (StoreInstruction) instr;
LocalInfo local = ((LocalStoreOperator) store.getLValue())
.getLocalInfo();
writer.startOp(writer.NO_PAREN, 0);
local.dumpDeclaration(writer);
... |
0120a34c-43ba-4039-bd05-c580e702d9c7 | 0 | public void Connect() throws Exception {
conn.init();
conn.connect();
} |
bf023efc-8a0e-4f27-a0af-e2d69931ab46 | 4 | public static void insertMedia(MediaCopy mc){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedSt... |
fa1289ab-8d1d-4b03-a6b3-572df3c7c1ea | 6 | public Set<Map.Entry<K,Float>> entrySet() {
return new AbstractSet<Map.Entry<K,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TObjectFloatMapDecorator.this.isEmpty();
}
public b... |
e30d8ffd-e6a6-422c-8f27-7b86a3725d4c | 1 | public static void main(String args[]) throws FileNotFoundException{
inputgraph();
exploredarray.add(1);
pathlength[1] = 0;
for(int j = 0; j <200; j++){
findnextvertextotraverse();
System.out.print(vertextotransverse);
System.out.print(score);
addtotheexplored();
}
//7,37,59,82,99,115,133,165,188... |
5c448242-3d74-4208-b47f-0c8cfff26325 | 7 | public int runGame() {
Player currentPlayer = whitePlayer;
Player otherPlayer = blackPlayer;
int moves = 0;
int end = Definitions.NO_WIN;
Move nextMove = null;
currentHumanBoard.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we) {
currentHumanBoard.setVis... |
f5aceaa3-e27c-4287-9c3c-517843fa0d03 | 0 | public IrcMessageHandler(AprilonIrc plugin){ Parent = plugin; } |
3a082295-457f-414a-af27-15d0d27e3091 | 5 | public PercolationStats(int N, int T) // perform T independent computational experiments on an N-by-N grid
{
if (N<=0 || T<=0)
{
throw new IllegalArgumentException();
}
mean = 0;
stddev = 0;
confidenceLo = 0;
confidenceHi = 0;
double [] x = new double [T];
double counter = 0;
for (int ... |
d07519fb-7604-4f4e-8870-7cea7162715d | 9 | @Override
public String toString()
{
StringBuilder sb = new StringBuilder();
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
sb.append( "+-----" );
}
sb.append( "+\n" );
for (int x = 0; x < width; x++)
{
sb.append( "|" );
if (board[y][x] >= 0)
{
Tetr... |
9971b807-018d-410d-9273-ad59a3b2033a | 2 | public void addEdge(String v, String w) throws InvalidEdgeException,
SelfLoopExistsException, ParallelEdgeExistsException
{
// / Insert names into the hash table. Associate current size as the
// value
if (!contains(v))
st.put(v, st.size());
if (!contains(w))
st.put(w, st.size());
// Reverse index
... |
74670ab3-f515-40a6-b8fa-759663b36cd4 | 3 | private String type() throws UnexpectedTokenException
{
StringBuilder type = new StringBuilder();
this.expect(IDENT);
type.append(this.getToken().data);
this.nextToken();
if(this.accept(LBRACK))
{
while(true)
{
type.append('[');
this.nextToken();
this.expect(RBRACK);
type.append(']'... |
0d3850ee-4286-4211-819c-bccfbf6400e1 | 7 | public static Object getValue(HSSFCell hssfCell) {
Object ret = null;
if(hssfCell == null) {
return null;
}
switch(hssfCell.getCellType()) {
case CELL_TYPE_BLANK:
break;
case Cell.CELL_TYPE_BOOLEAN:
ret = hssfCell.getBoo... |
1e7d9781-f7d0-4651-91db-6ddd2ae6838c | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
eca53094-2d8b-48fa-a6a3-af03de1cf980 | 6 | private int findEntry(K key) {
int avail = -1;
checkKey(key);// check null
int i = hashValue(key);// hash function *
int j = i;
do {
Entry<K, V> e = bucket[i];
if (e == null) {
if (avail < 0) {
avail = i;// key not in table
}
break;
} else if (key.equals(e.getKey()))// find the key
... |
2ed3185a-0547-41f8-85a9-9deec562e907 | 6 | public Painter() {
// MAIN JFRAME
JFrame f = new JFrame();
f.setSize(new Dimension(500, 500));
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// ENCOMPASSING PANEL
JPanel p = new JPanel();
p.setBackground(Color.WHITE);
p.setLayout(new BorderLayout());
// LEFT
JPanel leftPanel = new JPanel();
... |
1e3b7a56-0257-4ae8-858e-e16e24989e3b | 4 | public int lookupOffset(String id) {
for (Symbol p : params) {
if (p.getName().equals(id)) {
return p.getOffset();
}
}
for (Symbol v : symbols) {
if (v.getName().equals(id)) {
return v.getOffset();
}
}
return -1;
} |
130bdd97-1794-42a4-a87b-cf0f3d67ff3a | 9 | @Override
public double minValue(BackgammonState state, String player, double alpha, double beta, int depth) {
expandedNodes++;
maxDepth = Math.max(maxDepth, depth);
if (depth >= currDepthLimit || state.getUtility() == 1 || state.getUtility() == 0) {
return eval(state, player); /... |
07c209f2-ccfc-41c4-8f53-5c7cc5040ed7 | 0 | public boolean isInteresting() {
return this.interesting;
} |
a46489e8-380c-4f30-9d00-8b394ac4b2fd | 2 | protected int endOfLineOf(int offset) throws BadLocationException {
IRegion info = fDocument.getLineInformationOfOffset(offset);
if (offset <= info.getOffset() + info.getLength())
return info.getOffset() + info.getLength();
int line = fDocument.getLineOfOffset(offset); ... |
94242a6e-1b77-42f0-97be-a043524f9543 | 8 | public static void main(String[] args)
{
/*if (args.length < 3)
{
System.out.println("Not enough arguments. Arguments needed are contacts server ip, this client's port and your nickname (no spaces).");
System.exit(-1);
}
else
{
try
{
@SuppressWarnings("unused")
Chat chat = new Chat(args[... |
51591f7d-ed5f-469f-8828-c2ce414250d8 | 2 | void init(String genomeVersion, String configFileName, String dataDir) {
treatAllAsProteinCoding = false;
onlyRegulation = false;
errorOnMissingChromo = true;
errorChromoHit = true;
this.dataDir = dataDir;
readConfig(genomeVersion, configFileName); // Read config file and get a genome
genome = genomeByVe... |
e569bc45-fca8-47a5-91f0-ce407d37b50b | 0 | public VueAbstraite(CtrlAbstrait ctrl) {
this.controleur = ctrl;
} |
f6a653ab-071d-40c1-83d7-48f8ed8dff9f | 3 | public static boolean connect(int indexReader, String protocol)
throws CardException, IOException {
boolean sucess = true;
List<CardTerminal> terminals = getTerminalsList();
terminal = (CardTerminal) terminals.get(indexReader);
Logger.log("Leitora: " + terminal.toString()... |
87369347-331e-468c-9c67-8243fb506c4f | 8 | private List<Shape> getShapesOrderedWithoutTop(Collection<Line> lines) {
final List<Shape> all = new ArrayList<Shape>(shapes);
final Set<String> tops = new HashSet<String>();
final Map<String, Shape> shs = new HashMap<String, Shape>();
for (final Iterator<Shape> it = all.iterator(); it.hasNext();) {
final S... |
15d16cf4-cc3f-49fa-9693-7aae33cc71fc | 9 | public static Tip_LIzraz_Const_Niz PROVJERI_primarni_izraz(){
String linija = mParser.ParsirajNovuLiniju();
UniformniZnak uz = new UniformniZnak(linija);
Tip_LIzraz_Const_Niz vrati = new Tip_LIzraz_Const_Niz();
mZadnjiPrimarniIzrazJe_NIZ_ZNAKOVA = false;
if (uz.mNaziv.equals("IDN")){
ClanTabliceZnakova ... |
a2285959-c7f2-4fe7-ad5f-7a7d43df3042 | 9 | @Override
public void render(int glMode) {
float scale = radius / 10;
float width = 128f;
float zoomFactor = Model.getModel().getViewport().getZoomFactor();
// TODO disappear zoom should depend on the eventual orbit radius
boolean disappearZoom = scale / radius * zoomFactor < 0.0005f;
if (disappearZoom &&... |
0fca5722-2447-4bce-8e20-3e1cdc283899 | 0 | @Override
public int compareTo(Person o) {
return new Integer(age).compareTo(new Integer(o.age));
} |
f1bb4c67-2e1f-4eb0-ad43-3d004feb1097 | 8 | public void onTrigger( TriggerEvent event ) {
log( 3, "Engine Triggered by " + event.getName() + " for Player " + event.getPlayerInteractEvent().getPlayer().getName() );
VoodooLocation location = findVoodooLocation( event );
if( location == null ) {
log( 3, "No location found" );
return;
}
Str... |
e6ce7382-b15e-4ddd-b29b-e0368d306efb | 6 | private static double[][] computeHarrisResponse(double k, double[][] lx2,
double[][] ly2, double[][] lxy) {
int width = ly2.length, height = ly2[0].length;
double[][] harrisResponse = new double[width][height];
double max = 0;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
harris... |
62f79892-b885-4e52-b398-e51dfb3f435a | 1 | public static void isFalse(boolean condition, String message)
throws IllegalArgumentException
{
if(condition)
{
throw new IllegalArgumentException(message);
}
} |
d9154385-8ed1-461e-a253-776e6c8534cf | 0 | public static String getRatingDescription(int ratingId) {
return ratingsMap.get(ratingId);
} |
d77a7f5e-0cd2-43ed-a638-7d0113aff1d2 | 7 | public static int maxProfit(int[] prices) {
if (prices.length == 0) {
return 0;
}
if (prices.length == 1) {
return 0;
}
int low = prices[0];
int high = prices[0];
int lowPos = 0;
int highPos = 0;
int max = 0;
for (int i = 1; i < prices.length; i++) {
if (prices[i] > high) {
high = price... |
ef9b0f38-2632-4285-8802-d42004a04672 | 7 | public final void displayForeignStringAsLiteral(byte[] s, PrintStream port) {
try {
StringBuilder sb = new StringBuilder();
sb.append('"');
for (int i = 0; i < s.length; i++) {
char c = decode(s[i]);
if (c >= 0x20 && c <= 0x7E) {
... |
132a5c15-93cf-4593-b87b-83a8f59cabba | 0 | public void setName(String name) {
this.name = name;
} |
b202d733-e41c-4a4e-a48e-f6d6bb407e1b | 7 | @Override
public ArrayList<Object> searchGoods(String info) {
class SearchUnit implements Comparator<Object>{
int sum = 0;
final int num;
public SearchUnit(int i) {
this.num = i;
}
public void plus() {
sum ++;
}
@Override
public int compare(Object o1, Object o2) {
if(((SearchUnit)... |
1df58d1a-63bc-4b55-b129-22230aafc62e | 7 | private RsToken identifier(int value) throws RsParsingException{
StringBuffer sbuff;
sbuff=token.getStringBuffer();
sbuff.append((char)value);
value=nextChar();
while(value=='_'
|| value>='A' && value<='Z'
|| value>='a' && value<='z'
|| value>='0' && value<='9'){... |
7cc3e806-5f25-4cc9-98ba-04a61a68f2c9 | 0 | public BufferPoolExceededException(Exception e, String name){
super(e, name);
} |
2444b964-6607-4f42-97e0-12aac464a3bf | 1 | public Multikill() {
instance = this;
listeners = new ListenerHolder<>();
listeners.addListener(new KillListener(this));
if (!this.getDataFolder().exists())
this.getDataFolder().mkdir();
configFile = new File(this.getDataFolder(), "config.yml");
} |
ed965b19-55ed-4ee3-8e3a-4f139b974245 | 1 | public Set getDeclarables() {
Set used = new SimpleSet();
if (instr != null)
instr.fillDeclarables(used);
return used;
} |
a91a8597-19f5-4153-b1de-49ced3323f6a | 4 | public void setMessage(String msg){
String message = "<html><center>";
int charInLine = MAX_CHAR;
for (int i = 0; i < msg.length(); i++){
message += msg.charAt(i);
charInLine--;
if(charInLine <= 0){
if (i < msg.length()-2 && msg.charAt(i+1) == ' '){
charInLine = MAX_CHAR;
... |
ac2fb27a-39b3-4519-9f55-2d3e87705984 | 2 | public void index(Map<String, TreeSet<Item>> index, Item newItem, String... varags) {
for(String s: varags) {
if(!(index.containsKey(s))) {
TreeSet<Item> tempSet = new TreeSet<Item>();
tempSet.add(newItem);
index.put(s, tempSet);
}
... |
19cbf944-3cfc-4222-bc53-ec44410600a0 | 6 | void parseEntityRef(boolean externalAllowed) throws java.lang.Exception
{
String name;
name = readNmtoken(true);
require(';');
switch (getEntityType(name)) {
case ENTITY_UNDECLARED:
error("reference to undeclared entity", name, null);
brea... |
1cae82e4-6a81-487d-be76-5d2b24d04974 | 0 | public void setPaymentType(String paymentType) {
this.paymentType = paymentType;
} |
bd82f2e0-7580-4cb2-a7b4-560caa513a6d | 4 | public BitMatrix insert(BitMatrix M, int i, int j)
{
if (i+M.n>n || j+M.n>n)
throw new Error("Insertion overflow");
for (int r=0;r<M.n;r++)
{
BitSet src = M.m[r];
BitSet trg = m[i+r];
for (int c=0;c<M.n;c++)
trg.set(c+j,src.get(c));
}
return th... |
c71182c4-cc78-42b6-a41b-f83d94689dce | 9 | public static void main(String args[]) throws InterruptedException {
/*
* 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
... |
7859871c-2e9e-4783-b41d-78cbbacccc36 | 2 | public void addVertexSet(VertexSet s) {
Iterator<Land> it = s.iterator();
while (it.hasNext()) {
Land tmp = it.next();
if (!containsID(tmp.getID())) {
addVertex(tmp);
}
}
} |
f20e7135-88e9-4d13-8db6-771263602625 | 2 | @Override
public void close() {
if (connection != null)
try {
connection.close();
} catch (SQLException ex) {
this.writeError("Error on Connection close: " + ex, true);
}
} |
bec64f73-31d2-4130-92b4-577a839918a1 | 8 | public static ArrayList<Solucion> reducirConjuntoPareto(
Integer tamanhoMaximo, ArrayList<Solucion> conjuntoPareto){
int contador = conjuntoPareto.size();
int cluster1 = 0;
int cluster2 = 0;
Double distanciaMinima;
ArrayList<Cluster> listaClusters = crearCluster(conju... |
ebea1aa3-b4df-4628-b074-b1b9d55e0464 | 8 | public void goToCorner(final Component comp, final byte CORNER)
{
screenOffset();
final Rectangle FROM, DEST;
switch (CORNER)
{
default:
case TOP_LEFT:
DEST = new Rectangle(offset - 1,
-1,
(int) comp.getSiz... |
d046258d-3f4d-4886-8a48-510eb11a88a2 | 8 | static final void method2307(int i, long l, int i_0_, int i_1_) {
try {
anInt4823++;
if (i_1_ <= 3)
method2308((byte) -121, 59);
int i_2_ = (int) l >> -1914464274 & 0x1f;
int i_3_ = (0x37d8b0 & (int) l) >> -425142188;
int i_4_ = 0x7fffffff & (int) (l >>> -587776800);
if (i_2_ != 10 && i... |
73acb1ab-4b01-40e2-9863-97e6803e2518 | 3 | public void mouseEntered(MouseEvent evt) {
if (evt.getSource()==buy){
mousein = 1;
}
if (evt.getSource()==ok){
mousein = 2;
}
if (evt.getSource()==close){
mousein = 3;
}
} |
d0c8b77b-d6a6-424d-ba83-ff43db90e22f | 8 | public List<MType> build() {
// Now that build has been called, we are required to dispatch
// invalidations.
isClean = true;
if (!isMessagesListMutable && builders == null) {
// We still have an immutable list and we never created a builder.
return messages;
}
boolean allMessagesI... |
d2e0355a-8a3f-4d84-a4b9-327621002b7a | 6 | static void validate(int i, int j, int l, int w){
for(int m=j;m<=j+l;m++){
if(safeIsBlack(i, m)) return;
}
for(int m=j;m<=j+l/2;m++){
if(safeIsBlack(i, m)) return;
i++;
}
i--;
for(int m=j+l/2+1;m<=j+l;m++){
if(safeIsBlack(i, m)) return;
i--;
}
count++;
} |
18a3140d-3f3e-4963-a257-162b2b2e38e2 | 7 | @Override
public void run() {
for(;;) {
if( Thread.currentThread().isInterrupted() ) {
System.out.println("response receiver interrupted");
return;
}
try {
Response response = responseReader.read();
if( respo... |
140d38f4-56e3-435a-bba5-6e0bb77f6f6a | 3 | public static void main(String[] argsv) {
// Setting op a bank.
Bank christmasBank = new Bank();
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100)));
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000)));
// Award a bonus to... |
5de01e6b-3ec2-43c5-bec7-1a3d80ac23fc | 6 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, ClassNotFoundException, SQLException {
Authenticator auth = new Authenticator(request);
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = ... |
0285bcb7-37bb-40c2-81a8-532e40ac8c7f | 0 | @Override
public Set<String> getUsers() {
return getList("users");
} |
1ac3dd69-7432-4644-aa90-cb584f368552 | 6 | public void execute() {
final int selected = table.getSelectedRow();
if (selected != -1) {
setVisible(false);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Bot bot = Application.window.getActiveBot();
if (bot != null) {
int scriptIndex = table.getSelectedRow();
... |
d1a8e8a9-ef91-4d93-807d-e40c2d92c412 | 5 | public void Send(Session Session, EventResponse Message)
{
for (User mUser : this.GrabFriends().values())
{
for (Session sSession : Grizzly.GrabHabboHotel().GrabSessionHandler().GrabSessions().values())
{
if (Session.GrabHabbo() != null && mUser != null)
{
if (mUser.ID == sSession.GrabHabbo().ID... |
91e8eb6a-5ef7-47bc-9f45-3135268e1976 | 0 | private void restoreToGlobal() {
// We should no longer use document settings because the user explicitly said Restore to Global to them.
docSettings.syncToGlobal();
updateGUI();
docSettings.restoreTemporaryToCurrent();
docSettings.setUseDocumentSettings(false);
hide();
} |
17af8098-26b1-499d-b400-0bc938a5831a | 3 | public MainFrame(DB database, String loginName) {
super("ѧϢϵͳ");
this.database = database;
this.dialog = new StudentDialog(this);
this.admin = new AdminFrame(database, loginName);
this.author = new Author();
// òֹ
GridBagLayout layout = new GridBagLayout();
GridBagConstraints c = new GridBagConstraint... |
c77887db-dcc2-4aa5-a8fe-ef3b25101539 | 1 | public static void getIntAndStrings(int i, String... text)
{
System.out.println(i);
for(String s:text)
{
System.out.println(s);
}
} |
85ba3bb1-bc81-4bdd-976c-fe26f03b2b55 | 3 | @SuppressWarnings("static-access")
@Override
public void mouseReleased(MouseEvent e) {
if(e.getButton() == e.BUTTON1){
Buttons1 button = (Buttons1)e.getSource();
button.released(1);
} else if(e.getButton() == e.BUTTON2){
Buttons1 button = (Buttons1)e.getSource();
button.released(2);
} else if(e.getB... |
18c7c3c0-59ac-49e1-adda-5a82540a7cb2 | 0 | public String getTaskName() {
return taskName;
} |
aa9c7abf-f9d4-4253-968c-b42e355fa4db | 0 | @Test
public void testSearchCSS() throws Exception {
MyUnit.testFindFieldsbyCSS();
} |
53ab0b73-5b94-48e3-bb48-a07d39ebc491 | 1 | private Area buildPrimitive(boolean outer) {
Rectangle2D.Double body;
Ellipse2D.Double head;
Ellipse2D.Double tail;
if (outer) {
body = new Rectangle2D.Double(3, 0, 30, 6);
head = new Ellipse2D.Double(0, 0, 6, 6);
tail = new Ellipse2D.Double(30, 0, 6, 6);
} else {
body = new Rectangle2D.Double(3, ... |
130b7089-080f-4ade-b471-e54766ecdb81 | 1 | public static void sendMessageToWorld(World world, String from,
String message) {
List<Player> players = world.getPlayers();
for (Iterator<Player> i = players.iterator(); i.hasNext();) {
Player p = i.next();
p.sendMessage(String.format("%s[%s] %s", ChatColor.GOLD, from,
message));
}
} |
f0876422-434d-454c-b43f-2669fcc31f19 | 7 | public void playUpgradeSound(Location machineLocation, MachineType machineType)
{
Manager manager;
switch(machineType)
{
case OREGIN:
manager = getManager(OreGinManager.class);
break;
case CLOAKER:
manager = getManager(CloakerManager.class);
break;
default:
manager = null;
break;
}
... |
3a0a4ede-1e3f-4ead-b6ca-76e6bc0f6b1d | 1 | @Override
public void tableChanged(TableModelEvent e) {
if ( e.getType() == TableModelEvent.UPDATE ) {
int row = e.getFirstRow();
String newName = (String) tableModel.getValueAt(row, 0);
String newContent = (String) tableModel.getValueAt(row, 1);
Command comma... |
3152006a-8c68-408b-b01b-5f5f4d856db7 | 6 | public boolean evaluate(final String expr) {
Stack stack = new Stack();
if(expr == null) {
return false;
}
char[] chars = expr.toCharArray();
for(char character : chars) {
if(character == '(') {
StackNode node = new StackNode();
node.setData(character);
stack.push(node);
} else if(char... |
17508bf5-5d66-42d8-b809-4d60533c7ecf | 2 | public SignatureVisitor visitInterface() {
if (state != SUPER) {
throw new IllegalStateException();
}
SignatureVisitor v = sv == null ? null : sv.visitInterface();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
} |
329c3dc2-bb3f-436c-9be7-b67a6c90a5b9 | 8 | public void backup() {
logger.debug("enter backup method");
configService.initBackupConfig();
List<String> backupIndices = configService.getBackupIndices();
if(backupIndices == null || backupIndices.size()==0){
//备份该集群下面所有索引
backupIndices = getAllIndexesFromEs();
}
if(backupIndices!=null && backupIndi... |
662ff8fd-936f-4a4b-a3a3-8eb0bab5e926 | 3 | private String getCookie(URL url) {
final Pattern COOKIE_PATTERN = Pattern.compile("_ddn_intercept_2_=([^;]+)");
try {
URLConnection conn = url.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
conn.g... |
29bc18be-7756-49d8-a140-135010f82871 | 2 | public void testIntCoding() {
class Valider {
byte[] buf = null;
void valid(int i) {
buf = BytesUtils.encodeInt(i);
int bi = BytesUtils.decodeInt(buf, new Offset());
if (bi != i) {
System.err.println(String.format("Wrong with %d while bi = %d, and buf = %s", i, bi
, Arrays.toString(buf))... |
42c01f56-d9bf-439e-a0c0-7e0d13a1e9ba | 6 | public static Color randColor() {
switch (randInt(6)) {
case 0:
return Color.blue;
case 1:
return Color.green;
case 2:
return Color.orange;
case 3:
return Color.magenta;
case 4:
return Color.red;
case 5:
return Color.yellow;
default:
return null;
}
} |
2b3e97ca-53d1-496f-b1da-4ac87585800a | 8 | public static void main(String[] args) throws IOException {
long inicio = System.currentTimeMillis();
StringBuilder out = new StringBuilder();
BufferedReader in;
File archivo = new File("entrada");
if (archivo.exists())
in = new BufferedReader(new FileReader(archivo));
else
in = new BufferedReader(new... |
7b1f843c-8d30-4e60-984a-b523819da90e | 6 | public Sound2D()
{
rand = new Random();
try
// Trying to load zombie sfx
{
File moanFile = new File("src/sounds/ZombieMoan.wav");
AudioInputStream stream = AudioSystem.getAudioInputStream(moanFile);
zombieFormat = stream.getFormat();
byte[] array = getSamples(stream);
zom... |
0c58c57e-a0c8-4616-a7e9-949a2b309c7e | 5 | public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode dummy = new ListNode(0);
ListNode p = dummy;
int carry = 0;
while(l1 != null || l2 != null || carry != 0){
int sum = carry;
if(l1 != null) {
sum += l1.val;
l1 = l1.... |
cc51858c-2291-4fa4-8191-0afbf5b78802 | 7 | public void calculateAreas(int widthWindow, int heightWindow) {
// for each cell of the map
for(int j=0; j<this.heightMap; ++j) {
for(int i=0; i<this.widthMap; ++i) {
// we calculate only the hill cells (i.e. the cells that are not = -1)
if(this.map[i][j] != -1) {
// we look for the near... |
f54db098-e5b7-41ae-af86-a94392fe7bff | 2 | static double[][] subtract(double[][] matrix1, double[][] matrix2){
double[][] diff = new double[matrix1.length][matrix1[0].length];
for(int i = 0; i < diff.length; i++)
for(int j = 0; j < diff[0].length; j++)
diff[i][j] = matrix1[i][j] - matrix2[i][j];
return diff;
} |
f1296812-b7d1-4d40-b47c-b862c72e1c7d | 5 | * @param ty
* The y-coordinate at which to render the baseline.
*/
private void drawLine(Graphics g, int lineNum, int ty) {
if (baseFont != getFont()) {
baseFont = getFont();
specialFonts.clear();
}
g.setColor(getForeground());
Font drawingFont = baseFont;
g.setFont(drawi... |
07b3203d-c973-4b07-8eae-f479ed6432dc | 5 | private void select() {
if (currentChoice == 0) {
gsm.setState(1);
currentLevel = 1;
} else if (currentChoice == 1) {
gsm.setState(4);
} else if (currentChoice == 2) {
gsm.setState(5);
} else if (currentChoice == 3) {
gsm.setState(6);
} else if (currentChoice == 4) {
gsm.setState(9);
}
} |
1afd0505-d820-43dd-a564-b5c13dc38961 | 9 | private void addLink(Link link) {
final String assId = "ass" + UniqueSequence.getValue();
if (link.getType().getDecor1() == LinkDecor.EXTENDS || link.getType().getDecor2() == LinkDecor.EXTENDS) {
addExtension(link, assId);
return;
}
final Element association = document.createElement("UML:Association");
... |
9dc0fe27-926b-4d92-8d40-e15db5a1c2cd | 3 | private void ryhmaListSelectionChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting())
return;
int i = ryhmaList.getSelectedIndex();
if (i == -1) {
// Listassa ei ole enää valintaa, tyhjennä infoteksti
return;
}
Ryhma r = (Ryhma) ryhmaList.getModel().getElementAt(i);
List<Oppilas> oppilaat ... |
444835a3-2f06-4096-87e5-60287d87a65e | 7 | public void moveHero(ILocatable locatableObj, Position nextPosition){
if(locatableObj instanceof TRovers || locatableObj instanceof River){
return;
}
if(locatableObj == null){
tHero.moveAStep(nextPosition);
return;
}
if(locatableObj instanceof MapBase){
tHero.moveAStep(nextPosition);
t... |
a1370199-b141-4777-9fe2-703301c54cb6 | 3 | public void playerTurn() {
do {
System.out.println("Hit(1):\tStay(2):");
int playerAction = intInput.nextInt();
if (playerAction == 1) {
player.hit(shoe.dealCard());
} else if (playerAction == 2) {
System.out.println("You stayed");
break;
}
} while (player.getHand().getHandValue() < 21);... |
808339a4-151f-4a58-bc7b-1928d7d3cbff | 2 | public void test_16_DnaCoder_copy_2() {
long seed = 20100812;
Random rand = new Random(seed);
int numTests = 100000;
int maxLen, minLen = 10;
System.err.print("\nDnaCoder.copyBases test:");
for( int numWords = 1; numWords < 10; numWords++ ) {
System.err.print("\n\tMax words: " + numWords + "\t");
fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.