method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
684b552d-fc77-43c9-8cff-1695802ef0dc | 7 | public static void main(String[] args)
{
try
{
// Print out 10 hashes
for(int i = 0; i < 10; i++)
System.out.println(PasswordHash.createHash("p\r\nassw0Rd!"));
// Test password validation
boolean failure = false;
System.out... |
bab3cf08-8fa1-4bd2-b636-a94eeb7d9db6 | 9 | private boolean submitScore(boolean next){
//submit_score1 = new String[score.length];
//System.out.println("Submitscore"+db.current_score.getScores().toString());
HashMap<String, Float> submit_score = new HashMap<>();
for (int i = 0; i < score.length; i++) {
for (int j = 0; j < score[i].length; j++) {
i... |
1cd8b7cd-7a09-40ab-b1d2-94be4be17690 | 9 | private String getVersionHistoryHtml(URL templateUrl, int sinceVersion) throws IOException {
// Buffer for presentation-ready html.
StringBuilder historyBuf = new StringBuilder();
URL url = null;
BufferedReader in = null;
String line = null;
try {
// Fetch the template.
StringBuilder templateBuf = n... |
ebd13163-c9be-4a17-9051-332a13a9fe96 | 8 | private String getBaudotChar() {
int a=0;
if (inChar[5]==true) a=16;
if (inChar[4]==true) a=a+8;
if (inChar[3]==true) a=a+4;
if (inChar[2]==true) a=a+2;
if (inChar[1]==true) a++;
// Look out for figures or letters shift characters
if (a==0) {
return "";
}
else if (a==27) {
lettersMode=false;
... |
a568ec56-ab7c-479a-960f-f9806b790673 | 1 | @Override
public void fromMessage(Message message) throws JMSException {
try {
inputStream = ((BlobMessage) message).getInputStream();
} catch (IOException e) {
logger.error("Can't get input stream.", e);
}
} |
5f02ed81-f63d-4540-92d4-81a07d6b96ed | 2 | public static void main(String[] args) {
List<Integer> ints = new ArrayList<Integer>();
List<Double> doubles = new ArrayList<Double>();
doubles.add(3.05);doubles.add(6.9);doubles.add(8.9);
ints.add(3); ints.add(5); ints.add(10);
double sum = sum(ints);
double doubles1 = ... |
cc550064-e003-4c5c-9ff6-f04191c72795 | 8 | public static boolean isOrthonormal(double[][] qt, boolean insufficientRank, double epsilon) {
int n = qt.length;
int rank = 0;
for (int i = 0; i < n; i++) {
Vector ei = new DenseVector(qt[i], true);
double norm = ei.norm(2);
if (Math.abs(1.0 - norm) < epsilon) {
rank++;
} ... |
9fbc4893-4550-4086-a7f2-ef2e1f538002 | 2 | public static void afficherAide(){
if (p.getEchiquier().getTableau()[p.getCaseCliquee().getI()][p.getCaseCliquee().getJ()] != null){
Vector<Position> dest = p.getEchiquier().destinationPossible(p.getEchiquier().getTableau()[p.getCaseCliquee().getI()][p.getCaseCliquee().getJ()]);
for (Position pos : dest){
... |
77f3bb6b-0221-44ac-bc76-141457531700 | 1 | void drawCard(Graphics g, Card card, int x, int y) {
if (card == null) {
// Draw a face-down card
g.setColor(Color.blue);
g.fillRect(x+10, y + 10,65,90);
g.setColor(Color.white);
g.drawRect(x+10, y + 10, 65,90);
}
else {
// image generation
... |
cec3dc19-44ee-49d3-83de-dc3c78941fb3 | 7 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
ArrayList<Integer> primes = primeNumbers(1000001);
while ((line = in.readLine()) != null && line.length() != 0) {
... |
bf7a0e02-bf0e-4c1d-b114-b13e9f6fd43c | 1 | public int getPlayerNumber(Player p) {
if (p == null)
throw new IllegalArgumentException("Player can't be null!");
return players.indexOf(p);
} |
ac3dfb37-bf6c-4bad-a2b3-9d9850a67747 | 1 | public synchronized void put(T msg) {
Link<T> next = new Link<T>(msg);
if (first == null) {
first = next;
} else {
last.next = next;
last = next;
}
this.notify();
} |
e2dba39a-ce2d-4652-9121-d982aab4ea08 | 6 | protected Map<String, Graph> loadGraphsAndPatterns(String filename, String fileDir, Level readLevel)
throws IOException
{
String file = ((fileDir != null) ? fileDir : defaultFileDir) + filename + defaultFileExt;
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(file))... |
7945202a-c334-4acb-9fc1-d7b879c2ae5e | 8 | public SPIGroup getGroup (int gid) throws SPIException, XmlRpcException {
try {
Object[] result;
result = (Object[])this.execute(GETGROUP, addHeader(new Object[] { gid }));
return new SPIGroup(gid, (String)result[0], getIntegerList((Object[])result[1]));
} catch (XmlRpcException e) {
switch (e.c... |
0da2ca24-1cee-470c-838b-db0be62b1a4d | 8 | public List<File> buildFont( String internalName, FileGarbage garbage ) throws IOException {
File tempDir = File.createTempFile( "fonts", ".tmp" );
tempDir.delete();
tempDir.mkdirs();
garbage.addFile( tempDir, true );
File binDir = new File( "bin" );
File encFile = ... |
9b0d144e-b81d-431e-9828-4f7b38b8f328 | 2 | public double getDouble(String key) throws JSONException {
Object object = this.get(key);
try {
return object instanceof Number
? ((Number)object).doubleValue()
: Double.parseDouble((String)object);
} catch (Exception e) {
throw new JSONExc... |
154b706a-c8db-4698-afbf-944a499a5136 | 5 | private final void createSampleArrayCollection() {
try {
this.audioInputStream.mark(Integer.MAX_VALUE);
this.audioInputStream.reset();
int bufferSize = ( (int) this.getNumberOfFrames() ) * this.getFrameSize();
byte[] bytes = new byte[bufferSize];
try {
this.audioInputStream.read(bytes);... |
a0c6a6dd-9fa8-4345-aa65-a2f32517f8c4 | 9 | public void startElement(
String uri, String localName, String qName, Attributes attrs
) throws SAXException {
if (qName.equals("name") || qName.equals("info")) {
buf = new StringBuffer(50);
return;
}
if (qName.equals("hash")) {
if (file != null) {
HCHash hash = new HCHash(
attrs.getValue("l... |
3099f39e-11c1-4e49-a47f-c586b6eab9f6 | 9 | public static void executeKey(KEY_COMMAND k) {
if (game.paused) {
if (k == KEY_COMMAND.PAUSE) {
game.resume();
}
return;
}
switch (k) {
case LEFT:
game.gameBlock.shiftLeft();
break;
case RIGHT:
game.gameBlock.shiftRight();
break;
case ROTATE:
game.gameBlock.rotate... |
752d3eab-7c65-4d10-90f7-0e90a865e871 | 6 | private void processSite(final AbstractJobSite site) {
try {
Document doc = getDocument(site.getUrlWithQuery());
Element elem = site.getElementForNextPage(doc);
boolean morePagesToTraverse = site.morePagesToTraverse(elem);
//Only a single page listing. Can happen, based on the search terms.
... |
46e872f8-f701-4584-9e4e-ad8e43841063 | 4 | public void generate()
{
ArrayList<Integer> minePositions = new ArrayList<Integer>();
ArrayList<Integer> r = new ArrayList<Integer>();
for (int i = 0; i < (rows * columns); i++) {
r.add(i);
}
Collections.shuffle(r);
minePositions.addAll(r.subList(0, mines)... |
9dfa07e8-cf04-4d11-857f-5bdac29037be | 4 | public PlayerPanel(Player p) {
super();
player = p;
playerPnlHash.put(player, this);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent event) {
hiliteTerritories(map.getTerritories(player));
}
public void mous... |
3a65241d-06a6-446b-8baa-2f0cddd4aaac | 7 | public boolean destruccion(){
marcarBloques();
int i,j,bloquesNuevos,k,r,q;
boolean retorno=false;
Random generador=new Random();
for(i=0;i<15;i++){
bloquesNuevos=0;
for(j=0;j<15;j++){
if(buttonMatrix[i][j].destruir){
retorno=true;
for(k=j;k>bloquesNuevos;k--){
buttonMatrix[i][k-1].b... |
d8bebf4a-832f-45a9-80ce-57979a60b9e5 | 5 | @Override
public Method parseMethod() throws IOException {
Method m = new Method();
m.setReturnType(parseType());
if (curToken.type == Lexer.Type.NAME) {
m.setName(curToken.c);
curToken = lexer.getToken();
} else {
throw new IOException("missing m... |
c96a588a-f200-4be3-ad3a-c1e7e414ea37 | 3 | @SuppressWarnings("nls")
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append(mHorizontal ? "Horizontal" : "Vertical");
buffer.append(" Dock Layout [id:");
buffer.append(Integer.toHexString(hashCode()));
if (mDividerPosition != -1) {
buffer.append(" d:");
buff... |
23cbb186-6af0-4158-873c-1b29f858abcb | 4 | public void collsionDetect(Particle p){
if(p.loc.x > width || p.loc.x < 0) {
p.dir.x = -p.dir.x;
}
if(p.loc.y > height || p.loc.y < 0){
p.dir.y = -p.dir.y;
}
} |
befcec52-0d28-4de1-a774-1642b465de15 | 7 | public void skillBuy(int item) {
int nn = get99Count();
if (nn > 1)
nn = 1;
else
nn = 0;
for (int j = 0; j < skillCapes.length; j++) {
if (skillCapes[j] == item || skillCapes[j]+1 == item) {
if (c.getItems().freeSlots() > 1) {
if (c.getItems().playerHasItem(995,99000)) {
if ... |
a8368a09-6589-4b83-ada9-89f252a9b8a5 | 3 | ConnectionHandler(SharedTorrent torrent, byte[] id, InetAddress address, boolean force)
throws IOException {
this.torrent = torrent;
this.id = id;
this.forceObfuscation = force;
this.socket = new ServerSocket();
// Bind to the first available port in the range
// [PORT_RANGE_START; PORT_RANGE_END].
fo... |
1b79f26e-0f9b-43ed-89aa-9d1a8dee35ca | 0 | public TuringConvertController(ConvertPane pane, SelectionDrawer drawer,
TuringMachine automaton) {
super(pane, drawer, automaton);
myTuringMachine=automaton;
converter = new TuringToGrammarConverter();
// converter.initializeConverter();
pane.getTable().getColumnModel().getColumn(0).setMinWidth(150);
p... |
6517e008-b9eb-4b32-b2ce-563a8a2c0d3d | 8 | public static void main (String[] argv)
{
int i;
EntradaMat[] loleido;
if (argv.length != 1) {
System.err.println("Uso: java ManejadorMatrizXML <archivo>");
System.exit(1);
}
ManejadorMatrizXML handler = new ManejadorMatrizXML();
SAXParserFactory facto... |
4335473a-f534-471c-a277-02ea1d9d564a | 3 | public static void setCursor(String tex, Vector2 hotspot)
{
CursorLoader.tex = ResourceLoader.getTexture(tex);
CursorLoader.hotspot = hotspot;
if(tex != null)
{
Cursor emptyCursor;
try {
emptyCursor = new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null);
Mouse.setNativeCursor(emptyC... |
253b0414-52c3-4d05-aea7-0af145162092 | 6 | private void checkAdjacentNodesStart(Node origin) {
Node n = null;
for (int i = origin.x-1; i <= origin.x+1; i++) {
for (int j = origin.y-1; j <= origin.y+1; j++) {
if (!(i == origin.x && j == origin.y)) {
n = new Node(i, j);
int dirr = directionFromAdjacentNode(origin, n);
if (dirr == 1) {
... |
2e0f1890-7c17-4a13-b3c7-8357eb0ba279 | 2 | public EntityStatsEditor(String savedStats) {
setResizable(false);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setTitle("Stat Editor");
setBounds(100, 100, 450, 300);
getContentPane().setLayout(null);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBounds(0, 0, 434, 237... |
fe7879ab-ff85-4749-8f70-34d904c547d7 | 4 | public static boolean isAntiarithmetic() {
BitSet bs = new BitSet(a.length + 1);
for (int i = 0; i < a.length; i++) {
bs.clear();
for (int j = i + 1; j < a.length; j++) {
bs.set(a[j], true);
if ((a[j] + a[i]) % 2 == 0 && bs.get((a[j] + a[i]) / 2))
return false;
}
}
return true;
} |
9a135acb-4b93-450f-b81d-2dc6b8e2be8b | 5 | public RandomListNode copyRandomList(RandomListNode head) {
if (head == null) return null;
RandomListNode newHead = new RandomListNode(head.label);
Map<RandomListNode, RandomListNode> nodeMap = new HashMap<RandomListNode, RandomListNode>();
nodeMap.put(head, newHead);
RandomListNode next = he... |
f29aa816-2c00-4aa7-9ba3-329852749660 | 1 | @RequestMapping(value="/{tripID}/editTravelTrip", method=RequestMethod.POST)
public String ediTravelTrip(@PathVariable("tripID") String tripID,
@Valid @ModelAttribute("editTravelTrip") TravelTrip editTravelTrip,
BindingResult result, Model model){
if (!result.hasErrors()) {... |
4e62ad2a-f478-4c8a-8166-339fbc921765 | 0 | public synchronized EquationBTreeNode getChild2() {return child2;} |
2ebb2556-135c-4b0c-9213-1ec90fc5f93f | 4 | private Object[] readArray() throws EncodingException, NotImplementedException
{
int handle = readInt();
boolean inline = ((handle & 1) != 0);
handle = handle >> 1;
if (inline)
{
String key = readString();
if (key != null && !key.equals(""))
throw new NotImplementedException("Associative arrays ar... |
82d50e94-0c2e-4462-ab0b-965da3a52ab3 | 0 | public static Integer getIntegerValue(String key){
return Integer.valueOf(getStringValue(key));
} |
1b924ce8-9f68-4c4f-bd11-6fdcec7fb4da | 2 | @Override
public boolean loadAllInstruments(Soundbank soundbank) {
boolean success = true;
for (Synthesizer s : theSynths)
if (!s.loadAllInstruments(soundbank))
success = false;
return success;
} |
1aebe068-b479-44aa-8229-b04197605030 | 3 | public void reselect() {
if (lastClassName != null) {
TreePath lastPath = (hierarchyTree ? hierModel
.getPath(lastClassName) : packModel.getPath(lastClassName));
if (lastPath != null) {
classTree.setSelectionPath(lastPath);
classTree.scrollPathToVisible(lastPath);
}
}
} |
b1ec2257-3e78-42fa-84f5-f5db4e9ad986 | 0 | public static List<Appointment> findByWeek(long uid, long week)
throws SQLException {
List<Appointment> aAppt = new ArrayList<Appointment>();
long endOfWeek = week + 6 * DateUtil.DAY_LENGTH;
// once
aAppt.addAll(Appointment.findOnceByDaySpan(uid, week, endOfWeek));
// daily
aAppt.addAll(Appointment.fin... |
21aba501-9217-463a-a85f-89bcfca1d8eb | 2 | public SplashScreen(Forme forme){
this.forme=forme;
this.setSize(400,387);
this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
panel=new JPanel(new BorderLayout());
label=new JLabel(new ImageIcon("Ressources/Images/jeux_taquin.png"));
label.setVerticalAlignment(JLabel.CENTER);
label.setHorizontalAlignment(JLa... |
1faf84cb-f076-4c8c-bfe5-3ef1c95a369d | 9 | private boolean camposCompletos (){
if((!field_fec_alta.getText().equals(""))&&
(!field_limite_cred.getText().equals(""))&&
(!field_dni.getText().equals(""))&&
(!field_nombre.getText().equals(""))&&
(!field_apellido.getText().equals(""))&&
(!field_telefono.... |
dd7a6c00-0ebc-4e8e-a405-63678d1af1f0 | 2 | public static void main(String[] args) {
final Logger logger = Logger.getLogger(Money.class.toString());
logger.info("Starting");
Money thisObj = null;
try {
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
} finally {
if (thisObj != null) {
// Clean up re... |
29492c3a-3ed2-4be4-b8ab-c698869b66d3 | 8 | @Override
public FiveCardOmahaWorker build()
{
if (super.getRounds() <= 0) {
throw new IllegalStateException("The number of rounds must be a strictly positive number");
} else if (super.getProfiles() == null || super.getProfiles().size() < 2) {
thr... |
060200bc-798e-45b9-90cc-e1116dc2cb0a | 1 | public void redirectError(Writer w) {
if (w == null) {
throw new NullPointerException("w");
}
stderr = w;
} |
10910eac-6436-42d9-bc02-ba2bf07e9dc4 | 3 | public BlockDistillery(State state)
{
super(Material.iron);
setBlockTextureName("snow");
setCreativeTab(GraphiteMod.tabGraphite);
setHardness(2.0f);
setResistance(5.0f);
setStepSound(Block.soundTypeMetal);
this.state = state;
switch(state)
{
... |
eaed4f28-73f3-410b-8d90-2dc63e1571d5 | 0 | private void setUp(){
fieldDecode = new JTextField(25);
fieldEncode = new JTextField(25);
int newHeight = fieldDecode.getPreferredSize().height + 5;
int newWidth = fieldDecode.getPreferredSize().height;
fieldDecode.setPreferredSize(new Dimension(newWidth, newHeight));
fieldEncode.setPreferredSize(new ... |
794b586a-19a3-4626-9e6a-54dde16eed20 | 9 | protected void paintComponent(Graphics g) {
if (isOpaque()) {
Dimension size = getSize();
g.setColor(getBackground());
g.fillRect(0, 0, size.width, size.height);
}
int stepSize = 0;
int cDist = 0;
int rDist = 0;
for (int vectorIndex =... |
d1023d3a-1e02-49e0-89d3-35a03c6a3adf | 9 | public void setImage(String image) {
if (image.indexOf('\\') == -1) {
this.image = image;
return;
}
int size = image.length();
StringBuffer buf = new StringBuffer(size);
for (int i = 0; i < size; i++) {
char c = image.charAt(i);
if ... |
dbd5daa4-efbc-4bd1-a9c8-223921af661e | 1 | public int getPages(int intRegsPerPag, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception {
int pages;
try {
oMysql.conexion(enumTipoConexion);
pages = oMysql.getPages("usuario", intRegsPerPag, alFilter, hmOrder);
oMysql.desconexion();
... |
ef918bba-211c-474d-976a-38ee7987935e | 8 | private void doDecode() {
File file = null;
showMessage("uncompressing");
try {
int retval = ourChooser.showOpenDialog(null);
if (retval != JFileChooser.APPROVE_OPTION) {
return;
}
file = ourChooser.getSelectedFile();
St... |
bca65b6c-de43-4b71-9d2f-570e39f52bb6 | 6 | public Problem validate(final Object instance,
final IPAddress annotation, final Object target,
final CharSequence address)
{
if (address == null || address.length() < 1)
{
if (annotation.required())
{
return new Problem(instance, annotation, target, address);
}
return null;
}
... |
830b2e03-994c-4ce2-9673-0c949394c6fa | 9 | @Override
public String getCoordenadas() throws RemoteException {
String coordenadas = "";
while (coordenadas.length() != 2) {
coordenadas = JOptionPane.showInputDialog(frame,
"Digite as coordenadas juntas (ex. XY), " + System.getProperty("line.separator") + "jogadas informadas anteriormente "
+ Sys... |
651ba8a2-1765-40a0-8916-c05039d4290a | 0 | @Override
public void mouseExited(MouseEvent e) {
setBorderPainted(false);
} |
c5887680-049e-4edd-8aed-f6e9a43afe0f | 0 | public int distanceBetweenRank(Field otherField) {
return otherField.rank - this.rank;
} |
3d96fdfc-5f00-4501-93d1-9d63c9f1aa08 | 8 | private String GenerateOptions(int ir)
{
String r = new String();
boolean addHit = false;
for ( int i = 0; i < hand.size(); i++)
{
if (this.hand.get(i).isHandPlayable())
{
addHit = true;
break;
}
}
if ( addHit )
{
r += "Hit - 1\n";
iOptions.add(1);
}
r += "Stand - 2... |
bb604477-fa04-43ed-9703-e66e798caf24 | 8 | @Override
public void setArrestingOfficer(Area legalArea, MOB mob)
{
if ((arrestingOfficer != null)
&& (arrestingOfficer.getStartRoom() != null)
&& (arrestingOfficer.location() != null)
&& (legalArea != null)
&& (arrestingOfficer.getStartRoom().getArea() != arrestingOfficer.location().getArea())
&& (!... |
9fe1ade7-7b18-48d9-b38d-6a599d360144 | 6 | public static ArrayList<DVD> readTextDatabase(File file) {
//-------------------------------------
ArrayList<DVD> d = new ArrayList<>();
FileReader fr;
BufferedReader br;
String line;
DVD newDVD;
System.out.println("File name and path: " + file.getName() + " " + ... |
60ac5867-8bf7-4675-98a0-ffdb82a0f096 | 9 | @Override
public void onParticipantJoined(IParticipant p) {
if (isMyself(p.getUserId())) {
if (recvAudio || sendAudio) {
connectVoice();
}
if (videoFilename != null && videoFilename.length() > 0 && sendVideo) {
sendVideo();
}
if (recvDeskshare) {
connectDeskshare();
}
} else {
if (... |
c7ba21e9-e0dc-48d2-9964-d62b2d158978 | 7 | public int MoveInstanceToBestCluster(Instance inst) {
clusters.get(m_clusterAssignments.get(m_processed_InstanceID)).DeleteInstance(inst);
m_clusterAssignments.set(m_processed_InstanceID, -1);
double delta;
double deltamax;
int clustermax = -1;
int tempS = 0;
int tempW = 0;
if (inst in... |
4f7f13c2-90d5-4994-b63a-ac78f3f58786 | 3 | public void setImageIndent (int indent) {
checkWidget();
if (indent < 0) return;
if (imageIndent == indent) return;
imageIndent = indent;
if ((parent.getStyle () & SWT.VIRTUAL) != 0) cached = true;
} |
6519f75d-6f6a-4529-81f7-f793cf8ebe1f | 3 | void generateEdges() {
// Generate all vertical edges in the maze
int index = 0;
while (index < this.cells.size() - this.size) {
edges.add(new Edge(this.cells.get(index),
this.cells.get(index + this.size)));
index = index + 1;
}
// Gene... |
f793f465-1944-4b7b-87d2-87ab80209edd | 0 | public SimpleStringProperty localNumberProperty() {
return localNumber;
} |
134e0fe1-ec8d-499f-a3c8-e56c501424cd | 3 | public HashMap cashOutput(int amount) throws Exception
{
char[] params = Convert.toCharArray(amount);
ArrayList<Integer> answer = this.device.send(0x51, 5, params);
if (answer.size() == 0)
throw new Exception("Пустой ответ");
HashMap<String, Integer> result = new HashMa... |
bbe60cff-d87d-4db4-8d9a-77e5e8c68f28 | 3 | private ArrayList<Product> queryForProducts(String sql) {
ArrayList<Product> products = new ArrayList<>();
Connection con = null;
try {
con = getConnection();
PreparedStatement statement = con.prepareStatement(sql);
ResultSet resultSet = statement.executeQuery();
while(resultSet.next()) {
products... |
0a87f922-c16d-4823-9582-c8665aa3e166 | 1 | @Override
public void addUser(User user) {
PreparedStatement pStmt = null;
try {
pStmt = conn.prepareStatement("INSERT INTO USER (login, password, name, surname) VALUES (?, ?, ?, ?);");
pStmt.setString(1, user.getLogin());
pStmt.setString(2, getMD5Hash(user.getPassword()));
pStmt.setString(3,... |
688585ea-466b-4ce1-a9e3-a998f38f2247 | 8 | public String read(String transaction, String resource, boolean isReadOnly) {
if (isReadOnly) {
if (!snapshot.containsKey(transaction)) {
throw new IllegalArgumentException(
"A read transaction which has no snapshot");
}
if (!snapshot.g... |
fa2369e1-5cd5-4b82-8399-06f4aad0affd | 1 | public String parseLine(String line){
Pattern p=Pattern.compile(":\\w*!\\w*@\\w*.* PRIVMSG #\\w* :");
Matcher m=p.matcher(line);
if(m.find())
return line.substring(m.end());
return line;
} |
e582d85e-5170-4805-91a8-f0ef6063667c | 7 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (dateButton.getSelection ()) style |= SWT.DATE;
if (timeButton.getSelection ()) style |= SWT.TIME;
if (calendarButton.getSelection ()) style |= SWT.CALENDAR;
if (shortButton.getSelection ()) style |= SWT.SHORT... |
4f35026c-e849-4d0e-992c-fd0e30f27595 | 8 | private double findSplitNominalNumeric(int index) throws Exception {
double bestVal = Double.MAX_VALUE, currVal;
double[] sumsSquaresPerValue =
new double[m_Instances.attribute(index).numValues()],
sumsPerValue = new double[m_Instances.attribute(index).numValues()],
weightsPerValue = new d... |
0f2eb286-fc40-4a38-a793-6f9bcbbb75ba | 1 | public void mousemove(Coord c) {
if (dm) {
this.c = this.c.add(c.add(doff.inv()));
} else {
super.mousemove(c);
}
} |
5f509ce5-68f6-4d49-b81f-5944ccaa2111 | 8 | private void processMulti(MulticastMessage multiMsg) {
String destGroup = multiMsg.getSrcGroup();
ArrayList<String> memberList = groupList.get(destGroup).getMemberList();
MessageKey curKey = new MessageKey();
// If we receive a real multicast message
if(!multiMsg.getKind().equal... |
33bd1ac4-2fa6-4360-ad67-bd66ad59fba8 | 0 | private void calculateManhattan() {
grid.calculateManhattan(speed);
} |
a262bdbb-4382-4125-8f3f-d70d457b59b9 | 2 | public double standardError_of_ComplexImaginaryParts() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
double[] re = this.array_as_imaginary_part_of_Complex();
double standardError = Stat.sta... |
65fc6d70-dc4b-44a1-b00f-5f7885128aa3 | 4 | @Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
Game.VK_UP = false;
break;
case KeyEvent.VK_DOWN:
Game.VK_DOWN = false;
break;
case KeyEvent.VK_LEFT:
Game.VK_LEFT = false;
break;
case KeyEvent.VK_RIGHT:
Game.VK_RIGHT = false;
}
} |
b89cfd9c-af9b-406b-8eb6-1aca43af472b | 8 | public void update(double time){
for(Particle p:particles) p.tick(time);
for(Particle p:bgParticles) p.tick(time);
for(Explosion e:explosions) e.tick(time);
for(Projectile p:projectiles) p.tick(time);
for(Mob m:mobs) m.tick(time);
deleteMarkedEntities();
for(Tower t:towers) t.tick(time);
double exp = Ma... |
51c5419c-78e2-4676-83ab-f108a5e23f7f | 4 | public void run() {
byte[] ack_buffer = new byte[ACK_SIZE];
do {
try {
ack_buffer = new byte[ACK_SIZE];
DatagramPacket receivePacket = new DatagramPacket(
ack_buffer, ack_buffer.length);
clientSocket.receive(receivePacket);
} catch (Exception e) {
}
if (Utilities.getPacketNu... |
c26aed55-2c87-4b04-8ed3-0047b9d59de3 | 9 | public void update(Node lastPlayed){
Resolution.addFact(lastPlayed);
int playedNodesIndex = 0;
playedNodes = new Node[48];
for(int i = 0; i < allnodes.length; i++){
if(!(allnodes[i].getChar() == 'n')){
playedNodes[playedNodesI... |
72ab41eb-6b40-4bee-b75f-ff7ff07cf70d | 6 | public void setCombatModifiers(int typeID) {
switch (typeID) {
case 0: weakAgainst = 1;
strongAgainst = 3;
break;
case 1: weakAgainst = 2;
strongAgainst = 0;
break;
case 2: weakAgainst = 3;
strongAgainst = 1;
break;
case 3: weakAgainst = 0;
strongAgainst = 2;
break... |
f93b6f01-3132-48de-a520-6df6c3297728 | 0 | public Move(Board board, Position start, int horizontal , int vertical ){
field = board;
this.start=start;
this.horizontal=horizontal;
this.vertical=vertical;
} |
03d45104-4c6c-4664-a789-6c0b4ed1434d | 6 | public static void sendResponse(String output, Long id, Long prdetailsId) {
try {
post = new HttpPost(prop.getString("PostQuery").trim() + id);
post.setHeader("Authorization", "Basic " + new String(encoded));
post.setHeader("Content-Type", "application/json");
post.addHeader("X-Mifos-Platform-TenantId"... |
8a19d4ba-4ef9-401d-b747-b1badd107010 | 1 | public void stopListen(){
run = false;
try {
socketListen.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
6ea16427-3f2d-41ec-8d07-827bc1ed4e62 | 4 | private void proveQuery(String content) {
try {
Evaluator evaluator = new Evaluator(new RobinsonUnificationStrategy(), knowledgeBase);
boolean result = evaluator.prove(
new ConsoleEvaluationHandler(System.out, console), parser.parsePredicates(content));
if... |
4592aaa8-3a17-448f-9a17-9da95ffa82c1 | 2 | public static void createIcons(EngineConfiguration config){
EngineConfiguration engine = config;
String icon16 = engine.DISPLAY_ICON_16;
String icon32 = engine.DISPLAY_ICON_32;
if(!FileUtility.doesFileExist(icon16) || !FileUtility.doesFileExist(icon32)){
return;
}
... |
20f86db8-9d23-40cb-a18f-d8948fdb1c11 | 5 | public static void main(String[] args) {
// insert a bunch of strings
String[] strings = { "it", "was", "the", "best", "of", "times", "it", "was", "the", "worst" };
IndexMinPQ<String> pq = new IndexMinPQ<String>(strings.length);
for (int i = 0; i < strings.length; i++) {
pq.... |
09ce06ab-f35a-475c-b4e6-5a1f1667dc0d | 0 | public int getStatus() {
return Status;
} |
d1d6fd05-06b1-4a9f-85bc-b2c0313a09b0 | 4 | public float get_halffloat(int offset)
{
int signbit;
int mantissa;
int exp;
float result;
if(offset >= 0)
if (pb[5] < (offset + 2))
{
val = -1; // insufficient payload length
return 0;
}
result = ((p... |
8ef2eb82-9e6a-4888-8aeb-93237f2c7e5c | 6 | public static String unescape(String string) {
int length = string.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
... |
81726e5f-7cd3-4ac6-9606-bb43c9bece16 | 1 | public static void drawFullCircle(Graphics g, int x, int y){
//TODO:
for (int i = 0; i <= 20; i++){
g.setColor(new Color(Math.abs(i * (127 / 20)) + 127,255,0));
//System.out.println(Math.abs(i * (127 / 20)));
// g.fillOval((x + EMPTY_CIRCLE) / 2 + (EMPTY_CIRCLE / 2) - EMPTY_CIRCLE_THK / 2 + i * EMPTY_CIRCLE... |
15e0a24d-9af8-4616-8299-db8688768e7a | 5 | /* */ public RIFCSElement getClassObject()
/* */ throws RIFCSException
/* */ {
/* 360 */ NodeList nl = super.getElements(this.objectClass);
/* */
/* 362 */ if (nl.getLength() != 1)
/* */ {
/* 364 */ return null;
/* */ }
/* */
/* 367 */ if (this.objectClass... |
53efff51-7a74-4692-bfa9-9dd09dec49dd | 4 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
//由context parameter取得JDBC需要的資訊
ServletContext sc = this.getServletConfig().getServletContext();... |
e470d047-77d6-42e1-bb48-705918c6b261 | 5 | public MainFrame(MainController controller) {
super("Chatus");
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
int confirm = JOptionPane.showOptionDialog(null,
"Are You Sure to Close this Applic... |
c7fa04ce-923e-4285-bb52-ca3c8797c24c | 6 | private void constructionGrille () {
// creation du JPanel qui contient la grille
conteneurGrille = new JPanel();
conteneurGrille.setPreferredSize(new Dimension(420,420));
conteneurGrille.setLayout(new GridBagLayout());
//l'outil pour positionner
GridBagConstraints gbc = new GridBagConstraints();
gbc.fi... |
24226564-0c8d-4909-ab2b-0dfd3a72916d | 0 | public void setWait(){
myKeeper.setWait();
} |
05c44b8f-0816-4e7e-a835-edca2f90b9f6 | 0 | public World() {
} |
62e201d6-6fac-4324-847c-dfaba29fce2b | 4 | public static void applyFX(
DeviceType type, Mobile uses, Target applied, boolean hits
) {
final World world = uses.world() ;
if (type == null || type.hasProperty(MELEE)) {
//
// Put in a little 'splash' FX, in the direction of the arc.
final float r = uses.radius() ;
final S... |
2adbf218-6c97-423e-9752-d2352e6ad25b | 9 | public Ast.AstVector parse_PredicateList(SpecObject specObject, String property)
{
int at = m_current;
if (!ok())
{
return null;
}
Ast.AstVector node = m_ast.new AstVector();
Ast.AstPredicate pnode = parse_Predicate(specObject, property);
... |
8e50d06d-0349-4e37-a26d-475df0c3236e | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ImovelDoCorretorId other = (ImovelDoCorretorId) obj;
if (corretor == null) {
if (other.corretor != null)
return false;
} else if (!corre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.